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

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

新增了一个申请的业务状态,入库将装备从试用改为正式,缓存维护
上级 57a8a597
......@@ -88,7 +88,7 @@ public class DeviceApplyBill {
/**
* 申请状态(0:申请待审核,1:申请审核失败,2:申请中,3:已批复待审核,4:批复审核失败,5:申请成功)
*/
@ApiModelProperty(value = "申请状态(0:申请待审核,1:申请审核失败,2:申请完结,3:等待中办批复,4:批复后待执行)")
@ApiModelProperty(value = "申请状态(0:申请待审核,1:申请审核失败,2:申请完结,3:等待中办批复,4:批复后待执行,6:业务待完结)")
private Integer applyStatus;
/**
* 列装库主键idx数量(,作为分隔符),例如1x2,2x3,意为列装库id为1的申请2件,id为2的申请3件
......
......@@ -27,12 +27,22 @@ public class ApplyBillDetailVo {
@ApiModelProperty(value = "申请数量")
private Integer storageCount;
@ApiModelProperty(value = "批复数量")
@ApiModelProperty(value = "可入库数量")
private Integer waitNum;
@ApiModelProperty(value = "已入库数量")
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")
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 {
@ApiModelProperty(value = "申请类型(1:装备申请,2:退役申请,3:报废申请,4:销毁申请)")
private Integer applyType;
@ApiModelProperty(value = "选择试用装备详情类")
private List<ApplyTryVo> applyTryVos;
/**
* 转实体
......
package com.tykj.dev.device.library.task;
import com.tykj.dev.device.library.service.DeviceLibraryCacheService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;
/**
* @author zjm
* @version 1.0.0
* @ClassName TrainTask.java
* @Description 培训定时任务 主要是 判断报名截止以及培训开始、培训结束
* @createTime 2020年08月17日 23:20:00
*/
@Service
@Slf4j
public class DevideTask {
@Autowired
DeviceLibraryCacheService deviceLibraryCacheService;
@Scheduled(cron = "30 * * * * ? ")
private void signUpDeadline() {
log.info("定时device更新缓存开始");
deviceLibraryCacheService.deletAllDeviceLibraryList();
deviceLibraryCacheService.getAllDeviceLibraryList();
log.info("定时device更新缓存结束");
}
}
//package com.tykj.dev.device.library.task;
//
//import com.tykj.dev.device.library.service.DeviceLibraryCacheService;
//import lombok.extern.slf4j.Slf4j;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.scheduling.annotation.Scheduled;
//import org.springframework.stereotype.Service;
//
///**
// * @author zjm
// * @version 1.0.0
// * @ClassName TrainTask.java
// * @Description 培训定时任务 主要是 判断报名截止以及培训开始、培训结束
// * @createTime 2020年08月17日 23:20:00
// */
//@Service
//@Slf4j
//public class DevideTask {
// @Autowired
// DeviceLibraryCacheService deviceLibraryCacheService;
//
// @Scheduled(cron = "30 * * * * ? ")
// private void signUpDeadline() {
// log.info("定时device更新缓存开始");
// deviceLibraryCacheService.deletAllDeviceLibraryList();
// deviceLibraryCacheService.getAllDeviceLibraryList();
// log.info("定时device更新缓存结束");
// }
//}
......@@ -252,6 +252,12 @@ public enum StatusEnum {
*/
WAIT_CONFIRM_APPLY_DEVICE(511, "批复完成待执行"),
/**
* 业务待办结
*/
WAITAPPLYTASKTOEND(512,"申请任务待办结"),
// /**
// * 等待上传申请回执单
// */
......
......@@ -458,7 +458,8 @@ public class PackingController {
@ApiOperation(value = "判断序列号区间是否存在")
@PostMapping("/seqsExist/{id}/{num}/{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> inputSeqs = DeviceSeqUtil.selectDeviceSeqs(seq);
List<String> hasApplySeqs = deviceLibraries.stream()
......@@ -468,6 +469,9 @@ public class PackingController {
if (inputSeqs.size()!=num){
return ResponseEntity.ok("序列号区间总数为"+inputSeqs.size()+",与装备数量不匹配");
}
// if (inputSeqs.size()>num){
// return ResponseEntity.ok("序列号区间总数为"+inputSeqs.size()+",与装备数量不匹配");
// }
else {
Set<String> seqSet = new HashSet<>(inputSeqs);
if (seqSet.size()!=inputSeqs.size()){
......@@ -511,7 +515,10 @@ public class PackingController {
List<DeviceLibrary> deviceLibraries = deviceLibraryCacheService.getAllDeviceLibraryList();
List<String> existSeqs = deviceLibraries.stream().map(DeviceLibrary::getSeqNumber).collect(Collectors.toList());
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()+",与装备数量不匹配");
}
else {
......@@ -979,14 +986,14 @@ public class PackingController {
//进行过滤 退装的目录下面 回收站
// List<Integer> statuses = new ArrayList<>(Arrays.asList(3, 4));
//先过滤出child为空的
List<PackingLibrary> childs = resultList.stream()
.filter(packingLibrary -> (packingLibrary.getChilds() == null || packingLibrary.getChilds().size() == 0)
&& packingLibrary.getIsRoot() == 1 )
.collect(Collectors.toList());
// List<PackingLibrary> childs = resultList.stream()
// .filter(packingLibrary -> (packingLibrary.getChilds() == null || packingLibrary.getChilds().size() == 0)
// && packingLibrary.getIsRoot() == 1)
// .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 = 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 -> {
// List<PackingLibrary> in = packingLibraryDao.findAllByPartParentIdAndPackingStatusIn(
......
......@@ -283,6 +283,10 @@ public class PackingLibrary {
@ApiModelProperty(value = "装备的数量")
private Integer deviceNum;
@Transient
@ApiModelProperty(value = "装备id的集合")
private List<Integer> deviceIds;
@Transient
@ApiModelProperty(value = "序号")
private Integer seqOrderNumber;
......
......@@ -584,6 +584,7 @@ public class StorageBillController {
}
}
}
if (isEnd) {
TaskBto taskBto1 = taskService.get(deviceApplyBill.getId(), 9);
taskService.addInvolveUser(taskBto1,userUtils.getCurrentUserId());
......@@ -601,6 +602,7 @@ public class StorageBillController {
deviceApplyBillService.update(deviceApplyBill);
});
}
deviceLogService.addAllLog(deviceLogDtos);
//4.更新入库单入库详情
storageBillEntity.setStorageDetail(stringBuffer.toString());
......@@ -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();
deviceLibrarySaveVoList.forEach(deviceLibrarySaveVo -> {
List<DeviceLibrary> deviceLibraries = deviceLibraryService.findAllByPackingId(deviceLibrarySaveVo.getPackingId());
......@@ -663,9 +679,30 @@ public class StorageBillController {
if (deviceLibraries.size()>0){
//将装备试用的改为正式的
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(
......
......@@ -121,6 +121,8 @@ public class StorageBillSaveVo {
@ApiModelProperty(value = "是否是试用装备",notes = "0 是正式 1 是测试")
private Integer tryOutDevice = 0;
@ApiModelProperty(value = "试用装备id的集合")
private List<Integer> deviceIds;
public StorageBill toDo() {
......
......@@ -387,20 +387,27 @@ public class TaskSelectController {
}
}
}
if (packingIdList.size() == numList.size()) {
for (int i = 0; i < packingIdList.size(); i++) {
PackingLibrary p = packingLibraryService.getOne(packingIdList.get(i));
ApplyBillDetailVo applyBillDetailVo = applyBillDetailVoMap.get(packingIdList.get(i));
//zsp 进行试用装备数量的显示 和序列号
//查询出所有的试用装备
List<DeviceLibrary> deviceLibraries = deviceLibraryService.findAllByPackingId(packingIdList.get(i));
if (deviceLibraries.size()>0){
deviceLibraries = deviceLibraries.stream().filter(deviceLibrary -> deviceLibrary.getTryOutDevice() == 1)
.collect(Collectors.toList());
p.setDeviceSeqNumberList(deviceLibraries.stream().map(DeviceLibrary::getSeqNumber).collect(Collectors.toList()));
// List<DeviceLibrary> deviceLibraries = deviceLibraryService.findAllByPackingId(packingIdList.get(i));
// if (deviceLibraries.size()>0){
// deviceLibraries = deviceLibraries.stream().filter(deviceLibrary -> deviceLibrary.getTryOutDevice() == 1)
// .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) {
p.setApplyNum(numList.get(i));
......@@ -410,12 +417,16 @@ public class TaskSelectController {
if(applyBillDetailVo.getWaitNum() == null){
p.setWaitNum(null);
}else {
//zsp
p.setReplyNum(applyBillDetailVo.getWaitNum());
// //zsp
// 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.setSeq(statMap.get(p.getId()).getSeqInterval());
p.setDeviceIds(applyBillDetailVo.getDeviceIds());
p.setReplyNum(applyBillDetailVo.getReplyNum());
}
}
else {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论