From 537ed054fe1d9b40b4908cf41ce8c9a6a82d0df9 Mon Sep 17 00:00:00 2001
From: 44323 <443237572@qq.com>
Date: 星期一, 18 三月 2024 16:04:04 +0800
Subject: [PATCH] 部分bug修改

---
 cloud-server-account/src/main/java/com/dsh/account/service/impl/TAppUserServiceImpl.java |   72 +++++++++++++++++++++++++++++-------
 1 files changed, 58 insertions(+), 14 deletions(-)

diff --git a/cloud-server-account/src/main/java/com/dsh/account/service/impl/TAppUserServiceImpl.java b/cloud-server-account/src/main/java/com/dsh/account/service/impl/TAppUserServiceImpl.java
index 8676cfc..00b51ee 100644
--- a/cloud-server-account/src/main/java/com/dsh/account/service/impl/TAppUserServiceImpl.java
+++ b/cloud-server-account/src/main/java/com/dsh/account/service/impl/TAppUserServiceImpl.java
@@ -20,6 +20,8 @@
 import com.dsh.account.enums.RechargeRecordEnum;
 import com.dsh.account.feignclient.activity.*;
 import com.dsh.account.feignclient.activity.model.*;
+import com.dsh.account.feignclient.communityWorldCup.WorldCupPaymentClinet;
+import com.dsh.account.feignclient.communityWorldCup.model.GetWorldCupPayment;
 import com.dsh.account.feignclient.competition.DeductionCompetitionsClient;
 import com.dsh.account.feignclient.competition.model.BillingDataRequestVo;
 import com.dsh.account.feignclient.course.CoursePackageClient;
@@ -45,6 +47,7 @@
 import com.dsh.account.model.vo.classDetails.RegisteredCourse;
 import com.dsh.account.model.vo.classDetails.classInsVo.ClassInfoVo;
 import com.dsh.account.model.vo.userBenefitDetail.*;
+import com.dsh.account.service.IRefereeService;
 import com.dsh.account.service.TAppGiftService;
 import com.dsh.account.service.TAppUserService;
 import com.dsh.account.util.*;
@@ -116,7 +119,6 @@
     @Resource
     private ImgConfigClient icfgClient;
 
-
     @Resource
     private VideoOfCourseListClient voclClient;
 
@@ -177,6 +179,12 @@
 
     @Resource
     private UserCouponPaymentClient userCouponPaymentClient;
+
+    @Autowired
+    private IRefereeService refereeService;
+
+    @Resource
+    private WorldCupPaymentClinet worldCupPaymentClinet;
 
 
 
@@ -750,7 +758,6 @@
     @Override
     public IndexOfUserBenefirVo queryBenefitDetails(Integer appUserId, String lon, String lat) {
         IndexOfUserBenefirVo benefirVo = new IndexOfUserBenefirVo();
-
         TAppUser appUser = this.getById(appUserId);
         if (appUser.getHeadImg() != null) {
             benefirVo.setUserHeadImg(appUser.getHeadImg());
@@ -772,6 +779,8 @@
         List<IntegralCommodity> convertibleGoods = mcClient.getConvertibleGoods(location);
         benefirVo.setCommodities(convertibleGoods);
         benefirVo.setImage(icfgClient.getImageConfig());
+        Referee referee = refereeService.getOne(new QueryWrapper<Referee>().eq("phone", appUser.getPhone()).eq("state", 1));
+        benefirVo.setReferee(null == referee ? 0 : 1);
         return benefirVo;
     }
 
@@ -943,6 +952,39 @@
                         .collect(Collectors.toList());
             }
         }
+
+        //世界杯
+        GetWorldCupPayment getWorldCupPayment = new GetWorldCupPayment();
+        getWorldCupPayment.setAppUserId(appUserId);
+        getWorldCupPayment.setPayType("1,2");
+        getWorldCupPayment.setStartTime(monthStart);
+        getWorldCupPayment.setEndTime(monthEnd);
+        List<WorldCupPayment> worldCupPayment = worldCupPaymentClinet.getWorldCupPayment(getWorldCupPayment);
+        for (WorldCupPayment cupPayment : worldCupPayment) {
+            ConsumeDetail consumeDetail = new ConsumeDetail();
+            if(cupPayment.getPayStatus() != 3){
+                consumeDetail.setConsumeName(RechargeRecordEnum.WORLD_CIP_PAYMENT.getMsg());
+                consumeDetail.setConsumeTime(simpleDateFormat.format(cupPayment.getCreateTime()));
+                consumeDetail.setConsumeAmount("-" + cupPayment.getAmount());
+                consumeDetail.setType(2);
+                details.add(consumeDetail);
+            }else{
+                consumeDetail = new ConsumeDetail();
+                consumeDetail.setConsumeName(RechargeRecordEnum.WORLD_CIP_PAYMENT.getMsg());
+                consumeDetail.setConsumeTime(simpleDateFormat.format(cupPayment.getCreateTime()));
+                consumeDetail.setConsumeAmount("-" + cupPayment.getAmount());
+                consumeDetail.setType(2);
+                details.add(consumeDetail);
+
+                consumeDetail = new ConsumeDetail();
+                consumeDetail.setConsumeName(RechargeRecordEnum.CANCEL_WORLD_CIP_PAYMENT.getMsg());
+                consumeDetail.setConsumeTime(simpleDateFormat.format(cupPayment.getCreateTime()));
+                consumeDetail.setConsumeAmount("+" + cupPayment.getRefundAmount());
+                consumeDetail.setType(1);
+                details.add(consumeDetail);
+            }
+        }
+
         return details;
     }
 
@@ -1557,18 +1599,18 @@
                         case 1:
                             try {
                                 if (merchandise.getType() == 2) {
-                                    return WechatPayment(merchandise.getCash().multiply(new BigDecimal(exchangeType.getStuIds().size())), code);
+                                    return WechatPayment(merchandise.getType(), merchandise.getCash().multiply(new BigDecimal(exchangeType.getStuIds().size())), code);
                                 } else {
-                                    return WechatPayment(merchandise.getCash().multiply(new BigDecimal(goodsNums)), code);
+                                    return WechatPayment(merchandise.getType(), merchandise.getCash().multiply(new BigDecimal(goodsNums)), code);
                                 }
                             } catch (Exception e) {
                                 return ResultUtil.runErr();
                             }
                         case 2:
                             if (merchandise.getType() == 2) {
-                                return AlipayPayment(merchandise.getCash().multiply(new BigDecimal(exchangeType.getStuIds().size())), code, returnId);
+                                return AlipayPayment(merchandise.getType(), merchandise.getCash().multiply(new BigDecimal(exchangeType.getStuIds().size())), code, returnId);
                             } else {
-                                return AlipayPayment(merchandise.getCash().multiply(new BigDecimal(goodsNums)), code, returnId);
+                                return AlipayPayment(merchandise.getType(), merchandise.getCash().multiply(new BigDecimal(goodsNums)), code, returnId);
                             }
                         default:
                             break;
@@ -1579,18 +1621,18 @@
                         case 1:
                             try {
                                 if (merchandise.getType() == 2) {
-                                    return WechatPayment(merchandise.getCash().multiply(new BigDecimal(exchangeType.getStuIds().size())), code);
+                                    return WechatPayment(merchandise.getType(), merchandise.getCash().multiply(new BigDecimal(exchangeType.getStuIds().size())), code);
                                 } else {
-                                    return WechatPayment(merchandise.getCash().multiply(new BigDecimal(goodsNums)), code);
+                                    return WechatPayment(merchandise.getType(), merchandise.getCash().multiply(new BigDecimal(goodsNums)), code);
                                 }
                             } catch (Exception e) {
                                 return ResultUtil.runErr();
                             }
                         case 2:
                             if (merchandise.getType() == 2) {
-                                return AlipayPayment(merchandise.getCash().multiply(new BigDecimal(exchangeType.getStuIds().size())), code, returnId);
+                                return AlipayPayment(merchandise.getType(), merchandise.getCash().multiply(new BigDecimal(exchangeType.getStuIds().size())), code, returnId);
                             } else {
-                                return AlipayPayment(merchandise.getCash().multiply(new BigDecimal(goodsNums)), code, returnId);
+                                return AlipayPayment(merchandise.getType(), merchandise.getCash().multiply(new BigDecimal(goodsNums)), code, returnId);
                             }
                         default:
                             break;
@@ -1834,8 +1876,9 @@
         }
     }
 
-    private ResultUtil AlipayPayment(BigDecimal cash, String code, Long returnId) {
-        ResultUtil alipay = payMoneyUtil.alipay(smid,"优惠卷", "优惠卷", String.valueOf(returnId), code, cash.toString(),
+    private ResultUtil AlipayPayment(Integer type, BigDecimal cash, String code, Long returnId) {
+        String name = (type == 1 ? "购买实体商品" : type == 2 ? "报名运动营": type == 3 ? "购买门票" : "购买优惠券");
+        ResultUtil alipay = payMoneyUtil.alipay(smid,name, name, String.valueOf(returnId), code, cash.toString(),
                 "/base/pointMer/exchangeGoodPaymentAliCallback");
         if (alipay.getCode() == 200) {
             new Thread(new Runnable() {
@@ -2000,8 +2043,9 @@
     }
 
 
-    private ResultUtil WechatPayment(BigDecimal cash, String code) throws Exception {
-        ResultUtil weixinpay = payMoneyUtil.weixinpay("课包", "", code, cash.toString(),
+    private ResultUtil WechatPayment(Integer type, BigDecimal cash, String code) throws Exception {
+        String name = (type == 1 ? "购买实体商品" : type == 2 ? "报名运动营": type == 3 ? "购买门票" : "购买优惠券");
+        ResultUtil weixinpay = payMoneyUtil.weixinpay(name, "", code, cash.toString(),
                 "/base/pointMer/exchangeGoodPaymentWeChatCallback", "APP", "");
         if (weixinpay.getCode() == 200) {
             new Thread(new Runnable() {

--
Gitblit v1.7.1