Browse Source

校验 活动报名截止时间应该大于当前时间

dev_shibei_match
jianjun 5 years ago
parent
commit
b121532f1d
  1. 1
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java
  2. 14
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActServiceImpl.java

1
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, "该机关存在下级机关,不允许删除"),

14
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);

Loading…
Cancel
Save