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

更新

上级 643df8c1
...@@ -48,5 +48,9 @@ ...@@ -48,5 +48,9 @@
<groupId>com.tykj</groupId> <groupId>com.tykj</groupId>
<artifactId>dev-file</artifactId> <artifactId>dev-file</artifactId>
</dependency> </dependency>
<dependency>
<groupId>com.tykj</groupId>
<artifactId>dev-packing</artifactId>
</dependency>
</dependencies> </dependencies>
</project> </project>
\ No newline at end of file
...@@ -207,21 +207,22 @@ public class AllotBillController { ...@@ -207,21 +207,22 @@ public class AllotBillController {
ids.add(id); ids.add(id);
//改变装备状态 //改变装备状态
DeviceLibrary deviceLibraryEntity = deviceLibraryService.getOne(id); DeviceLibrary deviceLibraryEntity = deviceLibraryService.getOne(id);
// PackingLibrary packingLibrary =
if (allotBillSaveVo.getAllotType() == 2){ if (allotBillSaveVo.getAllotType() == 2){
if (deviceLibraryEntity.getAllotType()!=2){ // if (deviceLibraryEntity.getAllotType()!=2){
deviceLibraryEntity.setAllotType(2); // deviceLibraryEntity.setAllotType(2);
DeviceLogDto deviceLogDto = new DeviceLogDto(id, "将配发类型由" + deviceLibraryEntity.getAllotTypeName() + "改为"+configCache.getAllotTypeMap().get(2), fileVoList); // DeviceLogDto deviceLogDto = new DeviceLogDto(id, "将配发类型由" + deviceLibraryEntity.getAllotTypeName() + "改为"+configCache.getAllotTypeMap().get(2), fileVoList);
deviceLogService.addLog(deviceLogDto); // deviceLogService.addLog(deviceLogDto);
} // }
deviceLibraryEntity.setLifeStatus(3); deviceLibraryEntity.setLifeStatus(3);
deviceLibraryEntity.setManageStatus(0); deviceLibraryEntity.setManageStatus(0);
} }
else { else {
if (deviceLibraryEntity.getAllotType()!=1){ // if (deviceLibraryEntity.getAllotType()!=1){
deviceLibraryEntity.setAllotType(1); // deviceLibraryEntity.setAllotType(1);
DeviceLogDto deviceLogDto = new DeviceLogDto(id, "将配发类型由" + deviceLibraryEntity.getAllotTypeName() + "改为"+configCache.getAllotTypeMap().get(1), fileVoList); // DeviceLogDto deviceLogDto = new DeviceLogDto(id, "将配发类型由" + deviceLibraryEntity.getAllotTypeName() + "改为"+configCache.getAllotTypeMap().get(1), fileVoList);
deviceLogService.addLog(deviceLogDto); // deviceLogService.addLog(deviceLogDto);
} // }
deviceLibraryEntity.setLocationUnit(allotBillSaveVo.getReceiveUnit()); deviceLibraryEntity.setLocationUnit(allotBillSaveVo.getReceiveUnit());
deviceLibraryEntity.setOwnUnit(allotBillSaveVo.getReceiveUnit()); deviceLibraryEntity.setOwnUnit(allotBillSaveVo.getReceiveUnit());
} }
...@@ -608,50 +609,44 @@ public class AllotBillController { ...@@ -608,50 +609,44 @@ public class AllotBillController {
TaskDisposeUtil.isNotSubmit(taskBto.getBillStatus(),StatusEnum.WAIT_UPLOAD_ALLOT_RECEIVE_FILE); TaskDisposeUtil.isNotSubmit(taskBto.getBillStatus(),StatusEnum.WAIT_UPLOAD_ALLOT_RECEIVE_FILE);
Integer userId = userUtils.getCurrentUserId(); Integer userId = userUtils.getCurrentUserId();
taskService.addInvolveUser(taskBto,userId); taskService.addInvolveUser(taskBto,userId);
//不上传单据 taskService.moveToEnd(taskBto);
if (fileUploadVo.getStatus()==0){ taskService.moveAllSonNodeToEnd(taskBto.getId());
taskService.moveToArchive(taskBto); AllotBill allotBill = allotBillService.getOne(taskBto.getBillId());
allotBill.setBillFileName(fileUploadVo.getBillFileName());
allotBill.setBillFileUrl(fileUploadVo.getBillFileUrl());
if (fileUploadVo.getSendUserbId()!=null){
allotBill.setSendUserbId(fileUploadVo.getSendUserbId());
allotBill.setAgent(userPublicService.getOne(fileUploadVo.getSendUserbId()).getName());
} }
else { List<FileVo> fileVoList = new ArrayList<>();
taskService.moveToEnd(taskBto); if (fileUploadVo.getReceiveFiles()!=null&&fileUploadVo.getReceiveFiles().size()>0){
taskService.moveAllSonNodeToEnd(taskBto.getId()); fileUploadVo.getReceiveFiles().forEach(fileRet -> {
AllotBill allotBill = allotBillService.getOne(taskBto.getBillId()); fileVoList.add(new FileVo("配发单", fileRet.getName(), fileRet.getPreviewPath()));
allotBill.setBillFileName(fileUploadVo.getBillFileName());
allotBill.setBillFileUrl(fileUploadVo.getBillFileUrl());
if (fileUploadVo.getSendUserbId()!=null){
allotBill.setSendUserbId(fileUploadVo.getSendUserbId());
allotBill.setAgent(userPublicService.getOne(fileUploadVo.getSendUserbId()).getName());
}
List<FileVo> fileVoList = new ArrayList<>();
if (fileUploadVo.getReceiveFiles()!=null&&fileUploadVo.getReceiveFiles().size()>0){
fileUploadVo.getReceiveFiles().forEach(fileRet -> {
fileVoList.add(new FileVo("配发单", fileRet.getName(), fileRet.getPreviewPath()));
});
allotBill.setReceiveFiles(FilesUtil.stringFileToList(fileUploadVo.getReceiveFiles()));
}
// fileVoList.add(new FileVo("配发单", allotBill.getBillFileName(), allotBill.getBillFileUrl()));
allotBillService.update(allotBill);
//添加装备日志
List<Integer> deviceIds = StringSplitUtil.split(allotBill.getAllotCheckDetail());
deviceIds.forEach(integer -> {
//存装备日志
DeviceLogDto deviceLogDto = new DeviceLogDto(integer, "上传配发单据", fileVoList);
deviceLogService.addLog(deviceLogDto);
}); });
if (fileUploadVo.getSendUserbId()!=null) { allotBill.setReceiveFiles(FilesUtil.stringFileToList(fileUploadVo.getReceiveFiles()));
List<Integer> idList1 = new ArrayList<>(); }
idList1.add(fileUploadVo.getSendUserbId()); // fileVoList.add(new FileVo("配发单", allotBill.getBillFileName(), allotBill.getBillFileUrl()));
MessageBto messageBto = new MessageBto(taskBto.getId(), taskBto.getBusinessType(), "被选为签发人", idList1, 1); allotBillService.update(allotBill);
messageService.add(messageBto); //添加装备日志
} List<Integer> deviceIds = StringSplitUtil.split(allotBill.getAllotCheckDetail());
//发送阅知信息 deviceIds.forEach(integer -> {
List<Integer> ids = userPublicService.findOtherUser(userId); //存装备日志
ids.addAll(userDao.findAllByUnitsId(userPublicService.findUnitIdByName(allotBill.getSendUnit())).stream() DeviceLogDto deviceLogDto = new DeviceLogDto(integer, "上传配发单据", fileVoList);
.map(User::getUserId) deviceLogService.addLog(deviceLogDto);
.collect(Collectors.toList())); });
MessageBto messageBto = new MessageBto(taskBto.getId(),taskBto.getBusinessType(),"业务办结",ids,1); if (fileUploadVo.getSendUserbId()!=null) {
List<Integer> idList1 = new ArrayList<>();
idList1.add(fileUploadVo.getSendUserbId());
MessageBto messageBto = new MessageBto(taskBto.getId(), taskBto.getBusinessType(), "被选为签发人", idList1, 1);
messageService.add(messageBto); messageService.add(messageBto);
} }
//发送阅知信息
List<Integer> ids = userPublicService.findOtherUser(userId);
ids.addAll(userDao.findAllByUnitsId(userPublicService.findUnitIdByName(allotBill.getSendUnit())).stream()
.map(User::getUserId)
.collect(Collectors.toList()));
MessageBto messageBto = new MessageBto(taskBto.getId(),taskBto.getBusinessType(),"业务办结",ids,1);
messageService.add(messageBto);
return ResponseEntity.ok("上传成功"); return ResponseEntity.ok("上传成功");
} }
...@@ -666,11 +661,6 @@ public class AllotBillController { ...@@ -666,11 +661,6 @@ public class AllotBillController {
statusEnums.add(StatusEnum.WAIT_UPLOAD_CROSS_FILE); statusEnums.add(StatusEnum.WAIT_UPLOAD_CROSS_FILE);
statusEnums.add(StatusEnum.WAIT_UPLOAD_ALLOT_FILE); statusEnums.add(StatusEnum.WAIT_UPLOAD_ALLOT_FILE);
TaskDisposeUtil.isNotSubmit(taskBto.getBillStatus(),statusEnums); TaskDisposeUtil.isNotSubmit(taskBto.getBillStatus(),statusEnums);
//不上传单据
// if (fileVo.getStatus()==0){
// taskService.moveToArchive(taskBto);
// }
// else {
AllotBill allotBill = allotBillService.getOne(taskBto.getBillId()); AllotBill allotBill = allotBillService.getOne(taskBto.getBillId());
List<Integer> idList = new ArrayList<>(); List<Integer> idList = new ArrayList<>();
if (fileVo.getReceiveUseraId()!=null) { if (fileVo.getReceiveUseraId()!=null) {
...@@ -706,7 +696,6 @@ public class AllotBillController { ...@@ -706,7 +696,6 @@ public class AllotBillController {
deviceLibrary.setManageStatus(1); deviceLibrary.setManageStatus(1);
deviceLibraryService.update(deviceLibrary); deviceLibraryService.update(deviceLibrary);
}); });
// }
if (idList.size()>0) { if (idList.size()>0) {
MessageBto messageBto = new MessageBto(taskBto.getId(), taskBto.getBusinessType(), "被选为经办人", idList, 1); MessageBto messageBto = new MessageBto(taskBto.getId(), taskBto.getBusinessType(), "被选为经办人", idList, 1);
messageService.add(messageBto); messageService.add(messageBto);
...@@ -716,7 +705,7 @@ public class AllotBillController { ...@@ -716,7 +705,7 @@ public class AllotBillController {
userIds.addAll(userDao.findAllByUnitsId(userPublicService.findUnitIdByName(allotBill.getReceiveUnit())).stream() userIds.addAll(userDao.findAllByUnitsId(userPublicService.findUnitIdByName(allotBill.getReceiveUnit())).stream()
.map(User::getUserId) .map(User::getUserId)
.collect(Collectors.toList())); .collect(Collectors.toList()));
MessageBto messageBto = new MessageBto(taskBto.getId(),taskBto.getBusinessType(),"业务办结",userIds,1); MessageBto messageBto = new MessageBto(taskBto.getParentTaskId(),taskBto.getBusinessType(),"业务办结",userIds,1);
messageService.add(messageBto); messageService.add(messageBto);
return ResponseEntity.ok("OK"); return ResponseEntity.ok("OK");
} }
......
...@@ -245,7 +245,8 @@ public class BackController { ...@@ -245,7 +245,8 @@ public class BackController {
MessageBto messageBto = new MessageBto(taskBto.getId(), taskBto.getBusinessType(), "被选为签发人", idList1, 1); MessageBto messageBto = new MessageBto(taskBto.getId(), taskBto.getBusinessType(), "被选为签发人", idList1, 1);
messageService.add(messageBto); messageService.add(messageBto);
} }
MessageBto messageBto = new MessageBto(taskBto.getId(),taskBto.getBusinessType(),"接收退回装备",ids,1); String message = allotBackReceiveVo.getStatus()==0?"业务办结":"接收退回装备";
MessageBto messageBto = new MessageBto(taskBto.getId(),taskBto.getBusinessType(),message,ids,1);
messageService.add(messageBto); messageService.add(messageBto);
log.info("[退回模块]:接收并发起入库"); log.info("[退回模块]:接收并发起入库");
myWebSocket.sendMessage1(); myWebSocket.sendMessage1();
...@@ -296,6 +297,13 @@ public class BackController { ...@@ -296,6 +297,13 @@ public class BackController {
MessageBto messageBto = new MessageBto(taskBto.getId(), taskBto.getBusinessType(), "被选为签发人", idList1, 1); MessageBto messageBto = new MessageBto(taskBto.getId(), taskBto.getBusinessType(), "被选为签发人", idList1, 1);
messageService.add(messageBto); messageService.add(messageBto);
} }
//发送阅知信息
List<Integer> ids = userPublicService.findOtherUser(userId);
ids.addAll(userDao.findAllByUnitsId(userPublicService.findUnitIdByName(allotBackBill.getSendUnit())).stream()
.map(User::getUserId)
.collect(Collectors.toList()));
MessageBto messageBto = new MessageBto(taskBto.getId(),taskBto.getBusinessType(),"业务办结",ids,1);
messageService.add(messageBto);
} }
return ResponseEntity.ok("上传成功"); return ResponseEntity.ok("上传成功");
} }
...@@ -310,11 +318,6 @@ public class BackController { ...@@ -310,11 +318,6 @@ public class BackController {
List<StatusEnum> statusEnums = new ArrayList<>(); List<StatusEnum> statusEnums = new ArrayList<>();
statusEnums.add(StatusEnum.WAIT_UPLOAD_BACK_FILE_2); statusEnums.add(StatusEnum.WAIT_UPLOAD_BACK_FILE_2);
TaskDisposeUtil.isNotSubmit(taskBto.getBillStatus(),statusEnums); TaskDisposeUtil.isNotSubmit(taskBto.getBillStatus(),statusEnums);
//不上传单据
// if (fileVo.getStatus()==0){
// taskService.moveToArchive(taskBto);
// }
// else {
AllotBackBill allotBackBill = allotBackBillService.getOne(taskBto.getBillId()); AllotBackBill allotBackBill = allotBackBillService.getOne(taskBto.getBillId());
List<Integer> idList = new ArrayList<>(); List<Integer> idList = new ArrayList<>();
if (fileVo.getReceiveUseraId()!=null) { if (fileVo.getReceiveUseraId()!=null) {
...@@ -344,7 +347,13 @@ public class BackController { ...@@ -344,7 +347,13 @@ public class BackController {
MessageBto messageBto = new MessageBto(taskBto.getId(), taskBto.getBusinessType(), "被选为经办人", idList, 1); MessageBto messageBto = new MessageBto(taskBto.getId(), taskBto.getBusinessType(), "被选为经办人", idList, 1);
messageService.add(messageBto); messageService.add(messageBto);
} }
// } //发送阅知信息
List<Integer> userIds = userPublicService.findOtherUser(userUtils.getCurrentUserId());
userIds.addAll(userDao.findAllByUnitsId(userPublicService.findUnitIdByName(allotBackBill.getReceiveUnit())).stream()
.map(User::getUserId)
.collect(Collectors.toList()));
MessageBto messageBto = new MessageBto(taskBto.getParentTaskId(),taskBto.getBusinessType(),"业务办结",userIds,1);
messageService.add(messageBto);
return ResponseEntity.ok("OK"); return ResponseEntity.ok("OK");
} }
......
...@@ -29,7 +29,7 @@ public class FileUploadVo { ...@@ -29,7 +29,7 @@ public class FileUploadVo {
@ApiModelProperty(value = "配发单附件URL") @ApiModelProperty(value = "配发单附件URL")
private String billFileUrl; private String billFileUrl;
@NotNull(message = "status不能为空") // @NotNull(message = "status不能为空")
@ApiModelProperty(value = "是否上传单据(0:否,1:是)") @ApiModelProperty(value = "是否上传单据(0:否,1:是)")
private Integer status; private Integer status;
......
...@@ -24,7 +24,7 @@ public class FileVo { ...@@ -24,7 +24,7 @@ public class FileVo {
@ApiModelProperty(value = "配发附件") @ApiModelProperty(value = "配发附件")
private List<FileRet> allotFiles; private List<FileRet> allotFiles;
@NotNull(message = "status不能为空") // @NotNull(message = "status不能为空")
@ApiModelProperty(value = "是否上传单据(0:否,1:是)") @ApiModelProperty(value = "是否上传单据(0:否,1:是)")
private Integer status; private Integer status;
......
...@@ -13,6 +13,7 @@ import com.tykj.dev.device.library.subject.Dto.DeviceLogDto; ...@@ -13,6 +13,7 @@ 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.DeviceLibrarySelectVo; import com.tykj.dev.device.library.subject.vo.DeviceLibrarySelectVo;
import com.tykj.dev.device.library.subject.vo.FileVo; import com.tykj.dev.device.library.subject.vo.FileVo;
import com.tykj.dev.device.packing.controller.PackingController;
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.task.repository.TaskDao; import com.tykj.dev.device.task.repository.TaskDao;
...@@ -103,6 +104,9 @@ public class DeviceApplyController { ...@@ -103,6 +104,9 @@ public class DeviceApplyController {
@Autowired @Autowired
private UserDao userDao; private UserDao userDao;
@Autowired
private PackingController packingController;
@ApiOperation(value = "发起装备申请", notes = "可以通过这个接口发起装备申请") @ApiOperation(value = "发起装备申请", notes = "可以通过这个接口发起装备申请")
@PostMapping("/addDeviceApplyBill") @PostMapping("/addDeviceApplyBill")
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
...@@ -112,13 +116,27 @@ public class DeviceApplyController { ...@@ -112,13 +116,27 @@ public class DeviceApplyController {
Integer userId = userUtils.getCurrentUserId(); Integer userId = userUtils.getCurrentUserId();
//发起任务 //发起任务
TaskBto taskBto; TaskBto taskBto;
String title;
switch (deviceApplySaveVo.getApplyType()){
case 2:
title = "退役申请";
break;
case 3:
title = "报废申请";
break;
case 4:
title = "销毁申请";
break;
default:
title = "装备申请";
}
if (userUtils.getCurrentUnitLevel()==1){ if (userUtils.getCurrentUnitLevel()==1){
deviceApplyBillEntity.setApplyStatus(3); deviceApplyBillEntity.setApplyStatus(3);
deviceApplyBillService.update(deviceApplyBillEntity); deviceApplyBillService.update(deviceApplyBillEntity);
List<Integer> userIds = new ArrayList<>(); List<Integer> userIds = new ArrayList<>();
userIds.add(userId); userIds.add(userId);
userIds.add(0); userIds.add(0);
taskBto = new TaskBto(StatusEnum.WAIT_APPLY_FILE.id, "申请业务", null, ".", deviceApplyBillEntity.getId(), 9,userUtils.getCurrentUnitId(), 1, "country", userIds); taskBto = new TaskBto(StatusEnum.WAIT_APPLY_FILE.id, title, null, ".", deviceApplyBillEntity.getId(), 9,userUtils.getCurrentUnitId(), 1, "country", userIds);
} }
else { else {
//指定批复人 //指定批复人
...@@ -126,14 +144,14 @@ public class DeviceApplyController { ...@@ -126,14 +144,14 @@ public class DeviceApplyController {
List<Integer> userIds = new ArrayList<>(); List<Integer> userIds = new ArrayList<>();
userIds.add(userId); userIds.add(userId);
userIds.add(deviceApplySaveVo.getReplyUseraId()); userIds.add(deviceApplySaveVo.getReplyUseraId());
taskBto = new TaskBto(StatusEnum.DEVICE_APPLY_CONFIRM.id, "申请业务", null, ".", deviceApplyBillEntity.getId(), 9, userPublicService.findUnitIdByName(deviceApplySaveVo.getReplyUnit()), 1, null, userIds); taskBto = new TaskBto(StatusEnum.DEVICE_APPLY_CONFIRM.id, title, null, ".", deviceApplyBillEntity.getId(), 9, userPublicService.findUnitIdByName(deviceApplySaveVo.getReplyUnit()), 1, null, userIds);
} }
//不指定批复人 //不指定批复人
else { else {
List<Integer> userIds = new ArrayList<>(); List<Integer> userIds = new ArrayList<>();
userIds.add(userId); userIds.add(userId);
userIds.add(0); userIds.add(0);
taskBto = new TaskBto(StatusEnum.DEVICE_APPLY_CONFIRM.id, "申请业务", null, ".", deviceApplyBillEntity.getId(), 9, userPublicService.findUnitIdByName(deviceApplySaveVo.getReplyUnit()), 1, null, userIds); taskBto = new TaskBto(StatusEnum.DEVICE_APPLY_CONFIRM.id, title, null, ".", deviceApplyBillEntity.getId(), 9, userPublicService.findUnitIdByName(deviceApplySaveVo.getReplyUnit()), 1, null, userIds);
} }
} }
TaskBto taskBto1 = taskService.start(taskBto); TaskBto taskBto1 = taskService.start(taskBto);
...@@ -378,6 +396,12 @@ public class DeviceApplyController { ...@@ -378,6 +396,12 @@ public class DeviceApplyController {
@PostMapping("/uploadFile") @PostMapping("/uploadFile")
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public ResponseEntity uploadFile(@RequestBody @Validated UploadApplyFile uploadApplyFile) { public ResponseEntity uploadFile(@RequestBody @Validated UploadApplyFile uploadApplyFile) {
for(ReplyVo replyVo:uploadApplyFile.getReplyVos()){
ResponseEntity responseEntity = packingController.seqsExist(replyVo.getId(),replyVo.getNum(),replyVo.getSeqInterval());
if (!"ok".equals(responseEntity.getBody())){
return responseEntity;
}
}
TaskBto taskBto = taskService.get(uploadApplyFile.getTaskId()); TaskBto taskBto = taskService.get(uploadApplyFile.getTaskId());
taskService.addInvolveUser(taskBto,userUtils.getCurrentUserId()); taskService.addInvolveUser(taskBto,userUtils.getCurrentUserId());
taskService.moveToNext(taskBto); taskService.moveToNext(taskBto);
...@@ -387,8 +411,14 @@ public class DeviceApplyController { ...@@ -387,8 +411,14 @@ public class DeviceApplyController {
if(uploadApplyFile.getReplyVos()!=null&&uploadApplyFile.getReplyVos().size()>0){ if(uploadApplyFile.getReplyVos()!=null&&uploadApplyFile.getReplyVos().size()>0){
deviceApplyBill.setReplyVos(JacksonUtil.toJSon(uploadApplyFile.getReplyVos())); deviceApplyBill.setReplyVos(JacksonUtil.toJSon(uploadApplyFile.getReplyVos()));
} }
if (uploadApplyFile.getReplayNumber()!=null){
deviceApplyBill.setReplayNumber(uploadApplyFile.getReplayNumber());
}
if(uploadApplyFile.getReplyFiles()!=null&&uploadApplyFile.getReplyFiles().size()>0){
deviceApplyBill.setReplyFiles(FilesUtil.stringFileToList(uploadApplyFile.getReplyFiles()));
}
deviceApplyBillService.update(deviceApplyBill); deviceApplyBillService.update(deviceApplyBill);
return ResponseEntity.ok("上传成功"); return ResponseEntity.ok("ok");
} }
@ApiOperation(value = "确认接收申请装备", notes = "确认接收申请装备") @ApiOperation(value = "确认接收申请装备", notes = "确认接收申请装备")
......
package com.tykj.dev.device.apply.subject.domin; package com.tykj.dev.device.apply.subject.domin;
import com.tykj.dev.device.apply.subject.vo.ApplyBillDetailVo;
import com.tykj.dev.device.apply.subject.vo.ReplyVo; import com.tykj.dev.device.apply.subject.vo.ReplyVo;
import com.tykj.dev.device.file.entity.FileRet; import com.tykj.dev.device.file.entity.FileRet;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
...@@ -93,8 +94,12 @@ public class DeviceApplyBill { ...@@ -93,8 +94,12 @@ public class DeviceApplyBill {
* 列装库主键idx数量(,作为分隔符),例如1x2,2x3,意为列装库id为1的申请2件,id为2的申请3件 * 列装库主键idx数量(,作为分隔符),例如1x2,2x3,意为列装库id为1的申请2件,id为2的申请3件
*/ */
@Column(name = "apply_detail",columnDefinition = "TEXT") @Column(name = "apply_detail",columnDefinition = "TEXT")
@ApiModelProperty(value = "列装库主键idx数量(,作为分隔符),例如1x2,2x3,意为列装库id为1的申请2件,id为2的申请3件") @ApiModelProperty(value = "列装库主键idx数量(x作为分隔符),例如1x2x2x3,意为列装库id为1的申请2件,id为2的申请3件")
private String applyDetail; private String applyDetail;
@Column(name = "apply_stat",columnDefinition = "TEXT")
@ApiModelProperty(value = "申请统计Json")
private String applyStat;
/** /**
* 创建用户id * 创建用户id
*/ */
...@@ -162,4 +167,7 @@ public class DeviceApplyBill { ...@@ -162,4 +167,7 @@ public class DeviceApplyBill {
@Transient @Transient
private List<ReplyVo> replyVoList = new ArrayList<>(); private List<ReplyVo> replyVoList = new ArrayList<>();
@Transient
private List<ApplyBillDetailVo> applyBillDetailVos = new ArrayList<>();
} }
...@@ -4,11 +4,6 @@ import io.swagger.annotations.ApiModel; ...@@ -4,11 +4,6 @@ import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import javax.validation.Valid;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import java.util.List;
/** /**
* @author dengdiyi * @author dengdiyi
*/ */
...@@ -16,16 +11,16 @@ import java.util.List; ...@@ -16,16 +11,16 @@ import java.util.List;
@ApiModel("入库详情类") @ApiModel("入库详情类")
public class ApplyBillDetailVo { public class ApplyBillDetailVo {
@ApiModelProperty(value = "配件列表") // @NotNull(message = "packingId不能为空")
List<ApplyBillDetailVo> list; // @Min(value = 1,message = "packingId不能小于1")
@NotNull(message = "packingId不能为空")
@Min(value = 1,message = "packingId不能小于1")
@ApiModelProperty(value = "列装id") @ApiModelProperty(value = "列装id")
private Integer packingId; private Integer packingId;
@NotNull(message = "storageCount不能为空") // @NotNull(message = "storageCount不能为空")
@Min(value = 1,message = "storageCount不能小于1") // @Min(value = 1,message = "storageCount不能小于1")
@ApiModelProperty(value = "申请数量") @ApiModelProperty(value = "申请数量")
private Integer storageCount; private Integer storageCount;
@ApiModelProperty(value = "已入库数量")
private Integer completeCount = 0;
} }
...@@ -3,10 +3,12 @@ package com.tykj.dev.device.apply.subject.vo; ...@@ -3,10 +3,12 @@ package com.tykj.dev.device.apply.subject.vo;
import com.tykj.dev.device.apply.subject.domin.DeviceApplyBill; import com.tykj.dev.device.apply.subject.domin.DeviceApplyBill;
import com.tykj.dev.device.file.entity.FileRet; import com.tykj.dev.device.file.entity.FileRet;
import com.tykj.dev.device.file.service.FilesUtil; import com.tykj.dev.device.file.service.FilesUtil;
import com.tykj.dev.misc.base.BeanHelper;
import com.tykj.dev.misc.utils.JacksonUtil;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import org.springframework.beans.BeanUtils; import org.modelmapper.ModelMapper;
import javax.validation.Valid; import javax.validation.Valid;
import javax.validation.constraints.Min; import javax.validation.constraints.Min;
...@@ -21,11 +23,11 @@ import java.util.List; ...@@ -21,11 +23,11 @@ import java.util.List;
@ApiModel("装备申请存储类") @ApiModel("装备申请存储类")
public class DeviceApplySaveVo { public class DeviceApplySaveVo {
@NotNull(message = "applyNumber不能为空") // @NotNull(message = "applyNumber不能为空")
@ApiModelProperty(value = "申请文号") @ApiModelProperty(value = "申请文号")
private String applyNumber; private String applyNumber;
@NotNull(message = "replayNumber不能为空") // @NotNull(message = "replayNumber不能为空")
@ApiModelProperty(value = "批复文号") @ApiModelProperty(value = "批复文号")
private String replayNumber; private String replayNumber;
...@@ -67,17 +69,25 @@ public class DeviceApplySaveVo { ...@@ -67,17 +69,25 @@ public class DeviceApplySaveVo {
private Integer applyType; private Integer applyType;
public DeviceApplyBill toDo() { public DeviceApplyBill toDo() {
DeviceApplyBill deviceApplyBillEntity = new DeviceApplyBill(); ModelMapper mapper = BeanHelper.getUserMapper();
BeanUtils.copyProperties(this, deviceApplyBillEntity); DeviceApplyBill deviceApplyBillEntity = mapper.map(this, DeviceApplyBill.class);
deviceApplyBillEntity.setApplyStatus(0); deviceApplyBillEntity.setApplyStatus(0);
StringBuffer stringBuffer = new StringBuffer(); StringBuffer stringBuffer = new StringBuffer();
stringBuffer.append("x"); stringBuffer.append("x");
if (this.storageBillDetailVoList.size() > 0) { if (this.storageBillDetailVoList.size() > 0) {
for (ApplyBillDetailVo s : storageBillDetailVoList) { for (ApplyBillDetailVo s : storageBillDetailVoList) {
stringBuffer.append(s.getPackingId()).append("x"); stringBuffer.append(s.getPackingId()).append("x");
stringBuffer.append(s.getStorageCount()).append("x"); if (s.getStorageCount()!=null) {
stringBuffer.append(s.getStorageCount()).append("x");
}
else {
stringBuffer.append(0).append("x");
}
} }
} }
if (this.storageBillDetailVoList!=null){
deviceApplyBillEntity.setApplyStat(JacksonUtil.toJSon(this.storageBillDetailVoList));
}
deviceApplyBillEntity.setApplyDetail(stringBuffer.toString()); deviceApplyBillEntity.setApplyDetail(stringBuffer.toString());
if(this.applyFiles!=null&&this.applyFiles.size()>0){ if(this.applyFiles!=null&&this.applyFiles.size()>0){
deviceApplyBillEntity.setApplyFiles(FilesUtil.stringFileToList(this.applyFiles)); deviceApplyBillEntity.setApplyFiles(FilesUtil.stringFileToList(this.applyFiles));
......
...@@ -26,4 +26,10 @@ public class UploadApplyFile { ...@@ -26,4 +26,10 @@ public class UploadApplyFile {
@ApiModelProperty(value = "申请批复装备") @ApiModelProperty(value = "申请批复装备")
private List<ReplyVo> replyVos; private List<ReplyVo> replyVos;
@ApiModelProperty(value = "批复文号")
private String replayNumber;
@ApiModelProperty(value = "批复文号附件名")
private List<FileRet> replyFiles;
} }
...@@ -245,8 +245,8 @@ public enum LogType { ...@@ -245,8 +245,8 @@ public enum LogType {
ALLOT_BACK_7(103, ALLOT_BACK.id, WAIT_UPLOAD_ALLOT_BACK_FILE.id, ARCHIVE.id, "取消上传退回单"), ALLOT_BACK_7(103, ALLOT_BACK.id, WAIT_UPLOAD_ALLOT_BACK_FILE.id, ARCHIVE.id, "取消上传退回单"),
REPAIR_SEND_13(104, REPAIR.id, WAIT_UPLOAD_FILE.id, ARCHIVE.id, "取消上传送修单"), REPAIR_SEND_13(104, REPAIR.id, WAIT_UPLOAD_FILE.id, ARCHIVE.id, "取消上传送修单"),
REPAIR_BACK_9(105,REPAIR_BACK.id, WAIT_UPLOAD_BACK_FILE.id, ARCHIVE.id, "取消上传领取单"), REPAIR_BACK_9(105,REPAIR_BACK.id, WAIT_UPLOAD_BACK_FILE.id, ARCHIVE.id, "取消上传领取单"),
APPLY_5(106,APPLY.id, WAIT_APPLY_FILE.id, WAIT_CONFIRM_APPLY_DEVICE.id, "上传申请回执单"), APPLY_5(106,APPLY.id, WAIT_APPLY_FILE.id, WAIT_CONFIRM_APPLY_DEVICE.id, "上传批复单"),
APPLY_6(107,APPLY.id, WAIT_CONFIRM_APPLY_DEVICE.id, END.id, "确认接收申请装备"), APPLY_6(107,APPLY.id, WAIT_CONFIRM_APPLY_DEVICE.id, END.id, "业务办结"),
; ;
public Integer id; public Integer id;
......
...@@ -147,7 +147,7 @@ public class DeviceLibraryController { ...@@ -147,7 +147,7 @@ public class DeviceLibraryController {
@ApiOperation(value = "模糊查询核心装备分页", notes = "可以通过这个接口查询装备列表") @ApiOperation(value = "模糊查询核心装备分页", notes = "可以通过这个接口查询装备列表")
@PostMapping("/core/feature/summary") @PostMapping("/core/feature/summary")
public ResponseEntity selectCoreDevicePage(@RequestBody DeviceLibrarySelectVo deviceLibrarySelectVo) { public ResponseEntity selectCoreDevicePage(@RequestBody DeviceLibrarySelectVo deviceLibrarySelectVo) {
List<DeviceVo> resultList = deviceLibraryService.getCoreDevicePage(deviceLibrarySelectVo, deviceLibrarySelectVo.getPageable()).stream().map(DeviceLibrary::parseVo).collect(Collectors.toList()); List<DeviceVo> resultList = deviceLibraryService.getCoreDevicePage(deviceLibrarySelectVo).stream().map(DeviceLibrary::parseVo).collect(Collectors.toList());
// List<Comparator<DeviceVo>> comparators = new ArrayList<>(); // List<Comparator<DeviceVo>> comparators = new ArrayList<>();
// if (deviceLibrarySelectVo.getOrders().size() > 0) { // if (deviceLibrarySelectVo.getOrders().size() > 0) {
// for (CustomOrder c:deviceLibrarySelectVo.getOrders()) { // for (CustomOrder c:deviceLibrarySelectVo.getOrders()) {
......
...@@ -40,7 +40,7 @@ public interface DeviceLibraryService { ...@@ -40,7 +40,7 @@ public interface DeviceLibraryService {
* @param deviceLibrarySelectVo 装备查询vo * @param deviceLibrarySelectVo 装备查询vo
* @param pageable 获取核心装备分页 * @param pageable 获取核心装备分页
*/ */
List<DeviceLibrary> getCoreDevicePage(DeviceLibrarySelectVo deviceLibrarySelectVo, Pageable pageable); List<DeviceLibrary> getCoreDevicePage(DeviceLibrarySelectVo deviceLibrarySelectVo);
/** /**
* @param deviceLibrarySelectVo 装备查询vo * @param deviceLibrarySelectVo 装备查询vo
......
...@@ -86,7 +86,7 @@ public class DeviceLibraryServiceImpl implements DeviceLibraryService { ...@@ -86,7 +86,7 @@ public class DeviceLibraryServiceImpl implements DeviceLibraryService {
} }
@Override @Override
public List<DeviceLibrary> getCoreDevicePage(DeviceLibrarySelectVo deviceLibrarySelectVo, Pageable pageable) { public List<DeviceLibrary> getCoreDevicePage(DeviceLibrarySelectVo deviceLibrarySelectVo) {
Integer selectUnitId = deviceLibrarySelectVo.getUnitId(); Integer selectUnitId = deviceLibrarySelectVo.getUnitId();
Integer selectAreaId = deviceLibrarySelectVo.getAreaId(); Integer selectAreaId = deviceLibrarySelectVo.getAreaId();
//areaId为null //areaId为null
...@@ -179,7 +179,7 @@ public class DeviceLibraryServiceImpl implements DeviceLibraryService { ...@@ -179,7 +179,7 @@ public class DeviceLibraryServiceImpl implements DeviceLibraryService {
d.setName(deviceLibrarySelectVo.getName()); d.setName(deviceLibrarySelectVo.getName());
d.setContent(deviceLibrarySelectVo.getContent()); d.setContent(deviceLibrarySelectVo.getContent());
//获取所有的核心装备 //获取所有的核心装备
List<DeviceLibrary> libraryEntities = getCoreDevicePage(d, d.getPageable()); List<DeviceLibrary> libraryEntities = getCoreDevicePage(d);
if (libraryEntities.size() > 0) { if (libraryEntities.size() > 0) {
Map<String, List<DeviceLibrary>> map = libraryEntities.stream().collect(groupingBy(deviceLibrary -> deviceLibrary.getModel()+"Ǵ"+deviceLibrary.getName())); Map<String, List<DeviceLibrary>> map = libraryEntities.stream().collect(groupingBy(deviceLibrary -> deviceLibrary.getModel()+"Ǵ"+deviceLibrary.getName()));
//按型号遍历统计各种状态的装备数量 //按型号遍历统计各种状态的装备数量
......
...@@ -171,17 +171,17 @@ public enum StatusEnum { ...@@ -171,17 +171,17 @@ public enum StatusEnum {
/** /**
* 待上传配发单 * 待上传配发单
*/ */
WAIT_UPLOAD_ALLOT_RECEIVE_FILE(303, "待上传配发单"), WAIT_UPLOAD_ALLOT_RECEIVE_FILE(303, "待上传签收单"),
/** /**
* 待上传横向配发单 * 待上传横向配发单
*/ */
WAIT_UPLOAD_CROSS_FILE(311,"待上传配发单"), WAIT_UPLOAD_CROSS_FILE(311,"待上传回执单"),
/** /**
* 待上传纵向配发单 * 待上传纵向配发单
*/ */
WAIT_UPLOAD_ALLOT_FILE(322,"待上传配发单"), WAIT_UPLOAD_ALLOT_FILE(322,"待上传回执单"),
/** /**
* 草稿 * 草稿
...@@ -206,11 +206,11 @@ public enum StatusEnum { ...@@ -206,11 +206,11 @@ public enum StatusEnum {
/** /**
* 等待上传申请回执单 * 等待上传申请回执单
*/ */
WAIT_APPLY_FILE(510, "待上传申请回执单"), WAIT_APPLY_FILE(510, "待上传批复单"),
/** /**
* 等待上传申请回执单 * 等待上传申请回执单
*/ */
WAIT_CONFIRM_APPLY_DEVICE(511, "待确认接收申请装备"), WAIT_CONFIRM_APPLY_DEVICE(511, "批复完成待执行"),
// /** // /**
// * 等待上传申请回执单 // * 等待上传申请回执单
......
...@@ -3,14 +3,20 @@ package com.tykj.dev.device.packing.controller; ...@@ -3,14 +3,20 @@ package com.tykj.dev.device.packing.controller;
import com.tykj.dev.config.swagger.AutoDocument; import com.tykj.dev.config.swagger.AutoDocument;
import com.tykj.dev.device.library.service.DeviceLibraryService; import com.tykj.dev.device.library.service.DeviceLibraryService;
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.DeviceLogUserVo;
import com.tykj.dev.device.packing.repository.PackingLibraryDao; import com.tykj.dev.device.packing.repository.PackingLibraryDao;
import com.tykj.dev.device.packing.repository.PackingLogDao;
import com.tykj.dev.device.packing.service.PackingLibraryService; import com.tykj.dev.device.packing.service.PackingLibraryService;
import com.tykj.dev.device.packing.service.PackingLogService;
import com.tykj.dev.device.packing.subject.domin.PackingLibrary; import com.tykj.dev.device.packing.subject.domin.PackingLibrary;
import com.tykj.dev.device.packing.subject.domin.PackingLog;
import com.tykj.dev.device.packing.subject.vo.*; import com.tykj.dev.device.packing.subject.vo.*;
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.vo.TaskLogUserVo; import com.tykj.dev.device.task.subject.vo.TaskLogUserVo;
import com.tykj.dev.device.user.read.service.MessageService;
import com.tykj.dev.device.user.read.subject.bto.MessageBto;
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;
...@@ -64,6 +70,15 @@ public class PackingController { ...@@ -64,6 +70,15 @@ public class PackingController {
@Autowired @Autowired
DeviceLibraryService deviceLibraryService; DeviceLibraryService deviceLibraryService;
@Autowired
MessageService messageService;
@Autowired
PackingLogDao packingLogDao;
@Autowired
PackingLogService packingLogService;
@ApiOperation(value = "新增列装", notes = "可以通过这个接口发起列装") @ApiOperation(value = "新增列装", notes = "可以通过这个接口发起列装")
@PostMapping("/addPackingLibrary") @PostMapping("/addPackingLibrary")
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
...@@ -183,6 +198,22 @@ public class PackingController { ...@@ -183,6 +198,22 @@ public class PackingController {
packingLibraryService.update(p); packingLibraryService.update(p);
} }
} }
// TaskBto taskBto = new TaskBto(StatusEnum.END.id, "列装业务", null, ".", packingLibrary1.getId(), 1, userUtils.getCurrentUnitId(), 0, null, Collections.singletonList(userUtils.getCurrentUserId()));
// TaskBto saveEntity = taskService.start(taskBto);
String message = "添加列装型号:"+addModel.getModel();
// //添加业务日志
// TaskLogBto taskLogBto2 = new TaskLogBto(saveEntity.getId(), message, null);
// taskLogService.addLog(taskLogBto2);
//添加列装日志
PackingLog packingLog = new PackingLog();
packingLog.setRemark(message);
packingLog.setPackingId(packingLibrary1.getId());
packingLogService.add(packingLog);
//发送阅知信息
List<Integer> userIds = userPublicService.findOtherUser(userUtils.getCurrentUserId());
MessageBto messageBto = new MessageBto(0,1,message,userIds,0);
messageBto.setRecord(packingLibrary1.getId().toString());
messageService.add(messageBto);
return ResponseEntity.ok(packingLibrary1); return ResponseEntity.ok(packingLibrary1);
} }
...@@ -191,13 +222,48 @@ public class PackingController { ...@@ -191,13 +222,48 @@ public class PackingController {
public ResponseEntity addPack(@RequestBody @Validated AddPack addPack){ public ResponseEntity addPack(@RequestBody @Validated AddPack addPack){
PackingLibrary packingLibrary = addPack.toDo(); PackingLibrary packingLibrary = addPack.toDo();
PackingLibrary packingLibrary1 = packingLibraryService.getOne(addPack.getPartParentId()); PackingLibrary packingLibrary1 = packingLibraryService.getOne(addPack.getPartParentId());
// TaskBto taskBto = new TaskBto(StatusEnum.END.id, "列装业务", null, ".", packingLibrary1.getId(), 1, userUtils.getCurrentUnitId(), 0, null, Collections.singletonList(userUtils.getCurrentUserId()));
// TaskBto saveEntity = taskService.start(taskBto);
if (packingLibrary1.getIsRoot()==1){ if (packingLibrary1.getIsRoot()==1){
packingLibrary.setIsPart(0); packingLibrary.setIsPart(0);
String message = "添加列装装备:"+addPack.getName();
// //添加业务日志
// TaskLogBto taskLogBto2 = new TaskLogBto(saveEntity.getId(), message, null);
// taskLogService.addLog(taskLogBto2);
//发送阅知信息
List<Integer> userIds = userPublicService.findOtherUser(userUtils.getCurrentUserId());
MessageBto messageBto = new MessageBto(0,1,message,userIds,0);
messageBto.setRecord(packingLibrary1.getId().toString());
messageService.add(messageBto);
//添加列装日志
PackingLog packingLog = new PackingLog();
packingLog.setRemark(message);
packingLog.setPackingId(packingLibrary1.getId());
packingLogService.add(packingLog);
} }
else { else {
packingLibrary.setIsPart(1); packingLibrary.setIsPart(1);
String message = "添加列装装备附件:"+addPack.getName();
// //添加业务日志
// TaskLogBto taskLogBto2 = new TaskLogBto(saveEntity.getId(), message, null);
// taskLogService.addLog(taskLogBto2);
//发送阅知信息
List<Integer> userIds = userPublicService.findOtherUser(userUtils.getCurrentUserId());
MessageBto messageBto = new MessageBto(0,1,message,userIds,0);
messageBto.setRecord(packingLibrary1.getId().toString());
messageService.add(messageBto);
//添加列装日志
PackingLog packingLog = new PackingLog();
packingLog.setRemark(message);
packingLog.setPackingId(packingLibrary1.getId());
packingLogService.add(packingLog);
} }
packingLibraryService.addEntity(packingLibrary); PackingLibrary packingLibrary2 = packingLibraryService.addEntity(packingLibrary);
//添加列装日志
PackingLog packingLog = new PackingLog();
packingLog.setRemark("添加列装");
packingLog.setPackingId(packingLibrary2.getId());
packingLogService.add(packingLog);
return ResponseEntity.ok("添加成功"); return ResponseEntity.ok("添加成功");
} }
...@@ -271,6 +337,30 @@ public class PackingController { ...@@ -271,6 +337,30 @@ public class PackingController {
} }
} }
@ApiOperation(value = "判断序列号区间是否存在")
@PostMapping("/seqsExist/{id}/{num}/{seq}")
public ResponseEntity seqsExist(@PathVariable("id") int id,@PathVariable("num") int num,@PathVariable("seq") String seq){
List<DeviceLibrary> deviceLibraries = packingLibraryService.getAllDevSeqs(id);
List<String> existSeqs = deviceLibraries.stream().map(DeviceLibrary::getSeqNumber).collect(Collectors.toList());
List<String> inputSeqs = DeviceSeqUtil.selectDeviceSeqs(seq);
if (inputSeqs.size()!=num){
return ResponseEntity.ok("序列号区间总数为"+inputSeqs.size()+",与装备数量不匹配");
}
else {
if (existSeqs.containsAll(inputSeqs)){
return ResponseEntity.ok("ok");
}
else {
existSeqs.retainAll(inputSeqs);
inputSeqs.removeAll(existSeqs);
StringBuffer stringBuffer = new StringBuffer();
inputSeqs.forEach(s -> stringBuffer.append(s).append(","));
stringBuffer.deleteCharAt(stringBuffer.length()-1);
return ResponseEntity.ok("该型号序列号为"+stringBuffer.toString()+"的装备不存在");
}
}
}
@ApiOperation(value = "编辑列装型号") @ApiOperation(value = "编辑列装型号")
@PostMapping("/update/model") @PostMapping("/update/model")
public ResponseEntity updateModel(@RequestBody @Validated PackingModelEdit packingModelEdit){ public ResponseEntity updateModel(@RequestBody @Validated PackingModelEdit packingModelEdit){
...@@ -341,4 +431,11 @@ public class PackingController { ...@@ -341,4 +431,11 @@ public class PackingController {
PackingLibrary packingLibrary = packingLibraryService.getOne(id); PackingLibrary packingLibrary = packingLibraryService.getOne(id);
return ResponseEntity.ok(packingLibrary.getName()); return ResponseEntity.ok(packingLibrary.getName());
} }
@ApiOperation(value = "获取列装日志")
@GetMapping("/getLogs/{id}")
public ResponseEntity getPackingLogs(@PathVariable("id") int id){
List<DeviceLogUserVo> deviceLogUserVos = packingLogDao.getAllByPackingId(id).stream().map(PackingLog::toVo).collect(Collectors.toList());
return ResponseEntity.ok(deviceLogUserVos);
}
} }
...@@ -7,7 +7,7 @@ import com.tykj.dev.device.library.subject.domin.DeviceLibrary; ...@@ -7,7 +7,7 @@ import com.tykj.dev.device.library.subject.domin.DeviceLibrary;
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.packing.subject.vo.*; import com.tykj.dev.device.packing.subject.vo.*;
import com.tykj.dev.misc.exception.ApiException; import com.tykj.dev.misc.utils.PageUtil;
import com.tykj.dev.misc.utils.ResultUtil; import com.tykj.dev.misc.utils.ResultUtil;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
...@@ -66,8 +66,7 @@ public class PackingLibraryController { ...@@ -66,8 +66,7 @@ public class PackingLibraryController {
@ApiOperation(value = "列装库退装分页查询", notes = "可以通过这个接口进行列装查询") @ApiOperation(value = "列装库退装分页查询", notes = "可以通过这个接口进行列装查询")
@PostMapping("/retired/summary") @PostMapping("/retired/summary")
public ResponseEntity getInvalidPage(@RequestBody PackingLibrarySelectVo packingLibrarySelectVo) { public ResponseEntity getInvalidPage(@RequestBody PackingLibrarySelectVo packingLibrarySelectVo) {
Page<PackingLibrary> packingLibraryEntityPage = packingLibraryService.getInvalidPage(packingLibrarySelectVo, packingLibrarySelectVo.getPageable()); Page<PackingLibrary> packingLibraryEntityPage = PageUtil.getPerPage(packingLibrarySelectVo.getPage(),packingLibrarySelectVo.getSize(),packingLibraryService.getInvalidPage(packingLibrarySelectVo, packingLibrarySelectVo.getPageable()),packingLibrarySelectVo.getPageable());
packingLibraryEntityPage.getContent().forEach(PackingLibrary::setConfigName);
return ResultUtil.success(packingLibraryEntityPage); return ResultUtil.success(packingLibraryEntityPage);
} }
......
...@@ -16,4 +16,6 @@ public interface PackingLibraryDao extends JpaRepository<PackingLibrary, Integer ...@@ -16,4 +16,6 @@ public interface PackingLibraryDao extends JpaRepository<PackingLibrary, Integer
List<PackingLibrary> findAllByIdIn(List<Integer> ids); List<PackingLibrary> findAllByIdIn(List<Integer> ids);
PackingLibrary findByShowOrder(Integer showOrder); PackingLibrary findByShowOrder(Integer showOrder);
List<PackingLibrary> findAllByIsRootAndPackingStatus(Integer isRoot,Integer packingStatus);
} }
package com.tykj.dev.device.packing.repository;
import com.tykj.dev.device.packing.subject.domin.PackingLog;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import java.util.List;
/**
* @author dengdiyi
*/
public interface PackingLogDao extends JpaRepository<PackingLog, Integer>, JpaSpecificationExecutor<PackingLog> {
/**
* @param packingId 列装id
* 通过列装id查询装备履历
*/
List<PackingLog> getAllByPackingId(Integer packingId);
}
...@@ -36,7 +36,7 @@ public interface PackingLibraryService { ...@@ -36,7 +36,7 @@ public interface PackingLibraryService {
* @param packingLibrarySelectVo 列装查询vo * @param packingLibrarySelectVo 列装查询vo
* @param pageable 获取列装库退装分页 * @param pageable 获取列装库退装分页
*/ */
Page<PackingLibrary> getInvalidPage(PackingLibrarySelectVo packingLibrarySelectVo, Pageable pageable); List<PackingLibrary> getInvalidPage(PackingLibrarySelectVo packingLibrarySelectVo, Pageable pageable);
/** /**
* @param packingLibrarySelectVo 列装查询vo * @param packingLibrarySelectVo 列装查询vo
......
package com.tykj.dev.device.packing.service;
import com.tykj.dev.device.packing.subject.domin.PackingLog;
/**
* @author dengdiyi
*/
public interface PackingLogService {
void add(PackingLog packingLog);
}
...@@ -12,10 +12,15 @@ import com.tykj.dev.device.library.subject.domin.DeviceLibrary; ...@@ -12,10 +12,15 @@ import com.tykj.dev.device.library.subject.domin.DeviceLibrary;
import com.tykj.dev.device.library.subject.vo.Script; import com.tykj.dev.device.library.subject.vo.Script;
import com.tykj.dev.device.packing.repository.PackingLibraryDao; import com.tykj.dev.device.packing.repository.PackingLibraryDao;
import com.tykj.dev.device.packing.service.PackingLibraryService; import com.tykj.dev.device.packing.service.PackingLibraryService;
import com.tykj.dev.device.packing.service.PackingLogService;
import com.tykj.dev.device.packing.subject.domin.PackingLibrary; import com.tykj.dev.device.packing.subject.domin.PackingLibrary;
import com.tykj.dev.device.packing.subject.domin.PackingLog;
import com.tykj.dev.device.packing.subject.vo.AllotSeqs; import com.tykj.dev.device.packing.subject.vo.AllotSeqs;
import com.tykj.dev.device.packing.subject.vo.PackingLibrarySelectVo; import com.tykj.dev.device.packing.subject.vo.PackingLibrarySelectVo;
import com.tykj.dev.device.packing.subject.vo.SelectPack; import com.tykj.dev.device.packing.subject.vo.SelectPack;
import com.tykj.dev.device.user.read.service.MessageService;
import com.tykj.dev.device.user.read.subject.bto.MessageBto;
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.exception.ApiException; import com.tykj.dev.misc.exception.ApiException;
import com.tykj.dev.misc.utils.*; import com.tykj.dev.misc.utils.*;
...@@ -29,6 +34,7 @@ import org.springframework.stereotype.Service; ...@@ -29,6 +34,7 @@ import org.springframework.stereotype.Service;
import javax.persistence.Transient; import javax.persistence.Transient;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.sql.Timestamp;
import java.util.*; import java.util.*;
import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletableFuture;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -59,6 +65,15 @@ public class PackingLibraryServiceImpl implements PackingLibraryService { ...@@ -59,6 +65,15 @@ public class PackingLibraryServiceImpl implements PackingLibraryService {
@Autowired @Autowired
private ConfigCache configCache; private ConfigCache configCache;
@Autowired
private PackingLogService packingLogService;
@Autowired
private UserPublicService userPublicService;
@Autowired
private MessageService messageService;
@Override @Override
public PackingLibrary addEntity(PackingLibrary packingLibraryEntity) { public PackingLibrary addEntity(PackingLibrary packingLibraryEntity) {
PackingLibrary packingLibrary = packingLibraryDao.save(packingLibraryEntity); PackingLibrary packingLibrary = packingLibraryDao.save(packingLibraryEntity);
...@@ -97,8 +112,18 @@ public class PackingLibraryServiceImpl implements PackingLibraryService { ...@@ -97,8 +112,18 @@ public class PackingLibraryServiceImpl implements PackingLibraryService {
} }
@Override @Override
public Page<PackingLibrary> getInvalidPage(PackingLibrarySelectVo packingLibrarySelectVo, Pageable pageable) { public List<PackingLibrary> getInvalidPage(PackingLibrarySelectVo packingLibrarySelectVo, Pageable pageable) {
return packingLibraryDao.findAll(getSelectSpecification2(packingLibrarySelectVo), pageable); List<PackingLibrary> packingLibraryEntities = packingLibraryDao.findAll(getSelectSpecification2(packingLibrarySelectVo),pageable.getSort());
packingLibraryEntities.forEach(PackingLibrary::setConfigName);
//返回父子结构
Map<Integer, PackingLibrary> nodeCollect =
packingLibraryEntities.stream().collect(Collectors.toMap(PackingLibrary::getId, packingLibrary -> packingLibrary));
return GetTreeUtils.parseTreeFromDown(
packingLibraryEntities,
PackingLibrary::getId,
packingLibrary -> Optional.ofNullable(nodeCollect.get(packingLibrary.getPartParentId())),
PackingLibrary::addChildNode
);
} }
@Override @Override
...@@ -197,7 +222,15 @@ public class PackingLibraryServiceImpl implements PackingLibraryService { ...@@ -197,7 +222,15 @@ public class PackingLibraryServiceImpl implements PackingLibraryService {
@Override @Override
public void delete(Integer id) { public void delete(Integer id) {
packingLibraryDao.deleteById(id); PackingLibrary packingLibrary = getOne(id);
packingLibrary.setPackingStatus(3);
packingLibrary.setExitTime(Timestamp.from(new Date().toInstant()));
update(packingLibrary);
//添加列装日志
PackingLog packingLog = new PackingLog();
packingLog.setRemark("手动删除列装");
packingLog.setPackingId(id);
packingLogService.add(packingLog);
} }
/** /**
...@@ -275,6 +308,11 @@ public class PackingLibraryServiceImpl implements PackingLibraryService { ...@@ -275,6 +308,11 @@ public class PackingLibraryServiceImpl implements PackingLibraryService {
deleteAll(integer); deleteAll(integer);
}); });
} }
//发送阅知信息
List<Integer> userIds = userPublicService.findOtherUser(userUtils.getCurrentUserId());
MessageBto messageBto = new MessageBto(0,1,"手动删除列装",userIds,0);
messageBto.setRecord(id.toString());
messageService.add(messageBto);
} }
/** /**
...@@ -335,14 +373,11 @@ public class PackingLibraryServiceImpl implements PackingLibraryService { ...@@ -335,14 +373,11 @@ public class PackingLibraryServiceImpl implements PackingLibraryService {
List<Script> scripts = new ArrayList<>(); List<Script> scripts = new ArrayList<>();
List<DeviceLibrary> deviceLibraries = new ArrayList<>(); List<DeviceLibrary> deviceLibraries = new ArrayList<>();
ids.forEach(integer -> deviceLibraries.add(deviceLibraryMap.get(integer))); ids.forEach(integer -> deviceLibraries.add(deviceLibraryMap.get(integer)));
Map<String, List<DeviceLibrary>> map = deviceLibraries.stream().collect(groupingBy(deviceLibrary -> deviceLibrary.getPackingId()+"Ǵ"+deviceLibrary.getAllotTypeName())); Map<Integer, List<DeviceLibrary>> map = deviceLibraries.stream().collect(groupingBy(DeviceLibrary::getPackingId));
for (String s:map.keySet()){ for (Integer packingId:map.keySet()){
String[] strings = s.split("Ǵ"); List<DeviceLibrary> deviceLibraryList = map.get(packingId);
if (strings.length==2) {
Integer packingId = Integer.valueOf(strings[0]);
String allotType = strings[1];
List<DeviceLibrary> deviceLibraryList = map.get(s);
PackingLibrary packingLibrary = getOne(packingId); PackingLibrary packingLibrary = getOne(packingId);
packingLibrary.setConfigName();
Script script = new Script(); Script script = new Script();
script.setId(packingId); script.setId(packingId);
script.setPartParentId(packingLibrary.getPartParentId()); script.setPartParentId(packingLibrary.getPartParentId());
...@@ -352,11 +387,10 @@ public class PackingLibraryServiceImpl implements PackingLibraryService { ...@@ -352,11 +387,10 @@ public class PackingLibraryServiceImpl implements PackingLibraryService {
script.setSecretLevel(packingLibrary.getSecretLevelName()); script.setSecretLevel(packingLibrary.getSecretLevelName());
script.setType(packingLibrary.getTypeName()); script.setType(packingLibrary.getTypeName());
script.setNum(deviceLibraryList.size()); script.setNum(deviceLibraryList.size());
script.setAllotType(allotType); script.setAllotType(packingLibrary.getMatchingRangeName());
script.setAllotTypeNum(deviceLibraryList.get(0).getAllotType()); script.setAllotTypeNum(packingLibrary.getMatchingRange());
script.setSeqNumber(StringSplitUtil.stringListToString(DeviceSeqUtil.getContinuousSeqs(deviceLibraryList.stream().map(DeviceLibrary::getSeqNumber).collect(Collectors.toList())))); script.setSeqNumber(StringSplitUtil.stringListToString(DeviceSeqUtil.getContinuousSeqs(deviceLibraryList.stream().map(DeviceLibrary::getSeqNumber).collect(Collectors.toList()))));
scripts.add(script); scripts.add(script);
}
} }
Map<Integer, Script> nodeCollect = Map<Integer, Script> nodeCollect =
scripts.stream().collect(Collectors.toMap(Script::getId, script -> script)); scripts.stream().collect(Collectors.toMap(Script::getId, script -> script));
...@@ -370,6 +404,7 @@ public class PackingLibraryServiceImpl implements PackingLibraryService { ...@@ -370,6 +404,7 @@ public class PackingLibraryServiceImpl implements PackingLibraryService {
for (Script s:conList) { for (Script s:conList) {
addScript(scriptList,s); addScript(scriptList,s);
} }
scriptList.forEach(script -> script.setChilds(null));
return scriptList; return scriptList;
} }
......
package com.tykj.dev.device.packing.service.impl;
import com.tykj.dev.blockcha.subject.entity.BcHash;
import com.tykj.dev.blockcha.subject.service.BlockChainUtil;
import com.tykj.dev.config.TaskBeanConfig;
import com.tykj.dev.device.library.subject.domin.DeviceLog;
import com.tykj.dev.device.packing.repository.PackingLogDao;
import com.tykj.dev.device.packing.service.PackingLogService;
import com.tykj.dev.device.packing.subject.domin.PackingLog;
import com.tykj.dev.misc.utils.JacksonUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.concurrent.CompletableFuture;
@Service
public class PackingLogServiceImpl implements PackingLogService {
@Autowired
private PackingLogDao packingLogDao;
@Autowired
private BlockChainUtil blockChainUtil;
@Override
public void add(PackingLog packingLog) {
PackingLog packingLog1 = packingLogDao.save(packingLog);
CompletableFuture.runAsync(()->{
PackingLog packingLog2 = packingLogDao.findById(packingLog1.getId()).get();
BcHash bcText = blockChainUtil.sendHash(1000, JacksonUtil.toJSon(packingLog2));
String recordId = bcText.getData().getRecordID();
packingLog2.setRecordId(recordId);
packingLogDao.save(packingLog2);
}, TaskBeanConfig.getThreadPoolTaskScheduler());
}
}
...@@ -208,6 +208,12 @@ public class PackingLibrary { ...@@ -208,6 +208,12 @@ public class PackingLibrary {
@ApiModelProperty(value = "申请数量") @ApiModelProperty(value = "申请数量")
@Transient @Transient
private Integer applyNum; private Integer applyNum;
@ApiModelProperty(value = "待入库数量")
@Transient
private Integer waitNum;
@ApiModelProperty(value = "已入库数量")
@Transient
private Integer completeNum;
@ApiModelProperty(value = "预分配的装备序列号") @ApiModelProperty(value = "预分配的装备序列号")
@Transient @Transient
private String seq; private String seq;
......
package com.tykj.dev.device.packing.subject.domin;
import com.tykj.dev.device.library.subject.vo.DeviceLogUserVo;
import com.tykj.dev.device.user.subject.entity.User;
import com.tykj.dev.device.user.subject.service.UserPublicService;
import com.tykj.dev.misc.base.BeanHelper;
import com.tykj.dev.misc.utils.SpringUtils;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.annotations.SQLDelete;
import org.hibernate.annotations.Where;
import org.modelmapper.ModelMapper;
import org.springframework.data.annotation.CreatedBy;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedBy;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import javax.persistence.*;
import java.util.Date;
/**
* entity class for packing_log
* 列装履历日志
*/
@Data
@Entity
@EntityListeners(AuditingEntityListener.class)
@SQLDelete(sql = "update packing_log set delete_tag = 1 where id = ?")
@Where(clause = "delete_tag = 0")
@ApiModel("列装履历日志")
public class PackingLog {
/**
* 主键id
*/
@Id
@GeneratedValue
@ApiModelProperty(name = "主键id")
@Column(columnDefinition = "integer NOT NULL AUTO_INCREMENT")
private Integer id;
/**
* 装备id
*/
@ApiModelProperty(value = "列装id")
private Integer packingId;
/**
* 操作描述
*/
@ApiModelProperty(value = "操作描述")
private String remark;
/**
* 创建用户id
*/
@ApiModelProperty(value = "创建用户id")
@CreatedBy
private Integer createUserId;
/**
* 创建时间
*/
@ApiModelProperty(value = "创建时间")
@CreatedDate
private Date createTime;
/**
* 更新用户id
*/
@ApiModelProperty(value = "更新用户id")
@LastModifiedBy
private Integer updateUserId;
/**
* 更新时间
*/
@ApiModelProperty(value = "更新时间")
@LastModifiedDate
private Date updateTime;
/**
* 删除标记(0:未删除,1:已删除)
*/
@ApiModelProperty(value = "删除标记(0:未删除,1:已删除)")
private Integer deleteTag = 0;
@ApiModelProperty(value = "区块链记录id")
private String recordId;
/**
* dto类转化为vo类
*/
public DeviceLogUserVo toVo() {
UserPublicService userPublicService = SpringUtils.getBean("userPublicServiceImpl");
//复制相同属性
ModelMapper modelMapper = BeanHelper.getUserMapper();
DeviceLogUserVo deviceLogUserVo = modelMapper.map(this, DeviceLogUserVo.class);
//set vo字段
if (userPublicService != null && this.createUserId != null) {
User user = userPublicService.getOne(this.createUserId);
deviceLogUserVo.setUser(user.getName());
deviceLogUserVo.setUnit(userPublicService.findUnitsNameByUserId(this.createUserId));
deviceLogUserVo.setPhoneNum(user.getMobile());
}
return deviceLogUserVo;
}
}
...@@ -193,8 +193,6 @@ public class RepairController { ...@@ -193,8 +193,6 @@ public class RepairController {
if (repairBillSaveVo.getScriptSaveVos()!=null){ if (repairBillSaveVo.getScriptSaveVos()!=null){
deviceRepairSendBillEntity.setScriptJson(JacksonUtil.toJSon(repairBillSaveVo.getScriptSaveVos())); deviceRepairSendBillEntity.setScriptJson(JacksonUtil.toJSon(repairBillSaveVo.getScriptSaveVos()));
} }
// repairBill.setRepairStatus(0);
//更新维修单和送修单状态
//如果当前为省向国家发起的 //如果当前为省向国家发起的
if (level == 1) { if (level == 1) {
repairBill.setRepairStatus(4); repairBill.setRepairStatus(4);
...@@ -208,9 +206,7 @@ public class RepairController { ...@@ -208,9 +206,7 @@ public class RepairController {
} }
repairBill.setStartUserB(repairBillSaveVo.getAgent()); repairBill.setStartUserB(repairBillSaveVo.getAgent());
repairBill.setStartUserA(userPublicService.getOne(repairBillSaveVo.getStartUseraId()).getName()); repairBill.setStartUserA(userPublicService.getOne(repairBillSaveVo.getStartUseraId()).getName());
// repairBill.setStartUserB(userPublicService.getOne(repairBillSaveVo.getStartUserbId()).getName());
//生成单位电子签章id //生成单位电子签章id
// Long signId = snowflake.creatNextId();
Long signId2 = snowflake.creatNextId(); Long signId2 = snowflake.creatNextId();
if (repairBillSaveVo.getLeftSignatureId()!=null) { if (repairBillSaveVo.getLeftSignatureId()!=null) {
repairBill.setLeftSignatureId(repairBillSaveVo.getLeftSignatureId()); repairBill.setLeftSignatureId(repairBillSaveVo.getLeftSignatureId());
...@@ -226,8 +222,6 @@ public class RepairController { ...@@ -226,8 +222,6 @@ public class RepairController {
userIds.add(userId); userIds.add(userId);
userIds.add(0); userIds.add(0);
//存业务日志 //存业务日志
List<FileVo> fileVoList = new ArrayList<>();
// fileVoList.add(new FileVo("出库确认单", repairBillSaveVo.getFileName(), repairBillSaveVo.getFileUrl()));
deviceRepairSendBillEntity.setRepairStatus(0); deviceRepairSendBillEntity.setRepairStatus(0);
deviceRepairSendBillEntity.setSendTime(new Date()); deviceRepairSendBillEntity.setSendTime(new Date());
StringBuffer stringBuffer = new StringBuffer(); StringBuffer stringBuffer = new StringBuffer();
...@@ -367,12 +361,6 @@ public class RepairController { ...@@ -367,12 +361,6 @@ 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) {
// ResultObj resultObj = (ResultObj) responseEntity.getBody();
// TaskBto taskBto = (TaskBto) Objects.requireNonNull(resultObj).getData();
// TaskBto parentTask = taskService.get(deviceRepairBillSaveVo.getTaskId());
// taskBto.setParentTaskId(parentTask.getId());
// taskBto.setNodeIdDetail(parentTask.getNodeIdDetail() + deviceRepairBillSaveVo.getTaskId() + ".");
// taskService.update(taskBto);
return createRepair(deviceRepairBillSaveVo); return createRepair(deviceRepairBillSaveVo);
} }
...@@ -495,9 +483,12 @@ public class RepairController { ...@@ -495,9 +483,12 @@ public class RepairController {
repairSendBill.setRepairUseraId(userId); repairSendBill.setRepairUseraId(userId);
taskService.addInvolveUser(taskBto, userId); taskService.addInvolveUser(taskBto, userId);
} }
List<Integer> ids = userPublicService.findOtherUser(userUtils.getCurrentUserId());
ids.addAll(userDao.findAllByUnitsId(userPublicService.findUnitIdByName(repairBill.getSendUnit())).stream()
.map(User::getUserId)
.collect(Collectors.toList()));
//存业务日志 //存业务日志
List<FileVo> fileVoList = new ArrayList<>(); List<FileVo> fileVoList = new ArrayList<>();
// fileVoList.add(new FileVo("入库确认单", repairSendBill.getReceiveFileName(), repairSendBill.getReceiveFileUrl()));
//更新维修单和送修单 //更新维修单和送修单
repairBill.setRepairStatus(4); repairBill.setRepairStatus(4);
repairBill.setRepairUserB(userPublicService.getOne(repairReceiveVo.getReceiveUserbId()).getName()); repairBill.setRepairUserB(userPublicService.getOne(repairReceiveVo.getReceiveUserbId()).getName());
...@@ -516,12 +507,7 @@ public class RepairController { ...@@ -516,12 +507,7 @@ public class RepairController {
repairSendBill.setRepairReciveCheckDetail(repairReceiveVo.getReceiveCheckDetail()); repairSendBill.setRepairReciveCheckDetail(repairReceiveVo.getReceiveCheckDetail());
repairSendBill.setRepairReciveCheckResult(repairReceiveVo.getReceiveCheckResult()); repairSendBill.setRepairReciveCheckResult(repairReceiveVo.getReceiveCheckResult());
repairSendBill.setRepairUserbId(repairReceiveVo.getReceiveUserbId()); repairSendBill.setRepairUserbId(repairReceiveVo.getReceiveUserbId());
//任务推至下一阶段
// taskService.moveToSpecial(taskBto,StatusEnum.REPAIRING);
if (repairReceiveVo.getStatus()==0) { if (repairReceiveVo.getStatus()==0) {
// if (repairSendBill.getBillFileName()!=null&&repairSendBill.getBillFileUrl()!=null) {
// fileVoList.add(new FileVo("维修单", repairSendBill.getBillFileName(), repairSendBill.getBillFileUrl()));
// }
if (repairReceiveVo.getReceiveFiles()!=null&&repairReceiveVo.getReceiveFiles().size()>0){ if (repairReceiveVo.getReceiveFiles()!=null&&repairReceiveVo.getReceiveFiles().size()>0){
repairReceiveVo.getReceiveFiles().forEach(fileRet -> { repairReceiveVo.getReceiveFiles().forEach(fileRet -> {
fileVoList.add(new FileVo("维修单", fileRet.getName(), fileRet.getPreviewPath())); fileVoList.add(new FileVo("维修单", fileRet.getName(), fileRet.getPreviewPath()));
...@@ -531,12 +517,14 @@ public class RepairController { ...@@ -531,12 +517,14 @@ public class RepairController {
taskService.moveToEnd(taskBto); taskService.moveToEnd(taskBto);
//子任务完结 //子任务完结
taskService.moveAllSonNodeToEnd(taskBto.getId()); taskService.moveAllSonNodeToEnd(taskBto.getId());
//阅知
MessageBto messageBto = new MessageBto(taskBto.getId(),taskBto.getBusinessType(),"业务办结",ids,1);
messageService.add(messageBto);
} }
else { else {
taskService.moveToSpecial(taskBto,StatusEnum.WAIT_UPLOAD_FILE); taskService.moveToSpecial(taskBto,StatusEnum.WAIT_UPLOAD_FILE);
} }
deviceRepairSendBillService.update(repairSendBill); deviceRepairSendBillService.update(repairSendBill);
// taskService.update(taskService.moveToNext(taskBto, repairReceiveVo.getReceiveUserbId()));
//分隔装备id //分隔装备id
String[] strings = deviceIdDetail.split("x"); String[] strings = deviceIdDetail.split("x");
//存接收无误的装备id //存接收无误的装备id
...@@ -569,16 +557,6 @@ public class RepairController { ...@@ -569,16 +557,6 @@ public class RepairController {
} }
} }
} }
//获取所有父业务id
// List<Integer> fathers = StringSplitUtil.taskIdSplit(taskBto.getNodeIdDetail());
// 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 -> { repairDetailEntities.forEach(repairDetail -> {
repairDetail.setLocationUnit(userUtils.getCurrentUserUnitName()); repairDetail.setLocationUnit(userUtils.getCurrentUserUnitName());
...@@ -598,10 +576,6 @@ public class RepairController { ...@@ -598,10 +576,6 @@ public class RepairController {
MessageBto messageBto = new MessageBto(taskBto.getId(), taskBto.getBusinessType(), "被选为签发人", idList1, 1); MessageBto messageBto = new MessageBto(taskBto.getId(), taskBto.getBusinessType(), "被选为签发人", idList1, 1);
messageService.add(messageBto); messageService.add(messageBto);
} }
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(),"接收维修装备",ids,1); MessageBto messageBto = new MessageBto(taskBto.getId(),taskBto.getBusinessType(),"接收维修装备",ids,1);
messageService.add(messageBto); messageService.add(messageBto);
myWebSocket.sendMessage1(); myWebSocket.sendMessage1();
...@@ -621,9 +595,16 @@ public class RepairController { ...@@ -621,9 +595,16 @@ public class RepairController {
taskService.moveToArchive(taskBto); taskService.moveToArchive(taskBto);
} }
else { else {
RepairSendBill repairSendBill = deviceRepairSendBillDao.findByDeviceRepairBillId(taskBto.getBillId());
List<Integer> ids = userPublicService.findOtherUser(userId);
ids.addAll(userDao.findAllByUnitsId(userPublicService.findUnitIdByName(repairSendBill.getSendUnit())).stream()
.map(User::getUserId)
.collect(Collectors.toList()));
taskService.moveToEnd(taskBto); taskService.moveToEnd(taskBto);
taskService.moveAllSonNodeToEnd(taskBto.getId()); taskService.moveAllSonNodeToEnd(taskBto.getId());
RepairSendBill repairSendBill = deviceRepairSendBillDao.findByDeviceRepairBillId(taskBto.getBillId()); //阅知
MessageBto messageBto = new MessageBto(taskBto.getId(),taskBto.getBusinessType(),"业务办结",ids,1);
messageService.add(messageBto);
repairSendBill.setBillFileName(fileUploadVo.getBillFileName()); repairSendBill.setBillFileName(fileUploadVo.getBillFileName());
repairSendBill.setBillFileUrl(fileUploadVo.getBillFileUrl()); repairSendBill.setBillFileUrl(fileUploadVo.getBillFileUrl());
List<FileVo> fileVoList = new ArrayList<>(); List<FileVo> fileVoList = new ArrayList<>();
...@@ -634,7 +615,6 @@ public class RepairController { ...@@ -634,7 +615,6 @@ public class RepairController {
repairSendBill.setReceiveFiles(FilesUtil.stringFileToList(fileUploadVo.getReceiveFiles())); repairSendBill.setReceiveFiles(FilesUtil.stringFileToList(fileUploadVo.getReceiveFiles()));
} }
deviceRepairSendBillService.update(repairSendBill); deviceRepairSendBillService.update(repairSendBill);
// fileVoList.add(new FileVo("维修单", repairSendBill.getBillFileName(), repairSendBill.getBillFileUrl()));
//添加装备日志 //添加装备日志
List<Integer> deviceIds = StringSplitUtil.split(repairSendBill.getRepairDeviceCheckDetail()); List<Integer> deviceIds = StringSplitUtil.split(repairSendBill.getRepairDeviceCheckDetail());
deviceIds.forEach(integer -> { deviceIds.forEach(integer -> {
...@@ -717,48 +697,6 @@ public class RepairController { ...@@ -717,48 +697,6 @@ public class RepairController {
} }
} }
@ApiOperation(value = "修好装备出库查询", notes = "可以通过这个接口修好装备出库查询")
@GetMapping(value = "/backDeviceSelect/{id}")
public ResponseEntity backDeviceSelect(@PathVariable("id") int id) {
RepairOutPutDeviceVo repairOutPutDeviceVo = new RepairOutPutDeviceVo();
//获取业务和账单
TaskBto taskBto = taskService.get(id);
RepairBill repairBill = deviceRepairBillService.getOne(taskBto.getBillId());
repairOutPutDeviceVo.setRepairBill(repairBill);
List<DeviceLibrary> deviceLibraryEntities = new ArrayList<>();
//筛选所有修好装备或换新装备的id
List<Integer> idList = deviceRepairDetailService.findByBillId(taskBto.getBillId()).stream()
.filter(deviceRepairDetailEntity -> deviceRepairDetailEntity.getRepairStatus().equals(2) || deviceRepairDetailEntity.getRepairStatus().equals(3))
.map(RepairDetail::getDeviceId)
.collect(Collectors.toList());
//根据id添加装备
if (idList.size() > 0) {
idList.forEach(integer -> deviceLibraryEntities.add(deviceLibraryService.getOne(integer)));
}
repairOutPutDeviceVo.setDeviceLibraries(deviceLibraryEntities);
return ResultUtil.success(repairOutPutDeviceVo);
}
@ApiOperation(value = "往上维修出库装备查询", notes = "可以通过这个接口往上维修出库装备查询")
@GetMapping(value = "/sendDeviceSelect/{id}")
public ResponseEntity sendDeviceSelect(@PathVariable("id") int id) {
RepairOutPutDeviceVo repairOutPutDeviceVo = new RepairOutPutDeviceVo();
//获取业务和账单
TaskBto taskBto = taskService.get(id);
RepairBill repairBill = deviceRepairBillService.getOne(taskBto.getBillId());
repairOutPutDeviceVo.setRepairBill(repairBill);
List<DeviceLibrary> deviceLibraryEntities = new ArrayList<>();
//筛选所有还没修好装备的id
List<Integer> idList = deviceRepairDetailService.findByBillId(taskBto.getBillId()).stream()
.filter(deviceRepairDetailEntity -> deviceRepairDetailEntity.getRepairStatus().equals(1))
.map(RepairDetail::getDeviceId)
.collect(Collectors.toList());
//根据id添加装备
idList.forEach(integer -> deviceLibraryEntities.add(deviceLibraryService.getOne(integer)));
repairOutPutDeviceVo.setDeviceLibraries(deviceLibraryEntities);
return ResultUtil.success(repairOutPutDeviceVo);
}
@ApiOperation(value = "修好装备出库", notes = "可以通过这个接口修好装备出库") @ApiOperation(value = "修好装备出库", notes = "可以通过这个接口修好装备出库")
@PostMapping(value = "/back") @PostMapping(value = "/back")
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
...@@ -778,19 +716,15 @@ public class RepairController { ...@@ -778,19 +716,15 @@ public class RepairController {
}); });
} }
//获取当前维修业务,维修单 //获取当前维修业务,维修单
// TaskBto taskBto = taskService.get(repairBackBillSaveVo.getTaskId());
Integer userId = userUtils.getCurrentUserId(); Integer userId = userUtils.getCurrentUserId();
// 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.setSendTime(new Date()); repairBackBill.setSendTime(new Date());
repairBackBill.setTitle("维修退回业务"); repairBackBill.setTitle("维修退回业务");
repairBackBill.setAgent(repairBackBillSaveVo.getAgent()); repairBackBill.setAgent(repairBackBillSaveVo.getAgent());
//生成单位签章id //生成单位签章id
// Long signId = snowflake.creatNextId();
Long signId2 = snowflake.creatNextId(); Long signId2 = snowflake.creatNextId();
if (repairBackBillSaveVo.getLeftSignatureId()!=null) { if (repairBackBillSaveVo.getLeftSignatureId()!=null) {
repairBackBill.setLeftSignatureId(repairBackBillSaveVo.getLeftSignatureId()); repairBackBill.setLeftSignatureId(repairBackBillSaveVo.getLeftSignatureId());
...@@ -814,7 +748,6 @@ public class RepairController { ...@@ -814,7 +748,6 @@ public class RepairController {
taskService.start(taskBto2); taskService.start(taskBto2);
//添加业务日志 //添加业务日志
List<FileVo> fileVoList = new ArrayList<>(); List<FileVo> fileVoList = new ArrayList<>();
// 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 repairDetail = deviceRepairDetailService.getOne(d.getId());
...@@ -832,28 +765,6 @@ public class RepairController { ...@@ -832,28 +765,6 @@ public class RepairController {
List<Integer> idList = StringSplitUtil.split(deviceIdDetail); List<Integer> idList = StringSplitUtil.split(deviceIdDetail);
//添加出库白名单 //添加出库白名单
inputOutputDeviceService.addWhiteDevices(idList,userUtils.getCurrentUnitId(),1); inputOutputDeviceService.addWhiteDevices(idList,userUtils.getCurrentUnitId(),1);
//判断是否修完
// List<RepairDetail> deviceRepairDetailEntities = deviceRepairDetailService.findByBillId(repairBill.getId());
//获取所有装备的维修状态
// Set<Integer> statusSet = deviceRepairDetailEntities.stream()
// .map(RepairDetail::getRepairStatus)
// .collect(Collectors.toSet());
// //存放所有维修完成的状态
// Set<Integer> integerSet = new HashSet<>();
// integerSet.add(2);
// integerSet.add(3);
// integerSet.add(4);
// integerSet.add(5);
// integerSet.add(6);
// //取交集
// integerSet.retainAll(statusSet);
// //如果取交集后size不变,则说明全部都是维修完成的状态
// if (integerSet.size() == statusSet.size()) {
// //维修主业务完结
// taskService.update(taskService.moveToEnd(taskBto));
// repairBill.setRepairStatus(5);
// 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()
...@@ -956,27 +867,6 @@ public class RepairController { ...@@ -956,27 +867,6 @@ public class RepairController {
} }
} else { } else {
taskBto = new TaskBto(); taskBto = new TaskBto();
// //判断是否修完
// List<RepairDetail> deviceRepairDetailEntities = deviceRepairDetailService.findByBillId(taskBto.getBillId());
// //获取所有装备的维修状态
// Set<Integer> statusSet = deviceRepairDetailEntities.stream()
// .map(RepairDetail::getRepairStatus)
// .collect(Collectors.toSet());
// //存放所有维修完成的状态
// Set<Integer> integerSet = new HashSet<>();
// integerSet.add(2);
// integerSet.add(3);
// integerSet.add(4);
// integerSet.add(5);
// integerSet.add(6);
// //取交集
// integerSet.retainAll(statusSet);
// //如果取交集后size不变,则说明全部都是维修完成的状态
// if (integerSet.size() == statusSet.size()) {
// //结束父任务
// taskService.moveToEnd(taskBto);
// }
// RepairSendBill repairSendBill = deviceRepairSendBillDao.findByDeviceRepairBillId(taskBto.getBillId());
repairBackBill = new RepairBackBill(); repairBackBill = new RepairBackBill();
repairBackBill.setSendUnit(deviceLibraryService.getOne(repairReceiveVo.getDeviceList().get(0).getDeviceId()).getLocationUnit()); repairBackBill.setSendUnit(deviceLibraryService.getOne(repairReceiveVo.getDeviceList().get(0).getDeviceId()).getLocationUnit());
repairBackBill.setReceiveUnit(userUtils.getCurrentUserUnitName()); repairBackBill.setReceiveUnit(userUtils.getCurrentUserUnitName());
...@@ -984,7 +874,6 @@ public class RepairController { ...@@ -984,7 +874,6 @@ public class RepairController {
repairBackBill.setStartUseraId(repairReceiveVo.getStartUseraId()); repairBackBill.setStartUseraId(repairReceiveVo.getStartUseraId());
repairBackBill.setStartUserbId(repairReceiveVo.getStartUserbId()); repairBackBill.setStartUserbId(repairReceiveVo.getStartUserbId());
repairBackBill.setReceiveUserbId(repairReceiveVo.getReceiveUserbId()); repairBackBill.setReceiveUserbId(repairReceiveVo.getReceiveUserbId());
// repairBackBill.setDeviceRepairBillId(taskBto.getBillId());
} }
String deviceIdDetail = repairReceiveVo.getReceiveCheckDetail(); String deviceIdDetail = repairReceiveVo.getReceiveCheckDetail();
if (repairBackBill.getReceiveUseraId() == null) { if (repairBackBill.getReceiveUseraId() == null) {
...@@ -1002,9 +891,6 @@ public class RepairController { ...@@ -1002,9 +891,6 @@ public class RepairController {
repairBackBill.setBackReciveCheckResult(repairReceiveVo.getReceiveCheckResult()); repairBackBill.setBackReciveCheckResult(repairReceiveVo.getReceiveCheckResult());
repairBackBill.setReceiveUserbId(repairReceiveVo.getReceiveUserbId()); repairBackBill.setReceiveUserbId(repairReceiveVo.getReceiveUserbId());
List<FileVo> fileVoList = new ArrayList<>(); List<FileVo> fileVoList = new ArrayList<>();
// if (repairBackBill.getBillFileName()!=null&&repairBackBill.getBillFileUrl()!=null) {
// fileVoList.add(new FileVo("回执单", repairBackBill.getBillFileName(), repairBackBill.getBillFileUrl()));
// }
if (repairReceiveVo.getReceiveFiles()!=null&&repairReceiveVo.getReceiveFiles().size()>0){ if (repairReceiveVo.getReceiveFiles()!=null&&repairReceiveVo.getReceiveFiles().size()>0){
repairReceiveVo.getReceiveFiles().forEach(fileRet -> { repairReceiveVo.getReceiveFiles().forEach(fileRet -> {
fileVoList.add(new FileVo("回执单", fileRet.getName(), fileRet.getPreviewPath())); fileVoList.add(new FileVo("回执单", fileRet.getName(), fileRet.getPreviewPath()));
...@@ -1012,7 +898,6 @@ public class RepairController { ...@@ -1012,7 +898,6 @@ public class RepairController {
repairBackBill.setReceiveFiles(FilesUtil.stringFileToList(repairReceiveVo.getReceiveFiles())); repairBackBill.setReceiveFiles(FilesUtil.stringFileToList(repairReceiveVo.getReceiveFiles()));
} }
RepairBackBill repairBackBill1 = deviceRepairBackBillService.update(repairBackBill); RepairBackBill repairBackBill1 = deviceRepairBackBillService.update(repairBackBill);
// fileVoList.add(new FileVo("入库确认单", repairBackBill.getReceiveFileName(), repairBackBill.getReceiveFileUrl()));
TaskBto taskBto2; TaskBto taskBto2;
Map<Integer,List<Integer>> messageMap = new HashMap<>(); Map<Integer,List<Integer>> messageMap = new HashMap<>();
if (level == 1) { if (level == 1) {
...@@ -1040,20 +925,14 @@ public class RepairController { ...@@ -1040,20 +925,14 @@ public class RepairController {
messageMap.put(unitId, Collections.singletonList(repairDetail1.getId())); messageMap.put(unitId, Collections.singletonList(repairDetail1.getId()));
} }
else { else {
List<Integer> ids = new ArrayList<Integer>(messageMap.getOrDefault(unitId, new ArrayList<>())); List<Integer> ids = new ArrayList<>(messageMap.getOrDefault(unitId, new ArrayList<>()));
ids.add(repairDetail1.getId()); ids.add(repairDetail1.getId());
messageMap.put(unitId,ids); messageMap.put(unitId,ids);
} }
} }
deviceRepairDetailService.update(repairDetail); deviceRepairDetailService.update(repairDetail);
} }
//添加业务日志
// TaskLogBto taskLogBto2 = new TaskLogBto(taskBto2.getId(), "维修退回装备接收并发起入库", fileVoList);
// taskLogService.addLog(taskLogBto2);
} else { } else {
// if (repairReceiveVo.getStatus()==0) {
//任务推至下一阶段
// taskService.update(taskService.moveToNext(taskBto, repairReceiveVo.getReceiveUserbId()));
if (repairReceiveVo.getStatus()==0) { if (repairReceiveVo.getStatus()==0) {
taskBto2 = taskService.moveToEnd(taskBto); taskBto2 = taskService.moveToEnd(taskBto);
//子任务完结 //子任务完结
...@@ -1062,14 +941,9 @@ public class RepairController { ...@@ -1062,14 +941,9 @@ public class RepairController {
else { else {
taskBto2 = taskService.moveToSpecial(taskBto,StatusEnum.WAIT_UPLOAD_BACK_FILE); taskBto2 = taskService.moveToSpecial(taskBto,StatusEnum.WAIT_UPLOAD_BACK_FILE);
} }
// }
// else {
// taskBto2 = taskService.moveToSpecial(taskBto,StatusEnum.WAIT_UPLOAD_BACK_FILE);
// }
//获取维修详情 //获取维修详情
List<RepairDetail> repairDetailList = repairDetailDao.findByRepairBackBillId(repairBackBill.getId()); List<RepairDetail> repairDetailList = repairDetailDao.findByRepairBackBillId(repairBackBill.getId());
repairDetailList.forEach(repairDetail -> { repairDetailList.forEach(repairDetail -> {
// repairDetail.setLocationUnit(userUtils.getCurrentUserUnitName());
repairDetail.setRepairStatus(5); repairDetail.setRepairStatus(5);
if (repairDetail.getPid()!=null) { if (repairDetail.getPid()!=null) {
RepairDetail repairDetail1 = deviceRepairDetailService.getOne(repairDetail.getPid()); RepairDetail repairDetail1 = deviceRepairDetailService.getOne(repairDetail.getPid());
...@@ -1080,7 +954,7 @@ public class RepairController { ...@@ -1080,7 +954,7 @@ public class RepairController {
messageMap.put(unitId, Collections.singletonList(repairDetail1.getId())); messageMap.put(unitId, Collections.singletonList(repairDetail1.getId()));
} }
else { else {
List<Integer> ids = new ArrayList<Integer>(messageMap.getOrDefault(unitId, new ArrayList<>())); List<Integer> ids = new ArrayList<>(messageMap.getOrDefault(unitId, new ArrayList<>()));
ids.add(repairDetail1.getId()); ids.add(repairDetail1.getId());
messageMap.put(unitId,ids); messageMap.put(unitId,ids);
} }
...@@ -1088,26 +962,15 @@ public class RepairController { ...@@ -1088,26 +962,15 @@ public class RepairController {
deviceRepairDetailService.update(repairDetail); deviceRepairDetailService.update(repairDetail);
}); });
} }
// TaskBto parent = taskService.get(taskBto2.getParentTaskId());
String[] strings = deviceIdDetail.split("x"); String[] strings = deviceIdDetail.split("x");
//存放正常接收的装备id
Set<String> units = new HashSet<>();
List<Integer> idList = new ArrayList<>();
for (String s : strings) { for (String s : strings) {
if (s.length() > 1) { if (s.length() > 1) {
//接收无误的装备 //接收无误的装备
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);
//更改装备状态 //更改装备状态
DeviceLibrary deviceLibraryEntity = deviceLibraryService.getOne(id); DeviceLibrary deviceLibraryEntity = deviceLibraryService.getOne(id);
Integer unitId = userPublicService.findUnitIdByName(deviceLibraryEntity.getOwnUnit()); Integer unitId = userPublicService.findUnitIdByName(deviceLibraryEntity.getOwnUnit());
if (userUtils.getCurrentUnitLevel()==1&&unitsService.findById(unitId).getLevel()==3) {
units.add(unitsService.findByAreaId(unitId).getName());
}
else {
units.add(deviceLibraryEntity.getOwnUnit());
}
deviceLibraryEntity.setLocationUnit(userUtils.getCurrentUserUnitName()); deviceLibraryEntity.setLocationUnit(userUtils.getCurrentUserUnitName());
if (deviceLibraryEntity.getOwnUnit().equals(deviceLibraryEntity.getLocationUnit())) { if (deviceLibraryEntity.getOwnUnit().equals(deviceLibraryEntity.getLocationUnit())) {
deviceLibraryEntity.setLifeStatus(2); deviceLibraryEntity.setLifeStatus(2);
...@@ -1130,33 +993,8 @@ public class RepairController { ...@@ -1130,33 +993,8 @@ public class RepairController {
} }
} }
} }
//获取维修详情
// List<RepairDetail> repairDetailList = repairDetailDao.findByRepairBackBillId(repairBackBill.getId());
// //获取所有父业务id
// List<Integer> fathers = StringSplitUtil.taskIdSplit(parent.getNodeIdDetail());
// fathers.forEach(integer -> {
// //筛选出父业务相同装备的维修详情
// List<RepairDetail> repairDetails = repairDetailDao.findByDeviceRepairBillId(taskService.get(integer).getBillId()).stream()
// .filter(repairDetail -> idList.contains(repairDetail.getDeviceId()))
// .collect(Collectors.toList());
// repairDetails.forEach(repairDetail -> {
// repairDetail.setLocationUnit(userUtils.getCurrentUserUnitName());
// deviceRepairDetailService.update(repairDetail);
// });
// });
// //改变维修详情装备所在单位为当前单位
// repairDetailList.forEach(repairDetail -> {
//// repairDetail.setLocationUnit(userUtils.getCurrentUserUnitName());
// repairDetail.setRepairStatus(5);
// deviceRepairDetailService.update(repairDetail);
// });
//发送阅知信息 //发送阅知信息
List<Integer> ids = userPublicService.findOtherUser(userUtils.getCurrentUserId()); List<Integer> ids = userPublicService.findOtherUser(userUtils.getCurrentUserId());
List<Integer> ids2 = new ArrayList<>();
units.forEach(s -> ids2.addAll(userDao.findAllByUnitsId(userPublicService.findUnitIdByName(s)).stream()
.map(User::getUserId)
.collect(Collectors.toList())));
if (level>1) { if (level>1) {
ids.addAll(userDao.findAllByUnitsId(userPublicService.findUnitIdByName(repairBackBill.getSendUnit())).stream() ids.addAll(userDao.findAllByUnitsId(userPublicService.findUnitIdByName(repairBackBill.getSendUnit())).stream()
.map(User::getUserId) .map(User::getUserId)
...@@ -1174,7 +1012,8 @@ public class RepairController { ...@@ -1174,7 +1012,8 @@ public class RepairController {
MessageBto messageBto = new MessageBto(taskBto2.getId(), taskBto2.getBusinessType(), "被选为签发人", idList1, 1); MessageBto messageBto = new MessageBto(taskBto2.getId(), taskBto2.getBusinessType(), "被选为签发人", idList1, 1);
messageService.add(messageBto); messageService.add(messageBto);
} }
MessageBto messageBto = new MessageBto(taskBto2.getId(),taskBto2.getBusinessType(),"接收维修退回装备",ids,1); String message = repairReceiveVo.getStatus()==0?"业务办结":"接收维修领取装备";
MessageBto messageBto = new MessageBto(taskBto2.getId(),taskBto2.getBusinessType(),message,ids,1);
messageService.add(messageBto); messageService.add(messageBto);
messageMap.keySet().forEach(integer -> { messageMap.keySet().forEach(integer -> {
List<Integer> integerList = new ArrayList<>(); List<Integer> integerList = new ArrayList<>();
...@@ -1185,8 +1024,6 @@ public class RepairController { ...@@ -1185,8 +1024,6 @@ public class RepairController {
messageBto2.setRecord(StringSplitUtil.idListToString(messageMap.get(integer))); messageBto2.setRecord(StringSplitUtil.idListToString(messageMap.get(integer)));
messageService.add(messageBto2); messageService.add(messageBto2);
}); });
// MessageBto messageBto2 = new MessageBto(taskBto2.getId(),taskBto2.getBusinessType(),"待领取送修装备",ids2);
// messageService.add(messageBto2);
myWebSocket.sendMessage1(); myWebSocket.sendMessage1();
return ResultUtil.success("维修成功退回装备接收入库"); return ResultUtil.success("维修成功退回装备接收入库");
} }
...@@ -1204,9 +1041,16 @@ public class RepairController { ...@@ -1204,9 +1041,16 @@ public class RepairController {
taskService.moveToArchive(taskBto); taskService.moveToArchive(taskBto);
} }
else { else {
RepairBackBill repairBackBill = deviceRepairBackBillService.getOne(taskBto.getBillId());
List<Integer> ids = userPublicService.findOtherUser(userId);
ids.addAll(userDao.findAllByUnitsId(userPublicService.findUnitIdByName(repairBackBill.getSendUnit())).stream()
.map(User::getUserId)
.collect(Collectors.toList()));
taskService.moveToEnd(taskBto); taskService.moveToEnd(taskBto);
taskService.moveAllSonNodeToEnd(taskBto.getId()); taskService.moveAllSonNodeToEnd(taskBto.getId());
RepairBackBill repairBackBill = deviceRepairBackBillService.getOne(taskBto.getBillId()); //阅知
MessageBto messageBto = new MessageBto(taskBto.getId(),taskBto.getBusinessType(),"业务办结",ids,1);
messageService.add(messageBto);
repairBackBill.setBillFileName(fileUploadVo.getBillFileName()); repairBackBill.setBillFileName(fileUploadVo.getBillFileName());
repairBackBill.setBillFileUrl(fileUploadVo.getBillFileUrl()); repairBackBill.setBillFileUrl(fileUploadVo.getBillFileUrl());
List<FileVo> fileVoList = new ArrayList<>(); List<FileVo> fileVoList = new ArrayList<>();
...@@ -1217,7 +1061,6 @@ public class RepairController { ...@@ -1217,7 +1061,6 @@ public class RepairController {
repairBackBill.setReceiveFiles(FilesUtil.stringFileToList(fileUploadVo.getReceiveFiles())); repairBackBill.setReceiveFiles(FilesUtil.stringFileToList(fileUploadVo.getReceiveFiles()));
} }
deviceRepairBackBillService.update(repairBackBill); deviceRepairBackBillService.update(repairBackBill);
// fileVoList.add(new FileVo("回执单", repairBackBill.getBillFileName(), repairBackBill.getBillFileUrl()));
//添加装备日志 //添加装备日志
List<Integer> deviceIds = StringSplitUtil.split(repairBackBill.getBackReciveCheckDetail()); List<Integer> deviceIds = StringSplitUtil.split(repairBackBill.getBackReciveCheckDetail());
deviceIds.forEach(integer -> { deviceIds.forEach(integer -> {
...@@ -1315,10 +1158,6 @@ public class RepairController { ...@@ -1315,10 +1158,6 @@ public class RepairController {
throw new ApiException(ResponseEntity.status(303).body("序列号"+repairDetail.getSeqNumber()+"的装备已被其他专管员操作")); throw new ApiException(ResponseEntity.status(303).body("序列号"+repairDetail.getSeqNumber()+"的装备已被其他专管员操作"));
} }
}); });
//获取当前任务
// TaskBto taskBto = taskService.get(repairStatusChangeVo.getTaskId());
//获取所有父任务id
// List<Integer> fathers = StringSplitUtil.taskIdSplit(taskBto.getNodeIdDetail());
Map<Integer,List<Integer>> messageMap = new HashMap<>(); Map<Integer,List<Integer>> messageMap = new HashMap<>();
for (Integer id : repairStatusChangeVo.getId()) { for (Integer id : repairStatusChangeVo.getId()) {
//获取维修详情单 //获取维修详情单
...@@ -1351,17 +1190,6 @@ public class RepairController { ...@@ -1351,17 +1190,6 @@ public class RepairController {
deviceLibraryService.update(deviceLibrary); deviceLibraryService.update(deviceLibrary);
} }
deviceRepairDetailService.update(repairDetail1); deviceRepairDetailService.update(repairDetail1);
//修改父任务中所有维修详情单中的该装备的状态
// if (fathers.size() > 0) {
// fathers.forEach(integer -> {
// deviceRepairDetailService.findByBillId(integer).stream()
// .filter(repairDetail -> repairDetail.getDeviceId().equals(repairDetail1.getDeviceId()))
// .forEach(repairDetail -> {
// repairDetail.setRepairStatus(repairStatusChangeVo.getNewStatus());
// deviceRepairDetailService.update(repairDetail);
// });
// });
// }
//获取装备名称 //获取装备名称
String deviceName = deviceLibraryService.getOne(repairDetail1.getDeviceId()).getName(); String deviceName = deviceLibraryService.getOne(repairDetail1.getDeviceId()).getName();
//添加业务日志 //添加业务日志
...@@ -1371,9 +1199,6 @@ public class RepairController { ...@@ -1371,9 +1199,6 @@ public class RepairController {
fileVos.add(fileVo); fileVos.add(fileVo);
} }
String remark = "将装备" + deviceName + "状态由" + GlobalMap.getRepairStatusMap().get(oldStatus).name + "改为" + GlobalMap.getRepairStatusMap().get(repairStatusChangeVo.getNewStatus()).name; String remark = "将装备" + deviceName + "状态由" + GlobalMap.getRepairStatusMap().get(oldStatus).name + "改为" + GlobalMap.getRepairStatusMap().get(repairStatusChangeVo.getNewStatus()).name;
//业务日志
// TaskLogBto taskLogBto = new TaskLogBto(taskBto.getId(), remark, fileVos);
// taskLogService.addLog(taskLogBto);
//装备日志 //装备日志
DeviceLogDto deviceLogDto = new DeviceLogDto(repairDetail1.getDeviceId(), remark, fileVos); DeviceLogDto deviceLogDto = new DeviceLogDto(repairDetail1.getDeviceId(), remark, fileVos);
deviceLogService.addLog(deviceLogDto); deviceLogService.addLog(deviceLogDto);
...@@ -1397,25 +1222,9 @@ public class RepairController { ...@@ -1397,25 +1222,9 @@ public class RepairController {
messageMap.put(unitId, ids); messageMap.put(unitId, ids);
} }
} }
// List<Integer> ids2 = new ArrayList<>();
// ids2.addAll(userDao.findAllByUnitsId(userPublicService.getOne(repairDetail1.getCreateUserId()).getUnitsId()).stream()
// .map(User::getUserId)
// .collect(Collectors.toList()));
// MessageBto messageBto2 = new MessageBto(0, 0, "待领取送修装备", ids2);
// messageBto2.setRecord();
// messageService.add(messageBto2);
} }
} }
} }
// List<Integer> ids2 = new ArrayList<>();
// for (Integer integer:messageMap.keySet()) {
// ids2.addAll(userDao.findAllByUnitsId(integer).stream()
// .map(User::getUserId)
// .collect(Collectors.toList()));
// }
// MessageBto messageBto2 = new MessageBto(0, 5, "待领取送修装备", ids2);
// messageBto2.setRecord(StringSplitUtil.idListToString(messageMap.get(integer)));
// messageService.add(messageBto2);
messageMap.keySet().forEach(integer -> { messageMap.keySet().forEach(integer -> {
List<Integer> ids2 = new ArrayList<>(); List<Integer> ids2 = new ArrayList<>();
ids2.addAll(userDao.findAllByUnitsId(integer).stream() ids2.addAll(userDao.findAllByUnitsId(integer).stream()
...@@ -1576,16 +1385,10 @@ public class RepairController { ...@@ -1576,16 +1385,10 @@ public class RepairController {
repairBackBill.setScripts(JacksonUtil.readValue(repairBackBill.getScriptJson(),new TypeReference<List<ScriptSaveVo>>() {})); repairBackBill.setScripts(JacksonUtil.readValue(repairBackBill.getScriptJson(),new TypeReference<List<ScriptSaveVo>>() {}));
} }
repairBillDetailVo.setRepairBackBill(repairBackBill); repairBillDetailVo.setRepairBackBill(repairBackBill);
//获取送修单
// RepairBill repairBill1 = deviceRepairBillService.getOne(taskService.get(taskBto.getParentTaskId()).getBillId());
// 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());
} }
repairBackBill.setStartUserB(repairBackBill.getAgent()); repairBackBill.setStartUserB(repairBackBill.getAgent());
// if (repairBackBill.getStartUserbId() != null) {
// repairBackBill.setStartUserB(userPublicService.getOne(repairBackBill.getStartUserbId()).getName());
// }
if (repairBackBill.getReceiveUseraId() != null) { if (repairBackBill.getReceiveUseraId() != null) {
repairBackBill.setReceiveUserA(userPublicService.getOne(repairBackBill.getReceiveUseraId()).getName()); repairBackBill.setReceiveUserA(userPublicService.getOne(repairBackBill.getReceiveUseraId()).getName());
} }
...@@ -1689,10 +1492,6 @@ public class RepairController { ...@@ -1689,10 +1492,6 @@ public class RepairController {
integerList.add(5); integerList.add(5);
integerList.add(9); integerList.add(9);
List<RepairDetail> repairDetails1 = repairDetailDao.findAllByRepairStatusNotIn(integerList,repairTaskSelectVo.getPageable().getSort()); List<RepairDetail> repairDetails1 = repairDetailDao.findAllByRepairStatusNotIn(integerList,repairTaskSelectVo.getPageable().getSort());
// repairDetails.addAll(repairDetailDao.findAllByRepairStatus(9));
// repairDetails.addAll(repairDetailDao.findAllByRepairStatus(5));
// List<RepairDetail> repairDetails1 = repairDetailDao.findAll();
// repairDetails1.removeAll(repairDetails);
repairDetails1.forEach(repairDetail -> { repairDetails1.forEach(repairDetail -> {
repairDetail.setLocationUnit(deviceLibraryMap.get(repairDetail.getDeviceId()).getLocationUnit()); repairDetail.setLocationUnit(deviceLibraryMap.get(repairDetail.getDeviceId()).getLocationUnit());
repairDetail.setConfigName(); repairDetail.setConfigName();
...@@ -1826,6 +1625,13 @@ public class RepairController { ...@@ -1826,6 +1625,13 @@ public class RepairController {
taskService.moveToEnd(taskBto); taskService.moveToEnd(taskBto);
//主业务完结 //主业务完结
taskService.moveToEnd(taskService.get(taskBto.getParentTaskId())); taskService.moveToEnd(taskService.get(taskBto.getParentTaskId()));
List<Integer> userIds = userPublicService.findOtherUser(userUtils.getCurrentUserId());
userIds.addAll(userDao.findAllByUnitsId(userPublicService.findUnitIdByName(repairBackBill.getReceiveUnit())).stream()
.map(User::getUserId)
.collect(Collectors.toList()));
//阅知
MessageBto messageBto1 = new MessageBto(taskBto.getParentTaskId(),taskBto.getBusinessType(),"业务办结",userIds,1);
messageService.add(messageBto1);
//装备日志 //装备日志
List<FileVo> fileVoList = new ArrayList<>(); List<FileVo> fileVoList = new ArrayList<>();
fileVo.getSendFiles().forEach(fileRet -> fileVoList.add(new FileVo("领取单", fileRet.getName(), fileRet.getPreviewPath()))); fileVo.getSendFiles().forEach(fileRet -> fileVoList.add(new FileVo("领取单", fileRet.getName(), fileRet.getPreviewPath())));
...@@ -1878,6 +1684,13 @@ public class RepairController { ...@@ -1878,6 +1684,13 @@ public class RepairController {
taskService.moveToEnd(taskBto); taskService.moveToEnd(taskBto);
//主业务完结 //主业务完结
taskService.moveToEnd(taskService.get(taskBto.getParentTaskId())); taskService.moveToEnd(taskService.get(taskBto.getParentTaskId()));
List<Integer> userIds = userPublicService.findOtherUser(userUtils.getCurrentUserId());
userIds.addAll(userDao.findAllByUnitsId(userPublicService.findUnitIdByName(repairSendBill.getReceiveUnit())).stream()
.map(User::getUserId)
.collect(Collectors.toList()));
//阅知
MessageBto messageBto1 = new MessageBto(taskBto.getParentTaskId(),taskBto.getBusinessType(),"业务办结",userIds,1);
messageService.add(messageBto1);
//装备日志 //装备日志
List<FileVo> fileVoList = new ArrayList<>(); List<FileVo> fileVoList = new ArrayList<>();
fileVo.getSendFiles().forEach(fileRet -> fileVoList.add(new FileVo("维修单", fileRet.getName(), fileRet.getPreviewPath()))); fileVo.getSendFiles().forEach(fileRet -> fileVoList.add(new FileVo("维修单", fileRet.getName(), fileRet.getPreviewPath())));
......
...@@ -48,6 +48,10 @@ ...@@ -48,6 +48,10 @@
<groupId>com.tykj</groupId> <groupId>com.tykj</groupId>
<artifactId>dev-confirmcheck</artifactId> <artifactId>dev-confirmcheck</artifactId>
</dependency> </dependency>
<dependency>
<groupId>com.tykj</groupId>
<artifactId>dev-matching</artifactId>
</dependency>
</dependencies> </dependencies>
</project> </project>
\ No newline at end of file
...@@ -52,6 +52,16 @@ public class StatisticalController { ...@@ -52,6 +52,16 @@ public class StatisticalController {
// @Autowired // @Autowired
// private ConfigCache configCache; // private ConfigCache configCache;
/**
* 查询工作台统计
* @return 作台统计对象集合
*/
@ApiOperation(value = "查询工作台统计")
@GetMapping("/workBench")
public ResponseEntity workBench(){
return ResponseEntity.ok(statisticalService.getWorkBenchStat());
}
/** /**
* 查询各市的装备数量 * 查询各市的装备数量
* @return 各市装备对象集合 * @return 各市装备对象集合
......
...@@ -68,4 +68,9 @@ public interface StatisticalService { ...@@ -68,4 +68,9 @@ public interface StatisticalService {
* 获取专管员概要信息统计 * 获取专管员概要信息统计
*/ */
UserGeneralSituation getUserGeneralSituation(); UserGeneralSituation getUserGeneralSituation();
/**
* 获取工作台统计
*/
WorkBench getWorkBenchStat();
} }
package com.tykj.dev.statistical.service.impl; package com.tykj.dev.statistical.service.impl;
import com.tykj.dev.device.user.cache.AreaCache;
import com.tykj.dev.device.confirmcheck.entity.domain.DeviceCheckDetail; import com.tykj.dev.device.confirmcheck.entity.domain.DeviceCheckDetail;
import com.tykj.dev.device.confirmcheck.repository.DeviceCheckDetailDao; import com.tykj.dev.device.confirmcheck.repository.DeviceCheckDetailDao;
import com.tykj.dev.device.confirmcheck.repository.DeviceCheckStatDao; import com.tykj.dev.device.confirmcheck.repository.DeviceCheckStatDao;
import com.tykj.dev.device.library.repository.DeviceLibraryDao; import com.tykj.dev.device.library.repository.DeviceLibraryDao;
import com.tykj.dev.device.library.service.DeviceLibraryService;
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.DeviceLibrarySelectVo;
import com.tykj.dev.device.matching.repository.MatchingDeviceLibraryDao;
import com.tykj.dev.device.packing.repository.PackingLibraryDao;
import com.tykj.dev.device.selfcheck.base.SelfCheckSchedulerTask; import com.tykj.dev.device.selfcheck.base.SelfCheckSchedulerTask;
import com.tykj.dev.device.selfcheck.repository.SelfCheckBillDao; import com.tykj.dev.device.selfcheck.repository.SelfCheckBillDao;
import com.tykj.dev.device.selfcheck.subject.domin.SelfCheckBill; import com.tykj.dev.device.selfcheck.subject.domin.SelfCheckBill;
...@@ -13,6 +16,7 @@ import com.tykj.dev.device.task.service.TaskService; ...@@ -13,6 +16,7 @@ import com.tykj.dev.device.task.service.TaskService;
import com.tykj.dev.device.task.subject.vo.TaskSelectVo; import com.tykj.dev.device.task.subject.vo.TaskSelectVo;
import com.tykj.dev.device.task.subject.vo.TaskUserVo; import com.tykj.dev.device.task.subject.vo.TaskUserVo;
import com.tykj.dev.device.user.base.ret.UserSituationVo; import com.tykj.dev.device.user.base.ret.UserSituationVo;
import com.tykj.dev.device.user.cache.AreaCache;
import com.tykj.dev.device.user.cache.UnitsCache; import com.tykj.dev.device.user.cache.UnitsCache;
import com.tykj.dev.device.user.subject.dao.AreaDao; import com.tykj.dev.device.user.subject.dao.AreaDao;
import com.tykj.dev.device.user.subject.dao.UnitsDao; import com.tykj.dev.device.user.subject.dao.UnitsDao;
...@@ -73,6 +77,15 @@ public class StatisticalServiceImpl implements StatisticalService { ...@@ -73,6 +77,15 @@ public class StatisticalServiceImpl implements StatisticalService {
@Autowired @Autowired
private DeviceCheckStatDao deviceCheckStatDao; private DeviceCheckStatDao deviceCheckStatDao;
@Autowired
private DeviceLibraryService deviceLibraryService;
@Autowired
private MatchingDeviceLibraryDao matchingDeviceLibraryDao;
@Autowired
private PackingLibraryDao packingLibraryDao;
/** /**
* 获取装备统计信息 * 获取装备统计信息
*/ */
...@@ -461,6 +474,21 @@ public class StatisticalServiceImpl implements StatisticalService { ...@@ -461,6 +474,21 @@ public class StatisticalServiceImpl implements StatisticalService {
return new UserGeneralSituation(count,hasTraining,ids.size(),list); return new UserGeneralSituation(count,hasTraining,ids.size(),list);
} }
/**
* 获取工作台统计
*/
@Override
public WorkBench getWorkBenchStat() {
WorkBench workBench = new WorkBench();
DeviceLibrarySelectVo deviceLibrarySelectVo = new DeviceLibrarySelectVo();
deviceLibrarySelectVo.setAreaId(areaCache.findByName("浙江省").getId());
workBench.setPackingNum(packingLibraryDao.findAllByIsRootAndPackingStatus(0,2).size());
workBench.setAllDeviceNum(deviceLibraryService.getCoreDevicePage(deviceLibrarySelectVo).size());
workBench.setSelfDeviceNum(deviceLibraryService.getCoreDevicePage(new DeviceLibrarySelectVo()).size());
workBench.setMatchingDeviceNum(new Long(matchingDeviceLibraryDao.count()).intValue());
return workBench;
}
/** /**
* 获取各市最近一次自查和核查装备数量 * 获取各市最近一次自查和核查装备数量
*/ */
......
package com.tykj.dev.statistical.vo;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @author dengdiyi
* 工作台统计详情vo
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class WorkBench {
private Integer packingNum;
private Integer allDeviceNum;
private Integer selfDeviceNum;
private Integer matchingDeviceNum;
private Integer checkNum = 0;
private Integer completeCheckNum = 0;
private Integer examNum = 0;
private Integer examCompleteNum = 0;
private Integer trainNum = 0;
private Integer trainCompleteNum = 0;
private Integer lossNum = 0;
private Integer foundNum = 0;
}
...@@ -40,6 +40,10 @@ ...@@ -40,6 +40,10 @@
<groupId>com.tykj</groupId> <groupId>com.tykj</groupId>
<artifactId>dev-file</artifactId> <artifactId>dev-file</artifactId>
</dependency> </dependency>
<dependency>
<groupId>com.tykj</groupId>
<artifactId>dev-apply</artifactId>
</dependency>
</dependencies> </dependencies>
</project> </project>
\ No newline at end of file
...@@ -2,6 +2,9 @@ package com.tykj.dev.device.storage.controller; ...@@ -2,6 +2,9 @@ package com.tykj.dev.device.storage.controller;
import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.core.type.TypeReference;
import com.tykj.dev.config.swagger.AutoDocument; import com.tykj.dev.config.swagger.AutoDocument;
import com.tykj.dev.device.apply.service.DeviceApplyBillService;
import com.tykj.dev.device.apply.subject.domin.DeviceApplyBill;
import com.tykj.dev.device.apply.subject.vo.ApplyBillDetailVo;
import com.tykj.dev.device.file.service.FilesUtil; import com.tykj.dev.device.file.service.FilesUtil;
import com.tykj.dev.device.library.repository.DeviceLibraryDao; import com.tykj.dev.device.library.repository.DeviceLibraryDao;
import com.tykj.dev.device.library.service.DeviceLibraryService; import com.tykj.dev.device.library.service.DeviceLibraryService;
...@@ -37,6 +40,9 @@ import org.springframework.validation.annotation.Validated; ...@@ -37,6 +40,9 @@ import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.*; import java.util.*;
import java.util.function.Function;
import static java.util.stream.Collectors.toMap;
/** /**
* @author dengdiyi * @author dengdiyi
...@@ -80,6 +86,9 @@ public class StorageBillController { ...@@ -80,6 +86,9 @@ public class StorageBillController {
@Autowired @Autowired
private Snowflake snowflake; private Snowflake snowflake;
@Autowired
private DeviceApplyBillService deviceApplyBillService;
@ApiOperation(value = "自动生成序列号", notes = "可以通过这个接口自动生成序列号") @ApiOperation(value = "自动生成序列号", notes = "可以通过这个接口自动生成序列号")
@PostMapping(value = "/autoCreate/{num}") @PostMapping(value = "/autoCreate/{num}")
public ResponseEntity autoCreate(@PathVariable("num") int num){ public ResponseEntity autoCreate(@PathVariable("num") int num){
...@@ -111,61 +120,44 @@ public class StorageBillController { ...@@ -111,61 +120,44 @@ public class StorageBillController {
List<PackingLibrary> libraryEntities = new ArrayList<>(); List<PackingLibrary> libraryEntities = new ArrayList<>();
Map<Integer, List<PackingLibrary>> map = new HashMap<>(); Map<Integer, List<PackingLibrary>> map = new HashMap<>();
for (StorageBillDetailVo s : list) { for (StorageBillDetailVo s : list) {
List<String> strings = DeviceSeqUtil.createDeviceSeqs(s.getSeqInterval(),s.getStorageCount()); if (s.getStorageCount()>0) {
List<String> strings3 = DeviceSeqUtil.createDeviceSeqs(s.getProdInterval(),s.getStorageCount()); List<String> strings = DeviceSeqUtil.createDeviceSeqs(s.getSeqInterval(), s.getStorageCount());
List<List<String>> sons = new ArrayList<>(); List<String> strings3 = DeviceSeqUtil.createDeviceSeqs(s.getProdInterval(), s.getStorageCount());
List<List<String>> sons2 = new ArrayList<>(); List<List<String>> sons = new ArrayList<>();
int count = 1; List<List<String>> sons2 = new ArrayList<>();
Integer deviceNum = s.getStorageCount(); int count = 1;
while (deviceNum >= count) { Integer deviceNum = s.getStorageCount();
PackingLibrary packingLibraryEntity = new PackingLibrary(); while (deviceNum >= count) {
BeanUtils.copyProperties(packingLibraryService.getOne(s.getPackingId()), packingLibraryEntity); PackingLibrary packingLibraryEntity = new PackingLibrary();
packingLibraryEntity.setCorresponding(count); BeanUtils.copyProperties(packingLibraryService.getOne(s.getPackingId()), packingLibraryEntity);
if (!strings3.isEmpty()) { packingLibraryEntity.setCorresponding(count);
packingLibraryEntity.setProdNumber(strings3.get(0)); if (!strings3.isEmpty()) {
strings3.remove(0); packingLibraryEntity.setProdNumber(strings3.get(0));
} strings3.remove(0);
if (!strings.isEmpty()) {
if (deviceLibraryDao.getAllBySeqNumber(strings.get(0)).size()>0){
throw new ApiException("序列号"+strings.get(0)+"已存在");
} }
packingLibraryEntity.setSeq(strings.get(0)); if (!strings.isEmpty()) {
strings.remove(0); if (deviceLibraryDao.getAllBySeqNumber(strings.get(0)).size() > 0) {
} throw new ApiException("序列号" + strings.get(0) + "已存在");
libraryEntities.add(packingLibraryEntity);
if (s.getList() != null && s.getList().size() != 0) {
for (int j = 0;j<s.getList().size();j++) {
StorageBillDetailVo s2 = s.getList().get(j);
if (j>=sons.size()){
sons.add(DeviceSeqUtil.createDeviceSeqs(s2.getSeqInterval(),s2.getStorageCount()));
sons2.add(DeviceSeqUtil.createDeviceSeqs(s2.getProdInterval(),s2.getStorageCount()));
} }
packingLibraryEntity = packingLibraryService.getOne(s2.getPackingId()); packingLibraryEntity.setSeq(strings.get(0));
List<String> strings2 = sons.get(j); strings.remove(0);
List<String> strings1 = sons2.get(j); }
if (s2.getStorageCount() >= count) { libraryEntities.add(packingLibraryEntity);
packingLibraryEntity.setCorresponding(count); if (s.getList() != null && s.getList().size() != 0) {
if (!strings2.isEmpty()) { for (int j = 0; j < s.getList().size(); j++) {
if (deviceLibraryDao.getAllBySeqNumber(strings2.get(0)).size()>0){ StorageBillDetailVo s2 = s.getList().get(j);
throw new ApiException("序列号"+strings2.get(0)+"已存在"); if (j >= sons.size()) {
} sons.add(DeviceSeqUtil.createDeviceSeqs(s2.getSeqInterval(), s2.getStorageCount()));
packingLibraryEntity.setSeq(strings2.get(0)); sons2.add(DeviceSeqUtil.createDeviceSeqs(s2.getProdInterval(), s2.getStorageCount()));
strings2.remove(0);
}
if (!strings1.isEmpty()) {
packingLibraryEntity.setProdNumber(strings1.get(0));
strings1.remove(0);
} }
libraryEntities.add(packingLibraryEntity); packingLibraryEntity = packingLibraryService.getOne(s2.getPackingId());
} List<String> strings2 = sons.get(j);
if (s2.getStorageCount()-strings2.size()==deviceNum) { List<String> strings1 = sons2.get(j);
List<PackingLibrary> packingLibraries = new ArrayList<>(); if (s2.getStorageCount() >= count) {
for (int i = 0;i<s2.getStorageCount()-deviceNum;i++){ packingLibraryEntity.setCorresponding(count);
packingLibraryEntity = packingLibraryService.getOne(s2.getPackingId());
packingLibraryEntity.setCorresponding(0);
if (!strings2.isEmpty()) { if (!strings2.isEmpty()) {
if (deviceLibraryDao.getAllBySeqNumber(strings2.get(0)).size()>0){ if (deviceLibraryDao.getAllBySeqNumber(strings2.get(0)).size() > 0) {
throw new ApiException("序列号"+strings2.get(0)+"已存在"); throw new ApiException("序列号" + strings2.get(0) + "已存在");
} }
packingLibraryEntity.setSeq(strings2.get(0)); packingLibraryEntity.setSeq(strings2.get(0));
strings2.remove(0); strings2.remove(0);
...@@ -174,14 +166,33 @@ public class StorageBillController { ...@@ -174,14 +166,33 @@ public class StorageBillController {
packingLibraryEntity.setProdNumber(strings1.get(0)); packingLibraryEntity.setProdNumber(strings1.get(0));
strings1.remove(0); strings1.remove(0);
} }
packingLibraries.add(packingLibraryEntity); libraryEntities.add(packingLibraryEntity);
}
if (s2.getStorageCount() - strings2.size() == deviceNum) {
List<PackingLibrary> packingLibraries = new ArrayList<>();
for (int i = 0; i < s2.getStorageCount() - deviceNum; i++) {
packingLibraryEntity = packingLibraryService.getOne(s2.getPackingId());
packingLibraryEntity.setCorresponding(0);
if (!strings2.isEmpty()) {
if (deviceLibraryDao.getAllBySeqNumber(strings2.get(0)).size() > 0) {
throw new ApiException("序列号" + strings2.get(0) + "已存在");
}
packingLibraryEntity.setSeq(strings2.get(0));
strings2.remove(0);
}
if (!strings1.isEmpty()) {
packingLibraryEntity.setProdNumber(strings1.get(0));
strings1.remove(0);
}
packingLibraries.add(packingLibraryEntity);
}
map.put(s2.getPackingId(), packingLibraries);
} }
map.put(s2.getPackingId(), packingLibraries);
} }
}
}
count = count + 1;
} }
count = count + 1;
} }
} }
for (Integer i : map.keySet()) { for (Integer i : map.keySet()) {
...@@ -194,6 +205,22 @@ public class StorageBillController { ...@@ -194,6 +205,22 @@ public class StorageBillController {
@PostMapping(value = "/addStorageBill") @PostMapping(value = "/addStorageBill")
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public ResponseEntity addStorageBill(@RequestBody @Validated StorageBillSaveVo storageBillSaveVo) { public ResponseEntity addStorageBill(@RequestBody @Validated StorageBillSaveVo storageBillSaveVo) {
//是否申请业务导入
List<DeviceApplyBill> deviceApplyBills = new ArrayList<>();
Map<Integer, ApplyBillDetailVo> map = new HashMap<>();
if (storageBillSaveVo.getApplyTaskIds()!=null&&storageBillSaveVo.getApplyTaskIds().size()>0){
for (Integer id:storageBillSaveVo.getApplyTaskIds()) {
TaskBto taskBto1 = taskService.get(id);
DeviceApplyBill deviceApplyBill = deviceApplyBillService.getOne(taskBto1.getBillId());
if (deviceApplyBill.getApplyStat()!=null){
List<ApplyBillDetailVo> applyBillDetailVos = Objects.requireNonNull(JacksonUtil.readValue(deviceApplyBill.getApplyStat(), new TypeReference<List<ApplyBillDetailVo>>() {
}));
deviceApplyBill.setApplyBillDetailVos(applyBillDetailVos);
map.putAll(applyBillDetailVos.stream().collect(toMap(ApplyBillDetailVo::getPackingId, Function.identity())));
}
deviceApplyBills.add(deviceApplyBill);
}
}
//1.存入库单 //1.存入库单
Integer userId = userUtils.getCurrentUserId(); Integer userId = userUtils.getCurrentUserId();
List<Integer> userIds = new ArrayList<>(); List<Integer> userIds = new ArrayList<>();
...@@ -265,11 +292,44 @@ public class StorageBillController { ...@@ -265,11 +292,44 @@ public class StorageBillController {
DeviceLogDto deviceLogDto = new DeviceLogDto(saveEntity.getId(), "发起装备入库", fileVoList); DeviceLogDto deviceLogDto = new DeviceLogDto(saveEntity.getId(), "发起装备入库", fileVoList);
deviceLogDtos.add(deviceLogDto); deviceLogDtos.add(deviceLogDto);
stringBuffer.append("x"); stringBuffer.append("x");
//申请业务列装入库数量+1
if (map.get(d.getPackingId())!=null){
ApplyBillDetailVo applyBillDetailVo = map.get(d.getPackingId());
applyBillDetailVo.setCompleteCount(applyBillDetailVo.getCompleteCount()+1);
map.put(d.getPackingId(),applyBillDetailVo);
}
} }
else { else {
throw new ApiException("系统中已存在rfid卡号为"+d.getRfidCardId()+"的装备!"); throw new ApiException("系统中已存在rfid卡号为"+d.getRfidCardId()+"的装备!");
} }
} }
//更新申请业务入库数量
if (deviceApplyBills.size()>0){
deviceApplyBills.forEach(deviceApplyBill -> {
List<ApplyBillDetailVo> applyBillDetailVos = deviceApplyBill.getApplyBillDetailVos();
for (int i = 0;i<applyBillDetailVos.size();i++){
ApplyBillDetailVo applyBillDetailVo = applyBillDetailVos.get(i);
if (map.get(applyBillDetailVo.getPackingId())!=null){
applyBillDetailVo.setCompleteCount(map.get(applyBillDetailVo.getPackingId()).getCompleteCount());
applyBillDetailVos.set(i,applyBillDetailVo);
if (applyBillDetailVo.getStorageCount().equals(applyBillDetailVo.getCompleteCount())){
TaskBto taskBto1 = taskService.get(deviceApplyBill.getId(),9);
taskService.moveToEnd(taskBto1);
//发送阅知信息
MessageBto messageBto = new MessageBto();
messageBto.setContent("业务办结");
messageBto.setTaskId(taskBto1.getId());
messageBto.setIsHighLight(0);
messageBto.setInvolveUserIdList(userPublicService.findOtherUser(userId));
messageBto.setBusinessType(taskBto1.getBusinessType());
messageService.add(messageBto);
}
}
}
deviceApplyBill.setApplyStat(JacksonUtil.toJSon(applyBillDetailVos));
deviceApplyBillService.update(deviceApplyBill);
});
}
deviceLogService.addAllLog(deviceLogDtos); deviceLogService.addAllLog(deviceLogDtos);
//4.更新入库单入库详情 //4.更新入库单入库详情
storageBillEntity.setStorageDetail(stringBuffer.toString()); storageBillEntity.setStorageDetail(stringBuffer.toString());
......
...@@ -871,7 +871,7 @@ public class TaskServiceImpl implements TaskService { ...@@ -871,7 +871,7 @@ public class TaskServiceImpl implements TaskService {
boolean userConfirm = userId.equals(taskBto.getInvolveUserIdList().get(taskBto.getCurrentPoint())) || (taskBto.getInvolveUserIdList().get(taskBto.getCurrentPoint())==0 && taskBto.getOwnUnit().equals(userUtils.getCurrentUnitId())); boolean userConfirm = userId.equals(taskBto.getInvolveUserIdList().get(taskBto.getCurrentPoint())) || (taskBto.getInvolveUserIdList().get(taskBto.getCurrentPoint())==0 && taskBto.getOwnUnit().equals(userUtils.getCurrentUnitId()));
boolean isDraft = taskBto.getBillStatus() == 201 || taskBto.getBillStatus() == 333 || taskBto.getBillStatus() == 810 || taskBto.getBillStatus() == 322 || taskBto.getBillStatus() == 722; boolean isDraft = taskBto.getBillStatus() == 201 || taskBto.getBillStatus() == 333 || taskBto.getBillStatus() == 810 || taskBto.getBillStatus() == 322 || taskBto.getBillStatus() == 722;
// boolean isCreateUser = userId.equals(taskBto.getCreateUserId()); // boolean isCreateUser = userId.equals(taskBto.getCreateUserId());
boolean isCreateUnit = unitId.equals(userPublicService.findUnitIdByName(userPublicService.findUnitsNameByUserId(taskBto.getCreateUserId()))); boolean isCreateUnit = taskBto.getCreateUserId()!=null&&unitId.equals(userCache.findById(taskBto.getCreateUserId()).getUnitsId());
return unitExists && pointExists && !userConfirm && !userConfirm2 && !isDraft && isCreateUnit; return unitExists && pointExists && !userConfirm && !userConfirm2 && !isDraft && isCreateUnit;
}) })
.collect(Collectors.toList()); .collect(Collectors.toList());
......
...@@ -8,6 +8,7 @@ import com.tykj.dev.device.allot.subject.domin.AllotBackBill; ...@@ -8,6 +8,7 @@ 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.apply.service.DeviceApplyBillService; import com.tykj.dev.device.apply.service.DeviceApplyBillService;
import com.tykj.dev.device.apply.subject.domin.DeviceApplyBill; import com.tykj.dev.device.apply.subject.domin.DeviceApplyBill;
import com.tykj.dev.device.apply.subject.vo.ApplyBillDetailVo;
import com.tykj.dev.device.apply.subject.vo.ReplyVo; import com.tykj.dev.device.apply.subject.vo.ReplyVo;
import com.tykj.dev.device.file.service.FilesUtil; import com.tykj.dev.device.file.service.FilesUtil;
import com.tykj.dev.device.library.repository.DeviceLibraryDao; import com.tykj.dev.device.library.repository.DeviceLibraryDao;
...@@ -47,12 +48,12 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -47,12 +48,12 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.ArrayList; import java.util.*;
import java.util.Comparator; import java.util.function.Function;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import static java.util.stream.Collectors.toMap;
/** /**
* @author dengdiyi * @author dengdiyi
*/ */
...@@ -343,7 +344,16 @@ public class TaskSelectController { ...@@ -343,7 +344,16 @@ public class TaskSelectController {
deviceApplyBillEntity.setReplyFileList(FilesUtil.stringFileToList(deviceApplyBillEntity.getReplyFiles())); deviceApplyBillEntity.setReplyFileList(FilesUtil.stringFileToList(deviceApplyBillEntity.getReplyFiles()));
deviceApplyBillEntity.setApplyFileList(FilesUtil.stringFileToList(deviceApplyBillEntity.getApplyFiles())); deviceApplyBillEntity.setApplyFileList(FilesUtil.stringFileToList(deviceApplyBillEntity.getApplyFiles()));
deviceApplyBillEntity.setApplyNumFileList(FilesUtil.stringFileToList(deviceApplyBillEntity.getApplyNumFiles())); deviceApplyBillEntity.setApplyNumFileList(FilesUtil.stringFileToList(deviceApplyBillEntity.getApplyNumFiles()));
deviceApplyBillEntity.setReplyVoList(JacksonUtil.readValue(deviceApplyBillEntity.getReplyVos(),new TypeReference<List<ReplyVo>>(){})); Map<Integer,ReplyVo> map = new HashMap<>();
if (deviceApplyBillEntity.getReplyVos()!=null) {
map = Objects.requireNonNull(JacksonUtil.readValue(deviceApplyBillEntity.getReplyVos(), new TypeReference<List<ReplyVo>>() {
})).stream().collect(toMap(ReplyVo::getId, Function.identity()));
}
Map<Integer,ApplyBillDetailVo> statMap = new HashMap<>();
if (deviceApplyBillEntity.getApplyStat()!=null){
statMap = Objects.requireNonNull(JacksonUtil.readValue(deviceApplyBillEntity.getApplyStat(), new TypeReference<List<ApplyBillDetailVo>>() {
})).stream().collect(toMap(ApplyBillDetailVo::getPackingId, Function.identity()));
}
list.add(deviceApplyBillEntity); list.add(deviceApplyBillEntity);
List<Integer> idList = StringSplitUtil.userIdSplit(deviceApplyBillEntity.getApplyDetail()); List<Integer> idList = StringSplitUtil.userIdSplit(deviceApplyBillEntity.getApplyDetail());
List<Integer> packingIdList = new ArrayList<>(); List<Integer> packingIdList = new ArrayList<>();
...@@ -361,7 +371,19 @@ public class TaskSelectController { ...@@ -361,7 +371,19 @@ public class TaskSelectController {
if (packingIdList.size() == numList.size()) { if (packingIdList.size() == numList.size()) {
for (int i = 0; i < packingIdList.size(); i++) { for (int i = 0; i < packingIdList.size(); i++) {
PackingLibrary p = packingLibraryService.getOne(packingIdList.get(i)); PackingLibrary p = packingLibraryService.getOne(packingIdList.get(i));
p.setApplyNum(numList.get(i)); if (deviceApplyBillEntity.getApplyType()==1) {
p.setApplyNum(numList.get(i));
if (statMap.size()>0){
p.setCompleteNum(statMap.get(p.getId()).getCompleteCount());
p.setWaitNum(p.getApplyNum()-p.getCompleteNum());
}
}
else {
if (map.size()>0) {
p.setApplyNum(map.get(p.getId()).getNum());
p.setSeq(map.get(p.getId()).getSeqInterval());
}
}
packingLibraryEntityList.add(p); packingLibraryEntityList.add(p);
} }
} }
...@@ -468,6 +490,5 @@ public class TaskSelectController { ...@@ -468,6 +490,5 @@ public class TaskSelectController {
@GetMapping("/signature/create") @GetMapping("/signature/create")
public ResponseEntity createSignatureId() { public ResponseEntity createSignatureId() {
return ResponseEntity.ok(snowflake.creatNextId()); return ResponseEntity.ok(snowflake.creatNextId());
} }
} }
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论