wuzeyu
2024-10-18 cbcada79d9326529fb968b4a0e1d9e12f5008574
实现接口 最近未充值的农户
4个文件已修改
111 ■■■■■ 已修改文件
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoRm/RmClientAmountDayLastMapper.java 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmClientAmountDayLastMapper.xml 51 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/client/ClientCtrl.java 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/client/ClientSv.java 27 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoRm/RmClientAmountDayLastMapper.java
@@ -3,6 +3,7 @@
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.dy.pipIrrGlobal.pojoRm.RmClientAmountDayLast;
import com.dy.pipIrrGlobal.voRm.VoClientAmountDay;
import com.dy.pipIrrGlobal.voSt.VoClient;
import com.dy.pipIrrGlobal.voSt.VoDayClient;
import com.dy.pipIrrGlobal.voSt.VoMonthClient;
import org.apache.ibatis.annotations.Mapper;
@@ -109,4 +110,18 @@
     * @return
     */
    List<VoMonthClient> getMonthAmountAndMoney(Map<?, ?> params);
    /**
     * 最近未充值的农户数量
     * @param params
     * @return
     */
    Long getNotRechargeLastClientsCount(Map<String, Object> params);
    /**
     * 最近未充值的农户
     * @param params
     * @return
     */
    List<VoClient> getNotRechargeLastClients(Map<String, Object> params);
}
pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmClientAmountDayLastMapper.xml
@@ -833,4 +833,55 @@
            </if>
        </trim>
    </select>
    <!--最近未充值的农户数量-->
    <select id="getNotRechargeLastClientsCount" resultType="java.lang.Long">
        SELECT COUNT(*)
        FROM
        (        SELECT
        sc.id    AS clientId,
        sc.`name`   AS clientName,
        sc.clientNum  AS clientNum,
        sc.address   AS address,
        sc.phone    AS phone,
        sc.idCard   AS idCard
        FROM
        se_client sc
        LEFT JOIN (SELECT srh.clientId FROM `se_recharge_history` srh
        <where>
            srh.amount > 0 AND srh.operate_valid = 2
            <if test="timeStart != null and timeStart != ''">
                AND srh.operateDt > #{timeStart}
            </if>
        </where>
        ) c on c.clientId = sc.id
        WHERE c.clientId IS NULL
        GROUP BY sc.id) d
    </select>
    <!--最近未充值的农户-->
    <select id="getNotRechargeLastClients" resultType="com.dy.pipIrrGlobal.voSt.VoClient">
        SELECT
        sc.id    AS clientId,
        sc.`name`   AS clientName,
        sc.clientNum  AS clientNum,
        sc.address   AS address,
        sc.phone    AS phone,
        sc.idCard   AS idCard
        FROM
            se_client sc
                LEFT JOIN (SELECT srh.clientId FROM `se_recharge_history` srh
        <where>
            srh.amount > 0 AND srh.operate_valid = 2
            <if test="timeStart != null and timeStart != ''">
                AND srh.operateDt > #{timeStart}
            </if>
        </where>
        ) c on c.clientId = sc.id
        WHERE c.clientId IS NULL
        GROUP BY sc.id
        <trim prefix="limit ">
            <if test="start != null and count != null">
                #{start,javaType=Integer,jdbcType=INTEGER}, #{count,javaType=Integer,jdbcType=INTEGER}
            </if>
        </trim>
    </select>
</mapper>
pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/client/ClientCtrl.java
@@ -298,4 +298,22 @@
        }
    }
    /**
     * 最近未充值的农户
     *
     * @param qo
     * @return
     */
    @GetMapping(path = "/getNotRechargeLastClients")
    @SsoAop()
    public BaseResponse<QueryResultVo<List<VoClient>>> getNotRechargeLastClients(CommonQO qo) {
        try {
            QueryResultVo<List<VoClient>> res = clientSv.getNotRechargeLastClients(qo);
            return BaseResponseUtils.buildSuccess(res);
        }catch (Exception e){
            log.error("获取记录异常", e);
            return BaseResponseUtils.buildException(e.getMessage());
        }
    }
}
pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/client/ClientSv.java
@@ -493,4 +493,31 @@
        rsVo.obj = rmClientAmountDayLastMapper.getMonthAmountAndMoney(params);
        return rsVo ;
    }
    /**
     * 最近未充值的农户
     * @param qo
     * @return
     */
    public QueryResultVo<List<VoClient>> getNotRechargeLastClients(CommonQO qo) {
        String timeStart = qo.getTimeStart();
        if (timeStart != null && timeStart != ""){
            timeStart = timeStart + " 00:00:00";
            qo.setTimeStart(timeStart);
        }
        // 生成查询参数
        Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(qo) ;
        // 获取符合条件的记录数
        Long itemTotal = Optional.ofNullable(rmClientAmountDayLastMapper.getNotRechargeLastClientsCount(params)).orElse(0L);
        QueryResultVo<List<VoClient>> rsVo = new QueryResultVo<>() ;
        rsVo.pageSize = qo.pageSize ;
        rsVo.pageCurr = qo.pageCurr ;
        rsVo.calculateAndSet(itemTotal, params);
        rsVo.obj = rmClientAmountDayLastMapper.getNotRechargeLastClients(params);
        return rsVo ;
    }
}