提交 37828098 authored 作者: zjm's avatar zjm

fix(清退任务): 沿用老版本清退任务发起

沿用老版本清退任务发起
上级 04908b08
......@@ -65,6 +65,10 @@ public class RepelTaskStatistical extends BaseEntity {
@ApiModelProperty(value = "区域名称")
private String areaName;
/**
* 排序
*/
private Integer showOrder;
/**
* 本单位需要清退装备数量
*/
......@@ -94,7 +98,7 @@ public class RepelTaskStatistical extends BaseEntity {
this.areaName = areaName;
}
public RepelTaskStatistical(Integer repelId, Integer fatherTaskId, Integer taskId, Integer taskStatus, String areaName, Integer count, String des) {
public RepelTaskStatistical(Integer repelId, Integer fatherTaskId, Integer taskId, Integer taskStatus, String areaName, Integer count, String des,Integer showOrder) {
this.repelId = repelId;
this.fatherTaskId = fatherTaskId;
this.taskId = taskId;
......@@ -102,5 +106,6 @@ public class RepelTaskStatistical extends BaseEntity {
this.areaName = areaName;
this.count = count;
this.des = des;
this.showOrder=showOrder;
}
}
......@@ -118,9 +118,9 @@ public class RepelBusinessServiceImpl implements RepelBusinessService {
* @param deviceRepel
* @param userId
*/
// @Override
// @Transactional(rollbackFor = Exception.class)
public void initiateRepel1(DeviceRepel deviceRepel, Integer userId) {
@Override
@Transactional(rollbackFor = Exception.class)
public void initiateRepel(DeviceRepel deviceRepel, Integer userId,SecurityUser securityUser) {
//生成一个清退任务 省清退任务 类型为 清退统计 17 16清退
//参照选择的范围给单位都发送 市清退任务待执行
//如果省本身有需要清退的型号,给省自己发起一个代办任务 本级装备待清退
......@@ -220,7 +220,7 @@ public class RepelBusinessServiceImpl implements RepelBusinessService {
TaskBto taskBto1 = cityRepelTask(unisId, deviceRepelDetailService.saveDeviceRepelDetail(deviceRepelDetail).getId(), "["+units1.getName()+"]" + "型号为" + StringSplitUtil.stringListToString(deviceRepel.getModels().stream()
.distinct()
.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), "",units1.getShowOrder()));
}
}
} else {
......@@ -239,7 +239,7 @@ public class RepelBusinessServiceImpl implements RepelBusinessService {
TaskBto taskBto2 = directlyUnderTask(units.getUnitId(), deviceRepelDetailService.saveDeviceRepelDetail(deviceRepelDetail).getId(), taskBto.getId(), "[省直属相关单位]型号为" + StringSplitUtil.stringListToString(deviceRepel.getModels().stream()
.distinct()
.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), "",units.getShowOrder()+2));
}
DeviceRepelDetail deviceRepelDetail1 = new DeviceRepelDetail();
deviceRepelDetail1.setRepelId(deviceRepel1.getId());
......@@ -255,7 +255,7 @@ public class RepelBusinessServiceImpl implements RepelBusinessService {
TaskBto taskBto1 = oneselfTask(units.getUnitId(), deviceRepelDetailService.saveDeviceRepelDetail(deviceRepelDetail1).getId(), taskBto.getId(), "[省本级]型号为" + StringSplitUtil.stringListToString(deviceRepel.getModels().stream()
.distinct()
.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), "",units.getShowOrder()));
}
if (list == null || list.size() == 0) {
throw new ApiException(ResponseEntity.ok("发布失败"));
......@@ -266,9 +266,9 @@ public class RepelBusinessServiceImpl implements RepelBusinessService {
//测试版本
@Override
@Transactional(rollbackFor = Exception.class)
public void initiateRepel(DeviceRepel deviceRepel, Integer userId,SecurityUser securityUser) {
// @Override
// @Transactional(rollbackFor = Exception.class)
public void initiateRepel1(DeviceRepel deviceRepel, Integer userId,SecurityUser securityUser) {
//生成一个清退任务 省清退任务 类型为 清退统计 17 16清退
//参照选择的范围给单位都发送 市清退任务待执行
//如果省本身有需要清退的型号,给省自己发起一个代办任务 本级装备待清退
......@@ -288,7 +288,9 @@ public class RepelBusinessServiceImpl implements RepelBusinessService {
lifeStatus.add(DeviceLifeStatus.TO_BE_DESTROYED.id);
lifeStatus.add(DeviceLifeStatus.TO_BE_SCRAPPED.id);
List<Units> directlUnderUnitNames = new ArrayList<>();
//是否存在直属代管单位
AtomicBoolean directlUnderUnit = new AtomicBoolean(false);
//是否包括自己单位
AtomicBoolean correspondingLevel = new AtomicBoolean(false);
deviceRepel.setFielding(StringUtils.ListToString(deviceRepel.getFieldingIds()));
deviceRepel.setFiles(FilesUtil.stringFileToList(deviceRepel.getFileRets()));
......@@ -342,21 +344,24 @@ public class RepelBusinessServiceImpl implements RepelBusinessService {
}
DeviceRepel deviceRepel1 = deviceRepelService.saveDeviceRepel(deviceRepel);
TaskBto taskBto = statsXTask(units.getUnitId(), deviceRepel1.getId(), "["+units.getUnitDesc()+"]-"+deviceRepel.getTitle(), userId);
//给本单位其他专管员阅知
List<RepelTaskStatistical> list = new ArrayList<>();
Map<Units,List<Units>> mapUnitList=new HashMap<>();
Map<Units,Integer> unitTaskIDMap=new HashMap<>();
Map<String,List<DeviceLibrary>> unitNameDevice=toUnitListDeviceLibrary(deviceRepel.getFieldingIds(),seqNumbers,lifeStatus);
//存放直属不代管单位的集合
List<Units> directlUnderNoEscrowUnitList=new ArrayList<>();
deviceRepel.getTaskScopes().forEach(
unisId -> {
Units units1 = unitsService.findById(unisId);
if (unisId != units.getUnitId()) {
if (units1.getType() == 2) {
if (units1.getType() == 2 &&units1.getEscrow()==1) {
directlUnderUnit.set(true);
directlUnderUnitNames.add(units1);
} else if (units1.getType() == 1) {
mapUnitList.put(units1,unitsService.findBySubordinateUnit(units1.getUnitId()));
}else {
directlUnderNoEscrowUnitList.add(units1);
}
} else {
correspondingLevel.set(true);
......@@ -379,11 +384,11 @@ public class RepelBusinessServiceImpl implements RepelBusinessService {
//判断是否为
//生成任务状态为1206的清退任务
if (deviceRepel.getRepelStatus()==2){
TaskBto taskBto1 = cityRepelTask(k.getUnitId(), deviceRepelDetailService.saveDeviceRepelDetail(deviceRepelDetail).getId(), "[" + k.getUnitDesc() + "]" + deviceRepel.getTitle(), taskBto.getId(), 0);
list.add(new RepelTaskStatistical(deviceRepel1.getId(), taskBto.getId(), taskBto1.getId(), 5, k.getUnitDesc(), repelStatusJudgeCount(deviceRepel.getRepelStatus(), count.get()), ""));
TaskBto taskBto1 = cityRepelTask(k.getUnitId(), deviceRepelDetailService.saveDeviceRepelDetail(deviceRepelDetail).getId(), "[" + k.getUnitDesc() + "]-" + deviceRepel.getTitle(), taskBto.getId(), 0);
list.add(new RepelTaskStatistical(deviceRepel1.getId(), taskBto.getId(), taskBto1.getId(), 5, k.getUnitDesc(), repelStatusJudgeCount(deviceRepel.getRepelStatus(), count.get()), "",k.getShowOrder()));
}else {
TaskBto taskBto1 = cityRepelTask1206(k.getUnitId(), deviceRepelDetailService.saveDeviceRepelDetail(deviceRepelDetail).getId(), "[" + k.getUnitDesc() + "]" + deviceRepel.getTitle(), taskBto.getId(), 0);
list.add(new RepelTaskStatistical(deviceRepel1.getId(), taskBto.getId(), taskBto1.getId(), 5, k.getUnitDesc(), repelStatusJudgeCount(deviceRepel.getRepelStatus(), count.get()), ""));
TaskBto taskBto1 = cityRepelTask1206(k.getUnitId(), deviceRepelDetailService.saveDeviceRepelDetail(deviceRepelDetail).getId(), "[" + k.getUnitDesc() + "]-" + deviceRepel.getTitle(), taskBto.getId(), 0);
list.add(new RepelTaskStatistical(deviceRepel1.getId(), taskBto.getId(), taskBto1.getId(), 5, k.getUnitDesc(), repelStatusJudgeCount(deviceRepel.getRepelStatus(), count.get()), "",k.getShowOrder()));
DeviceRepel deviceRepel2 = new DeviceRepel();
deviceRepel2.setTaskScopes(v.stream().map(Units::getUnitId).collect(Collectors.toList()));
deviceRepel2.setId(null);
......@@ -401,6 +406,10 @@ public class RepelBusinessServiceImpl implements RepelBusinessService {
}
}
});
//处理直属不代管单位清退
directlUnderNoEscrowUnitDW(directlUnderNoEscrowUnitList,unitNameDevice,deviceRepel1,taskBto);
//处理直属代管单位
DeviceRepelDetail deviceRepelDetail = new DeviceRepelDetail();
deviceRepelDetail.setRepelId(deviceRepel1.getId());
deviceRepelDetail.setRepelStatus(1);
......@@ -425,11 +434,13 @@ public class RepelBusinessServiceImpl implements RepelBusinessService {
if (deviceLibraries.size()!=0){
suspensionBillBusinessService.initiateSuspensionBill2(deviceLibraries.stream().map(DeviceLibrary::getId).collect(Collectors.toList()), securityUser);
}
if (directlUnderUnit.get() && count.get() != 0) {
TaskBto taskBto2 = directlyUnderTask(units.getUnitId(), deviceRepelDetailService.saveDeviceRepelDetail(deviceRepelDetail).getId(), taskBto.getId(), "[省直属相关单位]-"+ deviceRepel.getTitle(), userId);
list.add(new RepelTaskStatistical(deviceRepel1.getId(), taskBto.getId(), taskBto2.getId(), 0, "省直属", repelStatusJudgeCount(deviceRepel.getRepelStatus(), count.get()), ""));
list.add(new RepelTaskStatistical(deviceRepel1.getId(), taskBto.getId(), taskBto2.getId(), 0, "省直属", repelStatusJudgeCount(deviceRepel.getRepelStatus(), count.get()), "",units.getShowOrder()+1));
repelEscrowService.saveAllRepelEscrowService(escrows);
}
//处理本级单位
DeviceRepelDetail deviceRepelDetail1 = new DeviceRepelDetail();
deviceRepelDetail1.setRepelId(deviceRepel1.getId());
deviceRepelDetail1.setRepelStatus(1);
......@@ -445,7 +456,7 @@ public class RepelBusinessServiceImpl implements RepelBusinessService {
}
if (correspondingLevel.get() && count.get() != 0) {
TaskBto taskBto1 = oneselfTask(units.getUnitId(), deviceRepelDetailService.saveDeviceRepelDetail(deviceRepelDetail1).getId(), taskBto.getId(), "[省本级]-"+deviceRepel.getTitle(), userId);
list.add(new RepelTaskStatistical(deviceRepel1.getId(), taskBto.getId(), taskBto1.getId(), 0, "省本级", repelStatusJudgeCount(deviceRepel.getRepelStatus(), count.get()), ""));
list.add(new RepelTaskStatistical(deviceRepel1.getId(), taskBto.getId(), taskBto1.getId(), 0, units.getUnitDesc(), repelStatusJudgeCount(deviceRepel.getRepelStatus(), count.get()), "",units.getShowOrder()));
}
if (list == null || list.size() == 0) {
throw new ApiException(ResponseEntity.ok("发布失败"));
......@@ -453,6 +464,28 @@ public class RepelBusinessServiceImpl implements RepelBusinessService {
repelTaskStatisticalService.saveAllRepelTaskStatistical(list);
}
/**
* 直属不代管单位清退处理
* @param list
*/
private void directlUnderNoEscrowUnitDW(List<Units> list,Map<String,List<DeviceLibrary>> unitNameDevice,DeviceRepel deviceRepel,TaskBto taskBto){
if (list.size()!=0){
List<RepelTaskStatistical> repelTaskStatisticals = new ArrayList<>();
list.forEach(
units -> {
DeviceRepelDetail deviceRepelDetail = new DeviceRepelDetail();
deviceRepelDetail.setRepelId(deviceRepel.getId());
deviceRepelDetail.setRepelStatus(1);
deviceRepelDetail.setSendUnit(units.getName());
deviceRepelDetail.setSendUnitId(units.getUnitId());
TaskBto taskBto1 = cityRepelTask1206(units.getUnitId(), deviceRepelDetailService.saveDeviceRepelDetail(deviceRepelDetail).getId(), "[" + units.getUnitDesc() + "]" + deviceRepel.getTitle(), taskBto.getId(), 0);
repelTaskStatisticals.add(new RepelTaskStatistical(deviceRepel.getId(), taskBto.getId(), taskBto1.getId(), 5, units.getUnitDesc(), repelStatusJudgeCount(deviceRepel.getRepelStatus(), 0), "",units.getShowOrder()));
}
);
repelTaskStatisticalService.saveAllRepelTaskStatistical(repelTaskStatisticals);
}
};
@Autowired
DeviceLibraryCacheService deviceLibraryCacheService;
......@@ -485,7 +518,7 @@ public class RepelBusinessServiceImpl implements RepelBusinessService {
deviceRepel.setTaskScope(StringUtils.ListToString(deviceRepel.getTaskScopes()));
deviceRepel.setFiles(FilesUtil.stringFileToList(deviceRepel.getFileRets()));
DeviceRepel deviceRepel1 = deviceRepelService.saveDeviceRepel(deviceRepel);
TaskBto taskBto = cityTotalTask(units.getUnitId(), deviceRepel1.getId(), "["+units.getName()+"]-"+deviceRepel1.getTitle(), taskId, 0);
TaskBto taskBto = cityTotalTask(units.getUnitId(), deviceRepel1.getId(), "["+units.getUnitDesc()+"]-"+deviceRepel1.getTitle()+"统计任务", taskId, 0);
List<DeviceLibrary> deviceLibraries=new ArrayList<>();
List<RepelTaskStatistical> list = new ArrayList<>();
unitsList.forEach(
......@@ -501,8 +534,8 @@ public class RepelBusinessServiceImpl implements RepelBusinessService {
if (unitNameDevice.containsKey(units1.getName())) {
List<DeviceLibrary> deviceLibraryList=unitNameDevice.get(units1.getName());
deviceLibraries.addAll(deviceLibraryList.stream().filter(deviceLibrary -> !deviceLibrary.getLocationUnit().equals(deviceLibrary.getOwnUnit()) && deviceLibrary.getLifeStatus().equals(DeviceLifeStatus.REPAIRING.id)).collect(Collectors.toList()));
TaskBto taskBto1 = countyRepelTask(units1.getUnitId(), deviceRepelDetailService.saveDeviceRepelDetail(deviceRepelDetail).getId(), "["+units1.getName()+"]-"+deviceRepel1.getTitle(), taskBto.getId(), 0);
list.add(new RepelTaskStatistical(deviceRepel1.getId(), taskBto.getId(), taskBto1.getId(), 0, units1.getUnitDesc(), repelStatusJudgeCount(deviceRepel.getRepelStatus(), deviceLibraryList.size()), ""));
TaskBto taskBto1 = countyRepelTask(units1.getUnitId(), deviceRepelDetailService.saveDeviceRepelDetail(deviceRepelDetail).getId(), "["+units1.getUnitDesc()+"]-"+deviceRepel1.getTitle(), taskBto.getId(), 0);
list.add(new RepelTaskStatistical(deviceRepel1.getId(), taskBto.getId(), taskBto1.getId(), 0, units1.getUnitDesc(), repelStatusJudgeCount(deviceRepel.getRepelStatus(), deviceLibraryList.size()), "",units1.getShowOrder()));
}
}else {
......@@ -567,9 +600,7 @@ public class RepelBusinessServiceImpl implements RepelBusinessService {
}
DeviceRepel deviceRepel1 = deviceRepelService.saveDeviceRepel(deviceRepel);
TaskBto taskBto = cityTotalTask(units.getUnitId(), deviceRepel1.getId(), "["+units.getName()+"]" + "型号为" + StringSplitUtil.stringListToString(deviceRepel.getModels().stream()
.distinct()
.collect(Collectors.toList())) + "设备统计任务", taskId, userId);
TaskBto taskBto = cityTotalTask(units.getUnitId(), deviceRepel1.getId(), "["+units.getUnitDesc()+"]-"+deviceRepel1.getTitle()+ "清退统计任务", taskId, userId);
// addMessage(new MessageBto(taskBto.getId(),taskBto.getBusinessType(),user.getName()+"转发清退任务["+deviceRepel1.getTitle()+"]",gainThisUser(userId,units.getUnitId())));
List<RepelTaskStatistical> list = new ArrayList<>();
......@@ -585,10 +616,8 @@ public class RepelBusinessServiceImpl implements RepelBusinessService {
deviceRepelDetail.setSendUnitId(units1.getUnitId());
Integer count = deviceLibraryService.countAllRepel(deviceRepel.getFieldingIds(), unitsService.findBySubordinateUnitName(units1.getUnitId()), DeviceSeqUtil.selectDeviceSeqs(deviceRepel.getSeqNumbers()), lifeStatus);
if (count != 0) {
TaskBto taskBto1 = countyRepelTask(unisId, deviceRepelDetailService.saveDeviceRepelDetail(deviceRepelDetail).getId(), units1.getName() + "清退型号为" + StringSplitUtil.stringListToString(deviceRepel.getModels().stream()
.distinct()
.collect(Collectors.toList())) + "设备", taskBto.getId(), userId);
list.add(new RepelTaskStatistical(deviceRepel1.getId(), taskBto.getId(), taskBto1.getId(), 0, area1.getName(), repelStatusJudgeCount(deviceRepel.getRepelStatus(), count), ""));
TaskBto taskBto1 = countyRepelTask(unisId, deviceRepelDetailService.saveDeviceRepelDetail(deviceRepelDetail).getId(), "["+units1.getUnitDesc()+"]-"+deviceRepel1.getTitle(), taskBto.getId(), userId);
list.add(new RepelTaskStatistical(deviceRepel1.getId(), taskBto.getId(), taskBto1.getId(), 0, units1.getUnitDesc(), repelStatusJudgeCount(deviceRepel.getRepelStatus(), count), "",units1.getShowOrder()));
}
}
}
......@@ -597,8 +626,6 @@ public class RepelBusinessServiceImpl implements RepelBusinessService {
taskService.moveToSpecial(taskBto, StatusEnum.SEND_BACK_1212, userId);
}
repelTaskStatisticalService.saveAllRepelTaskStatistical(list);
}
@Override
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论