提交 8f78d70d authored 作者: 133's avatar 133

【zjm】 提交1-31代码的修改

上级 84c5d132
...@@ -187,9 +187,22 @@ public enum LogType { ...@@ -187,9 +187,22 @@ public enum LogType {
SEND_BACK_20(100010,SEND_BACK.id, SEND_BACK_1211.id,END.id , "省对单位审核不通过,任务结束"), SEND_BACK_20(100010,SEND_BACK.id, SEND_BACK_1211.id,END.id , "省对单位审核不通过,任务结束"),
SEND_BACK_21(100011,SEND_BACK.id, SEND_BACK_1211.id,SEND_BACK_1204.id , "省对单位审核通过,等待下级单位提交"), SEND_BACK_21(100011,SEND_BACK.id, SEND_BACK_1211.id,SEND_BACK_1204.id , "省对单位审核通过,等待下级单位提交"),
SEND_BACK_23(100013,SEND_BACK.id, SEND_BACK_1212.id,END.id , "清退统计任务已办结"), SEND_BACK_23(100013,SEND_BACK.id, SEND_BACK_1212.id,END.id , "清退统计任务已办结"),
SEND_BACK_24(100014,SEND_BACK.id, SEND_BACK_1204.id,SEND_BACK_1212.id , "市清退统计任务待办结"), SEND_BACK_24(100014,SEND_BACK_STATISTICAL.id, SEND_BACK_1204.id,SEND_BACK_1212.id , "市清退统计任务待办结"),
SEND_BACK_25(100015,SEND_BACK.id, SEND_BACK_1200.id,SEND_BACK_1212.id , "省清退统计任务待办结"), SEND_BACK_25(100015,SEND_BACK_STATISTICAL.id, SEND_BACK_1200.id,SEND_BACK_1212.id , "省清退统计任务待办结"),
SEND_BACK_26(100016,SEND_BACK.id, SEND_BACK_1214.id,END.id , "清退装备任务,上传了回执单据"),
SEND_BACK_27(100017,SEND_BACK.id, SEND_BACK_1202.id,SEND_BACK_1213.id , "省直属单位清退装备选择完成,等待签字单据上传"),
SEND_BACK_28(100018,SEND_BACK.id, SEND_BACK_1213.id,END.id , "上传了直属单位清退签字单据"),
LOSS_1(9000,LOSS.id,ORIGIN_STATUS.id,LOSS1300.id,"发起装备丢失上报"),
LOSS_2(9001,LOSS.id,LOSS1300.id,LOSS1300.id,"确认了装备丢失"),
LOSS_3(9002,LOSS.id,LOSS1300.id,END.id,"确认了装备丢失报告,报告任务结束"),
LOSS_4(9003,LOSS.id,ORIGIN_STATUS.id,END.id,"省装备丢失报告发起记录"),
RETRIEVE_1(9010,RETRIEVE.id,ORIGIN_STATUS.id,RETRIEVE1400.id,"发起装备找回上报"),
RETRIEVE_2(9011,RETRIEVE.id,RETRIEVE1400.id,RETRIEVE1400.id,"确认了装备找回上报"),
RETRIEVE_3(9012,RETRIEVE.id,RETRIEVE1400.id,END.id,"确认了装备找回上报,找回任务结束"),
RETRIEVE_4(9013,LOSS.id,ORIGIN_STATUS.id,END.id,"省装备找回报告发起记录"),
WORK_H1(79, WORK_HANDOVER.id, ORIGIN_STATUS.id, WORKHANDOVER1011.id, "工作交接任务生成完成,等待上传交接单"), WORK_H1(79, WORK_HANDOVER.id, ORIGIN_STATUS.id, WORKHANDOVER1011.id, "工作交接任务生成完成,等待上传交接单"),
......
...@@ -2,6 +2,7 @@ package com.tykj.dev.device.loss.controller; ...@@ -2,6 +2,7 @@ package com.tykj.dev.device.loss.controller;
import com.tykj.dev.config.swagger.AutoDocument; import com.tykj.dev.config.swagger.AutoDocument;
import com.tykj.dev.device.loss.entity.vo.LossAuditvo; import com.tykj.dev.device.loss.entity.vo.LossAuditvo;
import com.tykj.dev.device.loss.entity.vo.RetrieveAuditvo;
import com.tykj.dev.device.loss.service.LossBillService; import com.tykj.dev.device.loss.service.LossBillService;
import com.tykj.dev.device.loss.entity.domain.DeviceLoss; import com.tykj.dev.device.loss.entity.domain.DeviceLoss;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
...@@ -38,4 +39,18 @@ public class DeviceLossController { ...@@ -38,4 +39,18 @@ public class DeviceLossController {
lossBillService.superiorAuditLoss(lossAuditvo); lossBillService.superiorAuditLoss(lossAuditvo);
return ResponseEntity.ok("确认成功"); return ResponseEntity.ok("确认成功");
} }
@PostMapping(value ="/initiateRetrieve")
@ApiOperation(value = "找回装备上报", notes = "找回装备上报接口")
public ResponseEntity initiateRetrieve(@RequestBody DeviceLoss deviceLoss){
lossBillService.initiateRetrieve(deviceLoss);
return ResponseEntity.ok("上报成功");
}
@PostMapping(value ="/superiorAuditRetrieve")
@ApiOperation(value = "上报上级单位确认接口", notes = "上报上级单位确认接口")
public ResponseEntity superiorAuditRetrieve(@RequestBody RetrieveAuditvo retrieveAuditvo){
lossBillService.superiorAuditRetrieve(retrieveAuditvo);
return ResponseEntity.ok("确认成功");
}
} }
...@@ -2,6 +2,7 @@ package com.tykj.dev.device.loss.entity.domain; ...@@ -2,6 +2,7 @@ package com.tykj.dev.device.loss.entity.domain;
import com.tykj.dev.device.file.entity.FileRet; import com.tykj.dev.device.file.entity.FileRet;
import com.tykj.dev.device.file.service.FilesUtil; import com.tykj.dev.device.file.service.FilesUtil;
import com.tykj.dev.device.loss.entity.vo.DeviceLossVo;
import com.tykj.dev.device.loss.util.StringUtils; import com.tykj.dev.device.loss.util.StringUtils;
import com.tykj.dev.misc.base.BaseEntity; import com.tykj.dev.misc.base.BaseEntity;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
...@@ -98,8 +99,8 @@ public class DeviceLoss extends BaseEntity { ...@@ -98,8 +99,8 @@ public class DeviceLoss extends BaseEntity {
/** /**
* 找回业务状态 * 找回业务状态
*/ */
@ApiModelProperty(value = "找回业务状态") @ApiModelProperty(value = "找回业务状态 1.等待审核 2.审核通过 3.审核失败")
private Integer backStatus; private Integer backStatus=1;
/** /**
* 单据集合 * 单据集合
...@@ -115,37 +116,43 @@ public class DeviceLoss extends BaseEntity { ...@@ -115,37 +116,43 @@ public class DeviceLoss extends BaseEntity {
@Transient @Transient
private List<Integer> devIdsList; private List<Integer> devIdsList;
/**
* 装备集合
public String getDevIds() { */
return devIds; @ApiModelProperty(value = "装备集合")
} @Transient
private List<DeviceLossVo> deviceLossVoList;
public void setDevIds() {
this.devIds = StringUtils.ListToString(devIdsList);
} // public String getDevIds() {
// return devIds;
public String getLossFile() { // }
return lossFile; //
} // public void setDevIds() {
// this.devIds = StringUtils.ListToString(devIdsList);
public void setLossFile() { // }
this.lossFile = FilesUtil.stringFileToList(fileRetList); //
} // public String getLossFile() {
// return lossFile;
public List<FileRet> getFileRetList() { // }
return FilesUtil.stringFileToList(lossFile); //
} // public void setLossFile() {
// this.lossFile = FilesUtil.stringFileToList(fileRetList);
public void setFileRetList(List<FileRet> fileRetList) { // }
this.fileRetList = fileRetList; //
} // public List<FileRet> getFileRetList() {
// return FilesUtil.stringFileToList(lossFile);
public List<Integer> getDevIdsList() { // }
return StringUtils.stringToList(devIds); //
} // public void setFileRetList(List<FileRet> fileRetList) {
// this.fileRetList = fileRetList;
public void setDevIdsList(List<Integer> devIdsList) { // }
this.devIdsList = devIdsList; //
} // public List<Integer> getDevIdsList() {
// return StringUtils.stringToList(devIds);
// }
//
// public void setDevIdsList(List<Integer> devIdsList) {
// this.devIdsList = devIdsList;
// }
} }
package com.tykj.dev.device.loss.entity.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author dengdiyi
*/
@Data
@ApiModel("装备类")
public class DeviceLossVo {
private Integer id;
/**
* 型号
*/
@ApiModelProperty(value = "型号")
private String model;
/**
* 类型
*/
@ApiModelProperty(value = "类型")
private Integer type;
/**
* 装备名称
*/
@ApiModelProperty(value = "装备名称")
private String name;
@ApiModelProperty(value = "装备序列号")
private String seqNumber;
/**
* rfid表面号
*/
@ApiModelProperty(value = "rfid表面号")
private String rfidSurfaceId;
/**
* 所在单位
*/
@ApiModelProperty(value = "所在单位")
private String locationUnit;
/**
* 所属单位
*/
@ApiModelProperty(value = "所属单位")
private String ownUnit;
}
...@@ -38,7 +38,7 @@ public class LossAuditvo { ...@@ -38,7 +38,7 @@ public class LossAuditvo {
* 用户单位名称 * 用户单位名称
*/ */
@ApiModelProperty(value = "用户单位名称") @ApiModelProperty(value = "用户单位名称")
private Integer unitName; private String unitName;
/** /**
* 备注 * 备注
*/ */
......
...@@ -38,7 +38,7 @@ public class RetrieveAuditvo { ...@@ -38,7 +38,7 @@ public class RetrieveAuditvo {
* 用户单位名称 * 用户单位名称
*/ */
@ApiModelProperty(value = "用户单位名称") @ApiModelProperty(value = "用户单位名称")
private Integer unitName; private String unitName;
/** /**
* 备注 * 备注
*/ */
......
package com.tykj.dev.device.loss.service.impl; package com.tykj.dev.device.loss.service.impl;
import com.tykj.dev.device.file.service.FilesUtil;
import com.tykj.dev.device.library.repository.DeviceLibraryDao;
import com.tykj.dev.device.library.subject.domin.DeviceLibrary;
import com.tykj.dev.device.loss.entity.domain.DeviceLoss; import com.tykj.dev.device.loss.entity.domain.DeviceLoss;
import com.tykj.dev.device.loss.entity.vo.DeviceLossVo;
import com.tykj.dev.device.loss.service.DeviceLossService; import com.tykj.dev.device.loss.service.DeviceLossService;
import com.tykj.dev.device.loss.service.LossBillSelectService; import com.tykj.dev.device.loss.service.LossBillSelectService;
import com.tykj.dev.device.loss.util.StringUtils;
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.misc.base.BeanHelper;
import org.modelmapper.ModelMapper;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.stream.Collectors;
/** /**
* @author zjm * @author zjm
* @version 1.0.0 * @version 1.0.0
...@@ -21,9 +30,20 @@ public class LossBillSelectServiceImpl implements LossBillSelectService { ...@@ -21,9 +30,20 @@ public class LossBillSelectServiceImpl implements LossBillSelectService {
TaskService taskService; TaskService taskService;
@Autowired @Autowired
DeviceLossService deviceLossService; DeviceLossService deviceLossService;
@Autowired
DeviceLibraryDao deviceLibraryDao;
@Override @Override
public DeviceLoss findDeviceLoss(Integer taskId) { public DeviceLoss findDeviceLoss(Integer taskId) {
TaskBto taskBto= taskService.get(taskId); TaskBto taskBto= taskService.get(taskId);
return deviceLossService.findByDeviceLoss(taskBto.getBillId()); DeviceLoss deviceLoss=deviceLossService.findByDeviceLoss(taskBto.getBillId());
deviceLoss.setDeviceLossVoList( deviceLibraryDao.findAllById(StringUtils.stringToList(deviceLoss.getDevIds()))
.stream().map(this::toDeviceLossVo).collect(Collectors.toList()));
deviceLoss.setFileRetList(FilesUtil.stringFileToList(deviceLoss.getLossFile()));
return deviceLoss;
}
private DeviceLossVo toDeviceLossVo(DeviceLibrary deviceLibrary){
ModelMapper mapper = BeanHelper.getUserMapper();
return mapper.map(deviceLibrary, DeviceLossVo.class);
} }
} }
package com.tykj.dev.device.loss.service.impl; package com.tykj.dev.device.loss.service.impl;
import com.tykj.dev.device.file.service.FilesUtil;
import com.tykj.dev.device.library.repository.DeviceLibraryDao; import com.tykj.dev.device.library.repository.DeviceLibraryDao;
import com.tykj.dev.device.library.service.DeviceLogService; import com.tykj.dev.device.library.service.DeviceLogService;
import com.tykj.dev.device.library.subject.Dto.DeviceLogDto; import com.tykj.dev.device.library.subject.Dto.DeviceLogDto;
...@@ -8,6 +9,7 @@ import com.tykj.dev.device.loss.entity.vo.LossAuditvo; ...@@ -8,6 +9,7 @@ import com.tykj.dev.device.loss.entity.vo.LossAuditvo;
import com.tykj.dev.device.loss.entity.vo.RetrieveAuditvo; import com.tykj.dev.device.loss.entity.vo.RetrieveAuditvo;
import com.tykj.dev.device.loss.service.DeviceLossService; import com.tykj.dev.device.loss.service.DeviceLossService;
import com.tykj.dev.device.loss.service.LossBillService; import com.tykj.dev.device.loss.service.LossBillService;
import com.tykj.dev.device.loss.util.StringUtils;
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.user.subject.entity.Area; import com.tykj.dev.device.user.subject.entity.Area;
...@@ -52,19 +54,22 @@ public class LossBillServiceImpl implements LossBillService { ...@@ -52,19 +54,22 @@ public class LossBillServiceImpl implements LossBillService {
@Autowired @Autowired
DeviceLogService deviceLogService; DeviceLogService deviceLogService;
@Override @Override
public void initiateLoss(DeviceLoss deviceLoss) { public void initiateLoss(DeviceLoss deviceLoss) {
deviceLoss.setDevIds(StringUtils.ListToString(deviceLoss.getDevIdsList()));
deviceLoss.setLossFile(FilesUtil.stringFileToList(deviceLoss.getFileRetList()));
DeviceLoss deviceLossThis= deviceLossService.save(deviceLoss); DeviceLoss deviceLossThis= deviceLossService.save(deviceLoss);
Units units=unitsService.findById(deviceLoss.getUnitId()); Units units=unitsService.findById(deviceLoss.getUnitId());
Area area=areaService.findByid(units.getAreaId()); Area area=areaService.findByid(units.getAreaId());
if (units.getLevel() == 1) { if (units.getLevel() == 1) {
end(deviceLossThis.getCreateUserId(), deviceLossThis.getId(), units.getName() + "丢失装备任务", units.getUnitId()); end(deviceLossThis.getCreateUserId(), deviceLossThis.getId(), units.getName() + "丢失装备任务", units.getUnitId());
} else { } else {
Units parentUnits=unitsService.findByAreaId(area.getFatherId()); Units parentUnits=unitsService.findUnitAreaId(area.getFatherId());
newLossTask(parentUnits.getUnitId(), deviceLossThis.getId(), units.getName() + "丢失装备任务"); newLossTask(parentUnits.getUnitId(), deviceLossThis.getId(), units.getName() + "丢失装备任务");
} }
deviceLibraryDao.upDateLeftStatus(DeviceLifeStatus.LOSS.id,deviceLoss.getDevIdsList()); deviceLibraryDao.upDateLeftStatus(DeviceLifeStatus.LOSS.id,deviceLoss.getDevIdsList());
devLogAdd(deviceLoss.getDevIdsList(), deviceLoss.getCreateUserId()); devLogAdd(deviceLoss.getDevIdsList(),"装备报备丢失", deviceLoss.getCreateUserId());
} }
...@@ -80,7 +85,7 @@ public class LossBillServiceImpl implements LossBillService { ...@@ -80,7 +85,7 @@ public class LossBillServiceImpl implements LossBillService {
deviceLoss.setProvinceDes(lossAuditvo.getDes()); deviceLoss.setProvinceDes(lossAuditvo.getDes());
taskService.moveToEnd(taskBto); taskService.moveToEnd(taskBto);
}else { }else {
Units parentUnits=unitsService.findByAreaId(area.getFatherId()); Units parentUnits=unitsService.findUnitAreaId(area.getFatherId());
deviceLoss.setCityUnitName(units.getName()); deviceLoss.setCityUnitName(units.getName());
deviceLoss.setCityDes(lossAuditvo.getDes()); deviceLoss.setCityDes(lossAuditvo.getDes());
taskBto.setOwnUnit(parentUnits.getUnitId()); taskBto.setOwnUnit(parentUnits.getUnitId());
...@@ -92,35 +97,65 @@ public class LossBillServiceImpl implements LossBillService { ...@@ -92,35 +97,65 @@ public class LossBillServiceImpl implements LossBillService {
@Override @Override
public void initiateRetrieve(DeviceLoss deviceLoss) { public void initiateRetrieve(DeviceLoss deviceLoss) {
deviceLoss.setDevIds(StringUtils.ListToString(deviceLoss.getDevIdsList()));
deviceLoss.setLossFile(FilesUtil.stringFileToList(deviceLoss.getFileRetList()));
DeviceLoss deviceLossThis= deviceLossService.save(deviceLoss); DeviceLoss deviceLossThis= deviceLossService.save(deviceLoss);
Units units=unitsService.findById(deviceLoss.getUnitId()); Units units=unitsService.findById(deviceLoss.getUnitId());
Area area=areaService.findByid(units.getAreaId()); Area area=areaService.findByid(units.getAreaId());
if (units.getLevel() == 1) { if (units.getLevel() == 1) {
endRetrieve(deviceLossThis.getCreateUserId(), deviceLossThis.getId(), units.getName() + "丢失装备任务", units.getUnitId()); endRetrieve(deviceLossThis.getCreateUserId(), deviceLossThis.getId(), units.getName() + "找回装备任务", units.getUnitId());
deviceLibraryDao.upDateLeftStatus(DeviceLifeStatus.IN_LIBRARY.id,deviceLoss.getDevIdsList()); deviceLibraryDao.upDateLeftStatus(DeviceLifeStatus.IN_LIBRARY.id,deviceLoss.getDevIdsList());
} else { } else {
Units parentUnits=unitsService.findByAreaId(area.getFatherId()); Units parentUnits=unitsService.findUnitAreaId(area.getFatherId());
newRetrieveTask(parentUnits.getUnitId(), deviceLossThis.getId(), units.getName() + "丢失装备任务"); newRetrieveTask(parentUnits.getUnitId(), deviceLossThis.getId(), units.getName() + "找回装备任务");
} }
devLogAdd(deviceLoss.getDevIdsList(), deviceLoss.getCreateUserId()); devLogAdd(deviceLoss.getDevIdsList(),"装备找回上报", deviceLoss.getCreateUserId());
} }
@Override @Override
public void superiorAuditRetrieve(RetrieveAuditvo retrieveAuditvo) { public void superiorAuditRetrieve(RetrieveAuditvo retrieveAuditvo) {
Units units=unitsService.findById(retrieveAuditvo.getUnitId());
Area area=areaService.findByid(units.getAreaId());
TaskBto taskBto=taskService.get(retrieveAuditvo.getTaskId());
DeviceLoss deviceLoss=deviceLossService.findByDeviceLoss(taskBto.getBillId());
if (units.getLevel()==1){
deviceLoss.setProvinceUnitName(units.getName());
deviceLoss.setProvinceDes(retrieveAuditvo.getDes());
taskService.moveToEnd(taskBto);
if (retrieveAuditvo.getType()==1){
deviceLoss.setBackStatus(2);
deviceLibraryDao.upDateLeftStatus(DeviceLifeStatus.IN_LIBRARY.id,deviceLoss.getDevIdsList());
}else {
deviceLoss.setBackStatus(3);
}
}else {
Units parentUnits=unitsService.findUnitAreaId(area.getFatherId());
deviceLoss.setCityUnitName(units.getName());
deviceLoss.setCityDes(retrieveAuditvo.getDes());
if (retrieveAuditvo.getType()==1){
taskBto.setOwnUnit(parentUnits.getUnitId());
taskService.moveToSpecial(taskBto,StatusEnum.RETRIEVE1400,0);
}else {
taskService.moveToEnd(taskBto);
deviceLoss.setBackStatus(3);
}
}
deviceLossService.save(deviceLoss);
} }
private void newRetrieveTask(Integer unitId, Integer lossId, String title){ private void newRetrieveTask(Integer unitId, Integer lossId, String title){
List<Integer> list=new ArrayList<>(); List<Integer> list=new ArrayList<>();
list.add(0); list.add(0);
taskService.start(new TaskBto(StatusEnum.RETRIEVE.id, title, 0, ".", lossId, BusinessEnum.LOSS.id, unitId, 0, "", list)); taskService.start(new TaskBto(StatusEnum.RETRIEVE1400.id, title, 0, ".", lossId, BusinessEnum.RETRIEVE.id, unitId, 0, "", list));
} }
private void endRetrieve(Integer userId, Integer lossId, String title, Integer unitId){ private void endRetrieve(Integer userId, Integer lossId, String title, Integer unitId){
List<Integer> list=new ArrayList<>(); List<Integer> list=new ArrayList<>();
list.add(userId); list.add(userId);
taskService.start(new TaskBto(StatusEnum.LOSS1300.id, title, 0, ".", lossId, BusinessEnum.LOSS.id, unitId, 0, "", list)); taskService.start(new TaskBto(StatusEnum.END.id, title, 0, ".", lossId, BusinessEnum.RETRIEVE.id, unitId, 0, "", list));
} }
...@@ -133,17 +168,16 @@ public class LossBillServiceImpl implements LossBillService { ...@@ -133,17 +168,16 @@ public class LossBillServiceImpl implements LossBillService {
private void end(Integer userId, Integer lossId, String title, Integer unitId){ private void end(Integer userId, Integer lossId, String title, Integer unitId){
List<Integer> list=new ArrayList<>(); List<Integer> list=new ArrayList<>();
list.add(userId); list.add(userId);
taskService.start(new TaskBto(StatusEnum.LOSS1300.id, title, 0, ".", lossId, BusinessEnum.LOSS.id, unitId, 0, "", list)); taskService.start(new TaskBto(StatusEnum.END.id, title, 0, ".", lossId, BusinessEnum.LOSS.id, unitId, 0, "", list));
} }
private void devLogAdd(List<Integer> ids, Integer userId){ private void devLogAdd(List<Integer> ids, String remark,Integer userId){
List<DeviceLog> logDtos=new ArrayList<>(); List<DeviceLog> logDtos=new ArrayList<>();
deviceLibraryDao.findAllById(ids).forEach( deviceLibraryDao.findAllById(ids).forEach(
deviceLibrary -> logDtos.add(new DeviceLogDto(deviceLibrary.getId(), "报备装备丢失",null,userId).toDo()) deviceLibrary -> logDtos.add(new DeviceLogDto(deviceLibrary.getId(), remark,null,userId).toDo())
); );
CompletableFuture.runAsync(() -> deviceLogService.saveAllLog(logDtos)); CompletableFuture.runAsync(() -> deviceLogService.saveAllLog(logDtos));
} }
} }
...@@ -84,13 +84,15 @@ public enum StatusEnum { ...@@ -84,13 +84,15 @@ public enum StatusEnum {
SEND_BACK_1211(1211, "市发清退任务待省审核"), SEND_BACK_1211(1211, "市发清退任务待省审核"),
SEND_BACK_1212(1212, "清退统计任务待办结"), SEND_BACK_1212(1212, "清退统计任务待办结"),
SEND_BACK_1213(1213,"省直属清退任务待上传单据"), SEND_BACK_1213(1213,"省直属清退任务待上传单据"),
SEND_BACK_1214(1214,"清退出库等待上传回执单"),
LOSS1300(1300,"丢失装备等待审核"), LOSS1300(1300,"丢失装备等待审核"),
RETRIEVE(1400,"装备找回等待审核"), RETRIEVE1400(1400,"装备找回等待审核"),
// SEND_BACK_1204(1204, "入库待审核"), // SEND_BACK_1204(1204, "入库待审核"),
......
package com.tykj.dev.misc.utils; package com.tykj.dev.misc.utils;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.stream.Collectors;
/** /**
* @author dengdiyi * @author dengdiyi
...@@ -82,4 +84,21 @@ public class StringSplitUtil { ...@@ -82,4 +84,21 @@ public class StringSplitUtil {
} }
return list; return list;
} }
public static String ListToString(List<Integer> idList){
StringBuffer stringBuffer=new StringBuffer();
idList.forEach(
i->stringBuffer.append(",").append(i)
);
return stringBuffer.toString();
}
public static List<Integer> stringToList(String idStirng){
if (idStirng!=null) {
List<String> idStringList = Arrays.asList(idStirng.split(","));
return idStringList.stream().filter(list2 -> !list2.equals("")).map(Integer::parseInt).collect(Collectors.toList());
}else {
return new ArrayList<>();
}
}
} }
...@@ -10,6 +10,8 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -10,6 +10,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.List;
/** /**
* @author zjm * @author zjm
* @version 1.0.0 * @version 1.0.0
...@@ -163,4 +165,15 @@ public class RepelDevController { ...@@ -163,4 +165,15 @@ public class RepelDevController {
return ResponseEntity.ok("省直属单位任务提交成功"); return ResponseEntity.ok("省直属单位任务提交成功");
} }
/**
* 清退装备任务等待上传回执单
*/
@ApiOperation(value = "清退装备任务等待上传回执单", notes = "上传回执单 也可以不上传回执单")
@GetMapping(value ="/receipts")
public ResponseEntity receipts( @RequestBody StorageDeviceRepel storageDeviceRepel){
repelBusinessService.receipts(storageDeviceRepel);
return ResponseEntity.ok("上传回执单成功");
}
} }
...@@ -90,6 +90,16 @@ public class RepelQueryController { ...@@ -90,6 +90,16 @@ public class RepelQueryController {
return ResponseEntity.ok(repelQueryService.clearedList(repelManagementVo)); return ResponseEntity.ok(repelQueryService.clearedList(repelManagementVo));
} }
/**
* 已退役
*/
@PostMapping(value ="/retiredList")
@ApiOperation(value = "已退役列表", notes = "已退役列表接口")
public ResponseEntity retiredList(@RequestBody RepelManagementVo repelManagementVo){
return ResponseEntity.ok(repelQueryService.retiredList(repelManagementVo));
}
// /** // /**
// * 省直属任务装备查询接口 // * 省直属任务装备查询接口
// */ // */
......
...@@ -26,5 +26,9 @@ public class StorageDeviceRepel { ...@@ -26,5 +26,9 @@ public class StorageDeviceRepel {
private List<Integer> deviceIds; private List<Integer> deviceIds;
private List<FileRet> outFiles;
private Integer userId; private Integer userId;
private Integer taskId;
} }
package com.tykj.dev.device.sendback.service; package com.tykj.dev.device.sendback.service;
import com.tykj.dev.device.file.entity.FileRet;
import com.tykj.dev.device.sendback.entity.domain.DeviceRepel; import com.tykj.dev.device.sendback.entity.domain.DeviceRepel;
import com.tykj.dev.device.sendback.entity.domain.DeviceRepelDetail; import com.tykj.dev.device.sendback.entity.domain.DeviceRepelDetail;
import com.tykj.dev.device.sendback.entity.vo.OrderOutData; import com.tykj.dev.device.sendback.entity.vo.OrderOutData;
...@@ -7,6 +8,8 @@ import com.tykj.dev.device.sendback.entity.vo.RepelAuditResult; ...@@ -7,6 +8,8 @@ import com.tykj.dev.device.sendback.entity.vo.RepelAuditResult;
import com.tykj.dev.device.sendback.entity.vo.ResolveConfirm; import com.tykj.dev.device.sendback.entity.vo.ResolveConfirm;
import com.tykj.dev.device.sendback.entity.vo.StorageDeviceRepel; import com.tykj.dev.device.sendback.entity.vo.StorageDeviceRepel;
import java.util.List;
public interface RepelBusinessService { public interface RepelBusinessService {
/** /**
...@@ -104,4 +107,11 @@ public interface RepelBusinessService { ...@@ -104,4 +107,11 @@ public interface RepelBusinessService {
* @param storageDeviceRepel 单据 和装备id对象 * @param storageDeviceRepel 单据 和装备id对象
*/ */
void receiptSingle(Integer taskId, StorageDeviceRepel storageDeviceRepel); void receiptSingle(Integer taskId, StorageDeviceRepel storageDeviceRepel);
/**
* 出库等待上传回执单
*/
void receipts(StorageDeviceRepel storageDeviceRepel);
} }
...@@ -56,6 +56,11 @@ public interface RepelQueryService { ...@@ -56,6 +56,11 @@ public interface RepelQueryService {
*/ */
List<ModelNameGroup> clearedList(RepelManagementVo repelManagementVo); List<ModelNameGroup> clearedList(RepelManagementVo repelManagementVo);
/**
* 退役装备列表
*/
List<ModelNameGroup> retiredList(RepelManagementVo repelManagementVo);
/** /**
*省直属任务装备查询接口 (无用) *省直属任务装备查询接口 (无用)
*/ */
......
...@@ -68,13 +68,11 @@ public class DeviceRepelDetailServiceImpl implements DeviceRepelDetailService { ...@@ -68,13 +68,11 @@ public class DeviceRepelDetailServiceImpl implements DeviceRepelDetailService {
@Override @Override
public List<DeviceLibrary> findYearAndUnitToDeviceList(Date time,Date endTime,Integer unitId) { public List<DeviceLibrary> findYearAndUnitToDeviceList(Date time,Date endTime,Integer unitId) {
List<DeviceLibrary> libraries=new ArrayList<>(); Set<DeviceLibrary> libraries=new HashSet<>();
deviceRepelDetailDao.findAllBySendTimeBetweenAndSendUnitIdAndRepelStatus(time,endTime,unitId,2).forEach( deviceRepelDetailDao.findAllBySendTimeBetweenAndSendUnitIdAndRepelStatus(time,endTime,unitId,2).forEach(
deviceRepelDetail -> { deviceRepelDetail -> libraries.addAll(findInvoleDevice(deviceRepelDetail.getDeviceIds()))
libraries.addAll(findInvoleDevice(deviceRepelDetail.getDeviceIds()));
}
); );
return libraries; return new ArrayList<>(libraries);
} }
......
...@@ -2,6 +2,7 @@ package com.tykj.dev.device.sendback.service.impl; ...@@ -2,6 +2,7 @@ package com.tykj.dev.device.sendback.service.impl;
import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.core.type.TypeReference;
import com.tykj.dev.config.GlobalMap; import com.tykj.dev.config.GlobalMap;
import com.tykj.dev.device.file.entity.FileRet;
import com.tykj.dev.device.file.service.FilesUtil; import com.tykj.dev.device.file.service.FilesUtil;
import com.tykj.dev.device.library.repository.DeviceLibraryDao; import com.tykj.dev.device.library.repository.DeviceLibraryDao;
import com.tykj.dev.device.library.service.DeviceLogService; import com.tykj.dev.device.library.service.DeviceLogService;
...@@ -26,6 +27,7 @@ import com.tykj.dev.device.user.subject.service.GroupService; ...@@ -26,6 +27,7 @@ import com.tykj.dev.device.user.subject.service.GroupService;
import com.tykj.dev.device.user.subject.service.UnitsService; import com.tykj.dev.device.user.subject.service.UnitsService;
import com.tykj.dev.device.user.subject.service.UserService; import com.tykj.dev.device.user.subject.service.UserService;
import com.tykj.dev.misc.base.BusinessEnum; import com.tykj.dev.misc.base.BusinessEnum;
import com.tykj.dev.misc.base.DeviceLifeStatus;
import com.tykj.dev.misc.base.StatusEnum; import com.tykj.dev.misc.base.StatusEnum;
import com.tykj.dev.misc.utils.JacksonUtil; import com.tykj.dev.misc.utils.JacksonUtil;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
...@@ -414,9 +416,12 @@ public class RepelBusinessServiceImpl implements RepelBusinessService { ...@@ -414,9 +416,12 @@ public class RepelBusinessServiceImpl implements RepelBusinessService {
orderOutDataRepelDetail.setRightSignatureId(UUID.randomUUID().toString()); orderOutDataRepelDetail.setRightSignatureId(UUID.randomUUID().toString());
orderOutDataRepelDetail.setNum("NO:第"+ LocalDateTime.now().getYear()+"QT"+deviceRepelDetail.getId()); orderOutDataRepelDetail.setNum("NO:第"+ LocalDateTime.now().getYear()+"QT"+deviceRepelDetail.getId());
deviceRepelDetailService.saveDeviceRepelDetail(orderOutDataRepelDetail); deviceRepelDetailService.saveDeviceRepelDetail(orderOutDataRepelDetail);
deviceLibraryDao.upDateLeftStatusAndOwnUnitName(15,orderOutData.getReceiveUnit(),StringUtils.stringToList(orderOutDataRepelDetail.getDeviceIds())); deviceLibraryDao.upDateLeftStatusAndOwnUnitName(DeviceLifeStatus.REPEL.id,orderOutData.getReceiveUnit(),StringUtils.stringToList(orderOutDataRepelDetail.getDeviceIds()));
taskBto.setOwnUnit(orderOutData.getReceiveUnitId()); taskBto.setOwnUnit(orderOutData.getReceiveUnitId());
taskService.moveToSpecial(taskBto,StatusEnum.SEND_BACK_1209,0); taskService.moveToSpecial(taskBto,StatusEnum.SEND_BACK_1209,0);
waitingReceiptsTask(orderOutData.getSendUnitId(),deviceRepelDetail.getId(),taskBto.getParentTaskId(),"清退装备出库等待上传回执单");
devLogAdd(findInvoleDevice(deviceRepelDetail.getDeviceIds()),deviceRepelDetail.getSendUnit()+"装备清退出库"+",等待"+deviceRepelDetail.getReceiveUnit()+"接收",userId); devLogAdd(findInvoleDevice(deviceRepelDetail.getDeviceIds()),deviceRepelDetail.getSendUnit()+"装备清退出库"+",等待"+deviceRepelDetail.getReceiveUnit()+"接收",userId);
orderOutDataRepelDetail.setDeviceLibraryEntities(findInvoleDevice(deviceRepelDetail.getDeviceIds())); orderOutDataRepelDetail.setDeviceLibraryEntities(findInvoleDevice(deviceRepelDetail.getDeviceIds()));
//把一些字段填写到对象中,保存入库 //把一些字段填写到对象中,保存入库
...@@ -437,9 +442,9 @@ public class RepelBusinessServiceImpl implements RepelBusinessService { ...@@ -437,9 +442,9 @@ public class RepelBusinessServiceImpl implements RepelBusinessService {
//否则为待清退 //否则为待清退
Integer inStock; Integer inStock;
if (unitsService.findById(deviceRepelDetail.getReceiveUnitId()).getLevel()==2){ if (unitsService.findById(deviceRepelDetail.getReceiveUnitId()).getLevel()==2){
inStock=2; inStock=DeviceLifeStatus.IN_LIBRARY.id;
}else { }else {
inStock=15; inStock=DeviceLifeStatus.REPEL.id;
} }
List<DeviceLibrary> libraries= findInvoleDevice(deviceRepelDetail.getDeviceIds()); List<DeviceLibrary> libraries= findInvoleDevice(deviceRepelDetail.getDeviceIds());
libraries.forEach( libraries.forEach(
...@@ -487,7 +492,7 @@ public class RepelBusinessServiceImpl implements RepelBusinessService { ...@@ -487,7 +492,7 @@ public class RepelBusinessServiceImpl implements RepelBusinessService {
); );
log.info("更新数据装备以及所属单位-{}",libraries.size()); log.info("更新数据装备以及所属单位-{}",libraries.size());
long time=System.currentTimeMillis(); long time=System.currentTimeMillis();
deviceLibraryDao.upDateLeftStatusAndUnitName(15,units.getName(),libraries.stream().map(DeviceLibrary::getId).collect(Collectors.toList())); deviceLibraryDao.upDateLeftStatusAndUnitName(DeviceLifeStatus.REPEL.id,units.getName(),libraries.stream().map(DeviceLibrary::getId).collect(Collectors.toList()));
log.info("更新数据装备以及所属单位{}",System.currentTimeMillis()-time); log.info("更新数据装备以及所属单位{}",System.currentTimeMillis()-time);
// deviceRepelDetail.setDeviceIds(ids.toString()); // deviceRepelDetail.setDeviceIds(ids.toString());
...@@ -552,7 +557,7 @@ public class RepelBusinessServiceImpl implements RepelBusinessService { ...@@ -552,7 +557,7 @@ public class RepelBusinessServiceImpl implements RepelBusinessService {
); );
log.info("更新数据装备以及所属单位-{}",libraries.size()); log.info("更新数据装备以及所属单位-{}",libraries.size());
long time=System.currentTimeMillis(); long time=System.currentTimeMillis();
deviceLibraryDao.upDateLeftStatusAndUnitName(2,deviceRepelDetail.getReceiveUnit(),StringUtils.stringToList(deviceRepelDetail.getDeviceIds())); deviceLibraryDao.upDateLeftStatus(DeviceLifeStatus.RETIRE.id,StringUtils.stringToList(deviceRepelDetail.getDeviceIds()));
log.info("更新数据装备以及所属单位{}",System.currentTimeMillis()-time); log.info("更新数据装备以及所属单位{}",System.currentTimeMillis()-time);
// deviceLibraryDao.saveAll(libraries); // deviceLibraryDao.saveAll(libraries);
...@@ -565,6 +570,15 @@ public class RepelBusinessServiceImpl implements RepelBusinessService { ...@@ -565,6 +570,15 @@ public class RepelBusinessServiceImpl implements RepelBusinessService {
deviceRepelDetailService.saveDeviceRepelDetail(deviceRepelDetail); deviceRepelDetailService.saveDeviceRepelDetail(deviceRepelDetail);
} }
@Override
public void receipts(StorageDeviceRepel storageDeviceRepel) {
TaskBto taskBto = taskService.get(storageDeviceRepel.getTaskId());
taskService.moveToEnd(taskBto);
DeviceRepelDetail deviceRepelDetail=deviceRepelDetailService.findDeviceRepelDetail(taskBto.getBillId());
deviceRepelDetail.setOutboundFile(FilesUtil.stringFileToList(storageDeviceRepel.getOutFiles()));
deviceRepelDetailService.saveDeviceRepelDetail(deviceRepelDetail);
}
/** /**
* 生成区清退任务 * 生成区清退任务
...@@ -643,6 +657,21 @@ public class RepelBusinessServiceImpl implements RepelBusinessService { ...@@ -643,6 +657,21 @@ public class RepelBusinessServiceImpl implements RepelBusinessService {
return taskService.start(new TaskBto(StatusEnum.SEND_BACK_1201.id, title, parentTaskId, ".", repelDetailId, BusinessEnum.SEND_BACK.id, unitId, 0, "", list)); return taskService.start(new TaskBto(StatusEnum.SEND_BACK_1201.id, title, parentTaskId, ".", repelDetailId, BusinessEnum.SEND_BACK.id, unitId, 0, "", list));
} }
/**
* 清退出库等待上传回执单
* @param unitId
* @param repelDetailId
* @param parentTaskId
* @return
*/
private TaskBto waitingReceiptsTask(Integer unitId, Integer repelDetailId, Integer parentTaskId,String title){
List<Integer> list=new ArrayList<>();
list.add(0);
return taskService.start(new TaskBto(StatusEnum.SEND_BACK_1214.id, title, parentTaskId, ".", repelDetailId, BusinessEnum.SEND_BACK.id, unitId, 0, "", list));
}
/** /**
* 省直属单位任务 省自己完成 16 * 省直属单位任务 省自己完成 16
* @param unitId 执行单位 * @param unitId 执行单位
......
...@@ -12,6 +12,7 @@ import com.tykj.dev.device.task.service.TaskService; ...@@ -12,6 +12,7 @@ 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.user.subject.entity.Units; import com.tykj.dev.device.user.subject.entity.Units;
import com.tykj.dev.device.user.subject.service.UnitsService; import com.tykj.dev.device.user.subject.service.UnitsService;
import com.tykj.dev.misc.base.DeviceLifeStatus;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -145,6 +146,14 @@ public class RepelQueryServiceImpl implements RepelQueryService { ...@@ -145,6 +146,14 @@ public class RepelQueryServiceImpl implements RepelQueryService {
return toModelNameGroup(repelDetailService.findYearAndUnitToDeviceList(new Date(repelManagementVo.getTime()),new Date(repelManagementVo.getEndTime()),repelManagementVo.getUnitId())); return toModelNameGroup(repelDetailService.findYearAndUnitToDeviceList(new Date(repelManagementVo.getTime()),new Date(repelManagementVo.getEndTime()),repelManagementVo.getUnitId()));
} }
@Override
public List<ModelNameGroup> retiredList(RepelManagementVo repelManagementVo) {
Units units= unitsService.findById(repelManagementVo.getUnitId());
return toModelNameGroup(deviceLibraryDao.findAllByOwnUnitAndLocationUnitAndLifeStatus(units.getName(),units.getName(),DeviceLifeStatus.RETIRE.id).stream().filter(deviceLibrary -> deviceLibrary.getUpdateTime().getTime()>=repelManagementVo.getTime()&&deviceLibrary.getUpdateTime().getTime()<=repelManagementVo.getEndTime()).collect(Collectors.toList()));
}
@Override @Override
public List<DeviceLibrary> provinceDirectlyUnderDev(Integer taskId) { public List<DeviceLibrary> provinceDirectlyUnderDev(Integer taskId) {
TaskBto taskBto= taskService.get(taskId); TaskBto taskBto= taskService.get(taskId);
......
package com.tykj.dev.device.train.entity; package com.tykj.dev.device.train.entity;
import com.tykj.dev.device.file.entity.FileRet;
import com.tykj.dev.device.train.entity.vo.WorkHandoverVo; import com.tykj.dev.device.train.entity.vo.WorkHandoverVo;
import com.tykj.dev.device.user.subject.entity.User;
import com.tykj.dev.misc.base.BeanHelper; import com.tykj.dev.misc.base.BeanHelper;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
...@@ -11,6 +13,7 @@ import org.springframework.data.annotation.CreatedDate; ...@@ -11,6 +13,7 @@ import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate; import org.springframework.data.annotation.LastModifiedDate;
import javax.persistence.*; import javax.persistence.*;
import java.util.List;
/** /**
* @author zjm * @author zjm
...@@ -33,30 +36,24 @@ public class WorkHandover { ...@@ -33,30 +36,24 @@ public class WorkHandover {
@Column(columnDefinition = "integer NOT NULL AUTO_INCREMENT") @Column(columnDefinition = "integer NOT NULL AUTO_INCREMENT")
private Integer workHandoverId; private Integer workHandoverId;
/** /**
* 交接人 * 交接人
*/ */
private Integer handoverUserAId; private String handoverUserIds;
/**
* 交接人b
*/
private Integer handoverUserBId;
/** /**
* 移交人a * 移交人a
*/ */
private Integer turnOverUserAId; private String turnOverUserIds;
/**
* 移交人b
*/
private Integer turnOverUserBId;
/** /**
* 监交人 * 监交人
*/ */
private String inUserName; private String inUserName;
/** /**
* 代办业务 json * 代办业务 json
*/ */
...@@ -70,12 +67,12 @@ public class WorkHandover { ...@@ -70,12 +67,12 @@ public class WorkHandover {
/** /**
* 文件集合(装备列表签字文件集合) * 文件集合(装备列表签字文件集合)
*/ */
private String fileLists; private String file;
/** /**
* 状态 1.新建 2.完成 * 状态 1.新建 2.完成
*/ */
private Integer status; private Integer status=1;
/** /**
* 创建时间 * 创建时间
...@@ -92,10 +89,21 @@ public class WorkHandover { ...@@ -92,10 +89,21 @@ public class WorkHandover {
@ApiModelProperty(value = "区块链RID",name = "recordId") @ApiModelProperty(value = "区块链RID",name = "recordId")
private String recordId; private String recordId;
public WorkHandoverVo toWorkHandover() { /**
ModelMapper mapper = BeanHelper.getUserMapper(); * 发起用户集合
WorkHandoverVo workHandoverVo = mapper.map(this, WorkHandoverVo.class); */
@Transient
private List<User> handoverUserList;
return workHandoverVo; /**
} * 接收用户集合
*/
@Transient
private List<User> turnOverUserList;
/**
* 接收用户集合
*/
@Transient
private List<FileRet> fileRets;
} }
...@@ -7,6 +7,8 @@ import lombok.Data; ...@@ -7,6 +7,8 @@ import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import org.modelmapper.ModelMapper; import org.modelmapper.ModelMapper;
import java.util.List;
/** /**
* @author zjm * @author zjm
* @version 1.0.0 * @version 1.0.0
...@@ -19,25 +21,10 @@ import org.modelmapper.ModelMapper; ...@@ -19,25 +21,10 @@ import org.modelmapper.ModelMapper;
@NoArgsConstructor @NoArgsConstructor
public class WorkHandoverAddVo { public class WorkHandoverAddVo {
/**
* 交接人
*/
private Integer handoverUserAId;
/**
* 交接人b
*/
private Integer handoverUserBId;
/** /**
* 移交人a * 移交人a
*/ */
private Integer turnOverUserAId; private List<Integer> turnOverUserAId;
/**
* 移交人b
*/
private Integer turnOverUserBId;
public WorkHandover toWorkHandover() { public WorkHandover toWorkHandover() {
......
...@@ -28,6 +28,6 @@ public interface WorkHandoverService { ...@@ -28,6 +28,6 @@ public interface WorkHandoverService {
/** /**
* 查询工作交接详情 * 查询工作交接详情
*/ */
WorkHandoverVo findById(Integer workHandoverId); WorkHandover findById(Integer workHandoverId);
} }
...@@ -2,6 +2,7 @@ package com.tykj.dev.device.train.service.impl; ...@@ -2,6 +2,7 @@ package com.tykj.dev.device.train.service.impl;
import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.core.type.TypeReference;
import com.tykj.dev.device.file.entity.FileRet; import com.tykj.dev.device.file.entity.FileRet;
import com.tykj.dev.device.file.service.FilesUtil;
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.vo.TaskUserVo; import com.tykj.dev.device.task.subject.vo.TaskUserVo;
...@@ -13,11 +14,14 @@ import com.tykj.dev.device.train.entity.vo.WorkHandoverVo; ...@@ -13,11 +14,14 @@ import com.tykj.dev.device.train.entity.vo.WorkHandoverVo;
import com.tykj.dev.device.train.service.TrainTaskService; import com.tykj.dev.device.train.service.TrainTaskService;
import com.tykj.dev.device.train.service.WorkHandoverService; import com.tykj.dev.device.train.service.WorkHandoverService;
import com.tykj.dev.device.user.subject.entity.SecurityUser; import com.tykj.dev.device.user.subject.entity.SecurityUser;
import com.tykj.dev.device.user.subject.entity.User;
import com.tykj.dev.device.user.subject.service.UnitsService;
import com.tykj.dev.device.user.subject.service.UserService; import com.tykj.dev.device.user.subject.service.UserService;
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.JacksonUtil; import com.tykj.dev.misc.utils.JacksonUtil;
import com.tykj.dev.misc.utils.StringSplitUtil;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.checkerframework.checker.units.qual.A; import org.checkerframework.checker.units.qual.A;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -27,6 +31,8 @@ import org.springframework.stereotype.Service; ...@@ -27,6 +31,8 @@ import org.springframework.stereotype.Service;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Optional; import java.util.Optional;
import java.util.stream.Collector;
import java.util.stream.Collectors;
/** /**
* @author zjm * @author zjm
...@@ -50,15 +56,26 @@ public class WorkHandoverServiceImpl implements WorkHandoverService { ...@@ -50,15 +56,26 @@ public class WorkHandoverServiceImpl implements WorkHandoverService {
@Autowired @Autowired
UserService userService; UserService userService;
@Autowired
UnitsService unitsService;
@Override @Override
public WorkHandover createWorkHandover(WorkHandoverAddVo workHandoverAddVo, SecurityUser securityUser) { public WorkHandover createWorkHandover(WorkHandoverAddVo workHandoverAddVo, SecurityUser securityUser) {
log.info("[workHandover] 新建工作交接"); log.info("[workHandover] 新建工作交接");
// WorkHandover
List<User> users= userService.findAllByUnite(securityUser.getCurrentUserInfo().getUnitsId());
List<Integer> handoverIds= users.stream().map(User::getUserId).collect(Collectors.toList());
WorkHandover workHandover=new WorkHandover();
workHandover.setStatus(1);
workHandover.setTurnOverUserIds(StringSplitUtil.ListToString(workHandoverAddVo.getTurnOverUserAId()));
workHandover.setHandoverUserIds(StringSplitUtil.ListToString(handoverIds));
//创建workHandoverDB 存储数据库 //创建workHandoverDB 存储数据库
WorkHandover workHandover = workHandoverDao.save(workHandoverAddVo.toWorkHandover()); workHandover = workHandoverDao.save(workHandover);
List<Integer> integers = new ArrayList<>(); List<Integer> integers = new ArrayList<>();
integers.add(securityUser.getCurrentUserInfo().getUserId()); integers.add(securityUser.getCurrentUserInfo().getUserId());
taskService.start(new TaskBto(StatusEnum.WORKHANDOVER1011.id, "工作交接", null, null, workHandover.getWorkHandoverId(), BusinessEnum.WORK_HANDOVER.id, securityUser.getCurrentUserInfo().getUnitsId(), 0, null, integers)); taskService.start(new TaskBto(StatusEnum.WORKHANDOVER1011.id, "工作交接", null, null, workHandover.getWorkHandoverId(), BusinessEnum.WORK_HANDOVER.id, securityUser.getCurrentUserInfo().getUnitsId(), 0, null, integers));
workHandover.setTurnOverUserList(userService.findAllUserIdInUser(workHandoverAddVo.getTurnOverUserAId()));
workHandover.setHandoverUserList(userService.findAllUserIdInUser(handoverIds));
return workHandover; return workHandover;
} }
...@@ -74,10 +91,10 @@ public class WorkHandoverServiceImpl implements WorkHandoverService { ...@@ -74,10 +91,10 @@ public class WorkHandoverServiceImpl implements WorkHandoverService {
throw new ApiException(ResponseEntity.status(500).body("未找到id为" + workHandoverEndAddVo.getWorkHandoverId() + " 工作交接业务")); throw new ApiException(ResponseEntity.status(500).body("未找到id为" + workHandoverEndAddVo.getWorkHandoverId() + " 工作交接业务"));
} }
workHandover.setStatus(2); workHandover.setStatus(2);
workHandover.setFileLists(JacksonUtil.toJSon(workHandoverEndAddVo.getFileLists())); workHandover.setFile(JacksonUtil.toJSon(workHandoverEndAddVo.getFileLists()));
workHandover = workHandoverDao.save(workHandover); workHandover = workHandoverDao.save(workHandover);
//把移交人的所有代办任务和跟踪任务替换名称,换成交接人 //把移交人的所有代办任务和跟踪任务替换名称,换成交接人
taskService.workHandover(workHandover.getHandoverUserAId(), workHandover.getTurnOverUserAId()); // taskService.workHandover(workHandover.getHandoverUserAId(), workHandover.getTurnOverUserAId());
//推入完结状态 //推入完结状态
TaskBto taskBto = trainTaskService.selectFatherIsNullAndBillidAndBillType(workHandover.getWorkHandoverId(), BusinessEnum.WORK_HANDOVER.id); TaskBto taskBto = trainTaskService.selectFatherIsNullAndBillidAndBillType(workHandover.getWorkHandoverId(), BusinessEnum.WORK_HANDOVER.id);
taskService.moveToEnd(taskBto); taskService.moveToEnd(taskBto);
...@@ -87,24 +104,14 @@ public class WorkHandoverServiceImpl implements WorkHandoverService { ...@@ -87,24 +104,14 @@ public class WorkHandoverServiceImpl implements WorkHandoverService {
} }
@Override @Override
public WorkHandoverVo findById(Integer workHandoverId) { public WorkHandover findById(Integer workHandoverId) {
Optional<WorkHandover> optionalWorkHandover = workHandoverDao.findById(workHandoverId); Optional<WorkHandover> optionalWorkHandover = workHandoverDao.findById(workHandoverId);
if (optionalWorkHandover.isPresent()) { if (optionalWorkHandover.isPresent()) {
WorkHandover workHandover = optionalWorkHandover.get(); WorkHandover workHandover = optionalWorkHandover.get();
WorkHandoverVo workHandoverVo = workHandover.toWorkHandover(); workHandover.setHandoverUserList(userService.findAllUserIdInUser(StringSplitUtil.stringToList(workHandover.getHandoverUserIds())));
if (workHandover.getFileLists()!=null) { workHandover.setTurnOverUserList(userService.findAllUserIdInUser(StringSplitUtil.stringToList(workHandover.getTurnOverUserIds())));
workHandoverVo.setFileLists(JacksonUtil.readValue(workHandover.getFileLists(), new TypeReference<List<FileRet>>() { workHandover.setFileRets(FilesUtil.stringFileToList(workHandover.getFile()));
})); return workHandover;
}
if (workHandover.getCommissionWord()!=null) {
workHandoverVo.setCommissionWord(JacksonUtil.readValue(workHandover.getCommissionWord(), new TypeReference<List<TaskUserVo>>() {
}));
}
if (workHandover.getTrackingWord()!=null) {
workHandoverVo.setTrackingWord(JacksonUtil.readValue(workHandover.getTrackingWord(), new TypeReference<List<TaskUserVo>>() {
}));
}
return workHandoverVo;
} else { } else {
throw new ApiException(ResponseEntity.status(500).body("没有这个id:" + workHandoverId)); throw new ApiException(ResponseEntity.status(500).body("没有这个id:" + workHandoverId));
} }
......
package com.tykj.dev.train; //package com.tykj.dev.train;
//
import com.github.wenhao.jpa.Specifications; //import com.github.wenhao.jpa.Specifications;
import com.tykj.dev.device.task.repository.TaskDao; //import com.tykj.dev.device.task.repository.TaskDao;
import com.tykj.dev.device.task.subject.domin.Task; //import com.tykj.dev.device.task.subject.domin.Task;
import com.tykj.dev.device.train.entity.vo.WorkHandoverAddVo; //import com.tykj.dev.device.train.entity.vo.WorkHandoverAddVo;
import com.tykj.dev.device.train.entity.vo.WorkHandoverVo; //import com.tykj.dev.device.train.entity.vo.WorkHandoverVo;
import com.tykj.dev.device.train.service.WorkHandoverService; //import com.tykj.dev.device.train.service.WorkHandoverService;
import com.tykj.dev.device.user.subject.service.UserService; //import com.tykj.dev.device.user.subject.service.UserService;
import com.tykj.dev.misc.base.StatusEnum; //import com.tykj.dev.misc.base.StatusEnum;
import com.tykj.dev.union.BaseTest; //import com.tykj.dev.union.BaseTest;
import lombok.extern.slf4j.Slf4j; //import lombok.extern.slf4j.Slf4j;
import org.junit.jupiter.api.Test; //import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired; //import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType; //import org.springframework.http.MediaType;
import org.springframework.security.test.context.support.WithMockUser; //import org.springframework.security.test.context.support.WithMockUser;
import org.springframework.test.context.ActiveProfiles; //import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.web.servlet.MockMvc; //import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.RequestBuilder; //import org.springframework.test.web.servlet.RequestBuilder;
//
import static com.tykj.dev.misc.utils.JacksonUtil.toJSon; //import static com.tykj.dev.misc.utils.JacksonUtil.toJSon;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; //import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; //import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
//
/** ///**
* DeviceCheckControllerTest. // * DeviceCheckControllerTest.
* // *
* @author Matrix <xhyrzldf@gmail.com> // * @author Matrix <xhyrzldf@gmail.com>
* @since 2020/9/15 at 11:17 上午 // * @since 2020/9/15 at 11:17 上午
*/ // */
@SuppressWarnings("ALL") //@SuppressWarnings("ALL")
@WithMockUser(username = "shena", password = "qwer1234", authorities = "省A专管员") //@WithMockUser(username = "shena", password = "qwer1234", authorities = "省A专管员")
@ActiveProfiles("dev") //@ActiveProfiles("dev")
@Slf4j //@Slf4j
class WorkHandoverTest extends BaseTest { //class WorkHandoverTest extends BaseTest {
//
@Autowired // @Autowired
protected MockMvc mockMvc; // protected MockMvc mockMvc;
@Autowired // @Autowired
WorkHandoverService workHandoverService; // WorkHandoverService workHandoverService;
@Autowired // @Autowired
UserService userService; // UserService userService;
@Autowired // @Autowired
private TaskDao taskRepo; // private TaskDao taskRepo;
//
private String url = "/user/handover/"; // private String url = "/user/handover/";
//
@Test // @Test
void startManualCheck() throws Exception { // void startManualCheck() throws Exception {
//
WorkHandoverAddVo workHandoverAddVo = new WorkHandoverAddVo(); // WorkHandoverAddVo workHandoverAddVo = new WorkHandoverAddVo();
//交接人 // //交接人
workHandoverAddVo.setHandoverUserId(9); //// workHandoverAddVo.setHandoverUserId(9);
//移交人 //// //移交人
workHandoverAddVo.setTurnOverUserId(10); //// workHandoverAddVo.setTurnOverUserId(10);
//监交人 //// //监交人
workHandoverAddVo.setInUserName("省a专管员"); //// workHandoverAddVo.setInUserName("省a专管员");
//
// 测试 // // 测试
RequestBuilder request; // RequestBuilder request;
//
request = post(url + "create") // request = post(url + "create")
.header("Origin", "*") // .header("Origin", "*")
.contentType(MediaType.APPLICATION_JSON) // .contentType(MediaType.APPLICATION_JSON)
.content(toJSon(workHandoverAddVo)); // .content(toJSon(workHandoverAddVo));
//
mockMvc.perform(request) // mockMvc.perform(request)
.andExpect(status().isOk()) // .andExpect(status().isOk())
.andDo(mvcResult1 -> System.out.println("[测试结果] 工作交接任务测试通过")); // .andDo(mvcResult1 -> System.out.println("[测试结果] 工作交接任务测试通过"));
//
//
// A 接口 // // A 接口
Task initTask = taskRepo.findAll(Specifications.<Task>and() // Task initTask = taskRepo.findAll(Specifications.<Task>and()
.eq("billStatus", StatusEnum.WORKHANDOVER1011.id) // .eq("billStatus", StatusEnum.WORKHANDOVER1011.id)
.build()) // .build())
.get(0); // .get(0);
Integer workBillId = initTask.getBillId(); // Integer workBillId = initTask.getBillId();
WorkHandoverVo workHandover = workHandoverService.findById(workBillId); // WorkHandoverVo workHandover = workHandoverService.findById(workBillId);
if (workHandover != null) { // if (workHandover != null) {
log.info("[workHandover] 新建工作交接业务完成"); // log.info("[workHandover] 新建工作交接业务完成");
} else { // } else {
log.info("[workHandover] 新建工作交接业务不通过"); // log.info("[workHandover] 新建工作交接业务不通过");
} // }
//
} // }
} //}
\ No newline at end of file \ No newline at end of file
...@@ -34,7 +34,10 @@ ...@@ -34,7 +34,10 @@
<groupId>com.tykj.dev</groupId> <groupId>com.tykj.dev</groupId>
<artifactId>socket</artifactId> <artifactId>socket</artifactId>
</dependency> </dependency>
<dependency>
<groupId>com.tykj.dev</groupId>
<artifactId>blockcha</artifactId>
</dependency>
</dependencies> </dependencies>
</project> </project>
\ No newline at end of file
...@@ -19,6 +19,11 @@ public interface UnitsService extends PublicService<Units> { ...@@ -19,6 +19,11 @@ public interface UnitsService extends PublicService<Units> {
Units findbyName(String name); Units findbyName(String name);
/**
* 根据区域id查询区域下的单位
*/
Units findUnitAreaId(Integer areaId);
/** /**
* 下级全部单位 * 下级全部单位
* @param leven 等级 * @param leven 等级
...@@ -75,7 +80,7 @@ public interface UnitsService extends PublicService<Units> { ...@@ -75,7 +80,7 @@ public interface UnitsService extends PublicService<Units> {
List<Integer> findSuperiorByunitsId(Integer unitsId); List<Integer> findSuperiorByunitsId(Integer unitsId);
/** /**
* 根据区域id查询上级对象 * 根据单位查询上级对象
* *
* @param unitsId 区域id * @param unitsId 区域id
* @return 单位对象 * @return 单位对象
......
...@@ -48,6 +48,11 @@ public class UnitsServiceImpl implements UnitsService { ...@@ -48,6 +48,11 @@ public class UnitsServiceImpl implements UnitsService {
return unitsDao.findByName(name); return unitsDao.findByName(name);
} }
@Override
public Units findUnitAreaId(Integer areaId) {
return unitsDao.findByAreaId(areaId).get(0);
}
@Override @Override
public List<Units> findListById(Integer leven) { public List<Units> findListById(Integer leven) {
return unitsDao.findAllByLevel(leven); return unitsDao.findAllByLevel(leven);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论