Merge pull request '人员同步BUG修复,导入优化' (#74) from feature/dxf into develop

Reviewed-on: #74
pull/77/head
dxfeng 3 years ago
commit 80d504aff8

@ -1,23 +1,18 @@
package com.engine.organization.service.impl;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
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.cloudstore.eccom.result.WeaResultMsg;
import com.engine.core.impl.Service;
import com.engine.hrm.entity.FieldSelectOptionBean;
import com.engine.organization.component.OrganizationWeaTable;
import com.engine.organization.entity.SelectOptionParam;
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.po.JclImportHistoryPO;
import com.engine.organization.entity.jclimport.vo.JclImportHistoryDetailVO;
import com.engine.organization.entity.job.po.JobPO;
import com.engine.organization.entity.scheme.po.GradePO;
@ -34,7 +29,6 @@ import com.engine.organization.mapper.extend.ExtMapper;
import com.engine.organization.mapper.extend.ExtendInfoMapper;
import com.engine.organization.mapper.hrmresource.SystemDataMapper;
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.mapper.resource.ResourceMapper;
import com.engine.organization.mapper.scheme.GradeMapper;
@ -47,6 +41,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 com.engine.organization.util.saveimport.OrgImportUtil;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.hssf.usermodel.HSSFDateUtil;
@ -54,19 +49,16 @@ import org.apache.poi.xssf.usermodel.XSSFCell;
import org.apache.poi.xssf.usermodel.XSSFRow;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import weaver.common.DateUtil;
import weaver.file.ImageFileManager;
import weaver.general.BaseBean;
import weaver.general.GCONST;
import weaver.general.Util;
import weaver.hrm.definedfield.HrmFieldManager;
import weaver.systeminfo.SystemEnv;
import javax.servlet.http.HttpServletRequest;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;
@ -662,7 +654,7 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
*
*/
private Long companyImport(String operateType, String excelFile) {
Long importHistoryId = saveImportLog("company", operateType);
Long importHistoryId = OrgImportUtil.saveImportLog("company", operateType, user);
JclImportHistoryDetailPO historyDetailPO;
ImageFileManager manager = new ImageFileManager();
@ -714,23 +706,23 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
if (infoPO.getIsrequired() == 1 && StringUtils.isBlank(cellValue) && !"comp_no".equalsIgnoreCase(infoPO.getFieldName())) {
historyDetailPO.setOperateDetail(infoPO.getFieldNameDesc() + "为必填项");
historyDetailPO.setStatus("0");
saveImportDetailLog(historyDetailPO);
OrgImportUtil.saveImportDetailLog(historyDetailPO);
continue nextRow;
}
Object reallyValue;
try {
reallyValue = getReallyValue(infoPO, cellValue);
reallyValue = OrgImportUtil.getReallyValue(infoPO, cellValue);
} catch (Exception e) {
historyDetailPO.setOperateDetail(cellValue + "转换失败");
historyDetailPO.setStatus("0");
saveImportDetailLog(historyDetailPO);
OrgImportUtil.saveImportDetailLog(historyDetailPO);
continue nextRow;
}
if (StringUtils.isNotBlank(cellValue) && StringUtils.isBlank(Util.null2String(reallyValue))) {
historyDetailPO.setOperateDetail(infoPO.getFieldNameDesc() + "数据转换失败,未找到对应数据");
historyDetailPO.setStatus("0");
saveImportDetailLog(historyDetailPO);
OrgImportUtil.saveImportDetailLog(historyDetailPO);
continue nextRow;
}
map.put(infoPO.getFieldName(), reallyValue);
@ -741,7 +733,7 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
if (split.length > 8) {
historyDetailPO.setOperateDetail("分部层级不能大于10");
historyDetailPO.setStatus("0");
saveImportDetailLog(historyDetailPO);
OrgImportUtil.saveImportDetailLog(historyDetailPO);
continue nextRow;
}
for (int index = 0; index < split.length - 1; index++) {
@ -749,7 +741,7 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
if (null == parentCompanyId) {
historyDetailPO.setOperateDetail(split[index] + "分部未找到对应数据");
historyDetailPO.setStatus("0");
saveImportDetailLog(historyDetailPO);
OrgImportUtil.saveImportDetailLog(historyDetailPO);
continue nextRow;
}
}
@ -780,7 +772,7 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
if (companyId != null) {
historyDetailPO.setOperateDetail("数据已存在");
historyDetailPO.setStatus("0");
saveImportDetailLog(historyDetailPO);
OrgImportUtil.saveImportDetailLog(historyDetailPO);
continue;
}
// 自动编号
@ -789,7 +781,7 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
} catch (OrganizationRunTimeException e) {
historyDetailPO.setOperateDetail(e.getMessage());
historyDetailPO.setStatus("0");
saveImportDetailLog(historyDetailPO);
OrgImportUtil.saveImportDetailLog(historyDetailPO);
continue;
}
map.put("comp_no", compNo);
@ -825,14 +817,14 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
historyDetailPO.setOperateDetail(Util.null2String(syncMap.get("message")));
historyDetailPO.setStatus("0");
}
saveImportDetailLog(historyDetailPO);
OrgImportUtil.saveImportDetailLog(historyDetailPO);
} else if ("update".equals(operateType)) {
// 查询对应ID
if (StringUtils.isNotBlank(compNo)) {
if (companyId == null) {
historyDetailPO.setOperateDetail("未找到对应数据");
historyDetailPO.setStatus("0");
saveImportDetailLog(historyDetailPO);
OrgImportUtil.saveImportDetailLog(historyDetailPO);
continue;
}
if (checkRepeatNo(compNo, COMPANY_TYPE, companyId)) {
@ -850,16 +842,16 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
historyDetailPO.setOperateDetail(Util.null2String(syncMap.get("message")));
historyDetailPO.setStatus("0");
}
saveImportDetailLog(historyDetailPO);
OrgImportUtil.saveImportDetailLog(historyDetailPO);
} else {
historyDetailPO.setOperateDetail(compNo + "编号已存在");
historyDetailPO.setStatus("0");
saveImportDetailLog(historyDetailPO);
OrgImportUtil.saveImportDetailLog(historyDetailPO);
}
} else {
historyDetailPO.setOperateDetail("编号为空,更新失败");
historyDetailPO.setStatus("0");
saveImportDetailLog(historyDetailPO);
OrgImportUtil.saveImportDetailLog(historyDetailPO);
}
}
}
@ -870,7 +862,7 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
*
*/
private Long departmentImport(String operateType, String excelFile) {
Long importHistoryId = saveImportLog("department", operateType);
Long importHistoryId = OrgImportUtil.saveImportLog("department", operateType, user);
JclImportHistoryDetailPO historyDetailPO;
ImageFileManager manager = new ImageFileManager();
@ -923,23 +915,23 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
if (infoPO.getIsrequired() == 1 && StringUtils.isBlank(cellValue) && !"dept_no".equalsIgnoreCase(infoPO.getFieldName())) {
historyDetailPO.setOperateDetail(infoPO.getFieldNameDesc() + "为必填项");
historyDetailPO.setStatus("0");
saveImportDetailLog(historyDetailPO);
OrgImportUtil.saveImportDetailLog(historyDetailPO);
continue nextRow;
}
Object reallyValue;
try {
reallyValue = getReallyValue(infoPO, cellValue);
reallyValue = OrgImportUtil.getReallyValue(infoPO, cellValue);
} catch (Exception e) {
historyDetailPO.setOperateDetail(cellValue + "转换失败");
historyDetailPO.setStatus("0");
saveImportDetailLog(historyDetailPO);
OrgImportUtil.saveImportDetailLog(historyDetailPO);
continue nextRow;
}
if (StringUtils.isNotBlank(cellValue) && StringUtils.isBlank(Util.null2String(reallyValue)) && !"ec_company".equals(infoPO.getFieldName())) {
historyDetailPO.setOperateDetail(infoPO.getFieldNameDesc() + "数据转换失败,未找到对应数据");
historyDetailPO.setStatus("0");
saveImportDetailLog(historyDetailPO);
OrgImportUtil.saveImportDetailLog(historyDetailPO);
continue nextRow;
}
map.put(infoPO.getFieldName(), reallyValue);
@ -950,7 +942,7 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
if (split.length > 8) {
historyDetailPO.setOperateDetail("分部层级不能大于10");
historyDetailPO.setStatus("0");
saveImportDetailLog(historyDetailPO);
OrgImportUtil.saveImportDetailLog(historyDetailPO);
continue nextRow;
}
for (String s : split) {
@ -958,7 +950,7 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
if (null == parentCompanyId) {
historyDetailPO.setOperateDetail(cellValue + "分部未找到对应数据");
historyDetailPO.setStatus("0");
saveImportDetailLog(historyDetailPO);
OrgImportUtil.saveImportDetailLog(historyDetailPO);
continue nextRow;
}
}
@ -969,7 +961,7 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
if (null == parentCompanyId) {
historyDetailPO.setOperateDetail(cellValue + "所属分部未找到");
historyDetailPO.setStatus("0");
saveImportDetailLog(historyDetailPO);
OrgImportUtil.saveImportDetailLog(historyDetailPO);
continue nextRow;
}
historyDetailPO.setRelatedName(cellValue);
@ -978,7 +970,7 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
if (split.length > 8) {
historyDetailPO.setOperateDetail("部门层级不能大于10");
historyDetailPO.setStatus("0");
saveImportDetailLog(historyDetailPO);
OrgImportUtil.saveImportDetailLog(historyDetailPO);
continue nextRow;
}
for (int index = 0; index < split.length - 1; index++) {
@ -986,7 +978,7 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
if (null == parentDepartmentId) {
historyDetailPO.setOperateDetail(split[index] + "部门未找到对应数据");
historyDetailPO.setStatus("0");
saveImportDetailLog(historyDetailPO);
OrgImportUtil.saveImportDetailLog(historyDetailPO);
continue nextRow;
}
}
@ -1018,7 +1010,7 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
if (departmentId != null) {
historyDetailPO.setOperateDetail("数据已存在");
historyDetailPO.setStatus("0");
saveImportDetailLog(historyDetailPO);
OrgImportUtil.saveImportDetailLog(historyDetailPO);
continue;
}
// 自动编号
@ -1027,7 +1019,7 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
} catch (OrganizationRunTimeException e) {
historyDetailPO.setOperateDetail(e.getMessage());
historyDetailPO.setStatus("0");
saveImportDetailLog(historyDetailPO);
OrgImportUtil.saveImportDetailLog(historyDetailPO);
continue;
}
map.put("dept_no", deptNo);
@ -1063,14 +1055,14 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
historyDetailPO.setOperateDetail(Util.null2String(syncMap.get("message")));
historyDetailPO.setStatus("0");
}
saveImportDetailLog(historyDetailPO);
OrgImportUtil.saveImportDetailLog(historyDetailPO);
} else if ("update".equals(operateType)) {
// 查询对应ID
if (StringUtils.isNotBlank(deptNo)) {
if (departmentId == null) {
historyDetailPO.setOperateDetail("未找到对应数据");
historyDetailPO.setStatus("0");
saveImportDetailLog(historyDetailPO);
OrgImportUtil.saveImportDetailLog(historyDetailPO);
continue;
}
if (checkRepeatNo(deptNo, DEPARTMENT_TYPE, departmentId)) {
@ -1088,16 +1080,16 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
historyDetailPO.setOperateDetail(Util.null2String(syncMap.get("message")));
historyDetailPO.setStatus("0");
}
saveImportDetailLog(historyDetailPO);
OrgImportUtil.saveImportDetailLog(historyDetailPO);
} else {
historyDetailPO.setOperateDetail(deptNo + "编号已存在");
historyDetailPO.setStatus("0");
saveImportDetailLog(historyDetailPO);
OrgImportUtil.saveImportDetailLog(historyDetailPO);
}
} else {
historyDetailPO.setOperateDetail("编号为空,更新失败");
historyDetailPO.setStatus("0");
saveImportDetailLog(historyDetailPO);
OrgImportUtil.saveImportDetailLog(historyDetailPO);
}
}
}
@ -1108,7 +1100,7 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
*
*/
private Long jobImport(String operateType, String excelFile) {
Long importHistoryId = saveImportLog("jobtitle", operateType);
Long importHistoryId = OrgImportUtil.saveImportLog("jobtitle", operateType, user);
JclImportHistoryDetailPO historyDetailPO;
ImageFileManager manager = new ImageFileManager();
@ -1161,23 +1153,23 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
if (infoPO.getIsrequired() == 1 && StringUtils.isBlank(cellValue) && !"job_no".equalsIgnoreCase(infoPO.getFieldName())) {
historyDetailPO.setOperateDetail(infoPO.getFieldNameDesc() + "为必填项");
historyDetailPO.setStatus("0");
saveImportDetailLog(historyDetailPO);
OrgImportUtil.saveImportDetailLog(historyDetailPO);
continue nextRow;
}
Object reallyValue;
try {
reallyValue = getReallyValue(infoPO, cellValue);
reallyValue = OrgImportUtil.getReallyValue(infoPO, cellValue);
} catch (Exception e) {
historyDetailPO.setOperateDetail(cellValue + "转换失败");
historyDetailPO.setStatus("0");
saveImportDetailLog(historyDetailPO);
OrgImportUtil.saveImportDetailLog(historyDetailPO);
continue nextRow;
}
if (StringUtils.isNotBlank(cellValue) && StringUtils.isBlank(Util.null2String(reallyValue)) && !"ec_company".equals(infoPO.getFieldName()) && !"ec_department".equals(infoPO.getFieldName())) {
historyDetailPO.setOperateDetail(infoPO.getFieldNameDesc() + "数据转换失败,未找到对应数据");
historyDetailPO.setStatus("0");
saveImportDetailLog(historyDetailPO);
OrgImportUtil.saveImportDetailLog(historyDetailPO);
continue nextRow;
}
map.put(infoPO.getFieldName(), reallyValue);
@ -1188,7 +1180,7 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
if (split.length > 8) {
historyDetailPO.setOperateDetail("分部层级不能大于10");
historyDetailPO.setStatus("0");
saveImportDetailLog(historyDetailPO);
OrgImportUtil.saveImportDetailLog(historyDetailPO);
continue nextRow;
}
for (String s : split) {
@ -1196,7 +1188,7 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
if (null == parentCompanyId) {
historyDetailPO.setOperateDetail(cellValue + "分部未找到对应数据");
historyDetailPO.setStatus("0");
saveImportDetailLog(historyDetailPO);
OrgImportUtil.saveImportDetailLog(historyDetailPO);
continue nextRow;
}
}
@ -1210,7 +1202,7 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
if (split.length > 8) {
historyDetailPO.setOperateDetail("部门层级不能大于10");
historyDetailPO.setStatus("0");
saveImportDetailLog(historyDetailPO);
OrgImportUtil.saveImportDetailLog(historyDetailPO);
continue nextRow;
}
for (String s : split) {
@ -1218,7 +1210,7 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
if (null == parentDepartmentId) {
historyDetailPO.setOperateDetail(cellValue + "部门未找到对应数据");
historyDetailPO.setStatus("0");
saveImportDetailLog(historyDetailPO);
OrgImportUtil.saveImportDetailLog(historyDetailPO);
continue nextRow;
}
}
@ -1229,7 +1221,7 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
if (null == parentCompanyId) {
historyDetailPO.setOperateDetail(cellValue + "所属分部未找到");
historyDetailPO.setStatus("0");
saveImportDetailLog(historyDetailPO);
OrgImportUtil.saveImportDetailLog(historyDetailPO);
continue nextRow;
}
historyDetailPO.setRelatedName(cellValue);
@ -1238,7 +1230,7 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
if (split.length > 8) {
historyDetailPO.setOperateDetail("岗位层级不能大于10");
historyDetailPO.setStatus("0");
saveImportDetailLog(historyDetailPO);
OrgImportUtil.saveImportDetailLog(historyDetailPO);
continue nextRow;
}
for (int index = 0; index < split.length - 1; index++) {
@ -1246,7 +1238,7 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
if (null == parentJobId) {
historyDetailPO.setOperateDetail(split[index] + "岗位未找到对应数据");
historyDetailPO.setStatus("0");
saveImportDetailLog(historyDetailPO);
OrgImportUtil.saveImportDetailLog(historyDetailPO);
continue nextRow;
}
}
@ -1274,7 +1266,7 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
if (jobId != null) {
historyDetailPO.setOperateDetail("数据已存在");
historyDetailPO.setStatus("0");
saveImportDetailLog(historyDetailPO);
OrgImportUtil.saveImportDetailLog(historyDetailPO);
continue;
}
// 自动编号
@ -1283,7 +1275,7 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
} catch (OrganizationRunTimeException e) {
historyDetailPO.setOperateDetail(e.getMessage());
historyDetailPO.setStatus("0");
saveImportDetailLog(historyDetailPO);
OrgImportUtil.saveImportDetailLog(historyDetailPO);
continue;
}
map.put("job_no", jobNo);
@ -1323,14 +1315,14 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
historyDetailPO.setOperateDetail(Util.null2String(syncMap.get("message")));
historyDetailPO.setStatus("0");
}
saveImportDetailLog(historyDetailPO);
OrgImportUtil.saveImportDetailLog(historyDetailPO);
} else if ("update".equals(operateType)) {
// 查询对应ID
if (StringUtils.isNotBlank(jobNo)) {
if (jobId == null) {
historyDetailPO.setOperateDetail("未找到对应数据");
historyDetailPO.setStatus("0");
saveImportDetailLog(historyDetailPO);
OrgImportUtil.saveImportDetailLog(historyDetailPO);
continue;
}
if (checkRepeatNo(jobNo, JOB_TYPE, jobId)) {
@ -1356,16 +1348,16 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
historyDetailPO.setOperateDetail(Util.null2String(syncMap.get("message")));
historyDetailPO.setStatus("0");
}
saveImportDetailLog(historyDetailPO);
OrgImportUtil.saveImportDetailLog(historyDetailPO);
} else {
historyDetailPO.setOperateDetail(jobNo + "编号已存在");
historyDetailPO.setStatus("0");
saveImportDetailLog(historyDetailPO);
OrgImportUtil.saveImportDetailLog(historyDetailPO);
}
} else {
historyDetailPO.setOperateDetail("编号为空,更新失败");
historyDetailPO.setStatus("0");
saveImportDetailLog(historyDetailPO);
OrgImportUtil.saveImportDetailLog(historyDetailPO);
}
}
}
@ -1373,7 +1365,7 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
}
private Long hrmResourceImport(String operateType, String excelFile, String keyField) {
Long importHistoryId = saveImportLog("resource", operateType);
Long importHistoryId = OrgImportUtil.saveImportLog("resource", operateType, user);
JclImportHistoryDetailPO historyDetailPO;
ImageFileManager manager = new ImageFileManager();
@ -1425,23 +1417,23 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
if (infoPO.getIsrequired() == 1 && StringUtils.isBlank(cellValue) && !"work_code".equalsIgnoreCase(infoPO.getFieldName())) {
historyDetailPO.setOperateDetail(infoPO.getFieldNameDesc() + "为必填项");
historyDetailPO.setStatus("0");
saveImportDetailLog(historyDetailPO);
OrgImportUtil.saveImportDetailLog(historyDetailPO);
continue nextRow;
}
Object reallyValue;
try {
reallyValue = getReallyValue(infoPO, cellValue);
reallyValue = OrgImportUtil.getReallyValue(infoPO, cellValue);
} catch (Exception e) {
historyDetailPO.setOperateDetail(cellValue + "转换失败");
historyDetailPO.setStatus("0");
saveImportDetailLog(historyDetailPO);
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");
saveImportDetailLog(historyDetailPO);
OrgImportUtil.saveImportDetailLog(historyDetailPO);
continue nextRow;
}
map.put(infoPO.getFieldName(), reallyValue);
@ -1452,7 +1444,7 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
if (split.length > 8) {
historyDetailPO.setOperateDetail("分部层级不能大于10");
historyDetailPO.setStatus("0");
saveImportDetailLog(historyDetailPO);
OrgImportUtil.saveImportDetailLog(historyDetailPO);
continue nextRow;
}
for (String s : split) {
@ -1460,7 +1452,7 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
if (null == parentCompanyId) {
historyDetailPO.setOperateDetail(cellValue + "分部未找到对应数据");
historyDetailPO.setStatus("0");
saveImportDetailLog(historyDetailPO);
OrgImportUtil.saveImportDetailLog(historyDetailPO);
continue nextRow;
}
}
@ -1474,7 +1466,7 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
if (split.length > 8) {
historyDetailPO.setOperateDetail("部门层级不能大于10");
historyDetailPO.setStatus("0");
saveImportDetailLog(historyDetailPO);
OrgImportUtil.saveImportDetailLog(historyDetailPO);
continue nextRow;
}
for (String s : split) {
@ -1482,7 +1474,7 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
if (null == parentDepartmentId) {
historyDetailPO.setOperateDetail(cellValue + "部门未找到对应数据");
historyDetailPO.setStatus("0");
saveImportDetailLog(historyDetailPO);
OrgImportUtil.saveImportDetailLog(historyDetailPO);
continue nextRow;
}
}
@ -1493,7 +1485,7 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
if (null == parentCompanyId) {
historyDetailPO.setOperateDetail(cellValue + "所属分部未找到");
historyDetailPO.setStatus("0");
saveImportDetailLog(historyDetailPO);
OrgImportUtil.saveImportDetailLog(historyDetailPO);
continue nextRow;
}
String[] split = cellValue.split(">");
@ -1501,7 +1493,7 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
if (split.length > 8) {
historyDetailPO.setOperateDetail("岗位层级不能大于10");
historyDetailPO.setStatus("0");
saveImportDetailLog(historyDetailPO);
OrgImportUtil.saveImportDetailLog(historyDetailPO);
continue nextRow;
}
for (String s : split) {
@ -1509,7 +1501,7 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
if (null == parentJobId) {
historyDetailPO.setOperateDetail(s + "岗位未找到对应数据");
historyDetailPO.setStatus("0");
saveImportDetailLog(historyDetailPO);
OrgImportUtil.saveImportDetailLog(historyDetailPO);
continue nextRow;
}
}
@ -1541,7 +1533,7 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
if (StringUtils.isBlank(keyFieldValue)) {
historyDetailPO.setOperateDetail("所选重复验证字段为空");
historyDetailPO.setStatus("0");
saveImportDetailLog(historyDetailPO);
OrgImportUtil.saveImportDetailLog(historyDetailPO);
continue;
}
historyDetailPO.setRelatedName(keyFieldValue);
@ -1552,7 +1544,7 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
if (resourceId != null) {
historyDetailPO.setOperateDetail(keyFieldValue + "已存在");
historyDetailPO.setStatus("0");
saveImportDetailLog(historyDetailPO);
OrgImportUtil.saveImportDetailLog(historyDetailPO);
continue;
}
@ -1565,14 +1557,14 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
} catch (OrganizationRunTimeException e) {
historyDetailPO.setOperateDetail(e.getMessage());
historyDetailPO.setStatus("0");
saveImportDetailLog(historyDetailPO);
OrgImportUtil.saveImportDetailLog(historyDetailPO);
continue;
}
map.put("work_code", workCode);
} catch (Exception e) {
historyDetailPO.setOperateDetail(Util.null2String(e.getMessage()));
historyDetailPO.setStatus("0");
saveImportDetailLog(historyDetailPO);
OrgImportUtil.saveImportDetailLog(historyDetailPO);
}
map.put("creator", user.getUID());
map.put("delete_type", 0);
@ -1603,13 +1595,13 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
historyDetailPO.setOperateDetail(Util.null2String(syncMap.get("message")));
historyDetailPO.setStatus("0");
}
saveImportDetailLog(historyDetailPO);
OrgImportUtil.saveImportDetailLog(historyDetailPO);
} else if ("update".equals(operateType)) {
// 查询对应ID
if (resourceId == null) {
historyDetailPO.setOperateDetail("未找到对应数据");
historyDetailPO.setStatus("0");
saveImportDetailLog(historyDetailPO);
OrgImportUtil.saveImportDetailLog(historyDetailPO);
continue;
}
map.put("update_time", new Date());
@ -1627,7 +1619,7 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
historyDetailPO.setOperateDetail(Util.null2String(syncMap.get("message")));
historyDetailPO.setStatus("0");
}
saveImportDetailLog(historyDetailPO);
OrgImportUtil.saveImportDetailLog(historyDetailPO);
}
}
return importHistoryId;
@ -1638,7 +1630,7 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
*/
private Long jobLevelImport(String operateType, String excelFile) {
Long importHistoryId = saveImportLog("joblevel", operateType);
Long importHistoryId = OrgImportUtil.saveImportLog("joblevel", operateType, user);
JclImportHistoryDetailPO historyDetailPO;
ImageFileManager manager = new ImageFileManager();
@ -1704,25 +1696,25 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
historyDetailPO.setRelatedName(relatedName);
historyDetailPO.setOperateDetail(infoPO.getFieldNameDesc() + "为必填项");
historyDetailPO.setStatus("0");
saveImportDetailLog(historyDetailPO);
OrgImportUtil.saveImportDetailLog(historyDetailPO);
continue nextRow;
}
Object reallyValue;
try {
// 数据格式转换
reallyValue = getReallyValue(infoPO, cellValue);
reallyValue = OrgImportUtil.getReallyValue(infoPO, cellValue);
} catch (Exception e) {
historyDetailPO.setRelatedName(relatedName);
historyDetailPO.setOperateDetail(cellValue + "转换失败");
historyDetailPO.setStatus("0");
saveImportDetailLog(historyDetailPO);
OrgImportUtil.saveImportDetailLog(historyDetailPO);
continue nextRow;
}
if (StringUtils.isNotBlank(cellValue) && StringUtils.isBlank(Util.null2String(reallyValue)) && !"ec_company".equals(infoPO.getFieldName()) && !"ec_department".equals(infoPO.getFieldName())) {
historyDetailPO.setOperateDetail(infoPO.getFieldNameDesc() + "数据转换失败,未找到对应数据");
historyDetailPO.setStatus("0");
saveImportDetailLog(historyDetailPO);
OrgImportUtil.saveImportDetailLog(historyDetailPO);
continue nextRow;
}
map.put(infoPO.getFieldName(), reallyValue);
@ -1733,7 +1725,7 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
historyDetailPO.setRelatedName(relatedName);
historyDetailPO.setOperateDetail("方案编号[" + reallyValue + "]与原有编号重复");
historyDetailPO.setStatus("0");
saveImportDetailLog(historyDetailPO);
OrgImportUtil.saveImportDetailLog(historyDetailPO);
continue nextRow;
}
}
@ -1744,7 +1736,7 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
historyDetailPO.setRelatedName(relatedName);
historyDetailPO.setOperateDetail("未找到编号为[" + reallyValue + "]的方案");
historyDetailPO.setStatus("0");
saveImportDetailLog(historyDetailPO);
OrgImportUtil.saveImportDetailLog(historyDetailPO);
continue nextRow;
}
}
@ -1755,7 +1747,7 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
historyDetailPO.setRelatedName(relatedName);
historyDetailPO.setOperateDetail("未找到编号为[" + reallyValue + "]的方案");
historyDetailPO.setStatus("0");
saveImportDetailLog(historyDetailPO);
OrgImportUtil.saveImportDetailLog(historyDetailPO);
continue nextRow;
}
}
@ -1769,7 +1761,7 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
historyDetailPO.setRelatedName(relatedName);
historyDetailPO.setOperateDetail("未找到编号为[" + split[index] + "]的职等");
historyDetailPO.setStatus("0");
saveImportDetailLog(historyDetailPO);
OrgImportUtil.saveImportDetailLog(historyDetailPO);
continue nextRow;
}
}
@ -1814,7 +1806,7 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
historyDetailPO.setRelatedName("职等编号");
historyDetailPO.setOperateDetail("职等页导入:同一方案" + schemeNo + "下,职等编号不可重复");
historyDetailPO.setStatus("0");
saveImportDetailLog(historyDetailPO);
OrgImportUtil.saveImportDetailLog(historyDetailPO);
continue nextRow;
} else {
levelPO.setLevelNo(levelNo);
@ -1834,7 +1826,7 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
historyDetailPO.setRelatedName(relatedName);
historyDetailPO.setOperateDetail("未找到编号为[" + schemeNo + "]的方案");
historyDetailPO.setStatus("0");
saveImportDetailLog(historyDetailPO);
OrgImportUtil.saveImportDetailLog(historyDetailPO);
continue nextRow;
}
break;
@ -1848,7 +1840,7 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
historyDetailPO.setRelatedName(relatedName);
historyDetailPO.setOperateDetail("未找到编号为[" + schemeNo2 + "]的方案");
historyDetailPO.setStatus("0");
saveImportDetailLog(historyDetailPO);
OrgImportUtil.saveImportDetailLog(historyDetailPO);
continue nextRow;
}
@ -1872,7 +1864,7 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
historyDetailPO.setRelatedName(relatedName);
historyDetailPO.setOperateDetail("未找到编号为[" + split[index] + "]的职等");
historyDetailPO.setStatus("0");
saveImportDetailLog(historyDetailPO);
OrgImportUtil.saveImportDetailLog(historyDetailPO);
continue nextRow;
}
if (levelIds != null) {
@ -1887,7 +1879,7 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
historyDetailPO.setRelatedName(relatedName);
historyDetailPO.setOperateDetail("同一方案[" + schemeNo2 + "]下,职级编号不可重复");
historyDetailPO.setStatus("0");
saveImportDetailLog(historyDetailPO);
OrgImportUtil.saveImportDetailLog(historyDetailPO);
continue nextRow;
} else {
// 关联职等id
@ -1900,7 +1892,7 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
}
historyDetailPO.setOperateDetail("添加成功");
historyDetailPO.setStatus("1");
saveImportDetailLog(historyDetailPO);
OrgImportUtil.saveImportDetailLog(historyDetailPO);
} else if ("update".equals(operateType)) {
switch (s) {
case 0:
@ -1914,7 +1906,7 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
historyDetailPO.setRelatedName(relatedName);
historyDetailPO.setOperateDetail("未找到编号为[" + map.get("scheme_no") + "]的方案");
historyDetailPO.setStatus("0");
saveImportDetailLog(historyDetailPO);
OrgImportUtil.saveImportDetailLog(historyDetailPO);
continue nextRow;
}
break;
@ -1935,14 +1927,14 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
historyDetailPO.setRelatedName(relatedName);
historyDetailPO.setOperateDetail("未找到编号为[" + schemeNo + "]的方案");
historyDetailPO.setStatus("0");
saveImportDetailLog(historyDetailPO);
OrgImportUtil.saveImportDetailLog(historyDetailPO);
continue nextRow;
}
} else {
historyDetailPO.setRelatedName(relatedName);
historyDetailPO.setOperateDetail("未找到编号为[" + schemeNo + "]的方案,无法更新");
historyDetailPO.setStatus("0");
saveImportDetailLog(historyDetailPO);
OrgImportUtil.saveImportDetailLog(historyDetailPO);
continue nextRow;
}
break;
@ -1954,7 +1946,7 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
historyDetailPO.setRelatedName(relatedName);
historyDetailPO.setOperateDetail("未找到编号为[" + schemeNo2 + "]的方案");
historyDetailPO.setStatus("0");
saveImportDetailLog(historyDetailPO);
OrgImportUtil.saveImportDetailLog(historyDetailPO);
continue nextRow;
}
// 处理职级编号
@ -1967,7 +1959,7 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
historyDetailPO.setRelatedName(relatedName);
historyDetailPO.setOperateDetail("未找到编号为[" + split[index] + "]的职等");
historyDetailPO.setStatus("0");
saveImportDetailLog(historyDetailPO);
OrgImportUtil.saveImportDetailLog(historyDetailPO);
continue nextRow;
}
if (levelIds != null) {
@ -1990,7 +1982,7 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
historyDetailPO.setRelatedName(relatedName);
historyDetailPO.setOperateDetail("未找到编号[" + schemeNo2 + "]的职级,无法更新");
historyDetailPO.setStatus("0");
saveImportDetailLog(historyDetailPO);
OrgImportUtil.saveImportDetailLog(historyDetailPO);
continue nextRow;
}
@ -2000,7 +1992,7 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
}
historyDetailPO.setOperateDetail("更新成功");
historyDetailPO.setStatus("1");
saveImportDetailLog(historyDetailPO);
OrgImportUtil.saveImportDetailLog(historyDetailPO);
}
}
@ -2039,68 +2031,7 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
cellValue = Util.toHtmlForHrm(cellValue);
return cellValue;
}
/**
*
*/
private Object getReallyValue(ExtendInfoPO extendInfo, String cellValue) throws Exception {
if (StringUtils.isBlank(cellValue)) {
return null;
}
Object object = null;
JSONArray jsonArray = JSONObject.parseArray(extendInfo.getCustomValue());
switch (extendInfo.getControlType()) {
case 1:
String valueType = (String) jsonArray.get(1);
// INPUT
if ("int".equals(valueType)) {
object = Integer.parseInt(cellValue);
} else if ("float".equals(valueType)) {
object = Float.parseFloat(cellValue);
} else if ("text".equals(valueType)) {
object = cellValue;
} else {
try {
object = new BigDecimal(cellValue).toPlainString();
} catch (NumberFormatException ignore) {
object = cellValue;
}
}
break;
case 3:
// BROWSER
org.json.JSONObject jsonObject = new org.json.JSONObject();
jsonObject.put("fieldhtmltype", extendInfo.getControlType());
jsonObject.put("type", extendInfo.getBrowserType());
jsonObject.put("fieldvalue", cellValue);
if ("161".equals(extendInfo.getBrowserType()) || "162".equals(extendInfo.getBrowserType())) {
jsonObject.put("dmlurl", SelectOptionParam.getCustomBrowserId(extendInfo.getCustomValue()));
} else {
jsonObject.put("dmlurl", extendInfo.getBrowserType());
}
jsonObject.put("fieldid", 0);
object = HrmFieldManager.getReallyFieldvalue(jsonObject);
break;
case 5:
// SELECT
JSONObject o = (JSONObject) jsonArray.get(2);
JSONArray datas = o.getJSONArray("datas");
List<FieldSelectOptionBean> options = datas.toJavaList(FieldSelectOptionBean.class);
Map<String, String> optionMap = options.stream().collect(Collectors.toMap(FieldSelectOptionBean::getOption, FieldSelectOptionBean::getId, (k1, k2) -> k1));
object = optionMap.get(cellValue);
break;
case 6:
// FILEUPLOAD
break;
case 4:// CHECKBOX
case 7:// TEXT
case 2:// TEXTAREA
default:
object = cellValue;
break;
}
return object;
}
/**
*
@ -2124,28 +2055,6 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
return false;
}
/**
*
*/
private Long saveImportLog(String importType, String operateType) {
JclImportHistoryPO historyPO = JclImportHistoryPO.builder().operator((long) user.getUID()).operateTime(DateUtil.getFullDate()).clientAddress(user.getLoginip()).importType(importType).sourceFrom("excel").operateType(operateType).status("importing").build();
MapperProxyFactory.getProxy(JclImportHistoryMapper.class).insertHistory(historyPO);
return historyPO.getId();
}
/**
*
*/
private void saveImportDetailLog(JclImportHistoryDetailPO historyDetailPO) {
String relatedName = "";
if (StringUtils.isNotBlank(historyDetailPO.getRelatedName())) {
relatedName = "[" + historyDetailPO.getRelatedName() + "]";
}
String detailMsg = "导入第" + historyDetailPO.getRowNums() + "行数据," + relatedName + historyDetailPO.getOperateDetail();
historyDetailPO.setOperateDetail(detailMsg);
MapperProxyFactory.getProxy(JclImportHistoryDetailMapper.class).insertHistoryDetail(historyDetailPO);
}
/**
*
*/
@ -2273,7 +2182,7 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
if (StringUtils.isNotBlank(operateDetail)) {
historyDetailPO.setOperateDetail(operateDetail);
historyDetailPO.setStatus("0");
saveImportDetailLog(historyDetailPO);
OrgImportUtil.saveImportDetailLog(historyDetailPO);
return true;
}
return false;
@ -2301,7 +2210,7 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
if (StringUtils.isNotBlank(operateDetail)) {
historyDetailPO.setOperateDetail(operateDetail);
historyDetailPO.setStatus("0");
saveImportDetailLog(historyDetailPO);
OrgImportUtil.saveImportDetailLog(historyDetailPO);
return true;
}
return false;

@ -19,6 +19,7 @@ import com.engine.organization.util.relation.EcHrmRelationUtil;
import com.engine.organization.util.relation.ResourceSyncUtil;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils;
import weaver.conn.RecordSet;
import weaver.general.Util;
import weaver.hrm.User;
@ -155,7 +156,7 @@ public class OrganizationSyncEc {
}
}
private void refreshResource(){
private void refreshResource() {
switch (operateType) {
case ADD:
addResource();
@ -225,7 +226,7 @@ public class OrganizationSyncEc {
String oldName = oldJobPO.getJobName();
String newName = Util.null2String(params.get("job_name"));
if(newName.equals(oldName)){
if (newName.equals(oldName)) {
this.resultMap = new HashMap<>();
this.resultMap.put("sign", "1");
return;
@ -420,8 +421,7 @@ public class OrganizationSyncEc {
*/
private void updateDepartment() {
Map<String, Object> map = new HashMap<>();
// 获取ec表ID
map.put("id", EcHrmRelationUtil.getEcDepartmentId(Util.null2String(params.get("id"))));
buildEcDepartmentData(map);
map.put("departmentmark", Util.null2String(params.get("dept_name_short")));
map.put("departmentname", Util.null2String(params.get("dept_name")));
@ -468,8 +468,8 @@ public class OrganizationSyncEc {
private void updateCompany() {
Map<String, Object> map = new HashMap<>();
// 获取ec表ID
map.put("id", EcHrmRelationUtil.getEcCompanyId(Util.null2String(params.get("id"))));
params.put("id", EcHrmRelationUtil.getEcCompanyId(Util.null2String(params.get("id"))));
buildEcCompanyData(map);
// 上级分部通过UUID联查ec表ID
String parentCompany = Util.null2String(params.get("parent_company"));
if (StringUtils.isNotBlank(parentCompany)) {
@ -519,4 +519,50 @@ public class OrganizationSyncEc {
this.resultMap = ServiceUtil.getService(OrganizationServiceImpl.class, user).doSubCompanyCancel(map, user);
}
}
private void buildEcCompanyData(Map<String, Object> map) {
String ecCompanyId = EcHrmRelationUtil.getEcCompanyId(Util.null2String(params.get("id")));
map.put("id", ecCompanyId);
RecordSet rs = new RecordSet();
// 先查拓展表
rs.execute("select * from hrmsubcompanydefined where subcomid = '" + ecCompanyId + "'");
int colcount = rs.getColCounts();
if (rs.next()) {
for (int i = 1; i <= colcount; i++) {
map.put(rs.getColumnName(i).toLowerCase(), Util.null2String(rs.getString(i)));
}
}
// 再查主表
rs.execute("select * from hrmsubcompany where id = '" + ecCompanyId + "'");
colcount = rs.getColCounts();
if (rs.next()) {
for (int i = 1; i <= colcount; i++) {
map.put(rs.getColumnName(i).toLowerCase(), Util.null2String(rs.getString(i)));
}
}
}
private void buildEcDepartmentData(Map<String, Object> map) {
String ecDepartment = EcHrmRelationUtil.getEcDepartmentId(Util.null2String(params.get("id")));
map.put("id", ecDepartment);
RecordSet rs = new RecordSet();
// 先查拓展表
rs.execute("select * from hrmdepartmentdefined where deptid = '" + ecDepartment + "'");
int colcount = rs.getColCounts();
if (rs.next()) {
for (int i = 1; i <= colcount; i++) {
map.put(rs.getColumnName(i).toLowerCase(), Util.null2String(rs.getString(i)));
}
}
// 再查主表
rs.execute("select * from hrmdepartment where id = '" + ecDepartment + "'");
colcount = rs.getColCounts();
if (rs.next()) {
for (int i = 1; i <= colcount; i++) {
map.put(rs.getColumnName(i).toLowerCase(), Util.null2String(rs.getString(i)));
}
}
}
}

@ -989,47 +989,14 @@ public class ResourceSyncUtil {
ecResourceId = MapperProxyFactory.getProxy(ResourceMapper.class).getEcResourceId(jclResourceId);
}
// 更新人员时,初始化人员参数
if(StringUtils.isNotBlank(ecResourceId)){
if (StringUtils.isNotBlank(ecResourceId)) {
RecordSet rs = new RecordSet();
rs.execute("select * from hrmresource where id = '" + ecResourceId + "'");
if(rs.next()){
convertParams.put("id",rs.getString("id"));
convertParams.put("loginid",rs.getString("loginid"));
convertParams.put("accounttype",rs.getString("accounttype"));
convertParams.put("password",rs.getString("password"));
convertParams.put("seclevel",rs.getString("seclevel"));
convertParams.put("workstartdate",rs.getString("workstartdate"));
convertParams.put("companystartdate",rs.getString("companystartdate"));
convertParams.put("dsporder",rs.getString("dsporder"));
convertParams.put("workcode",rs.getString("workcode"));
convertParams.put("lastname",rs.getString("lastname"));
convertParams.put("sex",rs.getString("sex"));
convertParams.put("resourceimageid",rs.getString("resourceimageid"));
convertParams.put("joblevel",rs.getString("joblevel"));
convertParams.put("jobactivitydesc",rs.getString("jobactivitydesc"));
convertParams.put("managerid",rs.getString("managerid"));
convertParams.put("assistantid",rs.getString("assistantid"));
convertParams.put("status",rs.getString("status"));
convertParams.put("locationid",rs.getString("locationid"));
convertParams.put("workroom",rs.getString("workroom"));
convertParams.put("telephone",rs.getString("telephone"));
convertParams.put("mobile",rs.getString("mobile"));
convertParams.put("mobilecall",rs.getString("mobilecall"));
convertParams.put("fax",rs.getString("fax"));
convertParams.put("jobcall",rs.getString("jobcall"));
convertParams.put("email",rs.getString("email"));
convertParams.put("systemlanguage",rs.getString("systemlanguage"));
convertParams.put("belongto",rs.getString("belongto"));
convertParams.put("mobileshowtype",rs.getString("mobileshowtype"));
convertParams.put("costcenterid",rs.getString("costcenterid"));
convertParams.put("cmd",rs.getString("cmd"));
convertParams.put("rcId",rs.getString("rcId"));
convertParams.put("departmentvirtualids",rs.getString("departmentvirtualids"));
// 更新EC人员用到参数
convertParams.put("editcontact",rs.getString("editcontact"));
convertParams.put("resourceimageBase64",rs.getString("resourceimageBase64"));
convertParams.put("oldresourceimage",rs.getString("oldresourceimage"));
int colcount = rs.getColCounts();
if (rs.next()) {
for (int i = 1; i <= colcount; i++) {
convertParams.put(rs.getColumnName(i).toLowerCase(), Util.null2String(rs.getString(i)));
}
}
}

@ -9,8 +9,10 @@ import com.engine.organization.entity.jclimport.po.JclImportHistoryDetailPO;
import com.engine.organization.entity.jclimport.po.JclImportHistoryPO;
import com.engine.organization.mapper.jclimport.JclImportHistoryDetailMapper;
import com.engine.organization.mapper.jclimport.JclImportHistoryMapper;
import com.engine.organization.util.OrganizationAssert;
import com.engine.organization.util.db.MapperProxyFactory;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.validator.GenericValidator;
import org.apache.poi.hssf.usermodel.HSSFDateUtil;
import org.apache.poi.xssf.usermodel.XSSFCell;
import weaver.common.DateUtil;
@ -18,6 +20,7 @@ import weaver.general.Util;
import weaver.hrm.User;
import weaver.hrm.definedfield.HrmFieldManager;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.List;
import java.util.Map;
@ -77,7 +80,11 @@ public class OrgImportUtil {
} else if ("float".equals(valueType)) {
object = Float.parseFloat(cellValue);
} else {
object = cellValue;
try {
object = new BigDecimal(cellValue).toPlainString();
} catch (NumberFormatException ignore) {
object = cellValue;
}
}
break;
case 3:
@ -93,6 +100,10 @@ public class OrgImportUtil {
}
jsonObject.put("fieldid", 0);
object = HrmFieldManager.getReallyFieldvalue(jsonObject);
// 如果是日期,校验日期的合法性
if ("2".equals(extendInfo.getBrowserType())) {
OrganizationAssert.isTrue(GenericValidator.isDate(Util.null2String(object), "yyyy-MM-dd", true), Util.null2String(object) + "日期转换失败");
}
break;
case 5:
// SELECT

Loading…
Cancel
Save