|
|
|
@ -22,6 +22,7 @@ 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.Util;
|
|
|
|
|
import weaver.hrm.User;
|
|
|
|
@ -175,6 +176,8 @@ public class DepartmentImport {
|
|
|
|
|
Integer parentCompanyId = null;
|
|
|
|
|
Integer parentDepartmentId = null;
|
|
|
|
|
String departmentName = "";
|
|
|
|
|
String enableDate = "";
|
|
|
|
|
String disableDate = "";
|
|
|
|
|
|
|
|
|
|
historyDetailPO.setRowNums(String.valueOf(i + 1));
|
|
|
|
|
for (int cellIndex = 0; cellIndex < lastCellNum; cellIndex++) {
|
|
|
|
@ -280,13 +283,51 @@ public class DepartmentImport {
|
|
|
|
|
map.put("departmentmark", departmentName);
|
|
|
|
|
map.put("departmentname", departmentName);
|
|
|
|
|
}
|
|
|
|
|
if ("qyrq".equals(infoPO.getFieldName())) {
|
|
|
|
|
enableDate = cellValue;
|
|
|
|
|
}
|
|
|
|
|
if ("fcrq".equals(infoPO.getFieldName())) {
|
|
|
|
|
disableDate = cellValue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// 校验、数据交互
|
|
|
|
|
if (i == 0) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* 汉桑部门需求二开,添加部门启用时间、封存时间校验
|
|
|
|
|
* 启用时间、封存时间必须大于等于当前日期;
|
|
|
|
|
* 启用日期小于封存日期;
|
|
|
|
|
*/
|
|
|
|
|
if (StringUtils.isNotBlank(enableDate)) {
|
|
|
|
|
String currentDate = DateUtil.getCurrentDate();
|
|
|
|
|
if (DateUtil.compDate(currentDate, enableDate) < 0) {
|
|
|
|
|
historyDetailPO.setOperateDetail("启用时间大于等于当前日期");
|
|
|
|
|
historyDetailPO.setStatus("0");
|
|
|
|
|
OrgImportUtil.saveImportDetailLog(historyDetailPO);
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (StringUtils.isNotBlank(disableDate)) {
|
|
|
|
|
if (DateUtil.compDate(enableDate, disableDate) <= 0) {
|
|
|
|
|
historyDetailPO.setOperateDetail("启用日期小于封存日期");
|
|
|
|
|
historyDetailPO.setStatus("0");
|
|
|
|
|
OrgImportUtil.saveImportDetailLog(historyDetailPO);
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ("add".equals(operateType)) {
|
|
|
|
|
if (StringUtils.isBlank(enableDate)) {
|
|
|
|
|
historyDetailPO.setOperateDetail("启用日期为必填项");
|
|
|
|
|
historyDetailPO.setStatus("0");
|
|
|
|
|
OrgImportUtil.saveImportDetailLog(historyDetailPO);
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
Map<String, Object> syncMap = new OrganizationSyncEc(user, LogModuleNameEnum.DEPARTMENT, OperateTypeEnum.ADD, map, false).sync();
|
|
|
|
|
if (OrgImportUtil.isThrowError(syncMap)) {
|
|
|
|
|
// 查询UUID
|
|
|
|
|