From ab37d7d33e2484ee97a602f348ab475101389149 Mon Sep 17 00:00:00 2001 From: Administrator <zhubaomin> Date: 星期三, 31 一月 2024 21:19:18 +0800 Subject: [PATCH] 2024-01-31 朱宝民 电子钱包4个查询接口 --- pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSe/SeConsumeMapper.java | 26 ++ pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSe/VoWallet.java | 33 ++ pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeConsumeMapper.xml | 50 +++ pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeWalletMapper.xml | 36 ++ pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeRefundMapper.xml | 51 +++ pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wallet/qo/QoWalletRecharge.java | 28 ++ pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSe/VoWalletRecharge.java | 41 +++ pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSe/SeWalletRechargeMapper.java | 18 + pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wallet/WalletCtrl.java | 125 +++++++++ pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wallet/qo/QueryVo.java | 25 + pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/result/SellResultCode.java | 5 pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSe/SeWalletMapper.java | 18 + pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeWalletRechargeMapper.xml | 53 ++++ pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSe/SeRefundMapper.java | 18 + pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSe/VoWalletRefund.java | 52 ++++ pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wallet/WalletSv.java | 130 ++++++++++ pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSe/VoWalletConsume.java | 37 ++ 17 files changed, 743 insertions(+), 3 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 index 8f2a2c8..918b3e2 100644 --- 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 @@ -2,7 +2,12 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.dy.pipIrrGlobal.pojoSe.SeConsume; +import com.dy.pipIrrGlobal.voSe.VoWalletConsume; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; +import java.util.Map; /** * @author ZhuBaoMin @@ -24,4 +29,25 @@ int updateByPrimaryKeySelective(SeConsume record); int updateByPrimaryKey(SeConsume record); + + /** + * 鏍规嵁鍐滄埛ID鑾峰彇娑堣垂姹囨�昏褰� + * @param clientId + * @return + */ + Map getWalletConsumeSum(@Param("clientId") Long clientId); + + /** + * 鏍规嵁鍐滄埛ID鑾峰彇鐢靛瓙閽卞寘娑堣垂璁板綍鏁� + * @param params + * @return + */ + Long getRecordCount(Map<?, ?> params); + + /*** + * 鏍规嵁鍐滄埛ID鑾峰彇鐢靛瓙閽卞寘娑堣垂璁板綍 + * @param params + * @return + */ + List<VoWalletConsume> getWalletConsumes(Map<?, ?> params); } \ 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 index 729ed2d..5acfd32 100644 --- 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 @@ -2,8 +2,12 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.dy.pipIrrGlobal.pojoSe.SeRefund; +import com.dy.pipIrrGlobal.voSe.VoWalletRefund; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; + +import java.util.List; +import java.util.Map; /** * @author ZhuBaoMin @@ -32,4 +36,18 @@ * @return */ SeRefund getRefundByWallerId(@Param("walletId") Long walletId); + + /** + * 鏍规嵁鎸囧畾鏉′欢鑾峰彇鐢靛瓙閽卞寘閫�娆捐褰曟暟 + * @param params + * @return + */ + Long getRecordCount(Map<?, ?> params); + + /*** + * 鏍规嵁鎸囧畾鏉′欢鑾峰彇鐢靛瓙閽卞寘閫�娆捐褰� + * @param params + * @return + */ + List<VoWalletRefund> getWalletRefunds(Map<?, ?> params); } \ 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 b1edd5e..45f3f55 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 @@ -2,8 +2,12 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.dy.pipIrrGlobal.pojoSe.SeWallet; +import com.dy.pipIrrGlobal.voSe.VoWallet; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; + +import java.util.List; +import java.util.Map; /** * @author ZhuBaoMin @@ -32,4 +36,18 @@ * @return */ SeWallet getWalletByClientId(@Param("clientId") Long clientId); + + /** + * 鏍规嵁鍐滄埛濮撳悕鑾峰彇鐢靛瓙閽卞寘璐︽埛璁板綍鏁� + * @param params + * @return + */ + Long getRecordCount(Map<?, ?> params); + + /*** + * 鏍规嵁鍐滄埛濮撳悕鑾峰彇鐢靛瓙閽卞寘璐︽埛璁板綍 + * @param params + * @return + */ + List<VoWallet> getWallets(Map<?, ?> params); } \ 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 b1e11ea..b7a299c 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 @@ -2,7 +2,11 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.dy.pipIrrGlobal.pojoSe.SeWalletRecharge; +import com.dy.pipIrrGlobal.voSe.VoWalletRecharge; import org.apache.ibatis.annotations.Mapper; + +import java.util.List; +import java.util.Map; /** * @author ZhuBaoMin @@ -24,4 +28,18 @@ int updateByPrimaryKeySelective(SeWalletRecharge record); int updateByPrimaryKey(SeWalletRecharge record); + + /** + * 鏍规嵁鎸囧畾鏉′欢鑾峰彇鐢靛瓙閽卞寘鍏呭�艰褰曟暟 + * @param params + * @return + */ + Long getRecordCount(Map<?, ?> params); + + /*** + * 鏍规嵁鎸囧畾鏉′欢鑾峰彇鐢靛瓙閽卞寘鍏呭�艰褰� + * @param params + * @return + */ + List<VoWalletRecharge> getWalletRecharges(Map<?, ?> params); } \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSe/VoWallet.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSe/VoWallet.java new file mode 100644 index 0000000..1dbb3a8 --- /dev/null +++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSe/VoWallet.java @@ -0,0 +1,33 @@ +package com.dy.pipIrrGlobal.voSe; + +import com.dy.common.po.BaseEntity; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +/** + * @author ZhuBaoMin + * @date 2024-01-31 16:15 + * @LastEditTime 2024-01-31 16:15 + * @Description + */ + +@Data +@Schema(title = "鐢靛瓙閽卞寘璐︽埛瑙嗗浘瀵硅薄") +public class VoWallet implements BaseEntity { + private static final long serialVersionUID = 202401311618001L; + + @Schema(title = "鍐滄埛ID") + private String clientId; + + @Schema(title = "鍐滄埛濮撳悕") + private String name; + + @Schema(title = "鍐滄埛缂栧彿") + private String clientNum; + + @Schema(title = "鎵嬫満鍙�") + private String phone; + + @Schema(title = "鐢靛瓙閽卞寘浣欓") + private Double money; +} diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSe/VoWalletConsume.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSe/VoWalletConsume.java new file mode 100644 index 0000000..6abcf8b --- /dev/null +++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSe/VoWalletConsume.java @@ -0,0 +1,37 @@ +package com.dy.pipIrrGlobal.voSe; + +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import org.springframework.format.annotation.DateTimeFormat; + +import java.util.Date; + +/** + * @author ZhuBaoMin + * @date 2024-01-31 18:23 + * @LastEditTime 2024-01-31 18:23 + * @Description + */ + +@Data +@Schema(title = "鐢靛瓙閽卞寘娑堣垂瑙嗗浘瀵硅薄") +public class VoWalletConsume { + private static final long serialVersionUID = 202401311824001L; + + @Schema(title = "娑堣垂閲戦") + private Double consumption; + + @Schema(title = "鐢ㄦ按鏃堕暱") + private Double duration; + + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + @Schema(title = "寮�闃�鏃堕棿") + private Date vot; + + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + @Schema(title = "鍏抽榾鏃堕棿") + private Date vct; +} diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSe/VoWalletRecharge.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSe/VoWalletRecharge.java new file mode 100644 index 0000000..7d9ea1e --- /dev/null +++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSe/VoWalletRecharge.java @@ -0,0 +1,41 @@ +package com.dy.pipIrrGlobal.voSe; + +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import org.springframework.format.annotation.DateTimeFormat; + +import java.util.Date; + +/** + * @author ZhuBaoMin + * @date 2024-01-31 16:43 + * @LastEditTime 2024-01-31 16:43 + * @Description + */ + +@Data +@Schema(title = "鐢靛瓙閽卞寘鍏呭�艰鍥惧璞�") +public class VoWalletRecharge { + private static final long serialVersionUID = 202401311644001L; + + @Schema(title = "鍐滄埛濮撳悕") + private String name; + + @Schema(title = "鍐滄埛缂栧彿") + private String clientNum; + + @Schema(title = "鎵嬫満鍙�") + private String phone; + + @Schema(title = "鍏呭�奸噾棰�") + private Double amount; + + @Schema(title = "鐢靛瓙閽卞寘浣欓") + private Double afterRecharge; + + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + @Schema(title = "鍏呭�兼椂闂�") + private Date rechargeTime; +} diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSe/VoWalletRefund.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSe/VoWalletRefund.java new file mode 100644 index 0000000..7d0dd24 --- /dev/null +++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSe/VoWalletRefund.java @@ -0,0 +1,52 @@ +package com.dy.pipIrrGlobal.voSe; + +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import org.springframework.format.annotation.DateTimeFormat; + +import java.util.Date; + +/** + * @author ZhuBaoMin + * @date 2024-01-31 18:29 + * @LastEditTime 2024-01-31 18:29 + * @Description + */ + +@Data +@Schema(title = "鐢靛瓙閽卞寘閫�娆捐鍥惧璞�") +public class VoWalletRefund { + private static final long serialVersionUID = 202401311830001L; + + @Schema(title = "鍐滄埛濮撳悕") + private String name; + + @Schema(title = "鍐滄埛缂栧彿") + private String clientNum; + + @Schema(title = "鎵嬫満鍙�") + private String phone; + + @Schema(title = "鐢宠閫�娆鹃噾棰�") + private Double refundAmount; + + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + @Schema(title = "鐢宠鏃堕棿") + private Date applicationTime; + + @Schema(title = "閫�娆剧姸鎬佷唬鐮�") + private Byte refundStatus; + + @Schema(title = "閫�娆剧姸鎬佸悕绉�") + private String refundStatusName; + + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + @Schema(title = "瀹℃牳鏃堕棿") + private Date auditTime; + + @Schema(title = "瀹℃牳澶囨敞") + private String remarks; +} diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeConsumeMapper.xml b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeConsumeMapper.xml index ca42c78..5f5ffb9 100644 --- a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeConsumeMapper.xml +++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeConsumeMapper.xml @@ -147,4 +147,54 @@ vct = #{vct,jdbcType=TIMESTAMP} where id = #{id,jdbcType=BIGINT} </update> + + <!--鏍规嵁鍐滄埛ID鑾峰彇娑堣垂姹囨�昏褰�--> + <select id="getWalletConsumeSum" resultType="java.util.Map"> + SELECT + cli.name AS clientName, + cli.clientNum, + wal.money, + (SELECT SUM(consumption) FROM se_consume WHERE client_id = cli.id) AS totalConsume + FROM se_client cli + INNER JOIN se_wallet wal ON wal.client_id = cli.id + <where> + <if test = "clientId != null and clientId > 0"> + AND cli.id = ${clientId} + </if> + </where> + + </select> + + <!--鏍规嵁鍐滄埛ID鑾峰彇鐢靛瓙閽卞寘娑堣垂璁板綍鏁�--> + <select id="getRecordCount" parameterType="java.util.Map" resultType="java.lang.Long"> + SELECT + COUNT(*) AS recordCount + FROM se_consume + <where> + <if test = "clientId != null and clientId > 0"> + AND client_id = ${clientId} + </if> + </where> + </select> + + <!--鏍规嵁鍐滄埛ID鑾峰彇鐢靛瓙閽卞寘娑堣垂璁板綍--> + <select id="getWalletConsumes" resultType="com.dy.pipIrrGlobal.voSe.VoWalletConsume"> + SELECT + consumption, + duration, + vot, + vct + FROM se_consume + <where> + <if test = "clientId != null and clientId > 0"> + AND client_id = ${clientId} + </if> + </where> + ORDER BY vct DESC + <trim prefix="limit " > + <if test="start != null and count != null"> + #{start,javaType=Integer,jdbcType=INTEGER}, #{count,javaType=Integer,jdbcType=INTEGER} + </if> + </trim> + </select> </mapper> \ 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 index 9576315..5fc7a50 100644 --- a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeRefundMapper.xml +++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeRefundMapper.xml @@ -178,4 +178,55 @@ from se_refund where refund_status = 1 AND wallet_id = ${walletId} </select> + + <!--鏍规嵁鎸囧畾鏉′欢鑾峰彇鐢靛瓙閽卞寘閫�娆捐褰曟暟--> + <select id="getRecordCount" parameterType="java.util.Map" resultType="java.lang.Long"> + SELECT + COUNT(*) AS recordCount + FROM se_refund ref + INNER JOIN se_client cli ON ref.client_id = cli.id + <where> + <if test = "refundStatus != null and refundStatus > 0"> + AND ref.refund_status = ${refundStatus} + </if> + + <if test = "clientName != null and clientName !=''"> + AND cli.name like CONCAT('%',#{clientName},'%') + </if> + </where> + </select> + + <!--鏍规嵁鎸囧畾鏉′欢鑾峰彇鐢靛瓙閽卞寘閫�娆捐褰�--> + <select id="getWalletRefunds" resultType="com.dy.pipIrrGlobal.voSe.VoWalletRefund"> + SELECT + cli.`name`, + cli.clientNum, + cli.phone, + ref.refund_amount AS refundAmount, + ref.application_time AS applicationTime, + ref.refund_status AS refundStatus, + (CASE + WHEN ref.refund_status = 1 THEN '鏈��娆�' + WHEN ref.refund_status = 2 THEN '宸查��娆�' + End) AS refundStatusName, + ref.audit_time AS auditTime, + ref.remarks + FROM se_refund ref + INNER JOIN se_client cli ON ref.client_id = cli.id + <where> + <if test = "refundStatus != null and refundStatus > 0"> + AND ref.refund_status = ${refundStatus} + </if> + + <if test = "clientName != null and clientName !=''"> + AND cli.name like CONCAT('%',#{clientName},'%') + </if> + </where> + ORDER BY ref.application_time DESC + <trim prefix="limit " > + <if test="start != null and count != null"> + #{start,javaType=Integer,jdbcType=INTEGER}, #{count,javaType=Integer,jdbcType=INTEGER} + </if> + </trim> + </select> </mapper> \ 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 aa60383..59a7dcd 100644 --- a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeWalletMapper.xml +++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeWalletMapper.xml @@ -121,4 +121,40 @@ WHERE client_id = ${clientId} LIMIT 0,1 </select> + + <!--鏍规嵁鍐滄埛濮撳悕鑾峰彇鐢靛瓙閽卞寘璐︽埛璁板綍鏁�--> + <select id="getRecordCount" parameterType="java.util.Map" resultType="java.lang.Long"> + SELECT + COUNT(*) AS recordCount + FROM se_wallet wal + INNER JOIN se_client cli ON wal.client_id = cli.id + <where> + <if test = "clientName != null and clientName !=''"> + AND cli.name like CONCAT('%',#{clientName},'%') + </if> + </where> + </select> + + <!--鏍规嵁鍐滄埛濮撳悕鑾峰彇鐢靛瓙閽卞寘璐︽埛璁板綍--> + <select id="getWallets" resultType="com.dy.pipIrrGlobal.voSe.VoWallet"> + SELECT + CAST(cli.id AS char) AS clientId, + cli.`name`, + cli.clientNum, + cli.phone, + wal.money + FROM se_wallet wal + INNER JOIN se_client cli ON wal.client_id = cli.id + <where> + <if test = "clientName != null and clientName !=''"> + AND cli.name like CONCAT('%',#{clientName},'%') + </if> + </where> + ORDER BY wal.last_operate_time DESC + <trim prefix="limit " > + <if test="start != null and count != null"> + #{start,javaType=Integer,jdbcType=INTEGER}, #{count,javaType=Integer,jdbcType=INTEGER} + </if> + </trim> + </select> </mapper> \ 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 44fb44a..cb9d41c 100644 --- a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeWalletRechargeMapper.xml +++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeWalletRechargeMapper.xml @@ -123,4 +123,57 @@ recharge_time = #{rechargeTime,jdbcType=TIMESTAMP} where id = #{id,jdbcType=BIGINT} </update> + + <!--鏍规嵁鎸囧畾鏉′欢鑾峰彇鐢靛瓙閽卞寘鍏呭�艰褰曟暟--> + <select id="getRecordCount" parameterType="java.util.Map" resultType="java.lang.Long"> + SELECT + COUNT(*) AS recordCount + FROM se_wallet_recharge rec + INNER JOIN se_client cli ON rec.client_id = cli.id + <where> + <if test = "walletId != null and walletId > 0"> + AND rec.wallet_id = ${walletId} + </if> + + <if test = "clientName != null and clientName !=''"> + AND cli.name like CONCAT('%',#{clientName},'%') + </if> + + <if test = "timeStart != null and timeStop != null"> + AND rec.recharge_time BETWEEN #{timeStart} AND #{timeStop} + </if> + </where> + </select> + + <!--鏍规嵁鎸囧畾鏉′欢鑾峰彇鐢靛瓙閽卞寘鍏呭�艰褰�--> + <select id="getWalletRecharges" resultType="com.dy.pipIrrGlobal.voSe.VoWalletRecharge"> + SELECT + cli.`name`, + cli.clientNum, + cli.phone, + rec.amount, + rec.after_recharge AS afterRecharge, + rec.recharge_time AS rechargeTime + FROM se_wallet_recharge rec + INNER JOIN se_client cli ON rec.client_id = cli.id + <where> + <if test = "walletId != null and walletId > 0"> + AND rec.wallet_id = ${walletId} + </if> + + <if test = "clientName != null and clientName !=''"> + AND cli.name like CONCAT('%',#{clientName},'%') + </if> + + <if test = "timeStart != null and timeStop != null"> + AND rec.recharge_time BETWEEN #{timeStart} AND #{timeStop} + </if> + </where> + ORDER BY rec.recharge_time DESC + <trim prefix="limit " > + <if test="start != null and count != null"> + #{start,javaType=Integer,jdbcType=INTEGER}, #{count,javaType=Integer,jdbcType=INTEGER} + </if> + </trim> + </select> </mapper> \ 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 f61de07..a5b4e35 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 @@ -89,7 +89,10 @@ REFUND_AMOUNT_CANNOT_GREATER_THAN_MONEY(90009, "鐢宠閫�娆惧け璐ワ紝閫�娆鹃噾棰濅笉鑳藉ぇ浜庝綑棰�"), APPLICATION_REFUND_FAIL(900010, "鐢宠閫�娆惧け璐�"), NO_TO_AUDIT_REFUND(900011, "璇ョ數瀛愰挶鍖呮病鏈夊緟瀹℃牳鐨勯��娆剧敵璇�"), - AUDIT_REFUND_FAIL(900012, "瀹℃牳閫�娆剧敵璇峰け璐�"); + AUDIT_REFUND_FAIL(900012, "瀹℃牳閫�娆剧敵璇峰け璐�"), + No_WALLER_RECHARGES(900013, "娌℃湁绗﹀悎鏉′欢鐨勫厖鍊兼暟鎹�"), + WALLET_CLIENT_ID_CANNOT_BE_NULL(900014, "鏌ヨ鐢靛瓙閽卞寘娑堣垂姹囨�诲け璐ワ紝鍐滄埛ID涓嶈兘涓虹┖"), + No_REFUNDS(900015, "娌℃湁绗﹀悎鏉′欢鐨勯��娆炬暟鎹�"); private final Integer code; private final String message; 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 780d2dd..500dd92 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 @@ -3,14 +3,21 @@ import com.dy.common.aop.SsoAop; import com.dy.common.webUtil.BaseResponse; import com.dy.common.webUtil.BaseResponseUtils; +import com.dy.common.webUtil.QueryResultVo; import com.dy.common.webUtil.ResultCodeMsg; import com.dy.pipIrrGlobal.pojoSe.SeConsume; import com.dy.pipIrrGlobal.pojoSe.SeRefund; import com.dy.pipIrrGlobal.pojoSe.SeWallet; import com.dy.pipIrrGlobal.pojoSe.SeWalletRecharge; +import com.dy.pipIrrGlobal.voSe.VoActiveCard; +import com.dy.pipIrrGlobal.voSe.VoWallet; +import com.dy.pipIrrGlobal.voSe.VoWalletRecharge; +import com.dy.pipIrrGlobal.voSe.VoWalletRefund; import com.dy.pipIrrSell.result.SellResultCode; import com.dy.pipIrrSell.wallet.enums.LastOperateENUM; import com.dy.pipIrrSell.wallet.enums.RefundStatusENUM; +import com.dy.pipIrrSell.wallet.qo.QoWalletRecharge; +import com.dy.pipIrrSell.wallet.qo.QueryVo; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; @@ -28,8 +35,7 @@ import org.springframework.web.bind.annotation.*; import java.text.DecimalFormat; -import java.util.Date; -import java.util.Optional; +import java.util.*; /** * @author ZhuBaoMin @@ -326,4 +332,119 @@ } return BaseResponseUtils.buildSuccess(true) ; } + + /** + * 鏍规嵁鍐滄埛濮撳悕鑾峰彇鐢靛瓙閽卞寘璐︽埛璁板綍 + * @param vo + * @return + */ + @Operation(summary = "鑾峰彇鐢靛瓙閽卞寘璐︽埛璁板綍", description = "杩斿洖鐢靛瓙閽卞寘璐︽埛璁板綍") + @ApiResponses(value = { + @ApiResponse( + responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE, + description = "杩斿洖涓�椤佃ˉ鍗℃暟鎹紙BaseResponse.content:QueryResultVo[{}]锛�", + content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE, + schema = @Schema(implementation = VoActiveCard.class))} + ) + }) + @GetMapping(path = "/get_wallets") + @SsoAop() + public BaseResponse<QueryResultVo<List<VoWallet>>> getWallets(QueryVo vo){ + try { + QueryResultVo<List<VoWallet>> res = walletSv.getWallets(vo); + if(res.itemTotal == 0) { + return BaseResponseUtils.buildFail(SellResultCode.No_ReissueCards.getMessage()); + } + return BaseResponseUtils.buildSuccess(res); + } catch (Exception e) { + log.error("鑾峰彇鐢靛瓙閽卞寘璐︽埛璁板綍", e); + return BaseResponseUtils.buildException(e.getMessage()) ; + } + } + + /** + * 鑾峰彇鐢靛瓙閽卞寘鍏呭�艰褰� + * @param vo + * @return + */ + @Operation(summary = "鑾峰彇鐢靛瓙閽卞寘鍏呭�艰褰�", description = "杩斿洖鐢靛瓙閽卞寘鍏呭�艰褰�") + @ApiResponses(value = { + @ApiResponse( + responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE, + description = "杩斿洖涓�椤佃ˉ鍗℃暟鎹紙BaseResponse.content:QueryResultVo[{}]锛�", + content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE, + schema = @Schema(implementation = VoActiveCard.class))} + ) + }) + @GetMapping(path = "/get_recharges") + @SsoAop() + public BaseResponse<QueryResultVo<List<VoWalletRecharge>>> getWalletRecharges(QoWalletRecharge vo){ + try { + QueryResultVo<List<VoWalletRecharge>> res = walletSv.getWalletRecharges(vo); + if(res.itemTotal == 0) { + return BaseResponseUtils.buildFail(SellResultCode.No_WALLER_RECHARGES.getMessage()); + } + return BaseResponseUtils.buildSuccess(res); + } catch (Exception e) { + log.error("鑾峰彇鐢靛瓙閽卞寘鍏呭�艰褰曞紓甯�", e); + return BaseResponseUtils.buildException(e.getMessage()) ; + } + } + + @Operation(summary = "鑾峰彇鐢靛瓙閽卞寘娑堣垂璁板綍", description = "杩斿洖鐢靛瓙閽卞寘娑堣垂璁板綍") + @ApiResponses(value = { + @ApiResponse( + responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE, + description = "杩斿洖涓�椤佃ˉ鍗℃暟鎹紙BaseResponse.content:QueryResultVo[{}]锛�", + content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE, + schema = @Schema(implementation = VoActiveCard.class))} + ) + }) + @GetMapping(path = "/get_consume") + @SsoAop() + public BaseResponse<Map> getWalletConsumes(QueryVo vo){ + Long clientId = Optional.ofNullable(vo.getClientId()).orElse(0L); + if(clientId == 0) { + return BaseResponseUtils.buildFail(SellResultCode.WALLET_CLIENT_ID_CANNOT_BE_NULL.getMessage()); + } + try { + Map res = Optional.ofNullable(walletSv.getWalletConsumes(vo)).orElse(new HashMap()); + if(res.size() <= 0) { + return BaseResponseUtils.buildFail(SellResultCode.No_WALLER_RECHARGES.getMessage()); + } + return BaseResponseUtils.buildSuccess(res); + } catch (Exception e) { + log.error("鑾峰彇鐢靛瓙閽卞寘鍏呭�艰褰曞紓甯�", e); + return BaseResponseUtils.buildException(e.getMessage()) ; + } + } + + /** + * 鑾峰彇鐢靛瓙閽卞寘閫�娆捐褰� + * @param vo + * @return + */ + @Operation(summary = "鑾峰彇鐢靛瓙閽卞寘閫�娆捐褰�", description = "杩斿洖鐢靛瓙閽卞寘閫�娆捐褰�") + @ApiResponses(value = { + @ApiResponse( + responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE, + description = "杩斿洖涓�椤佃ˉ鍗℃暟鎹紙BaseResponse.content:QueryResultVo[{}]锛�", + content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE, + schema = @Schema(implementation = VoActiveCard.class))} + ) + }) + @GetMapping(path = "/get_refunds") + @SsoAop() + public BaseResponse<QueryResultVo<List<VoWalletRefund>>> getWalletRefunds(QueryVo vo){ + try { + QueryResultVo<List<VoWalletRefund>> res = walletSv.getWalletRefunds(vo); + if(res.itemTotal == 0) { + return BaseResponseUtils.buildFail(SellResultCode.No_REFUNDS.getMessage()); + } + return BaseResponseUtils.buildSuccess(res); + } catch (Exception e) { + log.error("鑾峰彇鐢靛瓙閽卞寘閫�娆捐褰曞紓甯�", e); + return BaseResponseUtils.buildException(e.getMessage()) ; + } + } } 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 56626f5..3fafbb3 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,5 +1,6 @@ package com.dy.pipIrrSell.wallet; +import com.dy.common.webUtil.QueryResultVo; import com.dy.pipIrrGlobal.daoSe.SeConsumeMapper; import com.dy.pipIrrGlobal.daoSe.SeRefundMapper; import com.dy.pipIrrGlobal.daoSe.SeWalletMapper; @@ -8,9 +9,21 @@ import com.dy.pipIrrGlobal.pojoSe.SeRefund; import com.dy.pipIrrGlobal.pojoSe.SeWallet; import com.dy.pipIrrGlobal.pojoSe.SeWalletRecharge; +import com.dy.pipIrrGlobal.voSe.VoWallet; +import com.dy.pipIrrGlobal.voSe.VoWalletConsume; +import com.dy.pipIrrGlobal.voSe.VoWalletRecharge; +import com.dy.pipIrrGlobal.voSe.VoWalletRefund; +import com.dy.pipIrrSell.wallet.qo.QueryVo; +import com.dy.pipIrrSell.wallet.qo.QoWalletRecharge; import lombok.extern.slf4j.Slf4j; +import org.apache.dubbo.common.utils.PojoUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Optional; /** * @author ZhuBaoMin @@ -111,4 +124,121 @@ return seWalletMapper.updateByPrimaryKeySelective(po); } + + /** + * 鏍规嵁鍐滄埛濮撳悕鑾峰彇鐢靛瓙閽卞寘璐︽埛璁板綍 + * @param queryVo + * @return + */ + public QueryResultVo<List<VoWallet>> getWallets(QueryVo queryVo) { + Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(queryVo); + + Long itemTotal = seWalletMapper.getRecordCount(params); + + QueryResultVo<List<VoWallet>> rsVo = new QueryResultVo<>() ; + rsVo.pageSize = queryVo.pageSize ; + rsVo.pageCurr = queryVo.pageCurr ; + + rsVo.calculateAndSet(itemTotal, params); + rsVo.obj = seWalletMapper.getWallets(params); + return rsVo ; + } + + /** + * 鏍规嵁鎸囧畾鏉′欢鑾峰彇鐢靛瓙閽卞寘鍏呭�艰褰� + * @param queryVo + * @return + */ + public QueryResultVo<List<VoWalletRecharge>> getWalletRecharges(QoWalletRecharge queryVo) { + //瀹屽杽鏌ヨ鍏呭�艰褰曠殑璧锋鏃堕棿 + String timeStart = queryVo.getTimeStart(); + String timeStop = queryVo.getTimeStop(); + if(timeStart != null) { + timeStart = timeStart + " 00:00:00"; + queryVo.setTimeStart(timeStart); + } + if(timeStop != null) { + timeStop = timeStop + " 23:59:59"; + queryVo.setTimeStop(timeStop); + } + + Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(queryVo); + + Long itemTotal = seWalletRechargeMapper.getRecordCount(params); + + QueryResultVo<List<VoWalletRecharge>> rsVo = new QueryResultVo<>() ; + rsVo.pageSize = queryVo.pageSize ; + rsVo.pageCurr = queryVo.pageCurr ; + + rsVo.calculateAndSet(itemTotal, params); + rsVo.obj = seWalletRechargeMapper.getWalletRecharges(params); + return rsVo ; + } + + /** + * 鏍规嵁鍐滄埛ID鑾峰彇鐢靛瓙閽卞寘娑堣垂璁板綍 + * @param queryVo + * @return + */ + public Map getWalletConsumes(QueryVo queryVo) { + // 鑾峰彇鐢靛瓙閽卞寘娑堣垂姹囨�讳俊鎭� + String clientName = ""; + String clientNum = ""; + Double money = 0.0; + Double totalConsume = 0.0; + Long clientId = Optional.ofNullable(queryVo.getClientId()).orElse(0L); + Map map_consumeSum = Optional.ofNullable(seConsumeMapper.getWalletConsumeSum(clientId)).orElse(new HashMap()); + if(map_consumeSum.size() > 0) { + clientName = map_consumeSum.get("clientName").toString(); + clientNum = map_consumeSum.get("clientNum").toString(); + money = Double.parseDouble(map_consumeSum.get("money").toString()); + totalConsume = Double.parseDouble(map_consumeSum.get("totalConsume").toString()); + } + + Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(queryVo); + Long itemTotal = seConsumeMapper.getRecordCount(params); + + QueryResultVo<List<VoWalletConsume>> rsVo = new QueryResultVo<>() ; + rsVo.pageSize = queryVo.pageSize ; + rsVo.pageCurr = queryVo.pageCurr ; + + rsVo.calculateAndSet(itemTotal, params); + List<VoWalletConsume> list = seConsumeMapper.getWalletConsumes(params); + + + Map map_record = new HashMap(); + map_record.put("itemTotal", rsVo.itemTotal); + map_record.put("pageCurr", rsVo.pageCurr); + map_record.put("pageSize", rsVo.pageSize); + map_record.put("pageTotal", rsVo.pageTotal); + map_record.put("list", list); + + Map map_result = new HashMap(); + map_result.put("clientName", clientName); + map_result.put("clientNum", clientNum); + map_result.put("money", money); + map_result.put("totalConsume", totalConsume); + map_result.put("records", map_record); + + return map_result; + } + + /** + * 鏍规嵁鎸囧畾鏉′欢鑾峰彇鐢靛瓙閽卞寘閫�娆捐褰� + * @param queryVo + * @return + */ + public QueryResultVo<List<VoWalletRefund>> getWalletRefunds(QueryVo queryVo) { + Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(queryVo); + + Long itemTotal = seRefundMapper.getRecordCount(params); + + QueryResultVo<List<VoWalletRefund>> rsVo = new QueryResultVo<>() ; + rsVo.pageSize = queryVo.pageSize ; + rsVo.pageCurr = queryVo.pageCurr ; + + rsVo.calculateAndSet(itemTotal, params); + rsVo.obj = seRefundMapper.getWalletRefunds(params); + return rsVo ; + } } diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wallet/qo/QoWalletRecharge.java b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wallet/qo/QoWalletRecharge.java new file mode 100644 index 0000000..1f5ac6f --- /dev/null +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wallet/qo/QoWalletRecharge.java @@ -0,0 +1,28 @@ +package com.dy.pipIrrSell.wallet.qo; + +import com.dy.common.webUtil.QueryConditionVo; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +/** + * @author ZhuBaoMin + * @date 2024-01-31 19:27 + * @LastEditTime 2024-01-31 19:27 + * @Description + */ + +@Data +@Schema(name = "鐢靛瓙閽卞寘鍏呭�兼煡璇㈡潯浠�") +public class QoWalletRecharge extends QueryConditionVo { + @Schema(description = "鐢靛瓙閽卞寘璐︽埛ID") + public Long walletId; + + @Schema(description = "鍐滄埛濮撳悕") + public String clientName; + + @Schema(description = "鍏呭�兼満鏃堕棿_寮�濮�") + public String timeStart; + + @Schema(description = "鍏呭�兼満鏃堕棿_缁撴潫") + public String timeStop; +} diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wallet/qo/QueryVo.java b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wallet/qo/QueryVo.java new file mode 100644 index 0000000..7609fbd --- /dev/null +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wallet/qo/QueryVo.java @@ -0,0 +1,25 @@ +package com.dy.pipIrrSell.wallet.qo; + +import com.dy.common.webUtil.QueryConditionVo; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +/** + * @author ZhuBaoMin + * @date 2024-01-31 19:21 + * @LastEditTime 2024-01-31 19:21 + * @Description + */ + +@Data +@Schema(name = "鐢靛瓙閽卞寘璐︽埛鏌ヨ鏉′欢") +public class QueryVo extends QueryConditionVo { + @Schema(description = "鍐滄埛濮撳悕") + public String clientName; + + @Schema(description = "鍐滄埛ID") + public Long clientId; + + @Schema(description = "閫�娆剧姸鎬�") + public Integer refundStatus; +} -- Gitblit v1.8.0