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

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

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