puzhibing
2024-03-15 41156504948b983a3273ef3a5641932ac80dfd76
cloud-server-account/src/main/java/com/dsh/account/service/impl/StudentHonorServiceImpl.java
@@ -5,6 +5,7 @@
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;
@@ -46,14 +47,20 @@
    @Resource
    private SiteClient siteClient;
    @Autowired
    @Resource
    private HonorDeClient honorDeClient;
    @Autowired
    private TStudentService studentService;
    @Autowired
    @Resource
    private HonorRulesClient honorRulesClient;
    @Resource
    private WorldCupCompetitorClient worldCupCompetitorClient;
    @Autowired
    private StudentHonorService studentHonorService;
@@ -61,37 +68,9 @@
    @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) {
            GongVo vo = new GongVo();
@@ -125,6 +104,24 @@
            voList.add(vo);
        }
        Integer count5 = worldCupCompetitorClient.winCount(stuId);
        StudentHonor one = studentHonorService.getOne(new QueryWrapper<StudentHonor>()
                .eq("appUserId", appUserId).eq("honorType", 5));
        if (null != one) {
            GongVo vo = new GongVo();
            vo.setMedalType(5);
            vo.setMedalName("常胜将军");
            voList.add(vo);
        }
        one = studentHonorService.getOne(new QueryWrapper<StudentHonor>()
                .eq("appUserId", appUserId).eq("honorType", 6));
        if (null != one) {
            GongVo vo = new GongVo();
            vo.setMedalType(6);
            vo.setMedalName("越战越勇");
            voList.add(vo);
        }
        return voList;
    }
@@ -150,6 +147,12 @@
                case 4:
                    vo.setMedalName("深度玩家");
                    break;
                case 5:
                    vo.setMedalName("常胜将军");
                    break;
                case 6:
                    vo.setMedalName("越战越勇");
                    break;
            }
            //拿到当前对应的rule对象
            List<Integer> integers = new ArrayList<>();
@@ -160,8 +163,10 @@
                vo.setLevelNum(Integer.valueOf(honorRules.getLevel()) - 1);
                vo.setNextLevel(Integer.valueOf(honorRules.getLevel()));
                vo.setUpgradeConditions(String.valueOf(Integer.valueOf(honorRules.getCondition()) - studentHonor.getNumber()));
                vo.setIsTopLevel(0);
                vo.setIsTopLevel(2);
            } else {
                vo.setLevelNum(10);
                vo.setNextLevel(10);
                vo.setIsTopLevel(1);
            }
            list.add(vo);