| | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.dsh.course.entity.TCoursePackage; |
| | | import com.dsh.course.entity.TCoursePackageDiscount; |
| | | import com.dsh.course.entity.TCoursePackagePayment; |
| | | import com.dsh.course.feignclient.model.*; |
| | | import com.dsh.course.model.dto.DiscountJsonDto; |
| | | import com.dsh.course.service.TCoursePackageDiscountService; |
| | | import com.dsh.course.service.TCoursePackagePaymentService; |
| | | import com.dsh.course.service.TCoursePackageService; |
| | | import com.dsh.course.util.DateUtil; |
| | | import com.dsh.course.util.StrUtils; |
| | | import com.fasterxml.jackson.core.JsonProcessingException; |
| | | import com.fasterxml.jackson.databind.ObjectMapper; |
| | | import io.swagger.annotations.Api; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | |
| | | |
| | | @Autowired |
| | | private TCoursePackageService tcpService; |
| | | |
| | | @Autowired |
| | | private TCoursePackageDiscountService tcpdService; |
| | | |
| | | private final SimpleDateFormat format = new SimpleDateFormat("MM-dd HH:mm"); |
| | | |
| | |
| | | } |
| | | |
| | | courseVo.setCourseTime(coursePackage.getClassStartTime()+"-"+coursePackage.getClassEndTime()); |
| | | // TODO: 2023/6/30 查询会员折扣数据 |
| | | String payType = tCoursePackagePayment.getPayType(); |
| | | BigDecimal cashPayment = tCoursePackagePayment.getCashPayment(); |
| | | double cashPaymentValue = cashPayment.doubleValue(); |
| | | Integer playPaiCoin = tCoursePackagePayment.getPlayPaiCoin(); |
| | | TCoursePackageDiscount coursePackageDiscount = tcpdService.getOne(new QueryWrapper<TCoursePackageDiscount>() |
| | | .eq("coursePackageId",coursePackage.getId() ) |
| | | .eq("type",1) |
| | | .eq("auditStatus",2)); |
| | | ObjectMapper objectMapper = new ObjectMapper(); |
| | | String content = coursePackageDiscount.getContent(); |
| | | double discountMember = 0.0; |
| | | DiscountJsonDto discountJsonDto = null; |
| | | try { |
| | | discountJsonDto = objectMapper.readValue(content, DiscountJsonDto.class); |
| | | discountMember = discountJsonDto.getDiscountMember(); |
| | | } catch (JsonProcessingException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | switch (payType) { |
| | | case "1;2": |
| | | courseVo.setAmount(cashPaymentValue); |
| | | courseVo.setVipAmount(discountMember); |
| | | courseVo.setWpGold(playPaiCoin); |
| | | break; |
| | | case "1": |
| | | courseVo.setAmount(cashPaymentValue); |
| | | courseVo.setVipAmount(discountMember); |
| | | break; |
| | | case "2": |
| | | courseVo.setWpGold(playPaiCoin); |
| | | break; |
| | | } |
| | | |
| | | courseVo.setStoreId(coursePackage.getStoreId()); |
| | | } |
| | | |