|
@@ -24,6 +24,7 @@ import java.io.ByteArrayOutputStream;
|
|
import java.io.IOException;
|
|
import java.io.IOException;
|
|
import java.io.InputStream;
|
|
import java.io.InputStream;
|
|
import java.util.*;
|
|
import java.util.*;
|
|
|
|
+import java.util.function.Function;
|
|
import java.util.regex.Matcher;
|
|
import java.util.regex.Matcher;
|
|
import java.util.regex.Pattern;
|
|
import java.util.regex.Pattern;
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
@@ -57,10 +58,13 @@ public class OrganizationRatingServiceImpl extends ServiceImpl<OrganizationRatin
|
|
@Resource
|
|
@Resource
|
|
private IOrganizationRatingRuleService iOrganizationRatingRuleService;
|
|
private IOrganizationRatingRuleService iOrganizationRatingRuleService;
|
|
|
|
|
|
|
|
+ @Resource
|
|
|
|
+ private IEvaluationPortalService iEvaluationPortalService;
|
|
|
|
+
|
|
|
|
+
|
|
|
|
|
|
/**
|
|
/**
|
|
* 导入
|
|
* 导入
|
|
- *
|
|
|
|
* @param file
|
|
* @param file
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
@@ -91,7 +95,7 @@ public class OrganizationRatingServiceImpl extends ServiceImpl<OrganizationRatin
|
|
//遍历Excel表每一行的数据
|
|
//遍历Excel表每一行的数据
|
|
for (String[] str : strings) {
|
|
for (String[] str : strings) {
|
|
if (!str[1].equals(binName)) {
|
|
if (!str[1].equals(binName)) {
|
|
- return R.error("请导入" + binSection + "的数据");
|
|
|
|
|
|
+ return R.error("请导入" + binName + "的数据");
|
|
}
|
|
}
|
|
if (!str[2].equals(orgRatings.get(0).getYear())) {
|
|
if (!str[2].equals(orgRatings.get(0).getYear())) {
|
|
return R.error("请导入" + year + "年的数据");
|
|
return R.error("请导入" + year + "年的数据");
|
|
@@ -115,6 +119,7 @@ public class OrganizationRatingServiceImpl extends ServiceImpl<OrganizationRatin
|
|
}
|
|
}
|
|
}
|
|
}
|
|
boolean b = super.saveOrUpdateBatch(orgList);
|
|
boolean b = super.saveOrUpdateBatch(orgList);
|
|
|
|
+ savePortal(orgList);
|
|
if (b) {
|
|
if (b) {
|
|
return R.ok().data(b);
|
|
return R.ok().data(b);
|
|
} else {
|
|
} else {
|
|
@@ -220,7 +225,7 @@ public class OrganizationRatingServiceImpl extends ServiceImpl<OrganizationRatin
|
|
* 单位考评评级
|
|
* 单位考评评级
|
|
*/
|
|
*/
|
|
@Override
|
|
@Override
|
|
- public IPage<OrganizationRating> grade(List<OrganizationRating> orgRating) {
|
|
|
|
|
|
+ public List<OrganizationRating> grade(List<OrganizationRating> orgRating) {
|
|
XSSFWorkbook xwb = new XSSFWorkbook();
|
|
XSSFWorkbook xwb = new XSSFWorkbook();
|
|
Sheet st = xwb.createSheet();
|
|
Sheet st = xwb.createSheet();
|
|
List<OrganizationRatingRule> rules = iOrganizationRatingRuleService.list(null);
|
|
List<OrganizationRatingRule> rules = iOrganizationRatingRuleService.list(null);
|
|
@@ -237,7 +242,31 @@ public class OrganizationRatingServiceImpl extends ServiceImpl<OrganizationRatin
|
|
calcQQXMrating(rulesYear, col, st, xwb);
|
|
calcQQXMrating(rulesYear, col, st, xwb);
|
|
calcJJXMrating(rulesYear, col, st, xwb);
|
|
calcJJXMrating(rulesYear, col, st, xwb);
|
|
calcNDrating(rulesYear, orgRating, 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);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|