新增光伏Mppt相关功能

This commit is contained in:
2025-11-28 10:04:04 +08:00
parent 6c23c4a9c4
commit 861155b2e5
46 changed files with 1722 additions and 512 deletions

View File

@ -147,9 +147,9 @@
and date_format(#{date},'%Y-%m-%d') >= tem.validity_start_time and date_format(#{date},'%Y-%m-%d') <=
tem.validity_end_time
</if>
<!-- <if test="templateType != null">-->
<!-- and template_type = #{templateType}-->
<!-- </if>-->
<if test="elecType != null">
and tem.elec_type = #{elecType}
</if>
order by begin_time
</select>

View File

@ -0,0 +1,104 @@
<?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.ho.business.mapper.EarningsCalculateMpptMapper">
<delete id="deleteByDay">
delete
from earnings_calculate_mppt
<where>
and day = #{day}
<if test="typeList !=null and typeList.size() !=0">
and type in
<foreach collection="typeList" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
</where>
</delete>
<insert id="insertBatch">
INSERT INTO earnings_calculate_mppt
(group_id, pid, station_id, src_id, dept_id, create_time, day, type,
digital,elec,rate_type,price,total,discount)
VALUES
<foreach item="item" collection="list" index="index" separator=",">
(
#{item.groupId},#{item.pid},#{item.stationId},#{item.srcId},#{item.deptId}, now(),
#{item.day},#{item.type},#{item.digital},#{item.elec},#{item.rateType},#{item.price},#{item.total},#{item.discount}
)
</foreach>
</insert>
<select id="countPvIncome" resultType="com.ho.business.vo.resp.InverterResp.PowerGenerateRespVO">
SELECT DAY date,sum( digital ) profit
FROM
earnings_calculate_mppt
WHERE
station_id = #{stationId}
AND DAY BETWEEN #{beginTime}
AND #{endTime}
GROUP BY DAY
</select>
<select id="countAllPvIncome" resultType="java.math.BigDecimal">
SELECT sum( digital )
FROM
earnings_calculate_mppt
WHERE
station_id = #{stationId}
<if test="beginTime != null">
and day &gt;= #{beginTime}
</if>
<if test="endTime != null">
and day &lt;= #{endTime}
</if>
</select>
<select id="getProfit" resultType="com.ho.business.vo.resp.profit.DayProfitType">
select
station_id,day,type,sum(digital) as digital
from earnings_calculate_mppt
<where>
digital > 0
<if test="groupId != null">
and group_id = #{groupId}
</if>
<if test="beginTime != null and beginTime != '' and endTime != null and endTime != ''">
and day BETWEEN #{beginTime}
AND #{endTime}
</if>
</where>
group by station_id, day,type
</select>
<select id="getFirstTime" resultType="java.lang.String">
SELECT min(day) day
FROM earnings_calculate_mppt;
</select>
<select id="getEarningsByParam" resultType="com.ho.business.vo.resp.profit.DayProfitType">
select
station_id,day,type,sum(digital) as digital
from earnings_calculate_mppt
<where>
digital > 0
<if test="groupId != null">
and group_id = #{groupId}
</if>
<if test="beginTime != null and beginTime != '' and endTime != null and endTime != ''">
and day BETWEEN #{beginTime}
AND #{endTime}
</if>
<if test="stationIds != null and stationIds.size() != 0">
and station_id in
<foreach collection="stationIds" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
</where>
group by station_id, day,type
</select>
</mapper>

View File

@ -201,6 +201,31 @@
group by type,station_id,day
</where>
</select>
<select id="getElec" resultType="com.ho.business.vo.resp.profit.DayProfitType">
select
station_id,day,type,sum(digital) as digital
from elec_meter_value
<where>
digital > 0
<if test="type != null">
and type = #{type}
</if>
<if test="groupId != null">
and group_id = #{groupId}
</if>
<if test="beginTime != null and beginTime != '' and endTime != null and endTime != ''">
and day BETWEEN #{beginTime}
AND #{endTime}
</if>
<if test="stationIds != null and stationIds.size() != 0">
and station_id in
<foreach collection="stationIds" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
</where>
group by station_id, day,type;
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete

View File

@ -12,7 +12,7 @@
latitude,capacity,rate_power,
status,type,create_time,
contact,contact_details,grid_time,
update_time,deleted,is_enable,cabin_num,district,ad_code,is_daily_count,topology_type,cupboard_type,plan_version,inverter_flag,icc_id,province,city,
update_time,deleted,is_enable,cabin_num,district,ad_code,is_daily_count,topology_type,cupboard_type,plan_version,inverter_flag,pv_power,icc_id,province,city,
electricity_type,customer_type,voltage_level,batch_number,nation
</sql>
@ -217,6 +217,7 @@
<if test="record.cupboardType != null">cupboard_type,</if>
<if test="record.planVersion != null">plan_version,</if>
<if test="record.inverterFlag != null">inverter_flag,</if>
<if test="record.pvPower != null">pv_power,</if>
<if test="record.iccId != null">icc_id,</if>
<if test="record.province != null">province,</if>
<if test="record.city != null">city,</if>
@ -254,6 +255,7 @@
<if test="record.cupboardType != null">#{record.cupboardType},</if>
<if test="record.planVersion != null">#{record.planVersion},</if>
<if test="record.inverterFlag != null">#{record.inverterFlag},</if>
<if test="record.pvPower != null">#{record.pvPower},</if>
<if test="record.iccId != null">#{record.iccId},</if>
<if test="record.province != null">#{record.province},</if>
<if test="record.city != null">#{record.city},</if>
@ -343,6 +345,9 @@
<if test="record.inverterFlag != null">
inverter_flag = #{record.inverterFlag},
</if>
<if test="record.pvPower != null">
pv_power = #{record.pvPower,jdbcType=DECIMAL},
</if>
<if test="record.iccId != null">
icc_id = #{record.iccId},
</if>