提交 bf1312ac authored 作者: zhoushaopan's avatar zhoushaopan

feat(列装模块,申请模块,阅知模块): 解决了申请已入库数量不为0,修改维修和列装阅知

解决了申请已入库数量不为0,修改维修和列装阅知
上级 d43e83a0
...@@ -641,13 +641,18 @@ public class DeviceApplyController { ...@@ -641,13 +641,18 @@ public class DeviceApplyController {
//申请详情 //申请详情
if (deviceApplySaveVo.getStorageBillDetailVoList()!=null&&deviceApplySaveVo.getStorageBillDetailVoList().size() > 0) { if (deviceApplySaveVo.getStorageBillDetailVoList()!=null&&deviceApplySaveVo.getStorageBillDetailVoList().size() > 0) {
//分解父子结构 //分解父子结构
List<ApplyBillDetailVo> applyBillDetailVos = GetTreeUtils.splitTree(deviceApplySaveVo.getStorageBillDetailVoList(),ApplyBillDetailVo::getChilds,ApplyBillDetailVo::setChildNull); List<ApplyBillDetailVo> applyBillDetailVos = GetTreeUtils.splitTree(
deviceApplySaveVo.getStorageBillDetailVoList(),
ApplyBillDetailVo::getChilds,
ApplyBillDetailVo::setChildNull);
//拼接列装id和申请数量字符串 //拼接列装id和申请数量字符串
for (ApplyBillDetailVo s : applyBillDetailVos) { for (ApplyBillDetailVo s : applyBillDetailVos) {
stringBuffer.append(s.getPackingId()).append("x"); stringBuffer.append(s.getPackingId()).append("x");
//zsp //zsp
Integer packingId = s.getPackingId(); Integer packingId = s.getPackingId();
List<DeviceLibrary> deviceLibraries = deviceLibraryService.findAllByPackingId(packingId); List<DeviceLibrary> deviceLibraries = deviceLibraryService.findAllByPackingId(packingId);
deviceLibraries = deviceLibraries.stream().filter(deviceLibrary -> deviceLibrary.getTryOutDevice() == 1)
.collect(Collectors.toList());
if (deviceLibraries.size()>0){ if (deviceLibraries.size()>0){
s.setCompleteCount(deviceLibraries.size() + s.getCompleteCount()) ; s.setCompleteCount(deviceLibraries.size() + s.getCompleteCount()) ;
} }
......
...@@ -539,20 +539,19 @@ public class PackingController { ...@@ -539,20 +539,19 @@ public class PackingController {
map.put("error", "型号" + packingModelEdit.getModel() + "已存在"); map.put("error", "型号" + packingModelEdit.getModel() + "已存在");
return ResponseEntity.ok(map); return ResponseEntity.ok(map);
} }
packingLibrary.setShowOrder(packingModelEdit.getShowOrder()); packingLibrary.setShowOrder(packingModelEdit.getShowOrder());
PackingLog packingLog = new PackingLog(); PackingLog packingLog = new PackingLog();
if (packingLibrary.getIsRoot() == 1) {
if (packingLibrary.getIsRoot() == 1) { if (packingModelEdit.getModel() != null && !packingModelEdit.getModel().equals(packingLibrary.getModel())) {
if (packingModelEdit.getModel() != null && !packingModelEdit.getModel().equals(packingLibrary.getModel())) { //判断该列装下有没有入库装备 有装备则进行装备的型号的修改
//判断该列装下有没有入库装备 有装备则进行装备的型号的修改
//更新装备 //更新装备
long l2 = System.currentTimeMillis(); long l2 = System.currentTimeMillis();
List<DeviceLibrary> storagePackingDevices = deviceLibraryService.findAllByModel(packingLibrary.getModel()); List<DeviceLibrary> storagePackingDevices = deviceLibraryService.findAllByModel(packingLibrary.getModel());
if (storagePackingDevices.size()>0){ if (storagePackingDevices.size()>0){
deviceLibraryService.batchUpdateDevices(packingLibrary.getModel(),packingModelEdit.getModel());
//添加装备日志 //添加装备日志
String remark = "将原型号"+packingLibrary.getModel()+"修改型号为"+packingModelEdit.getModel(); String remark = "将原型号"+packingLibrary.getModel()+"修改型号为"+packingModelEdit.getModel();
deviceLibraryService.batchUpdateDevices(packingLibrary.getModel(),packingModelEdit.getModel());
List<Integer> deviceIds = storagePackingDevices.stream().map(DeviceLibrary::getId).collect(Collectors.toList()); List<Integer> deviceIds = storagePackingDevices.stream().map(DeviceLibrary::getId).collect(Collectors.toList());
List<DeviceLog> logDtos=new ArrayList<>(); List<DeviceLog> logDtos=new ArrayList<>();
deviceIds.forEach(integer -> { deviceIds.forEach(integer -> {
...@@ -571,25 +570,34 @@ public class PackingController { ...@@ -571,25 +570,34 @@ public class PackingController {
} }
log.info("batchUpdateDevices时间:{}", System.currentTimeMillis() - l2); log.info("batchUpdateDevices时间:{}", System.currentTimeMillis() - l2);
// } // }
packingLibrary.setModel(packingModelEdit.getModel()); String remark = "将原型号"+packingLibrary.getModel()+"修改型号为"+packingModelEdit.getModel();
packingLibrary.setName(packingModelEdit.getModel()); packingLibrary.setModel(packingModelEdit.getModel());
packingLibraryService.changeAllModel(packingLibrary.getId(), packingModelEdit.getModel()); packingLibrary.setName(packingModelEdit.getModel());
//添加列装日志 packingLibraryService.changeAllModel(packingLibrary.getId(), packingModelEdit.getModel());
//添加列装日志
// PackingLog packingLog = new PackingLog(); // PackingLog packingLog = new PackingLog();
packingLog.setRemark("将原型号"+packingLibrary.getModel()+"修改型号为"+packingModelEdit.getModel()); packingLog.setRemark(remark);
packingLog.setPackingId(packingLibrary.getId()); packingLog.setPackingId(packingLibrary.getId());
packingLogService.add(packingLog); packingLogService.add(packingLog);
}
BeanUtils.copyProperties(packingModelEdit, packingLibrary);
packingLibraryService.update(packingLibrary);
List<Integer> userIds = userPublicService.findOtherUser(userUtils.getCurrentUserId());
MessageBto messageBto = new MessageBto();
// if (packingModelEdit.getModel() != null && !packingModelEdit.getModel().equals(packingLibrary.getModel())){
// messageBto= new MessageBto(0, 1, "修改列装:"+packingLog.getRemark(), userIds, 0);
//// MessageBto messageBto = new MessageBto(0, 1, "修改列装型号目录", userIds, 0);
// }else {
if (packingLog.getRemark()!=null){
messageBto= new MessageBto(0, 1, "修改列装目录为:"+packingLog.getRemark(), userIds, 0);
}
// }
messageService.add(messageBto);
} else {
throw new ApiException("传入的列装id不是型号");
} }
BeanUtils.copyProperties(packingModelEdit, packingLibrary);
packingLibraryService.update(packingLibrary);
//发送阅知信息
List<Integer> userIds = userPublicService.findOtherUser(userUtils.getCurrentUserId());
// MessageBto messageBto = new MessageBto(0, 1, "修改列装型号目录", userIds, 0);
MessageBto messageBto = new MessageBto(0, 1, "修改列装:"+packingLog.getRemark(), userIds, 0);
messageService.add(messageBto);
} else {
throw new ApiException("传入的列装id不是型号");
}
//更新缓存 //更新缓存
packingLibraryService.getSortMap(); packingLibraryService.getSortMap();
if (packingModelEdit.getShowOrder() != null){ if (packingModelEdit.getShowOrder() != null){
......
...@@ -1263,7 +1263,9 @@ public class RepairController { ...@@ -1263,7 +1263,9 @@ public class RepairController {
.map(User::getUserId) .map(User::getUserId)
.collect(Collectors.toList())); .collect(Collectors.toList()));
// MessageBto messageBto2 = new MessageBto(0, 5, "待领取送修装备", integerList); // MessageBto messageBto2 = new MessageBto(0, 5, "待领取送修装备", integerList);
MessageBto messageBto2 = new MessageBto(0, 5, "待领取送修装备", integerList,1,1); MessageBto messageBto2 = new MessageBto(0, 5, "待领取送修装备,型号为"+
deviceLibraries.stream().map(DeviceLibrary::getModel).collect(Collectors.toList()),
integerList,1,1);
//存放详情id集合 //存放详情id集合
messageBto2.setRecord(StringSplitUtil.idListToString(messageMap.get(integer))); messageBto2.setRecord(StringSplitUtil.idListToString(messageMap.get(integer)));
messageService.add(messageBto2); messageService.add(messageBto2);
...@@ -1404,6 +1406,7 @@ public class RepairController { ...@@ -1404,6 +1406,7 @@ public class RepairController {
}); });
//各单位阅知map //各单位阅知map
Map<Integer, List<Integer>> messageMap = new HashMap<>(); Map<Integer, List<Integer>> messageMap = new HashMap<>();
List<DeviceLibrary> deviceLibraries = new ArrayList<>();
for (Integer id : repairStatusChangeVo.getId()) { for (Integer id : repairStatusChangeVo.getId()) {
//获取维修详情单 //获取维修详情单
RepairDetail repairDetail1 = deviceRepairDetailService.getOne(id); RepairDetail repairDetail1 = deviceRepairDetailService.getOne(id);
...@@ -1415,6 +1418,7 @@ public class RepairController { ...@@ -1415,6 +1418,7 @@ public class RepairController {
//在库 //在库
deviceLibrary.setLifeStatus(2); deviceLibrary.setLifeStatus(2);
deviceLibraryService.update(deviceLibrary); deviceLibraryService.update(deviceLibrary);
deviceLibraries.add(deviceLibrary);
//存装备日志 //存装备日志
DeviceLogDto deviceLogDto = new DeviceLogDto(deviceLibrary.getId(), "维修完成,装备状态改为在库", null, null); DeviceLogDto deviceLogDto = new DeviceLogDto(deviceLibrary.getId(), "维修完成,装备状态改为在库", null, null);
deviceLogService.addLog(deviceLogDto); deviceLogService.addLog(deviceLogDto);
...@@ -1432,6 +1436,7 @@ public class RepairController { ...@@ -1432,6 +1436,7 @@ public class RepairController {
repairDetail1.setNewDeviceDetailId(0); repairDetail1.setNewDeviceDetailId(0);
DeviceLibrary deviceLibrary = deviceLibraryService.getOne(repairDetail1.getDeviceId()); DeviceLibrary deviceLibrary = deviceLibraryService.getOne(repairDetail1.getDeviceId());
deviceLibrary.setLifeStatus(5); deviceLibrary.setLifeStatus(5);
deviceLibraries.add(deviceLibrary);
deviceLibraryService.update(deviceLibrary); deviceLibraryService.update(deviceLibrary);
} }
deviceRepairDetailService.update(repairDetail1); deviceRepairDetailService.update(repairDetail1);
...@@ -1479,7 +1484,8 @@ public class RepairController { ...@@ -1479,7 +1484,8 @@ public class RepairController {
ids2.addAll(userDao.findAllByUnitsId(integer).stream() ids2.addAll(userDao.findAllByUnitsId(integer).stream()
.map(User::getUserId) .map(User::getUserId)
.collect(Collectors.toList())); .collect(Collectors.toList()));
MessageBto messageBto2 = new MessageBto(0, 5, "待领取送修装备", ids2,1,1); MessageBto messageBto2 = new MessageBto(0, 5, "待领取送修装备,型号为"+
deviceLibraries.stream().map(DeviceLibrary::getModel).collect(Collectors.toList()), ids2,1,1);
messageBto2.setRecord(StringSplitUtil.idListToString(messageMap.get(integer))); messageBto2.setRecord(StringSplitUtil.idListToString(messageMap.get(integer)));
messageService.add(messageBto2); messageService.add(messageBto2);
}); });
...@@ -1983,7 +1989,8 @@ public class RepairController { ...@@ -1983,7 +1989,8 @@ public class RepairController {
integerList.addAll(userDao.findAllByUnitsId(unitId).stream() integerList.addAll(userDao.findAllByUnitsId(unitId).stream()
.map(User::getUserId) .map(User::getUserId)
.collect(Collectors.toList())); .collect(Collectors.toList()));
MessageBto messageBto2 = new MessageBto(0, 5, "待领取送修装备", integerList,1,1); MessageBto messageBto2 = new MessageBto(0, 5, "待领取送修装备,型号为"+
deviceLibraries.stream().map(DeviceLibrary::getModel).collect(Collectors.toList()), integerList,1,1);
messageBto2.setRecord(String.valueOf(repairDetail1.getId())); messageBto2.setRecord(String.valueOf(repairDetail1.getId()));
messageService.add(messageBto2); messageService.add(messageBto2);
} }
...@@ -2161,7 +2168,8 @@ public class RepairController { ...@@ -2161,7 +2168,8 @@ public class RepairController {
integerList.addAll(userDao.findAllByUnitsId(integer).stream() integerList.addAll(userDao.findAllByUnitsId(integer).stream()
.map(User::getUserId) .map(User::getUserId)
.collect(Collectors.toList())); .collect(Collectors.toList()));
MessageBto messageBto2 = new MessageBto(0, 5, "待领取送修装备", integerList,1,1); MessageBto messageBto2 = new MessageBto(0, 5, "待领取送修装备,型号为"+
models, integerList,1,1);
//阅知记录id拼接 //阅知记录id拼接
messageBto2.setRecord(StringSplitUtil.idListToString(messageMap.get(integer))); messageBto2.setRecord(StringSplitUtil.idListToString(messageMap.get(integer)));
messageService.add(messageBto2); messageService.add(messageBto2);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论