Przeglądaj źródła

add:出入库改动

caozixuan 1 rok temu
rodzic
commit
80415d1515

+ 13 - 0
sop-business/src/main/java/com/qmth/sop/business/bean/params/DeviceInOutForm.java

@@ -3,6 +3,8 @@ package com.qmth.sop.business.bean.params;
 import com.qmth.sop.common.enums.DeviceStatusEnum;
 import io.swagger.annotations.ApiModelProperty;
 
+import java.util.List;
+
 /**
  * @Description: 设备出入库登记表单
  * @Author: CaoZixuan
@@ -30,6 +32,9 @@ public class DeviceInOutForm {
     @ApiModelProperty("发往地")
     private String address;
 
+    @ApiModelProperty("发往地(回显)")
+    private List<String> addressArr;
+
     @ApiModelProperty("快递单拍照")
     private String basePhotoPath;
 
@@ -89,6 +94,14 @@ public class DeviceInOutForm {
         this.address = address;
     }
 
+    public List<String> getAddressArr() {
+        return addressArr;
+    }
+
+    public void setAddressArr(List<String> addressArr) {
+        this.addressArr = addressArr;
+    }
+
     public String getBasePhotoPath() {
         return basePhotoPath;
     }

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

@@ -1,5 +1,6 @@
 package com.qmth.sop.business.bean.result;
 
+import com.fasterxml.jackson.annotation.JsonIgnore;
 import com.fasterxml.jackson.databind.annotation.JsonSerialize;
 import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
 import com.qmth.sop.common.enums.DeviceStatusEnum;
@@ -7,6 +8,8 @@ import com.qmth.sop.common.enums.DeviceUsageTypeEnum;
 import com.qmth.sop.common.enums.InOutTypeEnum;
 import io.swagger.annotations.ApiModelProperty;
 
+import java.util.List;
+
 /**
  * @Description: 设备出入库记录查询结果
  * @Author: CaoZixuan
@@ -62,9 +65,24 @@ public class DeviceInOutResult {
 
     @ApiModelProperty("当前地")
     private String location;
+
+    @ApiModelProperty("当前地(回显)")
+    @JsonIgnore
+    private String locationArrTemp;
+
+    @ApiModelProperty("当前地(回显)")
+    private List<String> locationArr;
+
     @ApiModelProperty("发往地")
     private String address;
 
+    @ApiModelProperty("发往地(回显)")
+    @JsonIgnore
+    private String addressArrTemp;
+
+    @ApiModelProperty("发往地(回显)")
+    private List<String> addressArr;
+
     @ApiModelProperty("供应商id")
     @JsonSerialize(using = ToStringSerializer.class)
     private Long supplierId;
@@ -218,6 +236,22 @@ public class DeviceInOutResult {
         this.location = location;
     }
 
+    public String getLocationArrTemp() {
+        return locationArrTemp;
+    }
+
+    public void setLocationArrTemp(String locationArrTemp) {
+        this.locationArrTemp = locationArrTemp;
+    }
+
+    public List<String> getLocationArr() {
+        return locationArr;
+    }
+
+    public void setLocationArr(List<String> locationArr) {
+        this.locationArr = locationArr;
+    }
+
     public String getAddress() {
         return address;
     }
@@ -226,6 +260,22 @@ public class DeviceInOutResult {
         this.address = address;
     }
 
+    public String getAddressArrTemp() {
+        return addressArrTemp;
+    }
+
+    public void setAddressArrTemp(String addressArrTemp) {
+        this.addressArrTemp = addressArrTemp;
+    }
+
+    public List<String> getAddressArr() {
+        return addressArr;
+    }
+
+    public void setAddressArr(List<String> addressArr) {
+        this.addressArr = addressArr;
+    }
+
     public Long getSupplierId() {
         return supplierId;
     }

+ 12 - 0
sop-business/src/main/java/com/qmth/sop/business/entity/SysDevice.java

@@ -11,6 +11,7 @@ import io.swagger.annotations.ApiModelProperty;
 import javax.validation.constraints.NotBlank;
 import javax.validation.constraints.NotNull;
 import java.io.Serializable;
+import java.util.List;
 
 /**
  * <p>
@@ -55,6 +56,9 @@ public class SysDevice extends BaseEntity implements Serializable {
     @ApiModelProperty(value = "当前所在地")
     private String location;
 
+    @ApiModelProperty(value = "当前所在地(回显)")
+    private String locationArr;
+
     @ApiModelProperty(value = "总扫描量")
     private Long scanCount;
 
@@ -118,6 +122,14 @@ public class SysDevice extends BaseEntity implements Serializable {
         this.location = location;
     }
 
+    public String getLocationArr() {
+        return locationArr;
+    }
+
+    public void setLocationArr(String locationArr) {
+        this.locationArr = locationArr;
+    }
+
     public Long getScanCount() {
         return scanCount;
     }

+ 12 - 0
sop-business/src/main/java/com/qmth/sop/business/entity/TBDeviceInOut.java

@@ -9,6 +9,7 @@ import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 
 import java.io.Serializable;
+import java.util.List;
 
 /**
  * <p>
@@ -65,6 +66,9 @@ public class TBDeviceInOut implements Serializable {
     @ApiModelProperty(value = "发往地")
     private String address;
 
+    @ApiModelProperty(value = "发往地(回显)")
+    private String addressArr;
+
     @ApiModelProperty(value = "运行状态,NORMAL:正常,BREAK_DOWN:故障")
     private DeviceStatusEnum status;
 
@@ -185,6 +189,14 @@ public class TBDeviceInOut implements Serializable {
         this.address = address;
     }
 
+    public String getAddressArr() {
+        return addressArr;
+    }
+
+    public void setAddressArr(String addressArr) {
+        this.addressArr = addressArr;
+    }
+
     public DeviceStatusEnum getStatus() {
         return status;
     }

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

@@ -1,5 +1,6 @@
 package com.qmth.sop.business.service.impl;
 
+import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -54,19 +55,40 @@ public class TBDeviceInOutServiceImpl extends ServiceImpl<TBDeviceInOutMapper, T
 
         SysUser requestUser = (SysUser) ServletUtil.getRequestUser();
         DataPermissionDto dpr = sysUserService.buildUserDataPermission(requestUser.getId());
-
-        return this.baseMapper.findDeviceInOutPageBySop(new Page<>(pageNumber, pageSize), serviceUnitId, usageType,
+        IPage<DeviceInOutResult> result = this.baseMapper.findDeviceInOutPageBySop(new Page<>(pageNumber, pageSize), serviceUnitId, usageType,
                 userId, deviceStatus, inOutTimeStart, inOutTimeEnd, deviceNo, customName, location, address, serialNo, dpr);
+        result.getRecords().forEach(e -> {
+            String addressArrTemp = e.getAddressArrTemp();
+            String locationArrTemp = e.getLocationArrTemp();
+            if (addressArrTemp != null && addressArrTemp.length() > 0) {
+                e.setAddressArr(JSON.parseArray(addressArrTemp, String.class));
+            }
+            if (locationArrTemp != null && locationArrTemp.length() > 0) {
+                e.setLocationArr(JSON.parseArray(locationArrTemp, String.class));
+            }
+        });
+
+        return result;
     }
 
     @Override
     public List<DeviceInOutResult> findDeviceCanOutInfo(Long supplierId) {
-        return this.baseMapper.findDeviceCanOutInfo(supplierId, DeviceStatusEnum.NORMAL, InOutTypeEnum.IN);
+        return this.baseMapper.findDeviceCanOutInfo(supplierId, DeviceStatusEnum.NORMAL, InOutTypeEnum.IN).stream().peek(e -> {
+            String locationArrTemp = e.getLocationArrTemp();
+            if (locationArrTemp != null && locationArrTemp.length() > 0) {
+                e.setLocationArr(JSON.parseArray(locationArrTemp, String.class));
+            }
+        }).collect(Collectors.toList());
     }
 
     @Override
     public List<DeviceInOutResult> findDeviceCanInInfo(Long supplierId, String crmNo) {
-        return this.baseMapper.findDeviceCanInInfo(supplierId, InOutTypeEnum.OUT, crmNo);
+        return this.baseMapper.findDeviceCanInInfo(supplierId, InOutTypeEnum.OUT, crmNo).stream().peek(e -> {
+            String locationArrTemp = e.getLocationArrTemp();
+            if (locationArrTemp != null && locationArrTemp.length() > 0) {
+                e.setLocationArr(JSON.parseArray(locationArrTemp, String.class));
+            }
+        }).collect(Collectors.toList());
     }
 
 
@@ -115,6 +137,7 @@ public class TBDeviceInOutServiceImpl extends ServiceImpl<TBDeviceInOutMapper, T
             tbDeviceInOut.setSupplierName(e.getSupplierName());
             tbDeviceInOut.setLocation(e.getLocation());
             tbDeviceInOut.setAddress(e.getAddress());
+            tbDeviceInOut.setAddressArr(JSON.toJSONString(e.getAddressArr()));
             tbDeviceInOut.setStatus(e.getDeviceStatus());
             tbDeviceInOut.setUsageType(usageType);
             tbDeviceInOut.setBasePhotoPath(e.getBasePhotoPath());
@@ -123,6 +146,7 @@ public class TBDeviceInOutServiceImpl extends ServiceImpl<TBDeviceInOutMapper, T
             UpdateWrapper<SysDevice> updateWrapper = new UpdateWrapper<>();
             updateWrapper.lambda()
                     .set(SysDevice::getLocation, e.getAddress())
+                    .set(SysDevice::getLocationArr, JSON.toJSONString(e.getAddressArr()))
                     .set(SysDevice::getScanCount, e.getScanCount())
                     .set(SysDevice::getStatus, e.getDeviceStatus())
                     .set(SysDevice::getBound, inOutType)
@@ -145,7 +169,19 @@ public class TBDeviceInOutServiceImpl extends ServiceImpl<TBDeviceInOutMapper, T
         SysUser requestUser = (SysUser) ServletUtil.getRequestUser();
         DataPermissionDto dpr = sysUserService.buildUserDataPermission(requestUser.getId());
 
-        return this.baseMapper.findDeviceInOutPageBySource(new Page<>(pageNumber, pageSize), serviceUnitId, usageType,
+        IPage<DeviceInOutResult> result = this.baseMapper.findDeviceInOutPageBySource(new Page<>(pageNumber, pageSize), serviceUnitId, usageType,
                 userId, deviceStatus, inOutTimeStart, inOutTimeEnd, deviceNo, customName, location, address, serialNo, dpr);
+
+        result.getRecords().forEach(e -> {
+            String addressArrTemp = e.getAddressArrTemp();
+            String locationArrTemp = e.getLocationArrTemp();
+            if (addressArrTemp != null && addressArrTemp.length() > 0) {
+                e.setAddressArr(JSON.parseArray(addressArrTemp, String.class));
+            }
+            if (locationArrTemp != null && locationArrTemp.length() > 0) {
+                e.setLocationArr(JSON.parseArray(locationArrTemp, String.class));
+            }
+        });
+        return result;
     }
 }

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

@@ -340,4 +340,10 @@ INSERT INTO sys_config (id, config_key, config_name, config_value, enable, sort,
 INSERT INTO sys_config (id, config_key, config_name, config_value, enable, sort, create_id) VALUES ('44', 'fxxk.api.name.crm.detail', '纷享销客项目派单明细apiName', 'object_bs553__c', '1', '1', '1');
 INSERT INTO sys_config (id, config_key, config_name, config_value, enable, sort, create_id) VALUES ('45', 'fxxk.app.auth.url', '纷享销客应用级授权接口', 'https://open.fxiaoke.com/cgi/corpAccessToken/get/V2', '1', '1', '1');
 INSERT INTO sys_config (id, config_key, config_name, config_value, enable, sort, create_id) VALUES ('46', 'fxxk.user.by.mobile.url', '纷享销客根据手机号查询员工接口', 'https://open.fxiaoke.com/cgi/user/getByMobile', '1', '1', '1');
-INSERT INTO sys_config (id, config_key, config_name, config_value, enable, sort, create_id) VALUES ('47', 'fxxk.custom.query.url', '纷享销客查询自定义对象接口', 'https://openfxiaokecom/cgi/crm/custom/v2/data/query', '1', '1', '1');
+INSERT INTO sys_config (id, config_key, config_name, config_value, enable, sort, create_id) VALUES ('47', 'fxxk.custom.query.url', '纷享销客查询自定义对象接口', 'https://openfxiaokecom/cgi/crm/custom/v2/data/query', '1', '1', '1');
+
+-- 2023-10-12
+ALTER TABLE t_b_device_in_out
+    ADD COLUMN address_arr VARCHAR(100) NULL COMMENT '发往地(回显)' AFTER address;
+ALTER TABLE sys_device
+    ADD COLUMN location_arr VARCHAR(100) NULL COMMENT '当前所在地(回显)' AFTER location;

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

@@ -18,8 +18,10 @@
             su.real_name AS userName,
             IFNULL(tbdio.custom_name,'--') AS customName,
             tbdio.type AS inOutType,
-            tbdio.location AS location,
+            sd.location AS location,
+            sd.location_arr AS locationArrTemp,
             tbdio.address AS address,
+            tbdio.address_arr AS addressArrTemp,
             tbdio.serial_no AS serialNo,
             tbdio.base_photo_path AS basePhotoPath,
             ss.id AS supplierId,
@@ -92,8 +94,10 @@
             su.real_name AS userName,
             IFNULL(tbdio.custom_name,'--') AS customName,
             tbdio.type AS inOutType,
-            tbdio.location AS location,
+            sd.location AS location,
+            sd.location_arr AS locationArrTemp,
             tbdio.address AS address,
+            tbdio.address_arr AS addressArrTemp,
             tbdio.serial_no AS serialNo,
             tbdio.base_photo_path AS basePhotoPath,
             ss.id AS supplierId,
@@ -159,7 +163,8 @@
             sd.status AS deviceStatus,
             sd.scan_count AS scanCount,
             sd.device_code AS deviceNo,
-            sd.location
+            sd.location,
+            sd.location_arr AS locationArrTemp
         FROM
             sys_device sd
                 LEFT JOIN
@@ -188,6 +193,7 @@
             sd.scan_count AS scanCount,
             sd.device_code AS deviceNo,
             sd.location,
+            sd.location_arr AS locationArrTemp,
             ss.name AS address
         FROM
             sys_device sd