Merge remote-tracking branch 'origin/master'
| | |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."), |
| | | @ApiImplicitParam(value = "学员id", name = "stuId", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "预约状态 0=全部 1=待上课 2=已完成 3=已取消", name = "appointStatus", required = false, dataType = "int"), |
| | | @ApiImplicitParam(value = "时间类型 0=全部 1=近一周 2=近一个月 3=近一年", name = "appointStatus", required = false, dataType = "int"), |
| | | @ApiImplicitParam(value = "课程名称", name = "appointStatus", required = false, dataType = "string"), |
| | | }) |
| | | public ResultUtil<AppointmentRecordVo> cgeClassAppointmentRecordList(Integer stuId){ |
| | | public ResultUtil<AppointmentRecordVo> cgeClassAppointmentRecordList(Integer stuId,Integer appointStatus,Integer timeType,String search){ |
| | | try { |
| | | Integer appUserId = tokenUtil.getUserIdFormRedis(); |
| | | if(null == appUserId){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | return ResultUtil.success(istuService.getAppointmentRecords(stuId,appUserId)); |
| | | return ResultUtil.success(istuService.getAppointmentRecords(stuId,appUserId,appointStatus,timeType,search)); |
| | | }catch (Exception e){ |
| | | return ResultUtil.runErr(); |
| | | } |
| | |
| | | @ApiImplicitParam(value = "年月", name = "yearMonth", required = true, dataType = "string"), |
| | | @ApiImplicitParam(value = "记录(1充值 2扣除)", name = "recordId", required = true, dataType = "int"), |
| | | }) |
| | | public ResultUtil<IntegralDetailsResponse> pointDetails(String yearMonth, Integer recordId){ |
| | | public ResultUtil<List<IntegralsData>> pointDetails(String yearMonth, Integer recordId){ |
| | | try { |
| | | Integer userIdFormRedis = tokenUtil.getUserIdFormRedis(); |
| | | if(null == userIdFormRedis){ |
| | |
| | | @ApiModelProperty(value = "当前学员姓名") |
| | | private String stuName; |
| | | |
| | | @ApiModelProperty(value = "预约状态 0=全部 1=待上课 2=已完成 3=已取消") |
| | | private Integer appointStatus; |
| | | |
| | | @ApiModelProperty(value = "记录列表") |
| | | private List<RecordAppoint> appointList; |
| | | |
New file |
| | |
| | | package com.dsh.account.model.vo.userBenefitDetail; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | |
| | | @Data |
| | | public class IntegralsData { |
| | | |
| | | @ApiModelProperty(value = "名称") |
| | | private String consumeName; |
| | | |
| | | @ApiModelProperty(value = "时间") |
| | | private String consumeTime; |
| | | |
| | | @ApiModelProperty(value = "金额 例如 -90 ") |
| | | private String consumeAmount; |
| | | |
| | | @ApiModelProperty(value = "1扣减 2增加") |
| | | private Integer detailsType; |
| | | |
| | | } |
| | |
| | | * @param appUserId |
| | | * @return |
| | | */ |
| | | AppointmentRecordVo getAppointmentRecords(Integer stuId, Integer appUserId); |
| | | AppointmentRecordVo getAppointmentRecords(Integer stuId, Integer appUserId,Integer appointStatus,Integer timeType,String search); |
| | | |
| | | ResultUtil cancelReservationOfCourse( Integer courseStuRecordId); |
| | | |
| | |
| | | import com.dsh.account.entity.UserIntegralChanges; |
| | | import com.dsh.account.model.SaveUserIntegralChangesVo; |
| | | import com.dsh.account.model.vo.userBenefitDetail.ExchangeDetailsResponse; |
| | | import com.dsh.account.model.vo.userBenefitDetail.IntegralDetailsResponse; |
| | | import com.dsh.account.model.vo.userBenefitDetail.IntegralsData; |
| | | import com.dsh.account.model.vo.userBenefitDetail.PointDetailsVo; |
| | | |
| | | import java.util.List; |
| | |
| | | */ |
| | | public interface UserIntegralChangesService extends IService<UserIntegralChanges> { |
| | | |
| | | IntegralDetailsResponse queryUserPointsDetails(String yearMonth, Integer recordId, Integer userIdFormRedis); |
| | | List<IntegralsData> queryUserPointsDetails(String yearMonth, Integer recordId, Integer userIdFormRedis); |
| | | |
| | | |
| | | /** |
| | |
| | | } |
| | | |
| | | @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 ) |
| | |
| | | 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; |
| | | } |
| | |
| | | import com.dsh.account.mapper.UserIntegralChangesMapper; |
| | | import com.dsh.account.model.SaveUserIntegralChangesVo; |
| | | import com.dsh.account.model.vo.userBenefitDetail.ExchangeDetailsResponse; |
| | | import com.dsh.account.model.vo.userBenefitDetail.IntegralDetailsResponse; |
| | | import com.dsh.account.model.vo.userBenefitDetail.IntegralsData; |
| | | import com.dsh.account.model.vo.userBenefitDetail.PointDetailsVo; |
| | | import com.dsh.account.service.UserIntegralChangesService; |
| | | import com.dsh.account.util.DateTimeHelper; |
| | |
| | | private MerChandiseClient mcClient; |
| | | |
| | | @Override |
| | | public IntegralDetailsResponse queryUserPointsDetails(String yearMonth, Integer recordId, Integer userIdFormRedis) { |
| | | IntegralDetailsResponse vo = new IntegralDetailsResponse(); |
| | | List<IntegralDetailsResponse.IntegralsData> details = new ArrayList<>(); |
| | | public List<IntegralsData> queryUserPointsDetails(String yearMonth, Integer recordId, Integer userIdFormRedis) { |
| | | List<IntegralsData> details = new ArrayList<>(); |
| | | SimpleDateFormat simpleDateFormat = new SimpleDateFormat("MM-dd HH:mm"); |
| | | |
| | | Date monthStart = null; |
| | |
| | | .orderByDesc("insertTime")); |
| | | if (userIntegralChanges.size() > 0 ){ |
| | | for (UserIntegralChanges userIntegralChange : userIntegralChanges) { |
| | | IntegralDetailsResponse.IntegralsData detail= new IntegralDetailsResponse.IntegralsData(); |
| | | IntegralsData detail= new IntegralsData(); |
| | | switch (userIntegralChange.getType()){ |
| | | case 1: |
| | | detail.setConsumeAmount("+"+(userIntegralChange.getNewIntegral() - userIntegralChange.getOldIntegral())); |
| | |
| | | } |
| | | if (null != recordId){ |
| | | details = details.stream() |
| | | .filter(obj -> obj instanceof IntegralDetailsResponse.IntegralsData) |
| | | .filter(obj -> obj instanceof IntegralsData) |
| | | .filter(obj -> Objects.equals(obj.getDetailsType(), recordId)) |
| | | .collect(Collectors.toList()); |
| | | } |
| | | TAppUser tAppUser = tauMapper.selectById(userIdFormRedis); |
| | | vo.setWpGold(tAppUser.getIntegral()); |
| | | vo.setDetailList(details); |
| | | } |
| | | return vo; |
| | | return details; |
| | | } |
| | | |
| | | |
| | |
| | | return age; |
| | | } |
| | | |
| | | |
| | | // 获取近一周的开始时间 |
| | | public static Date getLastWeekStartDate() { |
| | | Calendar calendar = Calendar.getInstance(); |
| | | // 设置为当前日期的前一周 |
| | | calendar.add(Calendar.DAY_OF_YEAR, -7); |
| | | // 获取近一周的开始时间 |
| | | return calendar.getTime(); |
| | | } |
| | | |
| | | |
| | | // 获取近一个月的开始时间 |
| | | public static Date getLastMonthStartDate() { |
| | | Calendar calendar = Calendar.getInstance(); |
| | | // 设置为当前日期的前一个月 |
| | | calendar.add(Calendar.MONTH, -1); |
| | | // 获取近一个月的开始时间 |
| | | return calendar.getTime(); |
| | | } |
| | | |
| | | // 获取近一年的开始时间 |
| | | public static Date getLastYearStartDate() { |
| | | Calendar calendar = Calendar.getInstance(); |
| | | // 设置为当前日期的前一年 |
| | | calendar.add(Calendar.YEAR, -1); |
| | | // 获取近一年的开始时间 |
| | | return calendar.getTime(); |
| | | } |
| | | |
| | | |
| | | // 获取昨天的时间 |
| | | public static Date getLastOfDate() { |
| | | Calendar calendar = Calendar.getInstance(); |
| | | // 设置为当前日期的前一个月 |
| | | calendar.add(Calendar.DAY_OF_YEAR, -1); |
| | | // 获取近一个月的开始时间 |
| | | return calendar.getTime(); |
| | | } |
| | | |
| | | } |