|
@@ -237,19 +237,23 @@ public class IotOperationPlanJob implements JobHandler {
|
|
List<Long> rpdList = rpList.stream().map(IotOperationPlanDO::getDeptId).collect(Collectors.toList());
|
|
List<Long> rpdList = rpList.stream().map(IotOperationPlanDO::getDeptId).collect(Collectors.toList());
|
|
|
|
|
|
|
|
|
|
- Set<Long> idList1 = new HashSet<>();
|
|
|
|
- idList1 = deptService.getChildDeptIdListFromCache(163L);
|
|
|
|
- idList1.add(163L);
|
|
|
|
|
|
+ Set<Long> rdIdList = new HashSet<>();
|
|
|
|
+ rdIdList = deptService.getChildDeptIdListFromCache(163L);
|
|
|
|
+ rdIdList.add(163L);
|
|
|
|
|
|
- boolean exist = idList1.contains(plan.getDeptId());
|
|
|
|
|
|
+ Set<Long> rhIdList = new HashSet<>();
|
|
|
|
+ rhIdList = deptService.getChildDeptIdListFromCache(157L);
|
|
|
|
+ rhIdList.add(157L);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ boolean exist = rdIdList.contains(plan.getDeptId());
|
|
|
|
|
|
if(!exist){
|
|
if(!exist){
|
|
//1、有指定队伍插入指定队伍日报设备
|
|
//1、有指定队伍插入指定队伍日报设备
|
|
- //2、无指定队伍全部队伍插入日报设备
|
|
|
|
|
|
+
|
|
if(rpList.size()>0){
|
|
if(rpList.size()>0){
|
|
//筛选日报工单
|
|
//筛选日报工单
|
|
List<IotOpeationFillOrderDO> virOrderList = orderList1.stream().filter(e->rpdList.contains(e.getDeptId())).collect(Collectors.toList());
|
|
List<IotOpeationFillOrderDO> virOrderList = orderList1.stream().filter(e->rpdList.contains(e.getDeptId())).collect(Collectors.toList());
|
|
-
|
|
|
|
if(virOrderList.size()>0){
|
|
if(virOrderList.size()>0){
|
|
//创建日报设备
|
|
//创建日报设备
|
|
List <IotOpeationFillDO> devList = opeationFillService.reportMethod(virOrderList);
|
|
List <IotOpeationFillDO> devList = opeationFillService.reportMethod(virOrderList);
|
|
@@ -257,12 +261,69 @@ public class IotOperationPlanJob implements JobHandler {
|
|
iotOpeationFillMapper.insertFill(devList);
|
|
iotOpeationFillMapper.insertFill(devList);
|
|
|
|
|
|
}
|
|
}
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ boolean rhContain = rhIdList.contains(plan.getDeptId());
|
|
|
|
+
|
|
|
|
+ if(rhContain){
|
|
|
|
+ //2、瑞恒无指定队伍全部队伍插入日报设备
|
|
|
|
+ //筛选正常工单部门id
|
|
|
|
+ List<Long> deptIdList = orderList1.stream().map(IotOpeationFillOrderDO::getDeptId).collect(Collectors.toList());
|
|
|
|
+ //查询瑞恒所有责任人数据
|
|
|
|
+ Set<Long> pIdList = new HashSet<>();
|
|
|
|
+ pIdList = deptService.getChildDeptIdListFromCache(plan.getDeptId());
|
|
|
|
+ pIdList.add(plan.getDeptId());
|
|
|
|
+ List<IotOpeationFillDO> rhPdList = iotOpeationFillMapper.pdListRh(pIdList);
|
|
|
|
+ //筛选与正常工单不同部门的责任人数据
|
|
|
|
+ List<IotOpeationFillDO> verRPList = rhPdList.stream().filter(e->!deptIdList.contains(e.getDeptId())).collect(Collectors.toList());
|
|
|
|
+ //筛选小队责任人数据
|
|
|
|
+ // 使用迭代器遍历集合
|
|
|
|
+ Iterator<IotOpeationFillDO> iterator = verRPList.iterator();
|
|
|
|
+ while (iterator.hasNext()) {
|
|
|
|
+ IotOpeationFillDO rp = iterator.next();
|
|
|
|
+ IotOpeationFillOrderDO rpOrder = new IotOpeationFillOrderDO();
|
|
|
|
+ rpOrder.setDeptId(rp.getDeptId());
|
|
|
|
+ List<IotOpeationFillOrderDO> childList = iotOpeationFillMapper.childList(rpOrder);
|
|
|
|
+
|
|
|
|
+ // 当childList有元素时,通过迭代器删除当前元素
|
|
|
|
+ if (childList.size() > 0) {
|
|
|
|
+ iterator.remove(); // 使用迭代器的remove方法安全删除
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ //创建虚拟工单
|
|
|
|
+ if(verRPList.size()>0){
|
|
|
|
+ List<IotOpeationFillOrderDO> virOrderList = new ArrayList<>();
|
|
|
|
+ for (IotOpeationFillDO pd:verRPList) {
|
|
|
|
+ IotOpeationFillOrderDO fillDO = new IotOpeationFillOrderDO();
|
|
|
|
+ fillDO.setOrderName(pd.getOrgName()+"/"+LocalDate.now()+"运行记录填报");
|
|
|
|
+ fillDO.setDeptId(pd.getDeptId());
|
|
|
|
+ fillDO.setOrderStatus(0);
|
|
|
|
+ fillDO.setCreateTime(LocalDateTime.now());
|
|
|
|
+ fillDO.setUserName(pd.getUserName());
|
|
|
|
+ fillDO.setUserId(pd.getUserId());
|
|
|
|
+ fillDO.setMobile(pd.getMobile());
|
|
|
|
+ virOrderList.add(fillDO);
|
|
|
|
+ }
|
|
|
|
+ if(virOrderList.size()>0){
|
|
|
|
+ orderList1.addAll(virOrderList);
|
|
|
|
+ //插入虚拟工单工单
|
|
|
|
+ iotOpeationFillOrderMapper.insertBatch(virOrderList);
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ //创建日报设备
|
|
|
|
+ List <IotOpeationFillDO> devList = opeationFillService.reportMethod(orderList1);
|
|
|
|
+ //插入日报设备
|
|
|
|
+ iotOpeationFillMapper.insertFill(devList);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- //发送钉钉通知
|
|
|
|
|
|
+ /*//发送钉钉通知
|
|
pmsThreadPoolTaskExecutor.execute(()->{
|
|
pmsThreadPoolTaskExecutor.execute(()->{
|
|
try{
|
|
try{
|
|
for (IotOpeationFillOrderDO order:orderList1) {
|
|
for (IotOpeationFillOrderDO order:orderList1) {
|
|
@@ -271,7 +332,7 @@ public class IotOperationPlanJob implements JobHandler {
|
|
}catch (Exception e){
|
|
}catch (Exception e){
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
}
|
|
}
|
|
- });
|
|
|
|
|
|
+ });*/
|
|
|
|
|
|
|
|
|
|
//正常工单设备
|
|
//正常工单设备
|