瀏覽代碼

Merge remote-tracking branch 'origin/master'

zhangcl 2 月之前
父節點
當前提交
8b4d1ecdb2

+ 3 - 3
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/dal/mysql/iotopeationfill/IotOpeationFillMapper.java

@@ -53,16 +53,16 @@ public interface IotOpeationFillMapper extends BaseMapperX<IotOpeationFillDO> {
     @TenantIgnore
     List<IotOpeationFillDO> getFillDevices();
     @TenantIgnore
-    List<IotOpeationFillDO> getFillDevices1(Long[] deviceIds);
+    List<IotOpeationFillDO> getFillDevices1(@Param("deviceIds") List<Long> deviceIds);
     List<IotModelTemplateAttrsDO> getAttrsById(IotModelTemplateAttrsRespVO vo);
     int insertFill(List<IotOpeationFillDO> vo);
     int insertFillOrder(List<IotOpeationFillDO> vo);
     @TenantIgnore
     List<IotOpeationFillDO> fillList(IotOpeationFillPageReqVO vo);
     @TenantIgnore
-    List<IotOpeationFillDO> fills(Long[] deviceIds);
+    List<IotOpeationFillDO> fills(@Param("deviceIds")List<Long> deviceIds);
     @TenantIgnore
-    int upFill(Long[] deviceIds);
+    int upFill(@Param("deptId")Long deptId,@Param("deviceIds")List<Long> deviceIds);
     @TenantIgnore
     List<IotOpeationFillDO> fillListByUserId(IotOpeationFillRespVO vo);
     @TenantIgnore

+ 1 - 2
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/job/InspectCreateOrderJob.java

@@ -2,7 +2,6 @@ package cn.iocoder.yudao.module.pms.job;
 
 import cn.hutool.core.date.DateTime;
 import cn.hutool.core.date.DateUtil;
-import cn.iocoder.yudao.framework.common.exception.ServiceException;
 import cn.iocoder.yudao.framework.datapermission.core.annotation.DataPermission;
 import cn.iocoder.yudao.framework.quartz.core.handler.JobHandler;
 import cn.iocoder.yudao.framework.tenant.core.aop.TenantIgnore;
@@ -64,7 +63,7 @@ public class InspectCreateOrderJob implements JobHandler {
     private void deal(IotInspectPlanDO plan, Date date) {
         Date date1 = new Date();
         if ("hour".equals(plan.getPlanUnit())){
-            DateTime dateTime = DateUtil.offsetHour(date, Integer.parseInt(StringUtils.substringBeforeLast(String.valueOf(plan.getPlanCycle()),".")));
+            DateTime dateTime = DateUtil.offsetMinute(date, Integer.parseInt(StringUtils.substringBeforeLast(String.valueOf(plan.getPlanCycle()),".")));
             if (date1.compareTo(dateTime) > 0){
                 iotInspectOrderService.createPlan(plan);
             }

+ 3 - 1
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/service/failure/IotFailureReportServiceImpl.java

@@ -234,7 +234,9 @@ public class IotFailureReportServiceImpl implements IotFailureReportService {
         failureReportDOS.forEach(failureReport -> {
             failureReport.setDeptId(deptId);
         });
-        iotFailureReportMapper.updateBatch(failureReportDOS);
+        if(failureReportDOS.size()>0){
+            iotFailureReportMapper.updateBatch(failureReportDOS);
+        }
     }
 
 }

+ 5 - 6
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/service/inspect/IotInspectOrderServiceImpl.java

@@ -19,9 +19,6 @@ import cn.iocoder.yudao.module.pms.dal.mysql.inspect.IotInspectOrderMapper;
 import cn.iocoder.yudao.module.pms.dal.mysql.inspect.IotInspectPlanMapper;
 import cn.iocoder.yudao.module.pms.message.PmsMessage;
 import cn.iocoder.yudao.module.pms.service.iotdeviceperson.IotDevicePersonService;
-import cn.iocoder.yudao.module.system.api.dingtalk.DingtalkSendApi;
-import cn.iocoder.yudao.module.system.api.notify.NotifyMessageSendApi;
-import cn.iocoder.yudao.module.system.api.notify.dto.NotifySendSingleToUserReqDTO;
 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.service.dept.DeptService;
@@ -36,6 +33,7 @@ import org.springframework.validation.annotation.Validated;
 import javax.annotation.Resource;
 import java.time.LocalDateTime;
 import java.util.*;
+import java.util.concurrent.CompletableFuture;
 import java.util.stream.Collectors;
 
 import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
@@ -277,9 +275,10 @@ public class IotInspectOrderServiceImpl implements IotInspectOrderService {
                 iotInspectPlan.setLastCreateTime(LocalDateTime.now());
                 iotInspectPlanMapper.updateById(iotInspectPlan);
             });
-
-            //发送消息
-            pmsMessage.sendMessage(iotInspectOrderDO.getId(), iotInspectOrderDO.getInspectOrderTitle(), PmsConstants.GENERATE_INSPECT, k, user.getMobile());
+            CompletableFuture.runAsync(()->{
+                //发送消息
+                pmsMessage.sendMessage(iotInspectOrderDO.getId(), iotInspectOrderDO.getInspectOrderTitle(), PmsConstants.GENERATE_INSPECT, k, user.getMobile());
+            });
         });
     }
 

+ 2 - 64
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/service/iotopeationfill/IotOpeationFillServiceImpl.java

@@ -127,72 +127,10 @@ public class IotOpeationFillServiceImpl implements IotOpeationFillService {
         /**
          * 1、判断设备
          */
-        Long[] deviceId = (Long[]) deviceIds.toArray();
 
-        List<IotOpeationFillDO> fills = iotOpeationFillMapper.fills(deviceId);
+        List<IotOpeationFillDO> fills = iotOpeationFillMapper.fills(deviceIds);
         if(fills.size()>0){
-            iotOpeationFillMapper.upFill(deviceId);
-        }
-
-        List<IotOpeationFillDO> fillDOS = iotOpeationFillMapper.getFillDevices1(deviceId);
-        List<IotOpeationFillDO> rhList = iotOpeationFillMapper.rhList();
-        List<IotOpeationFillDO> rdList = iotOpeationFillMapper.rdList();
-        List<IotOpeationFillDO> ryList = iotOpeationFillMapper.ryList();
-        List<IotOpeationFillOrderDO> orderList = new ArrayList<>();
-
-        if(fillDOS.size()>0){
-
-            for (IotOpeationFillDO fillDO:fillDOS) {
-
-                IotOpeationFillOrderDO fill = new IotOpeationFillOrderDO();
-
-                boolean exists = rhList.stream()
-                        .anyMatch(rh -> rh.getId().equals(fillDO.getDeptId()));
-                if(exists){
-                    fillDO.setOrderName("瑞恒兴域"+ LocalDate.now()+"运行记录填报");
-                    fillDO.setDeptId(fillDO.getDeptId());
-                    fillDO.setOrderStatus(0);
-                    fillDO.setCreateTime(LocalDateTime.now());
-                    fillDO.setUserName(fillDO.getUserName());
-                    fillDO.setUserId(fillDO.getUserId());
-                    orderList.add(fill);
-                }
-
-                boolean exists1 = rdList.stream()
-                        .anyMatch(rd -> rd.getId().equals(fillDO.getDeptId()));
-
-                if(exists1){
-                    fillDO.setOrderName("瑞都石油"+LocalDate.now()+"运行记录填报");
-                    fillDO.setDeptId(fillDO.getDeptId());
-                    fillDO.setOrderStatus(0);
-                    fillDO.setCreateTime(LocalDateTime.now());
-                    fillDO.setUserName(fillDO.getUserName());
-                    fillDO.setUserId(fillDO.getUserId());
-                    orderList.add(fill);
-                }
-
-                boolean exists2 = ryList.stream()
-                        .anyMatch(ry -> ry.getId().equals(fillDO.getDeptId()));
-
-                if(exists2){
-                    fillDO.setOrderName("瑞鹰国际"+LocalDate.now()+"运行记录填报");
-                    fillDO.setDeptId(fillDO.getDeptId());
-                    fillDO.setOrderStatus(0);
-                    fillDO.setCreateTime(LocalDateTime.now());
-                    fillDO.setUserName(fillDO.getUserName());
-                    fillDO.setUserId(fillDO.getUserId());
-                    orderList.add(fill);
-                }
-            }
-
-            iotOpeationFillOrderMapper.insertBatch(orderList);
-
-            for (IotOpeationFillDO device:fillDOS) {
-                for (IotOpeationFillOrderDO order:orderList) {
-                    device.setOrderId(order.getId());
-                }
-            }
-            iotOpeationFillMapper.insertFill(fillDOS);
+            iotOpeationFillMapper.upFill(deptId,deviceIds);
         }
     }
 

+ 5 - 2
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/service/maintain/IotMaintainServiceImpl.java

@@ -376,8 +376,11 @@ public class IotMaintainServiceImpl implements IotMaintainService {
     @Override
     public void syncWordOrderData(List<Long> deviceIds, Long deptId) {
         List<IotMaintainDO> maintainDOS = iotMaintainMapper.selectByStatusAndAuditStatusAndDeviceId("finished", 20, deviceIds);
-        maintainDOS.forEach(maintainDO -> maintainDO.setDeptId(deptId));
-        iotMaintainMapper.updateBatch(maintainDOS);
+        if(maintainDOS.size()>0){
+            maintainDOS.forEach(maintainDO -> maintainDO.setDeptId(deptId));
+            iotMaintainMapper.updateBatch(maintainDOS);
+        }
+
     }
 
 

+ 29 - 18
yudao-module-pms/yudao-module-pms-biz/src/main/resources/mapper/static/IotOpeationFillMapper.xml

@@ -59,10 +59,12 @@
             c.id = d.device_id
           and
             c.device_status in ('sg','dm')
-          and c.device_id in
-        <foreach item="deviceId" collection="array" open="(" separator="," close=")">
-            #{deviceId}
-        </foreach>
+        <if test="deviceIds != null and !deviceIds.isEmpty()">
+            and c.id in
+            <foreach collection="deviceIds" item="id" open="(" separator="," close=")">
+                #{id}
+            </foreach>
+        </if>
     </select>
 
 
@@ -130,17 +132,22 @@
         SELECT * FROM
         rqiot.rq_iot_opeation_fill
         WHERE 1=1
-        and c.device_id in
-        <foreach item="deviceId" collection="array" open="(" separator="," close=")">
-            #{deviceId}
-        </foreach>
+        <if test="deviceIds != null and !deviceIds.isEmpty()">
+            and device_id  in
+            <foreach collection="deviceIds" item="id" open="(" separator="," close=")">
+                #{id}
+            </foreach>
+        </if>
     </select>
 
     <update id="upFill" parameterType="cn.iocoder.yudao.module.pms.dal.dataobject.iotopeationfill.IotOpeationFillDO">
-        update rqiot.rq_iot_opeation_fill set dept_id = #{deptId} where device_id in
-        <foreach item="id" collection="array" open="(" separator="," close=")">
-            #{deviceId}
-        </foreach>
+        update rqiot.rq_iot_opeation_fill set dept_id = #{deptId} where 1=1
+        <if test="deviceIds != null and !deviceIds.isEmpty()">
+            and device_id  in
+            <foreach collection="deviceIds" item="id" open="(" separator="," close=")">
+                #{id}
+            </foreach>
+        </if>
     </update>
 
 
@@ -152,19 +159,23 @@
 
     <select id="fillListByUserId" parameterType="cn.iocoder.yudao.module.pms.controller.admin.iotopeationfill.vo.IotOpeationFillRespVO"
             resultType="cn.iocoder.yudao.module.pms.dal.dataobject.iotopeationfill.IotOpeationFillDO">
-        select
+            select
             distinct
             a.*,
             b.name org_name
-        from
+            from
             rq_iot_opeation_fill a,
             system_dept b,
-            rqiot.rq_iot_model_template_attrs c
-        where
+            rqiot.rq_iot_model_template_attrs c,
+            rq_iot_opeation_fill_order d
+            where
             a.dept_id = b.id
-          and
+            and
             a.device_category_id = c.device_category_id
-
+            and
+            a.order_id = d.id
+            and
+            a.dept_id = d.dept_id
             <if test="orderId != null  and orderId != ''">
                 and a.order_id = #{orderId}
             </if>

+ 1 - 1
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/dept/vo/dept/DeptSaveReqVO.java

@@ -20,7 +20,7 @@ public class DeptSaveReqVO {
 
     @Schema(description = "部门名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋道")
     @NotBlank(message = "部门名称不能为空")
-    @Size(max = 30, message = "部门名称长度不能超过 30 个字符")
+//    @Size(max = 30, message = "部门名称长度不能超过 30 个字符")
     private String name;
 
     @Schema(description = "父部门 ID", example = "1024")