Просмотр исходного кода

fix: 设备编号 -> 设备序列号

caozixuan 1 год назад
Родитель
Сommit
6a89189838

+ 10 - 0
sop-business/src/main/java/com/qmth/sop/business/bean/result/DeviceInOutResult.java

@@ -33,6 +33,8 @@ public class DeviceInOutResult {
     @ApiModelProperty("设备id")
     @JsonSerialize(using = ToStringSerializer.class)
     private Long deviceId;
+    @ApiModelProperty("设备序列号")
+    private String deviceSerialNo;
     @ApiModelProperty("设备编号")
     private String deviceNo;
     @ApiModelProperty("设备品牌")
@@ -100,6 +102,14 @@ public class DeviceInOutResult {
         this.serialNo = serialNo;
     }
 
+    public String getDeviceSerialNo() {
+        return deviceSerialNo;
+    }
+
+    public void setDeviceSerialNo(String deviceSerialNo) {
+        this.deviceSerialNo = deviceSerialNo;
+    }
+
     public Long getInOutId() {
         return inOutId;
     }

+ 6 - 7
sop-business/src/main/java/com/qmth/sop/business/entity/TBDeviceInOut.java

@@ -9,7 +9,6 @@ import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 
 import java.io.Serializable;
-import java.util.List;
 
 /**
  * <p>
@@ -54,8 +53,8 @@ public class TBDeviceInOut implements Serializable {
     @ApiModelProperty(value = "类型,IN:入库,OUT:出库")
     private InOutTypeEnum type;
 
-    @ApiModelProperty(value = "设备号")
-    private String deviceNo;
+    @ApiModelProperty(value = "设备序列号")
+    private String deviceSerialNo;
 
     @ApiModelProperty(value = "供应商名称")
     private String supplierName;
@@ -157,12 +156,12 @@ public class TBDeviceInOut implements Serializable {
         this.type = type;
     }
 
-    public String getDeviceNo() {
-        return deviceNo;
+    public String getDeviceSerialNo() {
+        return deviceSerialNo;
     }
 
-    public void setDeviceNo(String deviceNo) {
-        this.deviceNo = deviceNo;
+    public void setDeviceSerialNo(String deviceSerialNo) {
+        this.deviceSerialNo = deviceSerialNo;
     }
 
     public String getSupplierName() {

+ 2 - 2
sop-business/src/main/java/com/qmth/sop/business/service/impl/ServiceAnalyseServiceImpl.java

@@ -162,14 +162,14 @@ public class ServiceAnalyseServiceImpl extends ServiceImpl<ServiceAnalyseMapper,
         Map<String, Integer> deviceInMap = tbDeviceInOutDatasource
                 .stream()
                 .filter(e -> InOutTypeEnum.IN.equals(e.getType()))
-                .collect(Collectors.toMap(TBDeviceInOut::getDeviceNo, e -> 1, Integer::sum));
+                .collect(Collectors.toMap(TBDeviceInOut::getDeviceSerialNo, e -> 1, Integer::sum));
 
         // 设备出库map -> (设备编号,出库次数)
         int equipmentOutboundTotal = 0;
         Map<String, Integer> deviceOutMap = tbDeviceInOutDatasource
                 .stream()
                 .filter(e -> InOutTypeEnum.OUT.equals(e.getType()))
-                .collect(Collectors.toMap(TBDeviceInOut::getDeviceNo, e -> 1, Integer::sum));
+                .collect(Collectors.toMap(TBDeviceInOut::getDeviceSerialNo, e -> 1, Integer::sum));
 
         for (String deviceNo : deviceOutMap.keySet()) {
             // 出库次数

+ 1 - 1
sop-business/src/main/java/com/qmth/sop/business/service/impl/TBDeviceInOutServiceImpl.java

@@ -149,7 +149,7 @@ public class TBDeviceInOutServiceImpl extends ServiceImpl<TBDeviceInOutMapper, T
             }
             tbDeviceInOut.setUserId(requestUser.getId());
             tbDeviceInOut.setType(inOutType);
-            tbDeviceInOut.setDeviceNo(e.getSerialNo());
+            tbDeviceInOut.setDeviceSerialNo(e.getSerialNo());
             tbDeviceInOut.setSupplierName(e.getSupplierName());
             tbDeviceInOut.setLocation(e.getLocation());
             tbDeviceInOut.setAddress(e.getAddress());

+ 7 - 1
sop-business/src/main/resources/db/log/caozixuan_update_log.sql

@@ -444,4 +444,10 @@ ALTER TABLE sys_supplier
 ;
 
 ALTER TABLE sys_user
-    ADD COLUMN supplier_id BIGINT NULL COMMENT '供应商id' AFTER source;
+    ADD COLUMN supplier_id BIGINT NULL COMMENT '供应商id' AFTER source;
+
+-- 2023-12-01
+update t_b_device_in_out tbdio set device_no = (select serial_no from sys_device sd where tbdio.device_no = sd.device_code);
+
+ALTER TABLE t_b_device_in_out
+    CHANGE COLUMN device_no device_serial_no VARCHAR(50) CHARACTER SET 'utf8mb4' NULL DEFAULT NULL COMMENT '设备序列号';

+ 1 - 1
sop-business/src/main/resources/mapper/DeviceMonitorMapper.xml

@@ -91,7 +91,7 @@
         t_b_service s
 
         left join t_b_device_in_out io on io.service_id=s.id
-        left join sys_device d on d.serial_no=io.serial_no
+        left join sys_device d on d.serial_no=io.device_serial_no
         <where>
             and s.status !='FINISH'
             <if test="dpr != null and !dpr.hasAdmin and !dpr.hasPmo">

+ 1 - 1
sop-business/src/main/resources/mapper/ServiceAnalyseMapper.xml

@@ -304,7 +304,7 @@
         FROM
         t_b_service s
         LEFT JOIN t_b_device_in_out io ON io.service_id = s.id
-        LEFT JOIN sys_device d ON d.serial_no = io.serial_no
+        LEFT JOIN sys_device d ON d.serial_no = io.device_serial_no
         LEFT JOIN sys_supplier su ON su.id = d.supplier_id
         <where>
             and io.id IS NOT NULL

+ 9 - 8
sop-business/src/main/resources/mapper/TBDeviceInOutMapper.xml

@@ -8,7 +8,7 @@
             tbdio.service_id AS serviceUnitId,
             IFNULL(tbs.name,'--') AS serviceUnitName,
             tbdio.usage_type AS usageType,
-            tbdio.device_no AS deviceNo,
+            sd.device_code AS deviceNo,
             sd.id AS deviceId,
             sd.brand AS deviceBrand,
             sd.model AS deviceModel,
@@ -23,6 +23,7 @@
             tbdio.address_arr AS addressArrTemp,
             tbdio.serial_no AS serialNo,
             tbdio.base_photo_path AS basePhotoPath,
+            tbdio.device_serial_no AS deviceSerialNo,
             ss.id AS supplierId,
             ss.name AS supplierName
         FROM
@@ -30,7 +31,7 @@
                 LEFT JOIN
             t_b_service tbs ON tbdio.service_id = tbs.id
                 LEFT JOIN
-            sys_device sd ON tbdio.serial_no = sd.serial_no
+            sys_device sd ON tbdio.device_serial_no = sd.serial_no
                 LEFT JOIN
             sys_user su ON tbdio.user_id = su.id
                 LEFT JOIN
@@ -56,7 +57,7 @@
                 AND #{inOutTimeEnd} > tbdio.in_out_time
             </if>
             <if test="deviceNo != null and deviceNo != ''">
-                AND tbdio.device_no LIKE CONCAT('%',#{deviceNo},'%')
+                AND sd.device_code LIKE CONCAT('%',#{deviceNo},'%')
             </if>
             <if test="customName != null and customName != ''">
                 AND tbdio.custom_name LIKE CONCAT('%',#{customName},'%')
@@ -101,7 +102,7 @@
             tbdio.service_id AS serviceUnitId,
             IFNULL(tbs.name,'--') AS serviceUnitName,
             tbdio.usage_type AS usageType,
-            tbdio.device_no AS deviceNo,
+            sd.device_code AS deviceNo,
             sd.id AS deviceId,
             sd.brand AS deviceBrand,
             sd.model AS deviceModel,
@@ -124,7 +125,7 @@
                 LEFT JOIN
             t_b_service tbs ON tbdio.service_id = tbs.id
                 LEFT JOIN
-            sys_device sd ON tbdio.serial_no = sd.serial_no
+            sys_device sd ON tbdio.device_serial_no = sd.serial_no
                 LEFT JOIN
             sys_user su ON tbdio.user_id = su.id
                 LEFT JOIN
@@ -150,7 +151,7 @@
                 AND #{inOutTimeEnd} > tbdio.in_out_time
             </if>
             <if test="deviceNo != null and deviceNo != ''">
-                AND tbdio.device_no LIKE CONCAT('%',#{deviceNo},'%')
+                AND sd.device_code LIKE CONCAT('%',#{deviceNo},'%')
             </if>
             <if test="customName != null and customName != ''">
                 AND tbdio.custom_name LIKE CONCAT('%',#{customName},'%')
@@ -244,10 +245,10 @@
             </if>
             <choose>
                 <when test="sopNo != null and sopNo != ''">
-                    AND EXISTS(SELECT 1 FROM t_b_device_in_out tbdio WHERE tbdio.serial_no = sd.device_code AND tbdio.sop_no = #{sopNo})
+                    AND EXISTS(SELECT 1 FROM t_b_device_in_out tbdio WHERE tbdio.device_serial_no = sd.device_code AND tbdio.sop_no = #{sopNo})
                 </when>
                 <otherwise>
-                    AND EXISTS(SELECT 1 FROM t_b_device_in_out tbdio WHERE tbdio.serial_no = sd.device_code AND tbdio.service_id IS NULL)
+                    AND EXISTS(SELECT 1 FROM t_b_device_in_out tbdio WHERE tbdio.device_serial_no = sd.device_code AND tbdio.service_id IS NULL)
                 </otherwise>
             </choose>
         </where>