|
@@ -6,14 +6,8 @@ import com.ruoyi.common.utils.StringUtils;
|
|
|
import com.ruoyi.framework.web.controller.BaseController;
|
|
|
import com.ruoyi.project.sems.domain.*;
|
|
|
import com.ruoyi.project.sems.service.*;
|
|
|
-import com.ruoyi.project.system.domain.SysUser;
|
|
|
-import com.ruoyi.project.system.domain.TAlarmPrincipal;
|
|
|
-import com.ruoyi.project.system.domain.TAlarmhistory;
|
|
|
-import com.ruoyi.project.system.domain.TAlarmtype;
|
|
|
-import com.ruoyi.project.system.service.ISysUserService;
|
|
|
-import com.ruoyi.project.system.service.ITAlarmPrincipalService;
|
|
|
-import com.ruoyi.project.system.service.ITAlarmhistoryService;
|
|
|
-import com.ruoyi.project.system.service.ITAlarmtypeService;
|
|
|
+import com.ruoyi.project.system.domain.*;
|
|
|
+import com.ruoyi.project.system.service.*;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
@@ -61,6 +55,8 @@ public class TSpecdevAllTask extends BaseController {
|
|
|
//注入报警记录管理的接口
|
|
|
@Autowired
|
|
|
private ITAlarmhistoryService alarmhistoryService;
|
|
|
+ @Autowired
|
|
|
+ private ISysPlantService sysPlantService;
|
|
|
|
|
|
private final String glAlarmType = "特种设备-锅炉-在用";
|
|
|
private final String glUrlSuffix = "sems/devgl/specGl";
|
|
@@ -103,39 +99,7 @@ public class TSpecdevAllTask extends BaseController {
|
|
|
}
|
|
|
|
|
|
private void checkWarnFlagForGl(Long firstlevel, Long secondlevel, Long thirdlevel, SimpleDateFormat sdf) {
|
|
|
- List<TSpecdevGl> list = this.specdevGlService.list(new QueryWrapper<TSpecdevGl>()
|
|
|
- .eq("del_flag", 0).eq("status", "1"));
|
|
|
- //获取动态处理预警级别
|
|
|
- TAlarmtype tAlarmtype = this.tAlarmtypeService.selectTAlarmtypeById(this.alarmtype);
|
|
|
- List<TSpecdevGl> firstList = new ArrayList<>();
|
|
|
- List<TSpecdevGl> secondList = new ArrayList<>();
|
|
|
- List<TSpecdevGl> thirdList = new ArrayList<>();
|
|
|
- for (TSpecdevGl tSpecdevGl : list) {
|
|
|
- if (tSpecdevGl.getNextWarnDate() != null) {
|
|
|
- long now = System.currentTimeMillis();
|
|
|
- long diff = tSpecdevGl.getNextWarnDate().getTime() - now;
|
|
|
- long nd = 1000 * 24 * 60 * 60;
|
|
|
- long day = diff / nd;
|
|
|
- // 半年内 预警标识为2级
|
|
|
- if (day > 0 && day <= secondlevel) {
|
|
|
- this.updateForGl(2L, tSpecdevGl);
|
|
|
- firstList.add(tSpecdevGl);
|
|
|
- continue;
|
|
|
- }
|
|
|
- // 半年-一年 预警标识为1级
|
|
|
- if (day > secondlevel && day <= thirdlevel) {
|
|
|
- this.updateForGl(1L, tSpecdevGl);
|
|
|
- secondList.add(tSpecdevGl);
|
|
|
- continue;
|
|
|
- }
|
|
|
- // 超时 预警标识为3级
|
|
|
- if (day < firstlevel) {
|
|
|
- this.updateForGl(3L, tSpecdevGl);
|
|
|
- thirdList.add(tSpecdevGl);
|
|
|
- continue;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+
|
|
|
//获取需要发送邮件的人员信息
|
|
|
TAlarmPrincipal tAlarmPrincipal = new TAlarmPrincipal();
|
|
|
tAlarmPrincipal.setTypeId(this.alarmtype);
|
|
@@ -149,6 +113,48 @@ public class TSpecdevAllTask extends BaseController {
|
|
|
}
|
|
|
userList.add(tAlarmPrincipal);
|
|
|
for (TAlarmPrincipal o : userList) {
|
|
|
+ //根据装置权限获取数据
|
|
|
+ List<SysPlant> plantList = sysPlantService.selectSysPlantByDeptId(o.getDeptId());
|
|
|
+ List<String> plants = new ArrayList<>();
|
|
|
+ for (SysPlant s:plantList
|
|
|
+ ) {
|
|
|
+ plants.add(s.getName());
|
|
|
+ }
|
|
|
+ List<TSpecdevGl> list = this.specdevGlService.list(new QueryWrapper<TSpecdevGl>()
|
|
|
+ .eq("del_flag", 0).eq("status", "1")
|
|
|
+ .in("plant_code" ,plants)
|
|
|
+ );
|
|
|
+ //获取动态处理预警级别
|
|
|
+ TAlarmtype tAlarmtype = this.tAlarmtypeService.selectTAlarmtypeById(this.alarmtype);
|
|
|
+ List<TSpecdevGl> firstList = new ArrayList<>();
|
|
|
+ List<TSpecdevGl> secondList = new ArrayList<>();
|
|
|
+ List<TSpecdevGl> thirdList = new ArrayList<>();
|
|
|
+ for (TSpecdevGl tSpecdevGl : list) {
|
|
|
+ if (tSpecdevGl.getNextWarnDate() != null) {
|
|
|
+ long now = System.currentTimeMillis();
|
|
|
+ long diff = tSpecdevGl.getNextWarnDate().getTime() - now;
|
|
|
+ long nd = 1000 * 24 * 60 * 60;
|
|
|
+ long day = diff / nd;
|
|
|
+ // 半年内 预警标识为2级
|
|
|
+ if (day > 0 && day <= secondlevel) {
|
|
|
+ this.updateForGl(2L, tSpecdevGl);
|
|
|
+ firstList.add(tSpecdevGl);
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ // 半年-一年 预警标识为1级
|
|
|
+ if (day > secondlevel && day <= thirdlevel) {
|
|
|
+ this.updateForGl(1L, tSpecdevGl);
|
|
|
+ secondList.add(tSpecdevGl);
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ // 超时 预警标识为3级
|
|
|
+ if (day < firstlevel) {
|
|
|
+ this.updateForGl(3L, tSpecdevGl);
|
|
|
+ thirdList.add(tSpecdevGl);
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
glSendEmail(sdf, firstList, o, this.glWarningContent(firstList, sdf), this.firstWarningLevel);
|
|
|
glSendEmail(sdf, secondList, o, this.glWarningContent(secondList, sdf), this.secondWarningLevel);
|
|
|
glSendEmail(sdf, thirdList, o, this.glWarningContent(thirdList, sdf), this.thirdWarningLevel);
|
|
@@ -156,37 +162,7 @@ public class TSpecdevAllTask extends BaseController {
|
|
|
}
|
|
|
|
|
|
private void checkWarnFlagForCc(Long firstlevel, Long secondlevel, Long thirdlevel, SimpleDateFormat sdf) {
|
|
|
- List<TSpecdevCc> list = this.specdevCcService.list(new QueryWrapper<TSpecdevCc>()
|
|
|
- .eq("del_flag", 0).eq("status", "1"));
|
|
|
- List<TSpecdevCc> firstList = new ArrayList<>();
|
|
|
- List<TSpecdevCc> secondList = new ArrayList<>();
|
|
|
- List<TSpecdevCc> thirdList = new ArrayList<>();
|
|
|
- for (TSpecdevCc tSpecdevCc : list) {
|
|
|
- if (tSpecdevCc.getNextWarnDate() != null) {
|
|
|
- long now = System.currentTimeMillis();
|
|
|
- long diff = tSpecdevCc.getNextWarnDate().getTime() - now;
|
|
|
- long nd = 1000 * 24 * 60 * 60;
|
|
|
- long day = diff / nd;
|
|
|
- // 半年内 预警标识为2级
|
|
|
- if (day > 0 && day <= secondlevel) {
|
|
|
- this.updateForCc(2L, tSpecdevCc);
|
|
|
- firstList.add(tSpecdevCc);
|
|
|
- continue;
|
|
|
- }
|
|
|
- // 半年-一年 预警标识为1级
|
|
|
- if (day > secondlevel && day <= thirdlevel) {
|
|
|
- this.updateForCc(1L, tSpecdevCc);
|
|
|
- secondList.add(tSpecdevCc);
|
|
|
- continue;
|
|
|
- }
|
|
|
- // 超时 预警标识为3级
|
|
|
- if (day < firstlevel) {
|
|
|
- this.updateForCc(3L, tSpecdevCc);
|
|
|
- thirdList.add(tSpecdevCc);
|
|
|
- continue;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+
|
|
|
//获取需要发送邮件的人员信息
|
|
|
TAlarmPrincipal tAlarmPrincipal = new TAlarmPrincipal();
|
|
|
tAlarmPrincipal.setTypeId(this.alarmtype);
|
|
@@ -199,6 +175,44 @@ public class TSpecdevAllTask extends BaseController {
|
|
|
}
|
|
|
}
|
|
|
for (TAlarmPrincipal o : userList) {
|
|
|
+ //根据装置权限获取数据
|
|
|
+ List<SysPlant> plantList = sysPlantService.selectSysPlantByDeptId(o.getDeptId());
|
|
|
+ List<String> plants = new ArrayList<>();
|
|
|
+ for (SysPlant s:plantList
|
|
|
+ ) {
|
|
|
+ plants.add(s.getName());
|
|
|
+ }
|
|
|
+ List<TSpecdevCc> list = this.specdevCcService.list(new QueryWrapper<TSpecdevCc>()
|
|
|
+ .eq("del_flag", 0).eq("status", "1").in("plant_code" ,plants));
|
|
|
+ List<TSpecdevCc> firstList = new ArrayList<>();
|
|
|
+ List<TSpecdevCc> secondList = new ArrayList<>();
|
|
|
+ List<TSpecdevCc> thirdList = new ArrayList<>();
|
|
|
+ for (TSpecdevCc tSpecdevCc : list) {
|
|
|
+ if (tSpecdevCc.getNextWarnDate() != null) {
|
|
|
+ long now = System.currentTimeMillis();
|
|
|
+ long diff = tSpecdevCc.getNextWarnDate().getTime() - now;
|
|
|
+ long nd = 1000 * 24 * 60 * 60;
|
|
|
+ long day = diff / nd;
|
|
|
+ // 半年内 预警标识为2级
|
|
|
+ if (day > 0 && day <= secondlevel) {
|
|
|
+ this.updateForCc(2L, tSpecdevCc);
|
|
|
+ firstList.add(tSpecdevCc);
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ // 半年-一年 预警标识为1级
|
|
|
+ if (day > secondlevel && day <= thirdlevel) {
|
|
|
+ this.updateForCc(1L, tSpecdevCc);
|
|
|
+ secondList.add(tSpecdevCc);
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ // 超时 预警标识为3级
|
|
|
+ if (day < firstlevel) {
|
|
|
+ this.updateForCc(3L, tSpecdevCc);
|
|
|
+ thirdList.add(tSpecdevCc);
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
ccSendEmail(sdf, firstList, o, this.ccWarningContent(firstList, sdf), this.firstWarningLevel);
|
|
|
ccSendEmail(sdf, secondList, o, this.ccWarningContent(secondList, sdf), this.secondWarningLevel);
|
|
|
ccSendEmail(sdf, thirdList, o, this.ccWarningContent(thirdList, sdf), this.thirdWarningLevel);
|
|
@@ -206,37 +220,7 @@ public class TSpecdevAllTask extends BaseController {
|
|
|
}
|
|
|
|
|
|
private void checkWarnFlagForDzsb(Long firstlevel, Long secondlevel, Long thirdlevel, SimpleDateFormat sdf) {
|
|
|
- List<TSpecdevDzsb> list = this.specdevDzsbService.list(new QueryWrapper<TSpecdevDzsb>()
|
|
|
- .eq("del_flag", 0).eq("status", "1"));
|
|
|
- List<TSpecdevDzsb> firstList = new ArrayList<>();
|
|
|
- List<TSpecdevDzsb> secondList = new ArrayList<>();
|
|
|
- List<TSpecdevDzsb> thirdList = new ArrayList<>();
|
|
|
- for (TSpecdevDzsb tSpecdevDzsb : list) {
|
|
|
- if (tSpecdevDzsb.getNextWarnDate() != null) {
|
|
|
- long now = System.currentTimeMillis();
|
|
|
- long diff = tSpecdevDzsb.getNextWarnDate().getTime() - now;
|
|
|
- long nd = 1000 * 24 * 60 * 60;
|
|
|
- long day = diff / nd;
|
|
|
- // 半年内 预警标识为2级
|
|
|
- if (day > 0 && day <= secondlevel) {
|
|
|
- this.updateForDzsb(2L, tSpecdevDzsb);
|
|
|
- firstList.add(tSpecdevDzsb);
|
|
|
- continue;
|
|
|
- }
|
|
|
- // 半年-一年 预警标识为1级
|
|
|
- if (day > secondlevel && day <= thirdlevel) {
|
|
|
- this.updateForDzsb(1L, tSpecdevDzsb);
|
|
|
- secondList.add(tSpecdevDzsb);
|
|
|
- continue;
|
|
|
- }
|
|
|
- // 超时 预警标识为3级
|
|
|
- if (day < firstlevel) {
|
|
|
- this.updateForDzsb(3L, tSpecdevDzsb);
|
|
|
- thirdList.add(tSpecdevDzsb);
|
|
|
- continue;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+
|
|
|
//获取需要发送邮件的人员信息
|
|
|
TAlarmPrincipal tAlarmPrincipal = new TAlarmPrincipal();
|
|
|
tAlarmPrincipal.setTypeId(this.alarmtype);
|
|
@@ -249,6 +233,44 @@ public class TSpecdevAllTask extends BaseController {
|
|
|
}
|
|
|
}
|
|
|
for (TAlarmPrincipal o : userList) {
|
|
|
+ //根据装置权限获取数据
|
|
|
+ List<SysPlant> plantList = sysPlantService.selectSysPlantByDeptId(o.getDeptId());
|
|
|
+ List<String> plants = new ArrayList<>();
|
|
|
+ for (SysPlant s:plantList
|
|
|
+ ) {
|
|
|
+ plants.add(s.getName());
|
|
|
+ }
|
|
|
+ List<TSpecdevDzsb> list = this.specdevDzsbService.list(new QueryWrapper<TSpecdevDzsb>()
|
|
|
+ .eq("del_flag", 0).eq("status", "1").in("plant_code" ,plants));
|
|
|
+ List<TSpecdevDzsb> firstList = new ArrayList<>();
|
|
|
+ List<TSpecdevDzsb> secondList = new ArrayList<>();
|
|
|
+ List<TSpecdevDzsb> thirdList = new ArrayList<>();
|
|
|
+ for (TSpecdevDzsb tSpecdevDzsb : list) {
|
|
|
+ if (tSpecdevDzsb.getNextWarnDate() != null) {
|
|
|
+ long now = System.currentTimeMillis();
|
|
|
+ long diff = tSpecdevDzsb.getNextWarnDate().getTime() - now;
|
|
|
+ long nd = 1000 * 24 * 60 * 60;
|
|
|
+ long day = diff / nd;
|
|
|
+ // 半年内 预警标识为2级
|
|
|
+ if (day > 0 && day <= secondlevel) {
|
|
|
+ this.updateForDzsb(2L, tSpecdevDzsb);
|
|
|
+ firstList.add(tSpecdevDzsb);
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ // 半年-一年 预警标识为1级
|
|
|
+ if (day > secondlevel && day <= thirdlevel) {
|
|
|
+ this.updateForDzsb(1L, tSpecdevDzsb);
|
|
|
+ secondList.add(tSpecdevDzsb);
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ // 超时 预警标识为3级
|
|
|
+ if (day < firstlevel) {
|
|
|
+ this.updateForDzsb(3L, tSpecdevDzsb);
|
|
|
+ thirdList.add(tSpecdevDzsb);
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
dzsbSendEmail(sdf, firstList, o, this.dzsbWarningContent(firstList, sdf), this.firstWarningLevel);
|
|
|
dzsbSendEmail(sdf, secondList, o, this.dzsbWarningContent(secondList, sdf), this.secondWarningLevel);
|
|
|
dzsbSendEmail(sdf, thirdList, o, this.dzsbWarningContent(thirdList, sdf), this.thirdWarningLevel);
|
|
@@ -256,37 +278,7 @@ public class TSpecdevAllTask extends BaseController {
|
|
|
}
|
|
|
|
|
|
private void checkWarnFlagForYlrq(Long firstlevel, Long secondlevel, Long thirdlevel, SimpleDateFormat sdf) {
|
|
|
- List<TSpecdevYlrq> list = this.specdevYlrqService.list(new QueryWrapper<TSpecdevYlrq>()
|
|
|
- .eq("del_flag", 0).eq("status", "1"));
|
|
|
- List<TSpecdevYlrq> firstList = new ArrayList<>();
|
|
|
- List<TSpecdevYlrq> secondList = new ArrayList<>();
|
|
|
- List<TSpecdevYlrq> thirdList = new ArrayList<>();
|
|
|
- for (TSpecdevYlrq tSpecdevYlrq : list) {
|
|
|
- if (tSpecdevYlrq.getNextWarnDate() != null) {
|
|
|
- long now = System.currentTimeMillis();
|
|
|
- long diff = tSpecdevYlrq.getNextWarnDate().getTime() - now;
|
|
|
- long nd = 1000 * 24 * 60 * 60;
|
|
|
- long day = diff / nd;
|
|
|
- // 半年内 预警标识为2级
|
|
|
- if (day > 0 && day <= secondlevel) {
|
|
|
- this.updateForYlrq(2L, tSpecdevYlrq);
|
|
|
- firstList.add(tSpecdevYlrq);
|
|
|
- continue;
|
|
|
- }
|
|
|
- // 半年-一年 预警标识为1级
|
|
|
- if (day > secondlevel && day <= thirdlevel) {
|
|
|
- this.updateForYlrq(1L, tSpecdevYlrq);
|
|
|
- secondList.add(tSpecdevYlrq);
|
|
|
- continue;
|
|
|
- }
|
|
|
- // 超时 预警标识为3级
|
|
|
- if (day < firstlevel) {
|
|
|
- this.updateForYlrq(3L, tSpecdevYlrq);
|
|
|
- thirdList.add(tSpecdevYlrq);
|
|
|
- continue;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+
|
|
|
//获取需要发送邮件的人员信息
|
|
|
TAlarmPrincipal tAlarmPrincipal = new TAlarmPrincipal();
|
|
|
tAlarmPrincipal.setTypeId(this.alarmtype);
|
|
@@ -299,6 +291,44 @@ public class TSpecdevAllTask extends BaseController {
|
|
|
}
|
|
|
}
|
|
|
for (TAlarmPrincipal o : userList) {
|
|
|
+ //根据装置权限获取数据
|
|
|
+ List<SysPlant> plantList = sysPlantService.selectSysPlantByDeptId(o.getDeptId());
|
|
|
+ List<String> plants = new ArrayList<>();
|
|
|
+ for (SysPlant s:plantList
|
|
|
+ ) {
|
|
|
+ plants.add(s.getName());
|
|
|
+ }
|
|
|
+ List<TSpecdevYlrq> list = this.specdevYlrqService.list(new QueryWrapper<TSpecdevYlrq>()
|
|
|
+ .eq("del_flag", 0).eq("status", "1").in("plant_code" ,plants));
|
|
|
+ List<TSpecdevYlrq> firstList = new ArrayList<>();
|
|
|
+ List<TSpecdevYlrq> secondList = new ArrayList<>();
|
|
|
+ List<TSpecdevYlrq> thirdList = new ArrayList<>();
|
|
|
+ for (TSpecdevYlrq tSpecdevYlrq : list) {
|
|
|
+ if (tSpecdevYlrq.getNextWarnDate() != null) {
|
|
|
+ long now = System.currentTimeMillis();
|
|
|
+ long diff = tSpecdevYlrq.getNextWarnDate().getTime() - now;
|
|
|
+ long nd = 1000 * 24 * 60 * 60;
|
|
|
+ long day = diff / nd;
|
|
|
+ // 半年内 预警标识为2级
|
|
|
+ if (day > 0 && day <= secondlevel) {
|
|
|
+ this.updateForYlrq(2L, tSpecdevYlrq);
|
|
|
+ firstList.add(tSpecdevYlrq);
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ // 半年-一年 预警标识为1级
|
|
|
+ if (day > secondlevel && day <= thirdlevel) {
|
|
|
+ this.updateForYlrq(1L, tSpecdevYlrq);
|
|
|
+ secondList.add(tSpecdevYlrq);
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ // 超时 预警标识为3级
|
|
|
+ if (day < firstlevel) {
|
|
|
+ this.updateForYlrq(3L, tSpecdevYlrq);
|
|
|
+ thirdList.add(tSpecdevYlrq);
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
ylrqSendEmail(sdf, firstList, o, this.ylrqWarningContent(firstList, sdf), this.firstWarningLevel);
|
|
|
ylrqSendEmail(sdf, secondList, o, this.ylrqWarningContent(secondList, sdf), this.secondWarningLevel);
|
|
|
ylrqSendEmail(sdf, thirdList, o, this.ylrqWarningContent(thirdList, sdf), this.thirdWarningLevel);
|
|
@@ -306,37 +336,7 @@ public class TSpecdevAllTask extends BaseController {
|
|
|
}
|
|
|
|
|
|
private void checkWarnFlagForYlgd(Long firstlevel, Long secondlevel, Long thirdlevel, SimpleDateFormat sdf) {
|
|
|
- List<TSpecdevYlgd> list = this.specdevYlgdService.list(new QueryWrapper<TSpecdevYlgd>()
|
|
|
- .eq("del_flag", 0).eq("status", "1"));
|
|
|
- List<TSpecdevYlgd> firstList = new ArrayList<>();
|
|
|
- List<TSpecdevYlgd> secondList = new ArrayList<>();
|
|
|
- List<TSpecdevYlgd> thirdList = new ArrayList<>();
|
|
|
- for (TSpecdevYlgd tSpecdevYlgd : list) {
|
|
|
- if (tSpecdevYlgd.getNextWarnDate() != null) {
|
|
|
- long now = System.currentTimeMillis();
|
|
|
- long diff = tSpecdevYlgd.getNextWarnDate().getTime() - now;
|
|
|
- long nd = 1000 * 24 * 60 * 60;
|
|
|
- long day = diff / nd;
|
|
|
- // 半年内 预警标识为2级
|
|
|
- if (day > 0 && day <= secondlevel) {
|
|
|
- this.updateForYlgd(2L, tSpecdevYlgd);
|
|
|
- firstList.add(tSpecdevYlgd);
|
|
|
- continue;
|
|
|
- }
|
|
|
- // 半年-一年 预警标识为1级
|
|
|
- if (day > secondlevel && day <= thirdlevel) {
|
|
|
- this.updateForYlgd(1L, tSpecdevYlgd);
|
|
|
- secondList.add(tSpecdevYlgd);
|
|
|
- continue;
|
|
|
- }
|
|
|
- // 超时 预警标识为3级
|
|
|
- if (day < firstlevel) {
|
|
|
- this.updateForYlgd(3L, tSpecdevYlgd);
|
|
|
- thirdList.add(tSpecdevYlgd);
|
|
|
- continue;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+
|
|
|
//获取需要发送邮件的人员信息
|
|
|
TAlarmPrincipal tAlarmPrincipal = new TAlarmPrincipal();
|
|
|
tAlarmPrincipal.setTypeId(this.alarmtype);
|
|
@@ -349,6 +349,44 @@ public class TSpecdevAllTask extends BaseController {
|
|
|
}
|
|
|
}
|
|
|
for (TAlarmPrincipal o : userList) {
|
|
|
+ //根据装置权限获取数据
|
|
|
+ List<SysPlant> plantList = sysPlantService.selectSysPlantByDeptId(o.getDeptId());
|
|
|
+ List<String> plants = new ArrayList<>();
|
|
|
+ for (SysPlant s:plantList
|
|
|
+ ) {
|
|
|
+ plants.add(s.getName());
|
|
|
+ }
|
|
|
+ List<TSpecdevYlgd> list = this.specdevYlgdService.list(new QueryWrapper<TSpecdevYlgd>()
|
|
|
+ .eq("del_flag", 0).eq("status", "1").in("plant_code" ,plants));
|
|
|
+ List<TSpecdevYlgd> firstList = new ArrayList<>();
|
|
|
+ List<TSpecdevYlgd> secondList = new ArrayList<>();
|
|
|
+ List<TSpecdevYlgd> thirdList = new ArrayList<>();
|
|
|
+ for (TSpecdevYlgd tSpecdevYlgd : list) {
|
|
|
+ if (tSpecdevYlgd.getNextWarnDate() != null) {
|
|
|
+ long now = System.currentTimeMillis();
|
|
|
+ long diff = tSpecdevYlgd.getNextWarnDate().getTime() - now;
|
|
|
+ long nd = 1000 * 24 * 60 * 60;
|
|
|
+ long day = diff / nd;
|
|
|
+ // 半年内 预警标识为2级
|
|
|
+ if (day > 0 && day <= secondlevel) {
|
|
|
+ this.updateForYlgd(2L, tSpecdevYlgd);
|
|
|
+ firstList.add(tSpecdevYlgd);
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ // 半年-一年 预警标识为1级
|
|
|
+ if (day > secondlevel && day <= thirdlevel) {
|
|
|
+ this.updateForYlgd(1L, tSpecdevYlgd);
|
|
|
+ secondList.add(tSpecdevYlgd);
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ // 超时 预警标识为3级
|
|
|
+ if (day < firstlevel) {
|
|
|
+ this.updateForYlgd(3L, tSpecdevYlgd);
|
|
|
+ thirdList.add(tSpecdevYlgd);
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
ylgdSendEmail(sdf, firstList, o, this.ylgdWarningContent(firstList, sdf), this.firstWarningLevel);
|
|
|
ylgdSendEmail(sdf, secondList, o, this.ylgdWarningContent(secondList, sdf), this.secondWarningLevel);
|
|
|
ylgdSendEmail(sdf, thirdList, o, this.ylgdWarningContent(thirdList, sdf), this.thirdWarningLevel);
|
|
@@ -356,37 +394,7 @@ public class TSpecdevAllTask extends BaseController {
|
|
|
}
|
|
|
|
|
|
private void checkWarnFlagForDt(Long firstlevel, Long secondlevel, Long thirdlevel, SimpleDateFormat sdf) {
|
|
|
- List<TSpecdevDt> list = this.specdevDtService.list(new QueryWrapper<TSpecdevDt>()
|
|
|
- .eq("del_flag", 0).eq("status", "1"));
|
|
|
- List<TSpecdevDt> firstList = new ArrayList<>();
|
|
|
- List<TSpecdevDt> secondList = new ArrayList<>();
|
|
|
- List<TSpecdevDt> thirdList = new ArrayList<>();
|
|
|
- for (TSpecdevDt tSpecdevDt : list) {
|
|
|
- if (tSpecdevDt.getNextWarnDate() != null) {
|
|
|
- long now = System.currentTimeMillis();
|
|
|
- long diff = tSpecdevDt.getNextWarnDate().getTime() - now;
|
|
|
- long nd = 1000 * 24 * 60 * 60;
|
|
|
- long day = diff / nd;
|
|
|
- // 半年内 预警标识为2级
|
|
|
- if (day > 0 && day <= secondlevel) {
|
|
|
- this.updateForDt(2L, tSpecdevDt);
|
|
|
- firstList.add(tSpecdevDt);
|
|
|
- continue;
|
|
|
- }
|
|
|
- // 半年-一年 预警标识为1级
|
|
|
- if (day > secondlevel && day <= thirdlevel) {
|
|
|
- this.updateForDt(1L, tSpecdevDt);
|
|
|
- secondList.add(tSpecdevDt);
|
|
|
- continue;
|
|
|
- }
|
|
|
- // 超时 预警标识为3级
|
|
|
- if (day < firstlevel) {
|
|
|
- this.updateForDt(3L, tSpecdevDt);
|
|
|
- thirdList.add(tSpecdevDt);
|
|
|
- continue;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+
|
|
|
//获取需要发送邮件的人员信息
|
|
|
TAlarmPrincipal tAlarmPrincipal = new TAlarmPrincipal();
|
|
|
tAlarmPrincipal.setTypeId(this.alarmtype);
|
|
@@ -399,6 +407,44 @@ public class TSpecdevAllTask extends BaseController {
|
|
|
}
|
|
|
}
|
|
|
for (TAlarmPrincipal o : userList) {
|
|
|
+ //根据装置权限获取数据
|
|
|
+ List<SysPlant> plantList = sysPlantService.selectSysPlantByDeptId(o.getDeptId());
|
|
|
+ List<String> plants = new ArrayList<>();
|
|
|
+ for (SysPlant s:plantList
|
|
|
+ ) {
|
|
|
+ plants.add(s.getName());
|
|
|
+ }
|
|
|
+ List<TSpecdevDt> list = this.specdevDtService.list(new QueryWrapper<TSpecdevDt>()
|
|
|
+ .eq("del_flag", 0).eq("status", "1").in("plant_code" ,plants));
|
|
|
+ List<TSpecdevDt> firstList = new ArrayList<>();
|
|
|
+ List<TSpecdevDt> secondList = new ArrayList<>();
|
|
|
+ List<TSpecdevDt> thirdList = new ArrayList<>();
|
|
|
+ for (TSpecdevDt tSpecdevDt : list) {
|
|
|
+ if (tSpecdevDt.getNextWarnDate() != null) {
|
|
|
+ long now = System.currentTimeMillis();
|
|
|
+ long diff = tSpecdevDt.getNextWarnDate().getTime() - now;
|
|
|
+ long nd = 1000 * 24 * 60 * 60;
|
|
|
+ long day = diff / nd;
|
|
|
+ // 半年内 预警标识为2级
|
|
|
+ if (day > 0 && day <= secondlevel) {
|
|
|
+ this.updateForDt(2L, tSpecdevDt);
|
|
|
+ firstList.add(tSpecdevDt);
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ // 半年-一年 预警标识为1级
|
|
|
+ if (day > secondlevel && day <= thirdlevel) {
|
|
|
+ this.updateForDt(1L, tSpecdevDt);
|
|
|
+ secondList.add(tSpecdevDt);
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ // 超时 预警标识为3级
|
|
|
+ if (day < firstlevel) {
|
|
|
+ this.updateForDt(3L, tSpecdevDt);
|
|
|
+ thirdList.add(tSpecdevDt);
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
dtSendEmail(sdf, firstList, o, this.dtWarningContent(firstList, sdf), this.firstWarningLevel);
|
|
|
dtSendEmail(sdf, secondList, o, this.dtWarningContent(secondList, sdf), this.secondWarningLevel);
|
|
|
dtSendEmail(sdf, thirdList, o, this.dtWarningContent(thirdList, sdf), this.thirdWarningLevel);
|