From 26cdbc1511eeac6e6d1bb95bb5b1863b4ad7b866 Mon Sep 17 00:00:00 2001 From: feiyu02 <risaku@163.com> Date: 星期三, 15 十一月 2023 09:05:52 +0800 Subject: [PATCH] 1. 修改风险值的查询逻辑; --- src/main/java/com/flightfeather/monitor/domain/ds1/mapper/RiskValueMapper.kt | 9 ++++ src/main/java/com/flightfeather/monitor/service/impl/RiskValueServiceImpl.java | 7 ++- src/main/resources/mapper/ds1/RiskValueMapper.xml | 18 +++++++++ src/main/java/com/flightfeather/monitor/service/RiskValueService.java | 3 + src/main/java/com/flightfeather/monitor/pojo/RiskValuePojo.kt | 52 ++++++++++++++++++++++++++ src/main/java/com/flightfeather/monitor/controller/dust/RiskValueController.java | 3 + 6 files changed, 87 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/flightfeather/monitor/controller/dust/RiskValueController.java b/src/main/java/com/flightfeather/monitor/controller/dust/RiskValueController.java index f88eb3e..c3d4288 100644 --- a/src/main/java/com/flightfeather/monitor/controller/dust/RiskValueController.java +++ b/src/main/java/com/flightfeather/monitor/controller/dust/RiskValueController.java @@ -3,6 +3,7 @@ import com.flightfeather.monitor.domain.ds1.entity.RiskValue; import com.flightfeather.monitor.pojo.Result; +import com.flightfeather.monitor.pojo.RiskValuePojo; import com.flightfeather.monitor.service.RiskValueService; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; @@ -33,7 +34,7 @@ @RequestParam String month, @RequestParam String type ) { - List<RiskValue> list = riskValueService.queryRiskDataByMonth(mnCode, month, type); + List<RiskValuePojo> list = riskValueService.queryRiskDataByMonth(mnCode, month, type); return Result.success(list); } } diff --git a/src/main/java/com/flightfeather/monitor/domain/ds1/mapper/RiskValueMapper.kt b/src/main/java/com/flightfeather/monitor/domain/ds1/mapper/RiskValueMapper.kt index 0cd7327..38bbe02 100644 --- a/src/main/java/com/flightfeather/monitor/domain/ds1/mapper/RiskValueMapper.kt +++ b/src/main/java/com/flightfeather/monitor/domain/ds1/mapper/RiskValueMapper.kt @@ -2,7 +2,14 @@ import com.flightfeather.monitor.domain.ds1.entity.RiskValue import com.flightfeather.monitor.domain.util.MyMapper +import com.flightfeather.monitor.pojo.RiskValuePojo import org.apache.ibatis.annotations.Mapper +import sun.util.resources.LocaleData +import java.time.LocalDate +import java.util.* @Mapper -interface RiskValueMapper : MyMapper<RiskValue?> \ No newline at end of file +interface RiskValueMapper : MyMapper<RiskValue?> { + + fun queryRiskDataByMonth(mnCode: String?, month: LocalDate?, type: String?): List<RiskValuePojo?> +} \ No newline at end of file diff --git a/src/main/java/com/flightfeather/monitor/pojo/RiskValuePojo.kt b/src/main/java/com/flightfeather/monitor/pojo/RiskValuePojo.kt new file mode 100644 index 0000000..80a6e86 --- /dev/null +++ b/src/main/java/com/flightfeather/monitor/pojo/RiskValuePojo.kt @@ -0,0 +1,52 @@ +package com.flightfeather.monitor.pojo + +import java.util.* + +class RiskValuePojo { + var id: Int? = null + + /** + * 鐩戞祴鐐圭紪鍙� + */ + var mnCode: String? = null + + /** + * 鐩戞祴鐐瑰悕绉� + */ + var name: String? = null + + /** + * 鏃堕棿 + */ + var lst: Date? = null + + /** + * 鍦ㄧ嚎鐜囬闄╁�� + */ + var onlineRisk: Double? = null + + /** + * 鏈夋晥鐜囬闄╁�� + */ + var validRisk: Double? = null + + /** + * 瓒呮爣椋庨櫓鍊� + */ + var exceedRisk: Double? = null + + /** + * 寮傚父绫诲瀷鑱氶泦搴� + */ + var exceptionTypeAggregation: Double? = null + + /** + * 鍏稿瀷寮傚父澶嶇幇鐜� + */ + var typicalExceptionRepetitionRate: Double? = null + + /** + * 缁熻绫诲瀷锛堟棩缁熻鎴栨湀缁熻锛�,day month + */ + var type: String? = null +} \ No newline at end of file diff --git a/src/main/java/com/flightfeather/monitor/service/RiskValueService.java b/src/main/java/com/flightfeather/monitor/service/RiskValueService.java index 5d39c8a..f1453ac 100644 --- a/src/main/java/com/flightfeather/monitor/service/RiskValueService.java +++ b/src/main/java/com/flightfeather/monitor/service/RiskValueService.java @@ -1,6 +1,7 @@ package com.flightfeather.monitor.service; import com.flightfeather.monitor.domain.ds1.entity.RiskValue; +import com.flightfeather.monitor.pojo.RiskValuePojo; import java.util.List; @@ -12,5 +13,5 @@ * @param type * @return */ - List<RiskValue> queryRiskDataByMonth(String mnCode, String month, String type); + List<RiskValuePojo> queryRiskDataByMonth(String mnCode, String month, String type); } diff --git a/src/main/java/com/flightfeather/monitor/service/impl/RiskValueServiceImpl.java b/src/main/java/com/flightfeather/monitor/service/impl/RiskValueServiceImpl.java index 07bb3cf..2187418 100644 --- a/src/main/java/com/flightfeather/monitor/service/impl/RiskValueServiceImpl.java +++ b/src/main/java/com/flightfeather/monitor/service/impl/RiskValueServiceImpl.java @@ -4,6 +4,7 @@ import com.flightfeather.monitor.domain.ds1.mapper.RiskValueMapper; import com.flightfeather.monitor.domain.ds1.repository.RiskValueRep; import com.flightfeather.monitor.mapper.RiskAnalysisMapper; +import com.flightfeather.monitor.pojo.RiskValuePojo; import com.flightfeather.monitor.service.RiskValueService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -20,10 +21,12 @@ private RiskValueRep riskValueRep; @Override - public List<RiskValue> queryRiskDataByMonth(String mnCode, String month, String type) { + public List<RiskValuePojo> queryRiskDataByMonth(String mnCode, String month, String type) { LocalDate date = LocalDate.parse(month); if (date != null) { - return riskValueRep.select(mnCode, date, type); + date = date.withDayOfMonth(1); + return riskValueMapper.queryRiskDataByMonth(mnCode, date, type); +// return riskValueRep.select(mnCode, date, type); } else { return new ArrayList<>(); } diff --git a/src/main/resources/mapper/ds1/RiskValueMapper.xml b/src/main/resources/mapper/ds1/RiskValueMapper.xml index 9e8daa2..2fc827f 100644 --- a/src/main/resources/mapper/ds1/RiskValueMapper.xml +++ b/src/main/resources/mapper/ds1/RiskValueMapper.xml @@ -22,4 +22,22 @@ id, mn_code, lst, online_risk, valid_risk, exceed_risk, exception_type_aggregation, typical_exception_repetition_rate, type </sql> + + <select id="queryRiskDataByMonth" resultType="com.flightfeather.monitor.pojo.RiskValuePojo"> + select b.name,a.* + from du_js_t_risk_value as a left join ja_t_dust_site_info as b on a.mn_code = b.mn_code + <where> + <if test="mnCode != null and mnCode != '' "> + b.name = #{mnCode} + </if> + + <if test="month != null"> + and a.lst = #{month} + </if> + + <if test="type != null and type != '' "> + and a.type = #{type} + </if> + </where> + </select> </mapper> \ No newline at end of file -- Gitblit v1.9.3