Jelajahi Sumber

Merge branch 'master' of http://124.70.43.205:3000/wangchangsheng/evaluation

hlf 6 bulan lalu
induk
melakukan
7ca8ab64f5

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

@@ -38,9 +38,13 @@ public class OrganizationRatingController {
 	private IOrganizationRatingService organizationRatingService;
 
 
+
+	/**
+	 * 单位考评评级
+	 */
 	@PostMapping(value = "grade")
 	public R grade(@RequestBody List<OrganizationRating> orgRating) {
-		IPage<OrganizationRating> grade = organizationRatingService.grade(orgRating);
+		List<OrganizationRating> grade = organizationRatingService.grade(orgRating);
 		return R.ok().data(grade);
 	}
 
@@ -71,7 +75,7 @@ public class OrganizationRatingController {
 				  @RequestParam(value = "bonusPoint", required = false) String bonusPoint,
 				  @RequestParam(value = "compositeScoreRaking", required = false) String compositeScoreRaking,
 				  @RequestParam(value = "projectLevel", required = false) String projectLevel) {
-		IPage<OrganizationRating> list = organizationRatingService.list(pageNum, pageSize, id, organizationYearRatingId, binSection, year, organizationShortName, organizationId, safetyEnvProtection, veto, netProfit, compositeScore, annualTarget, bonusPoint,compositeScoreRaking,projectLevel);
+		IPage<OrganizationRating> list = organizationRatingService.list(pageNum, pageSize, id, organizationYearRatingId, binSection, year, organizationShortName, organizationId, safetyEnvProtection, veto, netProfit, compositeScore, annualTarget, bonusPoint, compositeScoreRaking, projectLevel);
 		if (list.getRecords().isEmpty()) {
 			return R.ok().data("");
 		}

+ 4 - 0
ims-service/ims-eval/src/main/java/com/ims/eval/entity/OrganizationRating.java

@@ -147,5 +147,9 @@ public class OrganizationRating extends Model {
 	 */
 	private String projectLevel;
 
+	/**
+	 * 总分
+	 */
+	private String score;
 
 }

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

@@ -31,8 +31,7 @@ public interface IOrganizationRatingService extends IService<OrganizationRating>
 
 	List<OrganizationRating> getListSating(String organizationYearRatingId, String year, String organizationId);
 
-	IPage<OrganizationRating> grade(List<OrganizationRating> orgRating);
-
+	List<OrganizationRating> grade(List<OrganizationRating> orgRating);
 
 	void exportExcel(HttpServletResponse response, String binSection, String year) throws IOException;
 

+ 23 - 2
ims-service/ims-eval/src/main/java/com/ims/eval/service/impl/EvaluateReportServiceImpl.java

@@ -16,6 +16,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
+import javax.annotation.Resource;
 import java.util.*;
 import java.util.function.Function;
 import java.util.stream.Collectors;
@@ -65,6 +66,11 @@ public class EvaluateReportServiceImpl extends ServiceImpl<EvaluateReportMapper,
 
 	@Autowired
 	private  IPartyBuildingMultiplierService partyBuildingMultiplierService;
+
+
+	@Resource
+	private IOrganizationRatingService iOrganizationRatingService;
+
 	//考评结果报告
 	//按照业务类型生成
 	//业务阶综合展示
@@ -81,7 +87,7 @@ public class EvaluateReportServiceImpl extends ServiceImpl<EvaluateReportMapper,
 
 		OrganizationEvaluation evaluation = organizationEvaluationService.getById(organizationEvaluationId);
 		if (null == evaluation) {
-			throw new CustomException("没有此考评");
+			throw new CustomException("没有此考评");
 		}
 		//获取到对应组织考评规则
 		String evaluationRuleId = evaluation.getOrganizationEvaluationRuleId();
@@ -101,7 +107,7 @@ public class EvaluateReportServiceImpl extends ServiceImpl<EvaluateReportMapper,
 			.collect(Collectors.toMap(OrganizationEvaluationRule::getOrganizationId, rule -> rule));
 
 		for (BinSection bi : sections) {
-
+			IPage<OrganizationRating> orgRatingList = iOrganizationRatingService.list(1, 100000, null, null, bi.getSectionCode(), evaluation.getYear(), null, null, null, null, null, null, null, null, null, null);
 
 			EvaluateReport evaluateReport = new EvaluateReport();
 
@@ -494,6 +500,7 @@ public class EvaluateReportServiceImpl extends ServiceImpl<EvaluateReportMapper,
 					}
 				}else {
 					reportInfo.setScore(DoubleUtils.keepPrecision(zhScore, 2));
+
 					reportInfo.setDiscountScore(1.0);
 					portal.setScore(DoubleUtils.keepPrecision(zhScore, 2));//保存到首页排行
 				}
@@ -501,12 +508,26 @@ public class EvaluateReportServiceImpl extends ServiceImpl<EvaluateReportMapper,
 				evaluateRuleInfoList.add(reportInfo);
 			}
 
+			List<OrganizationRating> orlist = new ArrayList<>();
 			for (EvaluateReportInfo info : evaluateRuleInfoList) {
 				b = evaluateReportInfoService.saveOrUpdate(info);
 				if (!b) {
 					throw new CustomException("综合考核评分汇总明细存储失败");
 				}
+				if ("NDKP".equals(evaluation.getCheckCycle())) {
+					List<OrganizationRating> records = orgRatingList.getRecords();
+					if (records.isEmpty()) {
+						continue;
+					}
+					for (OrganizationRating or : records) {
+						if (info.getOrganizationName().equals(or.getOrganizationShortName()) && info.getOrganizationId().equals(or.getOrganizationId())) {
+							or.setScore(String.valueOf(info.getScore()));
+							orlist.add(or);
+						}
+					}
+				}
 			}
+			boolean orgRat = iOrganizationRatingService.saveOrUpdateBatch(orlist);
 
 			if(null !=portalList && portalList.size()>0){
 

+ 39 - 7
ims-service/ims-eval/src/main/java/com/ims/eval/service/impl/OrganizationEvaluationServiceImpl.java

@@ -1,5 +1,6 @@
 package com.ims.eval.service.impl;
 
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -164,21 +165,48 @@ public class OrganizationEvaluationServiceImpl extends ServiceImpl<OrganizationE
 		IPage<OrganizationEvaluation> list = baseMapper.selectPage(page, qw);
 
 		if (checkCycle.contains("DWPJ")) {
-			List<OrganizationEvaluation> dwpj = list.getRecords().stream().filter(ll -> "DWPJ".equals(ll.getCheckCycle())).collect(Collectors.toList());
-			QueryWrapper<OrganizationEvaluation> q = new QueryWrapper<>();
-			q.eq("check_cycle", "NDKP");
-			List<OrganizationEvaluation> organizationEvaluations = baseMapper.selectList(q);
-			List<OrganizationEvaluation> ndkp = organizationEvaluations.stream().filter(yy -> "NDKP".equals(yy.getCheckCycle()) && "2023".equals(yy.getYear())).collect(Collectors.toList());
-			if (dwpj.isEmpty()) {
+			if (list.getRecords().isEmpty()) {
+				QueryWrapper<OrganizationEvaluation> q = new QueryWrapper<>();
+				q.eq("check_cycle", "NDKP");
+				List<OrganizationEvaluation> organizationEvaluations = baseMapper.selectList(q);
+				List<OrganizationEvaluation> ndkp = organizationEvaluations.stream().filter(yy -> "2023".equals(yy.getYear())).collect(Collectors.toList());
+				if (ndkp.isEmpty()) {
+					return null;
+				}
 				orgRating(ndkp.get(0));
+				IPage<OrganizationEvaluation> oeLs =baseMapper.selectPage(page, qw);
+				return filter(oeLs);
 			}
-			return baseMapper.selectPage(page, qw);
+			/*List<OrganizationEvaluation> dwpj = list.getRecords().stream().filter(ll -> "DWPJ".equals(ll.getCheckCycle())).collect(Collectors.toList());
+			if (!dwpj.isEmpty()) {
+				return baseMapper.selectPage(page, qw);
+			}*/
+			return filter(list);
 		}
 
 		return list;
 	}
 
 
+	/**
+	 * 判断年度考评是否“流程已结束”,年度考评结束的单位显示单位考评评级
+	 */
+	private IPage<OrganizationEvaluation> filter(IPage<OrganizationEvaluation> list) {
+		IPage<OrganizationEvaluation> ioe = new Page<>();
+		List<OrganizationEvaluation> ls = new ArrayList<>();
+		for (OrganizationEvaluation oe : list.getRecords()) {
+			LambdaQueryWrapper<OrganizationEvaluation> lqw = new LambdaQueryWrapper<>();
+			lqw.eq(OrganizationEvaluation::getCheckCycle, "NDKP").eq(OrganizationEvaluation::getYear, oe.getYear());
+			List<OrganizationEvaluation> loes = baseMapper.selectList(lqw);
+			if ("流程已结束".equals(loes.get(0).getStage())) {
+				ls.add(oe);
+			}
+		}
+		ioe.setRecords(ls);
+		return ioe;
+	}
+
+
 	@Override
 	public boolean saveOrUpdate(OrganizationEvaluation entity) {
 		//获取指定部门的规则
@@ -249,6 +277,10 @@ public class OrganizationEvaluationServiceImpl extends ServiceImpl<OrganizationE
 		return b;
 	}
 
+
+	/**
+	 * 如果年度评级存在,单位评级不存在,则将年度评级的数据复制到单位评级
+	 */
 	private void orgRating(OrganizationEvaluation entity) {
 		if (!entity.getCheckCycle().equals("NDKP")) {
 			return;

+ 33 - 4
ims-service/ims-eval/src/main/java/com/ims/eval/service/impl/OrganizationRatingServiceImpl.java

@@ -24,6 +24,7 @@ import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
 import java.util.*;
+import java.util.function.Function;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 import java.util.stream.Collectors;
@@ -57,10 +58,13 @@ public class OrganizationRatingServiceImpl extends ServiceImpl<OrganizationRatin
 	@Resource
 	private IOrganizationRatingRuleService iOrganizationRatingRuleService;
 
+	@Resource
+	private IEvaluationPortalService iEvaluationPortalService;
+
+
 
 	/**
 	 * 导入
-	 *
 	 * @param file
 	 * @return
 	 */
@@ -91,7 +95,7 @@ public class OrganizationRatingServiceImpl extends ServiceImpl<OrganizationRatin
 			//遍历Excel表每一行的数据
 			for (String[] str : strings) {
 				if (!str[1].equals(binName)) {
-					return R.error("请导入" + binSection + "的数据");
+					return R.error("请导入" + binName + "的数据");
 				}
 				if (!str[2].equals(orgRatings.get(0).getYear())) {
 					return R.error("请导入" + year + "年的数据");
@@ -115,6 +119,7 @@ public class OrganizationRatingServiceImpl extends ServiceImpl<OrganizationRatin
 				}
 			}
 			boolean b = super.saveOrUpdateBatch(orgList);
+			savePortal(orgList);
 			if (b) {
 				return R.ok().data(b);
 			} else {
@@ -220,7 +225,7 @@ public class OrganizationRatingServiceImpl extends ServiceImpl<OrganizationRatin
 	 * 单位考评评级
 	 */
 	@Override
-	public IPage<OrganizationRating> grade(List<OrganizationRating> orgRating) {
+	public List<OrganizationRating> grade(List<OrganizationRating> orgRating) {
 		XSSFWorkbook xwb = new XSSFWorkbook();
 		Sheet st = xwb.createSheet();
 		List<OrganizationRatingRule> rules = iOrganizationRatingRuleService.list(null);
@@ -237,7 +242,31 @@ public class OrganizationRatingServiceImpl extends ServiceImpl<OrganizationRatin
 		calcQQXMrating(rulesYear, col, st, xwb);
 		calcJJXMrating(rulesYear, col, st, xwb);
 		calcNDrating(rulesYear, orgRating, st, xwb);
-		return null;
+		Map<String, OrganizationRating> map = orgRating.stream().collect(Collectors.toMap(OrganizationRating::getId, Function.identity()));
+		List<OrganizationRating> organizationRatings = baseMapper.selectBatchIds(map.keySet());
+		savePortal(organizationRatings);
+		return organizationRatings;
+	}
+
+
+	/**
+	 * 保存数据到首页
+	 */
+	private void savePortal(List<OrganizationRating> organizationRatings) {
+		List<EvaluationPortal> lep = new ArrayList<>();
+		for (OrganizationRating or : organizationRatings) {
+			if (or.getYearRate() != null && or.getScore() != null) {
+				EvaluationPortal ep = new EvaluationPortal();
+				ep.setBinSection(or.getBinSection());
+				ep.setCompany(or.getOrganizationShortName());
+				ep.setGrade(or.getYearRate());
+				ep.setScore(Double.parseDouble(or.getScore()));
+				ep.setBaseScore(150.00);
+				ep.setYear(or.getYear());
+				lep.add(ep);
+			}
+		}
+		boolean b = iEvaluationPortalService.saveBatch(lep);
 	}
 
 

+ 3 - 1
ims-service/ims-eval/src/main/resources/mappers/EvaluationPortalMapper.xml

@@ -36,7 +36,9 @@
 
     <select id="selectPortalList" resultType="java.util.Map">
         SELECT
-        ep.*,
+
+        ep.id,ep.bin_section,ep.company,REPLACE(ep.grade,'"','') as grade,ep.score,ep.base_score,ep.year,ep.season,ep.matter_heigh,ep.matter_low,ep.manage_heigh,
+        ep.manage_low,ep.standard_heigh,ep.standard_low,ep.dept_id,ep.create_time,ep.memo1,ep.memo2,ep.memo3,ep.memo4,ep.dept_name,ep.bin_stage,ep.bin_property,
         bs.section_name,
         ea.portal_id,
         ea.matter_heigh_note,

+ 1 - 1
ims-service/ims-eval/src/main/resources/mappers/OrganizationRatingMapper.xml

@@ -8,7 +8,7 @@
         select
         r.id,r.organization_year_rating_id,r.organization_short_name,r.organization_id,r.year,r.bin_section,TRIM('"' FROM r.scjy_rate) AS scjy_rate,
         TRIM('"' FROM r.qq_rate) AS qq_rate,TRIM('"' FROM r.jj_rate) AS jj_rate,TRIM('"' FROM r.year_rate) AS year_rate,r.create_by,r.update_by,r.create_time,r.update_time,
-        r.remark,r.safety_env_protection,r.veto,r.net_profit,r.composite_score,r.annual_target,r.bonus_point,r.composite_score_raking,r.project_level,
+        r.remark,r.safety_env_protection,r.veto,r.net_profit,r.composite_score,r.annual_target,r.bonus_point,r.composite_score_raking,r.project_level,r.score,
             bs.section_name binsectionname
         from
             organization_rating r