| | |
| | | import com.dsh.account.entity.TStudent; |
| | | import com.dsh.account.feignclient.activity.IntroduceRewardsClient; |
| | | import com.dsh.account.feignclient.activity.UserConponClient; |
| | | import com.dsh.account.feignclient.activity.model.IntrduceOfUserRequest; |
| | | import com.dsh.account.feignclient.competition.DeductionCompetitionsClient; |
| | | import com.dsh.account.feignclient.competition.ParticipantClient; |
| | | import com.dsh.account.feignclient.competition.model.GetStuSourseList; |
| | | import com.dsh.account.feignclient.competition.model.PurchaseRecordVo; |
| | | import com.dsh.account.feignclient.course.CancelListClient; |
| | | import com.dsh.account.feignclient.course.CoursePaymentClient; |
| | | import com.dsh.account.feignclient.course.CourseRecordClient; |
| | | import com.dsh.account.feignclient.course.CourseSessionNameClient; |
| | | import com.dsh.account.feignclient.course.model.StuSessionDetailsVo; |
| | | import com.dsh.account.feignclient.course.model.StuWithCoursesListVo; |
| | | import com.dsh.account.feignclient.course.model.StudentOfCourseVo; |
| | | import com.dsh.account.feignclient.competition.model.SaveParticipant; |
| | | import com.dsh.account.feignclient.course.*; |
| | | import com.dsh.account.feignclient.course.model.*; |
| | | import com.dsh.account.feignclient.other.NoticeClient; |
| | | import com.dsh.account.feignclient.other.QuestionClient; |
| | | import com.dsh.account.feignclient.other.SiteClient; |
| | | import com.dsh.account.feignclient.other.StoreClient; |
| | | import com.dsh.account.feignclient.other.model.StoreDetailOfCourse; |
| | | import com.dsh.account.feignclient.other.model.StoreInfo; |
| | | import com.dsh.account.feignclient.other.model.StoreLonLatList; |
| | | import com.dsh.account.feignclient.other.model.SysNotice; |
| | | import com.dsh.account.feignclient.other.model.*; |
| | | import com.dsh.account.mapper.CoachMapper; |
| | | import com.dsh.account.mapper.TAppUserMapper; |
| | | import com.dsh.account.mapper.TStudentMapper; |
| | | import com.dsh.account.model.vo.classDetails.AppointmentRecordVo; |
| | | import com.dsh.account.model.vo.classDetails.ClasspaymentRequest; |
| | | import com.dsh.account.model.vo.classDetails.classInsVo.ClassDetailsInsVo; |
| | | import com.dsh.account.model.vo.classDetails.classInsVo.StuDetailsReq; |
| | | import com.dsh.account.model.vo.classDetails.classInsVo.StuListVo; |
| | | import com.dsh.account.model.vo.exploreDetail.ExploreDatasVo; |
| | | import com.dsh.account.model.vo.exploreDetail.LonLatRequest; |
| | | import com.dsh.account.model.vo.exploreDetails.QuestionDetailsVo; |
| | | import com.dsh.account.model.vo.exploreDetails.QuestionIns; |
| | | import com.dsh.account.model.vo.exploreDetail.QuestionIns; |
| | | import com.dsh.account.model.vo.exploreDetail.StoreDetailsVo; |
| | | import com.dsh.account.model.vo.sourceDetail.CouponStuAvailableVo; |
| | | import com.dsh.account.model.vo.sourceDetail.CourseDetailsOfContinuationResp; |
| | | import com.dsh.account.model.vo.sourceDetail.RecordTimeRequest; |
| | | import com.dsh.account.service.TStudentService; |
| | | import com.dsh.account.util.DateTimeHelper; |
| | | import com.dsh.account.util.DateUtil; |
| | | import com.dsh.account.util.ToolUtil; |
| | | import com.dsh.account.util.*; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.text.ParseException; |
| | | import java.text.SimpleDateFormat; |
| | |
| | | @Service |
| | | public class TStudentServiceImpl extends ServiceImpl<TStudentMapper, TStudent> implements TStudentService { |
| | | |
| | | @Autowired |
| | | @Resource |
| | | private CourseSessionNameClient sessionNameClient; |
| | | |
| | | @Autowired |
| | | @Resource |
| | | private DeductionCompetitionsClient dcttClient; |
| | | |
| | | @Autowired |
| | | @Resource |
| | | private CancelListClient cancelcClient; |
| | | |
| | | @Autowired |
| | | @Resource |
| | | private IntroduceRewardsClient idrClient; |
| | | |
| | | @Autowired |
| | | @Resource |
| | | private CourseRecordClient crClient; |
| | | |
| | | @Autowired |
| | | @Resource |
| | | private CoursePaymentClient couPayClient; |
| | | |
| | | @Autowired |
| | | @Resource |
| | | private UserConponClient userCClient; |
| | | |
| | | @Autowired |
| | | @Resource |
| | | private StoreClient storeClient; |
| | | |
| | | @Autowired |
| | | @Resource |
| | | private NoticeClient noClient; |
| | | |
| | | @Autowired |
| | | @Resource |
| | | private QuestionClient quesClient; |
| | | |
| | | @Autowired |
| | | @Resource |
| | | private TAppUserMapper tauMapper; |
| | | |
| | | @Autowired |
| | | @Resource |
| | | private CoachMapper coachMapper; |
| | | |
| | | @Resource |
| | | private ParticipantClient participantClient; |
| | | |
| | | |
| | | @Autowired |
| | | private PayMoneyUtil payMoneyUtil; |
| | | |
| | | |
| | | @Resource |
| | | private SiteClient steClient; |
| | | |
| | | @Resource |
| | | private CourseListClient culisClient; |
| | | |
| | | |
| | | |
| | | @Override |
| | | public void addStuOfAppUser(StuDetailsReq stu,Integer appUserId) { |
| | | 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("身份证和姓名不匹配"); |
| | | } |
| | | } |
| | | student.setAppUserId(appUserId); |
| | | student.setName(stu.getName()); |
| | | student.setHeadImg(stu.getHeadImg()); |
| | | student.setPhone(ToolUtil.isNotEmpty(stu.getPhone()) ? stu.getPhone() : ""); |
| | | student.setSex(stu.getSex()); |
| | | student.setIdCard(ToolUtil.isNotEmpty(stu.getIdCard())?stu.getIdCard() : ""); |
| | | student.setBirthday(new Date(stu.getBirthday())); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
| | | student.setBirthday(sdf.parse(stu.getBirthday())); |
| | | student.setHeight(stu.getHeight()); |
| | | student.setWeight(stu.getWeight()); |
| | | BigDecimal bigDecimal = BigDecimal.valueOf(stu.getWeight()); |
| | |
| | | student.setInsertTime(new Date()); |
| | | student.setState(1); |
| | | this.baseMapper.insert(student); |
| | | |
| | | //同步信息到参赛人员信息中 |
| | | SaveParticipant saveParticipant = new SaveParticipant(); |
| | | saveParticipant.setAppUserId(appUserId); |
| | | saveParticipant.setName(student.getName()); |
| | | saveParticipant.setBirthday(student.getBirthday()); |
| | | saveParticipant.setGender(student.getSex()); |
| | | saveParticipant.setHeight(student.getHeight().intValue()); |
| | | saveParticipant.setWeight(student.getWeight()); |
| | | saveParticipant.setPhone(student.getPhone()); |
| | | saveParticipant.setIdcard(student.getIdCard()); |
| | | participantClient.saveParticipant(saveParticipant); |
| | | return ResultUtil.success(); |
| | | } |
| | | |
| | | @Override |
| | |
| | | ClassDetailsInsVo insVo = new ClassDetailsInsVo(); |
| | | Date localMonthStart = DateTimeHelper.getCurrentMouthStart(); |
| | | Date localMonthEnd = DateTimeHelper.getCurrentMouthEnd(); |
| | | List<StuSessionDetailsVo> stuSessionList = sessionNameClient.getStuSessionList(localMonthStart,localMonthEnd,stuId,userIdFormRedis); |
| | | GetStuSessionList getStuSessionList = new GetStuSessionList(); |
| | | getStuSessionList.setStartTime(localMonthStart); |
| | | getStuSessionList.setEndTime(localMonthEnd); |
| | | getStuSessionList.setStuId(stuId); |
| | | getStuSessionList.setAppUserId(userIdFormRedis); |
| | | List<StuSessionDetailsVo> stuSessionList = sessionNameClient.getStuSessionList(getStuSessionList); |
| | | TStudent tStudent = this.baseMapper.selectById(stuId); |
| | | if (ToolUtil.isNotEmpty(tStudent)){ |
| | | insVo.setStuId(tStudent.getId()); |
| | |
| | | insVo.setStuImage(tStudent.getHeadImg()); |
| | | |
| | | List<PurchaseRecordVo> purchaseRecordVoList = new ArrayList<>(); |
| | | |
| | | List<PurchaseRecordVo> stuSourseList = dcttClient.getStuSourseList(localMonthStart,localMonthEnd,userIdFormRedis); |
| | | GetStuSourseList getStuSourseList = new GetStuSourseList(); |
| | | getStuSourseList.setStartTime(localMonthStart); |
| | | getStuSourseList.setEndTime(localMonthEnd); |
| | | getStuSourseList.setAppUserId(userIdFormRedis); |
| | | List<PurchaseRecordVo> stuSourseList = dcttClient.getStuSourseList(getStuSourseList); |
| | | purchaseRecordVoList.addAll(stuSourseList); |
| | | List<PurchaseRecordVo> cancelCourseList = cancelcClient.getCancelCourseList(localMonthStart,localMonthEnd,stuId,userIdFormRedis); |
| | | |
| | | GetStuSessionList sessionList = new GetStuSessionList(); |
| | | sessionList.setStartTime(localMonthStart); |
| | | sessionList.setEndTime(localMonthEnd); |
| | | sessionList.setStuId(stuId); |
| | | sessionList.setAppUserId(userIdFormRedis); |
| | | List<PurchaseRecordVo> cancelCourseList = cancelcClient.getCancelCourseList(sessionList); |
| | | |
| | | purchaseRecordVoList.addAll(cancelCourseList); |
| | | List<PurchaseRecordVo> purchaseRecordVos = sessionNameClient.queryCourseDetails(localMonthStart,localMonthEnd,stuId,userIdFormRedis); |
| | | List<PurchaseRecordVo> purchaseRecordVos = sessionNameClient.queryCourseDetails(getStuSessionList); |
| | | purchaseRecordVoList.addAll(purchaseRecordVos); |
| | | List<TAppUser> tAppUsers = tauMapper.selectList(new QueryWrapper<TAppUser>() |
| | | .eq("referralUserId",userIdFormRedis ) |
| | | .between("insertTime",localMonthStart ,localMonthEnd)); |
| | | List<Integer> userIds = tAppUsers.stream().map(TAppUser::getId).collect(Collectors.toList()); |
| | | List<PurchaseRecordVo> purchaseRecordVos1 = idrClient.queryAppUsersofIntroduce(localMonthStart, localMonthEnd, userIds); |
| | | IntrduceOfUserRequest request = new IntrduceOfUserRequest(); |
| | | request.setStartTime(localMonthStart); |
| | | request.setEndTime(localMonthEnd); |
| | | request.setUserIds(userIds); |
| | | List<PurchaseRecordVo> purchaseRecordVos1 = idrClient.queryAppUsersofIntroduce(request); |
| | | purchaseRecordVoList.addAll(purchaseRecordVos1); |
| | | insVo.setSessionNames(stuSessionList); |
| | | insVo.setDetails(dealDataOfTime(purchaseRecordVoList)); |
| | | StuWithCoursesListVo stuOfCoursesDetails = couPayClient.getStuOfCoursesDetails(stuId, userIdFormRedis); |
| | | GetStuOfCoursesDetails getStuOfCoursesDetails = new GetStuOfCoursesDetails(); |
| | | getStuOfCoursesDetails.setStuId(stuId); |
| | | getStuOfCoursesDetails.setAppUserId(userIdFormRedis); |
| | | StuWithCoursesListVo stuOfCoursesDetails = couPayClient.getStuOfCoursesDetails(getStuOfCoursesDetails); |
| | | insVo.setTotalNums(stuOfCoursesDetails.getTotalNums()); |
| | | insVo.setDeductedNums(stuOfCoursesDetails.getDeductedNums()); |
| | | insVo.setRemainingNums(stuOfCoursesDetails.getRemainingNums()); |
| | | Integer deductionClassHour = crClient.getDeductionClassHour(lessonId, stuId, userIdFormRedis); |
| | | GetStudentCourse course = new GetStudentCourse(); |
| | | course.setCourseId(lessonId); |
| | | course.setStuId(stuId); |
| | | course.setAppUserId(userIdFormRedis); |
| | | Integer deductionClassHour = crClient.getDeductionClassHour(course); |
| | | insVo.setDeductionClassHours(deductionClassHour); |
| | | } |
| | | |
| | |
| | | List<PurchaseRecordVo> purchaseRecordVoList = new ArrayList<>(); |
| | | Date startTime = DateTimeHelper.getCurrentIdetMouthStart(timeRequest.getStartTime()); |
| | | Date endTime = DateTimeHelper.getCurrentIdeaMouthEnd(timeRequest.getEndTime()); |
| | | |
| | | List<PurchaseRecordVo> stuSourseList = dcttClient.getStuSourseList(startTime,endTime,appUserId); |
| | | GetStuSourseList getStuSourseList = new GetStuSourseList(); |
| | | getStuSourseList.setStartTime(startTime); |
| | | getStuSourseList.setEndTime(endTime); |
| | | getStuSourseList.setAppUserId(appUserId); |
| | | List<PurchaseRecordVo> stuSourseList = dcttClient.getStuSourseList(getStuSourseList); |
| | | purchaseRecordVoList.addAll(stuSourseList); |
| | | List<PurchaseRecordVo> cancelCourseList = cancelcClient.getCancelCourseList(startTime,endTime,timeRequest.getStuId(),appUserId); |
| | | |
| | | 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); |
| | | List<PurchaseRecordVo> purchaseRecordVos = sessionNameClient.queryCourseDetails(startTime,endTime,timeRequest.getStuId(),appUserId); |
| | | 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)); |
| | | List<Integer> userIds = tAppUsers.stream().map(TAppUser::getId).collect(Collectors.toList()); |
| | | List<PurchaseRecordVo> purchaseRecordVos1 = idrClient.queryAppUsersofIntroduce(startTime, endTime, userIds); |
| | | IntrduceOfUserRequest request = new IntrduceOfUserRequest(); |
| | | request.setStartTime(startTime); |
| | | request.setEndTime(endTime); |
| | | request.setUserIds(userIds); |
| | | List<PurchaseRecordVo> purchaseRecordVos1 = idrClient.queryAppUsersofIntroduce(request); |
| | | purchaseRecordVoList.addAll(purchaseRecordVos1); |
| | | |
| | | if (purchaseRecordVoList.size() > 0 ){ |
| | | purchaseRecordVoList = purchaseRecordVoList.stream() |
| | | .filter(record -> { |
| | | String fieldValue = record.getPurchaseAmount(); |
| | | if (ToolUtil.isNotEmpty(timeRequest.getType())){ |
| | | switch (timeRequest.getType()){ |
| | | case 1: |
| | | return fieldValue != null && !fieldValue.isEmpty() && fieldValue.charAt(0) == '-'; |
| | | case 2: |
| | | return fieldValue != null && !fieldValue.isEmpty() && fieldValue.charAt(0) == '+'; |
| | | default: |
| | | break; |
| | | } |
| | | } |
| | | return false; |
| | | }) |
| | | .collect(Collectors.toList()); |
| | | } |
| | | |
| | | purchaseRecordVoList = dealDataOfTime(purchaseRecordVoList); |
| | | return purchaseRecordVoList; |
| | |
| | | public CourseDetailsOfContinuationResp queryStuOfCourseDetails(Integer lessonId, Integer stuId, Integer appUserId) { |
| | | CourseDetailsOfContinuationResp resp = new CourseDetailsOfContinuationResp(); |
| | | |
| | | StudentOfCourseVo studentCourse = couPayClient.getStudentCourse(lessonId,stuId,appUserId); |
| | | GetStudentCourse getStudentCourse = new GetStudentCourse(); |
| | | getStudentCourse.setCourseId(lessonId); |
| | | getStudentCourse.setStuId(stuId); |
| | | getStudentCourse.setAppUserId(appUserId); |
| | | StudentOfCourseVo studentCourse = couPayClient.getStudentCourse(getStudentCourse); |
| | | resp.setCoursePackageId(studentCourse.getCoursePackageId()); |
| | | resp.setStuId(stuId); |
| | | resp.setPackageImg(studentCourse.getPackageImg()); |
| | |
| | | } |
| | | |
| | | @Override |
| | | public QuestionDetailsVo queryQuestionData() { |
| | | public List<QuestionIns> queryQuestionData() { |
| | | return quesClient.getSysQuestionDetails(); |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | @Override |
| | | public ExploreDatasVo queryIndexOfExplores(LonLatRequest llrequest) { |
| | | ExploreDatasVo datasVo = new ExploreDatasVo(); |
| | | List<StoreInfo> allNearbyStoreList = storeClient.getAllNearbyStoreList(llrequest.getLongitude(),llrequest.getLatitude()); |
| | | List<StoreLonLatList> allStoreLonLats = storeClient.getAllStoreLonLats(llrequest.getLongitude(), llrequest.getLatitude()); |
| | | datasVo.setStoreLists(allNearbyStoreList); |
| | | datasVo.setLonLatLists(allStoreLonLats); |
| | | return datasVo; |
| | | public List<StoreInfo> queryIndexOfExplores(LonLatRequest llrequest) { |
| | | GetAllNearbyStoreList getAllNearbyStoreList = new GetAllNearbyStoreList(); |
| | | getAllNearbyStoreList.setLongitude(llrequest.getLongitude()); |
| | | getAllNearbyStoreList.setLatitude(llrequest.getLatitude()); |
| | | return storeClient.getAllNearbyStoreList(getAllNearbyStoreList); |
| | | } |
| | | |
| | | @Override |
| | |
| | | return purchaseRecords; |
| | | } |
| | | |
| | | @Override |
| | | public ResultUtil renewClassPayment(Integer userIdFormRedis, ClasspaymentRequest request) { |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS"); |
| | | String code = sdf.format(new Date()) + UUIDUtil.getNumberRandom(5); |
| | | |
| | | TCoursePackagePayment packagePayment = new TCoursePackagePayment(); |
| | | packagePayment.setCode(code); |
| | | packagePayment.setAppUserId(userIdFormRedis); |
| | | packagePayment.setStudentId(request.getStuId()); |
| | | packagePayment.setCoursePackageId(request.getLessonId()); |
| | | packagePayment.setPayType(request.getPayType()); |
| | | packagePayment.setAbsencesNumber(0); |
| | | packagePayment.setPayUserType(1); |
| | | packagePayment.setPayStatus(1); |
| | | packagePayment.setPayUserId(userIdFormRedis); |
| | | packagePayment.setStatus(1); |
| | | packagePayment.setState(1); |
| | | packagePayment.setInsertTime(new Date()); |
| | | couPayClient.savePaymentCoursePackage(packagePayment); |
| | | |
| | | try { |
| | | switch (request.getPayType()) { |
| | | case 1: |
| | | return WeChatPayment(code,request.getPayAmount()); |
| | | case 2: |
| | | return AlipayPayment(code,request.getPayAmount()); |
| | | case 3: |
| | | int i = PlaypaiGoldPayment(code,request); |
| | | switch (i){ |
| | | case 1: |
| | | return ResultUtil.success(); |
| | | case 2: |
| | | return ResultUtil.error("用户未登录!"); |
| | | case 3: |
| | | return ResultUtil.error("续课失败,玩湃币不足,请充值"); |
| | | case 4: |
| | | return ResultUtil.error("续课失败,请联系管理员"); |
| | | } |
| | | default: |
| | | break; |
| | | } |
| | | }catch (Exception e){ |
| | | ResultUtil.runErr(); |
| | | } |
| | | return ResultUtil.success(); |
| | | } |
| | | |
| | | |
| | | public ResultUtil WeChatPayment(String code,BigDecimal amount) 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.setOrderNumber(transaction_id); |
| | | couPayClient.updatePaymentCoursePackage(coursePackagePayment); |
| | | break; |
| | | } |
| | | if("USERPAYING".equals(s)){ |
| | | num++; |
| | | } |
| | | } |
| | | } |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | }).start(); |
| | | } |
| | | return weixinpay; |
| | | } |
| | | |
| | | public ResultUtil AlipayPayment(String code,BigDecimal amount){ |
| | | ResultUtil alipay = payMoneyUtil.alipay("课包续费", "课包续费", "", code, amount.toString(), |
| | | "/base/coursePackage/alipayPaymentCallback"); |
| | | if(alipay.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.queryALIOrder(code); |
| | | if(resultUtil.getCode() == 200 && coursePackagePayment.getPayStatus() == 1){ |
| | | /** |
| | | * WAIT_BUYER_PAY(交易创建,等待买家付款)、 |
| | | * TRADE_CLOSED(未付款交易超时关闭,或支付完成后全额退款)、 |
| | | * TRADE_SUCCESS(交易支付成功)、 |
| | | * TRADE_FINISHED(交易结束,不可退款) |
| | | */ |
| | | Map<String, String> data1 = resultUtil.getData(); |
| | | String s = data1.get("tradeStatus"); |
| | | String tradeNo = data1.get("tradeNo"); |
| | | if("TRADE_CLOSED".equals(s) || "TRADE_FINISHED".equals(s) || num == 10){ |
| | | coursePackagePayment.setState(3); |
| | | couPayClient.delPaymentCoursePackage(coursePackagePayment.getId()); |
| | | break; |
| | | } |
| | | if("TRADE_SUCCESS".equals(s)){ |
| | | coursePackagePayment.setPayStatus(2); |
| | | coursePackagePayment.setOrderNumber(tradeNo); |
| | | couPayClient.updatePaymentCoursePackage(coursePackagePayment); |
| | | break; |
| | | } |
| | | if("WAIT_BUYER_PAY".equals(s)){ |
| | | num++; |
| | | } |
| | | } |
| | | } |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | }).start(); |
| | | } |
| | | return alipay; |
| | | } |
| | | |
| | | public int PlaypaiGoldPayment(String code,ClasspaymentRequest request){ |
| | | PlayPaiGoldCoursePackage paiGoldCoursePackage = new PlayPaiGoldCoursePackage(); |
| | | paiGoldCoursePackage.setCoursePackageId(request.getLessonId()); |
| | | paiGoldCoursePackage.setStuId(request.getStuId()); |
| | | paiGoldCoursePackage.setCoursePayConfigId(request.getCourseConfigId()); |
| | | paiGoldCoursePackage.setCode(code); |
| | | return couPayClient.paymentWanpaiRenewCourse(paiGoldCoursePackage); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public ResultUtil insertVipPaymentCallback(String code, String orderNumber) { |
| | | TCoursePackagePayment coursePackagePayment = couPayClient.getCoursePackagePaymentByCode(code); |
| | | if(coursePackagePayment.getPayStatus() != 1){ |
| | | return ResultUtil.success(); |
| | | } |
| | | coursePackagePayment.setPayStatus(2); |
| | | coursePackagePayment.setOrderNumber(orderNumber); |
| | | couPayClient.updatePaymentCoursePackage(coursePackagePayment); |
| | | return ResultUtil.success(); |
| | | } |
| | | |
| | | @Override |
| | | public AppointmentRecordVo getAppointmentRecords(Integer stuId, Integer appUserId,Integer appointStatus,Integer timeType,String search) { |
| | | AppointmentRecordVo recordVo = new AppointmentRecordVo(); |
| | | TStudent tStudent = this.baseMapper.selectOne(new QueryWrapper<TStudent>() |
| | | .eq("id",stuId ) |
| | | .eq("appUserId",appUserId)); |
| | | if (ToolUtil.isNotEmpty(tStudent)){ |
| | | recordVo.setStuId(tStudent.getId()); |
| | | recordVo.setStuName(tStudent.getName()); |
| | | List<RecordAppoint> recordAppoints = couPayClient.obtainStudentClassDetailsData(stuId); |
| | | if (ToolUtil.isEmpty(appointStatus)){ |
| | | recordVo.setAppointStatus(0); |
| | | }else { |
| | | recordVo.setAppointStatus(appointStatus); |
| | | recordAppoints = recordAppoints.stream() |
| | | .filter(record -> record.getStatus().equals(appointStatus)) |
| | | .collect(Collectors.toList()); |
| | | } |
| | | if (ToolUtil.isNotEmpty(search)){ |
| | | recordVo.setAppointStatus(appointStatus); |
| | | recordAppoints = recordAppoints.stream() |
| | | .filter(record -> record.getCoursePackageName().contains(search)) |
| | | .collect(Collectors.toList()); |
| | | } |
| | | if (ToolUtil.isNotEmpty(timeType)){ |
| | | Date lastOfDate = DateUtil.getLastOfDate(); |
| | | switch (timeType){ |
| | | case 1: |
| | | Date lastWeekStartDate = DateUtil.getLastWeekStartDate(); |
| | | recordAppoints = recordAppoints.stream() |
| | | .filter(record -> { |
| | | try { |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm"); |
| | | Date time = sdf.parse(record.getTimeFrame().substring(11)); |
| | | return !time.before(lastWeekStartDate) && !time.after(lastOfDate); |
| | | } catch (ParseException e) { |
| | | return false; |
| | | } |
| | | }) |
| | | .collect(Collectors.toList()); |
| | | break; |
| | | case 2: |
| | | Date lastMonthStartDate = DateUtil.getLastMonthStartDate(); |
| | | 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); |
| | | } catch (ParseException e) { |
| | | return false; |
| | | } |
| | | }) |
| | | .collect(Collectors.toList()); |
| | | break; |
| | | case 3: |
| | | Date lastYearStartDate = DateUtil.getLastYearStartDate(); |
| | | recordAppoints = recordAppoints.stream() |
| | | .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); |
| | | } catch (ParseException e) { |
| | | return false; |
| | | } |
| | | }) |
| | | .collect(Collectors.toList()); |
| | | break; |
| | | default: |
| | | break; |
| | | |
| | | } |
| | | } |
| | | recordVo.setAppointList(recordAppoints); |
| | | } |
| | | return recordVo; |
| | | } |
| | | |
| | | @Override |
| | | public ResultUtil cancelReservationOfCourse(Integer courseStuRecordId) { |
| | | Integer integer = crClient.cancelCourseRecordClass(courseStuRecordId); |
| | | switch (integer){ |
| | | case 1: |
| | | ResultUtil.success(); |
| | | break; |
| | | case 2: |
| | | ResultUtil.error("开课前三小时不能取消!"); |
| | | break; |
| | | default: |
| | | ResultUtil.runErr(); |
| | | break; |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | public List<StoreDetailList> queryStoreList(Integer space,String cityCode,String latitude,String longitude) { |
| | | StoreOfCitycodeResp citycodeResp = new StoreOfCitycodeResp(); |
| | | citycodeResp.setSpace(space); |
| | | citycodeResp.setCityCode(cityCode); |
| | | citycodeResp.setLongitude(latitude); |
| | | citycodeResp.setLatitude(longitude); |
| | | return storeClient.getQueryStoreList(citycodeResp); |
| | | } |
| | | |
| | | @Override |
| | | public StoreDetailsVo getStoreDetail(Integer storeId) { |
| | | Store store = storeClient.queryStoreById(storeId); |
| | | StoreDetailsVo detailsVo = new StoreDetailsVo(); |
| | | String realPicture = store.getRealPicture(); |
| | | String[] split = realPicture.split(","); |
| | | detailsVo.setImages(Arrays.asList(split)); |
| | | detailsVo.setStoreId(store.getId()); |
| | | detailsVo.setStoreName(store.getName()); |
| | | detailsVo.setStoreAddress(store.getAddress()); |
| | | detailsVo.setStoreTime(store.getStartTime() + "至" +store.getEndTime()); |
| | | detailsVo.setStoreInfo(store.getIntroduce()); |
| | | detailsVo.setLon(store.getLon()); |
| | | detailsVo.setLat(store.getLat()); |
| | | detailsVo.setPhone(store.getPhone()); |
| | | detailsVo.setVenueList(steClient.getAppUserSiteList()); |
| | | detailsVo.setCourseVoList(culisClient.getStoreOfCourseList(storeId)); |
| | | return detailsVo; |
| | | } |
| | | |
| | | |
| | | } |