提交 82bd9c0c authored 作者: 邓砥奕's avatar 邓砥奕

更新

上级 48039544
package com.tykj.dev.device.allot.controller;
import com.fasterxml.jackson.core.type.TypeReference;
import com.tykj.dev.config.cache.ConfigCache;
import com.tykj.dev.config.swagger.AutoDocument;
import com.tykj.dev.device.allot.service.AllotBackBillService;
......@@ -14,6 +15,7 @@ import com.tykj.dev.device.library.service.DeviceLogService;
import com.tykj.dev.device.library.subject.Dto.DeviceLogDto;
import com.tykj.dev.device.library.subject.domin.DeviceLibrary;
import com.tykj.dev.device.library.subject.vo.FileVo;
import com.tykj.dev.device.library.subject.vo.ScriptSaveVo;
import com.tykj.dev.device.packing.service.PackingLibraryService;
import com.tykj.dev.device.packing.subject.domin.PackingLibrary;
import com.tykj.dev.device.task.repository.TaskDao;
......@@ -192,10 +194,10 @@ public class AllotBillController {
taskBto1.setOwnUnit(userPublicService.findUnitIdByName(allotBillSaveVo.getReceiveUnit()));
saveEntity = taskService.moveToSpecial(taskBto1, StatusEnum.ALLOTING, 0);
}
if (allotBillSaveVo.getIsSigned()==null||allotBillSaveVo.getIsSigned()!=1) {
TaskBto taskBto2 = new TaskBto(StatusEnum.WAIT_UPLOAD_ALLOT_FILE.id, "配发业务", saveEntity.getId(), saveEntity.getNodeIdDetail() + saveEntity.getId() + ".", saveEntity.getBillId(), 3, userPublicService.findUnitIdByName(allotBillEntity.getSendUnit()), 0, null, Collections.singletonList(0));
taskService.start(taskBto2);
}
// if (allotBillSaveVo.getIsSigned()==null||allotBillSaveVo.getIsSigned()!=1) {
TaskBto taskBto2 = new TaskBto(StatusEnum.WAIT_UPLOAD_ALLOT_FILE.id, "配发业务", saveEntity.getId(), saveEntity.getNodeIdDetail() + saveEntity.getId() + ".", saveEntity.getBillId(), 3, userPublicService.findUnitIdByName(allotBillEntity.getSendUnit()), 0, null, Collections.singletonList(0));
taskService.start(taskBto2);
// }
}
else {
TaskBto taskBto2 = new TaskBto(StatusEnum.WAIT_UPLOAD_CROSS_FILE.id, "配发业务", null, ".", billId, 3, userPublicService.findUnitIdByName(allotBillEntity.getSendUnit()), 1, "country", userIds);
......@@ -577,10 +579,22 @@ public class AllotBillController {
userIds.add(0);
AllotBill allotBill1 = allotBillSaveVo.toDo();
allotBill1.setAllotStatus(0);
allotBill1.setSendUseraId(userUtils.getCurrentUserId());
AllotBill allotBill = allotBillService.addEntity(allotBill1);
//发起任务
TaskBto taskBto = new TaskBto(StatusEnum.ALLOT_DRAFT.id, "配发业务", null, ".", allotBill.getId(), 3, userUtils.getCurrentUnitId(), 0, null, userIds);
TaskBto taskBto1 = taskService.start(taskBto);
//改变装备状态为待配发
if (allotBillSaveVo.getAllotCheckDetail()!=null){
Map<Integer,DeviceLibrary> map = deviceLibraryService.getAllDeviceMap();
StringSplitUtil.split(allotBillSaveVo.getAllotCheckDetail()).forEach(integer -> {
if (map.get(integer)!=null){
DeviceLibrary deviceLibrary = map.get(integer);
deviceLibrary.setLifeStatus(21);
deviceLibraryService.update(deviceLibrary);
}
});
}
Integer id = taskBto1.getId();
myWebSocket.sendMessage1();
return ResponseEntity.ok("保存成功"+id);
......@@ -592,7 +606,8 @@ public class AllotBillController {
AllotBill allotBill1 = allotBillSaveVo.toDo();
allotBill1.setAllotStatus(0);
MapperUtils.copyNoNullProperties(allotBill1,allotBill);
allotBillService.update(allotBill1);
allotBillService.update(allotBill);
//改变装备状态为待配发
return ResponseEntity.ok("更新成功"+taskBto.getId());
}
}
......@@ -605,21 +620,48 @@ public class AllotBillController {
TaskBto taskBto = taskService.get(taskId);
TaskBto taskBto1 = taskService.addInvolveUser(taskBto,userUtils.getCurrentUserId());
taskService.moveToArchive(taskBto1);
//更改装备状态为在库
AllotBill allotBill = allotBillService.getOne(taskBto1.getBillId());
if (allotBill.getAllotCheckDetail()!=null){
Map<Integer,DeviceLibrary> map = deviceLibraryService.getAllDeviceMap();
StringSplitUtil.split(allotBill.getAllotCheckDetail()).forEach(integer -> {
if (map.get(integer)!=null){
DeviceLibrary deviceLibrary = map.get(integer);
deviceLibrary.setLifeStatus(2);
deviceLibraryService.update(deviceLibrary);
}
});
}
myWebSocket.sendMessage1();
return ResponseEntity.ok("删除成功");
}
// @ApiOperation(value = "删除配发单草稿", notes = "可以通过这个接口删除配发单草稿")
// @PostMapping(value = "/deleteAllotBill/{taskId}")
// @Transactional(rollbackFor = Exception.class)
// public ResponseEntity deleteAllotBill(@PathVariable("taskId") int taskId) {
// //任务封存
// TaskBto taskBto = taskService.get(taskId);
// TaskBto taskBto1 = taskService.addInvolveUser(taskBto,userUtils.getCurrentUserId());
// taskService.moveToArchive(taskBto1);
// myWebSocket.sendMessage1();
// return ResponseEntity.ok("删除成功");
// }
@ApiOperation(value = "申请电子签章", notes = "可以通过这个接口申请电子签章")
@PostMapping(value = "/applySign/{taskId}/{userId}")
@Transactional(rollbackFor = Exception.class)
public ResponseEntity applySign(@PathVariable("taskId") int taskId,@PathVariable("userId") int userId) {
//推动任务
TaskBto taskBto = taskService.get(taskId);
taskService.moveToSpecial(taskBto,StatusEnum.SIGN_WAIT_CONFIRM,userId);
myWebSocket.sendMessage1();
return ResponseEntity.ok("申请成功");
}
@ApiOperation(value = "申请电子签章审核", notes = "可以通过这个接口申请电子签章审核")
@PostMapping(value = "/applySignConfirm/{taskId}/{status}")
@Transactional(rollbackFor = Exception.class)
public ResponseEntity applySignConfirm(@PathVariable("taskId") int taskId,@PathVariable("status") int status) {
//推动任务
TaskBto taskBto = taskService.get(taskId);
if (status==1){
taskService.moveToSpecial(taskBto,StatusEnum.WAIT_SIGN);
}
else {
taskService.moveToSpecial(taskBto,StatusEnum.ALLOT_DRAFT,taskBto.getCreateUserId());
}
myWebSocket.sendMessage1();
return ResponseEntity.ok("申请成功");
}
@ApiOperation(value = "查询配发草稿详情", notes = "可以通过这个接口查询配发草稿详情")
@PostMapping(value = "/selectAllotDetail/{taskId}")
......@@ -646,6 +688,10 @@ public class AllotBillController {
allotBillEntity.setDeviceLibraries(deviceLibraryList);
}
allotBillEntity.setReplyFileList(FilesUtil.stringFileToList(allotBillEntity.getReplyFiles()));
allotBillEntity.setApplyFileList(FilesUtil.stringFileToList(allotBillEntity.getApplyFiles()));
if (allotBillEntity.getScriptJson()!=null){
allotBillEntity.setScripts(JacksonUtil.readValue(allotBillEntity.getScriptJson(),new TypeReference<List<ScriptSaveVo>>() {}));
}
return ResponseEntity.ok(allotBillEntity);
}
......
package com.tykj.dev.device.allot.controller;
import com.fasterxml.jackson.core.type.TypeReference;
import com.tykj.dev.config.swagger.AutoDocument;
import com.tykj.dev.device.allot.service.AllotBackBillService;
import com.tykj.dev.device.allot.subject.domin.AllotBackBill;
......@@ -13,6 +14,7 @@ import com.tykj.dev.device.library.service.DeviceLogService;
import com.tykj.dev.device.library.subject.Dto.DeviceLogDto;
import com.tykj.dev.device.library.subject.domin.DeviceLibrary;
import com.tykj.dev.device.library.subject.vo.FileVo;
import com.tykj.dev.device.library.subject.vo.ScriptSaveVo;
import com.tykj.dev.device.task.service.TaskService;
import com.tykj.dev.device.task.subject.bto.TaskBto;
import com.tykj.dev.device.user.read.service.MessageService;
......@@ -23,10 +25,7 @@ import com.tykj.dev.device.user.subject.service.UserPublicService;
import com.tykj.dev.device.user.util.UserUtils;
import com.tykj.dev.misc.base.ResultObj;
import com.tykj.dev.misc.base.StatusEnum;
import com.tykj.dev.misc.utils.Snowflake;
import com.tykj.dev.misc.utils.StringSplitUtil;
import com.tykj.dev.misc.utils.TaskDisposeUtil;
import com.tykj.dev.misc.utils.TimestampUtil;
import com.tykj.dev.misc.utils.*;
import com.tykj.dev.rfid.service.InputOutputDeviceService;
import com.tykj.dev.socket.MyWebSocket;
import io.swagger.annotations.Api;
......@@ -370,4 +369,129 @@ public class BackController {
allotBackBill.setSendUserbId(agentVo.getSendUserbId());
return ResponseEntity.ok(allotBackBillService.update(allotBackBill));
}
@ApiOperation(value = "保存退回操作", notes = "可以通过这个接口保存退回操作")
@PostMapping(value = "/saveBackBill")
@Transactional(rollbackFor = Exception.class)
public ResponseEntity saveBackBill(@RequestBody AllotBillSaveVo allotBillSaveVo) {
//第一次保存
if (allotBillSaveVo.getTaskId()==null){
//保存退回单
List<Integer> userIds = new ArrayList<>();
userIds.add(0);
AllotBackBill allotBackBill = allotBillSaveVo.toBackDo();
allotBackBill.setBackStatus(1);
AllotBackBill allotBackBill1 = allotBackBillService.addEntity(allotBackBill);
//发起任务
TaskBto taskBto = new TaskBto(StatusEnum.BACK_DRAFT.id, "退回业务", null, ".", allotBackBill1.getId(), 22, userUtils.getCurrentUnitId(), 0, null, userIds);
TaskBto taskBto1 = taskService.start(taskBto);
//改变装备状态为待退回
if (allotBillSaveVo.getAllotCheckDetail()!=null){
Map<Integer,DeviceLibrary> map = deviceLibraryService.getAllDeviceMap();
StringSplitUtil.split(allotBillSaveVo.getAllotCheckDetail()).forEach(integer -> {
if (map.get(integer)!=null){
DeviceLibrary deviceLibrary = map.get(integer);
deviceLibrary.setLifeStatus(22);
deviceLibraryService.update(deviceLibrary);
}
});
}
Integer id = taskBto1.getId();
myWebSocket.sendMessage1();
return ResponseEntity.ok("保存成功"+id);
}
else {
//更新账单
TaskBto taskBto = taskService.get(allotBillSaveVo.getTaskId());
AllotBackBill allotBackBill = allotBackBillService.getOne(taskBto.getBillId());
AllotBackBill allotBackBill1 = allotBillSaveVo.toBackDo();
allotBackBill1.setBackStatus(1);
MapperUtils.copyNoNullProperties(allotBackBill1,allotBackBill);
allotBackBillService.update(allotBackBill);
return ResponseEntity.ok("更新成功"+taskBto.getId());
}
}
@ApiOperation(value = "删除退回单草稿", notes = "可以通过这个接口删除退回单草稿")
@PostMapping(value = "/deleteBackBill/{taskId}")
@Transactional(rollbackFor = Exception.class)
public ResponseEntity deleteBackBill(@PathVariable("taskId") int taskId) {
//任务封存
TaskBto taskBto = taskService.get(taskId);
TaskBto taskBto1 = taskService.addInvolveUser(taskBto,userUtils.getCurrentUserId());
taskService.moveToArchive(taskBto1);
//更改装备状态为在库
AllotBackBill allotBackBill = allotBackBillService.getOne(taskBto1.getBillId());
if (allotBackBill.getBackCheckDetail()!=null){
Map<Integer,DeviceLibrary> map = deviceLibraryService.getAllDeviceMap();
StringSplitUtil.split(allotBackBill.getBackCheckDetail()).forEach(integer -> {
if (map.get(integer)!=null){
DeviceLibrary deviceLibrary = map.get(integer);
deviceLibrary.setLifeStatus(2);
deviceLibraryService.update(deviceLibrary);
}
});
}
myWebSocket.sendMessage1();
return ResponseEntity.ok("删除成功");
}
@ApiOperation(value = "申请电子签章", notes = "可以通过这个接口申请电子签章")
@PostMapping(value = "/applySign/{taskId}/{userId}")
@Transactional(rollbackFor = Exception.class)
public ResponseEntity applySign(@PathVariable("taskId") int taskId,@PathVariable("userId") int userId) {
//推动任务
TaskBto taskBto = taskService.get(taskId);
taskService.moveToSpecial(taskBto,StatusEnum.BACK_SIGN_WAIT_CONFIRM,userId);
myWebSocket.sendMessage1();
return ResponseEntity.ok("申请成功");
}
@ApiOperation(value = "申请电子签章审核", notes = "可以通过这个接口申请电子签章审核")
@PostMapping(value = "/applySignConfirm/{taskId}/{status}")
@Transactional(rollbackFor = Exception.class)
public ResponseEntity applySignConfirm(@PathVariable("taskId") int taskId,@PathVariable("status") int status) {
//推动任务
TaskBto taskBto = taskService.get(taskId);
if (status==1){
taskService.moveToSpecial(taskBto,StatusEnum.BACK_WAIT_SIGN);
}
else {
taskService.moveToSpecial(taskBto,StatusEnum.BACK_DRAFT,taskBto.getCreateUserId());
}
myWebSocket.sendMessage1();
return ResponseEntity.ok("申请成功");
}
@ApiOperation(value = "查询退回草稿详情", notes = "可以通过这个接口查询退回草稿详情")
@PostMapping(value = "/selectBackDetail/{taskId}")
@Transactional(rollbackFor = Exception.class)
public ResponseEntity selectBackDetail(@PathVariable("taskId") int taskId) {
TaskBto taskBto = taskService.get(taskId);
AllotBackBill allotBillEntity = allotBackBillService.getOne(taskBto.getBillId());
if (allotBillEntity.getSendUseraId() != null) {
allotBillEntity.setSenderUserA(userPublicService.getOne(allotBillEntity.getSendUseraId()).getName());
}
if (allotBillEntity.getSendUserbId() != null) {
allotBillEntity.setSenderUserB(userPublicService.getOne(allotBillEntity.getSendUserbId()).getName());
}
if (allotBillEntity.getReceiveUseraId() != null) {
allotBillEntity.setReceiveUserA(userPublicService.getOne(allotBillEntity.getReceiveUseraId()).getName());
}
if (allotBillEntity.getReceiveUserbId() != null) {
allotBillEntity.setReceiveUserB(userPublicService.getOne(allotBillEntity.getReceiveUserbId()).getName());
}
if (allotBillEntity.getBackCheckDetail()!=null){
List<Integer> ids = StringSplitUtil.split(allotBillEntity.getBackCheckDetail());
List<DeviceLibrary> deviceLibraryList = new ArrayList<>();
ids.forEach(integer -> deviceLibraryList.add(deviceLibraryService.getOne(integer)));
allotBillEntity.setDeviceLibraries(deviceLibraryList);
}
allotBillEntity.setReplyFileList(FilesUtil.stringFileToList(allotBillEntity.getReplyFiles()));
allotBillEntity.setApplyFileList(FilesUtil.stringFileToList(allotBillEntity.getApplyFiles()));
if (allotBillEntity.getScriptJson()!=null){
allotBillEntity.setScripts(JacksonUtil.readValue(allotBillEntity.getScriptJson(),new TypeReference<List<ScriptSaveVo>>() {}));
}
return ResponseEntity.ok(allotBillEntity);
}
}
package com.tykj.dev.device.allot.subject.domin;
import com.tykj.dev.device.file.entity.FileRet;
import com.tykj.dev.device.library.subject.domin.DeviceLibrary;
import com.tykj.dev.device.library.subject.vo.ScriptSaveVo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
......@@ -97,7 +98,7 @@ public class AllotBackBill {
@ApiModelProperty(value = "账单文件地址URL")
private String billFileUrl;
@ApiModelProperty(value = "配发退回状态(0:退回中,1:退回接收待审核,2:退回接收审核失败,3:退回完成)")
@ApiModelProperty(value = "配发退回状态(0:退回中,1:草稿,2:退回接收审核失败,3:退回完成)")
private Integer backStatus;
@CreatedBy
......@@ -199,4 +200,7 @@ public class AllotBackBill {
@Transient
private List<FileRet> receiveFileList = new ArrayList<>();
@Transient
private List<DeviceLibrary> deviceLibraries;
}
......@@ -3,7 +3,6 @@ package com.tykj.dev.config;
import com.tykj.dev.misc.base.*;
import java.util.Arrays;
import java.util.Collection;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;
......@@ -31,6 +30,8 @@ public class GlobalMap {
private static final Map<Integer,DeviceSecretLevel> deviceSecretLevelMap;
private static final Map<Integer,String> businessMap;
static {
statusEnumMap = Arrays.stream(StatusEnum.values())
.collect(Collectors.toMap(statusEnum -> statusEnum.id, Function.identity()));
......@@ -50,6 +51,8 @@ public class GlobalMap {
.collect(Collectors.toMap(deviceInvisibleRange -> deviceInvisibleRange.id, Function.identity()));
deviceSecretLevelMap = Arrays.stream(DeviceSecretLevel.values())
.collect(Collectors.toMap(deviceSecretLevel -> deviceSecretLevel.id, Function.identity()));
businessMap = Arrays.stream(BusinessEnum.values())
.collect(Collectors.toMap(businessEnum -> businessEnum.id, businessEnum -> businessEnum.name));
}
public static Map<Integer, StatusEnum> getStatusEnumMap() {
......@@ -88,5 +91,7 @@ public class GlobalMap {
return deviceInvisibleRangeMap;
}
public static Map<Integer, String> getBusinessMap() {
return businessMap;
}
}
......@@ -99,7 +99,17 @@ public enum DeviceLifeStatus {
/**
* 销毁中
*/
IN_THE_DESTROYED(20,"销毁中");
IN_THE_DESTROYED(20,"销毁中"),
/**
* 待配发
*/
WAIT_ALLOT(21,"待配发"),
/**
* 待退回
*/
WAIT_BACK(22,"待退回");
public Integer id;
......
......@@ -256,6 +256,9 @@ public enum StatusEnum {
ALLOT_BACKING(900, "装备退回中"),
WAIT_UPLOAD_ALLOT_BACK_FILE(901, "待上传退回单"),
WAIT_UPLOAD_BACK_FILE_2(911, "待上传退回单"),
BACK_DRAFT(922,"草稿"),
BACK_SIGN_WAIT_CONFIRM(930,"申请签章待审核"),
BACK_WAIT_SIGN(931,"待盖章出库"),
/**
* 报废状态
......
......@@ -495,7 +495,7 @@ public class PackingLibraryServiceImpl implements PackingLibraryService {
public List<DeviceLibrary> getAllDevSeqs(Integer packingId) {
PredicateBuilder<DeviceLibrary> predicateBuilder = Specifications.and();
// predicateBuilder.eq("ownUnit", userUtils.getCurrentUserUnitName());
predicateBuilder.eq("lifeStatus", 2);
// predicateBuilder.eq("lifeStatus", 2);
predicateBuilder.eq("packingId", packingId);
return deviceLibraryDao.findAll(predicateBuilder.build());
}
......
package com.tykj.dev.device.task.controller;
import com.tykj.dev.config.GlobalMap;
import com.tykj.dev.config.swagger.AutoDocument;
import com.tykj.dev.device.task.repository.TaskDao;
import com.tykj.dev.device.task.service.TaskLogService;
......@@ -15,6 +16,7 @@ import com.tykj.dev.misc.utils.ResultUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
......@@ -51,7 +53,13 @@ public class TaskController {
@RequestMapping(method = RequestMethod.POST, value = "/manage/summary", produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity getTaskPage(@RequestBody TaskSelectVo taskSelectVo) {
List<TaskUserVo> taskUserVos = taskService.getManageList(taskSelectVo);
return ResultUtil.success(PageUtil.getPerPage(taskSelectVo.getPage(), taskSelectVo.getSize(), taskUserVos, taskSelectVo.getPageable()));
Page<TaskUserVo> taskUserVos1 = PageUtil.getPerPage(taskSelectVo.getPage(), taskSelectVo.getSize(), taskUserVos, taskSelectVo.getPageable());
Map<String,Object> map = new HashMap<>();
Map<Integer,String> businessMap = GlobalMap.getBusinessMap();
Set<Integer> businessType = taskUserVos.stream().map(TaskUserVo::getBusinessType).collect(Collectors.toSet());
map.put("pages",taskUserVos1);
map.put("businessTypes",businessType.stream().map(integer -> new BusinessTypeVo(integer,businessMap.get(integer))).collect(Collectors.toList()));
return ResultUtil.success(map);
}
@ApiOperation(value = "业务跟踪待办列表查询", notes = "可以通过这个接口查询业务")
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论