合并代码

This commit is contained in:
2023-01-03 11:05:59 +08:00
parent 97e18b59cf
commit 71d213b6a2
67 changed files with 2781 additions and 448 deletions

View File

@@ -1,8 +1,10 @@
package com.njcn.harmonic.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.njcn.harmonic.pojo.param.OverviewParam;
import com.njcn.harmonic.pojo.param.StatSubstationBizBaseParam;
import com.njcn.harmonic.pojo.po.RStatHarmonicOrgM;
import com.njcn.harmonic.pojo.vo.OverviewVO;
import com.njcn.harmonic.pojo.vo.RStatHarmonicVO;
import com.njcn.harmonic.pojo.vo.StatHarmonicOrgVO;
import com.njcn.user.pojo.dto.DeptDTO;
@@ -33,4 +35,15 @@ public interface StatHarmonicOrgMMapper extends BaseMapper<RStatHarmonicOrgM> {
List<RStatHarmonicVO> selectInfoList(@Param("param") StatSubstationBizBaseParam param,
@Param("ids") List<String> ids,
@Param("dataType") String dataType);
/**
* 分布式光伏概览-超标监测点占比
* @param param
* @param ids
* @param dataType
* @return
*/
List<OverviewVO> selectYoY(@Param("param") OverviewParam param,
@Param("ids") List<String> ids,
@Param("dataType") String dataType);
}

View File

@@ -0,0 +1,16 @@
package com.njcn.harmonic.mapper.algorithm;
import com.njcn.harmonic.pojo.po.RStatFile;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* <p>
* Mapper 接口
* </p>
*
* @author wr
* @since 2022-12-28
*/
public interface RStatFileMapper extends BaseMapper<RStatFile> {
}

View File

@@ -0,0 +1,15 @@
<?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="com.njcn.harmonic.mapper.algorithm.RStatFileMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.njcn.harmonic.pojo.po.RStatFile">
<id column="id" property="id" />
<result column="create_Time" property="createTime" />
<result column="update_Time" property="updateTime" />
<result column="file_content" property="fileContent" />
<result column="create_By" property="createBy" />
<result column="update_By" property="updateBy" />
</resultMap>
</mapper>

View File

@@ -52,5 +52,103 @@
GROUP BY
harmonic_type
</select>
<select id="selectYoY" resultType="com.njcn.harmonic.pojo.vo.OverviewVO">
SELECT
concat(ta.yy,'-',ta.mm) dateTime,
ta.measurement_type_class as monitorSort,
ta.harmonic_type as harmonicType,
ta.num as sumNum,
IFNULL(tb.num,0) as ytbSumNum,
IFNULL(tc.num,0) as yhbSumNum,
ifnull(round((ta.num-tb.num)/tb.num*100,2),0) as sameNum,
ifnull(round((ta.num-tc.num)/tc.num*100,2),0) as ringNum
FROM (
SELECT
t.measurement_type_class,
t.harmonic_type,
year(t.data_date) as yy,
month(t.data_date) as mm,
TRUNCATE(SUM(over_limit_measurement_ratio_accrued)/count(over_limit_measurement_ratio_accrued),2) as num
FROM r_stat_harmonic_m t
<where>
and data_Type=#{dataType}
<if test="ids != null and ids.size > 0">
AND org_no IN
<foreach collection='ids' item='item' index="index" open='(' separator=',' close=')'>
#{item}
</foreach>
</if>
</where>
GROUP BY t.measurement_type_class,t.harmonic_type,yy,mm
) ta
-- 同比:上年同月
LEFT JOIN (
SELECT
t.measurement_type_class,
t.harmonic_type,
year(t.data_date) as yy,
month(t.data_date) as mm,
TRUNCATE(SUM(over_limit_measurement_ratio_accrued)/count(over_limit_measurement_ratio_accrued),2) as num
FROM r_stat_harmonic_m t
<where>
and data_Type=#{dataType}
<if test="ids != null and ids.size > 0">
AND org_no IN
<foreach collection='ids' item='item' index="index" open='(' separator=',' close=')'>
#{item}
</foreach>
</if>
</where>
GROUP BY t.measurement_type_class,t.harmonic_type,yy,mm
) tb
ON tb.mm = ta.mm and tb.yy = ta.yy-1 and tb.measurement_type_class = ta.measurement_type_class and tb.harmonic_type = ta.harmonic_type
-- 环比:上月
LEFT JOIN (
SELECT
t.measurement_type_class,
t.harmonic_type,
year(t.data_date) as yy,
month(t.data_date) as mm,
TRUNCATE(SUM(over_limit_measurement_ratio_accrued)/count(over_limit_measurement_ratio_accrued),2) as num
FROM r_stat_harmonic_m t
<where>
and data_Type=#{dataType}
<if test="ids != null and ids.size > 0">
AND org_no IN
<foreach collection='ids' item='item' index="index" open='(' separator=',' close=')'>
#{item}
</foreach>
</if>
</where>
GROUP BY t.measurement_type_class,t.harmonic_type,yy,mm
) tc
ON ( (tc.yy = ta.yy and tc.mm = ta.mm - 1 and tc.measurement_type_class = ta.measurement_type_class and tc.harmonic_type = ta.harmonic_type)
OR
(tc.yy=ta.yy - 1 AND tc.mm = 12 AND ta.mm = 1 and tc.measurement_type_class = ta.measurement_type_class and tc.harmonic_type = ta.harmonic_type)
)
<where>
<if test="param.year != null and param.year!=''">
AND ta.yy = #{param.year}
</if>
<if test="param.month != null and param.month.size > 0">
AND ta.mm IN
<foreach collection='param.month' item='item' index="index" open='(' separator=',' close=')'>
#{item}
</foreach>
</if>
</where>
</select>
</mapper>

View File

@@ -4,9 +4,11 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.njcn.harmonic.pojo.po.RStatOrgPvPowerQualityMPO;
import com.njcn.harmonic.pojo.vo.OverviewVO;
import com.njcn.harmonic.pojo.vo.StreamReverseOrgVO;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
/**
@@ -18,6 +20,15 @@ import java.util.Map;
public interface RStatOrgPvPowerQualityMMapper extends BaseMapper<RStatOrgPvPowerQualityMPO> {
Page<StreamReverseOrgVO> getStreamReverseByOrg(IPage<StreamReverseOrgVO> page, @Param("condMap")Map<String, Object> condMap);
/**
* 分布式光伏概览-电压问题
* @param deptCodes
* @param ids
* @return
*/
List<OverviewVO.VoltageVO> selectVoltage(@Param("deptCodes") List<String> deptCodes,
@Param("ids") List<String> ids);
}

View File

@@ -43,4 +43,36 @@
GROUP BY org_no,monitoring_object
</select>
<select id="selectVoltage" resultType="com.njcn.harmonic.pojo.vo.OverviewVO$VoltageVO">
SELECT
monitoring_object,
area_pq_event_type,
TRUNCATE ( SUM( total_monitor_num )/ count( total_monitor_num ), 2 ) AS totalMonitorNum
FROM
r_stat_org_pv_power_quality_m
<where>
<if test="deptCodes != null and deptCodes.size > 0">
AND org_no IN
<foreach collection='deptCodes' item='item' index="index" open='(' separator=',' close=')'>
#{item}
</foreach>
</if>
<if test="ids != null and ids.size > 0">
AND area_pq_event_type IN
<foreach collection='ids' item='item' index="index" open='(' separator=',' close=')'>
#{item}
</foreach>
</if>
<!-- <if test="param!=null and param.startTime != null and param.startTime !=''">-->
<!-- AND data_date >= #{param.startTime}-->
<!-- </if>-->
<!-- <if test="param!=null and param.endTime != null and param.endTime != ''">-->
<!-- AND data_date &lt;= #{param.endTime}-->
<!-- </if>-->
</where>
GROUP BY
monitoring_object,
area_pq_event_type
</select>
</mapper>