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

[配发、维修、清退模块]添加自动生成签章唯一id

上级 442b60a3
......@@ -20,7 +20,10 @@ import com.tykj.dev.device.task.subject.bto.TaskLogBto;
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.ResultUtil;
import com.tykj.dev.misc.utils.Snowflake;
import com.tykj.dev.misc.utils.StringSplitUtil;
import com.tykj.dev.socket.MyWebSocket;
import io.swagger.annotations.Api;
......@@ -70,6 +73,9 @@ public class AllotBackBillController {
@Autowired
private AllotBillService allotBillService;
@Autowired
private Snowflake snowflake;
@ApiOperation(value = "发起配发退回业务", notes = "可以通过这个接口发起配发退回任务")
@PostMapping(value = "/back")
public ResponseEntity allotBack(@RequestBody AllotBackBillSaveVo allotBackBillSaveVo){
......@@ -92,10 +98,13 @@ public class AllotBackBillController {
deviceLogService.addLog(deviceLogDto);
deviceLibraryService.update(deviceLibraryEntity);
});
//生成发件单位电子签章id
Long signId = snowflake.creatNextId();
//存储退回单
AllotBackBill allotBackBill = allotBackBillSaveVo.toDo();
allotBackBill.setAllotBillId(taskBto.getBillId());
allotBackBill.setSendUseraId(userUtils.getCurrentUserId());
allotBackBill.setLeftSignatureId(signId.toString());
AllotBackBill allotBackBill1 = allotBackBillService.addEntity(allotBackBill);
Calendar calendar = Calendar.getInstance();
calendar.setTime(allotBackBill1.getCreateTime());
......@@ -126,7 +135,7 @@ public class AllotBackBillController {
}
}
myWebSocket.sendMessage1();
return ResponseEntity.ok(taskBto1);
return ResponseEntity.ok(new ResultObj<>(taskBto1,signId.toString()));
}
@ApiOperation(value = "配发退回接收", notes = "可以通过这个接口配发退回接收")
......@@ -191,8 +200,11 @@ public class AllotBackBillController {
if (allotReceiveConfirmVo.getStatus() == 0) {
//业务完结
taskService.update(taskService.moveToEnd(taskBto));
//生成接收单位电子签章id
Long signId = snowflake.creatNextId();
//更新账单
allotBackBill.setBackStatus(3);
allotBackBill.setRightSignatureId(signId.toString());
allotBackBillService.update(allotBackBill);
for (String s:strings) {
//改变接收无误的装备的状态
......@@ -208,7 +220,7 @@ public class AllotBackBillController {
}
}
myWebSocket.sendMessage1();
return ResponseEntity.ok("入库审核通过配发退回接收成功");
return ResponseEntity.ok(signId.toString());
}
//审核失败
if (allotReceiveConfirmVo.getStatus()==1){
......
......@@ -22,6 +22,7 @@ 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.Snowflake;
import com.tykj.dev.misc.utils.TimestampUtil;
import com.tykj.dev.socket.MyWebSocket;
import io.swagger.annotations.Api;
......@@ -71,6 +72,9 @@ public class AllotBillController {
@Autowired
private MyWebSocket myWebSocket;
@Autowired
private Snowflake snowflake;
@ApiOperation(value = "发起配发业务", notes = "可以通过这个接口发起配发任务")
@PostMapping(value = "/addAllotBill")
public ResponseEntity addAllotBill(@RequestBody AllotBillSaveVo allotBillSaveVo) {
......@@ -118,6 +122,9 @@ public class AllotBillController {
AllotBill allotBillEntity = allotBillService.getOne(taskBto.getBillId());
allotBillEntity.setAllotStatus(2);
allotBillEntity.setSendTime(TimestampUtil.getCurrentTimestamp());
//生成发起单位电子签章id
Long signId = snowflake.creatNextId();
allotBillEntity.setLeftSignatureId(signId.toString());
allotBillService.update(allotBillEntity);
//task推至下一阶段
TaskBto taskBto1 = taskService.moveToNext(taskBto, allotBillEntity.getReceiveUseraId());
......@@ -140,7 +147,7 @@ public class AllotBillController {
}
}
myWebSocket.sendMessage1();
return ResponseEntity.ok("配发审核通过");
return ResponseEntity.ok(signId.toString());
}
//2.审核失败
if (allotBillConfirmVo.getStatus()==1){
......@@ -230,8 +237,11 @@ public class AllotBillController {
if (allotReceiveConfirmVo.getStatus() == 0) {
//业务完结
taskService.update(taskService.moveToEnd(taskBto));
//生成接收单位电子签章id
Long signId = snowflake.creatNextId();
//更新账单
allotBillEntity.setAllotStatus(5);
allotBillEntity.setRightSignatureId(signId.toString());
allotBillService.update(allotBillEntity);
for (String s:strings) {
//改变接收无误的装备的状态
......@@ -247,7 +257,7 @@ public class AllotBillController {
}
}
myWebSocket.sendMessage1();
return ResponseEntity.ok("入库审核通过配发接收成功");
return ResponseEntity.ok(signId.toString());
}
//审核失败
if (allotReceiveConfirmVo.getStatus()==1){
......
......@@ -30,6 +30,7 @@ import com.tykj.dev.device.user.subject.service.UserPublicService;
import com.tykj.dev.device.user.util.UserUtils;
import com.tykj.dev.misc.base.*;
import com.tykj.dev.misc.utils.ResultUtil;
import com.tykj.dev.misc.utils.Snowflake;
import com.tykj.dev.misc.utils.StringSplitUtil;
import com.tykj.dev.socket.MyWebSocket;
import io.swagger.annotations.Api;
......@@ -96,6 +97,9 @@ public class RepairController {
@Autowired
private DeviceChangeService deviceChangeService;
@Autowired
private Snowflake snowflake;
@ApiOperation(value = "发起维修", notes = "可以通过这个接口发起维修")
@PostMapping(value = "/form")
public ResponseEntity createRepair(@RequestBody RepairBillSaveVo repairBillSaveVo) {
......@@ -241,6 +245,9 @@ public class RepairController {
repairBill.setRepairStatus(2);
repairSendBill.setRepairStatus(2);
}
//生成发件单位电子签章id
Long signId = snowflake.creatNextId();
repairBill.setLeftSignatureId(signId.toString());
deviceRepairBillService.update(repairBill);
deviceRepairSendBillService.update(repairSendBill);
//修改装备状态,存装备日志
......@@ -261,7 +268,7 @@ public class RepairController {
}
}
myWebSocket.sendMessage1();
return ResultUtil.success("维修出库审核通过");
return ResultUtil.success(signId.toString());
}
//审核失败
if (deviceRepairConfirmVo.getStatus()==1) {
......@@ -398,6 +405,9 @@ public class RepairController {
//修改维修单,送修单状态
repairBill.setRepairStatus(4);
repairSendBill.setRepairStatus(5);
//生成收件单位签章id
Long signId = snowflake.creatNextId();
repairBill.setRightSignatureId(signId.toString());
deviceRepairBillService.update(repairBill);
deviceRepairSendBillService.update(repairSendBill);
for (String s:strings) {
......@@ -419,7 +429,7 @@ public class RepairController {
deviceRepairDetailService.update(deviceRepairDetailEntity);
});
myWebSocket.sendMessage1();
return ResultUtil.success("入库审核通过配发接收成功");
return ResultUtil.success(signId.toString());
}
//审核失败
if (repairConfirmVo.getStatus()==1){
......@@ -567,6 +577,9 @@ public class RepairController {
if (repairConfirmVo.getStatus() == 0) {
//改变账单状态
repairBackBill.setBackStatus(2);
//生成发件单位签章id
Long signId = snowflake.creatNextId();
repairBackBill.setLeftSignatureId(signId.toString());
deviceRepairBackBillService.update(repairBackBill);
if (idList.size()>0) {
for (Integer id:idList) {
......@@ -594,7 +607,7 @@ public class RepairController {
// TaskLogBto taskLogBto = new TaskLogBto(taskBto.getId(),"维修退回审核成功并出库",null);
// taskLogService.addLog(taskLogBto);
myWebSocket.sendMessage1();
return ResultUtil.success("维修退回出库审核通过");
return ResultUtil.success(signId.toString());
}
//审核失败
if (repairConfirmVo.getStatus()==1) {
......@@ -748,6 +761,9 @@ public class RepairController {
// taskLogService.addLog(taskLogBto);
//更新退回单状态
repairBackBill.setBackStatus(5);
//生成接收单位签章id
Long signId = snowflake.creatNextId();
repairBackBill.setRightSignatureId(signId.toString());
deviceRepairBackBillService.update(repairBackBill);
List<Integer> integerList = new ArrayList<>();
for (String s:strings) {
......@@ -775,7 +791,7 @@ public class RepairController {
repairDetails.forEach(repairDetail -> repairDetail.setRepairStatus(5));
});
myWebSocket.sendMessage1();
return ResultUtil.success("维修成功退回装备入库审核成功");
return ResultUtil.success(signId.toString());
}
//审核失败
if (repairConfirmVo.getStatus()==1){
......
......@@ -27,6 +27,7 @@ import com.tykj.dev.device.user.subject.entity.Units;
import com.tykj.dev.device.user.subject.entity.User;
import com.tykj.dev.misc.base.BusinessEnum;
import com.tykj.dev.misc.base.StatusEnum;
import com.tykj.dev.misc.utils.Snowflake;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
......@@ -66,6 +67,9 @@ public class SendBackServiceImpl implements SendBackService {
private final SendBackBillDetailDao sendBackBillDetailEntityDao;
@Autowired
private Snowflake snowflake;
@Autowired
DeviceLibraryService deviceLibraryService;
......@@ -537,6 +541,11 @@ public class SendBackServiceImpl implements SendBackService {
Units father=fatherUnit.get(0);
taskEntity.setOwnUnit(father.getUnitId());
SendBackBill sendBackBill= sendBackBillEntityDao.getOne(taskEntity.getBillId());
SendBackBillDetail sendBackBillDetail = sendBackBillDetailEntityDao.findSendBackBillDetailById(sendBackBill.getFormId());
//生成发件单位签章id
Long signId = snowflake.creatNextId();
sendBackBillDetail.setLeftSignatureId(signId.toString());
sendBackBillDetailEntityDao.save(sendBackBillDetail);
List<Integer> idList=stringToList(sendBackBill.getInvoleDevice());
deviceLibraryDao.getDeviceLibraryEntitiesByIdIn(idList).forEach(
deviceLibrary -> {
......@@ -575,6 +584,11 @@ public class SendBackServiceImpl implements SendBackService {
SendBackBill bill = sendBackBillEntityDao.getOne(billId);
bill.setIsComplete(1);
sendBackBillEntityDao.save(bill);
//生成收件单位签章id
SendBackBillDetail sendBackBillDetail = sendBackBillDetailEntityDao.findSendBackBillDetailById(bill.getFormId());
Long signId = snowflake.creatNextId();
sendBackBillDetail.setRightSignatureId(signId.toString());
sendBackBillDetailEntityDao.save(sendBackBillDetail);
List<Integer> idList = stringToList(bill.getInvoleDevice());
List<DeviceLibrary> deviceList = deviceLibraryDao.getDeviceLibraryEntitiesByIdIn(idList);
for (DeviceLibrary d:deviceList) {
......@@ -588,7 +602,7 @@ public class SendBackServiceImpl implements SendBackService {
deviceLibraryDao.saveAll(deviceList);
s(taskEntity,bill,idList);
return ResponseEntity.ok("装备已入库");
return ResponseEntity.ok(signId.toString());
}
/**
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论