|
@@ -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,6 +58,10 @@ public class OrganizationRatingServiceImpl extends ServiceImpl<OrganizationRatin
|
|
@Resource
|
|
@Resource
|
|
private IOrganizationRatingRuleService iOrganizationRatingRuleService;
|
|
private IOrganizationRatingRuleService iOrganizationRatingRuleService;
|
|
|
|
|
|
|
|
+ @Resource
|
|
|
|
+ private IEvaluationPortalService iEvaluationPortalService;
|
|
|
|
+
|
|
|
|
+
|
|
|
|
|
|
/**
|
|
/**
|
|
* 导入
|
|
* 导入
|
|
@@ -82,6 +87,7 @@ public class OrganizationRatingServiceImpl extends ServiceImpl<OrganizationRatin
|
|
List<String[]> strings = ExcelUtil.readData(fileType, startRows, true, is);
|
|
List<String[]> strings = ExcelUtil.readData(fileType, startRows, true, is);
|
|
List<String> ids = strings.stream().map(row -> row[row.length - 1]).collect(Collectors.toList());
|
|
List<String> ids = strings.stream().map(row -> row[row.length - 1]).collect(Collectors.toList());
|
|
List<OrganizationRating> organizationRatings = baseMapper.selectBatchIds(ids);
|
|
List<OrganizationRating> organizationRatings = baseMapper.selectBatchIds(ids);
|
|
|
|
+ savePortal(organizationRatings);
|
|
if (!binSection.equals(organizationRatings.get(0).getBinSection())) {
|
|
if (!binSection.equals(organizationRatings.get(0).getBinSection())) {
|
|
return R.error("请导入" + binSection + "的数据");
|
|
return R.error("请导入" + binSection + "的数据");
|
|
}
|
|
}
|
|
@@ -211,7 +217,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);
|
|
@@ -228,7 +234,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);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|