GasTimer.java 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499
  1. package com.huimv.admin.timer;
  2. import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
  3. import com.huimv.admin.common.utils.NumberUtils;
  4. import com.huimv.admin.entity.GasData;
  5. import com.huimv.admin.entity.GasThreshold;
  6. import com.huimv.admin.entity.GasWarningInfo;
  7. import com.huimv.admin.mapper.GasDataMapper;
  8. import com.huimv.admin.mapper.GasThresholdMapper;
  9. import com.huimv.admin.mapper.GasWarningInfoMapper;
  10. import org.springframework.beans.factory.annotation.Autowired;
  11. import org.springframework.context.annotation.Configuration;
  12. import org.springframework.scheduling.annotation.EnableScheduling;
  13. import org.springframework.scheduling.annotation.Scheduled;
  14. import java.util.Date;
  15. @Configuration
  16. @EnableScheduling
  17. public class GasTimer {
  18. @Autowired
  19. private GasDataMapper gasDataMapper;
  20. @Autowired
  21. private GasWarningInfoMapper warningInfoMapper;
  22. @Autowired
  23. private GasThresholdMapper thresholdMapper;
  24. // @Scheduled(cron = "0 0 */1 * * ? ")
  25. @Scheduled(cron = "0 */1 * * * ? ")
  26. // @Scheduled(cron = "0 0/2 * * * ? ")
  27. private void getShenChan() throws Exception {
  28. String type = NumberUtils.getNum(1, 5, 0);//loc_type
  29. for (int i = 1; i < 33; i++) {
  30. String nh3n = NumberUtils.getNumFloat3(0.011, 0.200);//NH3N
  31. String jlm = NumberUtils.getNumFloat(0.0, 10.5);//jlm
  32. String elht = NumberUtils.getNumFloat(0.0, 10.5);//elht
  33. String ejel = NumberUtils.getNumFloat(0.0, 10.5);//ejel
  34. String h2s = NumberUtils.getNumFloat(0.0, 10.5);//h2s
  35. String byx = NumberUtils.getNumFloat(0.0, 20.5);//byx
  36. String ch3 = NumberUtils.getNumFloat(0.0, 10.5);//ch3
  37. String sja = NumberUtils.getNumFloat(0.0, 10.5);//sja
  38. GasData gasData = new GasData();
  39. gasData.setNh3N(nh3n);
  40. gasData.setJlm(jlm);
  41. gasData.setElht(elht);
  42. gasData.setEjel(ejel);
  43. gasData.setH2s(h2s);
  44. gasData.setByx(byx);
  45. gasData.setCh3sh(ch3);
  46. gasData.setSja(sja);
  47. if (i > 28) {
  48. gasData.setLoctionType(i - 28);//下水碓
  49. gasData.setFarmId(39);
  50. } else if (i > 24) {
  51. gasData.setLoctionType(i - 24);//下水碓
  52. gasData.setFarmId(22);
  53. } else if (i > 20) {
  54. gasData.setLoctionType(i - 20);//平望
  55. gasData.setFarmId(28);
  56. } else if (i > 16) {
  57. gasData.setLoctionType(i - 16);//天台
  58. gasData.setFarmId(27);
  59. } else if (i > 12) {
  60. gasData.setLoctionType(i - 12);//横路
  61. gasData.setFarmId(26);
  62. } else if (i > 8) {
  63. gasData.setLoctionType(i - 8);//浦江
  64. gasData.setFarmId(23);
  65. } else if (i > 4) {
  66. gasData.setLoctionType(i - 4);//东阳
  67. gasData.setFarmId(24);
  68. } else {
  69. gasData.setLoctionType(i);
  70. gasData.setFarmId(21);
  71. }
  72. gasData.setCreateTime(new Date());
  73. QueryWrapper<GasThreshold> queryWrapper = new QueryWrapper<>();
  74. GasWarningInfo warningInfo = new GasWarningInfo();
  75. if (i == 1 || i == 5 || i == 9 || i == 13 || i == 17 || i == 21 || i == 25|| i == 29) {
  76. String cq = NumberUtils.getNumFloat(0.0, 1000.5);//cq
  77. gasData.setCq(cq);
  78. if (i == 1) {
  79. queryWrapper.eq("farm_id", 21).eq("gas_type", 1);
  80. } else if (i == 5) {
  81. queryWrapper.eq("farm_id", 24).eq("gas_type", 1);
  82. } else if (i == 9) {
  83. queryWrapper.eq("farm_id", 23).eq("gas_type", 1);
  84. } else if (i == 13) {
  85. queryWrapper.eq("farm_id", 26).eq("gas_type", 1);
  86. } else if (i == 17) {
  87. queryWrapper.eq("farm_id", 27).eq("gas_type", 1);
  88. } else if (i == 21) {
  89. queryWrapper.eq("farm_id", 28).eq("gas_type", 1);
  90. }else if (i == 25) {
  91. queryWrapper.eq("farm_id", 22).eq("gas_type", 1);
  92. } else {
  93. queryWrapper.eq("farm_id", 39).eq("gas_type", 1);
  94. }
  95. GasThreshold gasThreshold = thresholdMapper.selectOne(queryWrapper);
  96. if (Double.parseDouble(nh3n) > Double.parseDouble(gasThreshold.getNh3N())) {
  97. warningInfo.setWarningContent("NH3N为" + nh3n + "超过阈值,系统预警提醒");
  98. warningInfo.setWarningType(0);
  99. warningInfo.setBuildLocation("屋顶");
  100. warningInfo.setDate(new Date());
  101. warningInfo.setFarmId(gasThreshold.getFarmId());
  102. warningInfo.setUserIds(gasThreshold.getUserIds());
  103. warningInfoMapper.insert(warningInfo);
  104. }
  105. if (Double.parseDouble(jlm) > Double.parseDouble(gasThreshold.getJlm())) {
  106. warningInfo.setWarningContent("甲硫醚为" + jlm + "超过阈值,系统预警提醒");
  107. warningInfo.setWarningType(1);
  108. warningInfo.setBuildLocation("屋顶");
  109. warningInfo.setDate(new Date());
  110. warningInfo.setFarmId(gasThreshold.getFarmId());
  111. warningInfo.setUserIds(gasThreshold.getUserIds());
  112. warningInfoMapper.insert(warningInfo);
  113. }
  114. if (Double.parseDouble(elht) > Double.parseDouble(gasThreshold.getElht())) {
  115. warningInfo.setWarningContent("二硫化碳为" + elht + "超过阈值,系统预警提醒");
  116. warningInfo.setWarningType(2);
  117. warningInfo.setBuildLocation("屋顶");
  118. warningInfo.setDate(new Date());
  119. warningInfo.setFarmId(gasThreshold.getFarmId());
  120. warningInfo.setUserIds(gasThreshold.getUserIds());
  121. warningInfoMapper.insert(warningInfo);
  122. }
  123. if (Double.parseDouble(ejel) > Double.parseDouble(gasThreshold.getEjel())) {
  124. warningInfo.setWarningContent("二甲二硫为" + ejel + "超过阈值,系统预警提醒");
  125. warningInfo.setWarningType(3);
  126. warningInfo.setBuildLocation("屋顶");
  127. warningInfo.setDate(new Date());
  128. warningInfo.setFarmId(gasThreshold.getFarmId());
  129. warningInfo.setUserIds(gasThreshold.getUserIds());
  130. warningInfoMapper.insert(warningInfo);
  131. }
  132. if (Double.parseDouble(h2s) > Double.parseDouble(gasThreshold.getH2s())) {
  133. warningInfo.setWarningContent("H2S为" + h2s + "超过阈值,系统预警提醒");
  134. warningInfo.setWarningType(4);
  135. warningInfo.setBuildLocation("屋顶");
  136. warningInfo.setDate(new Date());
  137. warningInfo.setFarmId(gasThreshold.getFarmId());
  138. warningInfo.setUserIds(gasThreshold.getUserIds());
  139. warningInfoMapper.insert(warningInfo);
  140. }
  141. if (Double.parseDouble(byx) > Double.parseDouble(gasThreshold.getByx())) {
  142. warningInfo.setWarningContent("苯乙烯为" + byx + "超过阈值,系统预警提醒");
  143. warningInfo.setWarningType(5);
  144. warningInfo.setBuildLocation("屋顶");
  145. warningInfo.setDate(new Date());
  146. warningInfo.setFarmId(gasThreshold.getFarmId());
  147. warningInfo.setUserIds(gasThreshold.getUserIds());
  148. warningInfoMapper.insert(warningInfo);
  149. }
  150. if (Double.parseDouble(ch3) > Double.parseDouble(gasThreshold.getCh3sh())) {
  151. warningInfo.setWarningContent("CH3SH为" + ch3 + "超过阈值,系统预警提醒");
  152. warningInfo.setWarningType(6);
  153. warningInfo.setBuildLocation("屋顶");
  154. warningInfo.setDate(new Date());
  155. warningInfo.setFarmId(gasThreshold.getFarmId());
  156. warningInfo.setUserIds(gasThreshold.getUserIds());
  157. warningInfoMapper.insert(warningInfo);
  158. }
  159. if (Double.parseDouble(sja) > Double.parseDouble(gasThreshold.getSja())) {
  160. warningInfo.setWarningContent("三甲胺为" + sja + "超过阈值,系统预警提醒");
  161. warningInfo.setWarningType(7);
  162. warningInfo.setBuildLocation("屋顶");
  163. warningInfo.setDate(new Date());
  164. warningInfo.setFarmId(gasThreshold.getFarmId());
  165. warningInfo.setUserIds(gasThreshold.getUserIds());
  166. warningInfoMapper.insert(warningInfo);
  167. }
  168. if (Double.parseDouble(cq) > Double.parseDouble(gasThreshold.getCq())) {
  169. warningInfo.setWarningContent("臭气为" + cq + "超过阈值,系统预警提醒");
  170. warningInfo.setWarningType(8);
  171. warningInfo.setBuildLocation("屋顶");
  172. warningInfo.setDate(new Date());
  173. warningInfo.setFarmId(gasThreshold.getFarmId());
  174. warningInfo.setUserIds(gasThreshold.getUserIds());
  175. warningInfoMapper.insert(warningInfo);
  176. }
  177. } else if (i == 2 || i == 6 || i == 10 || i == 14 || i == 18 || i == 22 || i == 26) {
  178. String cq = NumberUtils.getNumFloat(0.0, 5000.5);//cq
  179. gasData.setCq(cq);
  180. if (i == 2) {
  181. queryWrapper.eq("farm_id", 21).eq("gas_type", 2);
  182. } else if (i == 6) {
  183. queryWrapper.eq("farm_id", 24).eq("gas_type", 2);
  184. } else if (i == 10) {
  185. queryWrapper.eq("farm_id", 23).eq("gas_type", 2);
  186. } else if (i == 14) {
  187. queryWrapper.eq("farm_id", 26).eq("gas_type", 2);
  188. } else if (i == 18) {
  189. queryWrapper.eq("farm_id", 27).eq("gas_type", 2);
  190. } else if (i == 22) {
  191. queryWrapper.eq("farm_id", 28).eq("gas_type", 2);
  192. } else {
  193. queryWrapper.eq("farm_id", 22).eq("gas_type", 2);
  194. }
  195. GasThreshold gasThreshold = thresholdMapper.selectOne(queryWrapper);
  196. if (Double.parseDouble(nh3n) > Double.parseDouble(gasThreshold.getNh3N())) {
  197. warningInfo.setWarningContent("NH3N为" + nh3n + "超过阈值,系统预警提醒");
  198. warningInfo.setWarningType(0);
  199. warningInfo.setBuildLocation("厂界上");
  200. warningInfo.setDate(new Date());
  201. warningInfo.setFarmId(gasThreshold.getFarmId());
  202. warningInfo.setUserIds(gasThreshold.getUserIds());
  203. warningInfoMapper.insert(warningInfo);
  204. }
  205. if (Double.parseDouble(jlm) > Double.parseDouble(gasThreshold.getJlm())) {
  206. warningInfo.setWarningContent("甲硫醚为" + jlm + "超过阈值,系统预警提醒");
  207. warningInfo.setWarningType(1);
  208. warningInfo.setBuildLocation("厂界上");
  209. warningInfo.setDate(new Date());
  210. warningInfo.setFarmId(gasThreshold.getFarmId());
  211. warningInfo.setUserIds(gasThreshold.getUserIds());
  212. warningInfoMapper.insert(warningInfo);
  213. }
  214. if (Double.parseDouble(elht) > Double.parseDouble(gasThreshold.getElht())) {
  215. warningInfo.setWarningContent("二硫化碳为" + elht + "超过阈值,系统预警提醒");
  216. warningInfo.setWarningType(2);
  217. warningInfo.setBuildLocation("厂界上");
  218. warningInfo.setDate(new Date());
  219. warningInfo.setFarmId(gasThreshold.getFarmId());
  220. warningInfo.setUserIds(gasThreshold.getUserIds());
  221. warningInfoMapper.insert(warningInfo);
  222. }
  223. if (Double.parseDouble(ejel) > Double.parseDouble(gasThreshold.getEjel())) {
  224. warningInfo.setWarningContent("二甲二硫为" + ejel + "超过阈值,系统预警提醒");
  225. warningInfo.setWarningType(3);
  226. warningInfo.setBuildLocation("厂界上");
  227. warningInfo.setDate(new Date());
  228. warningInfo.setFarmId(gasThreshold.getFarmId());
  229. warningInfo.setUserIds(gasThreshold.getUserIds());
  230. warningInfoMapper.insert(warningInfo);
  231. }
  232. if (Double.parseDouble(h2s) > Double.parseDouble(gasThreshold.getH2s())) {
  233. warningInfo.setWarningContent("H2S为" + h2s + "超过阈值,系统预警提醒");
  234. warningInfo.setWarningType(4);
  235. warningInfo.setBuildLocation("厂界上");
  236. warningInfo.setDate(new Date());
  237. warningInfo.setFarmId(gasThreshold.getFarmId());
  238. warningInfo.setUserIds(gasThreshold.getUserIds());
  239. warningInfoMapper.insert(warningInfo);
  240. }
  241. if (Double.parseDouble(byx) > Double.parseDouble(gasThreshold.getByx())) {
  242. warningInfo.setWarningContent("苯乙烯为" + byx + "超过阈值,系统预警提醒");
  243. warningInfo.setWarningType(5);
  244. warningInfo.setBuildLocation("厂界上");
  245. warningInfo.setDate(new Date());
  246. warningInfo.setFarmId(gasThreshold.getFarmId());
  247. warningInfo.setUserIds(gasThreshold.getUserIds());
  248. warningInfoMapper.insert(warningInfo);
  249. }
  250. if (Double.parseDouble(ch3) > Double.parseDouble(gasThreshold.getCh3sh())) {
  251. warningInfo.setWarningContent("CH3SH为" + ch3 + "超过阈值,系统预警提醒");
  252. warningInfo.setWarningType(6);
  253. warningInfo.setBuildLocation("厂界上");
  254. warningInfo.setDate(new Date());
  255. warningInfo.setFarmId(gasThreshold.getFarmId());
  256. warningInfo.setUserIds(gasThreshold.getUserIds());
  257. warningInfoMapper.insert(warningInfo);
  258. }
  259. if (Double.parseDouble(sja) > Double.parseDouble(gasThreshold.getSja())) {
  260. warningInfo.setWarningContent("三甲胺为" + sja + "超过阈值,系统预警提醒");
  261. warningInfo.setWarningType(7);
  262. warningInfo.setBuildLocation("厂界上");
  263. warningInfo.setDate(new Date());
  264. warningInfo.setFarmId(gasThreshold.getFarmId());
  265. warningInfo.setUserIds(gasThreshold.getUserIds());
  266. warningInfoMapper.insert(warningInfo);
  267. }
  268. if (Double.parseDouble(cq) > Double.parseDouble(gasThreshold.getCq())) {
  269. warningInfo.setWarningContent("臭气为" + cq + "超过阈值,系统预警提醒");
  270. warningInfo.setWarningType(8);
  271. warningInfo.setBuildLocation("厂界上");
  272. warningInfo.setDate(new Date());
  273. warningInfo.setFarmId(gasThreshold.getFarmId());
  274. warningInfo.setUserIds(gasThreshold.getUserIds());
  275. warningInfoMapper.insert(warningInfo);
  276. }
  277. } else if (i == 3 || i == 7 || i == 11 || i == 15 || i == 19 || i == 23 || i == 27) {
  278. String cq = NumberUtils.getNumFloat(0.0, 1000.5);//cq
  279. gasData.setCq(cq);
  280. if (i == 3) {
  281. queryWrapper.eq("farm_id", 21).eq("gas_type", 3);
  282. } else if (i == 7) {
  283. queryWrapper.eq("farm_id", 24).eq("gas_type", 3);
  284. } else if (i == 11) {
  285. queryWrapper.eq("farm_id", 23).eq("gas_type", 3);
  286. } else if (i == 15) {
  287. queryWrapper.eq("farm_id", 26).eq("gas_type", 3);
  288. } else if (i == 19) {
  289. queryWrapper.eq("farm_id", 27).eq("gas_type", 3);
  290. } else if (i == 23) {
  291. queryWrapper.eq("farm_id", 28).eq("gas_type", 3);
  292. } else {
  293. queryWrapper.eq("farm_id", 22).eq("gas_type", 3);
  294. }
  295. GasThreshold gasThreshold = thresholdMapper.selectOne(queryWrapper);
  296. if (Double.parseDouble(nh3n) > Double.parseDouble(gasThreshold.getNh3N())) {
  297. warningInfo.setWarningContent("NH3N为" + nh3n + "超过阈值,系统预警提醒");
  298. warningInfo.setWarningType(0);
  299. warningInfo.setBuildLocation("厂界下");
  300. warningInfo.setDate(new Date());
  301. warningInfo.setFarmId(gasThreshold.getFarmId());
  302. warningInfo.setUserIds(gasThreshold.getUserIds());
  303. warningInfoMapper.insert(warningInfo);
  304. }
  305. if (Double.parseDouble(jlm) > Double.parseDouble(gasThreshold.getJlm())) {
  306. warningInfo.setWarningContent("甲硫醚为" + jlm + "超过阈值,系统预警提醒");
  307. warningInfo.setWarningType(1);
  308. warningInfo.setBuildLocation("厂界下");
  309. warningInfo.setDate(new Date());
  310. warningInfo.setFarmId(gasThreshold.getFarmId());
  311. warningInfo.setUserIds(gasThreshold.getUserIds());
  312. warningInfoMapper.insert(warningInfo);
  313. }
  314. if (Double.parseDouble(elht) > Double.parseDouble(gasThreshold.getElht())) {
  315. warningInfo.setWarningContent("二硫化碳为" + elht + "超过阈值,系统预警提醒");
  316. warningInfo.setWarningType(2);
  317. warningInfo.setBuildLocation("厂界下");
  318. warningInfo.setDate(new Date());
  319. warningInfo.setFarmId(gasThreshold.getFarmId());
  320. warningInfo.setUserIds(gasThreshold.getUserIds());
  321. warningInfoMapper.insert(warningInfo);
  322. }
  323. if (Double.parseDouble(ejel) > Double.parseDouble(gasThreshold.getEjel())) {
  324. warningInfo.setWarningContent("二甲二硫为" + ejel + "超过阈值,系统预警提醒");
  325. warningInfo.setWarningType(3);
  326. warningInfo.setBuildLocation("厂界下");
  327. warningInfo.setDate(new Date());
  328. warningInfo.setFarmId(gasThreshold.getFarmId());
  329. warningInfo.setUserIds(gasThreshold.getUserIds());
  330. warningInfoMapper.insert(warningInfo);
  331. }
  332. if (Double.parseDouble(h2s) > Double.parseDouble(gasThreshold.getH2s())) {
  333. warningInfo.setWarningContent("H2S为" + h2s + "超过阈值,系统预警提醒");
  334. warningInfo.setWarningType(4);
  335. warningInfo.setBuildLocation("厂界下");
  336. warningInfo.setDate(new Date());
  337. warningInfo.setFarmId(gasThreshold.getFarmId());
  338. warningInfo.setUserIds(gasThreshold.getUserIds());
  339. warningInfoMapper.insert(warningInfo);
  340. }
  341. if (Double.parseDouble(byx) > Double.parseDouble(gasThreshold.getByx())) {
  342. warningInfo.setWarningContent("苯乙烯为" + byx + "超过阈值,系统预警提醒");
  343. warningInfo.setWarningType(5);
  344. warningInfo.setBuildLocation("厂界下");
  345. warningInfo.setDate(new Date());
  346. warningInfo.setFarmId(gasThreshold.getFarmId());
  347. warningInfo.setUserIds(gasThreshold.getUserIds());
  348. warningInfoMapper.insert(warningInfo);
  349. }
  350. if (Double.parseDouble(ch3) > Double.parseDouble(gasThreshold.getCh3sh())) {
  351. warningInfo.setWarningContent("CH3SH为" + ch3 + "超过阈值,系统预警提醒");
  352. warningInfo.setWarningType(6);
  353. warningInfo.setBuildLocation("厂界下");
  354. warningInfo.setDate(new Date());
  355. warningInfo.setFarmId(gasThreshold.getFarmId());
  356. warningInfo.setUserIds(gasThreshold.getUserIds());
  357. warningInfoMapper.insert(warningInfo);
  358. }
  359. if (Double.parseDouble(sja) > Double.parseDouble(gasThreshold.getSja())) {
  360. warningInfo.setWarningContent("三甲胺为" + sja + "超过阈值,系统预警提醒");
  361. warningInfo.setWarningType(7);
  362. warningInfo.setBuildLocation("厂界下");
  363. warningInfo.setDate(new Date());
  364. warningInfo.setFarmId(gasThreshold.getFarmId());
  365. warningInfo.setUserIds(gasThreshold.getUserIds());
  366. warningInfoMapper.insert(warningInfo);
  367. }
  368. if (Double.parseDouble(cq) > Double.parseDouble(gasThreshold.getCq())) {
  369. warningInfo.setWarningContent("臭气为" + cq + "超过阈值,系统预警提醒");
  370. warningInfo.setWarningType(8);
  371. warningInfo.setBuildLocation("厂界下");
  372. warningInfo.setDate(new Date());
  373. warningInfo.setFarmId(gasThreshold.getFarmId());
  374. warningInfo.setUserIds(gasThreshold.getUserIds());
  375. warningInfoMapper.insert(warningInfo);
  376. }
  377. } else if (i == 4 || i == 8 || i == 12 || i == 16 || i == 20 || i == 24 || i == 28) {
  378. String cq = NumberUtils.getNumFloat(0.0, 10000.5);//cq
  379. gasData.setCq(cq);
  380. if (i == 4) {
  381. queryWrapper.eq("farm_id", 21).eq("gas_type", 4);
  382. } else if (i == 8) {
  383. queryWrapper.eq("farm_id", 24).eq("gas_type", 4);
  384. } else if (i == 12) {
  385. queryWrapper.eq("farm_id", 23).eq("gas_type", 4);
  386. } else if (i == 16) {
  387. queryWrapper.eq("farm_id", 26).eq("gas_type", 4);
  388. } else if (i == 20) {
  389. queryWrapper.eq("farm_id", 27).eq("gas_type", 4);
  390. } else if (i == 24) {
  391. queryWrapper.eq("farm_id", 28).eq("gas_type", 4);
  392. } else {
  393. queryWrapper.eq("farm_id", 22).eq("gas_type", 4);
  394. }
  395. GasThreshold gasThreshold = thresholdMapper.selectOne(queryWrapper);
  396. if (Double.parseDouble(nh3n) > Double.parseDouble(gasThreshold.getNh3N())) {
  397. warningInfo.setWarningContent("NH3N为" + nh3n + "超过阈值,系统预警提醒");
  398. warningInfo.setWarningType(0);
  399. warningInfo.setBuildLocation("厂界居民");
  400. warningInfo.setDate(new Date());
  401. warningInfo.setFarmId(gasThreshold.getFarmId());
  402. warningInfo.setUserIds(gasThreshold.getUserIds());
  403. warningInfoMapper.insert(warningInfo);
  404. }
  405. if (Double.parseDouble(jlm) > Double.parseDouble(gasThreshold.getJlm())) {
  406. warningInfo.setWarningContent("甲硫醚为" + jlm + "超过阈值,系统预警提醒");
  407. warningInfo.setWarningType(1);
  408. warningInfo.setBuildLocation("厂界居民");
  409. warningInfo.setDate(new Date());
  410. warningInfo.setFarmId(gasThreshold.getFarmId());
  411. warningInfo.setUserIds(gasThreshold.getUserIds());
  412. warningInfoMapper.insert(warningInfo);
  413. }
  414. if (Double.parseDouble(elht) > Double.parseDouble(gasThreshold.getElht())) {
  415. warningInfo.setWarningContent("二硫化碳为" + elht + "超过阈值,系统预警提醒");
  416. warningInfo.setWarningType(2);
  417. warningInfo.setBuildLocation("厂界居民");
  418. warningInfo.setDate(new Date());
  419. warningInfo.setFarmId(gasThreshold.getFarmId());
  420. warningInfo.setUserIds(gasThreshold.getUserIds());
  421. warningInfoMapper.insert(warningInfo);
  422. }
  423. if (Double.parseDouble(ejel) > Double.parseDouble(gasThreshold.getEjel())) {
  424. warningInfo.setWarningContent("二甲二硫为" + ejel + "超过阈值,系统预警提醒");
  425. warningInfo.setWarningType(3);
  426. warningInfo.setBuildLocation("厂界居民");
  427. warningInfo.setDate(new Date());
  428. warningInfo.setFarmId(gasThreshold.getFarmId());
  429. warningInfo.setUserIds(gasThreshold.getUserIds());
  430. warningInfoMapper.insert(warningInfo);
  431. }
  432. if (Double.parseDouble(h2s) > Double.parseDouble(gasThreshold.getH2s())) {
  433. warningInfo.setWarningContent("H2S为" + h2s + "超过阈值,系统预警提醒");
  434. warningInfo.setWarningType(4);
  435. warningInfo.setBuildLocation("厂界居民");
  436. warningInfo.setDate(new Date());
  437. warningInfo.setFarmId(gasThreshold.getFarmId());
  438. warningInfo.setUserIds(gasThreshold.getUserIds());
  439. warningInfoMapper.insert(warningInfo);
  440. }
  441. if (Double.parseDouble(byx) > Double.parseDouble(gasThreshold.getByx())) {
  442. warningInfo.setWarningContent("苯乙烯为" + byx + "超过阈值,系统预警提醒");
  443. warningInfo.setWarningType(5);
  444. warningInfo.setBuildLocation("厂界居民");
  445. warningInfo.setDate(new Date());
  446. warningInfo.setFarmId(gasThreshold.getFarmId());
  447. warningInfo.setUserIds(gasThreshold.getUserIds());
  448. warningInfoMapper.insert(warningInfo);
  449. }
  450. if (Double.parseDouble(ch3) > Double.parseDouble(gasThreshold.getCh3sh())) {
  451. warningInfo.setWarningContent("CH3SH为" + ch3 + "超过阈值,系统预警提醒");
  452. warningInfo.setWarningType(6);
  453. warningInfo.setBuildLocation("厂界居民");
  454. warningInfo.setDate(new Date());
  455. warningInfo.setFarmId(gasThreshold.getFarmId());
  456. warningInfo.setUserIds(gasThreshold.getUserIds());
  457. warningInfoMapper.insert(warningInfo);
  458. }
  459. if (Double.parseDouble(sja) > Double.parseDouble(gasThreshold.getSja())) {
  460. warningInfo.setWarningContent("三甲胺为" + sja + "超过阈值,系统预警提醒");
  461. warningInfo.setWarningType(7);
  462. warningInfo.setBuildLocation("厂界居民");
  463. warningInfo.setDate(new Date());
  464. warningInfo.setFarmId(gasThreshold.getFarmId());
  465. warningInfo.setUserIds(gasThreshold.getUserIds());
  466. warningInfoMapper.insert(warningInfo);
  467. }
  468. if (Double.parseDouble(cq) > Double.parseDouble(gasThreshold.getCq())) {
  469. warningInfo.setWarningContent("臭气为" + cq + "超过阈值,系统预警提醒");
  470. warningInfo.setWarningType(8);
  471. warningInfo.setBuildLocation("厂界居民");
  472. warningInfo.setDate(new Date());
  473. warningInfo.setFarmId(gasThreshold.getFarmId());
  474. warningInfo.setUserIds(gasThreshold.getUserIds());
  475. warningInfoMapper.insert(warningInfo);
  476. }
  477. }
  478. gasDataMapper.insert(gasData);
  479. }
  480. }
  481. }