Merge pull request '人员导入逻辑重写' (#87) from feature/dxf into develop
Reviewed-on: http://221.226.25.34:3000/liang.cheng/weaver-hrm-organization/pulls/87
This commit is contained in:
commit
ea8a48099f
|
|
@ -66,8 +66,7 @@ public class HrmPersonnelCardServiceImpl extends Service implements HrmPersonnel
|
|||
|
||||
// 获取类型分组信息
|
||||
List<CusTreeFormPO> cusTreeForms = getPersonnelCardMapper().getCusTreeForms(0);
|
||||
// TODO 权限过滤
|
||||
//cusTreeForms.removeIf(item -> !hasGroupAccess(item.getId(), userInfo.getEcId()));
|
||||
cusTreeForms.removeIf(item -> !hasGroupAccess(item.getId(), userInfo.getEcId()));
|
||||
List<FormItem> formItemList = new ArrayList<>();
|
||||
try {
|
||||
for (CusTreeFormPO cusTreeForm : cusTreeForms) {
|
||||
|
|
|
|||
|
|
@ -7,14 +7,12 @@ import com.api.browser.util.ConditionType;
|
|||
import com.cloudstore.eccom.result.WeaResultMsg;
|
||||
import com.engine.core.impl.Service;
|
||||
import com.engine.organization.component.OrganizationWeaTable;
|
||||
import com.engine.organization.entity.commom.RecordInfo;
|
||||
import com.engine.organization.entity.extend.ExtendInfoOperateType;
|
||||
import com.engine.organization.entity.extend.param.ExtendInfoParams;
|
||||
import com.engine.organization.entity.extend.po.ExtendInfoPO;
|
||||
import com.engine.organization.entity.fieldset.param.FieldTransferParam;
|
||||
import com.engine.organization.entity.jclimport.po.JclImportHistoryDetailPO;
|
||||
import com.engine.organization.entity.jclimport.vo.JclImportHistoryDetailVO;
|
||||
import com.engine.organization.entity.job.po.JobPO;
|
||||
import com.engine.organization.entity.scheme.po.GradePO;
|
||||
import com.engine.organization.entity.scheme.po.LevelPO;
|
||||
import com.engine.organization.entity.scheme.po.SchemePO;
|
||||
|
|
@ -35,7 +33,6 @@ import com.engine.organization.mapper.scheme.GradeMapper;
|
|||
import com.engine.organization.mapper.scheme.LevelMapper;
|
||||
import com.engine.organization.mapper.scheme.SchemeMapper;
|
||||
import com.engine.organization.service.ImportCommonService;
|
||||
import com.engine.organization.thread.HrmResourceTriggerRunnable;
|
||||
import com.engine.organization.thread.JobTriggerRunnable;
|
||||
import com.engine.organization.thread.OrganizationSyncEc;
|
||||
import com.engine.organization.util.HasRightUtil;
|
||||
|
|
@ -45,6 +42,7 @@ import com.engine.organization.util.excel.ExcelUtil;
|
|||
import com.engine.organization.util.saveimport.CompanyImport;
|
||||
import com.engine.organization.util.saveimport.DepartmentImport;
|
||||
import com.engine.organization.util.saveimport.OrgImportUtil;
|
||||
import com.engine.organization.util.saveimport.ResourceImport;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.poi.hssf.usermodel.HSSFDateUtil;
|
||||
|
|
@ -111,8 +109,6 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
|
|||
String tableName = "";
|
||||
String errorMsg = "";
|
||||
List<String> excludeFields = new ArrayList<>();
|
||||
//List<FieldTransferParam> includeFields = new ArrayList<>();
|
||||
//List<String> selectedList = new ArrayList<>();
|
||||
Map<String, Object> returnMaps = new HashMap<>();
|
||||
if (StringUtils.isNotBlank(importType)) {
|
||||
switch (importType) {
|
||||
|
|
@ -128,18 +124,14 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
|
|||
excludeFields.add("showid");
|
||||
return DepartmentImport.getImportFields(user, excludeFields);
|
||||
case "jobtitle":
|
||||
extendType = "3";
|
||||
tableName = "JCL_ORG_JOB";
|
||||
excludeFields.add("parent_job");
|
||||
break;
|
||||
case "resource":
|
||||
extendType = "4";
|
||||
tableName = "JCL_ORG_HRMRESOURCE";
|
||||
excludeFields.add("scheme_id");
|
||||
excludeFields.add("sequence_id");
|
||||
excludeFields.add("job_grade");
|
||||
excludeFields.add("job_level");
|
||||
break;
|
||||
excludeFields.add("resourceimageid");
|
||||
excludeFields.add("messagerurl");
|
||||
excludeFields.add("workyear");
|
||||
excludeFields.add("companyworkyear");
|
||||
excludeFields.add("textfield1");
|
||||
excludeFields.add("textfield2");
|
||||
return ResourceImport.getImportFields(user, excludeFields);
|
||||
case "joblevel":
|
||||
extendType = "0";
|
||||
tableName = "JCL_ORG_SCHEME";
|
||||
|
|
@ -201,10 +193,10 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
|
|||
returnMap.put("condition", DepartmentImport.importForm(user, templatePath));
|
||||
break;
|
||||
case "jobtitle":
|
||||
returnMap.put("condition", getJobTitleImportForm(templatePath));
|
||||
break;
|
||||
//returnMap.put("condition", getJobTitleImportForm(templatePath));
|
||||
//break;
|
||||
case "resource":
|
||||
returnMap.put("condition", getResourceImportForm(templatePath));
|
||||
returnMap.put("condition", ResourceImport.importForm(user, templatePath));
|
||||
break;
|
||||
case "joblevel":
|
||||
returnMap.put("condition", getJobLevelImportForm(templatePath));
|
||||
|
|
@ -243,7 +235,7 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
|
|||
returnMap.put("pId", jobImport(operateType, excelFile));
|
||||
break;
|
||||
case "resource":
|
||||
returnMap.put("pId", hrmResourceImport(operateType, excelFile, keyField));
|
||||
returnMap.put("pId", ResourceImport.saveImport(operateType, excelFile, user, request));
|
||||
break;
|
||||
case "joblevel":
|
||||
returnMap.put("pId", jobLevelImport(operateType, excelFile));
|
||||
|
|
@ -299,65 +291,6 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
|
|||
return returnMap;
|
||||
}
|
||||
|
||||
|
||||
private List<Object> getJobTitleImportForm(String templatePath) throws IOException {
|
||||
|
||||
// 返回导入数据
|
||||
List<Object> lsGroup = new ArrayList<>();
|
||||
Map<String, Object> groupItem = new HashMap<>();
|
||||
List<Object> itemList = new ArrayList<>();
|
||||
|
||||
groupItem.put("title", SystemEnv.getHtmlLabelName(1361, user.getLanguage()));
|
||||
groupItem.put("defaultshow", true);
|
||||
|
||||
SearchConditionItem searchConditionItem;
|
||||
ConditionFactory conditionFactory = new ConditionFactory(user);
|
||||
|
||||
//导入类型
|
||||
List<SearchConditionOption> statusOptions = new ArrayList<>();
|
||||
statusOptions.add(new SearchConditionOption("add", SystemEnv.getHtmlLabelName(611, user.getLanguage()), true));
|
||||
statusOptions.add(new SearchConditionOption("update", SystemEnv.getHtmlLabelName(17744, user.getLanguage())));
|
||||
searchConditionItem = conditionFactory.createCondition(ConditionType.SELECT, 24863, "importType", statusOptions);
|
||||
searchConditionItem.setValue("add");
|
||||
itemList.add(searchConditionItem);
|
||||
|
||||
//模板文件
|
||||
searchConditionItem = conditionFactory.createCondition(ConditionType.INPUT, 28576, "templet");
|
||||
searchConditionItem.setValue(templatePath);
|
||||
itemList.add(searchConditionItem);
|
||||
|
||||
//Excel文件
|
||||
searchConditionItem = conditionFactory.createCondition(ConditionType.RESOURCEIMG, 16630, "excelfile");
|
||||
itemList.add(searchConditionItem);
|
||||
|
||||
groupItem.put("items", itemList);
|
||||
lsGroup.add(groupItem);
|
||||
|
||||
|
||||
itemList = new ArrayList<>();
|
||||
groupItem = new HashMap<>();
|
||||
groupItem.put("title", SystemEnv.getHtmlLabelName(33803, Util.getIntValue(user.getLanguage())));
|
||||
groupItem.put("defaultshow", true);
|
||||
List<Integer> lsPromptLabel = new ArrayList<>(); //提示信息
|
||||
lsPromptLabel.add(34275);
|
||||
lsPromptLabel.add(125452);
|
||||
|
||||
for (int i = 0; i < lsPromptLabel.size(); i++) {
|
||||
Map<String, Object> item = new HashMap<>();
|
||||
item.put("index", (i + 1));
|
||||
String value = Util.toScreen(SystemEnv.getHtmlLabelName(lsPromptLabel.get(i), user.getLanguage()), user.getLanguage());
|
||||
if (i == 0) {
|
||||
value += SystemEnv.getHtmlLabelName(28576, user.getLanguage());
|
||||
item.put("link", templatePath);
|
||||
}
|
||||
item.put("value", value);
|
||||
itemList.add(item);
|
||||
}
|
||||
groupItem.put("items", itemList);
|
||||
lsGroup.add(groupItem);
|
||||
return lsGroup;
|
||||
}
|
||||
|
||||
private List<Object> getJobLevelImportForm(String templatePath) throws IOException {
|
||||
|
||||
// 返回导入数据
|
||||
|
|
@ -420,84 +353,6 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
|
|||
return lsGroup;
|
||||
}
|
||||
|
||||
private List<Object> getResourceImportForm(String templatePath) throws IOException {
|
||||
|
||||
// 返回导入数据
|
||||
List<Object> lsGroup = new ArrayList<>();
|
||||
Map<String, Object> groupItem = new HashMap<>();
|
||||
List<Object> itemList = new ArrayList<>();
|
||||
|
||||
groupItem.put("title", SystemEnv.getHtmlLabelName(1361, user.getLanguage()));
|
||||
groupItem.put("defaultshow", true);
|
||||
|
||||
SearchConditionItem searchConditionItem;
|
||||
ConditionFactory conditionFactory = new ConditionFactory(user);
|
||||
|
||||
//重复验证字段
|
||||
List<SearchConditionOption> statusOptions = new ArrayList<>();
|
||||
statusOptions.add(new SearchConditionOption("last_name", SystemEnv.getHtmlLabelName(413, user.getLanguage())));
|
||||
statusOptions.add(new SearchConditionOption("work_code", SystemEnv.getHtmlLabelName(714, user.getLanguage()), true));
|
||||
//statusOptions.add(new SearchConditionOption("loginid", SystemEnv.getHtmlLabelName(412, user.getLanguage())));
|
||||
searchConditionItem = conditionFactory.createCondition(ConditionType.SELECT, 24638, "keyField", statusOptions);
|
||||
searchConditionItem.setValue("last_name");
|
||||
itemList.add(searchConditionItem);
|
||||
|
||||
//导入类型
|
||||
List<SearchConditionOption> statusOptions1 = new ArrayList<>();
|
||||
statusOptions1.add(new SearchConditionOption("add", SystemEnv.getHtmlLabelName(611, user.getLanguage()), true));
|
||||
statusOptions1.add(new SearchConditionOption("update", SystemEnv.getHtmlLabelName(17744, user.getLanguage())));
|
||||
searchConditionItem = conditionFactory.createCondition(ConditionType.SELECT, 24863, "importType", statusOptions1);
|
||||
searchConditionItem.setValue("add");
|
||||
itemList.add(searchConditionItem);
|
||||
|
||||
//模板文件
|
||||
searchConditionItem = conditionFactory.createCondition(ConditionType.INPUT, 28576, "templet");
|
||||
searchConditionItem.setValue(templatePath);
|
||||
itemList.add(searchConditionItem);
|
||||
|
||||
//Excel文件
|
||||
searchConditionItem = conditionFactory.createCondition(ConditionType.RESOURCEIMG, 16630, "excelfile");
|
||||
itemList.add(searchConditionItem);
|
||||
|
||||
groupItem.put("items", itemList);
|
||||
lsGroup.add(groupItem);
|
||||
|
||||
|
||||
itemList = new ArrayList<>();
|
||||
groupItem = new HashMap<>();
|
||||
groupItem.put("title", SystemEnv.getHtmlLabelName(33803, Util.getIntValue(user.getLanguage())));
|
||||
groupItem.put("defaultshow", true);
|
||||
List<Integer> lsPromptLabel = new ArrayList<>(); //提示信息
|
||||
lsPromptLabel.add(128520);
|
||||
lsPromptLabel.add(125868);
|
||||
lsPromptLabel.add(128365);
|
||||
//lsPromptLabel.add(81697);
|
||||
//lsPromptLabel.add(81698);
|
||||
lsPromptLabel.add(81699);
|
||||
lsPromptLabel.add(516263);
|
||||
//lsPromptLabel.add(81701);
|
||||
//lsPromptLabel.add(388880);
|
||||
lsPromptLabel.add(81702);
|
||||
lsPromptLabel.add(81703);
|
||||
lsPromptLabel.add(125869);
|
||||
|
||||
for (int i = 0; i < lsPromptLabel.size(); i++) {
|
||||
Map<String, Object> item = new HashMap<>();
|
||||
item.put("index", (i + 1));
|
||||
String value = Util.toScreen(SystemEnv.getHtmlLabelName(lsPromptLabel.get(i), user.getLanguage()), user.getLanguage());
|
||||
if (i == 0) {
|
||||
value += SystemEnv.getHtmlLabelName(28576, user.getLanguage());
|
||||
item.put("link", templatePath);
|
||||
}
|
||||
item.put("value", value);
|
||||
itemList.add(item);
|
||||
}
|
||||
groupItem.put("items", itemList);
|
||||
lsGroup.add(groupItem);
|
||||
return lsGroup;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 岗位导入
|
||||
*/
|
||||
|
|
@ -764,270 +619,6 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
|
|||
return importHistoryId;
|
||||
}
|
||||
|
||||
private Long hrmResourceImport(String operateType, String excelFile, String keyField) {
|
||||
Long importHistoryId = OrgImportUtil.saveImportLog("resource", operateType, user);
|
||||
JclImportHistoryDetailPO historyDetailPO;
|
||||
|
||||
ImageFileManager manager = new ImageFileManager();
|
||||
manager.getImageFileInfoById(Util.getIntValue(excelFile));
|
||||
XSSFWorkbook workbook;
|
||||
try {
|
||||
workbook = new XSSFWorkbook(manager.getInputStream());
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
// 当前sheet
|
||||
XSSFSheet sheetAt = workbook.getSheetAt(0);
|
||||
int lastRow = sheetAt.getLastRowNum();
|
||||
List<ExtendInfoPO> extendInfoPOS = new ArrayList<>();
|
||||
OrganizationAssert.isTrue(lastRow > 0, "导入数据为空");
|
||||
short lastCellNum = sheetAt.getRow(0).getLastCellNum();
|
||||
|
||||
// 遍历每一行数据
|
||||
nextRow:
|
||||
for (int i = 0; i <= lastRow; i++) {
|
||||
historyDetailPO = new JclImportHistoryDetailPO();
|
||||
historyDetailPO.setPid(importHistoryId);
|
||||
XSSFRow row = sheetAt.getRow(i);
|
||||
if (null == row) {
|
||||
continue;
|
||||
}
|
||||
// 组装待处理数据
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
Integer parentCompanyId = null;
|
||||
Integer parentDepartmentId = null;
|
||||
Long parentJobId = null;
|
||||
|
||||
historyDetailPO.setRowNums(String.valueOf(i + 1));
|
||||
for (int cellIndex = 0; cellIndex < lastCellNum; cellIndex++) {
|
||||
XSSFCell cell = row.getCell((short) cellIndex);
|
||||
String cellValue = getCellValue(cell).trim();
|
||||
if (i == 0) {
|
||||
// 首行 初始化字段信息
|
||||
List<ExtendInfoPO> infoPOList = getExtendInfoMapper().getInfoByExtendAndLabelName(RESOURCE_TYPE, cellValue);
|
||||
boolean isBreak = OrgImportUtil.isBreak(historyDetailPO, cellValue, infoPOList);
|
||||
if (isBreak) {
|
||||
break nextRow;
|
||||
}
|
||||
ExtendInfoPO extendInfoPO = infoPOList.get(0);
|
||||
extendInfoPOS.add(extendInfoPO);
|
||||
} else {
|
||||
ExtendInfoPO infoPO = extendInfoPOS.get(cellIndex);
|
||||
// 数据校验
|
||||
if (infoPO.getIsrequired() == 1 && StringUtils.isBlank(cellValue) && !"work_code".equalsIgnoreCase(infoPO.getFieldName())) {
|
||||
historyDetailPO.setOperateDetail(infoPO.getFieldNameDesc() + "为必填项");
|
||||
historyDetailPO.setStatus("0");
|
||||
OrgImportUtil.saveImportDetailLog(historyDetailPO);
|
||||
continue nextRow;
|
||||
}
|
||||
|
||||
Object reallyValue;
|
||||
try {
|
||||
reallyValue = OrgImportUtil.getReallyValue(infoPO, cellValue);
|
||||
} catch (Exception e) {
|
||||
historyDetailPO.setOperateDetail(cellValue + "转换失败");
|
||||
historyDetailPO.setStatus("0");
|
||||
OrgImportUtil.saveImportDetailLog(historyDetailPO);
|
||||
continue nextRow;
|
||||
}
|
||||
if (StringUtils.isNotBlank(cellValue) && StringUtils.isBlank(Util.null2String(reallyValue)) && !"ec_company".equals(infoPO.getFieldName()) && !"ec_department".equals(infoPO.getFieldName()) && !"job_title".equals(infoPO.getFieldName())) {
|
||||
historyDetailPO.setOperateDetail(infoPO.getFieldNameDesc() + "数据转换失败,未找到对应数据");
|
||||
historyDetailPO.setStatus("0");
|
||||
OrgImportUtil.saveImportDetailLog(historyDetailPO);
|
||||
continue nextRow;
|
||||
}
|
||||
map.put(infoPO.getFieldName(), reallyValue);
|
||||
// 上级分部
|
||||
if ("ec_company".equals(infoPO.getFieldName())) {
|
||||
String[] split = cellValue.split(">");
|
||||
if (split.length > 0) {
|
||||
if (split.length > 8) {
|
||||
historyDetailPO.setOperateDetail("分部层级不能大于10");
|
||||
historyDetailPO.setStatus("0");
|
||||
OrgImportUtil.saveImportDetailLog(historyDetailPO);
|
||||
continue nextRow;
|
||||
}
|
||||
for (String s : split) {
|
||||
parentCompanyId = MapperProxyFactory.getProxy(CompMapper.class).getIdByNameAndPid(s, parentCompanyId == null ? 0 : parentCompanyId);
|
||||
if (null == parentCompanyId) {
|
||||
historyDetailPO.setOperateDetail(cellValue + "分部未找到对应数据");
|
||||
historyDetailPO.setStatus("0");
|
||||
OrgImportUtil.saveImportDetailLog(historyDetailPO);
|
||||
continue nextRow;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ("ec_department".equals(infoPO.getFieldName())) {
|
||||
String[] split = cellValue.split(">");
|
||||
if (split.length > 0) {
|
||||
if (split.length > 8) {
|
||||
historyDetailPO.setOperateDetail("部门层级不能大于10");
|
||||
historyDetailPO.setStatus("0");
|
||||
OrgImportUtil.saveImportDetailLog(historyDetailPO);
|
||||
continue nextRow;
|
||||
}
|
||||
for (String s : split) {
|
||||
parentDepartmentId = MapperProxyFactory.getProxy(DepartmentMapper.class).getIdByNameAndPid(s, parentCompanyId, parentDepartmentId == null ? 0 : parentDepartmentId);
|
||||
if (null == parentDepartmentId) {
|
||||
historyDetailPO.setOperateDetail(cellValue + "部门未找到对应数据");
|
||||
historyDetailPO.setStatus("0");
|
||||
OrgImportUtil.saveImportDetailLog(historyDetailPO);
|
||||
continue nextRow;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ("job_title".equals(infoPO.getFieldName())) {
|
||||
if (null == parentCompanyId) {
|
||||
historyDetailPO.setOperateDetail(cellValue + "所属分部未找到");
|
||||
historyDetailPO.setStatus("0");
|
||||
OrgImportUtil.saveImportDetailLog(historyDetailPO);
|
||||
continue nextRow;
|
||||
}
|
||||
String[] split = cellValue.split(">");
|
||||
if (split.length > 0) {
|
||||
if (split.length > 8) {
|
||||
historyDetailPO.setOperateDetail("岗位层级不能大于10");
|
||||
historyDetailPO.setStatus("0");
|
||||
OrgImportUtil.saveImportDetailLog(historyDetailPO);
|
||||
continue nextRow;
|
||||
}
|
||||
for (String s : split) {
|
||||
parentJobId = MapperProxyFactory.getProxy(JobMapper.class).getIdByNameAndPid(s, parentCompanyId, parentDepartmentId == null ? 0 : parentDepartmentId, parentJobId == null ? 0 : parentJobId);
|
||||
if (null == parentJobId) {
|
||||
historyDetailPO.setOperateDetail(s + "岗位未找到对应数据");
|
||||
historyDetailPO.setStatus("0");
|
||||
OrgImportUtil.saveImportDetailLog(historyDetailPO);
|
||||
continue nextRow;
|
||||
}
|
||||
}
|
||||
}
|
||||
map.put("company_id", parentCompanyId);
|
||||
map.put("department_id", parentDepartmentId);
|
||||
map.put("ec_company", parentCompanyId);
|
||||
map.put("ec_department", parentDepartmentId);
|
||||
|
||||
map.put("job_title", parentJobId);
|
||||
}
|
||||
}
|
||||
}
|
||||
// 校验、数据交互
|
||||
if (i == 0) {
|
||||
continue;
|
||||
}
|
||||
// 根据岗位获取等级方案、岗位序列、职等、职级
|
||||
if (null != parentJobId) {
|
||||
JobPO jobById = MapperProxyFactory.getProxy(JobMapper.class).getJobById(parentJobId);
|
||||
map.put("scheme_id", jobById.getSchemeId());
|
||||
map.put("sequence_id", jobById.getSequenceId());
|
||||
map.put("job_level", jobById.getLevelId());
|
||||
map.put("job_grade", jobById.getGradeId());
|
||||
}
|
||||
|
||||
String keyFieldValue = Util.null2String(map.get(keyField));
|
||||
if (StringUtils.isBlank(keyFieldValue)) {
|
||||
historyDetailPO.setOperateDetail("所选重复验证字段为空");
|
||||
historyDetailPO.setStatus("0");
|
||||
OrgImportUtil.saveImportDetailLog(historyDetailPO);
|
||||
continue;
|
||||
}
|
||||
historyDetailPO.setRelatedName(keyFieldValue);
|
||||
// 判断当前人员是否存在
|
||||
boolean hasSameKeyFieldValue = hasSameKeyFieldValue(historyDetailPO, keyField, keyFieldValue);
|
||||
if (hasSameKeyFieldValue) {
|
||||
continue;
|
||||
}
|
||||
|
||||
Long resourceId = MapperProxyFactory.getProxy(ResourceMapper.class).getIdByKeyField(keyField, keyFieldValue).get(0);
|
||||
if ("add".equals(operateType)) {
|
||||
if (resourceId != null) {
|
||||
historyDetailPO.setOperateDetail(keyFieldValue + "已存在");
|
||||
historyDetailPO.setStatus("0");
|
||||
OrgImportUtil.saveImportDetailLog(historyDetailPO);
|
||||
continue;
|
||||
}
|
||||
|
||||
// 自动编号
|
||||
String workCode = Util.null2String(map.get("work_code"));
|
||||
try {
|
||||
// 自动编号
|
||||
try {
|
||||
workCode = HrmResourceServiceImpl.repeatDetermine(workCode);
|
||||
} catch (OrganizationRunTimeException e) {
|
||||
historyDetailPO.setOperateDetail(e.getMessage());
|
||||
historyDetailPO.setStatus("0");
|
||||
OrgImportUtil.saveImportDetailLog(historyDetailPO);
|
||||
continue;
|
||||
}
|
||||
map.put("work_code", workCode);
|
||||
} catch (Exception e) {
|
||||
historyDetailPO.setOperateDetail(Util.null2String(e.getMessage()));
|
||||
historyDetailPO.setStatus("0");
|
||||
OrgImportUtil.saveImportDetailLog(historyDetailPO);
|
||||
}
|
||||
map.put("creator", user.getUID());
|
||||
map.put("delete_type", 0);
|
||||
map.put("create_time", new Date());
|
||||
|
||||
String showOrder = Util.null2String(map.get("show_order"));
|
||||
if (StringUtils.isBlank(showOrder)) {
|
||||
Long maxShowOrder = MapperProxyFactory.getProxy(ResourceMapper.class).getMaxShowOrder();
|
||||
if (null == maxShowOrder) {
|
||||
maxShowOrder = 0L;
|
||||
}
|
||||
map.put("show_order", maxShowOrder + 1);
|
||||
}
|
||||
Map<String, Object> syncMap = new OrganizationSyncEc(user, LogModuleNameEnum.RESOURCE, OperateTypeEnum.ADD, map, false).sync();
|
||||
if (OrgImportUtil.isThrowError(syncMap) && StringUtils.isNotBlank(Util.null2String(syncMap.get("id")))) {
|
||||
String ecResourceId = Util.null2String(syncMap.get("id"));
|
||||
RecordInfo recordInfo = getSystemDataMapper().getHrmObjectByID(HRM_RESOURCE, ecResourceId);
|
||||
map.put("uuid", recordInfo.getUuid());
|
||||
ExtendInfoParams infoParams = ExtendInfoParams.builder().tableName("JCL_ORG_HRMRESOURCE").params(map).build();
|
||||
map.remove("id");
|
||||
MapperProxyFactory.getProxy(ExtMapper.class).insertTable(infoParams);
|
||||
// 更新组织架构图
|
||||
new HrmResourceTriggerRunnable(infoParams.getId()).run();
|
||||
historyDetailPO.setOperateDetail("添加成功");
|
||||
historyDetailPO.setStatus("1");
|
||||
|
||||
} else {
|
||||
historyDetailPO.setOperateDetail(Util.null2String(syncMap.get("message")));
|
||||
historyDetailPO.setStatus("0");
|
||||
}
|
||||
OrgImportUtil.saveImportDetailLog(historyDetailPO);
|
||||
} else if ("update".equals(operateType)) {
|
||||
// 查询对应ID
|
||||
if (resourceId == null) {
|
||||
historyDetailPO.setOperateDetail("未找到对应数据");
|
||||
historyDetailPO.setStatus("0");
|
||||
OrgImportUtil.saveImportDetailLog(historyDetailPO);
|
||||
continue;
|
||||
}
|
||||
map.put("update_time", new Date());
|
||||
map.put("id", resourceId);
|
||||
Map<String, Object> syncMap = new OrganizationSyncEc(user, LogModuleNameEnum.RESOURCE, OperateTypeEnum.UPDATE, map, false).sync();
|
||||
if (OrgImportUtil.isThrowError(syncMap)) {
|
||||
map.remove("id");
|
||||
MapperProxyFactory.getProxy(ExtMapper.class).updateTable(ExtendInfoParams.builder().id(resourceId).tableName("JCL_ORG_HRMRESOURCE").params(map).build());
|
||||
// 更新组织架构图
|
||||
new HrmResourceTriggerRunnable(resourceId).run();
|
||||
historyDetailPO.setOperateDetail("更新成功");
|
||||
historyDetailPO.setStatus("1");
|
||||
|
||||
} else {
|
||||
historyDetailPO.setOperateDetail(Util.null2String(syncMap.get("message")));
|
||||
historyDetailPO.setStatus("0");
|
||||
}
|
||||
OrgImportUtil.saveImportDetailLog(historyDetailPO);
|
||||
}
|
||||
}
|
||||
return importHistoryId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 方案职等职级导入
|
||||
*/
|
||||
|
|
@ -1472,20 +1063,39 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
|
|||
List<Object> gradeList = new ArrayList<>();
|
||||
Object companyColumn = "";
|
||||
Object departmentColumn = "";
|
||||
|
||||
String companyFieldName = "所属分部";
|
||||
String departmentFieldName = "所属部门";
|
||||
switch (importType) {
|
||||
case "company":
|
||||
companyFieldName = "简称";
|
||||
departmentFieldName = "";
|
||||
break;
|
||||
case "department":
|
||||
companyFieldName = "所属分部";
|
||||
departmentFieldName = "简称";
|
||||
break;
|
||||
case "resource":
|
||||
companyFieldName = "分部";
|
||||
departmentFieldName = "部门";
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
// 排序
|
||||
/*
|
||||
第一列:所属分部
|
||||
第二列:所属部门\上级部门\部门
|
||||
第一列:分部
|
||||
第二列:部门
|
||||
*/
|
||||
Iterator<Object> iterator = columnList.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
Object column = iterator.next();
|
||||
if ("所属分部".equals(column.toString())) {
|
||||
if (companyFieldName.equals(column.toString())) {
|
||||
companyColumn = column;
|
||||
iterator.remove();
|
||||
}
|
||||
|
||||
if ("所属部门".equals(column) || "上级部门".equals(column)) {
|
||||
if (departmentFieldName.equals(column)) {
|
||||
departmentColumn = column;
|
||||
iterator.remove();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,204 @@
|
|||
package com.engine.organization.util.saveimport;
|
||||
|
||||
import com.api.browser.bean.SearchConditionItem;
|
||||
import com.api.browser.bean.SearchConditionOption;
|
||||
import com.api.browser.util.ConditionFactory;
|
||||
import com.api.browser.util.ConditionType;
|
||||
import com.engine.organization.entity.fieldset.param.FieldTransferParam;
|
||||
import com.engine.organization.entity.jclimport.po.HrmFormFieldPO;
|
||||
import com.engine.organization.entity.jclimport.po.JclImportHistoryDetailPO;
|
||||
import com.engine.organization.entity.personnelcard.po.CusTreeFormPO;
|
||||
import com.engine.organization.exception.OrganizationRunTimeException;
|
||||
import com.engine.organization.mapper.jclimport.ImportMapper;
|
||||
import com.engine.organization.mapper.jclimport.JclImportHistoryDetailMapper;
|
||||
import com.engine.organization.mapper.personnelcard.PersonnelCardMapper;
|
||||
import com.engine.organization.util.db.MapperProxyFactory;
|
||||
import com.engine.organization.util.saveimport.hrmimport.HrmImportAdaptExcelE9;
|
||||
import com.engine.organization.util.saveimport.hrmimport.HrmImportProcessE9;
|
||||
import weaver.file.FileUploadToPath;
|
||||
import weaver.general.BaseBean;
|
||||
import weaver.general.Util;
|
||||
import weaver.hrm.User;
|
||||
import weaver.hrm.definedfield.HrmFieldManager;
|
||||
import weaver.join.hrm.in.HrmResourceVo;
|
||||
import weaver.systeminfo.SystemEnv;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2022/12/07
|
||||
* @version: 1.0
|
||||
*/
|
||||
public class ResourceImport {
|
||||
|
||||
private static ImportMapper getImportMapper() {
|
||||
return MapperProxyFactory.getProxy(ImportMapper.class);
|
||||
}
|
||||
|
||||
private static PersonnelCardMapper getPersonnelCardMapper() {
|
||||
return MapperProxyFactory.getProxy(PersonnelCardMapper.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入模板可选择字段
|
||||
*
|
||||
* @param user 当前用户
|
||||
* @param excludedFields 排除的字段
|
||||
*/
|
||||
public static Map<String, Object> getImportFields(User user, List<String> excludedFields) {
|
||||
|
||||
try {
|
||||
List<HrmFormFieldPO> importFields = new ArrayList<>();
|
||||
List<CusTreeFormPO> cusTreeForms = getPersonnelCardMapper().getCusTreeForms(0);
|
||||
importFields.add(HrmFormFieldPO.builder().fieldName("subcompanyid1").labelName("分部").build());
|
||||
for (CusTreeFormPO cusTreeForm : cusTreeForms) {
|
||||
HrmFieldManager hfm = new HrmFieldManager("HrmCustomFieldByInfoType", cusTreeForm.getId());
|
||||
hfm.getCustomFields();
|
||||
while (hfm.next()) {
|
||||
String fieldName = hfm.getFieldname();
|
||||
String fieldLabel = SystemEnv.getHtmlLabelNames(hfm.getLable(), user.getLanguage());
|
||||
importFields.add(HrmFormFieldPO.builder().fieldName(fieldName).labelName(fieldLabel).build());
|
||||
}
|
||||
}
|
||||
|
||||
Map<String, Object> returnMaps = new HashMap<>();
|
||||
importFields.removeIf(item -> excludedFields.contains(item.getFieldName()));
|
||||
|
||||
// 查询所有可以勾选的字段
|
||||
List<FieldTransferParam> fieldDatas = importFields.stream().map(item -> FieldTransferParam.builder().id(item.getFieldName()).name(item.getLabelName()).build()).collect(Collectors.toList());
|
||||
returnMaps.put("data", fieldDatas);
|
||||
|
||||
|
||||
// 设置必填字段
|
||||
List<String> selectedKeys = new ArrayList<>();
|
||||
selectedKeys.add("subcompanyid1");
|
||||
selectedKeys.add("departmentid");
|
||||
selectedKeys.add("lastname");
|
||||
selectedKeys.add("jobtitle");
|
||||
selectedKeys.add("jobactivity");
|
||||
selectedKeys.add("jobGroupId");
|
||||
selectedKeys.add("locationid");
|
||||
returnMaps.put("selectedKeys", selectedKeys);
|
||||
return returnMaps;
|
||||
} catch (Exception e) {
|
||||
new BaseBean().writeLog(e);
|
||||
throw new OrganizationRunTimeException("人员导入字段生成异常");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取导入模板及导入提示信息
|
||||
*
|
||||
* @param user 当前用户
|
||||
* @param templatePath 导入模板路径
|
||||
*/
|
||||
public static List<Map<String, Object>> importForm(User user, String templatePath) {
|
||||
|
||||
// 返回导入数据
|
||||
List<Map<String, Object>> lsGroup = new ArrayList<>();
|
||||
Map<String, Object> groupItem = new HashMap<>();
|
||||
List<Object> itemList = new ArrayList<>();
|
||||
|
||||
groupItem.put("title", SystemEnv.getHtmlLabelName(1361, user.getLanguage()));
|
||||
groupItem.put("defaultshow", true);
|
||||
|
||||
SearchConditionItem searchConditionItem;
|
||||
ConditionFactory conditionFactory = new ConditionFactory(user);
|
||||
|
||||
//重复验证字段
|
||||
List<SearchConditionOption> statusOptions = new ArrayList<>();
|
||||
statusOptions.add(new SearchConditionOption("last_name", SystemEnv.getHtmlLabelName(413, user.getLanguage())));
|
||||
statusOptions.add(new SearchConditionOption("work_code", SystemEnv.getHtmlLabelName(714, user.getLanguage()), true));
|
||||
//statusOptions.add(new SearchConditionOption("loginid", SystemEnv.getHtmlLabelName(412, user.getLanguage())));
|
||||
searchConditionItem = conditionFactory.createCondition(ConditionType.SELECT, 24638, "keyField", statusOptions);
|
||||
searchConditionItem.setValue("last_name");
|
||||
itemList.add(searchConditionItem);
|
||||
|
||||
//导入类型
|
||||
List<SearchConditionOption> statusOptions1 = new ArrayList<>();
|
||||
statusOptions1.add(new SearchConditionOption("add", SystemEnv.getHtmlLabelName(611, user.getLanguage()), true));
|
||||
statusOptions1.add(new SearchConditionOption("update", SystemEnv.getHtmlLabelName(17744, user.getLanguage())));
|
||||
searchConditionItem = conditionFactory.createCondition(ConditionType.SELECT, 24863, "importType", statusOptions1);
|
||||
searchConditionItem.setValue("add");
|
||||
itemList.add(searchConditionItem);
|
||||
|
||||
//模板文件
|
||||
searchConditionItem = conditionFactory.createCondition(ConditionType.INPUT, 28576, "templet");
|
||||
searchConditionItem.setValue(templatePath);
|
||||
itemList.add(searchConditionItem);
|
||||
|
||||
//Excel文件
|
||||
searchConditionItem = conditionFactory.createCondition(ConditionType.RESOURCEIMG, 16630, "excelfile");
|
||||
itemList.add(searchConditionItem);
|
||||
|
||||
groupItem.put("items", itemList);
|
||||
lsGroup.add(groupItem);
|
||||
|
||||
|
||||
itemList = new ArrayList<>();
|
||||
groupItem = new HashMap<>();
|
||||
groupItem.put("title", SystemEnv.getHtmlLabelName(33803, Util.getIntValue(user.getLanguage())));
|
||||
groupItem.put("defaultshow", true);
|
||||
List<Integer> lsPromptLabel = new ArrayList<>(); //提示信息
|
||||
lsPromptLabel.add(128520);
|
||||
lsPromptLabel.add(125868);
|
||||
lsPromptLabel.add(128365);
|
||||
//lsPromptLabel.add(81697);
|
||||
//lsPromptLabel.add(81698);
|
||||
lsPromptLabel.add(81699);
|
||||
lsPromptLabel.add(516263);
|
||||
//lsPromptLabel.add(81701);
|
||||
//lsPromptLabel.add(388880);
|
||||
lsPromptLabel.add(81702);
|
||||
lsPromptLabel.add(81703);
|
||||
lsPromptLabel.add(125869);
|
||||
|
||||
for (int i = 0; i < lsPromptLabel.size(); i++) {
|
||||
Map<String, Object> item = new HashMap<>();
|
||||
item.put("index", (i + 1));
|
||||
String value = Util.toScreen(SystemEnv.getHtmlLabelName(lsPromptLabel.get(i), user.getLanguage()), user.getLanguage());
|
||||
if (i == 0) {
|
||||
value += SystemEnv.getHtmlLabelName(28576, user.getLanguage());
|
||||
item.put("link", templatePath);
|
||||
}
|
||||
item.put("value", value);
|
||||
itemList.add(item);
|
||||
}
|
||||
groupItem.put("items", itemList);
|
||||
lsGroup.add(groupItem);
|
||||
return lsGroup;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param operateType 导入类型
|
||||
* @param excelFile 上传的文件
|
||||
* @param user 当前用户
|
||||
*/
|
||||
public static Long saveImport(String operateType, String excelFile, User user, HttpServletRequest request) {
|
||||
Long importHistoryId = OrgImportUtil.saveImportLog("resource", operateType, user);
|
||||
HrmImportAdaptExcelE9 importAdapt = new HrmImportAdaptExcelE9();
|
||||
FileUploadToPath fu = new FileUploadToPath(request);
|
||||
|
||||
List<String> errorInfo = importAdapt.creatImportMap(fu);
|
||||
|
||||
//如果读取数据和验证模板没有发生错误
|
||||
if (errorInfo.isEmpty()) {
|
||||
Map<String, HrmResourceVo> hrMap = importAdapt.getHrmImportMap();
|
||||
HrmImportProcessE9 importProcess = new HrmImportProcessE9();
|
||||
importProcess.init(request, importHistoryId);
|
||||
importProcess.processMap(hrMap);
|
||||
} else {
|
||||
for (String s : errorInfo) {
|
||||
MapperProxyFactory.getProxy(JclImportHistoryDetailMapper.class).insertHistoryDetail(JclImportHistoryDetailPO.builder().pid(importHistoryId).operateDetail(Util.null2String(s)).status("0").build());
|
||||
}
|
||||
}
|
||||
return importHistoryId;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -54,9 +54,9 @@ public class HrmImportAdaptExcelE9 extends BaseBean implements IHrmImportAdapt {
|
|||
private String[] temFields;
|
||||
|
||||
//标准模板字段
|
||||
private String tempField = "所属分部,部门," +
|
||||
private String tempField = "分部,部门," +
|
||||
"编号,姓名,登录名,密码,安全级别,性别," +
|
||||
// "岗位,职务,职务类别,职称," +
|
||||
"岗位,职务,职务类别,职称,职级," +
|
||||
"职责描述,直接上级,助理,状态," +
|
||||
"办公室,办公地点,办公电话,移动电话,其他电话," +
|
||||
"传真,电子邮件,系统语言,出生日期,民族," +
|
||||
|
|
@ -72,7 +72,7 @@ public class HrmImportAdaptExcelE9 extends BaseBean implements IHrmImportAdapt {
|
|||
private String[] requiredFields;
|
||||
|
||||
//必填列标准模板或字段下标
|
||||
// 所属分部,部门,姓名,岗位,职务,职务类别,办公地点
|
||||
// 分部,部门,姓名,岗位,职务,职务类别,办公地点
|
||||
// private String requiredField = "0,1,3,8,9,10,18";
|
||||
private final StringBuilder requiredField = new StringBuilder();
|
||||
|
||||
|
|
@ -82,7 +82,7 @@ public class HrmImportAdaptExcelE9 extends BaseBean implements IHrmImportAdapt {
|
|||
//标准导入字段
|
||||
private String voField = "subcompanyid1,departmentid," +
|
||||
"workcode,lastname,loginid,password,seclevel,sex," +
|
||||
// "jobtitle,jobactivityid,jobgroupid,jobcall," +
|
||||
"jobtitle,jobactivityid,jobgroupid,jobcall,joblevel," +
|
||||
"jobactivitydesc,managerid,assistantid,status," +
|
||||
"workroom,locationid,telephone,mobile,mobilecall," +
|
||||
"fax,email,systemlanguage,birthday,folk," +
|
||||
|
|
@ -282,8 +282,7 @@ public class HrmImportAdaptExcelE9 extends BaseBean implements IHrmImportAdapt {
|
|||
cellValue = getCellValue(cell).trim();
|
||||
for (int k = 0; k < temFields.length; k++) {
|
||||
if (cellValue.equals(temFields[k])) {
|
||||
String requiredFields = "所属分部,部门,姓名,岗位,职务,职务类别,办公地点";
|
||||
requiredFields = "所属分部,部门,登录名,姓名,性别,状态,办公地点,入职日期,参加工作日期,担任岗位,职等职级,担任职务";
|
||||
String requiredFields = "分部,部门,姓名,岗位,职务,职务类别,办公地点";
|
||||
List<String> requiredFieldList = Arrays.asList(requiredFields.split(","));
|
||||
|
||||
if (requiredFieldList.contains(cellValue)) {
|
||||
|
|
@ -307,19 +306,19 @@ public class HrmImportAdaptExcelE9 extends BaseBean implements IHrmImportAdapt {
|
|||
errorInfo.add(getCellPosition(i, (rowIndex + 1)) + "[" + cellValue + "]" + " 不是模板中字段,请检查是否有误"); //不是模板中字段,请检查是否有误
|
||||
if (importType.equals("add")) { //如果是插入操作才验证固定列
|
||||
if (i == 0 && !cellValue.equals(temFields[0]))
|
||||
errorInfo.add("分所属分部部必须在第" + (rowIndex + 1) + "行第1列"); //【所属分部】固定列
|
||||
errorInfo.add("分部必须在第" + (rowIndex + 1) + "行第1列"); //【分部】固定列
|
||||
if (i == 1 && !cellValue.equals(temFields[1]))
|
||||
errorInfo.add("部门必须在第" + (rowIndex + 1) + "行第2列"); // 【部门】固定列
|
||||
} else {
|
||||
//如果是更新,并且存在分部部门列,就规定分部、部门在第1、2列
|
||||
if (cellValue.equals(temFields[0]) && !temFields[1].equals(getCellValue(rowIndex, 1).trim()))
|
||||
errorInfo.add("更新时有分所属分部部则后一列必须为部门,且第" + (rowIndex + 1) + "行第1列为分所属分部部,第2列为部门"); //【分部】固定列
|
||||
errorInfo.add("更新时有分部则后一列必须为部门,且第" + (rowIndex + 1) + "行第1列为分部,第2列为部门"); //【分部】固定列
|
||||
else if (cellValue.equals(temFields[0]) && i != 0)
|
||||
errorInfo.add("所属分部必须在第" + (rowIndex + 1) + "行第1列"); //【分部】固定列
|
||||
errorInfo.add("分部必须在第" + (rowIndex + 1) + "行第1列"); //【分部】固定列
|
||||
|
||||
|
||||
if (cellValue.equals(temFields[1]) && !temFields[0].equals(getCellValue(rowIndex, 0).trim()))
|
||||
errorInfo.add("更新时有部门则前一列必须为所属分部,且第" + (rowIndex + 1) + "行第1列为所属分部,第2列为部门"); //【分部】固定列
|
||||
errorInfo.add("更新时有部门则前一列必须为分部,且第" + (rowIndex + 1) + "行第1列为分部,第2列为部门"); //【分部】固定列
|
||||
else if (cellValue.equals(temFields[1]) && i != 1)
|
||||
errorInfo.add("部门必须在第" + (rowIndex + 1) + "行第2列"); //【部门】固定列
|
||||
|
||||
|
|
@ -432,7 +431,7 @@ public class HrmImportAdaptExcelE9 extends BaseBean implements IHrmImportAdapt {
|
|||
|
||||
if (flag) { // 为true则,设置值,否则不需要
|
||||
|
||||
if (fieldIndex == 0 && getCellValue(1, cellNum).equals("所属分部")) { // 对于excel分部为空则取上面分部读取的值
|
||||
if (fieldIndex == 0 && getCellValue(1, cellNum).equals("分部")) { // 对于excel分部为空则取上面分部读取的值
|
||||
if (cellValue.equals(""))
|
||||
cellValue = subCompany;
|
||||
else
|
||||
|
|
@ -619,7 +618,7 @@ public class HrmImportAdaptExcelE9 extends BaseBean implements IHrmImportAdapt {
|
|||
String fieldName = voFields[fieldIndex];
|
||||
|
||||
// 人员信息第1行(模板第2行)的分部和部门为必填
|
||||
if ((rowNum == 1 || rowNum == 2) && fieldName.equals("subcompanyid1") && getCellValue(1, cellNum).equals("所属分部") && cellValue.equals("")) {
|
||||
if ((rowNum == 1 || rowNum == 2) && fieldName.equals("subcompanyid1") && getCellValue(1, cellNum).equals("分部") && cellValue.equals("")) {
|
||||
flag = false;
|
||||
msg = getCellPosition(cellNum, rowNum + 1) + "[" + temFields[fieldIndex] + "]"; //【分部】为必填
|
||||
errorInfo.add(msg + " " + SystemEnv.getHtmlLabelName(83626, userlanguage));
|
||||
|
|
@ -652,28 +651,28 @@ public class HrmImportAdaptExcelE9 extends BaseBean implements IHrmImportAdapt {
|
|||
return flag;
|
||||
}
|
||||
|
||||
//// 岗位
|
||||
//if (fieldName.equals("jobtitle") && cellValue.equals("")) {
|
||||
// flag = false;
|
||||
// msg = getCellPosition(cellNum, rowNum + 1) + "[" + temFields[fieldIndex] + "]"; //【岗位】为必填
|
||||
// errorInfo.add(msg + " " + SystemEnv.getHtmlLabelName(83626, userlanguage));
|
||||
// return flag;
|
||||
//}
|
||||
//
|
||||
//if (fieldName.equals("jobactivityid") && cellValue.equals("")) {
|
||||
// flag = false;
|
||||
// msg = getCellPosition(cellNum, rowNum + 1) + "[" + temFields[fieldIndex] + "]"; //【职务】为必填
|
||||
// errorInfo.add(msg + " " + SystemEnv.getHtmlLabelName(83626, userlanguage));
|
||||
// return flag;
|
||||
//}
|
||||
//
|
||||
//
|
||||
//if (fieldName.equals("jobgroupid") && cellValue.equals("")) {
|
||||
// flag = false;
|
||||
// msg = getCellPosition(cellNum, rowNum + 1) + "[" + temFields[fieldIndex] + "]"; //【职务类别】为必填
|
||||
// errorInfo.add(msg + " " + SystemEnv.getHtmlLabelName(83626, userlanguage));
|
||||
// return flag;
|
||||
//}
|
||||
// 岗位
|
||||
if (fieldName.equals("jobtitle") && cellValue.equals("")) {
|
||||
flag = false;
|
||||
msg = getCellPosition(cellNum, rowNum + 1) + "[" + temFields[fieldIndex] + "]"; //【岗位】为必填
|
||||
errorInfo.add(msg + " " + SystemEnv.getHtmlLabelName(83626, userlanguage));
|
||||
return flag;
|
||||
}
|
||||
|
||||
if (fieldName.equals("jobactivityid") && cellValue.equals("")) {
|
||||
flag = false;
|
||||
msg = getCellPosition(cellNum, rowNum + 1) + "[" + temFields[fieldIndex] + "]"; //【职务】为必填
|
||||
errorInfo.add(msg + " " + SystemEnv.getHtmlLabelName(83626, userlanguage));
|
||||
return flag;
|
||||
}
|
||||
|
||||
|
||||
if (fieldName.equals("jobgroupid") && cellValue.equals("")) {
|
||||
flag = false;
|
||||
msg = getCellPosition(cellNum, rowNum + 1) + "[" + temFields[fieldIndex] + "]"; //【职务类别】为必填
|
||||
errorInfo.add(msg + " " + SystemEnv.getHtmlLabelName(83626, userlanguage));
|
||||
return flag;
|
||||
}
|
||||
|
||||
|
||||
// 办公地点
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import com.engine.common.util.ParamUtil;
|
|||
import com.engine.encrypt.biz.EncryptFieldConfigComInfo;
|
||||
import com.engine.hrm.entity.RuleCodeType;
|
||||
import com.engine.hrm.util.CodeRuleManager;
|
||||
import com.engine.hrm.util.HrmTriggerUtil;
|
||||
import com.engine.hrm.util.HrmWeakPasswordUtil;
|
||||
import com.engine.hrm.util.face.HrmFaceCheckManager;
|
||||
import com.engine.hrm.util.face.ValidateFieldManager;
|
||||
|
|
@ -13,8 +14,6 @@ import com.engine.hrm.util.face.bean.CheckItemBean;
|
|||
import com.engine.organization.entity.jclimport.po.JclImportHistoryDetailPO;
|
||||
import com.engine.organization.mapper.jclimport.JclImportHistoryDetailMapper;
|
||||
import com.engine.organization.mapper.jclimport.JclImportHistoryMapper;
|
||||
import com.engine.organization.mapper.job.JobMapper;
|
||||
import com.engine.organization.thread.HrmResourceTriggerRunnable;
|
||||
import com.engine.organization.util.db.MapperProxyFactory;
|
||||
import com.weaver.integration.ldap.sync.oa.OaSync;
|
||||
import com.weaver.integration.ldap.util.AuthenticUtil;
|
||||
|
|
@ -232,8 +231,8 @@ public class HrmImportProcessE9 extends BaseBean {
|
|||
Class<HrmResourceVo> voClass = HrmResourceVo.class;
|
||||
|
||||
String field = "id,subcompanyid1,departmentid,workcode,lastname,"
|
||||
+ "loginid,password,seclevel,sex,"
|
||||
+ "managerid,assistantid,status,locationid,workroom,"
|
||||
+ "loginid,password,seclevel,sex,jobtitle,jobcall,joblevel,"
|
||||
+ "jobactivitydesc,managerid,assistantid,status,locationid,workroom,"
|
||||
+ "telephone,mobile,mobilecall,fax,email,"
|
||||
+ "systemlanguage,birthday,folk,nativeplace,regresidentplace,"
|
||||
+ "certificatenum,maritalstatus,policy,bememberdate,bepartydate,"
|
||||
|
|
@ -426,29 +425,15 @@ public class HrmImportProcessE9 extends BaseBean {
|
|||
hrm.setAccounttype(0);
|
||||
}
|
||||
|
||||
//// 岗位id
|
||||
//if (vo.getJobtitle() != null && vo.getJobactivityid() != null && vo.getJobgroupid() != null) {
|
||||
// int jobtitle = getJobTitles(vo.getJobtitle(), vo
|
||||
// .getJobactivityid(), vo.getJobgroupid());
|
||||
// /// -1:职务类别不存在,-2:职务不存在,-3:职务类别不存在
|
||||
// if (jobtitle == -1) {
|
||||
// resultList.add(createLog(vo, "创建", "失败", "职务类别不存在"));
|
||||
// continue;
|
||||
// } else if (jobtitle == -2) {
|
||||
// resultList.add(createLog(vo, "创建", "失败", "职务不存在"));
|
||||
// continue;
|
||||
// } else if (jobtitle == -3) {
|
||||
// resultList.add(createLog(vo, "创建", "失败", "岗位名称不存在"));
|
||||
// continue;
|
||||
// }
|
||||
// hrm.setJobtitle(jobtitle);
|
||||
//} else {
|
||||
// resultList.add(createLog(vo, "创建", "失败", SystemEnv.getHtmlLabelName(83531, userlanguage)));
|
||||
// continue;
|
||||
//}
|
||||
|
||||
// 担任岗位字段校验
|
||||
|
||||
// 岗位id
|
||||
if (vo.getJobtitle() != null && vo.getJobactivityid() != null && vo.getJobgroupid() != null) {
|
||||
int jobtitle = getJobTitles(vo.getJobtitle(), vo
|
||||
.getJobactivityid(), vo.getJobgroupid());
|
||||
hrm.setJobtitle(jobtitle);
|
||||
} else {
|
||||
resultList.add(createLog(vo, "创建", "失败", SystemEnv.getHtmlLabelName(83531, userlanguage)));
|
||||
continue;
|
||||
}
|
||||
|
||||
//上级id
|
||||
if (vo.getManagerid() != null) {
|
||||
|
|
@ -636,12 +621,12 @@ public class HrmImportProcessE9 extends BaseBean {
|
|||
}
|
||||
|
||||
//职级
|
||||
//if (isInteger(vo.getJoblevel())) {
|
||||
// int joblevel = vo.getJoblevel().equals("") ? 0 : Integer.parseInt(vo.getJoblevel());
|
||||
// hrm.setJoblevel((short) joblevel);
|
||||
//} else {
|
||||
// hrm.setJoblevel((short) 0);
|
||||
//}
|
||||
if (isInteger(vo.getJoblevel())) {
|
||||
int joblevel = vo.getJoblevel().equals("") ? 0 : Integer.parseInt(vo.getJoblevel());
|
||||
hrm.setJoblevel((short) joblevel);
|
||||
} else {
|
||||
hrm.setJoblevel((short) 0);
|
||||
}
|
||||
//用工性质
|
||||
if (vo.getUsekind() != null) {
|
||||
int usekind = getUseKind(vo.getUsekind());
|
||||
|
|
@ -830,7 +815,7 @@ public class HrmImportProcessE9 extends BaseBean {
|
|||
|
||||
new HrmDateCheck().calWorkInfo("" + id);
|
||||
// 刷新组织结构图
|
||||
new Thread(new HrmResourceTriggerRunnable((long) id)).start();
|
||||
// TODO new Thread(new HrmResourceTriggerRunnable((long) id)).start();
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -854,7 +839,6 @@ public class HrmImportProcessE9 extends BaseBean {
|
|||
if (this.checkInfo(vo, resultList)) {
|
||||
continue;
|
||||
}
|
||||
new BaseBean().writeLog("checkKeys校验通过");
|
||||
|
||||
if (vo.getAccounttype() == null || "".equalsIgnoreCase(Util.null2String(vo.getAccounttype()))) {
|
||||
if (StringUtil.isNotNull(vo.getCertificatenum()) && certificateNums.get(StringUtil.vString(vo.getCertificatenum())) != null) {
|
||||
|
|
@ -888,6 +872,7 @@ public class HrmImportProcessE9 extends BaseBean {
|
|||
issameSub = false;
|
||||
|
||||
}
|
||||
|
||||
if (subcompanyid1 == -9) {
|
||||
resultList.add(createLog(vo, "更新", "失败", SystemEnv.getErrorMsgName(56, userlanguage)));
|
||||
continue;
|
||||
|
|
@ -975,49 +960,36 @@ public class HrmImportProcessE9 extends BaseBean {
|
|||
}
|
||||
}
|
||||
|
||||
//// 岗位id
|
||||
//if ("".equals(Util.null2String(vo.getJobtitle())) && (!"".equals(Util.null2String(vo.getJobactivityid())) || !"".equals(Util.null2String(vo.getJobgroupid())))) {
|
||||
// resultList.add(createLog(vo, "更新", "失败", SystemEnv.getHtmlLabelName(83544, userlanguage)));
|
||||
// continue;
|
||||
//}
|
||||
//if (!"".equals(Util.null2String(vo.getJobtitle()))) {
|
||||
// String jobtitle;
|
||||
// String jobactivityid;
|
||||
// String jobactivityname;
|
||||
// String jobgroupid;
|
||||
// String jobgroupname;
|
||||
// if (vo.getJobactivityid() == null) {
|
||||
// jobtitle = resourcecominfo.getJobTitle(hrmId);
|
||||
// jobactivityid = jobTitlesComInfo.getJobactivityid(jobtitle);
|
||||
// jobactivityname = jobActivitiesComInfo.getJobActivitiesname(jobactivityid);
|
||||
// } else
|
||||
// jobactivityname = vo.getJobactivityid();
|
||||
// if (vo.getJobgroupid() == null) {
|
||||
// jobtitle = resourcecominfo.getJobTitle(hrmId);
|
||||
// jobactivityid = jobTitlesComInfo.getJobactivityid(jobtitle);
|
||||
// jobgroupid = jobActivitiesComInfo.getJobgroupid(jobactivityid);
|
||||
// jobgroupname = jobGroupsComInfo.getJobGroupsname(jobgroupid);
|
||||
// } else {
|
||||
// jobgroupname = vo.getJobgroupid();
|
||||
// }
|
||||
// int jobtitleid = getJobTitles(vo.getJobtitle(), jobactivityname, jobgroupname);
|
||||
// if (jobtitleid == -1) {
|
||||
// resultList.add(createLog(vo, "创建", "失败", "职务类别不存在"));
|
||||
// continue;
|
||||
// } else if (jobtitleid == -2) {
|
||||
// resultList.add(createLog(vo, "创建", "失败", "职务不存在"));
|
||||
// continue;
|
||||
// } else if (jobtitleid == -3) {
|
||||
// resultList.add(createLog(vo, "创建", "失败", "岗位名称不存在"));
|
||||
// continue;
|
||||
// }
|
||||
// hrm.setJobtitle(jobtitleid);
|
||||
//}
|
||||
|
||||
new BaseBean().writeLog("hrmId【" + hrmId + "】");
|
||||
if (Util.getIntValue(hrmId) < 0) {
|
||||
// 岗位id
|
||||
if ("".equals(Util.null2String(vo.getJobtitle())) && (!"".equals(Util.null2String(vo.getJobactivityid())) || !"".equals(Util.null2String(vo.getJobgroupid())))) {
|
||||
resultList.add(createLog(vo, "更新", "失败", SystemEnv.getHtmlLabelName(83544, userlanguage)));
|
||||
continue;
|
||||
}
|
||||
if (!"".equals(Util.null2String(vo.getJobtitle()))) {
|
||||
String jobtitle = "";
|
||||
String jobactivityid = "";
|
||||
String jobactivityname = "";
|
||||
String jobgroupid = "";
|
||||
String jobgroupname = "";
|
||||
if (vo.getJobactivityid() == null) {
|
||||
jobtitle = resourcecominfo.getJobTitle(hrmId);
|
||||
jobactivityid = jobTitlesComInfo.getJobactivityid(jobtitle);
|
||||
jobactivityname = jobActivitiesComInfo.getJobActivitiesname(jobactivityid);
|
||||
} else
|
||||
jobactivityname = vo.getJobactivityid();
|
||||
if (vo.getJobgroupid() == null) {
|
||||
jobtitle = resourcecominfo.getJobTitle(hrmId);
|
||||
jobactivityid = jobTitlesComInfo.getJobactivityid(jobtitle);
|
||||
jobgroupid = jobActivitiesComInfo.getJobgroupid(jobactivityid);
|
||||
jobgroupname = jobGroupsComInfo.getJobGroupsname(jobgroupid);
|
||||
} else {
|
||||
jobgroupname = vo.getJobgroupid();
|
||||
}
|
||||
int jobtitleid = getJobTitles(vo.getJobtitle(), jobactivityname, jobgroupname);
|
||||
hrm.setJobtitle(new Integer(jobtitleid));
|
||||
}
|
||||
|
||||
if (Util.getIntValue(hrmId) < 0) continue;
|
||||
|
||||
//上级id
|
||||
String managerstr = ""; //所有上级
|
||||
|
|
@ -1216,10 +1188,10 @@ public class HrmImportProcessE9 extends BaseBean {
|
|||
}
|
||||
|
||||
//职级
|
||||
//if (isInteger(vo.getJoblevel())) {
|
||||
// int joblevel = vo.getJoblevel().equals("") ? 0 : Integer.parseInt(vo.getJoblevel());
|
||||
// hrm.setJoblevel((short) joblevel);
|
||||
//}
|
||||
if (isInteger(vo.getJoblevel())) {
|
||||
int joblevel = vo.getJoblevel().equals("") ? 0 : Integer.parseInt(vo.getJoblevel());
|
||||
hrm.setJoblevel((short) joblevel);
|
||||
}
|
||||
|
||||
//用工性质
|
||||
if (vo.getUsekind() != null) {
|
||||
|
|
@ -1439,7 +1411,6 @@ public class HrmImportProcessE9 extends BaseBean {
|
|||
String nowmanagerstr = Util.null2String(recordSet.getString("managerstr"));
|
||||
String resourceid = recordSet.getString("id");
|
||||
//指定上级为自身的情况,不更新自身上级
|
||||
new BaseBean().writeLog("resourceid【" + resourceid + "】");
|
||||
if (hrmId.equals(resourceid)) {
|
||||
continue;
|
||||
}
|
||||
|
|
@ -1514,7 +1485,7 @@ public class HrmImportProcessE9 extends BaseBean {
|
|||
resultList.add(createLog(vo, "更新", "失败", "系统错误,请联系管理员"));
|
||||
}
|
||||
// 刷新组织结构图
|
||||
new Thread(new HrmResourceTriggerRunnable((long) keyMap.get(key))).start();
|
||||
// TODO new Thread(new HrmResourceTriggerRunnable((long) keyMap.get(key))).start();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
//数据异常
|
||||
|
|
@ -1596,17 +1567,6 @@ public class HrmImportProcessE9 extends BaseBean {
|
|||
fielddbType = jsonObject.getString("fielddbtype");
|
||||
jsonObject.put("fieldvalue", baseValues[i]);
|
||||
String fieldvalue = HrmFieldManager.getReallyFieldvalue(jsonObject);
|
||||
// 处理自动获取时,或取到已删除的数据
|
||||
if ("field100002".equalsIgnoreCase(fieldname)) {
|
||||
// 根据分部、部门,获取对应的岗位ID
|
||||
recordSet.execute("select subcompanyid1,departmentid from hrmresource where id = " + id);
|
||||
while (recordSet.next()) {
|
||||
String ecCompany = recordSet.getString("subcompanyid1");
|
||||
String ecDepartment = recordSet.getString("departmentid");
|
||||
Long jobId = MapperProxyFactory.getProxy(JobMapper.class).getIdByNameAndEcId(baseValues[i], ecCompany, ecDepartment);
|
||||
fieldvalue = null == jobId ? "" : jobId.toString();
|
||||
}
|
||||
}
|
||||
|
||||
EncryptFieldEntity encryptFieldEntity = new EncryptFieldConfigComInfo().getFieldEncryptConfig("cus_fielddata", fieldname, "HrmCustomFieldByInfoType", scopeId);
|
||||
if (encryptFieldEntity != null && "1".equals(encryptFieldEntity.getIsEncrypt())) {
|
||||
|
|
@ -1688,18 +1648,6 @@ public class HrmImportProcessE9 extends BaseBean {
|
|||
fielddbType = jsonObject.getString("fielddbtype");
|
||||
jsonObject.put("fieldvalue", baseValues[i]);
|
||||
String fieldvalue = HrmFieldManager.getReallyFieldvalue(jsonObject);
|
||||
// 处理自动获取时,或取到已删除的数据
|
||||
if ("field100002".equalsIgnoreCase(fieldname)) {
|
||||
// 根据分部、部门,获取对应的岗位ID
|
||||
recordSet.execute("select subcompanyid1,departmentid from hrmresource where id = " + id);
|
||||
while (recordSet.next()) {
|
||||
String ecCompany = recordSet.getString("subcompanyid1");
|
||||
String ecDepartment = recordSet.getString("departmentid");
|
||||
Long jobId = MapperProxyFactory.getProxy(JobMapper.class).getIdByNameAndEcId(baseValues[i], ecCompany, ecDepartment);
|
||||
fieldvalue = null == jobId ? "" : jobId.toString();
|
||||
new BaseBean().writeLog("岗位[" + baseValues[i] + "],jobId[" + Util.null2String(jobId) + "],ecCompany[" + ecCompany + "],ecDepartment[" + ecDepartment + "]");
|
||||
}
|
||||
}
|
||||
EncryptFieldEntity encryptFieldEntity = new EncryptFieldConfigComInfo().getFieldEncryptConfig("cus_fielddata", fieldname, "HrmCustomFieldByInfoType", scopeId);
|
||||
if (encryptFieldEntity != null && "1".equals(encryptFieldEntity.getIsEncrypt())) {
|
||||
//是否需要加密
|
||||
|
|
@ -1711,7 +1659,7 @@ public class HrmImportProcessE9 extends BaseBean {
|
|||
if (fieldvalue.endsWith(",")) {
|
||||
fieldvalue = fieldvalue.substring(0, fieldvalue.length() - 1);
|
||||
}
|
||||
if (!"".equals(fieldvalue) || "field100002".equalsIgnoreCase(fieldname)) {
|
||||
if (!"".equals(fieldvalue)) {
|
||||
flag = true;
|
||||
if (fielddbType.toLowerCase().startsWith("char") || fielddbType.toLowerCase().startsWith("varchar") || fielddbType.toLowerCase().startsWith("text")) {
|
||||
setStr.append(",").append(baseFields[i]).append("='").append(fieldvalue).append("'");
|
||||
|
|
@ -1822,8 +1770,7 @@ public class HrmImportProcessE9 extends BaseBean {
|
|||
if (!recordSet.next()) {
|
||||
return !addPersonData(personFild, personValue, id);
|
||||
}
|
||||
new BaseBean().writeLog("personValue【" + personValue + "】");
|
||||
new BaseBean().writeLog("personFild【" + personFild + "】");
|
||||
|
||||
String[] personValues = personValue.split(";");
|
||||
String[] personFields = personFild.split(",");
|
||||
String fielddbType;
|
||||
|
|
@ -2149,68 +2096,93 @@ public class HrmImportProcessE9 extends BaseBean {
|
|||
return currentId;
|
||||
}
|
||||
|
||||
///**
|
||||
// * 获取岗位id
|
||||
// *
|
||||
// * @param jobtitlename 岗位名称
|
||||
// * @param jobactivityname 职务
|
||||
// * @param jobgroupname 职务类别
|
||||
// * @return -1:职务类别不存在,-2:职务不存在,-3:岗位名称不存在
|
||||
// */
|
||||
//public int getJobTitles(String jobtitlename, String jobactivityname,
|
||||
// String jobgroupname) {
|
||||
// RecordSet rs = new RecordSet();
|
||||
// RecordSet recordSet = new RecordSet();
|
||||
// String sqlInsert;
|
||||
//
|
||||
// jobgroupname = Util.convertInput2DB4(jobgroupname);
|
||||
// jobactivityname = Util.convertInput2DB4(jobactivityname);
|
||||
//
|
||||
// /* 获取jobgroupid 职务类别 */
|
||||
// String selSql = "select id from HrmJobGroups where ltrim(rtrim(dbo.convToMultiLang(ltrim(rtrim(jobgroupname))," + userlanguage + ")))='" + jobgroupname + "'";
|
||||
// if (recordSet.getDBType().equalsIgnoreCase("oracle") || DialectUtil.isMySql(recordSet.getDBType()) || recordSet.getDBType().equalsIgnoreCase("postgresql")) {
|
||||
// selSql = "select id from HrmJobGroups where ltrim(rtrim(convToMultiLang(ltrim(rtrim(jobgroupname))," + userlanguage + ")))='" + jobgroupname + "'";
|
||||
// }
|
||||
//
|
||||
// int jobgroupid = getResultSetId(selSql);
|
||||
//
|
||||
// if (jobgroupid == 0) {
|
||||
// return -1;
|
||||
// }
|
||||
//
|
||||
// /* 获取jobactivityid 职务 */
|
||||
// selSql = "select id from HrmJobActivities where ltrim(rtrim(dbo.convToMultiLang(ltrim(rtrim(jobactivityname))," + userlanguage + ")))='" + jobactivityname + "' and jobgroupid=" + jobgroupid;
|
||||
// if (recordSet.getDBType().equalsIgnoreCase("oracle") || DialectUtil.isMySql(recordSet.getDBType()) || recordSet.getDBType().equalsIgnoreCase("postgresql")) {
|
||||
// selSql = "select id from HrmJobActivities where ltrim(rtrim(convToMultiLang(ltrim(rtrim(jobactivityname))," + userlanguage + ")))='" + jobactivityname + "' and jobgroupid=" + jobgroupid;
|
||||
// }
|
||||
//
|
||||
// int jobactivityid = getResultSetId(selSql);
|
||||
//
|
||||
// if (jobactivityid == 0) {
|
||||
// return -2;
|
||||
// }
|
||||
//
|
||||
// /*获取岗位id*/
|
||||
// selSql = "select id from HrmJobTitles where ltrim(rtrim(dbo.convToMultiLang(ltrim(rtrim(jobtitlemark))," + userlanguage + ")))='" + jobtitlename + "' and jobactivityid=" + jobactivityid;
|
||||
// if (recordSet.getDBType().equalsIgnoreCase("oracle") || DialectUtil.isMySql(recordSet.getDBType()) || recordSet.getDBType().equalsIgnoreCase("postgresql")) {
|
||||
// selSql = "select id from HrmJobTitles where ltrim(rtrim(convToMultiLang(ltrim(rtrim(jobtitlemark))," + userlanguage + ")))='" + jobtitlename + "' and jobactivityid=" + jobactivityid;
|
||||
// }
|
||||
//
|
||||
// int jobtitle = getResultSetId(selSql);
|
||||
//
|
||||
// if (jobtitle == 0) {
|
||||
// return -3;
|
||||
//
|
||||
// } else {
|
||||
// selSql = "select * from HrmJobTitles where id = '" + jobtitle + "' and jobactivityid = '" + jobactivityid + "' ";
|
||||
// recordSet.executeSql(selSql);
|
||||
// if (!recordSet.next()) {//查询这个名称已存在的岗位,对应的职务是否存在。如果对应职务的岗位不存在,则说明岗位对应的职务和职务类别有更新
|
||||
// sqlInsert = "update HrmJobTitles set jobactivityid = '" + jobactivityid + "'," + DbFunctionUtil.getUpdateSetSql(rs.getDBType(), 1) + " where id = '" + jobtitle + "' ";
|
||||
// rs.executeSql(sqlInsert);
|
||||
// }
|
||||
// }
|
||||
// return jobtitle;
|
||||
//}
|
||||
/**
|
||||
* 获取岗位id
|
||||
*
|
||||
* @param jobtitlename 岗位名称
|
||||
* @param jobactivityname 职务
|
||||
* @param jobgroupname 职务类型
|
||||
* @return
|
||||
*/
|
||||
public int getJobTitles(String jobtitlename, String jobactivityname,
|
||||
String jobgroupname) {
|
||||
RecordSet rs = new RecordSet();
|
||||
RecordSet recordSet = new RecordSet();
|
||||
String sqlInsert = "";
|
||||
|
||||
jobgroupname = Util.convertInput2DB4(jobgroupname);
|
||||
jobactivityname = Util.convertInput2DB4(jobactivityname);
|
||||
|
||||
/* 获取jobgroupid 职务类别 */
|
||||
String selSql = "select id from HrmJobGroups where ltrim(rtrim(dbo.convToMultiLang(ltrim(rtrim(jobgroupname))," + userlanguage + ")))='" + jobgroupname + "'";
|
||||
if (recordSet.getDBType().equalsIgnoreCase("oracle") || DialectUtil.isMySql(recordSet.getDBType()) || recordSet.getDBType().equalsIgnoreCase("postgresql")) {
|
||||
selSql = "select id from HrmJobGroups where ltrim(rtrim(convToMultiLang(ltrim(rtrim(jobgroupname))," + userlanguage + ")))='" + jobgroupname + "'";
|
||||
}
|
||||
|
||||
int jobgroupid = getResultSetId(selSql);
|
||||
|
||||
if (jobgroupid == 0) {
|
||||
if (jobgroupname.length() == 0) {
|
||||
selSql = "select max(id) as id from HrmJobGroups";
|
||||
jobgroupid = getResultSetId(selSql);
|
||||
} else {
|
||||
sqlInsert = "insert into HrmJobGroups (jobgroupname,jobgroupremark ," + DbFunctionUtil.getInsertColumnSql() + ") values('"
|
||||
+ jobgroupname + "','" + jobgroupname + "'," + DbFunctionUtil.getInsertColumnValueSql(recordSet.getDBType(), 1) + ")"; // 创建
|
||||
execSql(sqlInsert);
|
||||
jobgroupid = getResultSetId(selSql);
|
||||
}
|
||||
}
|
||||
|
||||
/* 获取jobactivityid 职务 */
|
||||
selSql = "select id from HrmJobActivities where ltrim(rtrim(dbo.convToMultiLang(ltrim(rtrim(jobactivityname))," + userlanguage + ")))='" + jobactivityname + "' and jobgroupid=" + jobgroupid;
|
||||
if (recordSet.getDBType().equalsIgnoreCase("oracle") || DialectUtil.isMySql(recordSet.getDBType()) || recordSet.getDBType().equalsIgnoreCase("postgresql")) {
|
||||
selSql = "select id from HrmJobActivities where ltrim(rtrim(convToMultiLang(ltrim(rtrim(jobactivityname))," + userlanguage + ")))='" + jobactivityname + "' and jobgroupid=" + jobgroupid;
|
||||
}
|
||||
|
||||
int jobactivityid = getResultSetId(selSql);
|
||||
|
||||
if (jobactivityid == 0) {
|
||||
sqlInsert = "insert into HrmJobActivities (jobactivityname,Jobactivitymark,jobgroupid ," + DbFunctionUtil.getInsertColumnSql() + ") values('"
|
||||
+ jobactivityname + "','" + jobactivityname + "'," + jobgroupid + " ," + DbFunctionUtil.getInsertColumnValueSql(recordSet.getDBType(), 1) + ")"; // 创建
|
||||
execSql(sqlInsert);
|
||||
jobactivityid = getResultSetId(selSql);
|
||||
}
|
||||
|
||||
/*获取岗位id*/
|
||||
selSql = "select id from HrmJobTitles where ltrim(rtrim(dbo.convToMultiLang(ltrim(rtrim(jobtitlemark))," + userlanguage + ")))='" + jobtitlename + "' and jobactivityid=" + jobactivityid;
|
||||
if (recordSet.getDBType().equalsIgnoreCase("oracle") || DialectUtil.isMySql(recordSet.getDBType()) || recordSet.getDBType().equalsIgnoreCase("postgresql")) {
|
||||
selSql = "select id from HrmJobTitles where ltrim(rtrim(convToMultiLang(ltrim(rtrim(jobtitlemark))," + userlanguage + ")))='" + jobtitlename + "' and jobactivityid=" + jobactivityid;
|
||||
}
|
||||
|
||||
int jobtitle = getResultSetId(selSql);
|
||||
|
||||
if (jobtitle == 0) {
|
||||
String jobtitlecode = "";
|
||||
try {
|
||||
jobtitlecode = CodeRuleManager.getCodeRuleManager().generateRuleCode(RuleCodeType.JOBTITLES, jobtitlecode);
|
||||
} catch (Exception e) {
|
||||
writeLog(e);
|
||||
}
|
||||
sqlInsert = "insert into HrmJobTitles (jobtitlename,Jobtitlemark,jobactivityid ," + DbFunctionUtil.getInsertColumnSql() + ", jobtitlecode) values('"
|
||||
+ jobtitlename + "','" + jobtitlename + "'," + jobactivityid + " ," + DbFunctionUtil.getInsertColumnValueSql(recordSet.getDBType(), 1) + ", '" + jobtitlecode + "')"; // 创建
|
||||
execSql(sqlInsert);
|
||||
HrmTriggerUtil.generateJobtitlesPinyin(jobtitlename, null);
|
||||
jobtitle = getResultSetId(selSql);
|
||||
|
||||
HrmFaceCheckManager.sync(jobtitle + "", HrmFaceCheckManager.getOptInsert(), "hrm_e9_import_getJobtitles", HrmFaceCheckManager.getOaJobtitle());
|
||||
|
||||
} else {
|
||||
selSql = "select * from HrmJobTitles where id = '" + jobtitle + "' and jobactivityid = '" + jobactivityid + "' ";
|
||||
recordSet.executeSql(selSql);
|
||||
if (!recordSet.next()) {//查询这个名称已存在的岗位,对应的职务是否存在。如果对应职务的岗位不存在,则说明岗位对应的职务和职务类别有更新
|
||||
sqlInsert = "update HrmJobTitles set jobactivityid = '" + jobactivityid + "'," + DbFunctionUtil.getUpdateSetSql(rs.getDBType(), 1) + " where id = '" + jobtitle + "' ";
|
||||
rs.executeSql(sqlInsert);
|
||||
}
|
||||
}
|
||||
return jobtitle;
|
||||
}
|
||||
|
||||
|
||||
public static boolean needCheckLicenseForUpdate(ResourceComInfo resourceComInfo, String hrmId, HrmResourceVo vo) {
|
||||
String statusOfHrmId = resourceComInfo.getStatus(hrmId);
|
||||
String loginidOfHrmId = resourceComInfo.getLoginID(hrmId);
|
||||
|
|
|
|||
Loading…
Reference in New Issue