|
@@ -1,14 +1,34 @@
|
|
package com.ruoyi.framework.task;
|
|
package com.ruoyi.framework.task;
|
|
|
|
|
|
|
|
+import com.github.stuxuhai.jpinyin.PinyinException;
|
|
|
|
+import com.ruoyi.common.sendEmail.IMailService;
|
|
|
|
+import com.ruoyi.common.thread.furnance.FurnancePressureThread;
|
|
|
|
+import com.ruoyi.common.thread.furnance.FurnanceTemperatureThread;
|
|
|
|
+import com.ruoyi.common.thread.sai.SaiApplyDueMailThread;
|
|
|
|
+import com.ruoyi.common.utils.StringUtils;
|
|
import com.ruoyi.framework.web.controller.BaseController;
|
|
import com.ruoyi.framework.web.controller.BaseController;
|
|
|
|
+import com.ruoyi.framework.web.domain.AjaxResult;
|
|
|
|
+import com.ruoyi.project.plant.domain.TStaffmgr;
|
|
|
|
+import com.ruoyi.project.plant.service.ITStaffmgrService;
|
|
|
|
+import com.ruoyi.project.production.controller.TFurnancePressureController;
|
|
|
|
+import com.ruoyi.project.production.controller.TFurnanceTemperatureController;
|
|
|
|
+import com.ruoyi.project.production.controller.vo.FurnancePressureFvpVO;
|
|
|
|
+import com.ruoyi.project.production.controller.vo.FurnanceTemperatureVO;
|
|
import com.ruoyi.project.production.domain.TFurnancePressure;
|
|
import com.ruoyi.project.production.domain.TFurnancePressure;
|
|
import com.ruoyi.project.production.domain.TFurnanceTemperature;
|
|
import com.ruoyi.project.production.domain.TFurnanceTemperature;
|
|
import com.ruoyi.project.production.service.ITFurnancePressureService;
|
|
import com.ruoyi.project.production.service.ITFurnancePressureService;
|
|
import com.ruoyi.project.production.service.ITFurnanceTemperatureService;
|
|
import com.ruoyi.project.production.service.ITFurnanceTemperatureService;
|
|
|
|
+import com.ruoyi.project.system.domain.SysDictData;
|
|
|
|
+import com.ruoyi.project.system.domain.SysUser;
|
|
|
|
+import com.ruoyi.project.system.service.ISysDictTypeService;
|
|
|
|
+import com.ruoyi.project.system.service.ISysUserService;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Component;
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
|
|
+import java.text.ParseException;
|
|
|
|
+import java.text.SimpleDateFormat;
|
|
import java.util.Date;
|
|
import java.util.Date;
|
|
|
|
+import java.util.List;
|
|
|
|
|
|
/**
|
|
/**
|
|
* 定时任务 - 裂解炉管测温测压
|
|
* 定时任务 - 裂解炉管测温测压
|
|
@@ -26,6 +46,24 @@ public class FurnanceTask extends BaseController {
|
|
@Autowired
|
|
@Autowired
|
|
private ITFurnanceTemperatureService temperatureService;
|
|
private ITFurnanceTemperatureService temperatureService;
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ private TFurnancePressureController pressureController;
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ private TFurnanceTemperatureController temperatureController;
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ private ISysDictTypeService iSysDictTypeService;
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ private IMailService mailService;
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ private ITStaffmgrService staffmgrService;
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ private ISysUserService userService;
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 每日巡检数据生成
|
|
* 每日巡检数据生成
|
|
*/
|
|
*/
|
|
@@ -65,4 +103,120 @@ public class FurnanceTask extends BaseController {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * FVP邮件提醒
|
|
|
|
+ */
|
|
|
|
+ public void alertFvp() throws ParseException, PinyinException {
|
|
|
|
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
|
+ Date date = new Date();
|
|
|
|
+ date.setHours(0);
|
|
|
|
+ date.setMinutes(0);
|
|
|
|
+ date.setSeconds(0);
|
|
|
|
+ Date parse = sdf.parse(sdf.format(date));
|
|
|
|
+ TFurnancePressure pressure = new TFurnancePressure();
|
|
|
|
+ pressure.setRecordTime(parse);
|
|
|
|
+ AjaxResult fvp = pressureController.fvp(pressure);
|
|
|
|
+ Object obj = fvp.get("data");
|
|
|
|
+ if (obj != null) {
|
|
|
|
+ List<FurnancePressureFvpVO> data = (List<FurnancePressureFvpVO>) obj;
|
|
|
|
+ boolean flag = false;
|
|
|
|
+ for (FurnancePressureFvpVO datum : data) {
|
|
|
|
+ double pass1Ratio = datum.getPass1Ratio();
|
|
|
|
+ double pass2Ratio = datum.getPass2Ratio();
|
|
|
|
+ double pass3Ratio = datum.getPass3Ratio();
|
|
|
|
+ double pass4Ratio = datum.getPass4Ratio();
|
|
|
|
+ double pass5Ratio = datum.getPass5Ratio();
|
|
|
|
+ double pass6Ratio = datum.getPass6Ratio();
|
|
|
|
+ double pass7Ratio = datum.getPass7Ratio();
|
|
|
|
+ double pass8Ratio = datum.getPass8Ratio();
|
|
|
|
+ double allPassMaxRatio = datum.getAllPassMaxRatio();
|
|
|
|
+ if (Double.compare(pass1Ratio, 0.9) >= 0 || Double.compare(pass2Ratio, 0.9) >= 0
|
|
|
|
+ || Double.compare(pass3Ratio, 0.9) >= 0 || Double.compare(pass4Ratio, 0.9) >= 0
|
|
|
|
+ || Double.compare(pass5Ratio, 0.9) >= 0 || Double.compare(pass6Ratio, 0.9) >= 0
|
|
|
|
+ || Double.compare(pass7Ratio, 0.9) >= 0 || Double.compare(pass8Ratio, 0.9) >= 0
|
|
|
|
+ || Double.compare(allPassMaxRatio, 0.9) >= 0) {
|
|
|
|
+ flag = true;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if (flag) {
|
|
|
|
+ List<SysDictData> furnanceRecipientDict = iSysDictTypeService.selectDictDataByType("FURNANCE_RECIPIENT");
|
|
|
|
+ for (SysDictData sysDictData : furnanceRecipientDict) {
|
|
|
|
+ String dictValue = sysDictData.getDictValue();
|
|
|
|
+ TStaffmgr staffmgr = staffmgrService.selectTStaffmgrByStaffId(dictValue);
|
|
|
|
+ SysUser sysUser = userService.selectUserByStaffId(dictValue);
|
|
|
|
+ FurnancePressureThread mailThread = new FurnancePressureThread(mailService, staffmgr, sysUser.getUserName());
|
|
|
|
+ Thread thread = new Thread(mailThread);
|
|
|
|
+ thread.start();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * COIL邮件提醒
|
|
|
|
+ */
|
|
|
|
+ public void alertCoil() throws ParseException, PinyinException {
|
|
|
|
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
|
+ Date date = new Date();
|
|
|
|
+ date.setDate(1);
|
|
|
|
+ Date parse = sdf.parse(sdf.format(date));
|
|
|
|
+ TFurnanceTemperature temperature = new TFurnanceTemperature();
|
|
|
|
+ temperature.setRecordTime(parse);
|
|
|
|
+ AjaxResult coil = temperatureController.coil(temperature);
|
|
|
|
+ Object obj = coil.get("data");
|
|
|
|
+ if (obj != null) {
|
|
|
|
+ List<FurnanceTemperatureVO> data = (List<FurnanceTemperatureVO>) obj;
|
|
|
|
+ boolean flag = false;
|
|
|
|
+ for (FurnanceTemperatureVO datum : data) {
|
|
|
|
+ String h109Out = datum.getH109Out();
|
|
|
|
+ String h110Out = datum.getH110Out();
|
|
|
|
+ String h111Out = datum.getH111Out();
|
|
|
|
+ String h112Out = datum.getH112Out();
|
|
|
|
+ String h113Out = datum.getH113Out();
|
|
|
|
+ String h114Out = datum.getH114Out();
|
|
|
|
+ String h115Out = datum.getH115Out();
|
|
|
|
+ String h116Out = datum.getH116Out();
|
|
|
|
+ String h117Out = datum.getH117Out();
|
|
|
|
+ String h118Out = datum.getH118Out();
|
|
|
|
+ String h130Out = datum.getH130Out();
|
|
|
|
+ if (this.compare1080(h109Out)) { flag = true; }
|
|
|
|
+ if (this.compare1080(h110Out)) { flag = true; }
|
|
|
|
+ if (this.compare1080(h111Out)) { flag = true; }
|
|
|
|
+ if (this.compare1080(h112Out)) { flag = true; }
|
|
|
|
+ if (this.compare1080(h113Out)) { flag = true; }
|
|
|
|
+ if (this.compare1080(h114Out)) { flag = true; }
|
|
|
|
+ if (this.compare1080(h115Out)) { flag = true; }
|
|
|
|
+ if (this.compare1080(h116Out)) { flag = true; }
|
|
|
|
+ if (this.compare1080(h117Out)) { flag = true; }
|
|
|
|
+ if (this.compare1080(h118Out)) { flag = true; }
|
|
|
|
+ if (this.compare1080(h130Out)) { flag = true; }
|
|
|
|
+ }
|
|
|
|
+ if (flag) {
|
|
|
|
+ List<SysDictData> furnanceRecipientDict = iSysDictTypeService.selectDictDataByType("FURNANCE_RECIPIENT");
|
|
|
|
+ for (SysDictData sysDictData : furnanceRecipientDict) {
|
|
|
|
+ String dictValue = sysDictData.getDictValue();
|
|
|
|
+ TStaffmgr staffmgr = staffmgrService.selectTStaffmgrByStaffId(dictValue);
|
|
|
|
+ SysUser sysUser = userService.selectUserByStaffId(dictValue);
|
|
|
|
+ FurnanceTemperatureThread mailThread = new FurnanceTemperatureThread(mailService, staffmgr, sysUser.getUserName());
|
|
|
|
+ Thread thread = new Thread(mailThread);
|
|
|
|
+ thread.start();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private boolean compare1080(String string) {
|
|
|
|
+ boolean flag = false;
|
|
|
|
+ if (StringUtils.isNotNull(string) && StringUtils.isNotEmpty(string)) {
|
|
|
|
+ String[] split = string.split(",");
|
|
|
|
+ for (int i = 0; i < split.length; i++) {
|
|
|
|
+ int element = Integer.parseInt(split[i]);
|
|
|
|
+ if (element > 1080) {
|
|
|
|
+ flag = true;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return flag;
|
|
|
|
+ }
|
|
|
|
+
|
|
}
|
|
}
|