Administrator
2024-01-31 742e0a8ec019ccb76f03fcc58859ed15e9264c4c
2024-01-31 朱宝民 电子钱包账户注册接口、充值接口
8个文件已添加
9个文件已修改
3个文件已删除
1423 ■■■■■ 已修改文件
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSe/SeConsumeMapper.java 27 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSe/SeRefundMapper.java 27 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSe/SeWalletMapper.java 16 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSe/SeWalletRechargeHistoryMapper.java 27 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSe/SeWalletRechargeMapper.java 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoSe/SeConsume.java 97 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoSe/SeRefund.java 113 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoSe/SeWallet.java 65 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoSe/SeWalletRecharge.java 89 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoSe/SeWalletRechargeHistory.java 54 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeConsumeMapper.xml 150 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeRefundMapper.xml 173 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeWalletMapper.xml 74 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeWalletRechargeHistoryMapper.xml 137 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeWalletRechargeMapper.xml 89 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/result/SellResultCode.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wallet/LastOperateENUM.java 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wallet/WalletCtrl.java 129 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wallet/WalletSv.java 77 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wallet/dto/DtoRecharge.java 36 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSe/SeConsumeMapper.java
New file
@@ -0,0 +1,27 @@
package com.dy.pipIrrGlobal.daoSe;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.dy.pipIrrGlobal.pojoSe.SeConsume;
import org.apache.ibatis.annotations.Mapper;
/**
 * @author ZhuBaoMin
 * @date 2024-01-30 15:44
 * @LastEditTime 2024-01-30 15:44
 * @Description 电子钱包消费Mapper接口
 */
@Mapper
public interface SeConsumeMapper extends BaseMapper {
    int deleteByPrimaryKey(Long id);
    int insert(SeConsume record);
    int insertSelective(SeConsume record);
    SeConsume selectByPrimaryKey(Long id);
    int updateByPrimaryKeySelective(SeConsume record);
    int updateByPrimaryKey(SeConsume record);
}
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSe/SeRefundMapper.java
New file
@@ -0,0 +1,27 @@
package com.dy.pipIrrGlobal.daoSe;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.dy.pipIrrGlobal.pojoSe.SeRefund;
import org.apache.ibatis.annotations.Mapper;
/**
 * @author ZhuBaoMin
 * @date 2024-01-30 15:45
 * @LastEditTime 2024-01-30 15:45
 * @Description 电子钱包退款Mapper接口
 */
@Mapper
public interface SeRefundMapper  extends BaseMapper {
    int deleteByPrimaryKey(Long id);
    int insert(SeRefund record);
    int insertSelective(SeRefund record);
    SeRefund selectByPrimaryKey(Long id);
    int updateByPrimaryKeySelective(SeRefund record);
    int updateByPrimaryKey(SeRefund record);
}
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSe/SeWalletMapper.java
@@ -3,16 +3,17 @@
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.dy.pipIrrGlobal.pojoSe.SeWallet;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/**
 * @author ZhuBaoMin
 * @date 2023/12/11 16:29
 * @LastEditTime 2023/12/11 16:29
 * @Description
 * @date 2024-01-30 15:41
 * @LastEditTime 2024-01-30 15:41
 * @Description 电子钱包Mapper接口
 */
@Mapper
public interface SeWalletMapper extends BaseMapper<SeWallet> {
public interface SeWalletMapper extends BaseMapper {
    int deleteByPrimaryKey(Long id);
    int insert(SeWallet record);
@@ -24,4 +25,11 @@
    int updateByPrimaryKeySelective(SeWallet record);
    int updateByPrimaryKey(SeWallet record);
    /**
     * 根据农户ID获取电子钱包对象
     * @param clientId
     * @return
     */
    SeWallet getWalletByClientId(@Param("clientId") Long clientId);
}
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSe/SeWalletRechargeHistoryMapper.java
File was deleted
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSe/SeWalletRechargeMapper.java
@@ -6,13 +6,13 @@
/**
 * @author ZhuBaoMin
 * @date 2023/12/12 9:06
 * @LastEditTime 2023/12/12 9:06
 * @Description
 * @date 2024-01-30 15:44
 * @LastEditTime 2024-01-30 15:44
 * @Description 电子钱包充值Mapper接口
 */
@Mapper
public interface SeWalletRechargeMapper extends BaseMapper<SeWalletRecharge> {
public interface SeWalletRechargeMapper extends BaseMapper {
    int deleteByPrimaryKey(Long id);
    int insert(SeWalletRecharge record);
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoSe/SeConsume.java
New file
@@ -0,0 +1,97 @@
package com.dy.pipIrrGlobal.pojoSe;
import com.alibaba.fastjson2.annotation.JSONField;
import com.alibaba.fastjson2.writer.ObjectWriterImplToString;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.dy.common.po.BaseEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.Min;
import jakarta.validation.constraints.NotNull;
import lombok.*;
import java.util.Date;
/**
 * @author ZhuBaoMin
 * @date 2024-01-30 15:44
 * @LastEditTime 2024-01-30 15:44
 * @Description 电子钱包消费实体
 */
@TableName(value="se_consume", autoResultMap = true)
@Data
@Builder
@ToString
@NoArgsConstructor
@AllArgsConstructor
@Schema(name = "电子钱包消费实体")
public class SeConsume implements BaseEntity {
    public static final long serialVersionUID = 202401301552003L;
    /**
    * 主键
    */
    @JSONField(serializeUsing= ObjectWriterImplToString.class)
    @TableId(type = IdType.INPUT)
    @Schema(description = "实体id", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
    private Long id;
    /**
    * 钱包ID
    */
    @Schema(description = "钱包ID", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
    @NotNull(message = "钱包ID不能为空")
    private Long walletId;
    /**
    * 农户ID
    */
    @Schema(description = "农户ID", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
    @NotNull(message = "农户ID不能为空")
    private Long clientId;
    /**
    * 钱包余额
    */
    @Schema(description = "钱包余额", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
    @Min(value = 0, message = "钱包余额不能小于0")
    private Double money;
    /**
    * 消费金额
    */
    @Schema(description = "消费金额", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
    @Min(value = 0, message = "消费金额不能小于0")
    @NotNull(message = "消费金额不能为空")
    private Double consumption;
    /**
    * 消费后余额
    */
    @Schema(description = "消费后余额", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
    @Min(value = 0, message = "消费后余额不能小于0")
    private Double afterConsume;
    /**
    * 用水时长
    */
    @Schema(description = "用水时长", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
    @Min(value = 0, message = "用水时长不能小于0")
    private Double duration;
    /**
    * 开阀时间
    */
    @Schema(description = "开阀时间", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
    @NotNull(message = "开阀时间不能为空")
    private Date vot;
    /**
    * 关阀时间
    */
    @Schema(description = "关阀时间", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
    @NotNull(message = "关阀时间不能为空")
    private Date vct;
}
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoSe/SeRefund.java
New file
@@ -0,0 +1,113 @@
package com.dy.pipIrrGlobal.pojoSe;
import com.alibaba.fastjson2.annotation.JSONField;
import com.alibaba.fastjson2.writer.ObjectWriterImplToString;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.dy.common.po.BaseEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.Max;
import jakarta.validation.constraints.Min;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Positive;
import lombok.*;
import org.hibernate.validator.constraints.Length;
import java.util.Date;
/**
 * @author ZhuBaoMin
 * @date 2024-01-30 15:45
 * @LastEditTime 2024-01-30 15:45
 * @Description 电子钱包退款实体
 */
@TableName(value="se_refund", autoResultMap = true)
@Data
@Builder
@ToString
@NoArgsConstructor
@AllArgsConstructor
@Schema(name = "电子钱包退款实体")
public class SeRefund implements BaseEntity {
    public static final long serialVersionUID = 202401301552004L;
    /**
    * 主键
    */
    @JSONField(serializeUsing= ObjectWriterImplToString.class)
    @TableId(type = IdType.INPUT)
    @Schema(description = "实体id", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
    private Long id;
    /**
    * 钱包ID
    */
    @Schema(description = "钱包ID", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
    @NotNull(message = "钱包ID不能为空")
    private Long walletId;
    /**
    * 农户ID
    */
    @Schema(description = "农户ID", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
    @NotNull(message = "农户ID不能为空")
    private Long clientId;
    /**
    * 钱包余额
    */
    @Schema(description = "钱包余额", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
    @Min(value = 0, message = "钱包余额不能小于0")
    private Double money;
    /**
    * 退款金额
    */
    @Schema(description = "退款金额", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
    @Min(value = 0, message = "消退款金额不能小于0")
    @NotNull(message = "退款金额不能为空")
    private Double refundAmount;
    /**
    * 退款后余额
    */
    @Schema(description = "退款后余额", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
    @Min(value = 0, message = "退款后余额不能小于0")
    private Double afterRefund;
    /**
    * 申请时间
    */
    @Schema(description = "申请时间", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
    private Date applicationTime;
    /**
    * 退款状态;1-未退款,2-已退款
    */
    @Schema(description = "退款状态", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
    @Min(value = 1, message = "退款状态不能小于1")
    @Max(value = 2, message = "退款状态不能大于2")
    private Byte refundStatus;
    /**
    * 审核人
    */
    @Schema(description = "操作人ID", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
    @Positive(message = "操作人ID必须为大于0的整数")
    private Long auditor;
    /**
    * 审核时间
    */
    @Schema(description = "审核时间", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
    private Date auditTime;
    /**
    * 审核备注
    */
    @Schema(description = "备注", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
    @Length(message = "备注长度小于{max}字", min = 1, max = 200)
    private String remarks;
}
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoSe/SeWallet.java
@@ -7,21 +7,18 @@
import com.baomidou.mybatisplus.annotation.TableName;
import com.dy.common.po.BaseEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.Positive;
import jakarta.validation.constraints.Max;
import jakarta.validation.constraints.Min;
import jakarta.validation.constraints.NotNull;
import lombok.*;
import org.hibernate.validator.constraints.Length;
import java.util.Date;
/**
 * @author ZhuBaoMin
 * @date 2023/12/11 16:29
 * @LastEditTime 2023/12/11 16:29
 * @Description
 */
/**
 * 电子钱包表
 * @date 2024-01-30 15:41
 * @LastEditTime 2024-01-30 15:41
 * @Description 电子钱包账户实体
 */
@TableName(value="se_wallet", autoResultMap = true)
@@ -30,36 +27,50 @@
@ToString
@NoArgsConstructor
@AllArgsConstructor
@Schema(name = "电子钱包表实体")
@Schema(name = "电子钱包账户实体")
public class SeWallet implements BaseEntity {
    public static final long serialVersionUID = 202401151519005L;
    public static final long serialVersionUID = 202401301552001L;
    /**
    * 主键
    */
     * 主键
     */
    @JSONField(serializeUsing= ObjectWriterImplToString.class)
    @TableId(type = IdType.INPUT)
    @Schema(description = "实体id", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
    @Positive(message = "主键必须为大于0的整数")
    private Long id;
    /**
    * 用水户编号
    */
    @Schema(description = "农户编号", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
    @Length(message = "农户编号不小于{min}", min = 1)
    private Long clientid;
     * 农户ID
     */
    @Schema(description = "农户ID", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
    @NotNull(message = "农户ID不能为空")
    private Long clientId;
    /**
    * 钱包余额
    */
    @Schema(description = "钱包余额", requiredMode = Schema.RequiredMode.REQUIRED)
    @Length(message = "钱包余额不小于{min}", min = 0)
    private Float money;
     * 钱包余额
     */
    @Schema(description = "钱包余额", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
    @Min(value = 0, message = "钱包余额不能小于0")
    private Double money;
    /**
    * 创建时间
    */
     * 最后操作;1-开户,2-充值,3-消费,4-申请退款,5-退款审核
     */
    @Schema(description = "操作类型", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
    @Min(value = 1, message = "最后操作不能小于1")
    @Max(value = 5, message = "最后操作不能大于5")
    private Byte lastOperate;
    /**
     * 最后操作时间
     */
    @Schema(description = "最后操作时间", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
    private Date lastOperateTime;
    /**
     * 创建时间
     */
    @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
    private Date createdt;
    private Date createTime;
}
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoSe/SeWalletRecharge.java
@@ -1,55 +1,82 @@
package com.dy.pipIrrGlobal.pojoSe;
import com.alibaba.fastjson2.annotation.JSONField;
import com.alibaba.fastjson2.writer.ObjectWriterImplToString;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.dy.common.po.BaseEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.Min;
import jakarta.validation.constraints.NotNull;
import lombok.*;
import java.util.Date;
/**
 * @author ZhuBaoMin
 * @date 2023/12/12 9:06
 * @LastEditTime 2023/12/12 9:06
 * @Description
 * @date 2024-01-30 15:44
 * @LastEditTime 2024-01-30 15:44
 * @Description 电子钱包充值实体
 */
/**
    * 电子钱包充值表
    */
public class SeWalletRecharge {
@TableName(value="se_wallet_recharge", autoResultMap = true)
@Data
@Builder
@ToString
@NoArgsConstructor
@AllArgsConstructor
@Schema(name = "电子钱包充值实体")
public class SeWalletRecharge implements BaseEntity {
    public static final long serialVersionUID = 202401301552002L;
    /**
    * 主键
    */
     * 主键
     */
    @JSONField(serializeUsing= ObjectWriterImplToString.class)
    @TableId(type = IdType.INPUT)
    @Schema(description = "实体id", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
    private Long id;
    /**
    * 钱包编号
    */
    private Long walletid;
     * 钱包ID
     */
    @Schema(description = "钱包ID", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
    @NotNull(message = "钱包ID不能为空")
    private Long walletId;
    /**
    * 农户编号
    */
    private Long clientid;
     * 农户ID
     */
    @Schema(description = "农户ID", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
    @NotNull(message = "农户ID不能为空")
    private Long clientId;
    /**
    * 钱包余额
    */
     * 钱包余额
     */
    @Schema(description = "钱包余额", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
    @Min(value = 0, message = "钱包余额不能小于0")
    private Double money;
    /**
    * 充值金额
    */
     * 充值金额
     */
    @Schema(description = "充值金额", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
    @Min(value = 0, message = "钱包余额不能小于0")
    @NotNull(message = "充值金额不能为空")
    private Double amount;
    /**
    * 充值后余额
    */
    private Double afterrecharge;
     * 充值后余额
     */
    @Schema(description = "充值后余额", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
    @Min(value = 0, message = "钱包余额不能小于0")
    private Double afterRecharge;
    /**
    * 充值时间
    */
    private Date rechargedt;
    /**
    * 备注信息
    */
    private String remarks;
     * 充值时间
     */
    @Schema(description = "充值时间", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
    private Date rechargeTime;
}
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoSe/SeWalletRechargeHistory.java
File was deleted
pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeConsumeMapper.xml
New file
@@ -0,0 +1,150 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.dy.pipIrrGlobal.daoSe.SeConsumeMapper">
  <resultMap id="BaseResultMap" type="com.dy.pipIrrGlobal.pojoSe.SeConsume">
    <!--@mbg.generated-->
    <!--@Table se_consume-->
    <id column="id" jdbcType="BIGINT" property="id" />
    <result column="wallet_id" jdbcType="BIGINT" property="walletId" />
    <result column="client_id" jdbcType="BIGINT" property="clientId" />
    <result column="money" jdbcType="FLOAT" property="money" />
    <result column="consumption" jdbcType="FLOAT" property="consumption" />
    <result column="after_consume" jdbcType="FLOAT" property="afterConsume" />
    <result column="duration" jdbcType="FLOAT" property="duration" />
    <result column="vot" jdbcType="TIMESTAMP" property="vot" />
    <result column="vct" jdbcType="TIMESTAMP" property="vct" />
  </resultMap>
  <sql id="Base_Column_List">
    <!--@mbg.generated-->
    id, wallet_id, client_id, money, consumption, after_consume, duration, vot, vct
  </sql>
  <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
    <!--@mbg.generated-->
    select
    <include refid="Base_Column_List" />
    from se_consume
    where id = #{id,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
    <!--@mbg.generated-->
    delete from se_consume
    where id = #{id,jdbcType=BIGINT}
  </delete>
  <insert id="insert" parameterType="com.dy.pipIrrGlobal.pojoSe.SeConsume">
    <!--@mbg.generated-->
    insert into se_consume (id, wallet_id, client_id,
      money, consumption, after_consume,
      duration, vot, vct
      )
    values (#{id,jdbcType=BIGINT}, #{walletId,jdbcType=BIGINT}, #{clientId,jdbcType=BIGINT},
      #{money,jdbcType=FLOAT}, #{consumption,jdbcType=FLOAT}, #{afterConsume,jdbcType=FLOAT},
      #{duration,jdbcType=FLOAT}, #{vot,jdbcType=TIMESTAMP}, #{vct,jdbcType=TIMESTAMP}
      )
  </insert>
  <insert id="insertSelective" parameterType="com.dy.pipIrrGlobal.pojoSe.SeConsume">
    <!--@mbg.generated-->
    insert into se_consume
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        id,
      </if>
      <if test="walletId != null">
        wallet_id,
      </if>
      <if test="clientId != null">
        client_id,
      </if>
      <if test="money != null">
        money,
      </if>
      <if test="consumption != null">
        consumption,
      </if>
      <if test="afterConsume != null">
        after_consume,
      </if>
      <if test="duration != null">
        duration,
      </if>
      <if test="vot != null">
        vot,
      </if>
      <if test="vct != null">
        vct,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="id != null">
        #{id,jdbcType=BIGINT},
      </if>
      <if test="walletId != null">
        #{walletId,jdbcType=BIGINT},
      </if>
      <if test="clientId != null">
        #{clientId,jdbcType=BIGINT},
      </if>
      <if test="money != null">
        #{money,jdbcType=FLOAT},
      </if>
      <if test="consumption != null">
        #{consumption,jdbcType=FLOAT},
      </if>
      <if test="afterConsume != null">
        #{afterConsume,jdbcType=FLOAT},
      </if>
      <if test="duration != null">
        #{duration,jdbcType=FLOAT},
      </if>
      <if test="vot != null">
        #{vot,jdbcType=TIMESTAMP},
      </if>
      <if test="vct != null">
        #{vct,jdbcType=TIMESTAMP},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.dy.pipIrrGlobal.pojoSe.SeConsume">
    <!--@mbg.generated-->
    update se_consume
    <set>
      <if test="walletId != null">
        wallet_id = #{walletId,jdbcType=BIGINT},
      </if>
      <if test="clientId != null">
        client_id = #{clientId,jdbcType=BIGINT},
      </if>
      <if test="money != null">
        money = #{money,jdbcType=FLOAT},
      </if>
      <if test="consumption != null">
        consumption = #{consumption,jdbcType=FLOAT},
      </if>
      <if test="afterConsume != null">
        after_consume = #{afterConsume,jdbcType=FLOAT},
      </if>
      <if test="duration != null">
        duration = #{duration,jdbcType=FLOAT},
      </if>
      <if test="vot != null">
        vot = #{vot,jdbcType=TIMESTAMP},
      </if>
      <if test="vct != null">
        vct = #{vct,jdbcType=TIMESTAMP},
      </if>
    </set>
    where id = #{id,jdbcType=BIGINT}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.dy.pipIrrGlobal.pojoSe.SeConsume">
    <!--@mbg.generated-->
    update se_consume
    set wallet_id = #{walletId,jdbcType=BIGINT},
      client_id = #{clientId,jdbcType=BIGINT},
      money = #{money,jdbcType=FLOAT},
      consumption = #{consumption,jdbcType=FLOAT},
      after_consume = #{afterConsume,jdbcType=FLOAT},
      duration = #{duration,jdbcType=FLOAT},
      vot = #{vot,jdbcType=TIMESTAMP},
      vct = #{vct,jdbcType=TIMESTAMP}
    where id = #{id,jdbcType=BIGINT}
  </update>
</mapper>
pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeRefundMapper.xml
New file
@@ -0,0 +1,173 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.dy.pipIrrGlobal.daoSe.SeRefundMapper">
  <resultMap id="BaseResultMap" type="com.dy.pipIrrGlobal.pojoSe.SeRefund">
    <!--@mbg.generated-->
    <!--@Table se_refund-->
    <id column="id" jdbcType="BIGINT" property="id" />
    <result column="wallet_id" jdbcType="BIGINT" property="walletId" />
    <result column="client_id" jdbcType="BIGINT" property="clientId" />
    <result column="money" jdbcType="FLOAT" property="money" />
    <result column="refund_amount" jdbcType="FLOAT" property="refundAmount" />
    <result column="after_refund" jdbcType="FLOAT" property="afterRefund" />
    <result column="application_time" jdbcType="TIMESTAMP" property="applicationTime" />
    <result column="refund_status" jdbcType="TINYINT" property="refundStatus" />
    <result column="auditor" jdbcType="BIGINT" property="auditor" />
    <result column="audit_time" jdbcType="TIMESTAMP" property="auditTime" />
    <result column="remarks" jdbcType="VARCHAR" property="remarks" />
  </resultMap>
  <sql id="Base_Column_List">
    <!--@mbg.generated-->
    id, wallet_id, client_id, money, refund_amount, after_refund, application_time, refund_status,
    auditor, audit_time, remarks
  </sql>
  <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
    <!--@mbg.generated-->
    select
    <include refid="Base_Column_List" />
    from se_refund
    where id = #{id,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
    <!--@mbg.generated-->
    delete from se_refund
    where id = #{id,jdbcType=BIGINT}
  </delete>
  <insert id="insert" parameterType="com.dy.pipIrrGlobal.pojoSe.SeRefund">
    <!--@mbg.generated-->
    insert into se_refund (id, wallet_id, client_id,
      money, refund_amount, after_refund,
      application_time, refund_status, auditor,
      audit_time, remarks)
    values (#{id,jdbcType=BIGINT}, #{walletId,jdbcType=BIGINT}, #{clientId,jdbcType=BIGINT},
      #{money,jdbcType=FLOAT}, #{refundAmount,jdbcType=FLOAT}, #{afterRefund,jdbcType=FLOAT},
      #{applicationTime,jdbcType=TIMESTAMP}, #{refundStatus,jdbcType=TINYINT}, #{auditor,jdbcType=BIGINT},
      #{auditTime,jdbcType=TIMESTAMP}, #{remarks,jdbcType=VARCHAR})
  </insert>
  <insert id="insertSelective" parameterType="com.dy.pipIrrGlobal.pojoSe.SeRefund">
    <!--@mbg.generated-->
    insert into se_refund
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        id,
      </if>
      <if test="walletId != null">
        wallet_id,
      </if>
      <if test="clientId != null">
        client_id,
      </if>
      <if test="money != null">
        money,
      </if>
      <if test="refundAmount != null">
        refund_amount,
      </if>
      <if test="afterRefund != null">
        after_refund,
      </if>
      <if test="applicationTime != null">
        application_time,
      </if>
      <if test="refundStatus != null">
        refund_status,
      </if>
      <if test="auditor != null">
        auditor,
      </if>
      <if test="auditTime != null">
        audit_time,
      </if>
      <if test="remarks != null">
        remarks,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="id != null">
        #{id,jdbcType=BIGINT},
      </if>
      <if test="walletId != null">
        #{walletId,jdbcType=BIGINT},
      </if>
      <if test="clientId != null">
        #{clientId,jdbcType=BIGINT},
      </if>
      <if test="money != null">
        #{money,jdbcType=FLOAT},
      </if>
      <if test="refundAmount != null">
        #{refundAmount,jdbcType=FLOAT},
      </if>
      <if test="afterRefund != null">
        #{afterRefund,jdbcType=FLOAT},
      </if>
      <if test="applicationTime != null">
        #{applicationTime,jdbcType=TIMESTAMP},
      </if>
      <if test="refundStatus != null">
        #{refundStatus,jdbcType=TINYINT},
      </if>
      <if test="auditor != null">
        #{auditor,jdbcType=BIGINT},
      </if>
      <if test="auditTime != null">
        #{auditTime,jdbcType=TIMESTAMP},
      </if>
      <if test="remarks != null">
        #{remarks,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.dy.pipIrrGlobal.pojoSe.SeRefund">
    <!--@mbg.generated-->
    update se_refund
    <set>
      <if test="walletId != null">
        wallet_id = #{walletId,jdbcType=BIGINT},
      </if>
      <if test="clientId != null">
        client_id = #{clientId,jdbcType=BIGINT},
      </if>
      <if test="money != null">
        money = #{money,jdbcType=FLOAT},
      </if>
      <if test="refundAmount != null">
        refund_amount = #{refundAmount,jdbcType=FLOAT},
      </if>
      <if test="afterRefund != null">
        after_refund = #{afterRefund,jdbcType=FLOAT},
      </if>
      <if test="applicationTime != null">
        application_time = #{applicationTime,jdbcType=TIMESTAMP},
      </if>
      <if test="refundStatus != null">
        refund_status = #{refundStatus,jdbcType=TINYINT},
      </if>
      <if test="auditor != null">
        auditor = #{auditor,jdbcType=BIGINT},
      </if>
      <if test="auditTime != null">
        audit_time = #{auditTime,jdbcType=TIMESTAMP},
      </if>
      <if test="remarks != null">
        remarks = #{remarks,jdbcType=VARCHAR},
      </if>
    </set>
    where id = #{id,jdbcType=BIGINT}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.dy.pipIrrGlobal.pojoSe.SeRefund">
    <!--@mbg.generated-->
    update se_refund
    set wallet_id = #{walletId,jdbcType=BIGINT},
      client_id = #{clientId,jdbcType=BIGINT},
      money = #{money,jdbcType=FLOAT},
      refund_amount = #{refundAmount,jdbcType=FLOAT},
      after_refund = #{afterRefund,jdbcType=FLOAT},
      application_time = #{applicationTime,jdbcType=TIMESTAMP},
      refund_status = #{refundStatus,jdbcType=TINYINT},
      auditor = #{auditor,jdbcType=BIGINT},
      audit_time = #{auditTime,jdbcType=TIMESTAMP},
      remarks = #{remarks,jdbcType=VARCHAR}
    where id = #{id,jdbcType=BIGINT}
  </update>
</mapper>
pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeWalletMapper.xml
@@ -5,13 +5,15 @@
    <!--@mbg.generated-->
    <!--@Table se_wallet-->
    <id column="id" jdbcType="BIGINT" property="id" />
    <result column="clientId" jdbcType="BIGINT" property="clientid" />
    <result column="client_id" jdbcType="BIGINT" property="clientId" />
    <result column="money" jdbcType="FLOAT" property="money" />
    <result column="createDt" jdbcType="TIMESTAMP" property="createdt" />
    <result column="last_operate" jdbcType="TINYINT" property="lastOperate" />
    <result column="last_operate_time" jdbcType="TIMESTAMP" property="lastOperateTime" />
    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
  </resultMap>
  <sql id="Base_Column_List">
    <!--@mbg.generated-->
    id, clientId, money, createDt
    id, client_id, money, last_operate, last_operate_time, create_time
  </sql>
  <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
    <!--@mbg.generated-->
@@ -27,9 +29,12 @@
  </delete>
  <insert id="insert" parameterType="com.dy.pipIrrGlobal.pojoSe.SeWallet">
    <!--@mbg.generated-->
    insert into se_wallet (id, clientId, money, createDt)
    values (#{id,jdbcType=BIGINT}, #{clientid,jdbcType=BIGINT}, #{money,jdbcType=FLOAT},
      #{createdt,jdbcType=TIMESTAMP})
    insert into se_wallet (id, client_id, money,
      last_operate, last_operate_time, create_time
      )
    values (#{id,jdbcType=BIGINT}, #{clientId,jdbcType=BIGINT}, #{money,jdbcType=FLOAT},
      #{lastOperate,jdbcType=TINYINT}, #{lastOperateTime,jdbcType=TIMESTAMP}, #{createTime,jdbcType=TIMESTAMP}
      )
  </insert>
  <insert id="insertSelective" parameterType="com.dy.pipIrrGlobal.pojoSe.SeWallet">
    <!--@mbg.generated-->
@@ -38,28 +43,40 @@
      <if test="id != null">
        id,
      </if>
      <if test="clientid != null">
        clientId,
      <if test="clientId != null">
        client_id,
      </if>
      <if test="money != null">
        money,
      </if>
      <if test="createdt != null">
        createDt,
      <if test="lastOperate != null">
        last_operate,
      </if>
      <if test="lastOperateTime != null">
        last_operate_time,
      </if>
      <if test="createTime != null">
        create_time,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="id != null">
        #{id,jdbcType=BIGINT},
      </if>
      <if test="clientid != null">
        #{clientid,jdbcType=BIGINT},
      <if test="clientId != null">
        #{clientId,jdbcType=BIGINT},
      </if>
      <if test="money != null">
        #{money,jdbcType=FLOAT},
      </if>
      <if test="createdt != null">
        #{createdt,jdbcType=TIMESTAMP},
      <if test="lastOperate != null">
        #{lastOperate,jdbcType=TINYINT},
      </if>
      <if test="lastOperateTime != null">
        #{lastOperateTime,jdbcType=TIMESTAMP},
      </if>
      <if test="createTime != null">
        #{createTime,jdbcType=TIMESTAMP},
      </if>
    </trim>
  </insert>
@@ -67,14 +84,20 @@
    <!--@mbg.generated-->
    update se_wallet
    <set>
      <if test="clientid != null">
        clientId = #{clientid,jdbcType=BIGINT},
      <if test="clientId != null">
        client_id = #{clientId,jdbcType=BIGINT},
      </if>
      <if test="money != null">
        money = #{money,jdbcType=FLOAT},
      </if>
      <if test="createdt != null">
        createDt = #{createdt,jdbcType=TIMESTAMP},
      <if test="lastOperate != null">
        last_operate = #{lastOperate,jdbcType=TINYINT},
      </if>
      <if test="lastOperateTime != null">
        last_operate_time = #{lastOperateTime,jdbcType=TIMESTAMP},
      </if>
      <if test="createTime != null">
        create_time = #{createTime,jdbcType=TIMESTAMP},
      </if>
    </set>
    where id = #{id,jdbcType=BIGINT}
@@ -82,9 +105,20 @@
  <update id="updateByPrimaryKey" parameterType="com.dy.pipIrrGlobal.pojoSe.SeWallet">
    <!--@mbg.generated-->
    update se_wallet
    set clientId = #{clientid,jdbcType=BIGINT},
    set client_id = #{clientId,jdbcType=BIGINT},
      money = #{money,jdbcType=FLOAT},
      createDt = #{createdt,jdbcType=TIMESTAMP}
      last_operate = #{lastOperate,jdbcType=TINYINT},
      last_operate_time = #{lastOperateTime,jdbcType=TIMESTAMP},
      create_time = #{createTime,jdbcType=TIMESTAMP}
    where id = #{id,jdbcType=BIGINT}
  </update>
  <!--根据农户ID获取电子钱包对象-->
  <select id="getWalletByClientId" resultMap="BaseResultMap">
    SELECT
        <include refid="Base_Column_List" />
    FROM se_wallet
    WHERE client_id = ${clientId}
    LIMIT 0,1
  </select>
</mapper>
pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeWalletRechargeHistoryMapper.xml
File was deleted
pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeWalletRechargeMapper.xml
@@ -5,17 +5,16 @@
    <!--@mbg.generated-->
    <!--@Table se_wallet_recharge-->
    <id column="id" jdbcType="BIGINT" property="id" />
    <result column="walletId" jdbcType="BIGINT" property="walletid" />
    <result column="clientId" jdbcType="BIGINT" property="clientid" />
    <result column="wallet_id" jdbcType="BIGINT" property="walletId" />
    <result column="client_id" jdbcType="BIGINT" property="clientId" />
    <result column="money" jdbcType="FLOAT" property="money" />
    <result column="amount" jdbcType="FLOAT" property="amount" />
    <result column="afterRecharge" jdbcType="FLOAT" property="afterrecharge" />
    <result column="rechargeDt" jdbcType="TIMESTAMP" property="rechargedt" />
    <result column="remarks" jdbcType="VARCHAR" property="remarks" />
    <result column="after_recharge" jdbcType="FLOAT" property="afterRecharge" />
    <result column="recharge_time" jdbcType="TIMESTAMP" property="rechargeTime" />
  </resultMap>
  <sql id="Base_Column_List">
    <!--@mbg.generated-->
    id, walletId, clientId, money, amount, afterRecharge, rechargeDt, remarks
    id, wallet_id, client_id, money, amount, after_recharge, recharge_time
  </sql>
  <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
    <!--@mbg.generated-->
@@ -31,12 +30,12 @@
  </delete>
  <insert id="insert" parameterType="com.dy.pipIrrGlobal.pojoSe.SeWalletRecharge">
    <!--@mbg.generated-->
    insert into se_wallet_recharge (id, walletId, clientId,
      money, amount, afterRecharge,
      rechargeDt, remarks)
    values (#{id,jdbcType=BIGINT}, #{walletid,jdbcType=BIGINT}, #{clientid,jdbcType=BIGINT},
      #{money,jdbcType=FLOAT}, #{amount,jdbcType=FLOAT}, #{afterrecharge,jdbcType=FLOAT},
      #{rechargedt,jdbcType=TIMESTAMP}, #{remarks,jdbcType=VARCHAR})
    insert into se_wallet_recharge (id, wallet_id, client_id,
      money, amount, after_recharge,
      recharge_time)
    values (#{id,jdbcType=BIGINT}, #{walletId,jdbcType=BIGINT}, #{clientId,jdbcType=BIGINT},
      #{money,jdbcType=FLOAT}, #{amount,jdbcType=FLOAT}, #{afterRecharge,jdbcType=FLOAT},
      #{rechargeTime,jdbcType=TIMESTAMP})
  </insert>
  <insert id="insertSelective" parameterType="com.dy.pipIrrGlobal.pojoSe.SeWalletRecharge">
    <!--@mbg.generated-->
@@ -45,11 +44,11 @@
      <if test="id != null">
        id,
      </if>
      <if test="walletid != null">
        walletId,
      <if test="walletId != null">
        wallet_id,
      </if>
      <if test="clientid != null">
        clientId,
      <if test="clientId != null">
        client_id,
      </if>
      <if test="money != null">
        money,
@@ -57,25 +56,22 @@
      <if test="amount != null">
        amount,
      </if>
      <if test="afterrecharge != null">
        afterRecharge,
      <if test="afterRecharge != null">
        after_recharge,
      </if>
      <if test="rechargedt != null">
        rechargeDt,
      </if>
      <if test="remarks != null">
        remarks,
      <if test="rechargeTime != null">
        recharge_time,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="id != null">
        #{id,jdbcType=BIGINT},
      </if>
      <if test="walletid != null">
        #{walletid,jdbcType=BIGINT},
      <if test="walletId != null">
        #{walletId,jdbcType=BIGINT},
      </if>
      <if test="clientid != null">
        #{clientid,jdbcType=BIGINT},
      <if test="clientId != null">
        #{clientId,jdbcType=BIGINT},
      </if>
      <if test="money != null">
        #{money,jdbcType=FLOAT},
@@ -83,14 +79,11 @@
      <if test="amount != null">
        #{amount,jdbcType=FLOAT},
      </if>
      <if test="afterrecharge != null">
        #{afterrecharge,jdbcType=FLOAT},
      <if test="afterRecharge != null">
        #{afterRecharge,jdbcType=FLOAT},
      </if>
      <if test="rechargedt != null">
        #{rechargedt,jdbcType=TIMESTAMP},
      </if>
      <if test="remarks != null">
        #{remarks,jdbcType=VARCHAR},
      <if test="rechargeTime != null">
        #{rechargeTime,jdbcType=TIMESTAMP},
      </if>
    </trim>
  </insert>
@@ -98,11 +91,11 @@
    <!--@mbg.generated-->
    update se_wallet_recharge
    <set>
      <if test="walletid != null">
        walletId = #{walletid,jdbcType=BIGINT},
      <if test="walletId != null">
        wallet_id = #{walletId,jdbcType=BIGINT},
      </if>
      <if test="clientid != null">
        clientId = #{clientid,jdbcType=BIGINT},
      <if test="clientId != null">
        client_id = #{clientId,jdbcType=BIGINT},
      </if>
      <if test="money != null">
        money = #{money,jdbcType=FLOAT},
@@ -110,14 +103,11 @@
      <if test="amount != null">
        amount = #{amount,jdbcType=FLOAT},
      </if>
      <if test="afterrecharge != null">
        afterRecharge = #{afterrecharge,jdbcType=FLOAT},
      <if test="afterRecharge != null">
        after_recharge = #{afterRecharge,jdbcType=FLOAT},
      </if>
      <if test="rechargedt != null">
        rechargeDt = #{rechargedt,jdbcType=TIMESTAMP},
      </if>
      <if test="remarks != null">
        remarks = #{remarks,jdbcType=VARCHAR},
      <if test="rechargeTime != null">
        recharge_time = #{rechargeTime,jdbcType=TIMESTAMP},
      </if>
    </set>
    where id = #{id,jdbcType=BIGINT}
@@ -125,13 +115,12 @@
  <update id="updateByPrimaryKey" parameterType="com.dy.pipIrrGlobal.pojoSe.SeWalletRecharge">
    <!--@mbg.generated-->
    update se_wallet_recharge
    set walletId = #{walletid,jdbcType=BIGINT},
      clientId = #{clientid,jdbcType=BIGINT},
    set wallet_id = #{walletId,jdbcType=BIGINT},
      client_id = #{clientId,jdbcType=BIGINT},
      money = #{money,jdbcType=FLOAT},
      amount = #{amount,jdbcType=FLOAT},
      afterRecharge = #{afterrecharge,jdbcType=FLOAT},
      rechargeDt = #{rechargedt,jdbcType=TIMESTAMP},
      remarks = #{remarks,jdbcType=VARCHAR}
      after_recharge = #{afterRecharge,jdbcType=FLOAT},
      recharge_time = #{rechargeTime,jdbcType=TIMESTAMP}
    where id = #{id,jdbcType=BIGINT}
  </update>
</mapper>
pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/result/SellResultCode.java
@@ -73,7 +73,16 @@
    GENERAL_ID_CANNOT_BE_NULL(80001, "总账编号不能为空"),
    GENERAL_NOT_EXIST(80001, "总账不存在"),
    GENERAL_AUDIT_FAIL(80001, "总账审核失败"),
    AUDITS_ADD_FAIL(80001, "总账审核记录添加失败");
    AUDITS_ADD_FAIL(80001, "总账审核记录添加失败"),
    /**
     * 电子钱包
     */
    CLIENT_ID_CANNOT_BE_NULL(90001, "农户编号不能为空"),
    WALLET_OPEN_ACCOUNT_FAIL(90002, "电子钱包账户注册失败"),
    WALLET_ACCOUNT_EXIST(90003, "该农户已注册电子钱包"),
    NO_ACCOUNT(90005, "您尚未注册电子钱包账户"),
    UPDATE_ACCOUNT_FAIL(90006, "充值失败,电子钱包账户更新失败");
    private final Integer code;
    private final String message;
pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wallet/LastOperateENUM.java
New file
@@ -0,0 +1,24 @@
package com.dy.pipIrrSell.wallet;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
 * @author ZhuBaoMin
 * @date 2024-01-30 17:12
 * @LastEditTime 2024-01-30 17:12
 * @Description 电子钱包最后操作枚举类
 */
@Getter
@AllArgsConstructor
public enum LastOperateENUM {
    OPEN_ACCOUNT((byte)1, "开户"),
    RECHARGE((byte)2, "充值"),
    CONSUME((byte)3, "消费"),
    APPLY_REFUND((byte)4, "申请退款"),
    AUDIT_REFUND((byte)5, "退款审核");
    private final Byte code;
    private final String message;
}
pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wallet/WalletCtrl.java
@@ -5,22 +5,24 @@
import com.dy.common.webUtil.BaseResponseUtils;
import com.dy.common.webUtil.ResultCodeMsg;
import com.dy.pipIrrGlobal.pojoSe.SeWallet;
import com.dy.pipIrrGlobal.pojoSe.SeWalletRecharge;
import com.dy.pipIrrSell.result.SellResultCode;
import com.dy.pipIrrSell.wallet.dto.DtoRecharge;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.responses.ApiResponses;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import jakarta.validation.constraints.NotNull;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.MediaType;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.BindingResult;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import java.util.Date;
import java.util.Optional;
@@ -41,6 +43,12 @@
public class WalletCtrl {
    private final WalletSv walletSv;
    /**
     * 注册电子钱包账户
     * 注册钱先验证该农户是否已经注册电子钱包
     * @param clientId
     * @return
     */
    @Operation(summary = "注册电子钱包", description = "注册电子钱包")
    @ApiResponses(value = {
            @ApiResponse(
@@ -50,56 +58,85 @@
                            schema = @Schema(implementation = Boolean.class))}
            )
    })
    @PostMapping(path = "add")
    @Transactional(rollbackFor = Exception.class)
    @PostMapping(path = "add_wallet")
    @SsoAop()
    //public BaseResponse<Boolean> add(@RequestBody Long clientId){
    public BaseResponse<Boolean> add(@RequestParam("clientId") @NotNull(message = "农户编号不能为空") Long clientId){
    public BaseResponse<Boolean> addWallet(@RequestParam("clientId") @NotNull(message = "农户编号不能为空") Long clientId){
        if(clientId == null || clientId < 0) {
            return BaseResponseUtils.buildFail("农户编号不能为空");
            return BaseResponseUtils.buildFail(SellResultCode.CLIENT_ID_CANNOT_BE_NULL.getMessage());
        }
        if(walletSv.getWalletByClientId(clientId) != null) {
            return BaseResponseUtils.buildFail(SellResultCode.WALLET_ACCOUNT_EXIST.getMessage());
        }
        SeWallet seWallet = new SeWallet();
        seWallet.setClientid(clientId);
        seWallet.setMoney(0f);
        seWallet.setCreatedt(new Date());
        Integer rec = Optional.ofNullable(walletSv.add(seWallet)).orElse(0);
        seWallet.setClientId(clientId);
        seWallet.setMoney(0d);
        seWallet.setLastOperate(LastOperateENUM.OPEN_ACCOUNT.getCode());
        seWallet.setLastOperateTime(new Date());
        seWallet.setCreateTime(new Date());
        Long rec = Optional.ofNullable(walletSv.addWallet(seWallet)).orElse(0L);
        if(rec == 0) {
            return BaseResponseUtils.buildFail("注册电子钱包-电子钱包记录写入异常");
            return BaseResponseUtils.buildFail(SellResultCode.WALLET_OPEN_ACCOUNT_FAIL.getMessage());
        }
        return BaseResponseUtils.buildSuccess(true) ;
    }
    //@Operation(summary = "电子钱包充值", description = "电子钱包充值")
    //@ApiResponses(value = {
    //        @ApiResponse(
    //                responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE,
    //                description = "操作结果:true:成功,false:失败(BaseResponse.content)",
    //                content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE,
    //                        schema = @Schema(implementation = Boolean.class))}
    //        )
    //})
    //@PostMapping(path = "addRecharge")
    //@Transactional(rollbackFor = Exception.class)
    //@SsoAop()
    //public BaseResponse<Boolean> addRecharge(@RequestBody  @Valid DtoWalletRecharge po, @Parameter(hidden = true) BindingResult bindingResult){
    //    DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
    //    if(bindingResult != null && bindingResult.hasErrors()){
    //        return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage());
    //    }
    //
    //
    //
    //    SeWallet seWallet = new SeWallet();
    //    seWallet.setClientid(clientId);
    //    seWallet.setMoney(0f);
    //    seWallet.setCreatedt(new Date());
    //    Integer rec = Optional.ofNullable(walletSv.add(seWallet)).orElse(0);
    //    if(rec == 0) {
    //        return BaseResponseUtils.buildFail("注册电子钱包-电子钱包记录写入异常");
    //    }
    //
    //    return BaseResponseUtils.buildSuccess(true) ;
    //}
    /**
     * 电子钱包账户充值
     * @param po
     * @param bindingResult
     * @return
     */
    @Operation(summary = "电子钱包充值", description = "电子钱包充值")
    @ApiResponses(value = {
            @ApiResponse(
                    responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE,
                    description = "操作结果:true:成功,false:失败(BaseResponse.content)",
                    content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE,
                            schema = @Schema(implementation = Boolean.class))}
            )
    })
    @PostMapping(path = "add_recharge", consumes = MediaType.APPLICATION_JSON_VALUE)
    @Transactional(rollbackFor = Exception.class)
    @SsoAop()
    public BaseResponse<Boolean> addRecharge(@RequestBody @Valid DtoRecharge po, BindingResult bindingResult){
        Long clientId = Optional.ofNullable(po .getClientId()).orElse(0L);
        Double amount = Optional.ofNullable(po.getAmount()).orElse(0.0);
        // 验证该农户是否已经注册电子钱包账户并取出ID及当前账户余额
        SeWallet seWallet = walletSv.getWalletByClientId(clientId);
        if(seWallet == null) {
            return BaseResponseUtils.buildFail(SellResultCode.NO_ACCOUNT.getMessage());
        }
        Long wallerId = Optional.ofNullable(seWallet.getId()).orElse(0L);
        Double money = Optional.ofNullable(seWallet.getMoney()).orElse(0.0);
        // 计算充值后余额
        Double afterRrecharge = money + amount;
        // 修改电子钱包余额、最后操作类型、最后操作时间
        seWallet.setMoney(afterRrecharge);
        seWallet.setLastOperate(LastOperateENUM.RECHARGE.getCode());
        seWallet.setLastOperateTime(new Date());
        Integer rec_updateWaller = Optional.ofNullable(walletSv.updateWallet(seWallet)).orElse(0);
        if(rec_updateWaller == 0) {
            return BaseResponseUtils.buildFail(SellResultCode.UPDATE_ACCOUNT_FAIL.getMessage());
        }
        // 添加充值记录
        SeWalletRecharge seWalletRecharge = new SeWalletRecharge();
        seWalletRecharge.setWalletId(wallerId);
        seWalletRecharge.setClientId(clientId);
        seWalletRecharge.setMoney(money);
        seWalletRecharge.setAmount(amount);
        seWalletRecharge.setAfterRecharge(afterRrecharge);
        seWalletRecharge.setRechargeTime(new Date());
        Long rec = Optional.ofNullable(walletSv.addRecharge(seWalletRecharge)).orElse(0L);
        if(rec == 0) {
            return BaseResponseUtils.buildFail(SellResultCode.WALLET_OPEN_ACCOUNT_FAIL.getMessage());
        }
        return BaseResponseUtils.buildSuccess(true) ;
    }
}
pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wallet/WalletSv.java
@@ -1,10 +1,11 @@
package com.dy.pipIrrSell.wallet;
import com.dy.pipIrrGlobal.daoSe.SeConsumeMapper;
import com.dy.pipIrrGlobal.daoSe.SeRefundMapper;
import com.dy.pipIrrGlobal.daoSe.SeWalletMapper;
import com.dy.pipIrrGlobal.daoSe.SeWalletRechargeHistoryMapper;
import com.dy.pipIrrGlobal.daoSe.SeWalletRechargeMapper;
import com.dy.pipIrrGlobal.pojoSe.SeWallet;
import com.dy.pipIrrGlobal.pojoSe.SeWalletRechargeHistory;
import com.dy.pipIrrGlobal.pojoSe.SeWalletRecharge;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -26,54 +27,42 @@
    private SeWalletRechargeMapper seWalletRechargeMapper;
    @Autowired
    private SeWalletRechargeHistoryMapper seWalletRechargeHistoryMapper;
    private SeConsumeMapper seConsumeMapper;
    @Autowired
    private SeRefundMapper seRefundMapper;
    /**
     * 根据农户ID获取电子钱包对象
     * @param clientId
     * @return
     */
    public SeWallet getWalletByClientId(Long clientId) {
        return seWalletMapper.getWalletByClientId(clientId);
    }
    /**
     * 注册电子钱包账号
     * @param po 电子钱包实体类
     * @return 电子钱包ID
     */
    public Long addWallet(SeWallet po) {
        seWalletMapper.insert(po);
        return po.getId();
    }
    public Integer updateWallet(SeWallet po) {
        return seWalletMapper.updateByPrimaryKeySelective(po);
    }
    /**
     * 电子钱包充值
     * @param po
     * @return
     */
    public Integer add(SeWallet po) {
        return seWalletMapper.insert(po);
    public Long addRecharge(SeWalletRecharge po) {
        seWalletRechargeMapper.insert(po);
        return po.getId();
    }
    /**
     * 根据编号从钱包表中获取该钱包余额
     * @param id
     * @return
     */
    public Float getMoneyById(Long id) {
        SeWallet po = seWalletMapper.selectByPrimaryKey(id);
        return po.getMoney();
    }
    /**
     * 根据钱包编号修改钱包余额
     * @param id 钱包编号(主键)
     * @param money 钱包余额
     * @return 修改记录数量
     */
    public Integer updateMoneyById(Long id, Float money) {
        SeWallet po = seWalletMapper.selectByPrimaryKey(id);
        po.setMoney(money);
        return seWalletMapper.updateByPrimaryKey(po);
    }
    /**
     * 根据id删除充值记录
     * @param id
     * @return
     */
    public Integer deleteWallerRechargeById(Long id) {
        return seWalletMapper.deleteByPrimaryKey(id);
    }
    /**
     * 将充值记录添加到充值历史表
     * @param po 充值历史实体
     * @return
     */
    public Integer addWallerRechargeHistory(SeWalletRechargeHistory po) {
        return seWalletRechargeHistoryMapper.insert(po);
    }
}
pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wallet/dto/DtoRecharge.java
New file
@@ -0,0 +1,36 @@
package com.dy.pipIrrSell.wallet.dto;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotNull;
import lombok.*;
/**
 * @author ZhuBaoMin
 * @date 2024-01-30 20:54
 * @LastEditTime 2024-01-30 20:54
 * @Description
 */
@Data
@Builder
@ToString
@NoArgsConstructor
@AllArgsConstructor
@Schema(name = "电子钱包账户充值传入对象")
public class DtoRecharge {
    public static final long serialVersionUID = 202401302055001L;
    /**
     * 农户ID
     */
    @Schema(description = "农户ID", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
    @NotNull(message = "农户ID不能为空")
    private Long clientId;
    /**
     * 充值金额
     */
    @Schema(description = "充值金额", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
    @NotNull(message = "充值金额不能为空")
    private Double amount;
}