浏览代码

feature 代码提交

xiahan 9 月之前
父节点
当前提交
fbf5a0e767

+ 3 - 1
bs-common/src/main/java/com/rongwei/safecommon/utils/CXCommonUtils.java

@@ -306,9 +306,11 @@ public class CXCommonUtils {
         }
         return currUser;
     }
+
+
     public static String getCurrentUserFactoryId(SysUserVo currentUser) {
         if(currentUser==null){
-            currentUser   = getCurrentUser();
+            currentUser = getCurrentUser();
         }
         List<SysOrganizationVo> organizationDoList = currentUser.getOrganizationDoList();
         String factoryId = organizationDoList.stream()

+ 8 - 5
cx-aps/cx-aps-common/src/main/java/com/rongwei/bscommon/sys/service/impl/ApsConflictLogServiceImpl.java

@@ -8,6 +8,7 @@ import com.rongwei.rwadmincommon.system.vo.SysUserVo;
 import com.rongwei.safecommon.utils.CXCommonUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.scheduling.annotation.Async;
 import org.springframework.stereotype.Service;
 import org.springframework.web.context.request.RequestContextHolder;
@@ -27,8 +28,9 @@ import java.util.Objects;
 public class ApsConflictLogServiceImpl extends ServiceImpl<ApsConflictLogDao, ApsConflictLogDo> implements ApsConflictLogService {
 
     private final Logger log = LoggerFactory.getLogger(this.getClass().getName());
+    @Autowired
+    private HttpServletRequest httpServletRequest;
 
-    @Async("customThreadPool")
     public void recordLog(String processequid, String aboutid,
                           String conflictname, int conflictstate, SysUserVo sysUserVo) {
         if (sysUserVo == null) {
@@ -39,13 +41,14 @@ public class ApsConflictLogServiceImpl extends ServiceImpl<ApsConflictLogDao, Ap
         apsConflictLogDo.setConflictstate(conflictstate == 1 ? "增加" : "删除");
         apsConflictLogDo.setProcessequid(processequid);
         apsConflictLogDo.setConflictname(conflictname);
-
-        HttpServletRequest request = ((ServletRequestAttributes) Objects.requireNonNull(RequestContextHolder.getRequestAttributes())).getRequest();
-        apsConflictLogDo.setOperation(request.getRequestURI());
+        apsConflictLogDo.setOperation(httpServletRequest.getRequestURI());
         apsConflictLogDo.setCreatedate(new Date());
         apsConflictLogDo.setCreateuserid(sysUserVo.getId());
         apsConflictLogDo.setCreateusername(sysUserVo.getName());
+        asyncSave(apsConflictLogDo);
+    }
+    @Async("customThreadPool")
+    public void asyncSave(ApsConflictLogDo apsConflictLogDo){
         this.save(apsConflictLogDo);
     }
-
 }

+ 3 - 0
cx-aps/cx-aps-common/src/main/java/com/rongwei/bscommon/sys/service/impl/ApsProcessOperationProcessEquServiceImpl.java

@@ -28,6 +28,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
+import javax.servlet.http.HttpServletRequest;
 import java.math.BigDecimal;
 import java.util.*;
 import java.util.concurrent.TimeUnit;
@@ -68,6 +69,8 @@ public class ApsProcessOperationProcessEquServiceImpl extends ServiceImpl<ApsPro
     private GanttService ganttService;
     @Autowired
     private ApsConflictLogServiceImpl apsConflictLogService;
+    @Autowired
+    private HttpServletRequest httpServletRequest;
 
     /**
      * 更新工序的待加工批次号信息

+ 5 - 0
cx-aps/cx-aps-entity/src/main/java/com/rongwei/bsentity/domain/ApsConflictLogDo.java

@@ -1,5 +1,8 @@
 package com.rongwei.bsentity.domain;
 
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
 import com.rongwei.rwcommon.base.BaseDo;
 import lombok.Data;
 
@@ -10,11 +13,13 @@ import lombok.Data;
  * @date 2024/10/22
  */
 @Data
+@TableName("aps_conflict_log")
 public class ApsConflictLogDo extends BaseDo {
 
     /**
      * 主键ID
      */
+    @TableId(type = IdType.AUTO)
     private String id;
     /**
      * 操作的功能描述