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

提交维修更改

上级 88bba9df
...@@ -13,8 +13,12 @@ import com.tykj.dev.device.library.service.DeviceLogService; ...@@ -13,8 +13,12 @@ import com.tykj.dev.device.library.service.DeviceLogService;
import com.tykj.dev.device.library.subject.Dto.DeviceLogDto; 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.domin.DeviceLibrary;
import com.tykj.dev.device.library.subject.vo.FileVo; import com.tykj.dev.device.library.subject.vo.FileVo;
import com.tykj.dev.device.read.service.MessageService;
import com.tykj.dev.device.read.subject.bto.MessageBto;
import com.tykj.dev.device.task.service.TaskService; import com.tykj.dev.device.task.service.TaskService;
import com.tykj.dev.device.task.subject.bto.TaskBto; import com.tykj.dev.device.task.subject.bto.TaskBto;
import com.tykj.dev.device.user.subject.dao.UserDao;
import com.tykj.dev.device.user.subject.entity.User;
import com.tykj.dev.device.user.subject.service.UserPublicService; import com.tykj.dev.device.user.subject.service.UserPublicService;
import com.tykj.dev.device.user.util.UserUtils; import com.tykj.dev.device.user.util.UserUtils;
import com.tykj.dev.misc.base.ResultObj; import com.tykj.dev.misc.base.ResultObj;
...@@ -38,6 +42,7 @@ import org.springframework.web.bind.annotation.RestController; ...@@ -38,6 +42,7 @@ import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Calendar; import java.util.Calendar;
import java.util.List; import java.util.List;
import java.util.stream.Collectors;
/** /**
* @author dengdiyi * @author dengdiyi
...@@ -79,6 +84,12 @@ public class AllotBackBillController { ...@@ -79,6 +84,12 @@ public class AllotBackBillController {
@Autowired @Autowired
private InputOutputDeviceService inputOutputDeviceService; private InputOutputDeviceService inputOutputDeviceService;
@Autowired
private UserDao userDao;
@Autowired
private MessageService messageService;
@ApiOperation(value = "发起配发退回业务", notes = "可以通过这个接口发起配发退回任务") @ApiOperation(value = "发起配发退回业务", notes = "可以通过这个接口发起配发退回任务")
@PostMapping(value = "/back") @PostMapping(value = "/back")
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
...@@ -155,12 +166,15 @@ public class AllotBackBillController { ...@@ -155,12 +166,15 @@ public class AllotBackBillController {
public ResponseEntity allotBackReceive(@RequestBody @Validated AllotBackReceiveVo allotBackReceiveVo) { public ResponseEntity allotBackReceive(@RequestBody @Validated AllotBackReceiveVo allotBackReceiveVo) {
//获取当前任务和账单 //获取当前任务和账单
TaskBto taskBto = taskService.get(allotBackReceiveVo.getTaskId()); TaskBto taskBto = taskService.get(allotBackReceiveVo.getTaskId());
taskService.addInvolveUser(taskBto, userUtils.getCurrentUserId());
AllotBackBill allotBackBill = allotBackBillService.getOne(taskBto.getBillId()); AllotBackBill allotBackBill = allotBackBillService.getOne(taskBto.getBillId());
//更改账单状态 //更改账单状态
allotBackBill.setBackStatus(1); allotBackBill.setBackStatus(3);
allotBackBill.setReceiveUseraId(userUtils.getCurrentUserId());
BeanUtils.copyProperties(allotBackReceiveVo, allotBackBill); BeanUtils.copyProperties(allotBackReceiveVo, allotBackBill);
//任务推至下一阶段 //任务推至完结
taskService.moveToNext(taskBto, allotBackReceiveVo.getReceiveUserbId()); taskService.moveToEnd(taskBto);
// taskService.moveToNext(taskBto, allotBackReceiveVo.getReceiveUserbId());
//分隔装备id信息 //分隔装备id信息
List<FileVo> fileVoList = new ArrayList<>(); List<FileVo> fileVoList = new ArrayList<>();
fileVoList.add(new FileVo("退回单", allotBackReceiveVo.getBillFileName(), allotBackReceiveVo.getBillFileUrl())); fileVoList.add(new FileVo("退回单", allotBackReceiveVo.getBillFileName(), allotBackReceiveVo.getBillFileUrl()));
...@@ -175,10 +189,12 @@ public class AllotBackBillController { ...@@ -175,10 +189,12 @@ public class AllotBackBillController {
Integer id = Integer.parseInt(s.substring(0, s.length() - 1)); Integer id = Integer.parseInt(s.substring(0, s.length() - 1));
//改变装备状态 //改变装备状态
DeviceLibrary deviceLibraryEntity = deviceLibraryService.getOne(id); DeviceLibrary deviceLibraryEntity = deviceLibraryService.getOne(id);
deviceLibraryEntity.setLifeStatus(0); deviceLibraryEntity.setLifeStatus(2);
deviceLibraryEntity.setOwnUnit(userUtils.getCurrentUserUnitName());
deviceLibraryEntity.setManageStatus(1);
deviceLibraryEntity.setLocationUnit(userUtils.getCurrentUserUnitName()); deviceLibraryEntity.setLocationUnit(userUtils.getCurrentUserUnitName());
//存装备日志 //存装备日志
DeviceLogDto deviceLogDto = new DeviceLogDto(id, "接收并发起入库", fileVoList); DeviceLogDto deviceLogDto = new DeviceLogDto(id, "接收配发退回装备", fileVoList);
deviceLogService.addLog(deviceLogDto); deviceLogService.addLog(deviceLogDto);
deviceLibraryService.update(deviceLibraryEntity); deviceLibraryService.update(deviceLibraryEntity);
} }
...@@ -189,13 +205,20 @@ public class AllotBackBillController { ...@@ -189,13 +205,20 @@ public class AllotBackBillController {
DeviceLibrary deviceLibraryEntity = deviceLibraryService.getOne(id); DeviceLibrary deviceLibraryEntity = deviceLibraryService.getOne(id);
deviceLibraryEntity.setLifeStatus(11); deviceLibraryEntity.setLifeStatus(11);
//存装备日志 //存装备日志
DeviceLogDto deviceLogDto = new DeviceLogDto(id, "接收入库丢失", fileVoList); DeviceLogDto deviceLogDto = new DeviceLogDto(id, "接收配发退回装备丢失", fileVoList);
deviceLogService.addLog(deviceLogDto); deviceLogService.addLog(deviceLogDto);
deviceLibraryService.update(deviceLibraryEntity); deviceLibraryService.update(deviceLibraryEntity);
} }
} }
} }
} }
//发送阅知信息
List<Integer> ids = userPublicService.findOtherUser(userUtils.getCurrentUserId());
ids.addAll(userDao.findAllByUnitsId(userPublicService.findUnitIdByName(allotBackBill.getSendUnit())).stream()
.map(User::getUserId)
.collect(Collectors.toList()));
MessageBto messageBto = new MessageBto(taskBto.getId(),taskBto.getBusinessType(),userUtils.getCurrentUserUnitName()+"接收配发退回装备",ids);
messageService.add(messageBto);
log.info("[配发模块]:配发退回接收入库"); log.info("[配发模块]:配发退回接收入库");
myWebSocket.sendMessage1(); myWebSocket.sendMessage1();
return ResponseEntity.ok("配发退回接收入库"); return ResponseEntity.ok("配发退回接收入库");
......
package com.tykj.dev.device.allot.controller; package com.tykj.dev.device.allot.controller;
import com.tykj.dev.config.swagger.AutoDocument; import com.tykj.dev.config.swagger.AutoDocument;
import com.tykj.dev.device.allot.service.AllotBackBillService;
import com.tykj.dev.device.allot.service.AllotBillService; import com.tykj.dev.device.allot.service.AllotBillService;
import com.tykj.dev.device.allot.subject.domin.AllotBackBill;
import com.tykj.dev.device.allot.subject.domin.AllotBill; import com.tykj.dev.device.allot.subject.domin.AllotBill;
import com.tykj.dev.device.allot.subject.vo.AllotBillConfirmVo; import com.tykj.dev.device.allot.subject.vo.AllotBillConfirmVo;
import com.tykj.dev.device.allot.subject.vo.AllotBillSaveVo; import com.tykj.dev.device.allot.subject.vo.AllotBillSaveVo;
...@@ -12,9 +14,13 @@ import com.tykj.dev.device.library.service.DeviceLogService; ...@@ -12,9 +14,13 @@ import com.tykj.dev.device.library.service.DeviceLogService;
import com.tykj.dev.device.library.subject.Dto.DeviceLogDto; 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.domin.DeviceLibrary;
import com.tykj.dev.device.library.subject.vo.FileVo; import com.tykj.dev.device.library.subject.vo.FileVo;
import com.tykj.dev.device.read.service.MessageService;
import com.tykj.dev.device.read.subject.bto.MessageBto;
import com.tykj.dev.device.task.service.TaskLogService; import com.tykj.dev.device.task.service.TaskLogService;
import com.tykj.dev.device.task.service.TaskService; import com.tykj.dev.device.task.service.TaskService;
import com.tykj.dev.device.task.subject.bto.TaskBto; import com.tykj.dev.device.task.subject.bto.TaskBto;
import com.tykj.dev.device.user.subject.dao.UserDao;
import com.tykj.dev.device.user.subject.entity.User;
import com.tykj.dev.device.user.subject.service.UserPublicService; import com.tykj.dev.device.user.subject.service.UserPublicService;
import com.tykj.dev.device.user.util.UserUtils; import com.tykj.dev.device.user.util.UserUtils;
import com.tykj.dev.misc.base.BusinessEnum; import com.tykj.dev.misc.base.BusinessEnum;
...@@ -40,6 +46,7 @@ import org.springframework.web.bind.annotation.RestController; ...@@ -40,6 +46,7 @@ import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Calendar; import java.util.Calendar;
import java.util.List; import java.util.List;
import java.util.stream.Collectors;
/** /**
* @author dengdiyi * @author dengdiyi
...@@ -81,6 +88,15 @@ public class AllotBillController { ...@@ -81,6 +88,15 @@ public class AllotBillController {
@Autowired @Autowired
private InputOutputDeviceService inputOutputDeviceService; private InputOutputDeviceService inputOutputDeviceService;
@Autowired
private MessageService messageService;
@Autowired
private UserDao userDao;
@Autowired
private AllotBackBillService allotBackBillService;
@ApiOperation(value = "发起配发业务", notes = "可以通过这个接口发起配发任务") @ApiOperation(value = "发起配发业务", notes = "可以通过这个接口发起配发任务")
@PostMapping(value = "/addAllotBill") @PostMapping(value = "/addAllotBill")
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
...@@ -106,23 +122,38 @@ public class AllotBillController { ...@@ -106,23 +122,38 @@ public class AllotBillController {
//2.发起任务 //2.发起任务
List<Integer> userIds = new ArrayList<>(); List<Integer> userIds = new ArrayList<>();
userIds.add(userId); userIds.add(userId);
userIds.add(allotBillSaveVo.getSendUserbId()); userIds.add(0);
TaskBto taskBto = new TaskBto(StatusEnum.ALLOT_SEND_CONFIRM.id, "配发业务", null, ".", billId, 3, userUtils.getCurrentUnitId(), 1, null, userIds); TaskBto taskBto = new TaskBto(StatusEnum.ALLOTING.id, "配发业务", null, ".", billId, 3, userPublicService.findUnitIdByName(allotBillSaveVo.getReceiveUnit()), 1, null, userIds);
TaskBto saveEntity = taskService.start(taskBto); TaskBto saveEntity = taskService.start(taskBto);
List<FileVo> fileVoList = new ArrayList<>(); List<FileVo> fileVoList = new ArrayList<>();
fileVoList.add(new FileVo("出库确认单", allotBillEntity.getFileName(), allotBillEntity.getFileUrl())); fileVoList.add(new FileVo("出库确认单", allotBillEntity.getFileName(), allotBillEntity.getFileUrl()));
//存装备日志 //存装备日志
String[] strings = deviceIdDetail.split("x"); String[] strings = deviceIdDetail.split("x");
List<Integer> ids = new ArrayList<>();
for (String s : strings) { for (String s : strings) {
if (s.length() >= 2) { if (s.length() >= 2) {
Integer id = Integer.parseInt(s.substring(0, s.length() - 1)); Integer id = Integer.parseInt(s.substring(0, s.length() - 1));
ids.add(id);
//改变装备状态
DeviceLibrary deviceLibraryEntity = deviceLibraryService.getOne(id);
deviceLibraryEntity.setLifeStatus(3);
deviceLibraryEntity.setManageStatus(0);
DeviceLogDto deviceLogDto = new DeviceLogDto(id, "对" + allotBillEntity.getReceiveUnit() + "发起配发", fileVoList); DeviceLogDto deviceLogDto = new DeviceLogDto(id, "对" + allotBillEntity.getReceiveUnit() + "发起配发", fileVoList);
deviceLogService.addLog(deviceLogDto); deviceLogService.addLog(deviceLogDto);
} }
} }
//添加出库白名单
inputOutputDeviceService.addWhiteDevices(ids, userUtils.getCurrentUnitId(), 1);
//发送阅知信息
List<Integer> idList = userPublicService.findOtherUser(userId);
idList.addAll(userDao.findAllByUnitsId(userPublicService.findUnitIdByName(allotBillEntity.getReceiveUnit())).stream()
.map(User::getUserId)
.collect(Collectors.toList()));
MessageBto messageBto = new MessageBto(saveEntity.getId(),saveEntity.getBusinessType(),allotBillEntity.getSendUnit() + "对" + allotBillEntity.getReceiveUnit() + "发起配发",idList);
messageService.add(messageBto);
log.info("[配发模块]:" + allotBillEntity.getSendUnit() + "对" + allotBillEntity.getReceiveUnit() + "发起配发"); log.info("[配发模块]:" + allotBillEntity.getSendUnit() + "对" + allotBillEntity.getReceiveUnit() + "发起配发");
myWebSocket.sendMessage1(); myWebSocket.sendMessage1();
return ResponseEntity.ok(new ResultObj(allotBillEntity, "发起成功")); return ResponseEntity.ok(new ResultObj(saveEntity, "发起成功"));
} }
@ApiOperation(value = "配发审核", notes = "可以通过这个接口对配发审核") @ApiOperation(value = "配发审核", notes = "可以通过这个接口对配发审核")
...@@ -195,6 +226,7 @@ public class AllotBillController { ...@@ -195,6 +226,7 @@ public class AllotBillController {
@PostMapping(value = "/receiveDevice") @PostMapping(value = "/receiveDevice")
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public ResponseEntity receiveDevice(@RequestBody @Validated AllotReceiveVo allotReceiveVo) { public ResponseEntity receiveDevice(@RequestBody @Validated AllotReceiveVo allotReceiveVo) {
Integer userId = userUtils.getCurrentUserId();
//获取当前任务 //获取当前任务
TaskBto taskBto = taskService.get(allotReceiveVo.getTaskId()); TaskBto taskBto = taskService.get(allotReceiveVo.getTaskId());
AllotBill allotBillEntity = allotBillService.getOne(taskBto.getBillId()); AllotBill allotBillEntity = allotBillService.getOne(taskBto.getBillId());
...@@ -202,12 +234,15 @@ public class AllotBillController { ...@@ -202,12 +234,15 @@ public class AllotBillController {
fileVoList.add(new FileVo("配发单", allotReceiveVo.getBillFileName(), allotReceiveVo.getBillFileUrl())); fileVoList.add(new FileVo("配发单", allotReceiveVo.getBillFileName(), allotReceiveVo.getBillFileUrl()));
fileVoList.add(new FileVo("入库确认单", allotReceiveVo.getReceiveFileName(), allotReceiveVo.getReceiveFileUrl())); fileVoList.add(new FileVo("入库确认单", allotReceiveVo.getReceiveFileName(), allotReceiveVo.getReceiveFileUrl()));
//更新账单状态 //更新账单状态
allotBillEntity.setAllotStatus(3); allotBillEntity.setAllotStatus(5);
BeanUtils.copyProperties(allotReceiveVo, allotBillEntity); BeanUtils.copyProperties(allotReceiveVo, allotBillEntity);
allotBillEntity.setReceiveTime(TimestampUtil.getCurrentTimestamp()); allotBillEntity.setReceiveTime(TimestampUtil.getCurrentTimestamp());
allotBillEntity.setReceiveUseraId(userId);
allotBillService.update(allotBillEntity); allotBillService.update(allotBillEntity);
//推至下一阶段 taskService.addInvolveUser(taskBto, userId);
taskService.update(taskService.moveToNext(taskBto, allotReceiveVo.getReceiveUserbId())); // //推至下一阶段
// taskService.update(taskService.moveToNext(taskBto, allotReceiveVo.getReceiveUserbId()));
taskService.moveToEnd(taskBto);
//分隔装备id信息 //分隔装备id信息
String deviceIdDetail = allotReceiveVo.getReceiveCheckDetail(); String deviceIdDetail = allotReceiveVo.getReceiveCheckDetail();
String[] strings = deviceIdDetail.split("x"); String[] strings = deviceIdDetail.split("x");
...@@ -218,8 +253,11 @@ public class AllotBillController { ...@@ -218,8 +253,11 @@ public class AllotBillController {
Integer id = Integer.parseInt(s.substring(0, s.length() - 1)); Integer id = Integer.parseInt(s.substring(0, s.length() - 1));
//改变装备状态 //改变装备状态
DeviceLibrary deviceLibraryEntity = deviceLibraryService.getOne(id); DeviceLibrary deviceLibraryEntity = deviceLibraryService.getOne(id);
deviceLibraryEntity.setLifeStatus(0); // deviceLibraryEntity.setLifeStatus(0);
deviceLibraryEntity.setLocationUnit(userUtils.getCurrentUserUnitName()); deviceLibraryEntity.setLocationUnit(userUtils.getCurrentUserUnitName());
deviceLibraryEntity.setLifeStatus(2);
deviceLibraryEntity.setOwnUnit(userUtils.getCurrentUserUnitName());
deviceLibraryEntity.setManageStatus(1);
//存装备日志 //存装备日志
DeviceLogDto deviceLogDto = new DeviceLogDto(id, "接收并发起入库", fileVoList); DeviceLogDto deviceLogDto = new DeviceLogDto(id, "接收并发起入库", fileVoList);
deviceLogService.addLog(deviceLogDto); deviceLogService.addLog(deviceLogDto);
...@@ -238,6 +276,13 @@ public class AllotBillController { ...@@ -238,6 +276,13 @@ public class AllotBillController {
} }
} }
} }
//发送阅知信息
List<Integer> ids = userPublicService.findOtherUser(userId);
ids.addAll(userDao.findAllByUnitsId(userPublicService.findUnitIdByName(allotBillEntity.getSendUnit())).stream()
.map(User::getUserId)
.collect(Collectors.toList()));
MessageBto messageBto = new MessageBto(taskBto.getId(),taskBto.getBusinessType(),"接收配发装备",ids);
messageService.add(messageBto);
log.info("[配发模块]:接收并发起入库"); log.info("[配发模块]:接收并发起入库");
myWebSocket.sendMessage1(); myWebSocket.sendMessage1();
return ResponseEntity.ok("配发接收入库"); return ResponseEntity.ok("配发接收入库");
...@@ -250,34 +295,35 @@ public class AllotBillController { ...@@ -250,34 +295,35 @@ public class AllotBillController {
//获取任务和账单 //获取任务和账单
TaskBto taskBto = taskService.get(allotReceiveConfirmVo.getTaskId()); TaskBto taskBto = taskService.get(allotReceiveConfirmVo.getTaskId());
AllotBill allotBillEntity = allotBillService.getOne(taskBto.getBillId()); AllotBill allotBillEntity = allotBillService.getOne(taskBto.getBillId());
String deviceIdDetail = allotBillEntity.getReceiveCheckDetail(); String deviceIdDetail = allotBillEntity.getAllotCheckDetail();
String[] strings = deviceIdDetail.split("x"); String[] strings = deviceIdDetail.split("x");
//审核通过 //审核通过
if (allotReceiveConfirmVo.getStatus() == 0) { // if (allotReceiveConfirmVo.getStatus() == 0) {
//业务完结 // //业务完结
taskService.update(taskService.moveToEnd(taskBto)); // taskService.update(taskService.moveToEnd(taskBto));
//更新账单 // //更新账单
allotBillEntity.setAllotStatus(5); // allotBillEntity.setAllotStatus(5);
allotBillService.update(allotBillEntity); // allotBillService.update(allotBillEntity);
for (String s : strings) { // for (String s : strings) {
//改变接收无误的装备的状态 // //改变接收无误的装备的状态
if (s.length() >= 2 && "1".equals(s.substring(s.length() - 1))) { // if (s.length() >= 2 && "1".equals(s.substring(s.length() - 1))) {
Integer id = Integer.parseInt(s.substring(0, s.length() - 1)); // Integer id = Integer.parseInt(s.substring(0, s.length() - 1));
DeviceLibrary deviceLibraryEntity = deviceLibraryService.getOne(id); // DeviceLibrary deviceLibraryEntity = deviceLibraryService.getOne(id);
deviceLibraryEntity.setLifeStatus(2); // deviceLibraryEntity.setLifeStatus(2);
deviceLibraryEntity.setOwnUnit(userUtils.getCurrentUserUnitName()); // deviceLibraryEntity.setOwnUnit(userUtils.getCurrentUserUnitName());
deviceLibraryEntity.setManageStatus(1); // deviceLibraryEntity.setManageStatus(1);
DeviceLogDto deviceLogDto = new DeviceLogDto(id, "审核成功并入库", null); // DeviceLogDto deviceLogDto = new DeviceLogDto(id, "审核成功并入库", null);
deviceLogService.addLog(deviceLogDto); // deviceLogService.addLog(deviceLogDto);
deviceLibraryService.update(deviceLibraryEntity); // deviceLibraryService.update(deviceLibraryEntity);
} // }
} // }
log.info("[配发模块]:审核成功并入库"); // log.info("[配发模块]:审核成功并入库");
myWebSocket.sendMessage1(); // myWebSocket.sendMessage1();
return ResponseEntity.ok("审核成功"); // return ResponseEntity.ok("审核成功");
} // }
//审核失败 //拒绝接收
if (allotReceiveConfirmVo.getStatus() == 1) { if (allotReceiveConfirmVo.getStatus() == 1) {
taskService.addInvolveUser(taskBto, userUtils.getCurrentUserId());
//业务封存 //业务封存
taskService.update(taskService.moveToArchive(taskBto)); taskService.update(taskService.moveToArchive(taskBto));
//更新账单状态 //更新账单状态
...@@ -289,16 +335,39 @@ public class AllotBillController { ...@@ -289,16 +335,39 @@ public class AllotBillController {
if (s.length() >= 2 && "1".equals(s.substring(s.length() - 1))) { if (s.length() >= 2 && "1".equals(s.substring(s.length() - 1))) {
Integer id = Integer.parseInt(s.substring(0, s.length() - 1)); Integer id = Integer.parseInt(s.substring(0, s.length() - 1));
DeviceLibrary deviceLibraryEntity = deviceLibraryService.getOne(id); DeviceLibrary deviceLibraryEntity = deviceLibraryService.getOne(id);
deviceLibraryEntity.setLifeStatus(1); deviceLibraryEntity.setLifeStatus(3);
DeviceLogDto deviceLogDto = new DeviceLogDto(id, "配发入库审核失败", null); deviceLibraryEntity.setLocationUnit(userUtils.getCurrentUserUnitName());
DeviceLogDto deviceLogDto = new DeviceLogDto(id, "拒绝接收配发装备", null);
deviceLogService.addLog(deviceLogDto); deviceLogService.addLog(deviceLogDto);
deviceLibraryService.update(deviceLibraryEntity); deviceLibraryService.update(deviceLibraryEntity);
} }
} }
//发送阅知信息
List<Integer> ids = userPublicService.findOtherUser(userUtils.getCurrentUserId());
ids.addAll(userDao.findAllByUnitsId(userPublicService.findUnitIdByName(allotBillEntity.getSendUnit())).stream()
.map(User::getUserId)
.collect(Collectors.toList()));
MessageBto messageBto = new MessageBto(taskBto.getId(),taskBto.getBusinessType(),allotBillEntity.getReceiveUnit()+"拒绝接收配发装备",ids);
messageService.add(messageBto);
//生成配发退回单
AllotBackBill allotBackBill =new AllotBackBill();
allotBackBill.setAllotBillId(taskBto.getBillId());
allotBackBill.setSendUseraId(userUtils.getCurrentUserId());
allotBackBill.setSendUnit(userUtils.getCurrentUserUnitName());
allotBackBill.setReceiveUnit(allotBillEntity.getSendUnit());
allotBackBill.setBackCheckDetail(allotBillEntity.getAllotCheckDetail());
AllotBackBill allotBackBill1 = allotBackBillService.addEntity(allotBackBill);
Calendar calendar = Calendar.getInstance();
calendar.setTime(allotBackBill1.getCreateTime());
int year = calendar.get(Calendar.YEAR);
String num = "NO:第" + year + "TH" + allotBackBill1.getId() + "号";
allotBackBill1.setNum(num);
allotBackBillService.update(allotBackBill1);
//生成配发退回子业务 //生成配发退回子业务
List<Integer> userIds = new ArrayList<>(); List<Integer> userIds = new ArrayList<>();
userIds.add(userUtils.getCurrentUserId()); userIds.add(userUtils.getCurrentUserId());
TaskBto taskBto1 = new TaskBto(StatusEnum.WAIT_BACK.id, "配发退回业务", taskBto.getId(), taskBto.getNodeIdDetail() + taskBto.getId() + ".", 0, BusinessEnum.ALLOT_BACK.id, userUtils.getCurrentUnitId(), 0, null, userIds); userIds.add(0);
TaskBto taskBto1 = new TaskBto(StatusEnum.ALLOT_BACKING.id, "配发退回业务", taskBto.getId(), taskBto.getNodeIdDetail() + taskBto.getId() + ".", allotBackBill1.getId(), BusinessEnum.ALLOT_BACK.id, userPublicService.findUnitIdByName(allotBillEntity.getSendUnit()), 1, null, userIds);
TaskBto task = taskService.start(taskBto1); TaskBto task = taskService.start(taskBto1);
log.info("[配发模块]:配发入库审核失败"); log.info("[配发模块]:配发入库审核失败");
myWebSocket.sendMessage1(); myWebSocket.sendMessage1();
......
...@@ -148,7 +148,9 @@ public class DeviceApplyController { ...@@ -148,7 +148,9 @@ public class DeviceApplyController {
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());
Integer userId = userUtils.getCurrentUserId(); Integer userId = userUtils.getCurrentUserId();
taskService.addInvolveUser(taskBto, userId);
DeviceApplyBill applyBillEntity = deviceApplyBillService.getOne(taskBto.getBillId()); DeviceApplyBill applyBillEntity = deviceApplyBillService.getOne(taskBto.getBillId());
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()
......
...@@ -81,7 +81,7 @@ public enum LogType { ...@@ -81,7 +81,7 @@ public enum LogType {
REPAIR_SEND_3(32, REPAIR_SEND_CONFIRM.id, ARCHIVE.id, "维修出库审核失败"), REPAIR_SEND_3(32, REPAIR_SEND_CONFIRM.id, ARCHIVE.id, "维修出库审核失败"),
REPAIR_SEND_4(33, WAIT_RECEIVE.id, END.id, "接收维修装备并发起入库"), REPAIR_SEND_4(33, WAIT_RECEIVE.id, REPAIRING.id, "接收维修装备并发起入库"),
DESTROY_4(100, WAIT_UPLOAD_BILL_FILE.id, END.id, "上传销毁单"), DESTROY_4(100, WAIT_UPLOAD_BILL_FILE.id, END.id, "上传销毁单"),
...@@ -91,7 +91,7 @@ public enum LogType { ...@@ -91,7 +91,7 @@ public enum LogType {
REPAIR_SEND_7(36, REPAIR_SEND_CONFIRM.id, COUNTRY_REPAIRING.id, "审核成功并出库"), REPAIR_SEND_7(36, REPAIR_SEND_CONFIRM.id, COUNTRY_REPAIRING.id, "审核成功并出库"),
REPAIR_BACK_1(37, ORIGIN_STATUS.id, REPAIR_BACK_CONFIRM.id, "向(%receiveUnit)退还维修装备"), REPAIR_BACK_1(37, ORIGIN_STATUS.id, WAIT_BACK_RECEIVE.id, "向(%receiveUnit)退还维修装备"),
REPAIR_BACK_2(38, REPAIR_BACK_CONFIRM.id, WAIT_BACK_RECEIVE.id, "维修退回审核成功并出库"), REPAIR_BACK_2(38, REPAIR_BACK_CONFIRM.id, WAIT_BACK_RECEIVE.id, "维修退回审核成功并出库"),
...@@ -166,12 +166,12 @@ public enum LogType { ...@@ -166,12 +166,12 @@ public enum LogType {
WORK_H1(79, ORIGIN_STATUS.id, WORKHANDOVER1011.id, "工作交接任务生成完成,等待上传交接单"), WORK_H1(79, ORIGIN_STATUS.id, WORKHANDOVER1011.id, "工作交接任务生成完成,等待上传交接单"),
WORK_H2(80, WORKHANDOVER1011.id, END.id, "工作交接完成"), WORK_H2(80, WORKHANDOVER1011.id, END.id, "工作交接完成"),
STORAGE_4(81, ORIGIN_STATUS.id, END.id, "进行装备入库"),
ALLOT_8(82, ORIGIN_STATUS.id, ALLOTING.id, "对(%receiveUnit)发起配发"), ALLOT_8(82, ORIGIN_STATUS.id, ALLOTING.id, "对(%receiveUnit)发起配发"),
ALLOT_9(83, ALLOTING.id, END.id, "接收配发装备"), ALLOT_9(83, ALLOTING.id, END.id, "接收配发装备"),
ALLOT_10(84, WAIT_ALLOT.id, ALLOTING.id, "对(%receiveUnit)发起配发"), ALLOT_10(84, WAIT_ALLOT.id, ALLOTING.id, "对(%receiveUnit)发起配发"),
ALLOT_11(85, ALLOTING.id, ARCHIVE.id, "拒绝接收配发装备"), ALLOT_11(85, ALLOTING.id, ARCHIVE.id, "拒绝接收配发装备"),
ALLOT_BACK_5(86, ALLOT_BACKING.id, END.id, "接收配发退回装备"), ALLOT_BACK_5(86, ALLOT_BACKING.id, END.id, "接收配发退回装备"),
REPAIR_SEND_10(87, ORIGIN_STATUS.id, COUNTRY_REPAIRING.id, "向(%receiveUnit)发起装备维修"),
; ;
public Integer id; public Integer id;
......
...@@ -9,6 +9,8 @@ import com.tykj.dev.device.library.subject.Dto.DeviceLogDto; ...@@ -9,6 +9,8 @@ import com.tykj.dev.device.library.subject.Dto.DeviceLogDto;
import com.tykj.dev.device.library.subject.domin.DeviceChange; import com.tykj.dev.device.library.subject.domin.DeviceChange;
import com.tykj.dev.device.library.subject.domin.DeviceLibrary; 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.FileVo;
import com.tykj.dev.device.read.service.MessageService;
import com.tykj.dev.device.read.subject.bto.MessageBto;
import com.tykj.dev.device.repair.repository.RepairBackBillDao; import com.tykj.dev.device.repair.repository.RepairBackBillDao;
import com.tykj.dev.device.repair.repository.RepairDetailDao; import com.tykj.dev.device.repair.repository.RepairDetailDao;
import com.tykj.dev.device.repair.repository.RepairSendBillDao; import com.tykj.dev.device.repair.repository.RepairSendBillDao;
...@@ -25,11 +27,12 @@ import com.tykj.dev.device.task.service.TaskLogService; ...@@ -25,11 +27,12 @@ import com.tykj.dev.device.task.service.TaskLogService;
import com.tykj.dev.device.task.service.TaskService; import com.tykj.dev.device.task.service.TaskService;
import com.tykj.dev.device.task.subject.bto.TaskBto; import com.tykj.dev.device.task.subject.bto.TaskBto;
import com.tykj.dev.device.task.subject.bto.TaskLogBto; import com.tykj.dev.device.task.subject.bto.TaskLogBto;
import com.tykj.dev.device.user.subject.dao.UserDao;
import com.tykj.dev.device.user.subject.entity.User;
import com.tykj.dev.device.user.subject.service.UserPublicService; import com.tykj.dev.device.user.subject.service.UserPublicService;
import com.tykj.dev.device.user.util.UserUtils; import com.tykj.dev.device.user.util.UserUtils;
import com.tykj.dev.misc.base.BusinessEnum; import com.tykj.dev.misc.base.BusinessEnum;
import com.tykj.dev.misc.base.RepairStatusEnum; import com.tykj.dev.misc.base.RepairStatusEnum;
import com.tykj.dev.misc.base.ResultObj;
import com.tykj.dev.misc.base.StatusEnum; import com.tykj.dev.misc.base.StatusEnum;
import com.tykj.dev.misc.utils.ResultUtil; import com.tykj.dev.misc.utils.ResultUtil;
import com.tykj.dev.misc.utils.Snowflake; import com.tykj.dev.misc.utils.Snowflake;
...@@ -108,22 +111,38 @@ public class RepairController { ...@@ -108,22 +111,38 @@ public class RepairController {
@Autowired @Autowired
private InputOutputDeviceService inputOutputDeviceService; private InputOutputDeviceService inputOutputDeviceService;
@Autowired
private UserDao userDao;
@Autowired
private MessageService messageService;
@ApiOperation(value = "发起维修", notes = "可以通过这个接口发起维修") @ApiOperation(value = "发起维修", notes = "可以通过这个接口发起维修")
@PostMapping(value = "/form") @PostMapping(value = "/form")
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public ResponseEntity createRepair(@RequestBody @Validated RepairBillSaveVo repairBillSaveVo) { public ResponseEntity createRepair(@RequestBody @Validated RepairBillSaveVo repairBillSaveVo) {
Integer level = userUtils.getCurrentUnitLevel();
//添加维修单和送修单 //添加维修单和送修单
RepairBill repairBill = new RepairBill(); RepairBill repairBill = new RepairBill();
RepairSendBill deviceRepairSendBillEntity = new RepairSendBill(); RepairSendBill deviceRepairSendBillEntity = new RepairSendBill();
Integer userId = userUtils.getCurrentUserId(); Integer userId = userUtils.getCurrentUserId();
BeanUtils.copyProperties(repairBillSaveVo, repairBill); BeanUtils.copyProperties(repairBillSaveVo, repairBill);
BeanUtils.copyProperties(repairBillSaveVo, deviceRepairSendBillEntity); BeanUtils.copyProperties(repairBillSaveVo, deviceRepairSendBillEntity);
repairBill.setRepairStatus(0); // repairBill.setRepairStatus(0);
//更新维修单和送修单状态
//如果当前为省向国家发起的
if (level == 1) {
repairBill.setRepairStatus(4);
deviceRepairSendBillEntity.setRepairStatus(5);
} else {
repairBill.setRepairStatus(2);
deviceRepairSendBillEntity.setRepairStatus(2);
}
if (repairBillSaveVo.getRepairUseraId() != null) { if (repairBillSaveVo.getRepairUseraId() != null) {
repairBill.setRepairUserA(userPublicService.getOne(repairBillSaveVo.getRepairUseraId()).getName()); repairBill.setRepairUserA(userPublicService.getOne(repairBillSaveVo.getRepairUseraId()).getName());
} }
repairBill.setStartUserA(userPublicService.getOne(repairBillSaveVo.getStartUseraId()).getName()); repairBill.setStartUserA(userPublicService.getOne(repairBillSaveVo.getStartUseraId()).getName());
repairBill.setStartUserB(userPublicService.getOne(repairBillSaveVo.getStartUserbId()).getName()); // repairBill.setStartUserB(userPublicService.getOne(repairBillSaveVo.getStartUserbId()).getName());
//生成单位电子签章id //生成单位电子签章id
Long signId = snowflake.creatNextId(); Long signId = snowflake.creatNextId();
Long signId2 = snowflake.creatNextId(); Long signId2 = snowflake.creatNextId();
...@@ -137,7 +156,7 @@ public class RepairController { ...@@ -137,7 +156,7 @@ public class RepairController {
//发起维修业务 //发起维修业务
List<Integer> userIds = new ArrayList<>(); List<Integer> userIds = new ArrayList<>();
userIds.add(userId); userIds.add(userId);
userIds.add(repairBillSaveVo.getStartUserbId()); userIds.add(0);
//存业务日志 //存业务日志
List<FileVo> fileVoList = new ArrayList<>(); List<FileVo> fileVoList = new ArrayList<>();
fileVoList.add(new FileVo("出库确认单", repairBillSaveVo.getFileName(), repairBillSaveVo.getFileUrl())); fileVoList.add(new FileVo("出库确认单", repairBillSaveVo.getFileName(), repairBillSaveVo.getFileUrl()));
...@@ -164,6 +183,14 @@ public class RepairController { ...@@ -164,6 +183,14 @@ public class RepairController {
repairDetail.setType(deviceLibraryEntity.getType()); repairDetail.setType(deviceLibraryEntity.getType());
repairDetail.setDeviceRepairBillId(repairBill1.getId()); repairDetail.setDeviceRepairBillId(repairBill1.getId());
deviceRepairDetailService.save(repairDetail); deviceRepairDetailService.save(repairDetail);
//如果当前为省像国家发起的
if (level == 1) {
deviceLibraryEntity.setLifeStatus(4);
} else {
deviceLibraryEntity.setLifeStatus(3);
}
deviceLibraryEntity.setManageStatus(0);
deviceLibraryService.update(deviceLibraryEntity);
//存装备日志 //存装备日志
DeviceLogDto deviceLogDto = new DeviceLogDto(d.getDeviceId(), "向" + repairBillSaveVo.getReceiveUnit() + "发起装备维修", fileVoList); DeviceLogDto deviceLogDto = new DeviceLogDto(d.getDeviceId(), "向" + repairBillSaveVo.getReceiveUnit() + "发起装备维修", fileVoList);
deviceLogService.addLog(deviceLogDto); deviceLogService.addLog(deviceLogDto);
...@@ -174,8 +201,58 @@ public class RepairController { ...@@ -174,8 +201,58 @@ public class RepairController {
deviceRepairSendBillEntity.setAgent(repairBillSaveVo.getAgent()); deviceRepairSendBillEntity.setAgent(repairBillSaveVo.getAgent());
deviceRepairSendBillEntity.setTitle("维修业务"); deviceRepairSendBillEntity.setTitle("维修业务");
deviceRepairSendBillService.addEntity(deviceRepairSendBillEntity); deviceRepairSendBillService.addEntity(deviceRepairSendBillEntity);
TaskBto taskBto = new TaskBto(StatusEnum.REPAIR_SEND_CONFIRM.id, "维修业务", null, ".", repairBill1.getId(), 5, userUtils.getCurrentUnitId(), 1, null, userIds); Integer ownUnit;
TaskBto saveEntity = taskService.start(taskBto); TaskBto saveEntity;
List<Integer> ids = userPublicService.findOtherUser(userUtils.getCurrentUserId());
if (level == 1) {
ownUnit = userUtils.getCurrentUnitId();
TaskBto taskBto = new TaskBto(StatusEnum.COUNTRY_REPAIRING.id, "维修业务", null, ".", repairBill1.getId(), 5, ownUnit, 1, null, userIds);
saveEntity = taskService.start(taskBto);
} else {
ownUnit = userPublicService.findUnitIdByName(repairBill.getReceiveUnit());
TaskBto taskBto = new TaskBto(StatusEnum.WAIT_RECEIVE.id, "维修业务", null, ".", repairBill1.getId(), 5, ownUnit, 1, null, userIds);
saveEntity = taskService.start(taskBto);
ids.addAll(userDao.findAllByUnitsId(userPublicService.findUnitIdByName(repairBill.getReceiveUnit())).stream()
.map(User::getUserId)
.collect(Collectors.toList()));
}
if (repairBillSaveVo.getTaskId()!=null) {
TaskBto parentTask = taskService.get(repairBillSaveVo.getTaskId());
saveEntity.setParentTaskId(parentTask.getId());
saveEntity.setNodeIdDetail(parentTask.getNodeIdDetail() + repairBillSaveVo.getTaskId() + ".");
taskService.update(saveEntity);
}
String deviceIdDetail = deviceRepairSendBillEntity.getRepairDeviceCheckDetail();
List<Integer> idList = StringSplitUtil.split(deviceIdDetail);
//如果当前为省,改变装备的所在为中办
if (level == 1) {
//获取当前业务维修详情
List<RepairDetail> repairDetailEntities = deviceRepairDetailService.findByBillId(repairBill.getId());
if (repairBillSaveVo.getTaskId()!=null) {
TaskBto parentTask = taskService.get(repairBillSaveVo.getTaskId());
//获取所有父业务id
List<Integer> fathers = StringSplitUtil.taskIdSplit(parentTask.getNodeIdDetail()+ repairBillSaveVo.getTaskId() + ".");
fathers.forEach(integer -> {
//筛选出父业务相同装备的维修详情
List<RepairDetail> repairDetails = repairDetailDao.findByDeviceRepairBillId(taskService.get(integer).getBillId()).stream()
.filter(repairDetail -> idList.contains(repairDetail.getDeviceId()))
.collect(Collectors.toList());
//添加维修详情
repairDetailEntities.addAll(repairDetails);
});
}
//改变维修详情装备所在单位为中办,状态为维修中
repairDetailEntities.forEach(repairDetail -> {
repairDetail.setLocationUnit("中办");
repairDetail.setRepairStatus(1);
deviceRepairDetailService.update(repairDetail);
});
}
//添加出库白名单
inputOutputDeviceService.addWhiteDevices(idList,userUtils.getCurrentUnitId(),1);
//发送阅知信息
MessageBto messageBto = new MessageBto(saveEntity.getId(),saveEntity.getBusinessType(),repairBill.getSendUnit()+"向"+repairBill.getReceiveUnit()+"发起装备维修",ids);
messageService.add(messageBto);
myWebSocket.sendMessage1(); myWebSocket.sendMessage1();
return ResultUtil.success(saveEntity); return ResultUtil.success(saveEntity);
} }
...@@ -184,14 +261,13 @@ public class RepairController { ...@@ -184,14 +261,13 @@ public class RepairController {
@PostMapping(value = "/continue/form") @PostMapping(value = "/continue/form")
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public ResponseEntity continueCreateRepair(@RequestBody @Validated RepairBillSaveVo deviceRepairBillSaveVo) { public ResponseEntity continueCreateRepair(@RequestBody @Validated RepairBillSaveVo deviceRepairBillSaveVo) {
ResponseEntity responseEntity = createRepair(deviceRepairBillSaveVo); // ResultObj resultObj = (ResultObj) responseEntity.getBody();
ResultObj resultObj = (ResultObj) responseEntity.getBody(); // TaskBto taskBto = (TaskBto) Objects.requireNonNull(resultObj).getData();
TaskBto taskBto = (TaskBto) Objects.requireNonNull(resultObj).getData(); // TaskBto parentTask = taskService.get(deviceRepairBillSaveVo.getTaskId());
TaskBto parentTask = taskService.get(deviceRepairBillSaveVo.getTaskId()); // taskBto.setParentTaskId(parentTask.getId());
taskBto.setParentTaskId(parentTask.getId()); // taskBto.setNodeIdDetail(parentTask.getNodeIdDetail() + deviceRepairBillSaveVo.getTaskId() + ".");
taskBto.setNodeIdDetail(parentTask.getNodeIdDetail() + deviceRepairBillSaveVo.getTaskId() + "."); // taskService.update(taskBto);
taskService.update(taskBto); return createRepair(deviceRepairBillSaveVo);
return ResultUtil.success("继续向上级发起维修成功");
} }
@ApiOperation(value = "发起维修审核", notes = "可以通过这个接口发起维修审核") @ApiOperation(value = "发起维修审核", notes = "可以通过这个接口发起维修审核")
...@@ -322,10 +398,10 @@ public class RepairController { ...@@ -322,10 +398,10 @@ public class RepairController {
fileVoList.add(new FileVo("维修单", repairSendBill.getBillFileName(), repairSendBill.getBillFileUrl())); 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(6); repairBill.setRepairStatus(4);
repairBill.setRepairUserB(userPublicService.getOne(repairReceiveVo.getReceiveUserbId()).getName()); repairBill.setRepairUserB(userPublicService.getOne(repairReceiveVo.getReceiveUserbId()).getName());
deviceRepairBillService.update(repairBill); deviceRepairBillService.update(repairBill);
repairSendBill.setRepairStatus(6); repairSendBill.setRepairStatus(5);
repairSendBill.setBillFileName(repairReceiveVo.getBillFileName()); repairSendBill.setBillFileName(repairReceiveVo.getBillFileName());
repairSendBill.setBillFileUrl(repairReceiveVo.getBillFileUrl()); repairSendBill.setBillFileUrl(repairReceiveVo.getBillFileUrl());
repairSendBill.setReceiveTime(new Date()); repairSendBill.setReceiveTime(new Date());
...@@ -337,7 +413,8 @@ public class RepairController { ...@@ -337,7 +413,8 @@ public class RepairController {
repairSendBill.setRepairUserbId(repairReceiveVo.getReceiveUserbId()); repairSendBill.setRepairUserbId(repairReceiveVo.getReceiveUserbId());
deviceRepairSendBillService.update(repairSendBill); deviceRepairSendBillService.update(repairSendBill);
//任务推至下一阶段 //任务推至下一阶段
taskService.update(taskService.moveToNext(taskBto, repairReceiveVo.getReceiveUserbId())); taskService.moveToSpecial(taskBto,StatusEnum.REPAIRING);
// taskService.update(taskService.moveToNext(taskBto, repairReceiveVo.getReceiveUserbId()));
//分隔装备id //分隔装备id
String[] strings = deviceIdDetail.split("x"); String[] strings = deviceIdDetail.split("x");
//存接收无误的装备id //存接收无误的装备id
...@@ -348,9 +425,9 @@ public class RepairController { ...@@ -348,9 +425,9 @@ public class RepairController {
if ("1".equals(s.substring(s.length() - 1))) { if ("1".equals(s.substring(s.length() - 1))) {
Integer id = Integer.parseInt(s.substring(0, s.length() - 1)); Integer id = Integer.parseInt(s.substring(0, s.length() - 1));
idList.add(id); idList.add(id);
//改变装备状态 //更新装备状态
DeviceLibrary deviceLibraryEntity = deviceLibraryService.getOne(id); DeviceLibrary deviceLibraryEntity = deviceLibraryService.getOne(id);
deviceLibraryEntity.setLifeStatus(0); deviceLibraryEntity.setLifeStatus(4);
deviceLibraryEntity.setLocationUnit(userUtils.getCurrentUserUnitName()); deviceLibraryEntity.setLocationUnit(userUtils.getCurrentUserUnitName());
//存装备日志 //存装备日志
DeviceLogDto deviceLogDto = new DeviceLogDto(id, "接收并发起入库", fileVoList); DeviceLogDto deviceLogDto = new DeviceLogDto(id, "接收并发起入库", fileVoList);
...@@ -383,8 +460,16 @@ public class RepairController { ...@@ -383,8 +460,16 @@ public class RepairController {
//改变维修详情装备所在单位为当前单位 //改变维修详情装备所在单位为当前单位
repairDetailEntities.forEach(repairDetail -> { repairDetailEntities.forEach(repairDetail -> {
repairDetail.setLocationUnit(userUtils.getCurrentUserUnitName()); repairDetail.setLocationUnit(userUtils.getCurrentUserUnitName());
repairDetail.setRepairStatus(1);
deviceRepairDetailService.update(repairDetail); deviceRepairDetailService.update(repairDetail);
}); });
//发送阅知信息
List<Integer> ids = userPublicService.findOtherUser(userUtils.getCurrentUserId());
ids.addAll(userDao.findAllByUnitsId(userPublicService.findUnitIdByName(repairBill.getSendUnit())).stream()
.map(User::getUserId)
.collect(Collectors.toList()));
MessageBto messageBto = new MessageBto(taskBto.getId(),taskBto.getBusinessType(),repairBill.getReceiveUnit()+"接收维修装备",ids);
messageService.add(messageBto);
myWebSocket.sendMessage1(); myWebSocket.sendMessage1();
return ResultUtil.success("维修装备接收入库"); return ResultUtil.success("维修装备接收入库");
} }
...@@ -513,7 +598,7 @@ public class RepairController { ...@@ -513,7 +598,7 @@ public class RepairController {
//生成维修退回单 //生成维修退回单
RepairBackBill repairBackBill = new RepairBackBill(); RepairBackBill repairBackBill = new RepairBackBill();
BeanUtils.copyProperties(repairBackBillSaveVo, repairBackBill); BeanUtils.copyProperties(repairBackBillSaveVo, repairBackBill);
repairBackBill.setBackStatus(0); repairBackBill.setBackStatus(2);
repairBackBill.setDeviceRepairBillId(repairBill.getId()); repairBackBill.setDeviceRepairBillId(repairBill.getId());
repairBackBill.setSendTime(new Date()); repairBackBill.setSendTime(new Date());
repairBackBill.setTitle("维修退回业务"); repairBackBill.setTitle("维修退回业务");
...@@ -530,17 +615,24 @@ public class RepairController { ...@@ -530,17 +615,24 @@ public class RepairController {
//发起维修退回子业务 //发起维修退回子业务
List<Integer> userIds = new ArrayList<>(); List<Integer> userIds = new ArrayList<>();
userIds.add(userId); userIds.add(userId);
userIds.add(repairBackBillSaveVo.getStartUserbId()); userIds.add(0);
TaskBto taskBto1 = new TaskBto(StatusEnum.REPAIR_BACK_CONFIRM.id, "维修退回", taskBto.getId(), taskBto.getNodeIdDetail() + taskBto.getId() + ".", deviceRepairBackBillEntity1.getId(), BusinessEnum.REPAIR_BACK.id, userUtils.getCurrentUnitId(), 1, null, userIds); 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 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()) {
DeviceLibrary deviceLibraryEntity = deviceLibraryService.getOne(d.getDeviceId());
deviceLibraryEntity.setLifeStatus(3);
deviceLibraryEntity.setManageStatus(0);
DeviceLogDto deviceLogDto = new DeviceLogDto(d.getDeviceId(), "向" + repairBackBillSaveVo.getReceiveUnit() + "退还维修装备", fileVoList); DeviceLogDto deviceLogDto = new DeviceLogDto(d.getDeviceId(), "向" + repairBackBillSaveVo.getReceiveUnit() + "退还维修装备", fileVoList);
deviceLogService.addLog(deviceLogDto); deviceLogService.addLog(deviceLogDto);
} }
String deviceIdDetail = repairBackBill.getBackCheckDetail();
List<Integer> idList = StringSplitUtil.split(deviceIdDetail);
//添加出库白名单
inputOutputDeviceService.addWhiteDevices(idList,userUtils.getCurrentUnitId(),1);
//判断是否修完 //判断是否修完
List<RepairDetail> deviceRepairDetailEntities = deviceRepairDetailService.findByBillId(repairBill.getId()); List<RepairDetail> deviceRepairDetailEntities = deviceRepairDetailService.findByBillId(repairBill.getId());
//获取所有装备的维修状态 //获取所有装备的维修状态
...@@ -561,8 +653,15 @@ public class RepairController { ...@@ -561,8 +653,15 @@ public class RepairController {
//维修主业务完结 //维修主业务完结
taskService.update(taskService.moveToEnd(taskBto)); taskService.update(taskService.moveToEnd(taskBto));
} }
//发送阅知信息
List<Integer> ids = userPublicService.findOtherUser(userUtils.getCurrentUserId());
ids.addAll(userDao.findAllByUnitsId(userPublicService.findUnitIdByName(repairBackBill.getReceiveUnit())).stream()
.map(User::getUserId)
.collect(Collectors.toList()));
MessageBto messageBto = new MessageBto(taskBto.getId(),taskBto.getBusinessType(),repairBackBill.getSendUnit()+"向"+repairBackBill.getReceiveUnit()+"退回维修装备",ids);
messageService.add(messageBto);
myWebSocket.sendMessage1(); myWebSocket.sendMessage1();
return ResultUtil.success("出库成功待审核"); return ResultUtil.success(task);
} }
@ApiOperation(value = "修好装备出库审核", notes = "可以通过这个接口修好装备出库审核") @ApiOperation(value = "修好装备出库审核", notes = "可以通过这个接口修好装备出库审核")
...@@ -637,6 +736,7 @@ public class RepairController { ...@@ -637,6 +736,7 @@ public class RepairController {
TaskBto taskBto = taskService.get(repairReceiveVo.getTaskId()); TaskBto taskBto = taskService.get(repairReceiveVo.getTaskId());
Integer userId = userUtils.getCurrentUserId(); Integer userId = userUtils.getCurrentUserId();
Integer level = userUtils.getCurrentUnitLevel(); Integer level = userUtils.getCurrentUnitLevel();
taskService.addInvolveUser(taskBto,userId);
//获取退回单和装备id //获取退回单和装备id
RepairBackBill repairBackBill; RepairBackBill repairBackBill;
if (level == 2 || level == 3) { if (level == 2 || level == 3) {
...@@ -677,7 +777,7 @@ public class RepairController { ...@@ -677,7 +777,7 @@ public class RepairController {
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()));
//更新退回单 //更新退回单
repairBackBill.setBackStatus(3); repairBackBill.setBackStatus(5);
repairBackBill.setBillFileName(repairReceiveVo.getBillFileName()); repairBackBill.setBillFileName(repairReceiveVo.getBillFileName());
repairBackBill.setBillFileUrl(repairReceiveVo.getBillFileUrl()); repairBackBill.setBillFileUrl(repairReceiveVo.getBillFileUrl());
repairBackBill.setReceiveTime(new Date()); repairBackBill.setReceiveTime(new Date());
...@@ -688,19 +788,21 @@ public class RepairController { ...@@ -688,19 +788,21 @@ public class RepairController {
repairBackBill.setBackReciveCheckResult(repairReceiveVo.getReceiveCheckResult()); repairBackBill.setBackReciveCheckResult(repairReceiveVo.getReceiveCheckResult());
repairBackBill.setReceiveUserbId(repairReceiveVo.getReceiveUserbId()); repairBackBill.setReceiveUserbId(repairReceiveVo.getReceiveUserbId());
RepairBackBill repairBackBill1 = deviceRepairBackBillService.update(repairBackBill); RepairBackBill repairBackBill1 = deviceRepairBackBillService.update(repairBackBill);
TaskBto taskBto2;
if (level == 1) { if (level == 1) {
List<Integer> userIds = new ArrayList<>(); List<Integer> userIds = new ArrayList<>();
userIds.add(userId); userIds.add(userId);
userIds.add(repairReceiveVo.getReceiveUserbId()); TaskBto taskBto1 = new TaskBto(StatusEnum.END.id, "维修退回", taskBto.getId(), taskBto.getNodeIdDetail() + taskBto.getId() + ".", repairBackBill1.getId(), BusinessEnum.REPAIR_BACK.id, userUtils.getCurrentUnitId(), 0, null, userIds);
TaskBto taskBto1 = new TaskBto(StatusEnum.REPAIR_BACK_RECEIVE_CONFIRM.id, "维修退回", taskBto.getId(), taskBto.getNodeIdDetail() + taskBto.getId() + ".", repairBackBill1.getId(), BusinessEnum.REPAIR_BACK.id, userUtils.getCurrentUnitId(), 1, null, userIds); taskBto2 = taskService.start(taskBto1);
taskService.start(taskBto1);
//添加业务日志 //添加业务日志
TaskLogBto taskLogBto2 = new TaskLogBto(taskBto1.getId(), "维修退回装备接收并发起入库", fileVoList); TaskLogBto taskLogBto2 = new TaskLogBto(taskBto1.getId(), "维修退回装备接收并发起入库", fileVoList);
taskLogService.addLog(taskLogBto2); taskLogService.addLog(taskLogBto2);
} else { } else {
//任务推至下一阶段 //任务推至下一阶段
taskService.update(taskService.moveToNext(taskBto, repairReceiveVo.getReceiveUserbId())); // taskService.update(taskService.moveToNext(taskBto, repairReceiveVo.getReceiveUserbId()));
taskBto2 = taskService.moveToEnd(taskBto);
} }
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<>();
...@@ -712,7 +814,7 @@ public class RepairController { ...@@ -712,7 +814,7 @@ public class RepairController {
idList.add(id); idList.add(id);
//更改装备状态 //更改装备状态
DeviceLibrary deviceLibraryEntity = deviceLibraryService.getOne(id); DeviceLibrary deviceLibraryEntity = deviceLibraryService.getOne(id);
deviceLibraryEntity.setLifeStatus(0); deviceLibraryEntity.setLifeStatus(2);
deviceLibraryEntity.setLocationUnit(userUtils.getCurrentUserUnitName()); deviceLibraryEntity.setLocationUnit(userUtils.getCurrentUserUnitName());
//添加装备日志 //添加装备日志
DeviceLogDto deviceLogDto = new DeviceLogDto(id, "维修退回装备接收并发起入库", fileVoList); DeviceLogDto deviceLogDto = new DeviceLogDto(id, "维修退回装备接收并发起入库", fileVoList);
...@@ -733,22 +835,30 @@ public class RepairController { ...@@ -733,22 +835,30 @@ public class RepairController {
} }
} }
//获取维修详情 //获取维修详情
List<RepairDetail> repairDetailList = deviceRepairDetailService.findByBillId(taskBto.getBillId()); List<RepairDetail> repairDetailList = deviceRepairDetailService.findByBillId(parent.getBillId());
//获取所有父业务id // //获取所有父业务id
List<Integer> fathers = StringSplitUtil.taskIdSplit(taskBto.getNodeIdDetail()); // List<Integer> fathers = StringSplitUtil.taskIdSplit(taskBto2.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());
//添加维修详情 // //添加维修详情
repairDetailList.addAll(repairDetails); // repairDetailList.addAll(repairDetails);
}); // });
//改变维修详情装备所在单位为当前单位 //改变维修详情装备所在单位为当前单位
repairDetailList.forEach(repairDetail -> { repairDetailList.forEach(repairDetail -> {
repairDetail.setLocationUnit(userUtils.getCurrentUserUnitName()); repairDetail.setLocationUnit(userUtils.getCurrentUserUnitName());
repairDetail.setRepairStatus(5);
deviceRepairDetailService.update(repairDetail); deviceRepairDetailService.update(repairDetail);
}); });
//发送阅知信息
List<Integer> ids = userPublicService.findOtherUser(userUtils.getCurrentUserId());
ids.addAll(userDao.findAllByUnitsId(userPublicService.findUnitIdByName(repairBackBill.getReceiveUnit())).stream()
.map(User::getUserId)
.collect(Collectors.toList()));
MessageBto messageBto = new MessageBto(taskBto2.getId(),taskBto2.getBusinessType(),repairBackBill.getReceiveUnit()+"接收维修退回装备",ids);
messageService.add(messageBto);
myWebSocket.sendMessage1(); myWebSocket.sendMessage1();
return ResultUtil.success("维修成功退回装备接收入库"); return ResultUtil.success("维修成功退回装备接收入库");
} }
......
...@@ -27,8 +27,8 @@ public class RepairBackBillSaveVo { ...@@ -27,8 +27,8 @@ public class RepairBackBillSaveVo {
@ApiModelProperty(value = "退回发起人", example = "1") @ApiModelProperty(value = "退回发起人", example = "1")
private Integer startUseraId; private Integer startUseraId;
@NotNull(message = "startUserbId不能为空") // @NotNull(message = "startUserbId不能为空")
@Min(value = 1,message = "startUserbId不能小于1") // @Min(value = 1,message = "startUserbId不能小于1")
@ApiModelProperty(value = "退回确认人", example = "1") @ApiModelProperty(value = "退回确认人", example = "1")
private Integer startUserbId; private Integer startUserbId;
......
...@@ -22,8 +22,8 @@ public class RepairBillSaveVo { ...@@ -22,8 +22,8 @@ public class RepairBillSaveVo {
@ApiModelProperty(value = "发起申请人", example = "1") @ApiModelProperty(value = "发起申请人", example = "1")
private Integer startUseraId; private Integer startUseraId;
@NotNull(message = "startUserbId不能为空") // @NotNull(message = "startUserbId不能为空")
@Min(value = 1,message = "startUserbId不能小于1") // @Min(value = 1,message = "startUserbId不能小于1")
@ApiModelProperty(value = "发起确认人", example = "1") @ApiModelProperty(value = "发起确认人", example = "1")
private Integer startUserbId; private Integer startUserbId;
......
...@@ -14,8 +14,8 @@ import javax.validation.constraints.NotNull; ...@@ -14,8 +14,8 @@ import javax.validation.constraints.NotNull;
@ApiModel("配发接收类") @ApiModel("配发接收类")
public class RepairReceiveVo { public class RepairReceiveVo {
@NotNull(message = "receiveUserbId不能为空") // @NotNull(message = "receiveUserbId不能为空")
@Min(value = 1,message = "receiveUserbId不能小于1") // @Min(value = 1,message = "receiveUserbId不能小于1")
@ApiModelProperty(value = "接收单位B岗") @ApiModelProperty(value = "接收单位B岗")
private Integer receiveUserbId; private Integer receiveUserbId;
......
...@@ -9,6 +9,8 @@ import com.tykj.dev.device.library.subject.vo.DeviceLibrarySaveVo; ...@@ -9,6 +9,8 @@ import com.tykj.dev.device.library.subject.vo.DeviceLibrarySaveVo;
import com.tykj.dev.device.library.subject.vo.FileVo; import com.tykj.dev.device.library.subject.vo.FileVo;
import com.tykj.dev.device.packing.service.PackingLibraryService; import com.tykj.dev.device.packing.service.PackingLibraryService;
import com.tykj.dev.device.packing.subject.domin.PackingLibrary; import com.tykj.dev.device.packing.subject.domin.PackingLibrary;
import com.tykj.dev.device.read.service.MessageService;
import com.tykj.dev.device.read.subject.bto.MessageBto;
import com.tykj.dev.device.storage.service.StorageBillService; import com.tykj.dev.device.storage.service.StorageBillService;
import com.tykj.dev.device.storage.subject.domin.StorageBill; import com.tykj.dev.device.storage.subject.domin.StorageBill;
import com.tykj.dev.device.storage.subject.vo.StorageBillConfirmVo; import com.tykj.dev.device.storage.subject.vo.StorageBillConfirmVo;
...@@ -18,6 +20,7 @@ import com.tykj.dev.device.storage.subject.vo.StorageDetailVo; ...@@ -18,6 +20,7 @@ import com.tykj.dev.device.storage.subject.vo.StorageDetailVo;
import com.tykj.dev.device.task.service.TaskLogService; import com.tykj.dev.device.task.service.TaskLogService;
import com.tykj.dev.device.task.service.TaskService; import com.tykj.dev.device.task.service.TaskService;
import com.tykj.dev.device.task.subject.bto.TaskBto; import com.tykj.dev.device.task.subject.bto.TaskBto;
import com.tykj.dev.device.task.subject.bto.TaskLogBto;
import com.tykj.dev.device.user.subject.service.UserPublicService; import com.tykj.dev.device.user.subject.service.UserPublicService;
import com.tykj.dev.device.user.util.UserUtils; import com.tykj.dev.device.user.util.UserUtils;
import com.tykj.dev.misc.base.BusinessEnum; import com.tykj.dev.misc.base.BusinessEnum;
...@@ -34,8 +37,6 @@ import org.springframework.http.ResponseEntity; ...@@ -34,8 +37,6 @@ import org.springframework.http.ResponseEntity;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import com.tykj.dev.device.read.service.MessageService;
import com.tykj.dev.device.read.subject.bto.MessageBto;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
...@@ -143,6 +144,9 @@ public class StorageBillController { ...@@ -143,6 +144,9 @@ public class StorageBillController {
List<FileVo> fileVoList = new ArrayList<>(); List<FileVo> fileVoList = new ArrayList<>();
fileVoList.add(new FileVo("配发单", storageBillEntity.getFileName(), storageBillEntity.getFileUrl())); fileVoList.add(new FileVo("配发单", storageBillEntity.getFileName(), storageBillEntity.getFileUrl()));
fileVoList.add(new FileVo("入库确认单", storageBillEntity.getReceiveFileName(), storageBillEntity.getReceiveFileUrl())); fileVoList.add(new FileVo("入库确认单", storageBillEntity.getReceiveFileName(), storageBillEntity.getReceiveFileUrl()));
//添加业务日志
TaskLogBto taskLogBto2 = new TaskLogBto(taskEntity1.getId(), "发起装备入库", fileVoList);
taskLogService.addLog(taskLogBto2);
//3.存装备 //3.存装备
Integer parentId = null; Integer parentId = null;
for (DeviceLibrarySaveVo d : storageBillSaveVo.getDeviceLibrarySaveVoList()) { for (DeviceLibrarySaveVo d : storageBillSaveVo.getDeviceLibrarySaveVoList()) {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论