Merge branch '1.0-bug' of http://120.76.84.145:10101/gitblit/r/java/PlayPai into 2.0
Conflicts:
cloud-server-course/src/main/java/com/dsh/course/controller/CoursePackagePaymentController.java
| | |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | TAppGift one = appGiftService.getOne(new LambdaQueryWrapper<TAppGift>().eq(TAppGift::getUserId, appUserId)); |
| | | Boolean b = false; |
| | | Integer i = 0; |
| | | if (one != null && one.getNum() > 0) { |
| | | i = appGiftService.weeksOfAddHours(packetId, appUserId, one.getNum()); |
| | | |
| | | } |
| | | if (i == 1) { |
| | | // 送完清0 |
| | |
| | | }) |
| | | public ResultUtil<List<StuMedalVo>> queryStuMedal(Integer stuId) { |
| | | try { |
| | | |
| | | |
| | | Integer appUserId = tokenUtil.getUserIdFormRedis(); |
| | | if (null == appUserId) { |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | return ResultUtil.success(honorService.queryHonorDetails(stuId)); |
| | | return ResultUtil.success(honorService.queryHonorDetails(appUserId)); |
| | | } catch (Exception e) { |
| | | return ResultUtil.runErr(); |
| | | } |
New file |
| | |
| | | package com.dsh.account.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.dsh.account.entity.StudentHonor; |
| | | import com.dsh.account.feignclient.other.HonorRulesClient; |
| | | import com.dsh.account.feignclient.other.model.HonorRules; |
| | | import com.dsh.account.service.StudentHonorService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.Date; |
| | | |
| | | |
| | | /** |
| | | * 勋章 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/studentHonor") |
| | | public class StudentHonorController { |
| | | |
| | | @Autowired |
| | | private StudentHonorService studentHonorService; |
| | | |
| | | @Resource |
| | | private HonorRulesClient honorRulesClient; |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 保存用户勋章 |
| | | * @param studentHonor |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/saveStudentHonor") |
| | | public void saveStudentHonor(@RequestBody StudentHonor studentHonor){ |
| | | StudentHonor one = studentHonorService.getOne(new QueryWrapper<StudentHonor>() |
| | | .eq("appUserId", studentHonor.getAppUserId()).eq("honorType", studentHonor.getHonorType())); |
| | | if(null == one){ |
| | | one = new StudentHonor(); |
| | | } |
| | | //获取荣耀规则 |
| | | HonorRules honorRules = new HonorRules(); |
| | | honorRules.setType(studentHonor.getHonorType()); |
| | | honorRules.setCondition(studentHonor.getNumber()); |
| | | HonorRules honorRules1 = honorRulesClient.getHonorRules(honorRules); |
| | | if(null != honorRules1){ |
| | | one.setAppUserId(studentHonor.getAppUserId()); |
| | | one.setHonorType(studentHonor.getHonorType()); |
| | | one.setNumber(studentHonor.getNumber()); |
| | | one.setHonorRuleId(honorRules1.getId()); |
| | | one.setHonorLevel(honorRules1.getLevel()); |
| | | one.setInsertTime(new Date()); |
| | | studentHonorService.saveOrUpdate(one); |
| | | } |
| | | } |
| | | } |
| | |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Integer id; |
| | | /** |
| | | * 学员id |
| | | * 用户id |
| | | */ |
| | | @TableField("stuId") |
| | | private Integer stuId; |
| | | @TableField("appUserId") |
| | | private Integer appUserId; |
| | | /** |
| | | * 荣耀规则id |
| | | */ |
| | |
| | | @TableField("honorLevel") |
| | | private Integer honorLevel; |
| | | /** |
| | | * 当前次数 |
| | | */ |
| | | @TableField("number") |
| | | private Integer number; |
| | | /** |
| | | * 添加时间 |
| | | */ |
| | | @TableField("insertTime") |
| | |
| | | public List<PurchaseRecordVo> queryAppUsersofIntroduce(@RequestBody IntrduceOfUserRequest request); |
| | | |
| | | @PostMapping("/base/introduce/getGiftList") |
| | | IntroduceRewards getGiftList(@RequestBody String cityCode); |
| | | List<IntroduceRewards> getGiftList(@RequestBody String cityCode); |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.dsh.account.feignclient.other; |
| | | |
| | | import com.dsh.account.feignclient.other.model.HonorRules; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | |
| | | |
| | | /** |
| | | * 荣耀规则 |
| | | */ |
| | | @FeignClient("mb-cloud-other") |
| | | public interface HonorRulesClient { |
| | | |
| | | |
| | | /** |
| | | * 获取合适的规则 |
| | | * @param honorRules |
| | | * @return |
| | | */ |
| | | @PostMapping("/honorRules/getHonorRules") |
| | | HonorRules getHonorRules(HonorRules honorRules); |
| | | |
| | | /** |
| | | * 根据id获取数据 |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @PostMapping("/honorRules/getHonorRulesById") |
| | | HonorRules getHonorRulesById(Integer id); |
| | | } |
New file |
| | |
| | | package com.dsh.account.feignclient.other.model; |
| | | |
| | | |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class HonorRules { |
| | | private Integer id; |
| | | /** |
| | | * 数据类型(1=俱乐部之星,2=运动达人,3=社区之王,4=深度玩家) |
| | | */ |
| | | private Integer type; |
| | | /** |
| | | * 等级 |
| | | */ |
| | | private Integer level; |
| | | /** |
| | | * 满足条件值 |
| | | */ |
| | | private Integer condition; |
| | | } |
| | |
| | | |
| | | List<GongVo> queryStuOfMedalData(Integer stuId); |
| | | |
| | | List<StuMedalVo> queryHonorDetails(Integer stuId); |
| | | List<StuMedalVo> queryHonorDetails(Integer appUserId); |
| | | |
| | | } |
| | |
| | | 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.HonorRulesClient; |
| | | import com.dsh.account.feignclient.other.SiteClient; |
| | | import com.dsh.account.mapper.StudentHonorMapper; |
| | | import com.dsh.account.model.vo.medalDetail.GongVo; |
| | |
| | | @Resource |
| | | private SiteClient siteClient; |
| | | |
| | | |
| | | @Autowired |
| | | private HonorDeClient honorDeClient; |
| | | |
| | | |
| | | @Autowired |
| | | private TStudentService studentService; |
| | | |
| | | @Autowired |
| | | private HonorRulesClient honorRulesClient; |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | @Override |
| | | public List<GongVo> queryStuOfMedalData(Integer stuId) { |
| | |
| | | |
| | | |
| | | @Override |
| | | public List<StuMedalVo> queryHonorDetails(Integer stuId) { |
| | | List<StuMedalVo> studentHonors = new ArrayList<>(); |
| | | // List<Integer> collect = studentHonors.stream().map(StudentHonor::getHonorRuleId).collect(Collectors.toList()); |
| | | |
| | | Integer count1 = coursePackageClient.counts(stuId); |
| | | if (count1 > 0) { |
| | | public List<StuMedalVo> queryHonorDetails(Integer appUserId) { |
| | | List<StuMedalVo> list = new ArrayList<>(); |
| | | List<StudentHonor> studentHonors = this.list(new QueryWrapper<StudentHonor>().eq("appUserId", appUserId)); |
| | | for (StudentHonor studentHonor : studentHonors) { |
| | | StuMedalVo vo = new StuMedalVo(); |
| | | vo.setMedalType(1); |
| | | vo.setMedalType(studentHonor.getHonorType()); |
| | | switch (studentHonor.getHonorType()){ |
| | | case 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); |
| | | break; |
| | | case 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); |
| | | break; |
| | | case 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); |
| | | break; |
| | | case 4: |
| | | vo.setMedalName("深度玩家"); |
| | | break; |
| | | } |
| | | //拿到当前对应的rule对象 |
| | | List<Integer> integers = new ArrayList<>(); |
| | | integers.add(4); |
| | | integers.add(count4); |
| | | integers.add(studentHonor.getHonorType()); |
| | | integers.add(studentHonor.getNumber()); |
| | | HonorRules honorRules = honorDeClient.getHonor(integers); |
| | | if (count4 < Integer.valueOf(honorRules.getCondition())) { |
| | | if (studentHonor.getNumber() < 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.setUpgradeConditions(String.valueOf(Integer.valueOf(honorRules.getCondition()) - studentHonor.getNumber())); |
| | | vo.setIsTopLevel(0); |
| | | } else { |
| | | vo.setIsTopLevel(1); |
| | | } |
| | | |
| | | studentHonors.add(vo); |
| | | list.add(vo); |
| | | } |
| | | |
| | | |
| | | return studentHonors; |
| | | return list; |
| | | } |
| | | } |
| | |
| | | return ResultUtil.error("请先开启定位", ""); |
| | | } |
| | | Map<String, String> geocode = gdMapGeocodingUtil.geocode(addAppUserVo.getLon(), addAppUserVo.getLat()); |
| | | Integer num = 0; |
| | | Integer activityId = null; |
| | | if (null != geocode) { |
| | | String province = geocode.get("province"); |
| | | String provinceCode = geocode.get("provinceCode"); |
| | | String city = geocode.get("city"); |
| | | String cityCode = geocode.get("cityCode"); |
| | | // 根据所在市code 查询是否有介绍有礼活动 |
| | | IntroduceRewards res = introduceRewardsClient.getGiftList(cityCode); |
| | | List<IntroduceRewards> res = introduceRewardsClient.getGiftList(cityCode); |
| | | if (res != null) { |
| | | num = res.getGiveClass(); |
| | | activityId = res.getId(); |
| | | for (IntroduceRewards re : res) { |
| | | Integer num = re.getGiveClass(); |
| | | Integer activityId = re.getId(); |
| | | if (ToolUtil.isNotEmpty(addAppUserVo.getInvitePhone())) { |
| | | List<TAppUser> tAppUsers = this.baseMapper.selectList(new LambdaQueryWrapper<TAppUser>() |
| | | .eq(TAppUser::getPhone, addAppUserVo.getInvitePhone())); |
| | |
| | | tAppGift.setActivityId(activityId); |
| | | tAppGift.setInsertTime(new Date()); |
| | | appGiftService.save(tAppGift); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | if (tAppUser.getState() == 2) { |
| | | return ResultUtil.error("您的账号已被冻结"); |
| | | } |
| | | boolean newUser = false; |
| | | List<TAppUser> tAppUsers1 = appUserMapper.selectList(new LambdaQueryWrapper<TAppUser>().eq(TAppUser::getPhone, dto.getPhone()).eq(TAppUser::getState, 1)); |
| | | if (tAppUsers1.size() > 0) { |
| | | TAppUser tAppUser1 = tAppUsers1.get(0); |
| | |
| | | appUserMapper.updateById(tAppUser); |
| | | token = getToken(tAppUser); |
| | | map.put("token", token); |
| | | |
| | | newUser = true; |
| | | } |
| | | |
| | | // tAppUser.setPhone(dto.getPhone()); |
| | | |
| | | if (ToolUtil.isNotEmpty(dto.getInvitePhone())) { |
| | | if (newUser && ToolUtil.isNotEmpty(dto.getInvitePhone())) { |
| | | if (ToolUtil.isEmpty(dto.getLat()) || ToolUtil.isEmpty(dto.getLon())) { |
| | | return ResultUtil.error("请先开启定位"); |
| | | } |
| | | TAppUser tAppUser1 = appUserMapper.selectOne(new LambdaQueryWrapper<TAppUser>().eq(TAppUser::getPhone, dto.getInvitePhone()).eq(TAppUser::getState, 1)); |
| | | if (tAppUser1 != null) { |
| | | TAppUser tAppUser1 = appUserMapper.selectOne(new LambdaQueryWrapper<TAppUser>() |
| | | .eq(TAppUser::getPhone, dto.getInvitePhone()).eq(TAppUser::getState, 1)); |
| | | if(null == tAppUser1){ |
| | | return ResultUtil.error("邀请人还未注册账号"); |
| | | } |
| | | Map<String, String> geocode = null; |
| | | try { |
| | | geocode = gdMapGeocodingUtil.geocode(dto.getLon(), dto.getLat()); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | Integer num = 0; |
| | | if (null != geocode) { |
| | | String province = geocode.get("province"); |
| | | String provinceCode = geocode.get("provinceCode"); |
| | | String city = geocode.get("city"); |
| | | String cityCode = geocode.get("cityCode"); |
| | | IntroduceRewards giftList = introduceRewardsClient.getGiftList(cityCode); |
| | | num = giftList.getGiveClass(); |
| | | } |
| | | Integer userId = null; |
| | | if (ToolUtil.isNotEmpty(dto.getInvitePhone())) { |
| | | List<TAppUser> tAppUsers = this.baseMapper.selectList(new LambdaQueryWrapper<TAppUser>().eq(TAppUser::getPhone, dto.getInvitePhone())); |
| | | if (tAppUsers.size() > 0) { |
| | | userId = tAppUsers.get(0).getId(); |
| | | } |
| | | } |
| | | if (userId != null) { |
| | | TAppGift one = appGiftService.getOne(new LambdaQueryWrapper<TAppGift>().eq(TAppGift::getUserId, userId)); |
| | | if (one != null) { |
| | | one.setNum(one.getNum() + num); |
| | | appGiftService.updateById(one); |
| | | } else { |
| | | // 根据所在市code 查询是否有介绍有礼活动 |
| | | List<IntroduceRewards> res = introduceRewardsClient.getGiftList(cityCode); |
| | | if (res != null) { |
| | | for (IntroduceRewards re : res) { |
| | | Integer num = re.getGiveClass(); |
| | | Integer activityId = re.getId(); |
| | | if (num != 0) { |
| | | TAppGift tAppGift = new TAppGift(); |
| | | tAppGift.setUserId(userId); |
| | | tAppGift.setUserName(tAppUser1.getName()); |
| | | tAppGift.setUserPhone(tAppUser1.getPhone()); |
| | | tAppGift.setUserId(tAppUser1.getId()); |
| | | tAppGift.setNum(num); |
| | | tAppGift.setShareUserId(tAppUser.getId()); |
| | | tAppGift.setShareUserName(tAppUser.getPhone()); |
| | | tAppGift.setShareUserPhone(tAppUser.getPhone()); |
| | | tAppGift.setActivityId(activityId); |
| | | tAppGift.setInsertTime(new Date()); |
| | | appGiftService.save(tAppGift); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | // appUserMapper.updateById(tAppUser); |
| | | |
| | | } |
| | | return ResultUtil.success(map); |
| | | } |
| | | |
| | |
| | | |
| | | @PostMapping("/base/introduce/getGiftList") |
| | | @ResponseBody |
| | | public IntroduceRewards getGiftList(@RequestBody String cityCode) { |
| | | public List<IntroduceRewards> getGiftList(@RequestBody String cityCode) { |
| | | List<IntroduceRewards> list = idrService.list(new LambdaQueryWrapper<IntroduceRewards>() |
| | | .eq(IntroduceRewards::getCityCode, cityCode) |
| | | .le(IntroduceRewards::getStartTime, new Date()) |
| | | .ge(IntroduceRewards::getEndTime, new Date()) |
| | | .eq(IntroduceRewards::getState, 1) |
| | | .orderByDesc(IntroduceRewards::getInsertTime) |
| | | .last("LIMIT 1")); |
| | | if (list.size() > 0) { |
| | | return list.get(0); |
| | | } |
| | | return null; |
| | | ); |
| | | return list; |
| | | } |
| | | |
| | | } |
| | |
| | | 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.StudentHonorClient; |
| | | import com.dsh.competition.feignclient.account.model.AppUser; |
| | | import com.dsh.competition.feignclient.account.model.StudentHonor; |
| | | import com.dsh.competition.feignclient.account.model.TStudent; |
| | | import com.dsh.competition.feignclient.course.CoursePackagePaymentClient; |
| | | import com.dsh.competition.feignclient.course.model.PaymentDeductionClassHour; |
| | |
| | | |
| | | @Autowired |
| | | private AppUserClient appUserClient; |
| | | |
| | | @Resource |
| | | private StudentHonorClient studentHonorClient; |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 根据门店ids 获取对应的赛事 根据赛事支付记录获取用户ids |
| | |
| | | try { |
| | | Competition byId = competitionService.getById(paymentCompetitionVo.getId()); |
| | | Date date = byId.getEndTime(); |
| | | // Assuming you have a Date object |
| | | // Check if the date is past the current time |
| | | boolean isPast = date.after(new Date()); |
| | | if (!isPast) { |
| | | return new ResultUtil(0, "已超过截至报名时间"); |
| | |
| | | } else { |
| | | competition.setStatus(3); |
| | | } |
| | | |
| | | if(competition.getStatus() == 2){ |
| | | //添加勋章数据 |
| | | List<PaymentCompetition> list = paymentCompetitionService.list(new QueryWrapper<PaymentCompetition>() |
| | | .eq("competitionId", competition.getId()).eq("payStatus", 2).eq("state", 1)); |
| | | Set<Integer> collect = list.stream().map(PaymentCompetition::getAppUserId).collect(Collectors.toSet()); |
| | | for (Integer integer : collect) { |
| | | int count = paymentCompetitionService.count(new QueryWrapper<PaymentCompetition>() |
| | | .eq("appUserId", integer).eq("payStatus", 2).eq("state", 1)); |
| | | StudentHonor studentHonor = new StudentHonor(); |
| | | studentHonor.setAppUserId(integer); |
| | | studentHonor.setHonorType(2); |
| | | studentHonor.setNumber(count); |
| | | studentHonorClient.saveStudentHonor(studentHonor); |
| | | } |
| | | } |
| | | } |
| | | competition.setInsertTime(new Date()); |
| | | cttService.save(competition); |
| | | |
| | | |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | |
| | | } else { |
| | | competition.setStatus(3); |
| | | } |
| | | |
| | | if(competition.getStatus() == 2){ |
| | | //添加勋章数据 |
| | | List<PaymentCompetition> list = paymentCompetitionService.list(new QueryWrapper<PaymentCompetition>() |
| | | .eq("competitionId", competition.getId()).eq("payStatus", 2).eq("state", 1)); |
| | | Set<Integer> collect = list.stream().map(PaymentCompetition::getAppUserId).collect(Collectors.toSet()); |
| | | for (Integer integer : collect) { |
| | | int count = paymentCompetitionService.count(new QueryWrapper<PaymentCompetition>() |
| | | .eq("appUserId", integer).eq("payStatus", 2).eq("state", 1)); |
| | | StudentHonor studentHonor = new StudentHonor(); |
| | | studentHonor.setAppUserId(integer); |
| | | studentHonor.setHonorType(2); |
| | | studentHonor.setNumber(count); |
| | | studentHonorClient.saveStudentHonor(studentHonor); |
| | | } |
| | | } |
| | | } |
| | | cttService.updateById(competition); |
| | | |
| | | |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | |
| | | @TableField("participantId") |
| | | private Integer participantId; |
| | | /** |
| | | * 参与人员类型(1=学员,2=参赛者) |
| | | */ |
| | | @TableField("participantType") |
| | | private Integer participantType; |
| | | /** |
| | | * 支付记录id |
| | | */ |
| | | @TableField("paymentCompetitionId") |
New file |
| | |
| | | package com.dsh.competition.feignclient.account; |
| | | |
| | | import com.dsh.competition.feignclient.account.model.StudentHonor; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | |
| | | /** |
| | | * 勋章 |
| | | */ |
| | | @FeignClient("mb-cloud-account") |
| | | public interface StudentHonorClient { |
| | | |
| | | |
| | | /** |
| | | * 保存用户勋章 |
| | | * @param studentHonor |
| | | */ |
| | | @PostMapping("/studentHonor/saveStudentHonor") |
| | | void saveStudentHonor(StudentHonor studentHonor); |
| | | } |
New file |
| | |
| | | package com.dsh.competition.feignclient.account.model; |
| | | |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class StudentHonor { |
| | | /** |
| | | * 用户id |
| | | */ |
| | | private Integer appUserId; |
| | | /** |
| | | * 荣耀类型 |
| | | */ |
| | | private Integer honorType; |
| | | /** |
| | | * 当前次数 |
| | | */ |
| | | private Integer number; |
| | | } |
| | |
| | | public class PaymentCompetitionVo { |
| | | @ApiModelProperty(value = "赛事id", dataType = "int", required = true) |
| | | private Integer id; |
| | | @ApiModelProperty(value = "参赛人员id,多个分号分隔", dataType = "String", required = true) |
| | | @ApiModelProperty(value = "参赛人员id[{\"id\":123,\"isStudent\":1},{\"id\":222,\"isStudent\":0}]", dataType = "String", required = true) |
| | | private String ids; |
| | | @ApiModelProperty(value = "支付方式(1=微信,2=支付宝,3=余额,4=课时)", dataType = "int", required = true) |
| | | private Integer payType; |
| | |
| | | package com.dsh.competition.service.impl; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.alibaba.nacos.common.utils.UuidUtils; |
| | | import com.alipay.api.AlipayApiException; |
| | | import com.alipay.api.AlipayClient; |
| | |
| | | @Override |
| | | public ResultUtil paymentCompetition(Integer uid, PaymentCompetitionVo paymentCompetitionVo) throws Exception { |
| | | AppUser appUser = appUserClient.queryAppUser(uid); |
| | | String[] split = paymentCompetitionVo.getIds().split(";"); |
| | | JSONArray jsonArray = JSON.parseArray(paymentCompetitionVo.getIds()); |
| | | Competition competition = this.getById(paymentCompetitionVo.getId()); |
| | | |
| | | List<PaymentCompetition> list = paymentCompetitionService.list(new QueryWrapper<PaymentCompetition>().eq("competitionId", paymentCompetitionVo.getId()).ne("payStatus", 3)); |
| | |
| | | } |
| | | |
| | | |
| | | // int competitionId = userCompetitionService.count(new QueryWrapper<UserCompetition>().eq("competitionId", paymentCompetitionVo.getId())); |
| | | if ((competitionId + split.length) > competition.getApplicantsNumber()) { |
| | | if ((competitionId + jsonArray.size()) > competition.getApplicantsNumber()) { |
| | | return ResultUtil.error("报名人数超过最大限制"); |
| | | } |
| | | BigDecimal money = null; |
| | | if (paymentCompetitionVo.getPayType() == 1 || paymentCompetitionVo.getPayType() == 2) { |
| | | money = new BigDecimal(competition.getCashPrice()).multiply(new BigDecimal(split.length)).setScale(2, RoundingMode.HALF_EVEN); |
| | | money = new BigDecimal(competition.getCashPrice()).multiply(new BigDecimal(jsonArray.size())).setScale(2, RoundingMode.HALF_EVEN); |
| | | } |
| | | if (paymentCompetitionVo.getPayType() == 3) {//玩湃币 |
| | | money = new BigDecimal(competition.getPlayPaiCoin()).multiply(new BigDecimal(split.length)).setScale(2, RoundingMode.HALF_EVEN); |
| | | money = new BigDecimal(competition.getPlayPaiCoin()).multiply(new BigDecimal(jsonArray.size())).setScale(2, RoundingMode.HALF_EVEN); |
| | | if (money.compareTo(new BigDecimal(appUser.getPlayPaiCoins())) > 0) { |
| | | return new ResultUtil(2, "报名失败,玩湃币不足,请充值"); |
| | | } |
| | | } |
| | | if (paymentCompetitionVo.getPayType() == 4) {//课程 |
| | | money = new BigDecimal(competition.getClassPrice()).multiply(new BigDecimal(split.length)).setScale(2, RoundingMode.HALF_EVEN); |
| | | for (String s : split) { |
| | | // Participant participant = participantService.getById(s); |
| | | // Student student = studentClient.queryStudentByPhone(participant.getPhone()); |
| | | // if(null == student){ |
| | | // return ResultUtil.error(participant.getName() + "不是学员,无法使用课时支付。"); |
| | | // } |
| | | // 2.0 |
| | | money = new BigDecimal(competition.getClassPrice()).multiply(new BigDecimal(jsonArray.size())).setScale(2, RoundingMode.HALF_EVEN); |
| | | Integer integer = coursePackagePaymentClient.queryResidueClassHourById(paymentCompetitionVo.getCoursePaymentId()); |
| | | if (new BigDecimal(integer).compareTo(new BigDecimal(competition.getClassPrice())) < 0) { |
| | | if (new BigDecimal(integer).compareTo(money) < 0) { |
| | | return new ResultUtil(3, "剩余课时不足,无法完成支付。"); |
| | | |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | paymentCompetition.setInsertTime(new Date()); |
| | | paymentCompetitionService.save(paymentCompetition); |
| | | |
| | | for (String s : split) { |
| | | for (int i = 0; i < jsonArray.size(); i++) { |
| | | JSONObject jsonObject = jsonArray.getJSONObject(i); |
| | | Integer id = jsonObject.getInteger("id"); |
| | | Integer isStudent = jsonObject.getInteger("isStudent"); |
| | | UserCompetition userCompetition = new UserCompetition(); |
| | | userCompetition.setAppUserId(uid); |
| | | userCompetition.setCompetitionId(paymentCompetitionVo.getId()); |
| | | userCompetition.setParticipantId(Integer.valueOf(s)); |
| | | userCompetition.setParticipantId(id); |
| | | userCompetition.setParticipantType(isStudent == 0 ? 2 : 1); |
| | | userCompetition.setPaymentCompetitionId(paymentCompetition.getId()); |
| | | userCompetition.setInsertTime(new Date()); |
| | | userCompetitionService.save(userCompetition); |
| | |
| | | paymentCompetition.setPayOrderNo(""); |
| | | paymentCompetitionService.updateById(paymentCompetition); |
| | | |
| | | // competition.setApplicantsNumber(competition.getApplicantsNumber() + 1); |
| | | this.updateById(competition); |
| | | } |
| | | if (paymentCompetitionVo.getPayType() == 4) {//课程 |
| | | for (String s : split) { |
| | | // Participant participant = participantService.getById(s); |
| | | // Student student = studentClient.queryStudentByPhone(participant.getPhone()); |
| | | for (int i = 0; i < jsonArray.size(); i++) { |
| | | JSONObject jsonObject = jsonArray.getJSONObject(i); |
| | | Integer id = jsonObject.getInteger("id"); |
| | | Integer isStudent = jsonObject.getInteger("isStudent"); |
| | | if(isStudent == 0){ |
| | | continue; |
| | | } |
| | | //扣减课时 |
| | | PaymentDeductionClassHour paymentDeductionClassHour = new PaymentDeductionClassHour(); |
| | | paymentDeductionClassHour.setId(Integer.valueOf(s)); |
| | | paymentDeductionClassHour.setId(id); |
| | | paymentDeductionClassHour.setClassHour(competition.getClassPrice()); |
| | | paymentDeductionClassHour.setCode(code); |
| | | paymentDeductionClassHour.setCourseId(paymentCompetitionVo.getCoursePaymentId()); |
| | | paymentDeductionClassHour.setUid(uid); |
| | | coursePackagePaymentClient.paymentDeductionClassHour(paymentDeductionClassHour); |
| | | } |
| | | |
| | | paymentCompetition = paymentCompetitionService.getById(paymentCompetition.getId()); |
| | | paymentCompetition.setAppUserId(null); |
| | | paymentCompetition.setPayStatus(2); |
| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.dsh.competition.entity.Competition; |
| | | import com.dsh.competition.entity.PaymentCompetition; |
| | | import com.dsh.competition.feignclient.account.StudentHonorClient; |
| | | import com.dsh.competition.feignclient.account.model.StudentHonor; |
| | | import com.dsh.competition.model.TCompetition; |
| | | import com.dsh.competition.service.CompetitionService; |
| | | import com.dsh.competition.service.IPaymentCompetitionService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.Arrays; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Set; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * @author shaqian |
| | |
| | | @Resource |
| | | private CompetitionService competitionService; |
| | | |
| | | @Resource |
| | | private StudentHonorClient studentHonorClient; |
| | | |
| | | @Autowired |
| | | private IPaymentCompetitionService paymentCompetitionService; |
| | | |
| | | |
| | | |
| | | /** |
| | | * 每秒去处理的定时任务 |
| | | */ |
| | |
| | | .ne("status", 4).ne("state", 3)); |
| | | for (Competition competition : list) { |
| | | // 当前时间小于开始时间 |
| | | if (competition.getStartTime().after(new Date())) { |
| | | if (competition.getStatus() != 1 && competition.getStartTime().after(new Date())) { |
| | | competition.setStatus(1); |
| | | } |
| | | if (competition.getStartTime().before(new Date())) { |
| | | if (competition.getStatus() == 1 && competition.getStartTime().before(new Date())) { |
| | | if (competition.getEndTime().after(new Date())) { |
| | | competition.setStatus(2); |
| | | } else { |
| | | competition.setStatus(3); |
| | | } |
| | | |
| | | if(competition.getStatus() == 2){ |
| | | //添加勋章数据 |
| | | List<PaymentCompetition> list1 = paymentCompetitionService.list(new QueryWrapper<PaymentCompetition>() |
| | | .eq("competitionId", competition.getId()).eq("payStatus", 2).eq("state", 1)); |
| | | Set<Integer> collect = list1.stream().map(PaymentCompetition::getAppUserId).collect(Collectors.toSet()); |
| | | for (Integer integer : collect) { |
| | | int count = paymentCompetitionService.count(new QueryWrapper<PaymentCompetition>() |
| | | .eq("appUserId", integer).eq("payStatus", 2).eq("state", 1)); |
| | | StudentHonor studentHonor = new StudentHonor(); |
| | | studentHonor.setAppUserId(integer); |
| | | studentHonor.setHonorType(2); |
| | | studentHonor.setNumber(count); |
| | | studentHonorClient.saveStudentHonor(studentHonor); |
| | | } |
| | | } |
| | | } |
| | | competitionService.updateById(competition); |
| | | } |
| | |
| | | package com.dsh.course.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.dsh.course.entity.*; |
| | | import com.dsh.course.feignclient.account.AppUserClient; |
| | | import com.dsh.course.feignclient.account.CoachClient; |
| | |
| | | @PostMapping("/cancelledClasses/addCancelledClasses") |
| | | public void addCancelledClasses(@RequestBody CancelledClasses cancelledClasses) { |
| | | cancelledClassesService.save(cancelledClasses); |
| | | |
| | | // TCoursePackagePayment byId = coursePackagePaymentService.getById(cancelledClasses.getCoursePackagePaymentId()); |
| | | orderStudentService.getById(cancelledClasses.getCoursePackagePaymentId()); |
| | | CourseCounsum courseCounsum = new CourseCounsum(); |
| | | courseCounsum.setPaymentId(cancelledClasses.getCoursePackagePaymentId()); |
| | |
| | | courseCounsumService.save(courseCounsum); |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | .eq("coursePackageSchedulingId", coursePackageScheduling.getId())); |
| | | } |
| | | } |
| | | |
| | | CourseCounsum courseCounsum = new CourseCounsum(); |
| | | courseCounsum.setPaymentId(coursePackageOrderStudent.getId()); |
| | | courseCounsum.setChangeType(0); |
| | | courseCounsum.setNum(paymentDeductionClassHour.getClassHour()); |
| | | courseCounsum.setInsertTime(new Date()); |
| | | courseCounsum.setReason("赛事报名"); |
| | | courseCounsum.setAppUserId(coursePackageOrderStudent.getAppUserId()); |
| | | courseCounsumService.save(courseCounsum); |
| | | |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | |
| | | @ResponseBody |
| | | @PostMapping("/base/coursePack/obtainStudentClassDetails") |
| | | public List<RecordAppoint> obtainStudentClassDetailsData(@RequestBody WeeksOfCourseRest stuId) { |
| | | // try { |
| | | return coursePackageOrderStudentService.obtainStuClassDetails(stuId.getStuId(), stuId.getAppUserId(), stuId.getPageNum()); |
| | | // }catch (Exception e){ |
| | | // e.printStackTrace(); |
| | | // throw new RuntimeException(); |
| | | // } |
| | | } |
| | | |
| | | |
| | |
| | | @PostMapping("/base/coursePack/sendHours") |
| | | 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])); |
| | | CoursePackageOrderStudent coursePackageOrderStudent = coursePackageOrderStudentService.getById(Long.valueOf(split2[0])); |
| | | coursePackageOrderStudent.setTotalClassHours(coursePackageOrderStudent.getTotalClassHours() + Integer.valueOf(split2[2])); |
| | | coursePackageOrderStudent.setLaveClassHours(coursePackageOrderStudent.getLaveClassHours() + Integer.valueOf(split2[2])); |
| | | coursePackageOrderStudentService.updateById(coursePackageOrderStudent); |
| | | |
| | | CourseCounsum courseCounsum = new CourseCounsum(); |
| | | courseCounsum.setPaymentId(byId.getId()); |
| | | courseCounsum.setPaymentId(coursePackageOrderStudent.getId()); |
| | | courseCounsum.setChangeType(1); |
| | | courseCounsum.setNum(Integer.valueOf(split2[2])); |
| | | courseCounsum.setInsertTime(new Date()); |
| | |
| | | courseCounsumService.save(courseCounsum); |
| | | |
| | | |
| | | List<CoursePackageStudent> studentCourse = coursePackageStudentService.list(new QueryWrapper<CoursePackageStudent>().eq("studentId", byId.getStudentId()).eq("coursePackageId", byId.getCoursePackageId())); |
| | | List<CoursePackageStudent> studentCourse = coursePackageStudentService.list(new QueryWrapper<CoursePackageStudent>().eq("studentId", coursePackageOrderStudent.getStudentId()).eq("coursePackageId", coursePackageOrderStudent.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())); |
| | | coursePackageStudentService.remove(new QueryWrapper<CoursePackageStudent>().eq("studentId", coursePackageOrderStudent.getStudentId()).eq("coursePackageId", coursePackageOrderStudent.getCoursePackageId())); |
| | | |
| | | |
| | | TCoursePackage tCoursePackage = packageService.getById(byId.getCoursePackageId()); |
| | | TCoursePackage tCoursePackage = packageService.getById(coursePackageOrderStudent.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())); |
| | | TCoursePackagePayment pay = packagePaymentService.getOne(new QueryWrapper<TCoursePackagePayment>().eq("coursePackageId", coursePackageOrderStudent.getCoursePackageId()).eq("studentId", coursePackageOrderStudent.getStudentId())); |
| | | |
| | | Date today = new Date(); |
| | | |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | if (b) { |
| | | return 1; |
| | | } else { |
| | | |
| | | return 0; |
| | | } |
| | | } |
| | | |
| | | |
| | |
| | | courseCounsum.setReason("退费"); |
| | | courseCounsum.setPaymentId(o.getId()); |
| | | courseCounsum.setInsertTime(new Date()); |
| | | courseCounsum.setAppUserId(o.getAppUserId()); |
| | | counsumService.save(courseCounsum); |
| | | |
| | | o.setTotalClassHours(0); |
| | | o.setLaveClassHours(0); |
| | | o.setStatus(2); |
| | | o.setAppUserId(null); |
| | |
| | | courseCounsum.setNum(laveClassHours); |
| | | courseCounsum.setChangeType(0); |
| | | courseCounsum.setPaymentId(orinPay.getId()); |
| | | courseCounsum.setAppUserId(orinPay.getAppUserId()); |
| | | counsumService.save(courseCounsum); |
| | | |
| | | CourseCounsum courseCounsum1 = new CourseCounsum(); |
| | |
| | | courseCounsum1.setNum(laveClassHours); |
| | | courseCounsum1.setChangeType(1); |
| | | courseCounsum1.setPaymentId(studentPay.getId()); |
| | | courseCounsum1.setAppUserId(studentPay.getAppUserId()); |
| | | counsumService.save(courseCounsum1); |
| | | |
| | | schedulingService.addNewCoursePackageScheduling(studentPay.getId(), laveClassHours); |
| | |
| | | courseCounsum.setNum(laveClassHours1); |
| | | courseCounsum.setChangeType(0); |
| | | courseCounsum.setPaymentId(orinPay.getId()); |
| | | courseCounsum.setAppUserId(orinPay.getAppUserId()); |
| | | counsumService.save(courseCounsum); |
| | | |
| | | |
| | |
| | | courseCounsum1.setNum(laveClassHours1); |
| | | courseCounsum1.setChangeType(1); |
| | | courseCounsum1.setPaymentId(to.getId()); |
| | | courseCounsum1.setAppUserId(to.getAppUserId()); |
| | | counsumService.save(courseCounsum1); |
| | | |
| | | //开始排课 |
| | |
| | | // 添加购买课时 paytyoe为7 |
| | | // 排课可期 判断课程时间段 添加排课表 添加上课记录表 |
| | | // 找到原来的课包 扣课时 |
| | | // CoursePackageOrderStudent coursePackageOrderStudent = orderStudentService.getById(toHoliDto.getId()); |
| | | CoursePackageOrderStudent coursePackageOrderStudent = orderStudentService.getOne(new QueryWrapper<CoursePackageOrderStudent>().eq("coursePackageId",toHoliDto.getId()).eq("studentId",stuId)); |
| | | |
| | | TCoursePackage coursePackage = coursePackageService.getById(coursePackageOrderStudent.getCoursePackageId()); |
| | |
| | | coursePackageOrderStudent.setAppUserId(null); |
| | | coursePackageOrderStudent.setLaveClassHours(coursePackageOrderStudent.getLaveClassHours()-toHoliDto.getClassNum()); |
| | | orderStudentService.updateById(coursePackageOrderStudent); |
| | | |
| | | CourseCounsum courseCounsum = new CourseCounsum(); |
| | | courseCounsum.setPaymentId(coursePackageOrderStudent.getId()); |
| | | courseCounsum.setChangeType(0); |
| | | courseCounsum.setNum(toHoliDto.getClassNum()); |
| | | courseCounsum.setInsertTime(new Date()); |
| | | courseCounsum.setReason("报名假期班"); |
| | | courseCounsum.setAppUserId(coursePackageOrderStudent.getAppUserId()); |
| | | courseCounsumService.save(courseCounsum); |
| | | |
| | | Integer laveClassHours = coursePackageOrderStudent.getLaveClassHours(); |
| | | if(3 >= laveClassHours){ |
| | | AppUser appUser = appUserClient.queryAppUser(coursePackageOrderStudent.getAppUserId()); |
| | |
| | | //增加日期,用于判断 |
| | | calendar.set(Calendar.DAY_OF_YEAR, calendar.get(Calendar.DAY_OF_YEAR) + 1); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | CourseCounsum courseCounsum = new CourseCounsum(); |
| | | courseCounsum.setPaymentId(coursePackageOrderStudent.getId()); |
| | | courseCounsum.setChangeType(0); |
| | | courseCounsum.setNum(toHoliDto.getClassNum()); |
| | | courseCounsum.setInsertTime(new Date()); |
| | | courseCounsum.setReason("报名假期班"); |
| | | // courseCounsum.setAppUserId(userId); |
| | | courseCounsumService.save(courseCounsum); |
| | | } |
| | | |
| | | return "报名成功"; |
| | |
| | | @ResponseBody |
| | | public String toTrans(@RequestBody ToHoliDto toHoliDto) throws ParseException { |
| | | String[] stuIds = toHoliDto.getIds(); |
| | | // //查询出学员ids对应的棵树,判断剩余课时数是否够 |
| | | // List<CoursePackageOrderStudent> list = orderStudentService.list(new QueryWrapper<CoursePackageOrderStudent>().eq("coursePackageId", toHoliDto.getClassId()).in("studentId", stuIds)); |
| | | // List<String> notStudent = new ArrayList<>(); |
| | | // for (CoursePackageOrderStudent coursePackageOrderStudent : list) { |
| | | // if (coursePackageOrderStudent.getLaveClassHours() < toHoliDto.getClassNum()) { |
| | | // notStudent.add(studentClient.queryStudentById(coursePackageOrderStudent.getStudentId()).getName()); |
| | | // } |
| | | // } |
| | | // if (!notStudent.isEmpty()) { |
| | | // String notStudentStr = String.join(",", notStudent); |
| | | // return notStudentStr+":课时数不足"; |
| | | // } |
| | | |
| | | |
| | | //转移课程 |
| | | for (String stuId : stuIds) { |
| | | // CoursePackageOrderStudent orinPay = orderStudentService.getById(toHoliDto.getId()); |
| | | CoursePackageOrderStudent orinPay = orderStudentService.getOne(new QueryWrapper<CoursePackageOrderStudent>() |
| | | .eq("studentId", stuId) |
| | | .eq("coursePackageId", toHoliDto.getId())); |
| | |
| | | courseCounsum.setInsertTime(new Date()); |
| | | Integer appUserId = orinPay.getAppUserId(); |
| | | Integer appUserId1 = studentPay.getAppUserId(); |
| | | |
| | | courseCounsum.setReason("换课"); |
| | | |
| | | |
| | | orinPay.setLaveClassHours(0); |
| | | orinPay.setStatus(3); |
| | | orinPay.setAppUserId(null); |
| | |
| | | courseCounsum.setNum(laveClassHours); |
| | | courseCounsum.setChangeType(0); |
| | | courseCounsum.setPaymentId(orinPay.getId()); |
| | | courseCounsum.setAppUserId(orinPay.getAppUserId()); |
| | | counsumService.save(courseCounsum); |
| | | |
| | | CourseCounsum courseCounsum1 = new CourseCounsum(); |
| | | courseCounsum1.setInsertTime(new Date()); |
| | | // if (appUserId.compareTo(appUserId1) != 0) { |
| | | // courseCounsum1.setReason("赠课"); |
| | | // } else { |
| | | courseCounsum1.setReason("换课"); |
| | | // } |
| | | courseCounsum1.setNum(laveClassHours); |
| | | courseCounsum1.setChangeType(1); |
| | | courseCounsum1.setPaymentId(studentPay.getId()); |
| | | courseCounsum1.setAppUserId(studentPay.getAppUserId()); |
| | | counsumService.save(courseCounsum1); |
| | | |
| | | schedulingService.addNewCoursePackageScheduling(studentPay.getId(), laveClassHours); |
New file |
| | |
| | | package com.dsh.course.feignclient.account; |
| | | |
| | | import com.dsh.course.feignclient.account.model.StudentHonor; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | |
| | | /** |
| | | * 勋章 |
| | | */ |
| | | @FeignClient("mb-cloud-account") |
| | | public interface StudentHonorClient { |
| | | |
| | | |
| | | /** |
| | | * 保存用户勋章 |
| | | * @param studentHonor |
| | | */ |
| | | @PostMapping("/studentHonor/saveStudentHonor") |
| | | void saveStudentHonor(StudentHonor studentHonor); |
| | | } |
New file |
| | |
| | | package com.dsh.course.feignclient.account.model; |
| | | |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class StudentHonor { |
| | | /** |
| | | * 用户id |
| | | */ |
| | | private Integer appUserId; |
| | | /** |
| | | * 荣耀类型 |
| | | */ |
| | | private Integer honorType; |
| | | /** |
| | | * 当前次数 |
| | | */ |
| | | private Integer number; |
| | | } |
| | |
| | | List<CoursePackageScheduling> list = coursePackageSchedulingService.list(new QueryWrapper<CoursePackageScheduling>() |
| | | .eq("appUserId", appUserId) |
| | | .eq("studentId", stuId) |
| | | // .lt("classDate", sdf.format(calendar.getTime())) |
| | | .orderByAsc("classDate") |
| | | ); |
| | | List<Long> ids = list.stream().map(CoursePackageScheduling::getId).collect(Collectors.toList()); |
| | |
| | | SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy.MM.dd"); |
| | | SimpleDateFormat format = new SimpleDateFormat("yyyy.MM.dd HH:mm"); |
| | | if (list.size() > 0) { |
| | | |
| | | // int pageNum = 1; // 页码 |
| | | int pageSize = 10; // 每页记录数 |
| | | Page<CoursePackageStudent> page = new Page<>(pageNum, pageSize); |
| | | IPage<CoursePackageStudent> coursePackageStudentPage = cpsMapper.selectPage(page, new QueryWrapper<CoursePackageStudent>() |
| | |
| | | } |
| | | |
| | | |
| | | CoursePackageScheduling byId = coursePackageSchedulingService.getById(coursePackageStudent.getCoursePackageSchedulingId()); |
| | | if (byId == null) { |
| | | CoursePackageScheduling coursePackageScheduling = coursePackageSchedulingService.getById(coursePackageStudent.getCoursePackageSchedulingId()); |
| | | if (coursePackageScheduling == null) { |
| | | continue; |
| | | } |
| | | String dateString1 = sdf.format(byId.getClassDate()); |
| | | String dateString2 = sdf.format(byId.getEndDate()); |
| | | String dateString1 = sdf.format(coursePackageScheduling.getClassDate()); |
| | | String dateString2 = sdf.format(coursePackageScheduling.getEndDate()); |
| | | |
| | | |
| | | recordVo.setTimeFrame(dateString1 + "-" + dateString2.substring(11)); |
| | |
| | | String[] split = classWeeks.split(";"); |
| | | List<String> integerList = Arrays.asList(split); |
| | | String weekOfDate = DateTimeHelper.getWeekOfDate(new Date()); |
| | | // if (integerList.contains(weekOfDate)) { |
| | | String dat = simpleDateFormat.format(byId.getClassDate()) + " " + dateString1.substring(11); |
| | | String ed = simpleDateFormat.format(byId.getEndDate()) + " " + dateString2.substring(11); |
| | | String dat = simpleDateFormat.format(coursePackageScheduling.getClassDate()) + " " + dateString1.substring(11); |
| | | String ed = simpleDateFormat.format(coursePackageScheduling.getEndDate()) + " " + dateString2.substring(11); |
| | | |
| | | Date start = null; |
| | | Date end = null; |
| | |
| | | } |
| | | |
| | | CancelledClasses cancelledClasses = cacMapper.selectOne(new QueryWrapper<CancelledClasses>() |
| | | .eq("coursePackageSchedulingId", byId.getId()).last("limit 1")); |
| | | // else { |
| | | // Date now = new Date(); |
| | | // if (now.after(byId.getClassDate()) && now.before(byId.getEndDate())) { |
| | | // recordVo.setStatus(2); |
| | | // } else { |
| | | // recordVo.setStatus(3); |
| | | // |
| | | // } |
| | | // } |
| | | .eq("coursePackageSchedulingId", coursePackageScheduling.getId()).last("limit 1")); |
| | | |
| | | |
| | | if (new Date().after(start)&&new Date().before(end)){ |
| | | recordVo.setStatus(2); |
| | | } |
| | | //待上课 |
| | | if (start.after(new Date())) { |
| | | recordVo.setStatus(1); |
| | | } |
| | | //已取消 |
| | | if (byId.getStatus() == 4) { |
| | | if (coursePackageScheduling.getStatus() == 4) { |
| | | recordVo.setStatus(4); |
| | | } else if (coursePackageStudent.getSignInOrNot() == 2) { |
| | | } |
| | | //已请假 |
| | | if (coursePackageStudent.getSignInOrNot() == 2) { |
| | | recordVo.setStatus(5); |
| | | }else if (ToolUtil.isNotEmpty(cancelledClasses)) { |
| | | } |
| | | //已完成 |
| | | if (ToolUtil.isNotEmpty(cancelledClasses)) { |
| | | recordVo.setStatus(3); |
| | | // 消课 到课状态0 旷课 |
| | | if (coursePackageStudent.getSignInOrNot() == 0) { |
| | | recordVo.setStatus(6); |
| | | } |
| | | |
| | | }else if (new Date().after(start)&&new Date().before(end)){ |
| | | recordVo.setStatus(2); |
| | | }else if (start.after(new Date())) { |
| | | //待上课 |
| | | recordVo.setStatus(1); |
| | | } |
| | | else { |
| | | // CancelledClasses cancelledClasses = cacMapper.selectOne(new QueryWrapper<CancelledClasses>() |
| | | // .eq("coursePackageSchedulingId", byId.getId()).last("limit 1")); |
| | | // if (ToolUtil.isNotEmpty(cancelledClasses)) { |
| | | // recordVo.setStatus(3); |
| | | // // 消课 到课状态0 旷课 |
| | | // if (coursePackageStudent.getSignInOrNot() == 0) { |
| | | // recordVo.setStatus(6); |
| | | // } |
| | | // |
| | | // } else { |
| | | // Date now = new Date(); |
| | | // if (now.after(byId.getClassDate()) && now.before(byId.getEndDate())) { |
| | | // recordVo.setStatus(2); |
| | | // } else { |
| | | // recordVo.setStatus(3); |
| | | // |
| | | // } |
| | | // } |
| | | } |
| | | // } else { |
| | | // recordVo.setStatus(1); |
| | | // } |
| | | recordVoList.add(recordVo); |
| | | } |
| | | |
| | |
| | | import com.dsh.course.entity.*; |
| | | import com.dsh.course.entity.TAppUser; |
| | | import com.dsh.course.entity.dto.StudentQeryDto; |
| | | import com.dsh.course.feignclient.account.AppUserClient; |
| | | import com.dsh.course.feignclient.account.CoachClient; |
| | | import com.dsh.course.feignclient.account.StudentClient; |
| | | import com.dsh.course.feignclient.account.UserIntegralChangesClient; |
| | | import com.dsh.course.feignclient.account.*; |
| | | import com.dsh.course.feignclient.account.model.*; |
| | | import com.dsh.course.feignclient.activity.BenefitVideoClient; |
| | | import com.dsh.course.feignclient.activity.CouponClient; |
| | |
| | | |
| | | @Resource |
| | | private UserIntegralChangesClient userIntegralChangesClient; |
| | | |
| | | @Resource |
| | | private StudentHonorClient studentHonorClient; |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | @Override |
| | |
| | | .eq("coursePackageId", detailsRequest.getCoursePackageId()) |
| | | .eq("courseId", detailsRequest.getVideoId()) |
| | | ); |
| | | //完成学习 |
| | | if (null != userVideoDetails && userVideoDetails.getState() == 1 && detailsRequest.getIsOver() == 1) { |
| | | userVideoDetails.setState(2); |
| | | userVideoDetails.setUpdateTime(new Date()); |
| | |
| | | AppUser appUser = appuClient.queryAppUser(coursePackageScheduling.getAppUserId()); |
| | | appUser.setIntegral((null == appUser.getIntegral() ? 0 : appUser.getIntegral()) + (null == coursePackageScheduling.getIntegral() ? 0 : coursePackageScheduling.getIntegral())); |
| | | appuClient.updateAppUser(appUser); |
| | | //保存用户积分变动记录 |
| | | SaveUserIntegralChangesVo vo = new SaveUserIntegralChangesVo(); |
| | | vo.setAppUserId(coursePackageScheduling.getAppUserId()); |
| | | vo.setIntegral(coursePackageScheduling.getIntegral()); |
| | | vo.setType(4); |
| | | userIntegralChangesClient.saveUserIntegralChanges(vo); |
| | | //添加勋章数据 |
| | | Integer number = uvdmapper.selectCount(new QueryWrapper<UserVideoDetails>().eq("appUserId", appUserId).eq("state", 2)); |
| | | StudentHonor studentHonor = new StudentHonor(); |
| | | studentHonor.setAppUserId(appUserId); |
| | | studentHonor.setHonorType(4); |
| | | studentHonor.setNumber(number); |
| | | studentHonorClient.saveStudentHonor(studentHonor); |
| | | return "SUCCESS"; |
| | | } |
| | | return "ERROR"; |
New file |
| | |
| | | package com.dsh.course.feignClient.account; |
| | | |
| | | import com.dsh.course.feignClient.account.model.StudentHonor; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | |
| | | /** |
| | | * 勋章 |
| | | */ |
| | | @FeignClient("mb-cloud-account") |
| | | public interface StudentHonorClient { |
| | | |
| | | |
| | | /** |
| | | * 保存用户勋章 |
| | | * @param studentHonor |
| | | */ |
| | | @PostMapping("/studentHonor/saveStudentHonor") |
| | | void saveStudentHonor(StudentHonor studentHonor); |
| | | } |
New file |
| | |
| | | package com.dsh.course.feignClient.account.model; |
| | | |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class StudentHonor { |
| | | /** |
| | | * 用户id |
| | | */ |
| | | private Integer appUserId; |
| | | /** |
| | | * 荣耀类型 |
| | | */ |
| | | private Integer honorType; |
| | | /** |
| | | * 当前次数 |
| | | */ |
| | | private Integer number; |
| | | } |
| | |
| | | */ |
| | | @PostMapping("/cancelledClasses/addCancelledClasses") |
| | | void addCancelledClasses(CancelledClasses cancelledClasses); |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | package com.dsh.course.feignClient.course; |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.dsh.course.feignClient.course.model.CancelledClasses; |
| | | import com.dsh.course.feignClient.course.model.CoursePackageScheduling; |
| | | import com.dsh.course.feignClient.course.model.QueryCoursePackageSchedulingList; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | |
| | | String[] dates = times.split(";"); |
| | | |
| | | SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm"); |
| | | |
| | | Date minDate = null; |
| | | Date maxDate = null; |
| | | |
| | | for (String dateStr : dates) { |
| | | String[] dateRange = dateStr.split("-"); |
| | | String startDateStr = dateRange[0].trim(); |
| | | String endDateStr = dateRange[1].trim(); |
| | | |
| | | try { |
| | | String start = dates[0]; |
| | | String startDateStr = start.substring(0, start.lastIndexOf("-")); |
| | | Date startDate = format.parse(startDateStr); |
| | | Date endDate = format.parse(endDateStr); |
| | | |
| | | if (minDate == null || startDate.before(minDate)) { |
| | | minDate = startDate; |
| | | } |
| | | if (maxDate == null || endDate.after(maxDate)) { |
| | | maxDate = endDate; |
| | | } |
| | | String end = dates[dates.length - 1]; |
| | | String[] str = end.split(" "); |
| | | String endDateStr = str[0] + " " + str[1].substring(str[1].indexOf("-") + 1); |
| | | Date endDate = format.parse(endDateStr); |
| | | siteBooking.setStartTime(startDate); |
| | | siteBooking.setEndTime(endDate); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | System.out.println("最小日期:" + minDate); |
| | | System.out.println("最大日期:" + maxDate); |
| | | siteBooking.setStartTime(minDate); |
| | | siteBooking.setEndTime(maxDate); |
| | | siteBooking.setPayType(2); |
| | | |
| | | //存多少钱 |
| | | String money = siteBooking.getMoney(); |
| | | String[] moneys = money.split(","); |
| | | siteBooking.setPayMoney(Double.valueOf(moneys[0])); |
| | | |
| | | |
| | | // 查询当前预约人是否是会员 |
| | | String phone = siteBooking.getPhone(); |
| | | String booker = siteBooking.getBooker(); |
| | |
| | | |
| | | model.addAttribute("item", tStudentDto); |
| | | if (tStudentDto.getLateralSurface()!=null&&!tStudentDto.equals("")) { |
| | | // String[] pics = tStudentDto.getLateralSurface().split(";"); |
| | | // model.addAttribute("pic1", pics[0]); |
| | | // System.out.println("=====pic1==" + pics[0]); |
| | | // if (pics.length > 1) { |
| | | // model.addAttribute("pic2", pics[1]); |
| | | // System.out.println("=====pic2==" + pics[1]); |
| | | // } |
| | | // if (pics.length > 2) { |
| | | // model.addAttribute("pic3", pics[2]); |
| | | // System.out.println("=====pic3==" + pics[2]); |
| | | // } |
| | | model.addAttribute("images",tStudentDto.getLateralSurface()); |
| | | } |
| | | |
| | |
| | | @RequestMapping("/changeStatus/{id}") |
| | | @ResponseBody |
| | | public ResultUtil changeStatus(@PathVariable Integer id) { |
| | | // InsertBackDto insertBackDto= new InsertBackDto(); |
| | | // insertBackDto.setId(id); |
| | | //// insertBackDto.setIds(ids); |
| | | // System.out.println("=====insertBackDto========"+insertBackDto); |
| | | |
| | | courseStuddentClient.changeStatus(id); |
| | | courseStuddentClient.zeroClass(id); |
| | | |
| | |
| | | @RequestMapping("/noStatus/{id}") |
| | | @ResponseBody |
| | | public ResultUtil noStatus(@PathVariable Integer id) { |
| | | // InsertBackDto insertBackDto= new InsertBackDto(); |
| | | // insertBackDto.setId(id); |
| | | //// insertBackDto.setIds(ids); |
| | | // System.out.println("=====insertBackDto========"+insertBackDto); |
| | | |
| | | courseStuddentClient.noStatus(id); |
| | | courseStuddentClient.backStausClass(id); |
| | | // courseStuddentClient.zeroClass(id); |
| | | |
| | | System.out.println("============学员查询接口========="); |
| | | return new ResultUtil<>(0,0,"已拒绝",null,null); |
| | |
| | | System.out.println("========ToHoliDto========="+resultUtil); |
| | | |
| | | if (resultUtil.equals("换课成功")) { |
| | | // return ResultUtil.success(resultUtil); |
| | | return new ResultUtil<>(0,0,resultUtil); |
| | | |
| | | }else { |
| | | return new ResultUtil<>(0,1,resultUtil);} |
| | | return new ResultUtil<>(0,1,resultUtil); |
| | | } |
| | | // if (resultUtil==""){ |
| | | // }else{ |
| | | } |
| | | |
| | | |
| | | //赠课 |
| | |
| | | */ |
| | | @TableField("startTime") |
| | | @ApiModelProperty("预约开始时间") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date startTime; |
| | | /** |
| | | * 预约结束 |
| | | */ |
| | | @TableField("endTime") |
| | | @ApiModelProperty("预约结束时间") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date endTime; |
| | | /** |
| | | * 预约人 |
| | |
| | | */ |
| | | @TableField("payTime") |
| | | @ApiModelProperty("支付时间") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date payTime; |
| | | /** |
| | | * 支付金额 |
| | |
| | | * 取消时间 |
| | | */ |
| | | @TableField("cancelTime") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date cancelTime; |
| | | /** |
| | | * 第三方取消退款流水号 |
| | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.dsh.course.entity.CoursePackageOrderStudent; |
| | | import com.dsh.course.feignClient.account.StudentHonorClient; |
| | | import com.dsh.course.feignClient.account.model.StudentHonor; |
| | | import com.dsh.course.feignClient.course.*; |
| | | import com.dsh.course.feignClient.course.model.*; |
| | | import com.dsh.guns.config.UserExt; |
| | |
| | | import java.math.BigDecimal; |
| | | import java.text.ParseException; |
| | | 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; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | |
| | | |
| | | @Resource |
| | | private CancelledClassesClient cancelledClassesClient; |
| | | |
| | | @Resource |
| | | private StudentHonorClient studentHonorClient; |
| | | |
| | | |
| | | |
| | |
| | | */ |
| | | @Override |
| | | public ResultUtil cancellationRecord(Long id, String cancelClasses, Integer deductClassHour) { |
| | | // CoursePackageScheduling coursePackageScheduling = coursePackageSchedulingClient.queryCoursePackageSchedulingById(id); |
| | | |
| | | List<CoursePackageScheduling> coursePackageSchedulings = coursePackageSchedulingClient.queryCoursePackageSchedulingsById(id); |
| | | CoursePackageScheduling coursePackageScheduling1 = coursePackageSchedulings.get(0); |
| | | Date classDate = coursePackageScheduling1.getEndDate(); |
| | |
| | | coursePackageScheduling.setDeductClassHour(deductClassHour); |
| | | coursePackageScheduling.setStatus(3); |
| | | } |
| | | |
| | | |
| | | // 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); |
| | |
| | | if(coursePackageStudent.getSignInOrNot() == 2){ |
| | | continue; |
| | | } |
| | | // TCoursePackagePayment tCoursePackagePayment = coursePackagePaymentClient.queryCoursePackagePaymentById(coursePackageStudent.getCoursePackagePaymentId()); |
| | | |
| | | CoursePackageOrderStudent coursePackageOrderStudent = coursePackagePaymentClient.queryCoursePackagePaymentById1(coursePackageStudent.getCoursePackagePaymentId()); |
| | | |
| | | if (deductClassHour!=null) { |
| | |
| | | cancelledClasses.setCoursePackageSchedulingId(coursePackageStudent.getCoursePackageSchedulingId()); |
| | | cancelledClasses.setVoucher(cancelClasses); |
| | | if (deductClassHour!=null) { |
| | | cancelledClasses.setCancelledClassesNumber(deductClassHour);} |
| | | cancelledClasses.setCancelledClassesNumber(deductClassHour); |
| | | } |
| | | cancelledClasses.setInsertTime(new Date()); |
| | | cancelledClassesClient.addCancelledClasses(cancelledClasses); |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | //添加勋章数据 |
| | | QueryCoursePackageStudent queryCoursePackageStudent = new QueryCoursePackageStudent(); |
| | | queryCoursePackageStudent.setAppUserId(coursePackageStudent.getAppUserId()); |
| | | queryCoursePackageStudent.setSignInOrNot(1); |
| | | queryCoursePackageStudent.setReservationStatus(1); |
| | | List<CoursePackageStudent> coursePackageStudents1 = coursePackageStudentClient.queryCoursePackageStudent(queryCoursePackageStudent); |
| | | StudentHonor studentHonor = new StudentHonor(); |
| | | studentHonor.setAppUserId(coursePackageStudent.getAppUserId()); |
| | | studentHonor.setHonorType(1); |
| | | studentHonor.setNumber(coursePackageStudents1.size()); |
| | | studentHonorClient.saveStudentHonor(studentHonor); |
| | | } |
| | | // } |
| | | |
| | | return ResultUtil.success(); |
| | | } |
| | |
| | | public List<Map<String, Object>> listorder(@RequestBody BookingQuery bookingQuery) { |
| | | System.out.println("===bookingQuery====" + bookingQuery); |
| | | return gameService.orderlist(bookingQuery); |
| | | // return game.getId(); |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | @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") |
| | | .le("`condition`", integers.get(1)).orderByDesc("condition") |
| | | .last("LIMIT 1")); |
| | | |
| | | if (one == null) { |
| | |
| | | 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)); |
| | | HonorRules one2 = honorRulesService.getOne(new QueryWrapper<HonorRules>().eq("type", integers.get(0)) |
| | | .eq("level", Integer.valueOf(one.getLevel()) + 1)); |
| | | return one2; |
| | | } |
| | | |
New file |
| | |
| | | package com.dsh.other.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.dsh.other.entity.HonorRules; |
| | | import com.dsh.other.service.HonorRulesService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | | |
| | | @RestController |
| | | @RequestMapping("/honorRules") |
| | | public class HonorRulesController { |
| | | |
| | | @Autowired |
| | | private HonorRulesService honorRulesService; |
| | | |
| | | |
| | | /** |
| | | * 获取当前合适的推责 |
| | | * @param honorRules |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/getHonorRules") |
| | | public HonorRules getHonorRules(@RequestBody HonorRules honorRules){ |
| | | List<HonorRules> list = honorRulesService.list(new QueryWrapper<HonorRules>() |
| | | .eq("type", honorRules.getType()).orderByDesc("condition")); |
| | | for (HonorRules rules : list) { |
| | | Integer condition = rules.getCondition(); |
| | | if(honorRules.getCondition().compareTo(condition) >= 0){ |
| | | return rules; |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 根据id获取数据 |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/getHonorRulesById") |
| | | public HonorRules getHonorRulesById(Integer id){ |
| | | return honorRulesService.getById(id); |
| | | } |
| | | } |
| | |
| | | */ |
| | | @TableField("startTime") |
| | | @ApiModelProperty("预约开始时间") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date startTime; |
| | | /** |
| | | * 预约结束 |
| | | */ |
| | | @TableField("endTime") |
| | | @ApiModelProperty("预约结束时间") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date endTime; |
| | | /** |
| | | * 预约人 |
| | |
| | | */ |
| | | @TableField("payTime") |
| | | @ApiModelProperty("支付时间") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date payTime; |
| | | /** |
| | | * 支付金额 |
| | |
| | | * 取消时间 |
| | | */ |
| | | @TableField("cancelTime") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date cancelTime; |
| | | /** |
| | | * 第三方取消退款流水号 |
New file |
| | |
| | | package com.dsh.other.feignclient.account; |
| | | |
| | | import com.dsh.other.feignclient.account.model.StudentHonor; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | |
| | | /** |
| | | * 勋章 |
| | | */ |
| | | @FeignClient("mb-cloud-account") |
| | | public interface StudentHonorClient { |
| | | |
| | | |
| | | /** |
| | | * 保存用户勋章 |
| | | * @param studentHonor |
| | | */ |
| | | @PostMapping("/studentHonor/saveStudentHonor") |
| | | void saveStudentHonor(StudentHonor studentHonor); |
| | | } |
New file |
| | |
| | | package com.dsh.other.feignclient.account.model; |
| | | |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class StudentHonor { |
| | | /** |
| | | * 用户id |
| | | */ |
| | | private Integer appUserId; |
| | | /** |
| | | * 荣耀类型 |
| | | */ |
| | | private Integer honorType; |
| | | /** |
| | | * 当前次数 |
| | | */ |
| | | private Integer number; |
| | | } |
| | |
| | | */ |
| | | @Override |
| | | public ResultUtil reservationSite(Integer uid, ReservationSite reservationSite) throws Exception { |
| | | |
| | | Site site = this.getById(reservationSite.getId()); |
| | | AppUser appUser = appUserClient.queryAppUser(uid); |
| | | String[] split = reservationSite.getTimes().split(";"); |
| | |
| | | return ResultUtil.error("优惠券已过期"); |
| | | } |
| | | if (userCoupon != null && coupon.getType() == 1) {//满减 |
| | | // {"conditionalAmount":50,"deductionAmount":10,"experienceName":""} |
| | | JSONObject jsonObject = JSON.parseObject(coupon.getContent()); |
| | | Double num1 = jsonObject.getDouble("conditionalAmount"); |
| | | Double num2 = jsonObject.getDouble("deductionAmount"); |
| | |
| | | } |
| | | if (reservationSite.getPayType() == 3) {//玩湃币支付 |
| | | if (reservationSite.getIsHalf() == 2) { |
| | | |
| | | |
| | | |
| | | return playPaiCoinPaymentSite(appUser, Double.valueOf(site.getPlayPaiCoin()), siteBooking); |
| | | } else { |
| | | return playPaiCoinPaymentSite(appUser, site.getPlayPaiCoinOne(), siteBooking); |
| | |
| | | package com.dsh.other.util; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.dsh.other.entity.SiteBooking; |
| | | import com.dsh.other.feignclient.account.StudentHonorClient; |
| | | import com.dsh.other.feignclient.account.model.StudentHonor; |
| | | import com.dsh.other.mapper.SiteBookingMapper; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.Arrays; |
| | | import java.util.Calendar; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | |
| | | |
| | | @Resource |
| | | private SiteBookingMapper siteBookingMapper; |
| | | |
| | | @Resource |
| | | private StudentHonorClient studentHonorClient; |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 每隔一分钟去处理的定时任务 |
| | |
| | | if (System.currentTimeMillis() > time) { |
| | | siteBooking.setStatus(4); |
| | | siteBookingMapper.updateById(siteBooking); |
| | | |
| | | //添加勋章数据 |
| | | Integer number = siteBookingMapper.selectCount(new QueryWrapper<SiteBooking>() |
| | | .eq("appUserId", siteBooking.getAppUserId()).in("status", Arrays.asList(3, 4))); |
| | | StudentHonor studentHonor = new StudentHonor(); |
| | | studentHonor.setAppUserId(siteBooking.getAppUserId()); |
| | | studentHonor.setHonorType(3); |
| | | studentHonor.setNumber(number); |
| | | studentHonorClient.saveStudentHonor(studentHonor); |
| | | |
| | | } |
| | | } |
| | | //定时修改赛事状态 |
| | |
| | | try { |
| | | // 获取待核销状态的记录 |
| | | List<SiteBooking> siteBookings = siteBookingMapper.selectList(new LambdaQueryWrapper<SiteBooking>() |
| | | .eq(SiteBooking::getStatus, 1)); |
| | | .eq(SiteBooking::getStatus, 0).eq(SiteBooking::getState, 1)); |
| | | for (SiteBooking siteBooking : siteBookings) { |
| | | if(null == siteBooking.getEndTime()){ |
| | | continue; |
| | | } |
| | | long time = siteBooking.getEndTime().getTime(); |
| | | if (System.currentTimeMillis() > time) { |
| | | siteBooking.setStatus(4); |
| | | long time = siteBooking.getInsertTime().getTime(); |
| | | if (System.currentTimeMillis() > time + 1800000L) { |
| | | siteBooking.setState(3); |
| | | siteBookingMapper.updateById(siteBooking); |
| | | } |
| | | } |
| | |
| | | </if> |
| | | |
| | | </where> |
| | | |
| | | order by bk.insertTime desc |
| | | |
| | | </select> |
| | | </mapper> |