|
|
|
@ -29,6 +29,7 @@ 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.employee.EmployeeMapper;
|
|
|
|
|
import com.engine.organization.mapper.extend.ExtMapper;
|
|
|
|
|
import com.engine.organization.mapper.extend.ExtendInfoMapper;
|
|
|
|
|
import com.engine.organization.mapper.hrmresource.HrmResourceMapper;
|
|
|
|
@ -46,6 +47,7 @@ import com.engine.organization.util.OrganizationAssert;
|
|
|
|
|
import com.engine.organization.util.db.MapperProxyFactory;
|
|
|
|
|
import com.engine.organization.util.excel.ExcelUtil;
|
|
|
|
|
import com.engine.organization.util.relation.EcHrmRelationUtil;
|
|
|
|
|
import org.apache.commons.collections.CollectionUtils;
|
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
|
import org.apache.poi.hssf.usermodel.HSSFDateUtil;
|
|
|
|
|
import org.apache.poi.xssf.usermodel.XSSFCell;
|
|
|
|
@ -695,8 +697,13 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
|
|
|
|
|
XSSFCell cell = row.getCell((short) cellIndex);
|
|
|
|
|
String cellValue = getCellValue(cell).trim();
|
|
|
|
|
if (i == 0) {
|
|
|
|
|
List<ExtendInfoPO> infoPOList = getExtendInfoMapper().getInfoByExtendAndLabelName(COMPANY_TYPE, cellValue);
|
|
|
|
|
boolean isBreak = isBreak(historyDetailPO, cellValue, infoPOList);
|
|
|
|
|
if (isBreak) {
|
|
|
|
|
break nextRow;
|
|
|
|
|
}
|
|
|
|
|
// 首行 初始化字段信息
|
|
|
|
|
ExtendInfoPO extendInfoPO = getExtendInfoMapper().getInfoByExtendAndLabelName(COMPANY_TYPE, cellValue);
|
|
|
|
|
ExtendInfoPO extendInfoPO = infoPOList.get(0);
|
|
|
|
|
extendInfoPOS.add(extendInfoPO);
|
|
|
|
|
} else {
|
|
|
|
|
ExtendInfoPO infoPO = extendInfoPOS.get(cellIndex);
|
|
|
|
@ -751,6 +758,13 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
|
|
|
|
|
companyName = split[split.length - 1];
|
|
|
|
|
map.put("comp_name", companyName);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ("comp_principal".equals(infoPO.getFieldName())) {
|
|
|
|
|
boolean hasSameName = hasSameName(historyDetailPO, cellValue);
|
|
|
|
|
if (hasSameName) {
|
|
|
|
|
continue nextRow;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// 校验、数据交互
|
|
|
|
@ -890,7 +904,12 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
|
|
|
|
|
String cellValue = getCellValue(cell).trim();
|
|
|
|
|
if (i == 0) {
|
|
|
|
|
// 首行 初始化字段信息
|
|
|
|
|
ExtendInfoPO extendInfoPO = getExtendInfoMapper().getInfoByExtendAndLabelName(DEPARTMENT_TYPE, cellValue);
|
|
|
|
|
List<ExtendInfoPO> infoPOList = getExtendInfoMapper().getInfoByExtendAndLabelName(DEPARTMENT_TYPE, cellValue);
|
|
|
|
|
boolean isBreak = isBreak(historyDetailPO, cellValue, infoPOList);
|
|
|
|
|
if (isBreak) {
|
|
|
|
|
break nextRow;
|
|
|
|
|
}
|
|
|
|
|
ExtendInfoPO extendInfoPO = infoPOList.get(0);
|
|
|
|
|
extendInfoPOS.add(extendInfoPO);
|
|
|
|
|
} else {
|
|
|
|
|
ExtendInfoPO infoPO = extendInfoPOS.get(cellIndex);
|
|
|
|
@ -975,6 +994,12 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
|
|
|
|
|
departmentName = split[split.length - 1];
|
|
|
|
|
map.put("dept_name", departmentName);
|
|
|
|
|
}
|
|
|
|
|
if ("dept_principal".equals(infoPO.getFieldName())) {
|
|
|
|
|
boolean hasSameName = hasSameName(historyDetailPO, cellValue);
|
|
|
|
|
if (hasSameName) {
|
|
|
|
|
continue nextRow;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// 校验、数据交互
|
|
|
|
@ -1114,7 +1139,12 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
|
|
|
|
|
String cellValue = getCellValue(cell).trim();
|
|
|
|
|
if (i == 0) {
|
|
|
|
|
// 首行 初始化字段信息
|
|
|
|
|
ExtendInfoPO extendInfoPO = getExtendInfoMapper().getInfoByExtendAndLabelName(JOB_TYPE, cellValue);
|
|
|
|
|
List<ExtendInfoPO> infoPOList = getExtendInfoMapper().getInfoByExtendAndLabelName(JOB_TYPE, cellValue);
|
|
|
|
|
boolean isBreak = isBreak(historyDetailPO, cellValue, infoPOList);
|
|
|
|
|
if (isBreak) {
|
|
|
|
|
break nextRow;
|
|
|
|
|
}
|
|
|
|
|
ExtendInfoPO extendInfoPO = infoPOList.get(0);
|
|
|
|
|
extendInfoPOS.add(extendInfoPO);
|
|
|
|
|
} else {
|
|
|
|
|
ExtendInfoPO infoPO = extendInfoPOS.get(cellIndex);
|
|
|
|
@ -1370,7 +1400,12 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
|
|
|
|
|
String cellValue = getCellValue(cell).trim();
|
|
|
|
|
if (i == 0) {
|
|
|
|
|
// 首行 初始化字段信息
|
|
|
|
|
ExtendInfoPO extendInfoPO = getExtendInfoMapper().getInfoByExtendAndLabelName(RESOURCE_TYPE, cellValue);
|
|
|
|
|
List<ExtendInfoPO> infoPOList = getExtendInfoMapper().getInfoByExtendAndLabelName(RESOURCE_TYPE, cellValue);
|
|
|
|
|
boolean isBreak = isBreak(historyDetailPO, cellValue, infoPOList);
|
|
|
|
|
if (isBreak) {
|
|
|
|
|
break nextRow;
|
|
|
|
|
}
|
|
|
|
|
ExtendInfoPO extendInfoPO = infoPOList.get(0);
|
|
|
|
|
extendInfoPOS.add(extendInfoPO);
|
|
|
|
|
} else {
|
|
|
|
|
ExtendInfoPO infoPO = extendInfoPOS.get(cellIndex);
|
|
|
|
@ -2205,4 +2240,53 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
|
|
|
|
|
return "1".equals(Util.null2String(resultMap.get("status"))) || "1".equals(Util.null2String(resultMap.get("sign")));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 判断表头是否正确
|
|
|
|
|
*
|
|
|
|
|
* @param historyDetailPO
|
|
|
|
|
* @param cellValue
|
|
|
|
|
* @param infoPOList
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
private boolean isBreak(JclImportHistoryDetailPO historyDetailPO, String cellValue, List<ExtendInfoPO> infoPOList) {
|
|
|
|
|
String operateDetail = "";
|
|
|
|
|
if (CollectionUtils.isEmpty(infoPOList)) {
|
|
|
|
|
operateDetail = "[" + cellValue + "]未找到对应字段";
|
|
|
|
|
}
|
|
|
|
|
if (infoPOList.size() > 1) {
|
|
|
|
|
operateDetail = "[" + cellValue + "]在表中定义多个,请修改后重新导入";
|
|
|
|
|
}
|
|
|
|
|
if (StringUtils.isNotBlank(operateDetail)) {
|
|
|
|
|
historyDetailPO.setOperateDetail(operateDetail);
|
|
|
|
|
historyDetailPO.setStatus("0");
|
|
|
|
|
saveImportDetailLog(historyDetailPO);
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 判断负责人是否有重名人员、若有重复人员、给出反馈信息。不处理该条数据
|
|
|
|
|
*
|
|
|
|
|
* @param historyDetailPO
|
|
|
|
|
* @param cellValue
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
private boolean hasSameName(JclImportHistoryDetailPO historyDetailPO, String cellValue) {
|
|
|
|
|
String operateDetail = "";
|
|
|
|
|
List<Long> resourceIds = MapperProxyFactory.getProxy(EmployeeMapper.class).getResourceIdsByName(cellValue);
|
|
|
|
|
if (CollectionUtils.isEmpty(resourceIds)) {
|
|
|
|
|
operateDetail = "[" + cellValue + "]未找到对应人员";
|
|
|
|
|
}
|
|
|
|
|
if (resourceIds.size() > 1) {
|
|
|
|
|
operateDetail = "[" + cellValue + "]查询到多个人员,请在导入完成后自行执行该负责人";
|
|
|
|
|
}
|
|
|
|
|
if (StringUtils.isNotBlank(operateDetail)) {
|
|
|
|
|
historyDetailPO.setOperateDetail(operateDetail);
|
|
|
|
|
historyDetailPO.setStatus("0");
|
|
|
|
|
saveImportDetailLog(historyDetailPO);
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|