StatisticsController.java 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477
  1. package com.ruoyi.project.statistics.controller;
  2. import com.ruoyi.common.core.controller.BaseController;
  3. import com.ruoyi.common.core.domain.AjaxResult;
  4. import com.ruoyi.common.utils.DateUtils;
  5. import com.ruoyi.project.check.domain.TCheckLawitems;
  6. import com.ruoyi.project.check.service.ITCheckLawitemsService;
  7. import com.ruoyi.project.statistics.domain.Statistics;
  8. import com.ruoyi.project.statistics.service.IStatisticsService;
  9. import org.springframework.beans.factory.annotation.Autowired;
  10. import org.springframework.web.bind.annotation.GetMapping;
  11. import org.springframework.web.bind.annotation.RequestMapping;
  12. import org.springframework.web.bind.annotation.RestController;
  13. import java.math.BigDecimal;
  14. import java.math.RoundingMode;
  15. import java.util.*;
  16. import java.util.concurrent.atomic.AtomicInteger;
  17. @RestController
  18. @RequestMapping("/statistics/statistics")
  19. public class StatisticsController extends BaseController {
  20. @Autowired
  21. private IStatisticsService statisticsService;
  22. @Autowired
  23. private ITCheckLawitemsService tCheckLawitemsService;
  24. @GetMapping("/list")
  25. public AjaxResult list(Statistics statistics) {
  26. List<Statistics> resultList = new ArrayList<>();
  27. // 根据装查询
  28. List<Statistics> countPlant = statisticsService.countPlant(statistics);
  29. for (Statistics plant : countPlant) {
  30. Statistics result = new Statistics();
  31. setStatistics(result);
  32. result.setPlantName(plant.getPlantName());
  33. result.setPlantCount(plant.getCount());
  34. // 统计设备数量
  35. Statistics countDevice = statisticsService.countDevice(plant);
  36. result.setDevCount(countDevice.getCount());
  37. // 根据密封点类型统计数量
  38. int qyljCount = 0;//取样连接系统
  39. for (Statistics countPoint : statisticsService.countPoint(plant)) {
  40. switch (countPoint.getContent()) {
  41. case "泵":
  42. result.setbCount(countPoint.getCount());
  43. break;
  44. case "阀门":
  45. result.setFmCount(countPoint.getCount());
  46. break;
  47. case "法兰":
  48. result.setFlCount(countPoint.getCount());
  49. break;
  50. case "搅拌器":
  51. result.setJbqCount(countPoint.getCount());
  52. break;
  53. case "连接件":
  54. result.setLjjCount(countPoint.getCount());
  55. break;
  56. case "泄压设备":
  57. result.setXysbCount(countPoint.getCount());
  58. break;
  59. case "压缩机":
  60. result.setYsjCount(countPoint.getCount());
  61. break;
  62. case "开口阀或开口管线":
  63. result.setKkfCount(countPoint.getCount());
  64. break;
  65. case "取样连接系统(开口取样-无残液置换、处置措施)":
  66. case "取样连接系统(密闭取样-取样瓶长期与取样口连接)":
  67. case "取样连接系统(开口取样-有残液置换、处置措施)":
  68. case "取样连接系统(密闭取样-取样瓶不与取样口连接)":
  69. qyljCount += countPoint.getCount();
  70. break;
  71. case "其他":
  72. result.setQtCount(countPoint.getCount());
  73. break;
  74. }
  75. }
  76. result.setQyljCount(qyljCount);
  77. // 计算总数量
  78. result.setPointCount(result.getbCount() + result.getYsjCount() + result.getJbqCount() + result.getFmCount() + result.getXysbCount() + result.getLjjCount() + result.getFlCount() + result.getKkfCount() + result.getQyljCount() + result.getQtCount());
  79. // 根据泄露程度统计
  80. statistics.setPlantId(plant.getPlantId());
  81. for (Statistics countXlcd : statisticsService.countXlcd(statistics)) {
  82. switch (countXlcd.getContent()) {
  83. case "1":
  84. result.setWxlCount(countXlcd.getCount());
  85. break;
  86. case "2":
  87. result.setYbxlCount(countXlcd.getCount());
  88. break;
  89. case "3":
  90. result.setYzxlCount(countXlcd.getCount());
  91. break;
  92. }
  93. }
  94. // 未检测数量统计
  95. result.setWjcCount((result.getPointCount() - result.getWxlCount() - result.getYbxlCount() - result.getYzxlCount()));
  96. // 总数统记
  97. result.setXlcdCount(result.getPointCount());
  98. // 查询所有检测点的净检测值
  99. List<Statistics> countPfl = statisticsService.countPfl(statistics);
  100. resultList.add(getCountValue(countPfl, result));
  101. }
  102. Statistics total = new Statistics();
  103. setStatistics(total);
  104. total.setPlantName("合计");
  105. for (Statistics item : resultList) {
  106. total.setPlantCount(item.getPlantCount() + total.getPlantCount());
  107. total.setDevCount(item.getDevCount() + total.getDevCount());
  108. total.setbCount(item.getbCount() + total.getbCount());
  109. total.setYsjCount(item.getYsjCount() + total.getYsjCount());
  110. total.setJbqCount(item.getJbqCount() + total.getJbqCount());
  111. total.setFmCount(item.getFmCount() + total.getFmCount());
  112. total.setXysbCount(item.getXysbCount() + total.getXysbCount());
  113. total.setLjjCount(item.getLjjCount() + total.getLjjCount());
  114. total.setFlCount(item.getFlCount() + total.getFlCount());
  115. total.setKkfCount(item.getKkfCount() + total.getKkfCount());
  116. total.setQyljCount(item.getQyljCount() + total.getQyljCount());
  117. total.setQtCount(item.getQtCount() + total.getQtCount());
  118. total.setPointCount(item.getPointCount() + total.getPointCount());
  119. total.setWxlCount(item.getWxlCount() + total.getWxlCount());
  120. total.setYbxlCount(item.getYbxlCount() + total.getYbxlCount());
  121. total.setYzxlCount(item.getYzxlCount() + total.getYzxlCount());
  122. total.setWjcCount(item.getWjcCount() + total.getWjcCount());
  123. total.setXlcdCount(item.getXlcdCount() + total.getXlcdCount());
  124. total.setXll(new BigDecimal(item.getXll()).add(new BigDecimal(total.getXll())).toString());
  125. total.setJpl(new BigDecimal(item.getJpl()).add(new BigDecimal(total.getJpl())).toString());
  126. total.setPfl(new BigDecimal(item.getPfl()).add(new BigDecimal(total.getPfl())).toString());
  127. total.setSjpfl(new BigDecimal(item.getSjpfl()).add(new BigDecimal(total.getSjpfl())).toString());
  128. }
  129. resultList.add(total);
  130. return AjaxResult.success(resultList);
  131. }
  132. private void setStatistics(Statistics total) {
  133. total.setPlantCount(0);
  134. total.setDevCount(0);
  135. total.setbCount(0);
  136. total.setYsjCount(0);
  137. total.setJbqCount(0);
  138. total.setFmCount(0);
  139. total.setXysbCount(0);
  140. total.setLjjCount(0);
  141. total.setFlCount(0);
  142. total.setKkfCount(0);
  143. total.setQyljCount(0);
  144. total.setQtCount(0);
  145. total.setPointCount(0);
  146. total.setWxlCount(0);
  147. total.setYbxlCount(0);
  148. total.setYzxlCount(0);
  149. total.setWjcCount(0);
  150. total.setXlcdCount(0);
  151. total.setXll("0");
  152. total.setJpl("0");
  153. total.setPfl("0");
  154. total.setSjpfl("0");
  155. }
  156. private Statistics getCountValue(List<Statistics> countPfl, Statistics result) {
  157. // 设置当年时间
  158. Calendar nc = Calendar.getInstance();//当年的1月1日
  159. nc.set(nc.get(Calendar.YEAR), 0, 1, 0, 0, 0);
  160. nc.set(Calendar.MILLISECOND, 0);//设置毫秒值为0否则会减掉 一天
  161. Calendar nm = Calendar.getInstance();//次年的1月1日
  162. nm.set(nm.get(Calendar.YEAR), 12, 1, 0, 0, 0);
  163. nm.set(Calendar.MILLISECOND, 0);//设置毫秒值为0否则会减掉 一天
  164. double zpfl = 0;//初始排放量
  165. double sjpfl = 0;//实际排放量
  166. double zxll = 0;//总泄漏量
  167. long pid = 0;
  168. double temp = 0;
  169. Map<String, String> testValues = getTestValue();
  170. for (int i = 0; i < countPfl.size(); i++) {
  171. Statistics point = countPfl.get(i);
  172. double netTestValue = Double.parseDouble(point.getNetTestValue());
  173. if (netTestValue < Integer.parseInt(testValues.get(point.getPointType()))) {
  174. if (i == 0 || !Objects.equals(countPfl.get(i - 1).getPointId(), point.getPointId())) {//如果是第一条||前一条和当前这条不是是同一个点
  175. sjpfl += getETOC(netTestValue, point.getPointType()) * DateUtils.differentDaysByMillisecond(nc.getTime(), point.getCheckDate()) * 24;
  176. } else if (Objects.equals(countPfl.get(i - 1).getPointId(), point.getPointId())) {//如果前一条和当前这条是同一个点
  177. if (new BigDecimal(countPfl.get(i - 1).getNetTestValue()).compareTo(new BigDecimal(Integer.parseInt(testValues.get(point.getPointType())))) < 0) { // 如果前一条检测值小于泄漏标准
  178. sjpfl += getETOC(netTestValue, point.getPointType()) * DateUtils.differentDaysByMillisecond(point.getCheckDate(), countPfl.get(i - 1).getCheckDate()) * 24;
  179. }
  180. }
  181. if (i + 1 == countPfl.size() || !Objects.equals(countPfl.get(i + 1).getPointId(), point.getPointId())) {//如果下一条和当前这条不是同一个点
  182. sjpfl += getETOC(netTestValue, point.getPointType()) * (DateUtils.differentDaysByMillisecond(nm.getTime(), point.getCheckDate())) * 24;
  183. }
  184. } else {
  185. if (i == 0 || !Objects.equals(countPfl.get(i - 1).getPointId(), point.getPointId())) {//如果是第一条||前一条和当前这条不是是同一个点
  186. sjpfl += getETOC(netTestValue, point.getPointType()) * DateUtils.differentDaysByMillisecond(nc.getTime(), point.getCheckDate()) * 24;
  187. } else if (Objects.equals(countPfl.get(i - 1).getPointId(), point.getPointId())) {//如果前一条和当前这条是同一个点
  188. sjpfl += getETOC(netTestValue, point.getPointType()) * DateUtils.differentDaysByMillisecond(point.getCheckDate(), countPfl.get(i - 1).getCheckDate()) * 24;
  189. }
  190. if (i + 1 == countPfl.size() || !Objects.equals(countPfl.get(i + 1).getPointId(), point.getPointId())) {//如果下一条和当前这条不是同一个点
  191. sjpfl += getETOC(netTestValue, point.getPointType()) * (DateUtils.differentDaysByMillisecond(nm.getTime(), point.getCheckDate())) * 24;
  192. } else {
  193. sjpfl += getETOC(netTestValue, point.getPointType()) * (DateUtils.differentDaysByMillisecond(countPfl.get(i + 1).getCheckDate(), point.getCheckDate())) * 24;
  194. }
  195. }
  196. if (pid == point.getPointId()) {
  197. continue;
  198. }
  199. if (netTestValue >= Integer.parseInt(testValues.get(point.getPointType()))) {
  200. pid = point.getPointId();
  201. if (i == 0 || !Objects.equals(countPfl.get(i - 1).getPointId(), point.getPointId())) {//如果是第一条||前一条和当前这条不是是同一个点
  202. double pfl = getETOC(netTestValue, point.getPointType()) * DateUtils.differentDaysByMillisecond(nc.getTime(), nm.getTime()) * 24;
  203. zxll += pfl;
  204. zpfl += pfl;
  205. } else {
  206. double pfl = getETOC(netTestValue, point.getPointType()) * DateUtils.differentDaysByMillisecond(countPfl.get(i - 1).getCheckDate(), nm.getTime()) * 24;
  207. zxll += pfl + (zpfl - temp);
  208. zpfl += pfl;
  209. temp = 0;
  210. }
  211. } else {
  212. if (i == 0 || !Objects.equals(countPfl.get(i - 1).getPointId(), point.getPointId())) {//如果是第一条||前一条和当前这条不是是同一个点
  213. temp = zpfl;
  214. zpfl += getETOC(netTestValue, point.getPointType()) * DateUtils.differentDaysByMillisecond(nc.getTime(), point.getCheckDate()) * 24;
  215. } else if (Objects.equals(countPfl.get(i - 1).getPointId(), point.getPointId())) {//如果前一条和当前这条是同一个点
  216. zpfl += getETOC(netTestValue, point.getPointType()) * DateUtils.differentDaysByMillisecond(point.getCheckDate(), countPfl.get(i - 1).getCheckDate()) * 24;
  217. }
  218. if (i + 1 == countPfl.size() || !Objects.equals(countPfl.get(i + 1).getPointId(), point.getPointId())) {//如果下一条和当前这条不是同一个点
  219. zpfl += getETOC(netTestValue, point.getPointType()) * (DateUtils.differentDaysByMillisecond(nm.getTime(), point.getCheckDate())) * 24;
  220. }
  221. }
  222. }
  223. // 排放量(t/年)
  224. result.setPfl(new BigDecimal(String.valueOf(zpfl)).divide(new BigDecimal("1000"), 4, RoundingMode.HALF_UP).stripTrailingZeros().toString());
  225. // 泄漏量(t/年)
  226. result.setXll(new BigDecimal(String.valueOf(zxll)).divide(new BigDecimal("1000"), 4, RoundingMode.HALF_UP).stripTrailingZeros().toString());
  227. // 减排量(t/年)
  228. result.setJpl(new BigDecimal(String.valueOf(zpfl - sjpfl)).divide(new BigDecimal("1000"), 4, RoundingMode.HALF_UP).stripTrailingZeros().toString());
  229. result.setSjpfl(new BigDecimal(String.valueOf(sjpfl)).divide(new BigDecimal("1000"), 4, RoundingMode.HALF_UP).stripTrailingZeros().toString());
  230. return result;
  231. }
  232. @GetMapping("/xlcdByPoint")
  233. public AjaxResult xlcdByPoint(Statistics statistics) {
  234. Map<String, Statistics> map = new HashMap<>();
  235. List<Statistics> xlcdByPoint = statisticsService.countXlcdByPoint(statistics);
  236. Statistics result = null;
  237. for (Statistics point : xlcdByPoint) {
  238. String pointType = point.getPointType();
  239. if (pointType.contains("取样连接系统")) {
  240. pointType = "取样连接系统";
  241. }
  242. Integer count = point.getCount();
  243. if (map.get(pointType) == null) {
  244. result = new Statistics();
  245. }
  246. switch (point.getContent()) {
  247. case "1":
  248. result.setWxlCount(count);
  249. break;
  250. case "2":
  251. result.setYbxlCount(count);
  252. break;
  253. case "3":
  254. result.setYzxlCount(count);
  255. break;
  256. }
  257. result.setPointType(pointType);
  258. map.put(pointType, result);
  259. }
  260. return AjaxResult.success(map.values());
  261. }
  262. @GetMapping("/pflByPoint")
  263. public AjaxResult pflByPoint(Statistics statistics) {
  264. List<Statistics> resultList = new ArrayList<>();
  265. // 根据装查询
  266. List<Statistics> countPlant = statisticsService.countPlant(statistics);
  267. Map<String, String> testValues = getTestValue();
  268. for (Statistics plant : countPlant) {
  269. statistics.setPlantId(plant.getPlantId());
  270. List<Statistics> countPfl = statisticsService.countPfl(statistics);
  271. // 设置当年时间
  272. Calendar nc = Calendar.getInstance();//当年的1月1日
  273. nc.set(nc.get(Calendar.YEAR), 0, 1, 0, 0, 0);
  274. nc.set(Calendar.MILLISECOND, 0);//设置毫秒值为0否则会减掉 一天
  275. Calendar nm = Calendar.getInstance();//次年的1月1日
  276. nm.set(nm.get(Calendar.YEAR), 12, 1, 0, 0, 0);
  277. nm.set(Calendar.MILLISECOND, 0);//设置毫秒值为0否则会减掉 一天
  278. Statistics result = null;
  279. double zpfl = 0;//初始排放量
  280. double sjpfl = 0;//实际排放量
  281. double zxll = 0;//总泄漏量
  282. long pid = 0;
  283. double temp = 0;
  284. for (int i = 0; i < countPfl.size(); i++) {
  285. Statistics item = countPfl.get(i);
  286. //如果是第一条或者下一条的密封点类型和当前的密封点类型不一致
  287. if (i == 0 || !countPfl.get(i).getPointType().equals(result.getPointType())) {
  288. result = new Statistics();
  289. result.setPointType(item.getPointType());
  290. zpfl = 0;//初始排放量
  291. sjpfl = 0;//实际排放量
  292. zxll = 0;//总泄漏量
  293. }
  294. result.setPlantName(plant.getPlantName());
  295. double netTestValue = Double.parseDouble(item.getNetTestValue());
  296. if (netTestValue < Integer.parseInt(testValues.get(item.getPointType()))) {
  297. if (i == 0 || !Objects.equals(countPfl.get(i - 1).getPointId(), item.getPointId())) {//如果是第一条||前一条和当前这条不是是同一个点
  298. sjpfl += getETOC(netTestValue, item.getPointType()) * DateUtils.differentDaysByMillisecond(nc.getTime(), item.getCheckDate()) * 24;
  299. } else if (Objects.equals(countPfl.get(i - 1).getPointId(), item.getPointId())) {//如果前一条和当前这条是同一个点
  300. if (new BigDecimal(countPfl.get(i - 1).getNetTestValue()).compareTo(new BigDecimal(Integer.parseInt(testValues.get(item.getPointType())))) < 0) { // 如果前一条检测值小于泄漏标准
  301. sjpfl += getETOC(netTestValue, item.getPointType()) * DateUtils.differentDaysByMillisecond(item.getCheckDate(), countPfl.get(i - 1).getCheckDate()) * 24;
  302. }
  303. }
  304. if (i + 1 == countPfl.size() || !Objects.equals(countPfl.get(i + 1).getPointId(), item.getPointId())) {//如果下一条和当前这条不是同一个点
  305. sjpfl += getETOC(netTestValue, item.getPointType()) * (DateUtils.differentDaysByMillisecond(nm.getTime(), item.getCheckDate())) * 24;
  306. }
  307. } else {
  308. if (i == 0 || !Objects.equals(countPfl.get(i - 1).getPointId(), item.getPointId())) {//如果是第一条||前一条和当前这条不是是同一个点
  309. sjpfl += getETOC(netTestValue, item.getPointType()) * DateUtils.differentDaysByMillisecond(nc.getTime(), item.getCheckDate()) * 24;
  310. } else if (Objects.equals(countPfl.get(i - 1).getPointId(), item.getPointId())) {//如果前一条和当前这条是同一个点
  311. sjpfl += getETOC(netTestValue, item.getPointType()) * DateUtils.differentDaysByMillisecond(item.getCheckDate(), countPfl.get(i - 1).getCheckDate()) * 24;
  312. }
  313. if (i + 1 == countPfl.size() || !Objects.equals(countPfl.get(i + 1).getPointId(), item.getPointId())) {//如果下一条和当前这条不是同一个点
  314. sjpfl += getETOC(netTestValue, item.getPointType()) * (DateUtils.differentDaysByMillisecond(nm.getTime(), item.getCheckDate())) * 24;
  315. } else {
  316. sjpfl += getETOC(netTestValue, item.getPointType()) * (DateUtils.differentDaysByMillisecond(countPfl.get(i + 1).getCheckDate(), item.getCheckDate())) * 24;
  317. }
  318. }
  319. if (pid == item.getPointId()) {
  320. if (i != 0 && (i + 1 == countPfl.size() || !countPfl.get(i + 1).getPointType().equals(item.getPointType()))) {
  321. // 排放量(t/年)
  322. result.setPfl(new BigDecimal(String.valueOf(zpfl)).divide(new BigDecimal("1000"), 8, RoundingMode.HALF_UP).stripTrailingZeros().toString());
  323. // 泄漏量(t/年)
  324. result.setXll(new BigDecimal(String.valueOf(zxll)).divide(new BigDecimal("1000"), 8, RoundingMode.HALF_UP).stripTrailingZeros().toString());
  325. // 减排量(t/年)
  326. result.setJpl(new BigDecimal(String.valueOf(zpfl - sjpfl)).divide(new BigDecimal("1000"), 8, RoundingMode.HALF_UP).stripTrailingZeros().toString());
  327. resultList.add(result);
  328. }
  329. continue;
  330. }
  331. if (netTestValue >= Integer.parseInt(testValues.get(item.getPointType()))) {
  332. pid = item.getPointId();
  333. if (i == 0 || !Objects.equals(countPfl.get(i - 1).getPointId(), item.getPointId())) {//如果是第一条||前一条和当前这条不是是同一个点
  334. double pfl = getETOC(netTestValue, item.getPointType()) * DateUtils.differentDaysByMillisecond(nc.getTime(), nm.getTime()) * 24;
  335. zxll += pfl;
  336. zpfl += pfl;
  337. } else {
  338. double pfl = getETOC(netTestValue, item.getPointType()) * DateUtils.differentDaysByMillisecond(countPfl.get(i - 1).getCheckDate(), nm.getTime()) * 24;
  339. zxll += pfl + (zpfl - temp);
  340. zpfl += pfl;
  341. temp = 0;
  342. }
  343. } else {
  344. if (i == 0 || !Objects.equals(countPfl.get(i - 1).getPointId(), item.getPointId())) {//如果是第一条||前一条和当前这条不是是同一个点
  345. temp = zpfl;
  346. zpfl += getETOC(netTestValue, item.getPointType()) * DateUtils.differentDaysByMillisecond(nc.getTime(), item.getCheckDate()) * 24;
  347. } else if (Objects.equals(countPfl.get(i - 1).getPointId(), item.getPointId())) {//如果前一条和当前这条是同一个点
  348. zpfl += getETOC(netTestValue, item.getPointType()) * DateUtils.differentDaysByMillisecond(item.getCheckDate(), countPfl.get(i - 1).getCheckDate()) * 24;
  349. }
  350. if (i + 1 == countPfl.size() || !Objects.equals(countPfl.get(i + 1).getPointId(), item.getPointId())) {//如果下一条和当前这条不是同一个点
  351. zpfl += getETOC(netTestValue, item.getPointType()) * (DateUtils.differentDaysByMillisecond(nm.getTime(), item.getCheckDate())) * 24;
  352. }
  353. }
  354. if (i != 0 && (i + 1 == countPfl.size() || !countPfl.get(i + 1).getPointType().equals(item.getPointType()))) {
  355. // 排放量(t/年)
  356. result.setPfl(new BigDecimal(String.valueOf(zpfl)).divide(new BigDecimal("1000"), 8, RoundingMode.HALF_UP).stripTrailingZeros().toString());
  357. // 泄漏量(t/年)
  358. result.setXll(new BigDecimal(String.valueOf(zxll)).divide(new BigDecimal("1000"), 8, RoundingMode.HALF_UP).stripTrailingZeros().toString());
  359. // 减排量(t/年)
  360. result.setJpl(new BigDecimal(String.valueOf(zpfl - sjpfl)).divide(new BigDecimal("1000"), 8, RoundingMode.HALF_UP).stripTrailingZeros().toString());
  361. resultList.add(result);
  362. }
  363. }
  364. }
  365. return AjaxResult.success(resultList);
  366. }
  367. /**
  368. * 计算排放速率(kg/h)
  369. *
  370. * @param netTestValue
  371. * @param pointType
  372. * @return
  373. */
  374. public double getETOC(double netTestValue, String pointType) {
  375. switch (pointType) {
  376. case "泵":
  377. if (netTestValue < 1) {
  378. return 2.4 * Math.pow(10, -5);
  379. } else if (netTestValue >= 1 && netTestValue < 50000) {
  380. return 5.03 * Math.pow(10, -5) * Math.pow(netTestValue, 0.61);
  381. } else {
  382. return 0.16;
  383. }
  384. case "阀门":
  385. if (netTestValue < 1) {
  386. return 7.8 * Math.pow(10, -6);
  387. } else if (netTestValue >= 1 && netTestValue < 50000) {
  388. return 2.29 * Math.pow(10, -6) * Math.pow(netTestValue, 0.746);
  389. } else {
  390. return 0.14;
  391. }
  392. case "法兰":
  393. if (netTestValue < 1) {
  394. return 3.1 * Math.pow(10, -7);
  395. } else if (netTestValue >= 1 && netTestValue < 50000) {
  396. return 4.61 * Math.pow(10, -6) * Math.pow(netTestValue, 0.703);
  397. } else {
  398. return 0.084;
  399. }
  400. case "连接件":
  401. if (netTestValue < 1) {
  402. return 7.5 * Math.pow(10, -6);
  403. } else if (netTestValue >= 1 && netTestValue < 50000) {
  404. return 1.53 * Math.pow(10, -6) * Math.pow(netTestValue, 0.735);
  405. } else {
  406. return 0.03;
  407. }
  408. case "开口阀或开口管线":
  409. if (netTestValue < 1) {
  410. return 2 * Math.pow(10, -6);
  411. } else if (netTestValue >= 1 && netTestValue < 50000) {
  412. return 2.2 * Math.pow(10, -6) * Math.pow(netTestValue, 0.704);
  413. } else {
  414. return 0.079;
  415. }
  416. default://其他
  417. if (netTestValue < 1) {
  418. return 4 * Math.pow(10, -6);
  419. } else if (netTestValue >= 1 && netTestValue < 50000) {
  420. return 1.36 * Math.pow(10, -5) * Math.pow(netTestValue, 0.589);
  421. } else {
  422. return 0.11;
  423. }
  424. }
  425. }
  426. private Map<String, String> getTestValue() {
  427. Map<String, String> map = new HashMap<>();
  428. List<TCheckLawitems> tCheckLawitems = tCheckLawitemsService.selectTCheckLawitemsByLawStatus();
  429. for (TCheckLawitems lawitem : tCheckLawitems) {
  430. map.put(lawitem.getPointType(), lawitem.getGeneral());
  431. }
  432. return map;
  433. }
  434. @GetMapping("/countXlcd")
  435. public AjaxResult countXlcd(Statistics statistics) {
  436. List<Statistics> resultList = new ArrayList<>();
  437. // 根据装查询
  438. for (Statistics plant : statisticsService.countPlant(statistics)) {
  439. Statistics result = new Statistics();
  440. setStatistics(result);
  441. result.setPlantName(plant.getPlantName());
  442. statistics.setPlantId(plant.getPlantId());
  443. for (Statistics countXlcd : statisticsService.countXlcd(statistics)) {
  444. switch (countXlcd.getContent()) {
  445. case "1":
  446. result.setWxlCount(countXlcd.getCount());
  447. break;
  448. case "2":
  449. result.setYbxlCount(countXlcd.getCount());
  450. break;
  451. case "3":
  452. result.setYzxlCount(countXlcd.getCount());
  453. break;
  454. }
  455. }
  456. resultList.add(result);
  457. }
  458. return AjaxResult.success(resultList);
  459. }
  460. }