|
|
|
@ -26,6 +26,7 @@ import com.engine.organization.entity.scheme.po.SchemePO;
|
|
|
|
|
import com.engine.organization.enums.LogModuleNameEnum;
|
|
|
|
|
import com.engine.organization.enums.OperateTypeEnum;
|
|
|
|
|
import com.engine.organization.enums.OrgImportEnum;
|
|
|
|
|
import com.engine.organization.exception.OrganizationRunTimeException;
|
|
|
|
|
import com.engine.organization.mapper.comp.CompMapper;
|
|
|
|
|
import com.engine.organization.mapper.department.DepartmentMapper;
|
|
|
|
|
import com.engine.organization.mapper.extend.ExtMapper;
|
|
|
|
@ -88,6 +89,7 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
|
|
|
|
|
private static final String HRM_RESOURCE = "hrmresource";
|
|
|
|
|
|
|
|
|
|
static Map<String, ExtendInfoPO> importFieldsMap;
|
|
|
|
|
|
|
|
|
|
static {
|
|
|
|
|
importFieldsMap = new HashMap<>();
|
|
|
|
|
importFieldsMap.put("方案编号", ExtendInfoPO.builder().tableName("jcl_org_scheme").fieldName("scheme_no").fieldNameDesc("方案编号").isrequired(1).controlType(1).browserType("1").customValue("[\"input\",\"text\",\"100\"]").build());
|
|
|
|
@ -101,6 +103,7 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
|
|
|
|
|
importFieldsMap.put("职级说明", ExtendInfoPO.builder().tableName("jcl_org_grade").fieldName("grade_description").fieldNameDesc("职级说明").isrequired(0).controlType(1).browserType("1").customValue("[\"input\",\"text\",\"100\"]").build());
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private ExtendInfoMapper getExtendInfoMapper() {
|
|
|
|
|
return MapperProxyFactory.getProxy(ExtendInfoMapper.class);
|
|
|
|
|
}
|
|
|
|
@ -161,7 +164,7 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
|
|
|
|
|
return returnMaps;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if("joblevel".equals(importType)){
|
|
|
|
|
if ("joblevel".equals(importType)) {
|
|
|
|
|
List<FieldTransferParam> fieldDatas = new ArrayList<>();
|
|
|
|
|
fieldDatas.add(FieldTransferParam.builder().id("1").name("职级编号").build());
|
|
|
|
|
fieldDatas.add(FieldTransferParam.builder().id("2").name("职级名称").build());
|
|
|
|
@ -173,13 +176,13 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
|
|
|
|
|
fieldDatas.add(FieldTransferParam.builder().id("8").name("职级说明").build());
|
|
|
|
|
fieldDatas.add(FieldTransferParam.builder().id("9").name("职等说明").build());
|
|
|
|
|
List<String> selectedKeys = new ArrayList<>();
|
|
|
|
|
for(int i=0;i<fieldDatas.subList(0,6).size();i++){
|
|
|
|
|
for (int i = 0; i < fieldDatas.subList(0, 6).size(); i++) {
|
|
|
|
|
selectedKeys.add(fieldDatas.get(i).getId());
|
|
|
|
|
}
|
|
|
|
|
returnMaps.put("data", fieldDatas);
|
|
|
|
|
returnMaps.put("selectedKeys", selectedKeys);
|
|
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
} else {
|
|
|
|
|
List<ExtendInfoPO> infoPOList = getExtendInfoMapper().listFields(extendType, "", tableName, ExtendInfoOperateType.LIST.getValue(), "1");
|
|
|
|
|
List<ExtendInfoPO> filterList = infoPOList.stream().filter(item -> !excludeFields.contains(item.getFieldName()) && 6 != item.getControlType()).collect(Collectors.toList());
|
|
|
|
|
|
|
|
|
@ -270,7 +273,7 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
|
|
|
|
|
//}
|
|
|
|
|
//returnMap.put("pId", importHistoryId);
|
|
|
|
|
|
|
|
|
|
returnMap.put("pId", hrmResourceImport(operateType, excelFile,keyField));
|
|
|
|
|
returnMap.put("pId", hrmResourceImport(operateType, excelFile, keyField));
|
|
|
|
|
break;
|
|
|
|
|
case "joblevel":
|
|
|
|
|
returnMap.put("pId", jobLevelImport(operateType, excelFile));
|
|
|
|
@ -512,6 +515,7 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
|
|
|
|
|
lsGroup.add(groupItem);
|
|
|
|
|
return lsGroup;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private List<Object> getJobLevelImportForm(String templatePath) throws IOException {
|
|
|
|
|
|
|
|
|
|
// 返回导入数据
|
|
|
|
@ -697,7 +701,7 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
|
|
|
|
|
} else {
|
|
|
|
|
ExtendInfoPO infoPO = extendInfoPOS.get(cellIndex);
|
|
|
|
|
// 数据校验
|
|
|
|
|
if (infoPO.getIsrequired() == 1 && StringUtils.isBlank(cellValue)) {
|
|
|
|
|
if (infoPO.getIsrequired() == 1 && StringUtils.isBlank(cellValue) && !"comp_no".equalsIgnoreCase(infoPO.getFieldName())) {
|
|
|
|
|
historyDetailPO.setOperateDetail(infoPO.getFieldNameDesc() + "为必填项");
|
|
|
|
|
historyDetailPO.setStatus("0");
|
|
|
|
|
saveImportDetailLog(historyDetailPO);
|
|
|
|
@ -763,7 +767,14 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
// 自动编号
|
|
|
|
|
compNo = CompServiceImpl.repeatDetermine(compNo);
|
|
|
|
|
try {
|
|
|
|
|
compNo = CompServiceImpl.repeatDetermine(compNo);
|
|
|
|
|
} catch (OrganizationRunTimeException e) {
|
|
|
|
|
historyDetailPO.setOperateDetail(e.getMessage());
|
|
|
|
|
historyDetailPO.setStatus("0");
|
|
|
|
|
saveImportDetailLog(historyDetailPO);
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
map.put("comp_no", compNo);
|
|
|
|
|
map.put("creator", user.getUID());
|
|
|
|
|
map.put("delete_type", 0);
|
|
|
|
@ -884,7 +895,7 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
|
|
|
|
|
} else {
|
|
|
|
|
ExtendInfoPO infoPO = extendInfoPOS.get(cellIndex);
|
|
|
|
|
// 数据校验
|
|
|
|
|
if (infoPO.getIsrequired() == 1 && StringUtils.isBlank(cellValue)) {
|
|
|
|
|
if (infoPO.getIsrequired() == 1 && StringUtils.isBlank(cellValue) && !"dept_no".equalsIgnoreCase(infoPO.getFieldName())) {
|
|
|
|
|
historyDetailPO.setOperateDetail(infoPO.getFieldNameDesc() + "为必填项");
|
|
|
|
|
historyDetailPO.setStatus("0");
|
|
|
|
|
saveImportDetailLog(historyDetailPO);
|
|
|
|
@ -980,7 +991,14 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
// 自动编号
|
|
|
|
|
deptNo = DepartmentServiceImpl.repeatDetermine(deptNo);
|
|
|
|
|
try {
|
|
|
|
|
deptNo = DepartmentServiceImpl.repeatDetermine(deptNo);
|
|
|
|
|
} catch (OrganizationRunTimeException e) {
|
|
|
|
|
historyDetailPO.setOperateDetail(e.getMessage());
|
|
|
|
|
historyDetailPO.setStatus("0");
|
|
|
|
|
saveImportDetailLog(historyDetailPO);
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
map.put("dept_no", deptNo);
|
|
|
|
|
map.put("creator", user.getUID());
|
|
|
|
|
map.put("delete_type", 0);
|
|
|
|
@ -1101,7 +1119,7 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
|
|
|
|
|
} else {
|
|
|
|
|
ExtendInfoPO infoPO = extendInfoPOS.get(cellIndex);
|
|
|
|
|
// 数据校验
|
|
|
|
|
if (infoPO.getIsrequired() == 1 && StringUtils.isBlank(cellValue)) {
|
|
|
|
|
if (infoPO.getIsrequired() == 1 && StringUtils.isBlank(cellValue) && !"job_no".equalsIgnoreCase(infoPO.getFieldName())) {
|
|
|
|
|
historyDetailPO.setOperateDetail(infoPO.getFieldNameDesc() + "为必填项");
|
|
|
|
|
historyDetailPO.setStatus("0");
|
|
|
|
|
saveImportDetailLog(historyDetailPO);
|
|
|
|
@ -1221,7 +1239,14 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
// 自动编号
|
|
|
|
|
jobNo = JobServiceImpl.repeatDetermine(jobNo);
|
|
|
|
|
try {
|
|
|
|
|
jobNo = JobServiceImpl.repeatDetermine(jobNo);
|
|
|
|
|
} catch (OrganizationRunTimeException e) {
|
|
|
|
|
historyDetailPO.setOperateDetail(e.getMessage());
|
|
|
|
|
historyDetailPO.setStatus("0");
|
|
|
|
|
saveImportDetailLog(historyDetailPO);
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
map.put("job_no", jobNo);
|
|
|
|
|
map.put("creator", user.getUID());
|
|
|
|
|
map.put("delete_type", 0);
|
|
|
|
@ -1350,7 +1375,7 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
|
|
|
|
|
} else {
|
|
|
|
|
ExtendInfoPO infoPO = extendInfoPOS.get(cellIndex);
|
|
|
|
|
// 数据校验
|
|
|
|
|
if (infoPO.getIsrequired() == 1 && StringUtils.isBlank(cellValue)) {
|
|
|
|
|
if (infoPO.getIsrequired() == 1 && StringUtils.isBlank(cellValue) && !"work_code".equalsIgnoreCase(infoPO.getFieldName())) {
|
|
|
|
|
historyDetailPO.setOperateDetail(infoPO.getFieldNameDesc() + "为必填项");
|
|
|
|
|
historyDetailPO.setStatus("0");
|
|
|
|
|
saveImportDetailLog(historyDetailPO);
|
|
|
|
@ -1466,7 +1491,7 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
String keyFieldValue = Util.null2String(map.get(keyField));
|
|
|
|
|
if(StringUtils.isBlank(keyFieldValue)){
|
|
|
|
|
if (StringUtils.isBlank(keyFieldValue)) {
|
|
|
|
|
historyDetailPO.setOperateDetail("所选重复验证字段为空");
|
|
|
|
|
historyDetailPO.setStatus("0");
|
|
|
|
|
saveImportDetailLog(historyDetailPO);
|
|
|
|
@ -1478,7 +1503,7 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
|
|
|
|
|
Long resourceId = MapperProxyFactory.getProxy(HrmResourceMapper.class).getIdByKeyField(keyField, keyFieldValue);
|
|
|
|
|
if ("add".equals(operateType)) {
|
|
|
|
|
if (resourceId != null) {
|
|
|
|
|
historyDetailPO.setOperateDetail(keyFieldValue+"已存在");
|
|
|
|
|
historyDetailPO.setOperateDetail(keyFieldValue + "已存在");
|
|
|
|
|
historyDetailPO.setStatus("0");
|
|
|
|
|
saveImportDetailLog(historyDetailPO);
|
|
|
|
|
continue;
|
|
|
|
@ -1488,7 +1513,14 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
|
|
|
|
|
String workCode = Util.null2String(map.get("work_code"));
|
|
|
|
|
try {
|
|
|
|
|
// 自动编号
|
|
|
|
|
workCode = HrmResourceServiceImpl.repeatDetermine(workCode);
|
|
|
|
|
try {
|
|
|
|
|
workCode = HrmResourceServiceImpl.repeatDetermine(workCode);
|
|
|
|
|
} catch (OrganizationRunTimeException e) {
|
|
|
|
|
historyDetailPO.setOperateDetail(e.getMessage());
|
|
|
|
|
historyDetailPO.setStatus("0");
|
|
|
|
|
saveImportDetailLog(historyDetailPO);
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
map.put("work_code", workCode);
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
historyDetailPO.setOperateDetail(Util.null2String(e.getMessage()));
|
|
|
|
@ -1976,12 +2008,12 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
|
|
|
|
|
object = Integer.parseInt(cellValue);
|
|
|
|
|
} else if ("float".equals(valueType)) {
|
|
|
|
|
object = Float.parseFloat(cellValue);
|
|
|
|
|
} else if ("text".equals(valueType)){
|
|
|
|
|
} else if ("text".equals(valueType)) {
|
|
|
|
|
object = cellValue;
|
|
|
|
|
} else {
|
|
|
|
|
try {
|
|
|
|
|
object = new BigDecimal(cellValue).toPlainString();
|
|
|
|
|
}catch (NumberFormatException ignore){
|
|
|
|
|
} catch (NumberFormatException ignore) {
|
|
|
|
|
object = cellValue;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -2056,7 +2088,11 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
|
|
|
|
|
* 日志导入详细信息日志
|
|
|
|
|
*/
|
|
|
|
|
private void saveImportDetailLog(JclImportHistoryDetailPO historyDetailPO) {
|
|
|
|
|
String detailMsg = "导入第" + historyDetailPO.getRowNums() + "行数据,[" + historyDetailPO.getRelatedName() + "]" + historyDetailPO.getOperateDetail();
|
|
|
|
|
String relatedName = historyDetailPO.getRelatedName();
|
|
|
|
|
if (StringUtils.isNotBlank(relatedName)) {
|
|
|
|
|
relatedName = "[" + relatedName + "]";
|
|
|
|
|
}
|
|
|
|
|
String detailMsg = "导入第" + historyDetailPO.getRowNums() + "行数据," + relatedName + historyDetailPO.getOperateDetail();
|
|
|
|
|
historyDetailPO.setOperateDetail(detailMsg);
|
|
|
|
|
MapperProxyFactory.getProxy(JclImportHistoryDetailMapper.class).insertHistoryDetail(historyDetailPO);
|
|
|
|
|
}
|
|
|
|
@ -2090,34 +2126,34 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
|
|
|
|
|
departmentColumn = column;
|
|
|
|
|
iterator.remove();
|
|
|
|
|
}
|
|
|
|
|
if("方案编号".equals(column)){
|
|
|
|
|
if ("方案编号".equals(column)) {
|
|
|
|
|
schemeList.add(column);
|
|
|
|
|
levelList.add(column);
|
|
|
|
|
gradeList.add(column);
|
|
|
|
|
}
|
|
|
|
|
if("方案名称".equals(column)){
|
|
|
|
|
if ("方案名称".equals(column)) {
|
|
|
|
|
schemeList.add(column);
|
|
|
|
|
}
|
|
|
|
|
if("方案说明".equals(column)){
|
|
|
|
|
if ("方案说明".equals(column)) {
|
|
|
|
|
schemeList.add(column);
|
|
|
|
|
}
|
|
|
|
|
if("职等编号".equals(column)){
|
|
|
|
|
levelList.add(0,column);
|
|
|
|
|
if ("职等编号".equals(column)) {
|
|
|
|
|
levelList.add(0, column);
|
|
|
|
|
gradeList.add(column);
|
|
|
|
|
}
|
|
|
|
|
if("职等名称".equals(column)){
|
|
|
|
|
levelList.add(1,column);
|
|
|
|
|
if ("职等名称".equals(column)) {
|
|
|
|
|
levelList.add(1, column);
|
|
|
|
|
}
|
|
|
|
|
if("职等说明".equals(column)){
|
|
|
|
|
if ("职等说明".equals(column)) {
|
|
|
|
|
levelList.add(column);
|
|
|
|
|
}
|
|
|
|
|
if("职级编号".equals(column)){
|
|
|
|
|
gradeList.add(0,column);
|
|
|
|
|
if ("职级编号".equals(column)) {
|
|
|
|
|
gradeList.add(0, column);
|
|
|
|
|
}
|
|
|
|
|
if("职级名称".equals(column)){
|
|
|
|
|
gradeList.add(1,column);
|
|
|
|
|
if ("职级名称".equals(column)) {
|
|
|
|
|
gradeList.add(1, column);
|
|
|
|
|
}
|
|
|
|
|
if("职级说明".equals(column)){
|
|
|
|
|
if ("职级说明".equals(column)) {
|
|
|
|
|
gradeList.add(column);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -2136,14 +2172,14 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
|
|
|
|
|
if ("joblevel".equals(importType)) {
|
|
|
|
|
excelSheetData.clear();
|
|
|
|
|
excelSheetData.add(schemeList);
|
|
|
|
|
ExcelUtil.genWorkbookV3(sheets,excelSheetData,0, "方案");
|
|
|
|
|
ExcelUtil.genWorkbookV3(sheets, excelSheetData, 0, "方案");
|
|
|
|
|
excelSheetData.clear();
|
|
|
|
|
excelSheetData.add(levelList);
|
|
|
|
|
ExcelUtil.genWorkbookV3(sheets,excelSheetData,1, "职等");
|
|
|
|
|
ExcelUtil.genWorkbookV3(sheets, excelSheetData, 1, "职等");
|
|
|
|
|
excelSheetData.clear();
|
|
|
|
|
excelSheetData.add(gradeList);
|
|
|
|
|
ExcelUtil.genWorkbookV3(sheets,excelSheetData,2, "职级");
|
|
|
|
|
}else{
|
|
|
|
|
ExcelUtil.genWorkbookV3(sheets, excelSheetData, 2, "职级");
|
|
|
|
|
} else {
|
|
|
|
|
sheets = ExcelUtil.genWorkbookV2(excelSheetData, importType);
|
|
|
|
|
}
|
|
|
|
|
String excelPath = outPutPath + File.separator + importType + ".xls";
|
|
|
|
|