2024-09-18 朱宝民 获取消费记录接口、获取返还记录接口
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.dy.pipIrrGlobal.pojoRm.RmOpenCloseValveHistory; |
| | | import com.dy.pipIrrGlobal.voRm.VoExpend; |
| | | import com.dy.pipIrrGlobal.voRm.VoOpenCloseValve; |
| | | import com.dy.pipIrrGlobal.voSt.VoClient; |
| | | import com.dy.pipIrrGlobal.voSt.VoIntake; |
| | |
| | | * @return |
| | | */ |
| | | List<VoIntake> getNoOpenHaveCloseIntakes(Map<String, Object> params); |
| | | |
| | | /** |
| | | * 获取水卡消费记录数量,管理平台使用 |
| | | * @param params |
| | | * @return |
| | | */ |
| | | Long getExpendsCount(Map<String, Object> params); |
| | | |
| | | /** |
| | | * 获取水卡消费记录,管理平台使用 |
| | | * @param params |
| | | * @return |
| | | */ |
| | | List<VoExpend> getExpends(Map<String, Object> params); |
| | | } |
| | |
| | | */ |
| | | List<VoRechargeNew> getRechargesNew(Map<?, ?> params); |
| | | |
| | | /** |
| | | * 获取返还记录数量,管理平台充值列表使用 |
| | | * @param params |
| | | * @return |
| | | */ |
| | | Long getRefundsCount(Map<?, ?> params); |
| | | /** |
| | | * 获取返还记录,管理平台充值列表使用 |
| | | * @param params |
| | | * @return |
| | | */ |
| | | List<VoRefund> getRefunds(Map<?, ?> params); |
| | | |
| | | /** |
| | | * 根据指定条件获取交易记录数 |
New file |
| | |
| | | package com.dy.pipIrrGlobal.voRm; |
| | | |
| | | import com.alibaba.fastjson2.annotation.JSONField; |
| | | import com.alibaba.fastjson2.writer.ObjectWriterImplToString; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.fasterxml.jackson.annotation.JsonPropertyOrder; |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2024-09-14 17:17 |
| | | * @LastEditTime 2024-09-14 17:17 |
| | | * @Description 消耗视图对象,水卡消耗记录 |
| | | */ |
| | | @Data |
| | | @JsonPropertyOrder({"clientName", "clientNum", "cardNum", "intakeName", "rtuAddr", "moneyAmount", "waterAmount", "duration", "operateTime"}) |
| | | public class VoExpend { |
| | | private static final long serialVersionUID = 202409141721001L; |
| | | |
| | | /** |
| | | * 农户姓名 |
| | | */ |
| | | private String clientName; |
| | | |
| | | /** |
| | | * 农户编号 |
| | | */ |
| | | private String clientNum; |
| | | |
| | | /** |
| | | * 水卡编号 |
| | | */ |
| | | @JSONField(serializeUsing= ObjectWriterImplToString.class) |
| | | private Long cardNum; |
| | | |
| | | /** |
| | | * 取水口编号 |
| | | */ |
| | | private String intakeName; |
| | | |
| | | /** |
| | | * 阀控器地址 |
| | | */ |
| | | private String rtuAddr; |
| | | |
| | | /** |
| | | * 本次花费金额 |
| | | */ |
| | | private Float moneyAmount; |
| | | |
| | | /** |
| | | * 本次用水量 |
| | | */ |
| | | private Float waterAmount; |
| | | |
| | | /** |
| | | * 本次用水时长 |
| | | */ |
| | | private Integer duration; |
| | | |
| | | /** |
| | | * 操作时间 |
| | | */ |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date operateTime; |
| | | } |
New file |
| | |
| | | package com.dy.pipIrrGlobal.voSe; |
| | | |
| | | import com.alibaba.fastjson2.annotation.JSONField; |
| | | import com.alibaba.fastjson2.writer.ObjectWriterImplToString; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.fasterxml.jackson.annotation.JsonPropertyOrder; |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2024-09-18 15:04 |
| | | * @LastEditTime 2024-09-18 15:04 |
| | | * @Description 返还视图对象 |
| | | */ |
| | | |
| | | @Data |
| | | @JsonPropertyOrder({"clientName", "clientNum", "cardNum", "money", "refundAmount", "operator", "operateTime"}) |
| | | public class VoRefund { |
| | | private static final long serialVersionUID = 202409181505001L; |
| | | |
| | | /** |
| | | * 农户姓名 |
| | | */ |
| | | private String clientName; |
| | | |
| | | /** |
| | | * 农户编号 |
| | | */ |
| | | private String clientNum; |
| | | |
| | | /** |
| | | * 水卡编号 |
| | | */ |
| | | @JSONField(serializeUsing= ObjectWriterImplToString.class) |
| | | private Long cardNum; |
| | | |
| | | /** |
| | | * 返还前余额 |
| | | */ |
| | | private Float money; |
| | | |
| | | /** |
| | | * 返还金额 |
| | | */ |
| | | private Float refundAmount; |
| | | |
| | | /** |
| | | * 操作人 |
| | | */ |
| | | private String operator; |
| | | |
| | | /** |
| | | * 操作时间 |
| | | */ |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date operateTime; |
| | | } |
| | |
| | | </if> |
| | | </trim> |
| | | </select> |
| | | |
| | | <!--获取水卡消费记录数量,管理平台使用--> |
| | | <select id="getExpendsCount" resultType="java.lang.Long"> |
| | | SELECT COUNT(*) AS recordCount |
| | | FROM rm_open_close_valve_history och |
| | | INNER JOIN se_client cli ON cli.id = och.client_id |
| | | INNER JOIN pr_intake inta ON inta.id = och.intake_id |
| | | <where> |
| | | AND och.cl_ic_card_no IS NOT NULL AND och.client_id IS NOT NULL |
| | | <if test = "clientName != null and clientName !=''"> |
| | | AND cli.name like CONCAT('%',#{clientName},'%') |
| | | </if> |
| | | |
| | | <if test = "clientNum != null and clientNum > 0"> |
| | | AND cli.clientNum like CONCAT('%',#{clientNum},'%') |
| | | </if> |
| | | |
| | | <if test = "cardNum != null and cardNum !=''"> |
| | | AND och.cl_ic_card_no like CONCAT('%',#{cardNum},'%') |
| | | </if> |
| | | </where> |
| | | </select> |
| | | |
| | | <!--获取水卡消费记录,管理平台使用--> |
| | | <select id="getExpends" resultType="com.dy.pipIrrGlobal.voRm.VoExpend"> |
| | | SELECT |
| | | cli.name AS clientName, |
| | | cli.clientNum, |
| | | och.cl_ic_card_no AS cardNum, |
| | | inta.name AS intakeName, |
| | | och.rtu_addr AS rtuAddr, |
| | | och.cl_this_money AS moneyAmount, |
| | | och.cl_this_amount AS waterAmount, |
| | | och.cl_this_time AS duration, |
| | | och.cl_dt AS operateTime |
| | | FROM rm_open_close_valve_history och |
| | | INNER JOIN se_client cli ON cli.id = och.client_id |
| | | INNER JOIN pr_intake inta ON inta.id = och.intake_id |
| | | <where> |
| | | AND och.cl_ic_card_no IS NOT NULL AND och.client_id IS NOT NULL |
| | | <if test = "clientName != null and clientName !=''"> |
| | | AND cli.name like CONCAT('%',#{clientName},'%') |
| | | </if> |
| | | |
| | | <if test = "clientNum != null and clientNum > 0"> |
| | | AND cli.clientNum like CONCAT('%',#{clientNum},'%') |
| | | </if> |
| | | |
| | | <if test = "cardNum != null and cardNum !=''"> |
| | | AND och.cl_ic_card_no like CONCAT('%',#{cardNum},'%') |
| | | </if> |
| | | </where> |
| | | ORDER BY och.cl_dt DESC |
| | | <trim prefix="limit " > |
| | | <if test="start != null and count != null"> |
| | | #{start,javaType=Integer,jdbcType=INTEGER}, #{count,javaType=Integer,jdbcType=INTEGER} |
| | | </if> |
| | | </trim> |
| | | </select> |
| | | </mapper> |
| | |
| | | </if> |
| | | </trim> |
| | | </select> |
| | | |
| | | <!--获取返还记录数量,管理平台充值列表使用--> |
| | | <select id="getRefundsCount" resultType="java.lang.Long"> |
| | | SELECT COUNT(*) AS recordCount |
| | | FROM se_client_card card |
| | | INNER JOIN se_client cli ON cli.id = card.clientId |
| | | LEFT JOIN se_card_operate ope ON ope.card_id = card.id |
| | | INNER JOIN ba_user us ON us.id = ope.operator |
| | | <where> |
| | | AND ope.operate_type = 5 |
| | | <if test = "clientName != null and clientName !=''"> |
| | | AND cli.name like CONCAT('%',#{clientName},'%') |
| | | </if> |
| | | |
| | | <if test = "clientNum != null and clientNum > 0"> |
| | | AND cli.clientNum like CONCAT('%',#{clientNum},'%') |
| | | </if> |
| | | |
| | | <if test = "cardNum != null and cardNum !=''"> |
| | | AND card.cardNum like CONCAT('%',#{cardNum},'%') |
| | | </if> |
| | | </where> |
| | | </select> |
| | | |
| | | <!--获取返还记录,管理平台充值列表使用--> |
| | | <select id="getRefunds" resultType="com.dy.pipIrrGlobal.voSe.VoRefund"> |
| | | SELECT |
| | | cli.name AS clientName, |
| | | cli.clientNum, |
| | | card.cardNum, |
| | | IFNULL(ope.money, 0) AS money, |
| | | IFNULL(ope.refund_amount, 0) AS refundAmount, |
| | | us.name AS operator, |
| | | ope.operate_dt AS operateTime |
| | | FROM se_client_card card |
| | | INNER JOIN se_client cli ON cli.id = card.clientId |
| | | LEFT JOIN se_card_operate ope ON ope.card_id = card.id |
| | | INNER JOIN ba_user us ON us.id = ope.operator |
| | | <where> |
| | | AND ope.operate_type = 5 |
| | | <if test = "clientName != null and clientName !=''"> |
| | | AND cli.name like CONCAT('%',#{clientName},'%') |
| | | </if> |
| | | |
| | | <if test = "clientNum != null and clientNum > 0"> |
| | | AND cli.clientNum like CONCAT('%',#{clientNum},'%') |
| | | </if> |
| | | |
| | | <if test = "cardNum != null and cardNum !=''"> |
| | | AND card.cardNum like CONCAT('%',#{cardNum},'%') |
| | | </if> |
| | | </where> |
| | | ORDER BY ope.operate_dt DESC |
| | | <trim prefix="limit " > |
| | | <if test="start != null and count != null"> |
| | | #{start,javaType=Integer,jdbcType=INTEGER}, #{count,javaType=Integer,jdbcType=INTEGER} |
| | | </if> |
| | | </trim> |
| | | </select> |
| | | </mapper> |
| | |
| | | }) |
| | | } |
| | | ) |
| | | @MapperScan({"com.dy.pipIrrGlobal.daoSe", "com.dy.pipIrrGlobal.daoBa", "com.dy.pipIrrGlobal.daoPr"}) |
| | | @MapperScan({"com.dy.pipIrrGlobal.daoSe", "com.dy.pipIrrGlobal.daoBa", "com.dy.pipIrrGlobal.daoPr", "com.dy.pipIrrGlobal.daoRm"}) |
| | | public class PipIrrSellApplication { |
| | | |
| | | public static void main(String[] args) { |
| | |
| | | import com.dy.pipIrrGlobal.pojoSe.SeClientCard; |
| | | import com.dy.pipIrrGlobal.pojoSe.SeManagerCard; |
| | | import com.dy.pipIrrGlobal.util.AmountToChinese; |
| | | import com.dy.pipIrrGlobal.voRm.VoExpend; |
| | | import com.dy.pipIrrGlobal.voSe.*; |
| | | import com.dy.pipIrrSell.cardOperate.dto.*; |
| | | import com.dy.pipIrrSell.cardOperate.enums.OperateTypeENUM; |
| | |
| | | } |
| | | |
| | | /** |
| | | * 获取返还记录,管理平台充值列表使用 |
| | | * @param vo |
| | | * @return |
| | | */ |
| | | @GetMapping(path = "/refunds") |
| | | @SsoAop() |
| | | public BaseResponse<QueryResultVo<List<VoRefund>>> getRefunds(QoRecharge vo){ |
| | | try { |
| | | QueryResultVo<List<VoRefund>> res = cardOperateSv.getRefunds(vo); |
| | | return BaseResponseUtils.buildSuccess(res); |
| | | } catch (Exception e) { |
| | | log.error("获取返还记录异常", e); |
| | | return BaseResponseUtils.buildException(e.getMessage()) ; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 获取水卡消费记录,管理平台使用 |
| | | * @param vo |
| | | * @return |
| | | */ |
| | | @GetMapping(path = "/expends") |
| | | @SsoAop() |
| | | public BaseResponse<QueryResultVo<List<VoExpend>>> getExpends(QoRecharge vo){ |
| | | try { |
| | | QueryResultVo<List<VoExpend>> res = cardOperateSv.getExpends(vo); |
| | | return BaseResponseUtils.buildSuccess(res); |
| | | } catch (Exception e) { |
| | | log.error("获取消费记录异常", e); |
| | | return BaseResponseUtils.buildException(e.getMessage()) ; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 根据指定条件获取交易明细 |
| | | * @param vo |
| | | * @return |
| | |
| | | import com.dy.common.webUtil.BaseResponseUtils; |
| | | import com.dy.common.webUtil.QueryResultVo; |
| | | import com.dy.pipIrrGlobal.daoBa.BaSettingsMapper; |
| | | import com.dy.pipIrrGlobal.daoRm.RmOpenCloseValveHistoryMapper; |
| | | import com.dy.pipIrrGlobal.daoSe.*; |
| | | import com.dy.pipIrrGlobal.pojoSe.*; |
| | | import com.dy.pipIrrGlobal.voRm.VoExpend; |
| | | import com.dy.pipIrrGlobal.voSe.*; |
| | | import com.dy.pipIrrSell.cardOperate.dto.DtoRecharge; |
| | | import com.dy.pipIrrSell.cardOperate.enums.OperateTypeENUM; |
| | |
| | | |
| | | @Autowired |
| | | private SeRechargeHistoryMapper seRechargeHistoryMapper; |
| | | |
| | | @Autowired |
| | | private RmOpenCloseValveHistoryMapper rmOpenCloseValveHistoryMapper; |
| | | |
| | | @Value("${project.projectNo}") |
| | | private Integer projectNo; |
| | |
| | | } |
| | | |
| | | /** |
| | | * 获取返还记录,管理平台充值列表使用 |
| | | * @param queryVo |
| | | * @return |
| | | */ |
| | | public QueryResultVo<List<VoRefund>> getRefunds(QoRecharge queryVo) { |
| | | Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(queryVo); |
| | | |
| | | Long itemTotal = seCardOperateMapper.getRefundsCount(params); |
| | | |
| | | QueryResultVo<List<VoRefund>> rsVo = new QueryResultVo<>() ; |
| | | rsVo.pageSize = queryVo.pageSize ; |
| | | rsVo.pageCurr = queryVo.pageCurr ; |
| | | |
| | | rsVo.calculateAndSet(itemTotal, params); |
| | | rsVo.obj = seCardOperateMapper.getRefunds(params); |
| | | return rsVo ; |
| | | } |
| | | |
| | | /** |
| | | * 获取水卡消费记录,管理平台使用 |
| | | * @param queryVo |
| | | * @return |
| | | */ |
| | | public QueryResultVo<List<VoExpend>> getExpends(QoRecharge queryVo) { |
| | | Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(queryVo); |
| | | |
| | | Long itemTotal = rmOpenCloseValveHistoryMapper.getExpendsCount(params); |
| | | |
| | | QueryResultVo<List<VoExpend>> rsVo = new QueryResultVo<>() ; |
| | | rsVo.pageSize = queryVo.pageSize ; |
| | | rsVo.pageCurr = queryVo.pageCurr ; |
| | | |
| | | rsVo.calculateAndSet(itemTotal, params); |
| | | rsVo.obj = rmOpenCloseValveHistoryMapper.getExpends(params); |
| | | return rsVo ; |
| | | } |
| | | |
| | | /** |
| | | * 根据指定条件获取交易记录 |
| | | * @param vo |
| | | * @return |