|
|
@ -1,24 +1,57 @@ |
|
|
|
package com.epmet.service.impl; |
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSON; |
|
|
|
import com.epmet.commons.tools.constant.AppClientConstant; |
|
|
|
import com.epmet.commons.tools.constant.StrConstant; |
|
|
|
import com.epmet.commons.tools.exception.EpmetErrorCode; |
|
|
|
import com.epmet.commons.tools.exception.RenException; |
|
|
|
import com.epmet.commons.tools.scan.param.ImgScanParamDTO; |
|
|
|
import com.epmet.commons.tools.scan.param.ImgTaskDTO; |
|
|
|
import com.epmet.commons.tools.scan.param.TextScanParamDTO; |
|
|
|
import com.epmet.commons.tools.scan.param.TextTaskDTO; |
|
|
|
import com.epmet.commons.tools.scan.result.SyncScanResult; |
|
|
|
import com.epmet.commons.tools.security.user.LoginUserUtil; |
|
|
|
import com.epmet.commons.tools.utils.ConvertUtils; |
|
|
|
import com.epmet.commons.tools.utils.Result; |
|
|
|
import com.epmet.commons.tools.utils.ScanContentUtils; |
|
|
|
import com.epmet.constant.ActConstant; |
|
|
|
import com.epmet.constant.ActMessageConstant; |
|
|
|
import com.epmet.constant.ReadFlagConstant; |
|
|
|
import com.epmet.dao.ActContentDao; |
|
|
|
import com.epmet.dao.ActInfoDao; |
|
|
|
import com.epmet.dao.ActOperationRecDao; |
|
|
|
import com.epmet.dao.ActUserRelationDao; |
|
|
|
import com.epmet.dto.ActInfoDTO; |
|
|
|
import com.epmet.dto.CustomerAgencyDTO; |
|
|
|
import com.epmet.dto.form.UserMessageFormDTO; |
|
|
|
import com.epmet.dto.form.work.ActListCommonFormDTO; |
|
|
|
import com.epmet.dto.form.work.CancelActFormDTO; |
|
|
|
import com.epmet.dto.form.work.PublishActContentFormDTO; |
|
|
|
import com.epmet.dto.form.work.PublishActInfoFormDTO; |
|
|
|
import com.epmet.dto.result.ActSponsorResultDTO; |
|
|
|
import com.epmet.dto.result.work.*; |
|
|
|
import com.epmet.entity.ActContentEntity; |
|
|
|
import com.epmet.entity.ActInfoEntity; |
|
|
|
import com.epmet.entity.ActOperationRecEntity; |
|
|
|
import com.epmet.feign.EpmetMessageOpenFeignClient; |
|
|
|
import com.epmet.feign.GovOrgOpenFeignClient; |
|
|
|
import com.epmet.service.ActInfoService; |
|
|
|
import com.epmet.service.LatestActInfoService; |
|
|
|
import com.epmet.service.WorkActService; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.apache.logging.log4j.LogManager; |
|
|
|
import org.apache.logging.log4j.Logger; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.beans.factory.annotation.Value; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
import java.text.ParseException; |
|
|
|
import java.text.SimpleDateFormat; |
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.Date; |
|
|
|
import java.util.List; |
|
|
|
import java.util.UUID; |
|
|
|
|
|
|
|
/** |
|
|
|
* 描述一下 |
|
|
@ -29,12 +62,44 @@ import java.util.List; |
|
|
|
@Service |
|
|
|
public class WorkActServiceImpl implements WorkActService { |
|
|
|
private Logger logger = LogManager.getLogger(WorkActServiceImpl.class); |
|
|
|
@Value("${openapi.scan.server.url}") |
|
|
|
private String scanApiUrl; |
|
|
|
@Value("${openapi.scan.method.textSyncScan}") |
|
|
|
private String textSyncScanMethod; |
|
|
|
@Value("${openapi.scan.method.imgSyncScan}") |
|
|
|
private String imgSyncScanMethod; |
|
|
|
@Autowired |
|
|
|
private GovOrgOpenFeignClient govOrgOpenFeignClient; |
|
|
|
@Autowired |
|
|
|
private LoginUserUtil loginUserUtil; |
|
|
|
@Autowired |
|
|
|
private ActInfoDao actInfoDao; |
|
|
|
@Autowired |
|
|
|
private LatestActInfoService latestActInfoService; |
|
|
|
@Autowired |
|
|
|
private ActContentDao actContentDao; |
|
|
|
@Autowired |
|
|
|
private ActOperationRecDao actOperationRecDao; |
|
|
|
@Autowired |
|
|
|
private ActInfoService actInfoService; |
|
|
|
@Autowired |
|
|
|
private ActUserRelationDao actUserRelationDao; |
|
|
|
@Autowired |
|
|
|
private EpmetMessageOpenFeignClient epmetMessageOpenFeignClient; |
|
|
|
|
|
|
|
/** |
|
|
|
* @return void |
|
|
|
* @author yinzuomei |
|
|
|
* @description 发布活动-删除历史活动草稿 |
|
|
|
* @Date 2020/7/20 18:15 |
|
|
|
**/ |
|
|
|
@Override |
|
|
|
public void deleteDraft() { |
|
|
|
String currentUserId=loginUserUtil.getLoginUserId(); |
|
|
|
if(StringUtils.isNotBlank(currentUserId)){ |
|
|
|
latestActInfoService.deleteAllDraft(currentUserId); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @return com.epmet.dto.result.work.SponsorResultDTO |
|
|
@ -59,6 +124,308 @@ public class WorkActServiceImpl implements WorkActService { |
|
|
|
return null; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @param formDTO |
|
|
|
* @return com.epmet.dto.result.work.PublishActResultDTO |
|
|
|
* @author yinzuomei |
|
|
|
* @description 发布活动 |
|
|
|
* @Date 2020/7/21 18:33 |
|
|
|
**/ |
|
|
|
@Override |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public PublishActResultDTO publishAct(PublishActInfoFormDTO formDTO) { |
|
|
|
//校验参数
|
|
|
|
this.checkPublishFormDTO(formDTO); |
|
|
|
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()); |
|
|
|
for(ActContentEntity actContentEntity:actContentEntityList){ |
|
|
|
actContentDao.insert(actContentEntity); |
|
|
|
} |
|
|
|
//插入一条操作日志
|
|
|
|
ActOperationRecEntity actOperationRecEntity=new ActOperationRecEntity(); |
|
|
|
actOperationRecEntity.setActId(actInfoEntity.getId()); |
|
|
|
actOperationRecEntity.setType(ActConstant.ACT_OPER_TYPE_PUBLISH); |
|
|
|
actOperationRecEntity.setNoticeUser(false); |
|
|
|
actOperationRecEntity.setRemark(StrConstant.EPMETY_STR); |
|
|
|
actOperationRecDao.insert(actOperationRecEntity); |
|
|
|
|
|
|
|
//删除所有的草稿
|
|
|
|
this.deleteDraft(); |
|
|
|
publishActResultDTO.setActId(actInfoEntity.getId()); |
|
|
|
|
|
|
|
return publishActResultDTO; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @return void |
|
|
|
* @param formDTO |
|
|
|
* @author yinzuomei |
|
|
|
* @description |
|
|
|
* @Date 2020/7/24 16:45 |
|
|
|
**/ |
|
|
|
private void checkPublishFormDTO(PublishActInfoFormDTO 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){ |
|
|
|
throw new RenException((EpmetErrorCode.ACT_SIGN_UP_END_TIME_ERROR.getCode())); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
public static void main(String[] args) { |
|
|
|
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"); |
|
|
|
System.out.println(yesterDate.compareTo(today)); |
|
|
|
System.out.println(tommorrow.compareTo(today)); |
|
|
|
System.out.println(today.compareTo(today1)); |
|
|
|
} catch (ParseException e) { |
|
|
|
e.printStackTrace(); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @return void |
|
|
|
* @param formDTO |
|
|
|
* @author yinzuomei |
|
|
|
* @description 活动相关内容审核(活动标题、招募要求、活动内容图文) |
|
|
|
* @Date 2020/7/21 19:20 |
|
|
|
**/ |
|
|
|
private void auditAct(PublishActInfoFormDTO formDTO) { |
|
|
|
//1、活动标题
|
|
|
|
if (StringUtils.isNotBlank(formDTO.getTitle())) { |
|
|
|
this.auditActTitle(formDTO.getTitle()); |
|
|
|
} |
|
|
|
//2、活动封面
|
|
|
|
if(StringUtils.isNotBlank(formDTO.getCoverPic())){ |
|
|
|
this.auditActCoverPic(formDTO.getCoverPic()); |
|
|
|
} |
|
|
|
|
|
|
|
//3、招募要求
|
|
|
|
if (StringUtils.isNotBlank(formDTO.getRequirement())) { |
|
|
|
this.auditActRequirement(formDTO.getRequirement()); |
|
|
|
} |
|
|
|
//4、活动内容
|
|
|
|
if(null==formDTO.getActContent()||formDTO.getActContent().size()<1){ |
|
|
|
return; |
|
|
|
} |
|
|
|
List<String> textList=new ArrayList<>(); |
|
|
|
List<String> imgList=new ArrayList<>(); |
|
|
|
for(PublishActContentFormDTO actContent:formDTO.getActContent()){ |
|
|
|
if(ActConstant.ACT_CONTENT_TYPE_TEXT.equals(actContent.getContentType())){ |
|
|
|
textList.add(actContent.getContent()); |
|
|
|
}else if(ActConstant.ACT_CONTENT_TYPE_IMG.equals(actContent.getContentType())){ |
|
|
|
imgList.add(actContent.getContent()); |
|
|
|
} |
|
|
|
} |
|
|
|
this.auditActContent(textList,imgList); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @return com.epmet.entity.ActInfoEntity |
|
|
|
* @param formDTO |
|
|
|
* @author yinzuomei |
|
|
|
* @description 发布活动-构造act_info |
|
|
|
* @Date 2020/7/21 20:00 |
|
|
|
**/ |
|
|
|
private ActInfoEntity constructActInfo(PublishActInfoFormDTO formDTO) { |
|
|
|
ActInfoEntity actInfoEntity = ConvertUtils.sourceToTarget(formDTO, ActInfoEntity.class); |
|
|
|
//活动名额类型(0-不限名额,1-固定名额)
|
|
|
|
if(actInfoEntity.getActQuota()==0){ |
|
|
|
actInfoEntity.setActQuotaCategory(false); |
|
|
|
}else{ |
|
|
|
actInfoEntity.setActQuotaCategory(true); |
|
|
|
} |
|
|
|
actInfoEntity.setSignUpStartTime(new Date()); |
|
|
|
actInfoEntity.setActStatus(ActConstant.ACT_STATUS_PUBLISHED); |
|
|
|
|
|
|
|
//1已经总结0未总结
|
|
|
|
actInfoEntity.setSummaryFlag(false); |
|
|
|
if(ActConstant.SPONSOR_AGENCY.equals(actInfoEntity.getSponsorType())){ |
|
|
|
//调用gov_org服务获取当前组织的上一级机关id
|
|
|
|
Result<CustomerAgencyDTO> result=govOrgOpenFeignClient.getAgencyById(formDTO.getSponsorId()); |
|
|
|
if(result.success()&&null!=result.getData()){ |
|
|
|
actInfoEntity.setPid(result.getData().getPid()); |
|
|
|
}else{ |
|
|
|
logger.warn("根据agencyId查询组织信息失败,agencyId=",formDTO.getSponsorId()); |
|
|
|
} |
|
|
|
}else{ |
|
|
|
actInfoEntity.setPid(""); |
|
|
|
} |
|
|
|
return actInfoEntity; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @return java.util.List<com.epmet.entity.ActContentEntity> |
|
|
|
* @param actContent |
|
|
|
* @param actId |
|
|
|
* @author yinzuomei |
|
|
|
* @description 发布活动-构造活动详情act_content |
|
|
|
* @Date 2020/7/21 19:59 |
|
|
|
**/ |
|
|
|
private List<ActContentEntity> constructActContent(List<PublishActContentFormDTO> actContent, String actId) { |
|
|
|
List<ActContentEntity> list=new ArrayList<>(); |
|
|
|
int orderNum=1; |
|
|
|
for(PublishActContentFormDTO actContentFormDTO:actContent){ |
|
|
|
ActContentEntity actContentEntity=new ActContentEntity(); |
|
|
|
actContentEntity.setActId(actId); |
|
|
|
actContentEntity.setContent(actContentFormDTO.getContent()); |
|
|
|
actContentEntity.setContentType(actContentFormDTO.getContentType()); |
|
|
|
actContentEntity.setOrderNum(orderNum); |
|
|
|
list.add(actContentEntity); |
|
|
|
orderNum++; |
|
|
|
} |
|
|
|
return list; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @return void |
|
|
|
* @param textList |
|
|
|
* @param imgList |
|
|
|
* @author yinzuomei |
|
|
|
* @description 活动详情审核 |
|
|
|
* @Date 2020/7/21 19:21 |
|
|
|
**/ |
|
|
|
private void auditActContent(List<String> textList, List<String> imgList) { |
|
|
|
//审核活动详情中的内容
|
|
|
|
if(null!=textList&&textList.size()>0){ |
|
|
|
TextScanParamDTO textScanParamDTO = new TextScanParamDTO(); |
|
|
|
textList.forEach(content -> { |
|
|
|
TextTaskDTO taskDTO = new TextTaskDTO(); |
|
|
|
taskDTO.setContent(content); |
|
|
|
taskDTO.setDataId(UUID.randomUUID().toString().replace("-", "")); |
|
|
|
textScanParamDTO.getTasks().add(taskDTO); |
|
|
|
}); |
|
|
|
Result<SyncScanResult> contentSyncScanRes = ScanContentUtils.textSyncScan(scanApiUrl.concat(textSyncScanMethod), textScanParamDTO); |
|
|
|
if (!contentSyncScanRes.success()) { |
|
|
|
logger.error("活动详情内容审核接口失败,返参:", JSON.toJSONString(contentSyncScanRes)); |
|
|
|
throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode()); |
|
|
|
} else { |
|
|
|
if (!contentSyncScanRes.getData().isAllPass()) { |
|
|
|
throw new RenException(EpmetErrorCode.ACT_REQ_SCAN_FAILED.getCode()); |
|
|
|
} |
|
|
|
} |
|
|
|
logger.info("活动详情内容审核成功"); |
|
|
|
} |
|
|
|
if(null!=imgList&&imgList.size()>0){ |
|
|
|
//审核活动详情中的图片
|
|
|
|
ImgScanParamDTO imgScanParamDTO = new ImgScanParamDTO(); |
|
|
|
imgList.forEach(url -> { |
|
|
|
ImgTaskDTO task = new ImgTaskDTO(); |
|
|
|
task.setDataId(UUID.randomUUID().toString().replace("-", "")); |
|
|
|
task.setUrl(url); |
|
|
|
imgScanParamDTO.getTasks().add(task); |
|
|
|
}); |
|
|
|
Result<SyncScanResult> imgScanResult = ScanContentUtils.imgSyncScan(scanApiUrl.concat(imgSyncScanMethod), imgScanParamDTO); |
|
|
|
if (!imgScanResult.success()){ |
|
|
|
logger.error("活动详情图片审核接口失败,返参:", JSON.toJSONString(imgScanResult)); |
|
|
|
throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode()); |
|
|
|
} else { |
|
|
|
if (!imgScanResult.getData().isAllPass()) { |
|
|
|
throw new RenException(EpmetErrorCode.ACT_CONTENT_IMG_SCAN_FAILED.getCode()); |
|
|
|
} |
|
|
|
} |
|
|
|
logger.info("活动详情图片审核成功"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @return void |
|
|
|
* @param requirement |
|
|
|
* @author yinzuomei |
|
|
|
* @description 活动招募条件审核 |
|
|
|
* @Date 2020/7/21 19:21 |
|
|
|
**/ |
|
|
|
private void auditActRequirement(String requirement) { |
|
|
|
TextScanParamDTO textScanParamDTO = new TextScanParamDTO(); |
|
|
|
TextTaskDTO taskDTO = new TextTaskDTO(); |
|
|
|
taskDTO.setContent(requirement); |
|
|
|
taskDTO.setDataId(UUID.randomUUID().toString().replace("-", "")); |
|
|
|
textScanParamDTO.getTasks().add(taskDTO); |
|
|
|
Result<SyncScanResult> textSyncScanResult = ScanContentUtils.textSyncScan(scanApiUrl.concat(textSyncScanMethod), textScanParamDTO); |
|
|
|
if (!textSyncScanResult.success()) { |
|
|
|
logger.error("活动报名条件审核接口返回失败,返参:", JSON.toJSONString(textSyncScanResult)); |
|
|
|
throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode()); |
|
|
|
} else { |
|
|
|
if (!textSyncScanResult.getData().isAllPass()) { |
|
|
|
logger.error("活动报名条件审核失败,报名条件:",requirement); |
|
|
|
throw new RenException(EpmetErrorCode.ACT_REQ_SCAN_FAILED.getCode()); |
|
|
|
} |
|
|
|
} |
|
|
|
logger.info("活动报名条件审核成功"); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @return void |
|
|
|
* @param coverPic |
|
|
|
* @author yinzuomei |
|
|
|
* @description 活动封面图片审核 |
|
|
|
* @Date 2020/7/21 19:21 |
|
|
|
**/ |
|
|
|
private void auditActCoverPic(String coverPic) { |
|
|
|
ImgScanParamDTO coverPicScanParamDTO = new ImgScanParamDTO(); |
|
|
|
ImgTaskDTO coverImgtask = new ImgTaskDTO(); |
|
|
|
coverImgtask.setDataId(UUID.randomUUID().toString().replace("-", "")); |
|
|
|
coverImgtask.setUrl(coverPic); |
|
|
|
coverPicScanParamDTO.getTasks().add(coverImgtask); |
|
|
|
Result<SyncScanResult> coverPicScanRes = ScanContentUtils.imgSyncScan(scanApiUrl.concat(imgSyncScanMethod), coverPicScanParamDTO); |
|
|
|
if (!coverPicScanRes.success()){ |
|
|
|
logger.error("活动封面审核失败接口返回失败,返参:", JSON.toJSONString(coverPicScanRes)); |
|
|
|
throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode()); |
|
|
|
} else { |
|
|
|
if (!coverPicScanRes.getData().isAllPass()) { |
|
|
|
logger.error("活动封面审核失败,封面图片地址:",coverPic); |
|
|
|
throw new RenException(EpmetErrorCode.ACT_COVER_PIC_SCAN_FAILED.getCode()); |
|
|
|
} |
|
|
|
} |
|
|
|
logger.info("活动封面审核成功"); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @return void |
|
|
|
* @param title |
|
|
|
* @author yinzuomei |
|
|
|
* @description 活动标题审核 |
|
|
|
* @Date 2020/7/21 19:21 |
|
|
|
**/ |
|
|
|
private void auditActTitle(String title) { |
|
|
|
TextScanParamDTO textScanParamDTO = new TextScanParamDTO(); |
|
|
|
TextTaskDTO taskDTO = new TextTaskDTO(); |
|
|
|
taskDTO.setContent(title); |
|
|
|
taskDTO.setDataId(UUID.randomUUID().toString().replace("-", "")); |
|
|
|
textScanParamDTO.getTasks().add(taskDTO); |
|
|
|
Result<SyncScanResult> textSyncScanResult = ScanContentUtils.textSyncScan(scanApiUrl.concat(textSyncScanMethod), textScanParamDTO); |
|
|
|
if (!textSyncScanResult.success()) { |
|
|
|
logger.error("活动标题审核接口返回失败,返参:", JSON.toJSONString(textSyncScanResult)); |
|
|
|
throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode()); |
|
|
|
} else { |
|
|
|
if (!textSyncScanResult.getData().isAllPass()) { |
|
|
|
logger.error("活动标题审核失败,标题内容:",title); |
|
|
|
throw new RenException(EpmetErrorCode.ACT_TITLE_SCAN_FAILED.getCode()); |
|
|
|
} |
|
|
|
} |
|
|
|
logger.info("活动标题审核通过"); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @param formDTO |
|
|
|
* @return com.epmet.dto.result.work.InProgressActResultDTO |
|
|
@ -128,20 +495,69 @@ public class WorkActServiceImpl implements WorkActService { |
|
|
|
return actInfoDao.selectFinishedList(formDTO.getCustomerId()); |
|
|
|
} |
|
|
|
|
|
|
|
public static void main(String[] args) { |
|
|
|
SimpleDateFormat format=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
|
|
|
|
|
|
|
try { |
|
|
|
Date date1=format.parse("2020-07-23 13:00:00"); |
|
|
|
Date yesterDate=format.parse("2020-07-22 13:00:00"); |
|
|
|
Date date2=format.parse("2020-07-23 13:00:00"); |
|
|
|
Date tommorrow=format.parse("2020-07-24 13:00:00"); |
|
|
|
System.out.println(new Date().compareTo(yesterDate)); |
|
|
|
System.out.println(date1.compareTo(tommorrow)); |
|
|
|
System.out.println(date1.compareTo(date2)); |
|
|
|
} catch (ParseException e) { |
|
|
|
e.printStackTrace(); |
|
|
|
/** |
|
|
|
* @param formDTO |
|
|
|
* @return void |
|
|
|
* @author yinzuomei |
|
|
|
* @description 取消活动 |
|
|
|
* @Date 2020/7/26 17:26 |
|
|
|
**/ |
|
|
|
@Override |
|
|
|
public void cancelAct(CancelActFormDTO formDTO) { |
|
|
|
ActInfoDTO actInfoDTO=actInfoService.get(formDTO.getActId()); |
|
|
|
if(null==actInfoDTO){ |
|
|
|
logger.error("act_info is null"); |
|
|
|
return ; |
|
|
|
} |
|
|
|
//插入取消活动操作日志
|
|
|
|
ActOperationRecEntity actOperationRecEntity=new ActOperationRecEntity(); |
|
|
|
actOperationRecEntity.setActId(formDTO.getActId()); |
|
|
|
actOperationRecEntity.setType(ActConstant.ACT_OPER_TYPE_CANCEL); |
|
|
|
actOperationRecEntity.setNoticeUser(true); |
|
|
|
actOperationRecEntity.setRemark(formDTO.getCancelReason()); |
|
|
|
actOperationRecDao.insert(actOperationRecEntity); |
|
|
|
//更新活动标识,改为已取消
|
|
|
|
actInfoDTO.setCancelReason(formDTO.getCancelReason()); |
|
|
|
actInfoDTO.setCancelTime(actOperationRecEntity.getCreatedTime()); |
|
|
|
actInfoDTO.setActStatus(ActConstant.ACT_STATUS_CANCELED); |
|
|
|
actInfoService.update(actInfoDTO); |
|
|
|
//查询已经通过审核的用户,发送消息
|
|
|
|
List<String> userIdList=actUserRelationDao.selectUserIdList(formDTO.getActId(),ActConstant.ACT_USER_STATUS_PASSED); |
|
|
|
if(null!=userIdList&&userIdList.size()>0){ |
|
|
|
List<UserMessageFormDTO> userMessageFormDTOS=new ArrayList<>(); |
|
|
|
for(String userId:userIdList){ |
|
|
|
UserMessageFormDTO userMessageFormDTO = new UserMessageFormDTO(); |
|
|
|
userMessageFormDTO.setUserId(userId); |
|
|
|
userMessageFormDTO.setGridId(StrConstant.STAR); |
|
|
|
userMessageFormDTO.setApp(AppClientConstant.APP_RESI); |
|
|
|
userMessageFormDTO.setTitle(ActMessageConstant.TITLE); |
|
|
|
userMessageFormDTO.setReadFlag(ReadFlagConstant.UN_READ); |
|
|
|
userMessageFormDTO.setMessageContent(String.format(ActMessageConstant.ACT_CANCELED, |
|
|
|
actInfoDTO.getTitle(), |
|
|
|
formDTO.getCancelReason())); |
|
|
|
userMessageFormDTOS.add(userMessageFormDTO); |
|
|
|
} |
|
|
|
Result sendMessageRes= epmetMessageOpenFeignClient.saveUserMessageList(userMessageFormDTOS); |
|
|
|
if(sendMessageRes.success()){ |
|
|
|
logger.info("给审核通过的用户发送消息成功"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @param actId |
|
|
|
* @return void |
|
|
|
* @author yinzuomei |
|
|
|
* @description 已取消-活动详情 |
|
|
|
* @Date 2020/7/26 18:00 |
|
|
|
**/ |
|
|
|
@Override |
|
|
|
public CanceledActDetailResultDTO canceledDetail(String actId) { |
|
|
|
CanceledActDetailResultDTO canceledActDetailResultDTO=actInfoDao.selectCanceledActInfo(actId); |
|
|
|
if(null!=canceledActDetailResultDTO){ |
|
|
|
canceledActDetailResultDTO.setActContent(actContentDao.selectByActId(actId)); |
|
|
|
} |
|
|
|
return canceledActDetailResultDTO; |
|
|
|
} |
|
|
|
} |
|
|
|