lisy
2023-08-08 0133dbbfad0e7f5920ff4f158127e4863ee15310
cloud-server-account/src/main/java/com/dsh/account/service/impl/TAppUserServiceImpl.java
@@ -854,13 +854,15 @@
    }
    @Override
    public ResultUtil productRedemptionOperation(Integer userIdFormRedis, Integer goodId, Integer goodsType,Integer nums,Integer exchangeType,Integer payType,List<Integer> stuIds) {
        PointsMerchandise merchandise = mcClient.selectPointsMerchandiseById(goodId);
    public ResultUtil productRedemptionOperation(Integer userIdFormRedis, GoodsExchangeVo exchangeType) {
        System.out.println("exchangeType:--->");
        System.out.println(exchangeType);
        PointsMerchandise merchandise = mcClient.selectPointsMerchandiseById(exchangeType.getGoodId());
        SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS");
        String code = sdf.format(new Date()) + UUIDUtil.getNumberRandom(5);
        for (int i = 0; i < nums; i++) {
        for (int i = 0; i < exchangeType.getNums(); i++) {
            UserPointsMerchandise pointsMerchandise = new UserPointsMerchandise();
            pointsMerchandise.setPointsMerchandiseId(goodId);
            pointsMerchandise.setPointsMerchandiseId(exchangeType.getGoodId());
            pointsMerchandise.setUserId(userIdFormRedis);
            pointsMerchandise.setCode(code);
            mcClient.saveDetailsUserPointMercase(pointsMerchandise);
@@ -882,15 +884,15 @@
        this.baseMapper.updateById(tAppUser);
//        现金支付
        if (exchangeType == 2 || exchangeType == 3) {
            switch (goodsType) {
        if (exchangeType.getExchangeType() == 2 || exchangeType.getExchangeType() == 3) {
            switch (exchangeType.getGoodsType()) {
                case 2:
                    for (int i = 0; i < stuIds.size(); i++) {
                    for (int i = 0; i < exchangeType.getStuIds().size(); i++) {
                        List<CoursePackagePaymentConfig> courseConfigList = cpconClient.getCourseConfigList(merchandise.getCoursePackageId());
                        TCoursePackagePayment packagePayment = new TCoursePackagePayment();
                        packagePayment.setAppUserId(userIdFormRedis);
                        packagePayment.setStudentId(stuIds.get(i));
                        packagePayment.setStudentId(exchangeType.getStuIds().get(i));
                        packagePayment.setCoursePackageId(merchandise.getCoursePackageId());
                        for (CoursePackagePaymentConfig coursePackagePaymentConfig : courseConfigList) {
                            if (Objects.equals(coursePackagePaymentConfig.getId(),merchandise.getCoursePackageConfigId())){
@@ -914,9 +916,9 @@
                    }
                    break;
                case 4:
                    for (int i = 0; i < nums; i++) {
                    for (int i = 0; i < exchangeType.getNums(); i++) {
                        UserCoupon coupon = new UserCoupon();
                        coupon.setCouponId(goodId);
                        coupon.setCouponId(exchangeType.getGoodId());
                        coupon.setUserId(userIdFormRedis);
                        coupon.setStatus(1);
                        coupon.setInsertTime(new Date());
@@ -927,22 +929,22 @@
                    break;
            }
            switch (payType){
            switch (exchangeType.getPayType()){
                case 1:
                    try {
                        if (merchandise.getType() == 2){
                            return WechatPayment(merchandise.getCash().multiply(new BigDecimal(stuIds.size())),code);
                            return WechatPayment(merchandise.getCash().multiply(new BigDecimal(exchangeType.getStuIds().size())),code);
                        }else {
                            return WechatPayment(merchandise.getCash().multiply(new BigDecimal(nums)),code);
                            return WechatPayment(merchandise.getCash().multiply(new BigDecimal(exchangeType.getNums())),code);
                        }
                    }catch (Exception e){
                        return ResultUtil.runErr();
                    }
                case 2:
                    if (merchandise.getType() == 2){
                        AlipayPayment(merchandise.getCash().multiply(new BigDecimal(stuIds.size())),code);
                        AlipayPayment(merchandise.getCash().multiply(new BigDecimal(exchangeType.getStuIds().size())),code);
                    }else {
                        AlipayPayment(merchandise.getCash().multiply(new BigDecimal(nums)),code);
                        AlipayPayment(merchandise.getCash().multiply(new BigDecimal(exchangeType.getNums())),code);
                    }
                    break;
                default: