From b1fb83530b7105e4aa73e4101727dea945eb01c2 Mon Sep 17 00:00:00 2001
From: 无关风月 <443237572@qq.com>
Date: 星期五, 29 八月 2025 21:48:15 +0800
Subject: [PATCH] bug修改
---
cloud-server-account/src/main/java/com/dsh/account/service/impl/TStudentServiceImpl.java | 351 ++++++++++++++++++++++++++++------------------------------
1 files changed, 169 insertions(+), 182 deletions(-)
diff --git a/cloud-server-account/src/main/java/com/dsh/account/service/impl/TStudentServiceImpl.java b/cloud-server-account/src/main/java/com/dsh/account/service/impl/TStudentServiceImpl.java
index 870a43f..677f74b 100644
--- a/cloud-server-account/src/main/java/com/dsh/account/service/impl/TStudentServiceImpl.java
+++ b/cloud-server-account/src/main/java/com/dsh/account/service/impl/TStudentServiceImpl.java
@@ -1,5 +1,9 @@
package com.dsh.account.service.impl;
+import com.alipay.api.AlipayClient;
+import com.alipay.api.DefaultAlipayClient;
+import com.alipay.api.request.AlipayTradeOrderSettleRequest;
+import com.alipay.api.response.AlipayTradeOrderSettleResponse;
import com.alipay.api.response.AlipayTradeQueryResponse;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -39,6 +43,7 @@
import com.dsh.account.service.TCourseInfoRecordService;
import com.dsh.account.service.TStudentService;
import com.dsh.account.util.*;
+import com.dsh.account.util.wx.WxV3PayConfig;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
@@ -48,6 +53,9 @@
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;
@@ -101,6 +109,8 @@
@Resource
private ParticipantClient participantClient;
+ @Autowired
+ private CoursePackageClient coursePackageClient;
@Autowired
private PayMoneyUtil payMoneyUtil;
@@ -119,11 +129,12 @@
@Override
public ResultUtil addStuOfAppUser(StuDetailsReq stu, Integer appUserId) throws Exception {
TStudent student = new TStudent();
- if (ToolUtil.isNotEmpty(stu.getName()) && ToolUtil.isNotEmpty(stu.getIdCard())) {
- Boolean aBoolean = JuHeUtil.idcardAuthentication(stu.getIdCard(), stu.getName());
- if (!aBoolean) {
- return ResultUtil.error("身份证和姓名不匹配");
- }
+ if(ToolUtil.isEmpty(stu.getIdCard())){
+ return ResultUtil.error("请填写身份证号");
+ }
+ Boolean aBoolean = JuHeUtil.idcardAuthentication(stu.getIdCard(), stu.getName());
+ if (!aBoolean) {
+ return ResultUtil.error("身份证和姓名不匹配");
}
student.setAppUserId(appUserId);
student.setName(stu.getName());
@@ -163,6 +174,7 @@
saveParticipant.setWeight(student.getWeight());
saveParticipant.setPhone(student.getPhone());
saveParticipant.setIdcard(student.getIdCard());
+
participantClient.saveParticipant(saveParticipant);
return ResultUtil.success();
}
@@ -234,107 +246,7 @@
@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;
}
@@ -480,14 +392,14 @@
packagePayment.setStatus(1);
packagePayment.setState(1);
packagePayment.setInsertTime(new Date());
- couPayClient.savePaymentCoursePackage(packagePayment);
+// couPayClient.savePaymentCoursePackage(packagePayment);
Integer hour = couPayClient.getClassHour(request.getCourseConfigId());
try {
switch (request.getPayType()) {
case 1:
- return WeChatPayment(code, request.getPayAmount(), hour);
+ return WeChatPayment(code, request.getPayAmount(), hour,request.getLessonId());
case 2:
return AlipayPayment(code, request.getPayAmount(), hour);
case 3:
@@ -512,69 +424,59 @@
}
- public ResultUtil WeChatPayment(String code, BigDecimal amount, Integer hour) throws Exception {
- ResultUtil weixinpay = payMoneyUtil.weixinpay("课包续费", "", code, amount.toString(),
- "/base/coursePackage/wechatPaymentCallback", "APP", "");
- if (weixinpay.getCode() == 200) {
- new Thread(new Runnable() {
- @Override
- public void run() {
- try {
- int num = 1;
- int wait = 0;
- while (num <= 10) {
- int min = 5000;
- wait += (min * num);
- Thread.sleep(wait);
- TCoursePackagePayment coursePackagePayment = couPayClient.getCoursePackagePaymentByCode(code);
- if (coursePackagePayment.getPayStatus() == 2) {
- break;
- }
- ResultUtil<Map<String, String>> resultUtil = payMoneyUtil.queryWXOrder(code, "");
- if (resultUtil.getCode() == 200 && coursePackagePayment.getPayStatus() == 1) {
- /**
- * SUCCESS—支付成功,
- * REFUND—转入退款,
- * NOTPAY—未支付,
- * CLOSED—已关闭,
- * REVOKED—已撤销(刷卡支付),
- * USERPAYING--用户支付中,
- * PAYERROR--支付失败(其他原因,如银行返回失败)
- */
- Map<String, String> data1 = resultUtil.getData();
- String s = data1.get("trade_state");
- String transaction_id = data1.get("transaction_id");
- if ("REFUND".equals(s) || "NOTPAY".equals(s) || "CLOSED".equals(s) || "REVOKED".equals(s) || "PAYERROR".equals(s) || num == 10) {
- coursePackagePayment.setState(3);
- couPayClient.delPaymentCoursePackage(coursePackagePayment.getId());
- break;
- }
- if ("SUCCESS".equals(s)) {
- coursePackagePayment.setPayStatus(2);
- coursePackagePayment.setTotalClassHours(hour);
- coursePackagePayment.setLaveClassHours(hour);
- coursePackagePayment.setOrderNumber(transaction_id);
- couPayClient.updatePaymentCoursePackage(coursePackagePayment);
- break;
- }
- if ("USERPAYING".equals(s)) {
- num++;
- }
- }
- }
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- }).start();
+ public ResultUtil WeChatPayment(String code, BigDecimal amount, Integer hour,Integer lessonId) throws Exception {
+ // 判断这个课包是属于哪个运营商的
+ CoursePackage coursePackage = coursePackageClient.queryCoursePackageById(lessonId);
+ Integer storeId = coursePackage.getStoreId();
+ Store store = storeClient.queryStoreById(storeId);
+ int isFenZhang= 1;
+ String merchantNumber = "";
+ if (store.getOperatorId()==null || store.getOperatorId()==0){
+ // 平台
+ isFenZhang = 0;
}
- return weixinpay;
- }
+ if (isFenZhang == 1) {
+ String s2 = storeClient.getmerchantNumberByOperatorId(store.getOperatorId());
+ System.err.println("微信商户号"+s2);
+ if(!StringUtils.hasLength(s2)){
+ return ResultUtil.error("运营商未配置微信商户号,获取支付失败!");
+ }
+ ResultUtil weixinpay = payMoneyUtil.weixinpayV3(s2,"课包续费",
+ code,"/base/coursePackage/wechatPaymentCallback1",
+ amount.toString());
+ return weixinpay;
+
+ }else{
+ ResultUtil weixinpay = payMoneyUtil.weixinpay("课包续费", "", code, amount.toString(),
+ "/base/coursePackage/wechatPaymentCallback", "APP", "");
+
+ 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 || store.getOperatorId()==0){
+ // 平台
+ smid1 = smid;
+ }else{
+ smid1 = storeClient.getmerchantNumberAliByOperatorId(store.getOperatorId());
+ }
+ if (!StringUtils.hasLength(smid1)){
+ return ResultUtil.error("运营商未配置支付宝商户号,获取支付失败!");
+ }
+ ResultUtil alipay = payMoneyUtil.alipay(smid1,"课包续费", "课包续费", "", code, amount.toString(),
"/base/coursePackage/alipayPaymentCallback");
if (alipay.getCode() == 200) {
+ String finalSmid = smid1;
new Thread(new Runnable() {
@Override
public void run() {
@@ -590,7 +492,6 @@
break;
}
AlipayTradeQueryResponse resultUtil = payMoneyUtil.queryALIOrder(code);
-
if (resultUtil.getCode().equals("10000") && coursePackagePayment.getPayStatus() == 1) {
/**
* WAIT_BUYER_PAY(交易创建,等待买家付款)、
@@ -615,8 +516,9 @@
coursePackagePayment.setLaveClassHours(hour);
coursePackagePayment.setOrderNumber(tradeNo);
couPayClient.updatePaymentCoursePackage(coursePackagePayment);
-
-
+ Integer coursePackageId = coursePackagePayment.getCoursePackageId();
+ Thread.sleep(30000);
+ payMoneyUtil.confirm(finalSmid,code,tradeNo,amount.toString());
break;
}
if ("WAIT_BUYER_PAY".equals(tradeStatus)) {
@@ -632,7 +534,51 @@
}
return alipay;
}
-
+ private void extracted(Integer operatorId, BigDecimal coursePackageOrder1, String tradeNo) throws Exception {
+ // 分账
+ AlipayClient alipayClient = new DefaultAlipayClient("https://openapi.alipay.com/gateway.do",
+ "2021004105665036",
+ "MIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQCi5i9nW/hGLJ3A06cZxTQdviFC7THpdSihoTYGLr9q006hu0V26ecBMY/o4w5bvIX0Ok/yofmZsVcCJpAPvbXL/uqVrIjnRRxXiaeBFThlxoBUTdunvbUSDYfzlEhJr5NvUKI6H6lz2niXlQGx4qy8Hau4ccWit9kM8jwUvsBVQoFgJA+xrjMvooA7YLopQtpOD+UJr5thApTSf1xrnr1W12yolTLEH15JmNV372cqXrYUuqnY0QsaPtxeqJUGAOcGdVLllQ7easEznP8DFBvDdHATcmp2SHNQDUEWN6MCVPbMgY06NQVqAXxqjTAYSVh+6TRu6bofPmpYC3TZB003AgMBAAECggEBAJAcR2+PA3NBYUYHeFrqBRMS8uX8ZR19kjZ7IgoSLTFaQsP9opRylPSPXhrPVBKAE5leRQAHn4MCSlESwHvMfxo7KFjFTFAc6dffZZpipYQUOc9bGampwJh58/3e/pyBgVMG6J23CPf/HJQtNFSkjd/V9+ayb/9l2dUEL3bC0fAZ/dbx8HsxdLw8wn3fLlWLj68hOMqa2deCZe3JdSVsPbeWqkh56FFsMLug0Nd+Ar4TgRl9/jnhXF0JWiD0LmPUYLhboY7EfUBzN4w1iYbDi1P+3zvoOYsiVKAXox9GMhQ2VzOO2UcSTuizSza2e98mGpabl/GpKmCz+RDFjtkX6eECgYEA2MyCij65eO3aGIm3FUe93DULRBYTfX8qJQSJq2WOWA3mmQlEW6L3O2B5/lG2h+8WmN6iLEs9eHpgycGYp7vAqgrANEn16ACVcuyx0scFtrZfZ+kmHMzFfiUWxJjVYk/6YngsGVBLdw6ueM42C8TTP67X9tU5TdVGoGWuqEj4W98CgYEAwFqwprXOch5Pqk/RPbb49r0Ou03K/UbciWnWWKzUhFFNS8MdlQPoDvQZbMwHLeWsa2VhaKITK3x5biLQb3U+0GLOn6lTvEyrEUH+ucREyLgVYTRAvwBPtnvlrzpyxPk2HnslQjju8WrvvLLBMKWUjlTrTOzhaHT21gz3pHMiOakCgYEAhLmfaXdBITGshb054sNLDtdCkGpbgEcrzAHdLps769iGxkYQHXHFngpQZUwtTUcoNGqIKknd1jZFrv7gsD+XkgKG7PwimehRlkwmCX5ilxtLiVgJRzRt6+5U5AMVD90a0tHzXYP0z2yjj73fBJF5KtGl0a10KZxaYrQdm1UhB00CgYBZZgzx/k9rtHC8LAqIj1CYhHejT92G53c6Gkl3vyOqN4sgKhfGmSEySfrDGPRBPZxr8ZtbIPCd5mUdberH0osWGMYFaJI1UsCy7aQwvGpniz7MhZeN7dweaOjwDs8mgtjHQ96mL4XGCDhR0BZ/wIURvZ/6iaGdhbbu9unlsWj3uQKBgQCmZYdsbbZkd3ev6f8rwyvMz+DrCQyYpY44cegBYuJgrZiQnL2fJioeN7ixX0UM48SfwsZEIrzshP/LGAwnc2MdjxKUl4jLN8SEe0NAjXOnz9Zaw740+aOmLpXcLWdP4uM2gIhWsvW1tEkQZCXmm7c9s/RsU8Pmzv+YL3+fSijOzA==",
+ "json", "GBK",
+ "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAmu8n/4yTHWbn7VOrNc9OsLtDL1bEQ8gC1dHkj8Wy5z0mkaOsjJRIG/28ze12M0V8jdCKuuDr5Z1OPKiqf+XO3ypguEh+mYUVMBM/cZodDFQfTY1TKLWjvQCuaqlA+QUTCK6f7T7stsgyQ1o9Jj0rXZDz6PM4QHSTzjrLIBaeqM5WIBvH+fy/X+QG5Utd+/UT0kc0JyvuKhZ65yVUd/C9VcwJJAPliRsAQNrqYterwAJ9zvw9tF11wj9W0XgJ8Ccu4x3gR1vrlLRJJo/OA97RmxPQ+5hSacWQZCUd1dwiBq+YCrKVHGTj14izRHXrLc0yBlRXo7tBOIqcy3IsvKVthQIDAQAB",
+ "RSA2");
+ AlipayTradeOrderSettleRequest request = new AlipayTradeOrderSettleRequest();
+ String randomCode = UUIDUtil.getRandomCode(16);
+ String proportionByOperatorId1 = storeClient.getProportionByOperatorId(operatorId);
+ // 支付宝分账比例
+ String s1 = proportionByOperatorId1.split(",")[1];
+ double i = Double.parseDouble(s1);
+ double v = i * 0.01;
+ BigDecimal bigDecimal1 = new BigDecimal(String.valueOf(v));
+ // 分账金额
+ BigDecimal bigDecimal2 = coursePackageOrder1.multiply(bigDecimal1).setScale(2, RoundingMode.DOWN);
+ request.setBizContent("{" +
+ " \"out_request_no\":\"" + randomCode + "\"," +
+ " \"trade_no\":\"" + tradeNo + "\"," +
+ " \"royalty_parameters\":[" +
+ " {" +
+ " \"royalty_type\":\"transfer\"," +
+ " \"trans_out\":\"" + storeClient.getSMIDByOperatorId(operatorId)+ "\"," +
+ " \"trans_out_type\":\"userId\"," +
+ " \"trans_in_type\":\"userId\"," +
+ " \"trans_in\":\"" + smid + "\"," +
+ " \"amount\":" + bigDecimal2 + "," +
+ " \"desc\":\"平台服务费\"," +
+ " \"royalty_scene\":\"平台服务费\"," +
+ " }" +
+ " ]," +
+ " \"extend_params\":{" +
+ " \"royalty_finish\":\"true\"" +
+ " }," +
+ " \"royalty_mode\":\"async\"" +
+ "}");
+ AlipayTradeOrderSettleResponse response = alipayClient.execute(request);
+ if (response.isSuccess()) {
+ System.out.println("调用成功");
+ } else {
+ System.out.println("调用失败");
+ }
+ }
public int PlaypaiGoldPayment(String code, ClasspaymentRequest request) {
PlayPaiGoldCoursePackage paiGoldCoursePackage = new PlayPaiGoldCoursePackage();
paiGoldCoursePackage.setCoursePackageId(request.getLessonId());
@@ -703,10 +649,19 @@
.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;
}
})
@@ -717,10 +672,20 @@
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;
}
})
@@ -732,9 +697,19 @@
.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;
}
})
@@ -781,18 +756,16 @@
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;
}
@@ -879,9 +852,23 @@
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;
}
--
Gitblit v1.7.1