ProtTimer.java 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518
  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.ProtData;
  5. import com.huimv.admin.entity.ProtThreshold;
  6. import com.huimv.admin.entity.ProtWarningInfo;
  7. import com.huimv.admin.mapper.ProtDataMapper;
  8. import com.huimv.admin.mapper.ProtThresholdMapper;
  9. import com.huimv.admin.mapper.ProtWarningInfoMapper;
  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 ProtTimer {
  18. @Autowired
  19. private ProtThresholdMapper protThresholdMapper;
  20. @Autowired
  21. private ProtDataMapper protDataMapper;
  22. @Autowired
  23. private ProtWarningInfoMapper warningInfoMapper;
  24. // 环保数据
  25. @Scheduled(cron = "0 0 */1 * * ? ")
  26. private void getShenChan() throws Exception {
  27. for (int i = 1; i < 7; i++) {
  28. //假设已经拿到了数据
  29. String num = NumberUtils.getNumFloat(6.4, 8.6);//ph
  30. ProtData protData = new ProtData();
  31. protData.setLoctionType(i);
  32. protData.setCreateDate(new Date());
  33. if (i < 4) {
  34. protData.setFarmId(21);
  35. } else {
  36. protData.setFarmId(24);
  37. }
  38. protData.setPh(num);
  39. QueryWrapper<ProtThreshold> queryWrapper = new QueryWrapper<>();
  40. if (i == 1||i==4) {
  41. String num1 = NumberUtils.getNum(8000, 20001,0);//cod
  42. String num2 = NumberUtils.getNumFloat(1000.0, 1501.0);//nh3n
  43. String num3 = NumberUtils.getNumFloat(100.0, 260.0);//tp
  44. String num4 = NumberUtils.getNum(1000, 1550, 0);//tn
  45. String num5 = NumberUtils.getNum(0, 51, 0);//flow
  46. protData.setCod(num1);
  47. protData.setNh3n(num2);
  48. protData.setTp(num3);
  49. protData.setTn(num4);
  50. protData.setFlow(num5);
  51. protDataMapper.insert(protData);
  52. if (i==1) {
  53. queryWrapper.eq("farm_id", 21).eq("prot_type", 1);
  54. } else {
  55. queryWrapper.eq("farm_id", 24).eq("prot_type", 1);
  56. }
  57. ProtThreshold protThreshold = protThresholdMapper.selectOne(queryWrapper);//进污口
  58. if (Double.parseDouble(num) > Double.parseDouble(protThreshold.getPh2()) || Double.parseDouble(num) < Double.parseDouble(protThreshold.getOther3())) {
  59. ProtWarningInfo protWarningInfo = new ProtWarningInfo();
  60. protWarningInfo.setWarningContent("进污口ph值为" + num + "达到红色预警");
  61. protWarningInfo.setWarningType(1);
  62. protWarningInfo.setFarmId(protThreshold.getFarmId());
  63. protWarningInfo.setDate(new Date());
  64. protWarningInfo.setUserIds(protThreshold.getUserIds());
  65. protWarningInfo.setDeviceId(i);
  66. protWarningInfo.setBuildLocation("进污口");
  67. warningInfoMapper.insert(protWarningInfo);
  68. }
  69. if (Double.parseDouble(num) > Double.parseDouble(protThreshold.getPh1()) || Double.parseDouble(num) < Double.parseDouble(protThreshold.getOther2())) {
  70. ProtWarningInfo protWarningInfo = new ProtWarningInfo();
  71. protWarningInfo.setWarningContent("进污口ph值为" + num + "达到橙色预警");
  72. protWarningInfo.setWarningType(1);
  73. protWarningInfo.setFarmId(protThreshold.getFarmId());
  74. protWarningInfo.setDate(new Date());
  75. protWarningInfo.setUserIds(protThreshold.getUserIds());
  76. protWarningInfo.setDeviceId(i);
  77. protWarningInfo.setBuildLocation("进污口");
  78. warningInfoMapper.insert(protWarningInfo);
  79. }
  80. if (Double.parseDouble(num1) > Double.parseDouble(protThreshold.getCod2())) {
  81. ProtWarningInfo protWarningInfo = new ProtWarningInfo();
  82. protWarningInfo.setWarningContent("进污口cod值为" + num1 + "达到红色预警");
  83. protWarningInfo.setWarningType(0);
  84. protWarningInfo.setFarmId(protThreshold.getFarmId());
  85. protWarningInfo.setDate(new Date());
  86. protWarningInfo.setUserIds(protThreshold.getUserIds());
  87. protWarningInfo.setDeviceId(i);
  88. protWarningInfo.setBuildLocation("进污口");
  89. warningInfoMapper.insert(protWarningInfo);
  90. }
  91. if (Double.parseDouble(num1) > Double.parseDouble(protThreshold.getCod1())) {
  92. ProtWarningInfo protWarningInfo = new ProtWarningInfo();
  93. protWarningInfo.setWarningContent("进污口cod值为" + num1 + "达到橙色预警");
  94. protWarningInfo.setWarningType(0);
  95. protWarningInfo.setFarmId(protThreshold.getFarmId());
  96. protWarningInfo.setDate(new Date());
  97. protWarningInfo.setUserIds(protThreshold.getUserIds());
  98. protWarningInfo.setDeviceId(i);
  99. protWarningInfo.setBuildLocation("进污口");
  100. warningInfoMapper.insert(protWarningInfo);
  101. }
  102. if (Double.parseDouble(num2) > Double.parseDouble(protThreshold.getNh3n2())) {
  103. ProtWarningInfo protWarningInfo = new ProtWarningInfo();
  104. protWarningInfo.setWarningContent("进污口NH3N值为" + num2 + "达到红色预警");
  105. protWarningInfo.setWarningType(2);
  106. protWarningInfo.setFarmId(protThreshold.getFarmId());
  107. protWarningInfo.setDate(new Date());
  108. protWarningInfo.setUserIds(protThreshold.getUserIds());
  109. protWarningInfo.setDeviceId(i);
  110. protWarningInfo.setBuildLocation("进污口");
  111. warningInfoMapper.insert(protWarningInfo);
  112. }
  113. if (Double.parseDouble(num2) > Double.parseDouble(protThreshold.getNh3n1())) {
  114. ProtWarningInfo protWarningInfo = new ProtWarningInfo();
  115. protWarningInfo.setWarningContent("进污口NH3N值为" + num2 + "达到橙色预警");
  116. protWarningInfo.setWarningType(2);
  117. protWarningInfo.setFarmId(protThreshold.getFarmId());
  118. protWarningInfo.setDate(new Date());
  119. protWarningInfo.setUserIds(protThreshold.getUserIds());
  120. protWarningInfo.setDeviceId(i);
  121. protWarningInfo.setBuildLocation("进污口");
  122. warningInfoMapper.insert(protWarningInfo);
  123. }
  124. if (Double.parseDouble(num3) > Double.parseDouble(protThreshold.getTp2())) {
  125. ProtWarningInfo protWarningInfo = new ProtWarningInfo();
  126. protWarningInfo.setWarningContent("进污口TP值为" + num3 + "达到红色预警");
  127. protWarningInfo.setWarningType(3);
  128. protWarningInfo.setFarmId(protThreshold.getFarmId());
  129. protWarningInfo.setDate(new Date());
  130. protWarningInfo.setUserIds(protThreshold.getUserIds());
  131. protWarningInfo.setDeviceId(i);
  132. protWarningInfo.setBuildLocation("进污口");
  133. warningInfoMapper.insert(protWarningInfo);
  134. }
  135. if (Double.parseDouble(num3) > Double.parseDouble(protThreshold.getTp1())) {
  136. ProtWarningInfo protWarningInfo = new ProtWarningInfo();
  137. protWarningInfo.setWarningContent("进污口TP值为" + num3 + "达到橙色预警");
  138. protWarningInfo.setWarningType(3);
  139. protWarningInfo.setFarmId(protThreshold.getFarmId());
  140. protWarningInfo.setDate(new Date());
  141. protWarningInfo.setUserIds(protThreshold.getUserIds());
  142. protWarningInfo.setDeviceId(i);
  143. protWarningInfo.setBuildLocation("进污口");
  144. warningInfoMapper.insert(protWarningInfo);
  145. }
  146. if (Double.parseDouble(num4) > Double.parseDouble(protThreshold.getTn2())) {
  147. ProtWarningInfo protWarningInfo = new ProtWarningInfo();
  148. protWarningInfo.setWarningContent("进污口TN值为" + num4 + "达到红色预警");
  149. protWarningInfo.setWarningType(4);
  150. protWarningInfo.setFarmId(protThreshold.getFarmId());
  151. protWarningInfo.setDate(new Date());
  152. protWarningInfo.setUserIds(protThreshold.getUserIds());
  153. protWarningInfo.setDeviceId(i);
  154. protWarningInfo.setBuildLocation("进污口");
  155. warningInfoMapper.insert(protWarningInfo);
  156. }
  157. if (Double.parseDouble(num4) > Double.parseDouble(protThreshold.getTn1())) {
  158. ProtWarningInfo protWarningInfo = new ProtWarningInfo();
  159. protWarningInfo.setWarningContent("进污口TN值为" + num4 + "达到橙色预警");
  160. protWarningInfo.setWarningType(4);
  161. protWarningInfo.setFarmId(protThreshold.getFarmId());
  162. protWarningInfo.setDate(new Date());
  163. protWarningInfo.setUserIds(protThreshold.getUserIds());
  164. protWarningInfo.setDeviceId(i);
  165. protWarningInfo.setBuildLocation("进污口");
  166. warningInfoMapper.insert(protWarningInfo);
  167. }
  168. if (Double.parseDouble(num5) > Double.parseDouble(protThreshold.getFlow2())) {
  169. ProtWarningInfo protWarningInfo = new ProtWarningInfo();
  170. protWarningInfo.setWarningContent("进污口累计流量值为" + num5 + "达到红色预警");
  171. protWarningInfo.setWarningType(5);
  172. protWarningInfo.setFarmId(protThreshold.getFarmId());
  173. protWarningInfo.setDate(new Date());
  174. protWarningInfo.setUserIds(protThreshold.getUserIds());
  175. protWarningInfo.setDeviceId(i);
  176. protWarningInfo.setBuildLocation("进污口");
  177. warningInfoMapper.insert(protWarningInfo);
  178. }
  179. if (Double.parseDouble(num5) > Double.parseDouble(protThreshold.getFlow1())) {
  180. ProtWarningInfo protWarningInfo = new ProtWarningInfo();
  181. protWarningInfo.setWarningContent("进污口累计流量值为" + num5 + "达到橙色预警");
  182. protWarningInfo.setWarningType(5);
  183. protWarningInfo.setFarmId(protThreshold.getFarmId());
  184. protWarningInfo.setDate(new Date());
  185. protWarningInfo.setUserIds(protThreshold.getUserIds());
  186. protWarningInfo.setDeviceId(i);
  187. protWarningInfo.setBuildLocation("进污口");
  188. warningInfoMapper.insert(protWarningInfo);
  189. }
  190. }
  191. if (i == 2||i==5) {
  192. String num1 = NumberUtils.getNum(0, 310,0);//cod
  193. String num2 = NumberUtils.getNumFloat(0.0, 31.0);//nh3n
  194. String num3 = NumberUtils.getNumFloat(0.0, 3.6);//tp
  195. String num4 = NumberUtils.getNum(0, 32, 0);//tn
  196. String num5 = NumberUtils.getNum(0, 55, 0);//flow
  197. protData.setCod(num1);
  198. protData.setNh3n(num2);
  199. protData.setTp(num3);
  200. protData.setTn(num4);
  201. protData.setFlow(num5);
  202. protDataMapper.insert(protData);
  203. if (i==2) {
  204. queryWrapper.eq("farm_id", 21).eq("prot_type", 2);
  205. } else {
  206. queryWrapper.eq("farm_id", 24).eq("prot_type", 2);
  207. }
  208. ProtThreshold protThreshold = protThresholdMapper.selectOne(queryWrapper);//污口
  209. if (Double.parseDouble(num) > Double.parseDouble(protThreshold.getPh2()) || Double.parseDouble(num) < Double.parseDouble(protThreshold.getOther3())) {
  210. ProtWarningInfo protWarningInfo = new ProtWarningInfo();
  211. protWarningInfo.setWarningContent("处理口ph值为" + num + "达到红色预警");
  212. protWarningInfo.setWarningType(1);
  213. protWarningInfo.setFarmId(protThreshold.getFarmId());
  214. protWarningInfo.setDate(new Date());
  215. protWarningInfo.setUserIds(protThreshold.getUserIds());
  216. protWarningInfo.setDeviceId(i);
  217. protWarningInfo.setBuildLocation("处理口");
  218. warningInfoMapper.insert(protWarningInfo);
  219. }
  220. if (Double.parseDouble(num) > Double.parseDouble(protThreshold.getPh1()) || Double.parseDouble(num) < Double.parseDouble(protThreshold.getOther2())) {
  221. ProtWarningInfo protWarningInfo = new ProtWarningInfo();
  222. protWarningInfo.setWarningContent("处理口ph值为" + num + "达到橙色预警");
  223. protWarningInfo.setWarningType(1);
  224. protWarningInfo.setFarmId(protThreshold.getFarmId());
  225. protWarningInfo.setDate(new Date());
  226. protWarningInfo.setUserIds(protThreshold.getUserIds());
  227. protWarningInfo.setDeviceId(i);
  228. protWarningInfo.setBuildLocation("处理口");
  229. warningInfoMapper.insert(protWarningInfo);
  230. }
  231. if (Double.parseDouble(num1) > Double.parseDouble(protThreshold.getCod2())) {
  232. ProtWarningInfo protWarningInfo = new ProtWarningInfo();
  233. protWarningInfo.setWarningContent("处理口cod值为" + num1 + "达到红色预警");
  234. protWarningInfo.setWarningType(0);
  235. protWarningInfo.setFarmId(protThreshold.getFarmId());
  236. protWarningInfo.setDate(new Date());
  237. protWarningInfo.setUserIds(protThreshold.getUserIds());
  238. protWarningInfo.setDeviceId(i);
  239. protWarningInfo.setBuildLocation("处理口");
  240. warningInfoMapper.insert(protWarningInfo);
  241. }
  242. if (Double.parseDouble(num1) > Double.parseDouble(protThreshold.getCod1())) {
  243. ProtWarningInfo protWarningInfo = new ProtWarningInfo();
  244. protWarningInfo.setWarningContent("处理口cod值为" + num1 + "达到橙色预警");
  245. protWarningInfo.setWarningType(0);
  246. protWarningInfo.setFarmId(protThreshold.getFarmId());
  247. protWarningInfo.setDate(new Date());
  248. protWarningInfo.setUserIds(protThreshold.getUserIds());
  249. protWarningInfo.setDeviceId(i);
  250. protWarningInfo.setBuildLocation("处理口");
  251. warningInfoMapper.insert(protWarningInfo);
  252. }
  253. if (Double.parseDouble(num2) > Double.parseDouble(protThreshold.getNh3n2())) {
  254. ProtWarningInfo protWarningInfo = new ProtWarningInfo();
  255. protWarningInfo.setWarningContent("处理口NH3N值为" + num2 + "达到红色预警");
  256. protWarningInfo.setWarningType(2);
  257. protWarningInfo.setFarmId(protThreshold.getFarmId());
  258. protWarningInfo.setDate(new Date());
  259. protWarningInfo.setUserIds(protThreshold.getUserIds());
  260. protWarningInfo.setDeviceId(i);
  261. protWarningInfo.setBuildLocation("处理口");
  262. warningInfoMapper.insert(protWarningInfo);
  263. }
  264. if (Double.parseDouble(num2) > Double.parseDouble(protThreshold.getNh3n1())) {
  265. ProtWarningInfo protWarningInfo = new ProtWarningInfo();
  266. protWarningInfo.setWarningContent("处理口NH3N值为" + num2 + "达到橙色预警");
  267. protWarningInfo.setWarningType(2);
  268. protWarningInfo.setFarmId(protThreshold.getFarmId());
  269. protWarningInfo.setDate(new Date());
  270. protWarningInfo.setUserIds(protThreshold.getUserIds());
  271. protWarningInfo.setDeviceId(i);
  272. protWarningInfo.setBuildLocation("处理口");
  273. warningInfoMapper.insert(protWarningInfo);
  274. }
  275. if (Double.parseDouble(num3) > Double.parseDouble(protThreshold.getTp2())) {
  276. ProtWarningInfo protWarningInfo = new ProtWarningInfo();
  277. protWarningInfo.setWarningContent("处理口TP值为" + num3 + "达到红色预警");
  278. protWarningInfo.setWarningType(3);
  279. protWarningInfo.setFarmId(protThreshold.getFarmId());
  280. protWarningInfo.setDate(new Date());
  281. protWarningInfo.setUserIds(protThreshold.getUserIds());
  282. protWarningInfo.setDeviceId(i);
  283. protWarningInfo.setBuildLocation("处理口");
  284. warningInfoMapper.insert(protWarningInfo);
  285. }
  286. if (Double.parseDouble(num3) > Double.parseDouble(protThreshold.getTp1())) {
  287. ProtWarningInfo protWarningInfo = new ProtWarningInfo();
  288. protWarningInfo.setWarningContent("处理口TP值为" + num3 + "达到橙色预警");
  289. protWarningInfo.setWarningType(3);
  290. protWarningInfo.setFarmId(protThreshold.getFarmId());
  291. protWarningInfo.setDate(new Date());
  292. protWarningInfo.setUserIds(protThreshold.getUserIds());
  293. protWarningInfo.setDeviceId(i);
  294. protWarningInfo.setBuildLocation("处理口");
  295. warningInfoMapper.insert(protWarningInfo);
  296. }
  297. if (Double.parseDouble(num4) > Double.parseDouble(protThreshold.getTn2())) {
  298. ProtWarningInfo protWarningInfo = new ProtWarningInfo();
  299. protWarningInfo.setWarningContent("处理口TN值为" + num4 + "达到红色预警");
  300. protWarningInfo.setWarningType(4);
  301. protWarningInfo.setFarmId(protThreshold.getFarmId());
  302. protWarningInfo.setDate(new Date());
  303. protWarningInfo.setUserIds(protThreshold.getUserIds());
  304. protWarningInfo.setDeviceId(i);
  305. protWarningInfo.setBuildLocation("处理口");
  306. warningInfoMapper.insert(protWarningInfo);
  307. }
  308. if (Double.parseDouble(num4) > Double.parseDouble(protThreshold.getTn1())) {
  309. ProtWarningInfo protWarningInfo = new ProtWarningInfo();
  310. protWarningInfo.setWarningContent("处理口TN值为" + num4 + "达到橙色预警");
  311. protWarningInfo.setWarningType(4);
  312. protWarningInfo.setFarmId(protThreshold.getFarmId());
  313. protWarningInfo.setDate(new Date());
  314. protWarningInfo.setUserIds(protThreshold.getUserIds());
  315. protWarningInfo.setDeviceId(i);
  316. protWarningInfo.setBuildLocation("处理口");
  317. warningInfoMapper.insert(protWarningInfo);
  318. }
  319. if (Double.parseDouble(num5) > Double.parseDouble(protThreshold.getFlow2())) {
  320. ProtWarningInfo protWarningInfo = new ProtWarningInfo();
  321. protWarningInfo.setWarningContent("处理口累计流量值为" + num5 + "达到红色预警");
  322. protWarningInfo.setWarningType(5);
  323. protWarningInfo.setFarmId(protThreshold.getFarmId());
  324. protWarningInfo.setDate(new Date());
  325. protWarningInfo.setUserIds(protThreshold.getUserIds());
  326. protWarningInfo.setDeviceId(i);
  327. protWarningInfo.setBuildLocation("处理口");
  328. warningInfoMapper.insert(protWarningInfo);
  329. }
  330. if (Double.parseDouble(num5) > Double.parseDouble(protThreshold.getFlow1())) {
  331. ProtWarningInfo protWarningInfo = new ProtWarningInfo();
  332. protWarningInfo.setWarningContent("处理口累计流量值为" + num5 + "达到橙色预警");
  333. protWarningInfo.setWarningType(5);
  334. protWarningInfo.setFarmId(protThreshold.getFarmId());
  335. protWarningInfo.setDate(new Date());
  336. protWarningInfo.setUserIds(protThreshold.getUserIds());
  337. protWarningInfo.setDeviceId(i);
  338. protWarningInfo.setBuildLocation("处理口");
  339. warningInfoMapper.insert(protWarningInfo);
  340. }
  341. }
  342. if (i == 3||i==6) {
  343. //排污口专用数据
  344. String ph = NumberUtils.getNumFloat(6.6, 8.4);//ph
  345. String cod = NumberUtils.getNum(0, 380, 0);//cod
  346. String nh3n = NumberUtils.getNum(0, 50, 1);//nh3n
  347. String tp = NumberUtils.getNumFloat(0.0, 10.0);//tp
  348. String tn = NumberUtils.getNum(0, 150, 1);//tn
  349. String flow = NumberUtils.getNum(0, 100, 1);//flow
  350. protData.setPh(ph);
  351. protData.setFlow(flow);
  352. protData.setTp(tp);
  353. protData.setTn(tn);
  354. protData.setCod(cod);
  355. protData.setNh3n(nh3n);
  356. protDataMapper.insert(protData);
  357. if (i==3) {
  358. queryWrapper.eq("farm_id", 21).eq("prot_type", 3);
  359. } else {
  360. queryWrapper.eq("farm_id", 24).eq("prot_type", 3);
  361. }
  362. ProtThreshold protThreshold = protThresholdMapper.selectOne(queryWrapper);//进污口
  363. if (Double.parseDouble(ph) > Double.parseDouble(protThreshold.getPh2()) || Double.parseDouble(ph) < Double.parseDouble(protThreshold.getOther3())) {
  364. ProtWarningInfo protWarningInfo = new ProtWarningInfo();
  365. protWarningInfo.setWarningContent("排污口ph值为" + ph + "达到红色预警");
  366. protWarningInfo.setWarningType(1);
  367. protWarningInfo.setFarmId(protThreshold.getFarmId());
  368. protWarningInfo.setDate(new Date());
  369. protWarningInfo.setUserIds(protThreshold.getUserIds());
  370. protWarningInfo.setDeviceId(i);
  371. protWarningInfo.setBuildLocation("排污口");
  372. warningInfoMapper.insert(protWarningInfo);
  373. }
  374. if (Double.parseDouble(ph) > Double.parseDouble(protThreshold.getPh1()) || Double.parseDouble(ph) < Double.parseDouble(protThreshold.getOther2())) {
  375. ProtWarningInfo protWarningInfo = new ProtWarningInfo();
  376. protWarningInfo.setWarningContent("排污口ph值为" + ph + "达到橙色预警");
  377. protWarningInfo.setWarningType(1);
  378. protWarningInfo.setFarmId(protThreshold.getFarmId());
  379. protWarningInfo.setDate(new Date());
  380. protWarningInfo.setUserIds(protThreshold.getUserIds());
  381. protWarningInfo.setDeviceId(i);
  382. protWarningInfo.setBuildLocation("排污口");
  383. warningInfoMapper.insert(protWarningInfo);
  384. }
  385. if (Double.parseDouble(cod) > Double.parseDouble(protThreshold.getCod2())) {
  386. ProtWarningInfo protWarningInfo = new ProtWarningInfo();
  387. protWarningInfo.setWarningContent("排污口cod值为" + cod + "达到红色预警");
  388. protWarningInfo.setWarningType(0);
  389. protWarningInfo.setFarmId(protThreshold.getFarmId());
  390. protWarningInfo.setDate(new Date());
  391. protWarningInfo.setUserIds(protThreshold.getUserIds());
  392. protWarningInfo.setDeviceId(i);
  393. protWarningInfo.setBuildLocation("排污口");
  394. warningInfoMapper.insert(protWarningInfo);
  395. }
  396. if (Double.parseDouble(cod) > Double.parseDouble(protThreshold.getCod1())) {
  397. ProtWarningInfo protWarningInfo = new ProtWarningInfo();
  398. protWarningInfo.setWarningContent("排污口cod值为" + cod + "达到橙色预警");
  399. protWarningInfo.setWarningType(0);
  400. protWarningInfo.setFarmId(protThreshold.getFarmId());
  401. protWarningInfo.setDate(new Date());
  402. protWarningInfo.setUserIds(protThreshold.getUserIds());
  403. protWarningInfo.setDeviceId(i);
  404. protWarningInfo.setBuildLocation("排污口");
  405. warningInfoMapper.insert(protWarningInfo);
  406. }
  407. if (Double.parseDouble(nh3n) > Double.parseDouble(protThreshold.getNh3n2())) {
  408. ProtWarningInfo protWarningInfo = new ProtWarningInfo();
  409. protWarningInfo.setWarningContent("排污口NH3N值为" + nh3n + "达到红色预警");
  410. protWarningInfo.setWarningType(2);
  411. protWarningInfo.setFarmId(protThreshold.getFarmId());
  412. protWarningInfo.setDate(new Date());
  413. protWarningInfo.setUserIds(protThreshold.getUserIds());
  414. protWarningInfo.setDeviceId(i);
  415. protWarningInfo.setBuildLocation("排污口");
  416. warningInfoMapper.insert(protWarningInfo);
  417. }
  418. if (Double.parseDouble(nh3n) > Double.parseDouble(protThreshold.getNh3n1())) {
  419. ProtWarningInfo protWarningInfo = new ProtWarningInfo();
  420. protWarningInfo.setWarningContent("排污口NH3N值为" + nh3n + "达到橙色预警");
  421. protWarningInfo.setWarningType(2);
  422. protWarningInfo.setFarmId(protThreshold.getFarmId());
  423. protWarningInfo.setDate(new Date());
  424. protWarningInfo.setUserIds(protThreshold.getUserIds());
  425. protWarningInfo.setDeviceId(i);
  426. protWarningInfo.setBuildLocation("排污口");
  427. warningInfoMapper.insert(protWarningInfo);
  428. }
  429. if (Double.parseDouble(tp) > Double.parseDouble(protThreshold.getTp2())) {
  430. ProtWarningInfo protWarningInfo = new ProtWarningInfo();
  431. protWarningInfo.setWarningContent("排污口TP值为" + tp + "达到红色预警");
  432. protWarningInfo.setWarningType(3);
  433. protWarningInfo.setFarmId(protThreshold.getFarmId());
  434. protWarningInfo.setDate(new Date());
  435. protWarningInfo.setUserIds(protThreshold.getUserIds());
  436. protWarningInfo.setDeviceId(i);
  437. protWarningInfo.setBuildLocation("排污口");
  438. warningInfoMapper.insert(protWarningInfo);
  439. }
  440. if (Double.parseDouble(tp) > Double.parseDouble(protThreshold.getTp1())) {
  441. ProtWarningInfo protWarningInfo = new ProtWarningInfo();
  442. protWarningInfo.setWarningContent("排污口TP值为" + tp + "达到橙色预警");
  443. protWarningInfo.setWarningType(3);
  444. protWarningInfo.setFarmId(protThreshold.getFarmId());
  445. protWarningInfo.setDate(new Date());
  446. protWarningInfo.setUserIds(protThreshold.getUserIds());
  447. protWarningInfo.setDeviceId(i);
  448. protWarningInfo.setBuildLocation("排污口");
  449. warningInfoMapper.insert(protWarningInfo);
  450. }
  451. if (Double.parseDouble(tn) > Double.parseDouble(protThreshold.getTn2())) {
  452. ProtWarningInfo protWarningInfo = new ProtWarningInfo();
  453. protWarningInfo.setWarningContent("排污口TN值为" + tn + "达到红色预警");
  454. protWarningInfo.setWarningType(4);
  455. protWarningInfo.setFarmId(protThreshold.getFarmId());
  456. protWarningInfo.setDate(new Date());
  457. protWarningInfo.setUserIds(protThreshold.getUserIds());
  458. protWarningInfo.setDeviceId(i);
  459. protWarningInfo.setBuildLocation("排污口");
  460. warningInfoMapper.insert(protWarningInfo);
  461. }
  462. if (Double.parseDouble(tn) > Double.parseDouble(protThreshold.getTn1())) {
  463. ProtWarningInfo protWarningInfo = new ProtWarningInfo();
  464. protWarningInfo.setWarningContent("排污口TN值为" + tn + "达到橙色预警");
  465. protWarningInfo.setWarningType(4);
  466. protWarningInfo.setFarmId(protThreshold.getFarmId());
  467. protWarningInfo.setDate(new Date());
  468. protWarningInfo.setUserIds(protThreshold.getUserIds());
  469. protWarningInfo.setDeviceId(i);
  470. protWarningInfo.setBuildLocation("排污口");
  471. warningInfoMapper.insert(protWarningInfo);
  472. }
  473. if (Double.parseDouble(flow) > Double.parseDouble(protThreshold.getFlow2())) {
  474. ProtWarningInfo protWarningInfo = new ProtWarningInfo();
  475. protWarningInfo.setWarningContent("排污口累计流量值为" + flow + "达到红色预警");
  476. protWarningInfo.setWarningType(5);
  477. protWarningInfo.setFarmId(protThreshold.getFarmId());
  478. protWarningInfo.setDate(new Date());
  479. protWarningInfo.setUserIds(protThreshold.getUserIds());
  480. protWarningInfo.setDeviceId(i);
  481. protWarningInfo.setBuildLocation("排污口");
  482. warningInfoMapper.insert(protWarningInfo);
  483. }
  484. if (Double.parseDouble(flow) > Double.parseDouble(protThreshold.getFlow1())) {
  485. ProtWarningInfo protWarningInfo = new ProtWarningInfo();
  486. protWarningInfo.setWarningContent("排污口累计流量值为" + flow + "达到橙色预警");
  487. protWarningInfo.setWarningType(5);
  488. protWarningInfo.setFarmId(protThreshold.getFarmId());
  489. protWarningInfo.setDate(new Date());
  490. protWarningInfo.setUserIds(protThreshold.getUserIds());
  491. protWarningInfo.setDeviceId(i);
  492. protWarningInfo.setBuildLocation("排污口");
  493. warningInfoMapper.insert(protWarningInfo);
  494. }
  495. }
  496. }
  497. }
  498. }