Quellcode durchsuchen

设备类型统计报表

hfxc226 vor 2 Jahren
Ursprung
Commit
f075ad726f

+ 4 - 0
platform-dao/src/main/java/com/platform/dao/dto/sb/SbInfoDTO.java

@@ -352,6 +352,10 @@ public class SbInfoDTO extends BaseDTO implements Serializable {
      * 是否需要检定:0否,1是,使用yesNo枚举类
      */
     private Integer isMeasure;
+    /**
+     * 是否自检:0否,1是,使用yesNo枚举类
+     */
+    private Integer isSelf;
     /**
      * 检定状态:0正常无需检定,1待检定,使用yesNo枚举类
      */

+ 4 - 0
platform-dao/src/main/java/com/platform/dao/entity/sb/SbInfo.java

@@ -300,6 +300,10 @@ public class SbInfo implements Serializable {
      * 是否需要检定:0否,1是,使用yesNo枚举类
      */
     private Integer isMeasure;
+    /**
+     * 是否自检:0否,1是,使用yesNo枚举类
+     */
+    private Integer isSelf;
     /**
      * 检定状态:0正常无需检定,1待检定,使用yesNo枚举类
      */

+ 4 - 0
platform-dao/src/main/java/com/platform/dao/vo/sb/SbInfoVO.java

@@ -451,6 +451,10 @@ public class SbInfoVO extends BaseVO implements Serializable {
      * 是否需要检定:0否,1是,使用yesNo枚举类
      */
     private Integer isMeasure;
+    /**
+     * 是否自检:0否,1是,使用yesNo枚举类
+     */
+    private Integer isSelf;
     /**
      * 检定状态:0正常无需检定,1待检定,使用yesNo枚举类
      */

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

@@ -12,7 +12,7 @@ financing_no_four,
 financing_no_five,
 param_list,
 name, model_id,
-        is_child, is_measure, measure_status,
+        is_child, is_measure, measure_status,is_self,
         is_show,
         is_financing,
         type_id, level, initial_value, current_value, cut_value,
@@ -92,7 +92,7 @@ sb.position_no,
 sb.pp_no,
 sb.name,  sb.initial_value,
         sb.current_value, sb.cut_value,
-        sb.is_child, sb.is_measure, sb.measure_status,
+        sb.is_child, sb.is_measure, sb.measure_status,sb.is_self,
         sb.is_financing,
         sb.parent_id,
 sb.param_list,
@@ -259,6 +259,9 @@ user.real_name as saveUserName,sb.repair_dept_id
         <if test="isMeasure != null">
             and sb.is_measure = #{isMeasure}
         </if>
+        <if test="isSelf != null">
+            and sb.is_self = #{isSelf}
+        </if>
         <if test="measureStatus != null">
             and sb.measure_status = #{measureStatus}
         </if>
@@ -422,6 +425,9 @@ user.real_name as saveUserName,sb.repair_dept_id
         <if test="isMeasure != null">
             and sb.is_measure = #{isMeasure}
         </if>
+        <if test="isSelf != null">
+            and sb.is_self = #{isSelf}
+        </if>
         <if test="positionNo != null and positionNo!=''">
             and sb.position_no = #{positionNo}
         </if>
@@ -505,6 +511,9 @@ user.real_name as saveUserName,sb.repair_dept_id
         <if test="isMeasure != null">
             and sb.is_measure = #{isMeasure}
         </if>
+        <if test="isSelf != null">
+            and sb.is_self = #{isSelf}
+        </if>
         <if test="positionNo != null and positionNo!=''">
             and sb.position_no = #{positionNo}
         </if>

+ 1 - 2
platform-rest/src/main/java/com/platform/rest/controller/sb/SbInfoController.java

@@ -45,7 +45,6 @@ import java.util.List;
 public class SbInfoController {
 
     private final SbInfoService sbInfoService;
-    private final SbInfoServiceImpl sbInfoServiceimpl;
 
     /**
      * 设备工作台数据
@@ -505,7 +504,7 @@ public class SbInfoController {
      */
     @GetMapping("/sbTree")
     public R getSbTree(SbInfoDTO sbInfoDTO) {
-        return new R<>(sbInfoServiceimpl.getSbVOById(sbInfoDTO));
+        return new R<>(sbInfoService.getSbVOById(sbInfoDTO));
     }
 
 }

+ 31 - 1
platform-service/src/main/java/com/platform/service/sb/impl/SbInfoServiceImpl.java

@@ -2163,9 +2163,16 @@ public class SbInfoServiceImpl extends BaseServiceImpl<SbInfoMapper, SbInfo, SbI
                                     throw new BusinessException("需要检定的设备,检定周期必填");
                                 }
                             } else {
-                                throw new BusinessException("需要检定的设备,检定日期必填");
+                                throw new BusinessException("需要检定的设备,检定日期必填");
                             }
                         }
+
+                        // 如果是仪表组,则是自检
+                        if (StringUtils.isNotEmpty(vo.getDph()) && vo.getDph().equals("仪表组") ) {
+                            tempInfo.setIsSelf(YesNoEnum.YES.getValue());
+                        }else{
+                            tempInfo.setIsSelf(YesNoEnum.NO.getValue());
+                        }
                     }
                     if (StringUtils.isNotBlank(vo.getTypeName())) { // 设备类型匹配
                         boolean findSbType = false;
@@ -2317,6 +2324,29 @@ public class SbInfoServiceImpl extends BaseServiceImpl<SbInfoMapper, SbInfo, SbI
                     if (vo.getCheckPeriod() != null) {
                         tempInfo.setIsMeasure(1);
                     }
+                    if (vo.getCheckPeriod() != null) {
+                        tempInfo.setIsMeasure(1);
+                    }
+                    if (tempInfo.getIsMeasure() == 1) {
+                        if (tempInfo.getNextCheckDate() == null) {
+                            if (tempInfo.getCheckDate() != null) {
+                                if (tempInfo.getCheckPeriod() != null) {
+                                    tempInfo.setNextCheckDate(tempInfo.getCheckDate().plusMonths(tempInfo.getCheckPeriod()));
+                                } else {
+                                    throw new BusinessException("需要检定的设备,检定周期必填");
+                                }
+                            } else {
+                                throw new BusinessException("需要检定的设备,检定日期必填");
+                            }
+                        }
+
+                        // 如果是仪表组,则是自检
+                        if (StringUtils.isNotEmpty(vo.getDph()) && vo.getDph().equals("仪表组") ) {
+                            tempInfo.setIsSelf(YesNoEnum.YES.getValue());
+                        }else{
+                            tempInfo.setIsSelf(YesNoEnum.NO.getValue());
+                        }
+                    }
                     if (StringUtils.isNotBlank(vo.getTypeName())) { // 设备类型匹配
                         boolean findSbType = false;
                         for (SbType sbType : typeList) {