|
@@ -33,8 +33,6 @@ import java.io.IOException;
|
|
import java.io.InputStream;
|
|
import java.io.InputStream;
|
|
import java.io.Serializable;
|
|
import java.io.Serializable;
|
|
import java.util.*;
|
|
import java.util.*;
|
|
-import java.util.regex.Matcher;
|
|
|
|
-import java.util.regex.Pattern;
|
|
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -322,7 +320,7 @@ public class OrganizationEvaluationRuleServiceImpl extends ServiceImpl<Organizat
|
|
|
|
|
|
// 创建表头
|
|
// 创建表头
|
|
Row headerRow = sheet.createRow(0);
|
|
Row headerRow = sheet.createRow(0);
|
|
- List<String> headers = Arrays.asList("ID", "单位名称", "考评周期", "考评规则", "是否考评", "考评年份", "生产经营权重", "前期权重", "基建权重");
|
|
|
|
|
|
+ List<String> headers = Arrays.asList("单位名称", "考评周期", "考评规则", "是否考评", "考评年份", "生产经营权重", "前期权重", "基建权重");
|
|
for (int i = 0; i < headers.size(); i++) {
|
|
for (int i = 0; i < headers.size(); i++) {
|
|
Cell cell = headerRow.createCell(i);
|
|
Cell cell = headerRow.createCell(i);
|
|
cell.setCellValue(headers.get(i));
|
|
cell.setCellValue(headers.get(i));
|
|
@@ -346,11 +344,8 @@ public class OrganizationEvaluationRuleServiceImpl extends ServiceImpl<Organizat
|
|
for (OrganizationEvaluationRule organizationEvaluationRule : organizationEvaluationRuleList) {
|
|
for (OrganizationEvaluationRule organizationEvaluationRule : organizationEvaluationRuleList) {
|
|
Row row = sheet.createRow(rowIndex++);
|
|
Row row = sheet.createRow(rowIndex++);
|
|
|
|
|
|
- // 设置ID
|
|
|
|
- row.createCell(0).setCellValue(organizationEvaluationRule.getId());
|
|
|
|
-
|
|
|
|
- // 设置其他数据
|
|
|
|
- row.createCell(1).setCellValue(organizationEvaluationRule.getOrganizationShortName());
|
|
|
|
|
|
+ // 设置其数据
|
|
|
|
+ row.createCell(0).setCellValue(organizationEvaluationRule.getOrganizationShortName());
|
|
if (null != organizationEvaluationRule.getEvaluationCycle()) {
|
|
if (null != organizationEvaluationRule.getEvaluationCycle()) {
|
|
if ("NDKP".equals(organizationEvaluationRule.getEvaluationCycle())) {
|
|
if ("NDKP".equals(organizationEvaluationRule.getEvaluationCycle())) {
|
|
evaluationCycle = "年度考评";
|
|
evaluationCycle = "年度考评";
|
|
@@ -359,9 +354,9 @@ public class OrganizationEvaluationRuleServiceImpl extends ServiceImpl<Organizat
|
|
} else if ("YDKP".equals(organizationEvaluationRule.getEvaluationCycle())) {
|
|
} else if ("YDKP".equals(organizationEvaluationRule.getEvaluationCycle())) {
|
|
evaluationCycle = "月度考评";
|
|
evaluationCycle = "月度考评";
|
|
}
|
|
}
|
|
- row.createCell(2).setCellValue(evaluationCycle);
|
|
|
|
|
|
+ row.createCell(1).setCellValue(evaluationCycle);
|
|
}
|
|
}
|
|
- row.createCell(3).setCellValue(organizationEvaluationRule.getEvaluateRuleName());
|
|
|
|
|
|
+ row.createCell(2).setCellValue(organizationEvaluationRule.getEvaluateRuleName());
|
|
if (null != organizationEvaluationRule.getIsCheck()) {
|
|
if (null != organizationEvaluationRule.getIsCheck()) {
|
|
String isCheck;
|
|
String isCheck;
|
|
if (organizationEvaluationRule.getIsCheck()) {
|
|
if (organizationEvaluationRule.getIsCheck()) {
|
|
@@ -369,16 +364,18 @@ public class OrganizationEvaluationRuleServiceImpl extends ServiceImpl<Organizat
|
|
} else {
|
|
} else {
|
|
isCheck = "否";
|
|
isCheck = "否";
|
|
}
|
|
}
|
|
- row.createCell(4).setCellValue(isCheck);
|
|
|
|
|
|
+ row.createCell(3).setCellValue(isCheck);
|
|
}
|
|
}
|
|
- row.createCell(5).setCellValue(organizationEvaluationRule.getYear());
|
|
|
|
- row.createCell(6).setCellValue(organizationEvaluationRule.getScjyWeight());
|
|
|
|
- row.createCell(7).setCellValue(organizationEvaluationRule.getQqWeight());
|
|
|
|
- row.createCell(8).setCellValue(organizationEvaluationRule.getJjWeight());
|
|
|
|
|
|
+ row.createCell(4).setCellValue(organizationEvaluationRule.getYear());
|
|
|
|
+ row.createCell(5).setCellValue(organizationEvaluationRule.getScjyWeight());
|
|
|
|
+ row.createCell(6).setCellValue(organizationEvaluationRule.getQqWeight());
|
|
|
|
+ row.createCell(7).setCellValue(organizationEvaluationRule.getJjWeight());
|
|
}
|
|
}
|
|
|
|
|
|
- // 隐藏第一列(ID列)
|
|
|
|
- sheet.setColumnHidden(0, true);
|
|
|
|
|
|
+ // 自动调整列宽
|
|
|
|
+ for (int i = 0; i < headers.size(); i++) {
|
|
|
|
+ sheet.autoSizeColumn(i);
|
|
|
|
+ }
|
|
|
|
|
|
// 将工作簿写入到输出流
|
|
// 将工作簿写入到输出流
|
|
try (ByteArrayOutputStream outputStream = new ByteArrayOutputStream()) {
|
|
try (ByteArrayOutputStream outputStream = new ByteArrayOutputStream()) {
|
|
@@ -440,8 +437,20 @@ public class OrganizationEvaluationRuleServiceImpl extends ServiceImpl<Organizat
|
|
//遍历Excel表每一行的数据
|
|
//遍历Excel表每一行的数据
|
|
for (String[] str : strings) {
|
|
for (String[] str : strings) {
|
|
OrganizationEvaluationRule organizationEvaluationRule = new OrganizationEvaluationRule();
|
|
OrganizationEvaluationRule organizationEvaluationRule = new OrganizationEvaluationRule();
|
|
- if (verifyID(str[0])) {
|
|
|
|
- organizationEvaluationRule.setId(str[0]);
|
|
|
|
|
|
+ String evaluateRuleNameStr = str[2].replaceAll(",", ",");
|
|
|
|
+ String[] evaluateRuleNames = evaluateRuleNameStr.split(",");
|
|
|
|
+ StringBuilder evaluateRuleIds = new StringBuilder();
|
|
|
|
+ StringBuilder binSections = new StringBuilder();
|
|
|
|
+ StringBuilder binStages = new StringBuilder();
|
|
|
|
+ for (String evaluateRuleName : evaluateRuleNames) {
|
|
|
|
+ EvaluateRule evaluateRule = evaluateRuleService.getEvaluateRuleByRuleName(evaluateRuleName, str[4]);
|
|
|
|
+ evaluateRuleIds.append(evaluateRule.getId());
|
|
|
|
+ binSections.append(evaluateRule.getBinSection());
|
|
|
|
+ binStages.append(evaluateRule.getBinStage());
|
|
|
|
+ }
|
|
|
|
+ OrganizationEvaluationRule obj = this.checkForExistence(str[0], toFullSpell(str[1]), binStages.toString(), binSections.toString(), str[4]);
|
|
|
|
+ if (null != obj) {
|
|
|
|
+ organizationEvaluationRule.setId(obj.getId());
|
|
organizationEvaluationRule.setScjyWeight(Double.parseDouble(str[6]));
|
|
organizationEvaluationRule.setScjyWeight(Double.parseDouble(str[6]));
|
|
organizationEvaluationRule.setQqWeight(Double.parseDouble(str[7]));
|
|
organizationEvaluationRule.setQqWeight(Double.parseDouble(str[7]));
|
|
organizationEvaluationRule.setJjWeight(Double.parseDouble(str[8]));
|
|
organizationEvaluationRule.setJjWeight(Double.parseDouble(str[8]));
|
|
@@ -457,17 +466,6 @@ public class OrganizationEvaluationRuleServiceImpl extends ServiceImpl<Organizat
|
|
}
|
|
}
|
|
organizationEvaluationRule.setOrganizationType("DWKP");
|
|
organizationEvaluationRule.setOrganizationType("DWKP");
|
|
organizationEvaluationRule.setEvaluationCycle(toFullSpell(str[1]));
|
|
organizationEvaluationRule.setEvaluationCycle(toFullSpell(str[1]));
|
|
- str[2].replaceAll(",", ",");
|
|
|
|
- String[] evaluateRuleNames = str[2].split(",");
|
|
|
|
- StringBuilder evaluateRuleIds = new StringBuilder();
|
|
|
|
- StringBuilder binSections = new StringBuilder();
|
|
|
|
- StringBuilder binStages = new StringBuilder();
|
|
|
|
- for (String evaluateRuleName : evaluateRuleNames){
|
|
|
|
- EvaluateRule evaluateRule = evaluateRuleService.getEvaluateRuleByRuleName(evaluateRuleName, str[4]);
|
|
|
|
- evaluateRuleIds.append(evaluateRule.getId());
|
|
|
|
- binSections.append(evaluateRule.getBinSection());
|
|
|
|
- binStages.append(evaluateRule.getBinStage());
|
|
|
|
- }
|
|
|
|
organizationEvaluationRule.setEvaluateRuleId(evaluateRuleIds.toString());
|
|
organizationEvaluationRule.setEvaluateRuleId(evaluateRuleIds.toString());
|
|
organizationEvaluationRule.setBinSection(binSections.toString());
|
|
organizationEvaluationRule.setBinSection(binSections.toString());
|
|
organizationEvaluationRule.setBinStage(binStages.toString());
|
|
organizationEvaluationRule.setBinStage(binStages.toString());
|
|
@@ -497,6 +495,28 @@ public class OrganizationEvaluationRuleServiceImpl extends ServiceImpl<Organizat
|
|
return R.error("上传文件为空!");
|
|
return R.error("上传文件为空!");
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
+ public OrganizationEvaluationRule checkForExistence(String organizationName, String evaluationCycle, String binStage, String binSection, String year) {
|
|
|
|
+ QueryWrapper<OrganizationEvaluationRule> qw = new QueryWrapper<>();
|
|
|
|
+ if (StringUtils.isNotEmpty(organizationName)) {
|
|
|
|
+ qw.lambda().eq(OrganizationEvaluationRule::getOrganizationName, organizationName);
|
|
|
|
+ }
|
|
|
|
+ if (StringUtils.isNotEmpty(evaluationCycle)) {
|
|
|
|
+ qw.lambda().eq(OrganizationEvaluationRule::getEvaluationCycle, evaluationCycle);
|
|
|
|
+ }
|
|
|
|
+ if (StringUtils.isNotEmpty(binStage)) {
|
|
|
|
+ qw.lambda().eq(OrganizationEvaluationRule::getBinStage, binStage);
|
|
|
|
+ }
|
|
|
|
+ if (StringUtils.isNotEmpty(binSection)) {
|
|
|
|
+ qw.lambda().eq(OrganizationEvaluationRule::getBinSection, binSection);
|
|
|
|
+ }
|
|
|
|
+ if (StringUtils.isNotEmpty(year)) {
|
|
|
|
+ qw.lambda().eq(OrganizationEvaluationRule::getYear, year);
|
|
|
|
+ }
|
|
|
|
+ qw.lambda().eq(OrganizationEvaluationRule::getDelFlag, false);
|
|
|
|
+ return baseMapper.selectOne(qw);
|
|
|
|
+ }
|
|
|
|
+
|
|
@Transactional
|
|
@Transactional
|
|
@Override
|
|
@Override
|
|
public boolean saveOrUpdate(OrganizationEvaluationRule entity) {
|
|
public boolean saveOrUpdate(OrganizationEvaluationRule entity) {
|
|
@@ -559,16 +579,9 @@ public class OrganizationEvaluationRuleServiceImpl extends ServiceImpl<Organizat
|
|
return true;
|
|
return true;
|
|
}
|
|
}
|
|
|
|
|
|
- public static boolean verifyID(String str) {
|
|
|
|
- Pattern isPureNumericPattern = Pattern.compile("^\\d+$");
|
|
|
|
- Matcher isPureNumericMatcher = isPureNumericPattern.matcher(str);
|
|
|
|
-
|
|
|
|
- Pattern containsAlphaNumericPattern = Pattern.compile("^(?=.*\\d)(?=.*[a-zA-Z]).+$");
|
|
|
|
- Matcher containsAlphaNumericMatcher = containsAlphaNumericPattern.matcher(str);
|
|
|
|
-
|
|
|
|
- return isPureNumericMatcher.matches() || containsAlphaNumericMatcher.matches();
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 汉字转拼音取首字母全大写
|
|
|
|
+ */
|
|
public static String toFullSpell(String chinese) {
|
|
public static String toFullSpell(String chinese) {
|
|
HanyuPinyinOutputFormat format = new HanyuPinyinOutputFormat();
|
|
HanyuPinyinOutputFormat format = new HanyuPinyinOutputFormat();
|
|
format.setCaseType(HanyuPinyinCaseType.UPPERCASE);
|
|
format.setCaseType(HanyuPinyinCaseType.UPPERCASE);
|