提交 3a07e021 authored 作者: zhoushaopan's avatar zhoushaopan

feat(申请模块): 新增去重序列号接口

新增去重序列号接口
上级 15377184
...@@ -459,25 +459,25 @@ public class DeviceApplyController { ...@@ -459,25 +459,25 @@ public class DeviceApplyController {
deviceApplyBillService.update(deviceApplyBill); deviceApplyBillService.update(deviceApplyBill);
} }
else { else {
if (uploadApplyFile.getReplyVos() != null && uploadApplyFile.getReplyVos().size() > 0) { // if (uploadApplyFile.getReplyVos() != null && uploadApplyFile.getReplyVos().size() > 0) {
for (ReplyVo replyVo : uploadApplyFile.getReplyVos()) { // for (ReplyVo replyVo : uploadApplyFile.getReplyVos()) {
ResponseEntity responseEntity = packingController.seqsExist(replyVo.getId(), replyVo.getNum(), replyVo.getSeqInterval()); // ResponseEntity responseEntity = packingController.seqsExist(replyVo.getId(), replyVo.getNum(), replyVo.getSeqInterval());
if (!"ok".equals(responseEntity.getBody())) { // if (!"ok".equals(responseEntity.getBody())) {
return responseEntity; // return responseEntity;
} // }
} // }
} // }
if (uploadApplyFile.getApplyBillDetailVos() != null && uploadApplyFile.getApplyBillDetailVos().size() > 0) { // if (uploadApplyFile.getApplyBillDetailVos() != null && uploadApplyFile.getApplyBillDetailVos().size() > 0) {
for (ApplyBillDetailVo a : uploadApplyFile.getApplyBillDetailVos()) { // for (ApplyBillDetailVo a : uploadApplyFile.getApplyBillDetailVos()) {
// ResponseEntity responseEntity = packingController.seqsNotExist(a.getPackingId(), a.getStorageCount(), a.getSeqInterval()); //// ResponseEntity responseEntity = packingController.seqsNotExist(a.getPackingId(), a.getStorageCount(), a.getSeqInterval());
// ResponseEntity responseEntity = packingController.seqsNotExist(a.getPackingId(), a.getWaitNum(), a.getSeqInterval()); //// ResponseEntity responseEntity = packingController.seqsNotExist(a.getPackingId(), a.getWaitNum(), a.getSeqInterval());
ResponseEntity responseEntity = packingController.seqsNotExist(a.getPackingId(), // ResponseEntity responseEntity = packingController.seqsNotExist(a.getPackingId(),
a.getWaitNum()-a.getCompleteCount(), a.getSeqInterval()); // a.getWaitNum()-a.getCompleteCount(), a.getSeqInterval());
if (!"ok".equals(responseEntity.getBody())) { // if (!"ok".equals(responseEntity.getBody())) {
return responseEntity; // return responseEntity;
} // }
} // }
} // }
//判断是入库还是显示业务待办结 //判断是入库还是显示业务待办结
DeviceApplyBill deviceApplyBill = deviceApplyBillService.getOne(taskBto.getBillId()); DeviceApplyBill deviceApplyBill = deviceApplyBillService.getOne(taskBto.getBillId());
...@@ -689,9 +689,11 @@ public class DeviceApplyController { ...@@ -689,9 +689,11 @@ public class DeviceApplyController {
//更新装备 //更新装备
deviceLibraryService.updateTry(deviceLibraryService.findByIds(deviceIds)); deviceLibraryService.updateTry(deviceLibraryService.findByIds(deviceIds));
//添加装备日志 //添加装备日志
Integer userId = userUtils.getCurrentUserId();
List<DeviceLogDto> deviceLogDtoList = new ArrayList<>(); List<DeviceLogDto> deviceLogDtoList = new ArrayList<>();
deviceIds.forEach(integer -> { deviceIds.forEach(integer -> {
DeviceLogDto deviceLogDto = new DeviceLogDto(integer,"装备从试用修改为正式",null); DeviceLogDto deviceLogDto = new DeviceLogDto(integer,"装备从试用修改为正式",null,
userId,null);
deviceLogDtoList.add(deviceLogDto); deviceLogDtoList.add(deviceLogDto);
}); });
executor.execute(()->{ executor.execute(()->{
...@@ -721,6 +723,22 @@ public class DeviceApplyController { ...@@ -721,6 +723,22 @@ public class DeviceApplyController {
return ResponseEntity.ok(stringBufferList); return ResponseEntity.ok(stringBufferList);
} }
@ApiOperation(value = "当修改试用装备序列时,移除序列号区间中所在的序列号", notes = "当修改试用装备序列时,移除序列号区间中所在的序列号")
@PostMapping("/removeFromSeqList")
@Transactional(rollbackFor = Exception.class)
public ResponseEntity removeFromSeqList(@RequestBody RemoveFromSeqListVo removeFromSeqListVo) {
List<String> stringList = deviceApplyBillService.removeFromSeqList(removeFromSeqListVo);
return ResponseEntity.ok(stringList);
}
@ApiOperation(value = "入库时候,如果试用装备的序列号在序列号区间,则进行去除", notes = "入库时候,如果试用装备的序列号在序列号区间,则进行去除")
@PostMapping("/removeSameSeq")
@Transactional(rollbackFor = Exception.class)
public ResponseEntity removeSameSeq(@RequestBody RemoveSameSeqVo removeSameSeqVo) {
List<String> stringList = deviceApplyBillService.removeSameSeq(removeSameSeqVo);
return ResponseEntity.ok(stringList);
}
/** /**
* 转实体 * 转实体
......
...@@ -3,6 +3,8 @@ package com.tykj.dev.device.apply.service; ...@@ -3,6 +3,8 @@ package com.tykj.dev.device.apply.service;
import com.tykj.dev.device.apply.subject.domin.DeviceApplyBill; import com.tykj.dev.device.apply.subject.domin.DeviceApplyBill;
import com.tykj.dev.device.apply.subject.vo.ApplyTaskDeviceCheckVo; import com.tykj.dev.device.apply.subject.vo.ApplyTaskDeviceCheckVo;
import com.tykj.dev.device.apply.subject.vo.RemoveFromSeqListVo;
import com.tykj.dev.device.apply.subject.vo.RemoveSameSeqVo;
import com.tykj.dev.device.library.subject.vo.ScriptSaveVo; import com.tykj.dev.device.library.subject.vo.ScriptSaveVo;
import java.util.List; import java.util.List;
...@@ -31,4 +33,12 @@ public interface DeviceApplyBillService { ...@@ -31,4 +33,12 @@ public interface DeviceApplyBillService {
List<StringBuffer> checkNumAndSeqNumber(List<ApplyTaskDeviceCheckVo> applyTaskDeviceCheckVos); List<StringBuffer> checkNumAndSeqNumber(List<ApplyTaskDeviceCheckVo> applyTaskDeviceCheckVos);
/**
* 申请任务入库 当修改试用装备序列时,移除序列号区间中所在的序列号
*/
List<String> removeFromSeqList(RemoveFromSeqListVo removeFromSeqListVo);
List<String> removeSameSeq(RemoveSameSeqVo removeSameSeqVo);
} }
...@@ -8,6 +8,8 @@ import com.tykj.dev.device.apply.repository.DeviceApplyBillDao; ...@@ -8,6 +8,8 @@ import com.tykj.dev.device.apply.repository.DeviceApplyBillDao;
import com.tykj.dev.device.apply.service.DeviceApplyBillService; import com.tykj.dev.device.apply.service.DeviceApplyBillService;
import com.tykj.dev.device.apply.subject.domin.DeviceApplyBill; import com.tykj.dev.device.apply.subject.domin.DeviceApplyBill;
import com.tykj.dev.device.apply.subject.vo.ApplyTaskDeviceCheckVo; import com.tykj.dev.device.apply.subject.vo.ApplyTaskDeviceCheckVo;
import com.tykj.dev.device.apply.subject.vo.RemoveFromSeqListVo;
import com.tykj.dev.device.apply.subject.vo.RemoveSameSeqVo;
import com.tykj.dev.device.apply.subject.vo.ReplyVo; import com.tykj.dev.device.apply.subject.vo.ReplyVo;
import com.tykj.dev.device.library.service.DeviceLibraryCacheService; import com.tykj.dev.device.library.service.DeviceLibraryCacheService;
import com.tykj.dev.device.library.service.DeviceLibraryService; import com.tykj.dev.device.library.service.DeviceLibraryService;
...@@ -25,6 +27,8 @@ import com.tykj.dev.device.user.util.UserUtils; ...@@ -25,6 +27,8 @@ import com.tykj.dev.device.user.util.UserUtils;
import com.tykj.dev.misc.base.StatusEnum; import com.tykj.dev.misc.base.StatusEnum;
import com.tykj.dev.misc.utils.DeviceSeqUtil; import com.tykj.dev.misc.utils.DeviceSeqUtil;
import com.tykj.dev.misc.utils.JacksonUtil; import com.tykj.dev.misc.utils.JacksonUtil;
import com.tykj.dev.misc.utils.StringSplitUtil;
import com.tykj.dev.misc.utils.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async; import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -239,16 +243,16 @@ public class DeviceApplyBillServiceImpl implements DeviceApplyBillService { ...@@ -239,16 +243,16 @@ public class DeviceApplyBillServiceImpl implements DeviceApplyBillService {
List<String> inputSeqs = DeviceSeqUtil.selectDeviceSeqs(seqNumInter); List<String> inputSeqs = DeviceSeqUtil.selectDeviceSeqs(seqNumInter);
if (!replyNum.equals(inputSeqs.size())){ if (!replyNum.equals(inputSeqs.size())){
//提示 批复数量跟输入区间不一致 //提示 批复数量跟输入区间不一致
stringBuffer.append("批复数量与序列号区间不一致").append(","); stringBuffer.append("批复数量与序列号区间不一致");
} }
//查询所有的序列号 检验是否重复 //查询所有的序列号 检验是否重复
List<String> allSeqList = deviceLibraryCacheService.getAllDeviceLibraryList().stream() // List<String> allSeqList = deviceLibraryCacheService.getAllDeviceLibraryList().stream()
.map(DeviceLibrary::getSeqNumber).collect(Collectors.toList()); // .map(DeviceLibrary::getSeqNumber).collect(Collectors.toList());
allSeqList.retainAll(inputSeqs); // allSeqList.retainAll(inputSeqs);
if (allSeqList.size()>0){ // if (allSeqList.size()>0){
//说明有重复的序列号 // //说明有重复的序列号
stringBuffer.append("序列号").append(allSeqList).append("已存在"); // stringBuffer.append("序列号").append(allSeqList).append("已存在");
} // }
} }
stringBufferList.add(stringBuffer); stringBufferList.add(stringBuffer);
...@@ -256,4 +260,32 @@ public class DeviceApplyBillServiceImpl implements DeviceApplyBillService { ...@@ -256,4 +260,32 @@ public class DeviceApplyBillServiceImpl implements DeviceApplyBillService {
return stringBufferList; return stringBufferList;
} }
@Override
public List<String> removeFromSeqList(RemoveFromSeqListVo removeFromSeqListVo) {
//对区间进行拆分
String seqNumberList = removeFromSeqListVo.getSeqNumberList();
//对序列号区间进行拆分
List<String> seqs = DeviceSeqUtil.selectDeviceSeqs(seqNumberList);
List<String> seq1 = DeviceSeqUtil.selectDeviceSeqs(removeFromSeqListVo.getSeqNumber());
seqs.removeAll(seq1);
//对原来的集合先进行排序
seqs.sort(Comparator.comparing(String::toString));
return DeviceSeqUtil.getContinuousSeqs(seqs);
}
@Override
public List<String> removeSameSeq(RemoveSameSeqVo removeSameSeqVo) {
String seqNumberList = removeSameSeqVo.getSeqNumberList();
List<String> selectDeviceSeqs = DeviceSeqUtil.selectDeviceSeqs(seqNumberList);
if (selectDeviceSeqs.size()>0){
List<String> removeSameSeq = removeSameSeqVo.getRemoveSameSeq();
if (removeSameSeq.size()>0){
selectDeviceSeqs.removeAll(removeSameSeq);
}
}
List<String> continuousSeqs = DeviceSeqUtil.getContinuousSeqs(selectDeviceSeqs);
return continuousSeqs;
}
} }
package com.tykj.dev.device.apply.subject.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author zsp
*/
@Data
@ApiModel("当修改试用装备序列时,移除序列号区间中所在的序列号vo")
public class RemoveFromSeqListVo {
@ApiModelProperty(value = "序列号区间")
private String seqNumberList;
@ApiModelProperty(value = "要移除的序列号")
private String seqNumber;
}
package com.tykj.dev.device.apply.subject.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
/**
* @author zsp
*/
@Data
@ApiModel("移除重复的序列号,在序列号区间中所在的序列号vo")
public class RemoveSameSeqVo {
@ApiModelProperty(value = "序列号区间")
private String seqNumberList;
@ApiModelProperty(value = "重复的序列号")
private List<String> removeSameSeq;
}
...@@ -65,12 +65,14 @@ public class PackingLibraryController { ...@@ -65,12 +65,14 @@ public class PackingLibraryController {
packingLibraries.forEach(packingLibrary -> { packingLibraries.forEach(packingLibrary -> {
List<String> inputSeqs = DeviceSeqUtil.selectDeviceSeqs(packingLibrary.getSeq()); List<String> inputSeqs = DeviceSeqUtil.selectDeviceSeqs(packingLibrary.getSeq());
List<String> outputSeqs = new ArrayList<>(); List<String> outputSeqs = new ArrayList<>();
inputSeqs.forEach(s -> { // inputSeqs.forEach(s -> {
if (map.get(s)==null){ // if (map.get(s)==null){
outputSeqs.add(s); // outputSeqs.add(s);
} // }
}); // });
packingLibrary.setSeq(StringSplitUtil.stringListToString(DeviceSeqUtil.getContinuousSeqs(outputSeqs))); // packingLibrary.setSeq(StringSplitUtil.stringListToString(DeviceSeqUtil.getContinuousSeqs(outputSeqs)));
packingLibrary.setSeq(StringSplitUtil.stringListToString(DeviceSeqUtil.getContinuousSeqs(inputSeqs)));
}); });
//返回父子结构 //返回父子结构
Map<Integer, PackingLibrary> nodeCollect = Map<Integer, PackingLibrary> nodeCollect =
......
...@@ -569,6 +569,7 @@ public class StorageBillController { ...@@ -569,6 +569,7 @@ public class StorageBillController {
} }
rfidService.printString(printVos); rfidService.printString(printVos);
} }
//更新申请业务入库数量 //更新申请业务入库数量
if (deviceApplyBills.size()>0){ if (deviceApplyBills.size()>0){
deviceApplyBills.forEach(deviceApplyBill -> { deviceApplyBills.forEach(deviceApplyBill -> {
...@@ -578,6 +579,21 @@ public class StorageBillController { ...@@ -578,6 +579,21 @@ public class StorageBillController {
ApplyBillDetailVo applyBillDetailVo = applyBillDetailVos.get(i); ApplyBillDetailVo applyBillDetailVo = applyBillDetailVos.get(i);
if (map.get(applyBillDetailVo.getPackingId())!=null){ if (map.get(applyBillDetailVo.getPackingId())!=null){
applyBillDetailVo.setCompleteCount(map.get(applyBillDetailVo.getPackingId()).getCompleteCount()); applyBillDetailVo.setCompleteCount(map.get(applyBillDetailVo.getPackingId()).getCompleteCount());
//更新序列号
String seqInterval = applyBillDetailVo.getSeqInterval();
List<String> seqs = DeviceSeqUtil.selectDeviceSeqs(seqInterval);
List<DeviceLibrarySaveVo> deviceLibrarySaveVoList = storageBillSaveVo.getDeviceLibrarySaveVoList();
List<String> storageSeq = deviceLibrarySaveVoList.stream().map(DeviceLibrarySaveVo::getSeqNumber).collect(Collectors.toList());
seqs.removeAll(storageSeq);
//根据试用装备的id查询序列号
List<Integer> deviceIds = storageBillSaveVo.getDeviceIds();
if (deviceIds.size()>0){
List<DeviceLibrary> byIds = deviceLibraryService.findByIds(deviceIds);
//获取序列号
List<String> seqNumbers = byIds.stream().map(DeviceLibrary::getSeqNumber).collect(Collectors.toList());
seqs.removeAll(seqNumbers);
}
applyBillDetailVo.setSeqInterval(StringSplitUtil.stringListToString(seqs));
applyBillDetailVos.set(i,applyBillDetailVo); applyBillDetailVos.set(i,applyBillDetailVo);
if (!applyBillDetailVo.getWaitNum().equals(applyBillDetailVo.getCompleteCount())){ if (!applyBillDetailVo.getWaitNum().equals(applyBillDetailVo.getCompleteCount())){
isEnd = false; isEnd = false;
...@@ -591,7 +607,7 @@ public class StorageBillController { ...@@ -591,7 +607,7 @@ public class StorageBillController {
taskService.moveToEnd(taskBto1); taskService.moveToEnd(taskBto1);
//发送阅知信息 //发送阅知信息
MessageBto messageBto = new MessageBto(); MessageBto messageBto = new MessageBto();
messageBto.setContent("业务办结"); messageBto.setContent("申请业务完结");
messageBto.setTaskId(taskBto1.getId()); messageBto.setTaskId(taskBto1.getId());
messageBto.setIsHighLight(0); messageBto.setIsHighLight(0);
messageBto.setInvolveUserIdList(userPublicService.findOtherUser(userId)); messageBto.setInvolveUserIdList(userPublicService.findOtherUser(userId));
...@@ -663,7 +679,8 @@ public class StorageBillController { ...@@ -663,7 +679,8 @@ public class StorageBillController {
deviceLibraryService.updateTry(deviceLibraries); deviceLibraryService.updateTry(deviceLibraries);
List<DeviceLogDto> deviceLogDtoList = new ArrayList<>(); List<DeviceLogDto> deviceLogDtoList = new ArrayList<>();
storageBillSaveVo.getDeviceIds().forEach(integer -> { storageBillSaveVo.getDeviceIds().forEach(integer -> {
DeviceLogDto deviceLogDto = new DeviceLogDto(integer,"试用装备改为正式装备",null); DeviceLogDto deviceLogDto = new DeviceLogDto(integer,"试用装备改为正式装备",
null,userId,null);
deviceLogDtoList.add(deviceLogDto); deviceLogDtoList.add(deviceLogDto);
}); });
executor.execute(()->{ executor.execute(()->{
...@@ -672,18 +689,6 @@ public class StorageBillController { ...@@ -672,18 +689,6 @@ public class StorageBillController {
} }
} }
} }
// if(storageBillSaveVo.getTryOutDevice() == 0){
// List<DeviceLibrarySaveVo> deviceLibrarySaveVoList = storageBillSaveVo.getDeviceLibrarySaveVoList();
// deviceLibrarySaveVoList.forEach(deviceLibrarySaveVo -> {
// List<DeviceLibrary> deviceLibraries = deviceLibraryService.findAllByPackingId(deviceLibrarySaveVo.getPackingId());
// deviceLibraries = deviceLibraries.stream().filter(deviceLibrary -> deviceLibrary.getTryOutDevice() == 1)
// .collect(Collectors.toList());
// if (deviceLibraries.size()>0){
// //将装备试用的改为正式的
// deviceLibraryService.updateTry(deviceLibraries);
// }
// });
// }
//异步去查询数据库 //异步去查询数据库
executor.execute( executor.execute(
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论