liujie
2023-08-02 b64d67ef01e81a857046f19dd556b4e4f0695e1c
cloud-server-account/src/main/java/com/dsh/account/service/impl/TStudentServiceImpl.java
@@ -13,13 +13,11 @@
import com.dsh.account.feignclient.competition.model.GetStuSourseList;
import com.dsh.account.feignclient.competition.model.PurchaseRecordVo;
import com.dsh.account.feignclient.competition.model.SaveParticipant;
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.*;
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.*;
import com.dsh.account.mapper.CoachMapper;
@@ -30,10 +28,9 @@
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;
@@ -104,6 +101,12 @@
    private PayMoneyUtil payMoneyUtil;
    @Resource
    private SiteClient steClient;
    @Resource
    private CourseListClient culisClient;
    @Override
@@ -121,7 +124,8 @@
        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());
@@ -249,6 +253,25 @@
        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;
    }
@@ -304,7 +327,7 @@
    }
    @Override
    public QuestionDetailsVo queryQuestionData() {
    public List<QuestionIns> queryQuestionData() {
        return quesClient.getSysQuestionDetails();
    }
@@ -319,16 +342,11 @@
    }
    @Override
    public ExploreDatasVo queryIndexOfExplores(LonLatRequest llrequest) {
        ExploreDatasVo datasVo = new ExploreDatasVo();
    public List<StoreInfo> queryIndexOfExplores(LonLatRequest llrequest) {
        GetAllNearbyStoreList getAllNearbyStoreList = new GetAllNearbyStoreList();
        getAllNearbyStoreList.setLongitude(llrequest.getLongitude());
        getAllNearbyStoreList.setLatitude(llrequest.getLatitude());
        List<StoreInfo> allNearbyStoreList = storeClient.getAllNearbyStoreList(getAllNearbyStoreList);
        List<StoreLonLatList> allStoreLonLats = storeClient.getAllStoreLonLats(getAllNearbyStoreList);
        datasVo.setStoreLists(allNearbyStoreList);
        datasVo.setLonLatLists(allStoreLonLats);
        return datasVo;
        return storeClient.getAllNearbyStoreList(getAllNearbyStoreList);
    }
    @Override
@@ -488,7 +506,7 @@
    }
    public ResultUtil AlipayPayment(String code,BigDecimal amount){
        ResultUtil alipay = payMoneyUtil.alipay("课包续费", "", "", code, amount.toString(),
        ResultUtil alipay = payMoneyUtil.alipay("课包续费", "课包续费", "", code, amount.toString(),
                "/base/coursePackage/alipayPaymentCallback");
        if(alipay.getCode() == 200){
            new Thread(new Runnable() {
@@ -564,7 +582,7 @@
    }
    @Override
    public AppointmentRecordVo getAppointmentRecords(Integer stuId, Integer appUserId) {
    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 )
@@ -572,7 +590,72 @@
        if (ToolUtil.isNotEmpty(tStudent)){
            recordVo.setStuId(tStudent.getId());
            recordVo.setStuName(tStudent.getName());
            recordVo.setAppointList(couPayClient.obtainStudentClassDetailsData(stuId));
            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;
    }
@@ -594,5 +677,35 @@
        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;
    }
}