From 01d0bbdcfd5c255ebed098c037dc262346563c19 Mon Sep 17 00:00:00 2001 From: dxfeng Date: Wed, 8 Mar 2023 13:50:04 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B1=89=E6=A1=91=E9=83=A8=E9=97=A8=E9=9C=80?= =?UTF-8?q?=E6=B1=82=E4=BA=8C=E5=BC=80=EF=BC=8C=E6=B7=BB=E5=8A=A0=E9=83=A8?= =?UTF-8?q?=E9=97=A8=E5=90=AF=E7=94=A8=E6=97=B6=E9=97=B4=E3=80=81=E5=B0=81?= =?UTF-8?q?=E5=AD=98=E6=97=B6=E9=97=B4=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/DepartmentServiceImpl.java | 25 +++++++++++++++++-- .../util/saveimport/DepartmentImport.java | 4 +-- 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/src/com/engine/organization/service/impl/DepartmentServiceImpl.java b/src/com/engine/organization/service/impl/DepartmentServiceImpl.java index 5aaeed0c..ccf18268 100644 --- a/src/com/engine/organization/service/impl/DepartmentServiceImpl.java +++ b/src/com/engine/organization/service/impl/DepartmentServiceImpl.java @@ -184,10 +184,10 @@ public class DepartmentServiceImpl extends Service implements DepartmentService String currentDate = DateUtil.getCurrentDate(); OrganizationAssert.notBlank(enableDate, "启用日期必填"); - OrganizationAssert.isTrue(DateUtil.compDate(currentDate, enableDate) >= 0, "启用日期大于等于当前日期"); + OrganizationAssert.isTrue(DateUtil.compDate(currentDate, enableDate) >= 0, "启用日期需大于等于当前日期"); if (StringUtils.isNotBlank(disableDate)) { - OrganizationAssert.isTrue(DateUtil.compDate(enableDate, disableDate) > 0, "启用日期小于封存日期"); + OrganizationAssert.isTrue(DateUtil.compDate(enableDate, disableDate) > 0, "启用日期需小于封存日期"); } Map syncMap = new OrganizationSyncEc(user, LogModuleNameEnum.DEPARTMENT, OperateTypeEnum.ADD, params).sync(); @@ -223,6 +223,27 @@ public class DepartmentServiceImpl extends Service implements DepartmentService } OrganizationAssert.isFalse(disableIds.contains(Integer.parseInt(supDepId)), "上级部门不能选择部门本身及其下级部门"); } + // 汉桑需求二开,启用日期、封存日期校验 + + String enableDate = Util.null2String(params.get("qyrq")); + String disableDate = Util.null2String(params.get("fcrq")); + String currentDate = DateUtil.getCurrentDate(); + OrganizationAssert.notBlank(enableDate, "启用日期必填"); + String oldEnableDate = ""; + + RecordSet rs = new RecordSet(); + rs.executeQuery("select qyrq,fcrq from hrmdepartmentdefined where deptid = ?", ecDepartmentId); + if (rs.next()) { + oldEnableDate = rs.getString("qyrq"); + } + + if (!oldEnableDate.equals(enableDate)) { + OrganizationAssert.isTrue(DateUtil.compDate(currentDate, enableDate) >= 0, "启用日期需大于等于当前日期"); + } + if (StringUtils.isNotBlank(disableDate)) { + OrganizationAssert.isTrue(DateUtil.compDate(enableDate, disableDate) > 0, "启用日期需小于封存日期"); + } + new OrganizationSyncEc(user, LogModuleNameEnum.DEPARTMENT, OperateTypeEnum.UPDATE, params).sync(); return (long) ecDepartmentId; diff --git a/src/com/engine/organization/util/saveimport/DepartmentImport.java b/src/com/engine/organization/util/saveimport/DepartmentImport.java index 203f0a55..4864d93f 100644 --- a/src/com/engine/organization/util/saveimport/DepartmentImport.java +++ b/src/com/engine/organization/util/saveimport/DepartmentImport.java @@ -305,7 +305,7 @@ public class DepartmentImport { if (StringUtils.isNotBlank(enableDate)) { String currentDate = DateUtil.getCurrentDate(); if (DateUtil.compDate(currentDate, enableDate) < 0) { - historyDetailPO.setOperateDetail("启用日期大于等于当前日期"); + historyDetailPO.setOperateDetail("启用日期需大于等于当前日期"); historyDetailPO.setStatus("0"); OrgImportUtil.saveImportDetailLog(historyDetailPO); continue; @@ -314,7 +314,7 @@ public class DepartmentImport { if (StringUtils.isNotBlank(disableDate)) { if (DateUtil.compDate(enableDate, disableDate) <= 0) { - historyDetailPO.setOperateDetail("启用日期小于封存日期"); + historyDetailPO.setOperateDetail("启用日期需小于封存日期"); historyDetailPO.setStatus("0"); OrgImportUtil.saveImportDetailLog(historyDetailPO); continue;