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

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

上级 84c5d132
......@@ -187,9 +187,22 @@ public enum LogType {
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_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_25(100015,SEND_BACK.id, SEND_BACK_1200.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_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, "工作交接任务生成完成,等待上传交接单"),
......
......@@ -2,6 +2,7 @@ package com.tykj.dev.device.loss.controller;
import com.tykj.dev.config.swagger.AutoDocument;
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.entity.domain.DeviceLoss;
import io.swagger.annotations.Api;
......@@ -38,4 +39,18 @@ public class DeviceLossController {
lossBillService.superiorAuditLoss(lossAuditvo);
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;
import com.tykj.dev.device.file.entity.FileRet;
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.misc.base.BaseEntity;
import io.swagger.annotations.ApiModelProperty;
......@@ -98,8 +99,8 @@ public class DeviceLoss extends BaseEntity {
/**
* 找回业务状态
*/
@ApiModelProperty(value = "找回业务状态")
private Integer backStatus;
@ApiModelProperty(value = "找回业务状态 1.等待审核 2.审核通过 3.审核失败")
private Integer backStatus=1;
/**
* 单据集合
......@@ -115,37 +116,43 @@ public class DeviceLoss extends BaseEntity {
@Transient
private List<Integer> devIdsList;
public String getDevIds() {
return devIds;
}
public void setDevIds() {
this.devIds = StringUtils.ListToString(devIdsList);
}
public String getLossFile() {
return lossFile;
}
public void setLossFile() {
this.lossFile = FilesUtil.stringFileToList(fileRetList);
}
public List<FileRet> getFileRetList() {
return FilesUtil.stringFileToList(lossFile);
}
public void setFileRetList(List<FileRet> fileRetList) {
this.fileRetList = fileRetList;
}
public List<Integer> getDevIdsList() {
return StringUtils.stringToList(devIds);
}
public void setDevIdsList(List<Integer> devIdsList) {
this.devIdsList = devIdsList;
}
/**
* 装备集合
*/
@ApiModelProperty(value = "装备集合")
@Transient
private List<DeviceLossVo> deviceLossVoList;
// public String getDevIds() {
// return devIds;
// }
//
// public void setDevIds() {
// this.devIds = StringUtils.ListToString(devIdsList);
// }
//
// public String getLossFile() {
// return lossFile;
// }
//
// public void setLossFile() {
// this.lossFile = FilesUtil.stringFileToList(fileRetList);
// }
//
// public List<FileRet> getFileRetList() {
// return FilesUtil.stringFileToList(lossFile);
// }
//
// public void setFileRetList(List<FileRet> fileRetList) {
// this.fileRetList = fileRetList;
// }
//
// 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 {
* 用户单位名称
*/
@ApiModelProperty(value = "用户单位名称")
private Integer unitName;
private String unitName;
/**
* 备注
*/
......
......@@ -38,7 +38,7 @@ public class RetrieveAuditvo {
* 用户单位名称
*/
@ApiModelProperty(value = "用户单位名称")
private Integer unitName;
private String unitName;
/**
* 备注
*/
......
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.vo.DeviceLossVo;
import com.tykj.dev.device.loss.service.DeviceLossService;
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.subject.bto.TaskBto;
import com.tykj.dev.misc.base.BeanHelper;
import org.modelmapper.ModelMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.stream.Collectors;
/**
* @author zjm
* @version 1.0.0
......@@ -21,9 +30,20 @@ public class LossBillSelectServiceImpl implements LossBillSelectService {
TaskService taskService;
@Autowired
DeviceLossService deviceLossService;
@Autowired
DeviceLibraryDao deviceLibraryDao;
@Override
public DeviceLoss findDeviceLoss(Integer 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;
import com.tykj.dev.device.file.service.FilesUtil;
import com.tykj.dev.device.library.repository.DeviceLibraryDao;
import com.tykj.dev.device.library.service.DeviceLogService;
import com.tykj.dev.device.library.subject.Dto.DeviceLogDto;
......@@ -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.service.DeviceLossService;
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.subject.bto.TaskBto;
import com.tykj.dev.device.user.subject.entity.Area;
......@@ -52,19 +54,22 @@ public class LossBillServiceImpl implements LossBillService {
@Autowired
DeviceLogService deviceLogService;
@Override
public void initiateLoss(DeviceLoss deviceLoss) {
deviceLoss.setDevIds(StringUtils.ListToString(deviceLoss.getDevIdsList()));
deviceLoss.setLossFile(FilesUtil.stringFileToList(deviceLoss.getFileRetList()));
DeviceLoss deviceLossThis= deviceLossService.save(deviceLoss);
Units units=unitsService.findById(deviceLoss.getUnitId());
Area area=areaService.findByid(units.getAreaId());
if (units.getLevel() == 1) {
end(deviceLossThis.getCreateUserId(), deviceLossThis.getId(), units.getName() + "丢失装备任务", units.getUnitId());
} else {
Units parentUnits=unitsService.findByAreaId(area.getFatherId());
Units parentUnits=unitsService.findUnitAreaId(area.getFatherId());
newLossTask(parentUnits.getUnitId(), deviceLossThis.getId(), units.getName() + "丢失装备任务");
}
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 {
deviceLoss.setProvinceDes(lossAuditvo.getDes());
taskService.moveToEnd(taskBto);
}else {
Units parentUnits=unitsService.findByAreaId(area.getFatherId());
Units parentUnits=unitsService.findUnitAreaId(area.getFatherId());
deviceLoss.setCityUnitName(units.getName());
deviceLoss.setCityDes(lossAuditvo.getDes());
taskBto.setOwnUnit(parentUnits.getUnitId());
......@@ -92,35 +97,65 @@ public class LossBillServiceImpl implements LossBillService {
@Override
public void initiateRetrieve(DeviceLoss deviceLoss) {
deviceLoss.setDevIds(StringUtils.ListToString(deviceLoss.getDevIdsList()));
deviceLoss.setLossFile(FilesUtil.stringFileToList(deviceLoss.getFileRetList()));
DeviceLoss deviceLossThis= deviceLossService.save(deviceLoss);
Units units=unitsService.findById(deviceLoss.getUnitId());
Area area=areaService.findByid(units.getAreaId());
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());
} else {
Units parentUnits=unitsService.findByAreaId(area.getFatherId());
newRetrieveTask(parentUnits.getUnitId(), deviceLossThis.getId(), units.getName() + "丢失装备任务");
Units parentUnits=unitsService.findUnitAreaId(area.getFatherId());
newRetrieveTask(parentUnits.getUnitId(), deviceLossThis.getId(), units.getName() + "找回装备任务");
}
devLogAdd(deviceLoss.getDevIdsList(), deviceLoss.getCreateUserId());
devLogAdd(deviceLoss.getDevIdsList(),"装备找回上报", deviceLoss.getCreateUserId());
}
@Override
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){
List<Integer> list=new ArrayList<>();
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){
List<Integer> list=new ArrayList<>();
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 {
private void end(Integer userId, Integer lossId, String title, Integer unitId){
List<Integer> list=new ArrayList<>();
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<>();
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));
}
}
......@@ -84,13 +84,15 @@ public enum StatusEnum {
SEND_BACK_1211(1211, "市发清退任务待省审核"),
SEND_BACK_1212(1212, "清退统计任务待办结"),
SEND_BACK_1213(1213,"省直属清退任务待上传单据"),
SEND_BACK_1214(1214,"清退出库等待上传回执单"),
LOSS1300(1300,"丢失装备等待审核"),
RETRIEVE(1400,"装备找回等待审核"),
RETRIEVE1400(1400,"装备找回等待审核"),
// SEND_BACK_1204(1204, "入库待审核"),
......
package com.tykj.dev.misc.utils;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
/**
* @author dengdiyi
......@@ -82,4 +84,21 @@ public class StringSplitUtil {
}
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;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* @author zjm
* @version 1.0.0
......@@ -163,4 +165,15 @@ public class RepelDevController {
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 {
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 {
private List<Integer> deviceIds;
private List<FileRet> outFiles;
private Integer userId;
private Integer taskId;
}
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.DeviceRepelDetail;
import com.tykj.dev.device.sendback.entity.vo.OrderOutData;
......@@ -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.StorageDeviceRepel;
import java.util.List;
public interface RepelBusinessService {
/**
......@@ -104,4 +107,11 @@ public interface RepelBusinessService {
* @param storageDeviceRepel 单据 和装备id对象
*/
void receiptSingle(Integer taskId, StorageDeviceRepel storageDeviceRepel);
/**
* 出库等待上传回执单
*/
void receipts(StorageDeviceRepel storageDeviceRepel);
}
......@@ -56,6 +56,11 @@ public interface RepelQueryService {
*/
List<ModelNameGroup> clearedList(RepelManagementVo repelManagementVo);
/**
* 退役装备列表
*/
List<ModelNameGroup> retiredList(RepelManagementVo repelManagementVo);
/**
*省直属任务装备查询接口 (无用)
*/
......
......@@ -68,13 +68,11 @@ public class DeviceRepelDetailServiceImpl implements DeviceRepelDetailService {
@Override
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(
deviceRepelDetail -> {
libraries.addAll(findInvoleDevice(deviceRepelDetail.getDeviceIds()));
}
deviceRepelDetail -> libraries.addAll(findInvoleDevice(deviceRepelDetail.getDeviceIds()))
);
return libraries;
return new ArrayList<>(libraries);
}
......
......@@ -2,6 +2,7 @@ package com.tykj.dev.device.sendback.service.impl;
import com.fasterxml.jackson.core.type.TypeReference;
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.library.repository.DeviceLibraryDao;
import com.tykj.dev.device.library.service.DeviceLogService;
......@@ -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.UserService;
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.utils.JacksonUtil;
import lombok.extern.slf4j.Slf4j;
......@@ -414,13 +416,16 @@ public class RepelBusinessServiceImpl implements RepelBusinessService {
orderOutDataRepelDetail.setRightSignatureId(UUID.randomUUID().toString());
orderOutDataRepelDetail.setNum("NO:第"+ LocalDateTime.now().getYear()+"QT"+deviceRepelDetail.getId());
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());
taskService.moveToSpecial(taskBto,StatusEnum.SEND_BACK_1209,0);
waitingReceiptsTask(orderOutData.getSendUnitId(),deviceRepelDetail.getId(),taskBto.getParentTaskId(),"清退装备出库等待上传回执单");
devLogAdd(findInvoleDevice(deviceRepelDetail.getDeviceIds()),deviceRepelDetail.getSendUnit()+"装备清退出库"+",等待"+deviceRepelDetail.getReceiveUnit()+"接收",userId);
orderOutDataRepelDetail.setDeviceLibraryEntities(findInvoleDevice(deviceRepelDetail.getDeviceIds()));
//把一些字段填写到对象中,保存入库
//把任务状态修改为 清退提交装备待接收
//把任务状态修改为 清退提交装备待接收
return orderOutDataRepelDetail;
}
......@@ -437,9 +442,9 @@ public class RepelBusinessServiceImpl implements RepelBusinessService {
//否则为待清退
Integer inStock;
if (unitsService.findById(deviceRepelDetail.getReceiveUnitId()).getLevel()==2){
inStock=2;
inStock=DeviceLifeStatus.IN_LIBRARY.id;
}else {
inStock=15;
inStock=DeviceLifeStatus.REPEL.id;
}
List<DeviceLibrary> libraries= findInvoleDevice(deviceRepelDetail.getDeviceIds());
libraries.forEach(
......@@ -487,7 +492,7 @@ public class RepelBusinessServiceImpl implements RepelBusinessService {
);
log.info("更新数据装备以及所属单位-{}",libraries.size());
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);
// deviceRepelDetail.setDeviceIds(ids.toString());
......@@ -552,7 +557,7 @@ public class RepelBusinessServiceImpl implements RepelBusinessService {
);
log.info("更新数据装备以及所属单位-{}",libraries.size());
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);
// deviceLibraryDao.saveAll(libraries);
......@@ -565,6 +570,15 @@ public class RepelBusinessServiceImpl implements RepelBusinessService {
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 {
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
* @param unitId 执行单位
......
......@@ -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.user.subject.entity.Units;
import com.tykj.dev.device.user.subject.service.UnitsService;
import com.tykj.dev.misc.base.DeviceLifeStatus;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -145,6 +146,14 @@ public class RepelQueryServiceImpl implements RepelQueryService {
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
public List<DeviceLibrary> provinceDirectlyUnderDev(Integer taskId) {
TaskBto taskBto= taskService.get(taskId);
......
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.user.subject.entity.User;
import com.tykj.dev.misc.base.BeanHelper;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
......@@ -11,6 +13,7 @@ import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;
import javax.persistence.*;
import java.util.List;
/**
* @author zjm
......@@ -33,30 +36,24 @@ public class WorkHandover {
@Column(columnDefinition = "integer NOT NULL AUTO_INCREMENT")
private Integer workHandoverId;
/**
* 交接人
*/
private Integer handoverUserAId;
private String handoverUserIds;
/**
* 交接人b
*/
private Integer handoverUserBId;
/**
* 移交人a
*/
private Integer turnOverUserAId;
/**
* 移交人b
*/
private Integer turnOverUserBId;
private String turnOverUserIds;
/**
* 监交人
*/
private String inUserName;
/**
* 代办业务 json
*/
......@@ -70,12 +67,12 @@ public class WorkHandover {
/**
* 文件集合(装备列表签字文件集合)
*/
private String fileLists;
private String file;
/**
* 状态 1.新建 2.完成
*/
private Integer status;
private Integer status=1;
/**
* 创建时间
......@@ -92,10 +89,21 @@ public class WorkHandover {
@ApiModelProperty(value = "区块链RID",name = "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;
import lombok.NoArgsConstructor;
import org.modelmapper.ModelMapper;
import java.util.List;
/**
* @author zjm
* @version 1.0.0
......@@ -19,25 +21,10 @@ import org.modelmapper.ModelMapper;
@NoArgsConstructor
public class WorkHandoverAddVo {
/**
* 交接人
*/
private Integer handoverUserAId;
/**
* 交接人b
*/
private Integer handoverUserBId;
/**
* 移交人a
*/
private Integer turnOverUserAId;
/**
* 移交人b
*/
private Integer turnOverUserBId;
private List<Integer> turnOverUserAId;
public WorkHandover toWorkHandover() {
......
......@@ -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;
import com.fasterxml.jackson.core.type.TypeReference;
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.subject.bto.TaskBto;
import com.tykj.dev.device.task.subject.vo.TaskUserVo;
......@@ -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.WorkHandoverService;
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.misc.base.BusinessEnum;
import com.tykj.dev.misc.base.StatusEnum;
import com.tykj.dev.misc.exception.ApiException;
import com.tykj.dev.misc.utils.JacksonUtil;
import com.tykj.dev.misc.utils.StringSplitUtil;
import lombok.extern.slf4j.Slf4j;
import org.checkerframework.checker.units.qual.A;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -27,6 +31,8 @@ import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collector;
import java.util.stream.Collectors;
/**
* @author zjm
......@@ -50,15 +56,26 @@ public class WorkHandoverServiceImpl implements WorkHandoverService {
@Autowired
UserService userService;
@Autowired
UnitsService unitsService;
@Override
public WorkHandover createWorkHandover(WorkHandoverAddVo workHandoverAddVo, SecurityUser securityUser) {
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 存储数据库
WorkHandover workHandover = workHandoverDao.save(workHandoverAddVo.toWorkHandover());
workHandover = workHandoverDao.save(workHandover);
List<Integer> integers = new ArrayList<>();
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));
workHandover.setTurnOverUserList(userService.findAllUserIdInUser(workHandoverAddVo.getTurnOverUserAId()));
workHandover.setHandoverUserList(userService.findAllUserIdInUser(handoverIds));
return workHandover;
}
......@@ -74,10 +91,10 @@ public class WorkHandoverServiceImpl implements WorkHandoverService {
throw new ApiException(ResponseEntity.status(500).body("未找到id为" + workHandoverEndAddVo.getWorkHandoverId() + " 工作交接业务"));
}
workHandover.setStatus(2);
workHandover.setFileLists(JacksonUtil.toJSon(workHandoverEndAddVo.getFileLists()));
workHandover.setFile(JacksonUtil.toJSon(workHandoverEndAddVo.getFileLists()));
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);
taskService.moveToEnd(taskBto);
......@@ -87,24 +104,14 @@ public class WorkHandoverServiceImpl implements WorkHandoverService {
}
@Override
public WorkHandoverVo findById(Integer workHandoverId) {
public WorkHandover findById(Integer workHandoverId) {
Optional<WorkHandover> optionalWorkHandover = workHandoverDao.findById(workHandoverId);
if (optionalWorkHandover.isPresent()) {
WorkHandover workHandover = optionalWorkHandover.get();
WorkHandoverVo workHandoverVo = workHandover.toWorkHandover();
if (workHandover.getFileLists()!=null) {
workHandoverVo.setFileLists(JacksonUtil.readValue(workHandover.getFileLists(), new TypeReference<List<FileRet>>() {
}));
}
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;
workHandover.setHandoverUserList(userService.findAllUserIdInUser(StringSplitUtil.stringToList(workHandover.getHandoverUserIds())));
workHandover.setTurnOverUserList(userService.findAllUserIdInUser(StringSplitUtil.stringToList(workHandover.getTurnOverUserIds())));
workHandover.setFileRets(FilesUtil.stringFileToList(workHandover.getFile()));
return workHandover;
} else {
throw new ApiException(ResponseEntity.status(500).body("没有这个id:" + workHandoverId));
}
......
package com.tykj.dev.repair;
import com.alibaba.fastjson.JSONObject;
import com.github.wenhao.jpa.Specifications;
import com.tykj.dev.device.repair.repository.RepairDetailDao;
import com.tykj.dev.device.repair.subject.vo.DeviceDetailVo;
import com.tykj.dev.device.repair.subject.vo.RepairBillSaveVo;
import com.tykj.dev.device.repair.subject.vo.RepairConfirmVo;
import com.tykj.dev.device.repair.subject.vo.RepairReceiveVo;
import com.tykj.dev.device.task.repository.TaskDao;
import com.tykj.dev.device.task.subject.domin.Task;
import com.tykj.dev.device.user.util.UserUtils;
import com.tykj.dev.misc.base.ResultObj;
import com.tykj.dev.misc.base.StatusEnum;
import com.tykj.dev.union.BaseTest;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.security.test.context.support.WithMockUser;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.MvcResult;
import org.springframework.test.web.servlet.RequestBuilder;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.stream.Collectors;
import static com.tykj.dev.misc.utils.JacksonUtil.toJSon;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
@SuppressWarnings("ALL")
@WithMockUser(username = "shia", password = "qwer1234", authorities = "市A专管员")
@ActiveProfiles("test")
public class RepairControllerTest extends BaseTest {
static int repairSendTaskId;
static int repairBackTaskId;
@Autowired
protected MockMvc mockMvc;
@Autowired
private TaskDao taskDao;
@Autowired
private RepairDetailDao repairDetailDao;
@Autowired
private UserUtils userUtils;
/**
* 发起维修运输过程单元测试
*/
@Test
public void createRepairTest() throws Exception {
Integer level = userUtils.getCurrentUnitLevel();
RepairBillSaveVo repairBillSaveVo = new RepairBillSaveVo();
repairBillSaveVo.setStartUseraId(3);
repairBillSaveVo.setStartUserbId(4);
repairBillSaveVo.setApplyNumber("qweqwe");
repairBillSaveVo.setAgent("sadad");
repairBillSaveVo.setReceiveUnit("省机要局");
List<DeviceDetailVo> ids = new ArrayList<>();
//package com.tykj.dev.repair;
//
//import com.alibaba.fastjson.JSONObject;
//import com.github.wenhao.jpa.Specifications;
//import com.tykj.dev.device.repair.repository.RepairDetailDao;
//import com.tykj.dev.device.repair.subject.vo.DeviceDetailVo;
//import com.tykj.dev.device.repair.subject.vo.RepairBillSaveVo;
//import com.tykj.dev.device.repair.subject.vo.RepairConfirmVo;
//import com.tykj.dev.device.repair.subject.vo.RepairReceiveVo;
//import com.tykj.dev.device.task.repository.TaskDao;
//import com.tykj.dev.device.task.subject.domin.Task;
//import com.tykj.dev.device.user.util.UserUtils;
//import com.tykj.dev.misc.base.ResultObj;
//import com.tykj.dev.misc.base.StatusEnum;
//import com.tykj.dev.union.BaseTest;
//import org.junit.Test;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.http.MediaType;
//import org.springframework.security.test.context.support.WithMockUser;
//import org.springframework.test.context.ActiveProfiles;
//import org.springframework.test.web.servlet.MockMvc;
//import org.springframework.test.web.servlet.MvcResult;
//import org.springframework.test.web.servlet.RequestBuilder;
//
//import java.util.ArrayList;
//import java.util.Comparator;
//import java.util.List;
//import java.util.stream.Collectors;
//
//import static com.tykj.dev.misc.utils.JacksonUtil.toJSon;
//import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
//import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
//import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
//
//@SuppressWarnings("ALL")
//@WithMockUser(username = "shia", password = "qwer1234", authorities = "市A专管员")
//@ActiveProfiles("test")
//public class RepairControllerTest extends BaseTest {
//
// static int repairSendTaskId;
// static int repairBackTaskId;
// @Autowired
// protected MockMvc mockMvc;
// @Autowired
// private TaskDao taskDao;
// @Autowired
// private RepairDetailDao repairDetailDao;
// @Autowired
// private UserUtils userUtils;
//
// /**
// * 发起维修运输过程单元测试
// */
// @Test
// public void createRepairTest() throws Exception {
// Integer level = userUtils.getCurrentUnitLevel();
// RepairBillSaveVo repairBillSaveVo = new RepairBillSaveVo();
// repairBillSaveVo.setStartUseraId(3);
// repairBillSaveVo.setStartUserbId(4);
// repairBillSaveVo.setApplyNumber("qweqwe");
// repairBillSaveVo.setAgent("sadad");
// repairBillSaveVo.setReceiveUnit("省机要局");
// List<DeviceDetailVo> ids = new ArrayList<>();
// ids.add(new DeviceDetailVo(21, "aaa"));
// ids.add(new DeviceDetailVo(26, "asdasd"));
repairBillSaveVo.setDeviceList(ids);
repairBillSaveVo.setFileName("aaaa");
repairBillSaveVo.setFileUrl("sdfhks");
repairBillSaveVo.setRepairDeviceCheckDetail("x211x261x");
repairBillSaveVo.setRepairDeviceCheckResult("0x0");
repairBillSaveVo.setReplayNumber("adjskhsd");
repairBillSaveVo.setSendedCount(2);
repairBillSaveVo.setSendingCount(2);
repairBillSaveVo.setSendUnit("市机要局");
// 测试
RequestBuilder request;
request = post("/repair/form")
.header("Origin", "*")
.contentType(MediaType.APPLICATION_JSON)
.content(toJSon(repairBillSaveVo));
mockMvc.perform(request)
.andExpect(status().isOk())
.andDo(mvcResult1 -> System.out.println("[测试结果] 发起维修任务测试通过"));
Task initTask = taskDao.findAll(Specifications.<Task>and()
.eq("billStatus", StatusEnum.REPAIR_SEND_CONFIRM.id)
.build()).stream()
.sorted(Comparator.comparing(Task::getCreateTime).reversed())
.collect(Collectors.toList())
.get(0);
repairSendTaskId = initTask.getId();
//审核通过
RepairConfirmVo repairConfirmVo = new RepairConfirmVo();
repairConfirmVo.setStatus(0);
repairConfirmVo.setTaskId(initTask.getId());
request = post("/repair/sendConfirm")
.header("Origin", "*")
.contentType(MediaType.APPLICATION_JSON)
.content(toJSon(repairConfirmVo));
mockMvc.perform(request)
.andExpect(status().isOk())
.andDo(mvcResult1 -> System.out.println("[测试结果] 对任务id=" + initTask.getId() + "的任务发起维修审核成功,维修单id为" + initTask.getBillId()));
//如果是省向国家发起的
if (level == 1) {
System.out.println("等待国家维修装备退回");
} else {
//接收维修装备
RepairReceiveVo repairReceiveVo = new RepairReceiveVo();
repairReceiveVo.setBillFileName("adfaf");
repairReceiveVo.setBillFileUrl("asdas");
repairReceiveVo.setReceiveCheckDetail("x211x261x");
repairReceiveVo.setReceiveCount(2);
repairReceiveVo.setReceiveCheckResult("0x0");
repairReceiveVo.setReceiveUserbId(2);
repairReceiveVo.setTaskId(initTask.getId());
request = post("/repair/receive")
.header("Origin", "*")
.contentType(MediaType.APPLICATION_JSON)
.content(toJSon(repairReceiveVo));
mockMvc.perform(request)
.andExpect(status().isOk())
.andDo(mvcResult1 -> System.out.println("[测试结果] 维修装备接收成功"));
//接收维修装备审核通过
repairConfirmVo.setStatus(0);
repairConfirmVo.setTaskId(initTask.getId());
request = post("/repair/receiveConfirm")
.header("Origin", "*")
.contentType(MediaType.APPLICATION_JSON)
.content(toJSon(repairConfirmVo));
mockMvc.perform(request)
.andExpect(status().isOk())
.andDo(mvcResult1 -> System.out.println("[测试结果] 接收维修装备审核成功"));
}
}
/**
* 维修退回过程单元测试
*/
@Test
public void sendBackRepairDevice() throws Exception {
Integer level = userUtils.getCurrentUnitLevel();
RequestBuilder request;
if (level == 2 || level == 3) {
request = get("/repair/backDeviceSelect/" + repairSendTaskId)
.header("Origin", "*")
.contentType(MediaType.APPLICATION_JSON);
MvcResult result = mockMvc.perform(request)
.andExpect(status().isOk())
.andDo(mvcResult1 -> System.out.println("[测试结果] 维修退回装备出库查询成功"))
.andReturn();
String body = result.getResponse().getContentAsString();
ResultObj resultObj = JSONObject.parseObject(body, ResultObj.class);
System.out.println("返回值:" + resultObj.getData());
}
}
}
// repairBillSaveVo.setDeviceList(ids);
// repairBillSaveVo.setFileName("aaaa");
// repairBillSaveVo.setFileUrl("sdfhks");
// repairBillSaveVo.setRepairDeviceCheckDetail("x211x261x");
// repairBillSaveVo.setRepairDeviceCheckResult("0x0");
// repairBillSaveVo.setReplayNumber("adjskhsd");
// repairBillSaveVo.setSendedCount(2);
// repairBillSaveVo.setSendingCount(2);
// repairBillSaveVo.setSendUnit("市机要局");
// // 测试
// RequestBuilder request;
//
// request = post("/repair/form")
// .header("Origin", "*")
// .contentType(MediaType.APPLICATION_JSON)
// .content(toJSon(repairBillSaveVo));
//
// mockMvc.perform(request)
// .andExpect(status().isOk())
// .andDo(mvcResult1 -> System.out.println("[测试结果] 发起维修任务测试通过"));
//
// Task initTask = taskDao.findAll(Specifications.<Task>and()
// .eq("billStatus", StatusEnum.REPAIR_SEND_CONFIRM.id)
// .build()).stream()
// .sorted(Comparator.comparing(Task::getCreateTime).reversed())
// .collect(Collectors.toList())
// .get(0);
// repairSendTaskId = initTask.getId();
// //审核通过
// RepairConfirmVo repairConfirmVo = new RepairConfirmVo();
// repairConfirmVo.setStatus(0);
// repairConfirmVo.setTaskId(initTask.getId());
// request = post("/repair/sendConfirm")
// .header("Origin", "*")
// .contentType(MediaType.APPLICATION_JSON)
// .content(toJSon(repairConfirmVo));
//
// mockMvc.perform(request)
// .andExpect(status().isOk())
// .andDo(mvcResult1 -> System.out.println("[测试结果] 对任务id=" + initTask.getId() + "的任务发起维修审核成功,维修单id为" + initTask.getBillId()));
// //如果是省向国家发起的
// if (level == 1) {
// System.out.println("等待国家维修装备退回");
// } else {
// //接收维修装备
// RepairReceiveVo repairReceiveVo = new RepairReceiveVo();
// repairReceiveVo.setBillFileName("adfaf");
// repairReceiveVo.setBillFileUrl("asdas");
// repairReceiveVo.setReceiveCheckDetail("x211x261x");
// repairReceiveVo.setReceiveCount(2);
// repairReceiveVo.setReceiveCheckResult("0x0");
// repairReceiveVo.setReceiveUserbId(2);
// repairReceiveVo.setTaskId(initTask.getId());
//
// request = post("/repair/receive")
// .header("Origin", "*")
// .contentType(MediaType.APPLICATION_JSON)
// .content(toJSon(repairReceiveVo));
//
// mockMvc.perform(request)
// .andExpect(status().isOk())
// .andDo(mvcResult1 -> System.out.println("[测试结果] 维修装备接收成功"));
//
// //接收维修装备审核通过
// repairConfirmVo.setStatus(0);
// repairConfirmVo.setTaskId(initTask.getId());
// request = post("/repair/receiveConfirm")
// .header("Origin", "*")
// .contentType(MediaType.APPLICATION_JSON)
// .content(toJSon(repairConfirmVo));
//
// mockMvc.perform(request)
// .andExpect(status().isOk())
// .andDo(mvcResult1 -> System.out.println("[测试结果] 接收维修装备审核成功"));
// }
// }
//
// /**
// * 维修退回过程单元测试
// */
// @Test
// public void sendBackRepairDevice() throws Exception {
// Integer level = userUtils.getCurrentUnitLevel();
// RequestBuilder request;
// if (level == 2 || level == 3) {
// request = get("/repair/backDeviceSelect/" + repairSendTaskId)
// .header("Origin", "*")
// .contentType(MediaType.APPLICATION_JSON);
// MvcResult result = mockMvc.perform(request)
// .andExpect(status().isOk())
// .andDo(mvcResult1 -> System.out.println("[测试结果] 维修退回装备出库查询成功"))
// .andReturn();
// String body = result.getResponse().getContentAsString();
// ResultObj resultObj = JSONObject.parseObject(body, ResultObj.class);
// System.out.println("返回值:" + resultObj.getData());
// }
// }
//}
package com.tykj.dev.train;
import com.github.wenhao.jpa.Specifications;
import com.tykj.dev.device.task.repository.TaskDao;
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.WorkHandoverVo;
import com.tykj.dev.device.train.service.WorkHandoverService;
import com.tykj.dev.device.user.subject.service.UserService;
import com.tykj.dev.misc.base.StatusEnum;
import com.tykj.dev.union.BaseTest;
import lombok.extern.slf4j.Slf4j;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.security.test.context.support.WithMockUser;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.RequestBuilder;
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.result.MockMvcResultMatchers.status;
/**
* DeviceCheckControllerTest.
*
* @author Matrix <xhyrzldf@gmail.com>
* @since 2020/9/15 at 11:17 上午
*/
@SuppressWarnings("ALL")
@WithMockUser(username = "shena", password = "qwer1234", authorities = "省A专管员")
@ActiveProfiles("dev")
@Slf4j
class WorkHandoverTest extends BaseTest {
@Autowired
protected MockMvc mockMvc;
@Autowired
WorkHandoverService workHandoverService;
@Autowired
UserService userService;
@Autowired
private TaskDao taskRepo;
private String url = "/user/handover/";
@Test
void startManualCheck() throws Exception {
WorkHandoverAddVo workHandoverAddVo = new WorkHandoverAddVo();
//交接人
workHandoverAddVo.setHandoverUserId(9);
//移交人
workHandoverAddVo.setTurnOverUserId(10);
//监交人
workHandoverAddVo.setInUserName("省a专管员");
// 测试
RequestBuilder request;
request = post(url + "create")
.header("Origin", "*")
.contentType(MediaType.APPLICATION_JSON)
.content(toJSon(workHandoverAddVo));
mockMvc.perform(request)
.andExpect(status().isOk())
.andDo(mvcResult1 -> System.out.println("[测试结果] 工作交接任务测试通过"));
// A 接口
Task initTask = taskRepo.findAll(Specifications.<Task>and()
.eq("billStatus", StatusEnum.WORKHANDOVER1011.id)
.build())
.get(0);
Integer workBillId = initTask.getBillId();
WorkHandoverVo workHandover = workHandoverService.findById(workBillId);
if (workHandover != null) {
log.info("[workHandover] 新建工作交接业务完成");
} else {
log.info("[workHandover] 新建工作交接业务不通过");
}
}
}
\ No newline at end of file
//package com.tykj.dev.train;
//
//import com.github.wenhao.jpa.Specifications;
//import com.tykj.dev.device.task.repository.TaskDao;
//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.WorkHandoverVo;
//import com.tykj.dev.device.train.service.WorkHandoverService;
//import com.tykj.dev.device.user.subject.service.UserService;
//import com.tykj.dev.misc.base.StatusEnum;
//import com.tykj.dev.union.BaseTest;
//import lombok.extern.slf4j.Slf4j;
//import org.junit.jupiter.api.Test;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.http.MediaType;
//import org.springframework.security.test.context.support.WithMockUser;
//import org.springframework.test.context.ActiveProfiles;
//import org.springframework.test.web.servlet.MockMvc;
//import org.springframework.test.web.servlet.RequestBuilder;
//
//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.result.MockMvcResultMatchers.status;
//
///**
// * DeviceCheckControllerTest.
// *
// * @author Matrix <xhyrzldf@gmail.com>
// * @since 2020/9/15 at 11:17 上午
// */
//@SuppressWarnings("ALL")
//@WithMockUser(username = "shena", password = "qwer1234", authorities = "省A专管员")
//@ActiveProfiles("dev")
//@Slf4j
//class WorkHandoverTest extends BaseTest {
//
// @Autowired
// protected MockMvc mockMvc;
// @Autowired
// WorkHandoverService workHandoverService;
// @Autowired
// UserService userService;
// @Autowired
// private TaskDao taskRepo;
//
// private String url = "/user/handover/";
//
// @Test
// void startManualCheck() throws Exception {
//
// WorkHandoverAddVo workHandoverAddVo = new WorkHandoverAddVo();
// //交接人
//// workHandoverAddVo.setHandoverUserId(9);
//// //移交人
//// workHandoverAddVo.setTurnOverUserId(10);
//// //监交人
//// workHandoverAddVo.setInUserName("省a专管员");
//
// // 测试
// RequestBuilder request;
//
// request = post(url + "create")
// .header("Origin", "*")
// .contentType(MediaType.APPLICATION_JSON)
// .content(toJSon(workHandoverAddVo));
//
// mockMvc.perform(request)
// .andExpect(status().isOk())
// .andDo(mvcResult1 -> System.out.println("[测试结果] 工作交接任务测试通过"));
//
//
// // A 接口
// Task initTask = taskRepo.findAll(Specifications.<Task>and()
// .eq("billStatus", StatusEnum.WORKHANDOVER1011.id)
// .build())
// .get(0);
// Integer workBillId = initTask.getBillId();
// WorkHandoverVo workHandover = workHandoverService.findById(workBillId);
// if (workHandover != null) {
// log.info("[workHandover] 新建工作交接业务完成");
// } else {
// log.info("[workHandover] 新建工作交接业务不通过");
// }
//
// }
//}
\ No newline at end of file
......@@ -34,7 +34,10 @@
<groupId>com.tykj.dev</groupId>
<artifactId>socket</artifactId>
</dependency>
<dependency>
<groupId>com.tykj.dev</groupId>
<artifactId>blockcha</artifactId>
</dependency>
</dependencies>
</project>
\ No newline at end of file
......@@ -19,6 +19,11 @@ public interface UnitsService extends PublicService<Units> {
Units findbyName(String name);
/**
* 根据区域id查询区域下的单位
*/
Units findUnitAreaId(Integer areaId);
/**
* 下级全部单位
* @param leven 等级
......@@ -75,7 +80,7 @@ public interface UnitsService extends PublicService<Units> {
List<Integer> findSuperiorByunitsId(Integer unitsId);
/**
* 根据区域id查询上级对象
* 根据单位查询上级对象
*
* @param unitsId 区域id
* @return 单位对象
......
......@@ -48,6 +48,11 @@ public class UnitsServiceImpl implements UnitsService {
return unitsDao.findByName(name);
}
@Override
public Units findUnitAreaId(Integer areaId) {
return unitsDao.findByAreaId(areaId).get(0);
}
@Override
public List<Units> findListById(Integer leven) {
return unitsDao.findAllByLevel(leven);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论