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

[配发模块]优化了配发退回流程,添加了装备编辑日志

上级 1980ae18
......@@ -34,6 +34,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
/**
......@@ -72,10 +73,12 @@ public class AllotBackBillController {
@ApiOperation(value = "发起配发退回业务", notes = "可以通过这个接口发起配发退回任务")
@PostMapping(value = "/back")
public ResponseEntity allotBack(@RequestBody AllotBackBillSaveVo allotBackBillSaveVo){
//获取当前配发task
//获取当前配发退回task
TaskBto taskBto = taskService.get(allotBackBillSaveVo.getTaskId());
//获取父配发业务
TaskBto fatherTask = taskService.get(taskBto.getParentTaskId());
//获取配发单
AllotBill allotBill = allotBillService.getOne(taskBto.getBillId());
AllotBill allotBill = allotBillService.getOne(fatherTask.getBillId());
//更改未勾选装备的状态
List<Integer> receiveDeviceIds = StringSplitUtil.split(allotBill.getReceiveCheckDetail());
List<Integer> backDeviceIds = StringSplitUtil.split(allotBackBillSaveVo.getBackCheckDetail());
......@@ -94,12 +97,16 @@ public class AllotBackBillController {
allotBackBill.setAllotBillId(taskBto.getBillId());
allotBackBill.setSendUseraId(userUtils.getCurrentUserId());
AllotBackBill allotBackBill1 = allotBackBillService.addEntity(allotBackBill);
Calendar calendar = Calendar.getInstance();
calendar.setTime(allotBackBill1.getCreateTime());
int year = calendar.get(Calendar.YEAR);
String num = "NO:第" + year + "TH" + allotBackBill1.getId() + "号";
allotBackBill1.setNum(num);
allotBackBillService.update(allotBackBill1);
//发起子任务
List<Integer> userIds = new ArrayList<>();
userIds.add(allotBackBill1.getSendUseraId());
userIds.add(allotBackBill1.getReceiveUseraId());
TaskBto taskBto1 = new TaskBto(StatusEnum.ALLOT_BACKING.id, BusinessEnum.ALLOT_BACK.name,taskBto.getId(),taskBto.getNodeIdDetail()+taskBto.getId()+".",allotBackBill1.getId(),BusinessEnum.ALLOT_BACK.id,userPublicService.findUnitIdByName(allotBackBill1.getReceiveUnit()),1,null,userIds);
taskService.start(taskBto1);
taskBto.setBillId(allotBackBill1.getId());
taskBto.setOwnUnit(userPublicService.findUnitIdByName(allotBackBill1.getReceiveUnit()));
TaskBto taskBto1 = taskService.moveToNext(taskBto,allotBackBill1.getReceiveUseraId());
//改变装备状态
List<FileVo> fileVoList = new ArrayList<>();
if (allotBackBillSaveVo.getFileName()!=null&&allotBackBillSaveVo.getFileUrl()!=null) {
......@@ -119,7 +126,7 @@ public class AllotBackBillController {
}
}
myWebSocket.sendMessage1();
return ResponseEntity.ok("发起配发退回成功");
return ResponseEntity.ok(taskBto1);
}
@ApiOperation(value = "配发退回接收", notes = "可以通过这个接口配发退回接收")
......
......@@ -19,6 +19,7 @@ import com.tykj.dev.device.task.subject.bto.TaskLogBto;
import com.tykj.dev.device.task.subject.domin.Task;
import com.tykj.dev.device.user.subject.service.UserPublicService;
import com.tykj.dev.device.user.util.UserUtils;
import com.tykj.dev.misc.base.BusinessEnum;
import com.tykj.dev.misc.base.ResultObj;
import com.tykj.dev.misc.base.StatusEnum;
import com.tykj.dev.misc.utils.TimestampUtil;
......@@ -268,7 +269,12 @@ public class AllotBillController {
}
}
myWebSocket.sendMessage1();
return ResponseEntity.ok("配发接收入库审核失败");
//生成配发退回子业务
List<Integer> userIds = new ArrayList<>();
userIds.add(userUtils.getCurrentUserId());
TaskBto taskBto1 = new TaskBto(StatusEnum.WAIT_BACK.id, "配发退回业务", taskBto.getId(), taskBto.getNodeIdDetail()+taskBto.getId()+".", 0, BusinessEnum.ALLOT_BACK.id, userUtils.getCurrentUnitId(), 0, null, userIds);
TaskBto task = taskService.start(taskBto1);
return ResponseEntity.ok(task);
}
else {
return ResponseEntity.ok("status只能为0或1");
......
......@@ -129,4 +129,7 @@ public class AllotBackBill {
@ApiModelProperty(value = "收件方审核人(B岗位)")
@Transient
private String receiveUserb;
@ApiModelProperty(value = "退回单号")
private String num;
}
......@@ -14,7 +14,7 @@ import org.springframework.beans.BeanUtils;
@ApiModel("配发退回单存储类")
public class AllotBackBillSaveVo {
@ApiModelProperty(name = "配发业务主键id")
@ApiModelProperty(name = "配发退回业务主键id")
private Integer taskId;
@ApiModelProperty(value = "申请文号")
......
......@@ -26,6 +26,8 @@ public class GlobalMap {
private static final Map<Integer, StorageType> storageTypeMap;
private static final Map<Integer, MatchingDeviceType> matchingDeviceTypeMap;
static {
statusEnumMap = Arrays.stream(StatusEnum.values())
.collect(Collectors.toMap(statusEnum -> statusEnum.id, Function.identity()));
......@@ -39,6 +41,8 @@ public class GlobalMap {
.collect(Collectors.toMap(matchingRange -> matchingRange.id,Function.identity()));
storageTypeMap = Arrays.stream(StorageType.values())
.collect(Collectors.toMap(storageType -> storageType.id,Function.identity()));
matchingDeviceTypeMap = Arrays.stream(MatchingDeviceType.values())
.collect(Collectors.toMap(matchingDeviceType -> matchingDeviceType.id,Function.identity()));
}
public static Map<Integer, StatusEnum> getStatusEnumMap() {
......@@ -61,6 +65,10 @@ public class GlobalMap {
return storageTypeMap;
}
public static Map<Integer, MatchingDeviceType> getMatchingDeviceTypeMap() {
return matchingDeviceTypeMap;
}
public static Map<Integer, MatchingRange> getMatchingRangeMap() {
return matchingRangeMap;
}
......
......@@ -246,10 +246,22 @@ public class DeviceLibraryController {
if (deviceLibraryEntity.getIsPart()==0&&d.getIsPart()==1&&d.getPartParentId()==null){
d.setPartParentId(deviceEditVo.getDeviceId());
deviceLibraryService.update(d);
//添加装备日志
String remark = "将表面号为"+ d.getRfidSurfaceId()+"的配件与表面号为"+deviceLibraryEntity.getRfidSurfaceId()+"的装备绑定";
DeviceLogDto deviceLogDto = new DeviceLogDto(deviceEditVo.getDeviceId(),remark,null);
DeviceLogDto deviceLogDto2 = new DeviceLogDto(id,remark,null);
deviceLogService.addLog(deviceLogDto);
deviceLogService.addLog(deviceLogDto2);
}
if (deviceLibraryEntity.getIsPart()==1&&d.getIsPart()==0){
deviceLibraryEntity.setPartParentId(id);
deviceLibraryService.update(deviceLibraryEntity);
//添加装备日志
String remark = "将表面号为"+ deviceLibraryEntity.getRfidSurfaceId()+"的配件与表面号为"+d.getRfidSurfaceId()+"的装备绑定";
DeviceLogDto deviceLogDto = new DeviceLogDto(deviceEditVo.getDeviceId(),remark,null);
DeviceLogDto deviceLogDto2 = new DeviceLogDto(id,remark,null);
deviceLogService.addLog(deviceLogDto);
deviceLogService.addLog(deviceLogDto2);
}
}
}
......@@ -262,10 +274,22 @@ public class DeviceLibraryController {
if (d.getIsPart()==1&&d.getPartParentId().equals(deviceEditVo.getDeviceId())){
d.setPartParentId(null);
deviceLibraryService.update(d);
//添加装备日志
String remark = "将表面号为"+ d.getRfidSurfaceId()+"的配件与表面号为"+deviceLibraryEntity.getRfidSurfaceId()+"的装备解绑";
DeviceLogDto deviceLogDto = new DeviceLogDto(deviceEditVo.getDeviceId(),remark,null);
DeviceLogDto deviceLogDto2 = new DeviceLogDto(id,remark,null);
deviceLogService.addLog(deviceLogDto);
deviceLogService.addLog(deviceLogDto2);
}
if (deviceLibraryEntity.getIsPart()==1&&d.getIsPart()==0&&deviceLibraryEntity.getPartParentId().equals(id)){
deviceLibraryEntity.setPartParentId(null);
deviceLibraryService.update(deviceLibraryEntity);
//添加装备日志
String remark = "将表面号为"+ deviceLibraryEntity.getRfidSurfaceId()+"的配件与表面号为"+d.getRfidSurfaceId()+"的装备解绑";
DeviceLogDto deviceLogDto = new DeviceLogDto(deviceEditVo.getDeviceId(),remark,null);
DeviceLogDto deviceLogDto2 = new DeviceLogDto(id,remark,null);
deviceLogService.addLog(deviceLogDto);
deviceLogService.addLog(deviceLogDto2);
}
}
}
......
package com.tykj.dev.device.matching.controller;
import com.tykj.dev.config.GlobalMap;
import com.tykj.dev.config.swagger.AutoDocument;
import com.tykj.dev.device.library.repository.DeviceLogDao;
import com.tykj.dev.device.library.service.DeviceLibraryService;
......@@ -206,25 +207,54 @@ public class MatchingDeviceController {
@PostMapping("/update")
public ResponseEntity update(@RequestBody MatchingDeviceEditVo matchingDeviceEditVo) {
MatchingDeviceLibrary m = matchingDeviceLibraryService.getOne(matchingDeviceEditVo.getMatchingDeviceId());
if (matchingDeviceEditVo.getCreateUnit() != null) {
if (matchingDeviceEditVo.getCreateUnit() != null&&!m.getCreateUnit().equals(matchingDeviceEditVo.getCreateUnit())) {
//添加设备日志
String remark = "将设备的创建单位由"+ m.getCreateUnit()+"改为"+matchingDeviceEditVo.getCreateUnit();
DeviceLogDto deviceLogDto = new DeviceLogDto(1,matchingDeviceEditVo.getMatchingDeviceId(),remark,null);
deviceLogService.addLog(deviceLogDto);
m.setCreateUnit(matchingDeviceEditVo.getCreateUnit());
}
if (matchingDeviceEditVo.getLifeStatus() != null) {
if (matchingDeviceEditVo.getLifeStatus() != null&&!m.getLifeStatus().equals(matchingDeviceEditVo.getLifeStatus())) {
//添加设备日志
String remark = "将设备的生命状态由"+ GlobalMap.getDeviceLifeStatusMap().get(m.getLifeStatus()).name+"改为"+GlobalMap.getDeviceLifeStatusMap().get(matchingDeviceEditVo.getLifeStatus()).name;
DeviceLogDto deviceLogDto = new DeviceLogDto(1,matchingDeviceEditVo.getMatchingDeviceId(),remark,null);
deviceLogService.addLog(deviceLogDto);
m.setLifeStatus(matchingDeviceEditVo.getLifeStatus());
}
if (matchingDeviceEditVo.getDeviceId() != null && m.getDeviceId() == 0) {
//添加设备日志
DeviceLibrary deviceLibrary = deviceLibraryService.getOne(matchingDeviceEditVo.getDeviceId());
String remark = "将该设备与表面号为"+ deviceLibrary.getRfidSurfaceId()+"的装备绑定";
DeviceLogDto deviceLogDto = new DeviceLogDto(1,matchingDeviceEditVo.getMatchingDeviceId(),remark,null);
deviceLogService.addLog(deviceLogDto);
m.setDeviceId(matchingDeviceEditVo.getDeviceId());
}
if (matchingDeviceEditVo.getModel()!=null){
if (matchingDeviceEditVo.getModel()!=null&&!m.getModel().equals(matchingDeviceEditVo.getModel())){
//添加设备日志
String remark = "将设备的型号由"+ m.getModel()+"改为"+matchingDeviceEditVo.getModel();
DeviceLogDto deviceLogDto = new DeviceLogDto(1,matchingDeviceEditVo.getMatchingDeviceId(),remark,null);
deviceLogService.addLog(deviceLogDto);
m.setModel(matchingDeviceEditVo.getModel());
}
if (matchingDeviceEditVo.getName()!=null){
if (matchingDeviceEditVo.getName()!=null&&!m.getName().equals(matchingDeviceEditVo.getName())){
//添加设备日志
String remark = "将设备的名称由"+ m.getName()+"改为"+matchingDeviceEditVo.getName();
DeviceLogDto deviceLogDto = new DeviceLogDto(1,matchingDeviceEditVo.getMatchingDeviceId(),remark,null);
deviceLogService.addLog(deviceLogDto);
m.setName(matchingDeviceEditVo.getName());
}
if (matchingDeviceEditVo.getSeqNumber()!=null){
if (matchingDeviceEditVo.getSeqNumber()!=null&&!m.getSeqNumber().equals(matchingDeviceEditVo.getSeqNumber())){
//添加设备日志
String remark = "将设备的序列号由"+ m.getSeqNumber()+"改为"+matchingDeviceEditVo.getSeqNumber();
DeviceLogDto deviceLogDto = new DeviceLogDto(1,matchingDeviceEditVo.getMatchingDeviceId(),remark,null);
deviceLogService.addLog(deviceLogDto);
m.setSeqNumber(matchingDeviceEditVo.getSeqNumber());
}
if (matchingDeviceEditVo.getType()!=null){
if (matchingDeviceEditVo.getType()!=null&&!m.getType().equals(matchingDeviceEditVo.getType())){
//添加设备日志
String remark = "将设备类型由"+ m.getType()+"改为"+matchingDeviceEditVo.getType();
DeviceLogDto deviceLogDto = new DeviceLogDto(1,matchingDeviceEditVo.getMatchingDeviceId(),remark,null);
deviceLogService.addLog(deviceLogDto);
m.setType(matchingDeviceEditVo.getType());
}
matchingDeviceLibraryService.update(m);
......
package com.tykj.dev.misc.base;
import lombok.AllArgsConstructor;
/**
* @author dengdiyi
* 配套设备类型枚举
*/
@AllArgsConstructor
public enum MatchingDeviceType {
/**
* 打印机
*/
PRINTER(1,"打印机"),
/**
* 手持设备
*/
HANDHELD_DEVICE(2,"手持设备");
public Integer id;
public String name;
}
......@@ -176,6 +176,7 @@ public enum StatusEnum {
/**
* 配发退回状态
*/
WAIT_BACK(899,"待配发退回"),
ALLOT_BACKING(900,"配发退回中"),
ALLOT_BACK_CONFIRM(901,"配发退回入库待审核")
;
......
package com.tykj.dev.device.packing.controller;
import com.tykj.dev.config.swagger.AutoDocument;
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.PackingEditVo;
......@@ -16,6 +17,7 @@ import org.springframework.data.domain.Page;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import java.util.Iterator;
import java.util.List;
/**
......@@ -48,6 +50,15 @@ public class PackingLibraryController {
@PostMapping("/getList")
public ResponseEntity getList(@RequestBody PackingLibrarySelectVo packingLibrarySelectVo) {
List<PackingLibrary> packingLibraryEntities = packingLibraryService.getList(packingLibrarySelectVo);
// if (packingLibrarySelectVo.ids!=null&&packingLibrarySelectVo.ids.size()>0) {
// packingLibraryEntities.removeIf(p -> packingLibrarySelectVo.ids.contains(p.getId()));
// packingLibraryEntities.forEach(packingLibrary -> {
// List<PackingLibrary> childs = packingLibrary.getChilds();
// if (childs!=null&&childs.size()>0){
// childs.removeIf(packingLibrary1 -> packingLibrarySelectVo.ids.contains(packingLibrary1.getId()));
// }
// });
// }
return ResultUtil.success(packingLibraryEntities);
}
......
......@@ -6,6 +6,7 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
import java.util.List;
/**
* @author dengdiyi
......@@ -14,6 +15,9 @@ import java.util.Date;
@ApiModel("列装查询类")
public class PackingLibrarySelectVo extends CustomPage {
@ApiModelProperty(value = "已经勾选了的列装id列表")
public List<Integer> ids;
@ApiModelProperty(value = "模糊查询关键字",example = "测试")
public String content;
......
......@@ -651,12 +651,7 @@ public class TaskServiceImpl implements TaskService {
if (taskLogs.size()==0){
return null;
}
if (taskLogs.size()>0) {
return taskLogs.get(0).getCreateTime();
}
else {
return null;
}
} else {
return null;
}
......
......@@ -174,6 +174,27 @@ public class TaskSelectController {
list.add(deviceLibraryEntities);
return ResponseEntity.ok(new ResultObj(list,"查询成功"));
case 22:
if (taskBto.getBillId()==0){
TaskBto allotTask = taskService.get(taskBto.getParentTaskId());
AllotBill allotBill = allotBillService.getOne(allotTask.getBillId());
list.add(allotBill);
String checkDetail = allotBill.getAllotCheckDetail();
List<DeviceLibrary> deviceLibraries = new ArrayList<>();
if (checkDetail!=null) {
String[] strings1 = checkDetail.split("x");
for (String s : strings1) {
if (s.length() >= 2 && "1".equals(s.substring(s.length() - 1))) {
Integer id = Integer.parseInt(s.substring(0, s.length() - 1));
Integer checkResult = Integer.parseInt(s.substring(s.length() - 1));
DeviceLibrary deviceLibraryEntity = deviceLibraryService.getOne(id);
deviceLibraryEntity.setCheckResult(checkResult);
deviceLibraries.add(deviceLibraryEntity);
}
}
}
list.add(deviceLibraries);
return ResponseEntity.ok(new ResultObj(list,"查询成功"));
}
AllotBackBill allotBackBill = allotBackBillService.getOne(billId);
if (allotBackBill.getSendUseraId()!=null){
allotBackBill.setSendUsera(userPublicService.getOne(allotBackBill.getSendUseraId()).getName());
......
spring.datasource.url=jdbc:mysql://localhost:3306/device?serverTimezone=Asia/Shanghai&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&useSSL=false
spring.datasource.url=jdbc:mysql://192.168.100.249:3306/device?serverTimezone=Asia/Shanghai&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&useSSL=false
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.username=root
spring.datasource.password=root
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论