|
@@ -58,6 +58,12 @@ public class OrganizationEvaluationRuleServiceImpl extends ServiceImpl<Organizat
|
|
|
@Autowired
|
|
|
private IOrganizationStructureService organizationStructureService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private IBinSectionService binSectionService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IBinStageService binStageService;
|
|
|
+
|
|
|
@Override
|
|
|
public IPage<OrganizationEvaluationRule> list(Integer pageNum, Integer pageSize, String id, String organizationName, String organizationId, String organizationType, String binSection, String binStage, String evaluationCycle, String year) {
|
|
|
QueryWrapper<OrganizationEvaluationRule> qw = new QueryWrapper<>();
|
|
@@ -320,7 +326,7 @@ public class OrganizationEvaluationRuleServiceImpl extends ServiceImpl<Organizat
|
|
|
|
|
|
// 创建表头
|
|
|
Row headerRow = sheet.createRow(0);
|
|
|
- List<String> headers = Arrays.asList("单位编码", "单位名称", "考评周期", "考评规则", "是否考评", "考评年份", "生产经营权重", "前期权重", "基建权重");
|
|
|
+ List<String> headers = Arrays.asList("单位编码", "单位名称", "业务属性编码", "业务属性", "业务阶段编码", "业务阶段", "考评周期", "考评规则", "是否考评", "考评年份", "生产经营权重", "前期权重", "基建权重");
|
|
|
for (int i = 0; i < headers.size(); i++) {
|
|
|
Cell cell = headerRow.createCell(i);
|
|
|
cell.setCellValue(headers.get(i));
|
|
@@ -347,6 +353,34 @@ public class OrganizationEvaluationRuleServiceImpl extends ServiceImpl<Organizat
|
|
|
// 设置其数据
|
|
|
row.createCell(0).setCellValue(organizationEvaluationRule.getOrganizationId());
|
|
|
row.createCell(1).setCellValue(organizationEvaluationRule.getOrganizationShortName());
|
|
|
+ if (null != organizationEvaluationRule.getBinSection()) {
|
|
|
+ String[] binSectionStr = organizationEvaluationRule.getBinSection().split(",");
|
|
|
+ StringBuilder binSectionCode = new StringBuilder();
|
|
|
+ StringBuilder binSectionName = new StringBuilder();
|
|
|
+ for (String str : binSectionStr) {
|
|
|
+ BinSection bse = binSectionService.getById(str);
|
|
|
+ if (null != bse) {
|
|
|
+ binSectionCode.append(bse.getSectionCode()).append(",");
|
|
|
+ binSectionName.append(bse.getSectionName()).append(",");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ row.createCell(2).setCellValue(binSectionCode.toString().length() > 0 ? binSectionCode.toString().substring(0, binSectionCode.toString().length() - 1) : "");
|
|
|
+ row.createCell(3).setCellValue(binSectionName.toString().length() > 0 ? binSectionName.toString().substring(0, binSectionName.toString().length() - 1) : "");
|
|
|
+ }
|
|
|
+ if (null != organizationEvaluationRule.getBinStage()) {
|
|
|
+ String[] binStageStr = organizationEvaluationRule.getBinStage().split(",");
|
|
|
+ StringBuilder binStageCode = new StringBuilder();
|
|
|
+ StringBuilder binStageName = new StringBuilder();
|
|
|
+ for (String str : binStageStr) {
|
|
|
+ BinStage bst = binStageService.getById(str);
|
|
|
+ if (null != bst) {
|
|
|
+ binStageCode.append(bst.getStageCode()).append(",");
|
|
|
+ binStageName.append(bst.getStageName()).append(",");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ row.createCell(4).setCellValue(binStageCode.toString().length() > 0 ? binStageCode.toString().substring(0, binStageCode.toString().length() - 1) : "");
|
|
|
+ row.createCell(5).setCellValue(binStageName.toString().length() > 0 ? binStageName.toString().substring(0, binStageName.toString().length() - 1) : "");
|
|
|
+ }
|
|
|
if (null != organizationEvaluationRule.getEvaluationCycle()) {
|
|
|
if ("NDKP".equals(organizationEvaluationRule.getEvaluationCycle())) {
|
|
|
evaluationCycle = "年度考评";
|
|
@@ -355,9 +389,9 @@ public class OrganizationEvaluationRuleServiceImpl extends ServiceImpl<Organizat
|
|
|
} else if ("YDKP".equals(organizationEvaluationRule.getEvaluationCycle())) {
|
|
|
evaluationCycle = "月度考评";
|
|
|
}
|
|
|
- row.createCell(2).setCellValue(evaluationCycle);
|
|
|
+ row.createCell(6).setCellValue(evaluationCycle);
|
|
|
}
|
|
|
- row.createCell(3).setCellValue(organizationEvaluationRule.getEvaluateRuleName());
|
|
|
+ row.createCell(7).setCellValue(organizationEvaluationRule.getEvaluateRuleName());
|
|
|
if (null != organizationEvaluationRule.getIsCheck()) {
|
|
|
String isCheck;
|
|
|
if (organizationEvaluationRule.getIsCheck()) {
|
|
@@ -365,12 +399,12 @@ public class OrganizationEvaluationRuleServiceImpl extends ServiceImpl<Organizat
|
|
|
} else {
|
|
|
isCheck = "否";
|
|
|
}
|
|
|
- row.createCell(4).setCellValue(isCheck);
|
|
|
+ row.createCell(8).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(9).setCellValue(organizationEvaluationRule.getYear());
|
|
|
+ row.createCell(10).setCellValue(organizationEvaluationRule.getScjyWeight());
|
|
|
+ row.createCell(11).setCellValue(organizationEvaluationRule.getQqWeight());
|
|
|
+ row.createCell(12).setCellValue(organizationEvaluationRule.getJjWeight());
|
|
|
}
|
|
|
|
|
|
// 自动调整列宽
|
|
@@ -403,7 +437,7 @@ public class OrganizationEvaluationRuleServiceImpl extends ServiceImpl<Organizat
|
|
|
|
|
|
// 创建表头
|
|
|
Row headerRow = sheet.createRow(0);
|
|
|
- List<String> headers = Arrays.asList("单位编码", "单位名称", "考评周期", "考评规则", "是否考评", "考评年份", "生产经营权重", "前期权重", "基建权重");
|
|
|
+ List<String> headers = Arrays.asList("单位编码", "单位名称", "业务属性编码", "业务属性", "业务阶段编码", "业务阶段", "考评周期", "考评规则", "是否考评", "考评年份", "生产经营权重", "前期权重", "基建权重");
|
|
|
for (int i = 0; i < headers.size(); i++) {
|
|
|
Cell cell = headerRow.createCell(i);
|
|
|
cell.setCellValue(headers.get(i));
|
|
@@ -432,33 +466,35 @@ public class OrganizationEvaluationRuleServiceImpl extends ServiceImpl<Organizat
|
|
|
int startRows = 1;
|
|
|
//获取输入流
|
|
|
InputStream is = file.getInputStream();
|
|
|
- List<OrganizationEvaluationRule> organizationEvaluationRuleListUp = new ArrayList<>();
|
|
|
- List<OrganizationEvaluationRule> organizationEvaluationRuleListSa = new ArrayList<>();
|
|
|
+ List<OrganizationEvaluationRule> organizationEvaluationRuleList = new ArrayList<>();
|
|
|
//Excel导入导出的单元类
|
|
|
List<String[]> strings = ExcelUtil.readData(fileType, startRows, true, is);
|
|
|
//遍历Excel表每一行的数据
|
|
|
for (String[] str : strings) {
|
|
|
OrganizationEvaluationRule organizationEvaluationRule = new OrganizationEvaluationRule();
|
|
|
- String evaluateRuleNameStr = str[3].replaceAll(",", ",");
|
|
|
- String[] evaluateRuleNames = evaluateRuleNameStr.split(",");
|
|
|
- StringBuilder evaluateRuleIds = new StringBuilder();
|
|
|
+ String[] binSectionStr = str[2].split(",");
|
|
|
StringBuilder binSections = new StringBuilder();
|
|
|
+ for (String string : binSectionStr) {
|
|
|
+ BinSection bse = binSectionService.getBinSectionBySectionCode(string);
|
|
|
+ if (null != bse) {
|
|
|
+ binSections.append(bse.getId()).append(",");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ String[] binStagesStr = str[4].split(",");
|
|
|
StringBuilder binStages = new StringBuilder();
|
|
|
- for (String evaluateRuleName : evaluateRuleNames) {
|
|
|
- EvaluateRule evaluateRule = evaluateRuleService.getEvaluateRuleByRuleName(evaluateRuleName, str[5]);
|
|
|
- if (null != evaluateRule) {
|
|
|
- evaluateRuleIds.append(evaluateRule.getId());
|
|
|
- binSections.append(evaluateRule.getBinSection());
|
|
|
- binStages.append(evaluateRule.getBinStage());
|
|
|
+ for (String string : binStagesStr) {
|
|
|
+ BinStage bst = binStageService.getBinStageByStageCode(string);
|
|
|
+ if (null != bst) {
|
|
|
+ binStages.append(bst.getId()).append(",");
|
|
|
}
|
|
|
}
|
|
|
- OrganizationEvaluationRule obj = this.checkForExistence(str[0], toFullSpell(str[2]), binStages.toString(), binSections.toString(), str[5]);
|
|
|
+ OrganizationEvaluationRule obj = this.checkForExistence(str[0], toFullSpell(str[6]), binStages.toString(), binSections.toString(), str[9]);
|
|
|
if (null != obj) {
|
|
|
organizationEvaluationRule.setId(obj.getId());
|
|
|
- organizationEvaluationRule.setScjyWeight(Double.parseDouble(str[6]));
|
|
|
- organizationEvaluationRule.setQqWeight(Double.parseDouble(str[7]));
|
|
|
- organizationEvaluationRule.setJjWeight(Double.parseDouble(str[8]));
|
|
|
- organizationEvaluationRuleListUp.add(organizationEvaluationRule);
|
|
|
+ organizationEvaluationRule.setScjyWeight(Double.parseDouble(str[10]));
|
|
|
+ organizationEvaluationRule.setQqWeight(Double.parseDouble(str[11]));
|
|
|
+ organizationEvaluationRule.setJjWeight(Double.parseDouble(str[12]));
|
|
|
+ organizationEvaluationRuleList.add(organizationEvaluationRule);
|
|
|
} else {
|
|
|
List<OrganizationStructure> organizationStructureList = organizationStructureService.getList2("", null, "");
|
|
|
OrganizationStructure organizationStructure = organizationStructureList.stream().filter(item -> item.getId().equals(str[0])).findFirst().orElse(null);
|
|
@@ -468,27 +504,34 @@ public class OrganizationEvaluationRuleServiceImpl extends ServiceImpl<Organizat
|
|
|
organizationEvaluationRule.setOrganizationShortName(organizationStructure.getShortName());
|
|
|
organizationEvaluationRule.setBusinessType(organizationStructure.getBusinessType());
|
|
|
organizationEvaluationRule.setOrganizationType("DWKP");
|
|
|
- organizationEvaluationRule.setEvaluationCycle(toFullSpell(str[2]));
|
|
|
- organizationEvaluationRule.setEvaluateRuleId(evaluateRuleIds.toString());
|
|
|
- organizationEvaluationRule.setBinSection(binSections.toString());
|
|
|
- organizationEvaluationRule.setBinStage(binStages.toString());
|
|
|
+ organizationEvaluationRule.setEvaluationCycle(toFullSpell(str[6]));
|
|
|
+ String[] evaluateRuleNames = str[7].split(",");
|
|
|
+ StringBuilder evaluateRuleIds = new StringBuilder();
|
|
|
+ for (String evaluateRuleName : evaluateRuleNames) {
|
|
|
+ EvaluateRule evaluateRule = evaluateRuleService.getEvaluateRuleByRuleName(evaluateRuleName, str[9]);
|
|
|
+ if (null != evaluateRule) {
|
|
|
+ evaluateRuleIds.append(evaluateRule.getId()).append(",");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ organizationEvaluationRule.setEvaluateRuleId(evaluateRuleIds.toString().length() > 0 ? evaluateRuleIds.toString().substring(0, evaluateRuleIds.toString().length() - 1) : "");
|
|
|
+ organizationEvaluationRule.setBinSection(binSections.toString().length() > 0 ? binSections.toString().substring(0, binSections.toString().length() - 1) : "");
|
|
|
+ organizationEvaluationRule.setBinStage(binStages.toString().length() > 0 ? binStages.toString().substring(0, binStages.toString().length() - 1) : "");
|
|
|
organizationEvaluationRule.setDelFlag(false);
|
|
|
- if ("是".equals(str[4])) {
|
|
|
+ if ("是".equals(str[8])) {
|
|
|
organizationEvaluationRule.setIsCheck(true);
|
|
|
- } else if ("否".equals(str[4])) {
|
|
|
+ } else if ("否".equals(str[8])) {
|
|
|
organizationEvaluationRule.setIsCheck(false);
|
|
|
}
|
|
|
- organizationEvaluationRule.setScjyWeight(Double.parseDouble(str[6]));
|
|
|
- organizationEvaluationRule.setQqWeight(Double.parseDouble(str[7]));
|
|
|
- organizationEvaluationRule.setJjWeight(Double.parseDouble(str[8]));
|
|
|
- organizationEvaluationRule.setYear(str[5]);
|
|
|
- organizationEvaluationRuleListSa.add(organizationEvaluationRule);
|
|
|
+ organizationEvaluationRule.setScjyWeight(Double.parseDouble(str[10]));
|
|
|
+ organizationEvaluationRule.setQqWeight(Double.parseDouble(str[11]));
|
|
|
+ organizationEvaluationRule.setJjWeight(Double.parseDouble(str[12]));
|
|
|
+ organizationEvaluationRule.setYear(str[9]);
|
|
|
+ organizationEvaluationRuleList.add(organizationEvaluationRule);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- boolean a = super.updateBatchById(organizationEvaluationRuleListUp);
|
|
|
- boolean b = super.saveBatch(organizationEvaluationRuleListSa);
|
|
|
- if (a || b) {
|
|
|
+ boolean b = super.saveOrUpdateBatch(organizationEvaluationRuleList);
|
|
|
+ if (b) {
|
|
|
return R.ok().data(b);
|
|
|
} else {
|
|
|
return R.error("导入失败!");
|