hfxc226 2 жил өмнө
parent
commit
5c7a106a5f

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

@@ -36,6 +36,10 @@ public class SbInfoDTO extends BaseDTO implements Serializable {
      * 设备位号
      */
     private String positionNo;
+    /**
+     * 父设备位号
+     */
+    private String ppNo;
 
     /**
      * 状态变更实际操作人姓名

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

@@ -28,6 +28,10 @@ public class SbInfo implements Serializable {
      * 设备位号
      */
     private String positionNo;
+    /**
+     * 父设备位号
+     */
+    private String ppNo;
     /**
      * 验收单id
      */

+ 31 - 26
platform-dao/src/main/java/com/platform/dao/vo/export/sb/ExportSbInfoVO.java

@@ -23,140 +23,145 @@ public class ExportSbInfoVO implements Serializable {
     /**
      * 主键
      */
-    @Excel(name = "主键", orderNum = "1")
+    @Excel(name = "主键")
     private String id;
     /**
      * 设备编号
      */
-    @Excel(name = "设备编号(必填)", orderNum = "2")
+    @Excel(name = "设备编号(必填)")
     private String no;
     /**
      * 设备位号
      */
-    @Excel(name = "设备位号", orderNum = "3")
+    @Excel(name = "设备位号")
     private String positionNo;
     /**
      * 设备名称
      */
-    @Excel(name = "设备名称(必填)", orderNum = "4")
+    @Excel(name = "设备名称(必填)")
     private String name;
     /**
      * 设备名称
      */
-    @Excel(name = "设备型号(必填)", orderNum = "5")
+    @Excel(name = "设备型号(必填)")
     private String model;
+    /**
+     * 设备位号
+     */
+    @Excel(name = "父位号")
+    private String ppNo;
     /**
      * 设备等级
      */
-    @Excel(name = "设备等级(必填;1:A级;2:B级;3:C级)", orderNum = "6")
+    @Excel(name = "设备等级(必填;1:A级;2:B级;3:C级)")
     private Integer level;
     /**
      * 设备原值
      */
-    @Excel(name = "设备原值", orderNum = "7")
+    @Excel(name = "设备原值")
     private Double initialValue;
     /**
      * 设备类别
      */
-    @Excel(name = "设备类别(必填)", orderNum = "8")
+    @Excel(name = "设备类别(必填)")
     private String typeName;
     /**
      * 自定义类型
      */
-    @Excel(name = "自定义类型(必填;3:生产设备;4:计量设备;5:特种设备)", orderNum = "9")
+    @Excel(name = "自定义类型(必填;3:生产设备;4:计量设备;5:特种设备)")
     private Integer useType;
     /**
      * 设备位置
      */
-    @Excel(name = "设备位置", orderNum = "10")
+    @Excel(name = "设备位置")
     private String positionName;
     /**
      * 使用位置
      */
-    @Excel(name = "出厂编号", orderNum = "11")
+    @Excel(name = "出厂编号")
     private String zzh;
     /**
      * 生产商
      */
-    @Excel(name = "生产商", orderNum = "12")
+    @Excel(name = "生产商")
     private String producerName;
     /**
      * 使用施工组名称
      */
-    @Excel(name = "使用人", orderNum = "13")
+    @Excel(name = "使用人")
     private String saveUserName;
     /**
      * 购置日期
      */
-    @Excel(name = "购置日期", orderNum = "14")
+    @Excel(name = "购置日期")
     private LocalDate buyDate;
     /**
      * 投用日期
      */
-    @Excel(name = "投用日期", orderNum = "15")
+    @Excel(name = "投用日期")
     private LocalDate startDate;
     /**
      * 状态
      */
-    @Excel(name = "状态(必填;1在库;2使用中)", orderNum = "16")
+    @Excel(name = "状态(必填;1在库;2使用中)")
     private Integer status;
     /**
      * 备注
      */
-    @Excel(name = "备注", orderNum = "17")
+    @Excel(name = "备注")
     private String remark;
     /**
      * 财务编码/固定资产编号
      */
-    @Excel(name = "固定资产编号", orderNum = "18")
+    @Excel(name = "固定资产编号")
     private String financingNo;
 
     /**
      * 固定资产
      */
-    @Excel(name = "是否固定资产(必填;0否;1是)", orderNum = "19")
+    @Excel(name = "是否固定资产(必填;0否;1是)")
     private Integer isFinancing;
 
     /**
      * 上次检定日期
      */
-    @Excel(name = "上次检定日期", orderNum = "20")
+    @Excel(name = "上次检定日期")
     private LocalDate checkDate;
 
     /**
      * 检定周期
      */
-    @Excel(name = "检定周期(月)", orderNum = "21")
+    @Excel(name = "检定周期(月)")
     private Integer checkPeriod;
 
     /**
      * 下次检定日期
      */
-    @Excel(name = "下次检定日期", orderNum = "22")
+    @Excel(name = "下次检定日期")
     private LocalDate nextCheckDate;
 
     /**
      * 预警天数
      */
-    @Excel(name = "预警天数", orderNum = "23")
+    @Excel(name = "预警天数")
     private Integer seatNumber;
 
     /**
      * 使用寿命
      */
-    @Excel(name = "使用寿命(年)", orderNum = "24")
+    @Excel(name = "使用寿命(年)")
     private double workYear;
 
     /**
      * 检定单位
      */
-    @Excel(name = "检定单位", orderNum = "25")
+    @Excel(name = "检定单位")
     private String dph;
 
     /**
      * 是否需要检定
      */
-    @Excel(name = "是否需要检定(必填;0:否;1:是)", orderNum = "26")
+    @Excel(name = "是否需要检定(必填;0:否;1:是)")
     private Integer isMeasure;
 
 }

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

@@ -33,6 +33,10 @@ public class SbInfoVO extends BaseVO implements Serializable {
      * 设备位号
      */
     private String positionNo;
+    /**
+     * 父设备位号
+     */
+    private String ppNo;
     /**
      * 验收单id
      */

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

@@ -5,7 +5,7 @@
         id
         , no,
 financing_no,
-position_no,
+position_no,pp_no,
 financing_no_two,
 financing_no_third,
 financing_no_four,
@@ -89,6 +89,7 @@ sb.financing_no_four,
 sb.financing_no_five,
 sb.financing_no,
 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,
@@ -220,6 +221,9 @@ user.real_name as saveUserName,sb.repair_dept_id
         <if test="positionNo != null and positionNo!=''">
             and sb.position_no = #{positionNo}
         </if>
+        <if test="ppNo != null and ppNo!=''">
+            and sb.pp_no = #{ppNo}
+        </if>
         <if test="likeDeptCode != null and likeDeptCode!=''">
             and sdDept.dept_code like concat(#{likeDeptCode},'%')
         </if>
@@ -413,6 +417,9 @@ user.real_name as saveUserName,sb.repair_dept_id
         <if test="positionNo != null and positionNo!=''">
             and sb.position_no = #{positionNo}
         </if>
+        <if test="ppNo != null and ppNo!=''">
+            and sb.pp_no = #{ppNo}
+        </if>
         <if test="measureStatus != null">
             and sb.measure_status = #{measureStatus}
         </if>
@@ -493,6 +500,9 @@ user.real_name as saveUserName,sb.repair_dept_id
         <if test="positionNo != null and positionNo!=''">
             and sb.position_no = #{positionNo}
         </if>
+        <if test="ppNo != null and ppNo!=''">
+            and sb.pp_no = #{ppNo}
+        </if>
         <if test="measureStatus != null">
             and sb.measure_status = #{measureStatus}
         </if>

+ 34 - 0
platform-service/src/main/java/com/platform/service/sb/impl/SbInfoServiceImpl.java

@@ -2096,8 +2096,42 @@ public class SbInfoServiceImpl extends BaseServiceImpl<SbInfoMapper, SbInfo, SbI
         try {
             List<ExportSbInfoVO> list = ExcelUtil.importExcel(file.getInputStream(), ExportSbInfoVO.class, 1);
             if(CollectionUtil.isNotEmpty(list)){
+                int i = 2;
                 for(ExportSbInfoVO vo : list){
+                    i++;
+                    // 如果有检定周期,就是需要检定
                     SbInfo tempInfo = BeanConverterUtil.copyObjectProperties(vo,SbInfo.class);
+                    // 对必填字段进行判断
+                    if(StringUtils.isBlank(vo.getPositionNo())){
+                      throw new BusinessException("第" + i + "行,位号为空,位号为必填项目,请填写;");// 编号为空,复制位号
+                    }
+                    if(StringUtils.isBlank(vo.getName())){
+                        throw new BusinessException("第" + i + "行,位号为空,请填写;");// 编号为空,复制位号
+                    }
+                    if(StringUtils.isBlank(vo.getModel())){
+                        throw new BusinessException("第" + i + "行,型号为空,请填写;");// 编号为空,复制位号
+                    }
+                    if(vo.getLevel() == null || vo.getLevel()<1 || vo.getLevel()>3){
+                        throw new BusinessException("第" + i + "行,等级为空,A级请填1,B级填2,C级填3;");// 编号为空,复制位号
+                    }
+                    if(vo.getUseType() == null || vo.getUseType()<3 || vo.getUseType()>5){
+                        throw new BusinessException("第" + i + "行,自定义类型为空,生产设备请填3,计量设备填4,特种设备填5;");// 编号为空,复制位号
+                    }
+                    if(vo.getStatus() == null || vo.getStatus()<1 || vo.getStatus()>2){
+                        throw new BusinessException("第" + i + "行,状态为空,在库请填3,使用中填4;");// 编号为空,复制位号
+                    }
+                    if(StringUtils.isBlank(vo.getNo())){
+                        tempInfo.setNo(vo.getPositionNo());// 编号为空,复制位号
+                    }
+                    if(StringUtils.isNotEmpty(vo.getPpNo())){
+                        tempInfo.setIsChild(1);
+                    }
+                    if(StringUtils.isNotEmpty(vo.getFinancingNo())){
+                        tempInfo.setIsFinancing(1);
+                    }
+                    if(vo.getCheckPeriod() != null){
+                        tempInfo.setIsMeasure(1);
+                    }
                     if(StringUtils.isNotBlank(vo.getTypeName())){ // 设备类型匹配
                         boolean findSbType = false;
                         for (SbType sbType : typeList) {