feiyu02
2023-11-15 26cdbc1511eeac6e6d1bb95bb5b1863b4ad7b866
1. 修改风险值的查询逻辑;
已修改5个文件
已添加1个文件
92 ■■■■■ 文件已修改
src/main/java/com/flightfeather/monitor/controller/dust/RiskValueController.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/flightfeather/monitor/domain/ds1/mapper/RiskValueMapper.kt 9 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/flightfeather/monitor/pojo/RiskValuePojo.kt 52 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/flightfeather/monitor/service/RiskValueService.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/flightfeather/monitor/service/impl/RiskValueServiceImpl.java 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/ds1/RiskValueMapper.xml 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
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);
    }
}
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?>
interface RiskValueMapper : MyMapper<RiskValue?> {
    fun queryRiskDataByMonth(mnCode: String?, month: LocalDate?, type: String?): List<RiskValuePojo?>
}
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
}
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);
}
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<>();
        }
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>