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

修改维修

上级 ad658b43
...@@ -82,13 +82,13 @@ public enum LogType { ...@@ -82,13 +82,13 @@ public enum LogType {
REPAIR_SEND_3(32,REPAIR.id, REPAIR_SEND_CONFIRM.id, ARCHIVE.id, "维修出库审核失败"), REPAIR_SEND_3(32,REPAIR.id, REPAIR_SEND_CONFIRM.id, ARCHIVE.id, "维修出库审核失败"),
REPAIR_SEND_4(33,REPAIR.id, WAIT_RECEIVE.id, REPAIRING.id, "接收维修装备并发起入库"), REPAIR_SEND_4(33,REPAIR.id, WAIT_RECEIVE.id, END.id, "接收维修装备并发起入库"),
DESTROY_4(100,DESTROY.id, WAIT_UPLOAD_BILL_FILE.id, END.id, "上传销毁单"), DESTROY_4(100,DESTROY.id, WAIT_UPLOAD_BILL_FILE.id, END.id, "上传销毁单"),
REPAIR_SEND_5(34,REPAIR.id, REPAIR_RECEIVE_CONFIRM.id, REPAIRING.id, "审核成功并入库维修"), REPAIR_SEND_5(34,REPAIR.id, WAIT_RECEIVE.id, WAIT_UPLOAD_FILE.id, "接收维修装备并发起入库(缺少单据)"),
REPAIR_SEND_6(35,REPAIR.id, REPAIR_RECEIVE_CONFIRM.id, ARCHIVE.id, "维修装备入库审核失败"), REPAIR_SEND_6(35,REPAIR.id, WAIT_UPLOAD_FILE.id, END.id, "上传送修单据"),
REPAIR_SEND_7(36,REPAIR.id, REPAIR_SEND_CONFIRM.id, COUNTRY_REPAIRING.id, "审核成功并出库"), REPAIR_SEND_7(36,REPAIR.id, REPAIR_SEND_CONFIRM.id, COUNTRY_REPAIRING.id, "审核成功并出库"),
...@@ -170,7 +170,7 @@ public enum LogType { ...@@ -170,7 +170,7 @@ public enum LogType {
ALLOT_10(84,ALLOT.id, WAIT_ALLOT.id, ALLOTING.id, "对(%receiveUnit)发起配发"), ALLOT_10(84,ALLOT.id, WAIT_ALLOT.id, ALLOTING.id, "对(%receiveUnit)发起配发"),
ALLOT_11(85,ALLOT.id, ALLOTING.id, ARCHIVE.id, "拒绝接收配发装备"), ALLOT_11(85,ALLOT.id, ALLOTING.id, ARCHIVE.id, "拒绝接收配发装备"),
ALLOT_BACK_5(86,ALLOT_BACK.id, ALLOT_BACKING.id, END.id, "接收配发退回装备"), ALLOT_BACK_5(86,ALLOT_BACK.id, ALLOT_BACKING.id, END.id, "接收配发退回装备"),
REPAIR_SEND_10(87,REPAIR.id, ORIGIN_STATUS.id, COUNTRY_REPAIRING.id, "向(%receiveUnit)发起装备维修"), REPAIR_SEND_10(87,REPAIR.id, ORIGIN_STATUS.id, END.id, "向(%receiveUnit)发起装备维修"),
REPAIR_BACK_7(88,REPAIR_BACK.id, ORIGIN_STATUS.id, END.id, "维修退回装备接收并发起入库"), REPAIR_BACK_7(88,REPAIR_BACK.id, ORIGIN_STATUS.id, END.id, "维修退回装备接收并发起入库"),
STORAGE_4(89,STORAGE.id, WAIT_STORAGE.id, ARCHIVE.id, "删除入库草稿"), STORAGE_4(89,STORAGE.id, WAIT_STORAGE.id, ARCHIVE.id, "删除入库草稿"),
; ;
......
...@@ -168,6 +168,7 @@ public enum StatusEnum { ...@@ -168,6 +168,7 @@ public enum StatusEnum {
WAIT_RECEIVE(701, "等待接收维修装备"), WAIT_RECEIVE(701, "等待接收维修装备"),
REPAIR_RECEIVE_CONFIRM(702, "接收维修装备待审核"), REPAIR_RECEIVE_CONFIRM(702, "接收维修装备待审核"),
REPAIRING(703, "维修中"), REPAIRING(703, "维修中"),
WAIT_UPLOAD_FILE(704, "等待上传送修单"),
COUNTRY_REPAIRING(777, "等待接收维修退回装备"), COUNTRY_REPAIRING(777, "等待接收维修退回装备"),
/** /**
* 维修完成退回状态 * 维修完成退回状态
...@@ -175,6 +176,7 @@ public enum StatusEnum { ...@@ -175,6 +176,7 @@ public enum StatusEnum {
REPAIR_BACK_CONFIRM(800, "维修退回装备出库待审核"), REPAIR_BACK_CONFIRM(800, "维修退回装备出库待审核"),
WAIT_BACK_RECEIVE(801, "等待接收维修退回装备"), WAIT_BACK_RECEIVE(801, "等待接收维修退回装备"),
REPAIR_BACK_RECEIVE_CONFIRM(802, "接收维修退回装备待审核"), REPAIR_BACK_RECEIVE_CONFIRM(802, "接收维修退回装备待审核"),
WAIT_UPLOAD_BACK_FILE(804, "等待上传回执单"),
/** /**
* 配发退回状态 * 配发退回状态
......
...@@ -201,6 +201,7 @@ public class RepairController { ...@@ -201,6 +201,7 @@ public class RepairController {
//如果当前为省像国家发起的 //如果当前为省像国家发起的
if (level == 1) { if (level == 1) {
deviceLibraryEntity.setLifeStatus(4); deviceLibraryEntity.setLifeStatus(4);
deviceLibraryEntity.setLocationUnit("中办");
} else { } else {
deviceLibraryEntity.setLifeStatus(3); deviceLibraryEntity.setLifeStatus(3);
} }
...@@ -221,7 +222,7 @@ public class RepairController { ...@@ -221,7 +222,7 @@ public class RepairController {
List<Integer> ids = userPublicService.findOtherUser(userUtils.getCurrentUserId()); List<Integer> ids = userPublicService.findOtherUser(userUtils.getCurrentUserId());
if (level == 1) { if (level == 1) {
ownUnit = userUtils.getCurrentUnitId(); ownUnit = userUtils.getCurrentUnitId();
TaskBto taskBto = new TaskBto(StatusEnum.COUNTRY_REPAIRING.id, "维修业务", null, ".", repairBill1.getId(), 5, ownUnit, 1, null, userIds); TaskBto taskBto = new TaskBto(StatusEnum.END.id, "维修业务", null, ".", repairBill1.getId(), 5, ownUnit, 1, null, userIds);
saveEntity = taskService.start(taskBto); saveEntity = taskService.start(taskBto);
} else { } else {
ownUnit = userPublicService.findUnitIdByName(repairBill.getReceiveUnit()); ownUnit = userPublicService.findUnitIdByName(repairBill.getReceiveUnit());
...@@ -410,7 +411,6 @@ public class RepairController { ...@@ -410,7 +411,6 @@ public class RepairController {
} }
//存业务日志 //存业务日志
List<FileVo> fileVoList = new ArrayList<>(); List<FileVo> fileVoList = new ArrayList<>();
fileVoList.add(new FileVo("维修单", repairSendBill.getBillFileName(), repairSendBill.getBillFileUrl()));
fileVoList.add(new FileVo("入库确认单", repairSendBill.getReceiveFileName(), repairSendBill.getReceiveFileUrl())); fileVoList.add(new FileVo("入库确认单", repairSendBill.getReceiveFileName(), repairSendBill.getReceiveFileUrl()));
//更新维修单和送修单 //更新维修单和送修单
repairBill.setRepairStatus(4); repairBill.setRepairStatus(4);
...@@ -428,7 +428,14 @@ public class RepairController { ...@@ -428,7 +428,14 @@ public class RepairController {
repairSendBill.setRepairUserbId(repairReceiveVo.getReceiveUserbId()); repairSendBill.setRepairUserbId(repairReceiveVo.getReceiveUserbId());
deviceRepairSendBillService.update(repairSendBill); deviceRepairSendBillService.update(repairSendBill);
//任务推至下一阶段 //任务推至下一阶段
taskService.moveToSpecial(taskBto,StatusEnum.REPAIRING); // taskService.moveToSpecial(taskBto,StatusEnum.REPAIRING);
if (repairReceiveVo.getStatus()==0) {
fileVoList.add(new FileVo("维修单", repairSendBill.getBillFileName(), repairSendBill.getBillFileUrl()));
taskService.moveToEnd(taskBto);
}
else {
taskService.moveToSpecial(taskBto,StatusEnum.WAIT_UPLOAD_FILE);
}
// taskService.update(taskService.moveToNext(taskBto, repairReceiveVo.getReceiveUserbId())); // taskService.update(taskService.moveToNext(taskBto, repairReceiveVo.getReceiveUserbId()));
//分隔装备id //分隔装备id
String[] strings = deviceIdDetail.split("x"); String[] strings = deviceIdDetail.split("x");
...@@ -489,6 +496,30 @@ public class RepairController { ...@@ -489,6 +496,30 @@ public class RepairController {
return ResultUtil.success("维修装备接收入库"); return ResultUtil.success("维修装备接收入库");
} }
@ApiOperation(value = "上传送修单", notes = "可以通过这个接口上传送修单")
@PostMapping(value = "/uploadRepairBill")
@Transactional(rollbackFor = Exception.class)
public ResponseEntity uploadRepairBill(@RequestBody @Validated FileUploadVo fileUploadVo){
TaskBto taskBto = taskService.get(fileUploadVo.getTaskId());
Integer userId = userUtils.getCurrentUserId();
taskService.addInvolveUser(taskBto,userId);
taskService.moveToEnd(taskBto);
RepairSendBill repairSendBill = deviceRepairSendBillService.getOne(taskBto.getBillId());
repairSendBill.setBillFileName(fileUploadVo.getBillFileName());
repairSendBill.setBillFileUrl(fileUploadVo.getBillFileUrl());
deviceRepairSendBillService.update(repairSendBill);
List<FileVo> fileVoList = new ArrayList<>();
fileVoList.add(new FileVo("维修单", repairSendBill.getBillFileName(), repairSendBill.getBillFileUrl()));
//添加装备日志
List<Integer> deviceIds = StringSplitUtil.split(repairSendBill.getRepairReciveCheckDetail());
deviceIds.forEach(integer -> {
//存装备日志
DeviceLogDto deviceLogDto = new DeviceLogDto(integer, "上传送修单据", fileVoList);
deviceLogService.addLog(deviceLogDto);
});
return ResponseEntity.ok("上传成功");
}
@ApiOperation(value = "接收维修装备审核", notes = "可以通过这个接口对接收维修装备审核") @ApiOperation(value = "接收维修装备审核", notes = "可以通过这个接口对接收维修装备审核")
@PostMapping(value = "/receiveConfirm") @PostMapping(value = "/receiveConfirm")
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
...@@ -607,19 +638,19 @@ public class RepairController { ...@@ -607,19 +638,19 @@ public class RepairController {
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public ResponseEntity repairBack(@RequestBody @Validated RepairBackBillSaveVo repairBackBillSaveVo) { public ResponseEntity repairBack(@RequestBody @Validated RepairBackBillSaveVo repairBackBillSaveVo) {
//获取当前维修业务,维修单 //获取当前维修业务,维修单
TaskBto taskBto = taskService.get(repairBackBillSaveVo.getTaskId()); // TaskBto taskBto = taskService.get(repairBackBillSaveVo.getTaskId());
Integer userId = userUtils.getCurrentUserId(); Integer userId = userUtils.getCurrentUserId();
RepairBill repairBill = deviceRepairBillService.getOne(taskBto.getBillId()); // RepairBill repairBill = deviceRepairBillService.getOne(taskBto.getBillId());
//生成维修退回单 //生成维修退回单
RepairBackBill repairBackBill = new RepairBackBill(); RepairBackBill repairBackBill = new RepairBackBill();
BeanUtils.copyProperties(repairBackBillSaveVo, repairBackBill); BeanUtils.copyProperties(repairBackBillSaveVo, repairBackBill);
repairBackBill.setBackStatus(2); repairBackBill.setBackStatus(2);
repairBackBill.setDeviceRepairBillId(repairBill.getId()); // repairBackBill.setDeviceRepairBillId(repairBill.getId());
repairBackBill.setSendTime(new Date()); repairBackBill.setSendTime(new Date());
repairBackBill.setTitle("维修退回业务"); repairBackBill.setTitle("维修退回业务");
repairBackBill.setAgent(repairBackBillSaveVo.getAgent()); repairBackBill.setAgent(repairBackBillSaveVo.getAgent());
Calendar calendar = Calendar.getInstance(); Calendar calendar = Calendar.getInstance();
String s1 = "NO:第" + calendar.get(Calendar.YEAR) + "HZ" + repairBackBill.getId() + "号"; String s1 = "NO:第" + calendar.get(Calendar.YEAR) + "LQ" + repairBackBill.getId() + "号";
repairBackBill.setDocNum(s1); repairBackBill.setDocNum(s1);
//生成单位签章id //生成单位签章id
Long signId = snowflake.creatNextId(); Long signId = snowflake.creatNextId();
...@@ -631,13 +662,16 @@ public class RepairController { ...@@ -631,13 +662,16 @@ public class RepairController {
List<Integer> userIds = new ArrayList<>(); List<Integer> userIds = new ArrayList<>();
userIds.add(userId); userIds.add(userId);
userIds.add(0); userIds.add(0);
TaskBto taskBto1 = new TaskBto(StatusEnum.WAIT_BACK_RECEIVE.id, "维修退回", taskBto.getId(), taskBto.getNodeIdDetail() + taskBto.getId() + ".", deviceRepairBackBillEntity1.getId(), BusinessEnum.REPAIR_BACK.id,userPublicService.findUnitIdByName(repairBackBill.getReceiveUnit()), 1, null, userIds); TaskBto taskBto1 = new TaskBto(StatusEnum.WAIT_BACK_RECEIVE.id, "维修退回", null, ".", deviceRepairBackBillEntity1.getId(), BusinessEnum.REPAIR_BACK.id,userPublicService.findUnitIdByName(repairBackBill.getReceiveUnit()), 1, null, userIds);
TaskBto task = taskService.start(taskBto1); TaskBto task = taskService.start(taskBto1);
//添加业务日志 //添加业务日志
List<FileVo> fileVoList = new ArrayList<>(); List<FileVo> fileVoList = new ArrayList<>();
fileVoList.add(new FileVo("出库确认单", repairBackBillSaveVo.getFileName(), repairBackBillSaveVo.getFileUrl())); fileVoList.add(new FileVo("出库确认单", repairBackBillSaveVo.getFileName(), repairBackBillSaveVo.getFileUrl()));
//添加装备日志 //添加装备日志
for (DeviceDetailVo d : repairBackBillSaveVo.getDeviceList()) { for (DeviceDetailVo d : repairBackBillSaveVo.getDeviceList()) {
RepairDetail repairDetail = deviceRepairDetailService.getOne(d.getId());
repairDetail.setRepairBackBillId(deviceRepairBackBillEntity1.getId());
deviceRepairDetailService.update(repairDetail);
DeviceLibrary deviceLibraryEntity = deviceLibraryService.getOne(d.getDeviceId()); DeviceLibrary deviceLibraryEntity = deviceLibraryService.getOne(d.getDeviceId());
deviceLibraryEntity.setLifeStatus(3); deviceLibraryEntity.setLifeStatus(3);
deviceLibraryEntity.setManageStatus(0); deviceLibraryEntity.setManageStatus(0);
...@@ -649,33 +683,33 @@ public class RepairController { ...@@ -649,33 +683,33 @@ public class RepairController {
//添加出库白名单 //添加出库白名单
inputOutputDeviceService.addWhiteDevices(idList,userUtils.getCurrentUnitId(),1); inputOutputDeviceService.addWhiteDevices(idList,userUtils.getCurrentUnitId(),1);
//判断是否修完 //判断是否修完
List<RepairDetail> deviceRepairDetailEntities = deviceRepairDetailService.findByBillId(repairBill.getId()); // List<RepairDetail> deviceRepairDetailEntities = deviceRepairDetailService.findByBillId(repairBill.getId());
//获取所有装备的维修状态 //获取所有装备的维修状态
Set<Integer> statusSet = deviceRepairDetailEntities.stream() // Set<Integer> statusSet = deviceRepairDetailEntities.stream()
.map(RepairDetail::getRepairStatus) // .map(RepairDetail::getRepairStatus)
.collect(Collectors.toSet()); // .collect(Collectors.toSet());
//存放所有维修完成的状态 // //存放所有维修完成的状态
Set<Integer> integerSet = new HashSet<>(); // Set<Integer> integerSet = new HashSet<>();
integerSet.add(2); // integerSet.add(2);
integerSet.add(3); // integerSet.add(3);
integerSet.add(4); // integerSet.add(4);
integerSet.add(5); // integerSet.add(5);
integerSet.add(6); // integerSet.add(6);
//取交集 // //取交集
integerSet.retainAll(statusSet); // integerSet.retainAll(statusSet);
//如果取交集后size不变,则说明全部都是维修完成的状态 // //如果取交集后size不变,则说明全部都是维修完成的状态
if (integerSet.size() == statusSet.size()) { // if (integerSet.size() == statusSet.size()) {
//维修主业务完结 // //维修主业务完结
taskService.update(taskService.moveToEnd(taskBto)); // taskService.update(taskService.moveToEnd(taskBto));
repairBill.setRepairStatus(5); // repairBill.setRepairStatus(5);
deviceRepairBillService.update(repairBill); // deviceRepairBillService.update(repairBill);
} // }
//发送阅知信息 //发送阅知信息
List<Integer> ids = userPublicService.findOtherUser(userUtils.getCurrentUserId()); List<Integer> ids = userPublicService.findOtherUser(userUtils.getCurrentUserId());
ids.addAll(userDao.findAllByUnitsId(userPublicService.findUnitIdByName(repairBackBill.getReceiveUnit())).stream() ids.addAll(userDao.findAllByUnitsId(userPublicService.findUnitIdByName(repairBackBill.getReceiveUnit())).stream()
.map(User::getUserId) .map(User::getUserId)
.collect(Collectors.toList())); .collect(Collectors.toList()));
MessageBto messageBto = new MessageBto(taskBto.getId(),taskBto.getBusinessType(),repairBackBill.getSendUnit()+"向"+repairBackBill.getReceiveUnit()+"退回维修装备",ids); MessageBto messageBto = new MessageBto(taskBto1.getId(),taskBto1.getBusinessType(),repairBackBill.getSendUnit()+"向"+repairBackBill.getReceiveUnit()+"退回维修装备",ids);
messageService.add(messageBto); messageService.add(messageBto);
myWebSocket.sendMessage1(); myWebSocket.sendMessage1();
return ResultUtil.success(task); return ResultUtil.success(task);
...@@ -759,32 +793,32 @@ public class RepairController { ...@@ -759,32 +793,32 @@ public class RepairController {
if (level == 2 || level == 3) { if (level == 2 || level == 3) {
repairBackBill = deviceRepairBackBillService.getOne(taskBto.getBillId()); repairBackBill = deviceRepairBackBillService.getOne(taskBto.getBillId());
} else { } else {
//判断是否修完 // //判断是否修完
List<RepairDetail> deviceRepairDetailEntities = deviceRepairDetailService.findByBillId(taskBto.getBillId()); // List<RepairDetail> deviceRepairDetailEntities = deviceRepairDetailService.findByBillId(taskBto.getBillId());
//获取所有装备的维修状态 // //获取所有装备的维修状态
Set<Integer> statusSet = deviceRepairDetailEntities.stream() // Set<Integer> statusSet = deviceRepairDetailEntities.stream()
.map(RepairDetail::getRepairStatus) // .map(RepairDetail::getRepairStatus)
.collect(Collectors.toSet()); // .collect(Collectors.toSet());
//存放所有维修完成的状态 // //存放所有维修完成的状态
Set<Integer> integerSet = new HashSet<>(); // Set<Integer> integerSet = new HashSet<>();
integerSet.add(2); // integerSet.add(2);
integerSet.add(3); // integerSet.add(3);
integerSet.add(4); // integerSet.add(4);
integerSet.add(5); // integerSet.add(5);
integerSet.add(6); // integerSet.add(6);
//取交集 // //取交集
integerSet.retainAll(statusSet); // integerSet.retainAll(statusSet);
//如果取交集后size不变,则说明全部都是维修完成的状态 // //如果取交集后size不变,则说明全部都是维修完成的状态
if (integerSet.size() == statusSet.size()) { // if (integerSet.size() == statusSet.size()) {
//结束父任务 // //结束父任务
taskService.moveToEnd(taskBto); // taskService.moveToEnd(taskBto);
} // }
RepairSendBill repairSendBill = deviceRepairSendBillDao.findByDeviceRepairBillId(taskBto.getBillId()); // RepairSendBill repairSendBill = deviceRepairSendBillDao.findByDeviceRepairBillId(taskBto.getBillId());
repairBackBill = new RepairBackBill(); repairBackBill = new RepairBackBill();
repairBackBill.setSendUnit("中办"); repairBackBill.setSendUnit("中办");
repairBackBill.setReceiveUnit(userUtils.getCurrentUserUnitName()); repairBackBill.setReceiveUnit(userUtils.getCurrentUserUnitName());
repairBackBill.setBackCheckDetail(repairSendBill.getRepairDeviceCheckDetail()); repairBackBill.setBackCheckDetail(repairReceiveVo.getReceiveCheckDetail());
repairBackBill.setDeviceRepairBillId(taskBto.getBillId()); // repairBackBill.setDeviceRepairBillId(taskBto.getBillId());
} }
String deviceIdDetail = repairReceiveVo.getReceiveCheckDetail(); String deviceIdDetail = repairReceiveVo.getReceiveCheckDetail();
if (repairBackBill.getReceiveUseraId() == null) { if (repairBackBill.getReceiveUseraId() == null) {
...@@ -803,23 +837,35 @@ public class RepairController { ...@@ -803,23 +837,35 @@ public class RepairController {
repairBackBill.setReceiveUserbId(repairReceiveVo.getReceiveUserbId()); repairBackBill.setReceiveUserbId(repairReceiveVo.getReceiveUserbId());
RepairBackBill repairBackBill1 = deviceRepairBackBillService.update(repairBackBill); RepairBackBill repairBackBill1 = deviceRepairBackBillService.update(repairBackBill);
List<FileVo> fileVoList = new ArrayList<>(); List<FileVo> fileVoList = new ArrayList<>();
fileVoList.add(new FileVo("维修单", repairBackBill.getBillFileName(), repairBackBill.getBillFileUrl())); fileVoList.add(new FileVo("回执单", repairBackBill.getBillFileName(), repairBackBill.getBillFileUrl()));
fileVoList.add(new FileVo("入库确认单", repairBackBill.getReceiveFileName(), repairBackBill.getReceiveFileUrl())); fileVoList.add(new FileVo("入库确认单", repairBackBill.getReceiveFileName(), repairBackBill.getReceiveFileUrl()));
TaskBto taskBto2; TaskBto taskBto2;
if (level == 1) { if (level == 1) {
List<Integer> userIds = new ArrayList<>(); List<Integer> userIds = new ArrayList<>();
userIds.add(userId); userIds.add(userId);
TaskBto taskBto1 = new TaskBto(StatusEnum.END.id, "维修退回", taskBto.getId(), taskBto.getNodeIdDetail() + taskBto.getId() + ".", repairBackBill1.getId(), BusinessEnum.REPAIR_BACK.id, userUtils.getCurrentUnitId(), 0, null, userIds); if (repairReceiveVo.getStatus()==0) {
taskBto2 = taskService.start(taskBto1); TaskBto taskBto1 = new TaskBto(StatusEnum.END.id, "维修退回", null, ".", repairBackBill1.getId(), BusinessEnum.REPAIR_BACK.id, userUtils.getCurrentUnitId(), 0, null, userIds);
taskBto2 = taskService.start(taskBto1);
}
else {
userIds.add(0);
TaskBto taskBto1 = new TaskBto(StatusEnum.WAIT_UPLOAD_BACK_FILE.id, "维修退回", null, ".", repairBackBill1.getId(), BusinessEnum.REPAIR_BACK.id, userUtils.getCurrentUnitId(), 1, null, userIds);
taskBto2 = taskService.start(taskBto1);
}
//添加业务日志 //添加业务日志
// TaskLogBto taskLogBto2 = new TaskLogBto(taskBto2.getId(), "维修退回装备接收并发起入库", fileVoList); // TaskLogBto taskLogBto2 = new TaskLogBto(taskBto2.getId(), "维修退回装备接收并发起入库", fileVoList);
// taskLogService.addLog(taskLogBto2); // taskLogService.addLog(taskLogBto2);
} else { } else {
//任务推至下一阶段 if (repairReceiveVo.getStatus()==0) {
//任务推至下一阶段
// taskService.update(taskService.moveToNext(taskBto, repairReceiveVo.getReceiveUserbId())); // taskService.update(taskService.moveToNext(taskBto, repairReceiveVo.getReceiveUserbId()));
taskBto2 = taskService.moveToEnd(taskBto); taskBto2 = taskService.moveToEnd(taskBto);
}
else {
taskBto2 = taskService.moveToSpecial(taskBto,StatusEnum.WAIT_UPLOAD_BACK_FILE);
}
} }
TaskBto parent = taskService.get(taskBto2.getParentTaskId()); // TaskBto parent = taskService.get(taskBto2.getParentTaskId());
String[] strings = deviceIdDetail.split("x"); String[] strings = deviceIdDetail.split("x");
//存放正常接收的装备id //存放正常接收的装备id
List<Integer> idList = new ArrayList<>(); List<Integer> idList = new ArrayList<>();
...@@ -851,26 +897,26 @@ public class RepairController { ...@@ -851,26 +897,26 @@ public class RepairController {
} }
} }
} }
//获取维修详情 // //获取维修详情
List<RepairDetail> repairDetailList = deviceRepairDetailService.findByBillId(parent.getBillId()); // List<RepairDetail> repairDetailList = deviceRepairDetailService.findByBillId(parent.getBillId());
//获取所有父业务id // //获取所有父业务id
List<Integer> fathers = StringSplitUtil.taskIdSplit(parent.getNodeIdDetail()); // List<Integer> fathers = StringSplitUtil.taskIdSplit(parent.getNodeIdDetail());
fathers.forEach(integer -> { // fathers.forEach(integer -> {
//筛选出父业务相同装备的维修详情 // //筛选出父业务相同装备的维修详情
List<RepairDetail> repairDetails = repairDetailDao.findByDeviceRepairBillId(taskService.get(integer).getBillId()).stream() // List<RepairDetail> repairDetails = repairDetailDao.findByDeviceRepairBillId(taskService.get(integer).getBillId()).stream()
.filter(repairDetail -> idList.contains(repairDetail.getDeviceId())) // .filter(repairDetail -> idList.contains(repairDetail.getDeviceId()))
.collect(Collectors.toList()); // .collect(Collectors.toList());
repairDetails.forEach(repairDetail -> { // repairDetails.forEach(repairDetail -> {
repairDetail.setLocationUnit(userUtils.getCurrentUserUnitName()); // repairDetail.setLocationUnit(userUtils.getCurrentUserUnitName());
deviceRepairDetailService.update(repairDetail); // deviceRepairDetailService.update(repairDetail);
}); // });
}); // });
//改变维修详情装备所在单位为当前单位 // //改变维修详情装备所在单位为当前单位
repairDetailList.forEach(repairDetail -> { // repairDetailList.forEach(repairDetail -> {
repairDetail.setLocationUnit(userUtils.getCurrentUserUnitName()); // repairDetail.setLocationUnit(userUtils.getCurrentUserUnitName());
repairDetail.setRepairStatus(5); // repairDetail.setRepairStatus(5);
deviceRepairDetailService.update(repairDetail); // deviceRepairDetailService.update(repairDetail);
}); // });
//发送阅知信息 //发送阅知信息
List<Integer> ids = userPublicService.findOtherUser(userUtils.getCurrentUserId()); List<Integer> ids = userPublicService.findOtherUser(userUtils.getCurrentUserId());
if (level>1) { if (level>1) {
...@@ -884,6 +930,30 @@ public class RepairController { ...@@ -884,6 +930,30 @@ public class RepairController {
return ResultUtil.success("维修成功退回装备接收入库"); return ResultUtil.success("维修成功退回装备接收入库");
} }
@ApiOperation(value = "上传回执单", notes = "可以通过这个接口上传回执单")
@PostMapping(value = "/uploadRepairBackBill")
@Transactional(rollbackFor = Exception.class)
public ResponseEntity uploadRepairBackBill(@RequestBody @Validated FileUploadVo fileUploadVo){
TaskBto taskBto = taskService.get(fileUploadVo.getTaskId());
Integer userId = userUtils.getCurrentUserId();
taskService.addInvolveUser(taskBto,userId);
taskService.moveToEnd(taskBto);
RepairBackBill repairBackBill = deviceRepairBackBillService.getOne(taskBto.getBillId());
repairBackBill.setBillFileName(fileUploadVo.getBillFileName());
repairBackBill.setBillFileUrl(fileUploadVo.getBillFileUrl());
deviceRepairBackBillService.update(repairBackBill);
List<FileVo> fileVoList = new ArrayList<>();
fileVoList.add(new FileVo("回执单", repairBackBill.getBillFileName(), repairBackBill.getBillFileUrl()));
//添加装备日志
List<Integer> deviceIds = StringSplitUtil.split(repairBackBill.getBackReciveCheckDetail());
deviceIds.forEach(integer -> {
//存装备日志
DeviceLogDto deviceLogDto = new DeviceLogDto(integer, "上传回执单据", fileVoList);
deviceLogService.addLog(deviceLogDto);
});
return ResponseEntity.ok("上传成功");
}
@ApiOperation(value = "修好装备送回接收入库审核", notes = "可以通过这个接口修好装备送回接收") @ApiOperation(value = "修好装备送回接收入库审核", notes = "可以通过这个接口修好装备送回接收")
@PostMapping(value = "/back/receive/confirm") @PostMapping(value = "/back/receive/confirm")
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
...@@ -1148,8 +1218,8 @@ public class RepairController { ...@@ -1148,8 +1218,8 @@ public class RepairController {
RepairBackBill repairBackBill = deviceRepairBackBillService.getOne(taskBto.getBillId()); RepairBackBill repairBackBill = deviceRepairBackBillService.getOne(taskBto.getBillId());
repairBillDetailVo.setRepairBackBill(repairBackBill); repairBillDetailVo.setRepairBackBill(repairBackBill);
//获取送修单 //获取送修单
RepairBill repairBill1 = deviceRepairBillService.getOne(taskService.get(taskBto.getParentTaskId()).getBillId()); // RepairBill repairBill1 = deviceRepairBillService.getOne(taskService.get(taskBto.getParentTaskId()).getBillId());
repairBillDetailVo.setRepairBill(repairBill1); // repairBillDetailVo.setRepairBill(repairBill1);
if (repairBackBill.getStartUseraId() != null) { if (repairBackBill.getStartUseraId() != null) {
repairBackBill.setStartUserA(userPublicService.getOne(repairBackBill.getStartUseraId()).getName()); repairBackBill.setStartUserA(userPublicService.getOne(repairBackBill.getStartUseraId()).getName());
} }
...@@ -1191,7 +1261,7 @@ public class RepairController { ...@@ -1191,7 +1261,7 @@ public class RepairController {
} }
//获取维修详情 //获取维修详情
List<RepairDetail> repairDetailList = getRepairDetail(repairBackBill.getDeviceRepairBillId()); List<RepairDetail> repairDetailList = repairDetailDao.findByRepairBackBillId(repairBackBill.getId());
repairBillDetailVo.setRepairDetails(repairDetailList); repairBillDetailVo.setRepairDetails(repairDetailList);
//设置装备备注 //设置装备备注
deviceLibraryList.forEach(deviceLibrary -> { deviceLibraryList.forEach(deviceLibrary -> {
......
...@@ -8,4 +8,5 @@ import java.util.List; ...@@ -8,4 +8,5 @@ import java.util.List;
public interface RepairDetailDao extends JpaRepository<RepairDetail, Integer>, JpaSpecificationExecutor<RepairDetail> { public interface RepairDetailDao extends JpaRepository<RepairDetail, Integer>, JpaSpecificationExecutor<RepairDetail> {
List<RepairDetail> findByDeviceRepairBillId(Integer billId); List<RepairDetail> findByDeviceRepairBillId(Integer billId);
List<RepairDetail> findByRepairBackBillId(Integer billId);
} }
...@@ -76,6 +76,7 @@ public class RepairDetail { ...@@ -76,6 +76,7 @@ public class RepairDetail {
* 所在单位 * 所在单位
*/ */
@ApiModelProperty(value = "所在单位") @ApiModelProperty(value = "所在单位")
@Transient
private String locationUnit; private String locationUnit;
/** /**
* 所属单位 * 所属单位
...@@ -130,4 +131,8 @@ public class RepairDetail { ...@@ -130,4 +131,8 @@ public class RepairDetail {
@ApiModelProperty(value = "区块链记录id") @ApiModelProperty(value = "区块链记录id")
private String recordId; private String recordId;
@ApiModelProperty(value = "维修记录信息")
private String record;
private Integer repairBackBillId;
} }
...@@ -18,6 +18,11 @@ import javax.validation.constraints.NotNull; ...@@ -18,6 +18,11 @@ import javax.validation.constraints.NotNull;
@ApiModel("维修装备详情类") @ApiModel("维修装备详情类")
public class DeviceDetailVo { public class DeviceDetailVo {
@NotNull(message = "id不能为空")
@Min(value = 1,message = "id不能小于1")
@ApiModelProperty(value = "维修详情ID", example = "1")
private Integer id;
@NotNull(message = "deviceId不能为空") @NotNull(message = "deviceId不能为空")
@Min(value = 1,message = "deviceId不能小于1") @Min(value = 1,message = "deviceId不能小于1")
@ApiModelProperty(value = "装备ID", example = "1") @ApiModelProperty(value = "装备ID", example = "1")
......
package com.tykj.dev.device.repair.subject.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
/**
* @author dengdiyi
*/
@Data
@ApiModel("单据上传类")
public class FileUploadVo {
@NotNull(message = "taskId不能为空")
@Min(value = 1,message = "taskId不能小于1")
@ApiModelProperty(value = "任务Id")
private Integer taskId;
@NotNull(message = "billFileName不能为空")
@ApiModelProperty(value = "配发单附件名字")
private String billFileName;
@NotNull(message = "billFileUrl不能为空")
@ApiModelProperty(value = "配发单附件URL")
private String billFileUrl;
}
...@@ -24,11 +24,11 @@ public class RepairReceiveVo { ...@@ -24,11 +24,11 @@ public class RepairReceiveVo {
@ApiModelProperty(value = "任务Id") @ApiModelProperty(value = "任务Id")
private Integer taskId; private Integer taskId;
@NotNull(message = "billFileName不能为空") // @NotNull(message = "billFileName不能为空")
@ApiModelProperty(value = "配发单附件名字") @ApiModelProperty(value = "配发单附件名字")
private String billFileName; private String billFileName;
@NotNull(message = "billFileUrl不能为空") // @NotNull(message = "billFileUrl不能为空")
@ApiModelProperty(value = "配发单附件URL") @ApiModelProperty(value = "配发单附件URL")
private String billFileUrl; private String billFileUrl;
...@@ -53,5 +53,7 @@ public class RepairReceiveVo { ...@@ -53,5 +53,7 @@ public class RepairReceiveVo {
@ApiModelProperty(value = "接收入库检查结果") @ApiModelProperty(value = "接收入库检查结果")
private String receiveCheckResult; private String receiveCheckResult;
@NotNull(message = "status不能为空")
@ApiModelProperty(value = "是否缺失单据(0:否,1:是)")
private Integer status = 0;
} }
...@@ -278,7 +278,8 @@ public class LogAspect { ...@@ -278,7 +278,8 @@ public class LogAspect {
AllotBill allotBill = allotBillService.getOne(outPutTask.getBillId()); AllotBill allotBill = allotBillService.getOne(outPutTask.getBillId());
getFieldsParam(allotBill); getFieldsParam(allotBill);
if ((this.oldStatus.equals(StatusEnum.ORIGIN_STATUS.id) && this.newStatus.equals(StatusEnum.ALLOTING.id)) if ((this.oldStatus.equals(StatusEnum.ORIGIN_STATUS.id) && this.newStatus.equals(StatusEnum.ALLOTING.id))
|| (this.oldStatus.equals(StatusEnum.WAIT_ALLOT.id) && this.newStatus.equals(StatusEnum.ALLOTING.id))) { || (this.oldStatus.equals(StatusEnum.WAIT_ALLOT.id) && this.newStatus.equals(StatusEnum.ALLOTING.id))
|| (this.oldStatus.equals(StatusEnum.ALLOT_DRAFT.id) && this.newStatus.equals(StatusEnum.ALLOTING.id))) {
this.fileVos.add(new FileVo("出库确认单", allotBill.getFileName(), allotBill.getFileUrl())); this.fileVos.add(new FileVo("出库确认单", allotBill.getFileName(), allotBill.getFileUrl()));
} }
if ((this.oldStatus.equals(StatusEnum.ALLOTING.id) && this.newStatus.equals(StatusEnum.END.id))) { if ((this.oldStatus.equals(StatusEnum.ALLOTING.id) && this.newStatus.equals(StatusEnum.END.id))) {
...@@ -315,13 +316,19 @@ public class LogAspect { ...@@ -315,13 +316,19 @@ public class LogAspect {
RepairSendBill repairSendBill = repairSendBillDao.findByDeviceRepairBillId(repairBill.getId()); RepairSendBill repairSendBill = repairSendBillDao.findByDeviceRepairBillId(repairBill.getId());
getFieldsParam(repairBillService.getOne(outPutTask.getBillId())); getFieldsParam(repairBillService.getOne(outPutTask.getBillId()));
if ((this.oldStatus.equals(StatusEnum.ORIGIN_STATUS.id) && this.newStatus.equals(StatusEnum.WAIT_RECEIVE.id)) if ((this.oldStatus.equals(StatusEnum.ORIGIN_STATUS.id) && this.newStatus.equals(StatusEnum.WAIT_RECEIVE.id))
||(this.oldStatus.equals(StatusEnum.ORIGIN_STATUS.id) && this.newStatus.equals(StatusEnum.COUNTRY_REPAIRING.id))) { ||(this.oldStatus.equals(StatusEnum.ORIGIN_STATUS.id) && this.newStatus.equals(StatusEnum.END.id))) {
this.fileVos.add(new FileVo("出库确认单", repairSendBill.getFileName(), repairSendBill.getFileUrl())); this.fileVos.add(new FileVo("出库确认单", repairSendBill.getFileName(), repairSendBill.getFileUrl()));
} }
if ((this.oldStatus.equals(StatusEnum.WAIT_RECEIVE.id) && this.newStatus.equals(StatusEnum.REPAIRING.id))) { if ((this.oldStatus.equals(StatusEnum.WAIT_RECEIVE.id) && this.newStatus.equals(StatusEnum.END.id))) {
this.fileVos.add(new FileVo("维修单", repairSendBill.getBillFileName(), repairSendBill.getBillFileUrl())); this.fileVos.add(new FileVo("维修单", repairSendBill.getBillFileName(), repairSendBill.getBillFileUrl()));
this.fileVos.add(new FileVo("入库确认单", repairSendBill.getReceiveFileName(), repairSendBill.getReceiveFileUrl())); this.fileVos.add(new FileVo("入库确认单", repairSendBill.getReceiveFileName(), repairSendBill.getReceiveFileUrl()));
} }
if ((this.oldStatus.equals(StatusEnum.WAIT_RECEIVE.id) && this.newStatus.equals(StatusEnum.WAIT_UPLOAD_FILE.id))) {
this.fileVos.add(new FileVo("入库确认单", repairSendBill.getReceiveFileName(), repairSendBill.getReceiveFileUrl()));
}
if ((this.oldStatus.equals(StatusEnum.WAIT_UPLOAD_FILE.id) && this.newStatus.equals(StatusEnum.END.id))) {
this.fileVos.add(new FileVo("维修单", repairSendBill.getBillFileName(), repairSendBill.getBillFileUrl()));
}
} }
break; break;
case 6: case 6:
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论