From b27efc697f2f81e0d0f247a2708e58af52a5df9b Mon Sep 17 00:00:00 2001
From: 无关风月 <443237572@qq.com>
Date: 星期四, 23 十月 2025 15:14:33 +0800
Subject: [PATCH] bug修改,后台新增修改用户积分
---
cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/impl/WorldCupPaymentServiceImpl.java | 48 +++++++++++++++++++++++++++++++++++++++++-------
1 files changed, 41 insertions(+), 7 deletions(-)
diff --git a/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/impl/WorldCupPaymentServiceImpl.java b/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/impl/WorldCupPaymentServiceImpl.java
index 02622b7..4f3d5d3 100644
--- a/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/impl/WorldCupPaymentServiceImpl.java
+++ b/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/impl/WorldCupPaymentServiceImpl.java
@@ -7,23 +7,30 @@
import com.dsh.communityWorldCup.entity.WorldCup;
import com.dsh.communityWorldCup.entity.WorldCupPayment;
import com.dsh.communityWorldCup.entity.WorldCupPaymentParticipant;
+import com.dsh.communityWorldCup.entity.WorldCupStore;
import com.dsh.communityWorldCup.feignclient.account.AppUserClient;
import com.dsh.communityWorldCup.feignclient.account.model.AppUser;
import com.dsh.communityWorldCup.feignclient.course.CoursePackageOrderStudentClient;
import com.dsh.communityWorldCup.feignclient.course.model.CoursePackageOrderStudent;
+import com.dsh.communityWorldCup.feignclient.other.StoreClient;
+import com.dsh.communityWorldCup.feignclient.other.model.Store;
import com.dsh.communityWorldCup.mapper.WorldCupPaymentMapper;
import com.dsh.communityWorldCup.model.DeductionClassHourList;
import com.dsh.communityWorldCup.service.IWorldCupPaymentParticipantService;
import com.dsh.communityWorldCup.service.IWorldCupPaymentService;
import com.dsh.communityWorldCup.service.IWorldCupService;
+import com.dsh.communityWorldCup.service.IWorldCupStoreService;
import com.dsh.communityWorldCup.util.PayMoneyUtil;
import com.dsh.communityWorldCup.util.ResultUtil;
+import com.dsh.communityWorldCup.util.UUIDUtil;
import net.bytebuddy.asm.Advice;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
+import org.springframework.util.StringUtils;
import javax.annotation.Resource;
import java.math.BigDecimal;
+import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.Map;
@@ -37,6 +44,8 @@
@Autowired
private IWorldCupPaymentParticipantService worldCupPaymentParticipantService;
+ @Autowired
+ private IWorldCupStoreService worldCupStoreService;
@Autowired
private IWorldCupService worldCupService;
@@ -46,6 +55,8 @@
@Resource
private AppUserClient appUserClient;
+ @Resource
+ private StoreClient storeClient;
@Resource
private CoursePackageOrderStudentClient coursePackageOrderStudentClient;
@@ -59,7 +70,7 @@
* @return
*/
@Override
- public ResultUtil cancelMyWorldCup(String id) {
+ public ResultUtil cancelMyWorldCup(Long id) throws Exception {
WorldCupPaymentParticipant worldCupPaymentParticipant = worldCupPaymentParticipantService.getById(id);
WorldCupPayment worldCupPayment = this.getById(worldCupPaymentParticipant.getWorldCupPaymentId());
WorldCup worldCup = worldCupService.getById(worldCupPayment.getWorldCupId());
@@ -79,15 +90,35 @@
}
List<WorldCupPaymentParticipant> list1 = worldCupPaymentParticipantService.list(new QueryWrapper<WorldCupPaymentParticipant>()
.eq("worldCupPaymentId", worldCupPayment.getId()).eq("alreadyEntered", 0));
+ //总排款金额(排除已经参加比赛的数据)
BigDecimal multiply = worldCupPayment.getUnitPrice().multiply(new BigDecimal(list1.size()));
//微信支付
+
+ List<WorldCupStore> list = worldCupStoreService.lambdaQuery().eq(WorldCupStore::getWorldCupId, worldCup.getId()).list();
+ Integer storeId = list.get(0).getStoreId();
+ Store store = storeClient.queryStoreById(storeId);
if(worldCupPayment.getPayType() == 1){
- Map<String, String> map = payMoneyUtil.wxRefund(worldCupPayment.getPayOrderNo(), worldCupPayment.getCode(),
- worldCupPayment.getAmount().toString(), multiply.toString(), "/base/worldCup/wxRefundWorldCupCallback");
- if(!"SUCCESS".equals(map.get("return_code"))){
- System.err.println("-------------微信退款失败---------");
- System.err.println(map.get("return_msg"));
- return ResultUtil.error("微信退款失败");
+ if (store.getOperatorId()!=null && store.getOperatorId()!=0){
+ String smidVx= storeClient.getmerchantNumberByOperatorId(store.getOperatorId());
+ if (!StringUtils.hasLength(smidVx)){
+ System.err.println("运营商未配置微信商户号,获取支付失败!");
+ }
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS");
+ String codeRefund = sdf.format(new Date()) + UUIDUtil.getNumberRandom(5);// 退款单号
+ // 运营商退款
+ payMoneyUtil.weixinRefundV3(smidVx, codeRefund, worldCupPayment.getPayOrderNo(), worldCupPayment.getAmount().toString(), "/base/worldCup/wxRefundWorldCupCallback1");
+ }else {
+ Map<String, String> map = payMoneyUtil.wxRefund(worldCupPayment.getPayOrderNo(), worldCupPayment.getCode(),
+ worldCupPayment.getAmount().toString(), multiply.toString(), "/base/worldCup/wxRefundWorldCupCallback");
+ if (!"SUCCESS".equals(map.get("return_code"))) {
+ System.err.println("-------------微信退款失败---------");
+ System.err.println(map.get("return_msg"));
+ return ResultUtil.error("微信退款失败");
+ } else {
+ worldCupPayment.setRefundAmount(multiply);
+ worldCupPayment.setWorldCupId(null);
+ this.updateById(worldCupPayment);
+ }
}
}
//支付宝支付
@@ -104,6 +135,7 @@
worldCupPayment.setRefundTime(new Date());
worldCupPayment.setRefundOrderNo(trade_no);
worldCupPayment.setPayStatus(3);
+ worldCupPayment.setRefundAmount(multiply);
this.updateById(worldCupPayment);
}
}
@@ -117,6 +149,7 @@
worldCupPayment.setRefundTime(new Date());
worldCupPayment.setRefundOrderNo("");
worldCupPayment.setPayStatus(3);
+ worldCupPayment.setRefundAmount(multiply);
this.updateById(worldCupPayment);
}
//课时支付
@@ -130,6 +163,7 @@
worldCupPayment.setRefundTime(new Date());
worldCupPayment.setRefundOrderNo("");
worldCupPayment.setPayStatus(3);
+ worldCupPayment.setRefundAmount(multiply);
this.updateById(worldCupPayment);
}
return ResultUtil.success();
--
Gitblit v1.7.1