Administrator
2024-01-31 ab37d7d33e2484ee97a602f348ab475101389149
2024-01-31 朱宝民 电子钱包4个查询接口
11个文件已修改
6个文件已添加
746 ■■■■■ 已修改文件
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSe/SeConsumeMapper.java 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSe/SeRefundMapper.java 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSe/SeWalletMapper.java 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSe/SeWalletRechargeMapper.java 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSe/VoWallet.java 33 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSe/VoWalletConsume.java 37 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSe/VoWalletRecharge.java 41 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSe/VoWalletRefund.java 52 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeConsumeMapper.xml 50 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeRefundMapper.xml 51 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeWalletMapper.xml 36 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeWalletRechargeMapper.xml 53 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/result/SellResultCode.java 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wallet/WalletCtrl.java 125 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wallet/WalletSv.java 130 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wallet/qo/QoWalletRecharge.java 28 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wallet/qo/QueryVo.java 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSe/SeConsumeMapper.java
@@ -2,7 +2,12 @@
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
@@ -24,4 +29,25 @@
    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);
}
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSe/SeRefundMapper.java
@@ -2,8 +2,12 @@
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
@@ -32,4 +36,18 @@
     * @return
     */
    SeRefund getRefundByWallerId(@Param("walletId") Long walletId);
    /**
     * 根据指定条件获取电子钱包退款记录数
     * @param params
     * @return
     */
    Long getRecordCount(Map<?, ?> params);
    /***
     * 根据指定条件获取电子钱包退款记录
     * @param params
     * @return
     */
    List<VoWalletRefund> getWalletRefunds(Map<?, ?> params);
}
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSe/SeWalletMapper.java
@@ -2,8 +2,12 @@
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
@@ -32,4 +36,18 @@
     * @return
     */
    SeWallet getWalletByClientId(@Param("clientId") Long clientId);
    /**
     * 根据农户姓名获取电子钱包账户记录数
     * @param params
     * @return
     */
    Long getRecordCount(Map<?, ?> params);
    /***
     * 根据农户姓名获取电子钱包账户记录
     * @param params
     * @return
     */
    List<VoWallet> getWallets(Map<?, ?> params);
}
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSe/SeWalletRechargeMapper.java
@@ -2,7 +2,11 @@
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
@@ -24,4 +28,18 @@
    int updateByPrimaryKeySelective(SeWalletRecharge record);
    int updateByPrimaryKey(SeWalletRecharge record);
    /**
     * 根据指定条件获取电子钱包充值记录数
     * @param params
     * @return
     */
    Long getRecordCount(Map<?, ?> params);
    /***
     * 根据指定条件获取电子钱包充值记录
     * @param params
     * @return
     */
    List<VoWalletRecharge> getWalletRecharges(Map<?, ?> params);
}
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSe/VoWallet.java
New file
@@ -0,0 +1,33 @@
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;
}
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSe/VoWalletConsume.java
New file
@@ -0,0 +1,37 @@
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;
}
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSe/VoWalletRecharge.java
New file
@@ -0,0 +1,41 @@
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;
}
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSe/VoWalletRefund.java
New file
@@ -0,0 +1,52 @@
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;
}
pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeConsumeMapper.xml
@@ -147,4 +147,54 @@
      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>
pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeRefundMapper.xml
@@ -178,4 +178,55 @@
    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>
pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeWalletMapper.xml
@@ -121,4 +121,40 @@
    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>
pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeWalletRechargeMapper.xml
@@ -123,4 +123,57 @@
      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>
pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/result/SellResultCode.java
@@ -89,7 +89,10 @@
    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;
pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wallet/WalletCtrl.java
@@ -3,14 +3,21 @@
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;
@@ -28,8 +35,7 @@
import org.springframework.web.bind.annotation.*;
import java.text.DecimalFormat;
import java.util.Date;
import java.util.Optional;
import java.util.*;
/**
 * @author ZhuBaoMin
@@ -326,4 +332,119 @@
        }
        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()) ;
        }
    }
}
pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wallet/WalletSv.java
@@ -1,5 +1,6 @@
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;
@@ -8,9 +9,21 @@
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
@@ -111,4 +124,121 @@
        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 ;
    }
}
pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wallet/qo/QoWalletRecharge.java
New file
@@ -0,0 +1,28 @@
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;
}
pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wallet/qo/QueryVo.java
New file
@@ -0,0 +1,25 @@
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;
}