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

更新

上级 643df8c1
......@@ -48,5 +48,9 @@
<groupId>com.tykj</groupId>
<artifactId>dev-file</artifactId>
</dependency>
<dependency>
<groupId>com.tykj</groupId>
<artifactId>dev-packing</artifactId>
</dependency>
</dependencies>
</project>
\ No newline at end of file
......@@ -207,21 +207,22 @@ public class AllotBillController {
ids.add(id);
//改变装备状态
DeviceLibrary deviceLibraryEntity = deviceLibraryService.getOne(id);
// PackingLibrary packingLibrary =
if (allotBillSaveVo.getAllotType() == 2){
if (deviceLibraryEntity.getAllotType()!=2){
deviceLibraryEntity.setAllotType(2);
DeviceLogDto deviceLogDto = new DeviceLogDto(id, "将配发类型由" + deviceLibraryEntity.getAllotTypeName() + "改为"+configCache.getAllotTypeMap().get(2), fileVoList);
deviceLogService.addLog(deviceLogDto);
}
// if (deviceLibraryEntity.getAllotType()!=2){
// deviceLibraryEntity.setAllotType(2);
// DeviceLogDto deviceLogDto = new DeviceLogDto(id, "将配发类型由" + deviceLibraryEntity.getAllotTypeName() + "改为"+configCache.getAllotTypeMap().get(2), fileVoList);
// deviceLogService.addLog(deviceLogDto);
// }
deviceLibraryEntity.setLifeStatus(3);
deviceLibraryEntity.setManageStatus(0);
}
else {
if (deviceLibraryEntity.getAllotType()!=1){
deviceLibraryEntity.setAllotType(1);
DeviceLogDto deviceLogDto = new DeviceLogDto(id, "将配发类型由" + deviceLibraryEntity.getAllotTypeName() + "改为"+configCache.getAllotTypeMap().get(1), fileVoList);
deviceLogService.addLog(deviceLogDto);
}
// if (deviceLibraryEntity.getAllotType()!=1){
// deviceLibraryEntity.setAllotType(1);
// DeviceLogDto deviceLogDto = new DeviceLogDto(id, "将配发类型由" + deviceLibraryEntity.getAllotTypeName() + "改为"+configCache.getAllotTypeMap().get(1), fileVoList);
// deviceLogService.addLog(deviceLogDto);
// }
deviceLibraryEntity.setLocationUnit(allotBillSaveVo.getReceiveUnit());
deviceLibraryEntity.setOwnUnit(allotBillSaveVo.getReceiveUnit());
}
......@@ -608,50 +609,44 @@ public class AllotBillController {
TaskDisposeUtil.isNotSubmit(taskBto.getBillStatus(),StatusEnum.WAIT_UPLOAD_ALLOT_RECEIVE_FILE);
Integer userId = userUtils.getCurrentUserId();
taskService.addInvolveUser(taskBto,userId);
//不上传单据
if (fileUploadVo.getStatus()==0){
taskService.moveToArchive(taskBto);
taskService.moveToEnd(taskBto);
taskService.moveAllSonNodeToEnd(taskBto.getId());
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 {
taskService.moveToEnd(taskBto);
taskService.moveAllSonNodeToEnd(taskBto.getId());
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());
}
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);
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()));
});
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);
}
//发送阅知信息
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);
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) {
List<Integer> idList1 = new ArrayList<>();
idList1.add(fileUploadVo.getSendUserbId());
MessageBto messageBto = new MessageBto(taskBto.getId(), taskBto.getBusinessType(), "被选为签发人", idList1, 1);
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("上传成功");
}
......@@ -666,11 +661,6 @@ public class AllotBillController {
statusEnums.add(StatusEnum.WAIT_UPLOAD_CROSS_FILE);
statusEnums.add(StatusEnum.WAIT_UPLOAD_ALLOT_FILE);
TaskDisposeUtil.isNotSubmit(taskBto.getBillStatus(),statusEnums);
//不上传单据
// if (fileVo.getStatus()==0){
// taskService.moveToArchive(taskBto);
// }
// else {
AllotBill allotBill = allotBillService.getOne(taskBto.getBillId());
List<Integer> idList = new ArrayList<>();
if (fileVo.getReceiveUseraId()!=null) {
......@@ -706,7 +696,6 @@ public class AllotBillController {
deviceLibrary.setManageStatus(1);
deviceLibraryService.update(deviceLibrary);
});
// }
if (idList.size()>0) {
MessageBto messageBto = new MessageBto(taskBto.getId(), taskBto.getBusinessType(), "被选为经办人", idList, 1);
messageService.add(messageBto);
......@@ -716,7 +705,7 @@ public class AllotBillController {
userIds.addAll(userDao.findAllByUnitsId(userPublicService.findUnitIdByName(allotBill.getReceiveUnit())).stream()
.map(User::getUserId)
.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);
return ResponseEntity.ok("OK");
}
......
......@@ -245,7 +245,8 @@ public class BackController {
MessageBto messageBto = new MessageBto(taskBto.getId(), taskBto.getBusinessType(), "被选为签发人", idList1, 1);
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);
log.info("[退回模块]:接收并发起入库");
myWebSocket.sendMessage1();
......@@ -296,6 +297,13 @@ public class BackController {
MessageBto messageBto = new MessageBto(taskBto.getId(), taskBto.getBusinessType(), "被选为签发人", idList1, 1);
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("上传成功");
}
......@@ -310,11 +318,6 @@ public class BackController {
List<StatusEnum> statusEnums = new ArrayList<>();
statusEnums.add(StatusEnum.WAIT_UPLOAD_BACK_FILE_2);
TaskDisposeUtil.isNotSubmit(taskBto.getBillStatus(),statusEnums);
//不上传单据
// if (fileVo.getStatus()==0){
// taskService.moveToArchive(taskBto);
// }
// else {
AllotBackBill allotBackBill = allotBackBillService.getOne(taskBto.getBillId());
List<Integer> idList = new ArrayList<>();
if (fileVo.getReceiveUseraId()!=null) {
......@@ -344,7 +347,13 @@ public class BackController {
MessageBto messageBto = new MessageBto(taskBto.getId(), taskBto.getBusinessType(), "被选为经办人", idList, 1);
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");
}
......
......@@ -29,7 +29,7 @@ public class FileUploadVo {
@ApiModelProperty(value = "配发单附件URL")
private String billFileUrl;
@NotNull(message = "status不能为空")
// @NotNull(message = "status不能为空")
@ApiModelProperty(value = "是否上传单据(0:否,1:是)")
private Integer status;
......
......@@ -24,7 +24,7 @@ public class FileVo {
@ApiModelProperty(value = "配发附件")
private List<FileRet> allotFiles;
@NotNull(message = "status不能为空")
// @NotNull(message = "status不能为空")
@ApiModelProperty(value = "是否上传单据(0:否,1:是)")
private Integer status;
......
......@@ -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.vo.DeviceLibrarySelectVo;
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.subject.domin.PackingLibrary;
import com.tykj.dev.device.task.repository.TaskDao;
......@@ -103,6 +104,9 @@ public class DeviceApplyController {
@Autowired
private UserDao userDao;
@Autowired
private PackingController packingController;
@ApiOperation(value = "发起装备申请", notes = "可以通过这个接口发起装备申请")
@PostMapping("/addDeviceApplyBill")
@Transactional(rollbackFor = Exception.class)
......@@ -112,13 +116,27 @@ public class DeviceApplyController {
Integer userId = userUtils.getCurrentUserId();
//发起任务
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){
deviceApplyBillEntity.setApplyStatus(3);
deviceApplyBillService.update(deviceApplyBillEntity);
List<Integer> userIds = new ArrayList<>();
userIds.add(userId);
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 {
//指定批复人
......@@ -126,14 +144,14 @@ public class DeviceApplyController {
List<Integer> userIds = new ArrayList<>();
userIds.add(userId);
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 {
List<Integer> userIds = new ArrayList<>();
userIds.add(userId);
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);
......@@ -378,6 +396,12 @@ public class DeviceApplyController {
@PostMapping("/uploadFile")
@Transactional(rollbackFor = Exception.class)
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());
taskService.addInvolveUser(taskBto,userUtils.getCurrentUserId());
taskService.moveToNext(taskBto);
......@@ -387,8 +411,14 @@ public class DeviceApplyController {
if(uploadApplyFile.getReplyVos()!=null&&uploadApplyFile.getReplyVos().size()>0){
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);
return ResponseEntity.ok("上传成功");
return ResponseEntity.ok("ok");
}
@ApiOperation(value = "确认接收申请装备", notes = "确认接收申请装备")
......
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.file.entity.FileRet;
import io.swagger.annotations.ApiModel;
......@@ -93,8 +94,12 @@ public class DeviceApplyBill {
* 列装库主键idx数量(,作为分隔符),例如1x2,2x3,意为列装库id为1的申请2件,id为2的申请3件
*/
@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;
@Column(name = "apply_stat",columnDefinition = "TEXT")
@ApiModelProperty(value = "申请统计Json")
private String applyStat;
/**
* 创建用户id
*/
......@@ -162,4 +167,7 @@ public class DeviceApplyBill {
@Transient
private List<ReplyVo> replyVoList = new ArrayList<>();
@Transient
private List<ApplyBillDetailVo> applyBillDetailVos = new ArrayList<>();
}
......@@ -4,11 +4,6 @@ import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.Valid;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import java.util.List;
/**
* @author dengdiyi
*/
......@@ -16,16 +11,16 @@ import java.util.List;
@ApiModel("入库详情类")
public class ApplyBillDetailVo {
@ApiModelProperty(value = "配件列表")
List<ApplyBillDetailVo> list;
@NotNull(message = "packingId不能为空")
@Min(value = 1,message = "packingId不能小于1")
// @NotNull(message = "packingId不能为空")
// @Min(value = 1,message = "packingId不能小于1")
@ApiModelProperty(value = "列装id")
private Integer packingId;
@NotNull(message = "storageCount不能为空")
@Min(value = 1,message = "storageCount不能小于1")
// @NotNull(message = "storageCount不能为空")
// @Min(value = 1,message = "storageCount不能小于1")
@ApiModelProperty(value = "申请数量")
private Integer storageCount;
@ApiModelProperty(value = "已入库数量")
private Integer completeCount = 0;
}
......@@ -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.file.entity.FileRet;
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.ApiModelProperty;
import lombok.Data;
import org.springframework.beans.BeanUtils;
import org.modelmapper.ModelMapper;
import javax.validation.Valid;
import javax.validation.constraints.Min;
......@@ -21,11 +23,11 @@ import java.util.List;
@ApiModel("装备申请存储类")
public class DeviceApplySaveVo {
@NotNull(message = "applyNumber不能为空")
// @NotNull(message = "applyNumber不能为空")
@ApiModelProperty(value = "申请文号")
private String applyNumber;
@NotNull(message = "replayNumber不能为空")
// @NotNull(message = "replayNumber不能为空")
@ApiModelProperty(value = "批复文号")
private String replayNumber;
......@@ -67,17 +69,25 @@ public class DeviceApplySaveVo {
private Integer applyType;
public DeviceApplyBill toDo() {
DeviceApplyBill deviceApplyBillEntity = new DeviceApplyBill();
BeanUtils.copyProperties(this, deviceApplyBillEntity);
ModelMapper mapper = BeanHelper.getUserMapper();
DeviceApplyBill deviceApplyBillEntity = mapper.map(this, DeviceApplyBill.class);
deviceApplyBillEntity.setApplyStatus(0);
StringBuffer stringBuffer = new StringBuffer();
stringBuffer.append("x");
if (this.storageBillDetailVoList.size() > 0) {
for (ApplyBillDetailVo s : storageBillDetailVoList) {
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());
if(this.applyFiles!=null&&this.applyFiles.size()>0){
deviceApplyBillEntity.setApplyFiles(FilesUtil.stringFileToList(this.applyFiles));
......
......@@ -26,4 +26,10 @@ public class UploadApplyFile {
@ApiModelProperty(value = "申请批复装备")
private List<ReplyVo> replyVos;
@ApiModelProperty(value = "批复文号")
private String replayNumber;
@ApiModelProperty(value = "批复文号附件名")
private List<FileRet> replyFiles;
}
......@@ -245,8 +245,8 @@ public enum LogType {
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_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_6(107,APPLY.id, WAIT_CONFIRM_APPLY_DEVICE.id, END.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, "业务办结"),
;
public Integer id;
......
......@@ -147,7 +147,7 @@ public class DeviceLibraryController {
@ApiOperation(value = "模糊查询核心装备分页", notes = "可以通过这个接口查询装备列表")
@PostMapping("/core/feature/summary")
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<>();
// if (deviceLibrarySelectVo.getOrders().size() > 0) {
// for (CustomOrder c:deviceLibrarySelectVo.getOrders()) {
......
......@@ -40,7 +40,7 @@ public interface DeviceLibraryService {
* @param deviceLibrarySelectVo 装备查询vo
* @param pageable 获取核心装备分页
*/
List<DeviceLibrary> getCoreDevicePage(DeviceLibrarySelectVo deviceLibrarySelectVo, Pageable pageable);
List<DeviceLibrary> getCoreDevicePage(DeviceLibrarySelectVo deviceLibrarySelectVo);
/**
* @param deviceLibrarySelectVo 装备查询vo
......
......@@ -86,7 +86,7 @@ public class DeviceLibraryServiceImpl implements DeviceLibraryService {
}
@Override
public List<DeviceLibrary> getCoreDevicePage(DeviceLibrarySelectVo deviceLibrarySelectVo, Pageable pageable) {
public List<DeviceLibrary> getCoreDevicePage(DeviceLibrarySelectVo deviceLibrarySelectVo) {
Integer selectUnitId = deviceLibrarySelectVo.getUnitId();
Integer selectAreaId = deviceLibrarySelectVo.getAreaId();
//areaId为null
......@@ -179,7 +179,7 @@ public class DeviceLibraryServiceImpl implements DeviceLibraryService {
d.setName(deviceLibrarySelectVo.getName());
d.setContent(deviceLibrarySelectVo.getContent());
//获取所有的核心装备
List<DeviceLibrary> libraryEntities = getCoreDevicePage(d, d.getPageable());
List<DeviceLibrary> libraryEntities = getCoreDevicePage(d);
if (libraryEntities.size() > 0) {
Map<String, List<DeviceLibrary>> map = libraryEntities.stream().collect(groupingBy(deviceLibrary -> deviceLibrary.getModel()+"Ǵ"+deviceLibrary.getName()));
//按型号遍历统计各种状态的装备数量
......
......@@ -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 {
/**
* 等待上传申请回执单
*/
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;
import com.tykj.dev.config.swagger.AutoDocument;
import com.tykj.dev.device.library.service.DeviceLibraryService;
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.PackingLogDao;
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.PackingLog;
import com.tykj.dev.device.packing.subject.vo.*;
import com.tykj.dev.device.task.service.TaskLogService;
import com.tykj.dev.device.task.service.TaskService;
import com.tykj.dev.device.task.subject.bto.TaskBto;
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.util.UserUtils;
import com.tykj.dev.misc.base.BusinessEnum;
......@@ -64,6 +70,15 @@ public class PackingController {
@Autowired
DeviceLibraryService deviceLibraryService;
@Autowired
MessageService messageService;
@Autowired
PackingLogDao packingLogDao;
@Autowired
PackingLogService packingLogService;
@ApiOperation(value = "新增列装", notes = "可以通过这个接口发起列装")
@PostMapping("/addPackingLibrary")
@Transactional(rollbackFor = Exception.class)
......@@ -183,6 +198,22 @@ public class PackingController {
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);
}
......@@ -191,13 +222,48 @@ public class PackingController {
public ResponseEntity addPack(@RequestBody @Validated AddPack addPack){
PackingLibrary packingLibrary = addPack.toDo();
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){
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 {
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("添加成功");
}
......@@ -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 = "编辑列装型号")
@PostMapping("/update/model")
public ResponseEntity updateModel(@RequestBody @Validated PackingModelEdit packingModelEdit){
......@@ -341,4 +431,11 @@ public class PackingController {
PackingLibrary packingLibrary = packingLibraryService.getOne(id);
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;
import com.tykj.dev.device.packing.service.PackingLibraryService;
import com.tykj.dev.device.packing.subject.domin.PackingLibrary;
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 io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
......@@ -66,8 +66,7 @@ public class PackingLibraryController {
@ApiOperation(value = "列装库退装分页查询", notes = "可以通过这个接口进行列装查询")
@PostMapping("/retired/summary")
public ResponseEntity getInvalidPage(@RequestBody PackingLibrarySelectVo packingLibrarySelectVo) {
Page<PackingLibrary> packingLibraryEntityPage = packingLibraryService.getInvalidPage(packingLibrarySelectVo, packingLibrarySelectVo.getPageable());
packingLibraryEntityPage.getContent().forEach(PackingLibrary::setConfigName);
Page<PackingLibrary> packingLibraryEntityPage = PageUtil.getPerPage(packingLibrarySelectVo.getPage(),packingLibrarySelectVo.getSize(),packingLibraryService.getInvalidPage(packingLibrarySelectVo, packingLibrarySelectVo.getPageable()),packingLibrarySelectVo.getPageable());
return ResultUtil.success(packingLibraryEntityPage);
}
......
......@@ -16,4 +16,6 @@ public interface PackingLibraryDao extends JpaRepository<PackingLibrary, Integer
List<PackingLibrary> findAllByIdIn(List<Integer> ids);
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 {
* @param packingLibrarySelectVo 列装查询vo
* @param pageable 获取列装库退装分页
*/
Page<PackingLibrary> getInvalidPage(PackingLibrarySelectVo packingLibrarySelectVo, Pageable pageable);
List<PackingLibrary> getInvalidPage(PackingLibrarySelectVo packingLibrarySelectVo, Pageable pageable);
/**
* @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;
import com.tykj.dev.device.library.subject.vo.Script;
import com.tykj.dev.device.packing.repository.PackingLibraryDao;
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.PackingLog;
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.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.misc.exception.ApiException;
import com.tykj.dev.misc.utils.*;
......@@ -29,6 +34,7 @@ import org.springframework.stereotype.Service;
import javax.persistence.Transient;
import java.lang.reflect.Field;
import java.sql.Timestamp;
import java.util.*;
import java.util.concurrent.CompletableFuture;
import java.util.stream.Collectors;
......@@ -59,6 +65,15 @@ public class PackingLibraryServiceImpl implements PackingLibraryService {
@Autowired
private ConfigCache configCache;
@Autowired
private PackingLogService packingLogService;
@Autowired
private UserPublicService userPublicService;
@Autowired
private MessageService messageService;
@Override
public PackingLibrary addEntity(PackingLibrary packingLibraryEntity) {
PackingLibrary packingLibrary = packingLibraryDao.save(packingLibraryEntity);
......@@ -97,8 +112,18 @@ public class PackingLibraryServiceImpl implements PackingLibraryService {
}
@Override
public Page<PackingLibrary> getInvalidPage(PackingLibrarySelectVo packingLibrarySelectVo, Pageable pageable) {
return packingLibraryDao.findAll(getSelectSpecification2(packingLibrarySelectVo), pageable);
public List<PackingLibrary> getInvalidPage(PackingLibrarySelectVo packingLibrarySelectVo, Pageable 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
......@@ -197,7 +222,15 @@ public class PackingLibraryServiceImpl implements PackingLibraryService {
@Override
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 {
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 {
List<Script> scripts = new ArrayList<>();
List<DeviceLibrary> deviceLibraries = new ArrayList<>();
ids.forEach(integer -> deviceLibraries.add(deviceLibraryMap.get(integer)));
Map<String, List<DeviceLibrary>> map = deviceLibraries.stream().collect(groupingBy(deviceLibrary -> deviceLibrary.getPackingId()+"Ǵ"+deviceLibrary.getAllotTypeName()));
for (String s:map.keySet()){
String[] strings = s.split("Ǵ");
if (strings.length==2) {
Integer packingId = Integer.valueOf(strings[0]);
String allotType = strings[1];
List<DeviceLibrary> deviceLibraryList = map.get(s);
Map<Integer, List<DeviceLibrary>> map = deviceLibraries.stream().collect(groupingBy(DeviceLibrary::getPackingId));
for (Integer packingId:map.keySet()){
List<DeviceLibrary> deviceLibraryList = map.get(packingId);
PackingLibrary packingLibrary = getOne(packingId);
packingLibrary.setConfigName();
Script script = new Script();
script.setId(packingId);
script.setPartParentId(packingLibrary.getPartParentId());
......@@ -352,11 +387,10 @@ public class PackingLibraryServiceImpl implements PackingLibraryService {
script.setSecretLevel(packingLibrary.getSecretLevelName());
script.setType(packingLibrary.getTypeName());
script.setNum(deviceLibraryList.size());
script.setAllotType(allotType);
script.setAllotTypeNum(deviceLibraryList.get(0).getAllotType());
script.setAllotType(packingLibrary.getMatchingRangeName());
script.setAllotTypeNum(packingLibrary.getMatchingRange());
script.setSeqNumber(StringSplitUtil.stringListToString(DeviceSeqUtil.getContinuousSeqs(deviceLibraryList.stream().map(DeviceLibrary::getSeqNumber).collect(Collectors.toList()))));
scripts.add(script);
}
}
Map<Integer, Script> nodeCollect =
scripts.stream().collect(Collectors.toMap(Script::getId, script -> script));
......@@ -370,6 +404,7 @@ public class PackingLibraryServiceImpl implements PackingLibraryService {
for (Script s:conList) {
addScript(scriptList,s);
}
scriptList.forEach(script -> script.setChilds(null));
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 {
@ApiModelProperty(value = "申请数量")
@Transient
private Integer applyNum;
@ApiModelProperty(value = "待入库数量")
@Transient
private Integer waitNum;
@ApiModelProperty(value = "已入库数量")
@Transient
private Integer completeNum;
@ApiModelProperty(value = "预分配的装备序列号")
@Transient
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 {
if (repairBillSaveVo.getScriptSaveVos()!=null){
deviceRepairSendBillEntity.setScriptJson(JacksonUtil.toJSon(repairBillSaveVo.getScriptSaveVos()));
}
// repairBill.setRepairStatus(0);
//更新维修单和送修单状态
//如果当前为省向国家发起的
if (level == 1) {
repairBill.setRepairStatus(4);
......@@ -208,9 +206,7 @@ public class RepairController {
}
repairBill.setStartUserB(repairBillSaveVo.getAgent());
repairBill.setStartUserA(userPublicService.getOne(repairBillSaveVo.getStartUseraId()).getName());
// repairBill.setStartUserB(userPublicService.getOne(repairBillSaveVo.getStartUserbId()).getName());
//生成单位电子签章id
// Long signId = snowflake.creatNextId();
Long signId2 = snowflake.creatNextId();
if (repairBillSaveVo.getLeftSignatureId()!=null) {
repairBill.setLeftSignatureId(repairBillSaveVo.getLeftSignatureId());
......@@ -226,8 +222,6 @@ public class RepairController {
userIds.add(userId);
userIds.add(0);
//存业务日志
List<FileVo> fileVoList = new ArrayList<>();
// fileVoList.add(new FileVo("出库确认单", repairBillSaveVo.getFileName(), repairBillSaveVo.getFileUrl()));
deviceRepairSendBillEntity.setRepairStatus(0);
deviceRepairSendBillEntity.setSendTime(new Date());
StringBuffer stringBuffer = new StringBuffer();
......@@ -367,12 +361,6 @@ public class RepairController {
@PostMapping(value = "/continue/form")
@Transactional(rollbackFor = Exception.class)
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);
}
......@@ -495,9 +483,12 @@ public class RepairController {
repairSendBill.setRepairUseraId(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<>();
// fileVoList.add(new FileVo("入库确认单", repairSendBill.getReceiveFileName(), repairSendBill.getReceiveFileUrl()));
//更新维修单和送修单
repairBill.setRepairStatus(4);
repairBill.setRepairUserB(userPublicService.getOne(repairReceiveVo.getReceiveUserbId()).getName());
......@@ -516,12 +507,7 @@ public class RepairController {
repairSendBill.setRepairReciveCheckDetail(repairReceiveVo.getReceiveCheckDetail());
repairSendBill.setRepairReciveCheckResult(repairReceiveVo.getReceiveCheckResult());
repairSendBill.setRepairUserbId(repairReceiveVo.getReceiveUserbId());
//任务推至下一阶段
// taskService.moveToSpecial(taskBto,StatusEnum.REPAIRING);
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){
repairReceiveVo.getReceiveFiles().forEach(fileRet -> {
fileVoList.add(new FileVo("维修单", fileRet.getName(), fileRet.getPreviewPath()));
......@@ -531,12 +517,14 @@ public class RepairController {
taskService.moveToEnd(taskBto);
//子任务完结
taskService.moveAllSonNodeToEnd(taskBto.getId());
//阅知
MessageBto messageBto = new MessageBto(taskBto.getId(),taskBto.getBusinessType(),"业务办结",ids,1);
messageService.add(messageBto);
}
else {
taskService.moveToSpecial(taskBto,StatusEnum.WAIT_UPLOAD_FILE);
}
deviceRepairSendBillService.update(repairSendBill);
// taskService.update(taskService.moveToNext(taskBto, repairReceiveVo.getReceiveUserbId()));
//分隔装备id
String[] strings = deviceIdDetail.split("x");
//存接收无误的装备id
......@@ -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 -> {
repairDetail.setLocationUnit(userUtils.getCurrentUserUnitName());
......@@ -598,10 +576,6 @@ public class RepairController {
MessageBto messageBto = new MessageBto(taskBto.getId(), taskBto.getBusinessType(), "被选为签发人", idList1, 1);
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);
messageService.add(messageBto);
myWebSocket.sendMessage1();
......@@ -621,9 +595,16 @@ public class RepairController {
taskService.moveToArchive(taskBto);
}
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.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.setBillFileUrl(fileUploadVo.getBillFileUrl());
List<FileVo> fileVoList = new ArrayList<>();
......@@ -634,7 +615,6 @@ public class RepairController {
repairSendBill.setReceiveFiles(FilesUtil.stringFileToList(fileUploadVo.getReceiveFiles()));
}
deviceRepairSendBillService.update(repairSendBill);
// fileVoList.add(new FileVo("维修单", repairSendBill.getBillFileName(), repairSendBill.getBillFileUrl()));
//添加装备日志
List<Integer> deviceIds = StringSplitUtil.split(repairSendBill.getRepairDeviceCheckDetail());
deviceIds.forEach(integer -> {
......@@ -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 = "可以通过这个接口修好装备出库")
@PostMapping(value = "/back")
@Transactional(rollbackFor = Exception.class)
......@@ -778,19 +716,15 @@ public class RepairController {
});
}
//获取当前维修业务,维修单
// TaskBto taskBto = taskService.get(repairBackBillSaveVo.getTaskId());
Integer userId = userUtils.getCurrentUserId();
// RepairBill repairBill = deviceRepairBillService.getOne(taskBto.getBillId());
//生成维修退回单
RepairBackBill repairBackBill = new RepairBackBill();
BeanUtils.copyProperties(repairBackBillSaveVo, repairBackBill);
repairBackBill.setBackStatus(2);
// repairBackBill.setDeviceRepairBillId(repairBill.getId());
repairBackBill.setSendTime(new Date());
repairBackBill.setTitle("维修退回业务");
repairBackBill.setAgent(repairBackBillSaveVo.getAgent());
//生成单位签章id
// Long signId = snowflake.creatNextId();
Long signId2 = snowflake.creatNextId();
if (repairBackBillSaveVo.getLeftSignatureId()!=null) {
repairBackBill.setLeftSignatureId(repairBackBillSaveVo.getLeftSignatureId());
......@@ -814,7 +748,6 @@ public class RepairController {
taskService.start(taskBto2);
//添加业务日志
List<FileVo> fileVoList = new ArrayList<>();
// fileVoList.add(new FileVo("出库确认单", repairBackBillSaveVo.getFileName(), repairBackBillSaveVo.getFileUrl()));
//添加装备日志
for (DeviceDetailVo d : repairBackBillSaveVo.getDeviceList()) {
RepairDetail repairDetail = deviceRepairDetailService.getOne(d.getId());
......@@ -832,28 +765,6 @@ public class RepairController {
List<Integer> idList = StringSplitUtil.split(deviceIdDetail);
//添加出库白名单
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());
ids.addAll(userDao.findAllByUnitsId(userPublicService.findUnitIdByName(repairBackBill.getReceiveUnit())).stream()
......@@ -956,27 +867,6 @@ public class RepairController {
}
} else {
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.setSendUnit(deviceLibraryService.getOne(repairReceiveVo.getDeviceList().get(0).getDeviceId()).getLocationUnit());
repairBackBill.setReceiveUnit(userUtils.getCurrentUserUnitName());
......@@ -984,7 +874,6 @@ public class RepairController {
repairBackBill.setStartUseraId(repairReceiveVo.getStartUseraId());
repairBackBill.setStartUserbId(repairReceiveVo.getStartUserbId());
repairBackBill.setReceiveUserbId(repairReceiveVo.getReceiveUserbId());
// repairBackBill.setDeviceRepairBillId(taskBto.getBillId());
}
String deviceIdDetail = repairReceiveVo.getReceiveCheckDetail();
if (repairBackBill.getReceiveUseraId() == null) {
......@@ -1002,9 +891,6 @@ public class RepairController {
repairBackBill.setBackReciveCheckResult(repairReceiveVo.getReceiveCheckResult());
repairBackBill.setReceiveUserbId(repairReceiveVo.getReceiveUserbId());
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){
repairReceiveVo.getReceiveFiles().forEach(fileRet -> {
fileVoList.add(new FileVo("回执单", fileRet.getName(), fileRet.getPreviewPath()));
......@@ -1012,7 +898,6 @@ public class RepairController {
repairBackBill.setReceiveFiles(FilesUtil.stringFileToList(repairReceiveVo.getReceiveFiles()));
}
RepairBackBill repairBackBill1 = deviceRepairBackBillService.update(repairBackBill);
// fileVoList.add(new FileVo("入库确认单", repairBackBill.getReceiveFileName(), repairBackBill.getReceiveFileUrl()));
TaskBto taskBto2;
Map<Integer,List<Integer>> messageMap = new HashMap<>();
if (level == 1) {
......@@ -1040,20 +925,14 @@ public class RepairController {
messageMap.put(unitId, Collections.singletonList(repairDetail1.getId()));
}
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());
messageMap.put(unitId,ids);
}
}
deviceRepairDetailService.update(repairDetail);
}
//添加业务日志
// TaskLogBto taskLogBto2 = new TaskLogBto(taskBto2.getId(), "维修退回装备接收并发起入库", fileVoList);
// taskLogService.addLog(taskLogBto2);
} else {
// if (repairReceiveVo.getStatus()==0) {
//任务推至下一阶段
// taskService.update(taskService.moveToNext(taskBto, repairReceiveVo.getReceiveUserbId()));
if (repairReceiveVo.getStatus()==0) {
taskBto2 = taskService.moveToEnd(taskBto);
//子任务完结
......@@ -1062,14 +941,9 @@ public class RepairController {
else {
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());
repairDetailList.forEach(repairDetail -> {
// repairDetail.setLocationUnit(userUtils.getCurrentUserUnitName());
repairDetail.setRepairStatus(5);
if (repairDetail.getPid()!=null) {
RepairDetail repairDetail1 = deviceRepairDetailService.getOne(repairDetail.getPid());
......@@ -1080,7 +954,7 @@ public class RepairController {
messageMap.put(unitId, Collections.singletonList(repairDetail1.getId()));
}
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());
messageMap.put(unitId,ids);
}
......@@ -1088,26 +962,15 @@ public class RepairController {
deviceRepairDetailService.update(repairDetail);
});
}
// TaskBto parent = taskService.get(taskBto2.getParentTaskId());
String[] strings = deviceIdDetail.split("x");
//存放正常接收的装备id
Set<String> units = new HashSet<>();
List<Integer> idList = new ArrayList<>();
for (String s : strings) {
if (s.length() > 1) {
//接收无误的装备
if ("1".equals(s.substring(s.length() - 1))) {
Integer id = Integer.parseInt(s.substring(0, s.length() - 1));
idList.add(id);
//更改装备状态
DeviceLibrary deviceLibraryEntity = deviceLibraryService.getOne(id);
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());
if (deviceLibraryEntity.getOwnUnit().equals(deviceLibraryEntity.getLocationUnit())) {
deviceLibraryEntity.setLifeStatus(2);
......@@ -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> ids2 = new ArrayList<>();
units.forEach(s -> ids2.addAll(userDao.findAllByUnitsId(userPublicService.findUnitIdByName(s)).stream()
.map(User::getUserId)
.collect(Collectors.toList())));
if (level>1) {
ids.addAll(userDao.findAllByUnitsId(userPublicService.findUnitIdByName(repairBackBill.getSendUnit())).stream()
.map(User::getUserId)
......@@ -1174,7 +1012,8 @@ public class RepairController {
MessageBto messageBto = new MessageBto(taskBto2.getId(), taskBto2.getBusinessType(), "被选为签发人", idList1, 1);
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);
messageMap.keySet().forEach(integer -> {
List<Integer> integerList = new ArrayList<>();
......@@ -1185,8 +1024,6 @@ public class RepairController {
messageBto2.setRecord(StringSplitUtil.idListToString(messageMap.get(integer)));
messageService.add(messageBto2);
});
// MessageBto messageBto2 = new MessageBto(taskBto2.getId(),taskBto2.getBusinessType(),"待领取送修装备",ids2);
// messageService.add(messageBto2);
myWebSocket.sendMessage1();
return ResultUtil.success("维修成功退回装备接收入库");
}
......@@ -1204,9 +1041,16 @@ public class RepairController {
taskService.moveToArchive(taskBto);
}
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.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.setBillFileUrl(fileUploadVo.getBillFileUrl());
List<FileVo> fileVoList = new ArrayList<>();
......@@ -1217,7 +1061,6 @@ public class RepairController {
repairBackBill.setReceiveFiles(FilesUtil.stringFileToList(fileUploadVo.getReceiveFiles()));
}
deviceRepairBackBillService.update(repairBackBill);
// fileVoList.add(new FileVo("回执单", repairBackBill.getBillFileName(), repairBackBill.getBillFileUrl()));
//添加装备日志
List<Integer> deviceIds = StringSplitUtil.split(repairBackBill.getBackReciveCheckDetail());
deviceIds.forEach(integer -> {
......@@ -1315,10 +1158,6 @@ public class RepairController {
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<>();
for (Integer id : repairStatusChangeVo.getId()) {
//获取维修详情单
......@@ -1351,17 +1190,6 @@ public class RepairController {
deviceLibraryService.update(deviceLibrary);
}
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();
//添加业务日志
......@@ -1371,9 +1199,6 @@ public class RepairController {
fileVos.add(fileVo);
}
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);
deviceLogService.addLog(deviceLogDto);
......@@ -1397,25 +1222,9 @@ public class RepairController {
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 -> {
List<Integer> ids2 = new ArrayList<>();
ids2.addAll(userDao.findAllByUnitsId(integer).stream()
......@@ -1576,16 +1385,10 @@ public class RepairController {
repairBackBill.setScripts(JacksonUtil.readValue(repairBackBill.getScriptJson(),new TypeReference<List<ScriptSaveVo>>() {}));
}
repairBillDetailVo.setRepairBackBill(repairBackBill);
//获取送修单
// RepairBill repairBill1 = deviceRepairBillService.getOne(taskService.get(taskBto.getParentTaskId()).getBillId());
// repairBillDetailVo.setRepairBill(repairBill1);
if (repairBackBill.getStartUseraId() != null) {
repairBackBill.setStartUserA(userPublicService.getOne(repairBackBill.getStartUseraId()).getName());
}
repairBackBill.setStartUserB(repairBackBill.getAgent());
// if (repairBackBill.getStartUserbId() != null) {
// repairBackBill.setStartUserB(userPublicService.getOne(repairBackBill.getStartUserbId()).getName());
// }
if (repairBackBill.getReceiveUseraId() != null) {
repairBackBill.setReceiveUserA(userPublicService.getOne(repairBackBill.getReceiveUseraId()).getName());
}
......@@ -1689,10 +1492,6 @@ public class RepairController {
integerList.add(5);
integerList.add(9);
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 -> {
repairDetail.setLocationUnit(deviceLibraryMap.get(repairDetail.getDeviceId()).getLocationUnit());
repairDetail.setConfigName();
......@@ -1826,6 +1625,13 @@ public class RepairController {
taskService.moveToEnd(taskBto);
//主业务完结
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<>();
fileVo.getSendFiles().forEach(fileRet -> fileVoList.add(new FileVo("领取单", fileRet.getName(), fileRet.getPreviewPath())));
......@@ -1878,6 +1684,13 @@ public class RepairController {
taskService.moveToEnd(taskBto);
//主业务完结
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<>();
fileVo.getSendFiles().forEach(fileRet -> fileVoList.add(new FileVo("维修单", fileRet.getName(), fileRet.getPreviewPath())));
......
......@@ -48,6 +48,10 @@
<groupId>com.tykj</groupId>
<artifactId>dev-confirmcheck</artifactId>
</dependency>
<dependency>
<groupId>com.tykj</groupId>
<artifactId>dev-matching</artifactId>
</dependency>
</dependencies>
</project>
\ No newline at end of file
......@@ -52,6 +52,16 @@ public class StatisticalController {
// @Autowired
// private ConfigCache configCache;
/**
* 查询工作台统计
* @return 作台统计对象集合
*/
@ApiOperation(value = "查询工作台统计")
@GetMapping("/workBench")
public ResponseEntity workBench(){
return ResponseEntity.ok(statisticalService.getWorkBenchStat());
}
/**
* 查询各市的装备数量
* @return 各市装备对象集合
......
......@@ -68,4 +68,9 @@ public interface StatisticalService {
* 获取专管员概要信息统计
*/
UserGeneralSituation getUserGeneralSituation();
/**
* 获取工作台统计
*/
WorkBench getWorkBenchStat();
}
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.repository.DeviceCheckDetailDao;
import com.tykj.dev.device.confirmcheck.repository.DeviceCheckStatDao;
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.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.repository.SelfCheckBillDao;
import com.tykj.dev.device.selfcheck.subject.domin.SelfCheckBill;
......@@ -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.TaskUserVo;
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.subject.dao.AreaDao;
import com.tykj.dev.device.user.subject.dao.UnitsDao;
......@@ -73,6 +77,15 @@ public class StatisticalServiceImpl implements StatisticalService {
@Autowired
private DeviceCheckStatDao deviceCheckStatDao;
@Autowired
private DeviceLibraryService deviceLibraryService;
@Autowired
private MatchingDeviceLibraryDao matchingDeviceLibraryDao;
@Autowired
private PackingLibraryDao packingLibraryDao;
/**
* 获取装备统计信息
*/
......@@ -461,6 +474,21 @@ public class StatisticalServiceImpl implements StatisticalService {
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 @@
<groupId>com.tykj</groupId>
<artifactId>dev-file</artifactId>
</dependency>
<dependency>
<groupId>com.tykj</groupId>
<artifactId>dev-apply</artifactId>
</dependency>
</dependencies>
</project>
\ No newline at end of file
......@@ -2,6 +2,9 @@ package com.tykj.dev.device.storage.controller;
import com.fasterxml.jackson.core.type.TypeReference;
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.library.repository.DeviceLibraryDao;
import com.tykj.dev.device.library.service.DeviceLibraryService;
......@@ -37,6 +40,9 @@ import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.*;
import java.util.function.Function;
import static java.util.stream.Collectors.toMap;
/**
* @author dengdiyi
......@@ -80,6 +86,9 @@ public class StorageBillController {
@Autowired
private Snowflake snowflake;
@Autowired
private DeviceApplyBillService deviceApplyBillService;
@ApiOperation(value = "自动生成序列号", notes = "可以通过这个接口自动生成序列号")
@PostMapping(value = "/autoCreate/{num}")
public ResponseEntity autoCreate(@PathVariable("num") int num){
......@@ -111,61 +120,44 @@ public class StorageBillController {
List<PackingLibrary> libraryEntities = new ArrayList<>();
Map<Integer, List<PackingLibrary>> map = new HashMap<>();
for (StorageBillDetailVo s : list) {
List<String> strings = DeviceSeqUtil.createDeviceSeqs(s.getSeqInterval(),s.getStorageCount());
List<String> strings3 = DeviceSeqUtil.createDeviceSeqs(s.getProdInterval(),s.getStorageCount());
List<List<String>> sons = new ArrayList<>();
List<List<String>> sons2 = new ArrayList<>();
int count = 1;
Integer deviceNum = s.getStorageCount();
while (deviceNum >= count) {
PackingLibrary packingLibraryEntity = new PackingLibrary();
BeanUtils.copyProperties(packingLibraryService.getOne(s.getPackingId()), packingLibraryEntity);
packingLibraryEntity.setCorresponding(count);
if (!strings3.isEmpty()) {
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)+"已存在");
if (s.getStorageCount()>0) {
List<String> strings = DeviceSeqUtil.createDeviceSeqs(s.getSeqInterval(), s.getStorageCount());
List<String> strings3 = DeviceSeqUtil.createDeviceSeqs(s.getProdInterval(), s.getStorageCount());
List<List<String>> sons = new ArrayList<>();
List<List<String>> sons2 = new ArrayList<>();
int count = 1;
Integer deviceNum = s.getStorageCount();
while (deviceNum >= count) {
PackingLibrary packingLibraryEntity = new PackingLibrary();
BeanUtils.copyProperties(packingLibraryService.getOne(s.getPackingId()), packingLibraryEntity);
packingLibraryEntity.setCorresponding(count);
if (!strings3.isEmpty()) {
packingLibraryEntity.setProdNumber(strings3.get(0));
strings3.remove(0);
}
packingLibraryEntity.setSeq(strings.get(0));
strings.remove(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()));
if (!strings.isEmpty()) {
if (deviceLibraryDao.getAllBySeqNumber(strings.get(0)).size() > 0) {
throw new ApiException("序列号" + strings.get(0) + "已存在");
}
packingLibraryEntity = packingLibraryService.getOne(s2.getPackingId());
List<String> strings2 = sons.get(j);
List<String> strings1 = sons2.get(j);
if (s2.getStorageCount() >= count) {
packingLibraryEntity.setCorresponding(count);
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);
packingLibraryEntity.setSeq(strings.get(0));
strings.remove(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()));
}
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);
packingLibraryEntity = packingLibraryService.getOne(s2.getPackingId());
List<String> strings2 = sons.get(j);
List<String> strings1 = sons2.get(j);
if (s2.getStorageCount() >= count) {
packingLibraryEntity.setCorresponding(count);
if (!strings2.isEmpty()) {
if (deviceLibraryDao.getAllBySeqNumber(strings2.get(0)).size()>0){
throw new ApiException("序列号"+strings2.get(0)+"已存在");
if (deviceLibraryDao.getAllBySeqNumber(strings2.get(0)).size() > 0) {
throw new ApiException("序列号" + strings2.get(0) + "已存在");
}
packingLibraryEntity.setSeq(strings2.get(0));
strings2.remove(0);
......@@ -174,14 +166,33 @@ public class StorageBillController {
packingLibraryEntity.setProdNumber(strings1.get(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()) {
......@@ -194,6 +205,22 @@ public class StorageBillController {
@PostMapping(value = "/addStorageBill")
@Transactional(rollbackFor = Exception.class)
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.存入库单
Integer userId = userUtils.getCurrentUserId();
List<Integer> userIds = new ArrayList<>();
......@@ -265,11 +292,44 @@ public class StorageBillController {
DeviceLogDto deviceLogDto = new DeviceLogDto(saveEntity.getId(), "发起装备入库", fileVoList);
deviceLogDtos.add(deviceLogDto);
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 {
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);
//4.更新入库单入库详情
storageBillEntity.setStorageDetail(stringBuffer.toString());
......
......@@ -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 isDraft = taskBto.getBillStatus() == 201 || taskBto.getBillStatus() == 333 || taskBto.getBillStatus() == 810 || taskBto.getBillStatus() == 322 || taskBto.getBillStatus() == 722;
// 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;
})
.collect(Collectors.toList());
......
......@@ -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.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.apply.subject.vo.ReplyVo;
import com.tykj.dev.device.file.service.FilesUtil;
import com.tykj.dev.device.library.repository.DeviceLibraryDao;
......@@ -47,12 +48,12 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
import static java.util.stream.Collectors.toMap;
/**
* @author dengdiyi
*/
......@@ -343,7 +344,16 @@ public class TaskSelectController {
deviceApplyBillEntity.setReplyFileList(FilesUtil.stringFileToList(deviceApplyBillEntity.getReplyFiles()));
deviceApplyBillEntity.setApplyFileList(FilesUtil.stringFileToList(deviceApplyBillEntity.getApplyFiles()));
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<Integer> idList = StringSplitUtil.userIdSplit(deviceApplyBillEntity.getApplyDetail());
List<Integer> packingIdList = new ArrayList<>();
......@@ -361,7 +371,19 @@ public class TaskSelectController {
if (packingIdList.size() == numList.size()) {
for (int i = 0; i < packingIdList.size(); 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);
}
}
......@@ -468,6 +490,5 @@ public class TaskSelectController {
@GetMapping("/signature/create")
public ResponseEntity createSignatureId() {
return ResponseEntity.ok(snowflake.creatNextId());
}
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论