Ver Fonte

feat(screen): 重构大屏设备颜色显示规则

- 颜色优先级调整为黄>红>蓝,一台设备只显示一种颜色
- 黄色改为有进行中报修单的设备,新增转派审批中和委外维修中状态
- 红色改为停机(停用中)且无进行中报修单的设备
- 查询设备列表时增加status字段用于判断停机状态
- 维修申请单增加完成时间不能早于开始时间的校验
dazhaxie há 1 semana atrás
pai
commit
2980679950

+ 5 - 0
platform-dao/src/main/java/com/platform/dao/vo/sb/SbInfoScreenDetailVO.java

@@ -40,5 +40,10 @@ public class SbInfoScreenDetailVO extends BaseVO implements Serializable {
      */
     private Integer level;
 
+    /**
+     * 设备状态:见 SbInfoStatusEnum,7-停用中(大屏显示红色)
+     */
+    private Integer status;
+
     private String mapName;
 }

+ 2 - 2
platform-dao/src/main/java/com/platform/dao/vo/sb/SbInfoScreenVO.java

@@ -25,12 +25,12 @@ import java.util.List;
 public class SbInfoScreenVO extends BaseVO implements Serializable {
     private List<SbInfoScreenDetailVO> normalSbInfoList;
     /**
-     * 非计划性报修 红色
+     * 停机(停用中)设备 红色,已排除有进行中报修单的设备
      *
      */
     private List<SbInfoScreenDetailVO> repairSbInfoListRed;
     /**
-     * 计划性报修 黃色
+     * 有进行中报修单的设备 黃色(优先级高于停机红色)
      *
      */
     private List<SbInfoScreenDetailVO> repairSbInfoListYellow;

+ 1 - 1
platform-dao/src/main/resources/mapper/sb/SbInfoMapper.xml

@@ -464,7 +464,7 @@ user.real_name as saveUserName
             parameterType="com.platform.dao.dto.sb.SbInfoDTO"
             resultType="com.platform.dao.vo.sb.SbInfoScreenDetailVO">
         select
-        sb.id, sb.no, sb.zjm, sb.jbdh, sb.level,sb.map_name
+        sb.id, sb.no, sb.zjm, sb.jbdh, sb.level, sb.status,sb.map_name
         from t_sb_info sb
         <where>
             sb.zjm is not null

+ 13 - 1
platform-service/src/main/java/com/platform/service/repair/impl/RepairApplicationFormServiceImpl.java

@@ -1032,6 +1032,11 @@ public class RepairApplicationFormServiceImpl
             applicationForm.setRepairEndTime(LocalDateTime.now());
         }
         if (dto.getRepairEndTime() != null) {
+            // 校验:完成时间不能早于维修开始时间
+            if (applicationForm.getRepairStartTime() != null
+                    && dto.getRepairEndTime().isBefore(applicationForm.getRepairStartTime())) {
+                throw new BusinessException("完成时间不能早于维修开始时间");
+            }
             applicationForm.setRepairEndTime(dto.getRepairEndTime());
         }
         applicationForm.setAssistantStatus(RepairAssistantStatusEnum.end.getValue());
@@ -1760,7 +1765,14 @@ public class RepairApplicationFormServiceImpl
     public void change(RepairApplicationFormDTO dto) {
 
         RepairApplicationForm applicationForm = mapper.selectById(dto.getId());
-        // 判断时间是否先后顺序
+        // 校验:完成时间不能早于维修开始时间
+        if (dto.getRepairEndTime() != null) {
+            LocalDateTime effectiveStart = dto.getRepairStartTime() != null
+                    ? dto.getRepairStartTime() : applicationForm.getRepairStartTime();
+            if (effectiveStart != null && dto.getRepairEndTime().isBefore(effectiveStart)) {
+                throw new BusinessException("完成时间不能早于维修开始时间");
+            }
+        }
         applicationForm.setCategory(dto.getCategory());
         if (dto.getRepairStartTime() != null) {
             applicationForm.setRepairStartTime(dto.getRepairStartTime());

+ 22 - 25
platform-service/src/main/java/com/platform/service/sb/impl/SbInfoServiceImpl.java

@@ -236,9 +236,9 @@ public class SbInfoServiceImpl extends BaseServiceImpl<SbInfoMapper, SbInfo, SbI
     /**
      * 获取大屏显示的有异常的设备
      * 1:显示字段为true的进行显示
-     * 2:有报修的都要显示
-     * 3:红色:非计划性维修的设备
-     * 黄色:计划性维修的设备
+     * 2:颜色优先级:黄 > 红 > 蓝,一台设备只显示一种颜色
+     * 黄色:有待接收/维修中/转派审批中/委外维修中报修单的设备,报修单提交验收或完成后恢复
+     * 红色:停机(停用中)且没有进行中报修单的设备
      * 蓝色:正常的设备
      *
      * @param model
@@ -250,41 +250,37 @@ public class SbInfoServiceImpl extends BaseServiceImpl<SbInfoMapper, SbInfo, SbI
         // 选择所有显示的设备
         List<SbInfoScreenDetailVO> sbInfoList = selectScreenDetailVOList(model);
 
-        // 判断是否有待分配的报修记录,也就是新增的报修
+        // 判断是否有还没修好的报修记录:待接收、维修中、转派审批中、委外维修中
         List<String> ids = sbInfoList.stream().map(SbInfoScreenDetailVO::getId).collect(Collectors.toList());
         Weekend<RepairApplicationForm> weekendRepair = new Weekend<>(RepairApplicationForm.class);
         WeekendCriteria<RepairApplicationForm, Object> weekendCriteria = weekendRepair.weekendCriteria();
         List<Integer> statusList = new ArrayList<Integer>();
         statusList.add(RepairApplicationFormStatusEnum.NOT_ALLOCATED.getValue());
         statusList.add(RepairApplicationFormStatusEnum.PROCESSING.getValue());
+        statusList.add(RepairApplicationFormStatusEnum.TRANSFER_APPROVAL.getValue());
+        statusList.add(RepairApplicationFormStatusEnum.ENTRUST_REPAIR.getValue());
         if (CollectionUtil.isNotEmpty(ids)) {
             weekendCriteria.andIn(RepairApplicationForm::getSbId, ids);
         }
         weekendCriteria.andIn(RepairApplicationForm::getStatus, statusList);
         List<RepairApplicationForm> repairList = repairApplicationFormMapper.selectByExample(weekendRepair);
+        // 有进行中报修单的设备id,这些设备统一显示黄色,不再按报修类别区分
+        Set<String> repairSbIds = new HashSet<String>();
+        for (RepairApplicationForm repair : repairList) {
+            if (repair.getSbId() != null) {
+                repairSbIds.add(repair.getSbId());
+            }
+        }
         List<SbInfoScreenDetailVO> normalSbInfoList = new ArrayList<SbInfoScreenDetailVO>();
         List<SbInfoScreenDetailVO> repairSbInfoListYellow = new ArrayList<SbInfoScreenDetailVO>();
-        List<SbInfoScreenDetailVO> repairSbInfoListRed = new ArrayList<SbInfoScreenDetailVO>();
+        List<SbInfoScreenDetailVO> stopSbInfoListRed = new ArrayList<SbInfoScreenDetailVO>();
         if (CollectionUtil.isNotEmpty(sbInfoList)) {
             for (SbInfoScreenDetailVO sbInfo : sbInfoList) {
-                boolean find = false;
-                RepairApplicationForm findRepair = null;
-                if (CollectionUtil.isNotEmpty(repairList)) {
-                    for (RepairApplicationForm repair : repairList) {
-                        if (repair.getSbId().equals(sbInfo.getId())) {
-                            find = true;
-                            findRepair = repair;
-                            break;
-                        }
-                    }
-                }
-                if (find) {
-                    if (findRepair.getCategory() == null
-                            || findRepair.getCategory().equals(RepairApplicationFormCategoryEnum.PLAN.getValue())) {
-                        repairSbInfoListYellow.add(sbInfo);
-                    } else {
-                        repairSbInfoListRed.add(sbInfo);
-                    }
+                // 颜色优先级:黄(有进行中报修单)> 红(停机)> 蓝(正常)
+                if (repairSbIds.contains(sbInfo.getId())) {
+                    repairSbInfoListYellow.add(sbInfo);
+                } else if (SbInfoStatusEnum.IN_STOP.getValue().equals(sbInfo.getStatus())) {
+                    stopSbInfoListRed.add(sbInfo);
                 } else {
                     normalSbInfoList.add(sbInfo);
                 }
@@ -301,8 +297,9 @@ public class SbInfoServiceImpl extends BaseServiceImpl<SbInfoMapper, SbInfo, SbI
                 if (CollectionUtil.isNotEmpty(repairSbInfoListYellow)) {
                     vo.setRepairSbInfoListYellow(splitList(item.getTargetId(), repairSbInfoListYellow));
                 }
-                if (CollectionUtil.isNotEmpty(repairSbInfoListRed)) {
-                    vo.setRepairSbInfoListRed(splitList(item.getTargetId(), repairSbInfoListRed));
+                if (CollectionUtil.isNotEmpty(stopSbInfoListRed)) {
+                    // 前端沿用红色列表字段,内容改为停机设备
+                    vo.setRepairSbInfoListRed(splitList(item.getTargetId(), stopSbInfoListRed));
                 }
                 if (CollectionUtil.isNotEmpty(normalSbInfoList)) {
                     vo.setNormalSbInfoList(splitList(item.getTargetId(), normalSbInfoList));