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