| | |
| | | import com.dsh.account.entity.HonorRules; |
| | | import com.dsh.account.entity.StudentHonor; |
| | | import com.dsh.account.entity.TStudent; |
| | | import com.dsh.account.feignclient.communityWorldCup.WorldCupCompetitorClient; |
| | | 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.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 |
| | | @Resource |
| | | private HonorDeClient honorDeClient; |
| | | |
| | | |
| | | @Autowired |
| | | private TStudentService studentService; |
| | | |
| | | @Resource |
| | | private HonorRulesClient honorRulesClient; |
| | | |
| | | @Resource |
| | | private WorldCupCompetitorClient worldCupCompetitorClient; |
| | | |
| | | @Autowired |
| | | private StudentHonorService studentHonorService; |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | @Override |
| | | public List<GongVo> queryStuOfMedalData(Integer stuId) { |
| | | public List<GongVo> queryStuOfMedalData(Integer stuId, Integer appUserId) { |
| | | List<GongVo> voList = new ArrayList<>(); |
| | | // 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) { |
| | | List<StudentHonor> list = studentHonorService.list(new QueryWrapper<StudentHonor>() |
| | | .eq("appUserId", appUserId)); |
| | | for (StudentHonor studentHonor : list) { |
| | | GongVo vo = new GongVo(); |
| | | vo.setMedalType(1); |
| | | vo.setMedalName("俱乐部之星"); |
| | | vo.setMedalType(studentHonor.getHonorType()); |
| | | switch (studentHonor.getHonorType()){ |
| | | case 1: |
| | | vo.setMedalName("俱乐部之星"); |
| | | break; |
| | | case 2: |
| | | vo.setMedalName("运动达人"); |
| | | break; |
| | | case 3: |
| | | vo.setMedalName("社区之王"); |
| | | break; |
| | | case 4: |
| | | vo.setMedalName("深度玩家"); |
| | | break; |
| | | case 5: |
| | | vo.setMedalName("常胜将军"); |
| | | break; |
| | | case 6: |
| | | vo.setMedalName("越战越勇"); |
| | | break; |
| | | default: |
| | | break; |
| | | } |
| | | 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<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.setMedalName("俱乐部之星"); |
| | | vo.setMedalType(studentHonor.getHonorType()); |
| | | switch (studentHonor.getHonorType()){ |
| | | case 1: |
| | | vo.setMedalName("俱乐部之星"); |
| | | break; |
| | | case 2: |
| | | vo.setMedalName("运动达人"); |
| | | break; |
| | | case 3: |
| | | vo.setMedalName("社区之王"); |
| | | break; |
| | | case 4: |
| | | vo.setMedalName("深度玩家"); |
| | | break; |
| | | case 5: |
| | | vo.setMedalName("常胜将军"); |
| | | break; |
| | | case 6: |
| | | vo.setMedalName("越战越勇"); |
| | | break; |
| | | } |
| | | //拿到当前对应的rule对象 |
| | | List<Integer> integers = new ArrayList<>(); |
| | | integers.add(1); |
| | | integers.add(count1); |
| | | integers.add(studentHonor.getHonorType()); |
| | | integers.add(studentHonor.getNumber()); |
| | | HonorRules honorRules = honorDeClient.getHonor(integers); |
| | | if (count1 < 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()) - count1)); |
| | | vo.setIsTopLevel(0); |
| | | vo.setUpgradeConditions(String.valueOf(Integer.valueOf(honorRules.getCondition()) - studentHonor.getNumber())); |
| | | vo.setIsTopLevel(2); |
| | | } else { |
| | | vo.setLevelNum(10); |
| | | vo.setNextLevel(10); |
| | | vo.setIsTopLevel(1); |
| | | } |
| | | |
| | | studentHonors.add(vo); |
| | | list.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; |
| | | return list; |
| | | } |
| | | } |