|
@@ -91,7 +91,7 @@ public class TBDeviceDeliveryServiceImpl extends ServiceImpl<TBDeviceDeliveryMap
|
|
|
List<DeviceDeliveryImportDto> deviceDeliveryImportDtoList = deviceDeliveryImportDtoLinkedMultiValueMap.get(
|
|
|
BasicExcelListener.SUCCESS);
|
|
|
|
|
|
- if (errorData.toString().length() > 0){
|
|
|
+ if (errorData.toString().length() > 0) {
|
|
|
throw ExceptionResultEnum.ERROR.exception(errorData.toString());
|
|
|
}
|
|
|
|
|
@@ -230,9 +230,11 @@ public class TBDeviceDeliveryServiceImpl extends ServiceImpl<TBDeviceDeliveryMap
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public IPage<TBDeviceDeliveryResult> page(IPage<TBDeviceDeliveryResult> iPage, Long serviceId, DeviceUsageTypeEnum usageType,
|
|
|
- String crmNo, DeviceDeliveryStatusEnum status, Long deliverUserId, Long deliveryStartTime, Long deliveryEndTime, String serialNo, String deviceNo, Long supplierId,
|
|
|
- Long receiveStartTime, Long receiveEndTime, String consignee, String mailingAddress, InOutTypeEnum deliveryType, String brand, String model, String expressNo) throws Exception {
|
|
|
+ public IPage<TBDeviceDeliveryResult> page(IPage<TBDeviceDeliveryResult> iPage, Long serviceId,
|
|
|
+ DeviceUsageTypeEnum usageType, String crmNo, DeviceDeliveryStatusEnum status, Long deliverUserId,
|
|
|
+ Long deliveryStartTime, Long deliveryEndTime, String serialNo, String deviceNo, Long supplierId,
|
|
|
+ Long receiveStartTime, Long receiveEndTime, String consignee, String mailingAddress,
|
|
|
+ InOutTypeEnum deliveryType, String brand, String model, String expressNo) throws Exception {
|
|
|
crmNo = SystemConstant.translateSpecificSign(crmNo);
|
|
|
serialNo = SystemConstant.translateSpecificSign(serialNo);
|
|
|
deviceNo = SystemConstant.translateSpecificSign(deviceNo);
|
|
@@ -265,8 +267,9 @@ public class TBDeviceDeliveryServiceImpl extends ServiceImpl<TBDeviceDeliveryMap
|
|
|
@Override
|
|
|
public List<TBDeviceDeliveryResult> list(Long serviceId, DeviceUsageTypeEnum usageType, String crmNo,
|
|
|
DeviceDeliveryStatusEnum status, Long deliverUserId, Long deliveryStartTime, Long deliveryEndTime,
|
|
|
- String serialNo, String deviceNo, Long supplierId, Long receiveStartTime, Long receiveEndTime, String consignee, String mailingAddress,
|
|
|
- InOutTypeEnum deliveryType, String brand, String model, String expressNo) throws Exception {
|
|
|
+ String serialNo, String deviceNo, Long supplierId, Long receiveStartTime, Long receiveEndTime,
|
|
|
+ String consignee, String mailingAddress, InOutTypeEnum deliveryType, String brand, String model,
|
|
|
+ String expressNo) throws Exception {
|
|
|
|
|
|
crmNo = SystemConstant.translateSpecificSign(crmNo);
|
|
|
serialNo = SystemConstant.translateSpecificSign(serialNo);
|
|
@@ -501,25 +504,29 @@ public class TBDeviceDeliveryServiceImpl extends ServiceImpl<TBDeviceDeliveryMap
|
|
|
for (FlowFormWidgetResult t : flowFormWidgetResultList) {
|
|
|
if (t.getFormId().contains(SystemConstant.DEVICE_OUT_TABLE)) {
|
|
|
JSONObject jsonObject = JSONObject.parseObject(t.getValue());
|
|
|
- JSONArray jsonArray = jsonObject.getJSONArray(SystemConstant.VALUE);
|
|
|
- for (int i = 0; i < jsonArray.size(); i++) {
|
|
|
- DeviceInOutForm deviceInOutForm = GsonUtil.fromJson(GsonUtil.toJson(jsonArray.getJSONObject(i)),
|
|
|
- DeviceInOutForm.class);
|
|
|
- deviceSerialNoList.add(deviceInOutForm.getSerialNo());
|
|
|
+ if (Objects.nonNull(jsonObject)) {
|
|
|
+ JSONArray jsonArray = jsonObject.getJSONArray(SystemConstant.VALUE);
|
|
|
+ for (int i = 0; i < jsonArray.size(); i++) {
|
|
|
+ DeviceInOutForm deviceInOutForm = GsonUtil.fromJson(GsonUtil.toJson(jsonArray.getJSONObject(i)),
|
|
|
+ DeviceInOutForm.class);
|
|
|
+ deviceSerialNoList.add(deviceInOutForm.getSerialNo());
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- List<TBDeviceDelivery> tbDeviceDeliveryList = this.list(
|
|
|
- new QueryWrapper<TBDeviceDelivery>().lambda().eq(TBDeviceDelivery::getEffect, true)
|
|
|
- .in(TBDeviceDelivery::getSerialNo, deviceSerialNoList));
|
|
|
- if (!CollectionUtils.isEmpty(tbDeviceDeliveryList)) {
|
|
|
- for (TBDeviceDelivery t : tbDeviceDeliveryList) {
|
|
|
- t.setStatus(status);
|
|
|
- t.setReceiveTime(System.currentTimeMillis());
|
|
|
- t.setReceiveUserId(userId);
|
|
|
- t.updateInfo(userId);
|
|
|
+ if (!CollectionUtils.isEmpty(deviceSerialNoList)) {
|
|
|
+ List<TBDeviceDelivery> tbDeviceDeliveryList = this.list(
|
|
|
+ new QueryWrapper<TBDeviceDelivery>().lambda().eq(TBDeviceDelivery::getEffect, true)
|
|
|
+ .in(TBDeviceDelivery::getSerialNo, deviceSerialNoList));
|
|
|
+ if (!CollectionUtils.isEmpty(tbDeviceDeliveryList)) {
|
|
|
+ for (TBDeviceDelivery t : tbDeviceDeliveryList) {
|
|
|
+ t.setStatus(status);
|
|
|
+ t.setReceiveTime(System.currentTimeMillis());
|
|
|
+ t.setReceiveUserId(userId);
|
|
|
+ t.updateInfo(userId);
|
|
|
+ }
|
|
|
+ this.updateBatchById(tbDeviceDeliveryList);
|
|
|
}
|
|
|
- this.updateBatchById(tbDeviceDeliveryList);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -532,33 +539,35 @@ public class TBDeviceDeliveryServiceImpl extends ServiceImpl<TBDeviceDeliveryMap
|
|
|
for (FlowFormWidgetResult t : flowFormWidgetResultList) {
|
|
|
if (t.getFormId().contains(SystemConstant.DEVICE_OUT_TABLE)) {
|
|
|
JSONObject jsonObject = JSONObject.parseObject(t.getValue());
|
|
|
- JSONArray jsonArray = jsonObject.getJSONArray(SystemConstant.VALUE);
|
|
|
- for (int i = 0; i < jsonArray.size(); i++) {
|
|
|
- DeviceInOutForm deviceInOutForm = GsonUtil.fromJson(GsonUtil.toJson(jsonArray.getJSONObject(i)),
|
|
|
- DeviceInOutForm.class);
|
|
|
- deviceSerialNoList.add(deviceInOutForm.getSerialNo());
|
|
|
-
|
|
|
- List<TBDeviceInOut> tbDeviceInOutList = tbDeviceInOutService.list(
|
|
|
- new QueryWrapper<TBDeviceInOut>().lambda().eq(TBDeviceInOut::getSopNo, sopNo)
|
|
|
- .eq(TBDeviceInOut::getType, InOutTypeEnum.OUT)
|
|
|
- .eq(TBDeviceInOut::getDeviceSerialNo, deviceInOutForm.getSerialNo()));
|
|
|
- if (!CollectionUtils.isEmpty(tbDeviceInOutList)) {
|
|
|
- for (TBDeviceInOut tbDeviceInOut : tbDeviceInOutList) {
|
|
|
- SysDevice sysDevice = sysDeviceService.getOne(new QueryWrapper<SysDevice>().lambda()
|
|
|
- .eq(SysDevice::getSerialNo, deviceInOutForm.getSerialNo()));
|
|
|
- sysDevice.setLocation(tbDeviceInOut.getLocation());
|
|
|
- sysDevice.setLocationArr(tbDeviceInOut.getAddressArr());
|
|
|
- sysDevice.setBound(InOutTypeEnum.IN);
|
|
|
- sysDevice.updateInfo(userId);
|
|
|
- sysDeviceService.updateById(sysDevice);
|
|
|
+ if (Objects.nonNull(jsonObject)) {
|
|
|
+ JSONArray jsonArray = jsonObject.getJSONArray(SystemConstant.VALUE);
|
|
|
+ for (int i = 0; i < jsonArray.size(); i++) {
|
|
|
+ DeviceInOutForm deviceInOutForm = GsonUtil.fromJson(GsonUtil.toJson(jsonArray.getJSONObject(i)),
|
|
|
+ DeviceInOutForm.class);
|
|
|
+ deviceSerialNoList.add(deviceInOutForm.getSerialNo());
|
|
|
+
|
|
|
+ List<TBDeviceInOut> tbDeviceInOutList = tbDeviceInOutService.list(
|
|
|
+ new QueryWrapper<TBDeviceInOut>().lambda().eq(TBDeviceInOut::getSopNo, sopNo)
|
|
|
+ .eq(TBDeviceInOut::getType, InOutTypeEnum.OUT)
|
|
|
+ .eq(TBDeviceInOut::getDeviceSerialNo, deviceInOutForm.getSerialNo()));
|
|
|
+ if (!CollectionUtils.isEmpty(tbDeviceInOutList)) {
|
|
|
+ for (TBDeviceInOut tbDeviceInOut : tbDeviceInOutList) {
|
|
|
+ SysDevice sysDevice = sysDeviceService.getOne(new QueryWrapper<SysDevice>().lambda()
|
|
|
+ .eq(SysDevice::getSerialNo, deviceInOutForm.getSerialNo()));
|
|
|
+ sysDevice.setLocation(tbDeviceInOut.getLocation());
|
|
|
+ sysDevice.setLocationArr(tbDeviceInOut.getAddressArr());
|
|
|
+ sysDevice.setBound(InOutTypeEnum.IN);
|
|
|
+ sysDevice.updateInfo(userId);
|
|
|
+ sysDeviceService.updateById(sysDevice);
|
|
|
+ }
|
|
|
+ tbDeviceInOutService.removeByIds(
|
|
|
+ tbDeviceInOutList.stream().map(TBDeviceInOut::getId).collect(Collectors.toList()));
|
|
|
}
|
|
|
- tbDeviceInOutService.removeByIds(
|
|
|
- tbDeviceInOutList.stream().map(TBDeviceInOut::getId).collect(Collectors.toList()));
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- if (deviceDeliveryUpdate) {
|
|
|
+ if (deviceDeliveryUpdate && !CollectionUtils.isEmpty(deviceSerialNoList)) {
|
|
|
List<TBDeviceDelivery> tbDeviceDeliveryList = this.list(
|
|
|
new QueryWrapper<TBDeviceDelivery>().lambda().eq(TBDeviceDelivery::getEffect, true)
|
|
|
.in(TBDeviceDelivery::getSerialNo, deviceSerialNoList));
|
|
@@ -587,10 +596,12 @@ public class TBDeviceDeliveryServiceImpl extends ServiceImpl<TBDeviceDeliveryMap
|
|
|
throw ExceptionResultEnum.ERROR.exception(String.format("所选设备序列号为[%s]的记录是已完成的数据,不能操作", serialNo));
|
|
|
}
|
|
|
TBDeviceInOut tbDeviceInOut = tbDeviceInOutService.getOne(
|
|
|
- new QueryWrapper<TBDeviceInOut>().lambda().eq(TBDeviceInOut::getDeviceSerialNo, serialNo).orderByDesc(TBDeviceInOut::getSerialNo).last(SystemConstant.LIMIT1));
|
|
|
+ new QueryWrapper<TBDeviceInOut>().lambda().eq(TBDeviceInOut::getDeviceSerialNo, serialNo)
|
|
|
+ .orderByDesc(TBDeviceInOut::getSerialNo).last(SystemConstant.LIMIT1));
|
|
|
|
|
|
SysDevice sysDevice = sysDeviceService.getOne(
|
|
|
- new QueryWrapper<SysDevice>().lambda().eq(SysDevice::getSerialNo, serialNo).last(SystemConstant.LIMIT1));
|
|
|
+ new QueryWrapper<SysDevice>().lambda().eq(SysDevice::getSerialNo, serialNo)
|
|
|
+ .last(SystemConstant.LIMIT1));
|
|
|
if (Objects.isNull(sysDevice)) {
|
|
|
throw ExceptionResultEnum.ERROR.exception(String.format("所选设备序列号为[%s]的设备在设备配置表中不存在", serialNo));
|
|
|
}
|
|
@@ -662,15 +673,18 @@ public class TBDeviceDeliveryServiceImpl extends ServiceImpl<TBDeviceDeliveryMap
|
|
|
DeviceDeliveryStatusEnum status = tbDeviceDelivery.getStatus();
|
|
|
if (!InOutTypeEnum.OUT.equals(type) || !DeviceDeliveryStatusEnum.RECEIVE.equals(status)) {
|
|
|
throw ExceptionResultEnum.ERROR.exception(
|
|
|
- String.format("所选设备序列号为[%s]的记录的发货状态必须是[%s][%s],且不能是[%s]用途", serialNo, InOutTypeEnum.OUT.getTitle(),
|
|
|
- DeviceDeliveryStatusEnum.RECEIVE.getTitle(), DeviceUsageTypeEnum.PROJECT.getTitle()));
|
|
|
+ String.format("所选设备序列号为[%s]的记录的发货状态必须是[%s][%s],且不能是[%s]用途", serialNo,
|
|
|
+ InOutTypeEnum.OUT.getTitle(), DeviceDeliveryStatusEnum.RECEIVE.getTitle(),
|
|
|
+ DeviceUsageTypeEnum.PROJECT.getTitle()));
|
|
|
}
|
|
|
|
|
|
TBDeviceInOut tbDeviceInOut = tbDeviceInOutService.getOne(
|
|
|
- new QueryWrapper<TBDeviceInOut>().lambda().eq(TBDeviceInOut::getDeviceSerialNo, serialNo).orderByDesc(TBDeviceInOut::getSerialNo).last(SystemConstant.LIMIT1));
|
|
|
+ new QueryWrapper<TBDeviceInOut>().lambda().eq(TBDeviceInOut::getDeviceSerialNo, serialNo)
|
|
|
+ .orderByDesc(TBDeviceInOut::getSerialNo).last(SystemConstant.LIMIT1));
|
|
|
|
|
|
SysDevice sysDevice = sysDeviceService.getOne(
|
|
|
- new QueryWrapper<SysDevice>().lambda().eq(SysDevice::getSerialNo, serialNo).last(SystemConstant.LIMIT1));
|
|
|
+ new QueryWrapper<SysDevice>().lambda().eq(SysDevice::getSerialNo, serialNo)
|
|
|
+ .last(SystemConstant.LIMIT1));
|
|
|
if (Objects.isNull(sysDevice)) {
|
|
|
throw ExceptionResultEnum.ERROR.exception(String.format("所选设备序列号为[%s]的设备在设备配置表中不存在", serialNo));
|
|
|
}
|