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

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

新增去重序列号接口
上级 15377184
......@@ -459,25 +459,25 @@ public class DeviceApplyController {
deviceApplyBillService.update(deviceApplyBill);
}
else {
if (uploadApplyFile.getReplyVos() != null && uploadApplyFile.getReplyVos().size() > 0) {
for (ReplyVo replyVo : uploadApplyFile.getReplyVos()) {
ResponseEntity responseEntity = packingController.seqsExist(replyVo.getId(), replyVo.getNum(), replyVo.getSeqInterval());
if (!"ok".equals(responseEntity.getBody())) {
return responseEntity;
}
}
}
if (uploadApplyFile.getApplyBillDetailVos() != null && uploadApplyFile.getApplyBillDetailVos().size() > 0) {
for (ApplyBillDetailVo a : uploadApplyFile.getApplyBillDetailVos()) {
// 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.getCompleteCount(), a.getSeqInterval());
if (!"ok".equals(responseEntity.getBody())) {
return responseEntity;
}
}
}
// if (uploadApplyFile.getReplyVos() != null && uploadApplyFile.getReplyVos().size() > 0) {
// for (ReplyVo replyVo : uploadApplyFile.getReplyVos()) {
// ResponseEntity responseEntity = packingController.seqsExist(replyVo.getId(), replyVo.getNum(), replyVo.getSeqInterval());
// if (!"ok".equals(responseEntity.getBody())) {
// return responseEntity;
// }
// }
// }
// if (uploadApplyFile.getApplyBillDetailVos() != null && uploadApplyFile.getApplyBillDetailVos().size() > 0) {
// for (ApplyBillDetailVo a : uploadApplyFile.getApplyBillDetailVos()) {
//// 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.getCompleteCount(), a.getSeqInterval());
// if (!"ok".equals(responseEntity.getBody())) {
// return responseEntity;
// }
// }
// }
//判断是入库还是显示业务待办结
DeviceApplyBill deviceApplyBill = deviceApplyBillService.getOne(taskBto.getBillId());
......@@ -689,9 +689,11 @@ public class DeviceApplyController {
//更新装备
deviceLibraryService.updateTry(deviceLibraryService.findByIds(deviceIds));
//添加装备日志
Integer userId = userUtils.getCurrentUserId();
List<DeviceLogDto> deviceLogDtoList = new ArrayList<>();
deviceIds.forEach(integer -> {
DeviceLogDto deviceLogDto = new DeviceLogDto(integer,"装备从试用修改为正式",null);
DeviceLogDto deviceLogDto = new DeviceLogDto(integer,"装备从试用修改为正式",null,
userId,null);
deviceLogDtoList.add(deviceLogDto);
});
executor.execute(()->{
......@@ -721,6 +723,22 @@ public class DeviceApplyController {
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;
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.RemoveFromSeqListVo;
import com.tykj.dev.device.apply.subject.vo.RemoveSameSeqVo;
import com.tykj.dev.device.library.subject.vo.ScriptSaveVo;
import java.util.List;
......@@ -31,4 +33,12 @@ public interface DeviceApplyBillService {
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;
import com.tykj.dev.device.apply.service.DeviceApplyBillService;
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.RemoveFromSeqListVo;
import com.tykj.dev.device.apply.subject.vo.RemoveSameSeqVo;
import com.tykj.dev.device.apply.subject.vo.ReplyVo;
import com.tykj.dev.device.library.service.DeviceLibraryCacheService;
import com.tykj.dev.device.library.service.DeviceLibraryService;
......@@ -25,6 +27,8 @@ import com.tykj.dev.device.user.util.UserUtils;
import com.tykj.dev.misc.base.StatusEnum;
import com.tykj.dev.misc.utils.DeviceSeqUtil;
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.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
......@@ -239,16 +243,16 @@ public class DeviceApplyBillServiceImpl implements DeviceApplyBillService {
List<String> inputSeqs = DeviceSeqUtil.selectDeviceSeqs(seqNumInter);
if (!replyNum.equals(inputSeqs.size())){
//提示 批复数量跟输入区间不一致
stringBuffer.append("批复数量与序列号区间不一致").append(",");
stringBuffer.append("批复数量与序列号区间不一致");
}
//查询所有的序列号 检验是否重复
List<String> allSeqList = deviceLibraryCacheService.getAllDeviceLibraryList().stream()
.map(DeviceLibrary::getSeqNumber).collect(Collectors.toList());
allSeqList.retainAll(inputSeqs);
if (allSeqList.size()>0){
//说明有重复的序列号
stringBuffer.append("序列号").append(allSeqList).append("已存在");
}
// List<String> allSeqList = deviceLibraryCacheService.getAllDeviceLibraryList().stream()
// .map(DeviceLibrary::getSeqNumber).collect(Collectors.toList());
// allSeqList.retainAll(inputSeqs);
// if (allSeqList.size()>0){
// //说明有重复的序列号
// stringBuffer.append("序列号").append(allSeqList).append("已存在");
// }
}
stringBufferList.add(stringBuffer);
......@@ -256,4 +260,32 @@ public class DeviceApplyBillServiceImpl implements DeviceApplyBillService {
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 {
packingLibraries.forEach(packingLibrary -> {
List<String> inputSeqs = DeviceSeqUtil.selectDeviceSeqs(packingLibrary.getSeq());
List<String> outputSeqs = new ArrayList<>();
inputSeqs.forEach(s -> {
if (map.get(s)==null){
outputSeqs.add(s);
}
});
packingLibrary.setSeq(StringSplitUtil.stringListToString(DeviceSeqUtil.getContinuousSeqs(outputSeqs)));
// inputSeqs.forEach(s -> {
// if (map.get(s)==null){
// outputSeqs.add(s);
// }
// });
// packingLibrary.setSeq(StringSplitUtil.stringListToString(DeviceSeqUtil.getContinuousSeqs(outputSeqs)));
packingLibrary.setSeq(StringSplitUtil.stringListToString(DeviceSeqUtil.getContinuousSeqs(inputSeqs)));
});
//返回父子结构
Map<Integer, PackingLibrary> nodeCollect =
......
......@@ -569,6 +569,7 @@ public class StorageBillController {
}
rfidService.printString(printVos);
}
//更新申请业务入库数量
if (deviceApplyBills.size()>0){
deviceApplyBills.forEach(deviceApplyBill -> {
......@@ -578,6 +579,21 @@ public class StorageBillController {
ApplyBillDetailVo applyBillDetailVo = applyBillDetailVos.get(i);
if (map.get(applyBillDetailVo.getPackingId())!=null){
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);
if (!applyBillDetailVo.getWaitNum().equals(applyBillDetailVo.getCompleteCount())){
isEnd = false;
......@@ -591,7 +607,7 @@ public class StorageBillController {
taskService.moveToEnd(taskBto1);
//发送阅知信息
MessageBto messageBto = new MessageBto();
messageBto.setContent("业务办结");
messageBto.setContent("申请业务完结");
messageBto.setTaskId(taskBto1.getId());
messageBto.setIsHighLight(0);
messageBto.setInvolveUserIdList(userPublicService.findOtherUser(userId));
......@@ -663,7 +679,8 @@ public class StorageBillController {
deviceLibraryService.updateTry(deviceLibraries);
List<DeviceLogDto> deviceLogDtoList = new ArrayList<>();
storageBillSaveVo.getDeviceIds().forEach(integer -> {
DeviceLogDto deviceLogDto = new DeviceLogDto(integer,"试用装备改为正式装备",null);
DeviceLogDto deviceLogDto = new DeviceLogDto(integer,"试用装备改为正式装备",
null,userId,null);
deviceLogDtoList.add(deviceLogDto);
});
executor.execute(()->{
......@@ -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(
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论