From 2368b6f47ba2866e860c3476bb227572b94e3896 Mon Sep 17 00:00:00 2001 From: Administrator <zhubaomin> Date: 星期五, 15 十二月 2023 18:03:06 +0800 Subject: [PATCH] 2023-12-15 朱宝民 增加了一个接口,修了一个接口 --- pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/activeCard/ActiveCardCtrl.java | 20 + pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeWalletMapper.xml | 90 ++++ 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/SeWalletRechargeHistoryMapper.java | 23 + pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSe/SeWalletRechargeMapper.java | 23 + pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wallet/WalletCtrl.java | 105 +++++ pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/activeCard/DtoActiveCard.java | 7 pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wallet/DtoWallet.java | 29 + pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/recharge/DtoRecharge.java | 6 pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeRechargeMapper.xml | 6 pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeWalletRechargeHistoryMapper.xml | 137 +++++++ pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSe/SeWalletMapper.java | 23 + pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeWalletRechargeMapper.xml | 137 +++++++ pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wallet/DtoWalletRecharge.java | 50 ++ pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/activeCard/RechargeDtoMapper.java | 26 + pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoSe/SeWalletRechargeHistory.java | 118 ++++++ pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/recharge/QueryVo.java | 3 pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/recharge/RechargeCtrl.java | 17 pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wallet/WalletSv.java | 79 ++++ pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoSe/SeWalletRecharge.java | 118 ++++++ 20 files changed, 1,073 insertions(+), 9 deletions(-) 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 new file mode 100644 index 0000000..33d48b5 --- /dev/null +++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSe/SeWalletMapper.java @@ -0,0 +1,23 @@ +package com.dy.pipIrrGlobal.daoSe; + +import com.dy.pipIrrGlobal.pojoSe.SeWallet; + +/** + * @author ZhuBaoMin + * @date 2023/12/11 16:29 + * @LastEditTime 2023/12/11 16:29 + * @Description + */ +public interface SeWalletMapper { + int deleteByPrimaryKey(Long id); + + int insert(SeWallet record); + + int insertSelective(SeWallet record); + + SeWallet selectByPrimaryKey(Long id); + + int updateByPrimaryKeySelective(SeWallet record); + + int updateByPrimaryKey(SeWallet record); +} \ 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 new file mode 100644 index 0000000..abeaa27 --- /dev/null +++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSe/SeWalletRechargeHistoryMapper.java @@ -0,0 +1,23 @@ +package com.dy.pipIrrGlobal.daoSe; + +import com.dy.pipIrrGlobal.pojoSe.SeWalletRechargeHistory; + +/** + * @author ZhuBaoMin + * @date 2023/12/12 9:06 + * @LastEditTime 2023/12/12 9:06 + * @Description + */ +public interface SeWalletRechargeHistoryMapper { + 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 new file mode 100644 index 0000000..84b5e3b --- /dev/null +++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSe/SeWalletRechargeMapper.java @@ -0,0 +1,23 @@ +package com.dy.pipIrrGlobal.daoSe; + +import com.dy.pipIrrGlobal.pojoSe.SeWalletRecharge; + +/** + * @author ZhuBaoMin + * @date 2023/12/12 9:06 + * @LastEditTime 2023/12/12 9:06 + * @Description + */ +public interface SeWalletRechargeMapper { + int deleteByPrimaryKey(Long id); + + int insert(SeWalletRecharge record); + + int insertSelective(SeWalletRecharge record); + + SeWalletRecharge selectByPrimaryKey(Long id); + + int updateByPrimaryKeySelective(SeWalletRecharge record); + + int updateByPrimaryKey(SeWalletRecharge record); +} \ 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 new file mode 100644 index 0000000..1133e8d --- /dev/null +++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoSe/SeWallet.java @@ -0,0 +1,65 @@ +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.Positive; +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 + */ + +/** + * 鐢靛瓙閽卞寘琛� + */ + +@TableName(value="se_wallet", autoResultMap = true) +@Data +@Builder +@ToString +@NoArgsConstructor +@AllArgsConstructor +@Schema(name = "鐢靛瓙閽卞寘琛ㄥ疄浣�") +public class SeWallet implements BaseEntity { + public static final long serialVersionUID = 1L; + + /** + * 涓婚敭 + */ + @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; + + /** + * 閽卞寘浣欓 + */ + @Schema(description = "閽卞寘浣欓", requiredMode = Schema.RequiredMode.REQUIRED) + @Length(message = "閽卞寘浣欓涓嶅皬浜巤min}", min = 0) + private Float money; + + /** + * 鍒涘缓鏃堕棿 + */ + @Schema(description = "鍒涘缓鏃堕棿", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + private Date createdt; +} \ 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 new file mode 100644 index 0000000..842defc --- /dev/null +++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoSe/SeWalletRecharge.java @@ -0,0 +1,118 @@ +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 SeWalletRecharge { + /** + * 涓婚敭 + */ + private Long id; + + /** + * 閽卞寘缂栧彿 + */ + private Long walletid; + + /** + * 鍐滄埛缂栧彿 + */ + private Long clientid; + + /** + * 閽卞寘浣欓 + */ + private Double money; + + /** + * 鍏呭�奸噾棰� + */ + private Double amount; + + /** + * 鍏呭�煎悗浣欓 + */ + private Double afterrecharge; + + /** + * 鍏呭�兼椂闂� + */ + private Date rechargedt; + + /** + * 澶囨敞淇℃伅 + */ + private String remarks; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public Long getWalletid() { + return walletid; + } + + public void setWalletid(Long walletid) { + this.walletid = walletid; + } + + public Long getClientid() { + return clientid; + } + + public void setClientid(Long clientid) { + this.clientid = clientid; + } + + public Double getMoney() { + return money; + } + + public void setMoney(Double money) { + this.money = money; + } + + public Double getAmount() { + return amount; + } + + public void setAmount(Double amount) { + this.amount = amount; + } + + public Double getAfterrecharge() { + return afterrecharge; + } + + public void setAfterrecharge(Double afterrecharge) { + this.afterrecharge = afterrecharge; + } + + public Date getRechargedt() { + return rechargedt; + } + + public void setRechargedt(Date rechargedt) { + this.rechargedt = rechargedt; + } + + public String getRemarks() { + return remarks; + } + + public void setRemarks(String remarks) { + this.remarks = remarks; + } +} \ 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 new file mode 100644 index 0000000..668c31a --- /dev/null +++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoSe/SeWalletRechargeHistory.java @@ -0,0 +1,118 @@ +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; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public Long getWalletid() { + return walletid; + } + + public void setWalletid(Long walletid) { + this.walletid = walletid; + } + + public Long getClientid() { + return clientid; + } + + public void setClientid(Long clientid) { + this.clientid = clientid; + } + + public Double getMoney() { + return money; + } + + public void setMoney(Double money) { + this.money = money; + } + + public Double getAmount() { + return amount; + } + + public void setAmount(Double amount) { + this.amount = amount; + } + + public Double getAfterrecharge() { + return afterrecharge; + } + + public void setAfterrecharge(Double afterrecharge) { + this.afterrecharge = afterrecharge; + } + + public Date getRechargedt() { + return rechargedt; + } + + public void setRechargedt(Date rechargedt) { + this.rechargedt = rechargedt; + } + + public String getRemarks() { + return remarks; + } + + public void setRemarks(String remarks) { + this.remarks = remarks; + } +} \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeRechargeMapper.xml b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeRechargeMapper.xml index 7ebcb09..c67c845 100644 --- a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeRechargeMapper.xml +++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeRechargeMapper.xml @@ -249,6 +249,10 @@ AND cli.name like CONCAT('%',#{clientName},'%') </if> + <if test = "clientId != null and clientId > 0"> + AND rec.clientId like CONCAT('%',#{clientId},'%') + </if> + <if test = "cardAddr != null and cardAddr !=''"> AND card.cardAddr like CONCAT('%',#{cardAddr},'%') </if> @@ -261,7 +265,7 @@ AND rec.operateDt BETWEEN #{rechargeTimeStart} AND #{rechargeTimeStop} </if> </where> - + ORDER BY rec.operateDt DESC <if test="pageCurr != null and pageSize != null"> LIMIT ${pageCurr}, ${pageSize} </if> diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeWalletMapper.xml b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeWalletMapper.xml new file mode 100644 index 0000000..0263487 --- /dev/null +++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeWalletMapper.xml @@ -0,0 +1,90 @@ +<?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.SeWalletMapper"> + <resultMap id="BaseResultMap" type="com.dy.pipIrrGlobal.pojoSe.SeWallet"> + <!--@mbg.generated--> + <!--@Table se_wallet--> + <id column="id" jdbcType="BIGINT" property="id" /> + <result column="clientId" jdbcType="BIGINT" property="clientid" /> + <result column="money" jdbcType="FLOAT" property="money" /> + <result column="createDt" jdbcType="TIMESTAMP" property="createdt" /> + </resultMap> + <sql id="Base_Column_List"> + <!--@mbg.generated--> + id, clientId, money, createDt + </sql> + <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap"> + <!--@mbg.generated--> + select + <include refid="Base_Column_List" /> + from se_wallet + where id = #{id,jdbcType=BIGINT} + </select> + <delete id="deleteByPrimaryKey" parameterType="java.lang.Long"> + <!--@mbg.generated--> + delete from se_wallet + where id = #{id,jdbcType=BIGINT} + </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> + <insert id="insertSelective" parameterType="com.dy.pipIrrGlobal.pojoSe.SeWallet"> + <!--@mbg.generated--> + insert into se_wallet + <trim prefix="(" suffix=")" suffixOverrides=","> + <if test="id != null"> + id, + </if> + <if test="clientid != null"> + clientId, + </if> + <if test="money != null"> + money, + </if> + <if test="createdt != null"> + createDt, + </if> + </trim> + <trim prefix="values (" suffix=")" suffixOverrides=","> + <if test="id != null"> + #{id,jdbcType=BIGINT}, + </if> + <if test="clientid != null"> + #{clientid,jdbcType=BIGINT}, + </if> + <if test="money != null"> + #{money,jdbcType=FLOAT}, + </if> + <if test="createdt != null"> + #{createdt,jdbcType=TIMESTAMP}, + </if> + </trim> + </insert> + <update id="updateByPrimaryKeySelective" parameterType="com.dy.pipIrrGlobal.pojoSe.SeWallet"> + <!--@mbg.generated--> + update se_wallet + <set> + <if test="clientid != null"> + clientId = #{clientid,jdbcType=BIGINT}, + </if> + <if test="money != null"> + money = #{money,jdbcType=FLOAT}, + </if> + <if test="createdt != null"> + createDt = #{createdt,jdbcType=TIMESTAMP}, + </if> + </set> + where id = #{id,jdbcType=BIGINT} + </update> + <update id="updateByPrimaryKey" parameterType="com.dy.pipIrrGlobal.pojoSe.SeWallet"> + <!--@mbg.generated--> + update se_wallet + set clientId = #{clientid,jdbcType=BIGINT}, + money = #{money,jdbcType=FLOAT}, + createDt = #{createdt,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/SeWalletRechargeHistoryMapper.xml b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeWalletRechargeHistoryMapper.xml new file mode 100644 index 0000000..d8bfcb9 --- /dev/null +++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeWalletRechargeHistoryMapper.xml @@ -0,0 +1,137 @@ +<?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 new file mode 100644 index 0000000..127bceb --- /dev/null +++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeWalletRechargeMapper.xml @@ -0,0 +1,137 @@ +<?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.SeWalletRechargeMapper"> + <resultMap id="BaseResultMap" type="com.dy.pipIrrGlobal.pojoSe.SeWalletRecharge"> + <!--@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="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 + where id = #{id,jdbcType=BIGINT} + </select> + <delete id="deleteByPrimaryKey" parameterType="java.lang.Long"> + <!--@mbg.generated--> + delete from se_wallet_recharge + where id = #{id,jdbcType=BIGINT} + </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> + <insert id="insertSelective" parameterType="com.dy.pipIrrGlobal.pojoSe.SeWalletRecharge"> + <!--@mbg.generated--> + insert into se_wallet_recharge + <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.SeWalletRecharge"> + <!--@mbg.generated--> + update se_wallet_recharge + <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.SeWalletRecharge"> + <!--@mbg.generated--> + update se_wallet_recharge + 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-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/activeCard/ActiveCardCtrl.java b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/activeCard/ActiveCardCtrl.java index 67fb839..440e774 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/activeCard/ActiveCardCtrl.java +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/activeCard/ActiveCardCtrl.java @@ -5,11 +5,14 @@ import com.dy.common.webUtil.BaseResponseUtils; import com.dy.common.webUtil.QueryResultVo; import com.dy.common.webUtil.ResultCodeMsg; -import com.dy.pipIrrGlobal.pojoSe.*; +import com.dy.pipIrrGlobal.pojoSe.SeActiveCard; +import com.dy.pipIrrGlobal.pojoSe.SeClientCard; import com.dy.pipIrrGlobal.voSe.VoActiveCard; import com.dy.pipIrrSell.clientCard.CardStateENUM; import com.dy.pipIrrSell.clientCard.ClientCardSv; import com.dy.pipIrrSell.clientCard.LastOperateENUM; +import com.dy.pipIrrSell.recharge.DtoRecharge; +import com.dy.pipIrrSell.recharge.RechargeCtrl; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.media.Content; @@ -46,6 +49,8 @@ public class ActiveCardCtrl { private final ActiveCardSv activeCardSv; private final ClientCardSv clientCardSv; + + private final RechargeCtrl rechargeCtrl; @Operation(summary = "鑾峰緱涓�椤靛紑鍗¤褰�", description = "杩斿洖涓�椤靛紑鍗℃暟鎹�") @ApiResponses(value = { @@ -91,6 +96,7 @@ * cardAddr 姘村崱鍦板潃 * clientId 鍐滄埛缂栧彿 * cardCost 鍗$墖璐圭敤 + * amount 鍏呭�奸噾棰� * reissueAmount 琛ュ崱閲戦锛岃ˉ鍗℃椂浣跨敤 * paymentId 鏀粯鏂瑰紡缂栧彿 * remarks 澶囨敞 @@ -101,6 +107,7 @@ String cardAddr = po.getCardAddr(); Long clientId = po.getClientId(); Integer cardCost = po.getCardCost(); + Float amount = po.getAmount(); Long paymentId = po.getPaymentId(); String remarks = po.getRemarks(); Long operator = po.getOperator(); @@ -140,6 +147,17 @@ return BaseResponseUtils.buildFail("寮�鍗″け璐�-寮�鍗¤褰曞啓鍏ュ紓甯�"); } + + if(amount != null && amount > 0) { + DtoRecharge dtoRecharge = RechargeDtoMapper.INSTANCT.po2vo(po); + dtoRecharge.setMoney(0f); + dtoRecharge.setGift(0f); + BaseResponse<Boolean> job = rechargeCtrl.addRecharge(dtoRecharge); + if(!job.getCode().equals("0001")) { + return BaseResponseUtils.buildFail("寮�鍗℃垚鍔燂紝浣嗗厖鍊煎け璐�"); + } + } + return BaseResponseUtils.buildSuccess(true) ; } diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/activeCard/DtoActiveCard.java b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/activeCard/DtoActiveCard.java index 75b6535..bdf4fb4 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/activeCard/DtoActiveCard.java +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/activeCard/DtoActiveCard.java @@ -42,6 +42,13 @@ private Integer cardCost; /** + * 鍏呭�奸噾棰� + */ + @Schema(description = "鍏呭�奸噾棰�", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @Min(value = 0, message="鍏呭�奸噾棰濅笉鑳藉皬浜�0") + private Float amount; + + /** * 琛ュ崱閲戦 */ @Schema(description = "琛ュ崱閲戦", requiredMode = Schema.RequiredMode.NOT_REQUIRED) diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/activeCard/RechargeDtoMapper.java b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/activeCard/RechargeDtoMapper.java new file mode 100644 index 0000000..b44ca2c --- /dev/null +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/activeCard/RechargeDtoMapper.java @@ -0,0 +1,26 @@ +package com.dy.pipIrrSell.activeCard; + +import com.dy.pipIrrSell.recharge.DtoRecharge; +import org.mapstruct.Mapper; +import org.mapstruct.Mapping; +import org.mapstruct.factory.Mappers; + +/** + * @author ZhuBaoMin + * @date 2023/12/15 13:34 + * @LastEditTime 2023/12/15 13:34 + * @Description 灏咲toActiveCard鏄犲皠涓篋toRecharge + */ + +@Mapper +public interface RechargeDtoMapper { + RechargeDtoMapper INSTANCT = Mappers.getMapper(RechargeDtoMapper.class); + + @Mapping(target = "cardAddr", source = "cardAddr") + @Mapping(target = "clientId", source = "clientId") + @Mapping(target = "amount", source = "amount") + @Mapping(target = "paymentId", source = "paymentId") + @Mapping(target = "remarks", source = "remarks") + @Mapping(target = "operator", source = "operator") + DtoRecharge po2vo(DtoActiveCard po); +} diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/recharge/DtoRecharge.java b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/recharge/DtoRecharge.java index fc37f9e..2205441 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/recharge/DtoRecharge.java +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/recharge/DtoRecharge.java @@ -59,9 +59,9 @@ /** * 鍏呭�煎悗浣欓 */ - @Schema(description = "鍏呭�煎悗浣欓", requiredMode = Schema.RequiredMode.NOT_REQUIRED) - @Min(value = 0, message="鍏呭�煎悗浣欓涓嶈兘灏忎簬0") - private Float afterRecharge; + //@Schema(description = "鍏呭�煎悗浣欓", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + //@Min(value = 0, message="鍏呭�煎悗浣欓涓嶈兘灏忎簬0") + //private Float afterRecharge; /** * 浠樻鏂瑰紡缂栧彿 diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/recharge/QueryVo.java b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/recharge/QueryVo.java index 3498483..99ba48c 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/recharge/QueryVo.java +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/recharge/QueryVo.java @@ -24,6 +24,9 @@ @Schema(description = "鍐滄埛濮撳悕") public String clientName; + @Schema(description = "鍐滄埛缂栧彿") + private Long clientId; + @Schema(description = "IC鍗″彿") public String cardAddr; diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/recharge/RechargeCtrl.java b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/recharge/RechargeCtrl.java index 321d450..b795839 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/recharge/RechargeCtrl.java +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/recharge/RechargeCtrl.java @@ -5,7 +5,9 @@ import com.dy.common.webUtil.BaseResponseUtils; import com.dy.common.webUtil.QueryResultVo; import com.dy.common.webUtil.ResultCodeMsg; -import com.dy.pipIrrGlobal.pojoSe.*; +import com.dy.pipIrrGlobal.pojoSe.SeClientCard; +import com.dy.pipIrrGlobal.pojoSe.SeRecharge; +import com.dy.pipIrrGlobal.pojoSe.SeRechargeHistory; import com.dy.pipIrrGlobal.voSe.VoRecharge; import com.dy.pipIrrSell.clientCard.ClientCardSv; import com.dy.pipIrrSell.clientCard.LastOperateENUM; @@ -24,7 +26,6 @@ import org.springframework.validation.BindingResult; import org.springframework.web.bind.annotation.*; -import java.time.format.DateTimeFormatter; import java.util.Date; import java.util.List; import java.util.Objects; @@ -73,11 +74,18 @@ @Transactional(rollbackFor = Exception.class) @SsoAop("-1")//@SsoAop(power = "-1") public BaseResponse<Boolean> add(@RequestBody @Parameter(description = "form琛ㄥ崟json鏁版嵁", required = true) @Valid DtoRecharge 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()); } + return addRecharge(po); + } + /** + * 娣诲姞鍏呭�艰褰� + * @param po + * @return + */ + public BaseResponse<Boolean> addRecharge(DtoRecharge po){ /** * cardId 姘村崱缂栧彿锛堥潪浼犲叆鍙傛暟锛岀敱cardAddr鍙嶆煡锛� * cardAddr 姘村崱鍦板潃 @@ -98,7 +106,8 @@ Float money = po.getMoney(); Float amount = po.getAmount(); Float gift = po.getGift(); - Float afterRecharge = po.getAfterRecharge(); + //Float afterRecharge = po.getAfterRecharge(); + Float afterRecharge = money + amount + gift; Long paymentId = po.getPaymentId(); Float price = po.getPrice(); String remarks = po.getRemarks(); diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wallet/DtoWallet.java b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wallet/DtoWallet.java new file mode 100644 index 0000000..6fbce4d --- /dev/null +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wallet/DtoWallet.java @@ -0,0 +1,29 @@ +package com.dy.pipIrrSell.wallet; + +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotNull; +import lombok.*; + +/** + * @author ZhuBaoMin + * @date 2023/12/11 17:28 + * @LastEditTime 2023/12/11 17:28 + * @Description + */ + +@Data +@Builder +@ToString +@NoArgsConstructor +@AllArgsConstructor +@Schema(name = "娉ㄥ唽鐢靛瓙閽卞寘浼犲叆瀵硅薄") +public class DtoWallet { + public static final long serialVersionUID = 1L; + + /** + * 鍐滄埛缂栧彿 + */ + @Schema(description = "鍐滄埛缂栧彿", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @NotNull(message = "鍐滄埛缂栧彿涓嶈兘涓虹┖") + private Long clientId; +} diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wallet/DtoWalletRecharge.java b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wallet/DtoWalletRecharge.java new file mode 100644 index 0000000..89c9e0a --- /dev/null +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wallet/DtoWalletRecharge.java @@ -0,0 +1,50 @@ +package com.dy.pipIrrSell.wallet; + +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.Min; +import jakarta.validation.constraints.NotNull; +import lombok.*; + +/** + * @author ZhuBaoMin + * @date 2023/12/12 11:46 + * @LastEditTime 2023/12/12 11:46 + * @Description + */ + +@Data +@Builder +@ToString +@NoArgsConstructor +@AllArgsConstructor +@Schema(name = "鐢靛瓙閽卞寘鍏呭�间紶鍏ュ璞�") +public class DtoWalletRecharge { + public static final long serialVersionUID = 1L; + + /** + * 閽卞寘缂栧彿 + */ + @Schema(description = "閽卞寘缂栧彿", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @NotNull(message = "閽卞寘缂栧彿涓嶈兘涓虹┖") + private Long walletId; + + /** + * 鍐滄埛缂栧彿 + */ + @Schema(description = "鍐滄埛缂栧彿", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @NotNull(message = "鍐滄埛缂栧彿涓嶈兘涓虹┖") + private Long clientId; + + /** + * 鍏呭�奸噾棰� + */ + @Schema(description = "鍏呭�奸噾棰�", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @Min(value = 0, message="鍏呭�奸噾棰濅笉鑳藉皬浜�0") + private Float amount; + + /** + * 澶囨敞淇℃伅 + */ + @Schema(description = "澶囨敞", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + private String remarks; +} 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 new file mode 100644 index 0000000..0e6d4a6 --- /dev/null +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wallet/WalletCtrl.java @@ -0,0 +1,105 @@ +package com.dy.pipIrrSell.wallet; + +import com.dy.common.aop.SsoAop; +import com.dy.common.webUtil.BaseResponse; +import com.dy.common.webUtil.BaseResponseUtils; +import com.dy.common.webUtil.ResultCodeMsg; +import com.dy.pipIrrGlobal.pojoSe.SeWallet; +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.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.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 java.util.Date; +import java.util.Optional; + +/** + * @author ZhuBaoMin + * @date 2023/12/11 16:36 + * @LastEditTime 2023/12/11 16:36 + * @Description + */ + +@Slf4j +@Tag(name = "鐢靛瓙閽卞寘绠$悊", description = "鐢靛瓙閽卞寘绠$悊") +@RestController +@RequestMapping(path="wallet") +@RequiredArgsConstructor +@Validated +public class WalletCtrl { + private final WalletSv walletSv; + + @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") + @Transactional(rollbackFor = Exception.class) + @SsoAop("-1")//@SsoAop(power = "-1") + //public BaseResponse<Boolean> add(@RequestBody Long clientId){ + public BaseResponse<Boolean> add(@RequestParam("clientId") @NotNull(message = "鍐滄埛缂栧彿涓嶈兘涓虹┖") Long clientId){ + if(clientId == null || clientId < 0) { + return BaseResponseUtils.buildFail("鍐滄埛缂栧彿涓嶈兘涓虹┖"); + } + + 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) ; + } + + //@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("-1")//@SsoAop(power = "-1") + //public BaseResponse<Boolean> addRecharge(@RequestBody @Parameter(description = "form琛ㄥ崟json鏁版嵁", required = true) @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) ; + //} +} 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 new file mode 100644 index 0000000..2e7b236 --- /dev/null +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wallet/WalletSv.java @@ -0,0 +1,79 @@ +package com.dy.pipIrrSell.wallet; + +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 lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +/** + * @author ZhuBaoMin + * @date 2023/12/11 16:36 + * @LastEditTime 2023/12/11 16:36 + * @Description + */ + +@Slf4j +@Service +public class WalletSv { + @Autowired + private SeWalletMapper seWalletMapper; + + @Autowired + private SeWalletRechargeMapper seWalletRechargeMapper; + + @Autowired + private SeWalletRechargeHistoryMapper seWalletRechargeHistoryMapper; + + /** + * 娉ㄥ唽鐢靛瓙閽卞寘璐﹀彿 + * @param po + * @return + */ + public Integer add(SeWallet po) { + return seWalletMapper.insert(po); + } + + /** + * 鏍规嵁缂栧彿浠庨挶鍖呰〃涓幏鍙栬閽卞寘浣欓 + * @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); + } +} -- Gitblit v1.8.0