Ver código fonte

pms 瑞恒日报 调试bug。

zhangcl 1 semana atrás
pai
commit
bae0d81f02

+ 20 - 6
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/service/iotrhdailyreport/IotRhDailyReportServiceImpl.java

@@ -1,5 +1,6 @@
 package cn.iocoder.yudao.module.pms.service.iotrhdailyreport;
 
+import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.collection.CollUtil;
 import cn.hutool.core.date.DatePattern;
 import cn.hutool.core.date.LocalDateTimeUtil;
@@ -35,6 +36,8 @@ import cn.iocoder.yudao.module.pms.job.IotDeviceCarFuelVO;
 import cn.iocoder.yudao.module.pms.message.PmsMessage;
 import cn.iocoder.yudao.module.pms.util.ZHBDUtil;
 import cn.iocoder.yudao.module.supplier.enums.common.SupplierAuditStatusEnum;
+import cn.iocoder.yudao.module.system.api.dept.DeptApi;
+import cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO;
 import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
 import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
 import cn.iocoder.yudao.module.system.controller.admin.dept.vo.dept.DeptListReqVO;
@@ -119,6 +122,8 @@ public class IotRhDailyReportServiceImpl implements IotRhDailyReportService {
     private ThreadPoolTaskExecutor pmsThreadPoolTaskExecutor;
     @Resource
     private PmsMessage pmsMessage;
+    @Resource
+    private DeptApi deptApi;
 
     @Override
     @Transactional(rollbackFor = Exception.class)
@@ -135,14 +140,19 @@ public class IotRhDailyReportServiceImpl implements IotRhDailyReportService {
             throw exception(IOT_RH_DAILY_REPORT_NO_DEPT);
         }
 
-        DeptDO currentDept = deptService.getDept(deptId);
+        // DeptDO currentDept = deptService.getDept(deptId);
+        DeptRespDTO currentDept = deptApi.getDept(deptId);
         // 队伍下设备非施工状态,新增时需要向填报人发送 消息提醒
         // 查询当前队伍下的设备的施工状态 如果是非施工,就需要向 日报 创建人发送钉钉消息
         List<DeptDO> teams = new ArrayList<>();
-        teams.add(currentDept);
+        BeanUtil.toBean(currentDept, DeptDO.class);
+        DeptDO dept = new DeptDO();
+        dept.setId(currentDept.getId());
+        dept.setName(currentDept.getName());
+        teams.add(dept);
         // 查询增压机状态为非施工的小队
         List<IotDeviceDO> teamStatusL = iotOpeationFillMapper.selectDevStatusBatch(teams);
-        System.out.println("无施工设备的队伍:" + currentDept.getName());
+        // System.out.println("无施工设备的队伍:" + currentDept.getName());
 
         // 设置 日报填写状态 审核状态
         iotRhDailyReport.setStatus(1);
@@ -395,8 +405,12 @@ public class IotRhDailyReportServiceImpl implements IotRhDailyReportService {
         // 暂时添加判断条件 创建人 是 null 的话 不发送 站内信及钉钉消息
         if (StrUtil.isNotBlank(iotRhDailyReport.getCreator()) && !noDeviceTeam.get()) {
 
-            DeptDO dept = deptService.getDept(deptId);
-            Long parentId = dept.getParentId();
+            DeptRespDTO msgDept = deptApi.getDept(deptId);
+            DeptDO deptDO = new DeptDO();
+            deptDO.setId(msgDept.getId());
+            deptDO.setName(msgDept.getName());
+            deptDO.setParentId(msgDept.getParentId());
+            Long parentId = deptDO.getParentId();
             if (ObjUtil.isNotEmpty(parentId)) {
                 AtomicReference<DeptDO> projectDept = new AtomicReference<>();
                 DataPermissionUtils.executeIgnore(() -> {
@@ -433,7 +447,7 @@ public class IotRhDailyReportServiceImpl implements IotRhDailyReportService {
                                         // 给多个用户发送 相同 的 提醒消息
                                         if (CollUtil.isNotEmpty(users)) {
                                             // 生成消息提醒标题 部门名称-井号
-                                            String msgTitle = dept.getName();
+                                            String msgTitle = deptDO.getName();
                                             if (StrUtil.isNotBlank(wellName)) {
                                                 msgTitle = StrUtil.join("-", msgTitle, wellName);
                                             }