汉桑部门需求二开,添加部门启用时间、封存时间校验
This commit is contained in:
parent
613cadfcd0
commit
60a874874e
|
|
@ -46,6 +46,7 @@ import com.engine.organization.util.tree.SearchTreeUtil;
|
|||
import com.google.common.collect.Lists;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import weaver.common.DateUtil;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.general.StringUtil;
|
||||
import weaver.general.Util;
|
||||
|
|
@ -173,6 +174,22 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
|
|||
@Override
|
||||
public Long saveBaseForm(Map<String, Object> params) {
|
||||
HasRightUtil.hasRight(user, RIGHT_NAME, false);
|
||||
/*
|
||||
* 汉桑部门需求二开,添加部门启用时间、封存时间校验
|
||||
* 启用时间、封存时间必须大于等于当前日期;
|
||||
* 启用日期小于封存日期;
|
||||
*/
|
||||
String enableDate = Util.null2String(params.get("qyrq"));
|
||||
String disableDate = Util.null2String(params.get("fcrq"));
|
||||
String currentDate = DateUtil.getCurrentDate();
|
||||
|
||||
OrganizationAssert.notBlank(enableDate, "启用时间必填");
|
||||
OrganizationAssert.isTrue(DateUtil.compDate(currentDate, enableDate) >= 0, "启用时间大于等于当前日期");
|
||||
|
||||
if (StringUtils.isNotBlank(disableDate)) {
|
||||
OrganizationAssert.isTrue(DateUtil.compDate(enableDate, disableDate) > 0, "启用日期小于封存日期");
|
||||
}
|
||||
|
||||
Map<String, Object> syncMap = new OrganizationSyncEc(user, LogModuleNameEnum.DEPARTMENT, OperateTypeEnum.ADD, params).sync();
|
||||
String ecCompanyID = Util.null2String(syncMap.get("id"));
|
||||
OrganizationAssert.isTrue(StringUtils.isNotBlank(ecCompanyID), syncMap.get("message").toString());
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in New Issue