|
@@ -1,5 +1,6 @@
|
|
package com.qmth.sop.business.service.impl;
|
|
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.conditions.update.UpdateWrapper;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
@@ -54,19 +55,40 @@ public class TBDeviceInOutServiceImpl extends ServiceImpl<TBDeviceInOutMapper, T
|
|
|
|
|
|
SysUser requestUser = (SysUser) ServletUtil.getRequestUser();
|
|
SysUser requestUser = (SysUser) ServletUtil.getRequestUser();
|
|
DataPermissionDto dpr = sysUserService.buildUserDataPermission(requestUser.getId());
|
|
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);
|
|
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
|
|
@Override
|
|
public List<DeviceInOutResult> findDeviceCanOutInfo(Long supplierId) {
|
|
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
|
|
@Override
|
|
public List<DeviceInOutResult> findDeviceCanInInfo(Long supplierId, String crmNo) {
|
|
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.setSupplierName(e.getSupplierName());
|
|
tbDeviceInOut.setLocation(e.getLocation());
|
|
tbDeviceInOut.setLocation(e.getLocation());
|
|
tbDeviceInOut.setAddress(e.getAddress());
|
|
tbDeviceInOut.setAddress(e.getAddress());
|
|
|
|
+ tbDeviceInOut.setAddressArr(JSON.toJSONString(e.getAddressArr()));
|
|
tbDeviceInOut.setStatus(e.getDeviceStatus());
|
|
tbDeviceInOut.setStatus(e.getDeviceStatus());
|
|
tbDeviceInOut.setUsageType(usageType);
|
|
tbDeviceInOut.setUsageType(usageType);
|
|
tbDeviceInOut.setBasePhotoPath(e.getBasePhotoPath());
|
|
tbDeviceInOut.setBasePhotoPath(e.getBasePhotoPath());
|
|
@@ -123,6 +146,7 @@ public class TBDeviceInOutServiceImpl extends ServiceImpl<TBDeviceInOutMapper, T
|
|
UpdateWrapper<SysDevice> updateWrapper = new UpdateWrapper<>();
|
|
UpdateWrapper<SysDevice> updateWrapper = new UpdateWrapper<>();
|
|
updateWrapper.lambda()
|
|
updateWrapper.lambda()
|
|
.set(SysDevice::getLocation, e.getAddress())
|
|
.set(SysDevice::getLocation, e.getAddress())
|
|
|
|
+ .set(SysDevice::getLocationArr, JSON.toJSONString(e.getAddressArr()))
|
|
.set(SysDevice::getScanCount, e.getScanCount())
|
|
.set(SysDevice::getScanCount, e.getScanCount())
|
|
.set(SysDevice::getStatus, e.getDeviceStatus())
|
|
.set(SysDevice::getStatus, e.getDeviceStatus())
|
|
.set(SysDevice::getBound, inOutType)
|
|
.set(SysDevice::getBound, inOutType)
|
|
@@ -145,7 +169,19 @@ public class TBDeviceInOutServiceImpl extends ServiceImpl<TBDeviceInOutMapper, T
|
|
SysUser requestUser = (SysUser) ServletUtil.getRequestUser();
|
|
SysUser requestUser = (SysUser) ServletUtil.getRequestUser();
|
|
DataPermissionDto dpr = sysUserService.buildUserDataPermission(requestUser.getId());
|
|
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);
|
|
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;
|
|
}
|
|
}
|
|
}
|
|
}
|