|
|
@ -137,15 +137,15 @@ public class WorkActServiceImpl implements WorkActService { |
|
|
|
@Override |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public PublishActResultDTO publishAct(PublishActInfoFormDTO formDTO) { |
|
|
|
//构造属性保存活动属性,活动内容
|
|
|
|
ActInfoEntity actInfoEntity=this.constructActInfo(formDTO); |
|
|
|
//校验参数
|
|
|
|
this.checkPublishFormDTO(formDTO); |
|
|
|
this.checkPublishFormDTO(actInfoEntity); |
|
|
|
PublishActResultDTO publishActResultDTO=new PublishActResultDTO(); |
|
|
|
//内容审核(活动标题、招募要求、活动内容图文)
|
|
|
|
this.auditAct(formDTO); |
|
|
|
logger.info("发布活动,审核成功"); |
|
|
|
|
|
|
|
//构造属性保存活动属性,活动内容
|
|
|
|
ActInfoEntity actInfoEntity=this.constructActInfo(formDTO); |
|
|
|
actInfoDao.insert(actInfoEntity); |
|
|
|
|
|
|
|
List<ActContentEntity> actContentEntityList=this.constructActContent(formDTO.getActContent(),actInfoEntity.getId()); |
|
|
@ -169,44 +169,23 @@ public class WorkActServiceImpl implements WorkActService { |
|
|
|
|
|
|
|
/** |
|
|
|
* @return void |
|
|
|
* @param formDTO |
|
|
|
* @param actInfoEntity |
|
|
|
* @author yinzuomei |
|
|
|
* @description 第一次发布 |
|
|
|
* @Date 2020/7/24 16:45 |
|
|
|
**/ |
|
|
|
private void checkPublishFormDTO(PublishActInfoFormDTO formDTO) { |
|
|
|
private void checkPublishFormDTO(ActInfoEntity actInfoEntity) { |
|
|
|
//1、活动预计开始时间、活动预计结束时间
|
|
|
|
if(formDTO.getActStartTime().compareTo(formDTO.getActEndTime())!=-1){ |
|
|
|
if(actInfoEntity.getActStartTime().compareTo(actInfoEntity.getActEndTime())!=-1){ |
|
|
|
throw new RenException(EpmetErrorCode.ACT_START_TIME_ERROR.getCode()); |
|
|
|
} |
|
|
|
//2、签到开始时间、签到结束时间
|
|
|
|
if(formDTO.getSignInStartTime().compareTo(formDTO.getSignInEndTime())!=-1){ |
|
|
|
if(actInfoEntity.getSignInStartTime().compareTo(actInfoEntity.getSignInEndTime())!=-1){ |
|
|
|
throw new RenException(EpmetErrorCode.ACT_SIGN_IN_START_TIME_ERROR.getCode()); |
|
|
|
} |
|
|
|
int n=actInfoEntity.getSignUpEndTime().compareTo(actInfoEntity.getActStartTime()); |
|
|
|
//3、报名截止时间(应该在活动预计开始时间之前)
|
|
|
|
if(formDTO.getSignUpEndTime().compareTo(formDTO.getActStartTime())!=-1){ |
|
|
|
throw new RenException((EpmetErrorCode.ACT_SIGN_UP_END_TIME_ERROR.getCode())); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @return void |
|
|
|
* @param formDTO |
|
|
|
* @author yinzuomei |
|
|
|
* @description 重新发布 |
|
|
|
* @Date 2020/7/24 16:45 |
|
|
|
**/ |
|
|
|
private void checkRePublishFormDTO(RePublishFormDTO formDTO) { |
|
|
|
//1、活动预计开始时间、活动预计结束时间
|
|
|
|
if(formDTO.getActStartTime().compareTo(formDTO.getActEndTime())!=-1){ |
|
|
|
throw new RenException(EpmetErrorCode.ACT_START_TIME_ERROR.getCode()); |
|
|
|
} |
|
|
|
//2、签到开始时间、签到结束时间
|
|
|
|
if(formDTO.getSignInStartTime().compareTo(formDTO.getSignInEndTime())!=-1){ |
|
|
|
throw new RenException(EpmetErrorCode.ACT_SIGN_IN_START_TIME_ERROR.getCode()); |
|
|
|
} |
|
|
|
//3、报名截止时间(应该在活动预计开始时间之前)
|
|
|
|
if(formDTO.getSignUpEndTime().compareTo(formDTO.getActStartTime())!=-1){ |
|
|
|
if(n!=-1){ |
|
|
|
throw new RenException((EpmetErrorCode.ACT_SIGN_UP_END_TIME_ERROR.getCode())); |
|
|
|
} |
|
|
|
} |
|
|
@ -215,10 +194,10 @@ public class WorkActServiceImpl implements WorkActService { |
|
|
|
SimpleDateFormat format=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
|
|
|
|
|
|
|
try { |
|
|
|
Date yesterDate=format.parse("2020-07-25 13:00:00"); |
|
|
|
Date today=format.parse("2020-07-26 13:00:00"); |
|
|
|
Date tommorrow=format.parse("2020-07-27 13:00:00"); |
|
|
|
Date today1=format.parse("2020-07-26 13:00:00"); |
|
|
|
Date yesterDate=format.parse("2020-07-26 13:00:00"); |
|
|
|
Date today=format.parse("2020-07-27 13:00:00"); |
|
|
|
Date tommorrow=format.parse("2020-07-28 13:00:00"); |
|
|
|
Date today1=format.parse("2020-07-27 13:00:00"); |
|
|
|
System.out.println(yesterDate.compareTo(today)); |
|
|
|
System.out.println(tommorrow.compareTo(today)); |
|
|
|
System.out.println(today.compareTo(today1)); |
|
|
@ -644,6 +623,7 @@ public class WorkActServiceImpl implements WorkActService { |
|
|
|
List<UserMessageFormDTO> userMessageFormDTOS=new ArrayList<>(); |
|
|
|
for(String userId:userIdList){ |
|
|
|
UserMessageFormDTO userMessageFormDTO = new UserMessageFormDTO(); |
|
|
|
userMessageFormDTO.setCustomerId(actInfoDTO.getCustomerId()); |
|
|
|
userMessageFormDTO.setUserId(userId); |
|
|
|
userMessageFormDTO.setGridId(StrConstant.STAR); |
|
|
|
userMessageFormDTO.setApp(AppClientConstant.APP_RESI); |
|
|
@ -960,6 +940,9 @@ public class WorkActServiceImpl implements WorkActService { |
|
|
|
if(!actInfoDTO.getCreatedBy().equals(loginUserUtil.getLoginUserId())){ |
|
|
|
throw new RenException(EpmetErrorCode.REQUIRE_PERMISSION.getCode()); |
|
|
|
} |
|
|
|
if(!ActConstant.ACT_STATUS_PUBLISHED.equals(actInfoDTO.getActStatus())){ |
|
|
|
throw new RenException("只有进行中的活动才可以编辑"); |
|
|
|
} |
|
|
|
ReEditActInfoResultDTO resultDTO= ConvertUtils.sourceToTarget(actInfoDTO, ReEditActInfoResultDTO.class); |
|
|
|
resultDTO.setActId(actId); |
|
|
|
List<ActPreviewContentResultDTO> actContent=actContentDao.selectByActId(actId); |
|
|
@ -984,15 +967,18 @@ public class WorkActServiceImpl implements WorkActService { |
|
|
|
if(!originalActInfo.getCreatedBy().equals(loginUserUtil.getLoginUserId())){ |
|
|
|
throw new RenException(EpmetErrorCode.REQUIRE_PERMISSION.getCode()); |
|
|
|
} |
|
|
|
if(!ActConstant.ACT_STATUS_PUBLISHED.equals(originalActInfo.getActStatus())){ |
|
|
|
throw new RenException("只有进行中的活动才可以编辑"); |
|
|
|
} |
|
|
|
//构造属性保存活动属性,活动内容
|
|
|
|
ActInfoEntity newActInfoEntity=this.constructRePublishActInfo(rePublishFormDTO); |
|
|
|
//校验参数
|
|
|
|
this.checkRePublishFormDTO(rePublishFormDTO); |
|
|
|
this.checkPublishFormDTO(newActInfoEntity); |
|
|
|
PublishActResultDTO publishActResultDTO=new PublishActResultDTO(); |
|
|
|
//内容审核(活动标题、招募要求、活动内容图文)
|
|
|
|
this.auditRePublishAct(rePublishFormDTO); |
|
|
|
logger.info("重新发布活动,审核成功"); |
|
|
|
|
|
|
|
//构造属性保存活动属性,活动内容
|
|
|
|
ActInfoEntity newActInfoEntity=this.constructRePublishActInfo(rePublishFormDTO); |
|
|
|
newActInfoEntity.setId(rePublishFormDTO.getActId()); |
|
|
|
actInfoDao.updateById(newActInfoEntity); |
|
|
|
//删除原来的
|
|
|
|