Browse Source

项目获取当前用户所属工厂统一化处理

sucheng 10 months ago
parent
commit
77301f49ff
15 changed files with 28 additions and 25 deletions
  1. 4 4
      cx-aps/cx-aps-common/src/main/java/com/rongwei/bscommon/sys/service/impl/ApsBlankOrderServiceImpl.java
  2. 1 1
      cx-aps/cx-aps-common/src/main/java/com/rongwei/bscommon/sys/service/impl/ApsProductDetailServiceImpl.java
  3. 1 1
      cx-aps/cx-aps-common/src/main/java/com/rongwei/bscommon/sys/service/impl/ApsProductionOrderServiceImpl.java
  4. 2 2
      cx-aps/cx-aps-common/src/main/java/com/rongwei/bscommon/sys/service/impl/ApsReportOutputServiceImpl.java
  5. 3 3
      cx-aps/cx-aps-common/src/main/java/com/rongwei/bscommon/sys/service/impl/ApsReportRecordsServiceImpl.java
  6. 1 1
      cx-aps/cx-aps-common/src/main/java/com/rongwei/bscommon/sys/service/impl/ApsServiceImpl.java
  7. 1 1
      cx-aps/cx-aps-common/src/main/java/com/rongwei/bscommon/sys/service/impl/GanttServiceImpl.java
  8. 1 1
      cx-aps/cx-aps-common/src/main/java/com/rongwei/bscommon/sys/utils/ApsUtils.java
  9. 1 1
      cx-equipment/cx-equipment-common/src/main/java/com/rongwei/bscommon/sys/config/EquMaintenanceStandardListener.java
  10. 2 1
      cx-equipment/cx-equipment-common/src/main/java/com/rongwei/bscommon/sys/service/impl/EquFrockTestRecordServiceImpl.java
  11. 2 1
      cx-equipment/cx-equipment-common/src/main/java/com/rongwei/bscommon/sys/service/impl/EquOverhaulPlanningTasksServiceImpl.java
  12. 4 3
      cx-equipment/cx-equipment-common/src/main/java/com/rongwei/bscommon/sys/service/impl/MaintenanceServiceImpl.java
  13. 1 1
      cx-safe-check/cx-save-check-common/src/main/java/com/rongwei/sfcommon/sys/service/impl/AspSafeAttachmentsServiceImpl.java
  14. 3 3
      cx-safe-check/cx-save-check-common/src/main/java/com/rongwei/sfcommon/sys/service/impl/AspSafetyPerformanceAppraisalServiceImpl.java
  15. 1 1
      cx-safe-check/cx-save-check-common/src/main/java/com/rongwei/sfcommon/sys/service/impl/CheckItemsServiceImpl.java

+ 4 - 4
cx-aps/cx-aps-common/src/main/java/com/rongwei/bscommon/sys/service/impl/ApsBlankOrderServiceImpl.java

@@ -520,7 +520,7 @@ public class ApsBlankOrderServiceImpl extends ServiceImpl<ApsBlankOrderDao, ApsB
         //获取当前用户的所属工厂
         SysUserVo currentUser = CXCommonUtils.getCurrentUser();
         ApsUtils.checkScheduling(currentUser);
-        String tenantId = currentUser.getOrganizationDoList().get(0).getFullpid().split(",")[1];
+        String tenantId = CXCommonUtils.getCurrentUserFactoryId(currentUser);
 
 //        List<ApsBlankOrderVo> notLockOrders = apsBlankOrderDao.getNotLockOrders(tenantId);
         List<ApsBlankOrderVo> notLockOrders = new ArrayList<>();
@@ -1542,7 +1542,7 @@ public class ApsBlankOrderServiceImpl extends ServiceImpl<ApsBlankOrderDao, ApsB
         //获取当前用户信息
         //获取当前用户的所属工厂
         SysUserVo currentUser = CXCommonUtils.getCurrentUser();
-        String tenantId = currentUser.getOrganizationDoList().get(0).getFullpid().split(",")[1];
+        String tenantId = CXCommonUtils.getCurrentUserFactoryId(currentUser);
 
 
         //=============校验坯料长度=================
@@ -2060,7 +2060,7 @@ public class ApsBlankOrderServiceImpl extends ServiceImpl<ApsBlankOrderDao, ApsB
         //获取当前用户信息
         //获取当前用户的所属工厂
         SysUserVo currentUser = CXCommonUtils.getCurrentUser();
-        String tenantId = currentUser.getOrganizationDoList().get(0).getFullpid().split(",")[1];
+        String tenantId = CXCommonUtils.getCurrentUserFactoryId(currentUser);
 
 
         //=============校验坯料长度=================
@@ -2816,7 +2816,7 @@ public class ApsBlankOrderServiceImpl extends ServiceImpl<ApsBlankOrderDao, ApsB
 
         //当前用户所属工厂
         SysUserVo currentUser = CXCommonUtils.getCurrentUser();
-        String tenantId = currentUser.getOrganizationDoList().get(0).getFullpid().split(",")[1];
+        String tenantId = CXCommonUtils.getCurrentUserFactoryId(currentUser);
         param.setTenantId(tenantId);
 
         Page<ProductPlanReportVo> queryPage = new Page<>(current, size);

+ 1 - 1
cx-aps/cx-aps-common/src/main/java/com/rongwei/bscommon/sys/service/impl/ApsProductDetailServiceImpl.java

@@ -465,7 +465,7 @@ public class ApsProductDetailServiceImpl extends ServiceImpl<ApsProductDetailDao
     public R updateOrSaveProductDetails(List<ApsProductDetailDo> req) {
         // 当前等路人所属工厂
         SysUserVo currentUser = CXCommonUtils.getCurrentUser();
-        String tenantId = currentUser.getOrganizationDoList().get(0).getFullpid().split(",")[1];
+        String tenantId = CXCommonUtils.getCurrentUserFactoryId(currentUser);
         if (ObjectUtil.isNotEmpty(req) && req.size() > 0) {
             for (ApsProductDetailDo apsProductDetailDo : req) {
                 apsProductDetailDo.setTenantid(tenantId);

+ 1 - 1
cx-aps/cx-aps-common/src/main/java/com/rongwei/bscommon/sys/service/impl/ApsProductionOrderServiceImpl.java

@@ -328,7 +328,7 @@ public class ApsProductionOrderServiceImpl extends ServiceImpl<ApsProductionOrde
         if (req.getIsNeedSave()) {
             //获取当前用户的所属工厂
             SysUserVo currentUser = CXCommonUtils.getCurrentUser();
-            String tenantId = currentUser.getOrganizationDoList().get(0).getFullpid().split(",")[1];
+            String tenantId = CXCommonUtils.getCurrentUserFactoryId(currentUser);
 
             //保存主表信息
             apsProductionOrderDo.setTenantid(tenantId);

+ 2 - 2
cx-aps/cx-aps-common/src/main/java/com/rongwei/bscommon/sys/service/impl/ApsReportOutputServiceImpl.java

@@ -203,7 +203,7 @@ public class ApsReportOutputServiceImpl extends ServiceImpl<ApsReportOutputDao,
         //获取当前用户信息
         //获取当前用户的所属工厂
         SysUserVo currentUser = CXCommonUtils.getCurrentUser();
-        String tenantId = currentUser.getOrganizationDoList().get(0).getFullpid().split(",")[1];
+        String tenantId = CXCommonUtils.getCurrentUserFactoryId(currentUser);
         for (ApsReportOutputDo apsReportOutputDo : resList) {
             apsReportOutputDo.setTenantid(tenantId);
         }
@@ -317,7 +317,7 @@ public class ApsReportOutputServiceImpl extends ServiceImpl<ApsReportOutputDao,
 //        //获取当前用户信息
 //        //获取当前用户的所属工厂
 //        SysUserVo currentUser = CXCommonUtils.getCurrentUser();
-//        String tenantId = currentUser.getOrganizationDoList().get(0).getFullpid().split(",")[1];
+//        String tenantId = CXCommonUtils.getCurrentUserFactoryId(currentUser);
 //        for (ApsReportOutputDo apsReportOutputDo : resList) {
 //            apsReportOutputDo.setTenantid(tenantId);
 //        }

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

@@ -366,7 +366,7 @@ public class ApsReportRecordsServiceImpl extends ServiceImpl<ApsReportRecordsDao
 
         //获取当前用户相关信息
         SysUserVo currentUser = CXCommonUtils.getCurrentUser();
-        String tenantId = currentUser.getOrganizationDoList().get(0).getFullpid().split(",")[1];
+        String tenantId = CXCommonUtils.getCurrentUserFactoryId(currentUser);
 
         //查询此工序对应工艺步骤中,对应设备的设备参数
         String equparames = "";
@@ -988,7 +988,7 @@ public class ApsReportRecordsServiceImpl extends ServiceImpl<ApsReportRecordsDao
             workInProgressInventoryDo.setId(SecurityUtil.getUUID());
             //获取当前用户相关信息
             SysUserVo currentUser = CXCommonUtils.getCurrentUser();
-            String tenantId = currentUser.getOrganizationDoList().get(0).getFullpid().split(",")[1];
+            String tenantId = CXCommonUtils.getCurrentUserFactoryId(currentUser);
             workInProgressInventoryDo.setTenantid(tenantId);
             //报工输出物料的批次号
             workInProgressInventoryDo.setBlankbatchnumber(apsReportOutputDo.getOutputnumber());
@@ -1093,7 +1093,7 @@ public class ApsReportRecordsServiceImpl extends ServiceImpl<ApsReportRecordsDao
 
         //当前登录用户信息
         SysUserVo currentUser = CXCommonUtils.getCurrentUser();
-        String tenantId = currentUser.getOrganizationDoList().get(0).getFullpid().split(",")[1];
+        String tenantId = CXCommonUtils.getCurrentUserFactoryId(currentUser);
 
         //查询此工序对应工艺步骤中,对应设备的设备参数
         String equparames = "";

+ 1 - 1
cx-aps/cx-aps-common/src/main/java/com/rongwei/bscommon/sys/service/impl/ApsServiceImpl.java

@@ -86,7 +86,7 @@ public class ApsServiceImpl implements ApsService {
         if(currentUser == null){
             currentUser = CXCommonUtils.getCurrentUser();
         }
-        String tenantId = currentUser.getOrganizationDoList().get(0).getFullpid().split(",")[1];
+        String tenantId = CXCommonUtils.getCurrentUserFactoryId(currentUser);
         if (StringUtils.isBlank(tenantId)) {
             throw new CustomException("所属工厂不能为空");
         }

+ 1 - 1
cx-aps/cx-aps-common/src/main/java/com/rongwei/bscommon/sys/service/impl/GanttServiceImpl.java

@@ -150,7 +150,7 @@ public class GanttServiceImpl implements GanttService {
         log.info("开始获取排程状态");
         if (StringUtils.isBlank(factoryId)) {
             SysUserVo currentUser = CXCommonUtils.getCurrentUser();
-            factoryId = currentUser.getOrganizationDoList().get(0).getFullpid().split(",")[1];
+            factoryId = CXCommonUtils.getCurrentUserFactoryId(currentUser);
         }
         log.debug("判断工厂:{}是否正在排程", factoryId);
         RLock rLock = redissonClient.getLock(factoryId);

+ 1 - 1
cx-aps/cx-aps-common/src/main/java/com/rongwei/bscommon/sys/utils/ApsUtils.java

@@ -69,7 +69,7 @@ public class ApsUtils {
         if(currentUser==null){
             currentUser = CXCommonUtils.getCurrentUser();
         }
-        String tenantId = currentUser.getOrganizationDoList().get(0).getFullpid().split(",")[1];
+        String tenantId = CXCommonUtils.getCurrentUserFactoryId(currentUser);
         if (StringUtils.isBlank(tenantId)) {
             throw new CustomException("当前用户所属工厂信息为空");
         }

+ 1 - 1
cx-equipment/cx-equipment-common/src/main/java/com/rongwei/bscommon/sys/config/EquMaintenanceStandardListener.java

@@ -82,7 +82,7 @@ public class EquMaintenanceStandardListener extends AnalysisEventListener<EquMai
                 .setCreatedate(date)
                 .setModifydate(date)
                 .setId(SecurityUtil.getUUID())
-                // .setTenantid(currentUser.getOrganizationDoList().get(0).getFullpid().split(",")[1])
+                // .setTenantid(CXCommonUtils.getCurrentUserFactoryId(currentUser))
                 .setTenantid(PlantEnum.idOf(equMaintenanceStandardTemplate.getPlantName()))
                 .setPlant(equMaintenanceStandardTemplate.getPlantName())
                 //                .setTenantid("0001S31000000000J0TR")

+ 2 - 1
cx-equipment/cx-equipment-common/src/main/java/com/rongwei/bscommon/sys/service/impl/EquFrockTestRecordServiceImpl.java

@@ -13,6 +13,7 @@ import com.rongwei.rwadmincommon.system.vo.SysUserVo;
 import com.rongwei.rwcommon.base.R;
 import com.rongwei.rwcommon.utils.SecurityUtil;
 import com.rongwei.rwcommon.utils.StringUtils;
+import com.rongwei.safecommon.utils.CXCommonUtils;
 import org.apache.poi.ss.usermodel.DataFormatter;
 import org.apache.poi.ss.usermodel.Row;
 import org.apache.poi.ss.usermodel.Sheet;
@@ -164,7 +165,7 @@ public class EquFrockTestRecordServiceImpl extends ServiceImpl<EquFrockTestRecor
                     allStrBuilder.append("第").append(i + 1).append("行").append(stringBuilder).append("<br>");
                 } else {
                     equFrockTestRecordDo.setId(SecurityUtil.getUUID())
-                            .setTenantid(currentUser.getOrganizationDoList().get(0).getFullpid().split(",")[1])
+                            .setTenantid(CXCommonUtils.getCurrentUserFactoryId(currentUser))
                             .setCreatedate(date)
                             .setModifydate(date)
                             .setCreateusername(currentUser.getName())

+ 2 - 1
cx-equipment/cx-equipment-common/src/main/java/com/rongwei/bscommon/sys/service/impl/EquOverhaulPlanningTasksServiceImpl.java

@@ -18,6 +18,7 @@ import com.rongwei.rwadmincommon.system.vo.SysUserVo;
 import com.rongwei.rwcommon.base.R;
 import com.rongwei.rwcommon.utils.SecurityUtil;
 import com.rongwei.rwcommon.utils.StringUtils;
+import com.rongwei.safecommon.utils.CXCommonUtils;
 import org.apache.poi.ss.usermodel.Row;
 import org.apache.poi.ss.usermodel.Sheet;
 import org.apache.poi.ss.usermodel.Workbook;
@@ -74,7 +75,7 @@ public class EquOverhaulPlanningTasksServiceImpl extends ServiceImpl<EquOverhaul
             for (int i = 1; i <= lastRowNum; i++) {
                 StringBuilder stringBuilder = new StringBuilder();
                 String taskNumber = "";
-                String factoryId = currentUser.getOrganizationDoList().get(0).getFullpid().split(",")[1];
+                String factoryId = CXCommonUtils.getCurrentUserFactoryId(currentUser);
                 List<SysOrganizationVo> resultList = factoryList.stream().filter(p -> p.getId().equals(factoryId)).collect(Collectors.toList());
                 String factory = resultList.get(0).getFullname();
                 EquOverhaulPlanningTasksDo equOverhaulPlanningTasksDo = new EquOverhaulPlanningTasksDo();

+ 4 - 3
cx-equipment/cx-equipment-common/src/main/java/com/rongwei/bscommon/sys/service/impl/MaintenanceServiceImpl.java

@@ -20,6 +20,7 @@ import com.rongwei.rwadmincommon.system.vo.SysUserVo;
 import com.rongwei.rwcommon.base.R;
 import com.rongwei.rwcommon.utils.SecurityUtil;
 import com.rongwei.rwcommonentity.commonservers.vo.SysSerialVo;
+import com.rongwei.safecommon.utils.CXCommonUtils;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -296,7 +297,7 @@ public class MaintenanceServiceImpl implements MaintenanceService {
                 Object data = serialNumberCode.getData();
                 maintenanceStandard.setStandardid(JSONObject.parseObject(JSONObject.toJSONString(data), Map.class).get("code").toString());
             }
-            maintenanceStandard.setTenantid(currentUser.getOrganizationDoList().get(0).getFullpid().split(",")[1])
+            maintenanceStandard.setTenantid(CXCommonUtils.getCurrentUserFactoryId(currentUser))
                     .setCreatedate(date)
                     .setModifydate(date)
                     .setCreateuserid(currentUser.getId())
@@ -439,7 +440,7 @@ public class MaintenanceServiceImpl implements MaintenanceService {
         // 遍历计划部位
         for (EquMaintenancePartDo maintenancePart : maintenancePartList) {
             SysSerialVo sysSerialVo = new SysSerialVo();
-            // String plantSimp = PlantEnum.addrOf(currentUser.getOrganizationDoList().get(0).getFullpid().split(",")[1]);
+            // String plantSimp = PlantEnum.addrOf(CXCommonUtils.getCurrentUserFactoryId(currentUser));
             String plantSimp = PlantEnum.addrOf(maintenancePart.getTenantid());
             sysSerialVo.setModulecode("equ_maintenance_task_aq_code_" + plantSimp);
             sysSerialVo.setResetrule("date:yyyy");
@@ -497,7 +498,7 @@ public class MaintenanceServiceImpl implements MaintenanceService {
                             .setModifyuserid(currentUser.getId())
                             .setModifyusername(currentUser.getName())
                             .setModifydate(newDate)
-                            .setTenantid(currentUser.getOrganizationDoList().get(0).getFullpid().split(",")[1]);
+                            .setTenantid(CXCommonUtils.getCurrentUserFactoryId(currentUser));
                     return equPartsSetoutTaskDo;
                 }).collect(Collectors.toList())).flatMap(Collection::stream).distinct().collect(Collectors.toList());
     }

+ 1 - 1
cx-safe-check/cx-save-check-common/src/main/java/com/rongwei/sfcommon/sys/service/impl/AspSafeAttachmentsServiceImpl.java

@@ -263,7 +263,7 @@ public class AspSafeAttachmentsServiceImpl extends ServiceImpl<AspSafeAttachment
         List<AspSafeAttachmentsDo> saveList = new ArrayList<>();
         ImportAspSafeAttachmentsVo importAspSafeAttachmentsVo;
         SysUserVo currentUser = CXCommonUtils.getCurrentUser();
-        String tenantId = currentUser.getOrganizationDoList().get(0).getFullpid().split(",")[1];
+        String tenantId = CXCommonUtils.getCurrentUserFactoryId(currentUser);
         //获取区域信息
         Map<String, String> checkAreaMap = saveCheckCommonDao.getCheckArea(tenantId).stream().collect(Collectors.toMap(CheckAreaVo::getName, CheckAreaVo::getId, (v1, v2) -> v1));
         // 获取组织机构信息

+ 3 - 3
cx-safe-check/cx-save-check-common/src/main/java/com/rongwei/sfcommon/sys/service/impl/AspSafetyPerformanceAppraisalServiceImpl.java

@@ -245,7 +245,7 @@ public class AspSafetyPerformanceAppraisalServiceImpl extends ServiceImpl<AspSaf
             main.setModifydate(date);
             //获取当前用户的tenantId
 //            main.setTenantid(currentUser.getTenantid());
-            main.setTenantid(currentUser.getOrganizationDoList().get(0).getFullpid().split(",")[1]);
+            main.setTenantid(CXCommonUtils.getCurrentUserFactoryId(currentUser));
             this.save(main);
 
             List<AspSafetyPerformanceAppraisalDetail> res = new ArrayList<>();
@@ -456,7 +456,7 @@ public class AspSafetyPerformanceAppraisalServiceImpl extends ServiceImpl<AspSaf
                     detail.setModifydate(date);
                     //获取当前用户的tenantId
 //                  detail.setTenantid(currentUser.getTenantid());
-                    detail.setTenantid(currentUser.getOrganizationDoList().get(0).getFullpid().split(",")[1]);
+                    detail.setTenantid(CXCommonUtils.getCurrentUserFactoryId(currentUser));
 
                     res.add(detail);
                 } else {
@@ -611,7 +611,7 @@ public class AspSafetyPerformanceAppraisalServiceImpl extends ServiceImpl<AspSaf
                     detail.setModifydate(date);
                     //获取当前用户的tenantId
 //                  detail.setTenantid(currentUser.getTenantid());
-                    detail.setTenantid(currentUser.getOrganizationDoList().get(0).getFullpid().split(",")[1]);
+                    detail.setTenantid(CXCommonUtils.getCurrentUserFactoryId(currentUser));
 
                     res.add(detail);
                 }

+ 1 - 1
cx-safe-check/cx-save-check-common/src/main/java/com/rongwei/sfcommon/sys/service/impl/CheckItemsServiceImpl.java

@@ -359,7 +359,7 @@ public class CheckItemsServiceImpl extends ServiceImpl<CheckItemsDao, CheckItems
         List<CheckItemsDo> saveList = new ArrayList<>();
         ImportCheckItemsVo importCheckItemsVo;
         SysUserVo currentUser = CXCommonUtils.getCurrentUser();
-        String tenantId = currentUser.getOrganizationDoList().get(0).getFullpid().split(",")[1];
+        String tenantId = CXCommonUtils.getCurrentUserFactoryId(currentUser);
         //获取区域信息
         Map<String, String> checkAreaMap = saveCheckCommonDao.getCheckArea(tenantId).stream().collect(Collectors.toMap(CheckAreaVo::getName, CheckAreaVo::getId, (v1, v2) -> v1));
         // 获取组织机构信息