瀏覽代碼

首页改造

全业务考评 11 月之前
父節點
當前提交
e9c4f30b8b

+ 2 - 2
ims-service/ims-eval/src/main/java/com/ims/eval/controller/EvaluationPortalController.java

@@ -29,8 +29,8 @@ public class EvaluationPortalController {
 	private IEvaluationPortalService portalService;
 
 	@GetMapping(value = "list")
-	public R listAll(String binSection, String year, String season) {
-		Map<String, Object> data = portalService.getPortalData(binSection, year, season);
+	public R listAll(String binSection, String year, String season,String newyear) {
+		Map<String, Object> data = portalService.getPortalData(binSection, year, season, newyear);
 		return R.ok().data(data);
 	}
 

+ 2 - 0
ims-service/ims-eval/src/main/java/com/ims/eval/dao/EvaluationPortalMapper.java

@@ -22,4 +22,6 @@ public interface EvaluationPortalMapper extends BaseMapper<EvaluationPortal> {
 
 
 	EvaluationPortal getHomeSeason();
+
+	EvaluationPortal getHomeYear();
 }

+ 1 - 1
ims-service/ims-eval/src/main/java/com/ims/eval/service/IEvaluationPortalService.java

@@ -24,7 +24,7 @@ public interface IEvaluationPortalService extends IService<EvaluationPortal> {
 	 * @param year
 	 * @param season
 	 */
-	Map<String, Object> getPortalData(String binSection, String year, String season);
+	Map<String, Object> getPortalData(String binSection, String year, String season,String newyear);
 
 	/**
 	 * list

+ 14 - 7
ims-service/ims-eval/src/main/java/com/ims/eval/service/impl/EvaluationPortalServiceImpl.java

@@ -47,11 +47,11 @@ public class EvaluationPortalServiceImpl extends ServiceImpl<EvaluationPortalMap
 	private EvaluationPortalMapper evaluationPortalMapper;
 
 	@Override
-	public Map<String, Object> getPortalData(String binSection, String year, String season) {
+	public Map<String, Object> getPortalData(String binSection, String year, String season,String newyear) {
 		Map<String, Object> map = new HashMap<>();
 		Calendar date = Calendar.getInstance();
 		try {
-			List<Map<String, Object>> yearList = baseMapper.selectPortalList(binSection, date.get(Calendar.YEAR) == Integer.valueOf(year) ? String.valueOf(Integer.valueOf(year) - 1) : year, null);
+			List<Map<String, Object>> yearList = baseMapper.selectPortalList(binSection, date.get(Calendar.YEAR) == Integer.valueOf(year) ? String.valueOf(Integer.valueOf(year) - 1) : newyear, null);
 			List<Map<String, Object>> seasonList = baseMapper.selectPortalList(binSection, year, season);
 			Map<Object, List<Map<String, Object>>> yearMap = yearList.stream().collect(Collectors.groupingBy(e -> e.get("bin_section"), Collectors.toList()));
 			Map<Object, List<Map<String, Object>>> seasonMap = seasonList.stream().collect(Collectors.groupingBy(e -> e.get("bin_section"), Collectors.toList()));
@@ -146,20 +146,27 @@ public class EvaluationPortalServiceImpl extends ServiceImpl<EvaluationPortalMap
 	@Override
 	public Map<String, String> getHomeSeason() {
 		Map<String, String> hs = new HashMap<>();
-		EvaluationPortal portal = null;
+		EvaluationPortal homeSeason = null;
+		EvaluationPortal homeYear = null;
 		try {
-			portal = evaluationPortalMapper.getHomeSeason();
+			homeSeason = evaluationPortalMapper.getHomeSeason();
+			homeYear = evaluationPortalMapper.getHomeYear();
 		} catch (Exception e) {
 			e.printStackTrace();
 		}
 
-		if(null != portal){
-			hs.put("year",portal.getYear());
-			hs.put("season",portal.getSeason());
+		if(null != homeYear){
+			hs.put("newyear",homeYear.getYear());
+		}
+
+		if(null != homeSeason){
+			hs.put("year",homeSeason.getYear());
+			hs.put("season",homeSeason.getSeason());
 		}else {
 			hs.put("year",DateUtils.getYear(new Date())+"");
 			hs.put("season",DateUtils.getSeason(new Date())+"");
 		}
+
 		return hs;
 	}
 }

+ 8 - 0
ims-service/ims-eval/src/main/resources/mappers/EvaluationPortalMapper.xml

@@ -113,5 +113,13 @@
         LIMIT 1;
     </select>
 
+    <select id="getHomeYear" resultType="com.ims.eval.entity.EvaluationPortal">
+        SELECT *
+        FROM evaluation_portal
+        where  season is null
+        ORDER BY year DESC, season DESC
+        LIMIT 1;
+    </select>
+
 
 </mapper>