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

提交阅知模块

上级 be437d28
...@@ -40,5 +40,10 @@ ...@@ -40,5 +40,10 @@
<groupId>com.tykj.dev</groupId> <groupId>com.tykj.dev</groupId>
<artifactId>rfid</artifactId> <artifactId>rfid</artifactId>
</dependency> </dependency>
<dependency>
<groupId>com.tykj</groupId>
<artifactId>dev-read</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
</dependencies> </dependencies>
</project> </project>
\ No newline at end of file
...@@ -14,8 +14,8 @@ import javax.validation.constraints.NotNull; ...@@ -14,8 +14,8 @@ import javax.validation.constraints.NotNull;
@ApiModel("配发接收类") @ApiModel("配发接收类")
public class AllotBackReceiveVo { public class AllotBackReceiveVo {
@NotNull(message = "receiveUserbId不能为空") // @NotNull(message = "receiveUserbId不能为空")
@Min(value = 1,message = "receiveUserbId不能小于1") // @Min(value = 1,message = "receiveUserbId不能小于1")
@ApiModelProperty(value = "接收单位B岗") @ApiModelProperty(value = "接收单位B岗")
private Integer receiveUserbId; private Integer receiveUserbId;
...@@ -24,11 +24,11 @@ public class AllotBackReceiveVo { ...@@ -24,11 +24,11 @@ public class AllotBackReceiveVo {
@ApiModelProperty(value = "任务Id") @ApiModelProperty(value = "任务Id")
private Integer taskId; private Integer taskId;
@NotNull(message = "billFileName不能为空") // @NotNull(message = "billFileName不能为空")
@ApiModelProperty(value = "配发单附件名字") @ApiModelProperty(value = "配发单附件名字")
private String billFileName; private String billFileName;
@NotNull(message = "billFileUrl不能为空") // @NotNull(message = "billFileUrl不能为空")
@ApiModelProperty(value = "配发单附件URL") @ApiModelProperty(value = "配发单附件URL")
private String billFileUrl; private String billFileUrl;
......
package com.tykj.dev.device.allot.subject.vo; package com.tykj.dev.device.allot.subject.vo;
import com.tykj.dev.device.allot.subject.domin.AllotBill; import com.tykj.dev.device.allot.subject.domin.AllotBill;
import com.tykj.dev.misc.utils.TimestampUtil;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
/** /**
...@@ -35,13 +35,13 @@ public class AllotBillSaveVo { ...@@ -35,13 +35,13 @@ public class AllotBillSaveVo {
@ApiModelProperty(value = "接收单位") @ApiModelProperty(value = "接收单位")
private String receiveUnit; private String receiveUnit;
@NotNull(message = "sendUserbId不能为空") // @NotNull(message = "sendUserbId不能为空")
@Min(value = 1,message = "sendUserbId不能小于1") // @Min(value = 1,message = "sendUserbId不能小于1")
@ApiModelProperty(value = "发件方(B岗位)") @ApiModelProperty(value = "发件方(B岗位)")
private Integer sendUserbId; private Integer sendUserbId;
@NotNull(message = "receiveUseraId不能为空") // @NotNull(message = "receiveUseraId不能为空")
@Min(value = 1,message = "receiveUseraId不能小于1") // @Min(value = 1,message = "receiveUseraId不能小于1")
@ApiModelProperty(value = "收件方(A岗位)") @ApiModelProperty(value = "收件方(A岗位)")
private Integer receiveUseraId; private Integer receiveUseraId;
...@@ -79,7 +79,8 @@ public class AllotBillSaveVo { ...@@ -79,7 +79,8 @@ public class AllotBillSaveVo {
public AllotBill toDo() { public AllotBill toDo() {
AllotBill allotBillEntity = new AllotBill(); AllotBill allotBillEntity = new AllotBill();
BeanUtils.copyProperties(this, allotBillEntity); BeanUtils.copyProperties(this, allotBillEntity);
allotBillEntity.setAllotStatus(0); allotBillEntity.setAllotStatus(2);
allotBillEntity.setSendTime(TimestampUtil.getCurrentTimestamp());
return allotBillEntity; return allotBillEntity;
} }
} }
...@@ -14,8 +14,8 @@ import javax.validation.constraints.NotNull; ...@@ -14,8 +14,8 @@ import javax.validation.constraints.NotNull;
@ApiModel("配发接收类") @ApiModel("配发接收类")
public class AllotReceiveVo { public class AllotReceiveVo {
@NotNull(message = "receiveUserbId不能为空") // @NotNull(message = "receiveUserbId不能为空")
@Min(value = 1,message = "receiveUserbId不能小于1") // @Min(value = 1,message = "receiveUserbId不能小于1")
@ApiModelProperty(value = "接收单位B岗") @ApiModelProperty(value = "接收单位B岗")
private Integer receiveUserbId; private Integer receiveUserbId;
......
...@@ -17,19 +17,25 @@ import com.tykj.dev.device.library.subject.vo.DeviceLibrarySelectVo; ...@@ -17,19 +17,25 @@ import com.tykj.dev.device.library.subject.vo.DeviceLibrarySelectVo;
import com.tykj.dev.device.library.subject.vo.FileVo; import com.tykj.dev.device.library.subject.vo.FileVo;
import com.tykj.dev.device.packing.service.PackingLibraryService; import com.tykj.dev.device.packing.service.PackingLibraryService;
import com.tykj.dev.device.packing.subject.domin.PackingLibrary; import com.tykj.dev.device.packing.subject.domin.PackingLibrary;
import com.tykj.dev.device.read.service.MessageService;
import com.tykj.dev.device.read.subject.bto.MessageBto;
import com.tykj.dev.device.task.repository.TaskDao; import com.tykj.dev.device.task.repository.TaskDao;
import com.tykj.dev.device.task.service.TaskLogService; import com.tykj.dev.device.task.service.TaskLogService;
import com.tykj.dev.device.task.service.TaskService; import com.tykj.dev.device.task.service.TaskService;
import com.tykj.dev.device.task.subject.bto.TaskBto; import com.tykj.dev.device.task.subject.bto.TaskBto;
import com.tykj.dev.device.task.subject.domin.Task; import com.tykj.dev.device.task.subject.domin.Task;
import com.tykj.dev.device.task.subject.vo.TaskLogUserVo; import com.tykj.dev.device.task.subject.vo.TaskLogUserVo;
import com.tykj.dev.device.user.subject.dao.UserDao;
import com.tykj.dev.device.user.subject.entity.User;
import com.tykj.dev.device.user.subject.service.UserPublicService; import com.tykj.dev.device.user.subject.service.UserPublicService;
import com.tykj.dev.device.user.util.UserUtils; import com.tykj.dev.device.user.util.UserUtils;
import com.tykj.dev.misc.base.BusinessEnum; import com.tykj.dev.misc.base.BusinessEnum;
import com.tykj.dev.misc.base.StatusEnum; import com.tykj.dev.misc.base.StatusEnum;
import com.tykj.dev.misc.exception.ApiException; import com.tykj.dev.misc.exception.ApiException;
import com.tykj.dev.misc.utils.ResultUtil; 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.misc.utils.StringSplitUtil;
import com.tykj.dev.rfid.service.InputOutputDeviceService;
import com.tykj.dev.socket.MyWebSocket; import com.tykj.dev.socket.MyWebSocket;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
...@@ -88,6 +94,18 @@ public class DeviceApplyController { ...@@ -88,6 +94,18 @@ public class DeviceApplyController {
@Autowired @Autowired
private MyWebSocket myWebSocket; private MyWebSocket myWebSocket;
@Autowired
private Snowflake snowflake;
@Autowired
private InputOutputDeviceService inputOutputDeviceService;
@Autowired
private MessageService messageService;
@Autowired
private UserDao userDao;
@ApiOperation(value = "发起装备申请", notes = "可以通过这个接口发起装备申请") @ApiOperation(value = "发起装备申请", notes = "可以通过这个接口发起装备申请")
@PostMapping("/addDeviceApplyBill") @PostMapping("/addDeviceApplyBill")
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
...@@ -111,7 +129,14 @@ public class DeviceApplyController { ...@@ -111,7 +129,14 @@ public class DeviceApplyController {
userIds.add(0); userIds.add(0);
taskBto = new TaskBto(StatusEnum.DEVICE_APPLY_CONFIRM.id, "申请业务", null, ".", deviceApplyBillEntity.getId(), 9, userPublicService.findUnitIdByName(deviceApplySaveVo.getReplyUnit()), 1, null, userIds); taskBto = new TaskBto(StatusEnum.DEVICE_APPLY_CONFIRM.id, "申请业务", null, ".", deviceApplyBillEntity.getId(), 9, userPublicService.findUnitIdByName(deviceApplySaveVo.getReplyUnit()), 1, null, userIds);
} }
taskService.start(taskBto); TaskBto taskBto1 = taskService.start(taskBto);
//发送阅知信息
List<Integer> userIds = userPublicService.findOtherUser(userId);
userIds.addAll(userDao.findAllByUnitsId(userPublicService.findUnitIdByName(deviceApplyBillEntity.getReplyUnit())).stream()
.map(User::getUserId)
.collect(Collectors.toList()));
MessageBto messageBto = new MessageBto(taskBto1.getId(),taskBto1.getBusinessType(),deviceApplyBillEntity.getApplyUnit() + "向" + deviceApplyBillEntity.getReplyUnit() + "发起装备申请",userIds);
messageService.add(messageBto);
log.info("[申请模块]:发起装备申请"); log.info("[申请模块]:发起装备申请");
myWebSocket.sendMessage1(); myWebSocket.sendMessage1();
return ResponseEntity.ok(deviceApplyBillEntity); return ResponseEntity.ok(deviceApplyBillEntity);
...@@ -124,6 +149,11 @@ public class DeviceApplyController { ...@@ -124,6 +149,11 @@ public class DeviceApplyController {
TaskBto taskBto = taskService.get(deviceApplyConfirmVo.getTaskId()); TaskBto taskBto = taskService.get(deviceApplyConfirmVo.getTaskId());
Integer userId = userUtils.getCurrentUserId(); Integer userId = userUtils.getCurrentUserId();
DeviceApplyBill applyBillEntity = deviceApplyBillService.getOne(taskBto.getBillId()); DeviceApplyBill applyBillEntity = deviceApplyBillService.getOne(taskBto.getBillId());
//阅知用户Id
List<Integer> ids = userPublicService.findOtherUser(userId);
ids.addAll(userDao.findAllByUnitsId(userPublicService.findUnitIdByName(applyBillEntity.getApplyUnit())).stream()
.map(User::getUserId)
.collect(Collectors.toList()));
//如果修改了批复文号 //如果修改了批复文号
if (deviceApplyConfirmVo.getReplyNumber() != null) { if (deviceApplyConfirmVo.getReplyNumber() != null) {
applyBillEntity.setReplayNumber(deviceApplyConfirmVo.getReplyNumber()); applyBillEntity.setReplayNumber(deviceApplyConfirmVo.getReplyNumber());
...@@ -133,6 +163,9 @@ public class DeviceApplyController { ...@@ -133,6 +163,9 @@ public class DeviceApplyController {
applyBillEntity.setApplyStatus(1); applyBillEntity.setApplyStatus(1);
taskService.update(taskService.moveToArchive(taskBto)); taskService.update(taskService.moveToArchive(taskBto));
deviceApplyBillService.update(applyBillEntity); deviceApplyBillService.update(applyBillEntity);
//发送阅知信息
MessageBto messageBto = new MessageBto(taskBto.getId(),taskBto.getBusinessType(),"对" + applyBillEntity.getApplyUnit() + "的装备申请驳回",ids);
messageService.add(messageBto);
log.info("[申请模块]:装备申请驳回"); log.info("[申请模块]:装备申请驳回");
myWebSocket.sendMessage1(); myWebSocket.sendMessage1();
return ResponseEntity.ok(taskBto); return ResponseEntity.ok(taskBto);
...@@ -141,10 +174,13 @@ public class DeviceApplyController { ...@@ -141,10 +174,13 @@ public class DeviceApplyController {
if (deviceApplyConfirmVo.getStatus() == 0) { if (deviceApplyConfirmVo.getStatus() == 0) {
applyBillEntity.setApplyStatus(2); applyBillEntity.setApplyStatus(2);
taskService.update(taskService.moveToEnd(taskBto)); taskService.update(taskService.moveToEnd(taskBto));
//发送阅知信息
MessageBto messageBto = new MessageBto(taskBto.getId(),taskBto.getBusinessType(),"同意" + applyBillEntity.getApplyUnit() + "的装备申请",ids);
messageService.add(messageBto);
log.info("[申请模块]:装备申请批复成功,发起配发子业务"); log.info("[申请模块]:装备申请批复成功,发起配发子业务");
//生成配发子任务 //生成配发子任务
List<Integer> userIds = new ArrayList<>(); List<Integer> userIds = new ArrayList<>();
userIds.add(userId); userIds.add(0);
TaskBto taskBto1 = new TaskBto(StatusEnum.WAIT_ALLOT.id, "配发业务", taskBto.getId(), "." + taskBto.getId() + ".", 0, 3, userUtils.getCurrentUnitId(), 0, null, userIds); TaskBto taskBto1 = new TaskBto(StatusEnum.WAIT_ALLOT.id, "配发业务", taskBto.getId(), "." + taskBto.getId() + ".", 0, 3, userUtils.getCurrentUnitId(), 0, null, userIds);
TaskBto task = taskService.start(taskBto1); TaskBto task = taskService.start(taskBto1);
deviceApplyBillService.update(applyBillEntity); deviceApplyBillService.update(applyBillEntity);
...@@ -171,37 +207,59 @@ public class DeviceApplyController { ...@@ -171,37 +207,59 @@ public class DeviceApplyController {
BeanUtils.copyProperties(deviceApplyAllotSaveVo, allotBillEntity); BeanUtils.copyProperties(deviceApplyAllotSaveVo, allotBillEntity);
allotBillEntity.setTitle("申请后配发"); allotBillEntity.setTitle("申请后配发");
allotBillEntity.setSendUseraId(userId); allotBillEntity.setSendUseraId(userId);
allotBillEntity.setReceiveUseraId(applyTask.getCreateUserId()); // allotBillEntity.setReceiveUseraId(applyTask.getCreateUserId());
allotBillEntity.setApplyNumber(deviceApplyBillEntity.getApplyNumber()); allotBillEntity.setApplyNumber(deviceApplyBillEntity.getApplyNumber());
allotBillEntity.setReplayNumber(deviceApplyBillEntity.getReplayNumber()); allotBillEntity.setReplayNumber(deviceApplyBillEntity.getReplayNumber());
allotBillEntity.setSendUnit(deviceApplyBillEntity.getReplyUnit()); allotBillEntity.setSendUnit(deviceApplyBillEntity.getReplyUnit());
allotBillEntity.setReceiveUnit(deviceApplyBillEntity.getApplyUnit()); allotBillEntity.setReceiveUnit(deviceApplyBillEntity.getApplyUnit());
allotBillEntity.setSendTime(new Date()); allotBillEntity.setSendTime(new Date());
allotBillEntity.setAllotType(2); allotBillEntity.setAllotType(2);
allotBillEntity.setAllotStatus(0); allotBillEntity.setAllotStatus(2);
AllotBill allotBill = allotBillService.addEntity(allotBillEntity); AllotBill allotBill = allotBillService.addEntity(allotBillEntity);
Calendar calendar = Calendar.getInstance(); Calendar calendar = Calendar.getInstance();
calendar.setTime(allotBillEntity.getCreateTime()); calendar.setTime(allotBillEntity.getCreateTime());
int year = calendar.get(Calendar.YEAR); int year = calendar.get(Calendar.YEAR);
String num = "NO:第" + year + "PF" + allotBill.getId() + "号"; String num = "NO:第" + year + "PF" + allotBill.getId() + "号";
allotBill.setNum(num); allotBill.setNum(num);
//生成电子签章id
Long signId = snowflake.creatNextId();
Long signId2 = snowflake.creatNextId();
allotBillEntity.setLeftSignatureId(signId.toString());
allotBillEntity.setRightSignatureId(signId2.toString());
allotBillService.update(allotBill); allotBillService.update(allotBill);
taskBto.setBillId(allotBill.getId()); taskBto.setBillId(allotBill.getId());
//配发业务移动到下一阶段 //配发业务移动到下一阶段
taskService.update(taskService.moveToNext(taskBto, deviceApplyAllotSaveVo.getSendUserbId())); TaskBto taskBto1 = taskService.moveToSpecial(taskBto,StatusEnum.ALLOTING);
taskBto1.setOwnUnit(userPublicService.findUnitIdByName(allotBill.getReceiveUnit()));
taskService.update(taskBto1);
//添加业务日志 //添加业务日志
List<FileVo> fileVoList = new ArrayList<>(); List<FileVo> fileVoList = new ArrayList<>();
fileVoList.add(new FileVo("出库确认单", allotBillEntity.getFileName(), allotBillEntity.getFileUrl())); fileVoList.add(new FileVo("出库确认单", allotBillEntity.getFileName(), allotBillEntity.getFileUrl()));
//添加装备日志 //添加装备日志
List<Integer> integerList = StringSplitUtil.split(allotBillEntity.getAllotCheckDetail()); List<Integer> integerList = StringSplitUtil.split(allotBillEntity.getAllotCheckDetail());
List<Integer> ids = new ArrayList<>();
if (integerList.size() > 0) { if (integerList.size() > 0) {
for (Integer id : integerList) { for (Integer id : integerList) {
if (id > 0) { if (id > 0) {
ids.add(id);
//改变装备状态
DeviceLibrary deviceLibraryEntity = deviceLibraryService.getOne(id);
deviceLibraryEntity.setLifeStatus(3);
deviceLibraryEntity.setManageStatus(0);
DeviceLogDto deviceLogDto = new DeviceLogDto(id, "对" + allotBillEntity.getReceiveUnit() + "发起配发", fileVoList); DeviceLogDto deviceLogDto = new DeviceLogDto(id, "对" + allotBillEntity.getReceiveUnit() + "发起配发", fileVoList);
deviceLogService.addLog(deviceLogDto); deviceLogService.addLog(deviceLogDto);
} }
} }
} }
//添加出库白名单
inputOutputDeviceService.addWhiteDevices(ids, userUtils.getCurrentUnitId(), 1);
//发送阅知信息
List<Integer> userIds = userPublicService.findOtherUser(userId);
userIds.addAll(userDao.findAllByUnitsId(userPublicService.findUnitIdByName(allotBillEntity.getReceiveUnit())).stream()
.map(User::getUserId)
.collect(Collectors.toList()));
MessageBto messageBto = new MessageBto(taskBto1.getId(),taskBto1.getBusinessType(),"对" + allotBillEntity.getReceiveUnit() + "发起配发",userIds);
messageService.add(messageBto);
log.info("[申请模块]:装备申请后发起配发"); log.info("[申请模块]:装备申请后发起配发");
myWebSocket.sendMessage1(); myWebSocket.sendMessage1();
return ResponseEntity.ok("发起配发成功"); return ResponseEntity.ok("发起配发成功");
......
...@@ -14,8 +14,8 @@ import javax.validation.constraints.NotNull; ...@@ -14,8 +14,8 @@ import javax.validation.constraints.NotNull;
@ApiModel("申请后配发类") @ApiModel("申请后配发类")
public class DeviceApplyAllotSaveVo { public class DeviceApplyAllotSaveVo {
@NotNull(message = "sendUserbId不能为空") // @NotNull(message = "sendUserbId不能为空")
@Min(value = 1,message = "sendUserbId不能小于1") // @Min(value = 1,message = "sendUserbId不能小于1")
@ApiModelProperty(value = "发件方(B岗位)") @ApiModelProperty(value = "发件方(B岗位)")
private Integer sendUserbId; private Integer sendUserbId;
......
...@@ -73,7 +73,7 @@ public enum LogType { ...@@ -73,7 +73,7 @@ public enum LogType {
MATCHING_3(29, ADD_MATCHING_DEVICE_CONFIRM.id, ARCHIVE.id, "添加配套设备审核失败"), MATCHING_3(29, ADD_MATCHING_DEVICE_CONFIRM.id, ARCHIVE.id, "添加配套设备审核失败"),
REPAIR_SEND_1(30, ORIGIN_STATUS.id, REPAIR_SEND_CONFIRM.id, "向(%receiveUnit)发起装备维修"), REPAIR_SEND_1(30, ORIGIN_STATUS.id, WAIT_RECEIVE.id, "向(%receiveUnit)发起装备维修"),
REPAIR_SEND_2(31, REPAIR_SEND_CONFIRM.id, WAIT_RECEIVE.id, "审核成功并出库"), REPAIR_SEND_2(31, REPAIR_SEND_CONFIRM.id, WAIT_RECEIVE.id, "审核成功并出库"),
...@@ -81,7 +81,7 @@ public enum LogType { ...@@ -81,7 +81,7 @@ public enum LogType {
REPAIR_SEND_3(32, REPAIR_SEND_CONFIRM.id, ARCHIVE.id, "维修出库审核失败"), REPAIR_SEND_3(32, REPAIR_SEND_CONFIRM.id, ARCHIVE.id, "维修出库审核失败"),
REPAIR_SEND_4(33, WAIT_RECEIVE.id, REPAIR_RECEIVE_CONFIRM.id, "接收维修装备并发起入库"), REPAIR_SEND_4(33, WAIT_RECEIVE.id, END.id, "接收维修装备并发起入库"),
DESTROY_4(100, WAIT_UPLOAD_BILL_FILE.id, END.id, "上传销毁单"), DESTROY_4(100, WAIT_UPLOAD_BILL_FILE.id, END.id, "上传销毁单"),
...@@ -135,7 +135,7 @@ public enum LogType { ...@@ -135,7 +135,7 @@ public enum LogType {
CONFIRM_CHECK_DETAIL_STAT_2(412, CHECK_STAT_1.id, END.id, "地区数据已确认完毕,将统计上传,任务完结"), CONFIRM_CHECK_DETAIL_STAT_2(412, CHECK_STAT_1.id, END.id, "地区数据已确认完毕,将统计上传,任务完结"),
ALLOT_BACK_1(57, ORIGIN_STATUS.id, ALLOT_BACKING.id, "配发退回装备出库成功"), ALLOT_BACK_1(57, ORIGIN_STATUS.id, ALLOT_BACKING.id, "发起配发装备退回"),
ALLOT_BACK_2(58, ALLOT_BACKING.id, ALLOT_BACK_CONFIRM.id, "配发退回装备接收成功"), ALLOT_BACK_2(58, ALLOT_BACKING.id, ALLOT_BACK_CONFIRM.id, "配发退回装备接收成功"),
...@@ -165,7 +165,14 @@ public enum LogType { ...@@ -165,7 +165,14 @@ public enum LogType {
WORK_H1(79, ORIGIN_STATUS.id, WORKHANDOVER1011.id, "工作交接任务生成完成,等待上传交接单"), WORK_H1(79, ORIGIN_STATUS.id, WORKHANDOVER1011.id, "工作交接任务生成完成,等待上传交接单"),
WORK_H2(80, WORKHANDOVER1011.id, END.id, "工作交接完成"); WORK_H2(80, WORKHANDOVER1011.id, END.id, "工作交接完成"),
STORAGE_4(81, ORIGIN_STATUS.id, END.id, "进行装备入库"),
ALLOT_8(82, ORIGIN_STATUS.id, ALLOTING.id, "对(%receiveUnit)发起配发"),
ALLOT_9(83, ALLOTING.id, END.id, "接收配发装备"),
ALLOT_10(84, WAIT_ALLOT.id, ALLOTING.id, "对(%receiveUnit)发起配发"),
ALLOT_11(85, ALLOTING.id, ARCHIVE.id, "拒绝接收配发装备"),
ALLOT_BACK_5(86, ALLOT_BACKING.id, END.id, "接收配发退回装备"),
;
public Integer id; public Integer id;
/** /**
......
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>equip</artifactId>
<groupId>com.tykj</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>dev-read</artifactId>
<dependencies>
<dependency>
<groupId>com.tykj.dev</groupId>
<artifactId>config</artifactId>
</dependency>
<dependency>
<groupId>com.tykj</groupId>
<artifactId>dev-user</artifactId>
</dependency>
</dependencies>
</project>
\ No newline at end of file
package com.tykj.dev.device.read;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
/**
* @author zjm
* @version 1.0.0
* @ClassName userApp.java
* @Description TODO
* @createTime 2020年09月01日 14:32:00
*/
@SpringBootApplication(scanBasePackages = {
"com.tykj.dev.*",
}
)
public class readApp {
public static void main(String[] args) {
SpringApplication.run(readApp.class, args);
}
}
...@@ -40,6 +40,11 @@ ...@@ -40,6 +40,11 @@
<groupId>com.tykj.dev</groupId> <groupId>com.tykj.dev</groupId>
<artifactId>rfid</artifactId> <artifactId>rfid</artifactId>
</dependency> </dependency>
<dependency>
<groupId>com.tykj</groupId>
<artifactId>dev-read</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
</dependencies> </dependencies>
</project> </project>
\ No newline at end of file
...@@ -32,6 +32,11 @@ ...@@ -32,6 +32,11 @@
<groupId>com.tykj.dev</groupId> <groupId>com.tykj.dev</groupId>
<artifactId>config</artifactId> <artifactId>config</artifactId>
</dependency> </dependency>
<dependency>
<groupId>com.tykj</groupId>
<artifactId>dev-read</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
</dependencies> </dependencies>
</project> </project>
\ No newline at end of file
...@@ -34,6 +34,8 @@ import org.springframework.http.ResponseEntity; ...@@ -34,6 +34,8 @@ import org.springframework.http.ResponseEntity;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import com.tykj.dev.device.read.service.MessageService;
import com.tykj.dev.device.read.subject.bto.MessageBto;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
...@@ -73,6 +75,9 @@ public class StorageBillController { ...@@ -73,6 +75,9 @@ public class StorageBillController {
@Autowired @Autowired
private MyWebSocket myWebSocket; private MyWebSocket myWebSocket;
@Autowired
private MessageService messageService;
@ApiOperation(value = "获取序列号区间列表", notes = "可以通过这个接口获取序列号区间列表") @ApiOperation(value = "获取序列号区间列表", notes = "可以通过这个接口获取序列号区间列表")
@GetMapping(value = "/getSeq/{num}/{string}") @GetMapping(value = "/getSeq/{num}/{string}")
public ResponseEntity getSeq(@PathVariable("string") String s,@PathVariable("num") Integer num){ public ResponseEntity getSeq(@PathVariable("string") String s,@PathVariable("num") Integer num){
...@@ -131,8 +136,8 @@ public class StorageBillController { ...@@ -131,8 +136,8 @@ public class StorageBillController {
//2.发起入库任务 //2.发起入库任务
List<Integer> userIds = new ArrayList<>(); List<Integer> userIds = new ArrayList<>();
userIds.add(userId); userIds.add(userId);
userIds.add(storageBillSaveVo.getReceiveUserbId()); // userIds.add(storageBillSaveVo.getReceiveUserbId());
TaskBto taskBto = new TaskBto(StatusEnum.STORAGE_CONFIRM.id, "入库业务", null, ".", storageBillEntity.getId(), 2, userUtils.getCurrentUnitId(), 1, null, userIds); TaskBto taskBto = new TaskBto(StatusEnum.END.id, "入库业务", null, ".", storageBillEntity.getId(), 2, userUtils.getCurrentUnitId(), 0, null, userIds);
TaskBto taskEntity1 = taskService.start(taskBto); TaskBto taskEntity1 = taskService.start(taskBto);
//存业务日志 //存业务日志
List<FileVo> fileVoList = new ArrayList<>(); List<FileVo> fileVoList = new ArrayList<>();
...@@ -146,7 +151,7 @@ public class StorageBillController { ...@@ -146,7 +151,7 @@ public class StorageBillController {
PackingLibrary packingLibraryEntity = packingLibraryService.getOne(d.getPackingId()); PackingLibrary packingLibraryEntity = packingLibraryService.getOne(d.getPackingId());
BeanUtils.copyProperties(packingLibraryEntity, deviceLibraryEntity); BeanUtils.copyProperties(packingLibraryEntity, deviceLibraryEntity);
deviceLibraryEntity.setId(null); deviceLibraryEntity.setId(null);
deviceLibraryEntity.setLifeStatus(0); deviceLibraryEntity.setLifeStatus(2);
BeanUtils.copyProperties(d, deviceLibraryEntity); BeanUtils.copyProperties(d, deviceLibraryEntity);
deviceLibraryEntity.setStorageBillId(storageBillId); deviceLibraryEntity.setStorageBillId(storageBillId);
deviceLibraryEntity.setLocationUnit(userUtils.getCurrentUserUnitName()); deviceLibraryEntity.setLocationUnit(userUtils.getCurrentUserUnitName());
...@@ -169,14 +174,21 @@ public class StorageBillController { ...@@ -169,14 +174,21 @@ public class StorageBillController {
} }
stringBuffer.append(saveEntity.getId()); stringBuffer.append(saveEntity.getId());
//存装备日志 //存装备日志
DeviceLogDto deviceLogDto = new DeviceLogDto(saveEntity.getId(), "发起入库", fileVoList); DeviceLogDto deviceLogDto = new DeviceLogDto(saveEntity.getId(), "发起装备入库", fileVoList);
deviceLogService.addLog(deviceLogDto); deviceLogService.addLog(deviceLogDto);
stringBuffer.append("x"); stringBuffer.append("x");
} }
//4.更新入库单入库详情 //4.更新入库单入库详情
storageBillEntity.setStorageDetail(stringBuffer.toString()); storageBillEntity.setStorageDetail(stringBuffer.toString());
//发送阅知信息
MessageBto messageBto = new MessageBto();
messageBto.setContent("发起装备入库");
messageBto.setTaskId(taskEntity1.getId());
messageBto.setInvolveUserIdList(userPublicService.findOtherUser(userId));
messageBto.setBusinessType(taskEntity1.getBusinessType());
messageService.add(messageBto);
myWebSocket.sendMessage1(); myWebSocket.sendMessage1();
return ResultUtil.success(storageBillService.update(storageBillEntity)); return ResultUtil.success(taskEntity1);
} }
@ApiOperation(value = "入库审核", notes = "可以通过这个接口入库审核") @ApiOperation(value = "入库审核", notes = "可以通过这个接口入库审核")
......
...@@ -45,8 +45,8 @@ public class StorageBillSaveVo { ...@@ -45,8 +45,8 @@ public class StorageBillSaveVo {
@ApiModelProperty(value = "接收单位A岗") @ApiModelProperty(value = "接收单位A岗")
private Integer receiveUseraId; private Integer receiveUseraId;
@NotNull(message = "receiveUserbId不能为空") // @NotNull(message = "receiveUserbId不能为空")
@Min(value = 1,message = "receiveUserbId不能小于1") // @Min(value = 1,message = "receiveUserbId不能小于1")
@ApiModelProperty(value = "接收单位B岗") @ApiModelProperty(value = "接收单位B岗")
private Integer receiveUserbId; private Integer receiveUserbId;
...@@ -84,7 +84,7 @@ public class StorageBillSaveVo { ...@@ -84,7 +84,7 @@ public class StorageBillSaveVo {
public StorageBill toDo() { public StorageBill toDo() {
StorageBill storageBillEntity = new StorageBill(); StorageBill storageBillEntity = new StorageBill();
BeanUtils.copyProperties(this, storageBillEntity); BeanUtils.copyProperties(this, storageBillEntity);
storageBillEntity.setStorageStatus(0); storageBillEntity.setStorageStatus(2);
storageBillEntity.setStorageDetail("x"); storageBillEntity.setStorageDetail("x");
return storageBillEntity; return storageBillEntity;
} }
......
...@@ -494,13 +494,12 @@ public class TaskServiceImpl implements TaskService { ...@@ -494,13 +494,12 @@ public class TaskServiceImpl implements TaskService {
update(taskBto); update(taskBto);
}); });
//查询跟踪 //查询跟踪
//涉及人员包括旧用户且指针对应UserId不是旧用户 //涉及人员包括旧用户
List<TaskBto> taskBtos1 = taskBtos.stream() List<TaskBto> taskBtos1 = taskBtos.stream()
.filter(taskBto -> { .filter(taskBto -> {
boolean involveExists = taskBto.getInvolveUserIdList().contains(oldUserId); boolean involveExists = taskBto.getInvolveUserIdList().contains(oldUserId);
boolean pointExists = taskBto.getCurrentPoint() < taskBto.getInvolveUserIdList().size(); boolean pointExists = taskBto.getCurrentPoint() < taskBto.getInvolveUserIdList().size();
boolean userConfirm = oldUserId.equals(taskBto.getInvolveUserIdList().get(taskBto.getCurrentPoint())); return involveExists && pointExists;
return involveExists && pointExists && !userConfirm;
}) })
.collect(Collectors.toList()); .collect(Collectors.toList());
//替换用户id //替换用户id
...@@ -568,13 +567,14 @@ public class TaskServiceImpl implements TaskService { ...@@ -568,13 +567,14 @@ public class TaskServiceImpl implements TaskService {
} }
//查询跟踪 //查询跟踪
if (taskSelectVo.getSelectNum() == 3) { if (taskSelectVo.getSelectNum() == 3) {
//涉及人员包括当前用户且指针对应UserId不是当前用户 //所有涉及人员所在单位包含当前用户所在单位且指针对应UserId不是当前用户
List<TaskBto> taskBtoList = taskBtos.stream() List<TaskBto> taskBtoList = taskBtos.stream()
.filter(taskBto -> { .filter(taskBto -> {
boolean involveExists = taskBto.getInvolveUserIdList().contains(userId); boolean unitExists = getUnitsByUsers(taskBto.getInvolveUserIdList()).contains(unitId);
// boolean involveExists = taskBto.getInvolveUserIdList().contains(userId);
boolean pointExists = taskBto.getCurrentPoint() < taskBto.getInvolveUserIdList().size(); boolean pointExists = taskBto.getCurrentPoint() < taskBto.getInvolveUserIdList().size();
boolean userConfirm = userId.equals(taskBto.getInvolveUserIdList().get(taskBto.getCurrentPoint())); boolean userConfirm = userId.equals(taskBto.getInvolveUserIdList().get(taskBto.getCurrentPoint()));
return involveExists && pointExists && !userConfirm; return unitExists && pointExists && !userConfirm;
}) })
.collect(Collectors.toList()); .collect(Collectors.toList());
//涉及人员当前指针为-1,且所属单位为当前单位 //涉及人员当前指针为-1,且所属单位为当前单位
...@@ -753,4 +753,18 @@ public class TaskServiceImpl implements TaskService { ...@@ -753,4 +753,18 @@ public class TaskServiceImpl implements TaskService {
} }
return index; return index;
} }
/**
* @param userIds 用户Id列表
* @return 返回存在这些用户的单位
*/
private Set<Integer> getUnitsByUsers(List<Integer> userIds){
Set<Integer> unitIds = new HashSet<>();
userIds.forEach(integer -> {
if (integer>0) {
unitIds.add(userCache.findById(integer).getUnitsId());
}
});
return unitIds;
}
} }
...@@ -381,7 +381,11 @@ ...@@ -381,7 +381,11 @@
</exclusion> </exclusion>
</exclusions> </exclusions>
</dependency> </dependency>
<dependency>
<groupId>com.tykj</groupId>
<artifactId>dev-read</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<!-- Spring Security Test --> <!-- Spring Security Test -->
<dependency> <dependency>
<groupId>org.springframework.security</groupId> <groupId>org.springframework.security</groupId>
......
...@@ -39,4 +39,10 @@ public interface UserPublicService { ...@@ -39,4 +39,10 @@ public interface UserPublicService {
List<String> findAllUnitNameByAreaId(Integer areaId); List<String> findAllUnitNameByAreaId(Integer areaId);
Integer findUnitIdByName(String unitName); Integer findUnitIdByName(String unitName);
/**
* @param userId 用户id
* 查询该用户同级其他用户Id
*/
List<Integer> findOtherUser(Integer userId);
} }
...@@ -77,6 +77,19 @@ public class UserPublicServiceImpl implements UserPublicService { ...@@ -77,6 +77,19 @@ public class UserPublicServiceImpl implements UserPublicService {
return unitsDao.findByName(unitName).getUnitId(); return unitsDao.findByName(unitName).getUnitId();
} }
/**
* @param userId 用户id
* 查询该用户同级其他用户Id
*/
@Override
public List<Integer> findOtherUser(Integer userId) {
Integer unitId = userCache.findById(userId).getUnitsId();
return userCache.findAll().stream()
.filter(user -> user.getUnitsId().equals(unitId)&&!user.getUserId().equals(userId))
.map(User::getUserId)
.collect(Collectors.toList());
}
@Override @Override
public String findUnitsNameByUserId(Integer userId) { public String findUnitsNameByUserId(Integer userId) {
User resultEntity = userCache.findById(userId); User resultEntity = userCache.findById(userId);
......
...@@ -42,6 +42,7 @@ ...@@ -42,6 +42,7 @@
<module>dev-user</module> <module>dev-user</module>
<module>dev-usereport</module> <module>dev-usereport</module>
<module>dev-statistical</module> <module>dev-statistical</module>
<module>dev-read</module>
</modules> </modules>
<properties> <properties>
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论