2024-01-31 朱宝民 电子钱包4个查询接口
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.dy.pipIrrGlobal.pojoSe.SeConsume; |
| | | import com.dy.pipIrrGlobal.voSe.VoWalletConsume; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | |
| | | int updateByPrimaryKeySelective(SeConsume record); |
| | | |
| | | int updateByPrimaryKey(SeConsume record); |
| | | |
| | | /** |
| | | * 根据农户ID获取消费汇总记录 |
| | | * @param clientId |
| | | * @return |
| | | */ |
| | | Map getWalletConsumeSum(@Param("clientId") Long clientId); |
| | | |
| | | /** |
| | | * 根据农户ID获取电子钱包消费记录数 |
| | | * @param params |
| | | * @return |
| | | */ |
| | | Long getRecordCount(Map<?, ?> params); |
| | | |
| | | /*** |
| | | * 根据农户ID获取电子钱包消费记录 |
| | | * @param params |
| | | * @return |
| | | */ |
| | | List<VoWalletConsume> getWalletConsumes(Map<?, ?> params); |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.dy.pipIrrGlobal.pojoSe.SeRefund; |
| | | import com.dy.pipIrrGlobal.voSe.VoWalletRefund; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | |
| | | * @return |
| | | */ |
| | | SeRefund getRefundByWallerId(@Param("walletId") Long walletId); |
| | | |
| | | /** |
| | | * 根据指定条件获取电子钱包退款记录数 |
| | | * @param params |
| | | * @return |
| | | */ |
| | | Long getRecordCount(Map<?, ?> params); |
| | | |
| | | /*** |
| | | * 根据指定条件获取电子钱包退款记录 |
| | | * @param params |
| | | * @return |
| | | */ |
| | | List<VoWalletRefund> getWalletRefunds(Map<?, ?> params); |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.dy.pipIrrGlobal.pojoSe.SeWallet; |
| | | import com.dy.pipIrrGlobal.voSe.VoWallet; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | |
| | | * @return |
| | | */ |
| | | SeWallet getWalletByClientId(@Param("clientId") Long clientId); |
| | | |
| | | /** |
| | | * 根据农户姓名获取电子钱包账户记录数 |
| | | * @param params |
| | | * @return |
| | | */ |
| | | Long getRecordCount(Map<?, ?> params); |
| | | |
| | | /*** |
| | | * 根据农户姓名获取电子钱包账户记录 |
| | | * @param params |
| | | * @return |
| | | */ |
| | | List<VoWallet> getWallets(Map<?, ?> params); |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.dy.pipIrrGlobal.pojoSe.SeWalletRecharge; |
| | | import com.dy.pipIrrGlobal.voSe.VoWalletRecharge; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | |
| | | int updateByPrimaryKeySelective(SeWalletRecharge record); |
| | | |
| | | int updateByPrimaryKey(SeWalletRecharge record); |
| | | |
| | | /** |
| | | * 根据指定条件获取电子钱包充值记录数 |
| | | * @param params |
| | | * @return |
| | | */ |
| | | Long getRecordCount(Map<?, ?> params); |
| | | |
| | | /*** |
| | | * 根据指定条件获取电子钱包充值记录 |
| | | * @param params |
| | | * @return |
| | | */ |
| | | List<VoWalletRecharge> getWalletRecharges(Map<?, ?> params); |
| | | } |
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-31 16:15 |
| | | * @LastEditTime 2024-01-31 16:15 |
| | | * @Description |
| | | */ |
| | | |
| | | @Data |
| | | @Schema(title = "电子钱包账户视图对象") |
| | | public class VoWallet implements BaseEntity { |
| | | private static final long serialVersionUID = 202401311618001L; |
| | | |
| | | @Schema(title = "农户ID") |
| | | private String clientId; |
| | | |
| | | @Schema(title = "农户姓名") |
| | | private String name; |
| | | |
| | | @Schema(title = "农户编号") |
| | | private String clientNum; |
| | | |
| | | @Schema(title = "手机号") |
| | | private String phone; |
| | | |
| | | @Schema(title = "电子钱包余额") |
| | | private Double money; |
| | | } |
New file |
| | |
| | | package com.dy.pipIrrGlobal.voSe; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2024-01-31 18:23 |
| | | * @LastEditTime 2024-01-31 18:23 |
| | | * @Description |
| | | */ |
| | | |
| | | @Data |
| | | @Schema(title = "电子钱包消费视图对象") |
| | | public class VoWalletConsume { |
| | | private static final long serialVersionUID = 202401311824001L; |
| | | |
| | | @Schema(title = "消费金额") |
| | | private Double consumption; |
| | | |
| | | @Schema(title = "用水时长") |
| | | private Double duration; |
| | | |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | @Schema(title = "开阀时间") |
| | | private Date vot; |
| | | |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | @Schema(title = "关阀时间") |
| | | private Date vct; |
| | | } |
New file |
| | |
| | | package com.dy.pipIrrGlobal.voSe; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2024-01-31 16:43 |
| | | * @LastEditTime 2024-01-31 16:43 |
| | | * @Description |
| | | */ |
| | | |
| | | @Data |
| | | @Schema(title = "电子钱包充值视图对象") |
| | | public class VoWalletRecharge { |
| | | private static final long serialVersionUID = 202401311644001L; |
| | | |
| | | @Schema(title = "农户姓名") |
| | | private String name; |
| | | |
| | | @Schema(title = "农户编号") |
| | | private String clientNum; |
| | | |
| | | @Schema(title = "手机号") |
| | | private String phone; |
| | | |
| | | @Schema(title = "充值金额") |
| | | private Double amount; |
| | | |
| | | @Schema(title = "电子钱包余额") |
| | | private Double afterRecharge; |
| | | |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | @Schema(title = "充值时间") |
| | | private Date rechargeTime; |
| | | } |
New file |
| | |
| | | package com.dy.pipIrrGlobal.voSe; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2024-01-31 18:29 |
| | | * @LastEditTime 2024-01-31 18:29 |
| | | * @Description |
| | | */ |
| | | |
| | | @Data |
| | | @Schema(title = "电子钱包退款视图对象") |
| | | public class VoWalletRefund { |
| | | private static final long serialVersionUID = 202401311830001L; |
| | | |
| | | @Schema(title = "农户姓名") |
| | | private String name; |
| | | |
| | | @Schema(title = "农户编号") |
| | | private String clientNum; |
| | | |
| | | @Schema(title = "手机号") |
| | | private String phone; |
| | | |
| | | @Schema(title = "申请退款金额") |
| | | private Double refundAmount; |
| | | |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | @Schema(title = "申请时间") |
| | | private Date applicationTime; |
| | | |
| | | @Schema(title = "退款状态代码") |
| | | private Byte refundStatus; |
| | | |
| | | @Schema(title = "退款状态名称") |
| | | private String refundStatusName; |
| | | |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | @Schema(title = "审核时间") |
| | | private Date auditTime; |
| | | |
| | | @Schema(title = "审核备注") |
| | | private String remarks; |
| | | } |
| | |
| | | vct = #{vct,jdbcType=TIMESTAMP} |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | |
| | | <!--根据农户ID获取消费汇总记录--> |
| | | <select id="getWalletConsumeSum" resultType="java.util.Map"> |
| | | SELECT |
| | | cli.name AS clientName, |
| | | cli.clientNum, |
| | | wal.money, |
| | | (SELECT SUM(consumption) FROM se_consume WHERE client_id = cli.id) AS totalConsume |
| | | FROM se_client cli |
| | | INNER JOIN se_wallet wal ON wal.client_id = cli.id |
| | | <where> |
| | | <if test = "clientId != null and clientId > 0"> |
| | | AND cli.id = ${clientId} |
| | | </if> |
| | | </where> |
| | | |
| | | </select> |
| | | |
| | | <!--根据农户ID获取电子钱包消费记录数--> |
| | | <select id="getRecordCount" parameterType="java.util.Map" resultType="java.lang.Long"> |
| | | SELECT |
| | | COUNT(*) AS recordCount |
| | | FROM se_consume |
| | | <where> |
| | | <if test = "clientId != null and clientId > 0"> |
| | | AND client_id = ${clientId} |
| | | </if> |
| | | </where> |
| | | </select> |
| | | |
| | | <!--根据农户ID获取电子钱包消费记录--> |
| | | <select id="getWalletConsumes" resultType="com.dy.pipIrrGlobal.voSe.VoWalletConsume"> |
| | | SELECT |
| | | consumption, |
| | | duration, |
| | | vot, |
| | | vct |
| | | FROM se_consume |
| | | <where> |
| | | <if test = "clientId != null and clientId > 0"> |
| | | AND client_id = ${clientId} |
| | | </if> |
| | | </where> |
| | | ORDER BY vct 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> |
| | |
| | | from se_refund |
| | | where refund_status = 1 AND wallet_id = ${walletId} |
| | | </select> |
| | | |
| | | <!--根据指定条件获取电子钱包退款记录数--> |
| | | <select id="getRecordCount" parameterType="java.util.Map" resultType="java.lang.Long"> |
| | | SELECT |
| | | COUNT(*) AS recordCount |
| | | FROM se_refund ref |
| | | INNER JOIN se_client cli ON ref.client_id = cli.id |
| | | <where> |
| | | <if test = "refundStatus != null and refundStatus > 0"> |
| | | AND ref.refund_status = ${refundStatus} |
| | | </if> |
| | | |
| | | <if test = "clientName != null and clientName !=''"> |
| | | AND cli.name like CONCAT('%',#{clientName},'%') |
| | | </if> |
| | | </where> |
| | | </select> |
| | | |
| | | <!--根据指定条件获取电子钱包退款记录--> |
| | | <select id="getWalletRefunds" resultType="com.dy.pipIrrGlobal.voSe.VoWalletRefund"> |
| | | SELECT |
| | | cli.`name`, |
| | | cli.clientNum, |
| | | cli.phone, |
| | | ref.refund_amount AS refundAmount, |
| | | ref.application_time AS applicationTime, |
| | | ref.refund_status AS refundStatus, |
| | | (CASE |
| | | WHEN ref.refund_status = 1 THEN '未退款' |
| | | WHEN ref.refund_status = 2 THEN '已退款' |
| | | End) AS refundStatusName, |
| | | ref.audit_time AS auditTime, |
| | | ref.remarks |
| | | FROM se_refund ref |
| | | INNER JOIN se_client cli ON ref.client_id = cli.id |
| | | <where> |
| | | <if test = "refundStatus != null and refundStatus > 0"> |
| | | AND ref.refund_status = ${refundStatus} |
| | | </if> |
| | | |
| | | <if test = "clientName != null and clientName !=''"> |
| | | AND cli.name like CONCAT('%',#{clientName},'%') |
| | | </if> |
| | | </where> |
| | | ORDER BY ref.application_time 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> |
| | |
| | | WHERE client_id = ${clientId} |
| | | LIMIT 0,1 |
| | | </select> |
| | | |
| | | <!--根据农户姓名获取电子钱包账户记录数--> |
| | | <select id="getRecordCount" parameterType="java.util.Map" resultType="java.lang.Long"> |
| | | SELECT |
| | | COUNT(*) AS recordCount |
| | | FROM se_wallet wal |
| | | INNER JOIN se_client cli ON wal.client_id = cli.id |
| | | <where> |
| | | <if test = "clientName != null and clientName !=''"> |
| | | AND cli.name like CONCAT('%',#{clientName},'%') |
| | | </if> |
| | | </where> |
| | | </select> |
| | | |
| | | <!--根据农户姓名获取电子钱包账户记录--> |
| | | <select id="getWallets" resultType="com.dy.pipIrrGlobal.voSe.VoWallet"> |
| | | SELECT |
| | | CAST(cli.id AS char) AS clientId, |
| | | cli.`name`, |
| | | cli.clientNum, |
| | | cli.phone, |
| | | wal.money |
| | | FROM se_wallet wal |
| | | INNER JOIN se_client cli ON wal.client_id = cli.id |
| | | <where> |
| | | <if test = "clientName != null and clientName !=''"> |
| | | AND cli.name like CONCAT('%',#{clientName},'%') |
| | | </if> |
| | | </where> |
| | | ORDER BY wal.last_operate_time 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> |
| | |
| | | recharge_time = #{rechargeTime,jdbcType=TIMESTAMP} |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | |
| | | <!--根据指定条件获取电子钱包充值记录数--> |
| | | <select id="getRecordCount" parameterType="java.util.Map" resultType="java.lang.Long"> |
| | | SELECT |
| | | COUNT(*) AS recordCount |
| | | FROM se_wallet_recharge rec |
| | | INNER JOIN se_client cli ON rec.client_id = cli.id |
| | | <where> |
| | | <if test = "walletId != null and walletId > 0"> |
| | | AND rec.wallet_id = ${walletId} |
| | | </if> |
| | | |
| | | <if test = "clientName != null and clientName !=''"> |
| | | AND cli.name like CONCAT('%',#{clientName},'%') |
| | | </if> |
| | | |
| | | <if test = "timeStart != null and timeStop != null"> |
| | | AND rec.recharge_time BETWEEN #{timeStart} AND #{timeStop} |
| | | </if> |
| | | </where> |
| | | </select> |
| | | |
| | | <!--根据指定条件获取电子钱包充值记录--> |
| | | <select id="getWalletRecharges" resultType="com.dy.pipIrrGlobal.voSe.VoWalletRecharge"> |
| | | SELECT |
| | | cli.`name`, |
| | | cli.clientNum, |
| | | cli.phone, |
| | | rec.amount, |
| | | rec.after_recharge AS afterRecharge, |
| | | rec.recharge_time AS rechargeTime |
| | | FROM se_wallet_recharge rec |
| | | INNER JOIN se_client cli ON rec.client_id = cli.id |
| | | <where> |
| | | <if test = "walletId != null and walletId > 0"> |
| | | AND rec.wallet_id = ${walletId} |
| | | </if> |
| | | |
| | | <if test = "clientName != null and clientName !=''"> |
| | | AND cli.name like CONCAT('%',#{clientName},'%') |
| | | </if> |
| | | |
| | | <if test = "timeStart != null and timeStop != null"> |
| | | AND rec.recharge_time BETWEEN #{timeStart} AND #{timeStop} |
| | | </if> |
| | | </where> |
| | | ORDER BY rec.recharge_time 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> |
| | |
| | | REFUND_AMOUNT_CANNOT_GREATER_THAN_MONEY(90009, "申请退款失败,退款金额不能大于余额"), |
| | | APPLICATION_REFUND_FAIL(900010, "申请退款失败"), |
| | | NO_TO_AUDIT_REFUND(900011, "该电子钱包没有待审核的退款申请"), |
| | | AUDIT_REFUND_FAIL(900012, "审核退款申请失败"); |
| | | AUDIT_REFUND_FAIL(900012, "审核退款申请失败"), |
| | | No_WALLER_RECHARGES(900013, "没有符合条件的充值数据"), |
| | | WALLET_CLIENT_ID_CANNOT_BE_NULL(900014, "查询电子钱包消费汇总失败,农户ID不能为空"), |
| | | No_REFUNDS(900015, "没有符合条件的退款数据"); |
| | | |
| | | private final Integer code; |
| | | private final String message; |
| | |
| | | import com.dy.common.aop.SsoAop; |
| | | import com.dy.common.webUtil.BaseResponse; |
| | | import com.dy.common.webUtil.BaseResponseUtils; |
| | | import com.dy.common.webUtil.QueryResultVo; |
| | | import com.dy.common.webUtil.ResultCodeMsg; |
| | | import com.dy.pipIrrGlobal.pojoSe.SeConsume; |
| | | import com.dy.pipIrrGlobal.pojoSe.SeRefund; |
| | | import com.dy.pipIrrGlobal.pojoSe.SeWallet; |
| | | import com.dy.pipIrrGlobal.pojoSe.SeWalletRecharge; |
| | | import com.dy.pipIrrGlobal.voSe.VoActiveCard; |
| | | import com.dy.pipIrrGlobal.voSe.VoWallet; |
| | | import com.dy.pipIrrGlobal.voSe.VoWalletRecharge; |
| | | import com.dy.pipIrrGlobal.voSe.VoWalletRefund; |
| | | import com.dy.pipIrrSell.result.SellResultCode; |
| | | import com.dy.pipIrrSell.wallet.enums.LastOperateENUM; |
| | | import com.dy.pipIrrSell.wallet.enums.RefundStatusENUM; |
| | | import com.dy.pipIrrSell.wallet.qo.QoWalletRecharge; |
| | | import com.dy.pipIrrSell.wallet.qo.QueryVo; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.media.Content; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.text.DecimalFormat; |
| | | import java.util.Date; |
| | | import java.util.Optional; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | |
| | | } |
| | | return BaseResponseUtils.buildSuccess(true) ; |
| | | } |
| | | |
| | | /** |
| | | * 根据农户姓名获取电子钱包账户记录 |
| | | * @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 = VoActiveCard.class))} |
| | | ) |
| | | }) |
| | | @GetMapping(path = "/get_wallets") |
| | | @SsoAop() |
| | | public BaseResponse<QueryResultVo<List<VoWallet>>> getWallets(QueryVo vo){ |
| | | try { |
| | | QueryResultVo<List<VoWallet>> res = walletSv.getWallets(vo); |
| | | if(res.itemTotal == 0) { |
| | | return BaseResponseUtils.buildFail(SellResultCode.No_ReissueCards.getMessage()); |
| | | } |
| | | 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 = VoActiveCard.class))} |
| | | ) |
| | | }) |
| | | @GetMapping(path = "/get_recharges") |
| | | @SsoAop() |
| | | public BaseResponse<QueryResultVo<List<VoWalletRecharge>>> getWalletRecharges(QoWalletRecharge vo){ |
| | | try { |
| | | QueryResultVo<List<VoWalletRecharge>> res = walletSv.getWalletRecharges(vo); |
| | | if(res.itemTotal == 0) { |
| | | return BaseResponseUtils.buildFail(SellResultCode.No_WALLER_RECHARGES.getMessage()); |
| | | } |
| | | 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 = VoActiveCard.class))} |
| | | ) |
| | | }) |
| | | @GetMapping(path = "/get_consume") |
| | | @SsoAop() |
| | | public BaseResponse<Map> getWalletConsumes(QueryVo vo){ |
| | | Long clientId = Optional.ofNullable(vo.getClientId()).orElse(0L); |
| | | if(clientId == 0) { |
| | | return BaseResponseUtils.buildFail(SellResultCode.WALLET_CLIENT_ID_CANNOT_BE_NULL.getMessage()); |
| | | } |
| | | try { |
| | | Map res = Optional.ofNullable(walletSv.getWalletConsumes(vo)).orElse(new HashMap()); |
| | | if(res.size() <= 0) { |
| | | return BaseResponseUtils.buildFail(SellResultCode.No_WALLER_RECHARGES.getMessage()); |
| | | } |
| | | 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 = VoActiveCard.class))} |
| | | ) |
| | | }) |
| | | @GetMapping(path = "/get_refunds") |
| | | @SsoAop() |
| | | public BaseResponse<QueryResultVo<List<VoWalletRefund>>> getWalletRefunds(QueryVo vo){ |
| | | try { |
| | | QueryResultVo<List<VoWalletRefund>> res = walletSv.getWalletRefunds(vo); |
| | | if(res.itemTotal == 0) { |
| | | return BaseResponseUtils.buildFail(SellResultCode.No_REFUNDS.getMessage()); |
| | | } |
| | | return BaseResponseUtils.buildSuccess(res); |
| | | } catch (Exception e) { |
| | | log.error("获取电子钱包退款记录异常", e); |
| | | return BaseResponseUtils.buildException(e.getMessage()) ; |
| | | } |
| | | } |
| | | } |
| | |
| | | package com.dy.pipIrrSell.wallet; |
| | | |
| | | import com.dy.common.webUtil.QueryResultVo; |
| | | import com.dy.pipIrrGlobal.daoSe.SeConsumeMapper; |
| | | import com.dy.pipIrrGlobal.daoSe.SeRefundMapper; |
| | | import com.dy.pipIrrGlobal.daoSe.SeWalletMapper; |
| | |
| | | import com.dy.pipIrrGlobal.pojoSe.SeRefund; |
| | | import com.dy.pipIrrGlobal.pojoSe.SeWallet; |
| | | import com.dy.pipIrrGlobal.pojoSe.SeWalletRecharge; |
| | | import com.dy.pipIrrGlobal.voSe.VoWallet; |
| | | import com.dy.pipIrrGlobal.voSe.VoWalletConsume; |
| | | import com.dy.pipIrrGlobal.voSe.VoWalletRecharge; |
| | | import com.dy.pipIrrGlobal.voSe.VoWalletRefund; |
| | | import com.dy.pipIrrSell.wallet.qo.QueryVo; |
| | | import com.dy.pipIrrSell.wallet.qo.QoWalletRecharge; |
| | | 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 |
| | |
| | | return seWalletMapper.updateByPrimaryKeySelective(po); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 根据农户姓名获取电子钱包账户记录 |
| | | * @param queryVo |
| | | * @return |
| | | */ |
| | | public QueryResultVo<List<VoWallet>> getWallets(QueryVo queryVo) { |
| | | Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(queryVo); |
| | | |
| | | Long itemTotal = seWalletMapper.getRecordCount(params); |
| | | |
| | | QueryResultVo<List<VoWallet>> rsVo = new QueryResultVo<>() ; |
| | | rsVo.pageSize = queryVo.pageSize ; |
| | | rsVo.pageCurr = queryVo.pageCurr ; |
| | | |
| | | rsVo.calculateAndSet(itemTotal, params); |
| | | rsVo.obj = seWalletMapper.getWallets(params); |
| | | return rsVo ; |
| | | } |
| | | |
| | | /** |
| | | * 根据指定条件获取电子钱包充值记录 |
| | | * @param queryVo |
| | | * @return |
| | | */ |
| | | public QueryResultVo<List<VoWalletRecharge>> getWalletRecharges(QoWalletRecharge queryVo) { |
| | | //完善查询充值记录的起止时间 |
| | | String timeStart = queryVo.getTimeStart(); |
| | | String timeStop = queryVo.getTimeStop(); |
| | | if(timeStart != null) { |
| | | timeStart = timeStart + " 00:00:00"; |
| | | queryVo.setTimeStart(timeStart); |
| | | } |
| | | if(timeStop != null) { |
| | | timeStop = timeStop + " 23:59:59"; |
| | | queryVo.setTimeStop(timeStop); |
| | | } |
| | | |
| | | Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(queryVo); |
| | | |
| | | Long itemTotal = seWalletRechargeMapper.getRecordCount(params); |
| | | |
| | | QueryResultVo<List<VoWalletRecharge>> rsVo = new QueryResultVo<>() ; |
| | | rsVo.pageSize = queryVo.pageSize ; |
| | | rsVo.pageCurr = queryVo.pageCurr ; |
| | | |
| | | rsVo.calculateAndSet(itemTotal, params); |
| | | rsVo.obj = seWalletRechargeMapper.getWalletRecharges(params); |
| | | return rsVo ; |
| | | } |
| | | |
| | | /** |
| | | * 根据农户ID获取电子钱包消费记录 |
| | | * @param queryVo |
| | | * @return |
| | | */ |
| | | public Map getWalletConsumes(QueryVo queryVo) { |
| | | // 获取电子钱包消费汇总信息 |
| | | String clientName = ""; |
| | | String clientNum = ""; |
| | | Double money = 0.0; |
| | | Double totalConsume = 0.0; |
| | | Long clientId = Optional.ofNullable(queryVo.getClientId()).orElse(0L); |
| | | Map map_consumeSum = Optional.ofNullable(seConsumeMapper.getWalletConsumeSum(clientId)).orElse(new HashMap()); |
| | | if(map_consumeSum.size() > 0) { |
| | | clientName = map_consumeSum.get("clientName").toString(); |
| | | clientNum = map_consumeSum.get("clientNum").toString(); |
| | | money = Double.parseDouble(map_consumeSum.get("money").toString()); |
| | | totalConsume = Double.parseDouble(map_consumeSum.get("totalConsume").toString()); |
| | | } |
| | | |
| | | Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(queryVo); |
| | | Long itemTotal = seConsumeMapper.getRecordCount(params); |
| | | |
| | | QueryResultVo<List<VoWalletConsume>> rsVo = new QueryResultVo<>() ; |
| | | rsVo.pageSize = queryVo.pageSize ; |
| | | rsVo.pageCurr = queryVo.pageCurr ; |
| | | |
| | | rsVo.calculateAndSet(itemTotal, params); |
| | | List<VoWalletConsume> list = seConsumeMapper.getWalletConsumes(params); |
| | | |
| | | |
| | | Map map_record = new HashMap(); |
| | | map_record.put("itemTotal", rsVo.itemTotal); |
| | | map_record.put("pageCurr", rsVo.pageCurr); |
| | | map_record.put("pageSize", rsVo.pageSize); |
| | | map_record.put("pageTotal", rsVo.pageTotal); |
| | | map_record.put("list", list); |
| | | |
| | | Map map_result = new HashMap(); |
| | | map_result.put("clientName", clientName); |
| | | map_result.put("clientNum", clientNum); |
| | | map_result.put("money", money); |
| | | map_result.put("totalConsume", totalConsume); |
| | | map_result.put("records", map_record); |
| | | |
| | | return map_result; |
| | | } |
| | | |
| | | /** |
| | | * 根据指定条件获取电子钱包退款记录 |
| | | * @param queryVo |
| | | * @return |
| | | */ |
| | | public QueryResultVo<List<VoWalletRefund>> getWalletRefunds(QueryVo queryVo) { |
| | | Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(queryVo); |
| | | |
| | | Long itemTotal = seRefundMapper.getRecordCount(params); |
| | | |
| | | QueryResultVo<List<VoWalletRefund>> rsVo = new QueryResultVo<>() ; |
| | | rsVo.pageSize = queryVo.pageSize ; |
| | | rsVo.pageCurr = queryVo.pageCurr ; |
| | | |
| | | rsVo.calculateAndSet(itemTotal, params); |
| | | rsVo.obj = seRefundMapper.getWalletRefunds(params); |
| | | return rsVo ; |
| | | } |
| | | } |
New file |
| | |
| | | package com.dy.pipIrrSell.wallet.qo; |
| | | |
| | | import com.dy.common.webUtil.QueryConditionVo; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2024-01-31 19:27 |
| | | * @LastEditTime 2024-01-31 19:27 |
| | | * @Description |
| | | */ |
| | | |
| | | @Data |
| | | @Schema(name = "电子钱包充值查询条件") |
| | | public class QoWalletRecharge extends QueryConditionVo { |
| | | @Schema(description = "电子钱包账户ID") |
| | | public Long walletId; |
| | | |
| | | @Schema(description = "农户姓名") |
| | | public String clientName; |
| | | |
| | | @Schema(description = "充值机时间_开始") |
| | | public String timeStart; |
| | | |
| | | @Schema(description = "充值机时间_结束") |
| | | public String timeStop; |
| | | } |
New file |
| | |
| | | package com.dy.pipIrrSell.wallet.qo; |
| | | |
| | | import com.dy.common.webUtil.QueryConditionVo; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2024-01-31 19:21 |
| | | * @LastEditTime 2024-01-31 19:21 |
| | | * @Description |
| | | */ |
| | | |
| | | @Data |
| | | @Schema(name = "电子钱包账户查询条件") |
| | | public class QueryVo extends QueryConditionVo { |
| | | @Schema(description = "农户姓名") |
| | | public String clientName; |
| | | |
| | | @Schema(description = "农户ID") |
| | | public Long clientId; |
| | | |
| | | @Schema(description = "退款状态") |
| | | public Integer refundStatus; |
| | | } |