2024-01-23 朱宝民 添加交易明细接口和交易统计接口
3 文件已重命名
8个文件已修改
1个文件已删除
1个文件已添加
| | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.dy.pipIrrGlobal.pojoSe.SeCardOperate; |
| | | import com.dy.pipIrrGlobal.voSe.VoRecharge; |
| | | import com.dy.pipIrrGlobal.voSe.VoTransaction; |
| | | import com.dy.pipIrrGlobal.voSe.VoTransactionStatistics; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | |
| | | * @return |
| | | */ |
| | | List<VoRecharge> getRecharges(Map<?, ?> params); |
| | | |
| | | |
| | | /** |
| | | * 根据指定条件获取交易记录数 |
| | | * @param params |
| | | * @return |
| | | */ |
| | | Long getTransactionRecordCount(Map<?, ?> params); |
| | | |
| | | /** |
| | | * 根据指定条件获取交易记录 |
| | | * @param params |
| | | * @return |
| | | */ |
| | | List<VoTransaction> getTransactions(Map<?, ?> params); |
| | | |
| | | /** |
| | | * 根据指定条件获取购水汇总和购卡汇总,获取交易明细使用 |
| | | * @param params |
| | | * @return |
| | | */ |
| | | Map getTransactionSums(Map<?, ?> params); |
| | | |
| | | /** |
| | | * 根据指定条件获取交易统计记录数 |
| | | * @param params |
| | | * @return |
| | | */ |
| | | Long getTransactionStatisticsRecordCount(Map<?, ?> params); |
| | | |
| | | /** |
| | | * 根据指定条件获取交易统计记录 |
| | | * @param params |
| | | * @return |
| | | */ |
| | | List<VoTransactionStatistics> getTransactionStatistics(Map<?, ?> params); |
| | | |
| | | /** |
| | | * 根基指定条件获取笔数合计、实收金额合计、赠送金额合计 |
| | | * @param params |
| | | * @return |
| | | */ |
| | | Map getTransactionStatisticsSums(Map<?, ?> params); |
| | | |
| | | /** |
| | | * 获取指定日期、指定支付方式实收金额合计 |
| | | * @param params |
| | | * @return |
| | | */ |
| | | //Float getPaymentSums(Map<?, ?> params); |
| | | Float getPaymentSums(@Param("tradeDate") String tradeDate, @Param("paymentId") Long paymentId); |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.dy.pipIrrGlobal.pojoSe.SeClient; |
| | | import com.dy.pipIrrGlobal.voSe.VoClient; |
| | | import com.dy.pipIrrGlobal.voSe.VoOperate; |
| | | import com.dy.pipIrrGlobal.voSe.VoStatistics; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | |
| | | */ |
| | | List<Map<String, Object>> getWaterTypes(); |
| | | |
| | | /** |
| | | * 根据指定条件获取购水汇总和购卡汇总 |
| | | * @param params 统计条件 |
| | | * @return 购水金额、购卡金额 |
| | | */ |
| | | Map getSums(Map<?, ?> params); |
| | | |
| | | /** |
| | | * 根据指定条件获取操作记录数 |
| | | * @param params 查询条件 |
| | | * @return 符合条件的记录数 |
| | | */ |
| | | Long getOperateRecordCount(Map<?, ?> params); |
| | | |
| | | /** |
| | | * 根据指定条件获取操作记录 |
| | | * @param params 查询条件 |
| | | * @return 符合条件的交易记录 |
| | | */ |
| | | List<VoOperate> getOperates(Map<?, ?> params); |
| | | |
| | | /** |
| | | * 根据指定条件获取交易笔数汇总和交易金额汇总 |
| | | * @param params |
| | | * @return |
| | | */ |
| | | Map getStatisticSums(Map<?, ?> params); |
| | | |
| | | /** |
| | | * 根据指定条件获取汇总记录数 |
| | | * @param params |
| | | * @return |
| | | */ |
| | | Long getStatisticRecordCount(Map<?, ?> params); |
| | | |
| | | /** |
| | | * 根据指定条件获取统计记录 |
| | | * @param params |
| | | * @return |
| | | */ |
| | | List<VoStatistics> getStatistics(Map<?, ?> params); |
| | | } |
File was renamed from pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSe/VoOperate.java |
| | |
| | | */ |
| | | |
| | | @Data |
| | | @Schema(title = "操作记录视图对象") |
| | | public class VoOperate implements BaseEntity { |
| | | @Schema(title = "交易记录视图对象") |
| | | public class VoTransaction implements BaseEntity { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @Schema(title = "村ID") |
| | | @Schema(title = "订单编号") |
| | | private Long orderNumber; |
| | | |
| | | @Schema(title = "村庄ID") |
| | | private Long villageId; |
| | | |
| | | @Schema(title = "区划名称串") |
| | | @Schema(title = "村庄") |
| | | private String districtTitle; |
| | | |
| | | @Schema(title = "农户编号") |
| | | private String clientNum; |
| | | |
| | | @Schema(title = "农户姓名") |
| | | @Schema(title = "姓名") |
| | | private String name; |
| | | |
| | | @Schema(title = "水卡编号") |
| | |
| | | @Schema(title = "身份证号") |
| | | private String idCard; |
| | | |
| | | @Schema(title = "手机号") |
| | | @Schema(title = "联系电话") |
| | | private String phone; |
| | | |
| | | @Schema(title = "充值金额") |
| | | private Float money; |
| | | |
| | | @Schema(title = "购卡金额") |
| | | private Integer cardCost; |
| | | |
| | | @Schema(title = "支付方式编号") |
| | | private Long paymentId; |
| | | |
| | | @Schema(title = "支付方式名称") |
| | | private String paymentMethod; |
| | | |
| | | @Schema(title = "业务类型") |
| | | private String operateType; |
| | |
| | | @Schema(title = "交易时间") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date operateDt; |
| | | private Date operateTime; |
| | | |
| | | @Schema(title = "余额") |
| | | private Float money; |
| | | |
| | | @Schema(title = "购水金额") |
| | | private Float waterCost; |
| | | |
| | | @Schema(title = "赠送金额") |
| | | private Float gift; |
| | | |
| | | @Schema(title = "购卡金额") |
| | | private Integer cardCost; |
| | | |
| | | @Schema(title = "支付方式") |
| | | private String paymentMethod; |
| | | |
| | | @Schema(title = "操作员") |
| | | private String operatorName; |
New file |
| | |
| | | package com.dy.pipIrrGlobal.voSe; |
| | | |
| | | import com.dy.common.po.BaseEntity; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2024-01-22 18:27 |
| | | * @LastEditTime 2024-01-22 18:27 |
| | | * @Description |
| | | */ |
| | | |
| | | @Data |
| | | @Schema(title = "交易记录汇总视图对象") |
| | | public class VoTransactionStatistics implements BaseEntity { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @Schema(title = "业务类型") |
| | | private String operateType; |
| | | |
| | | @Schema(title = "交易日期") |
| | | private String tradeDate; |
| | | |
| | | @Schema(title = "交易笔数") |
| | | private Integer count; |
| | | |
| | | @Schema(title = "实收金额") |
| | | private Float received; |
| | | |
| | | @Schema(title = "赠送金额") |
| | | private Float gift; |
| | | } |
| | |
| | | LIMIT ${pageCurr}, ${pageSize} |
| | | </if> |
| | | </select> |
| | | |
| | | <!--根据指定条件获取交易记录数--> |
| | | <select id="getTransactionRecordCount" parameterType="java.util.Map" resultType="java.lang.Long"> |
| | | SELECT |
| | | COUNT(*) AS recordCount |
| | | FROM se_card_operate ope |
| | | INNER JOIN se_client cli ON ope.client_id = cli.id |
| | | INNER JOIN se_client_card card ON ope.card_id = card.id |
| | | INNER JOIN ba_user user ON ope.operator = user.id |
| | | INNER JOIN se_payment_method pay ON ope.payment_id = pay.id |
| | | <where> |
| | | AND ope.operate_type IN(1,2,3,4) |
| | | <if test = "villageId != null and villageId > 0"> |
| | | AND cli.villageId = ${villageId} |
| | | </if> |
| | | |
| | | <if test = "cardNum != null and cardNum >0"> |
| | | AND card.cardNum = ${cardNum} |
| | | </if> |
| | | |
| | | <if test = "operateTimeStart != null and operateTimeStop != null"> |
| | | AND ope.operate_dt BETWEEN #{operateTimeStart} AND #{operateTimeStop} |
| | | </if> |
| | | </where> |
| | | </select> |
| | | |
| | | <!--根据指定条件获取交易记录--> |
| | | <select id="getTransactions" resultType="com.dy.pipIrrGlobal.voSe.VoTransaction"> |
| | | SELECT |
| | | ope.id AS orderNumber, |
| | | cli.villageId, |
| | | cli.districtTitle, |
| | | cli.clientNum, |
| | | cli.`name`, |
| | | card.cardNum, |
| | | cli.idCard, |
| | | cli.phone, |
| | | (CASE operate_type |
| | | WHEN 1 THEN '开卡' |
| | | WHEN 2 THEN '充值' |
| | | WHEN 3 THEN '销卡' |
| | | WHEN 4 THEN '补卡' |
| | | END) AS operateType, |
| | | ope.operate_dt AS operateTime, |
| | | IFNULL(ope.money, 0) AS money, |
| | | IFNULL(ope.trade_amount, 0) AS waterCost, |
| | | IFNULL(ope.gift, 0) AS gift, |
| | | IFNULL(ope.card_cost, 0) AS cardCost, |
| | | pay.`name` paymentMethod, |
| | | user.name AS operatorName |
| | | FROM se_card_operate ope |
| | | INNER JOIN se_client cli ON ope.client_id = cli.id |
| | | INNER JOIN se_client_card card ON ope.card_id = card.id |
| | | INNER JOIN ba_user user ON ope.operator = user.id |
| | | INNER JOIN se_payment_method pay ON ope.payment_id = pay.id |
| | | <where> |
| | | AND ope.operate_type IN(1,2,3,4) |
| | | <if test = "villageId != null and villageId > 0"> |
| | | AND cli.villageId = ${villageId} |
| | | </if> |
| | | |
| | | <if test = "cardNum != null and cardNum >0"> |
| | | AND card.cardNum = ${cardNum} |
| | | </if> |
| | | |
| | | <if test = "operateTimeStart != null and operateTimeStop != null"> |
| | | AND ope.operate_dt BETWEEN #{operateTimeStart} AND #{operateTimeStop} |
| | | </if> |
| | | </where> |
| | | ORDER BY ope.operate_dt |
| | | <if test="pageCurr != null and pageSize != null"> |
| | | LIMIT ${pageCurr}, ${pageSize} |
| | | </if> |
| | | </select> |
| | | |
| | | <!--根据指定条件获取购水汇总和购卡汇总,获取交易明细使用--> |
| | | <select id="getTransactionSums" resultType="java.util.Map"> |
| | | SELECT |
| | | IFNULL(SUM(trade_amount),0) AS waterCost, |
| | | IFNULL(SUM(card_cost),0) AS cardCost |
| | | FROM se_card_operate ope |
| | | INNER JOIN se_client cli ON ope.client_id = cli.id |
| | | INNER JOIN se_client_card card ON ope.card_id = card.id |
| | | INNER JOIN ba_user user ON ope.operator = user.id |
| | | INNER JOIN se_payment_method pay ON ope.payment_id = pay.id |
| | | <where> |
| | | AND ope.operate_type IN(1,2,3,4) |
| | | <if test = "villageId != null and villageId > 0"> |
| | | AND cli.villageId = ${villageId} |
| | | </if> |
| | | |
| | | <if test = "cardNum != null and cardNum >0"> |
| | | AND card.cardNum = ${cardNum} |
| | | </if> |
| | | |
| | | <if test = "operateTimeStart != null and operateTimeStop != null"> |
| | | AND ope.operate_dt BETWEEN #{operateTimeStart} AND #{operateTimeStop} |
| | | </if> |
| | | </where> |
| | | </select> |
| | | |
| | | |
| | | <!--根据指定条件获取交易统计记录数--> |
| | | <select id="getTransactionStatisticsRecordCount" parameterType="java.util.Map" resultType="java.lang.Long"> |
| | | SELECT |
| | | COUNT(*) AS recordCount |
| | | FROM v_transactionstatistics |
| | | <where> |
| | | <if test = "operateTimeStart != null and operateTimeStop != null"> |
| | | AND tradeDate BETWEEN #{operateTimeStart} AND #{operateTimeStop} |
| | | </if> |
| | | </where> |
| | | </select> |
| | | |
| | | <!--根据指定条件获取交易统计记录--> |
| | | <select id="getTransactionStatistics" resultType="com.dy.pipIrrGlobal.voSe.VoTransactionStatistics"> |
| | | SELECT * FROM v_transactionstatistics |
| | | <where> |
| | | <if test = "operateTimeStart != null and operateTimeStop != null"> |
| | | AND tradeDate BETWEEN #{operateTimeStart} AND #{operateTimeStop} |
| | | </if> |
| | | </where> |
| | | ORDER BY tradeDate |
| | | <if test="pageCurr != null and pageSize != null"> |
| | | LIMIT ${pageCurr}, ${pageSize} |
| | | </if> |
| | | </select> |
| | | |
| | | <!--根基指定条件获取笔数合计、实收金额合计、赠送金额合计--> |
| | | <select id="getTransactionStatisticsSums" resultType="java.util.Map"> |
| | | SELECT |
| | | SUM(count) AS totalCount, |
| | | SUM(received) AS totalReceived, |
| | | SUM(gift) AS totalGift |
| | | FROM v_transactionstatistics |
| | | <where> |
| | | <if test = "operateTimeStart != null and operateTimeStop != null"> |
| | | AND tradeDate BETWEEN #{operateTimeStart} AND #{operateTimeStop} |
| | | </if> |
| | | </where> |
| | | </select> |
| | | |
| | | <!--获取指定日期、指定支付方式实收金额合计--> |
| | | <select id="getPaymentSums" resultType="java.lang.Float"> |
| | | SELECT |
| | | SUM(ope.trade_amount) AS tradeAmount |
| | | FROM se_card_operate ope |
| | | <where> |
| | | <if test = "tradeDate != null and tradeDate !=''"> |
| | | AND Date(ope.operate_dt) = #{tradeDate} |
| | | </if> |
| | | |
| | | <if test = "paymentId != null and paymentId >0"> |
| | | AND ope.payment_id = ${paymentId} |
| | | </if> |
| | | </where> |
| | | GROUP BY ope.payment_id, Date(ope.operate_dt) |
| | | </select> |
| | | </mapper> |
| | |
| | | SELECT id, typeName from se_water_type |
| | | </select> |
| | | |
| | | <!-- 下列内容为交易明细查询 --> |
| | | <!--根据指定条件获取购水汇总和购卡汇总--> |
| | | <select id="getSums" resultType="java.util.Map"> |
| | | SELECT |
| | | SUM(money) AS money, |
| | | SUM(cardCost) AS cardCost |
| | | FROM v_operate |
| | | <where> |
| | | <if test = "villageId != null and villageId > 0"> |
| | | AND villageId = ${villageId} |
| | | </if> |
| | | |
| | | <if test = "paymentId != null and paymentId >0"> |
| | | AND paymentId = ${paymentId} |
| | | </if> |
| | | |
| | | <if test = "operateTimeStart != null and operateTimeStop != null"> |
| | | AND operateDt BETWEEN #{operateTimeStart} AND #{operateTimeStop} |
| | | </if> |
| | | </where> |
| | | </select> |
| | | |
| | | <!--根据指定条件获取交易记录数--> |
| | | <select id="getOperateRecordCount" parameterType="java.util.Map" resultType="java.lang.Long"> |
| | | SELECT |
| | | COUNT(*) AS recordCount |
| | | FROM v_operate |
| | | <where> |
| | | <if test = "villageId != null and villageId > 0"> |
| | | AND villageId = ${villageId} |
| | | </if> |
| | | |
| | | <if test = "paymentId != null and paymentId >0"> |
| | | AND paymentId = ${paymentId} |
| | | </if> |
| | | |
| | | <if test = "operateTimeStart != null and operateTimeStop != null"> |
| | | AND operateDt BETWEEN #{operateTimeStart} AND #{operateTimeStop} |
| | | </if> |
| | | </where> |
| | | </select> |
| | | |
| | | <!--根据指定条件获取交易记录--> |
| | | <select id="getOperates" resultType="com.dy.pipIrrGlobal.voSe.VoOperate"> |
| | | SELECT |
| | | villageId, |
| | | districtTitle, |
| | | clientNum, |
| | | `name`, |
| | | cardNum, |
| | | idCard, |
| | | phone, |
| | | money, |
| | | cardCost, |
| | | paymentId, |
| | | paymentMethod, |
| | | operateType, |
| | | operateDt, |
| | | operatorName |
| | | FROM v_operate |
| | | <where> |
| | | <if test = "villageId != null and villageId > 0"> |
| | | AND villageId = ${villageId} |
| | | </if> |
| | | |
| | | <if test = "paymentId != null and paymentId >0"> |
| | | AND paymentId = ${paymentId} |
| | | </if> |
| | | |
| | | <if test = "operateTimeStart != null and operateTimeStop != null"> |
| | | AND operateDt BETWEEN #{operateTimeStart} AND #{operateTimeStop} |
| | | </if> |
| | | </where> |
| | | ORDER BY operateDt |
| | | <if test="pageCurr != null and pageSize != null"> |
| | | LIMIT ${pageCurr}, ${pageSize} |
| | | </if> |
| | | </select> |
| | | |
| | | <!-- 下列内容为交易统计查询 --> |
| | | <!--根据指定条件获取交易笔数汇总和交易金额汇总--> |
| | | <select id="getStatisticSums" resultType="java.util.Map"> |
| | | SELECT |
| | | SUM(count) AS count, |
| | | SUM(money) AS money |
| | | FROM |
| | | ( |
| | | SELECT |
| | | villageId, |
| | | districtTitle, |
| | | operateType, |
| | | operateDt, |
| | | count(*) AS count, |
| | | (sum(money) + sum(cardCost)) AS money |
| | | FROM v_operate |
| | | <where> |
| | | <if test = "villageId != null and villageId > 0"> |
| | | AND villageId = ${villageId} |
| | | </if> |
| | | |
| | | <!-- <if test = "paymentId != null and paymentId >0">--> |
| | | <!-- AND paymentId = ${paymentId}--> |
| | | <!-- </if>--> |
| | | |
| | | <if test = "operateTimeStart != null and operateTimeStop != null"> |
| | | AND operateDt BETWEEN #{operateTimeStart} AND #{operateTimeStop} |
| | | </if> |
| | | </where> |
| | | GROUP BY villageId, districtTitle, operateType, operateDt |
| | | ) temp |
| | | </select> |
| | | |
| | | <!--根据指定条件获取汇总记录数--> |
| | | <select id="getStatisticRecordCount" parameterType="java.util.Map" resultType="java.lang.Long"> |
| | | SELECT |
| | | COUNT(*) AS recordCount |
| | | FROM |
| | | ( |
| | | SELECT |
| | | villageId, |
| | | districtTitle, |
| | | operateType, |
| | | operateDt, |
| | | count(*) AS count, |
| | | (sum(money) + sum(cardCost)) AS money |
| | | FROM v_operate |
| | | <where> |
| | | <if test = "villageId != null and villageId > 0"> |
| | | AND villageId = ${villageId} |
| | | </if> |
| | | |
| | | <!-- <if test = "paymentId != null and paymentId >0">--> |
| | | <!-- AND paymentId = ${paymentId}--> |
| | | <!-- </if>--> |
| | | |
| | | <if test = "operateTimeStart != null and operateTimeStop != null"> |
| | | AND operateDt BETWEEN #{operateTimeStart} AND #{operateTimeStop} |
| | | </if> |
| | | </where> |
| | | GROUP BY villageId, districtTitle, operateType, operateDt |
| | | ) temp |
| | | </select> |
| | | |
| | | <!--根据指定条件获取统计记录--> |
| | | <select id="getStatistics" resultType="com.dy.pipIrrGlobal.voSe.VoStatistics"> |
| | | SELECT |
| | | villageId, |
| | | districtTitle, |
| | | operateType, |
| | | operateDt, |
| | | count(*) AS count, |
| | | (sum(money) + sum(cardCost)) AS money |
| | | FROM v_operate |
| | | <where> |
| | | <if test = "villageId != null and villageId > 0"> |
| | | AND villageId = ${villageId} |
| | | </if> |
| | | |
| | | <!-- <if test = "paymentId != null and paymentId >0">--> |
| | | <!-- AND paymentId = ${paymentId}--> |
| | | <!-- </if>--> |
| | | |
| | | <if test = "operateTimeStart != null and operateTimeStop != null"> |
| | | AND operateDt BETWEEN #{operateTimeStart} AND #{operateTimeStop} |
| | | </if> |
| | | </where> |
| | | GROUP BY villageId, districtTitle, operateType, operateDt |
| | | ORDER BY operateDt |
| | | <if test="pageCurr != null and pageSize != null"> |
| | | LIMIT ${pageCurr}, ${pageSize} |
| | | </if> |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | import com.dy.common.webUtil.BaseResponseUtils; |
| | | import com.dy.common.webUtil.QueryResultVo; |
| | | import com.dy.common.webUtil.ResultCodeMsg; |
| | | import com.dy.pipIrrGlobal.pojoBa.BaClient; |
| | | import com.dy.pipIrrGlobal.pojoSe.SeCardOperate; |
| | | import com.dy.pipIrrGlobal.pojoSe.SeClientCard; |
| | | import com.dy.pipIrrGlobal.util.Constant; |
| | |
| | | import com.dy.pipIrrSell.cardOperate.dto.*; |
| | | import com.dy.pipIrrSell.cardOperate.enums.OperateTypeENUM; |
| | | import com.dy.pipIrrSell.cardOperate.qo.QoRecharge; |
| | | import com.dy.pipIrrSell.cardOperate.qo.QoTransaction; |
| | | import com.dy.pipIrrSell.cardOperate.qo.QoTransactionStatistics; |
| | | import com.dy.pipIrrSell.clientCard.CardStateENUM; |
| | | import com.dy.pipIrrSell.clientCard.ClientCardSv; |
| | | import com.dy.pipIrrSell.clientCard.LastOperateENUM; |
| | |
| | | |
| | | /** |
| | | * 添加注销记录 |
| | | * 支付方式为现金 |
| | | */ |
| | | SeCardOperate seCardOperate = new SeCardOperate(); |
| | | seCardOperate.setCardId(cardId); |
| | | seCardOperate.setClientId(clientId); |
| | | seCardOperate.setTradeAmount(-refund); |
| | | seCardOperate.setPaymentId(1L); |
| | | seCardOperate.setOperateType(OperateTypeENUM.CANCEL.getCode()); |
| | | seCardOperate.setRemarks(remarks); |
| | | seCardOperate.setOperator(operator); |
| | |
| | | return BaseResponseUtils.buildException(e.getMessage()) ; |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 根据指定条件获取交易明细 |
| | | * @param vo |
| | | * @return |
| | | */ |
| | | @Operation(summary = "获得交易记录明细", description = "返回交易记录明细") |
| | | @ApiResponses(value = { |
| | | @ApiResponse( |
| | | responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE, |
| | | description = "返回一页农户数据(BaseResponse.content:QueryResultVo[{}])", |
| | | content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE, |
| | | schema = @Schema(implementation = BaClient.class))} |
| | | ) |
| | | }) |
| | | @GetMapping(path = "getTransactions") |
| | | @SsoAop() |
| | | public BaseResponse<Map> getOperates(QoTransaction vo){ |
| | | try { |
| | | Map res = cardOperateSv.getTransactions(vo); |
| | | return BaseResponseUtils.buildSuccess(res); |
| | | } catch (Exception e) { |
| | | log.error("查询交易记录异常", e); |
| | | return BaseResponseUtils.buildException(e.getMessage()) ; |
| | | } |
| | | } |
| | | |
| | | |
| | | @Operation(summary = "获得交易汇总记录", description = "返回交易汇总记录") |
| | | @ApiResponses(value = { |
| | | @ApiResponse( |
| | | responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE, |
| | | description = "返回一页农户数据(BaseResponse.content:QueryResultVo[{}])", |
| | | content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE, |
| | | schema = @Schema(implementation = BaClient.class))} |
| | | ) |
| | | }) |
| | | @GetMapping(path = "getStatistics") |
| | | @SsoAop() |
| | | public BaseResponse<Map> getStatistics(QoTransactionStatistics vo){ |
| | | try { |
| | | Map res = cardOperateSv.getTransactionStatistics(vo); |
| | | return BaseResponseUtils.buildSuccess(res); |
| | | } catch (Exception e) { |
| | | log.error("查询交易汇总记录异常", e); |
| | | return BaseResponseUtils.buildException(e.getMessage()) ; |
| | | } |
| | | } |
| | | } |
| | |
| | | package com.dy.pipIrrSell.cardOperate; |
| | | |
| | | import com.alibaba.fastjson2.JSONArray; |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.dy.common.webUtil.BaseResponse; |
| | | import com.dy.common.webUtil.BaseResponseUtils; |
| | | import com.dy.common.webUtil.QueryResultVo; |
| | |
| | | import com.dy.pipIrrGlobal.pojoSe.SeCardOperate; |
| | | import com.dy.pipIrrGlobal.pojoSe.SeClientCard; |
| | | import com.dy.pipIrrGlobal.voSe.VoRecharge; |
| | | import com.dy.pipIrrGlobal.voSe.VoTransaction; |
| | | import com.dy.pipIrrGlobal.voSe.VoTransactionStatistics; |
| | | import com.dy.pipIrrSell.cardOperate.dto.DtoRecharge; |
| | | import com.dy.pipIrrSell.cardOperate.enums.OperateTypeENUM; |
| | | import com.dy.pipIrrSell.cardOperate.qo.QoRecharge; |
| | | import com.dy.pipIrrSell.cardOperate.qo.QoTransaction; |
| | | import com.dy.pipIrrSell.cardOperate.qo.QoTransactionStatistics; |
| | | import com.dy.pipIrrSell.clientCard.ClientCardSv; |
| | | import com.dy.pipIrrSell.clientCard.LastOperateENUM; |
| | | import com.dy.pipIrrSell.result.SellResultCode; |
| | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.text.ParseException; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | |
| | | /** |
| | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 根据指定条件获取充值记录 |
| | | * @param queryVo |
| | | * @return |
| | | */ |
| | | public QueryResultVo<List<VoRecharge>> getRecharges(QoRecharge queryVo) { |
| | | //完善查询充值记录的起止时间 |
| | | String rechargeTimeStart = queryVo.rechargeTimeStart; |
| | |
| | | rsVo.obj = seCardOperateMapper.getRecharges(params); |
| | | return rsVo ; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 根据指定条件获取交易记录 |
| | | * @param vo |
| | | * @return |
| | | */ |
| | | public Map getTransactions(QoTransaction vo){ |
| | | // 补齐查询时间 |
| | | String operateTimeStart = vo.operateTimeStart; |
| | | String operateTimeStop = vo.operateTimeStop; |
| | | if(operateTimeStart != null) { |
| | | operateTimeStart = operateTimeStart + " 00:00:00"; |
| | | vo.setOperateTimeStart(operateTimeStart); |
| | | } |
| | | if(operateTimeStop != null) { |
| | | operateTimeStop = operateTimeStop + " 23:59:59"; |
| | | vo.setOperateTimeStop(operateTimeStop); |
| | | } |
| | | |
| | | // 生成查询参数 |
| | | Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(vo) ; |
| | | |
| | | // 获取汇总的购水金额、购卡金额 |
| | | Float waterCost = 0f; |
| | | Float cardCost = 0f; |
| | | Map map_sum = Optional.ofNullable(seCardOperateMapper.getTransactionSums(params)).orElse(new HashMap()); |
| | | if(map_sum.size() > 0) { |
| | | waterCost = Float.parseFloat(map_sum.get("waterCost").toString()); |
| | | cardCost = Float.parseFloat(map_sum.get("cardCost").toString()); |
| | | } |
| | | |
| | | // 获取符合条件的记录数 |
| | | Long itemTotal = seCardOperateMapper.getTransactionRecordCount(params); |
| | | |
| | | Integer pageSize = vo.getPageSize(); |
| | | // 计算总页数 |
| | | Integer pageTotal ; |
| | | pageTotal = (int)Math.ceil((itemTotal==null?0.0D:itemTotal.doubleValue())/pageSize); |
| | | |
| | | // 根据当前页码及每页数量计算偏移量 |
| | | Integer pageCurr = (Integer.parseInt(params.get("pageCurr").toString()) - 1) * Integer.parseInt(params.get("pageSize").toString()); |
| | | params.put("pageCurr", pageCurr); |
| | | |
| | | List<VoTransaction> lit = seCardOperateMapper.getTransactions(params); |
| | | Map map_record = new HashMap(); |
| | | map_record.put("itemTotal", itemTotal); |
| | | map_record.put("pageCurr", vo.pageCurr); |
| | | map_record.put("pageSize", pageSize); |
| | | map_record.put("pageTotal", pageTotal); |
| | | map_record.put("list", lit); |
| | | |
| | | Map map_result = new HashMap(); |
| | | map_result.put("waterCost", waterCost); |
| | | map_result.put("cardCost", cardCost); |
| | | map_result.put("records", map_record); |
| | | |
| | | return map_result; |
| | | } |
| | | |
| | | /** |
| | | * 获取交易统计记录 |
| | | * 1.交易统计记录 |
| | | * 2.笔数合计、实收金额合计、赠送金额合计 |
| | | * 3.每一天、各种支付方式实收金额合计 |
| | | * @param vo |
| | | * @return |
| | | */ |
| | | public Map getTransactionStatistics(QoTransactionStatistics vo) throws ParseException { |
| | | /** |
| | | * 遍历查询日期,取出每天三种支付方式(现金、扫码、转账)实收金额 |
| | | * 每天一个对象 |
| | | * 对象组成JSONArray添加到返回对象中 |
| | | */ |
| | | SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); |
| | | Date startDate = dateFormat.parse(vo.getOperateTimeStart()); |
| | | Date stopDate = dateFormat.parse(vo.getOperateTimeStop()); |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTime(startDate); |
| | | |
| | | JSONArray array_paymentSums = new JSONArray(); |
| | | while (calendar.getTime().before(stopDate) || calendar.getTime().equals(stopDate)) { |
| | | String tradeDate = dateFormat.format(calendar.getTime()) ; |
| | | Float receivedCash = Optional.ofNullable(seCardOperateMapper.getPaymentSums(tradeDate ,1L)).orElse(0f); |
| | | Float receivedQRCode = Optional.ofNullable(seCardOperateMapper.getPaymentSums(tradeDate,2L)).orElse(0f); |
| | | Float receivedTransfer = Optional.ofNullable(seCardOperateMapper.getPaymentSums(tradeDate, 3L)).orElse(0f); |
| | | JSONObject job = new JSONObject(); |
| | | job.put("tradeDate", tradeDate); |
| | | job.put("receivedCash", receivedCash); |
| | | job.put("receivedQRCode", receivedQRCode); |
| | | job.put("receivedTransfer", receivedTransfer); |
| | | |
| | | array_paymentSums.add(job); |
| | | calendar.add(Calendar.DAY_OF_MONTH, 1); |
| | | } |
| | | |
| | | |
| | | // 补齐查询时间 |
| | | String operateTimeStart = vo.operateTimeStart; |
| | | String operateTimeStop = vo.operateTimeStop; |
| | | if(operateTimeStart != null) { |
| | | operateTimeStart = operateTimeStart + " 00:00:00"; |
| | | vo.setOperateTimeStart(operateTimeStart); |
| | | } |
| | | if(operateTimeStop != null) { |
| | | operateTimeStop = operateTimeStop + " 23:59:59"; |
| | | vo.setOperateTimeStop(operateTimeStop); |
| | | } |
| | | |
| | | // 生成查询参数 |
| | | Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(vo) ; |
| | | |
| | | //获取笔数合计、实收金额合计、赠送金额合计 |
| | | Integer totalCount = 0; |
| | | Float totalReceived = 0f; |
| | | Float totalGift = 0f; |
| | | Map map_sum = Optional.ofNullable(seCardOperateMapper.getTransactionStatisticsSums(params)).orElse(new HashMap()); |
| | | if(map_sum.size() > 0) { |
| | | totalCount = Integer.parseInt(map_sum.get("totalCount").toString()); |
| | | totalReceived = Float.parseFloat(map_sum.get("totalReceived").toString()); |
| | | totalGift = Float.parseFloat(map_sum.get("totalGift").toString()); |
| | | } |
| | | |
| | | // 获取符合条件的记录数 |
| | | Long itemTotal = seCardOperateMapper.getTransactionStatisticsRecordCount(params); |
| | | |
| | | Integer pageSize = vo.getPageSize(); |
| | | // 计算总页数 |
| | | Integer pageTotal ; |
| | | pageTotal = (int)Math.ceil((itemTotal==null?0.0D:itemTotal.doubleValue())/pageSize); |
| | | |
| | | // 根据当前页码及每页数量计算偏移量 |
| | | Integer pageCurr = (Integer.parseInt(params.get("pageCurr").toString()) - 1) * Integer.parseInt(params.get("pageSize").toString()); |
| | | params.put("pageCurr", pageCurr); |
| | | |
| | | List<VoTransactionStatistics> list = seCardOperateMapper.getTransactionStatistics(params); |
| | | Map map_record = new HashMap(); |
| | | map_record.put("itemTotal", itemTotal); |
| | | map_record.put("pageCurr", vo.pageCurr); |
| | | map_record.put("pageSize", pageSize); |
| | | map_record.put("pageTotal", pageTotal); |
| | | map_record.put("list", list); |
| | | |
| | | Map map_result = new HashMap(); |
| | | map_result.put("totalCount", totalCount); |
| | | map_result.put("totalReceived", totalReceived); |
| | | map_result.put("totalGift", totalGift); |
| | | map_result.put("records", map_record); |
| | | map_result.put("paymentSums", array_paymentSums); |
| | | |
| | | return map_result; |
| | | } |
| | | } |
File was renamed from pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/client/QueryOperate.java |
| | |
| | | package com.dy.pipIrrSell.client; |
| | | package com.dy.pipIrrSell.cardOperate.qo; |
| | | |
| | | import com.dy.common.webUtil.QueryConditionVo; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2023-12-26 21:00 |
| | | * @LastEditTime 2023-12-26 21:00 |
| | | * @date 2024-01-22 10:57 |
| | | * @LastEditTime 2024-01-22 10:57 |
| | | * @Description |
| | | */ |
| | | |
| | |
| | | @NoArgsConstructor |
| | | @AllArgsConstructor |
| | | @Builder |
| | | @Schema(name = "交易查询条件") |
| | | public class QueryOperate extends QueryConditionVo { |
| | | |
| | | @Schema(name = "交易明细查询条件") |
| | | public class QoTransaction extends QueryConditionVo { |
| | | @Schema(description = "村ID") |
| | | public Long villageId; |
| | | |
| | | @Schema(description = "支付方式编号") |
| | | public Long paymentId; |
| | | @Schema(description = "水卡编号") |
| | | public Long cardNum; |
| | | |
| | | @Schema(description = "交易查询起始时间") |
| | | public String operateTimeStart; |
File was renamed from pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/client/QueryStatistic.java |
| | |
| | | package com.dy.pipIrrSell.client; |
| | | package com.dy.pipIrrSell.cardOperate.qo; |
| | | |
| | | import com.dy.common.webUtil.QueryConditionVo; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2023-12-27 15:33 |
| | | * @LastEditTime 2023-12-27 15:33 |
| | | * @date 2024-01-22 18:32 |
| | | * @LastEditTime 2024-01-22 18:32 |
| | | * @Description |
| | | */ |
| | | |
| | |
| | | @AllArgsConstructor |
| | | @Builder |
| | | @Schema(name = "交易汇总查询条件") |
| | | public class QueryStatistic extends QueryConditionVo { |
| | | @Schema(description = "村ID") |
| | | public Long villageId; |
| | | |
| | | //@Schema(description = "支付方式编号") |
| | | //public Long paymentId; |
| | | |
| | | public class QoTransactionStatistics extends QueryConditionVo { |
| | | @Schema(description = "交易查询起始时间") |
| | | public String operateTimeStart; |
| | | |
| | |
| | | } |
| | | |
| | | /** |
| | | * 获取交易记录 |
| | | * @param vo |
| | | * @return |
| | | */ |
| | | @Operation(summary = "获得一页交易记录", description = "返回一页交易记录") |
| | | @ApiResponses(value = { |
| | | @ApiResponse( |
| | | responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE, |
| | | description = "返回一页农户数据(BaseResponse.content:QueryResultVo[{}])", |
| | | content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE, |
| | | schema = @Schema(implementation = BaClient.class))} |
| | | ) |
| | | }) |
| | | @GetMapping(path = "getOperates") |
| | | @SsoAop() |
| | | public BaseResponse<Map> getOperates(QueryOperate vo){ |
| | | try { |
| | | Map res = clientSv.getOperates(vo); |
| | | return BaseResponseUtils.buildSuccess(res); |
| | | } catch (Exception e) { |
| | | log.error("查询交易记录异常", e); |
| | | return BaseResponseUtils.buildException(e.getMessage()) ; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 获取交易汇总记录 |
| | | * @param vo |
| | | * @return |
| | | */ |
| | | @Operation(summary = "获得一页交易汇总记录", description = "返回一页交易汇总记录") |
| | | @ApiResponses(value = { |
| | | @ApiResponse( |
| | | responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE, |
| | | description = "返回一页农户数据(BaseResponse.content:QueryResultVo[{}])", |
| | | content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE, |
| | | schema = @Schema(implementation = BaClient.class))} |
| | | ) |
| | | }) |
| | | @GetMapping(path = "getStatistics") |
| | | @SsoAop() |
| | | public BaseResponse<Map> getStatistics(QueryStatistic vo){ |
| | | try { |
| | | Map res = clientSv.getStatistics(vo); |
| | | return BaseResponseUtils.buildSuccess(res); |
| | | } catch (Exception e) { |
| | | log.error("查询交易汇总记录异常", e); |
| | | return BaseResponseUtils.buildException(e.getMessage()) ; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 根据主键获取一个农户对象 |
| | | * @param id |
| | | * @return |
| | |
| | | } |
| | | |
| | | /** |
| | | * 生成10为农户编号 |
| | | * 生成10位农户编号 |
| | | * 1. 到农户表中查询6位区划串开头的最大的农户编号 |
| | | * 2. 是否取到记录 |
| | | * 2.1 取到 |
| | |
| | | import com.dy.pipIrrGlobal.daoSe.SeClientMapper; |
| | | import com.dy.pipIrrGlobal.pojoSe.SeClient; |
| | | import com.dy.pipIrrGlobal.voSe.VoClient; |
| | | import com.dy.pipIrrGlobal.voSe.VoOperate; |
| | | import com.dy.pipIrrGlobal.voSe.VoStatistics; |
| | | 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.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Optional; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | |
| | | rsVo.obj = seClientMapper.getClients(params); |
| | | |
| | | return rsVo ; |
| | | } |
| | | |
| | | /** |
| | | * 根据指定条件获取交易记录 |
| | | * @param vo |
| | | * @return |
| | | */ |
| | | public Map getOperates(QueryOperate vo){ |
| | | // 补齐查询时间 |
| | | String operateTimeStart = vo.operateTimeStart; |
| | | String operateTimeStop = vo.operateTimeStop; |
| | | if(operateTimeStart != null) { |
| | | operateTimeStart = operateTimeStart + " 00:00:00"; |
| | | vo.setOperateTimeStart(operateTimeStart); |
| | | } |
| | | if(operateTimeStop != null) { |
| | | operateTimeStop = operateTimeStop + " 23:59:59"; |
| | | vo.setOperateTimeStop(operateTimeStop); |
| | | } |
| | | |
| | | // 生成查询参数 |
| | | Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(vo) ; |
| | | |
| | | // 获取汇总的购水金额、购卡金额 |
| | | Float money = 0f; |
| | | Float cardCost = 0f; |
| | | Map map_sum = Optional.ofNullable(seClientMapper.getSums(params)).orElse(new HashMap()); |
| | | if(map_sum.size() > 0) { |
| | | money = Float.parseFloat(map_sum.get("money").toString()); |
| | | cardCost = Float.parseFloat(map_sum.get("cardCost").toString()); |
| | | } |
| | | |
| | | // 获取符合条件的记录数 |
| | | Long itemTotal = seClientMapper.getOperateRecordCount(params); |
| | | |
| | | Integer pageSize = vo.getPageSize(); |
| | | // 计算总页数 |
| | | Integer pageTotal ; |
| | | pageTotal = (int)Math.ceil((itemTotal==null?0.0D:itemTotal.doubleValue())/pageSize); |
| | | |
| | | // 根据当前页码及每页数量计算偏移量 |
| | | Integer pageCurr = (Integer.parseInt(params.get("pageCurr").toString()) - 1) * Integer.parseInt(params.get("pageSize").toString()); |
| | | params.put("pageCurr", pageCurr); |
| | | |
| | | List<VoOperate> lit = seClientMapper.getOperates(params); |
| | | Map map_record = new HashMap(); |
| | | map_record.put("itemTotal", itemTotal); |
| | | map_record.put("pageCurr", vo.pageCurr); |
| | | map_record.put("pageSize", pageSize); |
| | | map_record.put("pageTotal", pageTotal); |
| | | map_record.put("list", lit); |
| | | |
| | | Map map_result = new HashMap(); |
| | | map_result.put("money", money); |
| | | map_result.put("cardCost", cardCost); |
| | | map_result.put("records", map_record); |
| | | |
| | | return map_result; |
| | | } |
| | | |
| | | /** |
| | | * 根据指定条件获取统计记录 |
| | | * @param vo 交易汇总查询条件 |
| | | * @return 交易汇总记录 |
| | | */ |
| | | public Map getStatistics(QueryStatistic vo){ |
| | | // 补齐查询时间 |
| | | String operateTimeStart = vo.operateTimeStart; |
| | | String operateTimeStop = vo.operateTimeStop; |
| | | if(operateTimeStart != null) { |
| | | operateTimeStart = operateTimeStart + " 00:00:00"; |
| | | vo.setOperateTimeStart(operateTimeStart); |
| | | } |
| | | if(operateTimeStop != null) { |
| | | operateTimeStop = operateTimeStop + " 23:59:59"; |
| | | vo.setOperateTimeStop(operateTimeStop); |
| | | } |
| | | |
| | | // 生成查询参数 |
| | | Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(vo) ; |
| | | |
| | | // 获取汇总的交易笔数、交易金额 |
| | | Integer count = 0; |
| | | Float money = 0f; |
| | | Map map_sum = Optional.ofNullable(seClientMapper.getStatisticSums(params)).orElse(new HashMap()); |
| | | if(map_sum.size() > 0) { |
| | | count = Integer.parseInt(map_sum.get("count").toString()); |
| | | money = Float.parseFloat(map_sum.get("money").toString()); |
| | | } |
| | | |
| | | // 获取符合条件的记录数 |
| | | Long itemTotal = seClientMapper.getStatisticRecordCount(params); |
| | | |
| | | Integer pageSize = vo.getPageSize(); |
| | | // 计算总页数 |
| | | Integer pageTotal ; |
| | | pageTotal = (int)Math.ceil((itemTotal==null?0.0D:itemTotal.doubleValue())/pageSize); |
| | | |
| | | // 根据当前页码及每页数量计算偏移量 |
| | | Integer pageCurr = (Integer.parseInt(params.get("pageCurr").toString()) - 1) * Integer.parseInt(params.get("pageSize").toString()); |
| | | params.put("pageCurr", pageCurr); |
| | | |
| | | List<VoStatistics> lit = seClientMapper.getStatistics(params); |
| | | Map map_record = new HashMap(); |
| | | map_record.put("itemTotal", itemTotal); |
| | | map_record.put("pageCurr", vo.pageCurr); |
| | | map_record.put("pageSize", pageSize); |
| | | map_record.put("pageTotal", pageTotal); |
| | | map_record.put("list", lit); |
| | | |
| | | Map map_result = new HashMap(); |
| | | map_result.put("count", count); |
| | | map_result.put("money", money); |
| | | map_result.put("records", map_record); |
| | | |
| | | return map_result; |
| | | } |
| | | |
| | | /** |