From 30d46d06fb4153e48df281d3008ed90935b3c06d Mon Sep 17 00:00:00 2001
From: riku <risaku@163.com>
Date: 星期二, 19 七月 2022 16:45:08 +0800
Subject: [PATCH] 1. 新增扬尘监测数据超标情况表
---
src/main/kotlin/cn/flightfeather/supervision/business/storage/item/StScoreItem_2.kt | 67 +++++++++
src/main/resources/mapper/ds1/DustDataResultMapper.xml | 27 +++
src/main/kotlin/cn/flightfeather/supervision/domain/ds1/entity/DustDataResult.java | 265 +++++++++++++++++++++++++++++++++++++
src/main/kotlin/cn/flightfeather/supervision/business/storage/StAutoScore.kt | 8
src/main/kotlin/cn/flightfeather/supervision/domain/ds1/mapper/DustDataResultMapper.kt | 8 +
src/main/resources/generator/generatorConfig4ds1.xml | 2
6 files changed, 373 insertions(+), 4 deletions(-)
diff --git a/src/main/kotlin/cn/flightfeather/supervision/business/storage/StAutoScore.kt b/src/main/kotlin/cn/flightfeather/supervision/business/storage/StAutoScore.kt
index 00721c7..979bcc0 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/business/storage/StAutoScore.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/business/storage/StAutoScore.kt
@@ -2,6 +2,8 @@
import cn.flightfeather.supervision.business.Info
import cn.flightfeather.supervision.business.ScoreItem
+import cn.flightfeather.supervision.business.storage.item.StScoreItem_1
+import cn.flightfeather.supervision.business.storage.item.StScoreItem_2
import cn.flightfeather.supervision.common.utils.Constant
import cn.flightfeather.supervision.common.utils.DateUtil
import cn.flightfeather.supervision.common.utils.ExcelUtil
@@ -17,8 +19,6 @@
import tk.mybatis.mapper.entity.Example
import java.io.File
import java.io.FileOutputStream
-import java.time.LocalDate
-import java.time.LocalDateTime
import java.util.*
import javax.annotation.PostConstruct
import kotlin.math.abs
@@ -30,7 +30,8 @@
*/
@Component
class StAutoScore(
- stScoreItem_1: ScoreItem,
+ stScoreItem_1: StScoreItem_1,
+ stScoreItem_2: StScoreItem_2,
var sceneType: Constant.ScenseType = Constant.ScenseType.TYPE1, )
{
companion object {
@@ -93,6 +94,7 @@
init {
itemList.add(stScoreItem_1)
+ itemList.add(stScoreItem_2)
}
@PostConstruct
diff --git a/src/main/kotlin/cn/flightfeather/supervision/business/storage/item/StScoreItem_2.kt b/src/main/kotlin/cn/flightfeather/supervision/business/storage/item/StScoreItem_2.kt
new file mode 100644
index 0000000..adf27aa
--- /dev/null
+++ b/src/main/kotlin/cn/flightfeather/supervision/business/storage/item/StScoreItem_2.kt
@@ -0,0 +1,67 @@
+package cn.flightfeather.supervision.business.storage.item
+
+import cn.flightfeather.supervision.business.ScoreItem
+import cn.flightfeather.supervision.domain.ds1.entity.DustDataResult
+import cn.flightfeather.supervision.domain.ds1.entity.Problemlist
+import cn.flightfeather.supervision.domain.ds1.mapper.DustDataResultMapper
+import cn.flightfeather.supervision.domain.ds1.mapper.ProblemlistMapper
+import org.springframework.beans.factory.annotation.Autowired
+import org.springframework.stereotype.Component
+import tk.mybatis.mapper.entity.Example
+import java.time.LocalDateTime
+import java.time.ZoneId
+import javax.annotation.PostConstruct
+
+/**
+ * Date 2022/1/20 16:14
+ * Created by feiyu
+ */
+@Component
+class StScoreItem_2:ScoreItem() {
+
+ companion object {
+ private lateinit var instance: StScoreItem_2
+ }
+
+ @PostConstruct
+ fun init() {
+ instance = this
+ }
+
+ override var id: String = "dCQbQ8ibc6nexiJo"
+
+ override var name: String = "鎵皹鍦ㄧ嚎鐩戞祴鏁版嵁閲忕骇"
+
+ @Autowired
+ lateinit var dustDataResultMapper: DustDataResultMapper
+
+ /**
+ * 鎵皹鍦ㄧ嚎鐩戞祴鏁版嵁閲忕骇
+ * 閫夐」濡備笅锛�
+ * 1.鐩戞祴鏁版嵁鍑虹幇鍗曟棩鍙婁互涓婃湁鏁堣秴鏍�
+ * 2.鐩戞祴鏁版嵁鏈堝潎鍊艰秴鍖哄煙鏈堝潎鍊�20%浠ヤ笂鎴栨暟鎹槑鏄惧紓甯�
+ */
+ override fun otherProblem(size: Int): Int? {
+ val time = info.subTask?.planstarttime
+ val lt = LocalDateTime.ofInstant(time?.toInstant(), ZoneId.systemDefault())
+ val st = lt.withDayOfMonth(1).withHour(0).withMinute(0).withSecond(0)
+ val et = st.plusMonths(1)
+ val r = dustDataResultMapper.selectByExample(Example(DustDataResult::class.java).apply {
+ createCriteria().andGreaterThanOrEqualTo("drTime", st)
+ .andLessThan("drTime", et)
+ .andEqualTo("drSceneId", info.sceneId)
+ })
+
+ var result: Int? = null
+ r.forEach {
+ if (it.drExceedTimes > 0) {
+ result = 0
+ }
+ if (it.drOverAvgPer > 0) {
+ result = 1
+ }
+ }
+
+ return result
+ }
+}
\ No newline at end of file
diff --git a/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/entity/DustDataResult.java b/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/entity/DustDataResult.java
new file mode 100644
index 0000000..e3e174d
--- /dev/null
+++ b/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/entity/DustDataResult.java
@@ -0,0 +1,265 @@
+package cn.flightfeather.supervision.domain.ds1.entity;
+
+import java.util.Date;
+import javax.persistence.*;
+
+@Table(name = "ea_t_dust_data_result")
+public class DustDataResult {
+ @Id
+ @Column(name = "DR_Id")
+ private Integer drId;
+
+ /**
+ * 鍦烘櫙id
+ */
+ @Column(name = "DR_Scene_Id")
+ private String drSceneId;
+
+ /**
+ * 鍦烘櫙鍚嶇О
+ */
+ @Column(name = "DR_Scene_Name")
+ private Integer drSceneName;
+
+ /**
+ * 璁板綍鏈堜唤
+ */
+ @Column(name = "DR_Time")
+ private Date drTime;
+
+ /**
+ * 瓒呮爣娆℃暟
+ */
+ @Column(name = "DR_Exceed_Times")
+ private Integer drExceedTimes;
+
+ /**
+ * 骞冲潎鍊�
+ */
+ @Column(name = "DR_Avg")
+ private Double drAvg;
+
+ /**
+ * 鏈�澶у��
+ */
+ @Column(name = "DR_Max")
+ private Double drMax;
+
+ /**
+ * 鏈�灏忓��
+ */
+ @Column(name = "DR_Min")
+ private Double drMin;
+
+ /**
+ * 瓒呭尯鍘垮潎鍊肩櫨鍒嗘瘮
+ */
+ @Column(name = "DR_Over_Avg_Per")
+ private Double drOverAvgPer;
+
+ /**
+ * 鏈夋晥鏁版嵁鏉℃暟
+ */
+ @Column(name = "DR_Data_Num")
+ private Integer drDataNum;
+
+ /**
+ * 鏁版嵁鏈夋晥鐜�
+ */
+ @Column(name = "DR_Effective_Rate")
+ private Double drEffectiveRate;
+
+ /**
+ * @return DR_Id
+ */
+ public Integer getDrId() {
+ return drId;
+ }
+
+ /**
+ * @param drId
+ */
+ public void setDrId(Integer drId) {
+ this.drId = drId;
+ }
+
+ /**
+ * 鑾峰彇鍦烘櫙id
+ *
+ * @return DR_Scene_Id - 鍦烘櫙id
+ */
+ public String getDrSceneId() {
+ return drSceneId;
+ }
+
+ /**
+ * 璁剧疆鍦烘櫙id
+ *
+ * @param drSceneId 鍦烘櫙id
+ */
+ public void setDrSceneId(String drSceneId) {
+ this.drSceneId = drSceneId == null ? null : drSceneId.trim();
+ }
+
+ /**
+ * 鑾峰彇鍦烘櫙鍚嶇О
+ *
+ * @return DR_Scene_Name - 鍦烘櫙鍚嶇О
+ */
+ public Integer getDrSceneName() {
+ return drSceneName;
+ }
+
+ /**
+ * 璁剧疆鍦烘櫙鍚嶇О
+ *
+ * @param drSceneName 鍦烘櫙鍚嶇О
+ */
+ public void setDrSceneName(Integer drSceneName) {
+ this.drSceneName = drSceneName;
+ }
+
+ /**
+ * 鑾峰彇璁板綍鏈堜唤
+ *
+ * @return DR_Time - 璁板綍鏈堜唤
+ */
+ public Date getDrTime() {
+ return drTime;
+ }
+
+ /**
+ * 璁剧疆璁板綍鏈堜唤
+ *
+ * @param drTime 璁板綍鏈堜唤
+ */
+ public void setDrTime(Date drTime) {
+ this.drTime = drTime;
+ }
+
+ /**
+ * 鑾峰彇瓒呮爣娆℃暟
+ *
+ * @return DR_Exceed_Times - 瓒呮爣娆℃暟
+ */
+ public Integer getDrExceedTimes() {
+ return drExceedTimes;
+ }
+
+ /**
+ * 璁剧疆瓒呮爣娆℃暟
+ *
+ * @param drExceedTimes 瓒呮爣娆℃暟
+ */
+ public void setDrExceedTimes(Integer drExceedTimes) {
+ this.drExceedTimes = drExceedTimes;
+ }
+
+ /**
+ * 鑾峰彇骞冲潎鍊�
+ *
+ * @return DR_Avg - 骞冲潎鍊�
+ */
+ public Double getDrAvg() {
+ return drAvg;
+ }
+
+ /**
+ * 璁剧疆骞冲潎鍊�
+ *
+ * @param drAvg 骞冲潎鍊�
+ */
+ public void setDrAvg(Double drAvg) {
+ this.drAvg = drAvg;
+ }
+
+ /**
+ * 鑾峰彇鏈�澶у��
+ *
+ * @return DR_Max - 鏈�澶у��
+ */
+ public Double getDrMax() {
+ return drMax;
+ }
+
+ /**
+ * 璁剧疆鏈�澶у��
+ *
+ * @param drMax 鏈�澶у��
+ */
+ public void setDrMax(Double drMax) {
+ this.drMax = drMax;
+ }
+
+ /**
+ * 鑾峰彇鏈�灏忓��
+ *
+ * @return DR_Min - 鏈�灏忓��
+ */
+ public Double getDrMin() {
+ return drMin;
+ }
+
+ /**
+ * 璁剧疆鏈�灏忓��
+ *
+ * @param drMin 鏈�灏忓��
+ */
+ public void setDrMin(Double drMin) {
+ this.drMin = drMin;
+ }
+
+ /**
+ * 鑾峰彇瓒呭尯鍘垮潎鍊肩櫨鍒嗘瘮
+ *
+ * @return DR_Over_Avg_Per - 瓒呭尯鍘垮潎鍊肩櫨鍒嗘瘮
+ */
+ public Double getDrOverAvgPer() {
+ return drOverAvgPer;
+ }
+
+ /**
+ * 璁剧疆瓒呭尯鍘垮潎鍊肩櫨鍒嗘瘮
+ *
+ * @param drOverAvgPer 瓒呭尯鍘垮潎鍊肩櫨鍒嗘瘮
+ */
+ public void setDrOverAvgPer(Double drOverAvgPer) {
+ this.drOverAvgPer = drOverAvgPer;
+ }
+
+ /**
+ * 鑾峰彇鏈夋晥鏁版嵁鏉℃暟
+ *
+ * @return DR_Data_Num - 鏈夋晥鏁版嵁鏉℃暟
+ */
+ public Integer getDrDataNum() {
+ return drDataNum;
+ }
+
+ /**
+ * 璁剧疆鏈夋晥鏁版嵁鏉℃暟
+ *
+ * @param drDataNum 鏈夋晥鏁版嵁鏉℃暟
+ */
+ public void setDrDataNum(Integer drDataNum) {
+ this.drDataNum = drDataNum;
+ }
+
+ /**
+ * 鑾峰彇鏁版嵁鏈夋晥鐜�
+ *
+ * @return DR_Effective_Rate - 鏁版嵁鏈夋晥鐜�
+ */
+ public Double getDrEffectiveRate() {
+ return drEffectiveRate;
+ }
+
+ /**
+ * 璁剧疆鏁版嵁鏈夋晥鐜�
+ *
+ * @param drEffectiveRate 鏁版嵁鏈夋晥鐜�
+ */
+ public void setDrEffectiveRate(Double drEffectiveRate) {
+ this.drEffectiveRate = drEffectiveRate;
+ }
+}
\ No newline at end of file
diff --git a/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/mapper/DustDataResultMapper.kt b/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/mapper/DustDataResultMapper.kt
new file mode 100644
index 0000000..fe4faa6
--- /dev/null
+++ b/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/mapper/DustDataResultMapper.kt
@@ -0,0 +1,8 @@
+package cn.flightfeather.supervision.domain.ds1.mapper
+
+import cn.flightfeather.supervision.domain.ds1.entity.DustDataResult
+import cn.flightfeather.supervision.domain.util.MyMapper
+import org.apache.ibatis.annotations.Mapper
+
+@Mapper
+interface DustDataResultMapper : MyMapper<DustDataResult>
\ No newline at end of file
diff --git a/src/main/resources/generator/generatorConfig4ds1.xml b/src/main/resources/generator/generatorConfig4ds1.xml
index b694f3e..5165dbe 100644
--- a/src/main/resources/generator/generatorConfig4ds1.xml
+++ b/src/main/resources/generator/generatorConfig4ds1.xml
@@ -4,7 +4,7 @@
"http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd">
<generatorConfiguration>
<!-- 鏁版嵁搴撻┍鍔�:閫夋嫨浣犵殑鏈湴纭洏涓婇潰鐨勬暟鎹簱椹卞姩鍖�-->
- <classPathEntry location="C:\Users\UPC\.m2\repository\mysql\mysql-connector-java\8.0.21\mysql-connector-java-8.0.21.jar"/>
+ <classPathEntry location="C:\Users\feiyu\.m2\repository\mysql\mysql-connector-java\8.0.21\mysql-connector-java-8.0.21.jar"/>
<context id="DB2Tables" targetRuntime="MyBatis3" defaultModelType="flat">
<!-- TKmybatis閰嶇疆 -->
<property name="javaFileEncoding" value="UTF-8"/>
diff --git a/src/main/resources/mapper/ds1/DustDataResultMapper.xml b/src/main/resources/mapper/ds1/DustDataResultMapper.xml
new file mode 100644
index 0000000..07b6df5
--- /dev/null
+++ b/src/main/resources/mapper/ds1/DustDataResultMapper.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
+<mapper namespace="cn.flightfeather.supervision.domain.ds1.mapper.DustDataResultMapper" >
+ <resultMap id="BaseResultMap" type="cn.flightfeather.supervision.domain.ds1.entity.DustDataResult" >
+ <!--
+ WARNING - @mbg.generated
+ -->
+ <id column="DR_Id" property="drId" jdbcType="INTEGER" />
+ <result column="DR_Scene_Id" property="drSceneId" jdbcType="VARCHAR" />
+ <result column="DR_Scene_Name" property="drSceneName" jdbcType="INTEGER" />
+ <result column="DR_Time" property="drTime" jdbcType="DATE" />
+ <result column="DR_Exceed_Times" property="drExceedTimes" jdbcType="INTEGER" />
+ <result column="DR_Avg" property="drAvg" jdbcType="DOUBLE" />
+ <result column="DR_Max" property="drMax" jdbcType="DOUBLE" />
+ <result column="DR_Min" property="drMin" jdbcType="DOUBLE" />
+ <result column="DR_Over_Avg_Per" property="drOverAvgPer" jdbcType="DOUBLE" />
+ <result column="DR_Data_Num" property="drDataNum" jdbcType="INTEGER" />
+ <result column="DR_Effective_Rate" property="drEffectiveRate" jdbcType="DOUBLE" />
+ </resultMap>
+ <sql id="Base_Column_List" >
+ <!--
+ WARNING - @mbg.generated
+ -->
+ DR_Id, DR_Scene_Id, DR_Scene_Name, DR_Time, DR_Exceed_Times, DR_Avg, DR_Max, DR_Min,
+ DR_Over_Avg_Per, DR_Data_Num, DR_Effective_Rate
+ </sql>
+</mapper>
\ No newline at end of file
--
Gitblit v1.9.3