| | |
| | | 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(); |
| | | } |
| | |
| | | } |
| | | 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; |
| | | } |