| | |
| | | @PostMapping(value = "/list") |
| | | public R<Page<TCourse>> list(@RequestBody CourseQuery informationQuery) { |
| | | Long userId = tokenService.getLoginUser().getUserId(); |
| | | |
| | | Page<TCourse> page = courseService.lambdaQuery() |
| | | .like(!StringUtils.isEmpty(informationQuery.getName()), TCourse::getCourseName, informationQuery.getName()) |
| | | .eq(informationQuery.getRegionId() != null, TCourse::getRegionId, informationQuery.getRegionId()) |
| | | .eq(informationQuery.getTechnicalId() != null, TCourse::getTechnicalId, informationQuery.getTechnicalId()) |
| | | .eq(informationQuery.getMajorId() != null, TCourse::getMajorId, informationQuery.getMajorId()) |
| | | .eq(informationQuery.getLevel() != null, TCourse::getLevel, informationQuery.getLevel()) |
| | | .orderByDesc(TCourse::getCommitteeSort) |
| | | .page(Page.of(informationQuery.getPageNum(), informationQuery.getPageSize())); |
| | | |
| | | Page<TCourse> page; |
| | | if (informationQuery.getSortType()==1){ |
| | | page = courseService.lambdaQuery() |
| | | .like(!StringUtils.isEmpty(informationQuery.getName()), TCourse::getCourseName, informationQuery.getName()) |
| | | .eq(informationQuery.getRegionId() != null, TCourse::getRegionId, informationQuery.getRegionId()) |
| | | .eq(informationQuery.getTechnicalId() != null, TCourse::getTechnicalId, informationQuery.getTechnicalId()) |
| | | .eq(informationQuery.getMajorId() != null, TCourse::getMajorId, informationQuery.getMajorId()) |
| | | .eq(informationQuery.getLevel() != null, TCourse::getLevel, informationQuery.getLevel()) |
| | | .orderByDesc(TCourse::getCreateTime) |
| | | .page(Page.of(informationQuery.getPageNum(), informationQuery.getPageSize())); |
| | | }else { |
| | | page = courseService.lambdaQuery() |
| | | .like(!StringUtils.isEmpty(informationQuery.getName()), TCourse::getCourseName, informationQuery.getName()) |
| | | .eq(informationQuery.getRegionId() != null, TCourse::getRegionId, informationQuery.getRegionId()) |
| | | .eq(informationQuery.getTechnicalId() != null, TCourse::getTechnicalId, informationQuery.getTechnicalId()) |
| | | .eq(informationQuery.getMajorId() != null, TCourse::getMajorId, informationQuery.getMajorId()) |
| | | .eq(informationQuery.getLevel() != null, TCourse::getLevel, informationQuery.getLevel()) |
| | | .orderByDesc(TCourse::getCommitteeSort) |
| | | .page(Page.of(informationQuery.getPageNum(), informationQuery.getPageSize())); |
| | | } |
| | | |
| | | Set<Long> cacheSet = redisCache.getCacheSet("COURSE:" + userId); |
| | | |
| | |
| | | }else { |
| | | record.setStudyNum(cacheSet1.size()); |
| | | } |
| | | |
| | | Long count = orderService.lambdaQuery() |
| | | .eq(TOrder::getGoodId, record.getId()) |
| | | .eq(TOrder::getGoodType, 1) |
| | | .eq(TOrder::getPaymentStatus, 2).count(); |
| | | record.setBuyNum(Integer.parseInt(String.valueOf(count))); |
| | | |
| | | } |
| | | return R.ok(page); |
| | |
| | | prepayRequest.setMchid(weChatConfig.merchantId); |
| | | prepayRequest.setOutTradeNo(byId.getCode()); |
| | | prepayRequest.setDescription("购买课程"); |
| | | prepayRequest.setNotifyUrl("http://www.zhipingwang.com.cn:8081/call-back/buy"); |
| | | prepayRequest.setNotifyUrl("http://vwpmxwbhv59i.guyubao.com/call-back/buy"); |
| | | com.wechat.pay.java.service.payments.nativepay.model.Amount amount = new com.wechat.pay.java.service.payments.nativepay.model.Amount(); |
| | | amount.setTotal(byId.getPaymentAmount().multiply(new BigDecimal(100)).intValue()); |
| | | prepayRequest.setAmount(amount); |
| | |
| | | |
| | | if (!cacheSet.isEmpty()) { |
| | | Page<TCourse> page = courseService.lambdaQuery().in(TCourse::getId, cacheSet).page(Page.of(basePage.getPageNum(), basePage.getPageSize())); |
| | | for (TCourse record : page.getRecords()) { |
| | | Set<Object> cacheSet1 = redisCache.getCacheSet("STUDY:" + record.getId()); |
| | | if (cacheSet1==null){ |
| | | record.setStudyNum(0); |
| | | }else { |
| | | record.setStudyNum(cacheSet1.size()); |
| | | } |
| | | } |
| | | return R.ok(page); |
| | | }else { |
| | | return R.ok(new Page<>()); |