From 742e0a8ec019ccb76f03fcc58859ed15e9264c4c Mon Sep 17 00:00:00 2001 From: Administrator <zhubaomin> Date: 星期三, 31 一月 2024 08:26:30 +0800 Subject: [PATCH] 2024-01-31 朱宝民 电子钱包账户注册接口、充值接口 --- pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSe/SeConsumeMapper.java | 27 + pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoSe/SeRefund.java | 113 ++++ pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wallet/dto/DtoRecharge.java | 36 + pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeConsumeMapper.xml | 150 ++++++ pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeWalletMapper.xml | 74 ++ pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeRefundMapper.xml | 173 +++++++ pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoSe/SeConsume.java | 97 ++++ pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoSe/SeWallet.java | 65 +- pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSe/SeWalletRechargeMapper.java | 8 pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wallet/WalletCtrl.java | 129 +++-- /dev/null | 137 ----- pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/result/SellResultCode.java | 11 pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSe/SeWalletMapper.java | 16 pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeWalletRechargeMapper.xml | 89 +-- pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSe/SeRefundMapper.java | 27 + pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wallet/LastOperateENUM.java | 24 + pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wallet/WalletSv.java | 77 +- pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoSe/SeWalletRecharge.java | 89 ++- 18 files changed, 978 insertions(+), 364 deletions(-) diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSe/SeConsumeMapper.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSe/SeConsumeMapper.java new file mode 100644 index 0000000..8f2a2c8 --- /dev/null +++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSe/SeConsumeMapper.java @@ -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); +} \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSe/SeRefundMapper.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSe/SeRefundMapper.java new file mode 100644 index 0000000..e8df533 --- /dev/null +++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSe/SeRefundMapper.java @@ -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 鐢靛瓙閽卞寘閫�娆綧apper鎺ュ彛 + */ + +@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); +} \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSe/SeWalletMapper.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSe/SeWalletMapper.java index 1cc0294..b1edd5e 100644 --- a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSe/SeWalletMapper.java +++ b/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); } \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSe/SeWalletRechargeHistoryMapper.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSe/SeWalletRechargeHistoryMapper.java deleted file mode 100644 index 14eb8d2..0000000 --- a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSe/SeWalletRechargeHistoryMapper.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.dy.pipIrrGlobal.daoSe; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.dy.pipIrrGlobal.pojoSe.SeWalletRechargeHistory; -import org.apache.ibatis.annotations.Mapper; - -/** - * @author ZhuBaoMin - * @date 2023/12/12 9:06 - * @LastEditTime 2023/12/12 9:06 - * @Description - */ - -@Mapper -public interface SeWalletRechargeHistoryMapper extends BaseMapper<SeWalletRechargeHistory> { - int deleteByPrimaryKey(Long id); - - int insert(SeWalletRechargeHistory record); - - int insertSelective(SeWalletRechargeHistory record); - - SeWalletRechargeHistory selectByPrimaryKey(Long id); - - int updateByPrimaryKeySelective(SeWalletRechargeHistory record); - - int updateByPrimaryKey(SeWalletRechargeHistory record); -} \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSe/SeWalletRechargeMapper.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSe/SeWalletRechargeMapper.java index 77ab6cb..b1e11ea 100644 --- a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSe/SeWalletRechargeMapper.java +++ b/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 鐢靛瓙閽卞寘鍏呭�糓apper鎺ュ彛 */ @Mapper -public interface SeWalletRechargeMapper extends BaseMapper<SeWalletRecharge> { +public interface SeWalletRechargeMapper extends BaseMapper { int deleteByPrimaryKey(Long id); int insert(SeWalletRecharge record); diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoSe/SeConsume.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoSe/SeConsume.java new file mode 100644 index 0000000..fe5908d --- /dev/null +++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoSe/SeConsume.java @@ -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; +} \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoSe/SeRefund.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoSe/SeRefund.java new file mode 100644 index 0000000..75f3c85 --- /dev/null +++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoSe/SeRefund.java @@ -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 = "鎿嶄綔浜篒D", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @Positive(message = "鎿嶄綔浜篒D蹇呴』涓哄ぇ浜�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; +} \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoSe/SeWallet.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoSe/SeWallet.java index 14b8dd4..b3826d6 100644 --- a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoSe/SeWallet.java +++ b/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; + } \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoSe/SeWalletRecharge.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoSe/SeWalletRecharge.java index 239ff8e..2b28652 100644 --- a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoSe/SeWalletRecharge.java +++ b/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; } \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoSe/SeWalletRechargeHistory.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoSe/SeWalletRechargeHistory.java deleted file mode 100644 index 9a14c01..0000000 --- a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoSe/SeWalletRechargeHistory.java +++ /dev/null @@ -1,54 +0,0 @@ -package com.dy.pipIrrGlobal.pojoSe; - -import java.util.Date; - -/** - * @author ZhuBaoMin - * @date 2023/12/12 9:06 - * @LastEditTime 2023/12/12 9:06 - * @Description - */ -/** - * 鐢靛瓙閽卞寘鍏呭�煎巻鍙茶〃 - */ -public class SeWalletRechargeHistory { - /** - * 涓婚敭 - */ - private Long id; - - /** - * 閽卞寘缂栧彿 - */ - private Long walletid; - - /** - * 鍐滄埛缂栧彿 - */ - private Long clientid; - - /** - * 閽卞寘浣欓 - */ - private Double money; - - /** - * 鍏呭�奸噾棰� - */ - private Double amount; - - /** - * 鍏呭�煎悗浣欓 - */ - private Double afterrecharge; - - /** - * 鍏呭�兼椂闂� - */ - private Date rechargedt; - - /** - * 澶囨敞淇℃伅 - */ - private String remarks; -} \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeConsumeMapper.xml b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeConsumeMapper.xml new file mode 100644 index 0000000..ca42c78 --- /dev/null +++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeConsumeMapper.xml @@ -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> \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeRefundMapper.xml b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeRefundMapper.xml new file mode 100644 index 0000000..d19093c --- /dev/null +++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeRefundMapper.xml @@ -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> \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeWalletMapper.xml b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeWalletMapper.xml index 0263487..aa60383 100644 --- a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeWalletMapper.xml +++ b/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> \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeWalletRechargeHistoryMapper.xml b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeWalletRechargeHistoryMapper.xml deleted file mode 100644 index d8bfcb9..0000000 --- a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeWalletRechargeHistoryMapper.xml +++ /dev/null @@ -1,137 +0,0 @@ -<?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.SeWalletRechargeHistoryMapper"> - <resultMap id="BaseResultMap" type="com.dy.pipIrrGlobal.pojoSe.SeWalletRechargeHistory"> - <!--@mbg.generated--> - <!--@Table se_wallet_recharge_history--> - <id column="id" jdbcType="BIGINT" property="id" /> - <result column="walletId" jdbcType="BIGINT" property="walletid" /> - <result column="clientId" 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" /> - </resultMap> - <sql id="Base_Column_List"> - <!--@mbg.generated--> - id, walletId, clientId, money, amount, afterRecharge, rechargeDt, remarks - </sql> - <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap"> - <!--@mbg.generated--> - select - <include refid="Base_Column_List" /> - from se_wallet_recharge_history - where id = #{id,jdbcType=BIGINT} - </select> - <delete id="deleteByPrimaryKey" parameterType="java.lang.Long"> - <!--@mbg.generated--> - delete from se_wallet_recharge_history - where id = #{id,jdbcType=BIGINT} - </delete> - <insert id="insert" parameterType="com.dy.pipIrrGlobal.pojoSe.SeWalletRechargeHistory"> - <!--@mbg.generated--> - insert into se_wallet_recharge_history (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> - <insert id="insertSelective" parameterType="com.dy.pipIrrGlobal.pojoSe.SeWalletRechargeHistory"> - <!--@mbg.generated--> - insert into se_wallet_recharge_history - <trim prefix="(" suffix=")" suffixOverrides=","> - <if test="id != null"> - id, - </if> - <if test="walletid != null"> - walletId, - </if> - <if test="clientid != null"> - clientId, - </if> - <if test="money != null"> - money, - </if> - <if test="amount != null"> - amount, - </if> - <if test="afterrecharge != null"> - afterRecharge, - </if> - <if test="rechargedt != null"> - rechargeDt, - </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="amount != null"> - #{amount,jdbcType=FLOAT}, - </if> - <if test="afterrecharge != null"> - #{afterrecharge,jdbcType=FLOAT}, - </if> - <if test="rechargedt != null"> - #{rechargedt,jdbcType=TIMESTAMP}, - </if> - <if test="remarks != null"> - #{remarks,jdbcType=VARCHAR}, - </if> - </trim> - </insert> - <update id="updateByPrimaryKeySelective" parameterType="com.dy.pipIrrGlobal.pojoSe.SeWalletRechargeHistory"> - <!--@mbg.generated--> - update se_wallet_recharge_history - <set> - <if test="walletid != null"> - walletId = #{walletid,jdbcType=BIGINT}, - </if> - <if test="clientid != null"> - clientId = #{clientid,jdbcType=BIGINT}, - </if> - <if test="money != null"> - money = #{money,jdbcType=FLOAT}, - </if> - <if test="amount != null"> - amount = #{amount,jdbcType=FLOAT}, - </if> - <if test="afterrecharge != null"> - afterRecharge = #{afterrecharge,jdbcType=FLOAT}, - </if> - <if test="rechargedt != null"> - rechargeDt = #{rechargedt,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.SeWalletRechargeHistory"> - <!--@mbg.generated--> - update se_wallet_recharge_history - set walletId = #{walletid,jdbcType=BIGINT}, - clientId = #{clientid,jdbcType=BIGINT}, - money = #{money,jdbcType=FLOAT}, - amount = #{amount,jdbcType=FLOAT}, - afterRecharge = #{afterrecharge,jdbcType=FLOAT}, - rechargeDt = #{rechargedt,jdbcType=TIMESTAMP}, - remarks = #{remarks,jdbcType=VARCHAR} - where id = #{id,jdbcType=BIGINT} - </update> -</mapper> \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeWalletRechargeMapper.xml b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeWalletRechargeMapper.xml index 127bceb..44fb44a 100644 --- a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeWalletRechargeMapper.xml +++ b/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> \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/result/SellResultCode.java b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/result/SellResultCode.java index 8d92e08..8716054 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/result/SellResultCode.java +++ b/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; diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wallet/LastOperateENUM.java b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wallet/LastOperateENUM.java new file mode 100644 index 0000000..c2e159f --- /dev/null +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wallet/LastOperateENUM.java @@ -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; +} diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wallet/WalletCtrl.java b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wallet/WalletCtrl.java index 8eecd2c..7383dc8 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wallet/WalletCtrl.java +++ b/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 = "鎿嶄綔缁撴灉锛歵rue锛氭垚鍔燂紝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 = "鎿嶄綔缁撴灉锛歵rue锛氭垚鍔燂紝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) ; + } + } diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wallet/WalletSv.java b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wallet/WalletSv.java index 2e7b236..96f565e 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wallet/WalletSv.java +++ b/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); - } } diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wallet/dto/DtoRecharge.java b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wallet/dto/DtoRecharge.java new file mode 100644 index 0000000..c9953b2 --- /dev/null +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wallet/dto/DtoRecharge.java @@ -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; +} -- Gitblit v1.8.0