From b121532f1dc0e07e5d1d086c4182475f526e7409 Mon Sep 17 00:00:00 2001 From: jianjun Date: Fri, 7 Aug 2020 17:11:56 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A0=A1=E9=AA=8C=20=E6=B4=BB=E5=8A=A8?= =?UTF-8?q?=E6=8A=A5=E5=90=8D=E6=88=AA=E6=AD=A2=E6=97=B6=E9=97=B4=E5=BA=94?= =?UTF-8?q?=E8=AF=A5=E5=A4=A7=E4=BA=8E=E5=BD=93=E5=89=8D=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../commons/tools/exception/EpmetErrorCode.java | 1 + .../com/epmet/service/impl/WorkActServiceImpl.java | 14 ++++++++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java index 1ca4a859fd..fbbeebccbf 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java @@ -61,6 +61,7 @@ public enum EpmetErrorCode { HAVE_HANDLE(8123,"存在待处理事项,请先处理"), ACTUAL_TIME(8124,"请录入实际开始时间,实际结束时间"), ACTUAL_NOT_FINISHED(8125,"请先结束活动"), + ACT_SIGN_UP_END_TIME_EARLIER_NOW_EERROR(8121,"活动报名截止时间应晚于当前时间"), CANNOT_AUDIT_WARM(8201, "请完善居民信息"), NOT_DEL_AGENCY(8202, "该机关存在下级机关,不允许删除"), diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActServiceImpl.java index 4656baf0ee..740c446f37 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActServiceImpl.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActServiceImpl.java @@ -147,6 +147,11 @@ public class WorkActServiceImpl implements WorkActService { //构造属性保存活动属性,活动内容 ActInfoEntity actInfoEntity=this.constructActInfo(formDTO); //校验参数 + + //校验 活动报名截止时间应该大于当前时间 + if (actInfoEntity.getSignUpEndTime().before(DateUtils.minStrToSecondDate(DateUtils.format(new Date(), DateUtils.DATE_TIME_PATTERN_END_WITH_MINUTE)))){ + throw new RenException(EpmetErrorCode.ACT_SIGN_UP_END_TIME_EARLIER_NOW_EERROR.getCode(),EpmetErrorCode.ACT_SIGN_UP_END_TIME_EARLIER_NOW_EERROR.getMsg()); + } this.checkPublishFormDTO(actInfoEntity); PublishActResultDTO publishActResultDTO=new PublishActResultDTO(); //内容审核(活动标题、招募要求、活动内容图文) @@ -186,18 +191,19 @@ public class WorkActServiceImpl implements WorkActService { * @Date 2020/7/24 16:45 **/ private void checkPublishFormDTO(ActInfoEntity actInfoEntity) { + // //1、活动预计开始时间、活动预计结束时间 if(actInfoEntity.getActStartTime().compareTo(actInfoEntity.getActEndTime())!=-1){ - throw new RenException(EpmetErrorCode.ACT_START_TIME_ERROR.getCode()); + throw new RenException(EpmetErrorCode.ACT_START_TIME_ERROR.getCode(),EpmetErrorCode.ACT_START_TIME_ERROR.getMsg()); } //2、签到开始时间、签到结束时间 if(actInfoEntity.getSignInStartTime().compareTo(actInfoEntity.getSignInEndTime())!=-1){ - throw new RenException(EpmetErrorCode.ACT_SIGN_IN_START_TIME_ERROR.getCode()); + throw new RenException(EpmetErrorCode.ACT_SIGN_IN_START_TIME_ERROR.getCode(),EpmetErrorCode.ACT_SIGN_IN_START_TIME_ERROR.getMsg()); } int n=actInfoEntity.getSignUpEndTime().compareTo(actInfoEntity.getActStartTime()); //3、报名截止时间(应该在活动预计开始时间之前) if(n!=-1){ - throw new RenException((EpmetErrorCode.ACT_SIGN_UP_END_TIME_ERROR.getCode())); + throw new RenException(EpmetErrorCode.ACT_SIGN_UP_END_TIME_ERROR.getCode(),EpmetErrorCode.ACT_SIGN_UP_END_TIME_ERROR.getMsg()); } } @@ -327,7 +333,7 @@ public class WorkActServiceImpl implements WorkActService { if(result.success()&&null!=result.getData()){ actInfoEntity.setPid(result.getData().getPid()); }else{ - logger.warn("根据agencyId查询组织信息失败,agencyId=",formDTO.getSponsorId()); + logger.warn("根据agencyId查询组织信息失败,agencyId={}",formDTO.getSponsorId()); } }else{ actInfoEntity.setPid(StrConstant.EPMETY_STR);