提交 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;
}
}
......@@ -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
......@@ -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 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论