Merge remote-tracking branch 'origin/master'
| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.dsh.account.entity.TStudent; |
| | | import com.dsh.account.feignclient.competition.model.PurchaseRecordVo; |
| | | import com.dsh.account.model.vo.classDetails.AppointmentRecordVo; |
| | | import com.dsh.account.model.vo.classDetails.ClasspaymentRequest; |
| | | import com.dsh.account.model.vo.classDetails.classInsVo.*; |
| | | import com.dsh.account.model.vo.commentDetail.StuCommentsVo; |
| | | import com.dsh.account.model.vo.exploreDetail.LonLatRequest; |
| | | import com.dsh.account.model.vo.medalDetail.GongVo; |
| | | import com.dsh.account.model.vo.medalDetail.StuMedalVo; |
| | | import com.dsh.account.model.vo.sourceDetail.CouponStuAvailableVo; |
| | |
| | | @PostMapping("/api/startCource/queryStudentData") |
| | | @ApiOperation(value = "上课首页", tags = {"APP-开始上课"}) |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "经度值", name = "longitude", required = true, dataType = "String"), |
| | | @ApiImplicitParam(value = "纬度值", name = "latitude", required = true, dataType = "String"), |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil<ClassInfoVo> queryCouponRecord(String longitude, String latitude){ |
| | | public ResultUtil<ClassInfoVo> queryCouponRecord(LonLatRequest lonLatRequest){ |
| | | try { |
| | | Integer userIdFormRedis = tokenUtil.getUserIdFormRedis(); |
| | | if(null == userIdFormRedis){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | return ResultUtil.success(tappuService.queryUserOfStus(userIdFormRedis,longitude,latitude)); |
| | | return ResultUtil.success(tappuService.queryUserOfStus(userIdFormRedis,lonLatRequest.getLongitude(),lonLatRequest.getLatitude())); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | |
| | | @PostMapping("/api/startCource/queryPhysical") |
| | | @ApiOperation(value = "获取学员测试报告", tags = {"APP-开始上课"}) |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "学员id", name = "id", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "学员id", name = "stuID", required = true, dataType = "int"), |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil<StuPhysicalVo> getStuPhysicalInfo(Integer stuID){ |
| | |
| | | if(null == userIdFormRedis){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | istuService.addStuOfAppUser(stu,userIdFormRedis); |
| | | return ResultUtil.success(); |
| | | return istuService.addStuOfAppUser(stu,userIdFormRedis); |
| | | }catch (Exception e){ |
| | | return ResultUtil.runErr(ResultUtil.ERROR); |
| | | } |
| | |
| | | @PostMapping("/api/startCource/renewal") |
| | | @ApiOperation(value = "课时详情-续课课包详情", tags = {"APP-开始上课"}) |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."), |
| | | @ApiImplicitParam(value = "课包id", name = "lessonId", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "学员id", name = "stuId", required = true, dataType = "int"), |
| | | }) |
| | | public ResultUtil<CourseDetailsOfContinuationResp> renewalOfCourses(Integer lessonId, Integer stuId){ |
| | | try { |
| | |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."), |
| | | @ApiImplicitParam(value = "学员id", name = "stuId", required = true, dataType = "int"), |
| | | }) |
| | | public ResultUtil<List<StuCommentsVo>> queryStuComment(@RequestParam("stuId") Integer stuId){ |
| | | public ResultUtil<List<StuCommentsVo>> queryStuComment( Integer stuId){ |
| | | try { |
| | | return ResultUtil.success(evalstuService.queryStuCommentsList(stuId)); |
| | | }catch (Exception e){ |
| | |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."), |
| | | @ApiImplicitParam(value = "学员id", name = "stuId", required = true, dataType = "int"), |
| | | }) |
| | | public ResultUtil<List<StuMedalVo>> queryStuMedal(@RequestParam("stuId") Integer stuId){ |
| | | public ResultUtil<List<StuMedalVo>> queryStuMedal( Integer stuId){ |
| | | try { |
| | | Integer appUserId = tokenUtil.getUserIdFormRedis(); |
| | | if(null == appUserId){ |
| | |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."), |
| | | @ApiImplicitParam(value = "学员id", name = "stuId", required = true, dataType = "int"), |
| | | }) |
| | | public ResultUtil<List<GongVo>> queryStuGoog(@RequestParam("stuId") Integer stuId){ |
| | | public ResultUtil<List<GongVo>> queryStuGoog(Integer stuId){ |
| | | try { |
| | | Integer appUserId = tokenUtil.getUserIdFormRedis(); |
| | | if(null == appUserId){ |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 上课预约记录 |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/api/startCource/stuAppointList") |
| | | @ApiOperation(value = "上课预约记录", tags = {"APP-开始上课"}) |
| | | @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"), |
| | | }) |
| | | public ResultUtil<AppointmentRecordVo> cgeClassAppointmentRecordList(Integer stuId){ |
| | | try { |
| | | Integer appUserId = tokenUtil.getUserIdFormRedis(); |
| | | if(null == appUserId){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | return ResultUtil.success(istuService.getAppointmentRecords(stuId,appUserId)); |
| | | }catch (Exception e){ |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 取消预约 |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/api/startCource/cancelCourse") |
| | | @ApiOperation(value = "上课预约-取消预约", tags = {"APP-开始上课"}) |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."), |
| | | @ApiImplicitParam(value = "上课记录id", name = "courseStuRecordId", required = true, dataType = "int"), |
| | | }) |
| | | public ResultUtil cancelReservation(Integer courseStuRecordId){ |
| | | try { |
| | | Integer appUserId = tokenUtil.getUserIdFormRedis(); |
| | | if(null == appUserId){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | return istuService.cancelReservationOfCourse(courseStuRecordId); |
| | | }catch (Exception e){ |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | } |
| | |
| | | @ResponseBody |
| | | @PostMapping("/base/exploreWP/exceptionDetail") |
| | | @ApiOperation(value = "联系客服-常见问题详情", tags = {"APP-探索玩湃"}) |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "问题记录id", name = "quesId", required = true, dataType = "int"), |
| | | }) |
| | | public ResultUtil<QuestionIns> queryQuestionData(Integer quesId){ |
| | | try { |
| | | return ResultUtil.success(tsService.queryQuestionDataInfo(quesId)); |
| | |
| | | |
| | | |
| | | /** |
| | | * 商品详情 |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/api/useBenefit/goodsDetails") |
| | | @ApiOperation(value = "积分商城-商品详情", tags = {"APP-使用福利"}) |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."), |
| | | @ApiImplicitParam(value = "商品id", name = "goodId", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "商品类型 1实物 2课包 3门票 4优惠券", name = "goodsType", required = true, dataType = "int"), |
| | | }) |
| | | public ResultUtil<ProductDetailsVo> productDetails(Integer goodId, Integer goodsType){ |
| | | try { |
| | | return ResultUtil.success(tauService.productDetails(goodId,goodsType)); |
| | | }catch (Exception e){ |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 积分明细 |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/api/useBenefit/integralDetails") |
| | | @ApiOperation(value = "积分明细", tags = {"APP-使用福利"}) |
| | | @ApiOperation(value = "积分商城-积分明细", tags = {"APP-使用福利"}) |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."), |
| | | @ApiImplicitParam(value = "年月", name = "yearMonth", required = true, dataType = "string"), |
| | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 兑换记录 |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/api/useBenefit/exchangeRecords") |
| | | @ApiOperation(value = "积分商城-兑换记录", tags = {"APP-使用福利"}) |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."), |
| | | @ApiImplicitParam(value = "使用状态 (1已使用 2未使用)", name = "useType", required = true, dataType = "string"), |
| | | @ApiImplicitParam(value = "商品类型 1实物 2课包 3门票 4优惠券", name = "goodType", required = true, dataType = "int"), |
| | | }) |
| | | public ResultUtil<List<ExchangeDetailsResponse>> exchangeRecordsDetails(Integer useType, Integer goodType){ |
| | | try { |
| | | Integer userIdFormRedis = tokenUtil.getUserIdFormRedis(); |
| | | if(null == userIdFormRedis){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | return ResultUtil.success(uicService.queryExchangeGoodsdetails(userIdFormRedis,useType,goodType)); |
| | | }catch (Exception e){ |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 兑换记录详情 |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/api/useBenefit/redemptionDetails") |
| | | @ApiOperation(value = "积分商城-兑换记录详情", tags = {"APP-使用福利"}) |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."), |
| | | @ApiImplicitParam(value = "记录id", name = "detailsId", required = true, dataType = "string"), |
| | | }) |
| | | public ResultUtil<PointDetailsVo> redemptionDetails(Integer detailsId){ |
| | | try { |
| | | return ResultUtil.success(uicService.queryRedemptionDetails(detailsId)); |
| | | }catch (Exception e){ |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | import com.dsh.account.feignclient.activity.model.CommodityRequest; |
| | | import com.dsh.account.feignclient.activity.model.IntegralCommodity; |
| | | import com.dsh.account.feignclient.activity.model.PointsMerchandise; |
| | | import com.dsh.account.feignclient.activity.model.ProductDetailRequest; |
| | | import com.dsh.account.model.vo.userBenefitDetail.ExchangeDetailsResponse; |
| | | import com.dsh.account.model.vo.userBenefitDetail.PointDetailsVo; |
| | | import com.dsh.account.model.vo.userBenefitDetail.ProductDetailsVo; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | |
| | | @PostMapping("/base/pointMerchars/getRedeemedNums") |
| | | public int getRedeemedQuantity(@RequestBody Integer goodId); |
| | | |
| | | @PostMapping("/base/pointMerchars/getGoodDetails") |
| | | ProductDetailsVo getGoodDetailsWithId(@RequestBody ProductDetailRequest detailRequest); |
| | | |
| | | |
| | | @PostMapping("/base/pointMerchars/getDetailsOfExchange") |
| | | List<ExchangeDetailsResponse> getIntegralExchangeDetails(@RequestBody Integer appUserId); |
| | | |
| | | @PostMapping("/base/pointMerchars/getSpecificsOfGoods") |
| | | public PointDetailsVo getSpecificsOfGoods(@RequestBody Integer speMercharsId); |
| | | } |
| | |
| | | /** |
| | | * 所属积分 |
| | | */ |
| | | private BigDecimal integral; |
| | | private Integer integral; |
| | | /** |
| | | * 商品封面 |
| | | */ |
New file |
| | |
| | | package com.dsh.account.feignclient.activity.model; |
| | | |
| | | |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class ProductDetailRequest { |
| | | |
| | | Integer goodId; |
| | | |
| | | Integer goodsType; |
| | | |
| | | } |
| | |
| | | public boolean delPaymentCoursePackage(@RequestBody Integer payId); |
| | | |
| | | @PostMapping("/base/coursePack/updatePaymentCoursePackage") |
| | | void updatePaymentCoursePackage(TCoursePackagePayment coursePackagePayment); |
| | | void updatePaymentCoursePackage(@RequestBody TCoursePackagePayment coursePackagePayment); |
| | | |
| | | @PostMapping("/base/coursePack/savePaymentCoursePackage") |
| | | public boolean savePaymentCoursePackage(@RequestBody TCoursePackagePayment packagePayment); |
| | |
| | | @PostMapping("/base/coursePack/allAmountPayRecordOfUser") |
| | | public List<TCoursePackagePayment> getAmountPayRecord(@RequestBody Integer appUserId); |
| | | |
| | | @PostMapping("/base/coursePack/obtainStudentClassDetails") |
| | | List<RecordAppoint> obtainStudentClassDetailsData(@RequestBody Integer stuId); |
| | | |
| | | } |
| | |
| | | @PostMapping("/base/courseRecord/queryDeduClassHours") |
| | | public Integer getDeductionClassHour(@RequestBody GetStudentCourse course); |
| | | |
| | | @PostMapping("/base/courseRecord/cancelCourseData") |
| | | Integer cancelCourseRecordClass(@RequestBody Integer courseRecordId); |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.dsh.account.feignclient.course.model; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class RecordAppoint { |
| | | |
| | | @ApiModelProperty(value = "课包id") |
| | | private Integer coursePackageId; |
| | | |
| | | @ApiModelProperty(value = "上课记录id") |
| | | private Long courseStuRecordId; |
| | | |
| | | @ApiModelProperty(value = "课包名称") |
| | | private String coursePackageName; |
| | | |
| | | @ApiModelProperty(value = "课时数") |
| | | private Integer courseHours; |
| | | |
| | | @ApiModelProperty(value = "上课时间范围(例如:2021.03.01 8:00-11:00)") |
| | | private String timeFrame; |
| | | |
| | | @ApiModelProperty(value = "门店名称+地址") |
| | | private String storeNameAddr; |
| | | |
| | | @ApiModelProperty(value = "课状态(1待上课 2已开始 3已完成 4已取消)") |
| | | private Integer status; |
| | | |
| | | } |
New file |
| | |
| | | package com.dsh.account.model.vo.classDetails; |
| | | |
| | | |
| | | import com.dsh.account.feignclient.course.model.RecordAppoint; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | public class AppointmentRecordVo { |
| | | |
| | | @ApiModelProperty(value = "学员id") |
| | | private Integer stuId; |
| | | |
| | | @ApiModelProperty(value = "当前学员姓名") |
| | | private String stuName; |
| | | |
| | | @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 ExchangeDetailsResponse { |
| | | |
| | | @ApiModelProperty(value = "记录id") |
| | | private Long detailsId; |
| | | |
| | | @ApiModelProperty(value = "商品名称") |
| | | private String goodName; |
| | | |
| | | @ApiModelProperty(value = "支付类型(积分 / 积分+现金)") |
| | | private String requiredType; |
| | | |
| | | @ApiModelProperty(value = "有效期开始时间") |
| | | private String startTime; |
| | | |
| | | @ApiModelProperty(value = "有效期结束时间") |
| | | private String endTime; |
| | | |
| | | @ApiModelProperty(value = "使用状态 (1已使用 2未使用)") |
| | | private Integer useStatus; |
| | | |
| | | @ApiModelProperty(value = "商品类型 1实物 2课包 3门票 4优惠券") |
| | | private Integer goodType; |
| | | |
| | | } |
New file |
| | |
| | | package com.dsh.account.model.vo.userBenefitDetail; |
| | | |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | public class PointDetailsVo { |
| | | |
| | | @ApiModelProperty(value = "记录id") |
| | | private Integer detailsId; |
| | | |
| | | @ApiModelProperty(value = "图片集") |
| | | private List<String> pics; |
| | | |
| | | @ApiModelProperty(value = "商品名称") |
| | | private String goodName; |
| | | |
| | | @ApiModelProperty(value = "适用状态(1已使用 2未使用)") |
| | | private Integer useType; |
| | | |
| | | @ApiModelProperty(value = "有效期开始时间") |
| | | private String startTime; |
| | | |
| | | @ApiModelProperty(value = "有效期结束时间") |
| | | private String endTime; |
| | | |
| | | @ApiModelProperty(value = "下单时间") |
| | | private String orderTime; |
| | | |
| | | @ApiModelProperty(value = "核销时间") |
| | | private String writeOffTime; |
| | | |
| | | @ApiModelProperty(value = "核销门店") |
| | | private String writeOffName; |
| | | |
| | | @ApiModelProperty(value = "适用范围(指定门店可用)") |
| | | private String belongs; |
| | | |
| | | @ApiModelProperty(value = "兑换说明") |
| | | private String contents; |
| | | |
| | | } |
New file |
| | |
| | | package com.dsh.account.model.vo.userBenefitDetail; |
| | | |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | public class ProductDetailsVo { |
| | | |
| | | @ApiModelProperty(value = "商品id") |
| | | private Integer goodId; |
| | | |
| | | @ApiModelProperty(value = "图片列表") |
| | | private List<String> pics; |
| | | |
| | | @ApiModelProperty(value = "商品名称") |
| | | private String goodName; |
| | | |
| | | @ApiModelProperty(value = "适用人群") |
| | | private Integer belongsScope; |
| | | |
| | | @ApiModelProperty(value = "已兑换数量") |
| | | private Integer redeemedNum; |
| | | |
| | | @ApiModelProperty(value = "剩余数量") |
| | | private Integer residueNum; |
| | | |
| | | @ApiModelProperty(value = "每人限额") |
| | | private Integer perLimit; |
| | | |
| | | @ApiModelProperty(value = "所需类型(积分/积分+现金)") |
| | | private String requiredType; |
| | | |
| | | @ApiModelProperty(value = "价值") |
| | | private BigDecimal cost; |
| | | |
| | | @ApiModelProperty(value = "课时数") |
| | | private Integer courseHours; |
| | | |
| | | @ApiModelProperty(value = "适用范围") |
| | | private String belongs; |
| | | |
| | | @ApiModelProperty(value = "有效期开始时间") |
| | | private String startTime; |
| | | |
| | | @ApiModelProperty(value = "有效期结束时间") |
| | | private String endTime; |
| | | |
| | | @ApiModelProperty(value = "兑换说明") |
| | | private String contents; |
| | | |
| | | @ApiModelProperty(value = "商品类型 1实物 2课包 3门票 4优惠券") |
| | | private Integer goodType; |
| | | |
| | | } |
| | |
| | | |
| | | ResultUtil uploadAppUserHeadImg(Integer appUserId, MultipartFile file, HttpServletRequest request); |
| | | |
| | | ProductDetailsVo productDetails(Integer goodId, Integer goodsType ); |
| | | |
| | | } |
| | |
| | | import com.dsh.account.entity.TStudent; |
| | | import com.dsh.account.feignclient.competition.model.PurchaseRecordVo; |
| | | import com.dsh.account.feignclient.other.model.SysNotice; |
| | | 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; |
| | |
| | | */ |
| | | public interface TStudentService extends IService<TStudent> { |
| | | |
| | | void addStuOfAppUser(StuDetailsReq stu,Integer appUserId); |
| | | ResultUtil addStuOfAppUser(StuDetailsReq stu,Integer appUserId) throws Exception; |
| | | |
| | | ClassDetailsInsVo querySessionDetailsDt(Integer userIdFormRedis, Integer lessonId, Integer stuId); |
| | | |
| | |
| | | |
| | | ResultUtil insertVipPaymentCallback(String outTradeNo, String transactionId); |
| | | |
| | | /** |
| | | * 查询学院的上课记录 |
| | | * @param stuId |
| | | * @param appUserId |
| | | * @return |
| | | */ |
| | | AppointmentRecordVo getAppointmentRecords(Integer stuId, Integer appUserId); |
| | | |
| | | ResultUtil cancelReservationOfCourse( Integer courseStuRecordId); |
| | | |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | 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.PointDetailsVo; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | * @throws Exception |
| | | */ |
| | | void saveUserIntegralChanges(SaveUserIntegralChangesVo vo) throws Exception; |
| | | |
| | | List<ExchangeDetailsResponse> queryExchangeGoodsdetails(Integer userIdFormRedis, Integer useType, Integer goodType); |
| | | |
| | | |
| | | PointDetailsVo queryRedemptionDetails(Integer detailsId); |
| | | |
| | | } |
| | |
| | | import com.dsh.account.feignclient.activity.UserConponClient; |
| | | import com.dsh.account.feignclient.activity.model.CommodityRequest; |
| | | import com.dsh.account.feignclient.activity.model.PointsMerchandise; |
| | | import com.dsh.account.feignclient.activity.model.ProductDetailRequest; |
| | | import com.dsh.account.feignclient.competition.DeductionCompetitionsClient; |
| | | import com.dsh.account.feignclient.competition.model.PaymentCompetition; |
| | | import com.dsh.account.feignclient.course.CoursePackageClient; |
| | |
| | | return ResultUtil.success(); |
| | | } |
| | | |
| | | @Override |
| | | public ProductDetailsVo productDetails(Integer goodId, Integer goodsType ) { |
| | | ProductDetailRequest detailsVo = new ProductDetailRequest(); |
| | | detailsVo.setGoodsType(goodsType); |
| | | detailsVo.setGoodId(goodId); |
| | | return mcClient.getGoodDetailsWithId(detailsVo); |
| | | } |
| | | |
| | | } |
| | |
| | | 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; |
| | |
| | | |
| | | |
| | | @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()); |
| | |
| | | saveParticipant.setPhone(student.getPhone()); |
| | | saveParticipant.setIdcard(student.getIdCard()); |
| | | participantClient.saveParticipant(saveParticipant); |
| | | return ResultUtil.success(); |
| | | } |
| | | |
| | | @Override |
| | |
| | | return ResultUtil.success(); |
| | | } |
| | | |
| | | @Override |
| | | public AppointmentRecordVo getAppointmentRecords(Integer stuId, Integer appUserId) { |
| | | 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()); |
| | | recordVo.setAppointList(couPayClient.obtainStudentClassDetailsData(stuId)); |
| | | } |
| | | 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; |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.dsh.account.entity.TAppUser; |
| | | import com.dsh.account.entity.UserIntegralChanges; |
| | | import com.dsh.account.feignclient.activity.MerChandiseClient; |
| | | import com.dsh.account.mapper.TAppUserMapper; |
| | | 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.PointDetailsVo; |
| | | import com.dsh.account.service.UserIntegralChangesService; |
| | | import com.dsh.account.util.DateTimeHelper; |
| | | import com.dsh.account.util.ToolUtil; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.StringUtils; |
| | | |
| | |
| | | |
| | | @Resource |
| | | private TAppUserMapper tauMapper; |
| | | |
| | | @Resource |
| | | private MerChandiseClient mcClient; |
| | | |
| | | @Override |
| | | public IntegralDetailsResponse queryUserPointsDetails(String yearMonth, Integer recordId, Integer userIdFormRedis) { |
| | |
| | | userIntegralChanges.setInsertTime(new Date()); |
| | | this.save(userIntegralChanges); |
| | | } |
| | | |
| | | @Override |
| | | public List<ExchangeDetailsResponse> queryExchangeGoodsdetails(Integer userIdFormRedis, Integer useType, Integer goodType) { |
| | | List<ExchangeDetailsResponse> integralExchangeDetails = mcClient.getIntegralExchangeDetails(userIdFormRedis); |
| | | if (ToolUtil.isNotEmpty(useType)){ |
| | | integralExchangeDetails = integralExchangeDetails.stream() |
| | | .filter(response -> Objects.equals(response.getUseStatus(), useType)) |
| | | .collect(Collectors.toList()); |
| | | } |
| | | if (ToolUtil.isNotEmpty(goodType)){ |
| | | integralExchangeDetails = integralExchangeDetails.stream() |
| | | .filter(response -> Objects.equals(response.getGoodType(), goodType)) |
| | | .collect(Collectors.toList()); |
| | | } |
| | | return integralExchangeDetails; |
| | | } |
| | | |
| | | @Override |
| | | public PointDetailsVo queryRedemptionDetails(Integer detailsId) { |
| | | return mcClient.getSpecificsOfGoods(detailsId); |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | /** |
| | | * 获取当前日期是星期几<br> |
| | | * Obtain the day of the week for the current date. |
| | | * @param dt |
| | | * @return 当前日期是星期几 |
| | | */ |
| | | public static int getWeekNumOfDate(Date dt) { |
| | | Integer[] weekDays = {7, 1, 2, 3, 4, 5, 6}; // 将周一的数值设为2,依次递增表示周二到周日 |
| | | Calendar cal = Calendar.getInstance(); |
| | | cal.setTime(dt); |
| | | int w = cal.get(Calendar.DAY_OF_WEEK) - 1; |
| | | if (w < 0) { |
| | | w = 6; // 如果为负数,将其设为6,表示周日 |
| | | } |
| | | return weekDays[w]; |
| | | } |
| | | |
| | | /** |
| | | * 获取今天时间 2017-11-20 00:00:00 |
| | | */ |
| | | public static Date todayDate() { |
New file |
| | |
| | | package com.dsh.account.util; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.dsh.account.util.httpClinet.HttpClientUtil; |
| | | import com.dsh.account.util.httpClinet.HttpResult; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @date 2023/7/11 12:05 |
| | | */ |
| | | public class JuHeUtil { |
| | | |
| | | |
| | | /** |
| | | * 校验实名认证 |
| | | * @param idcard |
| | | * @param name |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | public static Boolean idcardAuthentication(String idcard, String name) throws Exception{ |
| | | Map<String, Object> params = new HashMap<>(); |
| | | params.put("idcard", idcard); |
| | | params.put("realname", name); |
| | | params.put("key", "29fec4bbe3108e4fbf52704e5a906fe0"); |
| | | HttpResult httpResult = HttpClientUtil.pushHttpRequset("POST", "http://op.juhe.cn/idcard/query", params, null, "form"); |
| | | if(httpResult.getCode() != 200){ |
| | | return false; |
| | | } |
| | | JSONObject jsonObject = JSON.parseObject(httpResult.getData()); |
| | | Integer error_code = jsonObject.getInteger("error_code"); |
| | | if(0 == error_code){ |
| | | JSONObject result = jsonObject.getJSONObject("result"); |
| | | Integer res = result.getInteger("res"); |
| | | return res == 1 ? true : false; |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | } |
| | |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.dsh.activity.entity.PointsMerchandise; |
| | | import com.dsh.activity.entity.UserPointsMerchandise; |
| | | import com.dsh.activity.feignclient.model.IntegralCommodity; |
| | | import com.dsh.activity.entity.*; |
| | | import com.dsh.activity.feignclient.course.CoursePackageClient; |
| | | import com.dsh.activity.feignclient.course.CoursePackageConfigClient; |
| | | import com.dsh.activity.feignclient.course.model.CoursePackage; |
| | | import com.dsh.activity.feignclient.course.model.CoursePackagePaymentConfig; |
| | | import com.dsh.activity.feignclient.model.*; |
| | | import com.dsh.activity.feignclient.other.StoreClient; |
| | | import com.dsh.activity.feignclient.other.model.StoreDetailOfCourse; |
| | | import com.dsh.activity.model.request.CommodityRequest; |
| | | import com.dsh.activity.service.PointsMerchandiseService; |
| | | import com.dsh.activity.service.UserPointsMerchandiseService; |
| | | import com.dsh.activity.service.*; |
| | | import com.dsh.activity.util.GDMapGeocodingUtil; |
| | | import com.dsh.activity.util.StrUtils; |
| | | import com.dsh.activity.util.ToolUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | |
| | | @RestController |
| | |
| | | @Autowired |
| | | private UserPointsMerchandiseService upmseService; |
| | | |
| | | @Autowired |
| | | private ICouponService iCouponService; |
| | | |
| | | @Autowired |
| | | private CoursePackageClient cpClient; |
| | | |
| | | @Autowired |
| | | private StoreClient stoClient; |
| | | |
| | | @Autowired |
| | | private CoursePackageConfigClient cpcfigClient; |
| | | |
| | | @Autowired |
| | | private PointsMerchandiseStoreService pmdstoService; |
| | | |
| | | @Autowired |
| | | private UserCouponService uconService; |
| | | |
| | | @Autowired |
| | | private CouponStoreService cstoreService; |
| | | |
| | | |
| | | @PostMapping("/base/pointMerchars/convertGoods") |
| | |
| | | .eq("pointsMerchandiseId",goodId)); |
| | | } |
| | | |
| | | |
| | | @PostMapping("/base/pointMerchars/getGoodDetails") |
| | | public ProductDetailsVo getGoodDetailsWithId(@RequestBody ProductDetailRequest detailRequest){ |
| | | SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); |
| | | ProductDetailsVo detailsVo = new ProductDetailsVo(); |
| | | PointsMerchandise merchandise = pmdsService.getById(detailRequest.getGoodId()); |
| | | switch (detailRequest.getGoodsType()){ |
| | | case 2: |
| | | // 课包 |
| | | CoursePackage coursePackage = cpClient.queryCoursePackageById(detailRequest.getGoodId()); |
| | | |
| | | detailsVo.setGoodId(coursePackage.getId()); |
| | | List<String> list1 = Arrays.asList(StrUtils.splitStr2StrArr(coursePackage.getDetailDrawing(), ",")); |
| | | list1.add(coursePackage.getCoverDrawing()); |
| | | detailsVo.setPics(list1); |
| | | Collections.sort(detailsVo.getPics(), (s1, s2) -> { |
| | | if (s1.equals(coursePackage.getCoverDrawing())) { |
| | | return -1; // s1排在前面 |
| | | } else if (s2.equals(coursePackage.getCoverDrawing())) { |
| | | return 1; // s2排在前面 |
| | | } else { |
| | | return 0; // 保持原顺序 |
| | | } |
| | | }); |
| | | detailsVo.setGoodName(coursePackage.getName()); |
| | | detailsVo.setBelongsScope(merchandise.getUserPopulation()); |
| | | int coursePackageNums = upmseService.count(new QueryWrapper<UserPointsMerchandise>() |
| | | .eq("pointsMerchandiseId",merchandise.getId() )); |
| | | detailsVo.setRedeemedNum(coursePackageNums); |
| | | detailsVo.setResidueNum(merchandise.getQuantityIssued() - coursePackageNums); |
| | | detailsVo.setPerLimit(merchandise.getPickUpQuantity()); |
| | | if (merchandise.getRedemptionMethod() == 1){ |
| | | detailsVo.setRequiredType(merchandise.getIntegral() + "积分"); |
| | | }else { |
| | | detailsVo.setRequiredType(merchandise.getIntegral() + "积分+¥"+merchandise.getCash()); |
| | | } |
| | | detailsVo.setCost(merchandise.getPrice()); |
| | | if (merchandise.getUseScope() == 1){ |
| | | detailsVo.setBelongs("全国通用"); |
| | | }else if (merchandise.getUseScope() == 2){ |
| | | detailsVo.setBelongs(merchandise.getProvince()+"|"+merchandise.getCity() + "用户可用"); |
| | | }else { |
| | | List<PointsMerchandiseStore> list = pmdstoService.list(new QueryWrapper<PointsMerchandiseStore>() |
| | | .eq("pointsMerchandiseId",merchandise.getId() )); |
| | | PointsMerchandiseStore pointsMerchandiseStore = list.get(0); |
| | | StoreDetailOfCourse courseOfStore = stoClient.getCourseOfStore(pointsMerchandiseStore.getStoreId()); |
| | | detailsVo.setBelongs(courseOfStore.getStoreName()+"可用"); |
| | | } |
| | | List<CoursePackagePaymentConfig> courseConfigList = cpcfigClient.getCourseConfigList(coursePackage.getId()); |
| | | int redul = 0; |
| | | |
| | | for (CoursePackagePaymentConfig coursePackagePaymentConfig : courseConfigList) { |
| | | redul = redul + coursePackagePaymentConfig.getClassHours(); |
| | | } |
| | | detailsVo.setCourseHours(redul); |
| | | detailsVo.setStartTime(format.format(merchandise.getStartTime())); |
| | | detailsVo.setEndTime(format.format(merchandise.getEndTime())); |
| | | |
| | | detailsVo.setContents(merchandise.getRedemptionInstructions()); |
| | | detailsVo.setGoodType(merchandise.getType()); |
| | | |
| | | break; |
| | | case 1: |
| | | case 3: |
| | | |
| | | detailsVo.setGoodId(merchandise.getId()); |
| | | List<String> list2 = Arrays.asList(StrUtils.splitStr2StrArr(merchandise.getProductImages(), ",")); |
| | | list2.add(merchandise.getCover()); |
| | | detailsVo.setPics(list2); |
| | | Collections.sort(detailsVo.getPics(), (s1, s2) -> { |
| | | if (s1.equals(merchandise.getCover())) { |
| | | return -1; // s1排在前面 |
| | | } else if (s2.equals(merchandise.getCover())) { |
| | | return 1; // s2排在前面 |
| | | } else { |
| | | return 0; // 保持原顺序 |
| | | } |
| | | }); |
| | | detailsVo.setPics(list2); |
| | | detailsVo.setGoodName(merchandise.getName()); |
| | | detailsVo.setBelongsScope(merchandise.getUserPopulation()); |
| | | int count = upmseService.count(new QueryWrapper<UserPointsMerchandise>() |
| | | .eq("pointsMerchandiseId",merchandise.getId() )); |
| | | detailsVo.setRedeemedNum(count); |
| | | detailsVo.setResidueNum(merchandise.getQuantityIssued()-count); |
| | | detailsVo.setPerLimit(merchandise.getPickUpQuantity()); |
| | | if (merchandise.getRedemptionMethod() == 1){ |
| | | detailsVo.setRequiredType(merchandise.getIntegral() + "积分"); |
| | | }else { |
| | | detailsVo.setRequiredType(merchandise.getIntegral() + "积分+¥"+merchandise.getCash()); |
| | | } |
| | | detailsVo.setCost(merchandise.getPrice()); |
| | | if (merchandise.getUseScope() == 1){ |
| | | detailsVo.setBelongs("全国通用"); |
| | | }else if (merchandise.getUseScope() == 2){ |
| | | detailsVo.setBelongs(merchandise.getProvince()+"|"+merchandise.getCity() + "用户可用"); |
| | | }else { |
| | | List<PointsMerchandiseStore> list = pmdstoService.list(new QueryWrapper<PointsMerchandiseStore>() |
| | | .eq("pointsMerchandiseId",merchandise.getId() )); |
| | | PointsMerchandiseStore pointsMerchandiseStore = list.get(0); |
| | | StoreDetailOfCourse courseOfStore = stoClient.getCourseOfStore(pointsMerchandiseStore.getStoreId()); |
| | | detailsVo.setBelongs(courseOfStore.getStoreName()+"可用"); |
| | | } |
| | | |
| | | detailsVo.setStartTime(format.format(merchandise.getStartTime())); |
| | | detailsVo.setEndTime(format.format(merchandise.getEndTime())); |
| | | |
| | | detailsVo.setContents(merchandise.getRedemptionInstructions()); |
| | | detailsVo.setGoodType(merchandise.getType()); |
| | | break; |
| | | case 4: |
| | | // 优惠券 |
| | | Coupon coupon = iCouponService.getById(detailRequest.getGoodId()); |
| | | detailsVo.setGoodId(coupon.getId()); |
| | | List<String> list3 = Arrays.asList(StrUtils.splitStr2StrArr(coupon.getProductImages(), ",")); |
| | | list3.add(coupon.getCover()); |
| | | detailsVo.setPics(list3); |
| | | Collections.sort(detailsVo.getPics(), (s1, s2) -> { |
| | | if (s1.equals(coupon.getCover())) { |
| | | return -1; // s1排在前面 |
| | | } else if (s2.equals(coupon.getCover())) { |
| | | return 1; // s2排在前面 |
| | | } else { |
| | | return 0; // 保持原顺序 |
| | | } |
| | | }); |
| | | detailsVo.setGoodName(coupon.getName()); |
| | | detailsVo.setBelongsScope(coupon.getUserPopulation()); |
| | | int couponNums = uconService.count(new QueryWrapper<UserCoupon>() |
| | | .eq("couponId",coupon.getId() )); |
| | | detailsVo.setRedeemedNum(couponNums); |
| | | detailsVo.setResidueNum(coupon.getQuantityIssued()-couponNums); |
| | | detailsVo.setPerLimit(coupon.getPickUpQuantity()); |
| | | if (merchandise.getRedemptionMethod() == 1){ |
| | | detailsVo.setRequiredType(merchandise.getIntegral() + "积分"); |
| | | }else { |
| | | detailsVo.setRequiredType(merchandise.getIntegral() + "积分+¥"+merchandise.getCash()); |
| | | } |
| | | if (coupon.getUseScope() == 1){ |
| | | detailsVo.setBelongs("全国通用"); |
| | | }else if (coupon.getUseScope() == 2){ |
| | | detailsVo.setBelongs(coupon.getProvince()+"|"+coupon.getCity() + "用户可用"); |
| | | }else { |
| | | List<CouponStore> list = cstoreService.list(new QueryWrapper<CouponStore>() |
| | | .eq("couponId",coupon.getId() )); |
| | | StoreDetailOfCourse courseOfStore = stoClient.getCourseOfStore(list.get(0).getStoreId()); |
| | | detailsVo.setBelongs(courseOfStore.getStoreName()+"可用"); |
| | | } |
| | | detailsVo.setStartTime(format.format(merchandise.getStartTime())); |
| | | detailsVo.setEndTime(format.format(merchandise.getEndTime())); |
| | | |
| | | detailsVo.setContents(coupon.getIllustrate()); |
| | | detailsVo.setGoodType(4); |
| | | break; |
| | | default: |
| | | break; |
| | | } |
| | | return detailsVo; |
| | | } |
| | | |
| | | |
| | | |
| | | @PostMapping("/base/pointMerchars/getDetailsOfExchange") |
| | | public List<ExchangeDetailsResponse> getIntegralExchangeDetails(@RequestBody Integer appUserId){ |
| | | List<ExchangeDetailsResponse> responses = new ArrayList<>(); |
| | | SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd"); |
| | | List<UserPointsMerchandise> pointsMerchandises = upmseService.list(new QueryWrapper<UserPointsMerchandise>() |
| | | .eq("userId",appUserId )); |
| | | if (pointsMerchandises.size() > 0 ){ |
| | | for (UserPointsMerchandise pointsMerchandise : pointsMerchandises) { |
| | | PointsMerchandise merchandise = pmdsService.getById(pointsMerchandise.getPointsMerchandiseId()); |
| | | ExchangeDetailsResponse detailsResponse = new ExchangeDetailsResponse(); |
| | | detailsResponse.setDetailsId(pointsMerchandise.getId()); |
| | | detailsResponse.setGoodName(merchandise.getName()); |
| | | if (merchandise.getRedemptionMethod() == 1){ |
| | | detailsResponse.setRequiredType(merchandise.getIntegral()+"积分"); |
| | | }else { |
| | | detailsResponse.setRequiredType(merchandise.getIntegral()+"积分 ¥"+merchandise.getCash()); |
| | | } |
| | | detailsResponse.setStartTime(simpleDateFormat.format(merchandise.getStartTime())); |
| | | detailsResponse.setEndTime(simpleDateFormat.format(merchandise.getEndTime())); |
| | | detailsResponse.setUseStatus(pointsMerchandise.getStatus()); |
| | | detailsResponse.setGoodType(merchandise.getType()); |
| | | responses.add(detailsResponse); |
| | | } |
| | | } |
| | | return responses; |
| | | } |
| | | |
| | | |
| | | |
| | | @PostMapping("/base/pointMerchars/getSpecificsOfGoods") |
| | | public PointDetailsVo getSpecificsOfGoods(@RequestBody Integer speMercharsId){ |
| | | SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd"); |
| | | PointDetailsVo detailsVo = new PointDetailsVo(); |
| | | UserPointsMerchandise byId = upmseService.getById(speMercharsId); |
| | | if (ToolUtil.isNotEmpty(byId)){ |
| | | PointsMerchandise pmdsServiceById = pmdsService.getById(byId.getPointsMerchandiseId()); |
| | | detailsVo.setDetailsId(byId.getId()); |
| | | switch (pmdsServiceById.getType()){ |
| | | case 1: |
| | | case 3: |
| | | List<String> list2 = Arrays.asList(StrUtils.splitStr2StrArr(pmdsServiceById.getProductImages(), ",")); |
| | | list2.add(pmdsServiceById.getCover()); |
| | | detailsVo.setPics(list2); |
| | | Collections.sort(detailsVo.getPics(), (s1, s2) -> { |
| | | if (s1.equals(pmdsServiceById.getCover())) { |
| | | return -1; // s1排在前面 |
| | | } else if (s2.equals(pmdsServiceById.getCover())) { |
| | | return 1; // s2排在前面 |
| | | } else { |
| | | return 0; // 保持原顺序 |
| | | } |
| | | }); |
| | | break; |
| | | case 2: |
| | | CoursePackage coursePackage = cpClient.queryCoursePackageById(pmdsServiceById.getCoursePackageId()); |
| | | List<String> list1 = Arrays.asList(StrUtils.splitStr2StrArr(coursePackage.getDetailDrawing(), ",")); |
| | | list1.add(coursePackage.getCoverDrawing()); |
| | | detailsVo.setPics(list1); |
| | | Collections.sort(detailsVo.getPics(), (s1, s2) -> { |
| | | if (s1.equals(coursePackage.getCoverDrawing())) { |
| | | return -1; // s1排在前面 |
| | | } else if (s2.equals(coursePackage.getCoverDrawing())) { |
| | | return 1; // s2排在前面 |
| | | } else { |
| | | return 0; // 保持原顺序 |
| | | } |
| | | }); |
| | | break; |
| | | case 4: |
| | | Coupon coupon = iCouponService.getById(pmdsServiceById.getId()); |
| | | List<String> list3 = Arrays.asList(StrUtils.splitStr2StrArr(coupon.getProductImages(), ",")); |
| | | list3.add(coupon.getCover()); |
| | | detailsVo.setPics(list3); |
| | | Collections.sort(detailsVo.getPics(), (s1, s2) -> { |
| | | if (s1.equals(coupon.getCover())) { |
| | | return -1; // s1排在前面 |
| | | } else if (s2.equals(coupon.getCover())) { |
| | | return 1; // s2排在前面 |
| | | } else { |
| | | return 0; // 保持原顺序 |
| | | } |
| | | }); |
| | | break; |
| | | default: |
| | | break; |
| | | } |
| | | |
| | | detailsVo.setGoodName(pmdsServiceById.getName()); |
| | | detailsVo.setStartTime(simpleDateFormat.format(pmdsServiceById.getStartTime())); |
| | | detailsVo.setEndTime(simpleDateFormat.format(pmdsServiceById.getEndTime())); |
| | | detailsVo.setOrderTime(simpleDateFormat.format(byId.getInsertTime())); |
| | | if (byId.getStatus() == 1){ |
| | | detailsVo.setUseType(2); |
| | | }else { |
| | | detailsVo.setUseType(1); |
| | | detailsVo.setWriteOffTime(simpleDateFormat.format(byId.getVerificationTime())); |
| | | StoreDetailOfCourse courseOfStore = stoClient.getCourseOfStore(byId.getVerifiStoreId()); |
| | | detailsVo.setWriteOffName(courseOfStore.getStoreName()); |
| | | } |
| | | switch (pmdsServiceById.getUseScope()){ |
| | | case 1: |
| | | detailsVo.setBelongs("全国通用"); |
| | | break; |
| | | case 2: |
| | | detailsVo.setBelongs(pmdsServiceById.getProvince()+pmdsServiceById.getCity()); |
| | | break; |
| | | case 3: |
| | | PointsMerchandiseStore one = pmdstoService.getOne(new QueryWrapper<PointsMerchandiseStore>() |
| | | .eq("pointsMerchandiseId",pmdsServiceById.getId() )); |
| | | StoreDetailOfCourse courseOfStore = stoClient.getCourseOfStore(one.getStoreId()); |
| | | detailsVo.setBelongs(courseOfStore.getStoreName()+" "+courseOfStore.getStoreAddr()); |
| | | break; |
| | | default: |
| | | break; |
| | | } |
| | | detailsVo.setContents(pmdsServiceById.getRedemptionInstructions()); |
| | | } |
| | | return detailsVo; |
| | | } |
| | | |
| | | } |
| | |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Integer id; |
| | | /** |
| | | * 类型(1=实体商品,2=课包商品,3=门票商品) |
| | | * 类型(1=实体商品,2=课包商品,3=门票商品 4=优惠券) |
| | | */ |
| | | @TableField("type") |
| | | private Integer type; |
| | |
| | | * 所属积分 |
| | | */ |
| | | @TableField("integral") |
| | | private BigDecimal integral; |
| | | private Integer integral; |
| | | /** |
| | | * 商品封面 |
| | | */ |
New file |
| | |
| | | package com.dsh.activity.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.baomidou.mybatisplus.extension.activerecord.Model; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.experimental.Accessors; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * <p> |
| | | * 积分商品使用门店关系数据 |
| | | * </p> |
| | | * |
| | | * @author jqs |
| | | * @since 2023-07-12 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @Accessors(chain = true) |
| | | @TableName("t_points_merchandise_store") |
| | | public class PointsMerchandiseStore extends Model<PointsMerchandiseStore> { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Integer id; |
| | | /** |
| | | * 积分商品id |
| | | */ |
| | | private Integer pointsMerchandiseId; |
| | | /** |
| | | * 门店id |
| | | */ |
| | | private Integer storeId; |
| | | |
| | | |
| | | @Override |
| | | protected Serializable pkVal() { |
| | | return this.id; |
| | | } |
| | | |
| | | } |
| | |
| | | @TableField("userId") |
| | | private Integer userId; |
| | | /** |
| | | * 状态(1=待核销,2=已核销) |
| | | */ |
| | | @TableField("status") |
| | | private Integer status; |
| | | /** |
| | | * 核销人员id |
| | | */ |
| | | @TableField("verificationUserId") |
| | | private Integer verificationUserId; |
| | | /** |
| | | * 核销门店id |
| | | */ |
| | | @TableField("verifiStoreId") |
| | | private Integer verifiStoreId; |
| | | /** |
| | | * 核销时间 |
| | | */ |
| | | @TableField("verificationTime") |
| | | private Date verificationTime; |
| | | /** |
| | | * 状态(1=待核销,2=已核销) |
| | | */ |
| | | @TableField("status") |
| | | private Integer status; |
| | | /** |
| | | * 领取时间 |
| | | */ |
| | | @TableField("insertTime") |
| | |
| | | |
| | | |
| | | import com.dsh.activity.entity.PointsMerchandise; |
| | | import com.dsh.activity.feignclient.model.IntegralCommodity; |
| | | import com.dsh.activity.feignclient.model.*; |
| | | import com.dsh.activity.model.request.CommodityRequest; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | |
| | | @PostMapping("/base/pointMerchars/getRedeemedNums") |
| | | public int getRedeemedQuantity(@RequestBody Integer goodId); |
| | | |
| | | |
| | | @PostMapping("/base/pointMerchars/getGoodDetails") |
| | | ProductDetailsVo getGoodDetailsWithId(@RequestBody ProductDetailRequest detailRequest); |
| | | |
| | | @PostMapping("/base/pointMerchars/getDetailsOfExchange") |
| | | List<ExchangeDetailsResponse> getIntegralExchangeDetails(@RequestBody Integer appUserId); |
| | | |
| | | |
| | | @PostMapping("/base/pointMerchars/getSpecificsOfGoods") |
| | | public PointDetailsVo getSpecificsOfGoods(@RequestBody Integer speMercharsId); |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.dsh.activity.feignclient.course; |
| | | |
| | | |
| | | import com.dsh.activity.feignclient.course.model.CoursePackagePaymentConfig; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | |
| | | import java.util.List; |
| | | |
| | | |
| | | @FeignClient(value = "mb-cloud-course") |
| | | public interface CoursePackageConfigClient { |
| | | |
| | | @PostMapping("/base/coursePack/getCoursePackageConfig") |
| | | List<CoursePackagePaymentConfig> getCourseConfigList(@RequestBody Integer coursePackageId); |
| | | |
| | | } |
New file |
| | |
| | | package com.dsh.activity.feignclient.course.model; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @date 2023/6/29 10:42 |
| | | */ |
| | | @Data |
| | | public class CoursePackagePaymentConfig { |
| | | /** |
| | | * 主键 |
| | | */ |
| | | private Integer id; |
| | | /** |
| | | * 课包id |
| | | */ |
| | | private Integer coursePackageId; |
| | | /** |
| | | * 课时数 |
| | | */ |
| | | private Integer classHours; |
| | | /** |
| | | * 现金支付价格 |
| | | */ |
| | | private Double cashPayment; |
| | | /** |
| | | * 玩湃币价格 |
| | | */ |
| | | private Integer playPaiCoin; |
| | | } |
New file |
| | |
| | | package com.dsh.activity.feignclient.model; |
| | | |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class ExchangeDetailsResponse { |
| | | |
| | | @ApiModelProperty(value = "记录id") |
| | | private Long detailsId; |
| | | |
| | | @ApiModelProperty(value = "商品名称") |
| | | private String goodName; |
| | | |
| | | @ApiModelProperty(value = "支付类型(积分 / 积分+现金)") |
| | | private String requiredType; |
| | | |
| | | @ApiModelProperty(value = "有效期开始时间") |
| | | private String startTime; |
| | | |
| | | @ApiModelProperty(value = "有效期结束时间") |
| | | private String endTime; |
| | | |
| | | @ApiModelProperty(value = "使用状态 (1已使用 2未使用)") |
| | | private Integer useStatus; |
| | | |
| | | @ApiModelProperty(value = "商品类型 1实物 2课包 3门票 4优惠券") |
| | | private Integer goodType; |
| | | |
| | | } |
New file |
| | |
| | | package com.dsh.activity.feignclient.model; |
| | | |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | public class PointDetailsVo { |
| | | |
| | | @ApiModelProperty(value = "记录id") |
| | | private Long detailsId; |
| | | |
| | | @ApiModelProperty(value = "图片集") |
| | | private List<String> pics; |
| | | |
| | | @ApiModelProperty(value = "商品名称") |
| | | private String goodName; |
| | | |
| | | @ApiModelProperty(value = "适用状态(1已使用 2未使用)") |
| | | private Integer useType; |
| | | |
| | | @ApiModelProperty(value = "有效期开始时间") |
| | | private String startTime; |
| | | |
| | | @ApiModelProperty(value = "有效期结束时间") |
| | | private String endTime; |
| | | |
| | | @ApiModelProperty(value = "下单时间") |
| | | private String orderTime; |
| | | |
| | | @ApiModelProperty(value = "核销时间") |
| | | private String writeOffTime; |
| | | |
| | | @ApiModelProperty(value = "核销门店") |
| | | private String writeOffName; |
| | | |
| | | @ApiModelProperty(value = "适用范围(指定门店可用)") |
| | | private String belongs; |
| | | |
| | | @ApiModelProperty(value = "兑换说明") |
| | | private String contents; |
| | | |
| | | } |
New file |
| | |
| | | package com.dsh.activity.feignclient.model; |
| | | |
| | | |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class ProductDetailRequest { |
| | | |
| | | Integer goodId; |
| | | |
| | | Integer goodsType; |
| | | |
| | | } |
New file |
| | |
| | | package com.dsh.activity.feignclient.model; |
| | | |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | public class ProductDetailsVo { |
| | | |
| | | @ApiModelProperty(value = "商品id") |
| | | private Integer goodId; |
| | | |
| | | @ApiModelProperty(value = "图片列表") |
| | | private List<String> pics; |
| | | |
| | | @ApiModelProperty(value = "商品名称") |
| | | private String goodName; |
| | | |
| | | @ApiModelProperty(value = "适用人群") |
| | | private Integer belongsScope; |
| | | |
| | | @ApiModelProperty(value = "已兑换数量") |
| | | private Integer redeemedNum; |
| | | |
| | | @ApiModelProperty(value = "剩余数量") |
| | | private Integer residueNum; |
| | | |
| | | @ApiModelProperty(value = "每人限额") |
| | | private Integer perLimit; |
| | | |
| | | @ApiModelProperty(value = "所需类型(积分/积分+现金)") |
| | | private String requiredType; |
| | | |
| | | @ApiModelProperty(value = "价值") |
| | | private BigDecimal cost; |
| | | |
| | | @ApiModelProperty(value = "课时数") |
| | | private Integer courseHours; |
| | | |
| | | @ApiModelProperty(value = "适用范围") |
| | | private String belongs; |
| | | |
| | | @ApiModelProperty(value = "有效期开始时间") |
| | | private String startTime; |
| | | |
| | | @ApiModelProperty(value = "有效期结束时间") |
| | | private String endTime; |
| | | |
| | | @ApiModelProperty(value = "兑换说明") |
| | | private String contents; |
| | | |
| | | @ApiModelProperty(value = "商品类型 1实物 2课包 3门票 4优惠券") |
| | | private Integer goodType; |
| | | |
| | | } |
New file |
| | |
| | | package com.dsh.activity.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.dsh.activity.entity.PointsMerchandiseStore; |
| | | |
| | | /** |
| | | * <p> |
| | | * 积分商品使用门店关系数据 Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author jqs |
| | | * @since 2023-07-12 |
| | | */ |
| | | public interface PointsMerchandiseStoreMapper extends BaseMapper<PointsMerchandiseStore> { |
| | | |
| | | } |
New file |
| | |
| | | package com.dsh.activity.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.dsh.activity.entity.PointsMerchandiseStore; |
| | | |
| | | /** |
| | | * <p> |
| | | * 积分商品使用门店关系数据 服务类 |
| | | * </p> |
| | | * |
| | | * @author jqs |
| | | * @since 2023-07-12 |
| | | */ |
| | | public interface PointsMerchandiseStoreService extends IService<PointsMerchandiseStore> { |
| | | |
| | | } |
New file |
| | |
| | | package com.dsh.activity.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.dsh.activity.entity.PointsMerchandiseStore; |
| | | import com.dsh.activity.mapper.PointsMerchandiseStoreMapper; |
| | | import com.dsh.activity.service.PointsMerchandiseStoreService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * <p> |
| | | * 积分商品使用门店关系数据 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author jqs |
| | | * @since 2023-07-12 |
| | | */ |
| | | @Service |
| | | public class PointsMerchandiseStoreServiceImpl extends ServiceImpl<PointsMerchandiseStoreMapper, PointsMerchandiseStore> implements PointsMerchandiseStoreService { |
| | | |
| | | } |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.dsh.activity.mapper.PointsMerchandiseStoreMapper"> |
| | | |
| | | |
| | | </mapper> |
| | |
| | | package com.dsh.course.controller; |
| | | |
| | | import com.dsh.course.entity.TCoursePackage; |
| | | import com.dsh.course.model.vo.response.ExchangeCoursePackageResponse; |
| | | import com.dsh.course.model.vo.response.WeekLimitedResponse; |
| | | import com.dsh.course.service.TCoursePackageDiscountService; |
| | | import com.dsh.course.service.TCoursePackageService; |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 折扣课包详情 |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/api/useBenefit/discountCourseDatas") |
| | | @ApiOperation(value = "本周福利-折扣课包详情", tags = {"APP-使用福利"}) |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."), |
| | | @ApiImplicitParam(name = "coursePackageDiscountId",value = "限时折扣配置id/赠送课时配置id",dataType = "int"), |
| | | @ApiImplicitParam(name = "lon",value = "经度",dataType = "String"), |
| | | @ApiImplicitParam(name = "lat",value = "纬度",dataType = "String"), |
| | | }) |
| | | public ResultUtil<ExchangeCoursePackageResponse> discountCourseDatas(Integer coursePackageDiscountId,String lon,String lat){ |
| | | try { |
| | | return ResultUtil.success(tcpdService.getWeekFreeCourseDetails(coursePackageDiscountId,lat,lon)); |
| | | }catch (Exception e){ |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 折扣课包支付 |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/api/useBenefit/paymentOfDiscountCoursePack") |
| | | @ApiOperation(value = "本周福利-折扣课包支付", tags = {"APP-使用福利"}) |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."), |
| | | @ApiImplicitParam(name = "coursePackageDiscountId",value = "限时折扣配置id/赠送课时配置id",dataType = "int"), |
| | | @ApiImplicitParam(name = "lon",value = "经度",dataType = "String"), |
| | | @ApiImplicitParam(name = "lat",value = "纬度",dataType = "String"), |
| | | }) |
| | | public ResultUtil paymentWeeksFreeCourse(Integer coursePackageDiscountId){ |
| | | try { |
| | | Integer appuserId = tokenUtil.getUserIdFormRedis(); |
| | | if(null == appuserId){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | return tcpdService.paymentDiscountCoursePack(coursePackageDiscountId,appuserId); |
| | | }catch (Exception e){ |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | } |
| | |
| | | @Autowired |
| | | private TCoursePackageDiscountService tcpdService; |
| | | |
| | | @Autowired |
| | | private PostCourseVideoService pcvService; |
| | | |
| | | @Autowired |
| | | private CoursePackageStudentService cpsService; |
| | | |
| | | @Autowired |
| | | private CancelledClassesService cacService; |
| | | |
| | | @Autowired |
| | | private ICoursePackagePaymentConfigService icppcService; |
| | |
| | | return packagePaymentService.save(packagePayment); |
| | | } |
| | | |
| | | |
| | | @PostMapping("/base/coursePack/obtainStudentClassDetails") |
| | | public List<RecordAppoint> obtainStudentClassDetailsData(@RequestBody Integer stuId){ |
| | | try { |
| | | Integer appUserId = tokenUtil.getUserIdFormRedis(); |
| | | return packagePaymentService.obtainStuClassDetails(stuId,appUserId); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | throw new RuntimeException(); |
| | | } |
| | | } |
| | | |
| | | |
| | | @PostMapping("/base/coursePack/getCoursePackageConfig") |
| | | public List<CoursePackagePaymentConfig> getCourseConfigList(@RequestBody Integer coursePackageId){ |
| | | return icppcService.list(new QueryWrapper<CoursePackagePaymentConfig>() |
| | | .eq("coursePackageId",coursePackageId)); |
| | | } |
| | | |
| | | } |
| | |
| | | import com.dsh.course.service.CancelledClassesService; |
| | | import com.dsh.course.service.CoursePackageStudentService; |
| | | import com.dsh.course.service.TCoursePackageService; |
| | | import com.dsh.course.util.ToolUtil; |
| | | import io.swagger.annotations.Api; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.text.ParseException; |
| | | import java.text.SimpleDateFormat; |
| | | import java.time.LocalDateTime; |
| | | import java.time.ZoneId; |
| | | import java.time.temporal.ChronoUnit; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | @Api |
| | |
| | | return sult; |
| | | } |
| | | |
| | | |
| | | @PostMapping("/base/courseRecord/cancelCourseData") |
| | | public Integer cancelCourseRecordClass(@RequestBody Integer courseRecordId){ |
| | | int sult = 0; |
| | | CoursePackageStudent packageStudent = cosService.getById(courseRecordId); |
| | | SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy.MM.dd"); |
| | | SimpleDateFormat format = new SimpleDateFormat("yyyy.MM.dd HH:mm"); |
| | | String tis = simpleDateFormat.format(new Date()); |
| | | |
| | | if (ToolUtil.isNotEmpty(packageStudent)){ |
| | | TCoursePackage coursePackage = tcpService.getById(packageStudent.getCoursePackageId()); |
| | | String startTime = tis +" " + coursePackage.getClassStartTime(); |
| | | Date parse = null; |
| | | try { |
| | | parse = format.parse(startTime); |
| | | } catch (ParseException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | LocalDateTime localDateTime = parse.toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime(); |
| | | // 计算时间间隔 |
| | | long hours = ChronoUnit.HOURS.between(LocalDateTime.now(), localDateTime); |
| | | // 判断是否在前三小时内 |
| | | if (hours <= 3 && hours >= 0){ |
| | | sult = 1; |
| | | }else { |
| | | sult = 2; |
| | | } |
| | | } |
| | | return sult; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.dsh.course.feignclient; |
| | | |
| | | |
| | | import com.dsh.course.entity.CoursePackagePaymentConfig; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | |
| | | import java.util.List; |
| | | |
| | | |
| | | @FeignClient(value = "mb-cloud-course") |
| | | public interface CoursePackageConfigClient { |
| | | |
| | | @PostMapping("/base/coursePack/getCoursePackageConfig") |
| | | List<CoursePackagePaymentConfig> getCourseConfigList(@RequestBody Integer coursePackageId); |
| | | |
| | | } |
| | |
| | | @PostMapping("/base/coursePack/allAmountPayRecordOfUser") |
| | | public List<TCoursePackagePayment> getAmountPayRecord(@RequestBody Integer appUserId); |
| | | |
| | | @PostMapping("/base/coursePack/obtainStudentClassDetails") |
| | | List<RecordAppoint> obtainStudentClassDetailsData(@RequestBody Integer stuId); |
| | | |
| | | } |
| | |
| | | @PostMapping("/base/courseRecord/queryDeduClassHours") |
| | | public Integer getDeductionClassHour(@RequestBody GetStudentCourse course); |
| | | |
| | | @PostMapping("/base/courseRecord/cancelCourseData") |
| | | Integer cancelCourseRecordClass(@RequestBody Integer courseRecordId); |
| | | |
| | | } |
New file |
| | |
| | | package com.dsh.course.feignclient.model; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class RecordAppoint { |
| | | |
| | | @ApiModelProperty(value = "课包id") |
| | | private Integer coursePackageId; |
| | | |
| | | @ApiModelProperty(value = "上课记录id") |
| | | private Long courseStuRecordId; |
| | | |
| | | @ApiModelProperty(value = "课包名称") |
| | | private String coursePackageName; |
| | | |
| | | @ApiModelProperty(value = "课时数") |
| | | private Integer courseHours; |
| | | |
| | | @ApiModelProperty(value = "上课时间范围(例如:2021.03.01 8:00-11:00)") |
| | | private String timeFrame; |
| | | |
| | | @ApiModelProperty(value = "门店名称+地址") |
| | | private String storeNameAddr; |
| | | |
| | | @ApiModelProperty(value = "课状态(1待上课 2已开始 3已完成 4已取消)") |
| | | private Integer status; |
| | | |
| | | } |
New file |
| | |
| | | package com.dsh.course.model.vo.response; |
| | | |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class ExchangeCoursePackageResponse { |
| | | |
| | | @ApiModelProperty(value = "限时折扣配置id/赠送课时配置id") |
| | | private Integer coursePackageDiscountId; |
| | | |
| | | @ApiModelProperty(value = "课包封面图") |
| | | private String coverDrawing; |
| | | |
| | | @ApiModelProperty(value = "课包介绍图") |
| | | private String introduceDrawing; |
| | | |
| | | @ApiModelProperty(value = "课包名称") |
| | | private String coursePackageName; |
| | | |
| | | @ApiModelProperty(value = "门店名称+地址") |
| | | private String storeNameAddr; |
| | | |
| | | @ApiModelProperty(value = "门店距离 单位km") |
| | | private double distance; |
| | | |
| | | @ApiModelProperty(value = "课时数") |
| | | private Integer classHours; |
| | | |
| | | @ApiModelProperty(value = "赠送课时数") |
| | | private Integer freeClassHours; |
| | | |
| | | @ApiModelProperty(value = "上课周数") |
| | | private String weekTime; |
| | | |
| | | @ApiModelProperty(value = "上课时间") |
| | | private String time; |
| | | |
| | | @ApiModelProperty(value = "原价") |
| | | private Double costPrice; |
| | | |
| | | @ApiModelProperty(value = "折扣价/会员价") |
| | | private Double discountPrice; |
| | | |
| | | @ApiModelProperty(value = "玩湃币") |
| | | private Integer wanpaiGold; |
| | | |
| | | } |
| | |
| | | @Data |
| | | public static class Details{ |
| | | |
| | | @ApiModelProperty(value = "限时折扣配置id/赠送课时配置id") |
| | | private Integer coursePackageDiscountId; |
| | | |
| | | @ApiModelProperty(value = "封面图") |
| | | private String image; |
| | | |
| | |
| | | @ApiModelProperty(value = "课包课时数") |
| | | private Integer courseHours; |
| | | |
| | | @ApiModelProperty(value = "赠送课时数(赠送课时取改字段)") |
| | | @ApiModelProperty(value = "赠送课时数(赠送课时 取该字段)") |
| | | private Integer donateHours; |
| | | |
| | | @ApiModelProperty(value = "今日/明日/周x") |
| | |
| | | private Date date; |
| | | |
| | | @ApiModelProperty(value = "原价") |
| | | private Integer originalPrice; |
| | | private Double originalPrice; |
| | | |
| | | @ApiModelProperty(value = "折后价") |
| | | private Integer discountPrice; |
| | | private Double discountPrice; |
| | | |
| | | @ApiModelProperty(value = "状态") |
| | | @ApiModelProperty(value = "状态(1=查看详情 2=暂未开始)") |
| | | private Integer status; |
| | | |
| | | @ApiModelProperty(value = "门店距离") |
| | |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.dsh.course.entity.TCoursePackageDiscount; |
| | | import com.dsh.course.model.vo.response.ExchangeCoursePackageResponse; |
| | | import com.dsh.course.model.vo.response.WeekLimitedResponse; |
| | | import com.dsh.course.util.ResultUtil; |
| | | |
| | | |
| | | /** |
| | |
| | | |
| | | WeekLimitedResponse getWeeksBenefitCourse(Integer appUserId,Integer discountType,String lon,String lat); |
| | | |
| | | ExchangeCoursePackageResponse getWeekFreeCourseDetails(Integer coursePackageDiscountId,String lat,String lon); |
| | | |
| | | ResultUtil paymentDiscountCoursePack(Integer coursePackageDiscountId, Integer appuserId); |
| | | |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.dsh.course.entity.TCoursePackagePayment; |
| | | import com.dsh.course.feignclient.model.RecordAppoint; |
| | | import com.dsh.course.model.vo.RegisterCourseVo; |
| | | import com.dsh.course.model.vo.request.ClasspaymentRequest; |
| | | import com.dsh.course.model.vo.request.CourseOfAfterRequest; |
| | |
| | | |
| | | ResultUtil ContinuationOrpaymentCourse(Integer userIdFormRedis, ClasspaymentRequest request); |
| | | |
| | | /** |
| | | * 查询学员的课包上课记录 |
| | | * @param stuId |
| | | * @param appUserId |
| | | * @return |
| | | */ |
| | | List<RecordAppoint> obtainStuClassDetails(Integer stuId, Integer appUserId); |
| | | |
| | | } |
| | |
| | | package com.dsh.course.service.impl; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.dsh.course.entity.CoursePackagePaymentConfig; |
| | | import com.dsh.course.entity.TCoursePackage; |
| | | import com.dsh.course.entity.TCoursePackageDiscount; |
| | | import com.dsh.course.entity.TCoursePackagePayment; |
| | | import com.dsh.course.feignclient.other.StoreClient; |
| | | import com.dsh.course.feignclient.other.model.GetDistanceVo; |
| | | import com.dsh.course.feignclient.other.model.Store; |
| | | import com.dsh.course.mapper.CoursePackagePaymentConfigMapper; |
| | | import com.dsh.course.mapper.TCoursePackageDiscountMapper; |
| | | import com.dsh.course.mapper.TCoursePackageMapper; |
| | | import com.dsh.course.mapper.TCoursePackagePaymentMapper; |
| | | import com.dsh.course.model.vo.response.ExchangeCoursePackageResponse; |
| | | import com.dsh.course.model.vo.response.WeekLimitedResponse; |
| | | import com.dsh.course.service.TCoursePackageDiscountService; |
| | | import com.dsh.course.util.DateTimeHelper; |
| | | import com.fasterxml.jackson.databind.JsonNode; |
| | | import com.fasterxml.jackson.databind.ObjectMapper; |
| | | import com.dsh.course.util.LocalDateTimeUtils; |
| | | import com.dsh.course.util.ResultUtil; |
| | | import com.dsh.course.util.StrUtils; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.text.ParseException; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.ArrayList; |
| | | import java.util.Calendar; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | |
| | | @Resource |
| | | private TCoursePackageMapper tcpMapper; |
| | | |
| | | @Resource |
| | | private TCoursePackagePaymentMapper tcppMapper; |
| | | |
| | | @Resource |
| | | private CoursePackagePaymentConfigMapper cppcMapper; |
| | | |
| | | @Resource |
| | | private StoreClient sreClient; |
| | |
| | | |
| | | @Override |
| | | public WeekLimitedResponse getWeeksBenefitCourse(Integer appUserId,Integer discountType,String lon,String lat) { |
| | | Date start = DateTimeHelper.getTodayTime(); |
| | | Date lastTime = DateTimeHelper.getWeekOfLastDay(); |
| | | SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd"); |
| | | Date localTime = DateTimeHelper.getWXTime(); |
| | | SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | |
| | | WeekLimitedResponse response= new WeekLimitedResponse(); |
| | | List<WeekLimitedResponse.Details> list = new ArrayList<>(); |
| | | |
| | | QueryWrapper<TCoursePackageDiscount> tCoursePackageDiscountQueryWrapper = new QueryWrapper<>(); |
| | | tCoursePackageDiscountQueryWrapper.eq("auditStatus",2 ); |
| | | List<TCoursePackageDiscount> tCoursePackageDiscounts = new ArrayList<>(); |
| | | int weekStr = LocalDateTimeUtils.getWeekStr(); |
| | | if (null == discountType || discountType == 1){ |
| | | tCoursePackageDiscountQueryWrapper.eq("type",3); |
| | | response.setDiscountType(1); |
| | | tCoursePackageDiscounts = this.baseMapper.selectList(tCoursePackageDiscountQueryWrapper); |
| | | if (tCoursePackageDiscounts.size() > 0){ |
| | | for (TCoursePackageDiscount tCoursePackageDiscount : tCoursePackageDiscounts) { |
| | | WeekLimitedResponse.Details ls = new WeekLimitedResponse.Details(); |
| | | |
| | | try { |
| | | ObjectMapper objectMapper = new ObjectMapper(); |
| | | JsonNode rootNode = null; |
| | | rootNode = objectMapper.readTree(tCoursePackageDiscount.getContent()); |
| | | String courseHours = rootNode.get("courseHours").asText(); |
| | | String lifespanEnd = rootNode.get("lifespanEnd").asText(); |
| | | Date endTime = simpleDateFormat.parse(lifespanEnd); |
| | | if (endTime.compareTo(lastTime) < 0){ |
| | | TCoursePackage coursePackage = tcpMapper.selectById(tCoursePackageDiscount.getCoursePackageId()); |
| | | // 判断预约人数是否已满 |
| | | Integer maxSubscribeNumber = coursePackage.getMaxSubscribeNumber(); |
| | | Integer integer = tcppMapper.selectCount(new QueryWrapper<TCoursePackagePayment>() |
| | | .eq("appUserId",appUserId ) |
| | | .eq("status",1)); |
| | | if (integer >= maxSubscribeNumber){ |
| | | continue; |
| | | } |
| | | TCoursePackage coursePackage = tcpMapper.selectById(tCoursePackageDiscount.getCoursePackageId()); |
| | | /** |
| | | * [{ |
| | | * "startDate": "2023-01-01 00:00:00", |
| | | * "endDate": "2023-12-31 23:59:59", |
| | | * "startTime": "02:00:00", |
| | | * "endTime": "23:00:00", |
| | | * "weeks": [1, 2, 7], |
| | | * "cashPayment": 100 |
| | | * }] |
| | | */ |
| | | try { |
| | | JSONArray jsonArray = JSON.parseArray(tCoursePackageDiscount.getContent()); |
| | | JSONObject jsonObject = jsonArray.getJSONObject(0); |
| | | Date parse1 = null; |
| | | Date parse2 = null; |
| | | String startDate = jsonObject.getString("startDate"); |
| | | String endDate = jsonObject.getString("endDate"); |
| | | try { |
| | | parse1 = simpleDateFormat.parse(startDate); |
| | | parse2 = simpleDateFormat.parse(endDate); |
| | | } catch (ParseException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | List<Integer> weeks = jsonObject.getJSONArray("weeks").toJavaList(Integer.class); |
| | | Double cashPayment = jsonObject.getDouble("cashPayment"); |
| | | Date tomorrowDate = null; |
| | | if (weekStr != 7) { |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTime(localTime); |
| | | calendar.add(Calendar.DAY_OF_WEEK, 1); |
| | | tomorrowDate = calendar.getTime(); |
| | | } |
| | | |
| | | boolean isWithinRange = false; |
| | | if (weeks.contains(weekStr)) { |
| | | isWithinRange = true; |
| | | } |
| | | |
| | | if (isWithinRange) { |
| | | // 判断当前日期是否在开始时间和结束时间范围内 |
| | | if (isDateWithinRange(localTime, parse1, parse2)) { |
| | | WeekLimitedResponse.Details resde = new WeekLimitedResponse.Details(); |
| | | |
| | | resde.setCoursePackageDiscountId(tCoursePackageDiscount.getId()); |
| | | resde.setImage(coursePackage.getCoverDrawing()); |
| | | resde.setCoursePackageName(coursePackage.getName()); |
| | | CoursePackagePaymentConfig paymentConfig = cppcMapper.selectById(tCoursePackageDiscount.getCoursePackagePaymentConfigId()); |
| | | resde.setCourseHours(paymentConfig.getClassHours()); |
| | | resde.setDataTime("今日"); |
| | | resde.setDate(localTime); |
| | | resde.setOriginalPrice(paymentConfig.getCashPayment()); |
| | | resde.setDiscountPrice(cashPayment); |
| | | resde.setStatus(1); |
| | | GetDistanceVo distanceVo = new GetDistanceVo(); |
| | | distanceVo.setLatitude(lat); |
| | | distanceVo.setLongitude(lon); |
| | | distanceVo.setStoreId(coursePackage.getStoreId()); |
| | | ls.setStoreDistance(sreClient.calculateDistance(distanceVo)); |
| | | // TODO: 2023/7/10 限时折扣查询 |
| | | list.add(ls); |
| | | resde.setStoreDistance(sreClient.calculateDistance(distanceVo)); |
| | | list.add(resde); |
| | | } |
| | | } |
| | | Calendar tempCalendar = Calendar.getInstance(); |
| | | tempCalendar.setTime(localTime); |
| | | tempCalendar.add(Calendar.DAY_OF_WEEK, 1); |
| | | |
| | | while (tempCalendar.get(Calendar.DAY_OF_WEEK) != Calendar.MONDAY) { |
| | | Date tempDate = tempCalendar.getTime(); |
| | | int weekNumOfDate = DateTimeHelper.getWeekNumOfDate(tempDate); |
| | | if (isDateWithinRange(tempDate, parse1, parse2) && weeks.contains(weekNumOfDate)) { |
| | | WeekLimitedResponse.Details resde = new WeekLimitedResponse.Details(); |
| | | |
| | | resde.setCoursePackageDiscountId(tCoursePackageDiscount.getId()); |
| | | resde.setImage(coursePackage.getCoverDrawing()); |
| | | resde.setCoursePackageName(coursePackage.getName()); |
| | | CoursePackagePaymentConfig paymentConfig = cppcMapper.selectById(tCoursePackageDiscount.getCoursePackagePaymentConfigId()); |
| | | resde.setCourseHours(paymentConfig.getClassHours()); |
| | | String weekOfDate = ""; |
| | | if (weekStr != 7 && tempDate.equals(tomorrowDate)) { |
| | | weekOfDate = "明日"; |
| | | } else { |
| | | weekOfDate = DateTimeHelper.getWeekOfDate(tempDate); |
| | | } |
| | | resde.setDataTime(weekOfDate); |
| | | resde.setDate(tempDate); |
| | | resde.setOriginalPrice(paymentConfig.getCashPayment()); |
| | | resde.setDiscountPrice(cashPayment); |
| | | resde.setStatus(2); |
| | | GetDistanceVo distanceVo = new GetDistanceVo(); |
| | | distanceVo.setLatitude(lat); |
| | | distanceVo.setLongitude(lon); |
| | | distanceVo.setStoreId(coursePackage.getStoreId()); |
| | | resde.setStoreDistance(sreClient.calculateDistance(distanceVo)); |
| | | list.add(resde); |
| | | } |
| | | tempCalendar.add(Calendar.DAY_OF_WEEK, 1); |
| | | } |
| | | |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | | }else { |
| | |
| | | tCoursePackageDiscounts = this.baseMapper.selectList(tCoursePackageDiscountQueryWrapper); |
| | | if (tCoursePackageDiscounts.size() > 0){ |
| | | for (TCoursePackageDiscount tCoursePackageDiscount : tCoursePackageDiscounts) { |
| | | TCoursePackage coursePackage = tcpMapper.selectById(tCoursePackageDiscount.getCoursePackageId()); |
| | | // 判断预约人数是否已满 |
| | | Integer maxSubscribeNumber = coursePackage.getMaxSubscribeNumber(); |
| | | Integer integer = tcppMapper.selectCount(new QueryWrapper<TCoursePackagePayment>() |
| | | .eq("appUserId",appUserId ) |
| | | .eq("status",1)); |
| | | if (integer >= maxSubscribeNumber){ |
| | | continue; |
| | | } |
| | | // [{ |
| | | // "startDate": "2023-01-01 00:00:00", |
| | | // "endDate": "2023-12-31 23:59:59", |
| | | // "startTime": "02:00:00", |
| | | // "endTime": "23:00:00", |
| | | // "weeks": [1, 2, 7], |
| | | // "hour": 10 |
| | | // }] |
| | | try { |
| | | ObjectMapper objectMapper = new ObjectMapper(); |
| | | JsonNode rootNode = null; |
| | | rootNode = objectMapper.readTree(tCoursePackageDiscount.getContent()); |
| | | String courseHours = rootNode.get("courseHours").asText(); |
| | | String lifespanStart = rootNode.get("lifespanStart").asText(); |
| | | String lifespanEnd = rootNode.get("lifespanEnd").asText(); |
| | | String classHours = rootNode.get("classHours").asText(); |
| | | JSONArray jsonArray = JSON.parseArray(tCoursePackageDiscount.getContent()); |
| | | JSONObject jsonObject = jsonArray.getJSONObject(0); |
| | | Date parse1 = null; |
| | | Date parse2 = null; |
| | | String startDate = jsonObject.getString("startDate"); |
| | | String endDate = jsonObject.getString("endDate"); |
| | | try { |
| | | parse1 = simpleDateFormat.parse(startDate); |
| | | parse2 = simpleDateFormat.parse(endDate); |
| | | } catch (ParseException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | List<Integer> weeks = jsonObject.getJSONArray("weeks").toJavaList(Integer.class); |
| | | Integer cashPayment = jsonObject.getInteger("hour"); |
| | | |
| | | Date tomorrowDate = null; |
| | | if (weekStr != 7) { |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTime(localTime); |
| | | calendar.add(Calendar.DAY_OF_WEEK, 1); |
| | | tomorrowDate = calendar.getTime(); |
| | | } |
| | | |
| | | boolean isWithinRange = false; |
| | | if (weeks.contains(weekStr)) { |
| | | isWithinRange = true; |
| | | } |
| | | |
| | | if (isWithinRange) { |
| | | // 判断当前日期是否在开始时间和结束时间范围内 |
| | | if (isDateWithinRange(localTime, parse1, parse2)) { |
| | | WeekLimitedResponse.Details resde = new WeekLimitedResponse.Details(); |
| | | |
| | | resde.setCoursePackageDiscountId(tCoursePackageDiscount.getId()); |
| | | resde.setImage(coursePackage.getCoverDrawing()); |
| | | resde.setCoursePackageName(coursePackage.getName()); |
| | | CoursePackagePaymentConfig paymentConfig = cppcMapper.selectById(tCoursePackageDiscount.getCoursePackagePaymentConfigId()); |
| | | resde.setCourseHours(paymentConfig.getClassHours()); |
| | | resde.setDonateHours(cashPayment); |
| | | resde.setDataTime("今日"); |
| | | resde.setDate(localTime); |
| | | resde.setOriginalPrice(paymentConfig.getCashPayment()); |
| | | resde.setStatus(1); |
| | | GetDistanceVo distanceVo = new GetDistanceVo(); |
| | | distanceVo.setLatitude(lat); |
| | | distanceVo.setLongitude(lon); |
| | | distanceVo.setStoreId(coursePackage.getStoreId()); |
| | | resde.setStoreDistance(sreClient.calculateDistance(distanceVo)); |
| | | list.add(resde); |
| | | } |
| | | } |
| | | Calendar tempCalendar = Calendar.getInstance(); |
| | | tempCalendar.setTime(localTime); |
| | | tempCalendar.add(Calendar.DAY_OF_WEEK, 1); |
| | | |
| | | while (tempCalendar.get(Calendar.DAY_OF_WEEK) != Calendar.MONDAY) { |
| | | Date tempDate = tempCalendar.getTime(); |
| | | int weekNumOfDate = DateTimeHelper.getWeekNumOfDate(tempDate); |
| | | if (isDateWithinRange(tempDate, parse1, parse2) && weeks.contains(weekNumOfDate)) { |
| | | WeekLimitedResponse.Details resde = new WeekLimitedResponse.Details(); |
| | | |
| | | resde.setCoursePackageDiscountId(tCoursePackageDiscount.getId()); |
| | | resde.setImage(coursePackage.getCoverDrawing()); |
| | | resde.setCoursePackageName(coursePackage.getName()); |
| | | CoursePackagePaymentConfig paymentConfig = cppcMapper.selectById(tCoursePackageDiscount.getCoursePackagePaymentConfigId()); |
| | | resde.setCourseHours(paymentConfig.getClassHours()); |
| | | resde.setDonateHours(cashPayment); |
| | | String weekOfDate = ""; |
| | | if (weekStr != 7 && tempDate.equals(tomorrowDate)) { |
| | | weekOfDate = "明日"; |
| | | } else { |
| | | weekOfDate = DateTimeHelper.getWeekOfDate(tempDate); |
| | | } |
| | | resde.setDataTime(weekOfDate); |
| | | resde.setDate(tempDate); |
| | | resde.setOriginalPrice(paymentConfig.getCashPayment()); |
| | | resde.setStatus(2); |
| | | GetDistanceVo distanceVo = new GetDistanceVo(); |
| | | distanceVo.setLatitude(lat); |
| | | distanceVo.setLongitude(lon); |
| | | distanceVo.setStoreId(coursePackage.getStoreId()); |
| | | resde.setStoreDistance(sreClient.calculateDistance(distanceVo)); |
| | | list.add(resde); |
| | | } |
| | | tempCalendar.add(Calendar.DAY_OF_WEEK, 1); |
| | | } |
| | | |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | | return response; |
| | | } |
| | | |
| | | @Override |
| | | public ExchangeCoursePackageResponse getWeekFreeCourseDetails(Integer coursePackageDiscountId,String lat,String lon) { |
| | | ExchangeCoursePackageResponse packageResponse = new ExchangeCoursePackageResponse(); |
| | | TCoursePackageDiscount coursePackageDiscount = this.baseMapper.selectById(coursePackageDiscountId); |
| | | packageResponse.setCoursePackageDiscountId(coursePackageDiscount.getId()); |
| | | Integer coursePackageId = coursePackageDiscount.getCoursePackageId(); |
| | | |
| | | TCoursePackage coursePackage = tcpMapper.selectById(coursePackageId); |
| | | |
| | | packageResponse.setCoverDrawing(coursePackage.getCoverDrawing()); |
| | | packageResponse.setIntroduceDrawing(coursePackage.getIntroduceDrawing()); |
| | | packageResponse.setCoursePackageName(coursePackage.getName()); |
| | | |
| | | Store store = sreClient.queryStoreById(coursePackage.getStoreId()); |
| | | packageResponse.setStoreNameAddr(store.getName() +"(" +store.getAddress()+")"); |
| | | GetDistanceVo distanceVo = new GetDistanceVo(); |
| | | |
| | | distanceVo.setLatitude(lat); |
| | | distanceVo.setLongitude(lon); |
| | | distanceVo.setStoreId(coursePackage.getStoreId()); |
| | | long l = sreClient.calculateDistance(distanceVo); |
| | | packageResponse.setDistance(l); |
| | | |
| | | JSONArray jsonArray = JSON.parseArray(coursePackageDiscount.getContent()); |
| | | JSONObject jsonObject = jsonArray.getJSONObject(0); |
| | | CoursePackagePaymentConfig paymentConfig = cppcMapper.selectById(coursePackageDiscount.getCoursePackagePaymentConfigId()); |
| | | if (coursePackageDiscount.getType() == 3){ |
| | | Double cashPayment = jsonObject.getDouble("cashPayment"); |
| | | packageResponse.setClassHours(paymentConfig.getClassHours()); |
| | | packageResponse.setCostPrice(paymentConfig.getCashPayment()); |
| | | packageResponse.setDiscountPrice(cashPayment); |
| | | }else { |
| | | packageResponse.setClassHours(paymentConfig.getClassHours()); |
| | | |
| | | Integer cashPayment = jsonObject.getInteger("hour"); |
| | | packageResponse.setFreeClassHours(cashPayment); |
| | | |
| | | packageResponse.setCostPrice(paymentConfig.getCashPayment()); |
| | | TCoursePackageDiscount coursePackageDiscount1 = this.baseMapper.selectOne(new QueryWrapper<TCoursePackageDiscount>() |
| | | .eq("type", 1) |
| | | .eq("coursePackageId",coursePackage.getId())); |
| | | String content = coursePackageDiscount1.getContent(); |
| | | JSONObject jsonObject1 = JSON.parseObject(content); |
| | | Double vipPrice = jsonObject1.getDouble("num1"); |
| | | packageResponse.setDiscountPrice(vipPrice); |
| | | packageResponse.setWanpaiGold(paymentConfig.getPlayPaiCoin()); |
| | | } |
| | | List<Integer> weeks = StrUtils.dealStrToList(coursePackage.getClassWeeks()); |
| | | if (weeks.size() > 0){ |
| | | StringBuilder courWeeks = new StringBuilder("每"); |
| | | for (Integer integer : weeks) { |
| | | switch (integer){ |
| | | case 1: |
| | | courWeeks.append("周一、"); |
| | | break; |
| | | case 2: |
| | | courWeeks.append("周二、"); |
| | | break; |
| | | case 3: |
| | | courWeeks.append("周三、"); |
| | | break; |
| | | case 4: |
| | | courWeeks.append("周四、"); |
| | | break; |
| | | case 5: |
| | | courWeeks.append("周五、"); |
| | | break; |
| | | case 6: |
| | | courWeeks.append("周六、"); |
| | | break; |
| | | case 7: |
| | | courWeeks.append("周末、"); |
| | | break; |
| | | default: |
| | | break; |
| | | } |
| | | } |
| | | if (courWeeks.length() > 0 && courWeeks.charAt(courWeeks.length() - 1) == ','){ |
| | | courWeeks.deleteCharAt(courWeeks.length() - 1); |
| | | } |
| | | packageResponse.setWeekTime(courWeeks.toString()); |
| | | } |
| | | packageResponse.setTime(coursePackage.getClassStartTime()+"-"+coursePackage.getClassEndTime()); |
| | | |
| | | return packageResponse; |
| | | } |
| | | |
| | | @Override |
| | | public ResultUtil paymentDiscountCoursePack(Integer coursePackageDiscountId, Integer appuserId) { |
| | | // TODO: 2023/7/13 折扣课包支付 |
| | | return null; |
| | | } |
| | | |
| | | |
| | | private static boolean isDateWithinRange(Date date, Date startTime, Date endTime) { |
| | | return date.after(startTime) && date.before(endTime); |
| | | } |
| | | |
| | | } |
| | |
| | | import com.dsh.course.feignclient.activity.CouponClient; |
| | | import com.dsh.course.feignclient.activity.model.BenefitsVideos; |
| | | import com.dsh.course.feignclient.activity.model.Coupon; |
| | | import com.dsh.course.feignclient.model.RecordAppoint; |
| | | import com.dsh.course.feignclient.other.StoreClient; |
| | | import com.dsh.course.feignclient.other.model.Store; |
| | | import com.dsh.course.mapper.*; |
| | |
| | | import com.dsh.course.model.vo.response.CourseDetailsResponse; |
| | | import com.dsh.course.model.vo.response.CourseOfVideoResponse; |
| | | import com.dsh.course.service.TCoursePackagePaymentService; |
| | | import com.dsh.course.util.PayMoneyUtil; |
| | | import com.dsh.course.util.ResultUtil; |
| | | import com.dsh.course.util.StrUtils; |
| | | import com.dsh.course.util.UUIDUtil; |
| | | import com.dsh.course.util.*; |
| | | import com.fasterxml.jackson.core.JsonProcessingException; |
| | | import com.fasterxml.jackson.databind.ObjectMapper; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.text.ParseException; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | import java.util.regex.Matcher; |
| | |
| | | |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public List<RecordAppoint> obtainStuClassDetails(Integer stuId, Integer appUserId) { |
| | | List<RecordAppoint> recordVoList = new ArrayList<>(); |
| | | List<TCoursePackagePayment> tCoursePackagePayments = this.baseMapper.selectList(new QueryWrapper<TCoursePackagePayment>() |
| | | .eq("studentId",stuId ) |
| | | .eq("appUserId",appUserId ) |
| | | .eq("payStatus",2 ) |
| | | .eq("status",1 ) |
| | | .orderByDesc("insertTime")); |
| | | SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy.MM.dd"); |
| | | SimpleDateFormat format = new SimpleDateFormat("yyyy.MM.dd HH:mm"); |
| | | if (tCoursePackagePayments.size() > 0 ){ |
| | | for (TCoursePackagePayment tCoursePackagePayment : tCoursePackagePayments) { |
| | | RecordAppoint recordVo = new RecordAppoint(); |
| | | recordVo.setCoursePackageId(tCoursePackagePayment.getCoursePackageId()); |
| | | |
| | | TCoursePackage coursePackage = tcpmapper.selectById(tCoursePackagePayment.getCoursePackageId()); |
| | | |
| | | recordVo.setCoursePackageName(coursePackage.getName()); |
| | | recordVo.setCourseHours(tCoursePackagePayment.getClassHours()); |
| | | Date date = DateUtil.getDate(); |
| | | |
| | | String classStartTime = coursePackage.getClassStartTime(); |
| | | String classEndTime = coursePackage.getClassEndTime(); |
| | | recordVo.setTimeFrame(simpleDateFormat.format(date)+" "+classStartTime+"-"+classEndTime); |
| | | Store store = stoClient.queryStoreById(coursePackage.getStoreId()); |
| | | recordVo.setStoreNameAddr(store.getName()+store.getAddress()); |
| | | CoursePackageStudent coursePackageStudent = cpsMapper.selectOne(new QueryWrapper<CoursePackageStudent>() |
| | | .eq("coursePackageId",tCoursePackagePayment.getCoursePackageId() ) |
| | | .eq("studentId",stuId) |
| | | .eq("appUserId",appUserId) |
| | | .eq("reservationStatus",1)); |
| | | if (ToolUtil.isNotEmpty(coursePackageStudent) && coursePackageStudent.getReservationStatus() == 1){ |
| | | |
| | | recordVo.setCourseStuRecordId(coursePackageStudent.getId()); |
| | | String classWeeks = coursePackage.getClassWeeks(); |
| | | String[] split = classWeeks.split(";"); |
| | | List<Integer> integerList = Arrays.stream(split) |
| | | .map(Integer::parseInt) |
| | | .collect(Collectors.toList()); |
| | | int dayOfWeek = DateTimeHelper.getDayOfWeek(new Date()); |
| | | |
| | | if (integerList.contains(dayOfWeek)){ |
| | | String dat = simpleDateFormat.format(date) +" "+ classStartTime; |
| | | |
| | | Date start = null; |
| | | try { |
| | | start = format.parse(dat); |
| | | } catch (ParseException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | if (start.after(new Date())){ |
| | | recordVo.setStatus(1); |
| | | }else { |
| | | CancelledClasses cancelledClasses = cacMapper.selectOne(new QueryWrapper<CancelledClasses>() |
| | | .eq("coursePackageId",tCoursePackagePayment.getCoursePackageId() )); |
| | | if (ToolUtil.isNotEmpty(cancelledClasses)){ |
| | | recordVo.setStatus(3); |
| | | }else { |
| | | recordVo.setStatus(2); |
| | | } |
| | | } |
| | | }else { |
| | | recordVo.setStatus(1); |
| | | } |
| | | }else { |
| | | recordVo.setStatus(4); |
| | | } |
| | | |
| | | recordVoList.add(recordVo); |
| | | } |
| | | } |
| | | return recordVoList; |
| | | } |
| | | |
| | | } |
| | |
| | | return weekDays[w]; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取当前日期是星期几<br> |
| | | * Obtain the day of the week for the current date. |
| | | * @param dt |
| | | * @return 当前日期是星期几 |
| | | */ |
| | | public static int getWeekNumOfDate(Date dt) { |
| | | Integer[] weekDays = {7, 1, 2, 3, 4, 5, 6}; // 将周一的数值设为2,依次递增表示周二到周日 |
| | | Calendar cal = Calendar.getInstance(); |
| | | cal.setTime(dt); |
| | | int w = cal.get(Calendar.DAY_OF_WEEK) - 1; |
| | | if (w < 0) { |
| | | w = 6; // 如果为负数,将其设为6,表示周日 |
| | | } |
| | | return weekDays[w]; |
| | | } |
| | | |
| | | /** |
| | | * 获取今天时间 2017-11-20 00:00:00 |
| | | */ |
| | |
| | | import java.time.Duration; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | import java.util.Calendar; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * LocalDateTimeUtils |
| | |
| | | return dayOfWeek.getValue(); |
| | | } |
| | | |
| | | /** |
| | | * 根据输入本周的周几,获取当天的时间 |
| | | * @param dayOfWeekInput 周几 |
| | | * @return |
| | | */ |
| | | public static Date getDateOfWeekNum(int dayOfWeekInput){ |
| | | // 获取当前日期 |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTime(new Date()); |
| | | |
| | | // 设置为本周的第一天(星期一) |
| | | calendar.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY); |
| | | |
| | | // 根据输入的星期几数值,计算出相应的偏移量 |
| | | int dayOfWeekIndex = (dayOfWeekInput + 6) % 7; |
| | | calendar.add(Calendar.DAY_OF_WEEK, dayOfWeekIndex); |
| | | |
| | | // 获取计算后的日期 |
| | | return calendar.getTime(); |
| | | } |
| | | |
| | | |
| | | } |