Jelajahi Sumber

设备位号功能

hfxc226 2 tahun lalu
induk
melakukan
53aff4658a

+ 12 - 11
platform-dao/src/main/java/com/platform/dao/vo/export/sb/ExportSbInfoVO.java

@@ -28,13 +28,18 @@ public class ExportSbInfoVO implements Serializable {
     /**
      * 设备编号
      */
-    @Excel(name = "设备编号(必填)")
+    @Excel(name = "设备编号")
     private String no;
     /**
      * 设备位号
      */
-    @Excel(name = "设备位号")
+    @Excel(name = "设备位号(必填)")
     private String positionNo;
+    /**
+     * 生产商
+     */
+    @Excel(name = "生产商")
+    private String producerName;
     /**
      * 设备名称
      */
@@ -80,11 +85,7 @@ public class ExportSbInfoVO implements Serializable {
      */
     @Excel(name = "出厂编号")
     private String zzh;
-    /**
-     * 生产商
-     */
-    @Excel(name = "生产商")
-    private String producerName;
+
     /**
      * 使用施工组名称
      */
@@ -93,12 +94,12 @@ public class ExportSbInfoVO implements Serializable {
     /**
      * 购置日期
      */
-    @Excel(name = "购置日期")
+    @Excel(name = "购置日期", exportFormat = "yyyy/MM/dd")
     private LocalDate buyDate;
     /**
      * 投用日期
      */
-    @Excel(name = "投用日期")
+    @Excel(name = "投用日期", exportFormat = "yyyy/MM/dd" )
     private LocalDate startDate;
     /**
      * 状态
@@ -125,7 +126,7 @@ public class ExportSbInfoVO implements Serializable {
     /**
      * 上次检定日期
      */
-    @Excel(name = "上次检定日期")
+    @Excel(name = "上次检定日期", exportFormat = "yyyy/MM/dd")
     private LocalDate checkDate;
 
     /**
@@ -137,7 +138,7 @@ public class ExportSbInfoVO implements Serializable {
     /**
      * 下次检定日期
      */
-    @Excel(name = "下次检定日期")
+    @Excel(name = "下次检定日期", exportFormat = "yyyy/MM/dd")
     private LocalDate nextCheckDate;
 
     /**

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

@@ -151,7 +151,7 @@ sb.param_list,
         sb.level,
         sb.unit,
         sb.use_type as useType,
-        sbType.name as typeName,producer.name as producerName,
+        sbType.name as typeName,
         position.name as positionName,
         sb.check_date,
         sb.check_period,
@@ -188,7 +188,6 @@ user.real_name as saveUserName,sb.repair_dept_id
         <include refid="Left_Column"/>
         from t_sb_info sb
         left join t_sb_type sbType on sb.type_id = sbType.id
-        left join t_firm_producer producer on sb.producer_id = producer.id
         left join t_sb_position position on sb.position_id = position.id
         left join t_sys_user user on sb.save_user = user.user_id
         left join t_sys_user user2 on sb.repair_user = user2.user_id
@@ -213,7 +212,10 @@ user.real_name as saveUserName,sb.repair_dept_id
             and user3.real_name like concat('%',#{repairUserSecondName},'%')
         </if>
         <if test="producerName != null and producerName!=''">
-            and producer.name like concat('%',#{producerName},'%')
+            and sb.producer_id like concat('%',#{producerName},'%')
+        </if>
+        <if test="producerId != null and producerId!=''">
+            and sb.producer_id like concat('%',#{producerId},'%')
         </if>
         <if test="positionId != null and positionId!=''">
             and sb.position_id = #{positionId}
@@ -591,7 +593,6 @@ user.real_name as saveUserName,sb.repair_dept_id
         <include refid="Left_Column"/>
         from t_sb_info sb
         left join t_sb_type sbType on sb.type_id = sbType.id
-        left join t_firm_producer producer on sb.producer_id = producer.id
         left join t_sb_position position on sb.position_id = position.id
         left join t_sys_user user on sb.save_user = user.user_id
         where sb.id = #{value}
@@ -601,7 +602,6 @@ user.real_name as saveUserName,sb.repair_dept_id
         <include refid="Left_Column"/>
         from t_sb_info sb
         left join t_sb_type sbType on sb.type_id = sbType.id
-        left join t_firm_producer producer on sb.producer_id = producer.id
         left join t_sb_position position on sb.position_id = position.id
         left join t_sys_user user on sb.save_user = user.user_id
         where sb.no = #{value}

+ 13 - 3
platform-office/src/main/java/com/platform/office/poi/excel/imports/CellValueServer.java

@@ -112,7 +112,8 @@ public class CellValueServer {
             try {
                 return format.parse(value);
             } catch (ParseException e) {
-                LOGGER.error("时间格式化失败,格式化:{},值:{}", entity.getFormat(), value);
+                e.printStackTrace();
+                LOGGER.error("1:时间格式化失败,格式化:{},值:{}", entity.getFormat(), value);
                 throw new ExcelImportException(ExcelImportEnum.GET_VALUE_ERROR);
             }
         }
@@ -124,7 +125,8 @@ public class CellValueServer {
             try {
                 return DateUtils.strToLocalDateTime(value, entity.getFormat());
             } catch (Exception e) {
-                LOGGER.error("时间格式化失败,格式化:{},值:{}", entity.getFormat(), value);
+                e.printStackTrace();
+                LOGGER.error("2:时间格式化失败,格式化:{},值:{}", entity.getFormat(), value);
                 throw new ExcelImportException(ExcelImportEnum.GET_VALUE_ERROR);
             }
         }
@@ -134,9 +136,17 @@ public class CellValueServer {
     private LocalDate getLocalDateData(ExcelImportEntity entity, String value) {
         if (StringUtils.isNotEmpty(entity.getFormat()) && StringUtils.isNotEmpty(value)) {
             try {
+                if(value.contains("/")){
+
+
+                }else if(value.contains("-")){
+
+                    return DateUtils.strToLocalDate(value, entity.getFormat());
+                }
                 return DateUtils.strToLocalDate(value, entity.getFormat());
             } catch (Exception e) {
-                LOGGER.error("时间格式化失败,格式化:{},值:{}", entity.getFormat(), value);
+                e.printStackTrace();
+                LOGGER.error("3:时间格式化失败,格式化:{},值:{}", entity.getFormat(), value);
                 throw new ExcelImportException(ExcelImportEnum.GET_VALUE_ERROR);
             }
         }

+ 8 - 1
platform-office/src/main/java/com/platform/office/poi/util/DateUtils.java

@@ -2,6 +2,7 @@ package com.platform.office.poi.util;
 
 import lombok.experimental.UtilityClass;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.poi.ss.usermodel.DateUtil;
 
 import java.text.SimpleDateFormat;
 import java.time.Instant;
@@ -25,9 +26,15 @@ import java.util.Date;
 @UtilityClass
 public class DateUtils {
     public final static String PATTERN_YMD_HMS = "yyyy-MM-dd HH:mm:ss";
-    public final static String PATTERN_YMD = "yyyy-MM-dd";
+    public final static String PATTERN_YMD = "yyyy/MM/dd";
+    public final static String PATTERN_YMD2 = "yyyy-MM-dd";
     private final static ZoneId ZONE_ID = ZoneId.systemDefault();
 
+    public static void main(String[] args) {
+        String ss = "2022/03/05";
+        LocalDate localDate = strToLocalDate(ss, PATTERN_YMD);
+        System.out.println(localDate.toString());
+    }
     /**
      * 当前时间所在一周的周一时间
      *

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

@@ -2125,7 +2125,6 @@ public class SbInfoServiceImpl extends BaseServiceImpl<SbInfoMapper, SbInfo, SbI
                     if(vo.getStatus() == null || vo.getStatus()<1 || vo.getStatus()>2){
                         throw new BusinessException("第" + i + "行,状态为空,在库请填1,使用中填2;");// 编号为空,复制位号
                     }
-
                     if(StringUtils.isBlank(vo.getNo())){
                         tempInfo.setNo(vo.getPositionNo());// 编号为空,复制位号
                     }
@@ -2162,10 +2161,11 @@ public class SbInfoServiceImpl extends BaseServiceImpl<SbInfoMapper, SbInfo, SbI
                             }
                         }
                         if (!findPosition) {
-                            throw new BusinessException("系统找不到车间名称,请先添加车间, 车间名称" + vo.getPositionName());
+                            throw new BusinessException("系统找不到位置名称,请先在基础配置中添加位置, 位置名称" + vo.getPositionName());
                         }
                     }
-                    if(StringUtils.isNotBlank(vo.getProducerName())){ // 生产商匹配
+                    tempInfo.setProducerId(vo.getProducerName());
+                    /*if(StringUtils.isNotBlank(vo.getProducerName())){ // 生产商匹配
                         boolean findProducer = false;
                         for (FirmProducer producer : producerList) {
                             if (producer.getName().equalsIgnoreCase(vo.getProducerName().trim())) {
@@ -2177,7 +2177,7 @@ public class SbInfoServiceImpl extends BaseServiceImpl<SbInfoMapper, SbInfo, SbI
                         if (!findProducer) {
                             throw new BusinessException("找不到生产商,请先添加:" + vo.getProducerName());
                         }
-                    }
+                    }*/
                     if(StringUtils.isNotBlank(vo.getSaveUserName())){ // 使用人员
                         boolean findSaveUser = false;
                         for (SysUser user : users) {