提交 ff7f23ee authored 作者: 133's avatar 133

[清退] 修改了直属单位提交完成 装备查询不到的bug

上级 89836d79
......@@ -21,7 +21,6 @@ public class FilesUtil {
List<String> strings = Arrays.asList(fileRets);
strings.forEach(
file -> {
System.out.println(file);
String[] files = file.split(",");
FileRet fileRet = new FileRet();
fileRet.setName(files[0]);
......
......@@ -98,6 +98,9 @@ public class DeviceLoss extends BaseEntity {
@Column(name = "loss_file",columnDefinition = "TEXT")
private String lossFile;
@ApiModelProperty(value = "区块链记录id")
private String recordId;
/**
* 找回业务状态
*/
......
package com.tykj.dev.device.loss.service.impl;
import com.tykj.dev.blockcha.subject.service.BlockChainUtil;
import com.tykj.dev.device.loss.entity.domain.DeviceLoss;
import com.tykj.dev.device.loss.repository.LossDao;
import com.tykj.dev.device.loss.service.DeviceLossService;
import com.tykj.dev.misc.utils.JacksonUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -16,14 +19,23 @@ import java.util.List;
* @createTime 2021年01月30日 11:17:00
*/
@Service
@Slf4j
public class DeviceLossServiceImpl implements DeviceLossService {
@Autowired
LossDao lossDao;
@Autowired
BlockChainUtil blockChainUtil;
@Override
public DeviceLoss save(DeviceLoss deviceLoss) {
return lossDao.save(deviceLoss);
// if (deviceLoss.getRecordId()==null){
// long time=System.currentTimeMillis();
// deviceLoss.setRecordId(blockChainUtil.sendText(1000, JacksonUtil.toJSon(deviceLoss)).getData().getRecordID());
// log.info("[丢失-找回]上链数据时间本次");
// }else {
// deviceLoss.setRecordId(blockChainUtil.appendText(JacksonUtil.toJSon(deviceLoss),deviceLoss.getRecordId()).getData().getRecordID());
// }
return lossDao.save(deviceLoss);
}
@Override
......@@ -40,4 +52,5 @@ public class DeviceLossServiceImpl implements DeviceLossService {
public List<DeviceLoss> findByListLossUnitId(Integer unitId) {
return lossDao.findAllByUnitId(unitId);
}
}
package com.tykj.dev.device.loss.service.impl;
import com.tykj.dev.blockcha.subject.service.BlockChainUtil;
import com.tykj.dev.device.file.service.FilesUtil;
import com.tykj.dev.device.library.repository.DeviceLibraryDao;
import com.tykj.dev.device.library.service.DeviceLibraryService;
......@@ -50,6 +51,9 @@ public class LossBillServiceImpl implements LossBillService {
@Autowired
UnitsService unitsService;
@Autowired
BlockChainUtil blockChainUtil;
@Autowired
DeviceLibraryDao deviceLibraryDao;
......@@ -223,4 +227,7 @@ public class LossBillServiceImpl implements LossBillService {
);
CompletableFuture.runAsync(() -> deviceLogService.saveAllLog(logDtos));
}
}
......@@ -68,7 +68,7 @@ public enum BusinessEnum {
/**
* 清退业务
*/
SEND_BACK(16, "清退装备交接业务"),
SEND_BACK(16, "清退业务"),
/**
* 清退异常处理
*/
......@@ -76,7 +76,7 @@ public enum BusinessEnum {
/**
* 清退出库
*/
SEND_BACK_STATISTICAL(18, "清退统计"),
SEND_BACK_STATISTICAL(18, "清退统计业务"),
/**
* 新增配套设备
*/
......@@ -92,7 +92,7 @@ public enum BusinessEnum {
/**
* 退回
*/
ALLOT_BACK(22, "退回"),
ALLOT_BACK(22, "退回业务"),
/**
* 报废
*/
......@@ -101,17 +101,17 @@ public enum BusinessEnum {
/**
* 丢失
*/
LOSS(24,"丢失"),
LOSS(24,"丢失业务"),
/**
* 找回
*/
RETRIEVE(25,"找回"),
RETRIEVE(25,"找回业务"),
/**
* 重新入库
*/
AGAINSTORAGE(26,"重新入库");
AGAINSTORAGE(26,"装备状态转换业务");
public Integer id;
......
......@@ -70,6 +70,12 @@ public class RepelQueryController {
return ResponseEntity.ok(repelQueryService.findDeviceChooseRepel(deviceChoosePageVo));
}
@PostMapping(value ="/idsList")
@ApiOperation(value = "清退选择装备id集合", notes = "清退选择装备id集合")
public ResponseEntity idsList(@RequestBody DeviceChoosePageVo deviceChoosePageVo){
return ResponseEntity.ok(repelQueryService.findIdList(deviceChoosePageVo));
}
@PostMapping(value ="/deviceChooseRepel1")
@ApiOperation(value = "省本级任务清退装备查询接口", notes = "省本级任务清退装备查询接口")
public ResponseEntity findDeviceRepel1(@RequestBody DeviceChoosePageVo deviceChoosePageVo){
......
......@@ -251,10 +251,13 @@ public class DeviceRepelDetail extends BaseEntity {
@Column(name = "script_json",columnDefinition = "TEXT")
private String scriptJson;
@Transient
private List<ScriptSaveVo> scripts = new ArrayList<>();
@Column(name = "directly_under_devices",columnDefinition = "TEXT")
private String directlyUnderDevices;
@Transient
private List<ScriptSaveVo> scripts = new ArrayList<>();
@Transient
private List<FileRet> sendFileList = new ArrayList<>();
......
package com.tykj.dev.device.sendback.entity.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;
/**
* @author zjm
* @version 1.0.0
* @ClassName DirectlyUnderDevicesVo.java
* @Description 直属单位提交装备列表对象
* @createTime 2021年04月18日 14:10:00
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@ApiModel("直属单位提交装备列表")
public class DirectlyUnderDevicesVo {
@ApiModelProperty(value = "单位id")
private Integer unitId;
@ApiModelProperty(value = "单位名称")
private String unitName;
@ApiModelProperty(value = "装备id集合")
private List<Integer> idsList;
}
......@@ -35,6 +35,10 @@ public interface RepelQueryService {
*/
DeviceChooseRepel findDeviceChooseRepel(DeviceChoosePageVo deviceChoosePageVo);
/**
* 根据列装id,以及当前用户 查询提交装备的ID集合
*/
List<Integer> findIdList(DeviceChoosePageVo deviceChoosePageVo);
/**
* 区县出库界面查询接口 根据taskid查询出库装备列表
......
......@@ -92,12 +92,10 @@ public class DeviceRepelDetailServiceImpl implements DeviceRepelDetailService {
return deviceRepelDetailDao.findAllByReceiveUnitIdIn(unitIds);
}
private List<DeviceLibrary> findInvoleDevice(String involeDevice){
if (involeDevice!=null && !involeDevice.equals(",") ) {
List<String> idStringList = Arrays.asList(involeDevice.split(","));
List<String> idListString = idStringList.stream().filter(list2->!list2.equals("")).collect(Collectors.toList());
System.out.println(idListString);
List<Integer> devIds = idListString.stream().map(Integer::parseInt).collect(Collectors.toList());
return deviceLibraryDao.getDeviceLibraryEntitiesByIdIn(devIds).stream().map(DeviceLibrary::setConfigName).collect(Collectors.toList());
}else {
......
......@@ -665,8 +665,11 @@ public class RepelBusinessServiceImpl implements RepelBusinessService {
taskService.moveToEnd(taskService.findBillTypeAndFatherId(BusinessEnum.SEND_BACK.id,taskId));
} else {
if (storageDeviceRepel.getIsIgnore()==null) {
List<StatusEnum> enumList=new ArrayList<>();
enumList.add(StatusEnum.SEND_BACK_1209);
enumList.add(StatusEnum.SEND_BACK_1218);
//判断当前状态是否为SEND_BACK_1209 清退装备等待入库
TaskDisposeUtil.isNotSubmit(taskBto.getBillStatus(), StatusEnum.SEND_BACK_1209);
TaskDisposeUtil.isNotSubmit(taskBto.getBillStatus(),enumList);
repelTaskStatistical.setTaskStatus(4);
taskService.moveToSpecial(taskBto, StatusEnum.SEND_BACK_1215, 0);
}else {
......@@ -756,8 +759,25 @@ public class RepelBusinessServiceImpl implements RepelBusinessService {
TaskBto taskBto= taskService.get(taskId);
TaskDisposeUtil.isNotSubmit(taskBto.getBillStatus(),StatusEnum.SEND_BACK_1202);
DeviceRepelDetail deviceRepelDetail=deviceRepelDetailService.findDeviceRepelDetail(taskBto.getBillId());
DeviceRepel deviceRepel= deviceRepelService.findDeviceRepel(deviceRepelDetail.getRepelId());
DeviceRepel deviceRepel = deviceRepelService.findDeviceRepel(deviceRepelDetail.getRepelId());
Map<String,List<Integer>> map=new HashMap<>();
List<DeviceLibrary> libraries=deviceLibraryDao.getDeviceLibraryEntitiesByIdIn(StringUtils.stringToList(deviceRepelDetail.getDeviceIds()));
libraries.forEach(
deviceLibrary -> {
if (map.containsKey(deviceLibrary.getOwnUnit())){
List<Integer> list= map.get(deviceLibrary.getOwnUnit());
list.add(deviceLibrary.getId());
map.put(deviceLibrary.getOwnUnit(),list);
}else {
List<Integer> list=new ArrayList<>();
list.add(deviceLibrary.getId());
map.put(deviceLibrary.getOwnUnit(),list);
}
}
);
deviceRepelDetail.setDirectlyUnderDevices(JacksonUtil.toJSon(map));
deviceRepelDetailService.saveDeviceRepelDetail(deviceRepelDetail);
devLogAdd(libraries,"省直属清退,把装备转变为待清退",securityUser.getCurrentUserInfo().getUserId());
deviceLibraryDao.upDateLeftStatusAndLockStatus(filterTypeReturnLeftStatus(deviceRepel.getType()), 0, StringUtils.stringToList(deviceRepelDetail.getDeviceIds()));
taskService.moveToSpecial(taskBto,StatusEnum.SEND_BACK_1213,0);
......@@ -778,7 +798,6 @@ public class RepelBusinessServiceImpl implements RepelBusinessService {
enumList.add(StatusEnum.SEND_BACK_1212);
enumList.add(StatusEnum.SEND_BACK_1204);
TaskDisposeUtil.isNotSubmit(taskBto.getBillStatus(),enumList);
taskService.moveToEnd(taskService.get(taskId));
}
......@@ -813,7 +832,7 @@ public class RepelBusinessServiceImpl implements RepelBusinessService {
deviceRepelDetail.setReceiveUserA(storageDeviceRepel.getUserAName());
}
if (units.getLevel()==3) {
deviceLibraryDao.upDateLeftStatusAndUnitNameAndLockStatus(DeviceLifeStatus.RETIRE.id, deviceRepelDetail.getReceiveUnit(), 0, StringUtils.stringToList(deviceRepelDetail.getDeviceIds()));
deviceLibraryDao.upDateLeftStatusAndUnitNameAndLockStatus(DeviceLifeStatus.SEND_BACK.id, deviceRepelDetail.getReceiveUnit(), 0, StringUtils.stringToList(deviceRepelDetail.getDeviceIds()));
}else {
deviceLibraryDao.upDateLeftStatusAndUnitNameAndLockStatus(filterTypeReturnLeftStatus(deviceRepel.getType()), deviceRepelDetail.getReceiveUnit(), 0, StringUtils.stringToList(deviceRepelDetail.getDeviceIds()));
}
......@@ -974,7 +993,7 @@ public class RepelBusinessServiceImpl implements RepelBusinessService {
List<Integer> list=new ArrayList<>();
list.add(userId);
list.add(0);
return taskService.start(new TaskBto(StatusEnum.SEND_BACK_1202.id, title+"直属单位", parentTaskId, ".", repelDetailId, BusinessEnum.SEND_BACK.id, unitId, 1, "", list));
return taskService.start(new TaskBto(StatusEnum.SEND_BACK_1202.id, title+"直属单位", parentTaskId, ".", repelDetailId, BusinessEnum.SEND_BACK.id, unitId, 1, "DirectlyUnder", list));
}
/**
......
......@@ -19,6 +19,7 @@ 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.base.StatusEnum;
import com.tykj.dev.misc.exception.ApiException;
import com.tykj.dev.misc.utils.DeviceSeqUtil;
import com.tykj.dev.misc.utils.JacksonUtil;
import com.tykj.dev.misc.utils.PageUtil;
......@@ -27,6 +28,7 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;
import javax.persistence.Transient;
......@@ -150,6 +152,51 @@ public class RepelQueryServiceImpl implements RepelQueryService {
return new DeviceChooseRepel(deviceLibraryPage,deviceLibraryPageAbnormal,isNotSub);
}
@Override
public List<Integer> findIdList(DeviceChoosePageVo deviceChoosePageVo) {
List<Integer> deviceLibraries=new ArrayList<>();
Units units= unitsService.findById(deviceChoosePageVo.getUnitId());
DeviceRepelDetail deviceRepelDetail= repelDetailService.findDeviceRepelDetail(taskService.get(deviceChoosePageVo.getTaskId()).getBillId());
DeviceRepel deviceRepel=deviceRepelService.findDeviceRepel(deviceRepelDetail.getRepelId());
if (deviceRepel.getSeqNumbers()==null||deviceRepel.getSeqNumbers().equals("")) {
deviceLibraryDao.findAllByPackingIdInAndOwnUnit(deviceChoosePageVo.getFielding(), units.getName()).stream()
.filter(deviceLibrary -> deviceLibrary.getLifeStatus().equals(DeviceLifeStatus.IN_LIBRARY.id)
|| deviceLibrary.getLifeStatus().equals(DeviceLifeStatus.REPEL.id)
|| deviceLibrary.getLifeStatus().equals(DeviceLifeStatus.SEND_BACK.id)
|| deviceLibrary.getLifeStatus().equals(DeviceLifeStatus.REPAIRING.id)
|| deviceLibrary.getLifeStatus().equals(DeviceLifeStatus.IN_TRANSIT.id)
|| deviceLibrary.getLifeStatus().equals(DeviceLifeStatus.USE.id))
.map(DeviceLibrary::setConfigName).forEach(
deviceLibrary -> {
if (deviceLibrary.getOwnUnit().equals(deviceLibrary.getLocationUnit())) {
if (deviceLibrary.getLifeStatus() == 2 || deviceLibrary.getLifeStatus() == 15 || deviceLibrary.getLifeStatus() == 14 || deviceLibrary.getLifeStatus() == 6) {
deviceLibraries.add(deviceLibrary.getId());
}
}
}
);
}else {
deviceLibraryDao.findAllBySeqNumberIn(DeviceSeqUtil.selectDeviceSeqs(deviceRepel.getSeqNumbers())).stream()
.filter(deviceLibrary -> deviceLibrary.getLifeStatus().equals(DeviceLifeStatus.IN_LIBRARY.id)
|| deviceLibrary.getLifeStatus().equals(DeviceLifeStatus.REPEL.id)
|| deviceLibrary.getLifeStatus().equals(DeviceLifeStatus.SEND_BACK.id)
|| deviceLibrary.getLifeStatus().equals(DeviceLifeStatus.REPAIRING.id)
|| deviceLibrary.getLifeStatus().equals(DeviceLifeStatus.IN_TRANSIT.id)
|| deviceLibrary.getLifeStatus().equals(DeviceLifeStatus.USE.id))
.filter(deviceLibrary -> deviceLibrary.getOwnUnit().equals(units.getName()))
.map(DeviceLibrary::setConfigName).forEach(
deviceLibrary -> {
if (deviceLibrary.getOwnUnit().equals(deviceLibrary.getLocationUnit())) {
if (deviceLibrary.getLifeStatus() == 2 || deviceLibrary.getLifeStatus() == 15 || deviceLibrary.getLifeStatus() == 14 || deviceLibrary.getLifeStatus() == 6) {
deviceLibraries.add(deviceLibrary.getId());
}
}
}
);
}
return deviceLibraries;
}
private List<DeviceLibrary> findModelAndType(DeviceSelectVo deviceSelectVo,List<DeviceLibrary> libraries){
if (deviceSelectVo.getModel()!=null&&deviceSelectVo.getType()==null){
return libraries.stream().filter(deviceLibrary -> deviceLibrary.getModel().equals(deviceSelectVo.getModel())).collect(Collectors.toList());
......@@ -282,7 +329,19 @@ public class RepelQueryServiceImpl implements RepelQueryService {
Units units=unitsService.findById(unitId);
TaskBto taskBto= taskService.get(taskId);
DeviceRepelDetail deviceRepelDetail= repelDetailService.findDeviceRepelDetail(taskBto.getBillId());
return findInvoleDevice(deviceRepelDetail.getDeviceIds()).stream().filter(deviceLibrary -> deviceLibrary.getOwnUnit().equals(units.getName())).collect(Collectors.toList());
Map<String,List<Integer>> map=JacksonUtil.readValue(deviceRepelDetail.getDirectlyUnderDevices(), new TypeReference<Map<String, List<Integer>>>() {});
if (map!=null) {
if (map.containsKey(units.getName())) {
return deviceLibraryDao.findAllById(map.get(units.getName()));
}else {
log.info("直属单位-{}-没有提交的装备,请查看",units.getName());
return new ArrayList<>();
}
}else {
log.info("直属单位任务{}没有提交的装备,请查看",taskBto.getId());
return new ArrayList<>();
}
}
@Override
......
......@@ -504,7 +504,7 @@ public class TrainJobController {
}
private TrainUser saveTrainUser(TrainUser trainUser){
TrainUser trainUser1 = trainUserDao.save(trainUser);
TrainUser trainUser1 = trainUserDao.save(trainUser);
BcHash bcHash=blockChainUtil.sendHash(1000,JacksonUtil.toJSon(trainUser1));
trainUser1.setRecordId(bcHash.getData().getRecordID());
// log.info("id----{}",bcHash.getData().getRecordID());
......
......@@ -47,4 +47,6 @@ public interface UserPublicService {
List<Integer> findOtherUser(Integer userId);
String getAreaNameByUnitName(String unitName);
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论