提交 50f3ecce authored 作者: 133's avatar 133

[销毁 清退] 代码修改 添加单据装备字段

上级 c3c64513
package com.tykj.dev.device.destroy.controller;
import com.fasterxml.jackson.core.type.TypeReference;
import com.tykj.dev.config.swagger.AutoDocument;
import com.tykj.dev.device.destroy.entity.domain.DeviceDestroyBill;
import com.tykj.dev.device.destroy.entity.enums.DestroyStatus;
......@@ -12,6 +13,7 @@ import com.tykj.dev.device.library.subject.Dto.DeviceLogDto;
import com.tykj.dev.device.library.subject.domin.DeviceLibrary;
import com.tykj.dev.device.library.subject.vo.DeviceLibrarySelectVo;
import com.tykj.dev.device.library.subject.vo.FileVo;
import com.tykj.dev.device.library.subject.vo.ScriptSaveVo;
import com.tykj.dev.device.task.service.TaskLogService;
import com.tykj.dev.device.task.service.TaskService;
import com.tykj.dev.device.task.subject.bto.TaskBto;
......@@ -21,15 +23,13 @@ import com.tykj.dev.device.user.util.AuthenticationUtils;
import com.tykj.dev.device.user.util.UserUtils;
import com.tykj.dev.misc.base.BusinessEnum;
import com.tykj.dev.misc.base.StatusEnum;
import com.tykj.dev.misc.utils.ListUtil;
import com.tykj.dev.misc.utils.ResultUtil;
import com.tykj.dev.misc.utils.StringSplitUtil;
import com.tykj.dev.misc.utils.TaskDisposeUtil;
import com.tykj.dev.misc.utils.*;
import com.tykj.dev.rfid.service.InputOutputDeviceService;
import com.tykj.dev.socket.MyWebSocket;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.ss.formula.functions.T;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
......@@ -98,6 +98,7 @@ public class DeviceDestroyController {
destroyBill.setDestroyStatus(DestroyStatus.CONFIRM_SUCCESS.getStatus());
//设置销毁时间
destroyBill.setDestroyTime(formVo.getDestroyTime());
destroyBill.setScriptJson(JacksonUtil.toJSon(formVo.getScriptSaveVos()));
//保存销毁账单
DeviceDestroyBill deviceDestroyBillEntitySaved = deviceDestroyBillService.addEntity(destroyBill);
//为账单新增文号
......@@ -169,7 +170,10 @@ public class DeviceDestroyController {
StringUtils.join(nameSet, ","),
StringUtils.join(modelSet, ","),
userPublicService.findUnitsNameByUserId(destroyBill.getStartUserAId()),
devices
devices,
JacksonUtil.readValue(destroyBill.getScriptJson(), new TypeReference<List<ScriptSaveVo>>() {
})
);
return ResultUtil.success(destroyDetailResultVo);
}
......
......@@ -2,6 +2,7 @@ package com.tykj.dev.device.destroy.entity.domain;
import com.tykj.dev.device.destroy.entity.enums.DestroyStatus;
import com.tykj.dev.device.destroy.entity.vo.DeviceDestroyFormVo;
import com.tykj.dev.device.library.subject.vo.ScriptSaveVo;
import com.tykj.dev.device.user.subject.entity.User;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
......@@ -17,6 +18,7 @@ import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import javax.persistence.*;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
......@@ -158,6 +160,12 @@ public class DeviceDestroyBill {
@ApiModelProperty(value = "区块链记录id")
private String recordId;
@Column(name = "script_json",columnDefinition = "TEXT")
private String scriptJson;
@Transient
private List<ScriptSaveVo> scripts = new ArrayList<>();
@ApiModelProperty(value = "单号")
@Transient
private String num;
......
package com.tykj.dev.device.destroy.entity.vo;
import com.tykj.dev.device.library.subject.domin.DeviceLibrary;
import com.tykj.dev.device.library.subject.vo.ScriptSaveVo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.persistence.Transient;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
......@@ -68,7 +70,10 @@ public class DeviceDestroyDetailResultVo {
@ApiModelProperty(value = "销毁装备列表", example = "1")
private List<DeviceLibrary> devices = new ArrayList<>();
public DeviceDestroyDetailResultVo(Integer startUserId, Integer confirmUserId, String startUser, String confirmUser, Integer destoryStatus, String fileName, String fileUrl, String docNumber, Date createTime, String undertaker, String leader, String supervisor, String name, String model, String unit, List<DeviceLibrary> devices) {
@ApiModelProperty(value = "装备数据", example = "1")
private List<ScriptSaveVo> scripts = new ArrayList<>();
public DeviceDestroyDetailResultVo(Integer startUserId, Integer confirmUserId, String startUser, String confirmUser, Integer destoryStatus, String fileName, String fileUrl, String docNumber, Date createTime, String undertaker, String leader, String supervisor, String name, String model, String unit, List<DeviceLibrary> devices,List<ScriptSaveVo> scripts) {
this.startUserId = startUserId;
this.confirmUserId = confirmUserId;
this.startUser = startUser;
......@@ -85,5 +90,6 @@ public class DeviceDestroyDetailResultVo {
this.model = model;
this.unit = unit;
this.devices = devices;
this.scripts = scripts;
}
}
package com.tykj.dev.device.destroy.entity.vo;
import com.tykj.dev.device.library.subject.vo.ScriptSaveVo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.persistence.Column;
import javax.persistence.Transient;
import javax.validation.constraints.NotEmpty;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
......@@ -44,4 +48,9 @@ public class DeviceDestroyFormVo {
@ApiModelProperty(value = "销毁时间")
private Date destroyTime;
@ApiModelProperty(value = "销毁单据装备数据")
private List<ScriptSaveVo> scriptSaveVos = new ArrayList<>();
}
......@@ -188,6 +188,16 @@ public class RepelDevController {
return ResponseEntity.ok("签发人选择成功");
}
/**
* 重新入库接口
*/
@ApiOperation(value = "重新入库接口", notes = "重新入库接口")
@PostMapping(value ="/againPutInStorage")
public ResponseEntity againPutInStorage( @RequestBody List<Integer> ids){
repelBusinessService.againPutInStorage(ids);
return ResponseEntity.ok("重新入库成功");
}
/**
* 测试
*/
......
......@@ -172,4 +172,13 @@ public class RepelQueryController {
List<TaskUserVo> taskUserVos = taskService.getManageList(taskSelectVo).stream().filter(taskUserVo -> taskUserVo.getBusinessType()==18||taskUserVo.getBusinessType()==16).collect(Collectors.toList());
return ResultUtil.success(PageUtil.getPerPage(taskSelectVo.getPage(), taskSelectVo.getSize(), taskUtils.orderByTopDesc(taskUserVos), taskSelectVo.getPageable()));
}
/**
* 查询退役中办任务
*/
@ApiOperation(value = "查询退役中办任务")
@GetMapping("/outsideTheProvince")
public ResponseEntity findOutsideTheProvince() {
return ResponseEntity.ok(repelQueryService.findOutsideTheProvince());
}
}
......@@ -3,6 +3,7 @@ package com.tykj.dev.device.sendback.entity.domain;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.tykj.dev.device.file.entity.FileRet;
import com.tykj.dev.device.library.subject.domin.DeviceLibrary;
import com.tykj.dev.device.library.subject.vo.ScriptSaveVo;
import com.tykj.dev.misc.base.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
......@@ -240,6 +241,13 @@ public class DeviceRepelDetail extends BaseEntity {
@Column(name = "send_files",columnDefinition = "TEXT")
private String sendFiles;
@Column(name = "script_json",columnDefinition = "TEXT")
private String scriptJson;
@Transient
private List<ScriptSaveVo> scripts = new ArrayList<>();
@Transient
private List<FileRet> replyFileList = new ArrayList<>();
......@@ -263,4 +271,7 @@ public class DeviceRepelDetail extends BaseEntity {
@ApiModelProperty(value = "清退单对象")
private List<FileRet> outboundFiles ;
}
......@@ -2,6 +2,7 @@ package com.tykj.dev.device.sendback.entity.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.tykj.dev.device.file.entity.FileRet;
import com.tykj.dev.device.library.subject.vo.ScriptSaveVo;
import com.tykj.dev.device.sendback.entity.domain.DeviceRepelDetail;
import com.tykj.dev.misc.base.BeanHelper;
import io.swagger.annotations.ApiModelProperty;
......@@ -176,12 +177,13 @@ public class OrderOutData {
@ApiModelProperty(value = "发件单位签章id")
private String leftSignatureId;
@Transient
private List<FileRet> replyFileList = new ArrayList<>();
@Transient
private List<FileRet> sendFileList = new ArrayList<>();
@ApiModelProperty(value = "单据装备数据信息")
private List<ScriptSaveVo> scriptSaveVos = new ArrayList<>();
public DeviceRepelDetail toTrainDetailsVo() {
ModelMapper mapper = BeanHelper.getUserMapper();
return mapper.map(this, DeviceRepelDetail.class);
......
......@@ -13,4 +13,6 @@ public interface DeviceRepelDetailDao extends JpaRepository<DeviceRepelDetail, I
@Query(value = "select d from DeviceRepelDetail as d where d.sendUnitId= ?1 or d.receiveUnitId = ?1")
List<DeviceRepelDetail> findAllBySendUnitIdOrReceiveUnitId(Integer unitId);
List<DeviceRepelDetail> findAllByReceiveUnitIdIn(List<Integer> ids);
}
......@@ -34,5 +34,8 @@ public interface DeviceRepelDetailService {
*/
List<DeviceLibrary> findYearAndUnitToDeviceList(Date time,Date endTime,Integer unitId);
List<DeviceRepelDetail> findUnitIdSendOrReceive(Integer unitId);
List<DeviceRepelDetail> findIdsReceiptUnits(List<Integer> unitIds);
}
......@@ -8,6 +8,7 @@ import com.tykj.dev.device.sendback.entity.vo.ResolveConfirm;
import com.tykj.dev.device.sendback.entity.vo.StorageDeviceRepel;
import com.tykj.dev.device.user.subject.entity.SecurityUser;
import java.util.List;
public interface RepelBusinessService {
......@@ -117,4 +118,11 @@ public interface RepelBusinessService {
* 添加发件签发人员信息
*/
void addSendBUser(StorageDeviceRepel storageDeviceRepel);
/**
* 装备重新入库 改变装备的生命状态
* @param ids 装备id
*/
void againPutInStorage(List<Integer> ids);
}
......@@ -4,6 +4,7 @@ import com.tykj.dev.device.library.subject.domin.DeviceLibrary;
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.*;
import com.tykj.dev.device.task.subject.bto.TaskBto;
import com.tykj.dev.device.user.subject.entity.SecurityUser;
import java.util.List;
......@@ -90,5 +91,9 @@ public interface RepelQueryService {
*/
List<DeviceRepelDetail> getList(SecurityUser securityUser);
/**
* 查询上级
*/
List<TaskBto> findOutsideTheProvince();
}
......@@ -84,6 +84,11 @@ public class DeviceRepelDetailServiceImpl implements DeviceRepelDetailService {
return deviceRepelDetailDao.findAllBySendUnitIdOrReceiveUnitId(unitId);
}
@Override
public List<DeviceRepelDetail> findIdsReceiptUnits(List<Integer> unitIds) {
return deviceRepelDetailDao.findAllByReceiveUnitIdIn(unitIds);
}
private List<DeviceLibrary> findInvoleDevice(String involeDevice){
if (involeDevice!=null && !involeDevice.equals(",") ) {
......
......@@ -10,6 +10,7 @@ import com.tykj.dev.device.library.service.DeviceLogService;
import com.tykj.dev.device.library.subject.Dto.DeviceLogDto;
import com.tykj.dev.device.library.subject.domin.DeviceLibrary;
import com.tykj.dev.device.library.subject.domin.DeviceLog;
import com.tykj.dev.device.library.subject.vo.LifeStatusVo;
import com.tykj.dev.device.packing.repository.PackingLibraryDao;
import com.tykj.dev.device.sendback.entity.domain.DeviceRepel;
import com.tykj.dev.device.sendback.entity.domain.DeviceRepelDetail;
......@@ -494,8 +495,9 @@ public class RepelBusinessServiceImpl implements RepelBusinessService {
orderOutDataRepelDetail.setNum("NO:第"+ LocalDateTime.now().getYear()+"QT"+taskBto.getBillId());
orderOutDataRepelDetail.setReplyFiles(FilesUtil.stringFileToList(orderOutData.getReplyFileList()));
orderOutDataRepelDetail.setSendFiles(FilesUtil.stringFileToList(orderOutData.getSendFileList()));
deviceRepelDetailService.saveDeviceRepelDetail(orderOutDataRepelDetail);
orderOutDataRepelDetail.setScriptJson(JacksonUtil.toJSon(orderOutData.getScriptSaveVos()));
orderOutDataRepelDetail.setScripts(orderOutData.getScriptSaveVos());
deviceRepelDetailService.saveDeviceRepelDetail(orderOutDataRepelDetail);
deviceLibraryDao.upDateLeftStatusAndOwnUnitName(DeviceLifeStatus.REPEL.id,orderOutData.getReceiveUnit(),StringUtils.stringToList(orderOutDataRepelDetail.getDeviceIds()));
taskBto.setCreateUserId(userId);
taskBto.setOwnUnit(orderOutData.getReceiveUnitId());
......@@ -600,7 +602,6 @@ public class RepelBusinessServiceImpl implements RepelBusinessService {
enumList.add(StatusEnum.SEND_BACK_1203);
TaskDisposeUtil.isNotSubmit(taskBto.getBillStatus(),enumList);
DeviceRepelDetail deviceRepelDetail=deviceRepelDetailService.findDeviceRepelDetail(taskBto.getBillId());
deviceRepelDetail.setBillFile(FilesUtil.stringFileToList(storageDeviceRepel.getFileRets()));
deviceRepelDetail.setRepelStatus(2);
......@@ -676,6 +677,8 @@ public class RepelBusinessServiceImpl implements RepelBusinessService {
deviceRepelDetailService.saveDeviceRepelDetail(deviceRepelDetail);
deviceLibraryDao.upDateLeftStatusAndOwnUnitName(DeviceLifeStatus.REPEL.id,orderOutData.getReceiveUnit(),orderOutData.getDevIds());
deviceRepelDetail.setDeviceLibraryEntities(findInvoleDevice(deviceRepelDetail.getDeviceIds()));
deviceRepelDetail.setScripts(orderOutData.getScriptSaveVos());
deviceRepelDetail.setScriptJson(JacksonUtil.toJSon(orderOutData.getScriptSaveVos()));
TaskBto taskBto= sendOutSuperior(units.getUnitId(),deviceRepelDetail.getId(),null);
addMessage(new MessageBto(taskBto.getId(),taskBto.getBusinessType(),"发起退役任务,待上传回执单据",gainThisUser(user.getUserId(),user.getUnitsId())));
return deviceRepelDetail;
......@@ -745,6 +748,15 @@ public class RepelBusinessServiceImpl implements RepelBusinessService {
deviceRepelDetailService.saveDeviceRepelDetail(deviceRepelDetail);
}
@Override
public void againPutInStorage(List<Integer> ids) {
List<DeviceLibrary> deviceLibraries= deviceLibraryDao.getDeviceLibraryEntitiesByIdIn(ids);
deviceLibraries.forEach(
deviceLibrary -> deviceLibrary.setLifeStatus(DeviceLifeStatus.IN_LIBRARY.id)
);
deviceLibraryService.sendHash(deviceLibraries);
}
/**
* 生成区清退任务
......
package com.tykj.dev.device.sendback.service.impl;
import com.fasterxml.jackson.core.type.TypeReference;
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.library.subject.vo.ScriptSaveVo;
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.*;
......@@ -13,7 +15,9 @@ import com.tykj.dev.device.task.subject.bto.TaskBto;
import com.tykj.dev.device.user.subject.entity.SecurityUser;
import com.tykj.dev.device.user.subject.entity.Units;
import com.tykj.dev.device.user.subject.service.UnitsService;
import com.tykj.dev.misc.base.BusinessEnum;
import com.tykj.dev.misc.base.DeviceLifeStatus;
import com.tykj.dev.misc.utils.JacksonUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -55,7 +59,10 @@ public class RepelQueryServiceImpl implements RepelQueryService {
@Override
public DeviceRepelDetail findDeviceRepelDetail(Integer taskId) {
TaskBto taskBto= taskService.get(taskId);
return repelDetailService.findDeviceRepelDetail(taskBto.getBillId());
DeviceRepelDetail deviceRepelDetail= repelDetailService.findDeviceRepelDetail(taskBto.getBillId());
deviceRepelDetail.setScripts(JacksonUtil.readValue(deviceRepelDetail.getScriptJson(), new TypeReference<List<ScriptSaveVo>>() {
}));
return deviceRepelDetail;
}
@Override
......@@ -218,6 +225,7 @@ public class RepelQueryServiceImpl implements RepelQueryService {
if (deviceRepelDetail.getOutboundFile()!=null){
deviceRepelDetail.setOutboundFiles(FilesUtil.stringFileToList(deviceRepelDetail.getOutboundFile()));
}
deviceRepelDetail.setScripts(JacksonUtil.readValue(deviceRepelDetail.getScriptJson(), new TypeReference<List<ScriptSaveVo>>() {}));
deviceRepelDetail.setDeviceLibraryEntities(deviceLibraryDao.findAllById(StringUtils.stringToList(deviceRepelDetail.getDeviceIds())).stream().map(DeviceLibrary::setConfigName).collect(Collectors.toList()));
list.add(deviceRepelDetail);
}
......@@ -225,6 +233,13 @@ public class RepelQueryServiceImpl implements RepelQueryService {
return list;
}
@Override
public List<TaskBto> findOutsideTheProvince() {
List<Integer> unitIds= unitsService.findSuperiorUnitsList().stream().map(Units::getUnitId).collect(Collectors.toList());
List<DeviceRepelDetail> list=repelDetailService.findIdsReceiptUnits(unitIds);
return taskService.findBillIdAndBillType(list.stream().map(DeviceRepelDetail::getId).collect(Collectors.toList()), BusinessEnum.SEND_BACK.id);
}
private DevRepelVo devRepelVo(DeviceLibrary deviceLibrary){
return new DevRepelVo(deviceLibrary.getId(),deviceLibrary.getName(),deviceLibrary.getModel(),deviceLibrary.getSeqNumber(),deviceLibrary.getType(),deviceLibrary.getTypeName(),deviceLibrary.getUpdateTime());
......
......@@ -66,4 +66,6 @@ public interface TaskDao extends JpaRepository<Task, Integer>, JpaSpecificationE
Task findByParentTaskIdAndAndTitle(Integer parentId, String title);
List<Task> findAllByBusinessType(Integer businessType);
List<Task> findAllByBillIdInAndBusinessType(List<Integer> ids,Integer type);
}
......@@ -165,4 +165,9 @@ public interface TaskService {
* 工作交接替换跟踪和待办
*/
void workHandover(Integer oldUserId, Integer newUserId);
/**
* 根据业务id 以及 业务类型进行查询
*/
List<TaskBto> findBillIdAndBillType(List<Integer> billIds,Integer billType);
}
......@@ -614,6 +614,11 @@ public class TaskServiceImpl implements TaskService {
myWebSocket.sendMessage1();
}
@Override
public List<TaskBto> findBillIdAndBillType(List<Integer> billIds,Integer billType) {
return taskDao.findAllByBillIdInAndBusinessType(billIds,billType).stream().map(Task::parse2Bto).collect(Collectors.toList());
}
/**
* @param taskSelectVo 查询vo
* 查询跟踪和待办列表
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论