From 13881163217e95af96be33c6fc5ad7ceed3038ce Mon Sep 17 00:00:00 2001
From: nidapeng <jp@doumee.com>
Date: 星期四, 02 五月 2024 11:49:59 +0800
Subject: [PATCH] 最新版本

---
 server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/CompanyServiceImpl.java |   22 +++++++++++++++-------
 1 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/CompanyServiceImpl.java b/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/CompanyServiceImpl.java
index 8e15e01..e94f81f 100644
--- a/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/CompanyServiceImpl.java
+++ b/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/CompanyServiceImpl.java
@@ -75,6 +75,9 @@
             throw new BusinessException(ResponseStatus.DATA_EXISTS.getCode(), "瀵逛笉璧凤紝缁勭粐鍚嶇О涓嶈兘閲嶅~");
         }
         LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
+        if(user ==null){
+            user = company.getLoginUserInfo();
+        }
         String rootOrgId = systemDictDataBiz.queryByCode(Constants.HK_PARAM,Constants.HK_ROOTORG_CODE).getCode();
         company.setHkParentId(rootOrgId);
         if(company.getParentId() !=null){
@@ -160,7 +163,9 @@
     @Override
     public Integer createLaborServices(Company company) {
         LoginUserInfo loginUserInfo = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
-
+        if(loginUserInfo ==null){
+            loginUserInfo = company.getLoginUserInfo();
+        }
         checkUnique(company);
         Company insert = new Company();
         insert.setCreator(loginUserInfo.getId());
@@ -184,13 +189,11 @@
     }
 
     @Override
-    public void deleteById(Integer id) {
-        LoginUserInfo loginUserInfo = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
+    public void deleteById(Integer id,    LoginUserInfo user ) {
         if(id== null ){
             throw  new BusinessException(ResponseStatus.BAD_REQUEST);
         }
 
-        LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
         Company model = findById(id);
         if(model == null || Constants.equalsInteger(model.getIsdeleted(),Constants.ONE)){
             throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(), "瀵逛笉璧凤紝缁勭粐淇℃伅涓嶅瓨鍦▇");
@@ -220,13 +223,13 @@
     }
 
     @Override
-    public void deleteByIdInBatch(List<Integer> ids) {
+    public void deleteByIdInBatch(List<Integer> ids,LoginUserInfo user) {
         if (CollectionUtils.isEmpty(ids)) {
             return;
         }
         ids.stream().forEach(s->{
             Company company = new Company();
-            deleteById(s);
+            deleteById(s,user);
         });
     }
 
@@ -245,6 +248,9 @@
             throw new BusinessException(ResponseStatus.DATA_EXISTS.getCode(), "瀵逛笉璧凤紝缁勭粐鍚嶇О涓嶈兘閲嶅~");
         }
         LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
+        if(user == null){
+            user = company.getLoginUserInfo();
+        }
         Company model = findById(company.getId());
         if(model == null || Constants.equalsInteger(model.getIsdeleted(),Constants.ONE)){
             throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(), "瀵逛笉璧凤紝缁勭粐淇℃伅涓嶅瓨鍦▇");
@@ -422,7 +428,9 @@
     @Override
     public void updateStatusById(Company company) {
         LoginUserInfo loginUserInfo = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
-
+        if(loginUserInfo==null){
+            loginUserInfo = company.getLoginUserInfo()
+        }
         company.setEditDate(new Date());
         company.setEditor(loginUserInfo.getId());
         company.setStatus(company.getStatus());

--
Gitblit v1.9.3