Merge branch 'master' of http://120.76.84.145:10101/gitblit/r/java/PlayPai
Conflicts:
cloud-server-management/src/main/webapp/static/modular/system/tGoods/tGoods_info.js
| | |
| | | import com.dsh.account.dto.BindDto; |
| | | import com.dsh.account.dto.SelectDto; |
| | | import com.dsh.account.dto.UpdateInfoDto; |
| | | import com.dsh.account.entity.Coach; |
| | | import com.dsh.account.entity.TAppUser; |
| | | import com.dsh.account.entity.TCourseInfoRecord; |
| | | import com.dsh.account.entity.*; |
| | | import com.dsh.account.model.*; |
| | | import com.dsh.account.model.query.appUserQuery.QueryAppUser; |
| | | import com.dsh.account.model.vo.QueryAppUserVO; |
| | | import com.dsh.account.service.IVipPaymentService; |
| | | import com.dsh.account.service.TAppUserService; |
| | | import com.dsh.account.service.TCourseInfoRecordService; |
| | | import com.dsh.account.service.*; |
| | | import com.dsh.account.util.PayMoneyUtil; |
| | | import com.dsh.account.util.ResultUtil; |
| | | import com.dsh.account.util.TokenUtil; |
| | |
| | | try { |
| | | ResultUtil smsCode = appUserService.getSMSCode(type, phone); |
| | | return smsCode; |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | @Autowired |
| | | private TStudentService studentService; |
| | | @ResponseBody |
| | | @PostMapping("/base/appUser/logOff") |
| | | @ApiOperation(value = "注销", tags = {"注销"}) |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "账号id", name = "appId", dataType = "int", required = true) |
| | | }) |
| | | public ResultUtil<String> logOff(Integer appId){ |
| | | try { |
| | | |
| | | appUserService.removeById(appId); |
| | | studentService.remove(new QueryWrapper<TStudent>().eq("appUserId",appId)); |
| | | |
| | | return ResultUtil.success("注销成功"); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | |
| | | } |
| | | |
| | | |
| | | @Autowired |
| | | private UserIntegralChangesService userIntegralChangesService; |
| | | /** |
| | | * 修改用户信息 |
| | | * @param appUser |
| | |
| | | public void updateAppUser(@RequestBody TAppUser appUser){ |
| | | try { |
| | | appUserService.updateById(appUser); |
| | | UserIntegralChanges userIntegralChanges = new UserIntegralChanges(); |
| | | userIntegralChanges.setAppUserId(appUser.getId()); |
| | | userIntegralChanges.setOldIntegral(appUser.getIntegral()+appUser.getPoints()); |
| | | userIntegralChanges.setType(5); |
| | | userIntegralChanges.setNewIntegral(appUser.getIntegral()); |
| | | userIntegralChanges.setInsertTime(new Date()); |
| | | userIntegralChanges.setCategory(2); |
| | | userIntegralChangesService.save(userIntegralChanges); |
| | | |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil<ClassInfoVo> queryCouponRecord(){ |
| | | public ResultUtil<ClassInfoVo> queryCouponRecord(Integer stuId){ |
| | | try { |
| | | Integer userIdFormRedis = tokenUtil.getUserIdFormRedis(); |
| | | if(null == userIdFormRedis){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | return ResultUtil.success(tappuService.queryUserOfStus(userIdFormRedis)); |
| | | return ResultUtil.success(tappuService.queryUserOfStus(stuId,userIdFormRedis)); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | |
| | | if (ToolUtil.isNotEmpty(tStudent)){ |
| | | vo.setBmi(tStudent.getBmi()); |
| | | vo.setBodyStatus(BMIBodyUtil.getBodyStatus(tStudent.getBmi())); |
| | | vo.setUrl(tStudent.getLateralSurface()); |
| | | if (tStudent.getLateralSurface()!=null) { |
| | | String[] split = tStudent.getLateralSurface().split(";"); |
| | | vo.setUrls(split); |
| | | } |
| | | vo.setHeight(tStudent.getHeight()); |
| | | vo.setWeight(tStudent.getWeight()); |
| | | } |
| | |
| | | vo.setStuWeight(sts.getWeight()); |
| | | vo.setIsNot(sts.getIsDefault()); |
| | | vo.setStuPhone(sts.getPhone()); |
| | | vo.setSex(sts.getSex()); |
| | | stuListVos.add(vo); |
| | | }); |
| | | } |
| | |
| | | @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 commitEditStu(StuEditInfoReq stu){ |
| | | public ResultUtil commitEditStu(StuDetailsReq stu){ |
| | | try { |
| | | Integer userIdFormRedis = tokenUtil.getUserIdFormRedis(); |
| | | if(null == userIdFormRedis){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | return ResultUtil.success(istuService.commitEditStudentInfo(stu,userIdFormRedis)); |
| | | SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); |
| | | |
| | | Double height = stu.getHeight(); |
| | | Double squareHeight = Math.pow(height/100, 2); |
| | | Double weight = stu.getWeight(); |
| | | |
| | | Double bim = weight/squareHeight; |
| | | |
| | | TStudent tStudent = new TStudent(); |
| | | tStudent.setId(stu.getStuId()); |
| | | tStudent.setBirthday(format.parse(stu.getBirthday())); |
| | | tStudent.setHeadImg(stu.getHeadImg()); |
| | | tStudent.setHeight(stu.getHeight()); |
| | | tStudent.setWeight(stu.getWeight()); |
| | | tStudent.setPhone(stu.getPhone()); |
| | | tStudent.setSex(stu.getSex()); |
| | | tStudent.setName(stu.getName()); |
| | | tStudent.setIdCard(stu.getIdCard()); |
| | | tStudent.setBmi(bim); |
| | | return ResultUtil.success(istuService.updateById(tStudent)); |
| | | |
| | | // return ResultUtil.success(istuService.commitEditStudentInfo(stu,userIdFormRedis)); |
| | | }catch (Exception e){ |
| | | return ResultUtil.runErr(); |
| | | } |
| | |
| | | }) |
| | | public ResultUtil<List<StuMedalVo>> queryStuMedal( Integer stuId){ |
| | | try { |
| | | |
| | | |
| | | |
| | | Integer appUserId = tokenUtil.getUserIdFormRedis(); |
| | | if(null == appUserId){ |
| | | return ResultUtil.tokenErr(); |
| | |
| | | @ApiImplicitParam(value = "搜索", name = "search", required = true, dataType = "string"), |
| | | }) |
| | | public ResultUtil<List<StoreDetailList>> getStoreListCon(Integer space,String cityCode,String latitude,String longitude,String search){ |
| | | try { |
| | | return ResultUtil.success(tsService.queryStoreList(space,cityCode,latitude,longitude,search)); |
| | | }catch (Exception e){ |
| | | return ResultUtil.runErr(); |
| | | } |
| | | // try { |
| | | return ResultUtil.success(tsService.queryStoreList(space,cityCode,"104.05349525280955","30.588087670753833",search)); |
| | | // }catch (Exception e){ |
| | | // return ResultUtil.runErr(); |
| | | // } |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/student/queryById") |
| | | public TStudent queryById(@RequestBody Integer id) { |
| | | return studentService.getById(id); |
| | | } |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/base/appUser/updateTStudent") |
| | | public void updateTStudent(@RequestBody TStudent student){ |
| | | try { |
| | |
| | | @ApiOperation(value = "福利主页", tags = {"APP-使用福利"}) |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."), |
| | | @ApiImplicitParam(name = "lat",value = "经度",dataType = "string"), |
| | | @ApiImplicitParam(name = "lon",value = "纬度",dataType = "string") |
| | | }) |
| | | public ResultUtil<IndexOfUserBenefirVo> queryAppUserUser(){ |
| | | public ResultUtil<IndexOfUserBenefirVo> queryAppUserUser(String lon,String lat){ |
| | | try { |
| | | Integer appUserId = tokenUtil.getUserIdFormRedis(); |
| | | if(null == appUserId){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | IndexOfUserBenefirVo indexOfUserBenefirVo = tauService.queryBenefitDetails(appUserId); |
| | | IndexOfUserBenefirVo indexOfUserBenefirVo = tauService.queryBenefitDetails(appUserId,lon,lat); |
| | | List<IntegralCommodity> commodities = indexOfUserBenefirVo.getCommodities(); |
| | | if (commodities.size() > 5) { |
| | | commodities = commodities.subList(0, 5); |
| | |
| | | @ApiOperation(value = "用户个人信息", tags = {"APP-使用福利"}) |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."), |
| | | @ApiImplicitParam(name = "lat",value = "经度",dataType = "string"), |
| | | @ApiImplicitParam(name = "lon",value = "纬度",dataType = "string") |
| | | |
| | | }) |
| | | public ResultUtil<AppUserDetailsVo> queryAppUserDetails(){ |
| | | try { |
| | |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | TAppUser tAppUser = tauService.getBaseMapper().selectById(appUserId); |
| | | if (tAppUser.getCode()==null){ |
| | | detailsVo.setNeedChange(1); |
| | | }else { |
| | | detailsVo.setNeedChange(0); |
| | | } |
| | | |
| | | |
| | | if (null != tAppUser){ |
| | | detailsVo.setUserId(appUserId); |
| | | detailsVo.setUserImage(tAppUser.getHeadImg()); |
| | |
| | | @ApiImplicitParam(value = "记录id", name = "detailsId", required = true, dataType = "string"), |
| | | }) |
| | | public ResultUtil<PointDetailsVo> redemptionDetails(Long detailsId){ |
| | | try { |
| | | // try { |
| | | PointDetailsVo pointDetailsVo = uicService.queryRedemptionDetails(detailsId); |
| | | pointDetailsVo.getPics().remove(0); |
| | | return ResultUtil.success(pointDetailsVo); |
| | | }catch (Exception e){ |
| | | return ResultUtil.runErr(); |
| | | } |
| | | // }catch (Exception e){ |
| | | // return ResultUtil.runErr(); |
| | | // } |
| | | } |
| | | |
| | | |
New file |
| | |
| | | package com.dsh.account.dto; |
| | | |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class Location { |
| | | private String lon; |
| | | private String lat; |
| | | } |
New file |
| | |
| | | package com.dsh.account.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.models.auth.In; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | |
| | | |
| | | @Data |
| | | @TableName("t_course_consum") |
| | | public class CourseCounsum { |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | Integer id; |
| | | @TableField("changeType") |
| | | Integer changeType; |
| | | @TableField("num") |
| | | Integer num; |
| | | @TableField("reason") |
| | | String reason; |
| | | @TableField("paymentId") |
| | | Long paymentId; |
| | | @TableField("insertTime") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm",timezone = "GMT+8") |
| | | Date insertTime; |
| | | @TableField("appUserId") |
| | | Integer appUserId; |
| | | } |
New file |
| | |
| | | package com.dsh.account.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.baomidou.mybatisplus.extension.activerecord.Model; |
| | | import io.swagger.models.auth.In; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.experimental.Accessors; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * <p> |
| | | * 荣誉规则 |
| | | * </p> |
| | | * |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @Accessors(chain = true) |
| | | @TableName("t_honor_rules") |
| | | public class HonorRules extends Model<HonorRules> { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Integer id; |
| | | /** |
| | | * 数据类型(1=俱乐部之星,2=运动达人,3=社区之王,4=深度玩家) |
| | | */ |
| | | @TableField("type") |
| | | private Integer type; |
| | | /** |
| | | * 等级 |
| | | */ |
| | | @TableField("level") |
| | | private Integer level; |
| | | /** |
| | | * 满足条件值 |
| | | */ |
| | | |
| | | @TableField(value = "`condition`") |
| | | private Integer condition; |
| | | |
| | | @Override |
| | | protected Serializable pkVal() { |
| | | return this.id; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.dsh.account.entity; |
| | | |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class OrderDto { |
| | | private String stuIds; |
| | | |
| | | private Integer appUserId; |
| | | |
| | | private Integer classId; |
| | | |
| | | private Integer classHours; |
| | | } |
| | |
| | | private Integer addUserId; |
| | | @TableField(exist = false) |
| | | private Integer age; |
| | | @TableField(exist = false) |
| | | private Integer points; |
| | | } |
| | |
| | | package com.dsh.account.feignclient.activity; |
| | | |
| | | |
| | | import com.dsh.account.dto.Location; |
| | | import com.dsh.account.feignclient.activity.model.*; |
| | | import com.dsh.account.feignclient.competition.model.BillingDataRequestVo; |
| | | import com.dsh.account.model.vo.userBenefitDetail.*; |
| | |
| | | public interface MerChandiseClient { |
| | | |
| | | @PostMapping("/base/pointMerchars/convertGoods") |
| | | public List<IntegralCommodity> getConvertibleGoods(); |
| | | public List<IntegralCommodity> getConvertibleGoods(@RequestBody Location location); |
| | | |
| | | |
| | | @PostMapping("/base/pointMerchars/getCommoditys") |
| | |
| | | package com.dsh.account.feignclient.activity.model; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | |
| | | @Data |
| | | public class UserPointsMerchandise{ |
| | | |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id", type = IdType.NONE) |
| | | private Long id; |
| | | /** |
| | | * 商品id |
| | | */ |
| | | @TableField("pointsMerchandiseId") |
| | | private Integer pointsMerchandiseId; |
| | | /** |
| | | * 用户id |
| | | */ |
| | | @TableField("userId") |
| | | private Integer userId; |
| | | /** |
| | | * 核销人员id |
| | | */ |
| | | @TableField("verificationUserId") |
| | | private Integer verificationUserId; |
| | | /** |
| | | * 核销门店id |
| | | */ |
| | | @TableField("verifiStoreId") |
| | | private Integer verifiStoreId; |
| | | /** |
| | | * 核销时间 |
| | | */ |
| | | @TableField("verificationTime") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date verificationTime; |
| | | /** |
| | | * 状态(1=待核销,2=已核销) |
| | | */ |
| | | @TableField("status") |
| | | private Integer status; |
| | | /** |
| | | * 领取时间 |
| | | */ |
| | | @TableField("insertTime") |
| | | private Date insertTime; |
| | | /** |
| | | * 现金支付方式(1=微信2支付宝) |
| | | */ |
| | | @TableField("payType") |
| | | private Integer payType; |
| | | /** |
| | | * 现金支付的交易凭证 |
| | | * code |
| | | */ |
| | | @TableField("code") |
| | | private String code; |
| | | /** |
| | | * 现金支付的交易订单号 |
| | | * orderNumber |
| | | */ |
| | | @TableField("orderNumber") |
| | | private String orderNumber; |
| | | /** |
| | | * 现金的支付状态(1=待支付 2=已支付) |
| | | * 现金的支付状态 |
| | | */ |
| | | @TableField("payStatus") |
| | | private Integer payStatus; |
| | | /** |
| | | * 可使用的门店id |
| | | */ |
| | | @TableField("storeId") |
| | | private Integer storeId; |
| | | /** |
| | | * 1=正常 2= 删除 |
| | | * 1=正常 2=删除 |
| | | */ |
| | | @TableField("state") |
| | | private Integer state; |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | */ |
| | | @PostMapping("/participant/saveParticipant") |
| | | void saveParticipant(SaveParticipant saveParticipant); |
| | | @PostMapping("/participant/counts") |
| | | Integer counts(Integer stuId); |
| | | } |
| | |
| | | CoursePackage queryCoursePackageById(Integer id); |
| | | @PostMapping("/base/coursePackage/queryByCode") |
| | | Integer queryByCode(String code); |
| | | @PostMapping("/base/coursePackage/counts") |
| | | Integer counts(Integer stuId); |
| | | @PostMapping("/base/coursePackage/counts1") |
| | | Integer counts1(Integer stuId); |
| | | } |
| | |
| | | package com.dsh.account.feignclient.course; |
| | | |
| | | import com.dsh.account.dto.TCoursePackagePayment1; |
| | | import com.dsh.account.entity.CourseCounsum; |
| | | import com.dsh.account.entity.OrderDto; |
| | | import com.dsh.account.feignclient.competition.model.BillingDataRequestVo; |
| | | import com.dsh.account.feignclient.course.model.*; |
| | | import com.dsh.account.model.BillingRequest; |
| | |
| | | @PostMapping("/base/coursePack/savePaymentCoursePackage") |
| | | public boolean savePaymentCoursePackage(@RequestBody TCoursePackagePayment packagePayment); |
| | | |
| | | |
| | | @PostMapping("/base/coursePack/orderClass") |
| | | public void orderClass(@RequestBody OrderDto orderDto); |
| | | |
| | | @PostMapping("/base/coursePack/allAmountPayRecordOfUser") |
| | | BillingRequestVo getAmountPayRecord(@RequestBody BillingDataRequestVo appUserId); |
| | | |
| | |
| | | List<TCoursePackagePayment> getCoursePackagePaymentOfCode(@RequestBody String code); |
| | | |
| | | @PostMapping("/base/coursePack/sendHours") |
| | | Integer sendHours(String s); |
| | | Integer sendHours(@RequestBody String s); |
| | | |
| | | @PostMapping("/base/coursePack/getClassHour") |
| | | Integer getClassHour(Integer courseConfigId); |
| | |
| | | @PostMapping("/base/coursePack/weeksOfCourseDetailsList") |
| | | HashMap<String, Object> weeksOfCourseDetailsList(@RequestBody CourseDetailReq courseDetailReq); |
| | | |
| | | @PostMapping("/base/coursePack/getConsumes") |
| | | List<CourseCounsum> getConsumes(@RequestBody BillingDataRequestVo requestVo); |
| | | |
| | | |
| | | // @PostMapping("/base/coursePack/getClassHour") |
| | | // Integer getClassHour(Integer courseConfigId); |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | import com.dsh.account.feignclient.competition.model.PurchaseRecordVo; |
| | | import com.dsh.account.feignclient.course.model.GetStuSessionList; |
| | | import com.dsh.account.feignclient.course.model.StuSessionDetailsVo; |
| | | import com.dsh.account.model.vo.sourceDetail.RecordTimeRequest; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | |
| | | |
| | | @PostMapping("/base/coursePack/paymentCourse") |
| | | public List<PurchaseRecordVo> queryCourseDetails(@RequestBody GetStuSessionList getStuSessionList); |
| | | |
| | | @PostMapping("/base/coursePack/getRecord") |
| | | List<PurchaseRecordVo> getRecord(@RequestBody RecordTimeRequest timeRequest); |
| | | } |
| | |
| | | |
| | | @ApiModelProperty(value = "课时有效期") |
| | | private String periodOfValidity; |
| | | @ApiModelProperty(value = "是否过滤分配课时") |
| | | private Integer isAble; |
| | | } |
| | |
| | | package com.dsh.account.feignclient.other; |
| | | |
| | | import com.dsh.account.entity.HonorRules; |
| | | import com.dsh.account.model.vo.medalDetail.StuMedalVo; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | |
| | | |
| | | @PostMapping("/base/honor/stuHonors") |
| | | public List<StuMedalVo> getStuHonors(@RequestBody List<Integer> honorIds); |
| | | |
| | | @PostMapping("/base/honor/getHonor") |
| | | HonorRules getHonor(@RequestBody List<Integer> integers); |
| | | } |
| | |
| | | |
| | | @PostMapping("/base/site/game") |
| | | List<Map<String, Object>> game(Integer appUserId); |
| | | |
| | | @PostMapping("/base/site/counts") |
| | | Integer counts(Integer stuId); |
| | | } |
| | |
| | | * 金额 |
| | | */ |
| | | private double amount; |
| | | |
| | | private String time1; |
| | | |
| | | } |
| | |
| | | |
| | | @ApiModelProperty(value = "课时有效期") |
| | | private String periodOfValidity; |
| | | @ApiModelProperty(value = "课程类型") |
| | | private Integer courseType; |
| | | @ApiModelProperty(value = "是否过滤分配课时 1过滤,0不过滤") |
| | | private Integer isAble; |
| | | |
| | | } |
| | |
| | | |
| | | @ApiModelProperty(value = "身份证号码") |
| | | private String idCard; |
| | | private Integer stuId; |
| | | } |
| | |
| | | @ApiModelProperty(value = "学员手机号") |
| | | private String stuPhone; |
| | | |
| | | @ApiModelProperty(value = "性别") |
| | | private Integer sex; |
| | | } |
| | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | public class StuPhysicalVo { |
| | | @ApiModelProperty(value = "身高") |
| | |
| | | private Double bmi; |
| | | @ApiModelProperty(value = "身体状态") |
| | | private String bodyStatus; |
| | | @ApiModelProperty(value = "图片链接") |
| | | private String url; |
| | | // @ApiModelProperty(value = "图片链接") |
| | | // private String url; |
| | | |
| | | @ApiModelProperty(value = "图片") |
| | | private String[] urls; |
| | | |
| | | } |
| | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @date 2023/6/24 17:34 |
| | |
| | | private Integer applicantsNumber; |
| | | |
| | | @ApiModelProperty("包含课时数") |
| | | private Integer classHours; |
| | | private List<Integer> classHours; |
| | | |
| | | @ApiModelProperty("价格") |
| | | private Double originalPrice; |
| | | @ApiModelProperty("玩湃币价格") |
| | | private Integer coin; |
| | | } |
| | |
| | | private String memberLifespan; |
| | | |
| | | private Integer isVip; |
| | | @ApiModelProperty(value = "1:需要修改,") |
| | | private Integer needChange; |
| | | |
| | | } |
| | |
| | | |
| | | @ApiModelProperty(value = "1日卡 2月卡 3季卡 4年卡") |
| | | private Integer cardType; |
| | | |
| | | @ApiModelProperty(value = "使用范围") |
| | | private Integer exchangeAddrType; |
| | | } |
| | |
| | | */ |
| | | public interface TAppUserService extends IService<TAppUser> { |
| | | |
| | | ClassInfoVo queryUserOfStus(Integer id); |
| | | ClassInfoVo queryUserOfStus(Integer id,Integer uid); |
| | | |
| | | |
| | | /** |
| | |
| | | * @param appUserId |
| | | * @return |
| | | */ |
| | | IndexOfUserBenefirVo queryBenefitDetails(Integer appUserId); |
| | | IndexOfUserBenefirVo queryBenefitDetails(Integer appUserId,String lon,String lat); |
| | | |
| | | /** |
| | | * 获取用户账单列表 |
| | |
| | | @Override |
| | | public List<RechargesDetail> getAppUserRechargeRecord(String yearMonth, Integer recordId, Integer appUserId,Integer pageNum,Integer pageSize) { |
| | | List<RechargesDetail> details = new ArrayList<>(); |
| | | SimpleDateFormat simpleDateFormat = new SimpleDateFormat("MM-dd HH:mm"); |
| | | SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm"); |
| | | |
| | | Date monthStart = null; |
| | | Date monthEnd = null; |
| | |
| | | if (rechargeRecords.size() > 0) { |
| | | for (RechargeRecords rechargeRecord : rechargeRecords) { |
| | | RechargesDetail consumeDetail = new RechargesDetail(); |
| | | consumeDetail.setConsumeName(RechargeRecordEnum.RECHARGE.name() + ":" + rechargeRecord.getPlayPaiCoins()); |
| | | consumeDetail.setConsumeName(RechargeRecordEnum.RECHARGE.getMsg() + ":¥" + rechargeRecord.getAmount()); |
| | | consumeDetail.setConsumeTime(simpleDateFormat.format(rechargeRecord.getInsertTime())); |
| | | consumeDetail.setConsumeAmount("+" + rechargeRecord.getAmount()); |
| | | consumeDetail.setConsumeAmount("+" + rechargeRecord.getPlayPaiCoins()); |
| | | consumeDetail.setRecordId(1); |
| | | details.add(consumeDetail); |
| | | } |
| | |
| | | //一页五条 |
| | | int size = pageSize; |
| | | |
| | | |
| | | SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); |
| | | List<RechargesDetail> filteredList = new ArrayList<>(); |
| | | for (RechargesDetail detail : details) { |
| | | try { |
| | | Date consumeTime = dateFormat.parse(detail.getConsumeTime()); |
| | | if (consumeTime.after(monthStart) && consumeTime.before(monthEnd)) { |
| | | String substring = detail.getConsumeTime().substring(5); |
| | | detail.setConsumeTime(substring); |
| | | filteredList.add(detail); |
| | | } |
| | | } catch (ParseException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | //分页 |
| | | details = details.stream().skip((pageNo - 1) * size).limit(size). |
| | | filteredList = filteredList.stream().skip((pageNo - 1) * size).limit(size). |
| | | collect(Collectors.toList()); |
| | | |
| | | return details; |
| | | return filteredList; |
| | | } |
| | | |
| | | @Override |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.dsh.account.entity.HonorRules; |
| | | import com.dsh.account.entity.StudentHonor; |
| | | import com.dsh.account.entity.TStudent; |
| | | import com.dsh.account.feignclient.competition.ParticipantClient; |
| | | import com.dsh.account.feignclient.course.CoursePackageClient; |
| | | import com.dsh.account.feignclient.course.model.CoursePackage; |
| | | import com.dsh.account.feignclient.other.HonorDeClient; |
| | | import com.dsh.account.feignclient.other.SiteClient; |
| | | import com.dsh.account.mapper.StudentHonorMapper; |
| | | import com.dsh.account.model.vo.medalDetail.GongVo; |
| | | import com.dsh.account.model.vo.medalDetail.StuMedalVo; |
| | | import com.dsh.account.service.StudentHonorService; |
| | | import com.dsh.account.service.TAppUserService; |
| | | import com.dsh.account.service.TStudentService; |
| | | import io.swagger.models.auth.In; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | |
| | | @Service |
| | | public class StudentHonorServiceImpl extends ServiceImpl<StudentHonorMapper, StudentHonor> implements StudentHonorService { |
| | | |
| | | @Resource |
| | | private CoursePackageClient coursePackageClient; |
| | | |
| | | @Resource |
| | | private ParticipantClient participantClient; |
| | | |
| | | @Resource |
| | | private SiteClient siteClient; |
| | | |
| | | |
| | | @Autowired |
| | | private HonorDeClient honorDeClient; |
| | | |
| | | |
| | | @Autowired |
| | | private TStudentService studentService; |
| | | |
| | | @Override |
| | | public List<GongVo> queryStuOfMedalData(Integer stuId) { |
| | | List<GongVo> voList = new ArrayList<>(); |
| | | List<StudentHonor> studentHonors = this.baseMapper.selectList(new QueryWrapper<StudentHonor>() |
| | | .eq("stuId", stuId)); |
| | | if (studentHonors.size() > 0){ |
| | | studentHonors.forEach( stuoHo -> { |
| | | GongVo vo = new GongVo(); |
| | | vo.setMedalType(stuoHo.getHonorType()); |
| | | switch (stuoHo.getHonorType()){ |
| | | case 1: |
| | | vo.setMedalName("俱乐部之星"); |
| | | break; |
| | | case 2: |
| | | vo.setMedalName("运动达人"); |
| | | break; |
| | | case 3: |
| | | vo.setMedalName("社区之王"); |
| | | break; |
| | | case 4: |
| | | vo.setMedalName("深度玩家"); |
| | | break; |
| | | default: |
| | | break; |
| | | } |
| | | voList.add(vo); |
| | | }); |
| | | // List<StudentHonor> studentHonors = this.baseMapper.selectList(new QueryWrapper<StudentHonor>() |
| | | // .eq("stuId", stuId)); |
| | | // |
| | | TStudent student = studentService.getById(stuId); |
| | | // |
| | | // |
| | | // if (studentHonors.size() > 0){ |
| | | // studentHonors.forEach( stuoHo -> { |
| | | // GongVo vo = new GongVo(); |
| | | // vo.setMedalType(stuoHo.getHonorType()); |
| | | // switch (stuoHo.getHonorType()){ |
| | | // case 1: |
| | | // vo.setMedalName("俱乐部之星"); |
| | | // break; |
| | | // case 2: |
| | | // vo.setMedalName("运动达人"); |
| | | // break; |
| | | // case 3: |
| | | // vo.setMedalName("社区之王"); |
| | | // break; |
| | | // case 4: |
| | | // vo.setMedalName("深度玩家"); |
| | | // break; |
| | | // default: |
| | | // break; |
| | | // } |
| | | // voList.add(vo); |
| | | // }); |
| | | // } |
| | | Integer count1 =coursePackageClient.counts(stuId); |
| | | if (count1>0){ |
| | | GongVo vo = new GongVo(); |
| | | vo.setMedalType(1); |
| | | vo.setMedalName("俱乐部之星"); |
| | | voList.add(vo); |
| | | } |
| | | |
| | | Integer count2 = participantClient.counts(stuId); |
| | | if (count2>0){ |
| | | GongVo vo = new GongVo(); |
| | | vo.setMedalType(2); |
| | | vo.setMedalName("运动达人"); |
| | | voList.add(vo); |
| | | } |
| | | |
| | | Integer count3 = siteClient.counts(student.getAppUserId()); |
| | | if (count3>0){ |
| | | GongVo vo = new GongVo(); |
| | | vo.setMedalType(3); |
| | | vo.setMedalName("社区之王"); |
| | | voList.add(vo); |
| | | } |
| | | |
| | | |
| | | Integer count4 = coursePackageClient.counts1(stuId); |
| | | if (count4>0){ |
| | | GongVo vo = new GongVo(); |
| | | vo.setMedalType(4); |
| | | vo.setMedalName("深度玩家"); |
| | | voList.add(vo); |
| | | } |
| | | |
| | | |
| | | return voList; |
| | | } |
| | | |
| | | |
| | | |
| | | @Override |
| | | public List<StuMedalVo> queryHonorDetails(Integer stuId) { |
| | | List<StudentHonor> studentHonors = this.baseMapper.selectList(new QueryWrapper<StudentHonor>() |
| | | .in("stuId",stuId)); |
| | | List<Integer> collect = studentHonors.stream().map(StudentHonor::getHonorRuleId).collect(Collectors.toList()); |
| | | return honorDeClient.getStuHonors(collect); |
| | | List<StuMedalVo> studentHonors = new ArrayList<>(); |
| | | // List<Integer> collect = studentHonors.stream().map(StudentHonor::getHonorRuleId).collect(Collectors.toList()); |
| | | |
| | | Integer count1 =coursePackageClient.counts(stuId); |
| | | if (count1>0){ |
| | | StuMedalVo vo = new StuMedalVo(); |
| | | vo.setMedalType(1); |
| | | vo.setMedalName("俱乐部之星"); |
| | | //拿到当前对应的rule对象 |
| | | List<Integer> integers = new ArrayList<>(); |
| | | integers.add(1); |
| | | integers.add(count1); |
| | | HonorRules honorRules = honorDeClient.getHonor(integers); |
| | | if (count1<Integer.valueOf(honorRules.getCondition())){ |
| | | vo.setLevelNum(Integer.valueOf(honorRules.getLevel())-1); |
| | | vo.setNextLevel(Integer.valueOf(honorRules.getLevel())); |
| | | vo.setUpgradeConditions(String.valueOf(Integer.valueOf(honorRules.getCondition())-count1)); |
| | | vo.setIsTopLevel(0); |
| | | }else { |
| | | vo.setIsTopLevel(1); |
| | | } |
| | | |
| | | studentHonors.add(vo); |
| | | } |
| | | |
| | | Integer count2 = participantClient.counts(stuId); |
| | | if (count2>0){ |
| | | StuMedalVo vo = new StuMedalVo(); |
| | | vo.setMedalType(2); |
| | | vo.setMedalName("运动达人"); |
| | | //拿到当前对应的rule对象 |
| | | List<Integer> integers = new ArrayList<>(); |
| | | integers.add(2); |
| | | integers.add(count2); |
| | | HonorRules honorRules = honorDeClient.getHonor(integers); |
| | | if (count2<Integer.valueOf(honorRules.getCondition())){ |
| | | vo.setLevelNum(Integer.valueOf(honorRules.getLevel())-1); |
| | | vo.setNextLevel(Integer.valueOf(honorRules.getLevel())); |
| | | vo.setUpgradeConditions(String.valueOf(Integer.valueOf(honorRules.getCondition())-count2)); |
| | | vo.setIsTopLevel(0); |
| | | }else { |
| | | vo.setIsTopLevel(1); |
| | | } |
| | | |
| | | studentHonors.add(vo); |
| | | } |
| | | TStudent student = studentService.getById(stuId); |
| | | |
| | | Integer count3 = siteClient.counts(student.getAppUserId()); |
| | | if (count3>0){ |
| | | StuMedalVo vo = new StuMedalVo(); |
| | | vo.setMedalType(3); |
| | | vo.setMedalName("社区之王"); |
| | | //拿到当前对应的rule对象 |
| | | List<Integer> integers = new ArrayList<>(); |
| | | integers.add(3); |
| | | integers.add(count3); |
| | | HonorRules honorRules = honorDeClient.getHonor(integers); |
| | | if (count3<Integer.valueOf(honorRules.getCondition())){ |
| | | vo.setLevelNum(Integer.valueOf(honorRules.getLevel())-1); |
| | | vo.setNextLevel(Integer.valueOf(honorRules.getLevel())); |
| | | vo.setUpgradeConditions(String.valueOf(Integer.valueOf(honorRules.getCondition())-count3)); |
| | | vo.setIsTopLevel(0); |
| | | }else { |
| | | vo.setIsTopLevel(1); |
| | | } |
| | | |
| | | studentHonors.add(vo); |
| | | } |
| | | |
| | | |
| | | Integer count4 = coursePackageClient.counts1(stuId); |
| | | if (count4>0){ |
| | | StuMedalVo vo = new StuMedalVo(); |
| | | vo.setMedalType(4); |
| | | vo.setMedalName("深度玩家"); |
| | | //拿到当前对应的rule对象 |
| | | List<Integer> integers = new ArrayList<>(); |
| | | integers.add(4); |
| | | integers.add(count4); |
| | | HonorRules honorRules = honorDeClient.getHonor(integers); |
| | | if (count4<Integer.valueOf(honorRules.getCondition())){ |
| | | vo.setLevelNum(Integer.valueOf(honorRules.getLevel())-1); |
| | | vo.setNextLevel(Integer.valueOf(honorRules.getLevel())); |
| | | vo.setUpgradeConditions(String.valueOf(Integer.valueOf(honorRules.getCondition())-count4)); |
| | | vo.setIsTopLevel(0); |
| | | }else { |
| | | vo.setIsTopLevel(1); |
| | | } |
| | | |
| | | studentHonors.add(vo); |
| | | } |
| | | |
| | | |
| | | |
| | | return studentHonors; |
| | | } |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.dsh.account.dto.BindDto; |
| | | import com.dsh.account.dto.SelectDto; |
| | | import com.dsh.account.dto.UpdateInfoDto; |
| | | import com.dsh.account.dto.UserInfoQueryDTO; |
| | | import com.dsh.account.dto.*; |
| | | import com.dsh.account.entity.*; |
| | | import com.dsh.account.enums.RechargeRecordEnum; |
| | | import com.dsh.account.feignclient.activity.IntroduceRewardsClient; |
| | |
| | | import com.dsh.account.feignclient.other.model.TImgConfig; |
| | | import com.dsh.account.mapper.*; |
| | | import com.dsh.account.model.*; |
| | | import com.dsh.account.model.AppUserByNameAndPhoneDTO; |
| | | import com.dsh.account.model.dto.Coupon; |
| | | import com.dsh.account.model.query.appUserQuery.QueryAppUser; |
| | | import com.dsh.account.model.vo.DetailsListVo; |
| | |
| | | return appUserMapper.groupCityInfo(dto); |
| | | } |
| | | @Override |
| | | public ClassInfoVo queryUserOfStus(Integer id) { |
| | | TAppUser tAppUser = this.baseMapper.selectById(id); |
| | | public ClassInfoVo queryUserOfStus(Integer id,Integer uid) { |
| | | TAppUser tAppUser = this.baseMapper.selectById(uid); |
| | | ClassInfoVo classInfoVo = new ClassInfoVo(); |
| | | if (ToolUtil.isNotEmpty(tAppUser)){ |
| | | List<TStudent> tStudents = tsmapper.selectList(new QueryWrapper<TStudent>() |
| | | // if (ToolUtil.isNotEmpty(tAppUser)){ |
| | | |
| | | // |
| | | |
| | | List<TStudent> tStudents = new ArrayList<>(); |
| | | if (id!=null) { |
| | | tStudents = tsmapper.selectList(new QueryWrapper<TStudent>() |
| | | .eq("id", id).eq("state", 1)); |
| | | |
| | | if (tStudents.size() == 0) { |
| | | tStudents = tsmapper.selectList(new QueryWrapper<TStudent>() |
| | | .eq("appUserId", tAppUser.getId()) |
| | | .eq("state", 1)); |
| | | } |
| | | }else { |
| | | tStudents = tsmapper.selectList(new QueryWrapper<TStudent>() |
| | | .eq("appUserId",tAppUser.getId()) |
| | | .eq("state",1) |
| | | .eq("isDefault",1)); |
| | | if (tStudents==null){ |
| | | tStudents = tsmapper.selectList(new QueryWrapper<TStudent>() |
| | | .eq("appUserId",tAppUser.getId()) |
| | | .eq("state",1)) |
| | | ; |
| | | } |
| | | } |
| | | if (tStudents.size() > 0 ){ |
| | | TStudent tStudent = tStudents.get(0); |
| | | classInfoVo.setStuId(tStudent.getId()); |
| | |
| | | course.setDeductedNums(ToolUtil.isEmpty(tCoursePackagePayment.getDeductionNums()) ? 0 : tCoursePackagePayment.getDeductionNums()); |
| | | course.setRemainingNums(ToolUtil.isEmpty(tCoursePackagePayment.getResidueNums())? 0 : tCoursePackagePayment.getResidueNums()); |
| | | course.setPeriodOfValidity(tCoursePackagePayment.getPeriodOfValidity()); |
| | | course.setIsAble(tCoursePackagePayment.getIsAble()); |
| | | courseList.add(course); |
| | | } |
| | | } |
| | | classInfoVo.setCourseList(courseList); |
| | | // List<ExerciseVideo> stuCourseOfVideoList = voclClient.getStuCourseOfVideoList(coursePackIds); |
| | | List<ExerciseVideo> query = voclClient.query(id); |
| | | System.out.println("======queryqueryqueryquery=================="+query); |
| | | classInfoVo.setExerciseVideoList(query); |
| | | List<ExerciseVideo> query = voclClient.query(tStudent.getId()); |
| | | classInfoVo.setExerciseVideoList(query); |
| | | |
| | | }else { |
| | | classInfoVo.setIsThere(2); |
| | | List<TImgConfig> tImgConfigs = configClient.getNoneStuImgs(); |
| | |
| | | classInfoVo.setImgs(tImgConfigs.get(0).getContent()); |
| | | } |
| | | } |
| | | } |
| | | // } |
| | | return classInfoVo; |
| | | } |
| | | |
| | |
| | | if(tAppUser.getState() == 2){ |
| | | return ResultUtil.error("您的账号已被冻结", ""); |
| | | } |
| | | if (tAppUser.getCode()==null){ |
| | | tAppUser.setCode(UUIDUtil.getNumberRandom(16)); |
| | | } |
| | | tAppUser.setPassword(password); |
| | | this.updateById(tAppUser); |
| | | return ResultUtil.success(); |
| | |
| | | } |
| | | |
| | | @Override |
| | | public IndexOfUserBenefirVo queryBenefitDetails(Integer appUserId) { |
| | | public IndexOfUserBenefirVo queryBenefitDetails(Integer appUserId,String lon,String lat) { |
| | | IndexOfUserBenefirVo benefirVo = new IndexOfUserBenefirVo(); |
| | | |
| | | TAppUser appUser = this.getById(appUserId); |
| | |
| | | }else { |
| | | benefirVo.setIsMember("普通用户"); |
| | | } |
| | | List<IntegralCommodity> convertibleGoods = mcClient.getConvertibleGoods(); |
| | | |
| | | Location location = new Location(); |
| | | location.setLat(lat); |
| | | location.setLon(lon); |
| | | List<IntegralCommodity> convertibleGoods = mcClient.getConvertibleGoods(location); |
| | | benefirVo.setCommodities(convertibleGoods); |
| | | benefirVo.setImage(icfgClient.getImageConfig()); |
| | | return benefirVo; |
| | |
| | | } |
| | | } |
| | | // 3.课包购买 |
| | | BillingRequestVo amountPayRecord = paymentClient.getAmountPayRecord(requestVo); |
| | | if (ToolUtil.isNotEmpty(amountPayRecord.getRequests())){ |
| | | for (BillingRequest coursePackagePayment : amountPayRecord.getRequests()) { |
| | | ConsumeDetail consumeDetail = new ConsumeDetail(); |
| | | consumeDetail.setConsumeName(RechargeRecordEnum.COURSE_PACKAGE_PURCHASE.getMsg()); |
| | | consumeDetail.setConsumeTime(coursePackagePayment.getTime()); |
| | | consumeDetail.setConsumeAmount("-" + coursePackagePayment.getAmount()); |
| | | // BillingRequestVo amountPayRecord = paymentClient.getAmountPayRecord(requestVo); |
| | | // if (ToolUtil.isNotEmpty(amountPayRecord.getRequests())){ |
| | | // for (BillingRequest coursePackagePayment : amountPayRecord.getRequests()) { |
| | | // ConsumeDetail consumeDetail = new ConsumeDetail(); |
| | | // consumeDetail.setConsumeName(RechargeRecordEnum.COURSE_PACKAGE_PURCHASE.getMsg()); |
| | | // consumeDetail.setConsumeTime(coursePackagePayment.getTime()); |
| | | // consumeDetail.setConsumeAmount("-" + coursePackagePayment.getAmount()); |
| | | // consumeDetail.setType(2); |
| | | // details.add(consumeDetail); |
| | | // } |
| | | // } |
| | | |
| | | //2.0 |
| | | List<CourseCounsum> courseCounsums = paymentClient.getConsumes(requestVo); |
| | | |
| | | for (CourseCounsum courseCounsum : courseCounsums) { |
| | | ConsumeDetail consumeDetail = new ConsumeDetail(); |
| | | String[] split = courseCounsum.getReason().split(";"); |
| | | consumeDetail.setConsumeName(split[0]); |
| | | consumeDetail.setConsumeTime(simpleDateFormat.format(courseCounsum.getInsertTime())); |
| | | // if (courseCounsum.getChangeType()==3){ |
| | | consumeDetail.setConsumeAmount("-" + split[1]); |
| | | consumeDetail.setType(2); |
| | | details.add(consumeDetail); |
| | | } |
| | | // } |
| | | // |
| | | // consumeDetail.setConsumeAmount("-" + coursePackagePayment.getAmount()); |
| | | // consumeDetail.setType(2); |
| | | details.add(consumeDetail); |
| | | } |
| | | |
| | | |
| | | // 4.场地预约 |
| | | RequestOfTypeVo allSiteBookingList = stClient.getAllSiteBookingList(requestVo); |
| | | if (ToolUtil.isNotEmpty(allSiteBookingList.getRequest())){ |
| | |
| | | consumeDetail.setConsumeAmount("-" + booking.getAmount()); |
| | | consumeDetail.setConsumeTime(booking.getTime()); |
| | | consumeDetail.setType(2); |
| | | details.add(consumeDetail); |
| | | }else { |
| | | consumeDetail.setConsumeName(RechargeRecordEnum.CANCEL_VENUE_RESERVATION.getMsg()); |
| | | consumeDetail.setConsumeAmount("+" + booking.getAmount()); |
| | | consumeDetail.setConsumeTime(booking.getTime()); |
| | | consumeDetail.setType(1); |
| | | ConsumeDetail consumeDetail1 = new ConsumeDetail(); |
| | | consumeDetail1.setConsumeName(RechargeRecordEnum.CANCEL_VENUE_RESERVATION.getMsg()); |
| | | consumeDetail1.setConsumeAmount("+" + booking.getAmount()); |
| | | consumeDetail1.setConsumeTime(booking.getTime()); |
| | | consumeDetail1.setType(1); |
| | | details.add(consumeDetail1); |
| | | ConsumeDetail consumeDetail2 = new ConsumeDetail(); |
| | | consumeDetail2.setConsumeName(RechargeRecordEnum.VENUE_RESERVATION.getMsg()); |
| | | consumeDetail2.setConsumeAmount("-" + booking.getAmount()); |
| | | consumeDetail2.setConsumeTime(booking.getTime1()); |
| | | consumeDetail2.setType(2); |
| | | details.add(consumeDetail2); |
| | | |
| | | } |
| | | details.add(consumeDetail); |
| | | // details.add(consumeDetail); |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | commodity.setBelongsType(vicinityGood.getUserPopulation()); |
| | | commodity.setGoodsType(1); |
| | | commodity.setUseScope(vicinityGood.getUseScope()); |
| | | commodity.setNums(mcClient.getRedeemedQuantity(vicinityGood.getId())); |
| | | List<Integer> integers = mcsClient.queryPointMerStoreIds(vicinityGood.getId()); |
| | | commodity.setShopIds(integers); |
| | |
| | | case 2: |
| | | commodity.setGoodId(vicinityGood.getId()); |
| | | CoursePackage coursePackage = cpageClient.queryCoursePackageById(vicinityGood.getCoursePackageId()); |
| | | commodity.setGoodImg(coursePackage.getCoverDrawing()); |
| | | // commodity.setGoodImg(coursePackage.getCoverDrawing()); |
| | | commodity.setGoodImg(vicinityGood.getCover()); |
| | | commodity.setGoodName(coursePackage.getName()); |
| | | commodity.setCondition(vicinityGood.getRedemptionMethod()); |
| | | if (vicinityGood.getRedemptionMethod() == 1) { |
| | |
| | | } |
| | | commodity.setBelongsType(vicinityGood.getUserPopulation()); |
| | | commodity.setGoodsType(2); |
| | | commodity.setUseScope(vicinityGood.getUseScope()); |
| | | |
| | | commodity.setNums(mcClient.getRedeemedQuantity(vicinityGood.getId())); |
| | | commodity.setShopIds(mcsClient.queryPointMerStoreIds(vicinityGood.getId())); |
| | | break; |
| | |
| | | commodity.setGoodId(vicinityGood.getId()); |
| | | commodity.setGoodName(vicinityGood.getName()); |
| | | commodity.setGoodImg(vicinityGood.getCover()); |
| | | commodity.setUseScope(vicinityGood.getUseScope()); |
| | | |
| | | commodity.setCondition(vicinityGood.getRedemptionMethod()); |
| | | if (vicinityGood.getRedemptionMethod() == 1) { |
| | | commodity.setIntegral(vicinityGood.getIntegral().intValue()); |
| | |
| | | if (allCoupon.getRedemptionMethod() == 1) { |
| | | commodity.setIntegral(allCoupon.getIntegral().intValue()); |
| | | } else { |
| | | commodity.setIntegral(allCoupon.getIntegral().intValue()); |
| | | if (allCoupon.getIntegral()!=null) { |
| | | commodity.setIntegral(allCoupon.getIntegral().intValue()); |
| | | } |
| | | commodity.setAmount(allCoupon.getCash()); |
| | | } |
| | | commodity.setBelongsType(allCoupon.getUserPopulation()); |
| | |
| | | if (request.getShopId()!=null){ |
| | | if (goods.size() > 0 ){ |
| | | goods = goods.stream() |
| | | .filter( merchandise ->(merchandise.getGoodsType() == 4&&merchandise.getUseScope() == 2)||(merchandise.getGoodsType() == 4&&merchandise.getUseScope() == 1)||merchandise.getShopIds().contains(request.getShopId())) |
| | | .filter( merchandise ->(merchandise.getGoodsType() == 1&&merchandise.getUseScope() == 2)||(merchandise.getGoodsType() == 1&&merchandise.getUseScope() == 1)||(merchandise.getGoodsType() == 4&&merchandise.getUseScope() == 2)||(merchandise.getGoodsType() == 4&&merchandise.getUseScope() == 1)||merchandise.getShopIds().contains(request.getShopId())) |
| | | .collect(Collectors.toList()); |
| | | } |
| | | } |
| | |
| | | |
| | | @Override |
| | | @Transactional |
| | | public ResultUtil productRedemptionOperation(Integer userIdFormRedis, GoodsExchangeVo exchangeType) { |
| | | public synchronized ResultUtil productRedemptionOperation(Integer userIdFormRedis, GoodsExchangeVo exchangeType) { |
| | | System.out.println("exchangeType:--->"); |
| | | |
| | | |
| | | |
| | | ReturnModel returnModel = new ReturnModel(); |
| | | Long returnId = null; |
| | |
| | | String code = sdf.format(new Date()) + UUIDUtil.getNumberRandom(5); |
| | | PointsMerchandise merchandise = mcClient.selectPointsMerchandiseById(exchangeType.getGoodId()); |
| | | |
| | | |
| | | |
| | | |
| | | if (ToolUtil.isEmpty(merchandise)){ |
| | | return ResultUtil.error("商品不存在"); |
| | | } |
| | |
| | | }else { |
| | | goodsNums = exchangeType.getNums(); |
| | | } |
| | | |
| | | TAppUser user = appUserService.getById(userIdFormRedis); |
| | | if (merchandise.getIntegral()!=null) { |
| | | if (user.getIntegral() < merchandise.getIntegral().intValue() * goodsNums) { |
| | | return new ResultUtil<>(0, "当前用户积分不足"); |
| | | } |
| | | |
| | | } |
| | | |
| | | AppUserGoodResp goodResp = new AppUserGoodResp(); |
| | | goodResp.setAppUserId(userIdFormRedis); |
| | | goodResp.setGoodId(merchandise.getId()); |
| | | int count = mcClient.queryUserHasGoodsNums(goodResp); |
| | | if (ToolUtil.isNotEmpty(count) && count >= merchandise.getPickUpQuantity()){ |
| | | if (ToolUtil.isNotEmpty(count) && count+exchangeType.getNums() > merchandise.getPickUpQuantity()){ |
| | | return ResultUtil.error("超过限领数量"); |
| | | } |
| | | int count1 = mcClient.queryUserHasGoodsNums1(goodResp); |
| | |
| | | return ResultUtil.error("超过发放数量"); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | for (int i = 0; i < goodsNums; i++) { |
| | | // 新增积分商品兑换记录 |
| | | UserPointsMerchandise pointsMerchandise = new UserPointsMerchandise(); |
| | | pointsMerchandise.setPointsMerchandiseId(exchangeType.getGoodId()); |
| | | pointsMerchandise.setUserId(userIdFormRedis); |
| | | pointsMerchandise.setStatus(1); |
| | | if (exchangeType.getGoodsType()==2){ |
| | | pointsMerchandise.setStatus(2); |
| | | pointsMerchandise.setVerificationTime(new Date()); |
| | | }else { |
| | | pointsMerchandise.setStatus(1); |
| | | } |
| | | pointsMerchandise.setState(1); |
| | | pointsMerchandise.setPayStatus(1); |
| | | if (exchangeType.getExchangeType()==1) { |
| | | pointsMerchandise.setPayStatus(2); |
| | | }else { |
| | | pointsMerchandise.setPayStatus(1); |
| | | } |
| | | if (merchandise.getUseScope() == 3){ |
| | | if (exchangeType.getGoodsType() == 2){ |
| | | CoursePackage coursePackage = cpageClient.queryCoursePackageById(merchandise.getCoursePackageId()); |
| | |
| | | packagePayment.setStatus(1); |
| | | packagePayment.setState(1); |
| | | packagePayment.setCode(code); |
| | | paymentClient.savePaymentCoursePackage(packagePayment); |
| | | // paymentClient.savePaymentCoursePackage(packagePayment); |
| | | |
| | | OrderDto orderDto = new OrderDto(); |
| | | orderDto.setAppUserId(userIdFormRedis); |
| | | String joinedString = String.join(",", exchangeType.getStuIds().stream().map(Object::toString).collect(Collectors.toList())); |
| | | orderDto.setStuIds(joinedString); |
| | | orderDto.setClassId(merchandise.getCoursePackageId()); |
| | | orderDto.setClassHours(packagePayment.getClassHours()); |
| | | paymentClient.orderClass(orderDto); |
| | | |
| | | |
| | | } |
| | | break; |
| | | case 4: |
| | |
| | | UserIntegralChanges userIntegralChanges = new UserIntegralChanges(); |
| | | userIntegralChanges.setAppUserId(appUserId); |
| | | userIntegralChanges.setOldIntegral(appUser.getIntegral()); |
| | | userIntegralChanges.setType(2); |
| | | userIntegralChanges.setType(5); |
| | | appUser.setIntegral(null == appUser.getIntegral() ? points : appUser.getIntegral() - points); |
| | | userIntegralChanges.setNewIntegral(appUser.getIntegral()); |
| | | userIntegralChanges.setInsertTime(new Date()); |
| | |
| | | |
| | | private ResultUtil AlipayPayment(BigDecimal cash, String code,Long returnId) { |
| | | System.out.println("金额:"+cash); |
| | | ResultUtil alipay = payMoneyUtil.alipay("课包续费", "课包续费", String.valueOf(returnId), code, cash.toString(), |
| | | ResultUtil alipay = payMoneyUtil.alipay("优惠卷", "优惠卷", String.valueOf(returnId), code, cash.toString(), |
| | | "/base/pointMer/exchangeGoodPaymentAliCallback"); |
| | | if(alipay.getCode() == 200){ |
| | | new Thread(new Runnable() { |
| | |
| | | String tradeNo = resultUtil.getTradeNo(); |
| | | String tradeStatus = resultUtil.getTradeStatus(); |
| | | System.out.println("ssssss"+tradeStatus); |
| | | if("REFUND".equals(tradeStatus) || "NOTPAY".equals(tradeStatus) || "CLOSED".equals(tradeStatus) || "REVOKED".equals(tradeStatus) || "PAYERROR".equals(tradeStatus) || num == 10){ |
| | | mcClient.deletePaymentRecord(code); |
| | | break; |
| | | } |
| | | |
| | | if("TRADE_SUCCESS".equals(tradeStatus)){ |
| | | for (UserPointsMerchandise userPointsMerchandise : userPointsMerchandises) { |
| | | userPointsMerchandise.setPayStatus(2); |
| | | userPointsMerchandise.setOrderNumber(tradeNo); |
| | | userPointsMerchandise.setPayType(2); |
| | | userPointsMerchandise.setInsertTime(null); |
| | | userPointsMerchandise.setUserId(null); |
| | | mcClient.updateDetailsUserPointMercase(userPointsMerchandise); |
| | | } |
| | | moneyOut(tradeNo,tradeNo); |
| | | break; |
| | | } |
| | | // if("REFUND".equals(tradeStatus) || "NOTPAY".equals(tradeStatus) || "CLOSED".equals(tradeStatus) || "REVOKED".equals(tradeStatus) || "PAYERROR".equals(tradeStatus) || num == 10){ |
| | | // mcClient.deletePaymentRecord(code); |
| | | // break; |
| | | // } |
| | | |
| | | if("WAIT_BUYER_PAY".equals(tradeStatus)){ |
| | | num++; |
| | | } |
| | |
| | | public List<PurchaseRecordVo> queryDeduRecordDetails(RecordTimeRequest timeRequest,Integer appUserId) { |
| | | List<PurchaseRecordVo> purchaseRecordVoList = new ArrayList<>(); |
| | | String time = timeRequest.getTime(); |
| | | Date monthStart = null; |
| | | Date monthEnd = null; |
| | | if (StringUtils.hasText(time)) { |
| | | monthStart = DateTimeHelper.getCurrentIdetMouthStart(time); |
| | | monthEnd = DateTimeHelper.getCurrentIdeaMouthEnd(time); |
| | | } else { |
| | | monthStart = DateTimeHelper.getCurrentMouthStart(); |
| | | monthEnd = DateTimeHelper.getCurrentMouthEnd(); |
| | | } |
| | | |
| | | SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM"); |
| | | Date startTime = DateTimeHelper.getCurrentIdetMouthStart(simpleDateFormat.format(monthStart)); |
| | | Date endTime = DateTimeHelper.getCurrentIdeaMouthEnd(simpleDateFormat.format(monthEnd)); |
| | | GetStuSourseList getStuSourseList = new GetStuSourseList(); |
| | | getStuSourseList.setStartTime(startTime); |
| | | getStuSourseList.setEndTime(endTime); |
| | | getStuSourseList.setAppUserId(appUserId); |
| | | // 报名赛事 |
| | | List<PurchaseRecordVo> stuSourseList = dcttClient.getStuSourseList(getStuSourseList); |
| | | purchaseRecordVoList.addAll(stuSourseList); |
| | | List<PurchaseRecordVo> record1 = sessionNameClient.getRecord(timeRequest); |
| | | |
| | | GetStuSessionList sessionList = new GetStuSessionList(); |
| | | sessionList.setStartTime(startTime); |
| | | sessionList.setEndTime(endTime); |
| | | sessionList.setStuId(timeRequest.getStuId()); |
| | | sessionList.setAppUserId(appUserId); |
| | | List<PurchaseRecordVo> cancelCourseList = cancelcClient.getCancelCourseList(sessionList); |
| | | |
| | | purchaseRecordVoList.addAll(cancelCourseList); |
| | | GetStuSessionList getStuSessionList = new GetStuSessionList(); |
| | | getStuSessionList.setStartTime(startTime); |
| | | getStuSessionList.setEndTime(endTime); |
| | | getStuSessionList.setStuId(timeRequest.getStuId()); |
| | | getStuSessionList.setAppUserId(appUserId); |
| | | // 购买课包 |
| | | List<PurchaseRecordVo> purchaseRecordVos = sessionNameClient.queryCourseDetails(getStuSessionList); |
| | | purchaseRecordVoList.addAll(purchaseRecordVos); |
| | | List<TAppUser> tAppUsers = tauMapper.selectList(new QueryWrapper<TAppUser>() |
| | | .eq("referralUserId",appUserId ) |
| | | .between("insertTime",startTime ,endTime)); |
| | | if (ToolUtil.isNotEmpty(tAppUsers)){ |
| | | List<Integer> userIds = tAppUsers.stream().map(TAppUser::getId).collect(Collectors.toList()); |
| | | IntrduceOfUserRequest request = new IntrduceOfUserRequest(); |
| | | request.setStartTime(startTime); |
| | | request.setEndTime(endTime); |
| | | request.setUserIds(userIds); |
| | | // 介绍有礼 |
| | | List<PurchaseRecordVo> purchaseRecordVos1 = idrClient.queryAppUsersofIntroduce(request); |
| | | purchaseRecordVoList.addAll(purchaseRecordVos1); |
| | | } |
| | | |
| | | LambdaQueryWrapper<TCourseInfoRecord> eq = new LambdaQueryWrapper<TCourseInfoRecord>().eq(TCourseInfoRecord::getUserId, appUserId); |
| | | if(timeRequest.getType()!=null){ |
| | | eq.eq(TCourseInfoRecord::getType,timeRequest.getType()); |
| | | } |
| | | if (timeRequest.getLessionId()!=null){ |
| | | eq.eq(TCourseInfoRecord::getCourseId,timeRequest.getLessionId()); |
| | | |
| | | } |
| | | // 2.0其他记录 |
| | | List<TCourseInfoRecord> list = courseInfoRecordService.list(eq); |
| | | List<PurchaseRecordVo> list1=new ArrayList<>(); |
| | | for (TCourseInfoRecord tCourseInfoRecord : list) { |
| | | PurchaseRecordVo purchaseRecordVo = new PurchaseRecordVo(); |
| | | purchaseRecordVo.setPurchaseTime(new SimpleDateFormat("MM-dd HH:mm").format(tCourseInfoRecord.getTime())); |
| | | purchaseRecordVo.setPurchaseType(tCourseInfoRecord.getName()); |
| | | if(tCourseInfoRecord.getType()==1){ |
| | | purchaseRecordVo.setPurchaseAmount("+"+tCourseInfoRecord.getNum()); |
| | | }else { |
| | | purchaseRecordVo.setPurchaseAmount("-"+tCourseInfoRecord.getNum()); |
| | | } |
| | | list1.add(purchaseRecordVo); |
| | | } |
| | | purchaseRecordVoList.addAll(list1); |
| | | |
| | | if (purchaseRecordVoList.size() > 0 ){ |
| | | purchaseRecordVoList = purchaseRecordVoList.stream() |
| | | .filter(record -> { |
| | | String fieldValue = record.getPurchaseAmount(); |
| | | if (ToolUtil.isNotEmpty(timeRequest.getType())){ |
| | | switch (timeRequest.getType()){ |
| | | case 2: |
| | | return fieldValue != null && !fieldValue.isEmpty() && fieldValue.charAt(0) == '-'; |
| | | case 1: |
| | | return fieldValue != null && !fieldValue.isEmpty() && fieldValue.charAt(0) == '+'; |
| | | default: |
| | | break; |
| | | } |
| | | } |
| | | return true; |
| | | }) |
| | | .collect(Collectors.toList()); |
| | | } |
| | | |
| | | purchaseRecordVoList = dealDataOfTime(purchaseRecordVoList); |
| | | return purchaseRecordVoList; |
| | | // |
| | | // Date monthStart = null; |
| | | // Date monthEnd = null; |
| | | // if (StringUtils.hasText(time)) { |
| | | // monthStart = DateTimeHelper.getCurrentIdetMouthStart(time); |
| | | // monthEnd = DateTimeHelper.getCurrentIdeaMouthEnd(time); |
| | | // } else { |
| | | // monthStart = DateTimeHelper.getCurrentMouthStart(); |
| | | // monthEnd = DateTimeHelper.getCurrentMouthEnd(); |
| | | // } |
| | | // |
| | | // SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM"); |
| | | // Date startTime = DateTimeHelper.getCurrentIdetMouthStart(simpleDateFormat.format(monthStart)); |
| | | // Date endTime = DateTimeHelper.getCurrentIdeaMouthEnd(simpleDateFormat.format(monthEnd)); |
| | | // GetStuSourseList getStuSourseList = new GetStuSourseList(); |
| | | // getStuSourseList.setStartTime(startTime); |
| | | // getStuSourseList.setEndTime(endTime); |
| | | // getStuSourseList.setAppUserId(appUserId); |
| | | // // 报名赛事 |
| | | // List<PurchaseRecordVo> stuSourseList = dcttClient.getStuSourseList1(getStuSourseList); |
| | | // purchaseRecordVoList.addAll(stuSourseList); |
| | | // |
| | | // GetStuSessionList sessionList = new GetStuSessionList(); |
| | | // sessionList.setStartTime(startTime); |
| | | // sessionList.setEndTime(endTime); |
| | | // sessionList.setStuId(timeRequest.getStuId()); |
| | | // sessionList.setAppUserId(appUserId); |
| | | // List<PurchaseRecordVo> cancelCourseList = cancelcClient.getCancelCourseList(sessionList); |
| | | // |
| | | // purchaseRecordVoList.addAll(cancelCourseList); |
| | | // GetStuSessionList getStuSessionList = new GetStuSessionList(); |
| | | // getStuSessionList.setStartTime(startTime); |
| | | // getStuSessionList.setEndTime(endTime); |
| | | // getStuSessionList.setStuId(timeRequest.getStuId()); |
| | | // getStuSessionList.setAppUserId(appUserId); |
| | | // // 购买课包 |
| | | // List<PurchaseRecordVo> purchaseRecordVos = sessionNameClient.queryCourseDetails(getStuSessionList); |
| | | // purchaseRecordVoList.addAll(purchaseRecordVos); |
| | | // List<TAppUser> tAppUsers = tauMapper.selectList(new QueryWrapper<TAppUser>() |
| | | // .eq("referralUserId",appUserId ) |
| | | // .between("insertTime",startTime ,endTime)); |
| | | // if (ToolUtil.isNotEmpty(tAppUsers)){ |
| | | // List<Integer> userIds = tAppUsers.stream().map(TAppUser::getId).collect(Collectors.toList()); |
| | | // IntrduceOfUserRequest request = new IntrduceOfUserRequest(); |
| | | // request.setStartTime(startTime); |
| | | // request.setEndTime(endTime); |
| | | // request.setUserIds(userIds); |
| | | // // 介绍有礼 |
| | | // List<PurchaseRecordVo> purchaseRecordVos1 = idrClient.queryAppUsersofIntroduce(request); |
| | | // purchaseRecordVoList.addAll(purchaseRecordVos1); |
| | | // } |
| | | // |
| | | // LambdaQueryWrapper<TCourseInfoRecord> eq = new LambdaQueryWrapper<TCourseInfoRecord>().eq(TCourseInfoRecord::getUserId, appUserId); |
| | | // if(timeRequest.getType()!=null){ |
| | | // eq.eq(TCourseInfoRecord::getType,timeRequest.getType()); |
| | | // } |
| | | // if (timeRequest.getLessionId()!=null){ |
| | | // eq.eq(TCourseInfoRecord::getCourseId,timeRequest.getLessionId()); |
| | | // |
| | | // } |
| | | // // 2.0其他记录 |
| | | // List<TCourseInfoRecord> list = courseInfoRecordService.list(eq); |
| | | // List<PurchaseRecordVo> list1=new ArrayList<>(); |
| | | // for (TCourseInfoRecord tCourseInfoRecord : list) { |
| | | // PurchaseRecordVo purchaseRecordVo = new PurchaseRecordVo(); |
| | | // purchaseRecordVo.setPurchaseTime(new SimpleDateFormat("MM-dd HH:mm").format(tCourseInfoRecord.getTime())); |
| | | // purchaseRecordVo.setPurchaseType(tCourseInfoRecord.getName()); |
| | | // if(tCourseInfoRecord.getType()==1){ |
| | | // purchaseRecordVo.setPurchaseAmount("+"+tCourseInfoRecord.getNum()); |
| | | // }else { |
| | | // purchaseRecordVo.setPurchaseAmount("-"+tCourseInfoRecord.getNum()); |
| | | // } |
| | | // list1.add(purchaseRecordVo); |
| | | // } |
| | | // purchaseRecordVoList.addAll(list1); |
| | | // |
| | | // if (purchaseRecordVoList.size() > 0 ){ |
| | | // purchaseRecordVoList = purchaseRecordVoList.stream() |
| | | // .filter(record -> { |
| | | // String fieldValue = record.getPurchaseAmount(); |
| | | // if (ToolUtil.isNotEmpty(timeRequest.getType())){ |
| | | // switch (timeRequest.getType()){ |
| | | // case 2: |
| | | // return fieldValue != null && !fieldValue.isEmpty() && fieldValue.charAt(0) == '-'; |
| | | // case 1: |
| | | // return fieldValue != null && !fieldValue.isEmpty() && fieldValue.charAt(0) == '+'; |
| | | // default: |
| | | // break; |
| | | // } |
| | | // } |
| | | // return true; |
| | | // }) |
| | | // .collect(Collectors.toList()); |
| | | // } |
| | | // |
| | | // purchaseRecordVoList = dealDataOfTime(purchaseRecordVoList); |
| | | return record1; |
| | | } |
| | | |
| | | @Override |
| | |
| | | coursePackagePayment.setLaveClassHours(hour); |
| | | coursePackagePayment.setOrderNumber(tradeNo); |
| | | couPayClient.updatePaymentCoursePackage(coursePackagePayment); |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | break; |
| | | } |
| | | if("WAIT_BUYER_PAY".equals(tradeStatus)){ |
| | |
| | | } |
| | | |
| | | if (ToolUtil.isNotEmpty(timeType) && timeType != 0) { |
| | | Date lastOfDate = DateUtil.getLastOfDate(); |
| | | // Date lastOfDate = DateUtil.getLastOfDate(); |
| | | Date lastOfDate = DateUtil.getDate(); |
| | | switch (timeType) { |
| | | case 1: |
| | | Date lastWeekStartDate = DateUtil.getLastWeekStartDate(); |
| | |
| | | detailsVo.setVenueList(steClient.getAppUserSiteList(storeId)); |
| | | List<StoreOfCourseVo> storeOfCourseList = culisClient.getStoreOfCourseList(storeId); |
| | | System.out.println(storeOfCourseList); |
| | | for (StoreOfCourseVo storeOfCourseVo : storeOfCourseList) { |
| | | if (storeOfCourseVo.getClassHours().equals("0")){ |
| | | storeOfCourseVo.setClassHours(null); |
| | | } |
| | | if (storeOfCourseVo.getClassStartTime().equals("-")){ |
| | | storeOfCourseVo.setClassStartTime(null); |
| | | } |
| | | } |
| | | detailsVo.setCourseVoList(storeOfCourseList); |
| | | return detailsVo; |
| | | } |
| | |
| | | detail.setConsumeName("观看教学视频"); |
| | | detail.setDetailsType(2); |
| | | break; |
| | | case 5: |
| | | detail.setConsumeAmount(""+(userIntegralChange.getNewIntegral() - userIntegralChange.getOldIntegral())); |
| | | detail.setConsumeName("智慧球场开始游戏"); |
| | | detail.setDetailsType(1); |
| | | break; |
| | | default: |
| | | break; |
| | | } |
| | |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.models.auth.In; |
| | | import org.checkerframework.checker.units.qual.A; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | |
| | | @ResponseBody |
| | | @PostMapping("/coupon/queryCouponByUser/{userId}") |
| | | public List<Integer> queryCouponByUser(@PathVariable("userId") Integer userId){ |
| | | List<Coupon> list = couponService.list(new QueryWrapper<Coupon>().eq("distributionMethod", 2).eq("userPopulation",2) |
| | | List<Coupon> list = couponService.list(new QueryWrapper<Coupon>().eq("distributionMethod", 2) |
| | | .le("startTime", new Date()).ge("endTime", new Date()).eq("auditStatus", 2) |
| | | .eq("state", 1)); |
| | | |
| | |
| | | } |
| | | |
| | | |
| | | @Autowired |
| | | private UserCouponService userCouponService; |
| | | @ResponseBody |
| | | @PostMapping("/coupon/queryCouponByUid") |
| | | public List<Coupon> queryCouponByUid(@RequestBody Integer uid){ |
| | | try { |
| | | LocalDateTime currentTime = LocalDateTime.now(); |
| | | LocalDateTime oneMinuteAgo = currentTime.minusSeconds(20); |
| | | |
| | | List<UserCoupon> list = userCouponService.list(new QueryWrapper<UserCoupon>().eq("userId", uid).ge("insertTime", oneMinuteAgo)); |
| | | List<Integer> ids = new ArrayList<>(); |
| | | for (UserCoupon userCoupon : list) { |
| | | ids.add(userCoupon.getCouponId()); |
| | | } |
| | | |
| | | if (ids.size()>0){ |
| | | List<Coupon> userId = couponService.list(new QueryWrapper<Coupon>().in("id",ids)); |
| | | return userId; |
| | | |
| | | } |
| | | |
| | | return null; |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 我的券包列表 |
| | | * @param req |
| | |
| | | |
| | | @PostMapping("/base/introduce/getGiftList") |
| | | public Integer getGiftList(@RequestBody String cityCode){ |
| | | List<IntroduceRewards> list = idrService.list(new LambdaQueryWrapper<IntroduceRewards>().eq(IntroduceRewards::getCityCode,cityCode).ge(IntroduceRewards::getStartTime,new Date()).le(IntroduceRewards::getEndTime,new Date())); |
| | | List<IntroduceRewards> list = idrService.list(new LambdaQueryWrapper<IntroduceRewards>().eq(IntroduceRewards::getCityCode,cityCode).le(IntroduceRewards::getStartTime,new Date()).ge(IntroduceRewards::getEndTime,new Date())); |
| | | int sum = list.stream().mapToInt(IntroduceRewards::getGiveClass).sum(); |
| | | return sum; |
| | | } |
| | |
| | | import com.dsh.activity.util.StrUtils; |
| | | import com.dsh.activity.util.TokenUtil; |
| | | import com.dsh.activity.util.ToolUtil; |
| | | import io.swagger.models.auth.In; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/base/pointMerchars/convertGoods") |
| | | public List<IntegralCommodity> getConvertibleGoods(){ |
| | | public List<IntegralCommodity> getConvertibleGoods(@RequestBody Location location) throws Exception { |
| | | List<IntegralCommodity> commodity = new ArrayList<>(); |
| | | List<PointsMerchandise> merchandises = pmdsService.list(new QueryWrapper<PointsMerchandise>() |
| | | .eq("state",1) |
| | | .eq("shelves",1) |
| | | .gt("endTime",new Date())); |
| | | if (merchandises.size() > 0){ |
| | | for (PointsMerchandise merchandise : merchandises) { |
| | | IntegralCommodity integralCommodity = new IntegralCommodity(); |
| | | integralCommodity.setCommodityId(merchandise.getId()); |
| | | integralCommodity.setCommodityImg(merchandise.getCover()); |
| | | integralCommodity.setCommodityName(merchandise.getName()); |
| | | integralCommodity.setCommodityPrice(merchandise.getPrice()); |
| | | integralCommodity.setGoodsType(merchandise.getType()); |
| | | commodity.add(integralCommodity); |
| | | |
| | | Map<String, String> geocode = gdMapGeocodingUtil.geocode(location.getLon(), location.getLat()); |
| | | String provinceCode = geocode.get("provinceCode"); |
| | | String cityCode = geocode.get("cityCode"); |
| | | |
| | | |
| | | List<PointsMerchandiseCity> cityCode1 = pmdsCityService.list(new QueryWrapper<PointsMerchandiseCity>().eq("cityCode", cityCode)); |
| | | List<Integer> cIds = new ArrayList<>(); |
| | | for (PointsMerchandiseCity pointsMerchandiseCity : cityCode1) { |
| | | cIds.add(pointsMerchandiseCity.getPointsMerchandiseId()); |
| | | } |
| | | |
| | | if (cIds.size()>0) { |
| | | |
| | | List<PointsMerchandise> merchandises = pmdsService.list(new QueryWrapper<PointsMerchandise>() |
| | | .eq("state", 1) |
| | | .eq("shelves", 1).in("id", cIds) |
| | | .gt("endTime", new Date())); |
| | | if (merchandises.size() > 0){ |
| | | for (PointsMerchandise merchandise : merchandises) { |
| | | IntegralCommodity integralCommodity = new IntegralCommodity(); |
| | | integralCommodity.setCommodityId(merchandise.getId()); |
| | | integralCommodity.setCommodityImg(merchandise.getCover()); |
| | | integralCommodity.setCommodityName(merchandise.getName()); |
| | | integralCommodity.setCommodityPrice(merchandise.getPrice()); |
| | | integralCommodity.setGoodsType(merchandise.getType()); |
| | | commodity.add(integralCommodity); |
| | | } |
| | | } |
| | | } |
| | | |
| | | System.out.println(commodity); |
| | | return commodity; |
| | | } |
| | |
| | | |
| | | // detailsVo.setGoodId(coursePackage.getId()); |
| | | detailsVo.setGoodId(merchandise.getId()); |
| | | List<String> list1 = new ArrayList<>(); |
| | | list1.add(coursePackage.getCoverDrawing()); |
| | | list1.addAll(Arrays.asList(StrUtils.splitStr2StrArr(coursePackage.getDetailDrawing(), ","))); |
| | | detailsVo.setPics(list1); |
| | | // List<String> list1 = new ArrayList<>(); |
| | | // list1.add(coursePackage.getCoverDrawing()); |
| | | // list1.addAll(Arrays.asList(StrUtils.splitStr2StrArr(coursePackage.getDetailDrawing(), ","))); |
| | | |
| | | String productImages = merchandise.getProductImages(); |
| | | String[] list1 = productImages.split(","); |
| | | detailsVo.setPics(Arrays.asList(list1)); |
| | | Collections.sort(detailsVo.getPics(), (s1, s2) -> { |
| | | if (s1.equals(coursePackage.getCoverDrawing())) { |
| | | return -1; // s1排在前面 |
| | |
| | | List<ExchangeDetailsResponse> responses = new ArrayList<>(); |
| | | SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd"); |
| | | List<UserPointsMerchandise> pointsMerchandises = upmseService.list(new QueryWrapper<UserPointsMerchandise>() |
| | | .eq("userId",appUserId )); |
| | | .eq("userId",appUserId ).eq("payStatus",2)); |
| | | |
| | | |
| | | List<UserCoupon> userCoupons = userCouponService.list(new QueryWrapper<UserCoupon>().eq("userId", appUserId)); |
| | | |
| | | |
| | | List<Coupon> list1 = couponService.list(); |
| | | List<Integer> ids = new ArrayList<>(); |
| | | for (Coupon coupon : list1) { |
| | | if (coupon.getDistributionMethod()==1) { |
| | | ids.add(coupon.getId()); |
| | | } |
| | | } |
| | | List<UserCoupon> userCoupons = new ArrayList<>(); |
| | | if (ids.size()>0) { |
| | | userCoupons = userCouponService.list(new QueryWrapper<UserCoupon>().eq("userId", appUserId).in("couponId", ids)); |
| | | } |
| | | if (pointsMerchandises.size() > 0 ){ |
| | | for (UserPointsMerchandise pointsMerchandise : pointsMerchandises) { |
| | | PointsMerchandise merchandise = pmdsService.getById(pointsMerchandise.getPointsMerchandiseId()); |
| | |
| | | |
| | | if (userCoupons.size()>0){ |
| | | for (UserCoupon userCoupon : userCoupons) { |
| | | |
| | | Coupon c = couponService.getById(userCoupon.getCouponId()); |
| | | if (c==null){ |
| | | if (c==null|| c.getRedemptionMethod()==null){ |
| | | continue; |
| | | } |
| | | |
| | |
| | | @ResponseBody |
| | | @PostMapping("/base/pointMerchars/getSpecificsOfGoods") |
| | | public PointDetailsVo getSpecificsOfGoods(@RequestBody Long speMercharsId){ |
| | | SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd"); |
| | | SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd"); |
| | | PointDetailsVo detailsVo = new PointDetailsVo(); |
| | | UserPointsMerchandise byId = upmseService.getById(speMercharsId); |
| | | |
| | |
| | | PointsMerchandise pmdsServiceById = pmdsService.getById(byId.getPointsMerchandiseId()); |
| | | // 2.0 |
| | | detailsVo.setCardType(pmdsServiceById.getCardType()); |
| | | detailsVo.setExchangeAddrType(pmdsServiceById.getUseScope()); |
| | | detailsVo.setExchangeType(pmdsServiceById.getRedemptionMethod()); |
| | | detailsVo.setGoodType(pmdsServiceById.getType()); |
| | | if (pmdsServiceById.getRedemptionMethod() == 1){ |
| | |
| | | detailsVo.setBelongs(pmdsServiceById.getProvince()+pmdsServiceById.getCity()); |
| | | break; |
| | | case 3: |
| | | StoreDetailOfCourse courseOfStore = stoClient.getCourseOfStore(byId.getStoreId()); |
| | | detailsVo.setBelongs(courseOfStore.getStoreName()+" "+courseOfStore.getStoreAddr()); |
| | | // StoreDetailOfCourse courseOfStore = stoClient.getCourseOfStore(byId.getStoreId()); |
| | | // detailsVo.setBelongs(courseOfStore.getStoreName()+" "+courseOfStore.getStoreAddr()); |
| | | // detailsVo.setBelongs("---------------"); |
| | | break; |
| | | default: |
| | | break; |
| | |
| | | |
| | | |
| | | @PostMapping("/base/pointMerchars/updateDetailsUserPointMercase") |
| | | public void updateDetailsUserPointMercase(@RequestBody UserPointsMerchandise merchandise){ |
| | | public void updateDetailsUserPointMercase(@RequestBody UserPointsMerchandise merchandise){ |
| | | merchandise.setUserId(null); |
| | | merchandise.setPointsMerchandiseId(null); |
| | | upmseService.updateById(merchandise); |
| | | } |
| | | |
| | |
| | | String couponIds = sendCouponReq.getCouponIds(); |
| | | for (String s : couponIds.split(",")) { |
| | | Coupon coupon = couponService.getById(s); |
| | | if (new Date().before(coupon.getStartTime())&&new Date().after(coupon.getEndTime())){ |
| | | continue; |
| | | } |
| | | //查询该优惠卷的数量够不够 |
| | | List<Integer> queryIds = new ArrayList<>(); |
| | | queryIds.add(coupon.getId()); |
New file |
| | |
| | | package com.dsh.activity.entity; |
| | | |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class Location { |
| | | private String lon; |
| | | private String lat; |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.baomidou.mybatisplus.extension.activerecord.Model; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.experimental.Accessors; |
| | |
| | | * 核销时间 |
| | | */ |
| | | @TableField("verificationTime") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date verificationTime; |
| | | /** |
| | | * 状态(1=待核销,2=已核销) |
| | |
| | | |
| | | private Integer cardType; |
| | | |
| | | @ApiModelProperty(value = "使用范围") |
| | | private Integer exchangeAddrType; |
| | | |
| | | } |
| | |
| | | public StoreInfoDto getStoreInfo(@RequestBody Integer id); |
| | | |
| | | @PostMapping("/base/protocol/storeDetail/courseOfSto") |
| | | StoreDetailOfCourse getCourseOfStore(@RequestParam("storeId") Integer storeId); |
| | | StoreDetailOfCourse getCourseOfStore(@RequestBody Integer storeId); |
| | | |
| | | |
| | | @PostMapping("/store/queryStoreByIds") |
| | |
| | | * 获取福利课程列表 |
| | | * @param uid |
| | | * @param classificationId |
| | | * @param pageSize |
| | | * @param pageNo |
| | | * @param offset |
| | | * @param limit |
| | | * @return |
| | | */ |
| | | List<Map<String, Object>> queryBenefitsVideosList(@Param("uid") Integer uid, @Param("classificationId") Integer classificationId, |
| | | @Param("ids") List<Integer> ids, @Param("pageSize") Integer pageSize, @Param("pageNo") Integer pageNo); |
| | | @Param("ids") List<Integer> ids, @Param("offset") Integer offset, @Param("limit") Integer limit); |
| | | |
| | | List<BenefitsVideos> getBenefitVideoById(@Param("id")Integer id); |
| | | |
| | |
| | | if (collect.size() > 0) { |
| | | benefitsVideosQueryWrapper.notIn("id", collect); |
| | | } |
| | | List<BenefitsVideos> list1 = this.list(benefitsVideosQueryWrapper.orderByDesc("insertTime").last(" limit 0, 4")); |
| | | List<BenefitsVideos> list1 = this.list(benefitsVideosQueryWrapper.eq("state",1).orderByDesc("insertTime").last(" limit 0, 4")); |
| | | List<BenefitsVideosListVo> lists = new ArrayList<>(); |
| | | for (BenefitsVideos benefitsVideos : list1) { |
| | | if (benefitsVideos.getState()==1) { |
| | |
| | | List<Course> courses = courseClient.queryCourseByName(search); |
| | | ids = courses.stream().map(Course::getId).collect(Collectors.toList()); |
| | | } |
| | | int offset = (pageNo - 1) * pageSize; |
| | | int limit = pageSize; |
| | | |
| | | List<Map<String, Object>> benefitsVideos = this.baseMapper.queryBenefitsVideosList(uid, classificationId, ids, pageSize, pageNo); |
| | | |
| | | List<Map<String, Object>> benefitsVideos = this.baseMapper.queryBenefitsVideosList(uid, classificationId, ids, offset, limit); |
| | | List<BenefitsVideosListVo> lists = new ArrayList<>(); |
| | | for (Map<String, Object> benefitsVideo : benefitsVideos) { |
| | | Integer id = Integer.valueOf(benefitsVideo.get("id").toString()); |
| | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.dsh.activity.entity.Coupon; |
| | | import com.dsh.activity.entity.TStudent; |
| | | import com.dsh.activity.entity.UserCoupon; |
| | | import com.dsh.activity.feignclient.account.AppUserClient; |
| | | import com.dsh.activity.feignclient.account.StudentClient; |
| | | import com.dsh.activity.feignclient.account.model.AppUser; |
| | |
| | | import com.dsh.activity.model.CouponListVo; |
| | | import com.dsh.activity.model.request.IntegralGoodsOfSearch; |
| | | import com.dsh.activity.service.ICouponService; |
| | | import com.dsh.activity.service.UserCouponService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.text.SimpleDateFormat; |
| | | import java.time.LocalDateTime; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | |
| | | |
| | | |
| | | |
| | | @Autowired |
| | | private UserCouponService userCouponService; |
| | | |
| | | @Autowired |
| | | private ICouponService couponService; |
| | | |
| | | /** |
| | | * 获取购买会员支付成功页面的优惠券 |
| | |
| | | AppUser appUser = appUserClient.queryAppUser(uid); |
| | | List<CouponListVo> listVos = new ArrayList<>(); |
| | | if (null != appUser) { |
| | | List<Integer> userPopulation = new ArrayList<>(); |
| | | userPopulation.add(1);//全部用户 |
| | | if (1 == appUser.getIsVip()) { |
| | | userPopulation.add(2);//年度会员 |
| | | } |
| | | List<TStudent> students = studentClient.queryStudentList(uid); |
| | | if (students.size() > 0) { |
| | | userPopulation.add(3);//已有学员用户 |
| | | } |
| | | // List<Integer> userPopulation = new ArrayList<>(); |
| | | // userPopulation.add(1);//全部用户 |
| | | // if (1 == appUser.getIsVip()) { |
| | | // userPopulation.add(2);//年度会员 |
| | | // } |
| | | // List<TStudent> students = studentClient.queryStudentList(uid); |
| | | // if (students.size() > 0) { |
| | | // userPopulation.add(3);//已有学员用户 |
| | | // } |
| | | |
| | | |
| | | // List<Coupon> list = this.list(new QueryWrapper<Coupon>().eq("distributionMethod", distributionMethod) |
| | | // .in("userPopulation", userPopulation) |
| | | // .eq("auditStatus", 2).eq("status", 2).eq("state", 1) |
| | | // .last(" and now() between startTime and endTime order by insertTime desc")); |
| | | |
| | | |
| | | List<Coupon> list = this.list(new QueryWrapper<Coupon>().eq("distributionMethod", 2).eq("userPopulation",2) |
| | | .le("startTime", new Date()).ge("endTime", new Date()).eq("auditStatus", 2) |
| | | .eq("state", 1)); |
| | | // List<Coupon> list = this.list(new QueryWrapper<Coupon>().eq("distributionMethod", 2).eq("userPopulation",2) |
| | | // .le("startTime", new Date()).ge("endTime", new Date()).eq("auditStatus", 2) |
| | | // .eq("state", 1)); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
| | | for (Coupon coupon : list) { |
| | | |
| | | |
| | | |
| | | LocalDateTime currentTime = LocalDateTime.now(); |
| | | LocalDateTime oneMinuteAgo = currentTime.minusSeconds(30); |
| | | |
| | | List<UserCoupon> list = userCouponService.list(new QueryWrapper<UserCoupon>().eq("userId", uid).ge("insertTime", oneMinuteAgo)); |
| | | List<Integer> ids = new ArrayList<>(); |
| | | for (UserCoupon userCoupon : list) { |
| | | ids.add(userCoupon.getCouponId()); |
| | | } |
| | | |
| | | // if (ids.size()>0){ |
| | | List<Coupon> userId = couponService.list(new QueryWrapper<Coupon>().in("id",ids)); |
| | | // return userId; |
| | | // |
| | | // } |
| | | |
| | | |
| | | for (Coupon coupon : userId) { |
| | | CouponListVo couponListVo = new CouponListVo(); |
| | | couponListVo.setId(coupon.getId().longValue()); |
| | | couponListVo.setName(coupon.getName()); |
| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.dsh.activity.entity.Coupon; |
| | | import com.dsh.activity.entity.CouponCity; |
| | | import com.dsh.activity.entity.CouponStore; |
| | | import com.dsh.activity.entity.UserCoupon; |
| | | import com.dsh.activity.feignclient.account.AppUserClient; |
| | |
| | | import com.dsh.activity.feignclient.other.StoreClient; |
| | | import com.dsh.activity.feignclient.other.model.Site; |
| | | import com.dsh.activity.feignclient.other.model.StoreDetailOfCourse; |
| | | import com.dsh.activity.mapper.CouponCityMapper; |
| | | import com.dsh.activity.mapper.CouponMapper; |
| | | import com.dsh.activity.mapper.CouponStoreMapper; |
| | | import com.dsh.activity.mapper.UserCouponMapper; |
| | |
| | | private CouponMapper couponMapper; |
| | | |
| | | @Resource |
| | | private CouponCityMapper couponCityMapper; |
| | | |
| | | @Resource |
| | | private StoreClient storeClient; |
| | | |
| | | @Resource |
| | |
| | | if(price.compareTo(num1) < 0){ |
| | | continue; |
| | | } |
| | | couponListVo.setUseCondition("满" + num1 + "元可用"); |
| | | couponListVo.setUseCondition("满¥" + num1 + "元可用"); |
| | | couponListVo.setFavorable(jsonObject.getString("deductionAmount")); |
| | | } |
| | | if (type == 2) {//代金券{"num1":1} |
| | | JSONObject jsonObject = JSON.parseObject(content); |
| | | Double num1 = jsonObject.getDouble("deductionAmount"); |
| | | Double num1 = jsonObject.getDouble("conditionalAmount"); |
| | | if(num1==null){ |
| | | num1=0d; |
| | | } |
| | |
| | | break; |
| | | case 2: |
| | | packageResp.setAvailable("指定城市可用"); |
| | | packageResp.setCityOrStore(""); |
| | | List<CouponCity> couponId = couponCityMapper.selectList(new QueryWrapper<CouponCity>().eq("couponId", coupon.getId())); |
| | | StringBuilder stringBuilder = new StringBuilder(); |
| | | for (CouponCity couponCity : couponId) { |
| | | stringBuilder.append(couponCity.getCity()); |
| | | } |
| | | packageResp.setCityOrStore(String.valueOf(stringBuilder)); |
| | | break; |
| | | case 3: |
| | | packageResp.setAvailable("指定门店可用"); |
| | | CouponStore couponStore = csMapper.selectOne(new QueryWrapper<CouponStore>() |
| | | .eq("couponId",coupon.getId())); |
| | | StoreDetailOfCourse courseOfStore = storeClient.getCourseOfStore(couponStore.getStoreId()); |
| | | packageResp.setCityOrStore(courseOfStore.getStoreName()+","+courseOfStore.getStoreAddr()); |
| | | // packageResp.setCityOrStore(courseOfStore.getStoreName()+","+courseOfStore.getStoreAddr()); |
| | | packageResp.setCityOrStore(courseOfStore.getStoreName()); |
| | | break; |
| | | default: |
| | | break; |
| | |
| | | </foreach> |
| | | </if> |
| | | order by insertTime desc) |
| | | LIMIT #{limit} OFFSET #{offset} |
| | | </select> |
| | | <select id="getBenefitVideoById" resultType="com.dsh.activity.entity.BenefitsVideos"> |
| | | select * from t_benefits_videos where |
| | |
| | | public ResultUtil<List<CompetitionListVo>> queryCompetitionList(String cityCode, String content, Integer registerCondition, String heat){ |
| | | try { |
| | | List<CompetitionListVo> competitionListVos = cttService.queryCompetitionList(cityCode, content, registerCondition, heat); |
| | | return ResultUtil.success(competitionListVos); |
| | | List<CompetitionListVo> filteredList = competitionListVos.stream() |
| | | .filter(vo -> vo.getStatus() == 1 || vo.getStatus() == 2) |
| | | .collect(Collectors.toList()); |
| | | |
| | | return ResultUtil.success(filteredList); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | CompetitionInfo competitionInfo = cttService.queryCompetitionInfo(uid, id, lon, lat); |
| | | |
| | | |
| | | String dateString = competitionInfo.getRegisterEndTime(); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm"); |
| | | Date date = sdf.parse(dateString); |
| | | if (new Date().after(date)){ |
| | | competitionInfo.setHasPass(1); |
| | | }else { |
| | | competitionInfo.setHasPass(0); |
| | | |
| | | } |
| | | |
| | | |
| | | return ResultUtil.success(competitionInfo); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | if (byId.getRegisterCondition()==3){ |
| | | Integer counts = coursePackagePaymentClient.isHave(uid); |
| | | Integer counts = coursePackagePaymentClient.isHave(paymentCompetitionVo.getIds()); |
| | | if (counts==0){ |
| | | return new ResultUtil(0,"当前赛事仅限已购课学员报名"); |
| | | } |
| | |
| | | package com.dsh.competition.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.dsh.competition.entity.Participant; |
| | | import com.dsh.competition.entity.UserCompetition; |
| | | import com.dsh.competition.feignclient.account.AppUserClient; |
| | | import com.dsh.competition.feignclient.account.StudentClient; |
| | | import com.dsh.competition.feignclient.account.model.AppUser; |
| | |
| | | import com.dsh.competition.model.ParticipantVo; |
| | | import com.dsh.competition.model.SaveParticipant; |
| | | import com.dsh.competition.service.IParticipantService; |
| | | import com.dsh.competition.service.UserCompetitionService; |
| | | import com.dsh.competition.util.JuHeUtil; |
| | | import com.dsh.competition.util.ResultUtil; |
| | | import com.dsh.competition.util.TokenUtil; |
| | | import com.dsh.competition.util.ToolUtil; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | |
| | | |
| | | |
| | | if (numDigits==9){ |
| | | return participantService.editParticipant(uid, editParticipant); |
| | | Participant byId = participantService.getById(editParticipant.getId()); |
| | | editParticipant.setName(byId.getName()); |
| | | return participantService.editParticipant(uid, editParticipant); |
| | | } |
| | | else { |
| | | |
| | | |
| | | TStudent student = new TStudent(); |
| | | student.setId(editParticipant.getId()); |
| | | student.setName(editParticipant.getName()); |
| | | |
| | | TStudent student1 = studentClient.queryById(editParticipant.getId()); |
| | | student.setName(student1.getName()); |
| | | student.setIdCard(editParticipant.getIdcard()); |
| | | student.setHeight(Double.valueOf(editParticipant.getHeight())); |
| | | student.setWeight(editParticipant.getWeight()); |
| | | if (editParticipant.getHeight()!=null) { |
| | | student.setHeight(Double.valueOf(editParticipant.getHeight())); |
| | | } |
| | | |
| | | if (editParticipant.getWeight()!=null) { |
| | | student.setWeight(editParticipant.getWeight()); |
| | | } |
| | | |
| | | if(ToolUtil.isNotEmpty(student.getName()) && ToolUtil.isNotEmpty(student.getIdCard())){ |
| | | Boolean aBoolean = JuHeUtil.idcardAuthentication(student.getIdCard(), student.getName()); |
| | | if(!aBoolean){ |
| | | return ResultUtil.error("身份证和姓名不匹配"); |
| | | } |
| | | } |
| | | |
| | | |
| | | student.setPhone(editParticipant.getPhone()); |
| | | studentClient.updateAppUser(student); |
| | | return ResultUtil.success(); |
| | |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | @Autowired |
| | | private UserCompetitionService userCompetitionService; |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/participant/counts") |
| | | public Integer counts(@RequestBody Integer stuId){ |
| | | return userCompetitionService.count(new QueryWrapper<UserCompetition>().eq("participantId",stuId)); |
| | | } |
| | | } |
| | |
| | | |
| | | @PostMapping("/student/queryStudentList") |
| | | List<TStudent> queryStudentList(@RequestBody Integer appUserId); |
| | | @PostMapping("/student/queryById") |
| | | TStudent queryById(Integer id); |
| | | } |
| | |
| | | List<PayCourseRes> paymentCompetitionCourseList(String s); |
| | | |
| | | @PostMapping("/coursePackagePayment/isHave") |
| | | |
| | | Integer isHave(Integer uid); |
| | | Integer isHave(String ids); |
| | | } |
| | |
| | | |
| | | void taskSetStatusEnd(); |
| | | |
| | | Integer counts(@Param("id")Long id); |
| | | |
| | | void deleteTenMinutes(); |
| | | } |
| | |
| | | private Double payMoney; |
| | | @ApiModelProperty("支付方式(1=微信,2=支付宝,3=玩湃币,4=课时)") |
| | | private Integer payType; |
| | | @ApiModelProperty("是否需要实名(0=否,1=是)") |
| | | private Integer isReal; |
| | | @ApiModelProperty("门店信息") |
| | | private List<Map<String,Object>> storeInfos; |
| | | |
| | | @ApiModelProperty("是否已过报名时间0否,1是") |
| | | private Integer hasPass; |
| | | } |
| | |
| | | import com.dsh.competition.feignclient.account.model.Student; |
| | | import com.dsh.competition.feignclient.course.CoursePackagePaymentClient; |
| | | import com.dsh.competition.feignclient.course.model.PaymentDeductionClassHour; |
| | | import com.dsh.competition.feignclient.model.CompetitionUser; |
| | | import com.dsh.competition.feignclient.other.StoreClient; |
| | | import com.dsh.competition.feignclient.other.model.Store; |
| | | import com.dsh.competition.mapper.CompetitionMapper; |
| | |
| | | public List<CompetitionListVo> queryCompetitionList(String cityCode, String content, Integer registerCondition, String heat) throws Exception { |
| | | List<CompetitionListVo> competitionListVos = this.baseMapper.queryCompetitionList(cityCode, content, registerCondition, heat); |
| | | |
| | | |
| | | for (CompetitionListVo competitionListVo : competitionListVos) { |
| | | Integer counts = this.baseMapper.counts(competitionListVo.getId()); |
| | | competitionListVo.setHeat(competitionListVo.getHeat()+counts); |
| | | } |
| | | |
| | | |
| | | return competitionListVos; |
| | |
| | | // 2.0 |
| | | ArrayList<Map<String,Object>> objects = new ArrayList<>(); |
| | | if(null != competition.getStoreId()){ |
| | | |
| | | String storeId = competition.getStoreId(); |
| | | for (String s : storeId.split(",")) { |
| | | HashMap<String, Object> map = new HashMap<>(); |
| | |
| | | |
| | | competitionInfo.setRegisterEndTime(sdf.format(competition.getRegisterEndTime())); |
| | | competitionInfo.setStartTime(sdf.format(competition.getStartTime())); |
| | | competitionInfo.setIsReal(competition.getRealName()); |
| | | competitionInfo.setEndTime(sdf.format(competition.getEndTime())); |
| | | competitionInfo.setAge(competition.getStartAge() + "-" + competition.getEndAge()); |
| | | competitionInfo.setProvince(competition.getProvince()); |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 赛事报名 |
| | | * @param uid |
| | |
| | | AppUser appUser = appUserClient.queryAppUser(uid); |
| | | String[] split = paymentCompetitionVo.getIds().split(";"); |
| | | Competition competition = this.getById(paymentCompetitionVo.getId()); |
| | | if ((competition.getBaseNumber()+split.length)>competition.getApplicantsNumber()){ |
| | | int competitionId = userCompetitionService.count(new QueryWrapper<UserCompetition>().eq("competitionId", paymentCompetitionVo.getId())); |
| | | if ((competitionId+split.length)>competition.getApplicantsNumber()){ |
| | | return ResultUtil.error("报名人数超过最大限制"); |
| | | |
| | | } |
| | | BigDecimal money = null; |
| | | if(paymentCompetitionVo.getPayType() == 1 || paymentCompetitionVo.getPayType() == 2){ |
| | |
| | | if(paymentCompetitionVo.getPayType() == 3){//玩湃币 |
| | | money = new BigDecimal(competition.getPlayPaiCoin()).multiply(new BigDecimal(split.length)).setScale(2, RoundingMode.HALF_EVEN); |
| | | if(money.compareTo(new BigDecimal(appUser.getPlayPaiCoins())) > 0){ |
| | | return ResultUtil.error("报名失败,玩湃币不足,请充值"); |
| | | |
| | | return new ResultUtil(2,"报名失败,玩湃币不足,请充值"); |
| | | } |
| | | } |
| | | if(paymentCompetitionVo.getPayType() == 4){//课程 |
| | |
| | | // 2.0 |
| | | Integer integer = coursePackagePaymentClient.queryResidueClassHourById(paymentCompetitionVo.getCoursePaymentId()); |
| | | if(new BigDecimal(integer).compareTo(new BigDecimal(competition.getClassPrice())) < 0){ |
| | | return ResultUtil.error( "剩余课时不足,无法完成支付。"); |
| | | return new ResultUtil(3,"剩余课时不足,无法完成支付。"); |
| | | |
| | | } |
| | | } |
| | | } |
| | |
| | | paymentCompetition.setPayOrderNo(""); |
| | | paymentCompetitionService.updateById(paymentCompetition); |
| | | |
| | | competition.setApplicantsNumber(competition.getApplicantsNumber() + 1); |
| | | // competition.setApplicantsNumber(competition.getApplicantsNumber() + 1); |
| | | this.updateById(competition); |
| | | } |
| | | if(paymentCompetitionVo.getPayType() == 4){//课程 |
| | |
| | | public void taskSetStatus() { |
| | | this.baseMapper.taskSetStatusStart(); |
| | | this.baseMapper.taskSetStatusEnd(); |
| | | this.baseMapper.deleteTenMinutes(); |
| | | } |
| | | |
| | | @Override |
| | |
| | | public List<ParticipantVo> queryParticipantList(Integer uid) throws Exception { |
| | | //拿到学员列表 |
| | | List<TStudent> tStudents = studentClient.queryStudentList(uid); |
| | | |
| | | List<ParticipantVo> listVo1 = new ArrayList<>(); |
| | | |
| | | //利用HashMap去重身份证 |
| | | LinkedHashMap<String,ParticipantVo> linkedHashMap =new LinkedHashMap<>(); |
| | | SimpleDateFormat sdf_year = new SimpleDateFormat("yyyy"); |
| | |
| | | } |
| | | participantVo.setGender(tStudent.getSex()); |
| | | participantVo.setIsStudent(1); |
| | | if (tStudent.getIdCard()==null|| tStudent.getIdCard().isEmpty()){ |
| | | listVo1.add(participantVo); |
| | | continue; |
| | | } |
| | | linkedHashMap.put(tStudent.getIdCard(),participantVo); |
| | | } |
| | | |
| | |
| | | participantVo.setBirthday(format); |
| | | } |
| | | participantVo.setGender(participant.getGender()); |
| | | |
| | | if (participant.getIdcard()==null|| participant.getIdcard().isEmpty()){ |
| | | listVo1.add(participantVo); |
| | | continue; |
| | | } |
| | | linkedHashMap.put(participant.getIdcard(),participantVo); |
| | | listVo.add(participantVo); |
| | | // listVo.add(participantVo); |
| | | |
| | | } |
| | | |
| | | listVo1.addAll(linkedHashMap.values()); |
| | | |
| | | |
| | | |
| | | List<ParticipantVo> listVo1 = new ArrayList<>(linkedHashMap.values()); |
| | | // List<ParticipantVo> listVo1 = new ArrayList<>(linkedHashMap.values()); |
| | | |
| | | |
| | | return listVo1; |
| | |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | |
| | | competitionInfo.setAge(competition.getStartAge() + "-" + competition.getEndAge()); |
| | | competitionInfo.setProvince(competition.getEntryProvince()); |
| | | competitionInfo.setCity(competition.getEntryCity()); |
| | | competitionInfo.setAddress(competition.getEntryAddress()); |
| | | |
| | | String str = competition.getAddress(); |
| | | str = str.substring(str.indexOf("省") + 1); |
| | | |
| | | // 去掉第一个“市”及之前的字符串 |
| | | str = str.substring(str.indexOf("市") + 1); |
| | | |
| | | // 去掉第一个“区”及之前的字符串 |
| | | str = str.substring(str.indexOf("区") + 1); |
| | | |
| | | |
| | | competitionInfo.setAddress(str); |
| | | competitionInfo.setCashPrice(competition.getCashPrice()); |
| | | competitionInfo.setPlayPaiCoin(competition.getPlayPaiCoin()); |
| | | competitionInfo.setClassPrice(competition.getClassPrice()); |
| | | competitionInfo.setIntroduction(competition.getIntroduction()); |
| | | competitionInfo.setRegistrationNotes(competition.getRegistrationNotes()); |
| | | competitionInfo.setApply(1); |
| | | ArrayList<Map<String,Object>> objects = new ArrayList<>(); |
| | | |
| | | if(null != competition.getStoreId()){ |
| | | String storeId = competition.getStoreId(); |
| | | for (String s : storeId.split(",")) { |
| | | HashMap<String, Object> map = new HashMap<>(); |
| | | Store store1 = storeClient.queryStoreById(Integer.valueOf(s)); |
| | | map.put("name",store1.getName()); |
| | | |
| | | |
| | | String str1 = store1.getAddress(); |
| | | str1 = str1.substring(str1.indexOf("省") + 1); |
| | | |
| | | // 去掉第一个“市”及之前的字符串 |
| | | str1 = str1.substring(str1.indexOf("市") + 1); |
| | | |
| | | // 去掉第一个“区”及之前的字符串 |
| | | str1 = str1.substring(str1.indexOf("区") + 1); |
| | | |
| | | map.put("address",str1); |
| | | map.put("storeLon",store.getLon()); |
| | | map.put("storeLat",store.getLat()); |
| | | map.put("storeCoverDrawing",store.getCoverDrawing()); |
| | | // if(ToolUtil.isNotEmpty(lon) && ToolUtil.isNotEmpty(lat)){ |
| | | // Map<String, Double> distance = GeodesyUtil.getDistance(lon + "," + lat, store.getLon() + "," + store.getLat()); |
| | | // double wgs84 = new BigDecimal(distance.get("WGS84")).divide(new BigDecimal(1000)).setScale(2, RoundingMode.HALF_EVEN).doubleValue(); |
| | | // map.put("distance",wgs84); |
| | | // } |
| | | objects.add(map); |
| | | } |
| | | |
| | | } |
| | | competitionInfo.setStoreInfos(objects); |
| | | |
| | | |
| | | |
| | | List<ParticipantVo> participant = new ArrayList<>(); |
| | | List<UserCompetition> list = userCompetitionService.list(new QueryWrapper<UserCompetition>().eq("paymentCompetitionId", paymentCompetition.getId())); |
| | | List<Integer> collect = list.stream().map(UserCompetition::getParticipantId).collect(Collectors.toList()); |
| | |
| | | participantVo.setIdcard(participant1.getIdcard()); |
| | | Integer age = Integer.valueOf(sdf_year.format(new Date())) - Integer.valueOf(sdf_year.format(participant1.getBirthday())); |
| | | participantVo.setAge(age); |
| | | participantVo.setPhone(participant1.getPhone()); |
| | | participant.add(participantVo); |
| | | } |
| | | competitionInfo.setParticipant(participant); |
| | |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.dsh.competition.mapper.CompetitionMapper"> |
| | | |
| | | <delete id="deleteTenMinutes"> |
| | | delete from t_payment_competition |
| | | WHERE payStatus = 1 |
| | | AND DATE_ADD(insertTime, INTERVAL 10 MINUTE) <= NOW() |
| | | </delete> |
| | | |
| | | |
| | | <select id="queryCompetitionList" resultType="com.dsh.competition.model.CompetitionListVo"> |
| | | select |
| | |
| | | aa.introduction, |
| | | aa.registerEndTime, |
| | | aa.age, |
| | | (aa.baseNumber+aa.userCompetitionCount) as heat, |
| | | aa.status |
| | | aa.status, |
| | | aa.heat |
| | | from ( |
| | | SELECT |
| | | a.id, |
| | |
| | | a.city AS cityName, |
| | | a.registerCondition, |
| | | a.introduction, |
| | | a.baseNumber as heat, |
| | | DATE_FORMAT(a.registerEndTime, '%Y-%m-%d %H:%i') AS registerEndTime, |
| | | CONCAT(a.startAge, '-', a.endAge) AS age, |
| | | a.baseNumber, |
| | | COUNT(uc.competitionId) AS userCompetitionCount, |
| | | CASE |
| | | WHEN NOW() < a.startTime THEN 1 -- 未开始 |
| | | WHEN now() between a.startTime and a.endTime THEN 2 -- 进行中 |
| | |
| | | END AS status |
| | | FROM |
| | | t_competition a |
| | | LEFT JOIN |
| | | t_user_competition5 uc ON a.id = uc.competitionId |
| | | WHERE |
| | | a.auditStatus = 2 |
| | | AND a.`status` IN (1, 2) |
| | | AND a.state = 1 |
| | | <if test="null != cityCode and '' != cityCode"> |
| | | and a.cityCode = #{cityCode} |
| | |
| | | order by aa.heat ${heat} |
| | | </if> |
| | | </select> |
| | | <select id="counts" resultType="java.lang.Integer"> |
| | | select count(1) |
| | | from t_user_competition where competitionId = #{id} |
| | | </select> |
| | | |
| | | |
| | | <update id="taskSetStatusStart"> |
| | |
| | | SELECT DATE_FORMAT(insertTime, '%m-%d %H:%i')as `time`, |
| | | amount |
| | | from t_payment_competition |
| | | where payStatus = 2 and payType in (1,2) |
| | | where payStatus in (2,3) and payType in (1,2) |
| | | <if test="null != monthStart and '' != monthStart and null != monthEnd and '' != monthEnd"> |
| | | and DATE_FORMAT(payTime, '%Y-%m-%d %H:%i:%s') between #{monthStart} and #{monthEnd} |
| | | </if> |
| | |
| | | </if> |
| | | </select> |
| | | <select id="queryCancelDatas" resultType="com.dsh.competition.feignclient.model.BillingRequest"> |
| | | SELECT DATE_FORMAT(insertTime, '%m-%d %H:%i')as `time`, |
| | | SELECT DATE_FORMAT(refundTime, '%m-%d %H:%i')as `time`, |
| | | amount |
| | | from t_payment_competition |
| | | where payStatus = 3 and payType in (1,2) |
| | |
| | | package com.dsh.course.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.dsh.course.entity.CancelledClasses; |
| | | import com.dsh.course.entity.CoursePackageScheduling; |
| | | import com.dsh.course.entity.TCoursePackage; |
| | | import com.dsh.course.entity.TCoursePackagePayment; |
| | | import com.dsh.course.entity.*; |
| | | import com.dsh.course.feignclient.account.AppUserClient; |
| | | import com.dsh.course.feignclient.account.CoachClient; |
| | | import com.dsh.course.feignclient.account.StudentClient; |
| | |
| | | return result; |
| | | } |
| | | |
| | | |
| | | @Autowired |
| | | private CourseCounsumService courseCounsumService; |
| | | /** |
| | | * 添加数据 |
| | | * @param cancelledClasses |
| | |
| | | @PostMapping("/cancelledClasses/addCancelledClasses") |
| | | public void addCancelledClasses(@RequestBody CancelledClasses cancelledClasses){ |
| | | cancelledClassesService.save(cancelledClasses); |
| | | |
| | | TCoursePackagePayment byId = coursePackagePaymentService.getById(cancelledClasses.getCoursePackagePaymentId()); |
| | | CourseCounsum courseCounsum = new CourseCounsum(); |
| | | courseCounsum.setPaymentId(byId.getId()); |
| | | courseCounsum.setChangeType(0); |
| | | courseCounsum.setNum(cancelledClasses.getCancelledClassesNumber()); |
| | | courseCounsum.setInsertTime(new Date()); |
| | | courseCounsum.setReason("消课"); |
| | | courseCounsumService.save(courseCounsum); |
| | | } |
| | | |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.dsh.course.entity.CoursePackagePaymentConfig; |
| | | import com.dsh.course.entity.TCoursePackage; |
| | | import com.dsh.course.entity.TCoursePackagePayment; |
| | | import com.dsh.course.entity.TCoursePackageType; |
| | | import com.dsh.course.entity.*; |
| | | import com.dsh.course.feignclient.model.StoreOfCourseVo; |
| | | import com.dsh.course.feignclient.other.StoreClient; |
| | | import com.dsh.course.feignclient.other.model.Store; |
| | |
| | | import com.dsh.course.model.QueryExamineCoursePackageLists; |
| | | import com.dsh.course.model.vo.response.Details; |
| | | import com.dsh.course.model.vo.response.ExchangeCoursePackageResponse; |
| | | import com.dsh.course.service.ICoursePackagePaymentConfigService; |
| | | import com.dsh.course.service.TCoursePackageDiscountService; |
| | | import com.dsh.course.service.TCoursePackagePaymentService; |
| | | import com.dsh.course.service.TCoursePackageService; |
| | | import com.dsh.course.service.*; |
| | | import com.dsh.course.util.PageFactory; |
| | | import com.dsh.course.util.ResultUtil; |
| | | import com.dsh.course.util.TokenUtil; |
| | | import com.dsh.course.util.ToolUtil; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.ArrayList; |
| | | import java.util.Comparator; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | |
| | | |
| | | return packagePaymentService.listStoreId(code); |
| | | } |
| | | |
| | | @Autowired |
| | | private CoursePackageStudentService coursePackageStudentService; |
| | | |
| | | @Autowired |
| | | private UserVideoDetailsService userVideoDetailsService; |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/base/coursePackage/counts") |
| | | public Integer counts(@RequestBody Integer stuId){ |
| | | return coursePackageStudentService.count(new QueryWrapper<CoursePackageStudent>().eq("signInOrNot",1).eq("studentId",stuId)); |
| | | |
| | | } |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/base/coursePackage/counts1") |
| | | public Integer counts1(@RequestBody Integer stuId){ |
| | | return userVideoDetailsService.count(new QueryWrapper<UserVideoDetails>().eq("appUserId",stuId)) ; |
| | | |
| | | } |
| | | /** |
| | | * 根据id获取课包 |
| | | */ |
| | |
| | | @ApiImplicitParam(name = "lon",value = "经度",dataType = "String"), |
| | | @ApiImplicitParam(name = "lat",value = "纬度",dataType = "String"), |
| | | }) |
| | | public ResultUtil<List<Details>> thisWeeksBenefitList(Integer discountType, String lon, String lat){ |
| | | try { |
| | | public ResultUtil<List<Details>> thisWeeksBenefitList(Integer discountType, String lon, String lat) throws Exception { |
| | | // try { |
| | | Integer appUserId = tokenUtil.getUserIdFormRedis(); |
| | | if(null == appUserId){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | return ResultUtil.success(tcpdService.getWeeksBenefitCourse(appUserId,discountType,lon,lat)); |
| | | }catch (Exception e){ |
| | | return ResultUtil.runErr(); |
| | | } |
| | | String [] strings = {"今日","明日","周一","周二","周三","周四","周五","周六","周日"}; |
| | | List<String> stringList = new ArrayList<>(Arrays.asList(strings)); |
| | | |
| | | List<Details> weeksBenefitCourse = tcpdService.getWeeksBenefitCourse(appUserId, discountType, lon, lat); |
| | | |
| | | weeksBenefitCourse.sort(new Comparator<Details>() { |
| | | @Override |
| | | public int compare(Details o1, Details o2) { |
| | | return stringList.indexOf(o1.getDataTime()) - stringList.indexOf(o2.getDataTime()); |
| | | } |
| | | }); |
| | | |
| | | |
| | | // return ResultUtil.success(tcpdService.getWeeksBenefitCourse(appUserId,discountType,lon,lat)); |
| | | return ResultUtil.success(weeksBenefitCourse); |
| | | // }catch (Exception e){ |
| | | // return ResultUtil.runErr(); |
| | | // } |
| | | } |
| | | |
| | | |
| | |
| | | List<TCoursePackage> list = coursePackageService.list(new QueryWrapper<TCoursePackage>() |
| | | .eq("storeId", storeId) |
| | | .eq("auditStatus",2) |
| | | .eq("state",1)); |
| | | .eq("state",1).orderByDesc("insertTime")); |
| | | if (list.size() > 0){ |
| | | for (TCoursePackage coursePackage : list) { |
| | | int count = tcppmenService.count(new QueryWrapper<TCoursePackagePayment>() |
| | |
| | | StoreOfCourseVo courseVo = new StoreOfCourseVo(); |
| | | courseVo.setCourseId(coursePackage.getId()); |
| | | courseVo.setName(coursePackage.getName()+"(" + store.getName() + ")"); |
| | | courseVo.setClassStartTime(coursePackage.getClassStartTime() +"-"+ coursePackage.getClassEndTime()); |
| | | |
| | | |
| | | String classStartTime = coursePackage.getClassStartTime(); |
| | | String classEndTime = coursePackage.getClassEndTime(); |
| | | ArrayList<String> classTime = new ArrayList<>(); |
| | | String[] split4 = classStartTime.split(","); |
| | | String[] split3 = classEndTime.split(","); |
| | | if(ToolUtil.isNotEmpty(classStartTime)){ |
| | | for (int i = 0; i < split4.length; i++) { |
| | | String s = split4[i].substring(0,5) + "-" + split3[i].substring(0,5); |
| | | classTime.add(s); |
| | | } |
| | | } |
| | | |
| | | // coursePackageInfo.setTimes(classTime); |
| | | String classTimeAsString = String.join("|", classTime); |
| | | |
| | | |
| | | |
| | | courseVo.setClassStartTime(classTimeAsString); |
| | | courseVo.setCoverDrawing(coursePackage.getCoverDrawing()); |
| | | courseVo.setApplicantsNumber(count); |
| | | List<CoursePackagePaymentConfig> list1 = icppconfigService.list(new QueryWrapper<CoursePackagePaymentConfig>() |
| | | .eq("coursePackageId",coursePackage.getId())); |
| | |
| | | CoursePackagePaymentConfig minConfig = list1.stream() |
| | | .min(Comparator.comparingDouble(CoursePackagePaymentConfig::getCashPayment)) |
| | | .orElse(null); |
| | | List<Integer> classHours = new ArrayList<>(); |
| | | for (CoursePackagePaymentConfig coursePackagePaymentConfig : list1) { |
| | | classHours.add(coursePackagePaymentConfig.getClassHours()); |
| | | } |
| | | |
| | | if (minConfig != null){ |
| | | courseVo.setClassHours(minConfig.getClassHours()); |
| | | courseVo.setClassHours(classHours); |
| | | courseVo.setOriginalPrice(minConfig.getCashPayment()); |
| | | courseVo.setCoin(minConfig.getPlayPaiCoin()); |
| | | } |
| | | |
| | | courseVoList.add(courseVo); |
| | |
| | | Student student = studentClient.queryStudentById(stuId); |
| | | List<TCoursePackagePayment> byUserId = packagePaymentService.list(new QueryWrapper<TCoursePackagePayment>() |
| | | .eq("appUserId",student.getAppUserId()) |
| | | .eq("studentId",stuId)); |
| | | .eq("studentId",stuId).eq("payStatus",2)); |
| | | |
| | | if (byUserId.size() > 0 ){ |
| | | for (TCoursePackagePayment tCoursePackagePayment : byUserId) { |
| | |
| | | resp.setTotalCourseNums(tCoursePackagePayment.getTotalClassHours()); |
| | | resp.setResidueNums(tCoursePackagePayment.getLaveClassHours()); |
| | | resp.setDeductionNums(tCoursePackagePayment.getTotalClassHours()-tCoursePackagePayment.getLaveClassHours()); |
| | | resp.setCourseType(tCoursePackage.getType()); |
| | | if (tCoursePackage.getType()!=1||tCoursePackage.getState()==2||tCoursePackagePayment.getPayStatus()==1){ |
| | | resp.setIsAble(0); |
| | | }else { |
| | | resp.setIsAble(1); |
| | | } |
| | | if (tCoursePackage.getValidDays()!=null){ |
| | | String afterDayDate = DateUtil.getAfterDayDate2(tCoursePackage.getInsertTime(),tCoursePackage.getValidDays() + ""); |
| | | resp.setPeriodOfValidity(afterDayDate); |
| | |
| | | }); |
| | | } |
| | | return purchaseRecordVos; |
| | | } |
| | | |
| | | |
| | | @Autowired |
| | | private CourseCounsumService courseCounsumService; |
| | | |
| | | @Autowired |
| | | private TCoursePackagePaymentService coursePackagePaymentService; |
| | | |
| | | @PostMapping("/base/coursePack/getRecord") |
| | | public List<PurchaseRecordVo> getRecord(@RequestBody RecordTimeRequest recordTimeRequest) { |
| | | List<TCoursePackagePayment> list = new ArrayList<>(); |
| | | Integer [] changes = {1,0}; |
| | | if (recordTimeRequest.getType()==null) { |
| | | list = coursePackagePaymentService.list(new QueryWrapper<TCoursePackagePayment>().eq("studentId", recordTimeRequest.getStuId()).eq("coursePackageId", recordTimeRequest.getLessionId()).orderByDesc("insertTime")); |
| | | }else { |
| | | |
| | | list = coursePackagePaymentService.list(new QueryWrapper<TCoursePackagePayment>().eq("studentId", recordTimeRequest.getStuId()).eq("coursePackageId", recordTimeRequest.getLessionId()).orderByDesc("insertTime")); |
| | | |
| | | } |
| | | List<Long> ids = new ArrayList<>(); |
| | | for (TCoursePackagePayment coursePackagePayment : list) { |
| | | ids.add(coursePackagePayment.getId()); |
| | | } |
| | | |
| | | |
| | | |
| | | QueryWrapper<CourseCounsum> in = new QueryWrapper<CourseCounsum>().in("paymentId", ids).in("changeType", changes); |
| | | |
| | | if (recordTimeRequest.getType()!=null){ |
| | | if (recordTimeRequest.getType()==2){ |
| | | recordTimeRequest.setType(0); |
| | | } |
| | | in.eq("changeType",recordTimeRequest.getType()); |
| | | } |
| | | List<CourseCounsum> paymentId = courseCounsumService.list(in); |
| | | List<PurchaseRecordVo> recordVos =new ArrayList<>(); |
| | | for (CourseCounsum courseCounsum : paymentId) { |
| | | PurchaseRecordVo purchaseRecordVo = new PurchaseRecordVo(); |
| | | if (courseCounsum.getChangeType() == 0) { |
| | | purchaseRecordVo.setPurchaseAmount("-" + courseCounsum.getNum()); |
| | | purchaseRecordVo.setPurchaseType(courseCounsum.getReason()); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("MM-dd HH:mm"); |
| | | String formattedDate = sdf.format(courseCounsum.getInsertTime()); |
| | | purchaseRecordVo.setPurchaseTime(formattedDate); |
| | | } else { |
| | | purchaseRecordVo.setPurchaseAmount("+" + courseCounsum.getNum()); |
| | | purchaseRecordVo.setPurchaseType(courseCounsum.getReason()); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("MM-dd HH:mm"); |
| | | String formattedDate = sdf.format(courseCounsum.getInsertTime()); |
| | | purchaseRecordVo.setPurchaseTime(formattedDate); |
| | | } |
| | | recordVos.add(purchaseRecordVo); |
| | | } |
| | | |
| | | return recordVos; |
| | | } |
| | | |
| | | |
| | |
| | | @ResponseBody |
| | | public List<CouponPaymentVo> getAppuserCourseList(@RequestBody Integer appUserId){ |
| | | List<CouponPaymentVo> paymentVos = new ArrayList<>(); |
| | | SimpleDateFormat simpleDateFormat = new SimpleDateFormat("MM-dd HH:mm"); |
| | | SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm"); |
| | | List<TCoursePackagePayment> list = packagePaymentService.list(new QueryWrapper<TCoursePackagePayment>() |
| | | .eq("appUserId", appUserId) |
| | | .eq("payType", 3) |
| | |
| | | baseVo.setName(coursePackage.getName()); |
| | | list.add(baseVo); |
| | | }); |
| | | return ResultUtil.success(list); |
| | | |
| | | Set<BaseVo> set = new HashSet<>(list); |
| | | List<BaseVo> back = new ArrayList<>(set); |
| | | |
| | | return ResultUtil.success(back); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | |
| | | // } |
| | | |
| | | |
| | | QueryWrapper<CoursePackageStudent> queryWrapper1 = new QueryWrapper<CoursePackageStudent>().eq("appUserId", appUserId); |
| | | QueryWrapper<CoursePackageStudent> queryWrapper1 = new QueryWrapper<CoursePackageStudent>().eq("studentId", search.getStuId()); |
| | | if (ToolUtil.isNotEmpty(search.getCourseTypeId())){ |
| | | queryWrapper1.eq("coursePackageId",search.getCourseTypeId()); |
| | | } |
| | |
| | | } |
| | | |
| | | System.out.println("======longs========"+longs); |
| | | List<CoursePackageScheduling> coursePackageSchedulings = coursePackageSchedulingService.list(new QueryWrapper<CoursePackageScheduling>().in("id",longs).isNotNull("courseId")); |
| | | // List<CoursePackageScheduling> coursePackageSchedulings = coursePackageSchedulingService.list(new QueryWrapper<CoursePackageScheduling>().in("id",longs).isNotNull("courseId")); |
| | | List<AppUserVideoResponse> coursePackageSchedulings1 = coursePackageSchedulingService.queryAll(longs); |
| | | |
| | | if (search.getSearch()!=null) { |
| | | List<AppUserVideoResponse> filteredList = new ArrayList<>(); |
| | | for (AppUserVideoResponse response : coursePackageSchedulings1) { |
| | | if (response.getVideoName().contains(search.getSearch())) { |
| | | filteredList.add(response); |
| | | } |
| | | } |
| | | return ResultUtil.success(filteredList); |
| | | |
| | | |
| | | } |
| | | |
| | | return ResultUtil.success(coursePackageSchedulings1); |
| | | |
| | |
| | | }) |
| | | public ResultUtil<PayCourseInfoReq> payCourseInfo(Integer courseId){ |
| | | try { |
| | | PayCourseInfoReq payCourseInfoReq = packagePaymentService.payCourseInfo(courseId); |
| | | |
| | | // Arrays.sort(payCourseInfoReq.getDay(), (a, b) -> a.compareTo(b)); |
| | | |
| | | Collections.sort(payCourseInfoReq.getDay(), Comparator.comparing(String::toString)); |
| | | |
| | | |
| | | return ResultUtil.success(packagePaymentService.payCourseInfo(courseId)); |
| | | }catch (Exception e){ |
| | | return ResultUtil.runErr(); |
| | |
| | | coursePackagePayment.setAppUserId(null); |
| | | packagePaymentService.updateById(coursePackagePayment); |
| | | |
| | | CourseCounsum courseCounsum = new CourseCounsum(); |
| | | courseCounsum.setPaymentId(coursePackagePayment.getId()); |
| | | courseCounsum.setChangeType(0); |
| | | courseCounsum.setNum(classHour); |
| | | courseCounsum.setInsertTime(new Date()); |
| | | courseCounsum.setReason("报名赛事"); |
| | | courseCounsumService.save(courseCounsum); |
| | | |
| | | // coursePackageSchedulingService.remove(new QueryWrapper<CoursePackageScheduling>().eq("courseId", coursePackagePayment.getCoursePackageId())); |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | List<CoursePackageStudent> studentCourse = coursePackageStudentService.list(new QueryWrapper<CoursePackageStudent>().eq("studentId", coursePackagePayment.getStudentId()).eq("coursePackageId", coursePackagePayment.getCoursePackageId())); |
| | |
| | | |
| | | |
| | | |
| | | Student student = studentClient.queryStudentById(coursePackagePayment.getStudentId()); |
| | | |
| | | TCoursePackage tCoursePackage = packageService.getById(coursePackagePayment.getCoursePackageId()); |
| | | String classWeeks = tCoursePackage.getClassWeeks(); |
| | | List<Integer> week = week(classWeeks); |
| | | |
| | | List<TCoursePackagePayment> pays = packagePaymentService.list(new QueryWrapper<TCoursePackagePayment>().eq("coursePackageId", coursePackagePayment.getCoursePackageId()).eq("studentId", coursePackagePayment.getStudentId())); |
| | | TCoursePackagePayment pay = packagePaymentService.getOne(new QueryWrapper<TCoursePackagePayment>().eq("coursePackageId", coursePackagePayment.getCoursePackageId()).eq("studentId", coursePackagePayment.getStudentId())); |
| | | |
| | | |
| | | for (TCoursePackagePayment pay : pays) { |
| | | |
| | | |
| | | List<CoursePackageStudent> studentCourse1 = coursePackageStudentService.list(new QueryWrapper<CoursePackageStudent>().eq("studentId", pay.getStudentId()).eq("coursePackageId", pay.getCoursePackageId())); |
| | | List<Long> collect1 = studentCourse1.stream().map(CoursePackageStudent::getCoursePackageSchedulingId).collect(Collectors.toList()); |
| | | //拿到最后一天的排课记录 |
| | | |
| | | CoursePackageScheduling cs = null; |
| | | if (collect1.size()>0) { |
| | | cs = coursePackageSchedulingService.getOne(new QueryWrapper<CoursePackageScheduling>().in("id", collect1).orderByDesc("classDate").last("limit 1")); |
| | | |
| | | } |
| | | // |
| | | // Calendar calendar = Calendar.getInstance(); |
| | | // Date currentDate = calendar.getTime(); |
| | | // calendar.add(Calendar.DAY_OF_MONTH, -1); |
| | | // Date today = calendar.getTime(); |
| | | Date today = new Date(); |
| | | |
| | | //判断最后一天是否超过当前日期 |
| | | if (cs==null||cs.getClassDate().before(new Date())){ |
| | | }else { |
| | | today = cs.getClassDate(); |
| | | } |
| | | |
| | | Integer laveClassHours = pay.getLaveClassHours(); |
| | | Integer codeTime = tCoursePackage.getCodeTime(); |
| | | Integer can = laveClassHours/codeTime; |
| | | |
| | | int count = 0; |
| | | |
| | | |
| | | String[] split = tCoursePackage.getClassStartTime().split(","); |
| | | String[] split1 = tCoursePackage.getClassEndTime().split(","); |
| | | SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); |
| | |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | // // 本周周几 |
| | | // int i = cn.hutool.core.date.DateUtil.dayOfWeek(new Date()) - 1; |
| | | // for (Integer integer : week) { |
| | | // if (integer < i) { |
| | | // // 找下一周的时间 |
| | | // Calendar instance = Calendar.getInstance(); |
| | | // instance.add(Calendar.DATE, 7 - (i - integer)); |
| | | // Date time = instance.getTime(); |
| | | // |
| | | // for (int i1 = 0; i1 < split.length; i1++) { |
| | | // |
| | | // CoursePackageScheduling coursePackageScheduling = new CoursePackageScheduling(); |
| | | // coursePackageScheduling.setCoursePackageId(tCoursePackage.getId()); |
| | | // Date parse = format1.parse(format.format(time) + " " + split[i1]); |
| | | // Date parse1 = format1.parse(format.format(time) + " " + split1[i1]); |
| | | // coursePackageScheduling.setClassDate(parse); |
| | | // coursePackageScheduling.setEndDate(parse1); |
| | | // coursePackageScheduling.setStatus(1); |
| | | // coursePackageSchedulingService.save(coursePackageScheduling); |
| | | // CoursePackageStudent student1 = new CoursePackageStudent(); |
| | | // student1.setAppUserId(student.getAppUserId()); |
| | | // student1.setStudentId(student.getId()); |
| | | // student1.setCoursePackageId(tCoursePackage.getId()); |
| | | // student1.setCoursePackagePaymentId(coursePackagePayment.getId()); |
| | | // student1.setCoursePackageSchedulingId(coursePackageScheduling.getId()); |
| | | // student1.setSignInOrNot(1); |
| | | // student1.setReservationStatus(1); |
| | | // student1.setInsertTime(new Date()); |
| | | // studentService.save(student1); |
| | | // |
| | | // } |
| | | // |
| | | // } else if (integer > i) { |
| | | // Calendar instance = Calendar.getInstance(); |
| | | // instance.add(Calendar.DATE, integer - i); |
| | | // Date time1 = instance.getTime(); |
| | | // List<Date> list6 = new ArrayList<>(); |
| | | // list6.add(time1); |
| | | // instance.add(Calendar.DATE, 7); |
| | | // Date time2 = instance.getTime(); |
| | | // list6.add(time2); |
| | | // for (Date time : list6) { |
| | | // for (int i1 = 0; i1 < split.length; i1++) { |
| | | // CoursePackageScheduling coursePackageScheduling = new CoursePackageScheduling(); |
| | | // coursePackageScheduling.setCoursePackageId(tCoursePackage.getId()); |
| | | // Date parse = format1.parse(format.format(time) + " " + split[i1]); |
| | | // Date parse1 = format1.parse(format.format(time) + " " + split1[i1]); |
| | | // coursePackageScheduling.setClassDate(parse); |
| | | // coursePackageScheduling.setEndDate(parse1); |
| | | // coursePackageScheduling.setStatus(1); |
| | | // coursePackageSchedulingService.save(coursePackageScheduling); |
| | | // |
| | | // CoursePackageStudent student1 = new CoursePackageStudent(); |
| | | // student1.setAppUserId(student.getAppUserId()); |
| | | // student1.setStudentId(student.getId()); |
| | | // student1.setCoursePackageId(tCoursePackage.getId()); |
| | | // student1.setCoursePackagePaymentId(coursePackagePayment.getId()); |
| | | // student1.setCoursePackageSchedulingId(coursePackageScheduling.getId()); |
| | | // student1.setSignInOrNot(1); |
| | | // student1.setReservationStatus(1); |
| | | // student1.setInsertTime(new Date()); |
| | | // studentService.save(student1); |
| | | // } |
| | | // } |
| | | // |
| | | // } else { |
| | | // Calendar instance = Calendar.getInstance(); |
| | | // instance.add(Calendar.DATE, 7); |
| | | // Date time = instance.getTime(); |
| | | // |
| | | // for (int i1 = 0; i1 < split.length; i1++) { |
| | | // CoursePackageScheduling coursePackageScheduling = new CoursePackageScheduling(); |
| | | // coursePackageScheduling.setCoursePackageId(tCoursePackage.getId()); |
| | | // Date parse = format1.parse(format.format(time) + " " + split[i1]); |
| | | // Date parse1 = format1.parse(format.format(time) + " " + split1[i1]); |
| | | // coursePackageScheduling.setClassDate(parse); |
| | | // coursePackageScheduling.setEndDate(parse1); |
| | | // coursePackageScheduling.setStatus(1); |
| | | // coursePackageSchedulingService.save(coursePackageScheduling); |
| | | // |
| | | // CoursePackageStudent student1 = new CoursePackageStudent(); |
| | | // student1.setAppUserId(student.getAppUserId()); |
| | | // student1.setStudentId(student.getId()); |
| | | // student1.setCoursePackageId(tCoursePackage.getId()); |
| | | // student1.setCoursePackagePaymentId(coursePackagePayment.getId()); |
| | | // student1.setCoursePackageSchedulingId(coursePackageScheduling.getId()); |
| | | // student1.setSignInOrNot(1); |
| | | // student1.setReservationStatus(1); |
| | | // student1.setInsertTime(new Date()); |
| | | // studentService.save(student1); |
| | | // } |
| | | // } |
| | | // } |
| | | |
| | | |
| | | // 2.0 少于3课时 推送 |
| | |
| | | for (TCoursePackagePayment tCoursePackagePayment : list) { |
| | | Integer coursePackageId = tCoursePackagePayment.getCoursePackageId(); |
| | | TCoursePackage byId = tcpService.getById(coursePackageId); |
| | | if (byId.getType()==3){ |
| | | continue; |
| | | } |
| | | if(storeIds.contains(byId.getStoreId())){ |
| | | PayCourseRes payCourseRes = new PayCourseRes(); |
| | | payCourseRes.setCourseNum(tCoursePackagePayment.getLaveClassHours()); |
| | |
| | | } |
| | | } |
| | | return objects; |
| | | } |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/coursePackagePayment/isHave") |
| | | public Integer isHave(@RequestBody String ids){ |
| | | String[] split = ids.split(","); |
| | | return coursePackagePaymentService.count(new QueryWrapper<TCoursePackagePayment>().in("studentId",split)); |
| | | |
| | | } |
| | | |
| | | |
| | |
| | | tCourseInfoRecord.setType(1); |
| | | tCourseInfoRecord.setNum(paymentConfig.getClassHours()); |
| | | auClitn.addCourseInfoRecord(tCourseInfoRecord); |
| | | |
| | | CourseCounsum courseCounsum = new CourseCounsum(); |
| | | courseCounsum.setPaymentId(packagePayment.getId()); |
| | | courseCounsum.setChangeType(1); |
| | | courseCounsum.setNum(packagePayment.getClassHours()); |
| | | courseCounsum.setInsertTime(new Date()); |
| | | courseCounsum.setReason("购买课包"); |
| | | courseCounsumService.save(courseCounsum); |
| | | |
| | | } catch (Exception e) { |
| | | return 4; |
| | | } |
| | |
| | | tCourseInfoRecord.setType(1); |
| | | tCourseInfoRecord.setTime(new Date()); |
| | | id = appUserClient.addCourseInfoRecord(tCourseInfoRecord); |
| | | |
| | | |
| | | CourseCounsum courseCounsum = new CourseCounsum(); |
| | | courseCounsum.setPaymentId(packagePayment.getId()); |
| | | courseCounsum.setChangeType(1); |
| | | courseCounsum.setNum(packagePayment.getClassHours()); |
| | | courseCounsum.setInsertTime(new Date()); |
| | | courseCounsum.setReason("续课"); |
| | | courseCounsumService.save(courseCounsum); |
| | | |
| | | } |
| | | return id; |
| | | } |
| | |
| | | public boolean savePaymentCoursePackage(@RequestBody TCoursePackagePayment packagePayment){ |
| | | |
| | | return packagePaymentService.save(packagePayment); |
| | | } |
| | | |
| | | |
| | | @PostMapping("/base/coursePack/orderClass") |
| | | public void orderClass(@RequestBody OrderDto orderDto) throws ParseException { |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS"); |
| | | String code = sdf.format(new Date()) + UUIDUtil.getNumberRandom(5); |
| | | String[] split = orderDto.getStuIds().split(","); |
| | | for (String s : split) { |
| | | TCoursePackagePayment coursePackagePaymentServiceOne = coursePackagePaymentService.getOne(new QueryWrapper<TCoursePackagePayment>().eq("studentId", s).eq("coursePackageId",orderDto.getClassId())); |
| | | |
| | | |
| | | |
| | | if (coursePackagePaymentServiceOne==null) { |
| | | TCoursePackagePayment coursePackagePayment = new TCoursePackagePayment(); |
| | | coursePackagePayment.setCode(code); |
| | | coursePackagePayment.setAppUserId(orderDto.getAppUserId()); |
| | | coursePackagePayment.setStudentId(Integer.valueOf(s)); |
| | | coursePackagePayment.setCoursePackageId(orderDto.getClassId()); |
| | | coursePackagePayment.setPayType(4); |
| | | coursePackagePayment.setClassHours(orderDto.getClassHours()); |
| | | coursePackagePayment.setTotalClassHours(orderDto.getClassHours()); |
| | | coursePackagePayment.setLaveClassHours(orderDto.getClassHours()); |
| | | coursePackagePayment.setAbsencesNumber(0); |
| | | coursePackagePayment.setPayUserType(1); |
| | | coursePackagePayment.setPayStatus(2); |
| | | coursePackagePayment.setPayUserId(orderDto.getAppUserId()); |
| | | coursePackagePayment.setStatus(1); |
| | | coursePackagePayment.setState(1); |
| | | coursePackagePayment.setInsertTime(new Date()); |
| | | coursePackagePaymentService.save(coursePackagePayment); |
| | | Integer sId = null; |
| | | Student student = studentClient.queryDefaultStudent(orderDto.getAppUserId()); |
| | | if (student != null) { |
| | | sId = student.getId(); |
| | | } |
| | | addPackageStudent(orderDto.getClassId(), orderDto.getAppUserId(), Integer.valueOf(s), coursePackagePayment.getId()); |
| | | |
| | | |
| | | CourseCounsum courseCounsum = new CourseCounsum(); |
| | | courseCounsum.setPaymentId(coursePackagePayment.getId()); |
| | | courseCounsum.setChangeType(1); |
| | | courseCounsum.setNum(orderDto.getClassHours()); |
| | | courseCounsum.setInsertTime(new Date()); |
| | | courseCounsum.setReason("积分兑换"); |
| | | courseCounsumService.save(courseCounsum); |
| | | |
| | | }else { |
| | | coursePackagePaymentServiceOne.setClassHours(coursePackagePaymentServiceOne.getClassHours()+orderDto.getClassHours()); |
| | | coursePackagePaymentServiceOne.setTotalClassHours(coursePackagePaymentServiceOne.getTotalClassHours()+orderDto.getClassHours()); |
| | | coursePackagePaymentServiceOne.setLaveClassHours(coursePackagePaymentServiceOne.getLaveClassHours()+orderDto.getClassHours()); |
| | | coursePackagePaymentServiceOne.setAppUserId(null); |
| | | coursePackagePaymentService.updateById(coursePackagePaymentServiceOne); |
| | | |
| | | Integer sId = null; |
| | | Student student = studentClient.queryDefaultStudent(orderDto.getAppUserId()); |
| | | if (student != null) { |
| | | sId = student.getId(); |
| | | } |
| | | addPackageStudent(orderDto.getClassId(), orderDto.getAppUserId(), Integer.valueOf(s), coursePackagePaymentServiceOne.getId()); |
| | | |
| | | |
| | | CourseCounsum courseCounsum = new CourseCounsum(); |
| | | courseCounsum.setPaymentId(coursePackagePaymentServiceOne.getId()); |
| | | courseCounsum.setChangeType(1); |
| | | courseCounsum.setNum(orderDto.getClassHours()); |
| | | courseCounsum.setInsertTime(new Date()); |
| | | courseCounsum.setReason("积分兑换"); |
| | | courseCounsumService.save(courseCounsum); |
| | | |
| | | |
| | | } |
| | | |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | public static Date[] generateDateArray1(Date startDate, Date endDate) { |
| | | List<Date> dateList = new ArrayList<>(); |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTime(startDate); |
| | | |
| | | while (!calendar.getTime().after(endDate)) { |
| | | Date currentDate = calendar.getTime(); |
| | | dateList.add(currentDate); |
| | | calendar.add(Calendar.DAY_OF_MONTH, 1); |
| | | } |
| | | |
| | | return dateList.toArray(new Date[0]); |
| | | } |
| | | |
| | | @Autowired |
| | | private TCoursePackageService coursePackageService; |
| | | private void addPackageStudent(Integer courseId, Integer userId, Integer sId,Long paymentId) throws ParseException { |
| | | // 课包 |
| | | TCoursePackage tCoursePackage = coursePackageService.getById(courseId); |
| | | |
| | | if (tCoursePackage.getType()==1) { |
| | | String classWeeks = tCoursePackage.getClassWeeks(); |
| | | |
| | | List<Integer> week = week(classWeeks); |
| | | |
| | | String[] split = tCoursePackage.getClassStartTime().split(","); |
| | | String[] split1 = tCoursePackage.getClassEndTime().split(","); |
| | | SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); |
| | | SimpleDateFormat format1 = new SimpleDateFormat("yyyy-MM-dd HH:mm"); |
| | | |
| | | //查出当前用户当前学员当前课包最后一天的排课数据 |
| | | List<CoursePackageStudent> studentCourse = coursePackageStudentService.list(new QueryWrapper<CoursePackageStudent>().eq("studentId", sId).eq("coursePackageId", courseId)); |
| | | List<Long> collect = studentCourse.stream().map(CoursePackageStudent::getCoursePackageSchedulingId).collect(Collectors.toList()); |
| | | //拿到最后一天的排课记录 |
| | | if (collect.size() > 0) { |
| | | coursePackageSchedulingService.remove(new QueryWrapper<CoursePackageScheduling>().in("id", collect)); |
| | | coursePackageStudentService.remove(new QueryWrapper<CoursePackageStudent>().eq("studentId", sId).eq("coursePackageId", courseId)); |
| | | } |
| | | Date today = new Date(); |
| | | TCoursePackagePayment pay = coursePackagePaymentService.getById(paymentId); |
| | | Integer laveClassHours = pay.getLaveClassHours(); |
| | | Integer codeTime = tCoursePackage.getCodeTime(); |
| | | Integer can = 0; |
| | | int count = 0; |
| | | // 本周周几 |
| | | Date[] dates = generateDateArray(14, today); |
| | | if (tCoursePackage.getType() == 1) { |
| | | can = laveClassHours / codeTime; |
| | | } |
| | | if (tCoursePackage.getType() == 2) { |
| | | Date startDate = tCoursePackage.getStartTime(); |
| | | Date endDate = tCoursePackage.getEndTime(); |
| | | dates = generateDateArray1(startDate, endDate); |
| | | can = 999; |
| | | } |
| | | for (Date date : dates) { |
| | | if (count == can) { |
| | | break; |
| | | } |
| | | int wei = cn.hutool.core.date.DateUtil.dayOfWeek(date); |
| | | if (week.contains(wei)) { |
| | | for (int i1 = 0; i1 < split.length; i1++) { |
| | | if (count == can) { |
| | | break; |
| | | } |
| | | CoursePackageScheduling coursePackageScheduling = new CoursePackageScheduling(); |
| | | coursePackageScheduling.setCoursePackageId(tCoursePackage.getId()); |
| | | Date parse = format1.parse(format.format(date) + " " + split[i1]); |
| | | Date parse1 = format1.parse(format.format(date) + " " + split1[i1]); |
| | | coursePackageScheduling.setClassDate(parse); |
| | | coursePackageScheduling.setEndDate(parse1); |
| | | coursePackageScheduling.setStatus(1); |
| | | coursePackageSchedulingService.save(coursePackageScheduling); |
| | | CoursePackageStudent student1 = new CoursePackageStudent(); |
| | | student1.setAppUserId(userId); |
| | | student1.setStudentId(sId); |
| | | student1.setCoursePackageId(tCoursePackage.getId()); |
| | | student1.setCoursePackagePaymentId(paymentId); |
| | | student1.setCoursePackageSchedulingId(coursePackageScheduling.getId()); |
| | | student1.setSignInOrNot(1); |
| | | student1.setReservationStatus(1); |
| | | student1.setInsertTime(new Date()); |
| | | coursePackageStudentService.save(student1); |
| | | count++; |
| | | } |
| | | } |
| | | } |
| | | |
| | | }else if (tCoursePackage.getType()==2){ |
| | | String classWeeks = tCoursePackage.getClassWeeks(); |
| | | List<Integer> week = week(classWeeks); |
| | | |
| | | Date today = new Date(); |
| | | |
| | | Date startTime = tCoursePackage.getStartTime(); |
| | | Date endTime = tCoursePackage.getEndTime(); |
| | | LocalDate startDate = startTime.toInstant().atZone(ZoneId.systemDefault()).toLocalDate(); |
| | | LocalDate endDate = endTime.toInstant().atZone(ZoneId.systemDefault()).toLocalDate(); |
| | | Period period = Period.between(startDate, endDate); |
| | | int days = period.getDays() + 1; |
| | | Integer can =999; |
| | | int count = 0; |
| | | String[] split = tCoursePackage.getClassStartTime().split(","); |
| | | String[] split1 = tCoursePackage.getClassEndTime().split(","); |
| | | SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); |
| | | SimpleDateFormat format1 = new SimpleDateFormat("yyyy-MM-dd HH:mm"); |
| | | |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTime(startTime); |
| | | calendar.add(Calendar.DAY_OF_MONTH, -1); |
| | | |
| | | TCoursePackagePayment pay = coursePackagePaymentService.getById(paymentId); |
| | | |
| | | |
| | | Date[] dates = generateDateArray(days,calendar.getTime()); |
| | | for (Date date : dates) { |
| | | if (count==can){ |
| | | break; |
| | | } |
| | | int wei = cn.hutool.core.date.DateUtil.dayOfWeek(date)-1; |
| | | if (wei == 0){ |
| | | wei =7; |
| | | } |
| | | if (week.contains(wei)){ |
| | | for (int i1 = 0; i1 < split.length; i1++) { |
| | | if (count==can){ |
| | | break; |
| | | } |
| | | CoursePackageScheduling coursePackageScheduling = new CoursePackageScheduling(); |
| | | coursePackageScheduling.setCoursePackageId(tCoursePackage.getId()); |
| | | Date parse = format1.parse(format.format(date) + " " + split[i1]); |
| | | Date parse1 = format1.parse(format.format(date) + " " + split1[i1]); |
| | | coursePackageScheduling.setClassDate(parse); |
| | | coursePackageScheduling.setEndDate(parse1); |
| | | coursePackageScheduling.setStatus(1); |
| | | coursePackageSchedulingService.save(coursePackageScheduling); |
| | | CoursePackageStudent student1 = new CoursePackageStudent(); |
| | | student1.setAppUserId(userId); |
| | | student1.setStudentId(sId); |
| | | student1.setCoursePackageId(tCoursePackage.getId()); |
| | | student1.setCoursePackagePaymentId(pay.getId()); |
| | | student1.setCoursePackageSchedulingId(coursePackageScheduling.getId()); |
| | | student1.setSignInOrNot(1); |
| | | student1.setReservationStatus(1); |
| | | student1.setInsertTime(new Date()); |
| | | coursePackageStudentService.save(student1); |
| | | count++; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | // 2.0 |
| | | TCourseInfoRecord tCourseInfoRecord = new TCourseInfoRecord(); |
| | | tCourseInfoRecord.setUserId(userId); |
| | | tCourseInfoRecord.setCourseId(courseId); |
| | | tCourseInfoRecord.setName("报名运动营"); |
| | | tCourseInfoRecord.setNum(tCoursePackage.getNeedNum()); |
| | | tCourseInfoRecord.setTime(new Date()); |
| | | tCourseInfoRecord.setType(2); |
| | | appUserClient.addCourseInfoRecord(tCourseInfoRecord); |
| | | |
| | | |
| | | } |
| | | |
| | | @ResponseBody |
| | |
| | | |
| | | // 2.0 送课时 |
| | | @PostMapping("/base/coursePack/sendHours") |
| | | public Integer sendHours(@RequestBody String s){ |
| | | String[] split = s.split("_"); |
| | | TCoursePackagePayment byId = packagePaymentService.getById(Long.valueOf(split[0])); |
| | | byId.setTotalClassHours(byId.getTotalClassHours()+Integer.valueOf(split[2])); |
| | | boolean b = packagePaymentService.updateHoursById(byId,Integer.valueOf(split[2])); |
| | | public Integer sendHours(@RequestBody String s) throws ParseException { |
| | | String[] split2 = s.split("_"); |
| | | TCoursePackagePayment byId = packagePaymentService.getById(Long.valueOf(split2[0])); |
| | | byId.setTotalClassHours(byId.getTotalClassHours()+Integer.valueOf(split2[2])); |
| | | boolean b = packagePaymentService.updateHoursById(byId,Integer.valueOf(split2[2])); |
| | | |
| | | CourseCounsum courseCounsum = new CourseCounsum(); |
| | | courseCounsum.setPaymentId(byId.getId()); |
| | | courseCounsum.setChangeType(1); |
| | | courseCounsum.setNum(Integer.valueOf(split2[2])); |
| | | courseCounsum.setInsertTime(new Date()); |
| | | courseCounsum.setReason("介绍有礼"); |
| | | courseCounsumService.save(courseCounsum); |
| | | |
| | | |
| | | List<CoursePackageStudent> studentCourse = coursePackageStudentService.list(new QueryWrapper<CoursePackageStudent>().eq("studentId", byId.getStudentId()).eq("coursePackageId", byId.getCoursePackageId())); |
| | | List<Long> collect = studentCourse.stream().map(CoursePackageStudent::getCoursePackageSchedulingId).collect(Collectors.toList()); |
| | | coursePackageSchedulingService.remove(new QueryWrapper<CoursePackageScheduling>().in("id",collect)); |
| | | coursePackageStudentService.remove(new QueryWrapper<CoursePackageStudent>().eq("studentId", byId.getStudentId()).eq("coursePackageId", byId.getCoursePackageId())); |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | TCoursePackage tCoursePackage = packageService.getById(byId.getCoursePackageId()); |
| | | String classWeeks = tCoursePackage.getClassWeeks(); |
| | | List<Integer> week = week(classWeeks); |
| | | |
| | | TCoursePackagePayment pay = packagePaymentService.getOne(new QueryWrapper<TCoursePackagePayment>().eq("coursePackageId", byId.getCoursePackageId()).eq("studentId", byId.getStudentId())); |
| | | |
| | | Date today = new Date(); |
| | | |
| | | Integer laveClassHours = pay.getLaveClassHours(); |
| | | Integer codeTime = tCoursePackage.getCodeTime(); |
| | | Integer can = laveClassHours/codeTime; |
| | | |
| | | int count = 0; |
| | | String[] split = tCoursePackage.getClassStartTime().split(","); |
| | | String[] split1 = tCoursePackage.getClassEndTime().split(","); |
| | | SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); |
| | | SimpleDateFormat format1 = new SimpleDateFormat("yyyy-MM-dd HH:mm"); |
| | | |
| | | Date[] dates = generateDateArray(14,today); |
| | | for (Date date : dates) { |
| | | if (count==can){ |
| | | break; |
| | | } |
| | | int wei = cn.hutool.core.date.DateUtil.dayOfWeek(date); |
| | | if (week.contains(wei)){ |
| | | for (int i1 = 0; i1 < split.length; i1++) { |
| | | if (count==can){ |
| | | break; |
| | | } |
| | | CoursePackageScheduling coursePackageScheduling = new CoursePackageScheduling(); |
| | | coursePackageScheduling.setCoursePackageId(tCoursePackage.getId()); |
| | | Date parse = format1.parse(format.format(date) + " " + split[i1]); |
| | | Date parse1 = format1.parse(format.format(date) + " " + split1[i1]); |
| | | coursePackageScheduling.setClassDate(parse); |
| | | coursePackageScheduling.setEndDate(parse1); |
| | | coursePackageScheduling.setStatus(1); |
| | | coursePackageSchedulingService.save(coursePackageScheduling); |
| | | CoursePackageStudent student1 = new CoursePackageStudent(); |
| | | student1.setAppUserId(pay.getAppUserId()); |
| | | student1.setStudentId(pay.getStudentId()); |
| | | student1.setCoursePackageId(pay.getCoursePackageId()); |
| | | student1.setCoursePackagePaymentId(pay.getId()); |
| | | student1.setCoursePackageSchedulingId(coursePackageScheduling.getId()); |
| | | student1.setSignInOrNot(1); |
| | | student1.setReservationStatus(1); |
| | | student1.setInsertTime(new Date()); |
| | | studentService.save(student1); |
| | | count++; |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | if(b){ |
| | | return 1; |
| | | }else { |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/base/coursePack/getConsumes") |
| | | List<CourseCounsum> getConsumes(@RequestBody BillingDataRequestVo requestVo) { |
| | | Integer[] integers = {2,3}; |
| | | QueryWrapper<CourseCounsum> courseCounsumQueryWrapper = new QueryWrapper<CourseCounsum>().in("changeType",integers).eq("appUserId",requestVo.getAppUserId()); |
| | | if (requestVo.getMonthEnd()!=null){ |
| | | courseCounsumQueryWrapper.ge("insertTime",requestVo.getMonthStart()); |
| | | courseCounsumQueryWrapper.le("insertTime",requestVo.getMonthEnd()); |
| | | } |
| | | return courseCounsumService.list(courseCounsumQueryWrapper); |
| | | |
| | | } |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/base/coursePack/weeksOfCourseDetailsList") |
| | | HashMap<String, Object> weeksOfCourseDetailsList(@RequestBody CourseDetailReq courseDetailReq){ |
| | |
| | | List<TCoursePackagePayment> list1 = packagePaymentService.list(new LambdaQueryWrapper<TCoursePackagePayment>().eq(TCoursePackagePayment::getAppUserId, courseDetailReq.getAppUserId()).eq(TCoursePackagePayment::getStudentId, courseDetailReq.getStuId()).in(TCoursePackagePayment::getCoursePackageId, collect)); |
| | | List<Integer> collect1 = list1.stream().map(TCoursePackagePayment::getCoursePackageId).collect(Collectors.toList()); |
| | | List<Long> ids = list1.stream().map(TCoursePackagePayment::getId).collect(Collectors.toList()); |
| | | |
| | | |
| | | for (TCoursePackage tCoursePackage : list) { |
| | | DetailsListVo detailsListVo = new DetailsListVo(); |
| | | detailsListVo.setId(tCoursePackage.getId()); |
| | | detailsListVo.setName(tCoursePackage.getName()); |
| | | detailsListVo.setCourseType(tCoursePackage.getType()); |
| | | String classStartTime = tCoursePackage.getClassStartTime(); |
| | | String[] split = classStartTime.split(","); |
| | | String classEndTime = tCoursePackage.getClassEndTime(); |
| | |
| | | strings.add(s); |
| | | } |
| | | } |
| | | if (detailsListVo.getCourseType()==1) { |
| | | detailsListVo.setTime(strings); |
| | | }else { |
| | | Date startTime = tCoursePackage.getStartTime(); |
| | | Date endTime = tCoursePackage.getEndTime(); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
| | | String formattedStartTime = sdf.format(startTime); |
| | | String formattedEndTime = sdf.format(endTime); |
| | | |
| | | detailsListVo.setTime(strings); |
| | | String result = formattedStartTime + "至" + formattedEndTime; |
| | | List<String> stringLists = new ArrayList<>(); |
| | | stringLists.add(result); |
| | | detailsListVo.setTime(stringLists); |
| | | |
| | | } |
| | | //价格 |
| | | List<CoursePackagePaymentConfig> list2 = icppcService.list(new LambdaQueryWrapper<CoursePackagePaymentConfig>().eq(CoursePackagePaymentConfig::getCoursePackageId, tCoursePackage.getId()).orderByAsc(CoursePackagePaymentConfig::getCashPayment)); |
| | | if (list2.size() > 0) { |
| | | Double cashPayment = list2.get(0).getCashPayment(); |
| | |
| | | .like(CoursePackageScheduling::getClassDate, courseDetailReq.getTime()) |
| | | ); |
| | | if(list3.size()==0){ |
| | | break; |
| | | detailsListVo.setType(2); |
| | | objects.add(detailsListVo); |
| | | continue; |
| | | } |
| | | //排课的ids |
| | | List<Long> collect2 = list3.stream().map(CoursePackageScheduling::getId).collect(Collectors.toList()); |
| | | if(collect2.size()==0){ |
| | | collect2.add(-1l); |
| | | } |
| | | |
| | | |
| | | List<CoursePackageStudent> list4 = cspsService.list(new LambdaQueryWrapper<CoursePackageStudent>() |
| | | .eq(CoursePackageStudent::getAppUserId, courseDetailReq.getAppUserId()) |
| | | .eq(CoursePackageStudent::getCoursePackageId, tCoursePackage.getId()) |
| | |
| | | in(CoursePackageStudent::getCoursePackagePaymentId, ids) |
| | | ); |
| | | |
| | | if(list4.size()>0){ |
| | | List<CoursePackageStudent> list5 = cspsService.list(new QueryWrapper<CoursePackageStudent>().eq("studentId", courseDetailReq.getStuId()).eq("coursePackageId",tCoursePackage.getId())); |
| | | |
| | | if(list5.size()>0){ |
| | | Integer signInOrNot = list4.get(0).getSignInOrNot(); |
| | | detailsListVo.setType(1); |
| | | |
| | |
| | | } |
| | | detailsListVo.setIsType(list4.get(0).getType()); |
| | | |
| | | for (CoursePackageStudent coursePackageStudent : list4) { |
| | | Integer signInOrNot1 = coursePackageStudent.getSignInOrNot(); |
| | | detailsListVo.setType(1); |
| | | |
| | | if(signInOrNot1==2){ |
| | | detailsListVo.setType(3); |
| | | } |
| | | detailsListVo.setIsType(coursePackageStudent.getType()); |
| | | CoursePackageScheduling coursePackageScheduling = coursePackageSchedulingMapper.selectById(coursePackageStudent.getCoursePackageSchedulingId()); |
| | | Date classDate = coursePackageScheduling.getClassDate(); |
| | | Date endDate = coursePackageScheduling.getEndDate(); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("HH:mm"); |
| | | String formattedClassDate = sdf.format(classDate); |
| | | String formattedEndDate = sdf.format(endDate); |
| | | |
| | | String result = formattedClassDate + "-" + formattedEndDate; |
| | | List<String> strings1 =new ArrayList<>(); |
| | | strings1.add(result); |
| | | detailsListVo.setTime(strings1); |
| | | DetailsListVo detailsListVo1 = new DetailsListVo(); |
| | | |
| | | // detailsListVo1.setId(coursePackageStudent.getId()); |
| | | BeanUtils.copyProperties(detailsListVo,detailsListVo1); |
| | | objects.add(detailsListVo1); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | }else { |
| | | detailsListVo.setType(2); |
| | | objects.add(detailsListVo); |
| | | |
| | | } |
| | | |
| | | } else { |
| | | detailsListVo.setType(2); |
| | | objects.add(detailsListVo); |
| | | |
| | | } |
| | | objects.add(detailsListVo); |
| | | // objects.add(detailsListVo); |
| | | } |
| | | map.put("data",objects); |
| | | |
| | |
| | | package com.dsh.course.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.dsh.course.entity.CoursePackageScheduling; |
| | | import com.dsh.course.model.QueryCoursePackageSchedulingList; |
| | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/coursePackageScheduling/queryCoursePackageSchedulingsById") |
| | | public List<CoursePackageScheduling> queryCoursePackageSchedulingsById(@RequestBody Long id){ |
| | | CoursePackageScheduling byId = coursePackageSchedulingService.getById(id); |
| | | Date date = new Date(); // 假设你有一个 Date 对象 |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | String formattedDate = sdf.format(byId.getClassDate()); |
| | | List<CoursePackageScheduling> list = coursePackageSchedulingService.list(new LambdaQueryWrapper<CoursePackageScheduling>().eq(CoursePackageScheduling::getCoursePackageId,byId.getCoursePackageId()).eq(CoursePackageScheduling::getClassDate,formattedDate)); |
| | | return list; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 编辑数据 |
| | | * @param coursePackageScheduling |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/coursePackageScheduling/editCoursePackageScheduling") |
| | | public void editCoursePackageScheduling(@RequestBody CoursePackageScheduling coursePackageScheduling){ |
| | | coursePackageScheduling.setCoursePackageId(null); |
| | | coursePackageSchedulingService.updateById(coursePackageScheduling); |
| | | public void editCoursePackageScheduling(@RequestBody List<CoursePackageScheduling> coursePackageScheduling){ |
| | | // coursePackageScheduling.setCoursePackageId(null); |
| | | for (CoursePackageScheduling packageScheduling : coursePackageScheduling) { |
| | | packageScheduling.setCoursePackageId(null); |
| | | } |
| | | coursePackageSchedulingService.updateBatchById(coursePackageScheduling); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/coursePackageStudent/queryByCoursePackageSchedulingId") |
| | | public List<CoursePackageStudent> queryByCoursePackageSchedulingId(@RequestBody Long coursePackageSchedulingId){ |
| | | return coursePackageStudentService.list(new QueryWrapper<CoursePackageStudent>().eq("coursePackageSchedulingId", coursePackageSchedulingId)); |
| | | public List<CoursePackageStudent> queryByCoursePackageSchedulingId(@RequestBody List<Long> coursePackageSchedulingId){ |
| | | return coursePackageStudentService.list(new QueryWrapper<CoursePackageStudent>().in("coursePackageSchedulingId", coursePackageSchedulingId)); |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.dsh.course.entity.CancelledClasses; |
| | | import com.dsh.course.entity.CourseCounsum; |
| | | import com.dsh.course.entity.CoursePackageStudent; |
| | | import com.dsh.course.entity.TCoursePackage; |
| | | import com.dsh.course.feignclient.model.GetStudentCourse; |
| | | import com.dsh.course.service.CancelledClassesService; |
| | | import com.dsh.course.service.CourseCounsumService; |
| | | import com.dsh.course.service.CoursePackageStudentService; |
| | | import com.dsh.course.service.TCoursePackageService; |
| | | import com.dsh.course.util.ToolUtil; |
| | |
| | | return sult; |
| | | } |
| | | |
| | | @Autowired |
| | | private CourseCounsumService courseCounsumService; |
| | | |
| | | @PostMapping("/base/courseRecord/save") |
| | | public void save(@RequestBody CourseCounsum courseCounsum) { |
| | | courseCounsumService.save(courseCounsum); |
| | | } |
| | | |
| | | |
| | | @PostMapping("/base/courseRecord/cancelCourseData") |
| | | public Integer cancelCourseRecordClass(@RequestBody Integer courseRecordId){ |
| | |
| | | import com.dsh.course.feignclient.account.StudentClient; |
| | | import com.dsh.course.feignclient.account.model.Student; |
| | | import com.dsh.course.mapper.CoursePackageSchedulingMapper; |
| | | import com.dsh.course.mapper.CoursePackageStudentMapper; |
| | | import com.dsh.course.model.dto.ToClassDto; |
| | | import com.dsh.course.service.*; |
| | | import com.dsh.course.util.ResultUtil; |
| | |
| | | import javax.swing.text.html.parser.Entity; |
| | | import java.text.ParseException; |
| | | import java.text.SimpleDateFormat; |
| | | import java.time.LocalDate; |
| | | import java.time.Period; |
| | | import java.time.ZoneId; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | |
| | | private CourseCounsumService counsumService; |
| | | @Autowired |
| | | private TCoursePackageService coursePackageService; |
| | | @Resource |
| | | private CoursePackageStudentMapper cpsMapper; |
| | | //获取退费记录 |
| | | @RequestMapping("/getRefund") |
| | | @ResponseBody |
| | |
| | | @ResponseBody |
| | | public void zeroClass(@RequestParam("id")Integer id){ |
| | | MoneyBack byId = moneyBackService.getById(id); |
| | | String[] split = byId.getIds().split(","); |
| | | System.out.println("========split===>"+split); |
| | | List<TCoursePackagePayment> id1 = paymentService.list(new QueryWrapper<TCoursePackagePayment>().in("id", split)); |
| | | String[] split2 = byId.getIds().split(","); |
| | | System.out.println("========split===>"+split2); |
| | | List<TCoursePackagePayment> id1 = paymentService.list(new QueryWrapper<TCoursePackagePayment>().in("id", split2)); |
| | | for (TCoursePackagePayment o :id1){ |
| | | CourseCounsum courseCounsum = new CourseCounsum(); |
| | | courseCounsum.setNum(o.getLaveClassHours()); |
| | |
| | | o.setStatus(2); |
| | | o.setAppUserId(null); |
| | | |
| | | |
| | | |
| | | TCoursePackage tCoursePackage = packageService.getById(o.getCoursePackageId()); |
| | | String classWeeks = tCoursePackage.getClassWeeks(); |
| | | List<Integer> week = week(classWeeks); |
| | | |
| | | String[] split = tCoursePackage.getClassStartTime().split(","); |
| | | String[] split1 = tCoursePackage.getClassEndTime().split(","); |
| | | SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); |
| | | SimpleDateFormat format1 = new SimpleDateFormat("yyyy-MM-dd HH:mm"); |
| | | // 本周周几 |
| | | |
| | | List<CoursePackageStudent> studentCourse = coursePackageStudentService.list(new QueryWrapper<CoursePackageStudent>().eq("studentId",o.getStudentId()).eq("coursePackageId", o.getCoursePackageId())); |
| | | List<Long> collect = studentCourse.stream().map(CoursePackageStudent::getCoursePackageSchedulingId).collect(Collectors.toList()); |
| | | //拿到最后一天的排课记录 |
| | | if (collect.size()>0) { |
| | | coursePackageSchedulingService.delete(new QueryWrapper<CoursePackageScheduling>().in("id", collect)); |
| | | coursePackageStudentService.remove(new QueryWrapper<CoursePackageStudent>().eq("studentId", o.getStudentId()).eq("coursePackageId", o.getCoursePackageId())); |
| | | } |
| | | |
| | | |
| | | |
| | |
| | | //课程转移 |
| | | @RequestMapping("/toClass") |
| | | @ResponseBody |
| | | public void toClass(@RequestBody ToClassDto toClassDto){ |
| | | public void toClass(@RequestBody ToClassDto toClassDto) throws ParseException { |
| | | System.out.println("===========到达getSelect======="+toClassDto); |
| | | TCoursePackagePayment orinPay = paymentService.getOne(new QueryWrapper<TCoursePackagePayment>().eq("id", toClassDto.getId())); |
| | | TCoursePackagePayment studentPay = paymentService.getOne(new QueryWrapper<TCoursePackagePayment>().eq("studentId", toClassDto.getToStudentId()).eq("coursePackageId",orinPay.getCoursePackageId())); |
| | |
| | | |
| | | orinPay.setTotalClassHours(0); |
| | | orinPay.setLaveClassHours(0); |
| | | orinPay.setStatus(5); |
| | | orinPay.setStatus(1); |
| | | orinPay.setAppUserId(null); |
| | | paymentService.updateById(orinPay); |
| | | |
| | | //删除orin的排课记录 |
| | | List<CoursePackageStudent> studentCourse1 = coursePackageStudentService.list(new QueryWrapper<CoursePackageStudent>().eq("studentId", orinPay.getStudentId()).eq("coursePackageId", orinPay.getCoursePackageId())); |
| | | List<Long> collect1 = studentCourse1.stream().map(CoursePackageStudent::getCoursePackageSchedulingId).collect(Collectors.toList()); |
| | | //拿到最后一天的排课记录 |
| | | if (collect1.size()>0){ |
| | | coursePackageSchedulingService.delete(new QueryWrapper<CoursePackageScheduling>().in("id", collect1)); |
| | | coursePackageStudentService.remove(new QueryWrapper<CoursePackageStudent>().eq("studentId", toClassDto.getToStudentId()).eq("coursePackageId", studentPay.getCoursePackageId())); |
| | | } |
| | | CourseCounsum courseCounsum = new CourseCounsum(); |
| | | courseCounsum.setInsertTime(new Date()); |
| | | if (orinPay.getAppUserId()!=studentPay.getAppUserId()){ |
| | | courseCounsum.setReason("课时转移"); |
| | | }else { courseCounsum.setReason("课时转移"); |
| | | courseCounsum.setReason("赠课"); |
| | | }else { courseCounsum.setReason("转课"); |
| | | } |
| | | courseCounsum.setNum(laveClassHours); |
| | | courseCounsum.setChangeType(0); |
| | |
| | | |
| | | CourseCounsum courseCounsum1 = new CourseCounsum(); |
| | | courseCounsum1.setInsertTime(new Date()); |
| | | courseCounsum1.setReason("课时转移"); |
| | | if (orinPay.getAppUserId()!=studentPay.getAppUserId()){ |
| | | courseCounsum1.setReason("赠课"); |
| | | }else { courseCounsum1.setReason("转课"); |
| | | } |
| | | courseCounsum1.setNum(laveClassHours); |
| | | courseCounsum1.setChangeType(1); |
| | | courseCounsum1.setPaymentId(studentPay.getId()); |
| | | counsumService.save(courseCounsum1); |
| | | |
| | | |
| | | //排课 |
| | | TCoursePackage tCoursePackage = packageService.getById(studentPay.getCoursePackageId()); |
| | | String classWeeks = tCoursePackage.getClassWeeks(); |
| | | List<Integer> week = week(classWeeks); |
| | | |
| | | String[] split = tCoursePackage.getClassStartTime().split(","); |
| | | String[] split1 = tCoursePackage.getClassEndTime().split(","); |
| | | SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); |
| | | SimpleDateFormat format1 = new SimpleDateFormat("yyyy-MM-dd HH:mm"); |
| | | // 本周周几 |
| | | |
| | | List<CoursePackageStudent> studentCourse = coursePackageStudentService.list(new QueryWrapper<CoursePackageStudent>().eq("studentId", toClassDto.getToStudentId()).eq("coursePackageId", studentPay.getCoursePackageId())); |
| | | List<Long> collect = studentCourse.stream().map(CoursePackageStudent::getCoursePackageSchedulingId).collect(Collectors.toList()); |
| | | //拿到最后一天的排课记录 |
| | | if (collect.size()>0) { |
| | | coursePackageSchedulingService.delete(new QueryWrapper<CoursePackageScheduling>().in("id", collect)); |
| | | coursePackageStudentService.remove(new QueryWrapper<CoursePackageStudent>().eq("studentId", toClassDto.getToStudentId()).eq("coursePackageId", studentPay.getCoursePackageId())); |
| | | } |
| | | |
| | | Student student = studentClient.queryStudentById(toClassDto.getToStudentId()); |
| | | |
| | | Date today = new Date(); |
| | | |
| | | |
| | | |
| | | |
| | | TCoursePackagePayment pay = coursePackagePaymentService.getById(studentPay.getId()); |
| | | Integer laveClassHours2 = pay.getLaveClassHours(); |
| | | Integer codeTime = tCoursePackage.getCodeTime(); |
| | | Integer can = 0; |
| | | int count = 0; |
| | | // 本周周几 |
| | | // int i = DateUtil.dayOfWeek(new Date())-1; |
| | | |
| | | Date[] dates = generateDateArray(14,today); |
| | | can = laveClassHours2/codeTime; |
| | | |
| | | for (Date date : dates) { |
| | | if (count==can){ |
| | | break; |
| | | } |
| | | int wei = DateUtil.dayOfWeek(date); |
| | | if (week.contains(wei)){ |
| | | for (int i1 = 0; i1 < split.length; i1++) { |
| | | if (count==can){ |
| | | break; |
| | | } |
| | | CoursePackageScheduling coursePackageScheduling = new CoursePackageScheduling(); |
| | | coursePackageScheduling.setCoursePackageId(tCoursePackage.getId()); |
| | | Date parse = format1.parse(format.format(date) + " " + split[i1]); |
| | | Date parse1 = format1.parse(format.format(date) + " " + split1[i1]); |
| | | coursePackageScheduling.setClassDate(parse); |
| | | coursePackageScheduling.setEndDate(parse1); |
| | | coursePackageScheduling.setStatus(1); |
| | | coursePackageSchedulingService.insert(coursePackageScheduling); |
| | | CoursePackageStudent student1 = new CoursePackageStudent(); |
| | | student1.setAppUserId(student.getAppUserId()); |
| | | student1.setStudentId(student.getId()); |
| | | student1.setCoursePackageId(tCoursePackage.getId()); |
| | | student1.setCoursePackagePaymentId(studentPay.getId()); |
| | | student1.setCoursePackageSchedulingId(coursePackageScheduling.getId()); |
| | | student1.setSignInOrNot(1); |
| | | student1.setReservationStatus(1); |
| | | student1.setInsertTime(new Date()); |
| | | cpsMapper.insert(student1); |
| | | count++; |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | }else { |
| | | |
| | |
| | | orinPay.setTotalClassHours(0); |
| | | orinPay.setLaveClassHours(0); |
| | | orinPay.setAppUserId(null); |
| | | orinPay.setStatus(6); |
| | | orinPay.setStatus(1); |
| | | paymentService.updateById(orinPay); |
| | | |
| | | |
| | | |
| | | //删除orin的排课记录 |
| | | List<CoursePackageStudent> studentCourse1 = coursePackageStudentService.list(new QueryWrapper<CoursePackageStudent>().eq("studentId", orinPay.getStudentId()).eq("coursePackageId", orinPay.getCoursePackageId())); |
| | | List<Long> collect1 = studentCourse1.stream().map(CoursePackageStudent::getCoursePackageSchedulingId).collect(Collectors.toList()); |
| | | //拿到最后一天的排课记录 |
| | | if (collect1.size()>0) { |
| | | coursePackageSchedulingService.delete(new QueryWrapper<CoursePackageScheduling>().in("id", collect1)); |
| | | coursePackageStudentService.remove(new QueryWrapper<CoursePackageStudent>().eq("studentId", toClassDto.getToStudentId()).eq("coursePackageId", studentPay.getCoursePackageId())); |
| | | } |
| | | |
| | | |
| | | CourseCounsum courseCounsum = new CourseCounsum(); |
| | | courseCounsum.setInsertTime(new Date()); |
| | | courseCounsum.setReason("课时转移"); |
| | | courseCounsum.setReason("赠课"); |
| | | courseCounsum.setNum(orinPay.getLaveClassHours()); |
| | | courseCounsum.setChangeType(0); |
| | | courseCounsum.setPaymentId(orinPay.getId()); |
| | |
| | | |
| | | CourseCounsum courseCounsum1 = new CourseCounsum(); |
| | | courseCounsum1.setInsertTime(new Date()); |
| | | courseCounsum1.setReason("课时转移"); |
| | | courseCounsum1.setReason("赠课"); |
| | | courseCounsum1.setNum(orinPay.getLaveClassHours()); |
| | | courseCounsum1.setChangeType(1); |
| | | courseCounsum1.setPaymentId(to.getId()); |
| | | counsumService.save(courseCounsum); |
| | | |
| | | |
| | | |
| | | TCoursePackage tCoursePackage = packageService.getById(studentPay.getCoursePackageId()); |
| | | String classWeeks = tCoursePackage.getClassWeeks(); |
| | | List<Integer> week = week(classWeeks); |
| | | |
| | | String[] split = tCoursePackage.getClassStartTime().split(","); |
| | | String[] split1 = tCoursePackage.getClassEndTime().split(","); |
| | | SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); |
| | | SimpleDateFormat format1 = new SimpleDateFormat("yyyy-MM-dd HH:mm"); |
| | | // 本周周几 |
| | | |
| | | List<CoursePackageStudent> studentCourse = coursePackageStudentService.list(new QueryWrapper<CoursePackageStudent>().eq("studentId", toClassDto.getToStudentId()).eq("coursePackageId", studentPay.getCoursePackageId())); |
| | | List<Long> collect = studentCourse.stream().map(CoursePackageStudent::getCoursePackageSchedulingId).collect(Collectors.toList()); |
| | | //拿到最后一天的排课记录 |
| | | if (collect.size()>0) { |
| | | coursePackageSchedulingService.delete(new QueryWrapper<CoursePackageScheduling>().in("id", collect)); |
| | | coursePackageStudentService.remove(new QueryWrapper<CoursePackageStudent>().eq("studentId", toClassDto.getToStudentId()).eq("coursePackageId", studentPay.getCoursePackageId())); |
| | | } |
| | | |
| | | |
| | | |
| | | Date today = new Date(); |
| | | |
| | | |
| | | |
| | | |
| | | TCoursePackagePayment pay = coursePackagePaymentService.getById(studentPay.getId()); |
| | | Integer laveClassHours2 = pay.getLaveClassHours(); |
| | | Integer codeTime = tCoursePackage.getCodeTime(); |
| | | Integer can = 0; |
| | | int count = 0; |
| | | // 本周周几 |
| | | // int i = DateUtil.dayOfWeek(new Date())-1; |
| | | |
| | | Date[] dates = generateDateArray(14,today); |
| | | can = laveClassHours2/codeTime; |
| | | |
| | | for (Date date : dates) { |
| | | if (count==can){ |
| | | break; |
| | | } |
| | | int wei = DateUtil.dayOfWeek(date); |
| | | if (week.contains(wei)){ |
| | | for (int i1 = 0; i1 < split.length; i1++) { |
| | | if (count==can){ |
| | | break; |
| | | } |
| | | CoursePackageScheduling coursePackageScheduling = new CoursePackageScheduling(); |
| | | coursePackageScheduling.setCoursePackageId(tCoursePackage.getId()); |
| | | Date parse = format1.parse(format.format(date) + " " + split[i1]); |
| | | Date parse1 = format1.parse(format.format(date) + " " + split1[i1]); |
| | | coursePackageScheduling.setClassDate(parse); |
| | | coursePackageScheduling.setEndDate(parse1); |
| | | coursePackageScheduling.setStatus(1); |
| | | coursePackageSchedulingService.insert(coursePackageScheduling); |
| | | CoursePackageStudent student1 = new CoursePackageStudent(); |
| | | student1.setAppUserId(student.getAppUserId()); |
| | | student1.setStudentId(student.getId()); |
| | | student1.setCoursePackageId(tCoursePackage.getId()); |
| | | student1.setCoursePackagePaymentId(studentPay.getId()); |
| | | student1.setCoursePackageSchedulingId(coursePackageScheduling.getId()); |
| | | student1.setSignInOrNot(1); |
| | | student1.setReservationStatus(1); |
| | | student1.setInsertTime(new Date()); |
| | | cpsMapper.insert(student1); |
| | | count++; |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | |
| | | |
| | | @Resource |
| | | private StudentClient studentClient; |
| | | @Autowired |
| | | private CourseCounsumService courseCounsumService; |
| | | @RequestMapping(value = "/toHoli",produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = "application/json;charset=UTF-8") |
| | | @ResponseBody |
| | | public String toHoli(@RequestBody ToHoliDto toHoliDto) throws ParseException { |
| | |
| | | payment.setLaveClassHours(laveClassHoursnew); |
| | | payment.setTotalClassHours(totalClassHoursnew); |
| | | payment.setAppUserId(null); |
| | | payment.setStatus(3); |
| | | // payment.setStatus(3); |
| | | |
| | | paymentService.updateById(payment); |
| | | |
| | |
| | | holi.setPayStatus(2); |
| | | paymentService.save(holi); |
| | | |
| | | |
| | | CourseCounsum courseCounsum = new CourseCounsum(); |
| | | courseCounsum.setPaymentId(holi.getId()); |
| | | courseCounsum.setChangeType(0); |
| | | courseCounsum.setNum(classNum); |
| | | courseCounsum.setInsertTime(new Date()); |
| | | courseCounsum.setReason("报名假期班"); |
| | | courseCounsumService.save(courseCounsum); |
| | | |
| | | //排假期课 |
| | | |
| | | TCoursePackage tCoursePackage = packageService.getById(toHoliDto.getClassId()); |
| | | String classWeeks = tCoursePackage.getClassWeeks(); |
| | | List<Integer> week = week(classWeeks); |
| | | |
| | | Date today = new Date(); |
| | | |
| | | Date startTime = tCoursePackage.getStartTime(); |
| | | Date endTime = tCoursePackage.getEndTime(); |
| | | LocalDate startDate = startTime.toInstant().atZone(ZoneId.systemDefault()).toLocalDate(); |
| | | LocalDate endDate = endTime.toInstant().atZone(ZoneId.systemDefault()).toLocalDate(); |
| | | Period period = Period.between(startDate, endDate); |
| | | int days = period.getDays() + 1; |
| | | Integer can =999; |
| | | int count = 0; |
| | | String[] split = tCoursePackage.getClassStartTime().split(","); |
| | | String[] split1 = tCoursePackage.getClassEndTime().split(","); |
| | | SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); |
| | | SimpleDateFormat format1 = new SimpleDateFormat("yyyy-MM-dd HH:mm"); |
| | | // 本周周几 |
| | | int i = DateUtil.dayOfWeek(new Date())-1; |
| | | for (Integer integer : week) { |
| | | if(integer<i){ |
| | | // 找下一周的时间 |
| | | Calendar instance = Calendar.getInstance(); |
| | | instance.add(Calendar.DATE,7-(i-integer)); |
| | | Date time = instance.getTime(); |
| | | |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTime(startTime); |
| | | calendar.add(Calendar.DAY_OF_MONTH, -1); |
| | | |
| | | Date[] dates = generateDateArray(days,calendar.getTime()); |
| | | for (Date date : dates) { |
| | | if (count==can){ |
| | | break; |
| | | } |
| | | int wei = cn.hutool.core.date.DateUtil.dayOfWeek(date)-1; |
| | | if (wei == 0){ |
| | | wei =7; |
| | | } |
| | | if (week.contains(wei)){ |
| | | for (int i1 = 0; i1 < split.length; i1++) { |
| | | |
| | | CoursePackageScheduling coursePackageScheduling = new CoursePackageScheduling(); |
| | | coursePackageScheduling.setCoursePackageId(tCoursePackage.getId()); |
| | | Date parse = format1.parse(format.format(time) + " " + split[i1]); |
| | | Date parse1 = format1.parse(format.format(time) + " " + split1[i1]); |
| | | coursePackageScheduling.setClassDate(parse); |
| | | coursePackageScheduling.setEndDate(parse1); |
| | | coursePackageScheduling.setStatus(1); |
| | | coursePackageSchedulingService.insert(coursePackageScheduling); |
| | | |
| | | CoursePackageStudent student1 = new CoursePackageStudent(); |
| | | student1.setAppUserId(student.getAppUserId()); |
| | | student1.setStudentId(student.getId()); |
| | | student1.setCoursePackageId(tCoursePackage.getId()); |
| | | student1.setCoursePackagePaymentId(holi.getId()); |
| | | student1.setCoursePackageSchedulingId(coursePackageScheduling.getId()); |
| | | student1.setSignInOrNot(1); |
| | | student1.setReservationStatus(1); |
| | | student1.setInsertTime(new Date()); |
| | | studentService.save(student1); |
| | | |
| | | } |
| | | |
| | | }else if(integer>i) { |
| | | Calendar instance = Calendar.getInstance(); |
| | | instance.add(Calendar.DATE,integer-i); |
| | | Date time1 = instance.getTime(); |
| | | List<Date> list = new ArrayList<>(); |
| | | list.add(time1); |
| | | instance.add(Calendar.DATE,7); |
| | | Date time2 = instance.getTime(); |
| | | list.add(time2); |
| | | for (Date time : list) { |
| | | for (int i1 = 0; i1 < split.length; i1++) { |
| | | CoursePackageScheduling coursePackageScheduling = new CoursePackageScheduling(); |
| | | coursePackageScheduling.setCoursePackageId(tCoursePackage.getId()); |
| | | Date parse = format1.parse(format.format(time) + " " + split[i1]); |
| | | Date parse1 = format1.parse(format.format(time) + " " + split1[i1]); |
| | | coursePackageScheduling.setClassDate(parse); |
| | | coursePackageScheduling.setEndDate(parse1); |
| | | coursePackageScheduling.setStatus(1); |
| | | coursePackageSchedulingService.insert(coursePackageScheduling); |
| | | |
| | | CoursePackageStudent student1 = new CoursePackageStudent(); |
| | | student1.setAppUserId(student.getAppUserId()); |
| | | student1.setStudentId(student.getId()); |
| | | student1.setCoursePackageId(tCoursePackage.getId()); |
| | | student1.setCoursePackagePaymentId(holi.getId()); |
| | | student1.setCoursePackageSchedulingId(coursePackageScheduling.getId()); |
| | | student1.setSignInOrNot(1); |
| | | student1.setReservationStatus(1); |
| | | student1.setInsertTime(new Date()); |
| | | studentService.save(student1); |
| | | if (count==can){ |
| | | break; |
| | | } |
| | | } |
| | | |
| | | }else { |
| | | Calendar instance = Calendar.getInstance(); |
| | | instance.add(Calendar.DATE,7); |
| | | Date time = instance.getTime(); |
| | | |
| | | for (int i1 = 0; i1 < split.length; i1++) { |
| | | CoursePackageScheduling coursePackageScheduling = new CoursePackageScheduling(); |
| | | coursePackageScheduling.setCoursePackageId(tCoursePackage.getId()); |
| | | Date parse = format1.parse(format.format(time) + " " + split[i1]); |
| | | Date parse1 = format1.parse(format.format(time) + " " + split1[i1]); |
| | | coursePackageScheduling.setClassDate(parse); |
| | | coursePackageScheduling.setEndDate(parse1); |
| | | coursePackageScheduling.setStatus(1); |
| | | coursePackageSchedulingService.insert(coursePackageScheduling); |
| | | |
| | | Date parse = format1.parse(format.format(date) + " " + split[i1]); |
| | | Date parse1 = format1.parse(format.format(date) + " " + split1[i1]); |
| | | coursePackageScheduling.setClassDate(parse); |
| | | coursePackageScheduling.setEndDate(parse1); |
| | | coursePackageScheduling.setStatus(1); |
| | | coursePackageSchedulingService.insert(coursePackageScheduling); |
| | | CoursePackageStudent student1 = new CoursePackageStudent(); |
| | | student1.setAppUserId(student.getAppUserId()); |
| | | student1.setStudentId(student.getId()); |
| | | student1.setCoursePackageId(tCoursePackage.getId()); |
| | | student1.setCoursePackageId(toHoliDto.getClassId()); |
| | | student1.setCoursePackagePaymentId(holi.getId()); |
| | | student1.setCoursePackageSchedulingId(coursePackageScheduling.getId()); |
| | | student1.setSignInOrNot(1); |
| | | student1.setReservationStatus(1); |
| | | student1.setInsertTime(new Date()); |
| | | studentService.save(student1); |
| | | count++; |
| | | } |
| | | } |
| | | } |
| | |
| | | |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | @Autowired |
| | | private TCoursePackagePaymentService coursePackagePaymentService; |
| | | public static Date[] generateDateArray(int numDays,Date date) { |
| | | // LocalDate tomorrow = LocalDate.now().plusDays(1); |
| | | LocalDate tomorrow = date.toInstant().atZone(ZoneId.systemDefault()).toLocalDate().plusDays(1); |
| | | |
| | | Date[] dates = new Date[numDays]; |
| | | |
| | | for (int i = 0; i < numDays; i++) { |
| | | LocalDate currentDate = tomorrow.plusDays(i); |
| | | dates[i] = Date.from(currentDate.atStartOfDay(ZoneId.systemDefault()).toInstant()); |
| | | } |
| | | |
| | | return dates; |
| | | } |
| | | private List<Integer> week(String week){ |
| | | String[] split = week.split(";"); |
| | |
| | | return integers; |
| | | } |
| | | |
| | | |
| | | @Autowired |
| | | private CoursePackageStudentService coursePackageStudentService; |
| | | @RequestMapping(value = "/toTrans",produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = "application/json;charset=UTF-8") |
| | | @ResponseBody |
| | | public String toTrans(@RequestBody ToHoliDto toHoliDto) throws ParseException { |
| | |
| | | |
| | | //新增课时 |
| | | |
| | | TCoursePackagePayment holi = new TCoursePackagePayment(); |
| | | holi.setAppUserId(student.getAppUserId()); |
| | | holi.setStudentId(student.getId()); |
| | | holi.setCoursePackageId(toHoliDto.getClassId()); |
| | | holi.setTotalClassHours(laveClassHours); |
| | | holi.setLaveClassHours(laveClassHours); |
| | | holi.setState(1); |
| | | holi.setInsertTime(new Date()); |
| | | holi.setPayStatus(2); |
| | | paymentService.save(holi); |
| | | TCoursePackagePayment one = paymentService.getOne(new QueryWrapper<TCoursePackagePayment>().eq("studentId", student.getId()).eq("coursePackageId", toHoliDto.getClassId())); |
| | | |
| | | TCoursePackagePayment holi = new TCoursePackagePayment(); |
| | | if (one==null){ |
| | | holi.setAppUserId(student.getAppUserId()); |
| | | holi.setStudentId(student.getId()); |
| | | holi.setCoursePackageId(toHoliDto.getClassId()); |
| | | holi.setTotalClassHours(laveClassHours); |
| | | holi.setLaveClassHours(laveClassHours); |
| | | holi.setState(1); |
| | | holi.setInsertTime(new Date()); |
| | | holi.setPayStatus(2); |
| | | holi.setStatus(1); |
| | | paymentService.save(holi); |
| | | |
| | | }else{ |
| | | one.setTotalClassHours(one.getTotalClassHours()+laveClassHours); |
| | | one.setLaveClassHours(one.getLaveClassHours()+laveClassHours); |
| | | one.setAppUserId(null); |
| | | paymentService.updateById(one); |
| | | holi=one; |
| | | } |
| | | System.out.println("保存成功=============》="+holi); |
| | | |
| | | |
| | | CourseCounsum courseCounsum = new CourseCounsum(); |
| | | courseCounsum.setPaymentId(holi.getId()); |
| | | courseCounsum.setChangeType(1); |
| | | courseCounsum.setNum(laveClassHours); |
| | | courseCounsum.setInsertTime(new Date()); |
| | | courseCounsum.setReason("换课"); |
| | | courseCounsumService.save(courseCounsum); |
| | | |
| | | |
| | | |
| | |
| | | SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); |
| | | SimpleDateFormat format1 = new SimpleDateFormat("yyyy-MM-dd HH:mm"); |
| | | // 本周周几 |
| | | int i = DateUtil.dayOfWeek(new Date())-1; |
| | | for (Integer integer : week) { |
| | | if(integer<i){ |
| | | // 找下一周的时间 |
| | | Calendar instance = Calendar.getInstance(); |
| | | instance.add(Calendar.DATE,7-(i-integer)); |
| | | Date time = instance.getTime(); |
| | | |
| | | List<CoursePackageStudent> studentCourse = coursePackageStudentService.list(new QueryWrapper<CoursePackageStudent>().eq("studentId", student.getId()).eq("coursePackageId", toHoliDto.getClassId())); |
| | | List<Long> collect = studentCourse.stream().map(CoursePackageStudent::getCoursePackageSchedulingId).collect(Collectors.toList()); |
| | | //拿到最后一天的排课记录 |
| | | if (collect.size()>0) { |
| | | coursePackageSchedulingService.delete(new QueryWrapper<CoursePackageScheduling>().in("id", collect)); |
| | | coursePackageStudentService.remove(new QueryWrapper<CoursePackageStudent>().eq("studentId", student.getId()).eq("coursePackageId", toHoliDto.getClassId())); |
| | | } |
| | | |
| | | |
| | | Date today = new Date(); |
| | | |
| | | |
| | | |
| | | |
| | | TCoursePackagePayment pay = coursePackagePaymentService.getById(holi.getId()); |
| | | Integer laveClassHours1 = pay.getLaveClassHours(); |
| | | Integer codeTime = tCoursePackage.getCodeTime(); |
| | | Integer can = 0; |
| | | |
| | | |
| | | int count = 0; |
| | | |
| | | // 本周周几 |
| | | // int i = DateUtil.dayOfWeek(new Date())-1; |
| | | |
| | | Date[] dates = generateDateArray(14,today); |
| | | can = laveClassHours1/codeTime; |
| | | |
| | | for (Date date : dates) { |
| | | if (count==can){ |
| | | break; |
| | | } |
| | | int wei = DateUtil.dayOfWeek(date); |
| | | if (week.contains(wei)){ |
| | | for (int i1 = 0; i1 < split.length; i1++) { |
| | | |
| | | CoursePackageScheduling coursePackageScheduling = new CoursePackageScheduling(); |
| | | coursePackageScheduling.setCoursePackageId(tCoursePackage.getId()); |
| | | Date parse = format1.parse(format.format(time) + " " + split[i1]); |
| | | Date parse1 = format1.parse(format.format(time) + " " + split1[i1]); |
| | | coursePackageScheduling.setClassDate(parse); |
| | | coursePackageScheduling.setEndDate(parse1); |
| | | coursePackageScheduling.setStatus(1); |
| | | coursePackageSchedulingService.insert(coursePackageScheduling); |
| | | |
| | | CoursePackageStudent student1 = new CoursePackageStudent(); |
| | | student1.setAppUserId(student.getAppUserId()); |
| | | student1.setStudentId(student.getId()); |
| | | student1.setCoursePackageId(tCoursePackage.getId()); |
| | | student1.setCoursePackagePaymentId(holi.getId()); |
| | | student1.setCoursePackageSchedulingId(coursePackageScheduling.getId()); |
| | | student1.setSignInOrNot(1); |
| | | student1.setReservationStatus(1); |
| | | student1.setInsertTime(new Date()); |
| | | studentService.save(student1); |
| | | |
| | | } |
| | | |
| | | }else if(integer>i) { |
| | | Calendar instance = Calendar.getInstance(); |
| | | instance.add(Calendar.DATE,integer-i); |
| | | Date time1 = instance.getTime(); |
| | | List<Date> list = new ArrayList<>(); |
| | | list.add(time1); |
| | | instance.add(Calendar.DATE,7); |
| | | Date time2 = instance.getTime(); |
| | | list.add(time2); |
| | | for (Date time : list) { |
| | | for (int i1 = 0; i1 < split.length; i1++) { |
| | | CoursePackageScheduling coursePackageScheduling = new CoursePackageScheduling(); |
| | | coursePackageScheduling.setCoursePackageId(tCoursePackage.getId()); |
| | | Date parse = format1.parse(format.format(time) + " " + split[i1]); |
| | | Date parse1 = format1.parse(format.format(time) + " " + split1[i1]); |
| | | coursePackageScheduling.setClassDate(parse); |
| | | coursePackageScheduling.setEndDate(parse1); |
| | | coursePackageScheduling.setStatus(1); |
| | | coursePackageSchedulingService.insert(coursePackageScheduling); |
| | | |
| | | CoursePackageStudent student1 = new CoursePackageStudent(); |
| | | student1.setAppUserId(student.getAppUserId()); |
| | | student1.setStudentId(student.getId()); |
| | | student1.setCoursePackageId(tCoursePackage.getId()); |
| | | student1.setCoursePackagePaymentId(holi.getId()); |
| | | student1.setCoursePackageSchedulingId(coursePackageScheduling.getId()); |
| | | student1.setSignInOrNot(1); |
| | | student1.setReservationStatus(1); |
| | | student1.setInsertTime(new Date()); |
| | | studentService.save(student1); |
| | | if (count==can){ |
| | | break; |
| | | } |
| | | } |
| | | |
| | | }else { |
| | | Calendar instance = Calendar.getInstance(); |
| | | instance.add(Calendar.DATE,7); |
| | | Date time = instance.getTime(); |
| | | |
| | | for (int i1 = 0; i1 < split.length; i1++) { |
| | | CoursePackageScheduling coursePackageScheduling = new CoursePackageScheduling(); |
| | | coursePackageScheduling.setCoursePackageId(tCoursePackage.getId()); |
| | | Date parse = format1.parse(format.format(time) + " " + split[i1]); |
| | | Date parse1 = format1.parse(format.format(time) + " " + split1[i1]); |
| | | coursePackageScheduling.setClassDate(parse); |
| | | coursePackageScheduling.setEndDate(parse1); |
| | | coursePackageScheduling.setStatus(1); |
| | | coursePackageSchedulingService.insert(coursePackageScheduling); |
| | | |
| | | Date parse = format1.parse(format.format(date) + " " + split[i1]); |
| | | Date parse1 = format1.parse(format.format(date) + " " + split1[i1]); |
| | | coursePackageScheduling.setClassDate(parse); |
| | | coursePackageScheduling.setEndDate(parse1); |
| | | coursePackageScheduling.setStatus(1); |
| | | coursePackageSchedulingService.insert(coursePackageScheduling); |
| | | CoursePackageStudent student1 = new CoursePackageStudent(); |
| | | student1.setAppUserId(student.getAppUserId()); |
| | | student1.setStudentId(student.getId()); |
| | |
| | | student1.setSignInOrNot(1); |
| | | student1.setReservationStatus(1); |
| | | student1.setInsertTime(new Date()); |
| | | studentService.save(student1); |
| | | cpsMapper.insert(student1); |
| | | count++; |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | |
| | | |
| | | String join = StringUtils.join(stringArray, ","); |
| | | System.out.println("==========join========"+join); |
| | | return "课时转移成功"; |
| | | return "转课成功"; |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | |
| | | |
| | | QueryWrapper<CoursePackageStudent> queryWrapper1 = new QueryWrapper<CoursePackageStudent>().eq("appUserId", id); |
| | | QueryWrapper<CoursePackageStudent> queryWrapper1 = new QueryWrapper<CoursePackageStudent>().eq("studentId", id); |
| | | List<CoursePackageStudent> list = coursePackageStudentService.list(queryWrapper1); |
| | | List<Long> longs = new ArrayList<>(); |
| | | for (CoursePackageStudent coursePackageStudent : list) { |
| | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.models.auth.In; |
| | | import lombok.Data; |
| | | |
| | |
| | | @TableField("paymentId") |
| | | Long paymentId; |
| | | @TableField("insertTime") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm",timezone = "GMT+8") |
| | | Date insertTime; |
| | | @TableField("appUserId") |
| | | Integer appUserId; |
| | | } |
New file |
| | |
| | | package com.dsh.course.entity; |
| | | |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class OrderDto { |
| | | private String stuIds; |
| | | |
| | | private Integer appUserId; |
| | | |
| | | private Integer classId; |
| | | |
| | | private Integer classHours; |
| | | } |
New file |
| | |
| | | package com.dsh.course.entity; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class RecordTimeRequest { |
| | | |
| | | @ApiModelProperty(value = "学员id", dataType = "int", required = true) |
| | | private Integer stuId; |
| | | |
| | | @ApiModelProperty(value = "结束时间 格式:yyyy-MM", dataType = "string") |
| | | private String time; |
| | | |
| | | @ApiModelProperty(value = "类型:1增加 2扣减 ", dataType = "int") |
| | | private Integer type; |
| | | |
| | | @ApiModelProperty(value = "课包id", dataType = "int") |
| | | private Integer lessionId; |
| | | } |
| | |
| | | @PostMapping("/base/userConpon/getCoupons") |
| | | List<Coupon> getCoupons(String couponIds); |
| | | |
| | | |
| | | @PostMapping("/coupon/queryCouponByUid") |
| | | List<Coupon> queryCouponByUid(Integer uid); |
| | | } |
| | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @date 2023/6/24 17:34 |
| | |
| | | private Integer applicantsNumber; |
| | | |
| | | @ApiModelProperty("包含课时数") |
| | | private Integer classHours; |
| | | private List<Integer> classHours; |
| | | |
| | | @ApiModelProperty("价格") |
| | | private Double originalPrice; |
| | | |
| | | |
| | | @ApiModelProperty("玩湃币价格") |
| | | private Integer coin; |
| | | } |
| | |
| | | |
| | | @ApiModelProperty(value = "课时有效期") |
| | | private String periodOfValidity; |
| | | @ApiModelProperty(value = "课程类型") |
| | | private Integer courseType; |
| | | @ApiModelProperty(value = "是否过滤分配课时") |
| | | private Integer isAble; |
| | | } |
| | |
| | | /** |
| | | * 获取排课预约信息 |
| | | * @param page |
| | | * @param coursePackageSchedulingId |
| | | * @param ids |
| | | * @param userId |
| | | * @param studentId |
| | | * @return |
| | | */ |
| | | List<Map<String, Object>> queryCoursePackageStudentList(Page<Map<String, Object>> page, @Param("coursePackageSchedulingId") Long coursePackageSchedulingId, |
| | | List<Map<String, Object>> queryCoursePackageStudentList(Page<Map<String, Object>> page, @Param("ids") List<Long> ids, |
| | | @Param("userId") List<Integer> userId, @Param("studentId") List<Integer> studentId); |
| | | |
| | | StudentClassInfo listAll(@Param("tStudentId")Integer tStudentId); |
| | |
| | | private Double money; |
| | | |
| | | private Integer isType=1; |
| | | |
| | | private Integer courseType; |
| | | } |
| | |
| | | @ApiModelProperty(value = "课程名称/门店名称",dataType = "string",required = false) |
| | | private String search; |
| | | |
| | | @ApiModelProperty(value = "学员id",dataType = "int",required = true) |
| | | private Integer stuId; |
| | | |
| | | |
| | | } |
| | |
| | | |
| | | @ApiModelProperty(value = "需要扣除的课时数",dataType = "int") |
| | | private Integer num; |
| | | @ApiModelProperty(value = "学员stuId") |
| | | private Integer stuId; |
| | | |
| | | } |
| | |
| | | |
| | | @ApiModelProperty("详情图片") |
| | | private String detailDrawing; |
| | | @ApiModelProperty("假期有效期") |
| | | private String time; |
| | | @ApiModelProperty("1常规 2假期 3体验") |
| | | private Integer type; |
| | | } |
| | |
| | | @ApiModelProperty(value = "门店距离") |
| | | private String storeDistance; |
| | | |
| | | @ApiModelProperty(value = "玩湃币") |
| | | private Integer coin; |
| | | |
| | | |
| | | } |
| | |
| | | |
| | | @ApiModelProperty(value = "玩湃币") |
| | | private Integer wanpaiGold; |
| | | @ApiModelProperty("详情图片") |
| | | private String detailDrawing; |
| | | |
| | | @ApiModelProperty("课程类型") |
| | | private Integer type; |
| | | |
| | | @ApiModelProperty("假期时间") |
| | | private String holiTime; |
| | | |
| | | private Integer payType; |
| | | |
| | | } |
| | |
| | | for (AppUserVideoResponse appUserVideoRespon : appUserVideoResponses) { |
| | | if (appUserVideoRespon.getVideoId() != null) { |
| | | if (this.baseMapper.isHave(appUserVideoRespon.getVideoId()) > 0) { |
| | | appUserVideoRespon.setStudyStatus(1); |
| | | appUserVideoRespon.setStudyStatus(2); |
| | | } else { |
| | | appUserVideoRespon.setStudyStatus(0); |
| | | appUserVideoRespon.setStudyStatus(1); |
| | | } |
| | | } |
| | | } |
| | |
| | | package com.dsh.course.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.dsh.course.entity.CoursePackageScheduling; |
| | | import com.dsh.course.entity.CoursePackageStudent; |
| | | import com.dsh.course.entity.StudentClassInfo; |
| | | import com.dsh.course.entity.TAppUser; |
| | |
| | | import com.dsh.course.feignclient.account.StudentClient; |
| | | import com.dsh.course.feignclient.account.model.AppUser; |
| | | import com.dsh.course.feignclient.account.model.Student; |
| | | import com.dsh.course.mapper.CoursePackageSchedulingMapper; |
| | | import com.dsh.course.mapper.CoursePackageStudentMapper; |
| | | import com.dsh.course.model.QueryCoursePackageStudentList; |
| | | import com.dsh.course.service.CoursePackageSchedulingService; |
| | | import com.dsh.course.service.CoursePackageStudentService; |
| | | import com.dsh.course.util.ToolUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | |
| | | |
| | | |
| | | |
| | | |
| | | @Autowired |
| | | private CoursePackageSchedulingMapper coursePackageSchedulingService; |
| | | |
| | | /** |
| | | * 获取排课预约数据 |
| | |
| | | studentId = students.stream().map(Student::getId).collect(Collectors.toList()); |
| | | } |
| | | } |
| | | List<Map<String, Object>> list = this.baseMapper.queryCoursePackageStudentList(page, queryCoursePackageStudentList.getCoursePackageSchedulingId(), userId, studentId); |
| | | |
| | | |
| | | CoursePackageScheduling coursePackageScheduling = coursePackageSchedulingService.selectById(queryCoursePackageStudentList.getCoursePackageSchedulingId()); |
| | | List<CoursePackageScheduling> coursePackageSchedulings = coursePackageSchedulingService.selectList(new QueryWrapper<CoursePackageScheduling>().eq("coursePackageId", coursePackageScheduling.getCoursePackageId()).eq("classDate", coursePackageScheduling.getClassDate())); |
| | | |
| | | |
| | | List<Long> ids = new ArrayList<>(); |
| | | for (CoursePackageScheduling packageScheduling : coursePackageSchedulings) { |
| | | ids.add(packageScheduling.getId()); |
| | | } |
| | | |
| | | List<Map<String, Object>> list = this.baseMapper.queryCoursePackageStudentList(page, ids, userId, studentId); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy"); |
| | | Integer now = Integer.valueOf(sdf.format(new Date())); |
| | | for (Map<String, Object> map : list) { |
| | |
| | | import com.dsh.course.model.vo.response.Details; |
| | | import com.dsh.course.model.vo.response.ExchangeCoursePackageResponse; |
| | | import com.dsh.course.service.TCoursePackageDiscountService; |
| | | import com.dsh.course.util.DateTimeHelper; |
| | | import com.dsh.course.util.LocalDateTimeUtils; |
| | | import com.dsh.course.util.StrUtils; |
| | | import com.dsh.course.util.*; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.text.ParseException; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.ArrayList; |
| | | import java.util.Calendar; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | List<Details> list = new ArrayList<>(); |
| | | |
| | | QueryWrapper<TCoursePackageDiscount> tCoursePackageDiscountQueryWrapper = new QueryWrapper<>(); |
| | | tCoursePackageDiscountQueryWrapper.eq("auditStatus", 2); |
| | | tCoursePackageDiscountQueryWrapper.eq("auditStatus", 2).eq("status",1); |
| | | List<TCoursePackageDiscount> tCoursePackageDiscounts = new ArrayList<>(); |
| | | int weekStr = LocalDateTimeUtils.getWeekStr(); |
| | | if (null == discountType || discountType == 1) { |
| | |
| | | Date parse2 = null; |
| | | String startDate = jsonObject.getString("startDate"); |
| | | String endDate = jsonObject.getString("endDate"); |
| | | String startTime = jsonObject.getString("startTime"); |
| | | String endTime = jsonObject.getString("endTime"); |
| | | |
| | | SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss"); |
| | | String currentTime = sdf.format(new Date()); |
| | | |
| | | boolean isWithinTimeRange = false; |
| | | try { |
| | | Date currentTimeDate = sdf.parse(currentTime); |
| | | Date startTimeDate = sdf.parse(startTime); |
| | | Date endTimeDate = sdf.parse(endTime); |
| | | |
| | | if (currentTimeDate.after(startTimeDate) && currentTimeDate.before(endTimeDate)) { |
| | | isWithinTimeRange = true; |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | try { |
| | | parse1 = simpleDateFormat.parse(startDate); |
| | | parse2 = simpleDateFormat.parse(endDate); |
| | |
| | | |
| | | if (isWithinRange) { |
| | | // 判断当前日期是否在开始时间和结束时间范围内 |
| | | if (isDateWithinRange(localTime, parse1, parse2)) { |
| | | if (isDateWithinRange(localTime, parse1, parse2)){ |
| | | Details resde = new Details(); |
| | | |
| | | resde.setCoursePackageDiscountId(tCoursePackageDiscount.getId()); |
| | |
| | | resde.setDate(localTime); |
| | | resde.setOriginalPrice(paymentConfig.getCashPayment()); |
| | | resde.setDiscountPrice(cashPayment); |
| | | resde.setStatus(1); |
| | | if (isWithinTimeRange) { |
| | | resde.setStatus(1); |
| | | }else { |
| | | resde.setStatus(2); |
| | | } |
| | | GetDistanceVo distanceVo = new GetDistanceVo(); |
| | | distanceVo.setLatitude(lat); |
| | | distanceVo.setLongitude(lon); |
| | | distanceVo.setStoreId(coursePackage.getStoreId()); |
| | | String s = sreClient.calculateDistance(distanceVo); |
| | | resde.setStoreDistance(s); |
| | | |
| | | |
| | | |
| | | |
| | | list.add(resde); |
| | | } |
| | | } |
| | |
| | | Date parse2 = null; |
| | | String startDate = jsonObject.getString("startDate"); |
| | | String endDate = jsonObject.getString("endDate"); |
| | | String startTime = jsonObject.getString("startTime"); |
| | | String endTime = jsonObject.getString("endTime"); |
| | | |
| | | SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss"); |
| | | String currentTime = sdf.format(new Date()); |
| | | |
| | | boolean isWithinTimeRange = false; |
| | | try { |
| | | Date currentTimeDate = sdf.parse(currentTime); |
| | | Date startTimeDate = sdf.parse(startTime); |
| | | Date endTimeDate = sdf.parse(endTime); |
| | | |
| | | if (currentTimeDate.after(startTimeDate) && currentTimeDate.before(endTimeDate)) { |
| | | isWithinTimeRange = true; |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | try { |
| | | parse1 = simpleDateFormat.parse(startDate); |
| | | parse2 = simpleDateFormat.parse(endDate); |
| | |
| | | CoursePackagePaymentConfig paymentConfig = cppcMapper.selectById(tCoursePackageDiscount.getCoursePackagePaymentConfigId()); |
| | | resde.setCourseHours(paymentConfig.getClassHours()); |
| | | resde.setDonateHours(cashPayment); |
| | | resde.setCoin(paymentConfig.getPlayPaiCoin()); |
| | | resde.setDataTime("今日"); |
| | | resde.setDate(localTime); |
| | | resde.setOriginalPrice(paymentConfig.getCashPayment()); |
| | | resde.setStatus(1); |
| | | if (isWithinTimeRange) { |
| | | resde.setStatus(1); |
| | | }else { |
| | | resde.setStatus(2); |
| | | |
| | | } |
| | | GetDistanceVo distanceVo = new GetDistanceVo(); |
| | | distanceVo.setLatitude(lat); |
| | | distanceVo.setLongitude(lon); |
| | |
| | | resde.setCourseHours(paymentConfig.getClassHours()); |
| | | resde.setDonateHours(cashPayment); |
| | | String weekOfDate = ""; |
| | | resde.setCoin(paymentConfig.getPlayPaiCoin()); |
| | | if (weekStr != 7 && tempDate.equals(tomorrowDate)) { |
| | | weekOfDate = "明日"; |
| | | } else { |
| | |
| | | packageResponse.setCoursePackageDiscountId(coursePackageId); |
| | | |
| | | TCoursePackage coursePackage = tcpMapper.selectById(coursePackageId); |
| | | |
| | | packageResponse.setType(coursePackage.getType()); |
| | | packageResponse.setCoverDrawing(coursePackage.getCoverDrawing()); |
| | | packageResponse.setIntroduceDrawing(coursePackage.getIntroduceDrawing()); |
| | | packageResponse.setCoursePackageName(coursePackage.getName()); |
| | | packageResponse.setDetailDrawing(coursePackage.getDetailDrawing()); |
| | | // packageResponse.setPayType(coursePackage.getPayType()); |
| | | |
| | | |
| | | if (coursePackage.getType()==2) { |
| | | Date startTime = coursePackage.getStartTime(); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy.MM.dd"); |
| | | String formattedDate = sdf.format(startTime); |
| | | |
| | | Date endTime = coursePackage.getEndTime(); |
| | | String formattedDate1 = sdf.format(endTime); |
| | | |
| | | packageResponse.setHoliTime(formattedDate +"-"+ formattedDate1); |
| | | |
| | | } |
| | | 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()); |
| | | String s = sreClient.calculateDistance(distanceVo); |
| | | packageResponse.setDistance(Double.valueOf(s)); |
| | | |
| | | if(ToolUtil.isNotEmpty(lon) && ToolUtil.isNotEmpty(lat)){ |
| | | Map<String, Double> distance = GeodesyUtil.getDistance(lon + "," + lat, store.getLon() + "," + store.getLat()); |
| | | double wgs84 = new BigDecimal(distance.get("WGS84")).divide(new BigDecimal(1000)).setScale(2, RoundingMode.HALF_EVEN).doubleValue(); |
| | | packageResponse.setDistance(wgs84); |
| | | } |
| | | |
| | | // distanceVo.setLatitude(lat); |
| | | // distanceVo.setLongitude(lon); |
| | | // distanceVo.setStoreId(coursePackage.getStoreId()); |
| | | // String s = sreClient.calculateDistance(distanceVo); |
| | | // |
| | | // |
| | | // packageResponse.setDistance(Double.valueOf(s)); |
| | | if (coursePackageDiscount.getType() == 1 || coursePackageDiscount.getType() == 2){ |
| | | return packageResponse; |
| | | } |
| | |
| | | CoursePackagePaymentConfig paymentConfig = cppcMapper.selectById(coursePackageDiscount.getCoursePackagePaymentConfigId()); |
| | | if (coursePackageDiscount.getType() == 3 ||coursePackageDiscount.getType() == 4){ |
| | | Double cashPayment = jsonObject.getDouble("cashPayment"); |
| | | |
| | | if(ToolUtil.isNotEmpty(paymentConfig.getCashPayment()) && paymentConfig.getCashPayment()>0 && ToolUtil.isNotEmpty(paymentConfig.getPlayPaiCoin()) && paymentConfig.getPlayPaiCoin()>0 ){ |
| | | packageResponse.setPayType(3); |
| | | }else if(ToolUtil.isNotEmpty(paymentConfig.getCashPayment()) && paymentConfig.getCashPayment()>0){ |
| | | packageResponse.setPayType(1); |
| | | }else if( ToolUtil.isNotEmpty(paymentConfig.getPlayPaiCoin()) && paymentConfig.getPlayPaiCoin()>0 ){ |
| | | packageResponse.setPayType(2); |
| | | } |
| | | |
| | | packageResponse.setClassHours(paymentConfig.getClassHours()); |
| | | packageResponse.setCostPrice(paymentConfig.getCashPayment()); |
| | | packageResponse.setDiscountPrice(cashPayment); |
| | | if (paymentConfig.getPlayPaiCoin()!=null) { |
| | | packageResponse.setWanpaiGold(paymentConfig.getPlayPaiCoin()); |
| | | } |
| | | if (cashPayment!=null) { |
| | | packageResponse.setDiscountPrice(cashPayment); |
| | | |
| | | }else { |
| | | packageResponse.setDiscountPrice(paymentConfig.getCashPayment()); |
| | | packageResponse.setCostPrice(null); |
| | | } |
| | | Integer cashPayment1 = jsonObject.getInteger("hour"); |
| | | packageResponse.setFreeClassHours(cashPayment1); |
| | | }else { |
| | | packageResponse.setClassHours(paymentConfig.getClassHours()); |
| | | |
| | |
| | | } |
| | | packageResponse.setWeekTime(courWeeks.toString()); |
| | | } |
| | | packageResponse.setTime(coursePackage.getClassStartTime()+"-"+coursePackage.getClassEndTime()); |
| | | |
| | | String classStartTime = coursePackage.getClassStartTime(); |
| | | String classEndTime = coursePackage.getClassEndTime(); |
| | | ArrayList<String> classTime = new ArrayList<>(); |
| | | String[] split4 = classStartTime.split(","); |
| | | String[] split3 = classEndTime.split(","); |
| | | if(ToolUtil.isNotEmpty(classStartTime)){ |
| | | for (int i = 0; i < split4.length; i++) { |
| | | String s = split4[i].substring(0,5) + "-" + split3[i].substring(0,5); |
| | | classTime.add(s); |
| | | } |
| | | } |
| | | |
| | | String classTimeAsString = String.join(" | ", classTime); |
| | | |
| | | |
| | | |
| | | packageResponse.setTime(classTimeAsString); |
| | | |
| | | return packageResponse; |
| | | } |
| | |
| | | import com.dsh.course.model.vo.RegisterCourseVo; |
| | | import com.dsh.course.model.vo.request.*; |
| | | import com.dsh.course.model.vo.response.*; |
| | | import com.dsh.course.service.CoursePackageSchedulingService; |
| | | import com.dsh.course.service.ICoursePackageSchedulingService; |
| | | import com.dsh.course.service.TCoursePackagePaymentService; |
| | | import com.dsh.course.service.*; |
| | | import com.dsh.course.util.*; |
| | | import com.fasterxml.jackson.core.JsonProcessingException; |
| | | import com.fasterxml.jackson.databind.ObjectMapper; |
| | |
| | | import java.math.RoundingMode; |
| | | import java.text.ParseException; |
| | | import java.text.SimpleDateFormat; |
| | | import java.time.LocalDate; |
| | | import java.time.ZoneId; |
| | | import java.util.*; |
| | | import java.util.regex.Matcher; |
| | | import java.util.regex.Pattern; |
| | |
| | | } |
| | | return responses; |
| | | } |
| | | |
| | | @Autowired |
| | | private TCourseService courseService; |
| | | @Override |
| | | public CourseOfVideoResponse queryVideoDetails(CourseWithDetailsRequest detailsRequest,Integer appUserId) { |
| | | CourseOfVideoResponse response = new CourseOfVideoResponse(); |
| | | BenefitsVideos videosWithIds = bfvoClient.getVideosWithIds(detailsRequest.getVideoId()); |
| | | // BenefitsVideos videosWithIds = bfvoClient.getVideosWithIds(detailsRequest.getVideoId()); |
| | | TCourse byId = courseService.getById(detailsRequest.getVideoId()); |
| | | TCoursePackage coursePackage = tcpmapper.selectById(detailsRequest.getCoursePackageId()); |
| | | if (null != videosWithIds && null != coursePackage){ |
| | | |
| | | if (null != coursePackage){ |
| | | response.setCoursePackageId(coursePackage.getId()); |
| | | response.setVideoId(videosWithIds.getId()); |
| | | response.setVideoURL(videosWithIds.getVideos()); |
| | | response.setVideoName(videosWithIds.getName()); |
| | | response.setIntegral(videosWithIds.getIntegral()); |
| | | response.setVideoId(byId.getId()); |
| | | response.setVideoURL(byId.getCourseVideo()); |
| | | response.setVideoName(coursePackage.getName()); |
| | | // response.setIntegral(byId.getIntegral()); |
| | | UserVideoDetails userVideoDetails = uvdmapper.selectOne(new QueryWrapper<UserVideoDetails>() |
| | | .eq("appUserId",appUserId ) |
| | | .eq("coursePackageId",coursePackage.getId()) |
| | | .eq("courseId",videosWithIds.getId())); |
| | | .eq("courseId",detailsRequest.getVideoId())); |
| | | |
| | | response.setStudyStatus(userVideoDetails.getState()); |
| | | if (userVideoDetails!=null) { |
| | | response.setStudyStatus(userVideoDetails.getState()); |
| | | }else { |
| | | response.setStudyStatus(1); |
| | | } |
| | | response.setPackageName(coursePackage.getName()); |
| | | response.setSynopsis(videosWithIds.getIntroduction()); |
| | | response.setDetailedDiagram(coursePackage.getIntroduceDrawing()); |
| | | response.setCover(videosWithIds.getCover()); |
| | | response.setSynopsis(byId.getIntroduce()); |
| | | response.setDetailedDiagram(byId.getIntroductionDrawing()); |
| | | response.setCover(byId.getCoverDrawing()); |
| | | } |
| | | |
| | | return response; |
| | |
| | | } |
| | | List<CoursePackageStudent> coursePackageStudents = cpsMapper.selectList(new QueryWrapper<CoursePackageStudent>() |
| | | .eq("coursePackageId",coursePackage.getId()) |
| | | .eq("studentId",appUserId )); |
| | | .eq("appUserId",appUserId )); |
| | | |
| | | List<Long> ids = new ArrayList<>(); |
| | | for (CoursePackageStudent coursePackageStudent : coursePackageStudents) { |
| | | ids.add(coursePackageStudent.getCoursePackageSchedulingId()); |
| | | } |
| | | List<CoursePackageScheduling> cps =new ArrayList<>(); |
| | | |
| | | if (!ids.isEmpty()) { |
| | | cps = coursePackageSchedulingService.list(new QueryWrapper<CoursePackageScheduling>().in("id", ids)); |
| | | } |
| | | Integer counts = 0; |
| | | |
| | | for (CoursePackageScheduling cp : cps) { |
| | | if (cp.getDeductClassHour()!=null) { |
| | | counts = counts + cp.getDeductClassHour(); |
| | | } |
| | | } |
| | | |
| | | |
| | | // Integer counts = cpsMapper.selectCount(new QueryWrapper<CoursePackageStudent>() |
| | | // .eq("coursePackageId",coursePackage.getId()) |
| | | // .eq("appUserId",appUserId )); |
| | | |
| | | if (coursePackageStudents.size() > 0 ){ |
| | | registerCourseVo.setCourseNums(coursePackageStudents.size() * 2); |
| | | // registerCourseVo.setCourseNums(coursePackageStudents.size() * 2); |
| | | registerCourseVo.setCourseNums(counts); |
| | | } |
| | | registerCourseVo.setPayStatus(tCoursePackagePayment.getPayStatus()); |
| | | courseVos.add(registerCourseVo); |
| | |
| | | return courseVos; |
| | | } |
| | | |
| | | @Autowired |
| | | private ICoursePackagePaymentConfigService coursePackagePaymentConfigService; |
| | | |
| | | @Autowired |
| | | private TCoursePackageDiscountService coursePackageDiscountService; |
| | | |
| | | @Override |
| | | public CourseDetailsResponse queryRegisteredCourseDetails(Long coursePayId, Integer appUserId) { |
| | | AppUser appUser = appuClient.queryAppUser(appUserId); |
| | | CourseDetailsResponse response = new CourseDetailsResponse(); |
| | | TCoursePackagePayment tCoursePackagePayment = this.baseMapper.selectById(coursePayId); |
| | | |
| | | if (null != tCoursePackagePayment){ |
| | | TCoursePackage coursePackage = tcpmapper.selectById(tCoursePackagePayment.getCoursePackageId()); |
| | | if (coursePackage.getType()==2) { |
| | | response.setTime(new SimpleDateFormat("yyyy.MM.dd").format(coursePackage.getStartTime()) + "-" + new SimpleDateFormat("yyyy.MM.dd").format(coursePackage.getEndTime())); |
| | | } |
| | | |
| | | |
| | | response.setCoursePackageId(tCoursePackagePayment.getCoursePackageId()); |
| | | response.setCoverDrawing(coursePackage.getCoverDrawing()); |
| | | response.setDetailDrawing(coursePackage.getDetailDrawing()); |
| | | response.setCoursePackageName(coursePackage.getName()); |
| | | response.setCoursePayId(tCoursePackagePayment.getId()); |
| | | response.setType(coursePackage.getType()); |
| | | List<Integer> integers = StrUtils.dealStrToList(coursePackage.getClassWeeks()); |
| | | String classWeeks = coursePackage.getClassWeeks(); |
| | | if (integers.size() > 0){ |
| | | StringBuilder courWeeks = new StringBuilder("每"); |
| | | for (Integer integer : integers) { |
| | | courWeeks.append(integer).append("、"); |
| | | } |
| | | if (courWeeks.length() > 0 && courWeeks.charAt(courWeeks.length() - 1) == '、'){ |
| | | courWeeks.deleteCharAt(courWeeks.length() - 1); |
| | | } |
| | | StringBuilder courWeeks = new StringBuilder("每"+classWeeks); |
| | | // for (Integer integer : integers) { |
| | | // courWeeks.append(integer).append("、"); |
| | | // } |
| | | // if (courWeeks.length() > 0 && courWeeks.charAt(courWeeks.length() - 1) == '、'){ |
| | | // courWeeks.deleteCharAt(courWeeks.length() - 1); |
| | | // } |
| | | response.setWeeks(courWeeks.toString()); |
| | | } |
| | | response.setCourseTimeFrame(coursePackage.getClassStartTime()+"-"+coursePackage.getClassEndTime()); |
| | | ArrayList<String> classTime = new ArrayList<>(); |
| | | String[] split4 = coursePackage.getClassStartTime().split(","); |
| | | String[] split3 = coursePackage.getClassEndTime().split(","); |
| | | if(ToolUtil.isNotEmpty(coursePackage.getClassStartTime())){ |
| | | for (int i = 0; i < split4.length; i++) { |
| | | String s = split4[i].substring(0,5) + "-" + split3[i].substring(0,5); |
| | | classTime.add(s); |
| | | } |
| | | } |
| | | |
| | | String joinedString = String.join("|", classTime); |
| | | |
| | | response.setCourseTimeFrame(joinedString); |
| | | |
| | | |
| | | // response.setCourseTimeFrame(coursePackage.getClassStartTime()+"-"+coursePackage.getClassEndTime()); |
| | | response.setIntroduceDrawing(coursePackage.getIntroduceDrawing()); |
| | | |
| | | Integer payType = tCoursePackagePayment.getPayType(); |
| | |
| | | } |
| | | } |
| | | |
| | | switch (payType) { |
| | | case 1: |
| | | case 2: |
| | | response.setAmount(cashPaymentValue); |
| | | response.setVipAmount(discountMember); |
| | | break; |
| | | case 3: |
| | | response.setWpGold(playPaiCoin); |
| | | break; |
| | | } |
| | | // switch (payType) { |
| | | // case 1: |
| | | // case 2: |
| | | // response.setAmount(cashPaymentValue); |
| | | // response.setVipAmount(discountMember); |
| | | // break; |
| | | // case 3: |
| | | // response.setWpGold(playPaiCoin); |
| | | // break; |
| | | // } |
| | | |
| | | // coursePackage.get |
| | | |
| | | |
| | | response.setPayStatus(tCoursePackagePayment.getPayStatus()); |
| | | |
| | | |
| | | List<CoursePackagePaymentConfigVo> list = new ArrayList<>(); |
| | | List<CoursePackagePaymentConfig> list1 = coursePackagePaymentConfigService.list(new QueryWrapper<CoursePackagePaymentConfig>().eq("coursePackageId", coursePackage.getId()).orderByAsc("classHours")); |
| | | list1.forEach(coursePackagePaymentConfig -> { |
| | | CoursePackagePaymentConfigVo coursePackagePaymentConfigVo = new CoursePackagePaymentConfigVo(); |
| | | coursePackagePaymentConfigVo.setId(coursePackagePaymentConfig.getId()); |
| | | coursePackagePaymentConfigVo.setClassHours(coursePackagePaymentConfig.getClassHours()); |
| | | coursePackagePaymentConfigVo.setPlayPaiCoin(coursePackagePaymentConfig.getPlayPaiCoin()); |
| | | |
| | | if(ToolUtil.isNotEmpty(coursePackagePaymentConfig.getCashPayment()) && coursePackagePaymentConfig.getCashPayment()>0 && ToolUtil.isNotEmpty(coursePackagePaymentConfig.getPlayPaiCoin()) && coursePackagePaymentConfig.getPlayPaiCoin()>0 ){ |
| | | coursePackagePaymentConfigVo.setPayType(3); |
| | | }else if(ToolUtil.isNotEmpty(coursePackagePaymentConfig.getCashPayment()) && coursePackagePaymentConfig.getCashPayment()>0){ |
| | | coursePackagePaymentConfigVo.setPayType(1); |
| | | }else if( ToolUtil.isNotEmpty(coursePackagePaymentConfig.getPlayPaiCoin()) && coursePackagePaymentConfig.getPlayPaiCoin()>0 ){ |
| | | coursePackagePaymentConfigVo.setPayType(2); |
| | | } |
| | | |
| | | // coursePackagePaymentConfigVo.setPayType(coursePackage.getPayType()); |
| | | //会员显示原价和支付价(会员价)。非会员显示会员价和支付价(最低) |
| | | if(appUser.getIsVip() == 0){//非会员 |
| | | List<TCoursePackageDiscount> list2 = coursePackageDiscountService.list(new QueryWrapper<TCoursePackageDiscount>().eq("coursePackagePaymentConfigId", coursePackagePaymentConfig.getId()) |
| | | .eq("type", 1).eq("auditStatus", 2)); |
| | | Double vipPrice = coursePackagePaymentConfig.getCashPayment(); |
| | | for (TCoursePackageDiscount coursePackageDiscount1 : list2) { |
| | | Double num1 = JSON.parseObject(coursePackageDiscount1.getContent()).getDouble("discountMember"); |
| | | if(vipPrice.compareTo(num1) > 0){ |
| | | vipPrice = num1; |
| | | } |
| | | } |
| | | coursePackagePaymentConfigVo.setVipPrice(vipPrice); |
| | | Double paymentPrice = coursePackagePaymentConfig.getCashPayment(); |
| | | List<TCoursePackageDiscount> list3 = coursePackageDiscountService.list(new QueryWrapper<TCoursePackageDiscount>().eq("coursePackagePaymentConfigId", coursePackagePaymentConfig.getId()) |
| | | .eq("type", 3).eq("auditStatus", 2)); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | for (TCoursePackageDiscount coursePackageDiscount2 : list3) { |
| | | /** |
| | | * [{ |
| | | * "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 |
| | | * }] |
| | | */ |
| | | JSONArray jsonArray = JSON.parseArray(coursePackageDiscount2.getContent()); |
| | | for (int i = 0; i < jsonArray.size(); i++) { |
| | | try { |
| | | JSONObject jsonObject = jsonArray.getJSONObject(i); |
| | | String startDate = jsonObject.getString("startDate"); |
| | | String endDate = jsonObject.getString("endDate"); |
| | | String startTime = jsonObject.getString("startTime"); |
| | | String endTime = jsonObject.getString("endTime"); |
| | | List<Integer> weeks = jsonObject.getJSONArray("weeks").toJavaList(Integer.class); |
| | | Double cashPayment2 = jsonObject.getDouble("cashPayment"); |
| | | Date startDate_date = sdf.parse(startDate); |
| | | Date endDate_date = sdf.parse(endDate); |
| | | long timeMillis = System.currentTimeMillis(); |
| | | if(timeMillis >= startDate_date.getTime() && timeMillis < endDate_date.getTime()){ |
| | | Date date = new Date(); |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTime(date); |
| | | int week = calendar.get(Calendar.DAY_OF_WEEK); |
| | | boolean isFirstSunday = (calendar.getFirstDayOfWeek() == Calendar.SUNDAY); |
| | | if(isFirstSunday){ |
| | | week = week - 1; |
| | | if(week == 0){ |
| | | week = 7; |
| | | } |
| | | } |
| | | if(!weeks.contains(week)){ |
| | | continue; |
| | | } |
| | | |
| | | String[] split1 = startTime.split(":"); |
| | | Integer hour1 = Integer.valueOf(split1[0]); |
| | | Calendar s = Calendar.getInstance(); |
| | | s.setTime(date); |
| | | s.set(Calendar.HOUR_OF_DAY, hour1); |
| | | s.set(Calendar.MINUTE, Integer.valueOf(split1[1])); |
| | | s.set(Calendar.SECOND, Integer.valueOf(split1[2])); |
| | | |
| | | String[] split2 = endTime.split(":"); |
| | | Integer hour2 = Integer.valueOf(split2[0]); |
| | | Calendar e = Calendar.getInstance(); |
| | | e.setTime(date); |
| | | e.set(Calendar.HOUR_OF_DAY, hour2); |
| | | e.set(Calendar.MINUTE, Integer.valueOf(split2[1])); |
| | | e.set(Calendar.SECOND, Integer.valueOf(split2[2])); |
| | | |
| | | if(hour1 > hour2){ |
| | | if(s.getTimeInMillis() > date.getTime()){ |
| | | s.set(Calendar.DAY_OF_YEAR, s.get(Calendar.DAY_OF_YEAR) - 1); |
| | | }else{ |
| | | e.set(Calendar.DAY_OF_YEAR, e.get(Calendar.DAY_OF_YEAR) + 1); |
| | | } |
| | | } |
| | | if(timeMillis >= s.getTimeInMillis() && timeMillis < e.getTimeInMillis() && paymentPrice.compareTo(cashPayment2) > 0){ |
| | | paymentPrice = cashPayment2; |
| | | } |
| | | } |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | | coursePackagePaymentConfigVo.setPaymentPrice(paymentPrice); |
| | | |
| | | if (coursePackagePaymentConfigVo.getPaymentPrice()<coursePackagePaymentConfigVo.getVipPrice()){ |
| | | coursePackagePaymentConfigVo.setOriginalPrice(coursePackagePaymentConfig.getCashPayment()); |
| | | coursePackagePaymentConfigVo.setVipPrice(null); |
| | | } |
| | | |
| | | } |
| | | else{ |
| | | List<TCoursePackageDiscount> list2 = coursePackageDiscountService.list(new QueryWrapper<TCoursePackageDiscount>().eq("coursePackagePaymentConfigId", coursePackagePaymentConfig.getId()) |
| | | .eq("type", 1).eq("auditStatus", 2)); |
| | | Double vipPrice = coursePackagePaymentConfig.getCashPayment(); |
| | | for (TCoursePackageDiscount coursePackageDiscount3 : list2) { |
| | | Double num1 = JSON.parseObject(coursePackageDiscount3.getContent()).getDouble("discountMember"); |
| | | if(vipPrice.compareTo(num1) > 0){ |
| | | vipPrice = num1; |
| | | } |
| | | } |
| | | coursePackagePaymentConfigVo.setPaymentPrice(vipPrice); |
| | | coursePackagePaymentConfigVo.setOriginalPrice(coursePackagePaymentConfig.getCashPayment()); |
| | | } |
| | | list.add(coursePackagePaymentConfigVo); |
| | | }); |
| | | // coursePackageInfo.setList(list); |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | | return response; |
| | | } |
| | |
| | | |
| | | @Override |
| | | public List<RecordAppoint> obtainStuClassDetails(Integer stuId, Integer appUserId,Integer pageNum) { |
| | | |
| | | |
| | | List<RecordAppoint> recordVoList = new ArrayList<>(); |
| | | List<TCoursePackagePayment> tCoursePackagePayments = this.baseMapper.selectList(new QueryWrapper<TCoursePackagePayment>() |
| | | .eq("studentId",stuId ) |
| | |
| | | if (tCoursePackagePayments.size() > 0 ){ |
| | | |
| | | // int pageNum = 1; // 页码 |
| | | int pageSize = 5; // 每页记录数 |
| | | Page<CoursePackageStudent> page = new Page<>(1, pageSize); |
| | | int pageSize = 100; // 每页记录数 |
| | | Page<CoursePackageStudent> page = new Page<>(pageNum, pageSize); |
| | | |
| | | // for (TCoursePackagePayment tCoursePackagePayment : tCoursePackagePayments) { |
| | | // List<CoursePackageStudent> coursePackageStudent1 = cpsMapper.selectList(new QueryWrapper<CoursePackageStudent>() |
| | |
| | | CoursePackageScheduling byId = coursePackageSchedulingService.getById(coursePackageStudent.getCoursePackageSchedulingId()); |
| | | // String classStartTime = coursePackage.getClassStartTime(); |
| | | // String classEndTime = coursePackage.getClassEndTime(); |
| | | //这里是过滤今天之后的数据 |
| | | if (byId == null||byId.getClassDate().after(new Date())){ |
| | | continue; |
| | | } |
| | | |
| | | if (byId == null){ |
| | | continue; |
| | |
| | | List<String> integerList = Arrays.asList(split); |
| | | String weekOfDate = DateTimeHelper.getWeekOfDate(new Date()); |
| | | if (integerList.contains(weekOfDate)){ |
| | | String dat = simpleDateFormat.format(date) +" "+ dateString2.substring(11); |
| | | String dat = simpleDateFormat.format(byId.getClassDate()) +" "+ dateString1.substring(11); |
| | | |
| | | Date start = null; |
| | | try { |
| | |
| | | } catch (ParseException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | if (start.after(new Date())){ |
| | | recordVo.setStatus(1); |
| | | }else if(coursePackageStudent.getSignInOrNot()==2){ |
| | | //已取消 |
| | | if (byId.getStatus()==4){ |
| | | recordVo.setStatus(4); |
| | | } else if(coursePackageStudent.getSignInOrNot()==2){ |
| | | //已请假 |
| | | recordVo.setStatus(5); |
| | | }else { |
| | | } |
| | | else if (start.after(new Date())){ |
| | | //待上课 |
| | | recordVo.setStatus(1); |
| | | } |
| | | // else if(coursePackageStudent.getSignInOrNot()==2){ |
| | | // recordVo.setStatus(5); |
| | | // } |
| | | else { |
| | | // CancelledClasses cancelledClasses = cacMapper.selectOne(new QueryWrapper<CancelledClasses>() |
| | | // .eq("coursePackageId",coursePackageStudent.getCoursePackageId())); |
| | | CancelledClasses cancelledClasses = cacMapper.selectOne(new QueryWrapper<CancelledClasses>() |
| | |
| | | } |
| | | |
| | | }else { |
| | | recordVo.setStatus(2); |
| | | Date now = new Date(); |
| | | if (now.after(byId.getClassDate())&&now.before(byId.getEndDate())){ |
| | | recordVo.setStatus(2); |
| | | }else { |
| | | recordVo.setStatus(3); |
| | | |
| | | } |
| | | } |
| | | } |
| | | }else { |
| | |
| | | return integers; |
| | | } |
| | | |
| | | @Autowired |
| | | private TCoursePackageService packageService; |
| | | |
| | | |
| | | @Autowired |
| | | private TCoursePackagePaymentService packagePaymentService; |
| | | @Autowired |
| | | private CoursePackageStudentService coursePackageStudentService; |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class,propagation = Propagation.REQUIRES_NEW) |
| | | public ResultUtil payCourse(PayCourseReq req,Integer userId){ |
| | |
| | | tCoursePackagePayment.setLaveClassHours(tCoursePackagePayment.getLaveClassHours()-req.getNum()); |
| | | this.baseMapper.updateHoursById(tCoursePackagePayment.getId(),-req.getNum()); |
| | | |
| | | // |
| | | // List<CoursePackageStudent> studentCourse = coursePackageStudentService.list(new QueryWrapper<CoursePackageStudent>().eq("studentId", coursePackagePayment.getStudentId()).eq("coursePackageId", coursePackagePayment.getCoursePackageId())); |
| | | // List<Long> collect = studentCourse.stream().map(CoursePackageStudent::getCoursePackageSchedulingId).collect(Collectors.toList()); |
| | | // coursePackageSchedulingService.remove(new QueryWrapper<CoursePackageScheduling>().in("id",collect)); |
| | | // coursePackageStudentService.remove(new QueryWrapper<CoursePackageStudent>().eq("studentId", paymentDeductionClassHour.getId()).eq("coursePackageId", coursePackagePayment.getCoursePackageId())); |
| | | // |
| | | // TCoursePackage tCoursePackage = packageService.getById(tCoursePackagePayment.getCoursePackageId()); |
| | | // String classWeeks = tCoursePackage.getClassWeeks(); |
| | | // List<Integer> week = week(classWeeks); |
| | | // |
| | | // TCoursePackagePayment pay = packagePaymentService.getOne(new QueryWrapper<TCoursePackagePayment>().eq("coursePackageId", tCoursePackagePayment.getCoursePackageId()).eq("studentId", tCoursePackagePayment.getStudentId())); |
| | | // |
| | | // |
| | | // Date today = new Date(); |
| | | // |
| | | // Integer laveClassHours = pay.getLaveClassHours(); |
| | | // Integer codeTime = tCoursePackage.getCodeTime(); |
| | | // Integer can = laveClassHours/codeTime; |
| | | // |
| | | // int count = 0; |
| | | // String[] split = tCoursePackage.getClassStartTime().split(","); |
| | | // String[] split1 = tCoursePackage.getClassEndTime().split(","); |
| | | // SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); |
| | | // SimpleDateFormat format1 = new SimpleDateFormat("yyyy-MM-dd HH:mm"); |
| | | // |
| | | // Date[] dates = generateDateArray(14,today); |
| | | // for (Date date : dates) { |
| | | // if (count==can){ |
| | | // break; |
| | | // } |
| | | // int wei = cn.hutool.core.date.DateUtil.dayOfWeek(date); |
| | | // if (week.contains(wei)){ |
| | | // for (int i1 = 0; i1 < split.length; i1++) { |
| | | // if (count==can){ |
| | | // break; |
| | | // } |
| | | // CoursePackageScheduling coursePackageScheduling = new CoursePackageScheduling(); |
| | | // coursePackageScheduling.setCoursePackageId(tCoursePackage.getId()); |
| | | // Date parse = format1.parse(format.format(date) + " " + split[i1]); |
| | | // Date parse1 = format1.parse(format.format(date) + " " + split1[i1]); |
| | | // coursePackageScheduling.setClassDate(parse); |
| | | // coursePackageScheduling.setEndDate(parse1); |
| | | // coursePackageScheduling.setStatus(1); |
| | | // coursePackageSchedulingService.save(coursePackageScheduling); |
| | | // CoursePackageStudent student1 = new CoursePackageStudent(); |
| | | // student1.setAppUserId(pay.getAppUserId()); |
| | | // student1.setStudentId(pay.getStudentId()); |
| | | // student1.setCoursePackageId(pay.getCoursePackageId()); |
| | | // student1.setCoursePackagePaymentId(pay.getId()); |
| | | // student1.setCoursePackageSchedulingId(coursePackageScheduling.getId()); |
| | | // student1.setSignInOrNot(1); |
| | | // student1.setReservationStatus(1); |
| | | // student1.setInsertTime(new Date()); |
| | | // studentService.save(student1); |
| | | // count++; |
| | | // } |
| | | // } |
| | | // } |
| | | |
| | | |
| | | |
| | | |
| | | TCoursePackage tCoursePackage = tcpmapper.selectById(req.getCourseId()); |
| | | // 添加课包 |
| | | TCoursePackagePayment tCoursePackagePayment1 = new TCoursePackagePayment(); |
| | | tCoursePackagePayment1.setAppUserId(userId); |
| | | Student student = studentClient.queryDefaultStudent(userId); |
| | | // student ID |
| | | Integer sId=null; |
| | | if(student!=null){ |
| | | tCoursePackagePayment1.setStudentId(student.getId()); |
| | | sId=student.getId(); |
| | | } |
| | | // tCoursePackagePayment1.setAppUserId(userId); |
| | | // Student student = studentClient.queryDefaultStudent(userId); |
| | | // // student ID |
| | | // |
| | | // Integer sId=null; |
| | | // if(student!=null){ |
| | | // tCoursePackagePayment1.setStudentId(student.getId()); |
| | | // sId=student.getId(); |
| | | // } |
| | | tCoursePackagePayment1.setCoursePackageId(tCoursePackage.getId()); |
| | | tCoursePackagePayment1.setStudentId(req.getStuId()); |
| | | tCoursePackagePayment1.setPayType(7); |
| | | tCoursePackagePayment1.setClassHours(req.getNum()); |
| | | tCoursePackagePayment1.setOriginalPrice(0.0); |
| | |
| | | tCoursePackagePayment1.setPayStatus(2); |
| | | tCoursePackagePayment1.setPayUserId(userId); |
| | | tCoursePackagePayment1.setStatus(1); |
| | | tCoursePackagePayment1.setAppUserId(userId); |
| | | tCoursePackagePayment1.setState(1); |
| | | tCoursePackagePayment1.setInsertTime(new Date()); |
| | | this.baseMapper.insert(tCoursePackagePayment1); |
| | |
| | | |
| | | CoursePackageStudent student1 = new CoursePackageStudent(); |
| | | student1.setAppUserId(userId); |
| | | student1.setStudentId(sId); |
| | | student1.setStudentId(req.getStuId()); |
| | | student1.setCoursePackageId(tCoursePackage.getId()); |
| | | student1.setCoursePackagePaymentId(tCoursePackagePayment1.getId()); |
| | | student1.setCoursePackageSchedulingId(coursePackageScheduling.getId()); |
| | |
| | | |
| | | |
| | | |
| | | public static Date[] generateDateArray(int numDays,Date date) { |
| | | // LocalDate tomorrow = LocalDate.now().plusDays(1); |
| | | LocalDate tomorrow = date.toInstant().atZone(ZoneId.systemDefault()).toLocalDate().plusDays(1); |
| | | |
| | | Date[] dates = new Date[numDays]; |
| | | |
| | | for (int i = 0; i < numDays; i++) { |
| | | LocalDate currentDate = tomorrow.plusDays(i); |
| | | dates[i] = Date.from(currentDate.atStartOfDay(ZoneId.systemDefault()).toInstant()); |
| | | } |
| | | |
| | | return dates; |
| | | } |
| | | |
| | | } |
| | |
| | | package com.dsh.course.service.impl; |
| | | |
| | | import cn.hutool.core.collection.CollectionUtil; |
| | | import cn.hutool.core.date.DateUtil; |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONArray; |
| | |
| | | import com.dsh.course.model.*; |
| | | import com.dsh.course.service.*; |
| | | import com.dsh.course.util.*; |
| | | import io.vertx.core.json.Json; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import javax.annotation.Resource; |
| | |
| | | import java.text.ParseException; |
| | | import java.text.SimpleDateFormat; |
| | | import java.time.LocalDate; |
| | | import java.time.Period; |
| | | import java.time.ZoneId; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | |
| | | wrapper.or().in("storeId", collect); |
| | | } |
| | | } |
| | | List<TCoursePackage> list = this.list(wrapper.last(" order by sort desc, insertTime desc")); |
| | | List<TCoursePackage> list1 = this.list(wrapper.last(" order by sort desc, insertTime desc")); |
| | | Date currentTime = new Date(); |
| | | |
| | | // Filter the list based on the conditions |
| | | List<TCoursePackage> list = list1.stream() |
| | | .filter(coursePackage -> coursePackage.getType() != 2 || currentTime.before(coursePackage.getEndTime())) |
| | | .collect(Collectors.toList()); |
| | | |
| | | List<CoursePackageListVo> listVos = new ArrayList<>(); |
| | | for (TCoursePackage coursePackage : list) { |
| | | Store store = storeClient.queryStoreById(coursePackage.getStoreId()); |
| | |
| | | coursePackageListVo.setPlayPaiCoin(coursePackagePaymentConfig.getPlayPaiCoin()); |
| | | } |
| | | //会员显示原价和会员价(最低)。非会员显示会员价和支付价(最低) |
| | | if(appUser.getIsVip() == 0){//非会员 |
| | | // if(appUser.getIsVip() == 0){//非会员 |
| | | List<TCoursePackageDiscount> list2 = coursePackageDiscountService.list(new QueryWrapper<TCoursePackageDiscount>().eq("coursePackagePaymentConfigId", coursePackagePaymentConfig.getId()) |
| | | .eq("type", 1).eq("auditStatus", 2)); |
| | | .eq("type", 1).eq("auditStatus", 2).eq("status",1)); |
| | | Double vipPrice = coursePackagePaymentConfig.getCashPayment(); |
| | | for (TCoursePackageDiscount coursePackageDiscount : list2) { |
| | | Double num1 = JSON.parseObject(coursePackageDiscount.getContent()).getDouble("discountMember"); |
| | |
| | | } |
| | | } |
| | | coursePackageListVo.setVipPrice(vipPrice); |
| | | coursePackageListVo.setOriginalPrice(coursePackagePaymentConfig.getCashPayment()); |
| | | |
| | | Double paymentPrice = coursePackagePaymentConfig.getCashPayment(); |
| | | List<TCoursePackageDiscount> list3 = coursePackageDiscountService.list(new QueryWrapper<TCoursePackageDiscount>().eq("coursePackagePaymentConfigId", coursePackagePaymentConfig.getId()) |
| | | .eq("type", 3).eq("auditStatus", 2)); |
| | | List<TCoursePackageDiscount> list3 = coursePackageDiscountService.list(new QueryWrapper<TCoursePackageDiscount>().eq("coursePackagePaymentConfigId", coursePackagePaymentConfig.getId()) |
| | | .eq("type", 3).eq("auditStatus", 2).eq("status",1)); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | for (TCoursePackageDiscount coursePackageDiscount : list3) { |
| | | /** |
| | |
| | | } |
| | | } |
| | | coursePackageListVo.setPaymentPrice(paymentPrice); |
| | | }else{ |
| | | List<TCoursePackageDiscount> list2 = coursePackageDiscountService.list(new QueryWrapper<TCoursePackageDiscount>().eq("coursePackagePaymentConfigId", coursePackagePaymentConfig.getId()) |
| | | .eq("type", 1).eq("auditStatus", 2)); |
| | | Double vipPrice = coursePackagePaymentConfig.getCashPayment(); |
| | | for (TCoursePackageDiscount coursePackageDiscount : list2) { |
| | | Double num1 = JSON.parseObject(coursePackageDiscount.getContent()).getDouble("discountMember"); |
| | | if(vipPrice.compareTo(num1) > 0){ |
| | | vipPrice = num1; |
| | | } |
| | | } |
| | | coursePackageListVo.setPaymentPrice(vipPrice); |
| | | coursePackageListVo.setOriginalPrice(coursePackagePaymentConfig.getCashPayment()); |
| | | } |
| | | |
| | | double vipPrice1 = coursePackageListVo.getVipPrice(); |
| | | double originalPrice1 = coursePackageListVo.getOriginalPrice(); |
| | | double paymentPrice1 = coursePackageListVo.getPaymentPrice(); |
| | | |
| | | double minPrice = Math.min(vipPrice1, Math.min(originalPrice1, paymentPrice1)); |
| | | double maxPrice = Math.max(vipPrice1, Math.max(originalPrice1, paymentPrice1)); |
| | | coursePackageListVo.setPaymentPrice(minPrice); |
| | | coursePackageListVo.setOriginalPrice(maxPrice); |
| | | System.out.println("Minimum price: " + minPrice); |
| | | System.out.println("Maximum price: " + maxPrice); |
| | | // } |
| | | // else{ |
| | | // List<TCoursePackageDiscount> list2 = coursePackageDiscountService.list(new QueryWrapper<TCoursePackageDiscount>().eq("coursePackagePaymentConfigId", coursePackagePaymentConfig.getId()) |
| | | // .eq("type", 1).eq("auditStatus", 2).eq("status",1)); |
| | | // Double vipPrice = coursePackagePaymentConfig.getCashPayment(); |
| | | // for (TCoursePackageDiscount coursePackageDiscount : list2) { |
| | | // Double num1 = JSON.parseObject(coursePackageDiscount.getContent()).getDouble("discountMember"); |
| | | // if(vipPrice.compareTo(num1) > 0){ |
| | | // vipPrice = num1; |
| | | // } |
| | | // } |
| | | // coursePackageListVo.setPaymentPrice(vipPrice); |
| | | // coursePackageListVo.setOriginalPrice(coursePackagePaymentConfig.getCashPayment()); |
| | | // } |
| | | |
| | | Map<String, Double> distance = GeodesyUtil.getDistance(coursePackageList.getLon() + "," + coursePackageList.getLat(), store.getLon() + "," + store.getLat()); |
| | | coursePackageListVo.setDistance(distance.get("WGS84") / 1000); |
| | |
| | | } |
| | | |
| | | //销量排行 |
| | | if(ToolUtil.isNotEmpty(coursePackageList.getSalesRanking())){ |
| | | if(ToolUtil.isNotEmpty(coursePackageList.getSalesRanking())&&coursePackageList.getSalesRanking().equals("asc")){ |
| | | Collections.sort(listVos, new Comparator<CoursePackageListVo>() { |
| | | public int compare(CoursePackageListVo s1, CoursePackageListVo s2) { |
| | | return Integer.compare(s1.getApplicantsNumber(), s2.getApplicantsNumber()); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | |
| | | if(ToolUtil.isNotEmpty(coursePackageList.getSalesRanking())&&coursePackageList.getSalesRanking().equals("desc")){ |
| | | Collections.sort(listVos, new Comparator<CoursePackageListVo>() { |
| | | public int compare(CoursePackageListVo s1, CoursePackageListVo s2) { |
| | | return Integer.compare(s2.getApplicantsNumber(), s1.getApplicantsNumber()); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | |
| | | //距离排行 |
| | | if(ToolUtil.isNotEmpty(coursePackageList.getDistanceSort())){ |
| | | if(ToolUtil.isNotEmpty(coursePackageList.getDistanceSort())&&coursePackageList.getDistanceSort().equals("asc")){ |
| | | Collections.sort(listVos, new Comparator<CoursePackageListVo>() { |
| | | public int compare(CoursePackageListVo s1, CoursePackageListVo s2) { |
| | | return Double.compare(s1.getDistance(), s2.getDistance()); |
| | | } |
| | | }); |
| | | } |
| | | if (ToolUtil.isNotEmpty(coursePackageList.getDistanceSort())&&coursePackageList.getDistanceSort().equals("desc")) { |
| | | Collections.sort(listVos, new Comparator<CoursePackageListVo>() { |
| | | public int compare(CoursePackageListVo s1, CoursePackageListVo s2) { |
| | | return Double.compare(s2.getDistance(), s1.getDistance()); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | |
| | | return listVos; |
| | | } |
| | | |
| | |
| | | coursePackageListVo.setId(coursePackage.getId()); |
| | | coursePackageListVo.setName(coursePackage.getName()); |
| | | coursePackageListVo.setStoreName(null != store ? store.getName() : ""); |
| | | // coursePackageListVo.setPayType(); |
| | | coursePackageListVo.setCoverDrawing(coursePackage.getCoverDrawing()); |
| | | |
| | | Double cashPayment1 = coursePackagePaymentConfig.getCashPayment(); |
| | | Integer playPaiCoin = coursePackagePaymentConfig.getPlayPaiCoin(); |
| | | if(ToolUtil.isNotEmpty(cashPayment1) && cashPayment1>0 && ToolUtil.isNotEmpty(playPaiCoin) && playPaiCoin>0){ |
| | | coursePackageListVo.setPayType(3); |
| | | }else if(ToolUtil.isNotEmpty(cashPayment1) && cashPayment1>0){ |
| | | coursePackageListVo.setPayType(1); |
| | | }else if(ToolUtil.isNotEmpty(playPaiCoin) && playPaiCoin>0){ |
| | | coursePackageListVo.setPayType(2); |
| | | } |
| | | |
| | | // 2.0修改 |
| | | String classStartTime = coursePackage.getClassStartTime(); |
| | |
| | | |
| | | coursePackageInfo.setDetailDrawing(coursePackage.getDetailDrawing()); |
| | | coursePackageInfo.setIntroduceDrawing(coursePackage.getIntroduceDrawing()); |
| | | |
| | | |
| | | List<CoursePackagePaymentConfigVo> list = new ArrayList<>(); |
| | | List<CoursePackagePaymentConfig> list1 = coursePackagePaymentConfigService.list(new QueryWrapper<CoursePackagePaymentConfig>().eq("coursePackageId", id).orderByAsc("classHours")); |
| | | list1.forEach(coursePackagePaymentConfig -> { |
| | |
| | | } |
| | | } |
| | | coursePackagePaymentConfigVo.setVipPrice(vipPrice); |
| | | |
| | | Double paymentPrice = coursePackagePaymentConfig.getCashPayment(); |
| | | List<TCoursePackageDiscount> list3 = coursePackageDiscountService.list(new QueryWrapper<TCoursePackageDiscount>().eq("coursePackagePaymentConfigId", coursePackagePaymentConfig.getId()) |
| | | .eq("type", 3).eq("auditStatus", 2)); |
| | |
| | | } |
| | | } |
| | | coursePackagePaymentConfigVo.setPaymentPrice(paymentPrice); |
| | | }else{ |
| | | |
| | | if (coursePackagePaymentConfigVo.getPaymentPrice()<coursePackagePaymentConfigVo.getVipPrice()){ |
| | | coursePackagePaymentConfigVo.setOriginalPrice(coursePackagePaymentConfig.getCashPayment()); |
| | | coursePackagePaymentConfigVo.setVipPrice(null); |
| | | } |
| | | |
| | | } |
| | | else{ |
| | | List<TCoursePackageDiscount> list2 = coursePackageDiscountService.list(new QueryWrapper<TCoursePackageDiscount>().eq("coursePackagePaymentConfigId", coursePackagePaymentConfig.getId()) |
| | | .eq("type", 1).eq("auditStatus", 2)); |
| | | Double vipPrice = coursePackagePaymentConfig.getCashPayment(); |
| | |
| | | //校验是否已经报满 |
| | | Integer integer = coursePackagePaymentService.queryCountNumber(paymentCourseVo.getId()); |
| | | TCoursePackage course = coursePackageService.getById(paymentCourseVo.getId()); |
| | | if (integer>=course.getMaxSubscribeNumber()){ |
| | | return ResultUtil.error("报名失败,已达最大报名人数"); |
| | | if (course.getType()!=3) { |
| | | |
| | | if (integer + paymentCourseVo.getStudentIds().split(";").length > course.getMaxSubscribeNumber()) { |
| | | return ResultUtil.error("报名失败,已达最大报名人数"); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | List<CoursePackagePaymentConfigVo> list = coursePackageInfo.getList(); |
| | | |
| | | String[] students = paymentCourseVo.getStudentIds().split(";"); |
| | | for (CoursePackagePaymentConfigVo coursePackagePaymentConfigVo : list) { |
| | | if(paymentCourseVo.getCoursePackagePaymentConfigId().compareTo(coursePackagePaymentConfigVo.getId()) == 0){ |
| | |
| | | if((cashPayment!=null || cashPayment>0) &&(playPaiCoin1!=null || playPaiCoin1>0)){ |
| | | payType=3; |
| | | } |
| | | |
| | | if(cashPayment!=null && cashPayment>0 && playPaiCoin1 !=null && playPaiCoin1>0){ |
| | | }else { |
| | | if(payType == 1 && paymentCourseVo.getPayType() == 3){//现金支付 |
| | |
| | | return ResultUtil.error("支付方式错误,请刷新后重试"); |
| | | } |
| | | } |
| | | |
| | | Double paymentPrice = coursePackagePaymentConfigVo.getPaymentPrice();//支付价 |
| | | paymentPrice = new BigDecimal(students.length).multiply(new BigDecimal(paymentPrice)).setScale(2, RoundingMode.HALF_EVEN).doubleValue(); |
| | | Double playPaiCoin = coursePackagePaymentConfigVo.getPlayPaiCoin().doubleValue();//支付币 |
| | | playPaiCoin = new BigDecimal(students.length).multiply(new BigDecimal(playPaiCoin)).setScale(2, RoundingMode.HALF_EVEN).doubleValue(); |
| | | if(paymentCourseVo.getPayType() != 3 && paymentPrice.compareTo(paymentCourseVo.getPrice()) != 0){ |
| | | if(paymentCourseVo.getPayType() != 3 && paymentPrice.compareTo(paymentCourseVo.getPrice()) != 0&&paymentCourseVo.getCouponId()!=null){ |
| | | return ResultUtil.error("支付金额异常,请刷新后重试"); |
| | | } |
| | | if(paymentCourseVo.getPayType() == 3 && playPaiCoin.compareTo(paymentCourseVo.getPrice()) != 0){ |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | Double price = paymentCourseVo.getPrice();//支付金额 |
| | | |
| | | //校验优惠券 |
| | | Long couponId = paymentCourseVo.getCouponId(); |
| | | if(null != couponId && paymentCourseVo.getPayType() != 3){ |
| | |
| | | coursePackagePayment.setState(1); |
| | | coursePackagePayment.setInsertTime(new Date()); |
| | | coursePackagePaymentService.save(coursePackagePayment); |
| | | |
| | | |
| | | CourseCounsum courseCounsum = new CourseCounsum(); |
| | | courseCounsum.setPaymentId(coursePackagePayment.getId()); |
| | | courseCounsum.setChangeType(1); |
| | | courseCounsum.setNum(coursePackagePaymentConfig.getClassHours()); |
| | | courseCounsum.setInsertTime(new Date()); |
| | | courseCounsum.setReason("购买课包"); |
| | | courseCounsumService.save(courseCounsum); |
| | | } |
| | | |
| | | Student student = studentClient.queryDefaultStudent(uid); |
| | |
| | | // 2.0 |
| | | userCouponClient.sendUserCoupon(new SendCouponReq(uid,coursePackagePaymentConfig.getCouponIds())); |
| | | |
| | | addPackageStudent(paymentCourseVo.getId(),uid, finalSid,one.getId()); |
| | | addPackageStudent(paymentCourseVo.getId(),uid, finalSid,one.getId(),null); |
| | | break; |
| | | } |
| | | if("USERPAYING".equals(s)){ |
| | |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS"); |
| | | String code = sdf.format(new Date()) + UUIDUtil.getNumberRandom(5); |
| | | for (String s : split) { |
| | | TCoursePackagePayment coursePackagePayment = new TCoursePackagePayment(); |
| | | coursePackagePayment.setCode(code); |
| | | coursePackagePayment.setAppUserId(uid); |
| | | coursePackagePayment.setStudentId(Integer.valueOf(s)); |
| | | coursePackagePayment.setCoursePackageId(paymentCourseVo.getId()); |
| | | coursePackagePayment.setPayType(paymentCourseVo.getPayType()); |
| | | coursePackagePayment.setClassHours(coursePackagePaymentConfig.getClassHours()); |
| | | coursePackagePayment.setOriginalPrice(paymentCourseVo.getPrice()); |
| | | coursePackagePayment.setUserCouponId(paymentCourseVo.getCouponId()); |
| | | coursePackagePayment.setCashPayment(new BigDecimal(paymentPrice)); |
| | | coursePackagePayment.setTotalClassHours(coursePackagePaymentConfig.getClassHours()); |
| | | coursePackagePayment.setLaveClassHours(coursePackagePaymentConfig.getClassHours()); |
| | | coursePackagePayment.setAbsencesNumber(0); |
| | | coursePackagePayment.setPayUserType(1); |
| | | coursePackagePayment.setPayStatus(1); |
| | | coursePackagePayment.setPayUserId(uid); |
| | | coursePackagePayment.setStatus(1); |
| | | coursePackagePayment.setState(1); |
| | | coursePackagePayment.setInsertTime(new Date()); |
| | | coursePackagePaymentService.save(coursePackagePayment); |
| | | // TCoursePackagePayment coursePackagePayment = new TCoursePackagePayment(); |
| | | // coursePackagePayment.setCode(code); |
| | | // coursePackagePayment.setAppUserId(uid); |
| | | // coursePackagePayment.setStudentId(Integer.valueOf(s)); |
| | | // coursePackagePayment.setCoursePackageId(paymentCourseVo.getId()); |
| | | // coursePackagePayment.setPayType(paymentCourseVo.getPayType()); |
| | | // coursePackagePayment.setClassHours(coursePackagePaymentConfig.getClassHours()); |
| | | // coursePackagePayment.setOriginalPrice(paymentCourseVo.getPrice()); |
| | | // coursePackagePayment.setUserCouponId(paymentCourseVo.getCouponId()); |
| | | // coursePackagePayment.setCashPayment(new BigDecimal(paymentPrice)); |
| | | // coursePackagePayment.setTotalClassHours(coursePackagePaymentConfig.getClassHours()); |
| | | // coursePackagePayment.setLaveClassHours(coursePackagePaymentConfig.getClassHours()); |
| | | // coursePackagePayment.setAbsencesNumber(0); |
| | | // coursePackagePayment.setPayUserType(1); |
| | | // coursePackagePayment.setPayStatus(1); |
| | | // coursePackagePayment.setPayUserId(uid); |
| | | // coursePackagePayment.setStatus(1); |
| | | // coursePackagePayment.setState(1); |
| | | // coursePackagePayment.setInsertTime(new Date()); |
| | | // coursePackagePaymentService.save(coursePackagePayment); |
| | | // |
| | | // |
| | | // CourseCounsum courseCounsum = new CourseCounsum(); |
| | | // courseCounsum.setPaymentId(coursePackagePayment.getId()); |
| | | // courseCounsum.setChangeType(1); |
| | | // courseCounsum.setNum(coursePackagePaymentConfig.getClassHours()); |
| | | // courseCounsum.setInsertTime(new Date()); |
| | | // courseCounsum.setReason("购买课包"); |
| | | // courseCounsumService.save(courseCounsum); |
| | | |
| | | TCoursePackagePayment coursePackagePaymentServiceOne = coursePackagePaymentService.getOne(new QueryWrapper<TCoursePackagePayment>().eq("studentId", s).eq("coursePackageId", paymentCourseVo.getId())); |
| | | |
| | | if (coursePackagePaymentServiceOne==null) { |
| | | TCoursePackagePayment coursePackagePayment = new TCoursePackagePayment(); |
| | | coursePackagePayment.setCode(code); |
| | | coursePackagePayment.setAppUserId(uid); |
| | | coursePackagePayment.setStudentId(Integer.valueOf(s)); |
| | | coursePackagePayment.setCoursePackageId(paymentCourseVo.getId()); |
| | | coursePackagePayment.setPayType(paymentCourseVo.getPayType()); |
| | | coursePackagePayment.setClassHours(coursePackagePaymentConfig.getClassHours()); |
| | | coursePackagePayment.setOriginalPrice(paymentCourseVo.getPrice()); |
| | | coursePackagePayment.setPlayPaiCoin(paymentPrice.intValue()); |
| | | coursePackagePayment.setTotalClassHours(coursePackagePaymentConfig.getClassHours()); |
| | | coursePackagePayment.setLaveClassHours(coursePackagePaymentConfig.getClassHours()); |
| | | coursePackagePayment.setAbsencesNumber(0); |
| | | coursePackagePayment.setPayUserType(1); |
| | | coursePackagePayment.setPayStatus(1); |
| | | coursePackagePayment.setPayUserId(uid); |
| | | coursePackagePayment.setStatus(1); |
| | | coursePackagePayment.setState(1); |
| | | coursePackagePayment.setInsertTime(new Date()); |
| | | coursePackagePaymentService.save(coursePackagePayment); |
| | | Integer sId = null; |
| | | Student student = studentClient.queryDefaultStudent(uid); |
| | | if (student != null) { |
| | | sId = student.getId(); |
| | | } |
| | | |
| | | // coursePackagePaymentServiceOne.setPlayPaiCoin(coursePackagePaymentServiceOne.getPlayPaiCoin()+paymentPrice.intValue()); |
| | | |
| | | // addPackageStudent(paymentCourseVo.getId(), uid, Integer.valueOf(s), coursePackagePayment.getId()); |
| | | |
| | | CourseCounsum courseCounsum = new CourseCounsum(); |
| | | courseCounsum.setPaymentId(coursePackagePayment.getId()); |
| | | courseCounsum.setChangeType(1); |
| | | courseCounsum.setNum(coursePackagePaymentConfig.getClassHours()); |
| | | courseCounsum.setInsertTime(new Date()); |
| | | courseCounsum.setReason("购买课包"); |
| | | courseCounsumService.save(courseCounsum); |
| | | |
| | | }else { |
| | | // coursePackagePaymentServiceOne.setClassHours(coursePackagePaymentServiceOne.getClassHours()+coursePackagePaymentConfig.getClassHours()); |
| | | // coursePackagePaymentServiceOne.setOriginalPrice(coursePackagePaymentServiceOne.getOriginalPrice()+paymentCourseVo.getPrice()); |
| | | // coursePackagePaymentServiceOne.setPlayPaiCoin(coursePackagePaymentServiceOne.getPlayPaiCoin()+paymentPrice.intValue()); |
| | | // coursePackagePaymentServiceOne.setTotalClassHours(coursePackagePaymentServiceOne.getTotalClassHours()+coursePackagePaymentConfig.getClassHours()); |
| | | // coursePackagePaymentServiceOne.setLaveClassHours(coursePackagePaymentServiceOne.getLaveClassHours()+coursePackagePaymentConfig.getClassHours()); |
| | | // coursePackagePaymentServiceOne.setCode(code); |
| | | // |
| | | // coursePackagePaymentServiceOne.setAppUserId(null); |
| | | // coursePackagePaymentServiceOne.setPayStatus(2); |
| | | // coursePackagePaymentService.updateById(coursePackagePaymentServiceOne); |
| | | // |
| | | // Integer sId = null; |
| | | // Student student = studentClient.queryDefaultStudent(uid); |
| | | // if (student != null) { |
| | | // sId = student.getId(); |
| | | // } |
| | | // coursePackagePaymentServiceOne.setPlayPaiCoin(coursePackagePaymentServiceOne.getPlayPaiCoin()+paymentPrice.intValue()); |
| | | // |
| | | // |
| | | // CourseCounsum courseCounsum = new CourseCounsum(); |
| | | // courseCounsum.setPaymentId(coursePackagePaymentServiceOne.getId()); |
| | | // courseCounsum.setChangeType(1); |
| | | // courseCounsum.setNum(coursePackagePaymentConfig.getClassHours()); |
| | | // courseCounsum.setInsertTime(new Date()); |
| | | // courseCounsum.setReason("续课"); |
| | | // courseCounsumService.save(courseCounsum); |
| | | |
| | | |
| | | } |
| | | } |
| | | |
| | | Student student = studentClient.queryDefaultStudent(uid); |
| | |
| | | coursePackagePayment.setOrderNumber(tradeNo); |
| | | coursePackagePayment.setAppUserId(null); |
| | | } |
| | | |
| | | for (String s1 : split) { |
| | | TCoursePackagePayment coursePackagePaymentServiceOne = coursePackagePaymentService.getOne(new QueryWrapper<TCoursePackagePayment>().eq("studentId", s).eq("coursePackageId", paymentCourseVo.getId())); |
| | | if (coursePackagePaymentServiceOne!=null) { |
| | | coursePackagePaymentServiceOne.setClassHours(coursePackagePaymentServiceOne.getClassHours()+coursePackagePaymentConfig.getClassHours()); |
| | | coursePackagePaymentServiceOne.setOriginalPrice(coursePackagePaymentServiceOne.getOriginalPrice()+paymentCourseVo.getPrice()); |
| | | coursePackagePaymentServiceOne.setPlayPaiCoin(coursePackagePaymentServiceOne.getPlayPaiCoin()+paymentPrice.intValue()); |
| | | coursePackagePaymentServiceOne.setTotalClassHours(coursePackagePaymentServiceOne.getTotalClassHours()+coursePackagePaymentConfig.getClassHours()); |
| | | coursePackagePaymentServiceOne.setLaveClassHours(coursePackagePaymentServiceOne.getLaveClassHours()+coursePackagePaymentConfig.getClassHours()); |
| | | coursePackagePaymentServiceOne.setCode(code); |
| | | |
| | | coursePackagePaymentServiceOne.setAppUserId(null); |
| | | coursePackagePaymentServiceOne.setPayStatus(2); |
| | | coursePackagePaymentService.updateById(coursePackagePaymentServiceOne); |
| | | |
| | | Integer sId = null; |
| | | Student student = studentClient.queryDefaultStudent(uid); |
| | | if (student != null) { |
| | | sId = student.getId(); |
| | | } |
| | | coursePackagePaymentServiceOne.setPlayPaiCoin(coursePackagePaymentServiceOne.getPlayPaiCoin()+paymentPrice.intValue()); |
| | | |
| | | |
| | | CourseCounsum courseCounsum = new CourseCounsum(); |
| | | courseCounsum.setPaymentId(coursePackagePaymentServiceOne.getId()); |
| | | courseCounsum.setChangeType(1); |
| | | courseCounsum.setNum(coursePackagePaymentConfig.getClassHours()); |
| | | courseCounsum.setInsertTime(new Date()); |
| | | courseCounsum.setReason("续课"); |
| | | courseCounsumService.save(courseCounsum); |
| | | |
| | | |
| | | } |
| | | } |
| | | |
| | | coursePackagePaymentService.updateBatchById(list); |
| | | System.out.println("===========到达支付"); |
| | | // 2.0 |
| | |
| | | |
| | | userCouponClient.sendUserCoupon(new SendCouponReq(uid,coursePackagePaymentConfig.getCouponIds())); |
| | | |
| | | for (TCoursePackagePayment coursePackagePayment : list) { |
| | | addPackageStudent(paymentCourseVo.getId(),uid, finalSid,coursePackagePayment.getId(),paymentCourseVo.getPrice()); |
| | | |
| | | |
| | | } |
| | | |
| | | moneyOut(tradeNo,tradeNo); |
| | | |
| | | |
| | | |
| | | |
| | | |
| | |
| | | if(student!=null){ |
| | | |
| | | } |
| | | addPackageStudent(paymentCourseVo.getId(),uid, finalSid,one.getId()); |
| | | break; |
| | | } |
| | | if("WAIT_BUYER_PAY".equals(s)){ |
| | |
| | | |
| | | |
| | | |
| | | @Autowired |
| | | private CourseCounsumService courseCounsumService; |
| | | |
| | | |
| | | |
| | | /** |
| | | * 玩湃币支付课程 |
| | |
| | | String[] split = paymentCourseVo.getStudentIds().split(";"); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS"); |
| | | String code = sdf.format(new Date()) + UUIDUtil.getNumberRandom(5); |
| | | for (String s : split) { |
| | | |
| | | TCoursePackagePayment coursePackagePayment = new TCoursePackagePayment(); |
| | | coursePackagePayment.setCode(code); |
| | | coursePackagePayment.setAppUserId(appUser.getId()); |
| | | coursePackagePayment.setStudentId(Integer.valueOf(s)); |
| | | coursePackagePayment.setCoursePackageId(paymentCourseVo.getId()); |
| | | coursePackagePayment.setPayType(paymentCourseVo.getPayType()); |
| | | coursePackagePayment.setClassHours(coursePackagePaymentConfig.getClassHours()); |
| | | coursePackagePayment.setOriginalPrice(paymentCourseVo.getPrice()); |
| | | coursePackagePayment.setPlayPaiCoin(paymentPrice.intValue()); |
| | | coursePackagePayment.setTotalClassHours(coursePackagePaymentConfig.getClassHours()); |
| | | coursePackagePayment.setLaveClassHours(coursePackagePaymentConfig.getClassHours()); |
| | | coursePackagePayment.setAbsencesNumber(0); |
| | | coursePackagePayment.setPayUserType(1); |
| | | coursePackagePayment.setPayStatus(2); |
| | | coursePackagePayment.setPayUserId(appUser.getId()); |
| | | coursePackagePayment.setStatus(1); |
| | | coursePackagePayment.setState(1); |
| | | coursePackagePayment.setInsertTime(new Date()); |
| | | coursePackagePaymentService.save(coursePackagePayment); |
| | | Integer sId=null; |
| | | Student student = studentClient.queryDefaultStudent(appUser.getId()); |
| | | if(student!=null){ |
| | | sId=student.getId(); |
| | | |
| | | //赠送课时 |
| | | int weekday = DateUtil.dayOfWeek(new Date()) - 1; |
| | | TCoursePackageDiscount discount = coursePackageDiscountService.getOne(new QueryWrapper<TCoursePackageDiscount>().eq("type",4).eq("coursePackageId", paymentCourseVo.getId()).last("limit 1")); |
| | | |
| | | Integer hour = 0; |
| | | if (discount!=null) { |
| | | JSONArray objects = JSONObject.parseArray(discount.getContent()); |
| | | JSONObject parse = JSONObject.parseObject(JSONObject.toJSONString(objects.get(0))); |
| | | hour = parse.getInteger("hour"); |
| | | if (hour == null) { |
| | | hour = 0; |
| | | } |
| | | addPackageStudent(paymentCourseVo.getId(),appUser.getId(), Integer.valueOf(s),coursePackagePayment.getId()); |
| | | } |
| | | |
| | | for (String s : split) { |
| | | TCoursePackagePayment coursePackagePaymentServiceOne = coursePackagePaymentService.getOne(new QueryWrapper<TCoursePackagePayment>().eq("studentId", s).eq("coursePackageId", paymentCourseVo.getId())); |
| | | |
| | | |
| | | |
| | | if (coursePackagePaymentServiceOne==null) { |
| | | TCoursePackagePayment coursePackagePayment = new TCoursePackagePayment(); |
| | | coursePackagePayment.setCode(code); |
| | | coursePackagePayment.setAppUserId(appUser.getId()); |
| | | coursePackagePayment.setStudentId(Integer.valueOf(s)); |
| | | coursePackagePayment.setCoursePackageId(paymentCourseVo.getId()); |
| | | coursePackagePayment.setPayType(paymentCourseVo.getPayType()); |
| | | coursePackagePayment.setClassHours(coursePackagePaymentConfig.getClassHours()+hour); |
| | | coursePackagePayment.setOriginalPrice(paymentCourseVo.getPrice()); |
| | | coursePackagePayment.setPlayPaiCoin(paymentPrice.intValue()); |
| | | coursePackagePayment.setTotalClassHours(coursePackagePaymentConfig.getClassHours()+hour); |
| | | coursePackagePayment.setLaveClassHours(coursePackagePaymentConfig.getClassHours()+hour); |
| | | coursePackagePayment.setAbsencesNumber(0); |
| | | coursePackagePayment.setPayUserType(1); |
| | | coursePackagePayment.setPayStatus(2); |
| | | coursePackagePayment.setPayUserId(appUser.getId()); |
| | | coursePackagePayment.setStatus(1); |
| | | coursePackagePayment.setState(1); |
| | | coursePackagePayment.setInsertTime(new Date()); |
| | | coursePackagePaymentService.save(coursePackagePayment); |
| | | Integer sId = null; |
| | | Student student = studentClient.queryDefaultStudent(appUser.getId()); |
| | | if (student != null) { |
| | | sId = student.getId(); |
| | | } |
| | | addPackageStudent(paymentCourseVo.getId(), appUser.getId(), Integer.valueOf(s), coursePackagePayment.getId(),null); |
| | | |
| | | //课时记录 |
| | | CourseCounsum courseCounsum = new CourseCounsum(); |
| | | courseCounsum.setPaymentId(coursePackagePayment.getId()); |
| | | courseCounsum.setChangeType(1); |
| | | courseCounsum.setNum(coursePackagePaymentConfig.getClassHours()); |
| | | courseCounsum.setInsertTime(new Date()); |
| | | courseCounsum.setReason("购买课包"); |
| | | courseCounsumService.save(courseCounsum); |
| | | |
| | | }else{ |
| | | coursePackagePaymentServiceOne.setClassHours(coursePackagePaymentServiceOne.getClassHours()+coursePackagePaymentConfig.getClassHours()+hour); |
| | | if (coursePackagePaymentServiceOne.getOriginalPrice()!=null) { |
| | | coursePackagePaymentServiceOne.setOriginalPrice(coursePackagePaymentServiceOne.getOriginalPrice() + paymentCourseVo.getPrice()); |
| | | }else { |
| | | coursePackagePaymentServiceOne.setOriginalPrice(paymentCourseVo.getPrice()); |
| | | } |
| | | if (coursePackagePaymentServiceOne.getPlayPaiCoin()==null){ |
| | | coursePackagePaymentServiceOne.setPlayPaiCoin(paymentPrice.intValue()); |
| | | |
| | | }else { |
| | | coursePackagePaymentServiceOne.setPlayPaiCoin(coursePackagePaymentServiceOne.getPlayPaiCoin()+paymentPrice.intValue());} |
| | | coursePackagePaymentServiceOne.setTotalClassHours(coursePackagePaymentServiceOne.getTotalClassHours()+coursePackagePaymentConfig.getClassHours()+hour); |
| | | coursePackagePaymentServiceOne.setLaveClassHours(coursePackagePaymentServiceOne.getLaveClassHours()+coursePackagePaymentConfig.getClassHours()+hour); |
| | | coursePackagePaymentServiceOne.setAppUserId(null); |
| | | coursePackagePaymentService.updateById(coursePackagePaymentServiceOne); |
| | | |
| | | // coursePackagePaymentService.save(coursePackagePayment); |
| | | Integer sId = null; |
| | | Student student = studentClient.queryDefaultStudent(appUser.getId()); |
| | | if (student != null) { |
| | | sId = student.getId(); |
| | | } |
| | | addPackageStudent(paymentCourseVo.getId(), appUser.getId(), Integer.valueOf(s), coursePackagePaymentServiceOne.getId(),null); |
| | | |
| | | |
| | | CourseCounsum courseCounsum = new CourseCounsum(); |
| | | courseCounsum.setPaymentId(coursePackagePaymentServiceOne.getId()); |
| | | courseCounsum.setChangeType(1); |
| | | courseCounsum.setNum(coursePackagePaymentConfig.getClassHours()); |
| | | courseCounsum.setInsertTime(new Date()); |
| | | courseCounsum.setReason("续课"); |
| | | courseCounsumService.save(courseCounsum); |
| | | |
| | | |
| | | } |
| | | |
| | | } |
| | | |
| | | Integer playPaiCoins = appUser.getPlayPaiCoins(); |
| | |
| | | |
| | | |
| | | |
| | | private void addPackageStudent(Integer courseId, Integer userId, Integer sId,Long paymentId) throws ParseException { |
| | | private void addPackageStudent(Integer courseId, Integer userId, Integer sId,Long paymentId,Double price) throws ParseException { |
| | | // 课包 |
| | | TCoursePackage tCoursePackage = this.baseMapper.selectById(courseId); |
| | | String classWeeks = tCoursePackage.getClassWeeks(); |
| | | |
| | | List<Integer> week = week(classWeeks); |
| | | if (tCoursePackage.getType()==1) { |
| | | String classWeeks = tCoursePackage.getClassWeeks(); |
| | | |
| | | String[] split = tCoursePackage.getClassStartTime().split(","); |
| | | String[] split1 = tCoursePackage.getClassEndTime().split(","); |
| | | SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); |
| | | SimpleDateFormat format1 = new SimpleDateFormat("yyyy-MM-dd HH:mm"); |
| | | List<Integer> week = week(classWeeks); |
| | | |
| | | //查出当前用户当前学员当前课包最后一天的排课数据 |
| | | List<CoursePackageStudent> studentCourse = coursePackageStudentService.list(new QueryWrapper<CoursePackageStudent>().eq("studentId", sId).eq("coursePackageId", courseId)); |
| | | List<Long> collect = studentCourse.stream().map(CoursePackageStudent::getCoursePackageSchedulingId).collect(Collectors.toList()); |
| | | //拿到最后一天的排课记录 |
| | | String[] split = tCoursePackage.getClassStartTime().split(","); |
| | | String[] split1 = tCoursePackage.getClassEndTime().split(","); |
| | | SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); |
| | | SimpleDateFormat format1 = new SimpleDateFormat("yyyy-MM-dd HH:mm"); |
| | | |
| | | CoursePackageScheduling cs = null; |
| | | if (collect.size()>0) { |
| | | cs = coursePackageSchedulingService.getOne(new QueryWrapper<CoursePackageScheduling>().in("id", collect).orderByDesc("classDate").last("limit 1")); |
| | | |
| | | } |
| | | int i = -1; |
| | | |
| | | // Calendar calendar = Calendar.getInstance(); |
| | | // Date currentDate = calendar.getTime(); |
| | | // calendar.add(Calendar.DAY_OF_MONTH, -1); |
| | | // Date today = calendar.getTime(); |
| | | Date today = new Date(); |
| | | |
| | | //判断最后一天是否超过当前日期 |
| | | if (cs==null||cs.getClassDate().before(new Date())){ |
| | | i = DateUtil.dayOfWeek(new Date())-1; |
| | | }else { |
| | | i = DateUtil.dayOfWeek(cs.getClassDate())-1; |
| | | today = cs.getClassDate(); |
| | | } |
| | | //查出当前用户当前学员当前课包最后一天的排课数据 |
| | | List<CoursePackageStudent> studentCourse = coursePackageStudentService.list(new QueryWrapper<CoursePackageStudent>().eq("studentId", sId).eq("coursePackageId", courseId)); |
| | | List<Long> collect = studentCourse.stream().map(CoursePackageStudent::getCoursePackageSchedulingId).collect(Collectors.toList()); |
| | | |
| | | |
| | | TCoursePackagePayment pay = coursePackagePaymentService.getById(paymentId); |
| | | Integer laveClassHours = pay.getLaveClassHours(); |
| | | Integer codeTime = tCoursePackage.getCodeTime(); |
| | | Integer can = 0; |
| | | |
| | | |
| | | int count = 0; |
| | | //拿到最后一天的排课记录 |
| | | if (collect.size() > 0){ |
| | | coursePackageSchedulingService.remove(new QueryWrapper<CoursePackageScheduling>().in("id", collect)); |
| | | coursePackageStudentService.remove(new QueryWrapper<CoursePackageStudent>().eq("studentId", sId).eq("coursePackageId", courseId)); |
| | | if (price!=null) { |
| | | CourseCounsum courseCounsum = new CourseCounsum(); |
| | | courseCounsum.setPaymentId(paymentId); |
| | | courseCounsum.setChangeType(3); |
| | | courseCounsum.setInsertTime(new Date()); |
| | | courseCounsum.setReason("续课;" + price); |
| | | courseCounsum.setAppUserId(userId); |
| | | courseCounsumService.save(courseCounsum); |
| | | } |
| | | |
| | | // 本周周几 |
| | | // int i = DateUtil.dayOfWeek(new Date())-1; |
| | | |
| | | Date[] dates = generateDateArray(14,today); |
| | | if (tCoursePackage.getType()==1){ |
| | | can = laveClassHours/codeTime; |
| | | } |
| | | if (tCoursePackage.getType()==2){ |
| | | Date startDate = tCoursePackage.getStartTime(); |
| | | Date endDate = tCoursePackage.getEndTime(); |
| | | dates = generateDateArray1(startDate, endDate); |
| | | can = 999; |
| | | } |
| | | |
| | | for (Date date : dates) { |
| | | if (count==can){ |
| | | break; |
| | | } |
| | | int wei = DateUtil.dayOfWeek(date); |
| | | if (week.contains(wei)){ |
| | | for (int i1 = 0; i1 < split.length; i1++) { |
| | | if (count==can){ |
| | | break; |
| | | } |
| | | CoursePackageScheduling coursePackageScheduling = new CoursePackageScheduling(); |
| | | coursePackageScheduling.setCoursePackageId(tCoursePackage.getId()); |
| | | Date parse = format1.parse(format.format(date) + " " + split[i1]); |
| | | Date parse1 = format1.parse(format.format(date) + " " + split1[i1]); |
| | | coursePackageScheduling.setClassDate(parse); |
| | | coursePackageScheduling.setEndDate(parse1); |
| | | coursePackageScheduling.setStatus(1); |
| | | coursePackageSchedulingService.save(coursePackageScheduling); |
| | | CoursePackageStudent student1 = new CoursePackageStudent(); |
| | | student1.setAppUserId(userId); |
| | | student1.setStudentId(sId); |
| | | student1.setCoursePackageId(tCoursePackage.getId()); |
| | | student1.setCoursePackagePaymentId(paymentId); |
| | | student1.setCoursePackageSchedulingId(coursePackageScheduling.getId()); |
| | | student1.setSignInOrNot(1); |
| | | student1.setReservationStatus(1); |
| | | student1.setInsertTime(new Date()); |
| | | cpsMapper.insert(student1); |
| | | count++; |
| | | }else { |
| | | if (price!=null) { |
| | | CourseCounsum courseCounsum = new CourseCounsum(); |
| | | courseCounsum.setPaymentId(paymentId); |
| | | courseCounsum.setChangeType(3); |
| | | courseCounsum.setInsertTime(new Date()); |
| | | courseCounsum.setReason("报名课程;" + price); |
| | | courseCounsum.setAppUserId(userId); |
| | | courseCounsumService.save(courseCounsum); |
| | | } |
| | | } |
| | | Date today = new Date(); |
| | | TCoursePackagePayment pay = coursePackagePaymentService.getById(paymentId); |
| | | Integer laveClassHours = pay.getLaveClassHours(); |
| | | Integer codeTime = tCoursePackage.getCodeTime(); |
| | | Integer can = 0; |
| | | int count = 0; |
| | | // 本周周几 |
| | | Date[] dates = generateDateArray(14, today); |
| | | if (tCoursePackage.getType() == 1) { |
| | | can = laveClassHours / codeTime; |
| | | } |
| | | if (tCoursePackage.getType() == 2) { |
| | | Date startDate = tCoursePackage.getStartTime(); |
| | | Date endDate = tCoursePackage.getEndTime(); |
| | | dates = generateDateArray1(startDate, endDate); |
| | | can = 999; |
| | | } |
| | | for (Date date : dates) { |
| | | if (count == can) { |
| | | break; |
| | | } |
| | | int wei = DateUtil.dayOfWeek(date); |
| | | if (week.contains(wei)) { |
| | | for (int i1 = 0; i1 < split.length; i1++) { |
| | | if (count == can) { |
| | | break; |
| | | } |
| | | CoursePackageScheduling coursePackageScheduling = new CoursePackageScheduling(); |
| | | coursePackageScheduling.setCoursePackageId(tCoursePackage.getId()); |
| | | Date parse = format1.parse(format.format(date) + " " + split[i1]); |
| | | Date parse1 = format1.parse(format.format(date) + " " + split1[i1]); |
| | | coursePackageScheduling.setClassDate(parse); |
| | | coursePackageScheduling.setEndDate(parse1); |
| | | coursePackageScheduling.setStatus(1); |
| | | coursePackageSchedulingService.save(coursePackageScheduling); |
| | | CoursePackageStudent student1 = new CoursePackageStudent(); |
| | | student1.setAppUserId(userId); |
| | | student1.setStudentId(sId); |
| | | student1.setCoursePackageId(tCoursePackage.getId()); |
| | | student1.setCoursePackagePaymentId(paymentId); |
| | | student1.setCoursePackageSchedulingId(coursePackageScheduling.getId()); |
| | | student1.setSignInOrNot(1); |
| | | student1.setReservationStatus(1); |
| | | student1.setInsertTime(new Date()); |
| | | cpsMapper.insert(student1); |
| | | count++; |
| | | } |
| | | } |
| | | } |
| | | |
| | | }else if (tCoursePackage.getType()==2){ |
| | | String classWeeks = tCoursePackage.getClassWeeks(); |
| | | List<Integer> week = week(classWeeks); |
| | | |
| | | Date today = new Date(); |
| | | |
| | | Date startTime = tCoursePackage.getStartTime(); |
| | | Date endTime = tCoursePackage.getEndTime(); |
| | | LocalDate startDate = startTime.toInstant().atZone(ZoneId.systemDefault()).toLocalDate(); |
| | | LocalDate endDate = endTime.toInstant().atZone(ZoneId.systemDefault()).toLocalDate(); |
| | | Period period = Period.between(startDate, endDate); |
| | | int days = period.getDays() + 1; |
| | | Integer can =999; |
| | | int count = 0; |
| | | String[] split = tCoursePackage.getClassStartTime().split(","); |
| | | String[] split1 = tCoursePackage.getClassEndTime().split(","); |
| | | SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); |
| | | SimpleDateFormat format1 = new SimpleDateFormat("yyyy-MM-dd HH:mm"); |
| | | |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTime(startTime); |
| | | calendar.add(Calendar.DAY_OF_MONTH, -1); |
| | | |
| | | TCoursePackagePayment pay = coursePackagePaymentService.getById(paymentId); |
| | | |
| | | |
| | | Date[] dates = generateDateArray(days,calendar.getTime()); |
| | | for (Date date : dates) { |
| | | if (count==can){ |
| | | break; |
| | | } |
| | | int wei = cn.hutool.core.date.DateUtil.dayOfWeek(date)-1; |
| | | if (wei == 0){ |
| | | wei =7; |
| | | } |
| | | if (week.contains(wei)){ |
| | | for (int i1 = 0; i1 < split.length; i1++) { |
| | | if (count==can){ |
| | | break; |
| | | } |
| | | CoursePackageScheduling coursePackageScheduling = new CoursePackageScheduling(); |
| | | coursePackageScheduling.setCoursePackageId(tCoursePackage.getId()); |
| | | Date parse = format1.parse(format.format(date) + " " + split[i1]); |
| | | Date parse1 = format1.parse(format.format(date) + " " + split1[i1]); |
| | | coursePackageScheduling.setClassDate(parse); |
| | | coursePackageScheduling.setEndDate(parse1); |
| | | coursePackageScheduling.setStatus(1); |
| | | coursePackageSchedulingService.save(coursePackageScheduling); |
| | | CoursePackageStudent student1 = new CoursePackageStudent(); |
| | | student1.setAppUserId(userId); |
| | | student1.setStudentId(sId); |
| | | student1.setCoursePackageId(tCoursePackage.getId()); |
| | | student1.setCoursePackagePaymentId(pay.getId()); |
| | | student1.setCoursePackageSchedulingId(coursePackageScheduling.getId()); |
| | | student1.setSignInOrNot(1); |
| | | student1.setReservationStatus(1); |
| | | student1.setInsertTime(new Date()); |
| | | cpsMapper.insert(student1); |
| | | count++; |
| | | } |
| | | } |
| | | } |
| | | }else if (tCoursePackage.getType()==3){ |
| | | |
| | | if (price!=null) { |
| | | CourseCounsum courseCounsum = new CourseCounsum(); |
| | | courseCounsum.setPaymentId(paymentId); |
| | | courseCounsum.setChangeType(3); |
| | | courseCounsum.setInsertTime(new Date()); |
| | | courseCounsum.setReason("购买体验课;" + price); |
| | | courseCounsum.setAppUserId(userId); |
| | | courseCounsumService.save(courseCounsum); |
| | | } |
| | | |
| | | |
| | | //生成当天的排课记录 |
| | | |
| | | //生成学员的上课表 |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | // for (Integer integer : week) { |
| | | // if (count==can){ |
| | | // break; |
| | | // } |
| | | // if(integer<i){ |
| | | // // 找下一周的时间 |
| | | // Calendar instance = Calendar.getInstance(); |
| | | // if (cs==null||cs.getClassDate().before(new Date())){ |
| | | // instance = Calendar.getInstance(); |
| | | // }else { |
| | | //// i = DateUtil.dayOfWeek(cs.getClassDate())-1; |
| | | // instance.setTime(cs.getClassDate()); |
| | | // } |
| | | // instance.add(Calendar.DATE,7-(i-integer)); |
| | | // Date time = instance.getTime(); |
| | | // |
| | | // for (int i1 = 0; i1 < split.length; i1++) { |
| | | // if (count==can){ |
| | | // break; |
| | | // } |
| | | // |
| | | // CoursePackageScheduling coursePackageScheduling = new CoursePackageScheduling(); |
| | | // coursePackageScheduling.setCoursePackageId(tCoursePackage.getId()); |
| | | // Date parse = format1.parse(format.format(time) + " " + split[i1]); |
| | | // Date parse1 = format1.parse(format.format(time) + " " + split1[i1]); |
| | | // coursePackageScheduling.setClassDate(parse); |
| | | // coursePackageScheduling.setEndDate(parse1); |
| | | // coursePackageScheduling.setStatus(1); |
| | | // coursePackageSchedulingService.save(coursePackageScheduling); |
| | | // |
| | | // CoursePackageStudent student1 = new CoursePackageStudent(); |
| | | // student1.setAppUserId(userId); |
| | | // student1.setStudentId(sId); |
| | | // student1.setCoursePackageId(tCoursePackage.getId()); |
| | | // student1.setCoursePackagePaymentId(paymentId); |
| | | // student1.setCoursePackageSchedulingId(coursePackageScheduling.getId()); |
| | | // student1.setSignInOrNot(1); |
| | | // student1.setReservationStatus(1); |
| | | // student1.setInsertTime(new Date()); |
| | | // cpsMapper.insert(student1); |
| | | // count++; |
| | | // } |
| | | // |
| | | // |
| | | // }else if(integer>i) { |
| | | // if (count==can){ |
| | | // break; |
| | | // } |
| | | // |
| | | //// Calendar instance = Calendar.getInstance(); |
| | | // |
| | | // Calendar instance = Calendar.getInstance(); |
| | | // if (cs==null||cs.getClassDate().before(new Date())){ |
| | | // instance = Calendar.getInstance(); |
| | | // }else { |
| | | //// i = DateUtil.dayOfWeek(cs.getClassDate())-1; |
| | | // instance.setTime(cs.getClassDate()); |
| | | // } |
| | | // instance.add(Calendar.DATE,integer-i); |
| | | // Date time1 = instance.getTime(); |
| | | // List<Date> list = new ArrayList<>(); |
| | | // list.add(time1); |
| | | // instance.add(Calendar.DATE,7); |
| | | // Date time2 = instance.getTime(); |
| | | // list.add(time2); |
| | | // for (Date time : list) { |
| | | // for (int i1 = 0; i1 < split.length; i1++) { |
| | | // CoursePackageScheduling coursePackageScheduling = new CoursePackageScheduling(); |
| | | // coursePackageScheduling.setCoursePackageId(tCoursePackage.getId()); |
| | | // Date parse = format1.parse(format.format(time) + " " + split[i1]); |
| | | // Date parse1 = format1.parse(format.format(time) + " " + split1[i1]); |
| | | // coursePackageScheduling.setClassDate(parse); |
| | | // coursePackageScheduling.setEndDate(parse1); |
| | | // coursePackageScheduling.setStatus(1); |
| | | // coursePackageSchedulingService.save(coursePackageScheduling); |
| | | // |
| | | // CoursePackageStudent student1 = new CoursePackageStudent(); |
| | | // student1.setAppUserId(userId); |
| | | // student1.setStudentId(sId); |
| | | // student1.setCoursePackageId(tCoursePackage.getId()); |
| | | // student1.setCoursePackagePaymentId(paymentId); |
| | | // student1.setCoursePackageSchedulingId(coursePackageScheduling.getId()); |
| | | // student1.setSignInOrNot(1); |
| | | // student1.setReservationStatus(1); |
| | | // student1.setInsertTime(new Date()); |
| | | // cpsMapper.insert(student1); |
| | | // count++; |
| | | // |
| | | // } |
| | | // } |
| | | // |
| | | // }else { |
| | | //// Calendar instance = Calendar.getInstance(); |
| | | // Calendar instance = Calendar.getInstance(); |
| | | // if (cs==null||cs.getClassDate().before(new Date())){ |
| | | // instance = Calendar.getInstance(); |
| | | // }else { |
| | | //// i = DateUtil.dayOfWeek(cs.getClassDate())-1; |
| | | // instance.setTime(cs.getClassDate()); |
| | | // } |
| | | // instance.add(Calendar.DATE,7); |
| | | // Date time = instance.getTime(); |
| | | // |
| | | // for (int i1 = 0; i1 < split.length; i1++) { |
| | | // if (count==can){ |
| | | // break; |
| | | // } |
| | | // |
| | | // CoursePackageScheduling coursePackageScheduling = new CoursePackageScheduling(); |
| | | // coursePackageScheduling.setCoursePackageId(tCoursePackage.getId()); |
| | | // Date parse = format1.parse(format.format(time) + " " + split[i1]); |
| | | // Date parse1 = format1.parse(format.format(time) + " " + split1[i1]); |
| | | // coursePackageScheduling.setClassDate(parse); |
| | | // coursePackageScheduling.setEndDate(parse1); |
| | | // coursePackageScheduling.setStatus(1); |
| | | // coursePackageSchedulingService.save(coursePackageScheduling); |
| | | // |
| | | // CoursePackageStudent student1 = new CoursePackageStudent(); |
| | | // student1.setAppUserId(userId); |
| | | // student1.setStudentId(sId); |
| | | // student1.setCoursePackageId(tCoursePackage.getId()); |
| | | // student1.setCoursePackagePaymentId(paymentId); |
| | | // student1.setCoursePackageSchedulingId(coursePackageScheduling.getId()); |
| | | // student1.setSignInOrNot(1); |
| | | // student1.setReservationStatus(1); |
| | | // student1.setInsertTime(new Date()); |
| | | // cpsMapper.insert(student1); |
| | | // count++; |
| | | // |
| | | // } |
| | | // } |
| | | // } |
| | | // 2.0 |
| | | TCourseInfoRecord tCourseInfoRecord = new TCourseInfoRecord(); |
| | | tCourseInfoRecord.setUserId(userId); |
| | |
| | | |
| | | @Override |
| | | public ResultUtil paymentCourseCouponList(Integer uid, Integer coursePackagePaymentConfigId) { |
| | | CoursePackagePaymentConfig coursePackagePaymentConfig = coursePackagePaymentConfigService.getById(coursePackagePaymentConfigId); |
| | | if(ToolUtil.isEmpty(coursePackagePaymentConfig.getCouponIds())){ |
| | | coursePackagePaymentConfig.setCouponIds("-1"); |
| | | } |
| | | List<Coupon> coupons = couponClient.getCoupons(coursePackagePaymentConfig.getCouponIds()); |
| | | // CoursePackagePaymentConfig coursePackagePaymentConfig = coursePackagePaymentConfigService.getById(coursePackagePaymentConfigId); |
| | | // if(ToolUtil.isEmpty(coursePackagePaymentConfig.getCouponIds())){ |
| | | // coursePackagePaymentConfig.setCouponIds("-1"); |
| | | // } |
| | | // List<Coupon> coupons = couponClient.getCoupons(coursePackagePaymentConfig.getCouponIds()); |
| | | |
| | | for (Coupon coupon : coupons) { |
| | | Date date1 = coupon.getStartTime(); // 2023-10-01 00:00:00 |
| | | Date date2 = coupon.getEndTime(); // 2023-10-12 00:00:00 |
| | | List<Coupon> coupons = couponClient.queryCouponByUid(uid); |
| | | |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy.MM.dd"); |
| | | String dateString1 = sdf.format(date1); |
| | | String dateString2 = sdf.format(date2); |
| | | |
| | | String result = dateString1 + "-" + dateString2; |
| | | coupon.setTimePeriod(result); |
| | | if (CollectionUtil.isNotEmpty(coupons)) { |
| | | for (Coupon coupon : coupons){ |
| | | Date date1 = coupon.getStartTime(); // 2023-10-01 00:00:00 |
| | | Date date2 = coupon.getEndTime(); // 2023-10-12 00:00:00 |
| | | |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy.MM.dd"); |
| | | String dateString1 = sdf.format(date1); |
| | | String dateString2 = sdf.format(date2); |
| | | |
| | | String result = dateString1 + "-" + dateString2; |
| | | coupon.setTimePeriod(result); |
| | | } |
| | | } |
| | | return ResultUtil.success(coupons); |
| | | } |
| | |
| | | </select> |
| | | <select id="queryAll" resultType="com.dsh.course.model.vo.response.AppUserVideoResponse"> |
| | | |
| | | SELECT cs.courseId as videoId,cs.coursePackageId as coursePackageId,tc.coverDrawing,tc.name as videoName,tc.introduce as synopsis,cs.integral,tc.courseVideo as courseVideo |
| | | SELECT cs.courseId as videoId,cs.coursePackageId as coursePackageId,tc.coverDrawing as coverImage,tc.name as videoName,tc.introduce as synopsis,cs.integral,tc.courseVideo as courseVideo,cp.name as packageName |
| | | FROM t_course_package_scheduling cs |
| | | LEFT JOIN t_course tc ON cs.courseId = tc.id |
| | | left join t_course_package cp on cs.coursePackageId = cp.id |
| | | WHERE cs.courseId IS NOT NULL |
| | | <if test="longs != null"> |
| | | AND cs.id IN |
| | |
| | | studentId, |
| | | signInOrNot, |
| | | reservationStatus |
| | | from t_course_package_student where coursePackageSchedulingId = #{coursePackageSchedulingId} |
| | | from t_course_package_student where 1=1 |
| | | <if test="ids != null and ids.size() > 0"> |
| | | and coursePackageSchedulingId in |
| | | <foreach collection="ids" close=")" item="id" open="(" separator=","> |
| | | #{id} |
| | | </foreach> |
| | | </if> |
| | | |
| | | and reservationStatus != 3 |
| | | <if test="null != userId"> |
| | | and appUserId in |
| | |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | |
| | | * @param coursePackageScheduling |
| | | */ |
| | | @PostMapping("/coursePackageScheduling/editCoursePackageScheduling") |
| | | void editCoursePackageScheduling(CoursePackageScheduling coursePackageScheduling); |
| | | void editCoursePackageScheduling(List<CoursePackageScheduling> coursePackageScheduling); |
| | | |
| | | |
| | | @PostMapping("/coursePackageScheduling/saveCoursePackageScheduling") |
| | | void save(CoursePackageScheduling coursePackageScheduling); |
| | | @PostMapping("/coursePackageScheduling/queryCoursePackageSchedulingsById") |
| | | List<CoursePackageScheduling> queryCoursePackageSchedulingsById(Long id); |
| | | } |
| | |
| | | import com.dsh.course.feignClient.course.model.QueryCoursePackageStudentList; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | |
| | | * @return |
| | | */ |
| | | @PostMapping("/coursePackageStudent/queryByCoursePackageSchedulingId") |
| | | List<CoursePackageStudent> queryByCoursePackageSchedulingId(Long coursePackageSchedulingId); |
| | | List<CoursePackageStudent> queryByCoursePackageSchedulingId(@RequestBody List<Long> coursePackageSchedulingId); |
| | | |
| | | |
| | | /** |
| | |
| | | HashMap<String, String> map = new HashMap<>(); |
| | | map.put("sign","0DB011836143EEE2C2E072967C9F4E4B"); |
| | | map.put("name",site.getName()); |
| | | map.put("space_id",store.getId().toString()); |
| | | map.put("area_id",integer1.toString()); |
| | | map.put("space_id",integer1.toString()); |
| | | map.put("area_id",store.getId().toString()); |
| | | String s = HttpRequestUtil.postRequest |
| | | ("https://try.daowepark.com/v7/user_api/general/addSpaceArea", map); |
| | | // 添加门禁 |
| | |
| | | for (String s1 : site.getIds().split(",")) { |
| | | HashMap<String, String> map1 = new HashMap<>(); |
| | | map1.put("sign", "0DB011836143EEE2C2E072967C9F4E4B"); |
| | | map1.put("space_id", store.getId().toString() + ""); |
| | | map1.put("space_id", integer1 + ""); |
| | | map1.put("device_id", s1); |
| | | map1.put("region_id", integer1 + ""); |
| | | map1.put("region_id", store.getId().toString() + ""); |
| | | String s2 = HttpRequestUtil.postRequest("https://try.daowepark.com/v7/user_api/general/addDevice", map1); |
| | | System.out.println("添加闸机:" + s2); |
| | | } |
| | |
| | | for (String s : site.getIds().split(",")) { |
| | | HashMap<String, String> map1 = new HashMap<>(); |
| | | map1.put("sign", "0DB011836143EEE2C2E072967C9F4E4B"); |
| | | map1.put("space_id", site.getId() + ""); |
| | | map1.put("space_id", store.getId() + ""); |
| | | map1.put("device_id", s); |
| | | map1.put("region_id", store.getId() + ""); |
| | | map1.put("region_id", site.getId() + ""); |
| | | // 添加门禁 |
| | | String s1 = HttpRequestUtil.postRequest("https://try.daowepark.com/v7/user_api/general/addDevice", map1); |
| | | System.out.println(s1); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | return ResultUtil.success(); |
| | | } |
| | | /** |
| | |
| | | import com.dsh.guns.config.UserExt; |
| | | import com.dsh.guns.core.support.HttpKit; |
| | | import com.dsh.guns.core.util.ToolUtil; |
| | | import com.dsh.guns.modular.system.model.CourseCounsum; |
| | | import com.dsh.guns.modular.system.model.TStore; |
| | | import com.dsh.guns.modular.system.service.ICoursePackageService; |
| | | import com.dsh.guns.modular.system.service.IStoreService; |
| | |
| | | */ |
| | | @Override |
| | | public ResultUtil cancelClassSchedule(Long id) { |
| | | CoursePackageScheduling coursePackageScheduling = coursePackageSchedulingClient.queryCoursePackageSchedulingById(id); |
| | | if(coursePackageScheduling.getStatus() != 1){ |
| | | return ResultUtil.error("不能取消本次"); |
| | | |
| | | // List<CoursePackageScheduling> coursePackageSchedulings = coursePackageSchedulingClient.queryCoursePackageSchedulingsById(id); |
| | | // List<Long> integers = new ArrayList<>(); |
| | | // for (CoursePackageScheduling coursePackageScheduling : coursePackageSchedulings) { |
| | | // integers.add(coursePackageScheduling.getId()); |
| | | // } |
| | | List<CoursePackageScheduling> coursePackageSchedulings = coursePackageSchedulingClient.queryCoursePackageSchedulingsById(id); |
| | | List<Long> integers = new ArrayList<>(); |
| | | for (CoursePackageScheduling coursePackageScheduling : coursePackageSchedulings) { |
| | | integers.add(coursePackageScheduling.getId()); |
| | | coursePackageScheduling.setStatus(4); |
| | | } |
| | | List<CoursePackageStudent> coursePackageStudents = coursePackageStudentClient.queryByCoursePackageSchedulingId(id); |
| | | if(coursePackageStudents.size() > 0){ |
| | | |
| | | coursePackageSchedulingClient.editCoursePackageScheduling(coursePackageSchedulings); |
| | | |
| | | |
| | | |
| | | // CoursePackageScheduling coursePackageScheduling = coursePackageSchedulingClient.queryCoursePackageSchedulingById(id); |
| | | // if(coursePackageScheduling.getStatus() != 1){ |
| | | // return ResultUtil.error("不能取消本次"); |
| | | } |
| | | coursePackageScheduling = new CoursePackageScheduling(); |
| | | coursePackageScheduling.setId(id); |
| | | coursePackageScheduling.setStatus(4); |
| | | coursePackageSchedulingClient.editCoursePackageScheduling(coursePackageScheduling); |
| | | // } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | // List<CoursePackageStudent> coursePackageStudents = coursePackageStudentClient.queryByCoursePackageSchedulingId(id); |
| | | // if(coursePackageStudents.size() > 0){ |
| | | //// return ResultUtil.error("不能取消本次"); |
| | | // } |
| | | // coursePackageScheduling = new CoursePackageScheduling(); |
| | | // coursePackageScheduling.setId(id); |
| | | // coursePackageScheduling.setStatus(4); |
| | | // coursePackageSchedulingClient.editCoursePackageScheduling(coursePackageScheduling); |
| | | return ResultUtil.success(); |
| | | } |
| | | |
| | |
| | | */ |
| | | @Override |
| | | public ResultUtil afterClassExercises(Long id, Integer courseId, Integer integral) { |
| | | CoursePackageScheduling coursePackageScheduling = coursePackageSchedulingClient.queryCoursePackageSchedulingById(id); |
| | | if(coursePackageScheduling.getStatus() != 3){ |
| | | return ResultUtil.error("不能发布课后练习"); |
| | | // CoursePackageScheduling coursePackageScheduling = coursePackageSchedulingClient.queryCoursePackageSchedulingById(id); |
| | | |
| | | // List<CoursePackageScheduling> coursePackageSchedulings = coursePackageSchedulingClient.queryCoursePackageSchedulingsById(id); |
| | | |
| | | |
| | | List<CoursePackageScheduling> coursePackageSchedulings = coursePackageSchedulingClient.queryCoursePackageSchedulingsById(id); |
| | | List<Long> integers = new ArrayList<>(); |
| | | for (CoursePackageScheduling coursePackageScheduling : coursePackageSchedulings) { |
| | | integers.add(coursePackageScheduling.getId()); |
| | | coursePackageScheduling.setCourseId(courseId); |
| | | } |
| | | coursePackageScheduling.setCourseId(courseId); |
| | | coursePackageScheduling.setIntegral(integral); |
| | | coursePackageSchedulingClient.editCoursePackageScheduling(coursePackageScheduling); |
| | | |
| | | coursePackageSchedulingClient.editCoursePackageScheduling(coursePackageSchedulings); |
| | | |
| | | // for (CoursePackageScheduling coursePackageScheduling : coursePackageSchedulings) { |
| | | // integers.add(coursePackageScheduling.getId()); |
| | | // if(coursePackageScheduling.getStatus() != 3){ |
| | | // return ResultUtil.error("不能发布课后练习"); |
| | | // } |
| | | // coursePackageScheduling.setCourseId(courseId); |
| | | // coursePackageScheduling.setIntegral(integral); |
| | | // coursePackageSchedulingClient.editCoursePackageScheduling(coursePackageScheduling); |
| | | // } |
| | | |
| | | // if(coursePackageScheduling.getStatus() != 3){ |
| | | // return ResultUtil.error("不能发布课后练习"); |
| | | // } |
| | | // coursePackageScheduling.setCourseId(courseId); |
| | | // coursePackageScheduling.setIntegral(integral); |
| | | // coursePackageSchedulingClient.editCoursePackageScheduling(coursePackageScheduling); |
| | | return ResultUtil.success(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | |
| | | */ |
| | | @Override |
| | | public ResultUtil cancellationRecord(Long id, String cancelClasses, Integer deductClassHour) { |
| | | CoursePackageScheduling coursePackageScheduling = coursePackageSchedulingClient.queryCoursePackageSchedulingById(id); |
| | | if(coursePackageScheduling.getStatus() == 1 || coursePackageScheduling.getStatus() == 4){ |
| | | return ResultUtil.error("不能添加消课凭证"); |
| | | } |
| | | coursePackageScheduling.setCancelClasses(cancelClasses); |
| | | coursePackageScheduling.setDeductClassHour(deductClassHour); |
| | | coursePackageSchedulingClient.editCoursePackageScheduling(coursePackageScheduling); |
| | | // CoursePackageScheduling coursePackageScheduling = coursePackageSchedulingClient.queryCoursePackageSchedulingById(id); |
| | | |
| | | List<CoursePackageStudent> coursePackageStudents = coursePackageStudentClient.queryByCoursePackageSchedulingId(id); |
| | | List<CoursePackageScheduling> coursePackageSchedulings = coursePackageSchedulingClient.queryCoursePackageSchedulingsById(id); |
| | | List<Long> integers = new ArrayList<>(); |
| | | for (CoursePackageScheduling coursePackageScheduling : coursePackageSchedulings) { |
| | | integers.add(coursePackageScheduling.getId()); |
| | | coursePackageScheduling.setCancelClasses(cancelClasses); |
| | | coursePackageScheduling.setDeductClassHour(deductClassHour); |
| | | } |
| | | |
| | | |
| | | // for (CoursePackageScheduling coursePackageScheduling : coursePackageSchedulings) { |
| | | |
| | | // if(coursePackageScheduling.getStatus() == 1 || coursePackageScheduling.getStatus() == 4){ |
| | | // return ResultUtil.error("不能添加消课凭证"); |
| | | // } |
| | | // coursePackageScheduling.setCancelClasses(cancelClasses); |
| | | // coursePackageScheduling.setDeductClassHour(deductClassHour); |
| | | coursePackageSchedulingClient.editCoursePackageScheduling(coursePackageSchedulings); |
| | | |
| | | List<CoursePackageStudent> coursePackageStudents = coursePackageStudentClient.queryByCoursePackageSchedulingId(integers); |
| | | for (CoursePackageStudent coursePackageStudent : coursePackageStudents) { |
| | | if(coursePackageStudent.getReservationStatus() == 0){ |
| | | continue; |
| | |
| | | cancelledClasses.setCancelledClassesNumber(deductClassHour);} |
| | | cancelledClasses.setInsertTime(new Date()); |
| | | cancelledClassesClient.addCancelledClasses(cancelledClasses); |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | | // } |
| | | |
| | | return ResultUtil.success(); |
| | | } |
| | | |
| | |
| | | |
| | | this.clearData(); |
| | | this.collectData(); |
| | | |
| | | |
| | | |
| | | |
| | | const quantityIssuedInput = document.getElementById('quantityIssued'); |
| | | const pickUpQuantityInput = document.getElementById('pickUpQuantity'); |
| | |
| | | import com.alipay.api.response.AlipayTradeQueryResponse; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.dsh.other.entity.TGame; |
| | | import com.dsh.other.entity.TGameConfig; |
| | | import com.dsh.other.entity.TGameRecord; |
| | | import com.dsh.other.entity.*; |
| | | import com.dsh.other.feignclient.CourseRecordClient; |
| | | import com.dsh.other.feignclient.account.AppUserClient; |
| | | import com.dsh.other.feignclient.account.model.AppUser; |
| | | import com.dsh.other.model.QueryMySiteVo; |
| | | import com.dsh.other.service.ISiteLockService; |
| | | import com.dsh.other.service.TGameConfigService; |
| | | import com.dsh.other.service.TGameRecordService; |
| | | import com.dsh.other.service.TGameService; |
| | |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | @RestController |
| | | @RequestMapping("/api/game") |
| | | public class GameController { |
| | | |
| | | @Autowired |
| | | private TGameRecordService gameRecordService; |
| | | |
| | | |
| | | @Autowired |
| | | private TGameService gameService; |
| | |
| | | @Autowired |
| | | private PayMoneyUtil payMoneyUtil; |
| | | |
| | | @Resource |
| | | private CourseRecordClient courseRecordClient; |
| | | |
| | | |
| | | @ResponseBody |
| | |
| | | } |
| | | } |
| | | |
| | | @Autowired |
| | | private ISiteLockService lockService; |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/queryGameList") |
| | |
| | | public ResultUtil<List<TGameConfig>> queryGameList(Integer siteId, Integer storeId){ |
| | | try { |
| | | List<TGameConfig> tGameConfigs = new ArrayList<>(); |
| | | |
| | | List<SiteLock> lock = lockService.list(new QueryWrapper<SiteLock>().eq("siteId", siteId)); |
| | | |
| | | Date now = new Date(); |
| | | for (SiteLock siteLock : lock) { |
| | | if (now.after(siteLock.getStartTime())&&now.before(siteLock.getEndTime())){ |
| | | return ResultUtil.error("当前场地已被锁定"); |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | List<TGame> list = gameService.list(new LambdaQueryWrapper<TGame>().eq(TGame::getSiteId, siteId).eq(TGame::getStoreId, storeId).eq(TGame::getState,0)); |
| | | if(list.size()>0){ |
| | |
| | | } |
| | | return weixinpay; |
| | | }else if(type==2){ |
| | | ResultUtil alipay = payMoneyUtil.alipay("游戏支付", "游戏支付", "", code, config.getCash().toString(), "/base/course/aliPaymentCourseCallback"); |
| | | // Integer gameId, Integer configId,Integer type,Integer sutuId,Integer spaceId; |
| | | |
| | | String params = uid+"_"+gameId+"_"+spaceId+"_"+sutuId; |
| | | |
| | | ResultUtil alipay = payMoneyUtil.alipay("游戏支付", "游戏支付", params, code, config.getCash().toString(), "/base/site/gameCallback"); |
| | | if(alipay.getCode() == 200){ |
| | | new Thread(new Runnable() { |
| | | @Override |
| | |
| | | int min = 5000; |
| | | wait += (min * num); |
| | | Thread.sleep(wait); |
| | | List<TGameRecord> list = gameRecordService.list(new QueryWrapper<TGameRecord>().eq("code", code).eq("payType", 3)); |
| | | List<TGameRecord> list = gameRecordService.list(new QueryWrapper<TGameRecord>().eq("number", code).eq("payType", 2)); |
| | | TGameRecord one = list.get(0); |
| | | if(one.getStatus() == 1){ |
| | | break; |
| | |
| | | coursePackagePayment.setStatus(1); |
| | | coursePackagePayment.setMoney(config.getCash()); |
| | | coursePackagePayment.setOrderNo(tradeNo); |
| | | |
| | | CourseCounsum courseCounsum = new CourseCounsum(); |
| | | // courseCounsum.setPaymentId(paymentId); |
| | | courseCounsum.setChangeType(3); |
| | | courseCounsum.setInsertTime(new Date()); |
| | | courseCounsum.setReason("智慧球场;" + config.getCash()); |
| | | courseCounsum.setAppUserId(uid); |
| | | courseRecordClient.save(courseCounsum); |
| | | |
| | | } |
| | | gameRecordService.updateBatchById(list); |
| | | Integer integer = startGame(uid, gameId, spaceId, sutuId); |
| | |
| | | } |
| | | int i1 = playPaiCoins - i; |
| | | appUser.setIntegral(i1); |
| | | appUser.setPoints(playCoin.intValue()); |
| | | appUserClient.updateAppUser(appUser); |
| | | startGame(uid,gameId,spaceId,sutuId); |
| | | return ResultUtil.success(); |
| | |
| | | wrapper1.eq("type",type1); |
| | | List<HonorRules> list1 = hrService.list(wrapper1); |
| | | for (int i = 0; i < list1.size(); i++) { |
| | | list1.get(i).setCondition(condition1.get(i)); |
| | | list1.get(i).setCondition(Integer.valueOf(condition1.get(i))); |
| | | } |
| | | hrService.updateBatchById(list1); |
| | | |
| | |
| | | wrapper2.eq("type",type2); |
| | | List<HonorRules> list2 = hrService.list(wrapper2); |
| | | for (int i = 0; i < list1.size(); i++) { |
| | | list2.get(i).setCondition(condition2.get(i)); |
| | | list2.get(i).setCondition(Integer.valueOf(condition2.get(i))); |
| | | } |
| | | hrService.updateBatchById(list2); |
| | | |
| | |
| | | wrapper3.eq("type",type3); |
| | | List<HonorRules> list3 = hrService.list(wrapper3); |
| | | for (int i = 0; i < list1.size(); i++) { |
| | | list3.get(i).setCondition(condition3.get(i)); |
| | | list3.get(i).setCondition(Integer.valueOf(condition3.get(i))); |
| | | } |
| | | hrService.updateBatchById(list3); |
| | | |
| | |
| | | wrapper4.eq("type",type4); |
| | | List<HonorRules> list4 = hrService.list(wrapper4); |
| | | for (int i = 0; i < list1.size(); i++) { |
| | | list4.get(i).setCondition(condition4.get(i)); |
| | | list4.get(i).setCondition(Integer.valueOf(condition4.get(i))); |
| | | } |
| | | hrService.updateBatchById(list4); |
| | | |
| | | return ResultUtil.success(); |
| | | } |
| | | |
| | | @Autowired |
| | | private HonorRulesService honorRulesService; |
| | | @PostMapping("/base/honor/getHonor") |
| | | public HonorRules getHonor(@RequestBody List<Integer> integers){ |
| | | // HonorRules one = honorRulesService.getOne(new QueryWrapper<HonorRules>().eq("type", integers.get(0)).le("condition", String.valueOf(integers.get(1))).last("limit 1")); |
| | | HonorRules one = honorRulesService.getOne(new QueryWrapper<HonorRules>() |
| | | .eq("type", integers.get(0)) |
| | | .le("`condition`",integers.get(1)).orderByDesc("level") |
| | | .last("LIMIT 1")); |
| | | |
| | | if (one ==null){ |
| | | HonorRules one1 = honorRulesService.getOne(new QueryWrapper<HonorRules>() |
| | | .eq("type", integers.get(0)) |
| | | .eq("level",1) |
| | | .last("LIMIT 1")); |
| | | return one1; |
| | | } |
| | | |
| | | if (one.getLevel()==10){ |
| | | return one; |
| | | } |
| | | HonorRules one2 = honorRulesService.getOne(new QueryWrapper<HonorRules>().eq("type", integers.get(0)).eq("level", Integer.valueOf(one.getLevel()) + 1)); |
| | | return one2; |
| | | } |
| | | |
| | | @PostMapping("/base/honor/stuHonors") |
| | | public List<StuMedalVo> getStuHonors(@RequestBody List<Integer> honorIds){ |
| | | List<StuMedalVo> stuMedalVos = new ArrayList<>(); |
| | | List<HonorRules> honorRules = hrService.querylistOfIds(honorIds); |
| | | |
| | | |
| | | |
| | | if (honorRules.size() > 0){ |
| | | honorRules.forEach(hrs -> { |
| | | StuMedalVo stuMedalVo = new StuMedalVo(); |
| | | stuMedalVo.setLevelNum(Integer.getInteger(hrs.getLevel())); |
| | | stuMedalVo.setLevelNum(Integer.getInteger(String.valueOf(hrs.getLevel()))); |
| | | stuMedalVo.setMedalType(hrs.getType()); |
| | | switch (hrs.getType()){ |
| | | case 1: |
| | |
| | | break; |
| | | } |
| | | if (!Objects.equals(hrs.getLevel(), "10")){ |
| | | stuMedalVo.setLevelNum(Integer.parseInt(hrs.getLevel())); |
| | | stuMedalVo.setNextLevel(Integer.parseInt(hrs.getLevel())+1); |
| | | stuMedalVo.setUpgradeConditions(hrs.getCondition()); |
| | | stuMedalVo.setLevelNum(Integer.parseInt(String.valueOf(hrs.getLevel()))); |
| | | stuMedalVo.setNextLevel(Integer.parseInt(String.valueOf(hrs.getLevel()))+1); |
| | | stuMedalVo.setUpgradeConditions(String.valueOf(hrs.getCondition())); |
| | | stuMedalVo.setIsTopLevel(2); |
| | | }else { |
| | | stuMedalVo.setIsTopLevel(1); |
| | |
| | | @PostMapping("/queryProtocol") |
| | | @ApiOperation(value = "获取各种协议", tags = {"用户—登录注册"}) |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "类型(1=用户协议,2=隐私协议,3=运动安全公告书)", name = "type", dataType = "int", required = true) |
| | | @ApiImplicitParam(value = "类型(1=用户协议,2=隐私协议,3=运动安全公告书,4=注销协议)", name = "type", dataType = "int", required = true) |
| | | }) |
| | | public ResultUtil<String> queryProtocol(Integer type){ |
| | | try { |
| | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | import com.dsh.other.model.vo.siteVo.ExpireSiteSearchVO; |
| | | import com.dsh.other.model.vo.siteVo.SiteSearchVO; |
| | | import com.dsh.other.service.*; |
| | | import com.dsh.other.util.PayMoneyUtil; |
| | | import com.dsh.other.util.RedisUtil; |
| | | import com.dsh.other.util.ResultUtil; |
| | | import com.dsh.other.util.TokenUtil; |
| | | import com.dsh.other.util.*; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | |
| | | @ApiImplicitParam(value = "半场名称", name = "halfName", dataType = "string", required = false), |
| | | @ApiImplicitParam(value = "选择场地的名称", name = "siteName", dataType = "string", required = false) |
| | | }) |
| | | public ResultUtil<List<QuerySiteTimes>> querySiteTimes(Integer id, String day,String halfName,String siteName){ |
| | | public ResultUtil<List<QuerySiteTimes>> querySiteTimes(Integer id, String day,String halfName,String siteName){ |
| | | try { |
| | | List<QuerySiteTimes> list = siteService.querySiteTimes(id, day,halfName,siteName); |
| | | return ResultUtil.success(list); |
| | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 启动游戏支付宝回调 |
| | | * @param request |
| | | * @param response |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/base/site/gameCallback") |
| | | public void gameCallback(HttpServletRequest request, HttpServletResponse response){ |
| | | try { |
| | | System.out.println("回调回调回调"); |
| | | Map<String, String> map = payMoneyUtil.alipayCallback(request); |
| | | if(null != map){ |
| | | |
| | | String code = map.get("passback_params"); |
| | | // String trade_no = map.get("trade_no"); |
| | | // SiteBooking siteBooking = siteBookingService.getOne(new QueryWrapper<SiteBooking>().eq("orderNo", code).eq("state", 1)); |
| | | // if(siteBooking.getStatus() == 0){ |
| | | // siteBooking.setPayTime(new Date()); |
| | | // siteBooking.setStatus(1); |
| | | // siteBooking.setPayOrderNo(trade_no); |
| | | // siteBookingService.updateById(siteBooking); |
| | | // } |
| | | |
| | | String[] s = code.split("_"); |
| | | Integer i = startGame(Integer.valueOf(s[0]), Integer.valueOf(s[1]), Integer.valueOf(s[2]), Integer.valueOf(s[3])); |
| | | System.err.println("===========游戏回调游戏回调========="+i); |
| | | PrintWriter out = response.getWriter(); |
| | | out.write("success"); |
| | | out.flush(); |
| | | out.close(); |
| | | } |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | |
| | | private static Integer startGame(Integer uid,Integer gameId,Integer spaceId,Integer sutuId){ |
| | | HashMap<String, String> map = new HashMap<>(); |
| | | map.put("sign","0DB011836143EEE2C2E072967C9F4E4B"); |
| | | map.put("app_user_id",uid+""); |
| | | map.put("game_id",gameId+""); |
| | | map.put("space_id",spaceId+""); |
| | | map.put("sutu_id",sutuId+""); |
| | | |
| | | String s = HttpRequestUtil.postRequest("https://try.daowepark.com/v7/user_api/general/gameStart", map); |
| | | JSONObject jsonObject = JSONObject.parseObject(s); |
| | | Object code = jsonObject.get("code"); |
| | | if(String.valueOf(code)!=null && "200".equals(String.valueOf(code))){ |
| | | return 200; |
| | | }else { |
| | | return 500; |
| | | } |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/site/queryMySite") |
| | | @ApiOperation(value = "获取我的预约场地列表", tags = {"用户—预约场地"}) |
| | |
| | | Integer storeId = byId.getStoreId(); |
| | | Store byId1 = service.getById(storeId); |
| | | Site site = siteService.getById(byId.getSiteId()); |
| | | |
| | | map.put("siteName",byId1.getName()); |
| | | SiteType siteType = siteTypeService.getById(site.getSiteTypeId()); |
| | | map.put("siteType",siteType.getName()); |
| | | map.put("shopName",byId1.getName()); |
| | | map.put("shopAddress",byId1.getAddress()); |
| | | |
| | | map.put("name",site.getName()); |
| | | |
| | | |
| | | |
| | | List<Integer> ids = getIds(byId.getSiteId()); |
| | |
| | | |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/base/site/counts") |
| | | public Integer counts(@RequestBody Integer stuId){ |
| | | return siteBookingService.count(new QueryWrapper<SiteBooking>().eq("appUserId",stuId)); |
| | | |
| | | } |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/base/site/queryOperator") |
| | | public OperatorUser queryOperator(@RequestBody List<Integer> stores){ |
| | |
| | | for (StoreConfig storeConfig : list) { |
| | | StoreConfigVo storeConfigVo = new StoreConfigVo(); |
| | | BeanUtils.copyProperties(storeConfig, storeConfigVo); |
| | | if (storeConfig.getBackgroundImage()==null||storeConfig.getBackgroundImage().equals("")){ |
| | | switch (storeConfigVo.getType()){ |
| | | case 1:{ |
| | | storeConfigVo.setBackgroundImage("https://we-park-life.oss-cn-beijing.aliyuncs.com/img/8b7073a4d33d4eea9f0d173cb4db92a7.png"); |
| | | break; |
| | | } |
| | | case 2:{ |
| | | storeConfigVo.setBackgroundImage("https://we-park-life.oss-cn-beijing.aliyuncs.com/img/f60f1622ae184475ad703ec60bbcbeff.png"); |
| | | break; |
| | | } |
| | | case 3:{ |
| | | storeConfigVo.setBackgroundImage("https://we-park-life.oss-cn-beijing.aliyuncs.com/img/08c5eca72fca4d479d21905d25870ef8.png"); |
| | | break; |
| | | |
| | | } |
| | | case 4:{ |
| | | storeConfigVo.setBackgroundImage("https://we-park-life.oss-cn-beijing.aliyuncs.com/img/8602be35e6cf4f76819b7b2d7b588efc.png"); |
| | | break; |
| | | |
| | | } |
| | | case 5:{ |
| | | storeConfigVo.setBackgroundImage("https://we-park-life.oss-cn-beijing.aliyuncs.com/img/694f84a1e2ba4d2c919f4f4ffaadece2.png"); |
| | | break; |
| | | |
| | | } |
| | | case 6:{ |
| | | storeConfigVo.setBackgroundImage("https://we-park-life.oss-cn-beijing.aliyuncs.com/img/81a83d229fea46a78be6a3ec1d5b7d6e.png"); |
| | | break; |
| | | |
| | | } |
| | | case 7:{ |
| | | storeConfigVo.setBackgroundImage("https://we-park-life.oss-cn-beijing.aliyuncs.com/img/312763e7565c48f2a16021c162c76018.png"); |
| | | break; |
| | | |
| | | } |
| | | case 8:{ |
| | | storeConfigVo.setBackgroundImage("https://we-park-life.oss-cn-beijing.aliyuncs.com/img/0771fb3bd4de43c08492d0912209e51f.png"); |
| | | break; |
| | | |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | | listVo.add(storeConfigVo); |
| | | } |
| | | return ResultUtil.success(listVo); |
| | |
| | | import com.dsh.other.model.dto.siteDto.StoreInfoDto; |
| | | import com.dsh.other.service.*; |
| | | import com.dsh.other.util.GDMapGeocodingUtil; |
| | | import com.dsh.other.util.GeodesyUtil; |
| | | import com.dsh.other.util.ResultUtil; |
| | | import com.dsh.other.util.ToolUtil; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | |
| | | info.setStoreName(store.getName()); |
| | | info.setStoreImg(store.getCoverDrawing()); |
| | | info.setDistance((long) Double.parseDouble(distanceTOKilometer)); |
| | | info.setStoreAddr(store.getAddress()); |
| | | |
| | | |
| | | String str = store.getAddress(); |
| | | str = str.substring(str.indexOf("省") + 1); |
| | | |
| | | // 去掉第一个“市”及之前的字符串 |
| | | str = str.substring(str.indexOf("市") + 1); |
| | | |
| | | // 去掉第一个“区”及之前的字符串 |
| | | str = str.substring(str.indexOf("区") + 1); |
| | | |
| | | info.setStoreAddr(str); |
| | | info.setLatitude(storeLat); |
| | | info.setLongitude(storeLon); |
| | | |
| | | storeInfos.add(info); |
| | | } |
| | | // Comparator<StoreInfo> distanceComparator = new Comparator<StoreInfo>() { |
| | |
| | | String current = distanceVo.getLongitude()+","+distanceVo.getLatitude(); |
| | | Store store = storeService.getById(distanceVo.getStoreId()); |
| | | String result = store.getLon()+","+store.getLat(); |
| | | return gdMapGeocodingUtil.getDistanceTOKilometer(current, result); |
| | | |
| | | |
| | | if(ToolUtil.isNotEmpty(distanceVo.getLongitude()) && ToolUtil.isNotEmpty(distanceVo.getLatitude())){ |
| | | Map<String, Double> distance = GeodesyUtil.getDistance(distanceVo.getLongitude() + "," + distanceVo.getLatitude(), store.getLon() + "," + store.getLat()); |
| | | double wgs84 = new BigDecimal(distance.get("WGS84")).divide(new BigDecimal(1000)).setScale(2, RoundingMode.HALF_EVEN).doubleValue(); |
| | | // packageResponse.setDistance(wgs84); |
| | | return wgs84+""; |
| | | } |
| | | return ""; |
| | | |
| | | // return gdMapGeocodingUtil.getDistanceTOKilometer(current, result); |
| | | } |
| | | |
| | | |
| | | @PostMapping("/base/protocol/storeDetail/citycodeLoLa") |
| | | public List<StoreDetailList> getQueryStoreList(@RequestBody StoreOfCitycodeResp citycodeResp){ |
| | | public List<StoreDetailList> getQueryStoreList(@RequestBody StoreOfCitycodeResp citycodeResp) throws Exception { |
| | | List<StoreDetailList> detailLists = new ArrayList<>(); |
| | | |
| | | if (citycodeResp.getCityCode()==null){ |
| | | Map<String, String> geocode = gdMapGeocodingUtil.geocode(citycodeResp.getLongitude(), citycodeResp.getLatitude()); |
| | | String provinceCode = geocode.get("provinceCode"); |
| | | String cityCode = geocode.get("cityCode"); |
| | | citycodeResp.setCityCode(cityCode); |
| | | } |
| | | |
| | | List<Store> list = storeService.list(new QueryWrapper<Store>() |
| | | .eq("state",1 ) |
| | | .eq("cityCode",citycodeResp.getCityCode())); |
| | | if (list.size() > 0 ){ |
| | | if (ToolUtil.isEmpty(citycodeResp.getLongitude()) && ToolUtil.isEmpty(citycodeResp.getLatitude())){ |
| | | return detailLists; |
| | | } |
| | | // if (ToolUtil.isEmpty(citycodeResp.getLongitude()) && ToolUtil.isEmpty(citycodeResp.getLatitude())){ |
| | | // return detailLists; |
| | | // } |
| | | for (Store store : list) { |
| | | String current = citycodeResp.getLongitude() +","+citycodeResp.getLatitude(); |
| | | String result = store.getLon()+","+store.getLat(); |
| | | String distanceTOKilometer = gdMapGeocodingUtil.getDistanceTOKilometer(current, result); |
| | | long l = Long.parseLong(distanceTOKilometer); |
| | | // 取5公里范围内的门店 |
| | | if ( l > 5){ |
| | | continue; |
| | | } |
| | | // long l = Long.parseLong(distanceTOKilometer); |
| | | //// 取5公里范围内的门店 |
| | | // if ( l > 5){ |
| | | // continue; |
| | | // } |
| | | StoreDetailList detailList = new StoreDetailList(); |
| | | detailList.setStoreId(store.getId()); |
| | | detailList.setStoreImg(store.getCoverDrawing()); |
| | | detailList.setStoreName(store.getName()); |
| | | detailList.setStoreAddress(store.getAddress()); |
| | | detailList.setStorePhone(store.getPhone()); |
| | | detailList.setStoreDistance(l); |
| | | // detailList.setStoreDistance(l); |
| | | detailList.setStoreTime(store.getStartTime() + "-" + store.getEndTime()); |
| | | detailList.setStoreInfo(store.getIntroduce()); |
| | | detailLists.add(detailList); |
| | |
| | | if(list.size()>0){ |
| | | tStoreOtherConfigTrues= tStoreOtherConfigTrueService.list(new LambdaQueryWrapper<TStoreOtherConfigTrue>().in(TStoreOtherConfigTrue::getPid, list.stream().map(TStoreOther::getId).collect(Collectors.toList())).eq(TStoreOtherConfigTrue::getState,1)); |
| | | } |
| | | for (TStoreOtherConfigTrue tStoreOtherConfigTrue : tStoreOtherConfigTrues) { |
| | | for (TStoreOther tStoreOther : list) { |
| | | if (tStoreOtherConfigTrue.getPid()==tStoreOther.getId()){ |
| | | tStoreOtherConfigTrue.setSort(tStoreOther.getSort()); |
| | | } |
| | | } |
| | | } |
| | | return ResultUtil.success(tStoreOtherConfigTrues); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | |
| | | try { |
| | | ObjectMapper objectMapper = new ObjectMapper(); |
| | | JsonNode rulesNode = objectMapper.readTree(storedValueConfig.getContent()).get("rules"); |
| | | |
| | | JsonNode rulesNode1 = objectMapper.readTree(storedValueConfig.getContent()).get("time_rules"); |
| | | |
| | | JsonNode jsonNode = rulesNode1.get(0); |
| | | String startTime = jsonNode.get("startTime").asText(); |
| | | String endTime = jsonNode.get("endTime").asText(); |
| | | |
| | | |
| | | |
| | | |
| | | if (rulesNode.isArray()) { |
| | | int i = 0; |
| | | for (JsonNode ruleNode : rulesNode) { |
New file |
| | |
| | | package com.dsh.other.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.models.auth.In; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | |
| | | |
| | | @Data |
| | | @TableName("t_course_consum") |
| | | public class CourseCounsum { |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | Integer id; |
| | | @TableField("changeType") |
| | | Integer changeType; |
| | | @TableField("num") |
| | | Integer num; |
| | | @TableField("reason") |
| | | String reason; |
| | | @TableField("paymentId") |
| | | Long paymentId; |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm",timezone = "GMT+8") |
| | | @TableField("insertTime") |
| | | Date insertTime; |
| | | @TableField("appUserId") |
| | | Integer appUserId; |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.baomidou.mybatisplus.extension.activerecord.Model; |
| | | import io.swagger.models.auth.In; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.experimental.Accessors; |
| | |
| | | * 等级 |
| | | */ |
| | | @TableField("level") |
| | | private String level; |
| | | private Integer level; |
| | | /** |
| | | * 满足条件值 |
| | | */ |
| | | |
| | | @TableField(value = "`condition`") |
| | | private String condition; |
| | | private Integer condition; |
| | | |
| | | @Override |
| | | protected Serializable pkVal() { |
New file |
| | |
| | | package com.dsh.other.feignclient; |
| | | |
| | | import com.dsh.other.entity.CourseCounsum; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | |
| | | @FeignClient(value = "mb-cloud-course") |
| | | public interface CourseRecordClient { |
| | | |
| | | |
| | | |
| | | @PostMapping("/base/courseRecord/cancelCourseData") |
| | | Integer cancelCourseRecordClass(@RequestBody Integer courseRecordId); |
| | | |
| | | @PostMapping("/base/courseRecord/save") |
| | | void save(@RequestBody CourseCounsum courseCounsum); |
| | | } |
| | |
| | | * 添加时间 |
| | | */ |
| | | private Date insertTime; |
| | | |
| | | private Integer points; |
| | | } |
| | |
| | | * MM-dd HH:mm |
| | | */ |
| | | private String time; |
| | | private String time1; |
| | | |
| | | /** |
| | | * 金额 |
| | | */ |
| | |
| | | private Integer status; |
| | | @ApiModelProperty("创建时间") |
| | | private Long insertTime; |
| | | @ApiModelProperty("支付方式2玩湃币,其他rmb") |
| | | private Integer payType; |
| | | } |
| | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.text.ParseException; |
| | | import java.text.SimpleDateFormat; |
| | | import java.time.LocalTime; |
| | | import java.util.*; |
| | |
| | | public List<QuerySiteTimes> querySiteTimes(Integer id, String day,String halfName,String siteName) throws Exception { |
| | | |
| | | System.out.println("=======date======"+day); |
| | | |
| | | List<String> strings = new ArrayList<>(); |
| | | |
| | | // List<SiteBooking> siteBookings = siteClient.listBooks(id); |
| | | List<SiteBooking> siteBookings = iSiteBookingService.list(new QueryWrapper<SiteBooking>().eq("siteId", id).eq("nextName",siteName).like("times",day)); |
| | | List<SiteBooking> siteBookings = iSiteBookingService.list(new QueryWrapper<SiteBooking>().eq("siteId", id).ne("status",5).eq("nextName",siteName).like("times",day)); |
| | | |
| | | |
| | | if (siteName==null|| siteName.equals("")){ |
| | | siteBookings = iSiteBookingService.list(new QueryWrapper<SiteBooking>().eq("siteId", id).like("times",day)); |
| | | siteBookings = iSiteBookingService.list(new QueryWrapper<SiteBooking>().eq("siteId", id).ne("status",5).like("times",day)); |
| | | } |
| | | |
| | | |
| | |
| | | if(stringDateBetween){ |
| | | orderDto.setSelectable(0); |
| | | } |
| | | if (DateComparisonExample.isStringWithinTimeRange(stime, siteLock.getStartTime(), siteLock.getEndTime())){ |
| | | orderDto.setSelectable(0); |
| | | } |
| | | if (DateComparisonExample.isStringWithinTimeRange(etime, siteLock.getStartTime(), siteLock.getEndTime())){ |
| | | orderDto.setSelectable(0); |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | public static String getNextTime(String currentTime) { |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 课程支付宝支付 |
| | | * @param paymentPrice |
| | |
| | | |
| | | SimpleDateFormat format = new SimpleDateFormat("yyyyMMdd"); |
| | | Date startTime = siteBooking.getStartTime(); |
| | | if(format.format(new Date()).equals(format.format(startTime))){ |
| | | if(format.format(new Date()).equals(format.format(startTime))&&siteBooking.getStatus() != 0){ |
| | | return ResultUtil.error("预约当天,不能取消"); |
| | | } |
| | | |
| | | if(siteBooking.getStatus() == 0){ |
| | | return ResultUtil.error("请先进行支付"); |
| | | // return ResultUtil.error("请先进行支付"); |
| | | siteBooking.setStatus(5); |
| | | siteBookingService.updateById(siteBooking); |
| | | return ResultUtil.success(); |
| | | } |
| | | if(siteBooking.getStatus() != 1 && siteBooking.getStatus() != 2){ |
| | | return ResultUtil.error("不能进行取消操作"); |
| | |
| | | String[] split = siteBooking.getTimes().split(";"); |
| | | Double payMoney = 0D; |
| | | if(payType == 3){ |
| | | payMoney = new BigDecimal(site.getPlayPaiCoin()).multiply(new BigDecimal(split.length)).setScale(2, RoundingMode.HALF_EVEN).doubleValue(); |
| | | // payMoney = new BigDecimal(site.getPlayPaiCoin()).multiply(new BigDecimal(split.length)).setScale(2, RoundingMode.HALF_EVEN).doubleValue(); |
| | | if(appUser.getPlayPaiCoins().compareTo(payMoney.intValue()) < 0){ |
| | | return ResultUtil.error("玩湃币不足"); |
| | | } |
| | | |
| | | if(siteBooking.getIsHalf()==2){ |
| | | payMoney = new BigDecimal(site.getPlayPaiCoin()).multiply(new BigDecimal(split.length)).setScale(2, RoundingMode.HALF_EVEN).doubleValue(); |
| | | }else { |
| | | payMoney = new BigDecimal(site.getPlayPaiCoinOne()).multiply(new BigDecimal(split.length)).setScale(2, RoundingMode.HALF_EVEN).doubleValue(); |
| | | } |
| | | }else{ |
| | | if(siteBooking.getIsHalf()==2){ |
| | |
| | | String[] split = siteBooking.getTimes().split(";"); |
| | | Map<String, Double> map = new HashMap<>(); |
| | | Double payMoney = new BigDecimal(site.getPlayPaiCoin()).multiply(new BigDecimal(split.length)).setScale(2, RoundingMode.HALF_EVEN).doubleValue(); |
| | | |
| | | |
| | | if(siteBooking.getIsHalf()==2){ |
| | | payMoney = new BigDecimal(site.getPlayPaiCoin()).multiply(new BigDecimal(split.length)).setScale(2, RoundingMode.HALF_EVEN).doubleValue(); |
| | | }else { |
| | | payMoney = new BigDecimal(site.getPlayPaiCoinOne()).multiply(new BigDecimal(split.length)).setScale(2, RoundingMode.HALF_EVEN).doubleValue(); |
| | | } |
| | | |
| | | map.put("playPaiCoin", payMoney); |
| | | payMoney = new BigDecimal(site.getCashPrice()).multiply(new BigDecimal(split.length)).setScale(2, RoundingMode.HALF_EVEN).doubleValue(); |
| | | |
| | | if(siteBooking.getIsHalf()==2){ |
| | | payMoney = new BigDecimal(site.getCashPrice()).multiply(new BigDecimal(split.length)).setScale(2, RoundingMode.HALF_EVEN).doubleValue(); |
| | | }else { |
| | | payMoney = new BigDecimal(site.getCashPriceOne()).multiply(new BigDecimal(split.length)).setScale(2, RoundingMode.HALF_EVEN).doubleValue(); |
| | | } |
| | | |
| | | //校验优惠券 |
| | | Long couponId = siteBooking.getUserCouponId(); |
| | | if(null != couponId){ |
| | |
| | | return (valueStartDate.after(startDate) || valueStartDate.equals(startDate)) |
| | | && (valueEndDate.before(endDate) || valueEndDate.equals(endDate)); |
| | | } |
| | | |
| | | public static boolean isStringWithinTimeRange(String stringValue, Date startTime, Date endTime) { |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm"); |
| | | try { |
| | | Date dateValue = sdf.parse(stringValue); |
| | | return dateValue.after(startTime) && dateValue.before(endTime); |
| | | } catch (ParseException e) { |
| | | e.printStackTrace(); |
| | | return false; |
| | | } |
| | | } |
| | | } |
| | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.dsh.other.util.httpClinet.HttpClientUtil; |
| | | import com.dsh.other.util.httpClinet.HttpResult; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | |
| | |
| | | JSONObject jsonObject = JSON.parseObject(httpResult.getData()); |
| | | Map<String, String> map = new HashMap<>(); |
| | | |
| | | |
| | | if(jsonObject.getString("status").equals("1")){ |
| | | JSONObject regeocode = jsonObject.getJSONObject("regeocode"); |
| | | JSONObject addressComponent = regeocode.getJSONObject("addressComponent"); |
| | |
| | | } |
| | | return map; |
| | | } |
| | | @Autowired |
| | | private GDMapGeocodingUtil gdMapGeocodingUtil; |
| | | public Map<String, String> geocode1(String lon, String lan) throws Exception{ |
| | | String url = "https://restapi.amap.com/v3/geocode/regeo?key=" + key + "&location=" + lon + "," + lan; |
| | | HttpResult httpResult = HttpClientUtil.pushHttpRequset("GET", url, null, null, "json"); |
| | | JSONObject jsonObject = JSON.parseObject(httpResult.getData()); |
| | | Map<String, String> map = new HashMap<>(); |
| | | |
| | | Map<String, String> geocode = gdMapGeocodingUtil.geocode(lon, lan); |
| | | String provinceCode = geocode.get("provinceCode"); |
| | | String cityCode = geocode.get("cityCode"); |
| | | map.put("cityCode", cityCode); |
| | | |
| | | // if(jsonObject.getString("status").equals("1")){ |
| | | // JSONObject regeocode = jsonObject.getJSONObject("regeocode"); |
| | | // JSONObject addressComponent = regeocode.getJSONObject("addressComponent"); |
| | | // String address = regeocode.getString("formatted_address"); |
| | | // map.put("address", address); |
| | | // String code = addressComponent.getString("adcode"); |
| | | // String province = addressComponent.getString("province"); |
| | | // String city = addressComponent.getString("city"); |
| | | // String district = addressComponent.getString("district"); |
| | | // map.put("province", province); |
| | | // map.put("provinceCode", code.substring(0, 2) + "0000"); |
| | | // map.put("city", city); |
| | | // map.put("cityCode", code.substring(0, 4) + "00"); |
| | | // map.put("district", district); |
| | | // map.put("districtCode", code); |
| | | // } |
| | | return map; |
| | | } |
| | | |
| | | |
| | | /** |
| | |
| | | // String alipayNum = operatorUser.getAlipayNum(); |
| | | |
| | | // extendParams.setSysServiceProviderId("YOUR_SERVICE_PROVIDER_ID"); |
| | | ExtendParams extendParams = new ExtendParams(); |
| | | model.setExtendParams(extendParams); |
| | | RoyaltyInfo royaltyInfo = new RoyaltyInfo(); |
| | | |
| | | // ExtendParams extendParams = new ExtendParams(); |
| | | // model.setExtendParams(extendParams); |
| | | // RoyaltyInfo royaltyInfo = new RoyaltyInfo(); |
| | | // royaltyInfo.setRoyaltyType("transfer"); |
| | | |
| | | |
| | | RoyaltyDetailInfos royaltyDetailInfo1 = new RoyaltyDetailInfos(); |
| | | royaltyDetailInfo1.setTransOutType("userId"); |
| | | royaltyDetailInfo1.setTransOut(aliAppid); |
| | | royaltyDetailInfo1.setTransInType("loginName"); |
| | | royaltyDetailInfo1.setTransIn("18398968484"); |
| | | |
| | | royaltyDetailInfo1.setDesc("分账描述1"); |
| | | royaltyDetailInfo1.setAmountPercentage("10"); |
| | | List<RoyaltyDetailInfos> royaltyDetailInfos = new ArrayList<>(); |
| | | |
| | | |
| | | |
| | | |
| | | royaltyInfo.setRoyaltyDetailInfos(royaltyDetailInfos); |
| | | model.setRoyaltyInfo(royaltyInfo); |
| | | System.err.println("========royaltyInfo=========="+royaltyInfo); |
| | | // RoyaltyDetailInfos royaltyDetailInfo1 = new RoyaltyDetailInfos(); |
| | | // royaltyDetailInfo1.setTransOutType("userId"); |
| | | // royaltyDetailInfo1.setTransOut(aliAppid); |
| | | // royaltyDetailInfo1.setTransInType("loginName"); |
| | | // royaltyDetailInfo1.setTransIn("18398968484"); |
| | | // |
| | | // royaltyDetailInfo1.setDesc("分账描述1"); |
| | | // royaltyDetailInfo1.setAmountPercentage("10"); |
| | | // List<RoyaltyDetailInfos> royaltyDetailInfos = new ArrayList<>(); |
| | | // |
| | | // |
| | | // |
| | | // |
| | | // royaltyInfo.setRoyaltyDetailInfos(royaltyDetailInfos); |
| | | // model.setRoyaltyInfo(royaltyInfo); |
| | | // System.err.println("========royaltyInfo=========="+royaltyInfo); |
| | | |
| | | |
| | | |
| | |
| | | import javax.annotation.Resource; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.concurrent.TimeUnit; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | |
| | | } |
| | | } |
| | | |
| | | @Scheduled(fixedRate = 60000) |
| | | public void taskMinute2(){ |
| | | try { |
| | | List<SiteBooking> siteBookings = siteBookingMapper.selectList(new LambdaQueryWrapper<SiteBooking>().eq(SiteBooking::getStatus, 0)); |
| | | for (SiteBooking siteBooking : siteBookings) { |
| | | long time = siteBooking.getInsertTime().getTime(); |
| | | long currentTime = System.currentTimeMillis(); |
| | | long timeDifference = currentTime - time; |
| | | long minutes = TimeUnit.MILLISECONDS.toMinutes(timeDifference); |
| | | if (minutes > 30) { |
| | | siteBooking.setStatus(5); |
| | | siteBookingMapper.updateById(siteBooking); |
| | | } |
| | | } |
| | | //定时修改赛事状态 |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | |
| | | |
| | | <select id="queryDatas" resultType="com.dsh.other.model.BillingRequestOfType"> |
| | | SELECT DATE_FORMAT(insertTime, '%m-%d %H:%i')as `time`, |
| | | SELECT DATE_FORMAT(insertTime, '%m-%d %H:%i')as `time`,DATE_FORMAT(payTime, '%m-%d %H:%i')as `time1`, |
| | | payMoney as amount, |
| | | `status` |
| | | from t_site_booking |
| | |
| | | c.lon as storeLon, |
| | | c.lat as storeLat, |
| | | a.payMoney as payMoney, |
| | | a.payType as payType, |
| | | CONCAT(DATE_FORMAT(a.startTime, '%Y-%m-%d %H:%i'), '-', DATE_FORMAT(a.endTime, '%H:%i')) as appointment, |
| | | a.`status`, |
| | | UNIX_TIMESTAMP(a.insertTime) * 1000 as insertTime |