| | |
| | | |
| | | import com.dy.pipIrrGlobal.pojoSt.StClientAmountMonth; |
| | | import com.dy.pipIrrGlobal.voSt.VoClientAmountStatistics; |
| | | import com.dy.pipIrrGlobal.voSt.VoStClientAmountMonth; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @Author: liurunyu |
| | |
| | | int updateByPrimaryKey(StClientAmountMonth record); |
| | | |
| | | |
| | | |
| | | ////////////////////////////////////// |
| | | //查询统计结果 |
| | | /** |
| | | * 查询总数量 |
| | | * @param params |
| | | * @return |
| | | */ |
| | | Long selectCountMonthStatistics(Map<?, ?> params) ; |
| | | /** |
| | | * 查询分页数据 |
| | | * @param params |
| | | * @return |
| | | */ |
| | | List<VoStClientAmountMonth> selectMonthStatistics(Map<?, ?> params) ; |
| | | |
| | | ////////////////////////////////////// |
| | | //统计相关 |
| | | /** |
| | |
| | | package com.dy.pipIrrGlobal.daoSt; |
| | | |
| | | import com.dy.pipIrrGlobal.pojoSt.StClientAmountYear; |
| | | import com.dy.pipIrrGlobal.voSt.VoStClientAmountYearRecord; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @Author: liurunyu |
| | |
| | | */ |
| | | int updateByPrimaryKey(StClientAmountYear record); |
| | | |
| | | |
| | | |
| | | ////////////////////////////////////// |
| | | //查询统计结果 |
| | | /** |
| | | * 查询总数量 |
| | | * @param params |
| | | * @return |
| | | */ |
| | | Long selectCountYearStatistics(Map<?, ?> params) ; |
| | | /** |
| | | * 查询分页数据 |
| | | * @param params |
| | | * @return |
| | | */ |
| | | List<VoStClientAmountYearRecord> selectYearStatistics(Map<?, ?> params) ; |
| | | |
| | | ////////////////////////////////////// |
| | | //统计相关 |
| | | /** |
| | | * 查询某年 某量值 |
| | | * |
New file |
| | |
| | | package com.dy.pipIrrGlobal.voSt; |
| | | |
| | | import com.alibaba.fastjson2.annotation.JSONField; |
| | | import com.alibaba.fastjson2.writer.ObjectWriterImplToString; |
| | | import com.fasterxml.jackson.annotation.JsonPropertyOrder; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @Author: liurunyu |
| | | * @Date: 2025/1/4 10:15 |
| | | * @Description |
| | | */ |
| | | @Data |
| | | @JsonPropertyOrder({ "id", "clientId", "clientNum", "clientName", "clientAddress" , "year" |
| | | ,"amount1" , "money1" , "times1" |
| | | ,"amount2" , "money2" , "times2" |
| | | ,"amount3" , "money3" , "times3" |
| | | ,"amount4" , "money4" , "times4" |
| | | ,"amount5" , "money5" , "times5" |
| | | ,"amount6" , "money6" , "times6" |
| | | ,"amount7" , "money7" , "times7" |
| | | ,"amount8" , "money8" , "times8" |
| | | ,"amount9" , "money9" , "times9" |
| | | ,"amount10" , "money10" , "times10" |
| | | ,"amount11" , "money11" , "times11" |
| | | ,"amount12" , "money12" , "times12" |
| | | }) |
| | | public class VoStClientAmountMonth { |
| | | |
| | | public static final long serialVersionUID = 202501041014001L; |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @JSONField(serializeUsing= ObjectWriterImplToString.class) |
| | | public Long id; |
| | | |
| | | /** |
| | | * 外键,指向农户 |
| | | */ |
| | | @JSONField(serializeUsing= ObjectWriterImplToString.class) |
| | | public Long clientId; |
| | | |
| | | /** |
| | | * 农户编月 |
| | | */ |
| | | public String clientNum ; |
| | | |
| | | /** |
| | | * 农户名称 |
| | | */ |
| | | public String clientName ; |
| | | |
| | | /** |
| | | * 农户地址 |
| | | */ |
| | | public String clientAddress ; |
| | | |
| | | /** |
| | | * 年度 |
| | | */ |
| | | public Integer year; |
| | | |
| | | /** |
| | | * 1月用水量统计 |
| | | */ |
| | | public Double amount1; |
| | | |
| | | /** |
| | | * 1月花费金额 |
| | | */ |
| | | public Double money1; |
| | | |
| | | /** |
| | | * 1月用水次数 |
| | | */ |
| | | public Integer times1; |
| | | |
| | | /** |
| | | * 2月用水量统计 |
| | | */ |
| | | public Double amount2; |
| | | |
| | | /** |
| | | * 2月花费金额 |
| | | */ |
| | | public Double money2; |
| | | |
| | | /** |
| | | * 2月用水次数 |
| | | */ |
| | | public Integer times2; |
| | | |
| | | /** |
| | | * 3月用水量统计 |
| | | */ |
| | | public Double amount3; |
| | | |
| | | /** |
| | | * 3月花费金额 |
| | | */ |
| | | public Double money3; |
| | | |
| | | /** |
| | | * 3月用水次数 |
| | | */ |
| | | public Integer times3; |
| | | |
| | | /** |
| | | * 4月用水量统计 |
| | | */ |
| | | public Double amount4; |
| | | |
| | | /** |
| | | * 4月花费金额 |
| | | */ |
| | | public Double money4; |
| | | |
| | | /** |
| | | * 4月用水次数 |
| | | */ |
| | | public Integer times4; |
| | | |
| | | /** |
| | | * 5月用水量统计 |
| | | */ |
| | | public Double amount5; |
| | | |
| | | /** |
| | | * 5月花费金额 |
| | | */ |
| | | public Double money5; |
| | | |
| | | /** |
| | | * 5月用水次数 |
| | | */ |
| | | public Integer times5; |
| | | |
| | | /** |
| | | * 6月用水量统计 |
| | | */ |
| | | public Double amount6; |
| | | |
| | | /** |
| | | * 6月花费金额 |
| | | */ |
| | | public Double money6; |
| | | |
| | | /** |
| | | * 6月用水次数 |
| | | */ |
| | | public Integer times6; |
| | | |
| | | /** |
| | | * 7月用水量统计 |
| | | */ |
| | | public Double amount7; |
| | | |
| | | /** |
| | | * 7月花费金额 |
| | | */ |
| | | public Double money7; |
| | | |
| | | /** |
| | | * 7月用水次数 |
| | | */ |
| | | public Integer times7; |
| | | |
| | | /** |
| | | * 8月用水量统计 |
| | | */ |
| | | public Double amount8; |
| | | |
| | | /** |
| | | * 8月花费金额 |
| | | */ |
| | | public Double money8; |
| | | |
| | | /** |
| | | * 8月用水次数 |
| | | */ |
| | | public Integer times8; |
| | | |
| | | /** |
| | | * 9月用水量统计 |
| | | */ |
| | | public Double amount9; |
| | | |
| | | /** |
| | | * 9月花费金额 |
| | | */ |
| | | public Double money9; |
| | | |
| | | /** |
| | | * 9月用水次数 |
| | | */ |
| | | public Integer times9; |
| | | |
| | | /** |
| | | * 10月用水量统计 |
| | | */ |
| | | public Double amount10; |
| | | |
| | | /** |
| | | * 10月花费金额 |
| | | */ |
| | | public Double money10; |
| | | |
| | | /** |
| | | * 10月用水次数 |
| | | */ |
| | | public Integer times10; |
| | | |
| | | /** |
| | | * 11月用水量统计 |
| | | */ |
| | | public Double amount11; |
| | | |
| | | /** |
| | | * 11月花费金额 |
| | | */ |
| | | public Double money11; |
| | | |
| | | /** |
| | | * 11月用水次数 |
| | | */ |
| | | public Integer times11; |
| | | |
| | | /** |
| | | * 12月用水量统计 |
| | | */ |
| | | public Double amount12; |
| | | |
| | | /** |
| | | * 12月花费金额 |
| | | */ |
| | | public Double money12; |
| | | |
| | | /** |
| | | * 12月用水次数 |
| | | */ |
| | | public Integer times12; |
| | | |
| | | } |
New file |
| | |
| | | package com.dy.pipIrrGlobal.voSt; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonPropertyOrder; |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @Author: liurunyu |
| | | * @Date: 2025/1/4 11:13 |
| | | * @Description |
| | | */ |
| | | @Data |
| | | @JsonPropertyOrder({ "yearGrp", "records" }) |
| | | public class VoStClientAmountYear { |
| | | |
| | | public List<String> yearGrp; |
| | | |
| | | public List<VoStClientAmountYearRecords> records; |
| | | } |
New file |
| | |
| | | package com.dy.pipIrrGlobal.voSt; |
| | | |
| | | import com.alibaba.fastjson2.annotation.JSONField; |
| | | import com.alibaba.fastjson2.writer.ObjectWriterImplToString; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @Author: liurunyu |
| | | * @Date: 2025/1/6 9:38 |
| | | * @Description |
| | | */ |
| | | @Data |
| | | public class VoStClientAmountYearRecord { |
| | | /** |
| | | * 外键,指向农户 |
| | | */ |
| | | public Long clientId; |
| | | |
| | | /** |
| | | * 农户编年 |
| | | */ |
| | | public String clientNum ; |
| | | |
| | | /** |
| | | * 农户名称 |
| | | */ |
| | | public String clientName ; |
| | | |
| | | /** |
| | | * 农户地址 |
| | | */ |
| | | public String clientAddress ; |
| | | |
| | | /** |
| | | * 1年用水量统计 |
| | | */ |
| | | public Double amount; |
| | | |
| | | /** |
| | | * 1年花费金额 |
| | | */ |
| | | public Double money; |
| | | |
| | | /** |
| | | * 1年用水次数 |
| | | */ |
| | | public Integer times; |
| | | |
| | | } |
New file |
| | |
| | | package com.dy.pipIrrGlobal.voSt; |
| | | |
| | | import com.alibaba.fastjson2.annotation.JSONField; |
| | | import com.alibaba.fastjson2.writer.ObjectWriterImplToString; |
| | | import com.fasterxml.jackson.annotation.JsonPropertyOrder; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @Author: liurunyu |
| | | * @Date: 2025/1/4 10:15 |
| | | * @Description |
| | | */ |
| | | @Data |
| | | @JsonPropertyOrder({ "id", "clientId", "clientNum", "clientName", "clientAddress" |
| | | ,"amount1" , "money1" , "times1" |
| | | ,"amount2" , "money2" , "times2" |
| | | ,"amount3" , "money3" , "times3" |
| | | ,"amount4" , "money4" , "times4" |
| | | ,"amount5" , "money5" , "times5" |
| | | ,"amount6" , "money6" , "times6" |
| | | ,"amount7" , "money7" , "times7" |
| | | ,"amount8" , "money8" , "times8" |
| | | ,"amount9" , "money9" , "times9" |
| | | ,"amount10" , "money10" , "times10" |
| | | }) |
| | | public class VoStClientAmountYearRecords { |
| | | |
| | | public static final long serialVersionUID = 202501041106001L; |
| | | |
| | | /** |
| | | * 外键,指向农户 |
| | | */ |
| | | @JSONField(serializeUsing= ObjectWriterImplToString.class) |
| | | public Long clientId; |
| | | |
| | | /** |
| | | * 农户编年 |
| | | */ |
| | | public String clientNum ; |
| | | |
| | | /** |
| | | * 农户名称 |
| | | */ |
| | | public String clientName ; |
| | | |
| | | /** |
| | | * 农户地址 |
| | | */ |
| | | public String clientAddress ; |
| | | |
| | | /** |
| | | * 1年用水量统计 |
| | | */ |
| | | public Double amount1; |
| | | |
| | | /** |
| | | * 1年花费金额 |
| | | */ |
| | | public Double money1; |
| | | |
| | | /** |
| | | * 1年用水次数 |
| | | */ |
| | | public Integer times1; |
| | | |
| | | /** |
| | | * 2年用水量统计 |
| | | */ |
| | | public Double amount2; |
| | | |
| | | /** |
| | | * 2年花费金额 |
| | | */ |
| | | public Double money2; |
| | | |
| | | /** |
| | | * 2年用水次数 |
| | | */ |
| | | public Integer times2; |
| | | |
| | | /** |
| | | * 3年用水量统计 |
| | | */ |
| | | public Double amount3; |
| | | |
| | | /** |
| | | * 3年花费金额 |
| | | */ |
| | | public Double money3; |
| | | |
| | | /** |
| | | * 3年用水次数 |
| | | */ |
| | | public Integer times3; |
| | | |
| | | /** |
| | | * 4年用水量统计 |
| | | */ |
| | | public Double amount4; |
| | | |
| | | /** |
| | | * 4年花费金额 |
| | | */ |
| | | public Double money4; |
| | | |
| | | /** |
| | | * 4年用水次数 |
| | | */ |
| | | public Integer times4; |
| | | |
| | | /** |
| | | * 5年用水量统计 |
| | | */ |
| | | public Double amount5; |
| | | |
| | | /** |
| | | * 5年花费金额 |
| | | */ |
| | | public Double money5; |
| | | |
| | | /** |
| | | * 5年用水次数 |
| | | */ |
| | | public Integer times5; |
| | | |
| | | /** |
| | | * 6年用水量统计 |
| | | */ |
| | | public Double amount6; |
| | | |
| | | /** |
| | | * 6年花费金额 |
| | | */ |
| | | public Double money6; |
| | | |
| | | /** |
| | | * 6年用水次数 |
| | | */ |
| | | public Integer times6; |
| | | |
| | | /** |
| | | * 7年用水量统计 |
| | | */ |
| | | public Double amount7; |
| | | |
| | | /** |
| | | * 7年花费金额 |
| | | */ |
| | | public Double money7; |
| | | |
| | | /** |
| | | * 7年用水次数 |
| | | */ |
| | | public Integer times7; |
| | | |
| | | /** |
| | | * 8年用水量统计 |
| | | */ |
| | | public Double amount8; |
| | | |
| | | /** |
| | | * 8年花费金额 |
| | | */ |
| | | public Double money8; |
| | | |
| | | /** |
| | | * 8年用水次数 |
| | | */ |
| | | public Integer times8; |
| | | |
| | | /** |
| | | * 9年用水量统计 |
| | | */ |
| | | public Double amount9; |
| | | |
| | | /** |
| | | * 9年花费金额 |
| | | */ |
| | | public Double money9; |
| | | |
| | | /** |
| | | * 9年用水次数 |
| | | */ |
| | | public Integer times9; |
| | | |
| | | /** |
| | | * 10年用水量统计 |
| | | */ |
| | | public Double amount10; |
| | | |
| | | /** |
| | | * 10年花费金额 |
| | | */ |
| | | public Double money10; |
| | | |
| | | /** |
| | | * 10年用水次数 |
| | | */ |
| | | public Integer times10; |
| | | |
| | | } |
| | |
| | | times30, amount31, money31, times31 |
| | | </sql> |
| | | <sql id="Base_Column_List_with_alias"> |
| | | <!--@mbg.generated--> |
| | | ${alias}.id, ${alias}.client_id, ${alias}.`year`, ${alias}.`month`, ${alias}.amount1, ${alias}.money1, ${alias}.times1, ${alias}.amount2, ${alias}.money2, ${alias}.times2, |
| | | ${alias}.amount3, ${alias}.money3, ${alias}.times3, ${alias}.amount4, ${alias}.money4, ${alias}.times4, ${alias}.amount5, ${alias}.money5, ${alias}.times5, ${alias}.amount6, |
| | | ${alias}.money6, ${alias}.times6, ${alias}.amount7, ${alias}.money7, ${alias}.times7, ${alias}.amount8, ${alias}.money8, ${alias}.times8, ${alias}.amount9, ${alias}.money9, |
| | |
| | | select |
| | | count(*) |
| | | from se_client mtb |
| | | <where> |
| | | where mtb.deleted != 0 |
| | | <trim prefix="and" suffixOverrides="and"> |
| | | <if test="name != null and name != ''"> |
| | | mtb.name like concat('%', #{name}, '%') |
| | | </if> |
| | | </where> |
| | | </trim> |
| | | </select> |
| | | |
| | | <select id="selectDayStatistics" resultType="com.dy.pipIrrGlobal.voSt.VoStClientAmountDay"> |
| | | select |
| | | mtb.id as clientId, |
| | | mtb.clientNum as clientNum, |
| | | mtb.phone as clientPhone, |
| | | mtb.name as clientName, |
| | | mtb.address as clientAddress, |
| | | <include refid="Base_Column_List_with_alias" > |
| | | <property name="alias" value="stTb"/> |
| | | </include> |
| | | from se_client mtb |
| | | LEFT JOIN st_client_amount_day stTb on stTb.client_id = mtb.id |
| | | <where> |
| | | where mtb.deleted != 0 |
| | | <trim prefix="and" suffixOverrides="and"> |
| | | <if test = "year != null"> |
| | | stTb.year = #{year, jdbcType=INTEGER} |
| | | </if> |
| | |
| | | <if test="name != null and name != ''"> |
| | | AND mtb.name like concat('%', #{name}, '%') |
| | | </if> |
| | | </where> |
| | | order by mtb.id ASC |
| | | </trim> |
| | | order by mtb.id DESC |
| | | <trim prefix="limit " > |
| | | <if test="start != null and count != null"> |
| | | #{start,javaType=Integer,jdbcType=INTEGER}, #{count,javaType=Integer,jdbcType=INTEGER} |
| | |
| | | times6, amount7, money7, times7, amount8, money8, times8, amount9, money9, times9, |
| | | amount10, money10, times10, amount11, money11, times11, amount12, money12, times12 |
| | | </sql> |
| | | <sql id="Base_Column_List_with_alias"> |
| | | <!--@mbg.generated--> |
| | | ${alias}.id, ${alias}.client_id, ${alias}.`year`, |
| | | ${alias}.amount1, ${alias}.money1, ${alias}.times1, ${alias}.amount2, ${alias}.money2, ${alias}.times2, |
| | | ${alias}.amount3, ${alias}.money3, ${alias}.times3, ${alias}.amount4, ${alias}.money4, ${alias}.times4, |
| | | ${alias}.amount5, ${alias}.money5, ${alias}.times5, ${alias}.amount6, ${alias}.money6, ${alias}.times6, |
| | | ${alias}.amount7, ${alias}.money7, ${alias}.times7, ${alias}.amount8, ${alias}.money8, ${alias}.times8, |
| | | ${alias}.amount9, ${alias}.money9, ${alias}.times9, ${alias}.amount10, ${alias}.money10, ${alias}.times10, |
| | | ${alias}.amount11, ${alias}.money11, ${alias}.times11, ${alias}.amount12, ${alias}.money12, ${alias}.times12 |
| | | </sql> |
| | | |
| | | |
| | | <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap"> |
| | | <!--@mbg.generated--> |
| | | select |
| | |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | |
| | | <!-- ////////////////////////////////// --> |
| | | <!-- 查询统计结果 --> |
| | | <!-- ////////////////////////////////// --> |
| | | <select id="selectCountMonthStatistics" resultType="java.lang.Long"> |
| | | select |
| | | count(*) |
| | | from se_client mtb |
| | | where mtb.deleted != 0 |
| | | <trim prefix="and" suffixOverrides="and"> |
| | | <if test="name != null and name != ''"> |
| | | mtb.name like concat('%', #{name}, '%') |
| | | </if> |
| | | </trim> |
| | | </select> |
| | | |
| | | <select id="selectMonthStatistics" resultType="com.dy.pipIrrGlobal.voSt.VoStClientAmountMonth"> |
| | | select |
| | | mtb.clientNum as clientNum, |
| | | mtb.phone as clientPhone, |
| | | mtb.address as clientAddress, |
| | | <include refid="Base_Column_List_with_alias" > |
| | | <property name="alias" value="stTb"/> |
| | | </include> |
| | | from se_client mtb |
| | | LEFT JOIN st_client_amount_month stTb on stTb.client_id = mtb.id |
| | | where mtb.deleted != 0 |
| | | <trim prefix="and" suffixOverrides="and"> |
| | | <if test = "year != null"> |
| | | stTb.year = #{year, jdbcType=INTEGER} |
| | | </if> |
| | | <if test="name != null and name != ''"> |
| | | AND mtb.name like concat('%', #{name}, '%') |
| | | </if> |
| | | </trim> |
| | | order by mtb.id DESC |
| | | <trim prefix="limit " > |
| | | <if test="start != null and count != null"> |
| | | #{start,javaType=Integer,jdbcType=INTEGER}, #{count,javaType=Integer,jdbcType=INTEGER} |
| | | </if> |
| | | </trim> |
| | | </select> |
| | | |
| | | |
| | | <!-- ////////////////////////////////// --> |
| | | <!-- 统计相关 --> |
| | | <!-- ////////////////////////////////// --> |
| | | <select id="selectByYear" resultMap="BaseResultMap"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | |
| | | <!-- ////////////////////////////////// --> |
| | | <!-- 查询统计结果 --> |
| | | <!-- ////////////////////////////////// --> |
| | | <select id="selectCountYearStatistics" resultType="java.lang.Long"> |
| | | select |
| | | count(*) |
| | | from se_client mtb |
| | | where mtb.deleted != 0 |
| | | <trim prefix="and" suffixOverrides="and"> |
| | | <if test="name != null and name != ''"> |
| | | mtb.name like concat('%', #{name}, '%') |
| | | </if> |
| | | </trim> |
| | | </select> |
| | | |
| | | <select id="selectYearStatistics" resultType="com.dy.pipIrrGlobal.voSt.VoStClientAmountYearRecord"> |
| | | select |
| | | ctb.id as clientId, |
| | | ctb.clientNum as clientNum, |
| | | ctb.name as clientName, |
| | | ctb.address as clientAddress, |
| | | cayTb.amount as amount, |
| | | cayTb.money as money, |
| | | cayTb.times as times |
| | | from se_client ctb |
| | | LEFT JOIN st_client_amount_year cayTb on cayTb.client_id = ctb.id |
| | | where ctb.deleted != 0 |
| | | <trim prefix="and" suffixOverrides="and"> |
| | | <if test="year != null"> |
| | | cayTb.`year` = #{year,jdbcType=INTEGER} |
| | | </if> |
| | | <if test="name != null and name != ''"> |
| | | and ctb.name like concat('%', #{name}, '%') |
| | | </if> |
| | | </trim> |
| | | order by ctb.id DESC |
| | | <trim prefix="limit " > |
| | | <if test="start != null and count != null"> |
| | | #{start,javaType=Integer,jdbcType=INTEGER}, #{count,javaType=Integer,jdbcType=INTEGER} |
| | | </if> |
| | | </trim> |
| | | </select> |
| | | |
| | | <!-- ////////////////////////////////// --> |
| | | <!-- 统计相关 --> |
| | |
| | | import com.dy.common.webUtil.BaseResponseUtils; |
| | | import com.dy.common.webUtil.QueryResultVo; |
| | | import com.dy.pipIrrGlobal.voSt.VoStClientAmountDay; |
| | | import com.dy.pipIrrGlobal.voSt.VoStClientAmountMonth; |
| | | import com.dy.pipIrrGlobal.voSt.VoStClientAmountYear; |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | @RequestMapping(path="stClient") |
| | | @RequiredArgsConstructor |
| | | public class StClientCtrl { |
| | | |
| | | private static final int startYear4YearStatistics = 2024 ; |
| | | |
| | | private StClientSv sv ; |
| | | |
| | |
| | | qo.month = ymd[1] ; |
| | | return BaseResponseUtils.buildSuccess(this.sv.selectStClientAmountDay(qo)); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 查询指定年农户各月用水量 |
| | | * @param qo |
| | | * @return |
| | | */ |
| | | @GetMapping(path = "/amountOfMonth") |
| | | @SsoAop() |
| | | public BaseResponse<QueryResultVo<List<VoStClientAmountMonth>>> amountOfMonth(StClientQo qo) throws Exception { |
| | | if(qo.year == null) { |
| | | return BaseResponseUtils.buildErrorMsg("查询条件年度不能为空"); |
| | | } |
| | | return BaseResponseUtils.buildSuccess(this.sv.selectStClientAmountMonth(qo)); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 查询指定年农户各年用水量 |
| | | * @param qo |
| | | * @return |
| | | */ |
| | | @GetMapping(path = "/amountOfYear") |
| | | @SsoAop() |
| | | public BaseResponse<QueryResultVo<List<VoStClientAmountYear>>> amountOfYear(StClientQo qo) throws Exception { |
| | | List<Integer> yearGrp = new ArrayList<Integer>(); |
| | | int nowYear = Integer.parseInt(DateTime.yyyy()) ; |
| | | if(qo.year == null) { |
| | | for(int i = startYear4YearStatistics; i <= nowYear; i++) { |
| | | yearGrp.add(i) ; |
| | | } |
| | | }else{ |
| | | if(qo.year > nowYear){ |
| | | qo.year = nowYear; |
| | | } |
| | | if(qo.year < startYear4YearStatistics){ |
| | | qo.year = startYear4YearStatistics; |
| | | } |
| | | yearGrp.add(qo.year) ; |
| | | } |
| | | return BaseResponseUtils.buildSuccess(this.sv.selectStClientAmountYear(qo, yearGrp)); |
| | | } |
| | | } |
| | |
| | | import com.dy.pipIrrGlobal.daoSt.StClientAmountDayMapper ; |
| | | import com.dy.pipIrrGlobal.daoSt.StClientAmountMonthMapper ; |
| | | import com.dy.pipIrrGlobal.daoSt.StClientAmountYearMapper ; |
| | | import com.dy.pipIrrGlobal.voSt.VoStClientAmountDay; |
| | | import com.dy.pipIrrGlobal.voSt.*; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.dubbo.common.utils.PojoUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.text.ParseException; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | |
| | | } |
| | | |
| | | |
| | | public QueryResultVo<List<VoStClientAmountDay>> selectStClientAmountDay(StClientQo qo) throws ParseException { |
| | | /** |
| | | * 查询农户用水日统计 |
| | | * @param qo |
| | | * @return |
| | | */ |
| | | public QueryResultVo<List<VoStClientAmountDay>> selectStClientAmountDay(StClientQo qo) { |
| | | QueryResultVo<List<VoStClientAmountDay>> rsVo = new QueryResultVo<>() ; |
| | | // 生成查询参数 |
| | | Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(qo) ; |
| | |
| | | } |
| | | return rsVo ; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 查询农户用水月统计 |
| | | * @param qo |
| | | * @return |
| | | */ |
| | | public QueryResultVo<List<VoStClientAmountMonth>> selectStClientAmountMonth(StClientQo qo) { |
| | | QueryResultVo<List<VoStClientAmountMonth>> rsVo = new QueryResultVo<>() ; |
| | | // 生成查询参数 |
| | | Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(qo) ; |
| | | // 获取符合条件的记录数 |
| | | Long itemTotal = stClientAmountMonthDao.selectCountMonthStatistics(params) ; |
| | | |
| | | if(itemTotal != null && itemTotal > 0) { |
| | | rsVo.pageSize = qo.pageSize; |
| | | rsVo.pageCurr = qo.pageCurr; |
| | | rsVo.calculateAndSet(itemTotal, params); |
| | | |
| | | rsVo.obj = stClientAmountMonthDao.selectMonthStatistics(params); |
| | | } |
| | | return rsVo ; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 查询农户用水年统计 |
| | | * @param qo |
| | | * @return |
| | | */ |
| | | public QueryResultVo<List<VoStClientAmountYearRecords>> selectStClientAmountYear(StClientQo qo, List<Integer> yearGrp) throws ParseException { |
| | | QueryResultVo<List<VoStClientAmountYearRecords>> rsVo = new QueryResultVo<>() ; |
| | | // 生成查询参数 |
| | | Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(qo) ; |
| | | params.put("yearGrp", yearGrp); |
| | | // 获取符合条件的记录数 |
| | | Long itemTotal = stClientAmountYearDao.selectCountYearStatistics(params) ; |
| | | |
| | | if(itemTotal != null && itemTotal > 0) { |
| | | rsVo.pageSize = qo.pageSize; |
| | | rsVo.pageCurr = qo.pageCurr; |
| | | rsVo.calculateAndSet(itemTotal, params); |
| | | |
| | | List<VoStClientAmountYearRecords> group = new ArrayList<>(); |
| | | int count = 1 ; |
| | | for(int year: yearGrp){ |
| | | params.put("year", year); |
| | | List<VoStClientAmountYearRecord> list = stClientAmountYearDao.selectYearStatistics(params); |
| | | if(group.isEmpty()){ |
| | | this.completion(group, list); |
| | | } |
| | | this.merge(count, group, list) ; |
| | | count += 1 ; |
| | | } |
| | | rsVo.obj = group ; |
| | | } |
| | | return rsVo ; |
| | | } |
| | | |
| | | /** |
| | | * 补全, 集合中没有就生成一个 |
| | | * @param group |
| | | * @param list |
| | | */ |
| | | private void completion(List<VoStClientAmountYearRecords> group, List<VoStClientAmountYearRecord> list){ |
| | | boolean found ; |
| | | for (VoStClientAmountYearRecord voInList : list) { |
| | | found = false ; |
| | | for(VoStClientAmountYearRecords voInGrp : group) { |
| | | if(voInList.clientId.longValue() == voInGrp.clientId.longValue()) { |
| | | found = true ; |
| | | } |
| | | } |
| | | if(!found) { |
| | | VoStClientAmountYearRecords vo4s = new VoStClientAmountYearRecords(); |
| | | vo4s.clientId = voInList.clientId; |
| | | vo4s.clientNum = voInList.clientNum; |
| | | vo4s.clientName = voInList.clientName; |
| | | vo4s.clientAddress = voInList.clientAddress; |
| | | group.add(vo4s) ; |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 合并, 集合中有就合并 |
| | | * @param count |
| | | * @param group |
| | | * @param list |
| | | */ |
| | | private void merge(int count, List<VoStClientAmountYearRecords> group, List<VoStClientAmountYearRecord> list){ |
| | | for (VoStClientAmountYearRecord voInList : list) { |
| | | VoStClientAmountYearRecords voInGrp_ = null ; |
| | | for(VoStClientAmountYearRecords voInGrp : group) { |
| | | if(voInList.clientId.longValue() == voInGrp.clientId.longValue()) { |
| | | voInGrp_ = voInGrp ; |
| | | break ; |
| | | } |
| | | } |
| | | if(voInGrp_ != null){ |
| | | this.merge(count, voInGrp_, voInList); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 合并值 |
| | | * @param count |
| | | * @param vo4s |
| | | * @param vo |
| | | */ |
| | | private void merge(int count, VoStClientAmountYearRecords vo4s, VoStClientAmountYearRecord vo){ |
| | | switch (count){ |
| | | case 1: |
| | | vo4s.amount1 = vo.amount; |
| | | vo4s.money1 = vo.money; |
| | | vo4s.times1 = vo.times; |
| | | break; |
| | | case 2: |
| | | vo4s.amount2 = vo.amount; |
| | | vo4s.money2 = vo.money; |
| | | vo4s.times2 = vo.times; |
| | | break; |
| | | case 3: |
| | | vo4s.amount3 = vo.amount; |
| | | vo4s.money3 = vo.money; |
| | | vo4s.times3 = vo.times; |
| | | break; |
| | | case 4: |
| | | vo4s.amount4 = vo.amount; |
| | | vo4s.money4 = vo.money; |
| | | vo4s.times4 = vo.times; |
| | | break; |
| | | case 5: |
| | | vo4s.amount5 = vo.amount; |
| | | vo4s.money5 = vo.money; |
| | | vo4s.times5 = vo.times; |
| | | break; |
| | | case 6: |
| | | vo4s.amount6 = vo.amount; |
| | | vo4s.money6 = vo.money; |
| | | vo4s.times6 = vo.times; |
| | | break; |
| | | case 7: |
| | | vo4s.amount7 = vo.amount; |
| | | vo4s.money7 = vo.money; |
| | | vo4s.times7 = vo.times; |
| | | break; |
| | | case 8: |
| | | vo4s.amount8 = vo.amount; |
| | | vo4s.money8 = vo.money; |
| | | vo4s.times8 = vo.times; |
| | | break; |
| | | case 9: |
| | | vo4s.amount9 = vo.amount; |
| | | vo4s.money9 = vo.money; |
| | | vo4s.times9 = vo.times; |
| | | break; |
| | | case 10: |
| | | vo4s.amount10 = vo.amount; |
| | | vo4s.money10 = vo.money; |
| | | vo4s.times10 = vo.times; |
| | | break; |
| | | } |
| | | } |
| | | } |