提交 31ef9a1d authored 作者: 133's avatar 133

[代码提交] 清退

上级 e6052266
...@@ -52,7 +52,7 @@ import java.util.concurrent.atomic.AtomicBoolean; ...@@ -52,7 +52,7 @@ import java.util.concurrent.atomic.AtomicBoolean;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
* @author 清退业务逻辑代码提供 * @author 清退业务逻辑代码提供
* @version 1.0.0 * @version 1.0.0
* @ClassName RepelBusinessServiceImpl.java * @ClassName RepelBusinessServiceImpl.java
* @Description TODO * @Description TODO
...@@ -109,6 +109,7 @@ public class RepelBusinessServiceImpl implements RepelBusinessService { ...@@ -109,6 +109,7 @@ public class RepelBusinessServiceImpl implements RepelBusinessService {
/** /**
* 发起申请后清退任务 * 发起申请后清退任务
*
* @param deviceRepel * @param deviceRepel
* @param userId * @param userId
*/ */
...@@ -122,9 +123,9 @@ public class RepelBusinessServiceImpl implements RepelBusinessService { ...@@ -122,9 +123,9 @@ public class RepelBusinessServiceImpl implements RepelBusinessService {
//把清退账单存储到数据表中 //把清退账单存储到数据表中
//写入业务日志 //写入业务日志
User user = userService.findByUser(userId); User user = userService.findByUser(userId);
Units units=unitsService.findById(user.getUnitsId()); Units units = unitsService.findById(user.getUnitsId());
Area area=areaService.findByid(units.getAreaId()); Area area = areaService.findByid(units.getAreaId());
List<Integer> lifeStatus=new ArrayList<>(); List<Integer> lifeStatus = new ArrayList<>();
lifeStatus.add(DeviceLifeStatus.IN_LIBRARY.id); lifeStatus.add(DeviceLifeStatus.IN_LIBRARY.id);
lifeStatus.add(DeviceLifeStatus.REPEL.id); lifeStatus.add(DeviceLifeStatus.REPEL.id);
lifeStatus.add(DeviceLifeStatus.REPAIRING.id); lifeStatus.add(DeviceLifeStatus.REPAIRING.id);
...@@ -133,33 +134,33 @@ public class RepelBusinessServiceImpl implements RepelBusinessService { ...@@ -133,33 +134,33 @@ public class RepelBusinessServiceImpl implements RepelBusinessService {
lifeStatus.add(DeviceLifeStatus.SEND_BACK.id); lifeStatus.add(DeviceLifeStatus.SEND_BACK.id);
lifeStatus.add(DeviceLifeStatus.TO_BE_DESTROYED.id); lifeStatus.add(DeviceLifeStatus.TO_BE_DESTROYED.id);
lifeStatus.add(DeviceLifeStatus.TO_BE_SCRAPPED.id); lifeStatus.add(DeviceLifeStatus.TO_BE_SCRAPPED.id);
List<String> directlUnderUnitNames=new ArrayList<>(); List<String> directlUnderUnitNames = new ArrayList<>();
AtomicBoolean directlUnderUnit= new AtomicBoolean(false); AtomicBoolean directlUnderUnit = new AtomicBoolean(false);
AtomicBoolean correspondingLevel= new AtomicBoolean(false); AtomicBoolean correspondingLevel = new AtomicBoolean(false);
deviceRepel.setFielding(StringUtils.ListToString(deviceRepel.getFieldingIds())); deviceRepel.setFielding(StringUtils.ListToString(deviceRepel.getFieldingIds()));
deviceRepel.setFiles(FilesUtil.stringFileToList(deviceRepel.getFileRets())); deviceRepel.setFiles(FilesUtil.stringFileToList(deviceRepel.getFileRets()));
deviceRepel.setTaskScope(StringUtils.ListToString(deviceRepel.getTaskScopes())); deviceRepel.setTaskScope(StringUtils.ListToString(deviceRepel.getTaskScopes()));
Map<String,Integer> unitNameMap=new HashMap<>(); Map<String, Integer> unitNameMap = new HashMap<>();
List<String> seqNumbers=DeviceSeqUtil.selectDeviceSeqs(deviceRepel.getSeqNumbers()); List<String> seqNumbers = DeviceSeqUtil.selectDeviceSeqs(deviceRepel.getSeqNumbers());
if (seqNumbers.size()!=0){ if (seqNumbers.size() != 0) {
log.info("申请任务触发清退任务"); log.info("申请任务触发清退任务");
deviceLibraryService.findAllBySeqNumber(seqNumbers).forEach( deviceLibraryService.findAllBySeqNumber(seqNumbers).forEach(
deviceLibrary -> { deviceLibrary -> {
if (!unitNameMap.containsKey(deviceLibrary.getOwnUnit())){ if (!unitNameMap.containsKey(deviceLibrary.getOwnUnit())) {
unitNameMap.put(deviceLibrary.getOwnUnit(),0); unitNameMap.put(deviceLibrary.getOwnUnit(), 0);
} }
} }
); );
//市区关系信息 //市区关系信息
Map<Integer,List<SupervisorVo>> supervisorMap=new HashMap<>(); Map<Integer, List<SupervisorVo>> supervisorMap = new HashMap<>();
//省直属 待考虑 //省直属 待考虑
unitNameMap.forEach((k,v)->{ unitNameMap.forEach((k, v) -> {
Units units1= unitsService.findbyName(k); Units units1 = unitsService.findbyName(k);
//区 //区
List<SupervisorVo> supervisorVoList=new ArrayList<>(); List<SupervisorVo> supervisorVoList = new ArrayList<>();
if (units1.getLevel() == 3){ if (units1.getLevel() == 3) {
Area area1 = areaService.findByid(units1.getAreaId()); Area area1 = areaService.findByid(units1.getAreaId());
Units father = unitsService.findUnitAreaId(area1.getFatherId()); Units father = unitsService.findUnitAreaId(area1.getFatherId());
if (supervisorMap.containsKey(father.getUnitId())) { if (supervisorMap.containsKey(father.getUnitId())) {
...@@ -181,88 +182,88 @@ public class RepelBusinessServiceImpl implements RepelBusinessService { ...@@ -181,88 +182,88 @@ public class RepelBusinessServiceImpl implements RepelBusinessService {
} }
}); });
List<Integer> unitList=new ArrayList<>(); List<Integer> unitList = new ArrayList<>();
unitList.addAll(supervisorMap.keySet()); unitList.addAll(supervisorMap.keySet());
deviceRepel.setTaskScope(StringUtils.ListToString(unitList)); deviceRepel.setTaskScope(StringUtils.ListToString(unitList));
deviceRepel.setTaskScopes(unitList); deviceRepel.setTaskScopes(unitList);
deviceRepel.setEquipmentInvolvingUnit(JacksonUtil.toJSon(supervisorMap)); deviceRepel.setEquipmentInvolvingUnit(JacksonUtil.toJSon(supervisorMap));
} }
DeviceRepel deviceRepel1= deviceRepelService.saveDeviceRepel(deviceRepel); DeviceRepel deviceRepel1 = deviceRepelService.saveDeviceRepel(deviceRepel);
TaskBto taskBto = statsXTask(units.getUnitId(),deviceRepel1.getId(),"清退型号为"+StringSplitUtil.stringListToString(deviceRepel.getModels().stream() TaskBto taskBto = statsXTask(units.getUnitId(), deviceRepel1.getId(), "清退型号为" + StringSplitUtil.stringListToString(deviceRepel.getModels().stream()
.distinct() .distinct()
.collect(Collectors.toList()))+"设备任务",userId); .collect(Collectors.toList())) + "设备任务", userId);
//给本单位其他专管员阅知 //给本单位其他专管员阅知
// addMessage(new MessageBto(taskBto.getId(),taskBto.getBusinessType(),user.getName()+"发起清退任务["+deviceRepel1.getTitle()+"]",gainThisUser(userId,units.getUnitId()))); // addMessage(new MessageBto(taskBto.getId(),taskBto.getBusinessType(),user.getName()+"发起清退任务["+deviceRepel1.getTitle()+"]",gainThisUser(userId,units.getUnitId())));
List<RepelTaskStatistical> list=new ArrayList<>(); List<RepelTaskStatistical> list = new ArrayList<>();
deviceRepel.getTaskScopes().forEach( deviceRepel.getTaskScopes().forEach(
unisId-> { unisId -> {
Units units1 = unitsService.findById(unisId); Units units1 = unitsService.findById(unisId);
if (unisId != units.getUnitId()) { if (unisId != units.getUnitId()) {
if (units1.getType() == 2) { if (units1.getType() == 2) {
directlUnderUnit.set(true); directlUnderUnit.set(true);
directlUnderUnitNames.add(units1.getName()); directlUnderUnitNames.add(units1.getName());
// directlUnderUnitDeviceIds.addAll(unitNameMap.get(units1.getName())); // directlUnderUnitDeviceIds.addAll(unitNameMap.get(units1.getName()));
} else if (units1.getType() == 1) { } else if (units1.getType() == 1) {
Area area1 = areaService.findByid(units1.getAreaId()); Area area1 = areaService.findByid(units1.getAreaId());
DeviceRepelDetail deviceRepelDetail=new DeviceRepelDetail(); DeviceRepelDetail deviceRepelDetail = new DeviceRepelDetail();
deviceRepelDetail.setRepelId(deviceRepel1.getId()); deviceRepelDetail.setRepelId(deviceRepel1.getId());
deviceRepelDetail.setRepelStatus(1); deviceRepelDetail.setRepelStatus(1);
deviceRepelDetail.setSendUnit(units1.getName()); deviceRepelDetail.setSendUnit(units1.getName());
deviceRepelDetail.setSendUnitId(units1.getUnitId()); deviceRepelDetail.setSendUnitId(units1.getUnitId());
long time=System.currentTimeMillis(); long time = System.currentTimeMillis();
Integer count=deviceLibraryService.countAllRepel(deviceRepel.getFieldingIds(),unitsService.findBySubordinateUnitName(units1.getUnitId()), seqNumbers,lifeStatus); Integer count = deviceLibraryService.countAllRepel(deviceRepel.getFieldingIds(), unitsService.findBySubordinateUnitName(units1.getUnitId()), seqNumbers, lifeStatus);
if (count!=0) { if (count != 0) {
TaskBto taskBto1 = cityRepelTask(unisId, deviceRepelDetailService.saveDeviceRepelDetail(deviceRepelDetail).getId(), units1.getName()+"清退型号为"+ StringSplitUtil.stringListToString(deviceRepel.getModels().stream() TaskBto taskBto1 = cityRepelTask(unisId, deviceRepelDetailService.saveDeviceRepelDetail(deviceRepelDetail).getId(), units1.getName() + "清退型号为" + StringSplitUtil.stringListToString(deviceRepel.getModels().stream()
.distinct() .distinct()
.collect(Collectors.toList()))+"设备", taskBto.getId(), userId); .collect(Collectors.toList())) + "设备", taskBto.getId(), userId);
list.add(new RepelTaskStatistical(deviceRepel1.getId(), taskBto.getId(), taskBto1.getId(), 0, area1.getName(), repelStatusJudgeCount(deviceRepel.getRepelStatus(),count), "")); list.add(new RepelTaskStatistical(deviceRepel1.getId(), taskBto.getId(), taskBto1.getId(), 0, area1.getName(), repelStatusJudgeCount(deviceRepel.getRepelStatus(), count), ""));
} }
} }
}else { } else {
correspondingLevel.set(true); correspondingLevel.set(true);
} }
} }
); );
DeviceRepelDetail deviceRepelDetail=new DeviceRepelDetail(); DeviceRepelDetail deviceRepelDetail = new DeviceRepelDetail();
deviceRepelDetail.setRepelId(deviceRepel1.getId()); deviceRepelDetail.setRepelId(deviceRepel1.getId());
deviceRepelDetail.setRepelStatus(1); deviceRepelDetail.setRepelStatus(1);
deviceRepelDetail.setSendUnitId(units.getUnitId()); deviceRepelDetail.setSendUnitId(units.getUnitId());
deviceRepelDetail.setSendUnit(units.getName()); deviceRepelDetail.setSendUnit(units.getName());
deviceRepelDetail.setRepelType(2); deviceRepelDetail.setRepelType(2);
Integer count=deviceLibraryService.countAllRepel(deviceRepel.getFieldingIds(),directlUnderUnitNames,seqNumbers,lifeStatus); Integer count = deviceLibraryService.countAllRepel(deviceRepel.getFieldingIds(), directlUnderUnitNames, seqNumbers, lifeStatus);
if (directlUnderUnit.get()&&count!=0){ if (directlUnderUnit.get() && count != 0) {
TaskBto taskBto2 = directlyUnderTask(units.getUnitId(), deviceRepelDetailService.saveDeviceRepelDetail(deviceRepelDetail).getId(), taskBto.getId(),"省直属单位清退型号为"+ StringSplitUtil.stringListToString(deviceRepel.getModels().stream() TaskBto taskBto2 = directlyUnderTask(units.getUnitId(), deviceRepelDetailService.saveDeviceRepelDetail(deviceRepelDetail).getId(), taskBto.getId(), "省直属单位清退型号为" + StringSplitUtil.stringListToString(deviceRepel.getModels().stream()
.distinct() .distinct()
.collect(Collectors.toList()))+"设备",userId); .collect(Collectors.toList())) + "设备", userId);
list.add(new RepelTaskStatistical(deviceRepel1.getId(), taskBto.getId(), taskBto2.getId(), 0, "省直属",repelStatusJudgeCount(deviceRepel.getRepelStatus(),count), "")); list.add(new RepelTaskStatistical(deviceRepel1.getId(), taskBto.getId(), taskBto2.getId(), 0, "省直属", repelStatusJudgeCount(deviceRepel.getRepelStatus(), count), ""));
} }
DeviceRepelDetail deviceRepelDetail1=new DeviceRepelDetail(); DeviceRepelDetail deviceRepelDetail1 = new DeviceRepelDetail();
deviceRepelDetail1.setRepelId(deviceRepel1.getId()); deviceRepelDetail1.setRepelId(deviceRepel1.getId());
deviceRepelDetail1.setRepelStatus(1); deviceRepelDetail1.setRepelStatus(1);
deviceRepelDetail1.setSendUnitId(units.getUnitId()); deviceRepelDetail1.setSendUnitId(units.getUnitId());
deviceRepelDetail1.setSendUnit(units.getName()); deviceRepelDetail1.setSendUnit(units.getName());
List<String> strings=new ArrayList<>(); List<String> strings = new ArrayList<>();
strings.add(units.getName()); strings.add(units.getName());
deviceRepelDetail1.setRepelType(3); deviceRepelDetail1.setRepelType(3);
count=deviceLibraryService.countAllRepel(deviceRepel.getFieldingIds(),strings, seqNumbers,lifeStatus); count = deviceLibraryService.countAllRepel(deviceRepel.getFieldingIds(), strings, seqNumbers, lifeStatus);
log.info("[清退] 本级装备件数{}",count); log.info("[清退] 本级装备件数{}", count);
if (correspondingLevel.get()&& count!=0){ if (correspondingLevel.get() && count != 0) {
TaskBto taskBto1 = oneselfTask(units.getUnitId(),deviceRepelDetailService.saveDeviceRepelDetail(deviceRepelDetail1).getId(), taskBto.getId(),"省本级清退型号为"+ StringSplitUtil.stringListToString(deviceRepel.getModels().stream() TaskBto taskBto1 = oneselfTask(units.getUnitId(), deviceRepelDetailService.saveDeviceRepelDetail(deviceRepelDetail1).getId(), taskBto.getId(), "省本级清退型号为" + StringSplitUtil.stringListToString(deviceRepel.getModels().stream()
.distinct() .distinct()
.collect(Collectors.toList()))+"设备",userId); .collect(Collectors.toList())) + "设备", userId);
list.add(new RepelTaskStatistical(deviceRepel1.getId(),taskBto.getId(),taskBto1.getId(),0,"省本级",repelStatusJudgeCount(deviceRepel.getRepelStatus(),count),"")); list.add(new RepelTaskStatistical(deviceRepel1.getId(), taskBto.getId(), taskBto1.getId(), 0, "省本级", repelStatusJudgeCount(deviceRepel.getRepelStatus(), count), ""));
} }
if (list==null||list.size()==0){ if (list == null || list.size() == 0) {
taskService.moveToSpecial(taskBto, StatusEnum.SEND_BACK_1212,userId); taskService.moveToSpecial(taskBto, StatusEnum.SEND_BACK_1212, userId);
} }
repelTaskStatisticalService.saveAllRepelTaskStatistical(list); repelTaskStatisticalService.saveAllRepelTaskStatistical(list);
} }
private Integer repelStatusJudgeCount(Integer repelStatus,Integer count){ private Integer repelStatusJudgeCount(Integer repelStatus, Integer count) {
if (repelStatus==1){ if (repelStatus == 1) {
return 0; return count;
}else { } else {
return 0; return count;
} }
} }
...@@ -274,7 +275,7 @@ public class RepelBusinessServiceImpl implements RepelBusinessService { ...@@ -274,7 +275,7 @@ public class RepelBusinessServiceImpl implements RepelBusinessService {
// 当前task推送 装备待清退 // 当前task推送 装备待清退
// 生成的任务放入统计表中 关联信息 // 生成的任务放入统计表中 关联信息
// 修改当前任务的状态 市清退任务待区县提交 // 修改当前任务的状态 市清退任务待区县提交
List<Integer> lifeStatus=new ArrayList<>(); List<Integer> lifeStatus = new ArrayList<>();
lifeStatus.add(DeviceLifeStatus.IN_LIBRARY.id); lifeStatus.add(DeviceLifeStatus.IN_LIBRARY.id);
lifeStatus.add(DeviceLifeStatus.REPEL.id); lifeStatus.add(DeviceLifeStatus.REPEL.id);
lifeStatus.add(DeviceLifeStatus.REPAIRING.id); lifeStatus.add(DeviceLifeStatus.REPAIRING.id);
...@@ -282,58 +283,59 @@ public class RepelBusinessServiceImpl implements RepelBusinessService { ...@@ -282,58 +283,59 @@ public class RepelBusinessServiceImpl implements RepelBusinessService {
lifeStatus.add(DeviceLifeStatus.USE.id); lifeStatus.add(DeviceLifeStatus.USE.id);
lifeStatus.add(DeviceLifeStatus.SEND_BACK.id); lifeStatus.add(DeviceLifeStatus.SEND_BACK.id);
User user = userService.findByUser(userId); User user = userService.findByUser(userId);
Units units=unitsService.findById(user.getUnitsId()); Units units = unitsService.findById(user.getUnitsId());
Area area=areaService.findByid(units.getAreaId()); Area area = areaService.findByid(units.getAreaId());
deviceRepel.setFielding(StringUtils.ListToString(deviceRepel.getFieldingIds())); deviceRepel.setFielding(StringUtils.ListToString(deviceRepel.getFieldingIds()));
deviceRepel.setTaskScope(StringUtils.ListToString(deviceRepel.getTaskScopes())); deviceRepel.setTaskScope(StringUtils.ListToString(deviceRepel.getTaskScopes()));
deviceRepel.setFiles(FilesUtil.stringFileToList(deviceRepel.getFileRets())); deviceRepel.setFiles(FilesUtil.stringFileToList(deviceRepel.getFileRets()));
//查询上级任务 判断是否为申请后清退 //查询上级任务 判断是否为申请后清退
TaskBto currentTask= taskService.get(taskId); TaskBto currentTask = taskService.get(taskId);
DeviceRepelDetail deviceRepelDetail1 = deviceRepelDetailService.findDeviceRepelDetail(currentTask.getBillId()); DeviceRepelDetail deviceRepelDetail1 = deviceRepelDetailService.findDeviceRepelDetail(currentTask.getBillId());
RepelTaskStatistical repelTaskStatistical= repelTaskStatisticalService.findRepelTaskStatistical(currentTask.getId(),deviceRepelDetail1.getRepelId()); RepelTaskStatistical repelTaskStatistical = repelTaskStatisticalService.findRepelTaskStatistical(currentTask.getId(), deviceRepelDetail1.getRepelId());
repelTaskStatistical.setTaskStatus(5); repelTaskStatistical.setTaskStatus(5);
repelTaskStatisticalService.saveRepelTaskStatistical(repelTaskStatistical); repelTaskStatisticalService.saveRepelTaskStatistical(repelTaskStatistical);
taskService.moveToSpecial(currentTask,StatusEnum.SEND_BACK_1206); taskService.moveToSpecial(currentTask, StatusEnum.SEND_BACK_1206);
DeviceRepel deviceRepelCurrent=deviceRepelService.findDeviceRepel(deviceRepelDetail1.getRepelId()); DeviceRepel deviceRepelCurrent = deviceRepelService.findDeviceRepel(deviceRepelDetail1.getRepelId());
if (deviceRepelCurrent.getEquipmentInvolvingUnit()!=null){ if (deviceRepelCurrent.getEquipmentInvolvingUnit() != null) {
Map<Integer,List<SupervisorVo>> integerListMap=JacksonUtil.readValue(deviceRepelCurrent.getEquipmentInvolvingUnit(), new TypeReference<Map<Integer,List<SupervisorVo>>>() {}); Map<Integer, List<SupervisorVo>> integerListMap = JacksonUtil.readValue(deviceRepelCurrent.getEquipmentInvolvingUnit(), new TypeReference<Map<Integer, List<SupervisorVo>>>() {
if (integerListMap.containsKey(units.getUnitId())){ });
if (integerListMap.containsKey(units.getUnitId())) {
deviceRepel.setTaskScopes(integerListMap.get(units.getUnitId()).stream().map(SupervisorVo::getUnitid).collect(Collectors.toList())); deviceRepel.setTaskScopes(integerListMap.get(units.getUnitId()).stream().map(SupervisorVo::getUnitid).collect(Collectors.toList()));
}else { } else {
throw new ApiException(ResponseEntity.status(500).body("[申请后清退] 为根据单位ID查询到市分解任务到单位范围:"+currentTask.getId())); throw new ApiException(ResponseEntity.status(500).body("[申请后清退] 为根据单位ID查询到市分解任务到单位范围:" + currentTask.getId()));
} }
} }
DeviceRepel deviceRepel1= deviceRepelService.saveDeviceRepel(deviceRepel); DeviceRepel deviceRepel1 = deviceRepelService.saveDeviceRepel(deviceRepel);
TaskBto taskBto= cityTotalTask(units.getUnitId(),deviceRepel1.getId(),units.getName()+"清退型号为"+StringSplitUtil.stringListToString(deviceRepel.getModels().stream() TaskBto taskBto = cityTotalTask(units.getUnitId(), deviceRepel1.getId(), units.getName() + "清退型号为" + StringSplitUtil.stringListToString(deviceRepel.getModels().stream()
.distinct() .distinct()
.collect(Collectors.toList()))+"设备统计任务",taskId,userId); .collect(Collectors.toList())) + "设备统计任务", taskId, userId);
// addMessage(new MessageBto(taskBto.getId(),taskBto.getBusinessType(),user.getName()+"转发清退任务["+deviceRepel1.getTitle()+"]",gainThisUser(userId,units.getUnitId()))); // addMessage(new MessageBto(taskBto.getId(),taskBto.getBusinessType(),user.getName()+"转发清退任务["+deviceRepel1.getTitle()+"]",gainThisUser(userId,units.getUnitId())));
List<RepelTaskStatistical> list=new ArrayList<>(); List<RepelTaskStatistical> list = new ArrayList<>();
deviceRepel.getTaskScopes().forEach( deviceRepel.getTaskScopes().forEach(
unisId-> { unisId -> {
if (unisId != units.getUnitId()) { if (unisId != units.getUnitId()) {
Units units1 = unitsService.findById(unisId); Units units1 = unitsService.findById(unisId);
Area area1 = areaService.findByid(units1.getAreaId()); Area area1 = areaService.findByid(units1.getAreaId());
DeviceRepelDetail deviceRepelDetail=new DeviceRepelDetail(); DeviceRepelDetail deviceRepelDetail = new DeviceRepelDetail();
deviceRepelDetail.setRepelId(deviceRepel1.getId()); deviceRepelDetail.setRepelId(deviceRepel1.getId());
deviceRepelDetail.setRepelStatus(1); deviceRepelDetail.setRepelStatus(1);
deviceRepelDetail.setSendUnit(units1.getName()); deviceRepelDetail.setSendUnit(units1.getName());
deviceRepelDetail.setSendUnitId(units1.getUnitId()); deviceRepelDetail.setSendUnitId(units1.getUnitId());
Integer count=deviceLibraryService.countAllRepel(deviceRepel.getFieldingIds(),unitsService.findBySubordinateUnitName(units1.getUnitId()), DeviceSeqUtil.selectDeviceSeqs(deviceRepel.getSeqNumbers()),lifeStatus); Integer count = deviceLibraryService.countAllRepel(deviceRepel.getFieldingIds(), unitsService.findBySubordinateUnitName(units1.getUnitId()), DeviceSeqUtil.selectDeviceSeqs(deviceRepel.getSeqNumbers()), lifeStatus);
if (count!=0) { if (count != 0) {
TaskBto taskBto1 = countyRepelTask(unisId, deviceRepelDetailService.saveDeviceRepelDetail(deviceRepelDetail).getId(),units1.getName()+"清退型号为"+ StringSplitUtil.stringListToString(deviceRepel.getModels().stream() TaskBto taskBto1 = countyRepelTask(unisId, deviceRepelDetailService.saveDeviceRepelDetail(deviceRepelDetail).getId(), units1.getName() + "清退型号为" + StringSplitUtil.stringListToString(deviceRepel.getModels().stream()
.distinct() .distinct()
.collect(Collectors.toList()))+"设备" , taskBto.getId(),userId); .collect(Collectors.toList())) + "设备", taskBto.getId(), userId);
list.add(new RepelTaskStatistical(deviceRepel1.getId(), taskBto.getId(), taskBto1.getId(), 0, area1.getName(),repelStatusJudgeCount(deviceRepel.getRepelStatus(),count), "")); list.add(new RepelTaskStatistical(deviceRepel1.getId(), taskBto.getId(), taskBto1.getId(), 0, area1.getName(), repelStatusJudgeCount(deviceRepel.getRepelStatus(), count), ""));
} }
} }
} }
); );
if (list==null||list.size()==0){ if (list == null || list.size() == 0) {
taskService.moveToSpecial(taskBto, StatusEnum.SEND_BACK_1212,userId); taskService.moveToSpecial(taskBto, StatusEnum.SEND_BACK_1212, userId);
} }
repelTaskStatisticalService.saveAllRepelTaskStatistical(list); repelTaskStatisticalService.saveAllRepelTaskStatistical(list);
...@@ -344,24 +346,24 @@ public class RepelBusinessServiceImpl implements RepelBusinessService { ...@@ -344,24 +346,24 @@ public class RepelBusinessServiceImpl implements RepelBusinessService {
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void cityInitiateRepel(DeviceRepel deviceRepel, Integer userId) { public void cityInitiateRepel(DeviceRepel deviceRepel, Integer userId) {
User user = userService.findByUser(userId); User user = userService.findByUser(userId);
Units units=unitsService.findById(user.getUnitsId()); Units units = unitsService.findById(user.getUnitsId());
Area area=areaService.findByid(units.getAreaId()); Area area = areaService.findByid(units.getAreaId());
Units unitsFather= unitsService.findByAreaId(units.getUnitId()); Units unitsFather = unitsService.findByAreaId(units.getUnitId());
deviceRepel.setFielding(StringUtils.ListToString(deviceRepel.getFieldingIds())); deviceRepel.setFielding(StringUtils.ListToString(deviceRepel.getFieldingIds()));
deviceRepel.setTaskScope(StringUtils.ListToString(deviceRepel.getTaskScopes())); deviceRepel.setTaskScope(StringUtils.ListToString(deviceRepel.getTaskScopes()));
deviceRepel.setFiles(FilesUtil.stringFileToList(deviceRepel.getFileRets())); deviceRepel.setFiles(FilesUtil.stringFileToList(deviceRepel.getFileRets()));
DeviceRepel deviceRepel1= deviceRepelService.saveDeviceRepel(deviceRepel); DeviceRepel deviceRepel1 = deviceRepelService.saveDeviceRepel(deviceRepel);
DeviceRepelDetail deviceRepelDetail=new DeviceRepelDetail(); DeviceRepelDetail deviceRepelDetail = new DeviceRepelDetail();
deviceRepelDetail.setRepelId(deviceRepel1.getId()); deviceRepelDetail.setRepelId(deviceRepel1.getId());
deviceRepelDetail.setRepelStatus(1); deviceRepelDetail.setRepelStatus(1);
TaskBto taskBto= cityInitiateTask(unitsFather.getUnitId(),deviceRepel1.getId(),deviceRepel.getTitle(),userId); TaskBto taskBto = cityInitiateTask(unitsFather.getUnitId(), deviceRepel1.getId(), deviceRepel.getTitle(), userId);
addMessage(new MessageBto(taskBto.getId(),taskBto.getBusinessType(),user.getName()+"发起清退任务["+deviceRepel1.getTitle()+"]",gainThisUser(userId,units.getUnitId()))); addMessage(new MessageBto(taskBto.getId(), taskBto.getBusinessType(), user.getName() + "发起清退任务[" + deviceRepel1.getTitle() + "]", gainThisUser(userId, units.getUnitId())));
} }
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void provinceAuditCity(Integer taskId, Integer userId,RepelAuditResult repelAuditResult) { public void provinceAuditCity(Integer taskId, Integer userId, RepelAuditResult repelAuditResult) {
// TaskBto taskBto=taskService.get(taskId); // TaskBto taskBto=taskService.get(taskId);
// TaskDisposeUtil.isNotSubmit(taskBto.getBillStatus(),StatusEnum.SEND_BACK_1211); // TaskDisposeUtil.isNotSubmit(taskBto.getBillStatus(),StatusEnum.SEND_BACK_1211);
// List<Integer> lifeStatus=new ArrayList<>(); // List<Integer> lifeStatus=new ArrayList<>();
...@@ -414,7 +416,7 @@ public class RepelBusinessServiceImpl implements RepelBusinessService { ...@@ -414,7 +416,7 @@ public class RepelBusinessServiceImpl implements RepelBusinessService {
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void resolveConfirm(Integer taskId,Integer userId) { public void resolveConfirm(Integer taskId, Integer userId) {
// 修改当前任务的状态 清退待提交装备审核 // 修改当前任务的状态 清退待提交装备审核
// 修改上级任务是否代办 // 修改上级任务是否代办
...@@ -422,25 +424,25 @@ public class RepelBusinessServiceImpl implements RepelBusinessService { ...@@ -422,25 +424,25 @@ public class RepelBusinessServiceImpl implements RepelBusinessService {
// 修改统计表中的数据信息 状态 // 修改统计表中的数据信息 状态
User user = userService.findByUser(userId); User user = userService.findByUser(userId);
TaskBto taskBto= taskService.get(taskId); TaskBto taskBto = taskService.get(taskId);
List<StatusEnum> list=new ArrayList<>(); List<StatusEnum> list = new ArrayList<>();
list.add(StatusEnum.SEND_BACK_1205); list.add(StatusEnum.SEND_BACK_1205);
list.add(StatusEnum.SEND_BACK_1203); list.add(StatusEnum.SEND_BACK_1203);
list.add(StatusEnum.SEND_BACK_1202); list.add(StatusEnum.SEND_BACK_1202);
list.add(StatusEnum.SEND_BACK_1201); list.add(StatusEnum.SEND_BACK_1201);
list.add(StatusEnum.SEND_BACK_1206); list.add(StatusEnum.SEND_BACK_1206);
TaskDisposeUtil.isNotSubmit(taskBto.getBillStatus(),list); TaskDisposeUtil.isNotSubmit(taskBto.getBillStatus(), list);
DeviceRepelDetail deviceRepelDetail= deviceRepelDetailService.findDeviceRepelDetailNoDev(taskBto.getBillId()); DeviceRepelDetail deviceRepelDetail = deviceRepelDetailService.findDeviceRepelDetailNoDev(taskBto.getBillId());
TaskBto parentTask= taskService.get(taskBto.getParentTaskId()); TaskBto parentTask = taskService.get(taskBto.getParentTaskId());
taskService.moveToSpecial(parentTask, GlobalMap.getStatusEnumMap().get(parentTask.getBillStatus()),0); taskService.moveToSpecial(parentTask, GlobalMap.getStatusEnumMap().get(parentTask.getBillStatus()), 0);
taskService.moveToSpecial(taskBto,StatusEnum.SEND_BACK_1207,-1); taskService.moveToSpecial(taskBto, StatusEnum.SEND_BACK_1207, -1);
RepelTaskStatistical repelTaskStatistical= repelTaskStatisticalService.findRepelTaskStatistical(taskBto.getId(),deviceRepelDetail.getRepelId()); RepelTaskStatistical repelTaskStatistical = repelTaskStatisticalService.findRepelTaskStatistical(taskBto.getId(), deviceRepelDetail.getRepelId());
repelTaskStatistical.setCount(StringUtils.stringToList(deviceRepelDetail.getDeviceIds()).size()); repelTaskStatistical.setCount(StringUtils.stringToList(deviceRepelDetail.getDeviceIds()).size());
repelTaskStatistical.setTaskStatus(3); repelTaskStatistical.setTaskStatus(3);
repelTaskStatisticalService.saveRepelTaskStatistical(repelTaskStatistical); repelTaskStatisticalService.saveRepelTaskStatistical(repelTaskStatistical);
deviceRepelDetailService.saveDeviceRepelDetail(deviceRepelDetail); deviceRepelDetailService.saveDeviceRepelDetail(deviceRepelDetail);
DeviceRepel deviceRepel= deviceRepelService.findDeviceRepel(deviceRepelDetail.getRepelId()); DeviceRepel deviceRepel = deviceRepelService.findDeviceRepel(deviceRepelDetail.getRepelId());
// addMessage(new MessageBto(taskBto.getId(),taskBto.getBusinessType(),user.getName()+"操作了["+deviceRepel.getTitle()+"]任务,选择了退回装备",gainThisUser(userId,user.getUnitsId()))); // addMessage(new MessageBto(taskBto.getId(),taskBto.getBusinessType(),user.getName()+"操作了["+deviceRepel.getTitle()+"]任务,选择了退回装备",gainThisUser(userId,user.getUnitsId())));
} }
...@@ -454,37 +456,36 @@ public class RepelBusinessServiceImpl implements RepelBusinessService { ...@@ -454,37 +456,36 @@ public class RepelBusinessServiceImpl implements RepelBusinessService {
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void submitChooseDevice(Integer taskId, ResolveConfirm resolveConfirm) { public void submitChooseDevice(Integer taskId, ResolveConfirm resolveConfirm) {
long stime=System.currentTimeMillis(); long stime = System.currentTimeMillis();
TaskBto taskBto= taskService.get(taskId); TaskBto taskBto = taskService.get(taskId);
deviceLibraryService.isInStockOrWaitRetired(resolveConfirm.getDevIds()); deviceLibraryService.isInStockOrWaitRetired(resolveConfirm.getDevIds());
List<StatusEnum> list=new ArrayList<>(); List<StatusEnum> list = new ArrayList<>();
list.add(StatusEnum.SEND_BACK_1205); list.add(StatusEnum.SEND_BACK_1205);
list.add(StatusEnum.SEND_BACK_1203); list.add(StatusEnum.SEND_BACK_1203);
list.add(StatusEnum.SEND_BACK_1202); list.add(StatusEnum.SEND_BACK_1202);
list.add(StatusEnum.SEND_BACK_1201); list.add(StatusEnum.SEND_BACK_1201);
list.add(StatusEnum.SEND_BACK_1206); list.add(StatusEnum.SEND_BACK_1206);
TaskDisposeUtil.isNotSubmit(taskBto.getBillStatus(),list); TaskDisposeUtil.isNotSubmit(taskBto.getBillStatus(), list);
log.info("提交装备接口开始{}",taskId); log.info("提交装备接口开始{}", taskId);
DeviceRepelDetail deviceRepelDetail= deviceRepelDetailService.findDeviceRepelDetailNoDev(taskBto.getBillId()); DeviceRepelDetail deviceRepelDetail = deviceRepelDetailService.findDeviceRepelDetailNoDev(taskBto.getBillId());
RepelTaskStatistical repelTaskStatistical= repelTaskStatisticalService.findRepelTaskStatistical(taskBto.getId(),deviceRepelDetail.getRepelId()); RepelTaskStatistical repelTaskStatistical = repelTaskStatisticalService.findRepelTaskStatistical(taskBto.getId(), deviceRepelDetail.getRepelId());
repelTaskStatistical.setCount(resolveConfirm.getDevIds().size()); repelTaskStatistical.setCount(resolveConfirm.getDevIds().size());
//装备状态改为锁定 //装备状态改为锁定
if (resolveConfirm.getDevIds()!=null&&resolveConfirm.getDevIds().size()!=0) { if (resolveConfirm.getDevIds() != null && resolveConfirm.getDevIds().size() != 0) {
deviceLibraryDao.upDateLockStatus(1, resolveConfirm.getDevIds()); deviceLibraryDao.upDateLockStatus(1, resolveConfirm.getDevIds());
} }
deviceRepelDetail.setDeviceIds(StringUtils.ListToString(resolveConfirm.getDevIds())); deviceRepelDetail.setDeviceIds(StringUtils.ListToString(resolveConfirm.getDevIds()));
if (resolveConfirm.getDes()!=null&&!resolveConfirm.getDes().equals("")) { if (resolveConfirm.getDes() != null && !resolveConfirm.getDes().equals("")) {
deviceRepelDetail.setSubmitDescription(resolveConfirm.getDes()); deviceRepelDetail.setSubmitDescription(resolveConfirm.getDes());
repelTaskStatistical.setDes(resolveConfirm.getDes()); repelTaskStatistical.setDes(resolveConfirm.getDes());
} }
repelTaskStatisticalService.saveRepelTaskStatistical(repelTaskStatistical); repelTaskStatisticalService.saveRepelTaskStatistical(repelTaskStatistical);
deviceRepelDetailService.saveDeviceRepelDetail(deviceRepelDetail); deviceRepelDetailService.saveDeviceRepelDetail(deviceRepelDetail);
log.info("提交装备接口结束{}",System.currentTimeMillis()-stime); log.info("提交装备接口结束{}", System.currentTimeMillis() - stime);
} }
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void resolveAudit(Integer taskId, RepelAuditResult repelAuditResult) { public void resolveAudit(Integer taskId, RepelAuditResult repelAuditResult) {
...@@ -495,27 +496,27 @@ public class RepelBusinessServiceImpl implements RepelBusinessService { ...@@ -495,27 +496,27 @@ public class RepelBusinessServiceImpl implements RepelBusinessService {
// 修改统计表中的数据信息 状态 // 修改统计表中的数据信息 状态
TaskBto taskBto = taskService.get(taskId); TaskBto taskBto = taskService.get(taskId);
TaskDisposeUtil.isNotSubmit(taskBto.getBillStatus(),StatusEnum.SEND_BACK_1207); TaskDisposeUtil.isNotSubmit(taskBto.getBillStatus(), StatusEnum.SEND_BACK_1207);
DeviceRepelDetail deviceRepelDetail= deviceRepelDetailService.findDeviceRepelDetail(taskBto.getBillId()); DeviceRepelDetail deviceRepelDetail = deviceRepelDetailService.findDeviceRepelDetail(taskBto.getBillId());
RepelTaskStatistical repelTaskStatistical= repelTaskStatisticalService.findRepelTaskStatistical(taskBto.getId(),deviceRepelDetail.getRepelId()); RepelTaskStatistical repelTaskStatistical = repelTaskStatisticalService.findRepelTaskStatistical(taskBto.getId(), deviceRepelDetail.getRepelId());
repelTaskStatistical.setTaskStatus(0); repelTaskStatistical.setTaskStatus(0);
//1 审核通过 //1 审核通过
if (repelAuditResult.getType()==1){ if (repelAuditResult.getType() == 1) {
List<Integer> list= StringUtils.stringToList(deviceRepelDetail.getDeviceIds()); List<Integer> list = StringUtils.stringToList(deviceRepelDetail.getDeviceIds());
repelTaskStatistical.setTaskStatus(5); repelTaskStatistical.setTaskStatus(5);
if (list!=null&&list.size()!=0) { if (list != null && list.size() != 0) {
taskService.moveToSpecial(taskBto, StatusEnum.SEND_BACK_1208, 0); taskService.moveToSpecial(taskBto, StatusEnum.SEND_BACK_1208, 0);
}else { } else {
taskBto = taskService.moveToEnd(taskBto); taskBto = taskService.moveToEnd(taskBto);
deviceRepelDetail.setRepelStatus(3); deviceRepelDetail.setRepelStatus(3);
repelTaskStatistical.setTaskStatus(1); repelTaskStatistical.setTaskStatus(1);
// addMessage(new MessageBto(taskBto.getId(),taskBto.getBusinessType(),"清退任务审核通过,无提交装备任务结束",findUnitId(taskBto.getOwnUnit()))); // addMessage(new MessageBto(taskBto.getId(),taskBto.getBusinessType(),"清退任务审核通过,无提交装备任务结束",findUnitId(taskBto.getOwnUnit())));
} }
}else { } else {
//审核失败 //审核失败
taskService.moveToSpecial(taskBto,StatusEnum.SEND_BACK_1206,0); taskService.moveToSpecial(taskBto, StatusEnum.SEND_BACK_1206, 0);
if (deviceRepelDetail.getDeviceIds()!=null&&!deviceRepelDetail.getDeviceIds().equals("")) { if (deviceRepelDetail.getDeviceIds() != null && !deviceRepelDetail.getDeviceIds().equals("")) {
deviceLibraryDao.upDateLockStatus(0, StringUtils.stringToList(deviceRepelDetail.getDeviceIds())); deviceLibraryDao.upDateLockStatus(0, StringUtils.stringToList(deviceRepelDetail.getDeviceIds()));
deviceRepelDetail.setDeviceIds(null); deviceRepelDetail.setDeviceIds(null);
} }
...@@ -524,73 +525,72 @@ public class RepelBusinessServiceImpl implements RepelBusinessService { ...@@ -524,73 +525,72 @@ public class RepelBusinessServiceImpl implements RepelBusinessService {
deviceRepelDetail.setAuditingFeedback(repelAuditResult.getDes()); deviceRepelDetail.setAuditingFeedback(repelAuditResult.getDes());
deviceRepelDetailService.saveDeviceRepelDetail(deviceRepelDetail); deviceRepelDetailService.saveDeviceRepelDetail(deviceRepelDetail);
// 判读是否还有需要审核待task // 判读是否还有需要审核待task
isCommission(taskBto,deviceRepelDetail.getRepelId()); isCommission(taskBto, deviceRepelDetail.getRepelId());
isEnd(taskBto,deviceRepelDetail.getRepelId()); isEnd(taskBto, deviceRepelDetail.getRepelId());
} }
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public DeviceRepelDetail sendBackOutCheck(Integer taskId, Integer userId, OrderOutData orderOutData) { public DeviceRepelDetail sendBackOutCheck(Integer taskId, Integer userId, OrderOutData orderOutData) {
User user = userService.findByUser(userId); User user = userService.findByUser(userId);
Units units=unitsService.findById(user.getUnitsId()); Units units = unitsService.findById(user.getUnitsId());
TaskBto taskBto= taskService.get(taskId); TaskBto taskBto = taskService.get(taskId);
List<StatusEnum> statusEnums=new ArrayList<>(); List<StatusEnum> statusEnums = new ArrayList<>();
statusEnums.add(StatusEnum.SEND_BACK_1205); statusEnums.add(StatusEnum.SEND_BACK_1205);
statusEnums.add(StatusEnum.SEND_BACK_1206); statusEnums.add(StatusEnum.SEND_BACK_1206);
statusEnums.add(StatusEnum.SEND_BACK_1208); statusEnums.add(StatusEnum.SEND_BACK_1208);
statusEnums.add(StatusEnum.SEND_BACK_1219); statusEnums.add(StatusEnum.SEND_BACK_1219);
TaskDisposeUtil.isNotSubmit(taskBto.getBillStatus(),statusEnums); TaskDisposeUtil.isNotSubmit(taskBto.getBillStatus(), statusEnums);
DeviceRepelDetail deviceRepelDetail = deviceRepelDetailService.findDeviceRepelDetail(taskBto.getBillId()); DeviceRepelDetail deviceRepelDetail = deviceRepelDetailService.findDeviceRepelDetail(taskBto.getBillId());
DeviceRepelDetail orderOutDataRepelDetail = orderOutData.toTrainDetailsVo(); DeviceRepelDetail orderOutDataRepelDetail = orderOutData.toTrainDetailsVo();
orderOutDataRepelDetail.setId(deviceRepelDetail.getId()); orderOutDataRepelDetail.setId(deviceRepelDetail.getId());
orderOutDataRepelDetail.setRepelId(deviceRepelDetail.getRepelId()); orderOutDataRepelDetail.setRepelId(deviceRepelDetail.getRepelId());
orderOutDataRepelDetail.setDeviceIds(deviceRepelDetail.getDeviceIds()); orderOutDataRepelDetail.setDeviceIds(deviceRepelDetail.getDeviceIds());
orderOutDataRepelDetail.setCreateTime(deviceRepelDetail.getCreateTime()); orderOutDataRepelDetail.setCreateTime(deviceRepelDetail.getCreateTime());
orderOutDataRepelDetail.setCreateUserId(deviceRepelDetail.getCreateUserId()); orderOutDataRepelDetail.setCreateUserId(deviceRepelDetail.getCreateUserId());
orderOutDataRepelDetail.setRightSignatureId(UUID.randomUUID().toString()); orderOutDataRepelDetail.setRightSignatureId(UUID.randomUUID().toString());
orderOutDataRepelDetail.setNum("NO:第"+ LocalDateTime.now().getYear()+"QT"+taskBto.getBillId()); orderOutDataRepelDetail.setNum("NO:第" + LocalDateTime.now().getYear() + "QT" + taskBto.getBillId());
orderOutDataRepelDetail.setReplyFiles(FilesUtil.stringFileToList(orderOutData.getReplyFileList())); orderOutDataRepelDetail.setReplyFiles(FilesUtil.stringFileToList(orderOutData.getReplyFileList()));
orderOutDataRepelDetail.setSendFiles(FilesUtil.stringFileToList(orderOutData.getSendFileList())); orderOutDataRepelDetail.setSendFiles(FilesUtil.stringFileToList(orderOutData.getSendFileList()));
orderOutDataRepelDetail.setScriptJson(JacksonUtil.toJSon(orderOutData.getScriptSaveVos())); orderOutDataRepelDetail.setScriptJson(JacksonUtil.toJSon(orderOutData.getScriptSaveVos()));
orderOutDataRepelDetail.setScripts(orderOutData.getScriptSaveVos()); orderOutDataRepelDetail.setScripts(orderOutData.getScriptSaveVos());
orderOutDataRepelDetail.setReplyFiles(FilesUtil.stringFileToList(orderOutData.getReplyFileList())); orderOutDataRepelDetail.setReplyFiles(FilesUtil.stringFileToList(orderOutData.getReplyFileList()));
orderOutDataRepelDetail.setApplyFiles(FilesUtil.stringFileToList(orderOutData.getApplyFileList())); orderOutDataRepelDetail.setApplyFiles(FilesUtil.stringFileToList(orderOutData.getApplyFileList()));
deviceRepelDetailService.saveDeviceRepelDetail(orderOutDataRepelDetail); deviceRepelDetailService.saveDeviceRepelDetail(orderOutDataRepelDetail);
deviceLibraryDao.upDateLeftStatus(DeviceLifeStatus.SEND_BACK_IN.id,StringUtils.stringToList(orderOutDataRepelDetail.getDeviceIds())); deviceLibraryDao.upDateLeftStatus(DeviceLifeStatus.SEND_BACK_IN.id, StringUtils.stringToList(orderOutDataRepelDetail.getDeviceIds()));
taskBto.setCreateUserId(userId); taskBto.setCreateUserId(userId);
taskBto.setOwnUnit(orderOutData.getReceiveUnitId()); taskBto.setOwnUnit(orderOutData.getReceiveUnitId());
taskService.moveToSpecial(taskBto,StatusEnum.SEND_BACK_1209,0); taskService.moveToSpecial(taskBto, StatusEnum.SEND_BACK_1209, 0);
DeviceRepel deviceRepel= deviceRepelService.findDeviceRepel(deviceRepelDetail.getRepelId()); DeviceRepel deviceRepel = deviceRepelService.findDeviceRepel(deviceRepelDetail.getRepelId());
waitingReceiptsTask(orderOutData.getSendUnitId(),deviceRepelDetail.getId(),taskBto.getId(),taskBto.getTitle(),userId); waitingReceiptsTask(orderOutData.getSendUnitId(), deviceRepelDetail.getId(), taskBto.getId(), taskBto.getTitle(), userId);
addMessage(new MessageBto(taskBto.getId(),taskBto.getBusinessType(),"清退设备出库完成",gainThisUser(userId,user.getUnitsId()))); addMessage(new MessageBto(taskBto.getId(), taskBto.getBusinessType(), "清退设备出库完成", gainThisUser(userId, user.getUnitsId())));
devLogAdd(findInvoleDevice(deviceRepelDetail.getDeviceIds()),deviceRepelDetail.getSendUnit()+"装备清退出库"+",等待接收",userId,taskBto.getId()); devLogAdd(findInvoleDevice(deviceRepelDetail.getDeviceIds()), deviceRepelDetail.getSendUnit() + "装备清退出库" + ",等待接收", userId, taskBto.getId());
orderOutDataRepelDetail.setDeviceLibraryEntities(findInvoleDevice(deviceRepelDetail.getDeviceIds())); orderOutDataRepelDetail.setDeviceLibraryEntities(findInvoleDevice(deviceRepelDetail.getDeviceIds()));
//把一些字段填写到对象中,保存入库 //把一些字段填写到对象中,保存入库
//把任务状态修改为 清退提交装备待接收 //把任务状态修改为 清退提交装备待接收
return orderOutDataRepelDetail; return orderOutDataRepelDetail;
} }
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void sealOfAudit(Integer taskId, Integer userId,OrderOutData orderOutData) { public void sealOfAudit(Integer taskId, Integer userId, OrderOutData orderOutData) {
TaskBto taskBto= taskService.get(taskId); TaskBto taskBto = taskService.get(taskId);
MemberThat memberThat = userService.findById(orderOutData.getSendUserbId()); MemberThat memberThat = userService.findById(orderOutData.getSendUserbId());
List<StatusEnum> statusEnums=new ArrayList<>(); List<StatusEnum> statusEnums = new ArrayList<>();
statusEnums.add(StatusEnum.SEND_BACK_1205); statusEnums.add(StatusEnum.SEND_BACK_1205);
statusEnums.add(StatusEnum.SEND_BACK_1206); statusEnums.add(StatusEnum.SEND_BACK_1206);
statusEnums.add(StatusEnum.SEND_BACK_1208); statusEnums.add(StatusEnum.SEND_BACK_1208);
TaskDisposeUtil.isNotSubmit(taskBto.getBillStatus(),statusEnums); TaskDisposeUtil.isNotSubmit(taskBto.getBillStatus(), statusEnums);
DeviceRepelDetail deviceRepelDetail=deviceRepelDetailService.findDeviceRepelDetail(taskBto.getBillId()); DeviceRepelDetail deviceRepelDetail = deviceRepelDetailService.findDeviceRepelDetail(taskBto.getBillId());
DeviceRepelDetail orderOutDataRepelDetail =orderOutData.toTrainDetailsVo(); DeviceRepelDetail orderOutDataRepelDetail = orderOutData.toTrainDetailsVo();
orderOutDataRepelDetail.setId(deviceRepelDetail.getId()); orderOutDataRepelDetail.setId(deviceRepelDetail.getId());
orderOutDataRepelDetail.setRepelId(deviceRepelDetail.getRepelId()); orderOutDataRepelDetail.setRepelId(deviceRepelDetail.getRepelId());
orderOutDataRepelDetail.setCreateTime(deviceRepelDetail.getCreateTime()); orderOutDataRepelDetail.setCreateTime(deviceRepelDetail.getCreateTime());
orderOutDataRepelDetail.setCreateUserId(deviceRepelDetail.getCreateUserId()); orderOutDataRepelDetail.setCreateUserId(deviceRepelDetail.getCreateUserId());
orderOutDataRepelDetail.setDeviceIds(deviceRepelDetail.getDeviceIds()); orderOutDataRepelDetail.setDeviceIds(deviceRepelDetail.getDeviceIds());
orderOutDataRepelDetail.setRightSignatureId(UUID.randomUUID().toString()); orderOutDataRepelDetail.setRightSignatureId(UUID.randomUUID().toString());
orderOutDataRepelDetail.setNum("NO:第"+ LocalDateTime.now().getYear()+"QT"+taskBto.getBillId()); orderOutDataRepelDetail.setNum("NO:第" + LocalDateTime.now().getYear() + "QT" + taskBto.getBillId());
orderOutDataRepelDetail.setReplyFiles(FilesUtil.stringFileToList(orderOutData.getReplyFileList())); orderOutDataRepelDetail.setReplyFiles(FilesUtil.stringFileToList(orderOutData.getReplyFileList()));
orderOutDataRepelDetail.setSendFiles(FilesUtil.stringFileToList(orderOutData.getSendFileList())); orderOutDataRepelDetail.setSendFiles(FilesUtil.stringFileToList(orderOutData.getSendFileList()));
orderOutDataRepelDetail.setScriptJson(JacksonUtil.toJSon(orderOutData.getScriptSaveVos())); orderOutDataRepelDetail.setScriptJson(JacksonUtil.toJSon(orderOutData.getScriptSaveVos()));
...@@ -598,62 +598,62 @@ public class RepelBusinessServiceImpl implements RepelBusinessService { ...@@ -598,62 +598,62 @@ public class RepelBusinessServiceImpl implements RepelBusinessService {
orderOutDataRepelDetail.setReplyFiles(FilesUtil.stringFileToList(orderOutData.getReplyFileList())); orderOutDataRepelDetail.setReplyFiles(FilesUtil.stringFileToList(orderOutData.getReplyFileList()));
orderOutDataRepelDetail.setApplyFiles(FilesUtil.stringFileToList(orderOutData.getApplyFileList())); orderOutDataRepelDetail.setApplyFiles(FilesUtil.stringFileToList(orderOutData.getApplyFileList()));
deviceRepelDetailService.saveDeviceRepelDetail(orderOutDataRepelDetail); deviceRepelDetailService.saveDeviceRepelDetail(orderOutDataRepelDetail);
taskService.moveToSpecial(taskBto,StatusEnum.SEND_BACK_1217,orderOutData.getSendUserbId()); taskService.moveToSpecial(taskBto, StatusEnum.SEND_BACK_1217, orderOutData.getSendUserbId());
} }
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void sendSealOfAudit(Integer taskId, Integer userId, StorageDeviceRepel storageDeviceRepel) { public void sendSealOfAudit(Integer taskId, Integer userId, StorageDeviceRepel storageDeviceRepel) {
TaskBto taskBto= taskService.get(taskId); TaskBto taskBto = taskService.get(taskId);
List<StatusEnum> enumList=new ArrayList<>(); List<StatusEnum> enumList = new ArrayList<>();
enumList.add(StatusEnum.SEND_BACK_1209); enumList.add(StatusEnum.SEND_BACK_1209);
enumList.add(StatusEnum.SEND_BACK_1213); enumList.add(StatusEnum.SEND_BACK_1213);
enumList.add(StatusEnum.SEND_BACK_1215); enumList.add(StatusEnum.SEND_BACK_1215);
TaskDisposeUtil.isNotSubmit(taskBto.getBillStatus(),enumList); TaskDisposeUtil.isNotSubmit(taskBto.getBillStatus(), enumList);
DeviceRepelDetail deviceRepelDetail=deviceRepelDetailService.findDeviceRepelDetail(taskBto.getBillId()); DeviceRepelDetail deviceRepelDetail = deviceRepelDetailService.findDeviceRepelDetail(taskBto.getBillId());
if (storageDeviceRepel.getUserBName()!=null) { if (storageDeviceRepel.getUserBName() != null) {
deviceRepelDetail.setReceiveUserB(storageDeviceRepel.getUserBName()); deviceRepelDetail.setReceiveUserB(storageDeviceRepel.getUserBName());
} }
if (storageDeviceRepel.getUserB()!=null) { if (storageDeviceRepel.getUserB() != null) {
deviceRepelDetail.setReceiveUserbId(storageDeviceRepel.getUserB()); deviceRepelDetail.setReceiveUserbId(storageDeviceRepel.getUserB());
} }
if (storageDeviceRepel.getUserAName()!=null) { if (storageDeviceRepel.getUserAName() != null) {
deviceRepelDetail.setReceiveUserA(storageDeviceRepel.getUserAName()); deviceRepelDetail.setReceiveUserA(storageDeviceRepel.getUserAName());
} }
if (storageDeviceRepel.getUserA()!=null) { if (storageDeviceRepel.getUserA() != null) {
deviceRepelDetail.setReceiveUseraId(storageDeviceRepel.getUserA()); deviceRepelDetail.setReceiveUseraId(storageDeviceRepel.getUserA());
} }
deviceRepelDetailService.saveDeviceRepelDetail(deviceRepelDetail); deviceRepelDetailService.saveDeviceRepelDetail(deviceRepelDetail);
taskService.moveToSpecial(taskBto,StatusEnum.SEND_BACK_1220,storageDeviceRepel.getUserB()); taskService.moveToSpecial(taskBto, StatusEnum.SEND_BACK_1220, storageDeviceRepel.getUserB());
} }
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void outSealOfAuditEnd(Integer taskId, Integer reviewTheResults) { public void outSealOfAuditEnd(Integer taskId, Integer reviewTheResults) {
TaskBto taskBto= taskService.get(taskId); TaskBto taskBto = taskService.get(taskId);
if (reviewTheResults==0){ if (reviewTheResults == 0) {
taskService.moveToSpecial(taskBto,StatusEnum.SEND_BACK_1219,0); taskService.moveToSpecial(taskBto, StatusEnum.SEND_BACK_1219, 0);
}else { } else {
DeviceRepelDetail deviceRepelDetail=deviceRepelDetailService.findDeviceRepelDetail(taskBto.getBillId()); DeviceRepelDetail deviceRepelDetail = deviceRepelDetailService.findDeviceRepelDetail(taskBto.getBillId());
deviceRepelDetail.setSenderUserB(null); deviceRepelDetail.setSenderUserB(null);
deviceRepelDetail.setSendUserbId(null); deviceRepelDetail.setSendUserbId(null);
deviceRepelDetailService.saveDeviceRepelDetail(deviceRepelDetail); deviceRepelDetailService.saveDeviceRepelDetail(deviceRepelDetail);
taskService.moveToSpecial(taskBto,StatusEnum.SEND_BACK_1208,deviceRepelDetail.getSendUseraId()); taskService.moveToSpecial(taskBto, StatusEnum.SEND_BACK_1208, deviceRepelDetail.getSendUseraId());
} }
} }
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void sendSealOfAuditEnd(Integer taskId, Integer reviewTheResults) { public void sendSealOfAuditEnd(Integer taskId, Integer reviewTheResults) {
TaskBto taskBto= taskService.get(taskId); TaskBto taskBto = taskService.get(taskId);
if (reviewTheResults==0){ if (reviewTheResults == 0) {
taskService.moveToSpecial(taskBto,StatusEnum.SEND_BACK_1218,0); taskService.moveToSpecial(taskBto, StatusEnum.SEND_BACK_1218, 0);
}else { } else {
DeviceRepelDetail deviceRepelDetail=deviceRepelDetailService.findDeviceRepelDetail(taskBto.getBillId()); DeviceRepelDetail deviceRepelDetail = deviceRepelDetailService.findDeviceRepelDetail(taskBto.getBillId());
deviceRepelDetail.setReceiveUserbId(null); deviceRepelDetail.setReceiveUserbId(null);
deviceRepelDetail.setReceiveUserB(null); deviceRepelDetail.setReceiveUserB(null);
deviceRepelDetailService.saveDeviceRepelDetail(deviceRepelDetail); deviceRepelDetailService.saveDeviceRepelDetail(deviceRepelDetail);
taskService.moveToSpecial(taskBto,StatusEnum.SEND_BACK_1209,deviceRepelDetail.getReceiveUseraId()); taskService.moveToSpecial(taskBto, StatusEnum.SEND_BACK_1209, deviceRepelDetail.getReceiveUseraId());
} }
} }
...@@ -664,135 +664,135 @@ public class RepelBusinessServiceImpl implements RepelBusinessService { ...@@ -664,135 +664,135 @@ public class RepelBusinessServiceImpl implements RepelBusinessService {
//是 直接入库 任务完结 //是 直接入库 任务完结
//否 状态改为入库待补充文件 //否 状态改为入库待补充文件
//修改统计表中的数据信息 状态 //修改统计表中的数据信息 状态
User user=userService.findByUser(storageDeviceRepel.getUserId()); User user = userService.findByUser(storageDeviceRepel.getUserId());
Units units = unitsService.findById(user.getUnitsId()); Units units = unitsService.findById(user.getUnitsId());
List<RepelDeviceUnit> list=new ArrayList<>(); List<RepelDeviceUnit> list = new ArrayList<>();
TaskBto taskBto= taskService.get(taskId); TaskBto taskBto = taskService.get(taskId);
DeviceRepelDetail deviceRepelDetail = deviceRepelDetailService.findDeviceRepelDetail(taskBto.getBillId()); DeviceRepelDetail deviceRepelDetail = deviceRepelDetailService.findDeviceRepelDetail(taskBto.getBillId());
DeviceRepel deviceRepel= deviceRepelService.findDeviceRepel(deviceRepelDetail.getRepelId()); DeviceRepel deviceRepel = deviceRepelService.findDeviceRepel(deviceRepelDetail.getRepelId());
if (storageDeviceRepel.getUserBName()!=null) { if (storageDeviceRepel.getUserBName() != null) {
deviceRepelDetail.setReceiveUserB(storageDeviceRepel.getUserBName()); deviceRepelDetail.setReceiveUserB(storageDeviceRepel.getUserBName());
} }
if (storageDeviceRepel.getUserB()!=null){ if (storageDeviceRepel.getUserB() != null) {
deviceRepelDetail.setReceiveUserbId(storageDeviceRepel.getUserB()); deviceRepelDetail.setReceiveUserbId(storageDeviceRepel.getUserB());
} }
if (storageDeviceRepel.getUserA()!=null){ if (storageDeviceRepel.getUserA() != null) {
deviceRepelDetail.setReceiveUseraId(storageDeviceRepel.getUserA()); deviceRepelDetail.setReceiveUseraId(storageDeviceRepel.getUserA());
} }
if (storageDeviceRepel.getUserAName()!=null) { if (storageDeviceRepel.getUserAName() != null) {
deviceRepelDetail.setReceiveUserA(storageDeviceRepel.getUserAName()); deviceRepelDetail.setReceiveUserA(storageDeviceRepel.getUserAName());
} }
if (storageDeviceRepel.getSenderId()!=null) { if (storageDeviceRepel.getSenderId() != null) {
deviceRepelDetail.setSendUserbId(storageDeviceRepel.getSenderId()); deviceRepelDetail.setSendUserbId(storageDeviceRepel.getSenderId());
} }
if (storageDeviceRepel.getSenderName()!=null) { if (storageDeviceRepel.getSenderName() != null) {
deviceRepelDetail.setSenderUserB(storageDeviceRepel.getSenderName()); deviceRepelDetail.setSenderUserB(storageDeviceRepel.getSenderName());
} }
//获取相关单位的id集合 //获取相关单位的id集合
List<Integer> unitIds=new ArrayList<>(); List<Integer> unitIds = new ArrayList<>();
unitIds.add(deviceRepelDetail.getSendUnitId()); unitIds.add(deviceRepelDetail.getSendUnitId());
unitIds.add(deviceRepelDetail.getReceiveUnitId()); unitIds.add(deviceRepelDetail.getReceiveUnitId());
//判断是否为入库单据待补充 还是直接入库。 //判断是否为入库单据待补充 还是直接入库。
RepelTaskStatistical repelTaskStatistical = repelTaskStatisticalService.findRepelTaskStatistical(taskBto.getId(),deviceRepelDetail.getRepelId()); RepelTaskStatistical repelTaskStatistical = repelTaskStatisticalService.findRepelTaskStatistical(taskBto.getId(), deviceRepelDetail.getRepelId());
if (storageDeviceRepel.getFileRets()!=null&&storageDeviceRepel.getFileRets().size()!=0) { if (storageDeviceRepel.getFileRets() != null && storageDeviceRepel.getFileRets().size() != 0) {
List<StatusEnum> enumList=new ArrayList<>(); List<StatusEnum> enumList = new ArrayList<>();
enumList.add(StatusEnum.SEND_BACK_1209); enumList.add(StatusEnum.SEND_BACK_1209);
enumList.add(StatusEnum.SEND_BACK_1213); enumList.add(StatusEnum.SEND_BACK_1213);
enumList.add(StatusEnum.SEND_BACK_1215); enumList.add(StatusEnum.SEND_BACK_1215);
enumList.add(StatusEnum.SEND_BACK_1218); enumList.add(StatusEnum.SEND_BACK_1218);
TaskDisposeUtil.isNotSubmit(taskBto.getBillStatus(),enumList); TaskDisposeUtil.isNotSubmit(taskBto.getBillStatus(), enumList);
deviceRepelDetail.setBillFile(FilesUtil.stringFileToList(storageDeviceRepel.getFileRets())); deviceRepelDetail.setBillFile(FilesUtil.stringFileToList(storageDeviceRepel.getFileRets()));
deviceRepelDetail.setRepelStatus(2); deviceRepelDetail.setRepelStatus(2);
repelTaskStatistical.setTaskStatus(1); repelTaskStatistical.setTaskStatus(1);
if (units.getLevel()==1){ if (units.getLevel() == 1) {
deviceLibraryDao.upDateLeftStatusAndUnitNameAndLockStatus(filterTypeReturnLeftStatus(deviceRepel.getType()), deviceRepelDetail.getReceiveUnit(), 0, StringUtils.stringToList(deviceRepelDetail.getDeviceIds())); deviceLibraryDao.upDateLeftStatusAndUnitNameAndLockStatus(filterTypeReturnLeftStatus(deviceRepel.getType()), deviceRepelDetail.getReceiveUnit(), 0, StringUtils.stringToList(deviceRepelDetail.getDeviceIds()));
}else { } else {
deviceLibraryDao.upDateLeftStatusAndUnitNameAndLockStatus(DeviceLifeStatus.IN_LIBRARY.id, deviceRepelDetail.getReceiveUnit(), 0, StringUtils.stringToList(deviceRepelDetail.getDeviceIds())); deviceLibraryDao.upDateLeftStatusAndUnitNameAndLockStatus(DeviceLifeStatus.IN_LIBRARY.id, deviceRepelDetail.getReceiveUnit(), 0, StringUtils.stringToList(deviceRepelDetail.getDeviceIds()));
} }
List<DeviceLibrary> libraries = findInvoleDevice(deviceRepelDetail.getDeviceIds()); List<DeviceLibrary> libraries = findInvoleDevice(deviceRepelDetail.getDeviceIds());
libraries.forEach( libraries.forEach(
deviceLibrary -> { deviceLibrary -> {
list.add(new RepelDeviceUnit(deviceLibrary.getId(),deviceRepelDetail.getSendUnitId())); list.add(new RepelDeviceUnit(deviceLibrary.getId(), deviceRepelDetail.getSendUnitId()));
}); });
//添加根据type修改装备状态 //添加根据type修改装备状态
repelDeviceUnitService.saveAllRepelDeviceUnit(list); repelDeviceUnitService.saveAllRepelDeviceUnit(list);
taskService.moveToEnd(taskBto); taskService.moveToEnd(taskBto);
taskService.moveToEnd(taskService.findBillTypeAndFatherId(BusinessEnum.SEND_BACK.id,taskId)); taskService.moveToEnd(taskService.findBillTypeAndFatherId(BusinessEnum.SEND_BACK.id, taskId));
taskService.moveToArchive(taskService.findBillTypeAndFatherId(BusinessEnum.SEND_BACK.id,taskId)); taskService.moveToArchive(taskService.findBillTypeAndFatherId(BusinessEnum.SEND_BACK.id, taskId));
devLogAdd(findInvoleDevice(deviceRepelDetail.getDeviceIds()),"签收"+deviceRepelDetail.getSendUnit()+"清退的设备",storageDeviceRepel.getUserId(),taskBto.getId()); devLogAdd(findInvoleDevice(deviceRepelDetail.getDeviceIds()), "签收" + deviceRepelDetail.getSendUnit() + "清退的设备", storageDeviceRepel.getUserId(), taskBto.getId());
addMessage(new MessageBto(taskBto.getId(),taskBto.getBusinessType(),"签收"+deviceRepelDetail.getSendUnit()+"清退的设备",findUnitIds(user.getUserId(),unitIds))); addMessage(new MessageBto(taskBto.getId(), taskBto.getBusinessType(), "签收" + deviceRepelDetail.getSendUnit() + "清退的设备", findUnitIds(user.getUserId(), unitIds)));
} else { } else {
if (storageDeviceRepel.getIsIgnore()==null) { if (storageDeviceRepel.getIsIgnore() == null) {
List<StatusEnum> enumList=new ArrayList<>(); List<StatusEnum> enumList = new ArrayList<>();
enumList.add(StatusEnum.SEND_BACK_1209); enumList.add(StatusEnum.SEND_BACK_1209);
enumList.add(StatusEnum.SEND_BACK_1218); enumList.add(StatusEnum.SEND_BACK_1218);
//判断当前状态是否为SEND_BACK_1209 清退装备等待入库 //判断当前状态是否为SEND_BACK_1209 清退装备等待入库
TaskDisposeUtil.isNotSubmit(taskBto.getBillStatus(),enumList); TaskDisposeUtil.isNotSubmit(taskBto.getBillStatus(), enumList);
repelTaskStatistical.setTaskStatus(4); repelTaskStatistical.setTaskStatus(4);
taskService.moveToSpecial(taskBto, StatusEnum.SEND_BACK_1215, 0); taskService.moveToSpecial(taskBto, StatusEnum.SEND_BACK_1215, 0);
}else { } else {
repelTaskStatistical.setTaskStatus(1); repelTaskStatistical.setTaskStatus(1);
if (units.getLevel()==1){ if (units.getLevel() == 1) {
deviceLibraryDao.upDateLeftStatusAndUnitNameAndLockStatus(filterTypeReturnLeftStatus(deviceRepel.getType()), deviceRepelDetail.getReceiveUnit(), 0, StringUtils.stringToList(deviceRepelDetail.getDeviceIds())); deviceLibraryDao.upDateLeftStatusAndUnitNameAndLockStatus(filterTypeReturnLeftStatus(deviceRepel.getType()), deviceRepelDetail.getReceiveUnit(), 0, StringUtils.stringToList(deviceRepelDetail.getDeviceIds()));
}else { } else {
deviceLibraryDao.upDateLeftStatusAndUnitNameAndLockStatus(DeviceLifeStatus.SEND_BACK.id, deviceRepelDetail.getReceiveUnit(), 0, StringUtils.stringToList(deviceRepelDetail.getDeviceIds())); deviceLibraryDao.upDateLeftStatusAndUnitNameAndLockStatus(DeviceLifeStatus.SEND_BACK.id, deviceRepelDetail.getReceiveUnit(), 0, StringUtils.stringToList(deviceRepelDetail.getDeviceIds()));
} }
taskService.moveToEnd(taskBto); taskService.moveToEnd(taskBto);
taskService.moveToEnd(taskService.findBillTypeAndFatherId(BusinessEnum.SEND_BACK.id,taskId)); taskService.moveToEnd(taskService.findBillTypeAndFatherId(BusinessEnum.SEND_BACK.id, taskId));
taskService.moveToArchive(taskService.findBillTypeAndFatherId(BusinessEnum.SEND_BACK.id,taskId)); taskService.moveToArchive(taskService.findBillTypeAndFatherId(BusinessEnum.SEND_BACK.id, taskId));
devLogAdd(findInvoleDevice(deviceRepelDetail.getDeviceIds()),"签收"+deviceRepelDetail.getSendUnit()+"清退的设备",storageDeviceRepel.getUserId(),taskBto.getId()); devLogAdd(findInvoleDevice(deviceRepelDetail.getDeviceIds()), "签收" + deviceRepelDetail.getSendUnit() + "清退的设备", storageDeviceRepel.getUserId(), taskBto.getId());
Documents documents= deviceRepelDetail.toDoc(); Documents documents = deviceRepelDetail.toDoc();
documents.setSrcA(storageDeviceRepel.getSrcA()); documents.setSrcA(storageDeviceRepel.getSrcA());
documents.setSrcB(storageDeviceRepel.getSrcB()); documents.setSrcB(storageDeviceRepel.getSrcB());
documents.setScriptSaveVos(JacksonUtil.readValue(deviceRepelDetail.getScriptJson(), new TypeReference<List<ScriptSaveVo>>() { documents.setScriptSaveVos(JacksonUtil.readValue(deviceRepelDetail.getScriptJson(), new TypeReference<List<ScriptSaveVo>>() {
})); }));
List<DeviceLibrary> libraries = findInvoleDevice(deviceRepelDetail.getDeviceIds()); List<DeviceLibrary> libraries = findInvoleDevice(deviceRepelDetail.getDeviceIds());
libraries.forEach( libraries.forEach(
deviceLibrary -> { deviceLibrary -> {
list.add(new RepelDeviceUnit(deviceLibrary.getId(),deviceRepelDetail.getSendUnitId())); list.add(new RepelDeviceUnit(deviceLibrary.getId(), deviceRepelDetail.getSendUnitId()));
} }
); );
//添加根据type修改装备状态 //添加根据type修改装备状态
repelDeviceUnitService.saveAllRepelDeviceUnit(list); repelDeviceUnitService.saveAllRepelDeviceUnit(list);
FileRet fileRet= pdfService.billPdf(documents); FileRet fileRet = pdfService.billPdf(documents);
deviceRepelDetail.setOutboundFile(JacksonUtil.toJSon(fileRet)); deviceRepelDetail.setOutboundFile(JacksonUtil.toJSon(fileRet));
deviceRepelDetail.setSendFiles(JacksonUtil.toJSon(fileRet)); deviceRepelDetail.setSendFiles(JacksonUtil.toJSon(fileRet));
addMessage(new MessageBto(taskBto.getId(),taskBto.getBusinessType(),"签收"+deviceRepelDetail.getSendUnit()+"清退的设备",findUnitIds(user.getUserId(),unitIds))); addMessage(new MessageBto(taskBto.getId(), taskBto.getBusinessType(), "签收" + deviceRepelDetail.getSendUnit() + "清退的设备", findUnitIds(user.getUserId(), unitIds)));
} }
} }
deviceRepelDetail.setReceiveTime(new Date()); deviceRepelDetail.setReceiveTime(new Date());
repelTaskStatisticalService.saveRepelTaskStatistical(repelTaskStatistical); repelTaskStatisticalService.saveRepelTaskStatistical(repelTaskStatistical);
deviceRepelDetailService.saveDeviceRepelDetail(deviceRepelDetail); deviceRepelDetailService.saveDeviceRepelDetail(deviceRepelDetail);
isEnd(taskBto,deviceRepelDetail.getRepelId()); isEnd(taskBto, deviceRepelDetail.getRepelId());
} }
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void oneselfRepel(Integer taskId, StorageDeviceRepel storageDeviceRepel,Integer userId) { public void oneselfRepel(Integer taskId, StorageDeviceRepel storageDeviceRepel, Integer userId) {
//完结当前任务 //完结当前任务
//修改统计表中的数据信息 状态 //修改统计表中的数据信息 状态
//把装备的状态都修改为待清退。 //把装备的状态都修改为待清退。
User user = userService.findByUser(userId); User user = userService.findByUser(userId);
Units units=unitsService.findById(user.getUnitsId()); Units units = unitsService.findById(user.getUnitsId());
List<RepelDeviceUnit> list=new ArrayList<>(); List<RepelDeviceUnit> list = new ArrayList<>();
TaskBto taskBto= taskService.get(taskId); TaskBto taskBto = taskService.get(taskId);
List<StatusEnum> enumList=new ArrayList<>(); List<StatusEnum> enumList = new ArrayList<>();
enumList.add(StatusEnum.SEND_BACK_1213); enumList.add(StatusEnum.SEND_BACK_1213);
enumList.add(StatusEnum.SEND_BACK_1203); enumList.add(StatusEnum.SEND_BACK_1203);
TaskDisposeUtil.isNotSubmit(taskBto.getBillStatus(),enumList); TaskDisposeUtil.isNotSubmit(taskBto.getBillStatus(), enumList);
DeviceRepelDetail deviceRepelDetail=deviceRepelDetailService.findDeviceRepelDetail(taskBto.getBillId()); DeviceRepelDetail deviceRepelDetail = deviceRepelDetailService.findDeviceRepelDetail(taskBto.getBillId());
deviceRepelDetail.setBillFile(FilesUtil.stringFileToList(storageDeviceRepel.getFileRets())); deviceRepelDetail.setBillFile(FilesUtil.stringFileToList(storageDeviceRepel.getFileRets()));
deviceRepelDetail.setRepelStatus(2); deviceRepelDetail.setRepelStatus(2);
taskService.moveToEnd(taskBto); taskService.moveToEnd(taskBto);
DeviceRepel deviceRepel = deviceRepelService.findDeviceRepel(deviceRepelDetail.getRepelId()); DeviceRepel deviceRepel = deviceRepelService.findDeviceRepel(deviceRepelDetail.getRepelId());
if (storageDeviceRepel.getDeviceIds()!=null&&storageDeviceRepel.getDeviceIds().size()!=0) { if (storageDeviceRepel.getDeviceIds() != null && storageDeviceRepel.getDeviceIds().size() != 0) {
StringBuffer ids = new StringBuffer(); StringBuffer ids = new StringBuffer();
List<DeviceLibrary> libraries = deviceLibraryDao.getDeviceLibraryEntitiesByIdIn(storageDeviceRepel.getDeviceIds()); List<DeviceLibrary> libraries = deviceLibraryDao.getDeviceLibraryEntitiesByIdIn(storageDeviceRepel.getDeviceIds());
libraries.forEach( libraries.forEach(
...@@ -808,49 +808,48 @@ public class RepelBusinessServiceImpl implements RepelBusinessService { ...@@ -808,49 +808,48 @@ public class RepelBusinessServiceImpl implements RepelBusinessService {
deviceLibraryDao.upDateLeftStatusAndUnitNameAndLockStatus(filterTypeReturnLeftStatus(deviceRepel.getType()), deviceRepelDetail.getSendUnit(), 0, StringUtils.stringToList(deviceRepelDetail.getDeviceIds())); deviceLibraryDao.upDateLeftStatusAndUnitNameAndLockStatus(filterTypeReturnLeftStatus(deviceRepel.getType()), deviceRepelDetail.getSendUnit(), 0, StringUtils.stringToList(deviceRepelDetail.getDeviceIds()));
log.info("更新数据装备以及所属单位{}", System.currentTimeMillis() - time); log.info("更新数据装备以及所属单位{}", System.currentTimeMillis() - time);
} }
devLogAdd(libraries,"省本级清退,把装备转变为待清退",userId,taskId); devLogAdd(libraries, "省本级清退,把装备转变为待清退", userId, taskId);
} }
RepelTaskStatistical repelTaskStatistical= repelTaskStatisticalService.findRepelTaskStatistical(taskBto.getId(),deviceRepelDetail.getRepelId()); RepelTaskStatistical repelTaskStatistical = repelTaskStatisticalService.findRepelTaskStatistical(taskBto.getId(), deviceRepelDetail.getRepelId());
repelTaskStatistical.setTaskStatus(1); repelTaskStatistical.setTaskStatus(1);
repelTaskStatisticalService.saveRepelTaskStatistical(repelTaskStatistical); repelTaskStatisticalService.saveRepelTaskStatistical(repelTaskStatistical);
deviceRepelDetailService.saveDeviceRepelDetail(deviceRepelDetail); deviceRepelDetailService.saveDeviceRepelDetail(deviceRepelDetail);
isEnd(taskBto,deviceRepelDetail.getRepelId()); isEnd(taskBto, deviceRepelDetail.getRepelId());
// addMessage(new MessageBto(taskBto.getId(),taskBto.getBusinessType(),"完成["+deviceRepel.getTitle()+"]本级清退任务",gainThisUser(user.getUserId(),user.getUnitsId()))); // addMessage(new MessageBto(taskBto.getId(),taskBto.getBusinessType(),"完成["+deviceRepel.getTitle()+"]本级清退任务",gainThisUser(user.getUserId(),user.getUnitsId())));
} }
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void provinceDirectlyUnder(Integer taskId,SecurityUser securityUser) { public void provinceDirectlyUnder(Integer taskId, SecurityUser securityUser) {
TaskBto taskBto= taskService.get(taskId); TaskBto taskBto = taskService.get(taskId);
TaskDisposeUtil.isNotSubmit(taskBto.getBillStatus(),StatusEnum.SEND_BACK_1202); TaskDisposeUtil.isNotSubmit(taskBto.getBillStatus(), StatusEnum.SEND_BACK_1202);
DeviceRepelDetail deviceRepelDetail=deviceRepelDetailService.findDeviceRepelDetail(taskBto.getBillId()); 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<>(); Map<String, List<Integer>> map = new HashMap<>();
List<DeviceLibrary> libraries=deviceLibraryDao.getDeviceLibraryEntitiesByIdIn(StringUtils.stringToList(deviceRepelDetail.getDeviceIds())); List<DeviceLibrary> libraries = deviceLibraryDao.getDeviceLibraryEntitiesByIdIn(StringUtils.stringToList(deviceRepelDetail.getDeviceIds()));
libraries.forEach( libraries.forEach(
deviceLibrary -> { deviceLibrary -> {
if (map.containsKey(deviceLibrary.getOwnUnit())){ if (map.containsKey(deviceLibrary.getOwnUnit())) {
List<Integer> list= map.get(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()); list.add(deviceLibrary.getId());
map.put(deviceLibrary.getOwnUnit(),list); 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)); deviceRepelDetail.setDirectlyUnderDevices(JacksonUtil.toJSon(map));
deviceRepelDetailService.saveDeviceRepelDetail(deviceRepelDetail); deviceRepelDetailService.saveDeviceRepelDetail(deviceRepelDetail);
devLogAdd(libraries,"省直属清退,把装备转变为待清退",securityUser.getCurrentUserInfo().getUserId(),taskBto.getId()); devLogAdd(libraries, "省直属清退,把装备转变为待清退", securityUser.getCurrentUserInfo().getUserId(), taskBto.getId());
deviceLibraryDao.upDateLeftStatusAndLockStatus(filterTypeReturnLeftStatus(deviceRepel.getType()), 0, StringUtils.stringToList(deviceRepelDetail.getDeviceIds())); deviceLibraryDao.upDateLeftStatusAndLockStatus(filterTypeReturnLeftStatus(deviceRepel.getType()), 0, StringUtils.stringToList(deviceRepelDetail.getDeviceIds()));
taskService.moveToSpecial(taskBto,StatusEnum.SEND_BACK_1213,0); taskService.moveToSpecial(taskBto, StatusEnum.SEND_BACK_1213, 0);
} }
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void provinceRepel(Integer taskId) { public void provinceRepel(Integer taskId) {
...@@ -860,14 +859,14 @@ public class RepelBusinessServiceImpl implements RepelBusinessService { ...@@ -860,14 +859,14 @@ public class RepelBusinessServiceImpl implements RepelBusinessService {
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void cityRepelEnd(Integer taskId) { public void cityRepelEnd(Integer taskId) {
TaskBto taskBto=taskService.get(taskId); TaskBto taskBto = taskService.get(taskId);
List<StatusEnum> enumList=new ArrayList<>(); List<StatusEnum> enumList = new ArrayList<>();
enumList.add(StatusEnum.SEND_BACK_1200); enumList.add(StatusEnum.SEND_BACK_1200);
enumList.add(StatusEnum.SEND_BACK_1212); enumList.add(StatusEnum.SEND_BACK_1212);
enumList.add(StatusEnum.SEND_BACK_1204); enumList.add(StatusEnum.SEND_BACK_1204);
TaskDisposeUtil.isNotSubmit(taskBto.getBillStatus(),enumList); TaskDisposeUtil.isNotSubmit(taskBto.getBillStatus(), enumList);
taskService.moveToEnd(taskService.get(taskId)); taskService.moveToEnd(taskService.get(taskId));
DeviceRepel deviceRepel= deviceRepelService.findDeviceRepel(taskBto.getBillId()); DeviceRepel deviceRepel = deviceRepelService.findDeviceRepel(taskBto.getBillId());
deviceRepel.setStatus(1); deviceRepel.setStatus(1);
deviceRepelService.saveDeviceRepel(deviceRepel); deviceRepelService.saveDeviceRepel(deviceRepel);
} }
...@@ -875,54 +874,53 @@ public class RepelBusinessServiceImpl implements RepelBusinessService { ...@@ -875,54 +874,53 @@ public class RepelBusinessServiceImpl implements RepelBusinessService {
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void receipts(StorageDeviceRepel storageDeviceRepel) { public void receipts(StorageDeviceRepel storageDeviceRepel) {
User user= userService.findByUser(storageDeviceRepel.getUserId()); User user = userService.findByUser(storageDeviceRepel.getUserId());
Units units=unitsService.findById(user.getUnitsId()); Units units = unitsService.findById(user.getUnitsId());
TaskBto taskBto = taskService.get(storageDeviceRepel.getTaskId()); TaskBto taskBto = taskService.get(storageDeviceRepel.getTaskId());
TaskDisposeUtil.isNotSubmit(taskBto.getBillStatus(),StatusEnum.SEND_BACK_1214); TaskDisposeUtil.isNotSubmit(taskBto.getBillStatus(), StatusEnum.SEND_BACK_1214);
taskService.moveToEnd(taskBto); taskService.moveToEnd(taskBto);
taskService.moveToArchive(taskBto); taskService.moveToArchive(taskBto);
DeviceRepelDetail deviceRepelDetail=deviceRepelDetailService.findDeviceRepelDetail(taskBto.getBillId()); DeviceRepelDetail deviceRepelDetail = deviceRepelDetailService.findDeviceRepelDetail(taskBto.getBillId());
DeviceRepel deviceRepel=deviceRepelService.findDeviceRepel(deviceRepelDetail.getRepelId()); DeviceRepel deviceRepel = deviceRepelService.findDeviceRepel(deviceRepelDetail.getRepelId());
if (storageDeviceRepel.getSenderName()!=null) { if (storageDeviceRepel.getSenderName() != null) {
deviceRepelDetail.setSenderUserB(storageDeviceRepel.getSenderName()); deviceRepelDetail.setSenderUserB(storageDeviceRepel.getSenderName());
} }
if (storageDeviceRepel.getSenderId()!=null) if (storageDeviceRepel.getSenderId() != null) {
deviceRepelDetail.setSendUserbId(storageDeviceRepel.getSenderId()); deviceRepelDetail.setSendUserbId(storageDeviceRepel.getSenderId());
deviceRepelDetail.setOutboundFile(FilesUtil.stringFileToList(storageDeviceRepel.getOutFiles())); }
deviceRepelDetail.setOutboundFile(FilesUtil.stringFileToList(storageDeviceRepel.getOutFiles()));
if (storageDeviceRepel.getUserBName()!=null) {
if (storageDeviceRepel.getUserBName() != null) {
deviceRepelDetail.setReceiveUserB(storageDeviceRepel.getUserBName()); deviceRepelDetail.setReceiveUserB(storageDeviceRepel.getUserBName());
} }
if (storageDeviceRepel.getUserB()!=null){ if (storageDeviceRepel.getUserB() != null) {
deviceRepelDetail.setReceiveUserbId(storageDeviceRepel.getUserB()); deviceRepelDetail.setReceiveUserbId(storageDeviceRepel.getUserB());
} }
if (storageDeviceRepel.getUserA()!=null){ if (storageDeviceRepel.getUserA() != null) {
deviceRepelDetail.setReceiveUseraId(storageDeviceRepel.getUserA()); deviceRepelDetail.setReceiveUseraId(storageDeviceRepel.getUserA());
} }
if (storageDeviceRepel.getUserAName()!=null) { if (storageDeviceRepel.getUserAName() != null) {
deviceRepelDetail.setReceiveUserA(storageDeviceRepel.getUserAName()); deviceRepelDetail.setReceiveUserA(storageDeviceRepel.getUserAName());
} }
if (units.getLevel()==3) { if (units.getLevel() == 3) {
deviceLibraryDao.upDateLeftStatusAndUnitNameAndLockStatus(DeviceLifeStatus.IN_LIBRARY.id, deviceRepelDetail.getReceiveUnit(), 0, StringUtils.stringToList(deviceRepelDetail.getDeviceIds())); deviceLibraryDao.upDateLeftStatusAndUnitNameAndLockStatus(DeviceLifeStatus.IN_LIBRARY.id, deviceRepelDetail.getReceiveUnit(), 0, StringUtils.stringToList(deviceRepelDetail.getDeviceIds()));
}else { } else {
deviceLibraryDao.upDateLeftStatusAndUnitNameAndLockStatus(filterTypeReturnLeftStatus(deviceRepel.getType()), deviceRepelDetail.getReceiveUnit(), 0, StringUtils.stringToList(deviceRepelDetail.getDeviceIds())); deviceLibraryDao.upDateLeftStatusAndUnitNameAndLockStatus(filterTypeReturnLeftStatus(deviceRepel.getType()), deviceRepelDetail.getReceiveUnit(), 0, StringUtils.stringToList(deviceRepelDetail.getDeviceIds()));
} }
deviceRepelDetail.setRepelStatus(2); deviceRepelDetail.setRepelStatus(2);
TaskBto fatherTask=taskService.get(taskBto.getParentTaskId()); TaskBto fatherTask = taskService.get(taskBto.getParentTaskId());
taskService.moveToEnd(fatherTask); taskService.moveToEnd(fatherTask);
deviceRepelDetail.setReceiveTime(new Date()); deviceRepelDetail.setReceiveTime(new Date());
DeviceRepelDetail deviceRepelDetailFather= deviceRepelDetailService.findDeviceRepelDetail(fatherTask.getBillId()); DeviceRepelDetail deviceRepelDetailFather = deviceRepelDetailService.findDeviceRepelDetail(fatherTask.getBillId());
RepelTaskStatistical repelTaskStatistical = repelTaskStatisticalService.findRepelTaskStatistical(fatherTask.getId(),deviceRepelDetailFather.getRepelId()); RepelTaskStatistical repelTaskStatistical = repelTaskStatisticalService.findRepelTaskStatistical(fatherTask.getId(), deviceRepelDetailFather.getRepelId());
repelTaskStatistical.setTaskStatus(1); repelTaskStatistical.setTaskStatus(1);
repelTaskStatisticalService.saveRepelTaskStatistical(repelTaskStatistical); repelTaskStatisticalService.saveRepelTaskStatistical(repelTaskStatistical);
isEnd(fatherTask,deviceRepelDetailFather.getRepelId()); isEnd(fatherTask, deviceRepelDetailFather.getRepelId());
deviceRepelDetailService.saveDeviceRepelDetail(deviceRepelDetail); deviceRepelDetailService.saveDeviceRepelDetail(deviceRepelDetail);
List<Integer> unitIds=new ArrayList<>(); List<Integer> unitIds = new ArrayList<>();
unitIds.add(deviceRepelDetail.getSendUnitId()); unitIds.add(deviceRepelDetail.getSendUnitId());
unitIds.add(deviceRepelDetail.getReceiveUnitId()); unitIds.add(deviceRepelDetail.getReceiveUnitId());
addMessage(new MessageBto(taskBto.getId(),taskBto.getBusinessType(),"装备清退任务,出库方上传了回执单据任务结束",findUnitIds(storageDeviceRepel.getUserId(),unitIds))); addMessage(new MessageBto(taskBto.getId(), taskBto.getBusinessType(), "装备清退任务,出库方上传了回执单据任务结束", findUnitIds(storageDeviceRepel.getUserId(), unitIds)));
} }
...@@ -930,11 +928,11 @@ public class RepelBusinessServiceImpl implements RepelBusinessService { ...@@ -930,11 +928,11 @@ public class RepelBusinessServiceImpl implements RepelBusinessService {
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void addSendBUser(StorageDeviceRepel storageDeviceRepel) { public void addSendBUser(StorageDeviceRepel storageDeviceRepel) {
TaskBto taskBto = taskService.get(storageDeviceRepel.getTaskId()); TaskBto taskBto = taskService.get(storageDeviceRepel.getTaskId());
TaskDisposeUtil.isNotSubmit(taskBto.getBillStatus(),StatusEnum.SEND_BACK_1214); TaskDisposeUtil.isNotSubmit(taskBto.getBillStatus(), StatusEnum.SEND_BACK_1214);
DeviceRepelDetail deviceRepelDetail=deviceRepelDetailService.findDeviceRepelDetail(taskBto.getBillId()); DeviceRepelDetail deviceRepelDetail = deviceRepelDetailService.findDeviceRepelDetail(taskBto.getBillId());
deviceRepelDetail.setSenderUserB(storageDeviceRepel.getUserBName()); deviceRepelDetail.setSenderUserB(storageDeviceRepel.getUserBName());
deviceRepelDetail.setSendUserbId(storageDeviceRepel.getUserB()); deviceRepelDetail.setSendUserbId(storageDeviceRepel.getUserB());
addMessage(new MessageBto(taskBto.getId(),taskBto.getBusinessType(),"选择了你为签发人请阅知",new ArrayList<>(storageDeviceRepel.getUserB()))); addMessage(new MessageBto(taskBto.getId(), taskBto.getBusinessType(), "选择了你为签发人请阅知", new ArrayList<>(storageDeviceRepel.getUserB())));
deviceRepelDetailService.saveDeviceRepelDetail(deviceRepelDetail); deviceRepelDetailService.saveDeviceRepelDetail(deviceRepelDetail);
} }
...@@ -945,7 +943,7 @@ public class RepelBusinessServiceImpl implements RepelBusinessService { ...@@ -945,7 +943,7 @@ public class RepelBusinessServiceImpl implements RepelBusinessService {
//给同级专管员推送阅知 //给同级专管员推送阅知
//装备在待退役中展示 //装备在待退役中展示
//任务完结 //任务完结
deviceLibraryDao.upDateLeftStatus(DeviceLifeStatus.REPEL.id,ids); deviceLibraryDao.upDateLeftStatus(DeviceLifeStatus.REPEL.id, ids);
} }
...@@ -953,45 +951,44 @@ public class RepelBusinessServiceImpl implements RepelBusinessService { ...@@ -953,45 +951,44 @@ public class RepelBusinessServiceImpl implements RepelBusinessService {
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void AllRepelNotDeviceSubmit(SecurityUser securityUser, Integer taskId) { public void AllRepelNotDeviceSubmit(SecurityUser securityUser, Integer taskId) {
TaskBto taskBto= taskService.get(taskId); TaskBto taskBto = taskService.get(taskId);
List<StatusEnum> enumList=new ArrayList<>(); List<StatusEnum> enumList = new ArrayList<>();
enumList.add(StatusEnum.SEND_BACK_1205); enumList.add(StatusEnum.SEND_BACK_1205);
enumList.add(StatusEnum.SEND_BACK_1203); enumList.add(StatusEnum.SEND_BACK_1203);
enumList.add(StatusEnum.SEND_BACK_1206); enumList.add(StatusEnum.SEND_BACK_1206);
enumList.add(StatusEnum.SEND_BACK_1208); enumList.add(StatusEnum.SEND_BACK_1208);
TaskDisposeUtil.isNotSubmit(taskBto.getBillStatus(),enumList); TaskDisposeUtil.isNotSubmit(taskBto.getBillStatus(), enumList);
DeviceRepelDetail deviceRepelDetail=deviceRepelDetailService.findDeviceRepelDetail(taskBto.getBillId()); DeviceRepelDetail deviceRepelDetail = deviceRepelDetailService.findDeviceRepelDetail(taskBto.getBillId());
deviceRepelDetail.setRepelStatus(3); deviceRepelDetail.setRepelStatus(3);
taskService.moveToEnd(taskBto); taskService.moveToEnd(taskBto);
RepelTaskStatistical repelTaskStatistical= repelTaskStatisticalService.findRepelTaskStatistical(taskBto.getId(),deviceRepelDetail.getRepelId()); RepelTaskStatistical repelTaskStatistical = repelTaskStatisticalService.findRepelTaskStatistical(taskBto.getId(), deviceRepelDetail.getRepelId());
repelTaskStatistical.setTaskStatus(1); repelTaskStatistical.setTaskStatus(1);
repelTaskStatistical.setCount(0); repelTaskStatistical.setCount(0);
repelTaskStatisticalService.saveRepelTaskStatistical(repelTaskStatistical); repelTaskStatisticalService.saveRepelTaskStatistical(repelTaskStatistical);
deviceRepelDetailService.saveDeviceRepelDetail(deviceRepelDetail); deviceRepelDetailService.saveDeviceRepelDetail(deviceRepelDetail);
isEnd(taskBto,deviceRepelDetail.getRepelId()); isEnd(taskBto, deviceRepelDetail.getRepelId());
// addMessage(new MessageBto(taskBto.getId(),taskBto.getBusinessType(),"本单位无装备提交,完成了清退任务",gainThisUser(securityUser.getCurrentUserInfo().getUserId(),securityUser.getCurrentUserInfo().getUnitsId()))); // addMessage(new MessageBto(taskBto.getId(),taskBto.getBusinessType(),"本单位无装备提交,完成了清退任务",gainThisUser(securityUser.getCurrentUserInfo().getUserId(),securityUser.getCurrentUserInfo().getUnitsId())));
} }
@Override @Override
public void withdraw(Integer taskId) { public void withdraw(Integer taskId) {
TaskBto taskBto = taskService.get(taskId); TaskBto taskBto = taskService.get(taskId);
Units units= unitsService.findById(taskBto.getOwnUnit()); Units units = unitsService.findById(taskBto.getOwnUnit());
TaskBto fatherTaskBto=taskService.get(taskBto.getParentTaskId()); TaskBto fatherTaskBto = taskService.get(taskBto.getParentTaskId());
Task task= taskBto.toDo(); Task task = taskBto.toDo();
task.setDeleteTag(1); task.setDeleteTag(1);
taskService.deleteById(task); taskService.deleteById(task);
DeviceRepelDetail deviceRepelDetail= deviceRepelDetailService.findDeviceRepelDetailNoDev(taskBto.getBillId()); DeviceRepelDetail deviceRepelDetail = deviceRepelDetailService.findDeviceRepelDetailNoDev(taskBto.getBillId());
deviceLibraryDao.upDateLeftStatus(DeviceLifeStatus.IN_LIBRARY.id, StringUtils.stringToList(deviceRepelDetail.getDeviceIds())); deviceLibraryDao.upDateLeftStatus(DeviceLifeStatus.IN_LIBRARY.id, StringUtils.stringToList(deviceRepelDetail.getDeviceIds()));
fatherTaskBto.setOwnUnit(units.getUnitId()); fatherTaskBto.setOwnUnit(units.getUnitId());
if (units.getLevel()==3){ if (units.getLevel() == 3) {
taskService.moveToSpecial(fatherTaskBto,StatusEnum.SEND_BACK_1205,0); taskService.moveToSpecial(fatherTaskBto, StatusEnum.SEND_BACK_1205, 0);
}else { } else {
taskService.moveToSpecial(fatherTaskBto,StatusEnum.SEND_BACK_1206,0); taskService.moveToSpecial(fatherTaskBto, StatusEnum.SEND_BACK_1206, 0);
} }
} }
...@@ -1001,8 +998,8 @@ public class RepelBusinessServiceImpl implements RepelBusinessService { ...@@ -1001,8 +998,8 @@ public class RepelBusinessServiceImpl implements RepelBusinessService {
* 主要用于清退到省的时候 * 主要用于清退到省的时候
* 主任务的type为0时 在库 为1时 待退役 为2 待报废 为3 待销毁 * 主任务的type为0时 在库 为1时 待退役 为2 待报废 为3 待销毁
*/ */
private Integer filterTypeReturnLeftStatus(Integer type){ private Integer filterTypeReturnLeftStatus(Integer type) {
switch (type){ switch (type) {
case 0: case 0:
return DeviceLifeStatus.IN_LIBRARY.id; return DeviceLifeStatus.IN_LIBRARY.id;
case 1: case 1:
...@@ -1016,18 +1013,18 @@ public class RepelBusinessServiceImpl implements RepelBusinessService { ...@@ -1016,18 +1013,18 @@ public class RepelBusinessServiceImpl implements RepelBusinessService {
} }
/** /**
* 生成区清退任务 * 生成区清退任务
* @param unitId 执行单位id *
* @param unitId 执行单位id
* @param repelDetailId 账单id * @param repelDetailId 账单id
* @param title 标题 * @param title 标题
* @param parentTaskId 上级任务ID * @param parentTaskId 上级任务ID
* @return TaskBto * @return TaskBto
*/ */
private TaskBto countyRepelTask(Integer unitId,Integer repelDetailId,String title,Integer parentTaskId,Integer userId){ private TaskBto countyRepelTask(Integer unitId, Integer repelDetailId, String title, Integer parentTaskId, Integer userId) {
//省清退任务待市提交 //省清退任务待市提交
List<Integer> list=new ArrayList<>(); List<Integer> list = new ArrayList<>();
list.add(userId); list.add(userId);
list.add(0); list.add(0);
return taskService.start(new TaskBto(StatusEnum.SEND_BACK_1205.id, title, parentTaskId, ".", repelDetailId, BusinessEnum.SEND_BACK.id, unitId, 1, "", list)); return taskService.start(new TaskBto(StatusEnum.SEND_BACK_1205.id, title, parentTaskId, ".", repelDetailId, BusinessEnum.SEND_BACK.id, unitId, 1, "", list));
...@@ -1035,14 +1032,15 @@ public class RepelBusinessServiceImpl implements RepelBusinessService { ...@@ -1035,14 +1032,15 @@ public class RepelBusinessServiceImpl implements RepelBusinessService {
/** /**
* 市发起清退 * 市发起清退
*
* @param unitId * @param unitId
* @param repelDetailId * @param repelDetailId
* @param title * @param title
* @return * @return
*/ */
private TaskBto cityInitiateTask(Integer unitId,Integer repelDetailId,String title,Integer userId){ private TaskBto cityInitiateTask(Integer unitId, Integer repelDetailId, String title, Integer userId) {
//省清退任务待市提交 //省清退任务待市提交
List<Integer> list=new ArrayList<>(); List<Integer> list = new ArrayList<>();
list.add(userId); list.add(userId);
list.add(0); list.add(0);
return taskService.start(new TaskBto(StatusEnum.SEND_BACK_1211.id, title, null, ".", repelDetailId, BusinessEnum.SEND_BACK_STATISTICAL.id, unitId, 0, "", list)); return taskService.start(new TaskBto(StatusEnum.SEND_BACK_1211.id, title, null, ".", repelDetailId, BusinessEnum.SEND_BACK_STATISTICAL.id, unitId, 0, "", list));
...@@ -1050,13 +1048,14 @@ public class RepelBusinessServiceImpl implements RepelBusinessService { ...@@ -1050,13 +1048,14 @@ public class RepelBusinessServiceImpl implements RepelBusinessService {
/** /**
* 市的清退统计任务任务 17 * 市的清退统计任务任务 17
*
* @param unitId * @param unitId
* @param repelDetailId * @param repelDetailId
* @param title * @param title
* @return * @return
*/ */
private TaskBto cityTotalTask(Integer unitId,Integer repelDetailId,String title,Integer parentId,Integer userId){ private TaskBto cityTotalTask(Integer unitId, Integer repelDetailId, String title, Integer parentId, Integer userId) {
List<Integer> list=new ArrayList<>(); List<Integer> list = new ArrayList<>();
list.add(userId); list.add(userId);
list.add(-1); list.add(-1);
return taskService.start(new TaskBto(StatusEnum.SEND_BACK_1204.id, title, parentId, ".", repelDetailId, BusinessEnum.SEND_BACK_STATISTICAL.id, unitId, 1, "shi", list)); return taskService.start(new TaskBto(StatusEnum.SEND_BACK_1204.id, title, parentId, ".", repelDetailId, BusinessEnum.SEND_BACK_STATISTICAL.id, unitId, 1, "shi", list));
...@@ -1064,44 +1063,46 @@ public class RepelBusinessServiceImpl implements RepelBusinessService { ...@@ -1064,44 +1063,46 @@ public class RepelBusinessServiceImpl implements RepelBusinessService {
/** /**
* 省的清退总任务 17 * 省的清退总任务 17
*
* @param unitId * @param unitId
* @param repelDetailId * @param repelDetailId
* @param title * @param title
* @return * @return
*/ */
private TaskBto statsXTask(Integer unitId,Integer repelDetailId,String title,Integer userId){ private TaskBto statsXTask(Integer unitId, Integer repelDetailId, String title, Integer userId) {
//省清退任务待市提交 //省清退任务待市提交
List<Integer> list=new ArrayList<>(); List<Integer> list = new ArrayList<>();
list.add(userId); list.add(userId);
list.add(-1); list.add(-1);
return taskService.start(new TaskBto(StatusEnum.SEND_BACK_1200.id, title, null, ".", repelDetailId, BusinessEnum.SEND_BACK_STATISTICAL.id, unitId, 1, "",list )); return taskService.start(new TaskBto(StatusEnum.SEND_BACK_1200.id, title, null, ".", repelDetailId, BusinessEnum.SEND_BACK_STATISTICAL.id, unitId, 1, "", list));
} }
/** /**
* 省对市发起的清退 市清退任务待执行 16 * 省对市发起的清退 市清退任务待执行 16
* @param unitId 执行单位id *
* @param unitId 执行单位id
* @param repelDetailId 账单id 详情 * @param repelDetailId 账单id 详情
* @param title 标题 * @param title 标题
* @return task对象 * @return task对象
*/ */
private TaskBto cityRepelTask(Integer unitId,Integer repelDetailId,String title,Integer parentTaskId,Integer userId){ private TaskBto cityRepelTask(Integer unitId, Integer repelDetailId, String title, Integer parentTaskId, Integer userId) {
List<Integer> list=new ArrayList<>(); List<Integer> list = new ArrayList<>();
list.add(userId); list.add(userId);
list.add(0); list.add(0);
return taskService.start(new TaskBto(StatusEnum.SEND_BACK_1201.id, title, parentTaskId, ".", repelDetailId, BusinessEnum.SEND_BACK.id, unitId, 1, "", list)); return taskService.start(new TaskBto(StatusEnum.SEND_BACK_1201.id, title, parentTaskId, ".", repelDetailId, BusinessEnum.SEND_BACK.id, unitId, 1, "", list));
} }
/** /**
* 清退出库等待上传回执单 * 清退出库等待上传回执单
*
* @param unitId * @param unitId
* @param repelDetailId * @param repelDetailId
* @param parentTaskId * @param parentTaskId
* @return * @return
*/ */
private TaskBto waitingReceiptsTask(Integer unitId, Integer repelDetailId, Integer parentTaskId,String title,Integer userId){ private TaskBto waitingReceiptsTask(Integer unitId, Integer repelDetailId, Integer parentTaskId, String title, Integer userId) {
List<Integer> list=new ArrayList<>(); List<Integer> list = new ArrayList<>();
list.add(userId); list.add(userId);
list.add(0); list.add(0);
return taskService.start(new TaskBto(StatusEnum.SEND_BACK_1214.id, title, parentTaskId, ".", repelDetailId, BusinessEnum.SEND_BACK.id, unitId, 1, "", list)); return taskService.start(new TaskBto(StatusEnum.SEND_BACK_1214.id, title, parentTaskId, ".", repelDetailId, BusinessEnum.SEND_BACK.id, unitId, 1, "", list));
...@@ -1110,13 +1111,14 @@ public class RepelBusinessServiceImpl implements RepelBusinessService { ...@@ -1110,13 +1111,14 @@ public class RepelBusinessServiceImpl implements RepelBusinessService {
/** /**
* 省直属单位任务 省自己完成 16 * 省直属单位任务 省自己完成 16
* @param unitId 执行单位 *
* @param unitId 执行单位
* @param repelDetailId 账单详情id * @param repelDetailId 账单详情id
* @param parentTaskId 上级taskid * @param parentTaskId 上级taskid
* @return TaskBto * @return TaskBto
*/ */
private TaskBto directlyUnderTask(Integer unitId, Integer repelDetailId, Integer parentTaskId,String title,Integer userId){ private TaskBto directlyUnderTask(Integer unitId, Integer repelDetailId, Integer parentTaskId, String title, Integer userId) {
List<Integer> list=new ArrayList<>(); List<Integer> list = new ArrayList<>();
list.add(userId); list.add(userId);
list.add(0); list.add(0);
return taskService.start(new TaskBto(StatusEnum.SEND_BACK_1202.id, title, parentTaskId, ".", repelDetailId, BusinessEnum.SEND_BACK.id, unitId, 1, "DirectlyUnder", list)); return taskService.start(new TaskBto(StatusEnum.SEND_BACK_1202.id, title, parentTaskId, ".", repelDetailId, BusinessEnum.SEND_BACK.id, unitId, 1, "DirectlyUnder", list));
...@@ -1124,13 +1126,14 @@ public class RepelBusinessServiceImpl implements RepelBusinessService { ...@@ -1124,13 +1126,14 @@ public class RepelBusinessServiceImpl implements RepelBusinessService {
/** /**
* 省本级任务 16 * 省本级任务 16
*
* @param unitId * @param unitId
* @param repelDetailId * @param repelDetailId
* @param parentTaskId * @param parentTaskId
* @return * @return
*/ */
private TaskBto oneselfTask(Integer unitId, Integer repelDetailId, Integer parentTaskId,String title,Integer userId){ private TaskBto oneselfTask(Integer unitId, Integer repelDetailId, Integer parentTaskId, String title, Integer userId) {
List<Integer> list=new ArrayList<>(); List<Integer> list = new ArrayList<>();
list.add(userId); list.add(userId);
list.add(0); list.add(0);
return taskService.start(new TaskBto(StatusEnum.SEND_BACK_1203.id, title, parentTaskId, ".", repelDetailId, BusinessEnum.SEND_BACK.id, unitId, 1, "", list)); return taskService.start(new TaskBto(StatusEnum.SEND_BACK_1203.id, title, parentTaskId, ".", repelDetailId, BusinessEnum.SEND_BACK.id, unitId, 1, "", list));
...@@ -1138,36 +1141,38 @@ public class RepelBusinessServiceImpl implements RepelBusinessService { ...@@ -1138,36 +1141,38 @@ public class RepelBusinessServiceImpl implements RepelBusinessService {
/** /**
* 市本级任务 16 * 市本级任务 16
*
* @param unitId * @param unitId
* @param repelDetailId * @param repelDetailId
* @param parentTaskId * @param parentTaskId
* @return * @return
*/ */
private TaskBto cityDeclaredTask(Integer unitId, Integer repelDetailId, Integer parentTaskId,String title,Integer userId){ private TaskBto cityDeclaredTask(Integer unitId, Integer repelDetailId, Integer parentTaskId, String title, Integer userId) {
List<Integer> list=new ArrayList<>(); List<Integer> list = new ArrayList<>();
list.add(userId); list.add(userId);
list.add(0); list.add(0);
return taskService.start(new TaskBto(StatusEnum.SEND_BACK_1216.id, title+"市本级清退任务", parentTaskId, ".", repelDetailId, BusinessEnum.SEND_BACK.id, unitId, 1, "", list)); return taskService.start(new TaskBto(StatusEnum.SEND_BACK_1216.id, title + "市本级清退任务", parentTaskId, ".", repelDetailId, BusinessEnum.SEND_BACK.id, unitId, 1, "", list));
} }
/** /**
* 省出库中办 16 * 省出库中办 16
*
* @param unitId * @param unitId
* @param repelDetailId * @param repelDetailId
* @param parentTaskId * @param parentTaskId
* @return * @return
*/ */
private TaskBto sendOutSuperior(Integer unitId, Integer repelDetailId, Integer parentTaskId,Integer userId){ private TaskBto sendOutSuperior(Integer unitId, Integer repelDetailId, Integer parentTaskId, Integer userId) {
List<Integer> list=new ArrayList<>(); List<Integer> list = new ArrayList<>();
list.add(userId); list.add(userId);
list.add(0); list.add(0);
return taskService.start(new TaskBto(StatusEnum.SEND_BACK_1210.id, "省退役国家装备任务", parentTaskId, ".", repelDetailId, BusinessEnum.SEND_BACK.id, unitId, 1, "country", list)); return taskService.start(new TaskBto(StatusEnum.SEND_BACK_1210.id, "省退役国家装备任务", parentTaskId, ".", repelDetailId, BusinessEnum.SEND_BACK.id, unitId, 1, "country", list));
} }
private List<DeviceLibrary> findInvoleDevice(String involeDevice){ private List<DeviceLibrary> findInvoleDevice(String involeDevice) {
List<String> idStringList = Arrays.asList(involeDevice.split(",")); List<String> idStringList = Arrays.asList(involeDevice.split(","));
List<String> idListString = idStringList.stream().filter(list2->!list2.equals("")).collect(Collectors.toList()); List<String> idListString = idStringList.stream().filter(list2 -> !list2.equals("")).collect(Collectors.toList());
List<Integer> devIds = idListString.stream().map(Integer::parseInt).collect(Collectors.toList()); List<Integer> devIds = idListString.stream().map(Integer::parseInt).collect(Collectors.toList());
return deviceLibraryDao.getDeviceLibraryEntitiesByIdIn(devIds); return deviceLibraryDao.getDeviceLibraryEntitiesByIdIn(devIds);
} }
...@@ -1175,22 +1180,22 @@ public class RepelBusinessServiceImpl implements RepelBusinessService { ...@@ -1175,22 +1180,22 @@ public class RepelBusinessServiceImpl implements RepelBusinessService {
/** /**
* 判读是否留在代办 * 判读是否留在代办
*/ */
private void isCommission(TaskBto taskBto,Integer repelId){ private void isCommission(TaskBto taskBto, Integer repelId) {
boolean flag= repelTaskStatisticalService.findAllRepelTaskStatistical(taskBto.getParentTaskId(),repelId).stream().allMatch(e->e.getTaskStatus()!=3); boolean flag = repelTaskStatisticalService.findAllRepelTaskStatistical(taskBto.getParentTaskId(), repelId).stream().allMatch(e -> e.getTaskStatus() != 3);
if (flag){ if (flag) {
TaskBto parentTask= taskService.get(taskBto.getParentTaskId()); TaskBto parentTask = taskService.get(taskBto.getParentTaskId());
taskService.moveToSpecial(parentTask, GlobalMap.getStatusEnumMap().get(parentTask.getBillStatus()),-1); taskService.moveToSpecial(parentTask, GlobalMap.getStatusEnumMap().get(parentTask.getBillStatus()), -1);
} }
} }
/** /**
* 判读是否可以办结任务 * 判读是否可以办结任务
*/ */
private void isEnd(TaskBto taskBto,Integer repelId){ private void isEnd(TaskBto taskBto, Integer repelId) {
boolean flag = repelTaskStatisticalService.findAllRepelTaskStatistical(taskBto.getParentTaskId(),repelId).stream().allMatch(e->e.getTaskStatus()==1); boolean flag = repelTaskStatisticalService.findAllRepelTaskStatistical(taskBto.getParentTaskId(), repelId).stream().allMatch(e -> e.getTaskStatus() == 1);
if (flag){ if (flag) {
TaskBto parentTask= taskService.get(taskBto.getParentTaskId()); TaskBto parentTask = taskService.get(taskBto.getParentTaskId());
if (parentTask.getBillStatus()!=StatusEnum.END.id) { if (parentTask.getBillStatus() != StatusEnum.END.id) {
taskService.moveToSpecial(parentTask, StatusEnum.SEND_BACK_1212, 0); taskService.moveToSpecial(parentTask, StatusEnum.SEND_BACK_1212, 0);
} }
} }
...@@ -1198,15 +1203,16 @@ public class RepelBusinessServiceImpl implements RepelBusinessService { ...@@ -1198,15 +1203,16 @@ public class RepelBusinessServiceImpl implements RepelBusinessService {
/** /**
* 异步添加装备日志 * 异步添加装备日志
*
* @param deviceLibraries * @param deviceLibraries
* @param remark * @param remark
* @param userId * @param userId
*/ */
public void devLogAdd(List<DeviceLibrary> deviceLibraries,String remark,Integer userId,Integer taskId){ public void devLogAdd(List<DeviceLibrary> deviceLibraries, String remark, Integer userId, Integer taskId) {
List<DeviceLog> logDtos=new ArrayList<>(); List<DeviceLog> logDtos = new ArrayList<>();
deviceLibraries.forEach( deviceLibraries.forEach(
deviceLibrary -> { deviceLibrary -> {
logDtos.add(new DeviceLogDto(deviceLibrary.getId(),remark,null,userId,taskId).toDo()); logDtos.add(new DeviceLogDto(deviceLibrary.getId(), remark, null, userId, taskId).toDo());
} }
); );
...@@ -1218,37 +1224,41 @@ public class RepelBusinessServiceImpl implements RepelBusinessService { ...@@ -1218,37 +1224,41 @@ public class RepelBusinessServiceImpl implements RepelBusinessService {
/** /**
* 添加阅读 * 添加阅读
*
* @param messageBto * @param messageBto
*/ */
private void addMessage(MessageBto messageBto){ private void addMessage(MessageBto messageBto) {
messageService.add(messageBto); messageService.add(messageBto);
} }
/** /**
* 根据单位id查询用户 去除用户id * 根据单位id查询用户 去除用户id
*
* @param userId * @param userId
* @param unitId * @param unitId
* @return * @return
*/ */
private List<Integer> gainThisUser(Integer userId,Integer unitId){ private List<Integer> gainThisUser(Integer userId, Integer unitId) {
return userService.findAllByUnite(unitId).stream().filter(user -> !user.getUserId().equals(userId)).map(User::getUserId).collect(Collectors.toList()); return userService.findAllByUnite(unitId).stream().filter(user -> !user.getUserId().equals(userId)).map(User::getUserId).collect(Collectors.toList());
} }
/** /**
* 根据单位id查询用户id集合 * 根据单位id查询用户id集合
*
* @param unitId * @param unitId
* @return * @return
*/ */
private List<Integer> findUnitId(Integer unitId){ private List<Integer> findUnitId(Integer unitId) {
return userService.findAllByUnite(unitId).stream().map(User::getUserId).collect(Collectors.toList()); return userService.findAllByUnite(unitId).stream().map(User::getUserId).collect(Collectors.toList());
} }
/** /**
* 根据单位id查询用户id集合 * 根据单位id查询用户id集合
*
* @param unitId * @param unitId
* @return * @return
*/ */
private List<Integer> findUnitIds(Integer userId,List<Integer> unitIds){ private List<Integer> findUnitIds(Integer userId, List<Integer> unitIds) {
return userService.findUnitsIdInUsers(unitIds).stream().filter(user -> user.getUserId()!=userId).map(User::getUserId).collect(Collectors.toList()); return userService.findUnitsIdInUsers(unitIds).stream().filter(user -> user.getUserId() != userId).map(User::getUserId).collect(Collectors.toList());
} }
} }
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论