提交 48376a10 authored 作者: zhoushaopan's avatar zhoushaopan

feat(装备申请,装备入库,缓存): 新增了一个申请的业务状态,入库将装备从试用改为正式,缓存维护

新增了一个申请的业务状态,入库将装备从试用改为正式,缓存维护
上级 57a8a597
...@@ -45,12 +45,15 @@ import lombok.extern.slf4j.Slf4j; ...@@ -45,12 +45,15 @@ import lombok.extern.slf4j.Slf4j;
import org.modelmapper.ModelMapper; import org.modelmapper.ModelMapper;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.*; import java.util.*;
import java.util.concurrent.Executor;
import java.util.function.Function;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import static java.util.stream.Collectors.groupingBy; import static java.util.stream.Collectors.groupingBy;
...@@ -114,6 +117,10 @@ public class DeviceApplyController { ...@@ -114,6 +117,10 @@ public class DeviceApplyController {
@Autowired @Autowired
private PackingController packingController; private PackingController packingController;
@Autowired
@Qualifier("taskExecutor")
private Executor executor;
// @Autowired // @Autowired
// private DeviceLibraryDao deviceLibraryDao; // private DeviceLibraryDao deviceLibraryDao;
...@@ -133,6 +140,7 @@ public class DeviceApplyController { ...@@ -133,6 +140,7 @@ public class DeviceApplyController {
} }
//添加申请单 //添加申请单
// DeviceApplyBill deviceApplyBillEntity = deviceApplyBillService.addEntity(deviceApplySaveVo.toDo()); // DeviceApplyBill deviceApplyBillEntity = deviceApplyBillService.addEntity(deviceApplySaveVo.toDo());
DeviceApplyBill deviceApplyBillEntity = deviceApplyBillService.addEntity(toDo(deviceApplySaveVo)); DeviceApplyBill deviceApplyBillEntity = deviceApplyBillService.addEntity(toDo(deviceApplySaveVo));
Integer userId = userUtils.getCurrentUserId(); Integer userId = userUtils.getCurrentUserId();
...@@ -461,16 +469,34 @@ public class DeviceApplyController { ...@@ -461,16 +469,34 @@ public class DeviceApplyController {
} }
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(),
a.getWaitNum()-a.getCompleteCount(), a.getSeqInterval());
if (!"ok".equals(responseEntity.getBody())) { if (!"ok".equals(responseEntity.getBody())) {
return responseEntity; return responseEntity;
} }
} }
} }
taskService.moveToNext(taskBto);
//判断是入库还是显示业务待办结
DeviceApplyBill deviceApplyBill = deviceApplyBillService.getOne(taskBto.getBillId()); DeviceApplyBill deviceApplyBill = deviceApplyBillService.getOne(taskBto.getBillId());
deviceApplyBill.setApplyStatus(4); if (uploadApplyFile.getApplyBillDetailVos() != null && uploadApplyFile.getApplyBillDetailVos().size() > 0){
boolean b = uploadApplyFile.getApplyBillDetailVos().stream()
.allMatch(applyBillDetailVo -> applyBillDetailVo.getReplyNum()
-applyBillDetailVo.getSelectApplyNum() == 0);
if (b){
taskService.moveToSpecial(taskBto,StatusEnum.WAITAPPLYTASKTOEND);
deviceApplyBill.setApplyStatus(6);
}else {
taskService.moveToNext(taskBto);
deviceApplyBill.setApplyStatus(4);
}
}
// taskService.moveToNext(taskBto);
// DeviceApplyBill deviceApplyBill = deviceApplyBillService.getOne(taskBto.getBillId());
// deviceApplyBill.setApplyStatus(4);
deviceApplyBill.setBackFiles(FilesUtil.stringFileToList(uploadApplyFile.getBackFiles())); deviceApplyBill.setBackFiles(FilesUtil.stringFileToList(uploadApplyFile.getBackFiles()));
if (uploadApplyFile.getReplyVos() != null && uploadApplyFile.getReplyVos().size() > 0) { if (uploadApplyFile.getReplyVos() != null && uploadApplyFile.getReplyVos().size() > 0) {
deviceApplyBill.setReplyVos(JacksonUtil.toJSon(uploadApplyFile.getReplyVos())); deviceApplyBill.setReplyVos(JacksonUtil.toJSon(uploadApplyFile.getReplyVos()));
...@@ -482,6 +508,11 @@ public class DeviceApplyController { ...@@ -482,6 +508,11 @@ public class DeviceApplyController {
deviceApplyBill.setReplyFiles(FilesUtil.stringFileToList(uploadApplyFile.getReplyFiles())); deviceApplyBill.setReplyFiles(FilesUtil.stringFileToList(uploadApplyFile.getReplyFiles()));
} }
if (uploadApplyFile.getApplyBillDetailVos() != null && uploadApplyFile.getApplyBillDetailVos().size() > 0) { if (uploadApplyFile.getApplyBillDetailVos() != null && uploadApplyFile.getApplyBillDetailVos().size() > 0) {
//自己算可入库数量
uploadApplyFile.getApplyBillDetailVos().forEach(applyBillDetailVo -> {
applyBillDetailVo.setWaitNum(applyBillDetailVo.getReplyNum()-applyBillDetailVo.getSelectApplyNum());
});
deviceApplyBill.setApplyStat(JacksonUtil.toJSon(uploadApplyFile.getApplyBillDetailVos())); deviceApplyBill.setApplyStat(JacksonUtil.toJSon(uploadApplyFile.getApplyBillDetailVos()));
} }
//add //add
...@@ -513,7 +544,7 @@ public class DeviceApplyController { ...@@ -513,7 +544,7 @@ public class DeviceApplyController {
@ApiOperation(value = "确认接收申请装备", notes = "确认接收申请装备") @ApiOperation(value = "确认接收申请装备", notes = "确认接收申请装备")
@PostMapping("/confirm/{id}")//不用了 @PostMapping("/confirm/{id}")//不用了
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public ResponseEntity confirm(@PathVariable("id") int taskId) { public ResponseEntity confirm(@PathVariable("id") int taskId) {
TaskBto taskBto = taskService.get(taskId); TaskBto taskBto = taskService.get(taskId);
taskService.addInvolveUser(taskBto,userUtils.getCurrentUserId()); taskService.addInvolveUser(taskBto,userUtils.getCurrentUserId());
...@@ -655,6 +686,39 @@ public class DeviceApplyController { ...@@ -655,6 +686,39 @@ public class DeviceApplyController {
return ResponseEntity.ok(deviceLibraries); return ResponseEntity.ok(deviceLibraries);
} }
@ApiOperation(value = "申请任务完结", notes = "从业务待办结推到申请任务完结")
@PostMapping("/applyTaskToEnd")
@Transactional(rollbackFor = Exception.class)
public ResponseEntity applyTaskToEnd(@RequestBody ApplyTaskToEnd applyTaskToEnd) {
Integer taskId = applyTaskToEnd.getTaskId();
List<Integer> deviceIds = applyTaskToEnd.getDeviceIds();
//更新装备
deviceLibraryService.updateTry(deviceLibraryService.findByIds(deviceIds));
//添加装备日志
List<DeviceLogDto> deviceLogDtoList = new ArrayList<>();
deviceIds.forEach(integer -> {
DeviceLogDto deviceLogDto = new DeviceLogDto(integer,"装备从试用修改为正式",null);
deviceLogDtoList.add(deviceLogDto);
});
executor.execute(()->{
deviceLogService.addAllLog(deviceLogDtoList);
});
TaskBto taskBto = taskService.get(taskId);
DeviceApplyBill deviceApplyBill = deviceApplyBillService.getOne(taskBto.getBillId());
deviceApplyBill.setApplyStatus(4);
deviceApplyBillService.update(deviceApplyBill);
//发送阅知信息
MessageBto messageBto = new MessageBto();
messageBto.setContent("申请任务已办结");
messageBto.setTaskId(taskBto.getId());
messageBto.setIsHighLight(0);
messageBto.setInvolveUserIdList(userPublicService.findOtherUser(userUtils.getCurrentUserId()));
messageBto.setBusinessType(taskBto.getBusinessType());
messageService.add(messageBto);
taskService.moveToEnd(taskBto);
return ResponseEntity.ok("申请任务完成");
}
/** /**
* 转实体 * 转实体
...@@ -673,22 +737,29 @@ public class DeviceApplyController { ...@@ -673,22 +737,29 @@ public class DeviceApplyController {
ApplyBillDetailVo::getChilds, ApplyBillDetailVo::getChilds,
ApplyBillDetailVo::setChildNull); ApplyBillDetailVo::setChildNull);
//拼接列装id和申请数量字符串 //拼接列装id和申请数量字符串
//选择试用装备数量
List<ApplyTryVo> applyTryVos = deviceApplySaveVo.getApplyTryVos();
Map<Integer, ApplyTryVo> tryVoMap = applyTryVos.stream().collect(
Collectors.toMap(ApplyTryVo::getPackingId, Function.identity()));
for (ApplyBillDetailVo s : applyBillDetailVos) { for (ApplyBillDetailVo s : applyBillDetailVos) {
stringBuffer.append(s.getPackingId()).append("x"); stringBuffer.append(s.getPackingId()).append("x");
//遍历集合 List<ApplyTryVo> applyTryVos;
//zsp //zsp
Integer packingId = s.getPackingId(); Integer packingId = s.getPackingId();
List<DeviceLibrary> deviceLibraries = deviceLibraryService.findAllByPackingId(packingId); s.setCompleteCount(s.getCompleteCount());
deviceLibraries = deviceLibraries.stream().filter(deviceLibrary -> deviceLibrary.getTryOutDevice() == 1) if (s.getStorageCount() != null) {
.collect(Collectors.toList()); stringBuffer.append(s.getStorageCount()).append("x");
if (deviceLibraries.size()>0){ } else {
s.setCompleteCount(deviceLibraries.size() + s.getCompleteCount()) ; stringBuffer.append(0).append("x");
}
if (tryVoMap.containsKey(packingId)){
s.setSelectApplyNum(tryVoMap.get(packingId).getDeviceIds().size());
s.setDeviceIds(tryVoMap.get(packingId).getDeviceIds());
}else {
s.setSelectApplyNum(0);
s.setDeviceIds(null);
} }
if (s.getStorageCount()!=null) {
stringBuffer.append(s.getStorageCount()).append("x");
}
else {
stringBuffer.append(0).append("x");
}
} }
//转为json存储 //转为json存储
deviceApplyBillEntity.setApplyStat(JacksonUtil.toJSon(applyBillDetailVos)); deviceApplyBillEntity.setApplyStat(JacksonUtil.toJSon(applyBillDetailVos));
...@@ -720,4 +791,68 @@ public class DeviceApplyController { ...@@ -720,4 +791,68 @@ public class DeviceApplyController {
} }
return deviceApplyBillEntity; return deviceApplyBillEntity;
} }
// public DeviceApplyBill toDo(DeviceApplySaveVo deviceApplySaveVo) {
// ModelMapper mapper = BeanHelper.getUserMapper();
// DeviceApplyBill deviceApplyBillEntity = mapper.map(deviceApplySaveVo, DeviceApplyBill.class);
// deviceApplyBillEntity.setApplyStatus(0);
// StringBuffer stringBuffer = new StringBuffer();
// stringBuffer.append("x");
// //申请详情
// if (deviceApplySaveVo.getStorageBillDetailVoList()!=null&&deviceApplySaveVo.getStorageBillDetailVoList().size() > 0) {
// //分解父子结构
// List<ApplyBillDetailVo> applyBillDetailVos = GetTreeUtils.splitTree(
// deviceApplySaveVo.getStorageBillDetailVoList(),
// ApplyBillDetailVo::getChilds,
// ApplyBillDetailVo::setChildNull);
// //拼接列装id和申请数量字符串
// for (ApplyBillDetailVo s : applyBillDetailVos) {
// stringBuffer.append(s.getPackingId()).append("x");
// //zsp
// Integer packingId = s.getPackingId();
// List<DeviceLibrary> deviceLibraries = deviceLibraryService.findAllByPackingId(packingId);
// deviceLibraries = deviceLibraries.stream().filter(deviceLibrary -> deviceLibrary.getTryOutDevice() == 1)
// .collect(Collectors.toList());
// if (deviceLibraries.size()>0){
// s.setCompleteCount(deviceLibraries.size() + s.getCompleteCount()) ;
// }
// if (s.getStorageCount()!=null) {
// stringBuffer.append(s.getStorageCount()).append("x");
// }
// else {
// stringBuffer.append(0).append("x");
// }
// }
// //转为json存储
// deviceApplyBillEntity.setApplyStat(JacksonUtil.toJSon(applyBillDetailVos));
// //如果不是装备申请,添加replyVo
// if (deviceApplySaveVo.getApplyType()!=1){
// List<ReplyVo> replyVos = new ArrayList<>();
// for (ApplyBillDetailVo applyBillDetailVo : applyBillDetailVos){
// ReplyVo replyVo = new ReplyVo();
// replyVo.setId(applyBillDetailVo.getPackingId());
// replyVo.setNum(applyBillDetailVo.getStorageCount());
// replyVo.setSeqInterval(applyBillDetailVo.getSeqInterval());
// replyVos.add(replyVo);
// }
// //转为json存储
// deviceApplyBillEntity.setReplyVos(JacksonUtil.toJSon(replyVos));
// }
// }
// //set组合字符串
// deviceApplyBillEntity.setApplyDetail(stringBuffer.toString());
// //单据转换
// if(deviceApplySaveVo.getApplyFiles()!=null&&deviceApplySaveVo.getApplyFiles().size()>0){
// deviceApplyBillEntity.setApplyFiles(FilesUtil.stringFileToList(deviceApplySaveVo.getApplyFiles()));
// }
// if(deviceApplySaveVo.getApplyNumFiles()!=null&&deviceApplySaveVo.getApplyNumFiles().size()>0){
// deviceApplyBillEntity.setApplyNumFiles(FilesUtil.stringFileToList(deviceApplySaveVo.getApplyNumFiles()));
// }
// if(deviceApplySaveVo.getReplyFiles()!=null&&deviceApplySaveVo.getReplyFiles().size()>0){
// deviceApplyBillEntity.setReplyFiles(FilesUtil.stringFileToList(deviceApplySaveVo.getReplyFiles()));
// }
// return deviceApplyBillEntity;
// }
} }
...@@ -88,7 +88,7 @@ public class DeviceApplyBill { ...@@ -88,7 +88,7 @@ public class DeviceApplyBill {
/** /**
* 申请状态(0:申请待审核,1:申请审核失败,2:申请中,3:已批复待审核,4:批复审核失败,5:申请成功) * 申请状态(0:申请待审核,1:申请审核失败,2:申请中,3:已批复待审核,4:批复审核失败,5:申请成功)
*/ */
@ApiModelProperty(value = "申请状态(0:申请待审核,1:申请审核失败,2:申请完结,3:等待中办批复,4:批复后待执行)") @ApiModelProperty(value = "申请状态(0:申请待审核,1:申请审核失败,2:申请完结,3:等待中办批复,4:批复后待执行,6:业务待完结)")
private Integer applyStatus; private Integer applyStatus;
/** /**
* 列装库主键idx数量(,作为分隔符),例如1x2,2x3,意为列装库id为1的申请2件,id为2的申请3件 * 列装库主键idx数量(,作为分隔符),例如1x2,2x3,意为列装库id为1的申请2件,id为2的申请3件
......
...@@ -27,12 +27,22 @@ public class ApplyBillDetailVo { ...@@ -27,12 +27,22 @@ public class ApplyBillDetailVo {
@ApiModelProperty(value = "申请数量") @ApiModelProperty(value = "申请数量")
private Integer storageCount; private Integer storageCount;
@ApiModelProperty(value = "批复数量") @ApiModelProperty(value = "可入库数量")
private Integer waitNum; private Integer waitNum;
@ApiModelProperty(value = "已入库数量") @ApiModelProperty(value = "已入库数量")
private Integer completeCount = 0; private Integer completeCount = 0;
@ApiModelProperty(value = "批复数量")
private Integer replyNum;
@ApiModelProperty(value = "已选中申请数量")
private Integer selectApplyNum;
@ApiModelProperty(value = "装备id")
private List<Integer> deviceIds;
@ApiModelProperty(value = "序列号区间", example = "1") @ApiModelProperty(value = "序列号区间", example = "1")
private String seqInterval; private String seqInterval;
......
package com.tykj.dev.device.apply.subject.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;
/**
* @author zsp
*/
@Data
@ApiModel("业务待办结vo")
@AllArgsConstructor
@NoArgsConstructor
public class ApplyTaskToEnd {
@ApiModelProperty(value = "任务id")
private Integer taskId;
@ApiModelProperty(value = "装备id的集合")
private List<Integer> deviceIds;
}
package com.tykj.dev.device.apply.subject.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;
/**
* @author zsp
*/
@Data
@ApiModel("选择试用装备详情类")
@AllArgsConstructor
@NoArgsConstructor
public class ApplyTryVo {
@ApiModelProperty(value = "列装id")
private Integer packingId;
@ApiModelProperty(value = "装备id的集合")
private List<Integer> deviceIds;
}
...@@ -71,6 +71,9 @@ public class DeviceApplySaveVo { ...@@ -71,6 +71,9 @@ public class DeviceApplySaveVo {
@ApiModelProperty(value = "申请类型(1:装备申请,2:退役申请,3:报废申请,4:销毁申请)") @ApiModelProperty(value = "申请类型(1:装备申请,2:退役申请,3:报废申请,4:销毁申请)")
private Integer applyType; private Integer applyType;
@ApiModelProperty(value = "选择试用装备详情类")
private List<ApplyTryVo> applyTryVos;
/** /**
* 转实体 * 转实体
......
package com.tykj.dev.device.library.task; //package com.tykj.dev.device.library.task;
//
import com.tykj.dev.device.library.service.DeviceLibraryCacheService; //import com.tykj.dev.device.library.service.DeviceLibraryCacheService;
import lombok.extern.slf4j.Slf4j; //import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; //import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled; //import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service; //import org.springframework.stereotype.Service;
//
/** ///**
* @author zjm // * @author zjm
* @version 1.0.0 // * @version 1.0.0
* @ClassName TrainTask.java // * @ClassName TrainTask.java
* @Description 培训定时任务 主要是 判断报名截止以及培训开始、培训结束 // * @Description 培训定时任务 主要是 判断报名截止以及培训开始、培训结束
* @createTime 2020年08月17日 23:20:00 // * @createTime 2020年08月17日 23:20:00
*/ // */
@Service //@Service
@Slf4j //@Slf4j
public class DevideTask { //public class DevideTask {
@Autowired // @Autowired
DeviceLibraryCacheService deviceLibraryCacheService; // DeviceLibraryCacheService deviceLibraryCacheService;
//
@Scheduled(cron = "30 * * * * ? ") // @Scheduled(cron = "30 * * * * ? ")
private void signUpDeadline() { // private void signUpDeadline() {
log.info("定时device更新缓存开始"); // log.info("定时device更新缓存开始");
deviceLibraryCacheService.deletAllDeviceLibraryList(); // deviceLibraryCacheService.deletAllDeviceLibraryList();
deviceLibraryCacheService.getAllDeviceLibraryList(); // deviceLibraryCacheService.getAllDeviceLibraryList();
log.info("定时device更新缓存结束"); // log.info("定时device更新缓存结束");
} // }
} //}
...@@ -252,6 +252,12 @@ public enum StatusEnum { ...@@ -252,6 +252,12 @@ public enum StatusEnum {
*/ */
WAIT_CONFIRM_APPLY_DEVICE(511, "批复完成待执行"), WAIT_CONFIRM_APPLY_DEVICE(511, "批复完成待执行"),
/**
* 业务待办结
*/
WAITAPPLYTASKTOEND(512,"申请任务待办结"),
// /** // /**
// * 等待上传申请回执单 // * 等待上传申请回执单
// */ // */
......
...@@ -458,7 +458,8 @@ public class PackingController { ...@@ -458,7 +458,8 @@ public class PackingController {
@ApiOperation(value = "判断序列号区间是否存在") @ApiOperation(value = "判断序列号区间是否存在")
@PostMapping("/seqsExist/{id}/{num}/{seq}") @PostMapping("/seqsExist/{id}/{num}/{seq}")
public ResponseEntity seqsExist(@PathVariable("id") int id,@PathVariable("num") int num,@PathVariable("seq") String seq){ public ResponseEntity seqsExist(@PathVariable("id") int id,@PathVariable("num") int num,@PathVariable("seq") String seq){
List<DeviceLibrary> deviceLibraries = packingLibraryService.getAllDevSeqs(id); // List<DeviceLibrary> deviceLibraries = packingLibraryService.getAllDevSeqs(id);
List<DeviceLibrary> deviceLibraries = deviceLibraryCacheService.getAllDeviceLibraryList();
List<String> existSeqs = deviceLibraries.stream().map(DeviceLibrary::getSeqNumber).collect(Collectors.toList()); List<String> existSeqs = deviceLibraries.stream().map(DeviceLibrary::getSeqNumber).collect(Collectors.toList());
List<String> inputSeqs = DeviceSeqUtil.selectDeviceSeqs(seq); List<String> inputSeqs = DeviceSeqUtil.selectDeviceSeqs(seq);
List<String> hasApplySeqs = deviceLibraries.stream() List<String> hasApplySeqs = deviceLibraries.stream()
...@@ -468,6 +469,9 @@ public class PackingController { ...@@ -468,6 +469,9 @@ public class PackingController {
if (inputSeqs.size()!=num){ if (inputSeqs.size()!=num){
return ResponseEntity.ok("序列号区间总数为"+inputSeqs.size()+",与装备数量不匹配"); return ResponseEntity.ok("序列号区间总数为"+inputSeqs.size()+",与装备数量不匹配");
} }
// if (inputSeqs.size()>num){
// return ResponseEntity.ok("序列号区间总数为"+inputSeqs.size()+",与装备数量不匹配");
// }
else { else {
Set<String> seqSet = new HashSet<>(inputSeqs); Set<String> seqSet = new HashSet<>(inputSeqs);
if (seqSet.size()!=inputSeqs.size()){ if (seqSet.size()!=inputSeqs.size()){
...@@ -511,7 +515,10 @@ public class PackingController { ...@@ -511,7 +515,10 @@ public class PackingController {
List<DeviceLibrary> deviceLibraries = deviceLibraryCacheService.getAllDeviceLibraryList(); List<DeviceLibrary> deviceLibraries = deviceLibraryCacheService.getAllDeviceLibraryList();
List<String> existSeqs = deviceLibraries.stream().map(DeviceLibrary::getSeqNumber).collect(Collectors.toList()); List<String> existSeqs = deviceLibraries.stream().map(DeviceLibrary::getSeqNumber).collect(Collectors.toList());
List<String> inputSeqs = DeviceSeqUtil.selectDeviceSeqs(seq); List<String> inputSeqs = DeviceSeqUtil.selectDeviceSeqs(seq);
if (inputSeqs.size()>0&&inputSeqs.size()!=num){ // if (inputSeqs.size()>0&&inputSeqs.size()!=num){
// return ResponseEntity.ok("序列号区间总数为"+inputSeqs.size()+",与装备数量不匹配");
// }
if (inputSeqs.size()>0&&inputSeqs.size()>num){
return ResponseEntity.ok("序列号区间总数为"+inputSeqs.size()+",与装备数量不匹配"); return ResponseEntity.ok("序列号区间总数为"+inputSeqs.size()+",与装备数量不匹配");
} }
else { else {
...@@ -979,14 +986,14 @@ public class PackingController { ...@@ -979,14 +986,14 @@ public class PackingController {
//进行过滤 退装的目录下面 回收站 //进行过滤 退装的目录下面 回收站
// List<Integer> statuses = new ArrayList<>(Arrays.asList(3, 4)); // List<Integer> statuses = new ArrayList<>(Arrays.asList(3, 4));
//先过滤出child为空的 //先过滤出child为空的
List<PackingLibrary> childs = resultList.stream() // List<PackingLibrary> childs = resultList.stream()
.filter(packingLibrary -> (packingLibrary.getChilds() == null || packingLibrary.getChilds().size() == 0) // .filter(packingLibrary -> (packingLibrary.getChilds() == null || packingLibrary.getChilds().size() == 0)
&& packingLibrary.getIsRoot() == 1 ) // && packingLibrary.getIsRoot() == 1)
.collect(Collectors.toList()); // .collect(Collectors.toList());
//取出不为空的 //取出不为空的
List<Integer> ids = childs.stream().map(PackingLibrary::getId).collect(Collectors.toList()); // List<Integer> ids = childs.stream().map(PackingLibrary::getId).collect(Collectors.toList());
// resultList.removeAll(childs); // resultList.removeAll(childs);
resultList = resultList.stream().filter(packingLibrary -> !ids.contains(packingLibrary.getId())).collect(Collectors.toList()); // resultList = resultList.stream().filter(packingLibrary -> !ids.contains(packingLibrary.getId())).collect(Collectors.toList());
// childs.forEach(packingLibrary -> { // childs.forEach(packingLibrary -> {
// List<PackingLibrary> in = packingLibraryDao.findAllByPartParentIdAndPackingStatusIn( // List<PackingLibrary> in = packingLibraryDao.findAllByPartParentIdAndPackingStatusIn(
......
...@@ -283,6 +283,10 @@ public class PackingLibrary { ...@@ -283,6 +283,10 @@ public class PackingLibrary {
@ApiModelProperty(value = "装备的数量") @ApiModelProperty(value = "装备的数量")
private Integer deviceNum; private Integer deviceNum;
@Transient
@ApiModelProperty(value = "装备id的集合")
private List<Integer> deviceIds;
@Transient @Transient
@ApiModelProperty(value = "序号") @ApiModelProperty(value = "序号")
private Integer seqOrderNumber; private Integer seqOrderNumber;
......
...@@ -584,6 +584,7 @@ public class StorageBillController { ...@@ -584,6 +584,7 @@ public class StorageBillController {
} }
} }
} }
if (isEnd) { if (isEnd) {
TaskBto taskBto1 = taskService.get(deviceApplyBill.getId(), 9); TaskBto taskBto1 = taskService.get(deviceApplyBill.getId(), 9);
taskService.addInvolveUser(taskBto1,userUtils.getCurrentUserId()); taskService.addInvolveUser(taskBto1,userUtils.getCurrentUserId());
...@@ -601,6 +602,7 @@ public class StorageBillController { ...@@ -601,6 +602,7 @@ public class StorageBillController {
deviceApplyBillService.update(deviceApplyBill); deviceApplyBillService.update(deviceApplyBill);
}); });
} }
deviceLogService.addAllLog(deviceLogDtos); deviceLogService.addAllLog(deviceLogDtos);
//4.更新入库单入库详情 //4.更新入库单入库详情
storageBillEntity.setStorageDetail(stringBuffer.toString()); storageBillEntity.setStorageDetail(stringBuffer.toString());
...@@ -654,7 +656,21 @@ public class StorageBillController { ...@@ -654,7 +656,21 @@ public class StorageBillController {
} }
//完成更新试用修改为正式 //完成更新试用修改为正式
if(storageBillSaveVo.getTryOutDevice() == 0){ if (storageBillSaveVo.getTryOutDevice() == 0 ){
if (storageBillSaveVo.getDeviceIds().size()>0){
List<DeviceLibrary> deviceLibraries = deviceLibraryService.findByIds(storageBillSaveVo.getDeviceIds());
if (deviceLibraries.size()>0){
deviceLibraryService.updateTry(deviceLibraries);
List<DeviceLogDto> deviceLogDtoList = new ArrayList<>();
storageBillSaveVo.getDeviceIds().forEach(integer -> {
DeviceLogDto deviceLogDto = new DeviceLogDto(integer,"试用装备改为正式装备",null);
deviceLogDtoList.add(deviceLogDto);
});
executor.execute(()->{
deviceLogService.addAllLog(deviceLogDtoList);
});
}
}
List<DeviceLibrarySaveVo> deviceLibrarySaveVoList = storageBillSaveVo.getDeviceLibrarySaveVoList(); List<DeviceLibrarySaveVo> deviceLibrarySaveVoList = storageBillSaveVo.getDeviceLibrarySaveVoList();
deviceLibrarySaveVoList.forEach(deviceLibrarySaveVo -> { deviceLibrarySaveVoList.forEach(deviceLibrarySaveVo -> {
List<DeviceLibrary> deviceLibraries = deviceLibraryService.findAllByPackingId(deviceLibrarySaveVo.getPackingId()); List<DeviceLibrary> deviceLibraries = deviceLibraryService.findAllByPackingId(deviceLibrarySaveVo.getPackingId());
...@@ -663,9 +679,30 @@ public class StorageBillController { ...@@ -663,9 +679,30 @@ public class StorageBillController {
if (deviceLibraries.size()>0){ if (deviceLibraries.size()>0){
//将装备试用的改为正式的 //将装备试用的改为正式的
deviceLibraryService.updateTry(deviceLibraries); deviceLibraryService.updateTry(deviceLibraries);
List<DeviceLogDto> deviceLogDtoList = new ArrayList<>();
deviceLibraries.stream().map(DeviceLibrary::getId).collect(Collectors.toList()).forEach(integer -> {
DeviceLogDto deviceLogDto = new DeviceLogDto(integer,"试用装备改为正式装备",null);
deviceLogDtoList.add(deviceLogDto);
});
executor.execute(()->{
deviceLogService.addAllLog(deviceLogDtoList);
});
} }
}); });
} }
// 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(
......
...@@ -121,6 +121,8 @@ public class StorageBillSaveVo { ...@@ -121,6 +121,8 @@ public class StorageBillSaveVo {
@ApiModelProperty(value = "是否是试用装备",notes = "0 是正式 1 是测试") @ApiModelProperty(value = "是否是试用装备",notes = "0 是正式 1 是测试")
private Integer tryOutDevice = 0; private Integer tryOutDevice = 0;
@ApiModelProperty(value = "试用装备id的集合")
private List<Integer> deviceIds;
public StorageBill toDo() { public StorageBill toDo() {
......
...@@ -387,20 +387,27 @@ public class TaskSelectController { ...@@ -387,20 +387,27 @@ public class TaskSelectController {
} }
} }
} }
if (packingIdList.size() == numList.size()) { if (packingIdList.size() == numList.size()) {
for (int i = 0; i < packingIdList.size(); i++) { for (int i = 0; i < packingIdList.size(); i++) {
PackingLibrary p = packingLibraryService.getOne(packingIdList.get(i)); PackingLibrary p = packingLibraryService.getOne(packingIdList.get(i));
ApplyBillDetailVo applyBillDetailVo = applyBillDetailVoMap.get(packingIdList.get(i)); ApplyBillDetailVo applyBillDetailVo = applyBillDetailVoMap.get(packingIdList.get(i));
//zsp 进行试用装备数量的显示 和序列号 //zsp 进行试用装备数量的显示 和序列号
//查询出所有的试用装备 //查询出所有的试用装备
List<DeviceLibrary> deviceLibraries = deviceLibraryService.findAllByPackingId(packingIdList.get(i)); // List<DeviceLibrary> deviceLibraries = deviceLibraryService.findAllByPackingId(packingIdList.get(i));
if (deviceLibraries.size()>0){ // if (deviceLibraries.size()>0){
deviceLibraries = deviceLibraries.stream().filter(deviceLibrary -> deviceLibrary.getTryOutDevice() == 1) // deviceLibraries = deviceLibraries.stream().filter(deviceLibrary -> deviceLibrary.getTryOutDevice() == 1)
.collect(Collectors.toList()); // .collect(Collectors.toList());
p.setDeviceSeqNumberList(deviceLibraries.stream().map(DeviceLibrary::getSeqNumber).collect(Collectors.toList())); // p.setDeviceSeqNumberList(deviceLibraries.stream().map(DeviceLibrary::getSeqNumber).collect(Collectors.toList()));
// }
//根据申请数量进行展示
if (applyBillDetailVo.getDeviceIds()!=null){
List<DeviceLibrary> deviceLibraryList = deviceLibraryService.findByIds(applyBillDetailVo.getDeviceIds());
if (deviceLibraryList.size()>0){
p.setDeviceSeqNumberList(deviceLibraryList.stream().map(DeviceLibrary::getSeqNumber)
.collect(Collectors.toList()));
}
} }
// deviceLibraryList.addAll(deviceLibraries);
// List<String> stringList = deviceLibraries.stream().map(DeviceLibrary::getSeqNumber).collect(Collectors.toList());
//截止 //截止
if (deviceApplyBillEntity.getApplyType()==1) { if (deviceApplyBillEntity.getApplyType()==1) {
p.setApplyNum(numList.get(i)); p.setApplyNum(numList.get(i));
...@@ -410,12 +417,16 @@ public class TaskSelectController { ...@@ -410,12 +417,16 @@ public class TaskSelectController {
if(applyBillDetailVo.getWaitNum() == null){ if(applyBillDetailVo.getWaitNum() == null){
p.setWaitNum(null); p.setWaitNum(null);
}else { }else {
//zsp // //zsp
p.setReplyNum(applyBillDetailVo.getWaitNum()); // p.setReplyNum(applyBillDetailVo.getWaitNum());
// p.setWaitNum(applyBillDetailVo.getWaitNum()-p.getCompleteNum());
// p.setWaitNum(applyBillDetailVo.getWaitNum()-applyBillDetailVo.getSelectApplyNum());
p.setWaitNum(applyBillDetailVo.getWaitNum()-p.getCompleteNum()); p.setWaitNum(applyBillDetailVo.getWaitNum()-p.getCompleteNum());
} }
// p.setWaitNum(applyBillDetailVo.getWaitNum()-p.getCompleteNum()); // p.setWaitNum(applyBillDetailVo.getWaitNum()-p.getCompleteNum());
p.setSeq(statMap.get(p.getId()).getSeqInterval()); p.setSeq(statMap.get(p.getId()).getSeqInterval());
p.setDeviceIds(applyBillDetailVo.getDeviceIds());
p.setReplyNum(applyBillDetailVo.getReplyNum());
} }
} }
else { else {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论