| | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.alibaba.nacos.common.utils.UuidUtils; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.dsh.course.entity.CoursePackagePaymentConfig; |
| | | import com.dsh.course.entity.TCoursePackage; |
| | |
| | | coursePackageListVo.setClassStartTime(coursePackage.getClassStartTime() + "-" + coursePackage.getClassEndTime()); |
| | | coursePackageListVo.setApplicantsNumber(integer); |
| | | coursePackageListVo.setPayType(coursePackage.getPayType()); |
| | | coursePackageListVo.setPlayPaiCoin(coursePackageListVo.getPlayPaiCoin()); |
| | | coursePackageListVo.setPlayPaiCoin(coursePackagePaymentConfig.getPlayPaiCoin()); |
| | | |
| | | //会员显示原价和会员价(最低)。非会员显示会员价和支付价(最低) |
| | | if(appUser.getIsVip() == 0){//非会员 |
| | |
| | | .eq("type", 1).eq("auditStatus", 2)); |
| | | Double vipPrice = coursePackagePaymentConfig.getCashPayment(); |
| | | for (TCoursePackageDiscount coursePackageDiscount : list2) { |
| | | Double num1 = JSON.parseObject(coursePackageDiscount.getContent()).getDouble("num1"); |
| | | Double num1 = JSON.parseObject(coursePackageDiscount.getContent()).getDouble("discountMember"); |
| | | if(vipPrice.compareTo(num1) > 0){ |
| | | vipPrice = num1; |
| | | } |
| | |
| | | .eq("type", 1).eq("auditStatus", 2)); |
| | | Double vipPrice = coursePackagePaymentConfig.getCashPayment(); |
| | | for (TCoursePackageDiscount coursePackageDiscount : list2) { |
| | | Double num1 = JSON.parseObject(coursePackageDiscount.getContent()).getDouble("num1"); |
| | | Double num1 = JSON.parseObject(coursePackageDiscount.getContent()).getDouble("discountMember"); |
| | | if(vipPrice.compareTo(num1) > 0){ |
| | | vipPrice = num1; |
| | | } |
| | |
| | | .eq("type", 1).eq("auditStatus", 2)); |
| | | Double vipPrice = coursePackagePaymentConfig.getCashPayment(); |
| | | for (TCoursePackageDiscount coursePackageDiscount : list2) { |
| | | Double num1 = JSON.parseObject(coursePackageDiscount.getContent()).getDouble("num1"); |
| | | Double num1 = JSON.parseObject(coursePackageDiscount.getContent()).getDouble("discountMember"); |
| | | if(vipPrice.compareTo(num1) > 0){ |
| | | vipPrice = num1; |
| | | } |
| | |
| | | .eq("type", 1).eq("auditStatus", 2)); |
| | | Double vipPrice = coursePackagePaymentConfig.getCashPayment(); |
| | | for (TCoursePackageDiscount coursePackageDiscount : list2) { |
| | | Double num1 = JSON.parseObject(coursePackageDiscount.getContent()).getDouble("num1"); |
| | | Double num1 = JSON.parseObject(coursePackageDiscount.getContent()).getDouble("discountMember"); |
| | | if(vipPrice.compareTo(num1) > 0){ |
| | | vipPrice = num1; |
| | | } |
| | |
| | | } |
| | | if(coupon.getType() == 1){//满减 |
| | | JSONObject jsonObject = JSON.parseObject(coupon.getContent()); |
| | | Double num1 = jsonObject.getDouble("num1"); |
| | | Double num2 = jsonObject.getDouble("num2"); |
| | | // {"conditionalAmount":50,"deductionAmount":10,"experienceName":""} |
| | | Double num1 = jsonObject.getDouble("conditionalAmount"); |
| | | Double num2 = jsonObject.getDouble("deductionAmount"); |
| | | if(price.compareTo(num1) <= 0){ |
| | | return ResultUtil.error("该优惠券无法使用"); |
| | | } |
| | |
| | | } |
| | | if(coupon.getType() == 2){//代金券 |
| | | JSONObject jsonObject = JSON.parseObject(coupon.getContent()); |
| | | Double num1 = jsonObject.getDouble("num1"); |
| | | Double num1 = jsonObject.getDouble("conditionalAmount"); |
| | | if(price.compareTo(num1) <= 0){ |
| | | return ResultUtil.error("该优惠券无法使用"); |
| | | } |
| | |
| | | appUserClient.updateAppUser(appUser); |
| | | return ResultUtil.success(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取课包管理列表数据 |
| | | * @param queryCoursePackageLists |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<Map<String, Object>> queryCoursePackageLists(Page<Map<String, Object>> page, QueryCoursePackageLists queryCoursePackageLists) { |
| | | List<Map<String, Object>> list = this.baseMapper.queryCoursePackageLists(page, queryCoursePackageLists); |
| | | for (Map<String, Object> map : list) { |
| | | Integer id = Integer.valueOf(map.get("id").toString()); |
| | | Integer integer = coursePackagePaymentService.queryCountNumber(id); |
| | | map.put("paymentNumber", integer); |
| | | |
| | | boolean cash = false; |
| | | boolean coin = false; |
| | | List<CoursePackagePaymentConfig> coursePackagePaymentConfigs = coursePackagePaymentConfigService.list(new QueryWrapper<CoursePackagePaymentConfig>().eq("coursePackageId", id)); |
| | | for (CoursePackagePaymentConfig coursePackagePaymentConfig : coursePackagePaymentConfigs) { |
| | | if(0 != coursePackagePaymentConfig.getCashPayment()){ |
| | | cash = true; |
| | | } |
| | | if(0 != coursePackagePaymentConfig.getPlayPaiCoin()){ |
| | | coin = true; |
| | | } |
| | | } |
| | | map.put("payType", (cash ? "现金支付" : "") + (coin ? cash ? "&玩湃币支付" : "玩湃币支付" : "")); |
| | | } |
| | | return list; |
| | | } |
| | | } |