|
@@ -21,6 +21,7 @@ import cn.iocoder.yudao.module.pms.service.iotopeationfill.IotOpeationFillServic
|
|
|
import cn.iocoder.yudao.module.system.service.dept.DeptService;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
+import org.apache.ibatis.annotations.Param;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
|
|
import org.springframework.stereotype.Component;
|
|
@@ -225,12 +226,105 @@ public class IotOperationPlanJob implements JobHandler {
|
|
|
.filter(obj -> idList.contains(obj.getUserId()))
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
|
+ Set<Long> idList1 = new HashSet<>();
|
|
|
+ idList1 = deptService.getChildDeptIdListFromCache(157L);
|
|
|
+ idList1.add(157L);
|
|
|
+
|
|
|
+ boolean containPlan = idList1.contains(plan.getDeptId());
|
|
|
+
|
|
|
+ List<IotOpeationFillOrderDO> orderList2 = new ArrayList<>();
|
|
|
+ List<IotOperationPlanDO> rpList = new ArrayList<>();
|
|
|
+
|
|
|
+ Set<Long> pdeptList = new HashSet<>();
|
|
|
+ pdeptList = deptService.getChildDeptIdListFromCache(plan.getDeptId());
|
|
|
+ pdeptList.add(plan.getDeptId());
|
|
|
+
|
|
|
+ //查询日报计划
|
|
|
+ rpList = planMapper.getReportPlan(pdeptList);
|
|
|
+ List<Long> rpdList = rpList.stream().map(IotOperationPlanDO::getDeptId).collect(Collectors.toList());
|
|
|
+
|
|
|
+ if(rpdList.size()>0){
|
|
|
+ orderList2 = orderList.stream().filter(e->rpdList.contains(e.getDeptId())).collect(Collectors.toList());
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ if(containPlan){
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ if(rpList.size()>0){
|
|
|
+
|
|
|
+ //有责任人,但设备不满足条件,而且属于瑞恒
|
|
|
+ List<IotOpeationFillDO> pdList2 = iotOpeationFillMapper.pdList2(pdeptList);
|
|
|
+ //有责任人,且满足条件,而且属于瑞恒
|
|
|
|
|
|
+ //判断是否与日报计划所属部门一致
|
|
|
+ pdList2 = pdList2.stream().filter(e->rpdList.contains(e.getDeptId())).collect(Collectors.toList());
|
|
|
+
|
|
|
+ if(pdList2.size()>0){
|
|
|
+ orderList2 = new ArrayList<>();
|
|
|
+ try{
|
|
|
+ for (IotOpeationFillDO pd:pdList2) {
|
|
|
+
|
|
|
+ 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());
|
|
|
+ orderList2.add(fillDO);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ orderList1.addAll(orderList2);
|
|
|
+
|
|
|
+ }catch (Exception e){
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }else if(orderList2.size()>0){
|
|
|
+ orderList1.addAll(orderList2);
|
|
|
+ }
|
|
|
+
|
|
|
+ }else{
|
|
|
+ List<IotOpeationFillDO> pdList2 = iotOpeationFillMapper.pdList2(pdeptList);
|
|
|
+
|
|
|
+ if(pdList2.size()>0){
|
|
|
+
|
|
|
+ try{
|
|
|
+ for (IotOpeationFillDO pd:pdList2) {
|
|
|
+
|
|
|
+ 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());
|
|
|
+ orderList1.add(fillDO);
|
|
|
+ }
|
|
|
+
|
|
|
+ }catch (Exception e){
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
iotOpeationFillOrderMapper.insertBatch(orderList1);
|
|
|
|
|
|
|
|
|
- //发送钉钉通知
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ /* //发送钉钉通知
|
|
|
pmsThreadPoolTaskExecutor.execute(()->{
|
|
|
try{
|
|
|
for (IotOpeationFillOrderDO order:orderList1) {
|
|
@@ -239,7 +333,7 @@ public class IotOperationPlanJob implements JobHandler {
|
|
|
}catch (Exception e){
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
- });
|
|
|
+ });*/
|
|
|
|
|
|
|
|
|
for (IotOpeationFillDO device:deviceList) {
|
|
@@ -266,17 +360,19 @@ public class IotOperationPlanJob implements JobHandler {
|
|
|
iotOpeationFillMapper.insertFill(deviceList);
|
|
|
|
|
|
|
|
|
- Set<Long> idList1 = new HashSet<>();
|
|
|
- idList1 = deptService.getChildDeptIdListFromCache(157L);
|
|
|
- idList1.add(157L);
|
|
|
|
|
|
- List<Long> oDeptList = orderList1.stream().map(IotOpeationFillOrderDO::getDeptId).collect(Collectors.toList());
|
|
|
+ List<Long> oDeptList = orderList2.stream().map(IotOpeationFillOrderDO::getDeptId).collect(Collectors.toList());
|
|
|
|
|
|
boolean exist = idList1.containsAll(oDeptList);
|
|
|
|
|
|
if(exist){
|
|
|
+ List <IotOpeationFillDO> devList = new ArrayList<>();
|
|
|
+ if(rpList.size()>0){
|
|
|
+ devList = opeationFillService.reportMethod(orderList2);
|
|
|
+ }else{
|
|
|
+ devList = opeationFillService.reportMethod(orderList1);
|
|
|
+ }
|
|
|
//插入虚拟设备
|
|
|
- List <IotOpeationFillDO> devList = opeationFillService.reportMethod(orderList1);
|
|
|
iotOpeationFillMapper.insertFill(devList);
|
|
|
}
|
|
|
|