| | |
| | | import java.math.RoundingMode; |
| | | import java.text.ParseException; |
| | | import java.text.SimpleDateFormat; |
| | | import java.time.Instant; |
| | | import java.time.LocalDate; |
| | | import java.time.ZoneId; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | |
| | | @Resource |
| | | private ParticipantClient participantClient; |
| | | |
| | | @Autowired |
| | | private CoursePackageClient coursePackageClient; |
| | | |
| | | @Autowired |
| | | private PayMoneyUtil payMoneyUtil; |
| | |
| | | saveParticipant.setWeight(student.getWeight()); |
| | | saveParticipant.setPhone(student.getPhone()); |
| | | saveParticipant.setIdcard(student.getIdCard()); |
| | | |
| | | participantClient.saveParticipant(saveParticipant); |
| | | return ResultUtil.success(); |
| | | } |
| | |
| | | |
| | | @Override |
| | | public List<PurchaseRecordVo> queryDeduRecordDetails(RecordTimeRequest timeRequest, Integer appUserId) { |
| | | List<PurchaseRecordVo> purchaseRecordVoList = new ArrayList<>(); |
| | | String time = timeRequest.getTime(); |
| | | |
| | | List<PurchaseRecordVo> record1 = sessionNameClient.getRecord(timeRequest); |
| | | |
| | | // |
| | | // Date monthStart = null; |
| | | // Date monthEnd = null; |
| | | // if (StringUtils.hasText(time)) { |
| | | // monthStart = DateTimeHelper.getCurrentIdetMouthStart(time); |
| | | // monthEnd = DateTimeHelper.getCurrentIdeaMouthEnd(time); |
| | | // } else { |
| | | // monthStart = DateTimeHelper.getCurrentMouthStart(); |
| | | // monthEnd = DateTimeHelper.getCurrentMouthEnd(); |
| | | // } |
| | | // |
| | | // SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM"); |
| | | // Date startTime = DateTimeHelper.getCurrentIdetMouthStart(simpleDateFormat.format(monthStart)); |
| | | // Date endTime = DateTimeHelper.getCurrentIdeaMouthEnd(simpleDateFormat.format(monthEnd)); |
| | | // GetStuSourseList getStuSourseList = new GetStuSourseList(); |
| | | // getStuSourseList.setStartTime(startTime); |
| | | // getStuSourseList.setEndTime(endTime); |
| | | // getStuSourseList.setAppUserId(appUserId); |
| | | // // 报名赛事 |
| | | // List<PurchaseRecordVo> stuSourseList = dcttClient.getStuSourseList1(getStuSourseList); |
| | | // purchaseRecordVoList.addAll(stuSourseList); |
| | | // |
| | | // GetStuSessionList sessionList = new GetStuSessionList(); |
| | | // sessionList.setStartTime(startTime); |
| | | // sessionList.setEndTime(endTime); |
| | | // sessionList.setStuId(timeRequest.getStuId()); |
| | | // sessionList.setAppUserId(appUserId); |
| | | // List<PurchaseRecordVo> cancelCourseList = cancelcClient.getCancelCourseList(sessionList); |
| | | // |
| | | // purchaseRecordVoList.addAll(cancelCourseList); |
| | | // GetStuSessionList getStuSessionList = new GetStuSessionList(); |
| | | // getStuSessionList.setStartTime(startTime); |
| | | // getStuSessionList.setEndTime(endTime); |
| | | // getStuSessionList.setStuId(timeRequest.getStuId()); |
| | | // getStuSessionList.setAppUserId(appUserId); |
| | | // // 购买课包 |
| | | // List<PurchaseRecordVo> purchaseRecordVos = sessionNameClient.queryCourseDetails(getStuSessionList); |
| | | // purchaseRecordVoList.addAll(purchaseRecordVos); |
| | | // List<TAppUser> tAppUsers = tauMapper.selectList(new QueryWrapper<TAppUser>() |
| | | // .eq("referralUserId",appUserId ) |
| | | // .between("insertTime",startTime ,endTime)); |
| | | // if (ToolUtil.isNotEmpty(tAppUsers)){ |
| | | // List<Integer> userIds = tAppUsers.stream().map(TAppUser::getId).collect(Collectors.toList()); |
| | | // IntrduceOfUserRequest request = new IntrduceOfUserRequest(); |
| | | // request.setStartTime(startTime); |
| | | // request.setEndTime(endTime); |
| | | // request.setUserIds(userIds); |
| | | // // 介绍有礼 |
| | | // List<PurchaseRecordVo> purchaseRecordVos1 = idrClient.queryAppUsersofIntroduce(request); |
| | | // purchaseRecordVoList.addAll(purchaseRecordVos1); |
| | | // } |
| | | // |
| | | // LambdaQueryWrapper<TCourseInfoRecord> eq = new LambdaQueryWrapper<TCourseInfoRecord>().eq(TCourseInfoRecord::getUserId, appUserId); |
| | | // if(timeRequest.getType()!=null){ |
| | | // eq.eq(TCourseInfoRecord::getType,timeRequest.getType()); |
| | | // } |
| | | // if (timeRequest.getLessionId()!=null){ |
| | | // eq.eq(TCourseInfoRecord::getCourseId,timeRequest.getLessionId()); |
| | | // |
| | | // } |
| | | // // 2.0其他记录 |
| | | // List<TCourseInfoRecord> list = courseInfoRecordService.list(eq); |
| | | // List<PurchaseRecordVo> list1=new ArrayList<>(); |
| | | // for (TCourseInfoRecord tCourseInfoRecord : list) { |
| | | // PurchaseRecordVo purchaseRecordVo = new PurchaseRecordVo(); |
| | | // purchaseRecordVo.setPurchaseTime(new SimpleDateFormat("MM-dd HH:mm").format(tCourseInfoRecord.getTime())); |
| | | // purchaseRecordVo.setPurchaseType(tCourseInfoRecord.getName()); |
| | | // if(tCourseInfoRecord.getType()==1){ |
| | | // purchaseRecordVo.setPurchaseAmount("+"+tCourseInfoRecord.getNum()); |
| | | // }else { |
| | | // purchaseRecordVo.setPurchaseAmount("-"+tCourseInfoRecord.getNum()); |
| | | // } |
| | | // list1.add(purchaseRecordVo); |
| | | // } |
| | | // purchaseRecordVoList.addAll(list1); |
| | | // |
| | | // if (purchaseRecordVoList.size() > 0 ){ |
| | | // purchaseRecordVoList = purchaseRecordVoList.stream() |
| | | // .filter(record -> { |
| | | // String fieldValue = record.getPurchaseAmount(); |
| | | // if (ToolUtil.isNotEmpty(timeRequest.getType())){ |
| | | // switch (timeRequest.getType()){ |
| | | // case 2: |
| | | // return fieldValue != null && !fieldValue.isEmpty() && fieldValue.charAt(0) == '-'; |
| | | // case 1: |
| | | // return fieldValue != null && !fieldValue.isEmpty() && fieldValue.charAt(0) == '+'; |
| | | // default: |
| | | // break; |
| | | // } |
| | | // } |
| | | // return true; |
| | | // }) |
| | | // .collect(Collectors.toList()); |
| | | // } |
| | | // |
| | | // purchaseRecordVoList = dealDataOfTime(purchaseRecordVoList); |
| | | return record1; |
| | | } |
| | | |
| | |
| | | } |
| | | return weixinpay; |
| | | } |
| | | |
| | | private String smid = "2088330203191220";//平台支付宝商户号 |
| | | public ResultUtil AlipayPayment(String code, BigDecimal amount, Integer hour) { |
| | | ResultUtil alipay = payMoneyUtil.alipay("课包续费", "课包续费", "", code, amount.toString(), |
| | | TCoursePackagePayment coursePackagePayment = couPayClient.getCoursePackagePaymentByCode(code); |
| | | Integer coursePackageId = coursePackagePayment.getCoursePackageId(); |
| | | // 判断这个课包是属于哪个运营商的 |
| | | CoursePackage coursePackage = coursePackageClient.queryCoursePackageById(coursePackageId); |
| | | Integer storeId = coursePackage.getStoreId(); |
| | | Store store = storeClient.queryStoreById(storeId); |
| | | String smid1= ""; |
| | | if (store.getOperatorId()==null){ |
| | | // 平台 |
| | | smid1 = smid; |
| | | }else{ |
| | | String smidByOperatorId = storeClient.getSMIDByOperatorId(store.getOperatorId()); |
| | | smid1 = smidByOperatorId; |
| | | } |
| | | |
| | | ResultUtil alipay = payMoneyUtil.alipay(smid1,"课包续费", "课包续费", "", code, amount.toString(), |
| | | "/base/coursePackage/alipayPaymentCallback"); |
| | | if (alipay.getCode() == 200) { |
| | | new Thread(new Runnable() { |
| | |
| | | break; |
| | | } |
| | | AlipayTradeQueryResponse resultUtil = payMoneyUtil.queryALIOrder(code); |
| | | |
| | | if (resultUtil.getCode().equals("10000") && coursePackagePayment.getPayStatus() == 1) { |
| | | /** |
| | | * WAIT_BUYER_PAY(交易创建,等待买家付款)、 |
| | |
| | | coursePackagePayment.setLaveClassHours(hour); |
| | | coursePackagePayment.setOrderNumber(tradeNo); |
| | | couPayClient.updatePaymentCoursePackage(coursePackagePayment); |
| | | |
| | | |
| | | Integer coursePackageId = coursePackagePayment.getCoursePackageId(); |
| | | // 判断这个课包是属于哪个运营商的 |
| | | CoursePackage coursePackage = coursePackageClient.queryCoursePackageById(coursePackageId); |
| | | Integer storeId = coursePackage.getStoreId(); |
| | | Store store = storeClient.queryStoreById(storeId); |
| | | String smid1= ""; |
| | | if (store.getOperatorId()==null){ |
| | | // 平台 |
| | | smid1 = smid; |
| | | }else{ |
| | | String smidByOperatorId = storeClient.getSMIDByOperatorId(store.getOperatorId()); |
| | | smid1 = smidByOperatorId; |
| | | } |
| | | payMoneyUtil.confirm(smid1,code,tradeNo,amount.toString()); |
| | | break; |
| | | } |
| | | if ("WAIT_BUYER_PAY".equals(tradeStatus)) { |
| | |
| | | .filter(record -> { |
| | | try { |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm"); |
| | | String substring = record.getTimeFrame().substring(11); |
| | | String substring = record.getTimeFrame().substring(0,16); |
| | | Date time = sdf.parse(substring); |
| | | return !time.before(lastWeekStartDate) && !time.after(lastOfDate); |
| | | Instant instant = time.toInstant(); |
| | | LocalDate dateToCheck = instant.atZone(ZoneId.systemDefault()).toLocalDate(); |
| | | // 获取今天的日期 |
| | | LocalDate today = LocalDate.now(); |
| | | // 计算一周前的日期 |
| | | LocalDate oneWeekAgo = today.minusWeeks(1); |
| | | // 计算一周后的日期 |
| | | LocalDate oneWeekLater = today.plusWeeks(1); |
| | | return dateToCheck.isAfter(oneWeekAgo) && dateToCheck.isBefore(oneWeekLater); |
| | | } catch (ParseException e) { |
| | | e.printStackTrace(); |
| | | return false; |
| | | } |
| | | }) |
| | |
| | | recordAppoints = recordAppoints.stream() |
| | | .filter(record -> { |
| | | try { |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
| | | Date time = sdf.parse(record.getTimeFrame().substring(11)); |
| | | return !time.before(lastMonthStartDate) && !time.after(lastOfDate); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm"); |
| | | String substring = record.getTimeFrame().substring(0,16); |
| | | Date time = sdf.parse(substring); |
| | | Instant instant = time.toInstant(); |
| | | LocalDate dateToCheck = instant.atZone(ZoneId.systemDefault()).toLocalDate(); |
| | | // 获取今天的日期 |
| | | LocalDate today = LocalDate.now(); |
| | | // 计算一周前的日期 |
| | | LocalDate oneWeekAgo = today.minusMonths(1); |
| | | // 计算一周后的日期 |
| | | LocalDate oneWeekLater = today.plusMonths(1); |
| | | return dateToCheck.isAfter(oneWeekAgo) && dateToCheck.isBefore(oneWeekLater); |
| | | } catch (ParseException e) { |
| | | e.printStackTrace(); |
| | | return false; |
| | | } |
| | | }) |
| | |
| | | .filter(record -> { |
| | | try { |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm"); |
| | | Date time = sdf.parse(record.getTimeFrame().substring(11)); |
| | | return !time.before(lastYearStartDate) && !time.after(lastOfDate); |
| | | String substring = record.getTimeFrame().substring(0,16); |
| | | Date time = sdf.parse(substring); |
| | | Instant instant = time.toInstant(); |
| | | LocalDate dateToCheck = instant.atZone(ZoneId.systemDefault()).toLocalDate(); |
| | | // 获取今天的日期 |
| | | LocalDate today = LocalDate.now(); |
| | | // 计算一周前的日期 |
| | | LocalDate oneWeekAgo = today.minusYears(1); |
| | | // 计算一周后的日期 |
| | | LocalDate oneWeekLater = today.plusYears(1); |
| | | return dateToCheck.isAfter(oneWeekAgo) && dateToCheck.isBefore(oneWeekLater); |
| | | } catch (ParseException e) { |
| | | e.printStackTrace(); |
| | | return false; |
| | | } |
| | | }) |
| | |
| | | citycodeResp.setLatitude(longitude); |
| | | List<StoreDetailList> queryStoreList = storeClient.getQueryStoreList(citycodeResp); |
| | | if (queryStoreList.size() > 0) { |
| | | if (ToolUtil.isEmpty(space) || space == 2) { |
| | | if (ToolUtil.isEmpty(space) || space ==1) { |
| | | queryStoreList = queryStoreList.stream().sorted(Comparator.comparing(o -> o.getStoreDistance())).collect(Collectors.toList()); |
| | | } else { |
| | | queryStoreList = queryStoreList.stream() |
| | | .sorted(Comparator.comparing(StoreDetailList::getStoreDistance).reversed()) |
| | | .collect(Collectors.toList()); |
| | | |
| | | } else { |
| | | queryStoreList = queryStoreList.stream().sorted(Comparator.comparing(o -> o.getStoreDistance())).collect(Collectors.toList()); |
| | | } |
| | | if (ToolUtil.isNotEmpty(search)) { |
| | | queryStoreList = queryStoreList.stream().filter(o -> o.getStoreName().contains(search)).collect(Collectors.toList()); |
| | | } |
| | | |
| | | } |
| | | return queryStoreList; |
| | | } |
| | |
| | | return this.baseMapper.getGiftSelect(giftSearchDto); |
| | | } |
| | | |
| | | @Resource |
| | | private SiteClient siteClient; |
| | | |
| | | |
| | | @Override |
| | | public List<Map<String, Object>> queryCom(Integer id) { |
| | | return this.baseMapper.queryCom(id); |
| | | List<Map<String, Object>> maps = this.baseMapper.queryCom(id); |
| | | for (Map<String, Object> map : maps) { |
| | | Integer coachId = (Integer) map.get("coachId"); |
| | | System.err.println("==============XXXXXXXXXXXX"+coachId); |
| | | if (coachId!=null) { |
| | | User name = siteClient.queryUserName(coachId); |
| | | map.put("name",name.getName()); |
| | | } |
| | | } |
| | | |
| | | return maps; |
| | | } |
| | | |
| | | |