提交 0be48775 authored 作者: zhoushaopan's avatar zhoushaopan

feat(申请模块,维修模块): 修改申请阅知,修改了市送给省装备,省修好给市,显示装备为在库(此时该装备所属在区)

修改申请阅知,修改了市送给省装备,省修好给市,显示装备为在库(此时该装备所属在区)
上级 30706ebc
...@@ -237,61 +237,65 @@ public class DeviceApplyController { ...@@ -237,61 +237,65 @@ public class DeviceApplyController {
return ResponseEntity.ok("ok"); return ResponseEntity.ok("ok");
} }
@ApiOperation(value = "装备申请批复", notes = "可以通过这个接口批复") // @ApiOperation(value = "装备申请批复", notes = "可以通过这个接口批复")
@PostMapping("/replay")//不用了 // @PostMapping("/replay")//不用了
@Transactional(rollbackFor = Exception.class) // @Transactional(rollbackFor = Exception.class)
public ResponseEntity addDeviceApplyBillReplay(@RequestBody @Validated DeviceApplyConfirmVo deviceApplyConfirmVo) { // public ResponseEntity addDeviceApplyBillReplay(@RequestBody @Validated DeviceApplyConfirmVo deviceApplyConfirmVo) {
TaskBto taskBto = taskService.get(deviceApplyConfirmVo.getTaskId()); // TaskBto taskBto = taskService.get(deviceApplyConfirmVo.getTaskId());
TaskDisposeUtil.isNotSubmit(taskBto.getBillStatus(),StatusEnum.DEVICE_APPLY_CONFIRM); // TaskDisposeUtil.isNotSubmit(taskBto.getBillStatus(),StatusEnum.DEVICE_APPLY_CONFIRM);
Integer userId = userUtils.getCurrentUserId(); // Integer userId = userUtils.getCurrentUserId();
taskService.addInvolveUser(taskBto, userId); // taskService.addInvolveUser(taskBto, userId);
DeviceApplyBill applyBillEntity = deviceApplyBillService.getOne(taskBto.getBillId()); // DeviceApplyBill applyBillEntity = deviceApplyBillService.getOne(taskBto.getBillId());
applyBillEntity.setReplyUseraId(userId); // applyBillEntity.setReplyUseraId(userId);
//阅知用户Id // //阅知用户Id
List<Integer> ids = userPublicService.findOtherUser(userId); // List<Integer> ids = userPublicService.findOtherUser(userId);
// ids.addAll(userDao.findAllByUnitsId(userPublicService.findUnitIdByName(applyBillEntity.getApplyUnit())).stream() //// ids.addAll(userDao.findAllByUnitsId(userPublicService.findUnitIdByName(applyBillEntity.getApplyUnit())).stream()
//// .map(User::getUserId)
//// .collect(Collectors.toList()));
// ids.addAll(userDao.findAllByUnitsId(applyBillEntity.getApplyUnitId()).stream()
// .map(User::getUserId) // .map(User::getUserId)
// .collect(Collectors.toList())); // .collect(Collectors.toList()));
ids.addAll(userDao.findAllByUnitsId(applyBillEntity.getApplyUnitId()).stream() // //如果修改了批复文号
.map(User::getUserId) // if (deviceApplyConfirmVo.getReplyNumber() != null) {
.collect(Collectors.toList())); // applyBillEntity.setReplayNumber(deviceApplyConfirmVo.getReplyNumber());
//如果修改了批复文号 // }
if (deviceApplyConfirmVo.getReplyNumber() != null) { // //批复驳回
applyBillEntity.setReplayNumber(deviceApplyConfirmVo.getReplyNumber()); // if (deviceApplyConfirmVo.getStatus() == 1) {
} // applyBillEntity.setApplyStatus(1);
//批复驳回 // taskService.update(taskService.moveToArchive(taskBto));
if (deviceApplyConfirmVo.getStatus() == 1) { // deviceApplyBillService.update(applyBillEntity);
applyBillEntity.setApplyStatus(1); // //发送阅知信息 装备申请被拒绝
taskService.update(taskService.moveToArchive(taskBto)); //// MessageBto messageBto = new MessageBto(taskBto.getId(),taskBto.getBusinessType(),
deviceApplyBillService.update(applyBillEntity); //// "不同意 申请业务:【"+userPublicService.getAreaNameByUnitName(applyBillEntity.getApplyUnit()) + "->【中办机要局】",ids);
//发送阅知信息 //
MessageBto messageBto = new MessageBto(taskBto.getId(),taskBto.getBusinessType(), // MessageBto messageBto = new MessageBto(taskBto.getId(),taskBto.getBusinessType(),
"不同意 申请业务:【"+userPublicService.getAreaNameByUnitName(applyBillEntity.getApplyUnit()) + "->【中办机要局】",ids); // "装备申请被拒绝:【"+userPublicService.getAreaNameByUnitName(applyBillEntity.getApplyUnit()) +
messageService.add(messageBto); // "->【中办机要局】申请"+MessageFormatUtil.spellModelAndCount(),ids);
log.info("[申请模块]:装备申请驳回"); // messageService.add(messageBto);
myWebSocket.sendMessage1(); // log.info("[申请模块]:装备申请驳回");
return ResponseEntity.ok(taskBto); // myWebSocket.sendMessage1();
} // return ResponseEntity.ok(taskBto);
//批复成功 // }
if (deviceApplyConfirmVo.getStatus() == 0) { // //批复成功
applyBillEntity.setApplyStatus(2); // if (deviceApplyConfirmVo.getStatus() == 0) {
taskService.update(taskService.moveToEnd(taskBto)); // applyBillEntity.setApplyStatus(2);
//发送阅知信息 // taskService.update(taskService.moveToEnd(taskBto));
MessageBto messageBto = new MessageBto(taskBto.getId(),taskBto.getBusinessType(),"同意" + userPublicService.getAreaNameByUnitName(applyBillEntity.getApplyUnit()) + "的装备申请",ids); // //发送阅知信息
messageService.add(messageBto); // MessageBto messageBto = new MessageBto(taskBto.getId(),taskBto.getBusinessType(),"同意" + userPublicService.getAreaNameByUnitName(applyBillEntity.getApplyUnit()) + "的装备申请",ids);
log.info("[申请模块]:装备申请批复成功,发起配发子业务"); // messageService.add(messageBto);
//生成配发子任务 // log.info("[申请模块]:装备申请批复成功,发起配发子业务");
List<Integer> userIds = new ArrayList<>(); // //生成配发子任务
userIds.add(0); // List<Integer> userIds = new ArrayList<>();
TaskBto taskBto1 = new TaskBto(StatusEnum.WAIT_ALLOT.id, "配发业务", taskBto.getId(), "." + taskBto.getId() + ".", 0, 3, userUtils.getCurrentUnitId(), 0, null, userIds); // userIds.add(0);
TaskBto task = taskService.start(taskBto1); // TaskBto taskBto1 = new TaskBto(StatusEnum.WAIT_ALLOT.id, "配发业务", taskBto.getId(), "." + taskBto.getId() + ".", 0, 3, userUtils.getCurrentUnitId(), 0, null, userIds);
deviceApplyBillService.update(applyBillEntity); // TaskBto task = taskService.start(taskBto1);
myWebSocket.sendMessage1(); // deviceApplyBillService.update(applyBillEntity);
return ResponseEntity.ok(task); // myWebSocket.sendMessage1();
} else { // return ResponseEntity.ok(task);
throw new ApiException(ResultUtil.failed("status只能为0或1")); // } else {
} // throw new ApiException(ResultUtil.failed("status只能为0或1"));
} // }
// }
@ApiOperation(value = "装备申请后发起配发", notes = "可以通过这个接口装备申请后发起配发") @ApiOperation(value = "装备申请后发起配发", notes = "可以通过这个接口装备申请后发起配发")
@PostMapping("/allot")//不用了 @PostMapping("/allot")//不用了
...@@ -474,7 +478,9 @@ public class DeviceApplyController { ...@@ -474,7 +478,9 @@ public class DeviceApplyController {
taskService.moveToEnd(taskBto); taskService.moveToEnd(taskBto);
List<Integer> userIds = userPublicService.findOtherUser(userUtils.getCurrentUserId()); List<Integer> userIds = userPublicService.findOtherUser(userUtils.getCurrentUserId());
DeviceApplyBill deviceApplyBill = deviceApplyBillService.getOne(taskBto.getBillId()); DeviceApplyBill deviceApplyBill = deviceApplyBillService.getOne(taskBto.getBillId());
MessageBto messageBto = new MessageBto(taskBto.getId(),taskBto.getBusinessType(),"申请不同意,申请业务办结",userIds,0);
MessageBto messageBto = new MessageBto(taskBto.getId(),taskBto.getBusinessType(),"装备申请被拒绝:"
+MessageFormatUtil.spellModelAndCount(uploadApplyFile.getModels(),uploadApplyFile.getTotalNum()),userIds,0);
messageService.add(messageBto); messageService.add(messageBto);
deviceApplyBill.setApplyStatus(1); deviceApplyBill.setApplyStatus(1);
deviceApplyBill.setBackFiles(FilesUtil.stringFileToList(uploadApplyFile.getBackFiles())); deviceApplyBill.setBackFiles(FilesUtil.stringFileToList(uploadApplyFile.getBackFiles()));
......
...@@ -53,4 +53,10 @@ public class UploadApplyFile { ...@@ -53,4 +53,10 @@ public class UploadApplyFile {
@ApiModelProperty(value = "经办人") @ApiModelProperty(value = "经办人")
private String agent; private String agent;
@ApiModelProperty(value = "型号的集合")
private List<String> models;
@ApiModelProperty(value = "总数量")
private Integer totalNum;
} }
...@@ -149,26 +149,37 @@ public class RepairController { ...@@ -149,26 +149,37 @@ public class RepairController {
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public ResponseEntity judge(@RequestBody List<Integer> ids) { public ResponseEntity judge(@RequestBody List<Integer> ids) {
//存放所有维修记录的发件单位 //存放所有维修记录的发件单位
Set<String> sendUnits = new HashSet<>(); // Set<String> sendUnits = new HashSet<>();
List<Integer> sendUnits = new ArrayList<>();
ids.forEach(integer -> { ids.forEach(integer -> {
RepairDetail repairDetail = deviceRepairDetailService.getOne(integer); RepairDetail repairDetail = deviceRepairDetailService.getOne(integer);
RepairBill repairBill = deviceRepairBillService.getOne(repairDetail.getDeviceRepairBillId()); RepairBill repairBill = deviceRepairBillService.getOne(repairDetail.getDeviceRepairBillId());
sendUnits.add(repairBill.getSendUnit()); // sendUnits.add(repairBill.getSendUnit());
sendUnits.add(repairBill.getSendUnitId().toString()); sendUnits.add(repairBill.getSendUnitId());
}); });
//去重
List<Integer> collect = sendUnits.stream().distinct().collect(Collectors.toList());
//如果是同一单位返回单位名称,否则返error //如果是同一单位返回单位名称,否则返error
// if (sendUnits.size() == 1) { if (collect.size() == 1) {
Units units = unitsService.findById(collect.get(0));
// return ResponseEntity.ok(sendUnits.iterator().next()); // return ResponseEntity.ok(sendUnits.iterator().next());
// } else { return ResponseEntity.ok(units);
// return ResponseEntity.ok("error");
// }
List<String> list = sendUnits.stream().sorted().collect(Collectors.toList());
if (sendUnits.size() == 2) {
return ResponseEntity.ok(list);
} else { } else {
return ResponseEntity.ok("error"); return ResponseEntity.ok("error");
} }
// if (sendUnits.size() == 1) {
//// return ResponseEntity.ok(sendUnits.iterator().next());
// return ResponseEntity.ok(collect);
// } else {
// return ResponseEntity.ok("error");
// }
// List<String> list = sendUnits.stream().sorted().collect(Collectors.toList());
//
// if (sendUnits.size() == 2) {
// return ResponseEntity.ok(list);
// } else {
// return ResponseEntity.ok("error");
// }
} }
@ApiOperation(value = "保存维修操作", notes = "可以通过这个接口保存维修操作") @ApiOperation(value = "保存维修操作", notes = "可以通过这个接口保存维修操作")
...@@ -1324,6 +1335,8 @@ public class RepairController { ...@@ -1324,6 +1335,8 @@ public class RepairController {
//如果所属和所在一致,状态改为在库 //如果所属和所在一致,状态改为在库
if (deviceLibraryEntity.getOwnUnit().equals(deviceLibraryEntity.getLocationUnit())) { if (deviceLibraryEntity.getOwnUnit().equals(deviceLibraryEntity.getLocationUnit())) {
deviceLibraryEntity.setLifeStatus(2); deviceLibraryEntity.setLifeStatus(2);
}else {
deviceLibraryEntity.setLifeStatus(4);
} }
deviceLibraryEntity.setManageStatus(1); deviceLibraryEntity.setManageStatus(1);
deviceLibraries.add(deviceLibraryEntity); deviceLibraries.add(deviceLibraryEntity);
...@@ -2297,7 +2310,13 @@ public class RepairController { ...@@ -2297,7 +2310,13 @@ public class RepairController {
deviceLogService.addLog(deviceLogDto); deviceLogService.addLog(deviceLogDto);
DeviceLibrary deviceLibraryEntity = deviceLibraryService.getOne(integer); DeviceLibrary deviceLibraryEntity = deviceLibraryService.getOne(integer);
deviceLibraryEntity.setLocationUnit(repairBackBill.getReceiveUnit()); deviceLibraryEntity.setLocationUnit(repairBackBill.getReceiveUnit());
deviceLibraryEntity.setLifeStatus(2); if (deviceLibraryEntity.getOwnUnit().equals(repairBackBill.getReceiveUnit())){
//在库
deviceLibraryEntity.setLifeStatus(2);
}else {
//维修中
deviceLibraryEntity.setLifeStatus(4);
}
deviceLibraryEntity.setManageStatus(1); deviceLibraryEntity.setManageStatus(1);
deviceLibraryService.update(deviceLibraryEntity); deviceLibraryService.update(deviceLibraryEntity);
}); });
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论