Bladeren bron

河南职高对口升学:查位次

jinxia.mo 1 week geleden
bovenliggende
commit
61e76c21b2

+ 9 - 14
ie-admin/src/main/java/com/ruoyi/web/controller/front/FrontNewsController.java

@@ -14,6 +14,7 @@ import com.ruoyi.syzy.domain.BWwwNews;
 import com.ruoyi.syzy.domain.BWwwNewsRef;
 import com.ruoyi.syzy.service.IBWwwNewsRefService;
 import com.ruoyi.syzy.service.IBWwwNewsService;
+import com.ruoyi.web.service.CommService;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiParam;
@@ -43,6 +44,8 @@ public class FrontNewsController extends BaseController {
 
     @Autowired
     private ISysConfigService sysConfigService;
+    @Autowired
+    private CommService commService;
     @GetMapping("types")
     @ApiOperation("00 高考资讯类型")
     public TableDataInfo types() {
@@ -72,7 +75,7 @@ public class FrontNewsController extends BaseController {
     @ApiOperation("00 通关指南")
     public TableDataInfo getMainList(@ApiParam(value = "省份 ", example = "湖南") @RequestParam(required = false) String location) {
         BWwwNewsRef cond = new BWwwNewsRef();
-        cond.setLocation(getLocation(location));
+        cond.setLocation(commService.getLocation(location));
         return getDataTable(newsRefService.selectBWwwNewsRefList(cond));
     }
 
@@ -80,7 +83,7 @@ public class FrontNewsController extends BaseController {
     @ApiOperation("00 通关指南免登陆")
     public TableDataInfo getMainListNoToken(@ApiParam(value = "省份 ", example = "湖南") @RequestParam(required = false) String location) {
         BWwwNewsRef cond = new BWwwNewsRef();
-        cond.setLocation(getLocation(location));
+        cond.setLocation(commService.getLocation(location));
         return getDataTable(newsRefService.selectBWwwNewsRefList(cond));
     }
 
@@ -107,7 +110,7 @@ public class FrontNewsController extends BaseController {
                               @ApiParam(value = "省份 ", example = "湖南") @RequestParam(required = false) String location,
                               @ApiParam(value = "页数", example = "1") @RequestParam Integer pageNum,
                               @ApiParam(value = "页大小", example = "15") @RequestParam Integer pageSize) {
-        return llist(ids,top,type,tag,title,getLocation(location), pageNum,pageSize);
+        return llist(ids,top,type,tag,title,commService.getLocation(location), pageNum,pageSize);
     }
 
     private TableDataInfo llist(String ids,Boolean top,String type, String tag,String title,String location, Integer pageNum,Integer pageSize){
@@ -116,7 +119,7 @@ public class FrontNewsController extends BaseController {
         exam.setType(type);
         exam.setTitle(title);
         exam.setTag(StringUtils.trimToNull(tag));
-        exam.setLocation(getLocation(location));
+        exam.setLocation(commService.getLocation(location));
         if(StringUtils.isNotBlank(ids)){
             String[] strArray = ids.split(",");
             List<String> strList = new ArrayList<>(strArray.length);
@@ -135,7 +138,7 @@ public class FrontNewsController extends BaseController {
                                      @ApiParam(value = "省份 ", example = "湖南") @RequestParam(required = false) String location,
                                      @ApiParam(value = "页数", example = "1") Integer pageNum,
                                      @ApiParam(value = "页大小", example = "15") Integer pageSize) {
-        return llist(ids,top,type,tag,title,getLocation(location), pageNum,pageSize);
+        return llist(ids,top,type,tag,title,commService.getLocation(location), pageNum,pageSize);
     }
 
     @GetMapping("info")
@@ -157,14 +160,6 @@ public class FrontNewsController extends BaseController {
         return AjaxResult.success(clicked);
     }
 
-    private String getLocation(String location){
-        if(StringUtils.isBlank(location)) {
-            location = VistorContextHolder.getLocation();
-        }
-        if (StringUtils.isBlank(location)) {
-            location = "湖南";
-        }
-        return location;
-    }
+
 
 }

+ 77 - 0
ie-admin/src/main/java/com/ruoyi/web/controller/front/FrontSyzyYfydController.java

@@ -1,5 +1,6 @@
 package com.ruoyi.web.controller.front;
 
+import com.google.common.collect.Lists;
 import com.google.common.collect.Maps;
 import com.ruoyi.common.core.controller.BaseController;
 import com.ruoyi.common.core.domain.AjaxResult;
@@ -7,8 +8,12 @@ import com.ruoyi.common.core.page.TableDataInfo;
 import com.ruoyi.common.utils.CommonUtils;
 import com.ruoyi.common.utils.SecurityUtils;
 import com.ruoyi.common.utils.StringUtils;
+import com.ruoyi.system.service.ISysConfigService;
 import com.ruoyi.syzy.domain.BBusiWishScoreGroups;
 import com.ruoyi.syzy.service.IBBusiWishScoreGroupsService;
+import com.ruoyi.web.service.CommService;
+import com.ruoyi.web.service.ScoreRankService;
+import com.ruoyi.web.service.ZyService;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiParam;
@@ -31,6 +36,14 @@ import java.util.stream.Collectors;
 public class FrontSyzyYfydController extends BaseController {
     @Autowired
     private IBBusiWishScoreGroupsService scoreGroupsService;
+    @Autowired
+    private ScoreRankService scoreRankService;
+    @Autowired
+    private ISysConfigService configService;
+    @Autowired
+    private ZyService zyService;
+    @Autowired
+    private CommService commService;
 
     @GetMapping("locations")
     @ApiOperation("01.地域")
@@ -96,4 +109,68 @@ public class FrontSyzyYfydController extends BaseController {
         }
         return AjaxResult.success(groupList.get(0));
     }
+
+
+    @GetMapping("getEquivalentScore")
+    @ApiOperation("06.根据分数找历史等效位次")
+    public AjaxResult getEquivalentScore(@ApiParam("地域") String location, @ApiParam("录入年度")  Integer year,
+                                         @ApiParam("分数") @RequestParam Integer score) {
+        if (StringUtils.isBlank(location)) {
+            location = commService.getLocation(location);
+        }
+        String mode = String.valueOf(SecurityUtils.getLoginUser().getUser().getExamMajor());
+        // 1. 初始当前年度, 文理类型
+        List<Integer> list = scoreGroupsService.yearsNoStatus(location);
+        if (CollectionUtils.isEmpty(list)) {
+            return AjaxResult.error("无有效一分一段数据");
+        }
+        Integer currYear = zyService.getYear();
+        String forceLocation = configService.selectConfigByKey("voluntary.force.locations");
+        Integer submitYear = currYear;
+        if (null != forceLocation && forceLocation.contains(location)) {
+            submitYear = submitYear - 1;
+        }
+        if (null == year) {
+            year = list.get(0);
+        }
+
+        // Map cond = Maps.newHashMap();
+        // ZyService.appendMode(cond, location, mode);
+        // List<String> modes = cond.containsKey("modes") ? (List) cond.get("modes") : Lists.newArrayList((String) cond.get("mode"));
+
+        AjaxResult ajax = AjaxResult.success();
+
+        BBusiWishScoreGroups base = scoreRankService.getScoreGroups(location, year, mode, score);
+        ajax.put("match", base);
+        ajax.put("scores", getHistoryEqList(base, mode, currYear, year, submitYear, score, location));
+        return ajax;
+    }
+
+    private List<Map> getHistoryEqList(BBusiWishScoreGroups base, String mode, Integer maxYear, Integer userYear, Integer submitYear, Integer score, String location) {
+        List<Map> historyEqList = Lists.newArrayList();
+        if(null == base) {
+            return historyEqList;
+        }
+        BBusiWishScoreGroups currScoreRange = scoreRankService.getScoreRangeByScore(location, maxYear, mode, userYear, score);
+        if (null == currScoreRange) {
+            return historyEqList;
+        }
+        Integer minYear = submitYear - 2; // 专业线最近3年 + 计划年, 计划是新年度时共4年
+        for (int i = submitYear; i >= minYear; i--) {
+            Map tmp = new HashMap();
+            tmp.put("year" , i);
+            BBusiWishScoreGroups eqScoreRange = scoreRankService.getScoreRangeByBatch(location, maxYear, currScoreRange.getMode(), i, currScoreRange.getType());
+            Integer eqRank = scoreRankService.getEqRank(currScoreRange, eqScoreRange, location, maxYear, userYear, score, null, i);
+            if (null == eqRank) {
+                tmp.put("seat", 0);
+                tmp.put("score", 0);
+            } else {
+                tmp.put("seat" , eqRank);
+                Integer lastEqScore = scoreRankService.getScore(location, i, eqScoreRange.getMode(), eqRank);
+                tmp.put("score" , lastEqScore);
+            }
+            historyEqList.add(tmp);
+        }
+        return historyEqList;
+    }
 }

+ 14 - 0
ie-admin/src/main/java/com/ruoyi/web/service/CommService.java

@@ -2,6 +2,7 @@ package com.ruoyi.web.service;
 
 import com.google.common.collect.Lists;
 import com.google.common.collect.Maps;
+import com.ruoyi.common.core.content.VistorContextHolder;
 import com.ruoyi.common.core.domain.entity.SysUser;
 import com.ruoyi.common.core.text.Convert;
 import com.ruoyi.common.enums.UserRegStatus;
@@ -151,4 +152,17 @@ public class CommService {
         }
         return treeNodeList;
     }
+
+    public String getLocation(){
+        return getLocation(null);
+    }
+    public String getLocation(String location){
+        if(org.apache.commons.lang3.StringUtils.isBlank(location)) {
+            location = VistorContextHolder.getLocation();
+        }
+        if (org.apache.commons.lang3.StringUtils.isBlank(location)) {
+            location = "湖南";
+        }
+        return location;
+    }
 }