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 |  302 +++++++++++++++++++++++++++++++------------------
 1 files changed, 191 insertions(+), 111 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 0a66628..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;
 
 
 
@@ -447,6 +455,10 @@
         tAppUser.setIsVip(0);
         tAppUser.setState(1);
         tAppUser.setInsertTime(new Date());
+        tAppUser.setProvince("");
+        tAppUser.setProvinceCode("");
+        tAppUser.setCity("");
+        tAppUser.setCityCode("");
         // 注册用户
         int insert = this.baseMapper.insert(tAppUser);
         // 介绍有礼
@@ -455,43 +467,40 @@
                 return ResultUtil.error("请先开启定位", "");
             }
             Map<String, String> geocode = gdMapGeocodingUtil.geocode(addAppUserVo.getLon(), addAppUserVo.getLat());
-            Integer num = 0;
-            Integer activityId = null;
             if (null != geocode) {
-                String province = geocode.get("province");
-                String provinceCode = geocode.get("provinceCode");
-                String city = geocode.get("city");
                 String cityCode = geocode.get("cityCode");
                 // 根据所在市code 查询是否有介绍有礼活动
-                IntroduceRewards res = introduceRewardsClient.getGiftList(cityCode);
+                List<IntroduceRewards> res = introduceRewardsClient.getGiftList(cityCode);
                 if (res != null) {
-                    num = res.getGiveClass();
-                    activityId = res.getId();
-                    if (ToolUtil.isNotEmpty(addAppUserVo.getInvitePhone())) {
-                        List<TAppUser> tAppUsers = this.baseMapper.selectList(new LambdaQueryWrapper<TAppUser>()
-                                .eq(TAppUser::getPhone, addAppUserVo.getInvitePhone()));
-                        if (tAppUsers.size() > 0) {
-                            addAppUserVo.setReferralUserId(tAppUsers.get(0).getId());
+                    for (IntroduceRewards re : res) {
+                        Integer num = re.getGiveClass();
+                        Integer activityId = re.getId();
+                        if (ToolUtil.isNotEmpty(addAppUserVo.getInvitePhone())) {
+                            List<TAppUser> tAppUsers = this.baseMapper.selectList(new LambdaQueryWrapper<TAppUser>()
+                                    .eq(TAppUser::getPhone, addAppUserVo.getInvitePhone()));
+                            if (tAppUsers.size() > 0) {
+                                addAppUserVo.setReferralUserId(tAppUsers.get(0).getId());
+                            }
                         }
-                    }
-                    if (num != 0) {
-                        TAppGift tAppGift = new TAppGift();
-                        TAppUser phone = appUserService.getOne(new QueryWrapper<TAppUser>()
-                                .eq("phone", addAppUserVo.getInvitePhone()));
-                        if (phone == null) {
-                            return ResultUtil.error("推荐人手机号未注册玩湃会员!");
-                        } else {
-                            tAppGift.setUserName(phone.getName());
-                            tAppGift.setUserPhone(phone.getPhone());
+                        if (num != 0) {
+                            TAppGift tAppGift = new TAppGift();
+                            TAppUser phone = appUserService.getOne(new QueryWrapper<TAppUser>()
+                                    .eq("phone", addAppUserVo.getInvitePhone()));
+                            if (phone == null) {
+                                return ResultUtil.error("推荐人手机号未注册玩湃会员!");
+                            } else {
+                                tAppGift.setUserName(phone.getName());
+                                tAppGift.setUserPhone(phone.getPhone());
+                            }
+                            tAppGift.setUserId(addAppUserVo.getReferralUserId());
+                            tAppGift.setNum(num);
+                            tAppGift.setShareUserId(tAppUser.getId());
+                            tAppGift.setShareUserName(tAppUser.getPhone());
+                            tAppGift.setShareUserPhone(tAppUser.getPhone());
+                            tAppGift.setActivityId(activityId);
+                            tAppGift.setInsertTime(new Date());
+                            appGiftService.save(tAppGift);
                         }
-                        tAppGift.setUserId(addAppUserVo.getReferralUserId());
-                        tAppGift.setNum(num);
-                        tAppGift.setShareUserId(tAppUser.getId());
-                        tAppGift.setShareUserName(tAppUser.getPhone());
-                        tAppGift.setShareUserPhone(tAppUser.getPhone());
-                        tAppGift.setActivityId(activityId);
-                        tAppGift.setInsertTime(new Date());
-                        appGiftService.save(tAppGift);
                     }
                 }
             }
@@ -546,6 +555,7 @@
             tAppUser.setPassword(Md5Util.MD5Encode("111111", null));
             tAppUser.setIsVip(0);
             tAppUser.setState(1);
+            tAppUser.setInsertTime(new Date());
             this.baseMapper.insert(tAppUser);
         }
         if (tAppUser.getState() == 2) {
@@ -579,6 +589,10 @@
                 tAppUser.setGender(loginWechatVo.getSex());
                 tAppUser.setState(1);
                 tAppUser.setInsertTime(new Date());
+                tAppUser.setProvince("");
+                tAppUser.setProvinceCode("");
+                tAppUser.setCity("");
+                tAppUser.setCityCode("");
                 this.baseMapper.insert(tAppUser);
             }
         }
@@ -632,6 +646,27 @@
      */
     @Override
     public ResultUtil updatePassword(String phone, String code, String password) throws Exception {
+        String value = redisUtil.getValue(phone);
+        if (!"123456".equals(code) && (ToolUtil.isEmpty(value) || !value.equals(code))) {
+            return ResultUtil.error("验证码无效");
+        }
+        TAppUser tAppUser = this.baseMapper.selectOne(new QueryWrapper<TAppUser>().eq("phone", phone).ne("state", 3));
+        if (tAppUser == null) {
+            return ResultUtil.error("该账号未注册", "");
+        }
+        if (tAppUser.getState() == 2) {
+            return ResultUtil.error("您的账号已被冻结", "");
+        }
+        if (tAppUser.getCode() == null) {
+            tAppUser.setCode(UUIDUtil.getNumberRandom(16));
+        }
+        tAppUser.setPassword(password);
+        this.updateById(tAppUser);
+        return ResultUtil.success();
+    }
+
+    @Override
+    public ResultUtil updatePassword1(String phone, String code, String password) throws Exception {
         String value = redisUtil.getValue(phone);
         if (!"123456".equals(code) && (ToolUtil.isEmpty(value) || !value.equals(code))) {
             return ResultUtil.error("验证码无效");
@@ -723,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());
@@ -745,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;
     }
 
@@ -916,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;
     }
 
@@ -1145,6 +1214,7 @@
         if (tAppUser.getState() == 2) {
             return ResultUtil.error("您的账号已被冻结");
         }
+        boolean newUser = false;
         List<TAppUser> tAppUsers1 = appUserMapper.selectList(new LambdaQueryWrapper<TAppUser>().eq(TAppUser::getPhone, dto.getPhone()).eq(TAppUser::getState, 1));
         if (tAppUsers1.size() > 0) {
             TAppUser tAppUser1 = tAppUsers1.get(0);
@@ -1162,56 +1232,49 @@
             appUserMapper.updateById(tAppUser);
             token = getToken(tAppUser);
             map.put("token", token);
-
+            newUser = true;
         }
 
-//        tAppUser.setPhone(dto.getPhone());
-
-        if (ToolUtil.isNotEmpty(dto.getInvitePhone())) {
+        if (newUser && ToolUtil.isNotEmpty(dto.getInvitePhone())) {
             if (ToolUtil.isEmpty(dto.getLat()) || ToolUtil.isEmpty(dto.getLon())) {
                 return ResultUtil.error("请先开启定位");
             }
-            TAppUser tAppUser1 = appUserMapper.selectOne(new LambdaQueryWrapper<TAppUser>().eq(TAppUser::getPhone, dto.getInvitePhone()).eq(TAppUser::getState, 1));
-            if (tAppUser1 != null) {
-                Map<String, String> geocode = null;
-                try {
-                    geocode = gdMapGeocodingUtil.geocode(dto.getLon(), dto.getLat());
-                } catch (Exception e) {
-                    e.printStackTrace();
-                }
-                Integer num = 0;
-                if (null != geocode) {
-                    String province = geocode.get("province");
-                    String provinceCode = geocode.get("provinceCode");
-                    String city = geocode.get("city");
-                    String cityCode = geocode.get("cityCode");
-                    IntroduceRewards giftList = introduceRewardsClient.getGiftList(cityCode);
-                    num = giftList.getGiveClass();
-                }
-                Integer userId = null;
-                if (ToolUtil.isNotEmpty(dto.getInvitePhone())) {
-                    List<TAppUser> tAppUsers = this.baseMapper.selectList(new LambdaQueryWrapper<TAppUser>().eq(TAppUser::getPhone, dto.getInvitePhone()));
-                    if (tAppUsers.size() > 0) {
-                        userId = tAppUsers.get(0).getId();
-                    }
-                }
-                if (userId != null) {
-                    TAppGift one = appGiftService.getOne(new LambdaQueryWrapper<TAppGift>().eq(TAppGift::getUserId, userId));
-                    if (one != null) {
-                        one.setNum(one.getNum() + num);
-                        appGiftService.updateById(one);
-                    } else {
-                        TAppGift tAppGift = new TAppGift();
-                        tAppGift.setUserId(userId);
-                        tAppGift.setNum(num);
-                        appGiftService.save(tAppGift);
+            TAppUser tAppUser1 = appUserMapper.selectOne(new LambdaQueryWrapper<TAppUser>()
+                    .eq(TAppUser::getPhone, dto.getInvitePhone()).eq(TAppUser::getState, 1));
+            if(null == tAppUser1){
+                return ResultUtil.error("邀请人还未注册账号");
+            }
+            Map<String, String> geocode = null;
+            try {
+                geocode = gdMapGeocodingUtil.geocode(dto.getLon(), dto.getLat());
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+            if (null != geocode) {
+                String cityCode = geocode.get("cityCode");
+                // 根据所在市code 查询是否有介绍有礼活动
+                List<IntroduceRewards> res = introduceRewardsClient.getGiftList(cityCode);
+                if (res != null) {
+                    for (IntroduceRewards re : res) {
+                        Integer num = re.getGiveClass();
+                        Integer activityId = re.getId();
+                        if (num != 0) {
+                            TAppGift tAppGift = new TAppGift();
+                            tAppGift.setUserName(tAppUser1.getName());
+                            tAppGift.setUserPhone(tAppUser1.getPhone());
+                            tAppGift.setUserId(tAppUser1.getId());
+                            tAppGift.setNum(num);
+                            tAppGift.setShareUserId(tAppUser.getId());
+                            tAppGift.setShareUserName(tAppUser.getPhone());
+                            tAppGift.setShareUserPhone(tAppUser.getPhone());
+                            tAppGift.setActivityId(activityId);
+                            tAppGift.setInsertTime(new Date());
+                            appGiftService.save(tAppGift);
+                        }
                     }
                 }
             }
         }
-
-//        appUserMapper.updateById(tAppUser);
-
         return ResultUtil.success(map);
     }
 
@@ -1339,7 +1402,7 @@
                 return ResultUtil.success(returnId);
             }
             //积分+现金
-            if(coupon.getRedemptionMethod() == 1){
+            if(coupon.getRedemptionMethod() == 2){
                 userCouponPaymentClient.addUserCouponPayment(userCouponPayment);
                 try {
                     if(exchangeType.getPayType() == 1){
@@ -1451,6 +1514,7 @@
                     }
                 }
                 pointsMerchandise.setCode(code);
+                pointsMerchandise.setInsertTime(new Date());
                 returnId = mcClient.saveDetailsUserPointMercase(pointsMerchandise);
             }
 
@@ -1493,6 +1557,7 @@
                                     packagePayment.setStatus(1);
                                     packagePayment.setState(1);
                                     packagePayment.setCode(code);
+                                    packagePayment.setInsertTime(new Date());
 //                                    paymentClient.savePaymentCoursePackage(packagePayment);
 
                                     OrderDto orderDto = new OrderDto();
@@ -1512,6 +1577,7 @@
                                     coupon.setCouponId(exchangeType.getGoodId());
                                     coupon.setUserId(userIdFormRedis);
                                     coupon.setStatus(1);
+                                    coupon.setInsertTime(new Date());
                                     ucponClient.insertToAppuserCoupon(coupon);
                                 }
                                 break;
@@ -1533,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;
@@ -1555,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;
@@ -1671,17 +1737,15 @@
     /**
      * 优惠券支付宝支付
      *
-     * @param uid
-     * @param paymentPrice
-     * @param paymentCourseVo
      * @return
      * @throws Exception
      */
+    private String smid = "2088330203191220";//平台支付宝商户号
     public ResultUtil aliPaymentCoupon(String body, UserCouponPayment userCouponPayment) throws Exception {
         String code = userCouponPayment.getCode();
         Double cash = userCouponPayment.getCash();
 
-        ResultUtil alipay = payMoneyUtil.alipay(body, body, "", code, cash.toString(), "/base/coupon/aliPaymentCouponCallback");
+        ResultUtil alipay = payMoneyUtil.alipay(smid, body, "",String.valueOf(userCouponPayment.getId()), code, cash.toString(), "/base/coupon/aliPaymentCouponCallback");
         if (alipay.getCode() == 200) {
             new Thread(new Runnable() {
                 @Override
@@ -1714,6 +1778,10 @@
                                     //有待支付的订单,这里不处理
                                     userCouponPayment1.setStatus(-1);
                                     userCouponPaymentClient.updateUserCouponPayment(userCouponPayment1);
+                                    if ("TRADE_FINISHED".equals(s)) {
+                                        // todo 资金结算
+
+                                    }
                                     break;
                                 }
                                 if ("TRADE_SUCCESS".equals(s)) {
@@ -1721,22 +1789,23 @@
                                     userCouponPayment1.setPaymentTime(new Date());
                                     userCouponPayment1.setOrderNumber(tradeNo);
                                     userCouponPaymentClient.updateUserCouponPayment(userCouponPayment1);
-
                                     UserCoupon userCoupon = new UserCoupon();
                                     userCoupon.setCouponId(userCouponPayment1.getCouponId());
                                     userCoupon.setUserId(userCouponPayment1.getUserId());
                                     userCoupon.setStatus(1);
                                     userCoupon.setInsertTime(new Date());
                                     userConponClient.insertToAppuserCoupon(userCoupon);
-
                                     if(null != userCouponPayment1.getIntegral() && 0 != userCouponPayment1.getIntegral()){
                                         //扣积分
                                         TAppUser user = appUserService.getById(userCouponPayment1.getUserId());
                                         user.setIntegral(user.getIntegral() - userCouponPayment1.getIntegral().intValue());
                                         appUserService.updateById(user);
                                     }
+                                    payMoneyUtil.confirm(smid,code,tradeNo,cash.toString());
                                     break;
+
                                 }
+
                                 if ("WAIT_BUYER_PAY".equals(s)) {
                                     num++;
                                 }
@@ -1807,9 +1876,9 @@
         }
     }
 
-    private ResultUtil AlipayPayment(BigDecimal cash, String code, Long returnId) {
-        System.out.println("金额:" + cash);
-        ResultUtil alipay = payMoneyUtil.alipay("优惠卷", "优惠卷", 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() {
@@ -1855,6 +1924,11 @@
                                         mcClient.updateDetailsUserPointMercase(userPointsMerchandise);
                                     }
                                     moneyOut(tradeNo, tradeNo);
+                                    break;
+                                }
+                                if ("TRADE_FINISHED".equals(tradeStatus)) {
+                                    // todo 资金结算
+                                    payMoneyUtil.confirm(smid,code,tradeNo,cash.toString());
                                     break;
                                 }
 //                                if("REFUND".equals(tradeStatus) || "NOTPAY".equals(tradeStatus) || "CLOSED".equals(tradeStatus) || "REVOKED".equals(tradeStatus) || "PAYERROR".equals(tradeStatus) || num == 10){
@@ -1923,7 +1997,8 @@
 
         List<UserPointsMerchandise> userPointsMerchandises = merChandiseClient.queryUserPointMerchaseByCode(outNum);
 //        PaymentCompetition code = paymentCompetitionService.getOne(new QueryWrapper<PaymentCompetition>().eq("code", outNum));
-        Integer storeId = userPointsMerchandises.get(0).getStoreId();
+        if(userPointsMerchandises.size() > 0){
+            Integer storeId = userPointsMerchandises.get(0).getStoreId();
 
 //        Competition byId1 = competitionService.getById(code.getCompetitionId());
 
@@ -1931,7 +2006,7 @@
 //        TCoursePackage byId = coursePackageService.getById(one.getCoursePackageId());
 
 
-        OperatorUser operatorUser = storeClient.queryByStoreId(storeId);
+            OperatorUser operatorUser = storeClient.queryByStoreId(storeId);
 
 
 //        Integer paymentCompetitions = competitionsClient.queryByCode(outTradeNo);
@@ -1943,31 +2018,34 @@
 //        OperatorUser operatorUser = siteClient.queryOperator(stores);
 
 
-        OpenApiRoyaltyDetailInfoPojo op = new OpenApiRoyaltyDetailInfoPojo();
-        op.setTransOutType("loginName");
-        op.setTransOut("happysports@weparklife.com");
-        op.setTransInType("userId");
-        op.setTransIn(operatorUser.getAlipayNum());
-        op.setAmountPercentage(Long.valueOf(operatorUser.getAlipayProportion()));
+            OpenApiRoyaltyDetailInfoPojo op = new OpenApiRoyaltyDetailInfoPojo();
+            op.setTransOutType("loginName");
+            op.setTransOut("happysports@weparklife.com");
+            op.setTransInType("userId");
+            op.setTransIn(operatorUser.getAlipayNum());
+            op.setAmountPercentage(Long.valueOf(operatorUser.getAlipayProportion()));
 
-        List<OpenApiRoyaltyDetailInfoPojo> ops = new ArrayList<>();
-        ops.add(op);
-        model.setRoyaltyParameters(ops);
+            List<OpenApiRoyaltyDetailInfoPojo> ops = new ArrayList<>();
+            ops.add(op);
+            model.setRoyaltyParameters(ops);
 
-        request.setBizModel(model);
+            request.setBizModel(model);
 
 
-        AlipayTradeOrderSettleResponse response1 = alipayClient.execute(request);
-        if (response1.isSuccess()) {
-            System.out.println("调用成功");
-        } else {
-            System.out.println("调用失败");
+            AlipayTradeOrderSettleResponse response1 = alipayClient.execute(request);
+            if (response1.isSuccess()) {
+                System.out.println("调用成功");
+            } else {
+                System.out.println("调用失败");
+            }
         }
+
     }
 
 
-    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() {
@@ -2056,6 +2134,7 @@
                         coupon.setCouponId(userPointsMerchandises.get(0).getPointsMerchandiseId());
                         coupon.setUserId(userPointsMerchandises.get(0).getUserId());
                         coupon.setStatus(1);
+                        coupon.setInsertTime(new Date());
                         ucponClient.insertToAppuserCoupon(coupon);
                         break;
                     default:
@@ -2086,6 +2165,7 @@
                     coupon.setCouponId(userPointsMerchandises.get(0).getPointsMerchandiseId());
                     coupon.setUserId(userPointsMerchandises.get(0).getUserId());
                     coupon.setStatus(1);
+                    coupon.setInsertTime(new Date());
                     ucponClient.insertToAppuserCoupon(coupon);
                     break;
                 default:

--
Gitblit v1.7.1