From e6fa0149e0c8690efc9c444650c6ef82f04ba54b Mon Sep 17 00:00:00 2001
From: Pu Zhibing <393733352@qq.com>
Date: 星期二, 14 一月 2025 19:38:19 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'
---
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopController.java | 2
ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/model/WithdrawalRequests.java | 6 ++
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/WithdrawalRequestsController.java | 37 +++++++++++++++++-
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShareController.java | 6 ++
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/ShopWithdraw.java | 6 ++
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/WalletServiceImpl.java | 2
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/vo/OrderRefundPassListVo.java | 20 ++++++++++
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/UserCouponController.java | 4 +
ruoyi-service/ruoyi-order/src/main/resources/mapper/order/OrderMapper.xml | 4 +-
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopWithdrawController.java | 33 +++++++++++++++-
10 files changed, 106 insertions(+), 14 deletions(-)
diff --git a/ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/model/WithdrawalRequests.java b/ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/model/WithdrawalRequests.java
index c0a2a59..97a1805 100644
--- a/ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/model/WithdrawalRequests.java
+++ b/ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/model/WithdrawalRequests.java
@@ -74,9 +74,13 @@
@TableField("audit_status")
private Integer auditStatus;
- @ApiModelProperty(value = "状态(1=处理中,2=成功)")
+ @ApiModelProperty(value = "状态(1=处理中,2=成功,3=失败)")
@TableField("status")
private Integer status;
+
+ @ApiModelProperty(value = "处理结果")
+ @TableField("remark")
+ private String remark;
@ApiModelProperty(value = "到账时间")
@TableField("arrival_time")
diff --git a/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/ShopWithdraw.java b/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/ShopWithdraw.java
index 8795234..6bda5f6 100644
--- a/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/ShopWithdraw.java
+++ b/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/ShopWithdraw.java
@@ -59,10 +59,14 @@
@TableField("audit_msg")
private String auditMsg;
- @ApiModelProperty(value = "状态(1=申请中,2=已到账)")
+ @ApiModelProperty(value = "状态(1=申请中,2=已到账,3=失败)")
@TableField("status")
private Integer status;
+ @ApiModelProperty(value = "处理结果")
+ @TableField("remark")
+ private String remark;
+
@ApiModelProperty(value = "到账时间")
@TableField("arrival_time")
private LocalDateTime arrivalTime;
diff --git a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/UserCouponController.java b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/UserCouponController.java
index 0bca4b0..1d24df4 100644
--- a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/UserCouponController.java
+++ b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/UserCouponController.java
@@ -98,7 +98,9 @@
List<Goods> data1 = goodsClient.getAllGoods().getData();
List<String> collect = data1.stream().map(Goods::getName).collect(Collectors.toList());
goodNames.addAll(collect);
- }else{
+ }else if(StringUtils.isEmpty(data.getForGoodIds())){
+ goodNames.addAll(JSON.parseArray(data.getGoodsNameJson(), String.class));
+ }else {
String[] split = vo.getForGoodIds().split(",");
R<List<Goods>> goodsById = goodsClient.getGoodsById(split);
if (goodsById.getData()!=null){
diff --git a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/WithdrawalRequestsController.java b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/WithdrawalRequestsController.java
index bea2770..c792884 100644
--- a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/WithdrawalRequestsController.java
+++ b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/WithdrawalRequestsController.java
@@ -158,9 +158,9 @@
@PostMapping("/withdrawalCallback")
public Object withdrawalCallback(@RequestBody SinglePayCallbackResult singlePayCallbackResult){
Integer status = singlePayCallbackResult.getStatus();
+ String merchantOrderNo = singlePayCallbackResult.getMerchantOrderNo();
+ WithdrawalRequests withdrawalRequests = withdrawalRequestsService.getById(merchantOrderNo);
if(203 == status || 205 == status){
- String merchantOrderNo = singlePayCallbackResult.getMerchantOrderNo();
- WithdrawalRequests withdrawalRequests = withdrawalRequestsService.getById(merchantOrderNo);
if(1 == withdrawalRequests.getStatus()){
withdrawalRequests.setStatus(2);
withdrawalRequests.setArrivalTime(LocalDateTime.now());
@@ -169,8 +169,39 @@
JSONObject jsonObject = new JSONObject();
jsonObject.put("statusCode", 2001);
return jsonObject;
+ }else{
+ //回退扣除的金额,添加明细记录
+ //修改用户的可提现金额
+ BigDecimal withdrawalAmount = withdrawalRequests.getWithdrawalAmount();
+ AppUser appUser = appUserService.getById(withdrawalRequests.getAppUserId());
+ BigDecimal withdrawableAmount = appUser.getWithdrawableAmount();
+ BigDecimal withdrawnAmount = appUser.getWithdrawnAmount();
+ BigDecimal balance = appUser.getBalance();
+ appUser.setWithdrawableAmount(withdrawableAmount.add(withdrawalAmount).setScale(2, RoundingMode.HALF_EVEN));
+ appUser.setWithdrawnAmount(withdrawnAmount.subtract(withdrawalAmount).setScale(2, RoundingMode.HALF_EVEN));
+ appUser.setBalance(appUser.getBalance().add(withdrawalAmount).setScale(2, RoundingMode.HALF_EVEN));
+ appUserService.updateById(appUser);
+ //添加变动明细
+ BalanceChangeRecord balanceChangeRecord = new BalanceChangeRecord();
+ balanceChangeRecord.setAppUserId(appUser.getId());
+ balanceChangeRecord.setVipId(appUser.getVipId());
+ balanceChangeRecord.setOrderId(withdrawalRequests.getId());
+ balanceChangeRecord.setChangeType(2);
+ balanceChangeRecord.setBeforeAmount(balance);
+ balanceChangeRecord.setChangeAmount(withdrawalAmount);
+ balanceChangeRecord.setAfterAmount(appUser.getBalance());
+ balanceChangeRecord.setDelFlag(0);
+ balanceChangeRecord.setCreateTime(LocalDateTime.now());
+ balanceChangeRecordService.save(balanceChangeRecord);
+
+ withdrawalRequests.setStatus(3);
+ withdrawalRequests.setRemark(singlePayCallbackResult.getErrorCodeDesc());
+ withdrawalRequestsService.updateById(withdrawalRequests);
+
+ JSONObject jsonObject = new JSONObject();
+ jsonObject.put("statusCode", 2001);
+ return jsonObject;
}
- return new JSONObject();
}
}
diff --git a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/WalletServiceImpl.java b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/WalletServiceImpl.java
index fe38178..146fbb7 100644
--- a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/WalletServiceImpl.java
+++ b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/WalletServiceImpl.java
@@ -42,7 +42,7 @@
// 获取提现审核中的金额
List<WithdrawalRequests> waitAuditList = withdrawalRequestsService.list(new LambdaQueryWrapper<WithdrawalRequests>()
.eq(WithdrawalRequests::getAppUserId, userId)
- .eq(WithdrawalRequests::getAuditStatus, WithdrawalAuditStatus.WAIT_AUDIT));
+ .eq(WithdrawalRequests::getAuditStatus, WithdrawalAuditStatus.WAIT_AUDIT.getCode()));
BigDecimal reduce = waitAuditList.stream().map(WithdrawalRequests::getWithdrawalAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
WalletVO walletVO = new WalletVO();
walletVO.setWithdrawalAmount(appUser.getWithdrawableAmount());
diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/vo/OrderRefundPassListVo.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/vo/OrderRefundPassListVo.java
index 2b9ea96..16b6c46 100644
--- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/vo/OrderRefundPassListVo.java
+++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/vo/OrderRefundPassListVo.java
@@ -22,4 +22,24 @@
private Integer refundMethod;
@ApiModelProperty("售后状态(1待审核2已完成3已拒绝4待退货5待平台收货)")
private Integer status;
+
+
+ private String orderNumber;
+ private String userName;
+ private Integer passStatus;
+
+ public void setOrderNumber(String orderNumber) {
+ this.orderNumber = orderNumber;
+ this.setCode(orderNumber);
+ }
+
+ public void setUserName(String userName) {
+ this.userName = userName;
+ this.setName(userName);
+ }
+
+ public void setPassStatus(Integer passStatus) {
+ this.passStatus = passStatus;
+ this.setStatus(passStatus);
+ }
}
diff --git a/ruoyi-service/ruoyi-order/src/main/resources/mapper/order/OrderMapper.xml b/ruoyi-service/ruoyi-order/src/main/resources/mapper/order/OrderMapper.xml
index 4be8e48..70f2159 100644
--- a/ruoyi-service/ruoyi-order/src/main/resources/mapper/order/OrderMapper.xml
+++ b/ruoyi-service/ruoyi-order/src/main/resources/mapper/order/OrderMapper.xml
@@ -62,7 +62,7 @@
point,
order_status as status,
distribution_mode as distributionMode
- from t_order where del_flag = 0 and pay_status = 2 and end_time is not null and distribution_mode != 2
+ from t_order where del_flag = 0 and pay_status = 2
<if test="null != item.code and '' != item.code">
and order_number like CONCAT('%', #{item.code}, '%')
</if>
@@ -85,7 +85,7 @@
and order_status in (4, 8)
</if>
<if test="null != item.shopId">
- and shop_id = #{item.shopId} and address_json is null
+ and shop_id = #{item.shopId} and distribution_mode != 2
</if>
order by create_time desc
</select>
diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShareController.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShareController.java
index b7ca926..0831a8d 100644
--- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShareController.java
+++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShareController.java
@@ -149,10 +149,14 @@
SysUser sysUser = sysUserClient.getSysUser(userid).getData();
share.setAddType(sysUser.getRoleType() == 1 ? 1 : 3);
share.setAppletShare(0);
- share.setAuditStatus(ShareAuditStatus.SUCCESS.getCode());
if(sysUser.getRoleType() == 2){
share.setObjectId(sysUser.getObjectId().longValue());
}
+ if (sysUser.getRoleType() == 1){
+ share.setAuditStatus(ShareAuditStatus.SUCCESS.getCode());
+ }else{
+ share.setAuditStatus(ShareAuditStatus.WAIT.getCode());
+ }
share.setDelFlag(0);
shareService.save(share);
return R.ok();
diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopController.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopController.java
index 31c9504..d564c72 100644
--- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopController.java
+++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopController.java
@@ -270,7 +270,7 @@
if (!shopService.cheUserByPhone(phone)) {
return R.fail("该手机号未注册");
}
- if (shop.getPid()!=null){
+ if (shop.getPid() != null && shop.getPid() != 0){
Shop shopP = shopService.getById(shop.getPid());
if (shopP.getPid()!=null&&shopP.getPid()!=0&& shopP.getPid().equals(shop.getId())){
return R.fail("门店之间不能互相作为上级门店");
diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopWithdrawController.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopWithdrawController.java
index be86361..ad93c40 100644
--- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopWithdrawController.java
+++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopWithdrawController.java
@@ -263,9 +263,9 @@
@PostMapping("/withdrawalCallback")
public Object withdrawalCallback(@RequestBody SinglePayCallbackResult singlePayCallbackResult){
Integer status = singlePayCallbackResult.getStatus();
+ String merchantOrderNo = singlePayCallbackResult.getMerchantOrderNo();
+ ShopWithdraw shopWithdraw = shopWithdrawService.getById(merchantOrderNo);
if(203 == status || 205 == status){
- String merchantOrderNo = singlePayCallbackResult.getMerchantOrderNo();
- ShopWithdraw shopWithdraw = shopWithdrawService.getById(merchantOrderNo);
if(1 == shopWithdraw.getStatus()){
shopWithdraw.setStatus(2);
shopWithdraw.setArrivalTime(LocalDateTime.now());
@@ -274,8 +274,35 @@
JSONObject jsonObject = new JSONObject();
jsonObject.put("statusCode", 2001);
return jsonObject;
+ }else{
+ //回退金额和添加变动明细
+ Shop shop = shopService.getById(shopWithdraw.getShopId());
+ BigDecimal balance = shop.getBalance();
+ BigDecimal canWithdrawMoney = shop.getCanWithdrawMoney();
+ BigDecimal withdrawMoney = shop.getWithdrawMoney();
+ shop.setBalance(balance.add(shopWithdraw.getMoney()).setScale(2, RoundingMode.HALF_EVEN));
+ shop.setCanWithdrawMoney(canWithdrawMoney.add(shopWithdraw.getMoney()).setScale(2, RoundingMode.HALF_EVEN));
+ shop.setWithdrawMoney(withdrawMoney.subtract(shopWithdraw.getMoney()).setScale(2, RoundingMode.HALF_EVEN));
+ shopService.updateById(shop);
+ //添加门店变动明细
+ ShopBalanceStatement shopBalanceStatement = new ShopBalanceStatement();
+ shopBalanceStatement.setShopId(shop.getId());
+ shopBalanceStatement.setType(4);
+ shopBalanceStatement.setHistoricalBalance(balance);
+ shopBalanceStatement.setVariableAmount(shopWithdraw.getMoney());
+ shopBalanceStatement.setBalance(shop.getBalance());
+ shopBalanceStatement.setCreateUserId(shopWithdraw.getAuditUserId());
+ shopBalanceStatement.setCreateTime(LocalDateTime.now());
+ shopBalanceStatement.setObjectId(shopWithdraw.getId());
+ shopBalanceStatementService.save(shopBalanceStatement);
+ shopWithdraw.setStatus(3);
+ shopWithdraw.setRemark(singlePayCallbackResult.getErrorCodeDesc());
+ shopWithdrawService.updateById(shopWithdraw);
+
+ JSONObject jsonObject = new JSONObject();
+ jsonObject.put("statusCode", 2001);
+ return jsonObject;
}
- return new JSONObject();
}
}
--
Gitblit v1.7.1