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 b977a2e76f..1c4adc9bf3 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 @@ -54,6 +54,10 @@ public enum EpmetErrorCode { ACT_CONTENT_TEXT_SCAN_FAILED(8116,"活动详情内容审核失败,请重新编辑"), ACT_CONTENT_IMG_SCAN_FAILED(8117,"活动详情图片失败,请重新编辑"), ACT_COVER_PIC_SCAN_FAILED(8118,"活动封面图片审核失败,请重新编辑"), + ACT_START_TIME_ERROR(8119,"活动预计开始时间应早于活动预计结束时间"), + ACT_SIGN_IN_START_TIME_ERROR(8120,"签到开始时间应早于签到结束时间"), + ACT_SIGN_UP_END_TIME_ERROR(8121,"活动报名截止时间应早于活动预计开始时间"), + CANNOT_AUDIT_WARM(8201, "请完善居民信息"), NOT_DEL_AGENCY(8202, "该机关存在下级机关,不允许删除"), diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/ActOperationRecDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/ActOperationRecDTO.java index 00b8294271..955997a340 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/ActOperationRecDTO.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/ActOperationRecDTO.java @@ -53,9 +53,14 @@ public class ActOperationRecDTO implements Serializable { private String type; /** - * 1通知用户0不通知 + * 1通知用户0不通知,取消活动时默认true */ - private Boolean noticeUser; + private Boolean noticeUser; + + /** + * 备注,取消活动时此列有值 + */ + private String remark; /** * 删除标记 diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/work/CancelActFormDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/work/CancelActFormDTO.java new file mode 100644 index 0000000000..1ae524df14 --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/work/CancelActFormDTO.java @@ -0,0 +1,32 @@ +package com.epmet.dto.form.work; + +import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * 描述一下 + * + * @author yinzuomei@elink-cn.com + * @date 2020/7/26 17:23 + */ +@Data +public class CancelActFormDTO implements Serializable { + private static final long serialVersionUID = -5297836691628421645L; + public interface AddUserInternalGroup {} + public interface UserShowGroup extends CustomerClientShowGroup { + } + /** + * 活动id + */ + @NotBlank(message = "活动id不能为空", groups = {AddUserInternalGroup.class }) + private String actId; + + /** + * 取消原因 + */ + @NotBlank(message = "取消原因不能为空", groups = {UserShowGroup.class}) + private String cancelReason; +} diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/work/DraftActInfoFormDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/work/DraftActInfoFormDTO.java index 55cd75a090..1d128594ff 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/work/DraftActInfoFormDTO.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/work/DraftActInfoFormDTO.java @@ -1,6 +1,5 @@ package com.epmet.dto.form.work; -import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; import lombok.Data; import javax.validation.Valid; @@ -22,9 +21,6 @@ public class DraftActInfoFormDTO implements Serializable { public interface AddUserInternalGroup { } - public interface AddDraftUserShowGroup extends CustomerClientShowGroup { - } - @Valid private List actContent; diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/ActPreviewResultDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/ActPreviewResultDTO.java index f5869bdb87..eb6f07693c 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/ActPreviewResultDTO.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/ActPreviewResultDTO.java @@ -43,13 +43,13 @@ public class ActPreviewResultDTO implements Serializable { private Integer reward; /** - * 活动开始时间yyyy-MM-dd HH:mm + * 活动预计开始时间yyyy-MM-dd HH:mm */ @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8") private Date actStartTime; /** - * 活动结束时间yyyy-MM-dd HH:mm + * 活动预计结束时间yyyy-MM-dd HH:mm */ @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8") private Date actEndTime; diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/CanceledActDetailResultDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/CanceledActDetailResultDTO.java new file mode 100644 index 0000000000..a361a5511e --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/CanceledActDetailResultDTO.java @@ -0,0 +1,119 @@ +package com.epmet.dto.result.work; + +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; +import java.util.List; + +/** + * 已取消-活动详情 + * + * @author yinzuomei@elink-cn.com + * @date 2020/7/26 18:02 + */ +@Data +public class CanceledActDetailResultDTO implements Serializable { + private static final long serialVersionUID = 4438884084461494174L; + + /** + *活动id + */ + private String actId; + + /** + * 活动标题 + */ + private String title; + + /** + * 报名截止时间:yyyy-MM-dd HH:mm + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8") + private Date signUpEndTime; + + /** + * 活动开始时间yyyy-MM-dd HH:mm + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8") + private Date actStartTime; + + /** + * 活动结束时间yyyy-MM-dd HH:mm + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8") + private Date actEndTime; + + /** + * 活动地点 + */ + private String actAddress; + + /** + * 活动名额 + */ + private Integer actQuota; + + /** + * true:固定名额 false: 不限制名额 + */ + private Boolean actQuotaCategory; + + /** + * 联系人 + */ + private String sponsorContacts; + + /** + * 联系电话 + */ + private String sponsorTel; + /** + * 活动积分 + */ + private Integer reward; + /** + * 主办方名称 + */ + private String sponsorName; + /** + * 报名条件 + */ + private String requirement; + /** + * 取消时间yyyy-MM-dd HH:mm:ss + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + private Date cancelTime; + /** + * 取消理由 + */ + private String cancelReason; + /** + * 活动详情 + */ + private List actContent; + + @Override + public String toString() { + return "CanceledActDetailResultDTO{" + + "actId='" + actId + '\'' + + ", title='" + title + '\'' + + ", signUpEndTime=" + signUpEndTime + + ", actStartTime=" + actStartTime + + ", actEndTime=" + actEndTime + + ", actAddress='" + actAddress + '\'' + + ", actQuota=" + actQuota + + ", actQuotaCategory=" + actQuotaCategory + + ", sponsorContacts='" + sponsorContacts + '\'' + + ", sponsorTel='" + sponsorTel + '\'' + + ", reward=" + reward + + ", sponsorName='" + sponsorName + '\'' + + ", requirement='" + requirement + '\'' + + ", cancelTime=" + cancelTime + + ", cancelReason='" + cancelReason + '\'' + + ", actContent=" + actContent + + '}'; + } +} diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/DeniedUserResultDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/DeniedUserResultDTO.java new file mode 100644 index 0000000000..c7ca1833bb --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/DeniedUserResultDTO.java @@ -0,0 +1,57 @@ +package com.epmet.dto.result.work; + +import lombok.Data; + +import java.io.Serializable; + +/** + * 积分发放-已拒绝列表 + * + * @author yinzuomei@elink-cn.com + * @date 2020/7/26 19:01 + */ +@Data +public class DeniedUserResultDTO implements Serializable { + private static final long serialVersionUID = 110993452055116412L; + + /** + * 给分或者不给分,重新处理入参用 + */ + private String actUserRelationId; + + /** + * 用户id + */ + private String userId; + + /** + * 活动id + */ + private String actId; + + /** + * 姓名 + */ + private String realName; + + /** + * 昵称 + */ + private String nickName; + + /** + * 头像 + */ + private String headImgUrl; + + /** + * true:是志愿者 false:不是志愿者 + */ + private Boolean volunteerFlag; + + /** + * 拒绝原因 + */ + private String denyRewardReason; + +} diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/ObtainedUserResultDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/ObtainedUserResultDTO.java new file mode 100644 index 0000000000..05cf6e2674 --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/ObtainedUserResultDTO.java @@ -0,0 +1,51 @@ +package com.epmet.dto.result.work; + +import lombok.Data; + +import java.io.Serializable; + +/** + * 积分发放-已发放列表 + * + * @author yinzuomei@elink-cn.com + * @date 2020/7/26 18:43 + */ +@Data +public class ObtainedUserResultDTO implements Serializable { + private static final long serialVersionUID = 8187248601958392521L; + /** + * 给分或者不给分,重新处理入参用 + */ + private String actUserRelationId; + + /** + * 用户id + */ + private String userId; + + /** + * 活动id + */ + private String actId; + + /** + * 姓名 + */ + private String realName; + + /** + * 昵称 + */ + private String nickName; + + /** + * 头像 + */ + private String headImgUrl; + + /** + * true:是志愿者 false:不是志愿者 + */ + private Boolean volunteerFlag; + +} diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/constant/ActMessageConstant.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/constant/ActMessageConstant.java index be7530973c..b7bf8cce40 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/constant/ActMessageConstant.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/constant/ActMessageConstant.java @@ -8,6 +8,16 @@ package com.epmet.constant; */ public interface ActMessageConstant { String TITLE="您有一条活动消息"; + /** + * 报名审核成功,给居民端用户发送消息 + */ String AUDIT_PASSED="您报名的活动%s,已审核通过"; + /** + * 拒绝用户的报名,给居民端用户发送消息 + */ String AUDIT_REFUSED="您报名的活动%s,审核未通过,原因:%s"; + /** + * 活动被取消,给已经通过审核的居民端用户,发送消息 + */ + String ACT_CANCELED="您报名的活动%s,已取消,原因:%s"; } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/GrantPointsController.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/GrantPointsController.java index 86e935c2a3..72f402337a 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/GrantPointsController.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/GrantPointsController.java @@ -4,14 +4,20 @@ import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.dto.form.work.ActIdFormDTO; import com.epmet.dto.form.work.GrantPointsFormDTO; +import com.epmet.dto.result.work.CanceledUserResultDTO; +import com.epmet.dto.result.work.DeniedUserResultDTO; +import com.epmet.dto.result.work.ObtainedUserResultDTO; import com.epmet.dto.result.work.PendingUserResultDTO; import com.epmet.service.GrantPointsService; +import com.epmet.service.WorkActUserService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; +import java.util.List; + /** * 工作端-积分发放api * @@ -23,6 +29,8 @@ import org.springframework.web.bind.annotation.RestController; public class GrantPointsController { @Autowired private GrantPointsService grantPointsService; + @Autowired + private WorkActUserService workActUserService ; /** * @return com.epmet.commons.tools.utils.Result @@ -78,4 +86,43 @@ public class GrantPointsController { grantPointsService.reset(formDTO); return new Result(); } + + /** + * @param actIdFormDTO + * @return com.epmet.commons.tools.utils.Result> + * @author yinzuomei + * @description 积分发放-已发放列表 + * @Date 2020/7/26 18:46 + **/ + @PostMapping("agreedlist") + public Result> agreedList(@RequestBody ActIdFormDTO actIdFormDTO) { + ValidatorUtils.validateEntity(actIdFormDTO, ActIdFormDTO.AddUserInternalGroup.class); + return new Result>().ok(grantPointsService.agreedList(actIdFormDTO)); + } + + /** + * @return com.epmet.commons.tools.utils.Result> + * @param actIdFormDTO + * @author yinzuomei + * @description 积分发放-已拒绝列表 + * @Date 2020/7/26 19:02 + **/ + @PostMapping("deniedlist") + public Result> deniedList(@RequestBody ActIdFormDTO actIdFormDTO){ + ValidatorUtils.validateEntity(actIdFormDTO, ActIdFormDTO.AddUserInternalGroup.class); + return new Result>().ok(grantPointsService.deniedList(actIdFormDTO)); + } + + /** + * @param actIdFormDTO + * @return com.epmet.commons.tools.utils.Result> + * @author yinzuomei + * @description 积分发放-已取消报名列表 + * @Date 2020/7/26 19:19 + **/ + @PostMapping("canceleduserlist") + public Result> canceledUserList(@RequestBody ActIdFormDTO actIdFormDTO) { + ValidatorUtils.validateEntity(actIdFormDTO, ActIdFormDTO.AddUserInternalGroup.class); + return new Result>().ok(workActUserService.queryCanceledUserList(actIdFormDTO)); + } } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/WorkActController.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/WorkActController.java index 2e14ec9aac..aca1f4aee4 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/WorkActController.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/WorkActController.java @@ -2,11 +2,8 @@ package com.epmet.controller; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; -import com.epmet.dto.form.work.ActListCommonFormDTO; -import com.epmet.dto.result.work.CanceledActResultDTO; -import com.epmet.dto.result.work.FinishedActResultDTO; -import com.epmet.dto.result.work.InProgressActResultDTO; -import com.epmet.dto.result.work.SponsorResultDTO; +import com.epmet.dto.form.work.*; +import com.epmet.dto.result.work.*; import com.epmet.service.WorkActService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; @@ -28,6 +25,19 @@ public class WorkActController { @Autowired private WorkActService workActService; + /** + * @return com.epmet.commons.tools.utils.Result + * @param + * @author yinzuomei + * @description 发布活动-删除历史活动草稿 + * @Date 2020/7/20 18:15 + **/ + @PostMapping("deletedraft") + public Result deleteDraft(){ + workActService.deleteDraft(); + return new Result(); + } + /** * @return com.epmet.commons.tools.utils.Result * @param @@ -40,6 +50,26 @@ public class WorkActController { return new Result().ok(workActService.querySponsorList()); } + /** + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + * @author yinzuomei + * @description 发布活动 + * @Date 2020/7/21 18:32 + **/ + @PostMapping("publish") + public Result publishAct(@RequestBody PublishActInfoFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO, PublishActInfoFormDTO.AddUserShowGroup.class, PublishActInfoFormDTO.AddUserInternalGroup.class); + for (PublishActContentFormDTO actContentFormDTO : formDTO.getActContent()) { + ValidatorUtils.validateEntity(actContentFormDTO, + PublishActContentFormDTO.UserShowGroup.class, + PublishActContentFormDTO.UserInternalGroup.class + ); + } + PublishActResultDTO resultDTO = workActService.publishAct(formDTO); + return new Result().ok(resultDTO); + } + /** * @return com.epmet.commons.tools.utils.Result * @param formDTO @@ -78,4 +108,31 @@ public class WorkActController { ValidatorUtils.validateEntity(formDTO,ActListCommonFormDTO.AddUserInternalGroup.class); return new Result>().ok(workActService.queryFinishedList(formDTO)); } + + /** + * @return com.epmet.commons.tools.utils.Result + * @param formDTO + * @author yinzuomei + * @description 取消活动 + * @Date 2020/7/26 17:26 + **/ + @PostMapping("cancelact") + public Result cancelAct(@RequestBody CancelActFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO,CancelActFormDTO.UserShowGroup.class,CancelActFormDTO.AddUserInternalGroup.class); + workActService.cancelAct(formDTO); + return new Result(); + } + + /** + * @param actIdFormDTO + * @return com.epmet.commons.tools.utils.Result + * @author yinzuomei + * @description 已取消-活动详情 + * @Date 2020/7/26 18:00 + **/ + @PostMapping("canceleddetail") + public Result canceledDetail(@RequestBody ActIdFormDTO actIdFormDTO) { + ValidatorUtils.validateEntity(actIdFormDTO, ActIdFormDTO.AddUserInternalGroup.class); + return new Result().ok(workActService.canceledDetail(actIdFormDTO.getActId())); + } } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/WorkActDraftController.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/WorkActDraftController.java index f69b65b065..e960a2f926 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/WorkActDraftController.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/WorkActDraftController.java @@ -37,19 +37,6 @@ public class WorkActDraftController { return new Result().ok(initResultDTO); } - /** - * @return com.epmet.commons.tools.utils.Result - * @param - * @author yinzuomei - * @description 发布活动-删除历史活动草稿 - * @Date 2020/7/20 18:15 - **/ - @PostMapping("deletedraft") - public Result deleteDraft(){ - workActDraftService.deleteDraft(); - return new Result(); - } - /** * @return com.epmet.commons.tools.utils.Result * @param @@ -72,9 +59,8 @@ public class WorkActDraftController { **/ @PostMapping("saveact") public Result saveAct(@RequestBody DraftActInfoFormDTO formDTO){ - //起码活动标题不能为空 - ValidatorUtils.validateEntity(formDTO, DraftActInfoFormDTO.AddDraftUserShowGroup.class, - DraftActInfoFormDTO.AddUserInternalGroup.class); + //起码客户id不能为空 + ValidatorUtils.validateEntity(formDTO,DraftActInfoFormDTO.AddUserInternalGroup.class); //如果录入了活动内容,需要校验 content、contentType if (null != formDTO.getActContent() && formDTO.getActContent().size() > 0) { for(DraftActContentFormDTO actContentFormDTO:formDTO.getActContent()){ @@ -102,25 +88,4 @@ public class WorkActDraftController { return new Result().ok(resultDTO); } - /** - * @param formDTO - * @return com.epmet.commons.tools.utils.Result - * @author yinzuomei - * @description 发布活动 - * @Date 2020/7/21 18:32 - **/ - @PostMapping("publish") - public Result publishAct(@RequestBody PublishActInfoFormDTO formDTO) { - ValidatorUtils.validateEntity(formDTO, PublishActInfoFormDTO.AddUserShowGroup.class, PublishActInfoFormDTO.AddUserInternalGroup.class); - for (PublishActContentFormDTO actContentFormDTO : formDTO.getActContent()) { - ValidatorUtils.validateEntity(actContentFormDTO, - PublishActContentFormDTO.UserShowGroup.class, - PublishActContentFormDTO.UserInternalGroup.class - ); - } - PublishActResultDTO resultDTO = workActDraftService.publishAct(formDTO); - return new Result().ok(resultDTO); - } - - } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActContentDao.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActContentDao.java index 2d7ef0de25..c125c2d9f4 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActContentDao.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActContentDao.java @@ -18,9 +18,12 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.result.work.ActPreviewContentResultDTO; import com.epmet.entity.ActContentEntity; import org.apache.ibatis.annotations.Mapper; +import java.util.List; + /** * 活动内容 * @@ -29,5 +32,13 @@ import org.apache.ibatis.annotations.Mapper; */ @Mapper public interface ActContentDao extends BaseDao { - + + /** + * @return java.util.List + * @param actId + * @author yinzuomei + * @description 根据活动id查询活动详情 + * @Date 2020/7/26 18:26 + **/ + List selectByActId(String actId); } \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActInfoDao.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActInfoDao.java index 86bbf2afde..4766a2823c 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActInfoDao.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActInfoDao.java @@ -270,4 +270,13 @@ public interface ActInfoDao extends BaseDao { * @Date 2020/7/24 10:55 **/ List queryCanceledUserList(String actId); + + /** + * @return com.epmet.dto.result.work.CanceledActDetailResultDTO + * @param actId + * @author yinzuomei + * @description 工作端-查询已取消活动详情 + * @Date 2020/7/26 18:29 + **/ + CanceledActDetailResultDTO selectCanceledActInfo(String actId); } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActUserRelationDao.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActUserRelationDao.java index bb6598d312..526ca76a1f 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActUserRelationDao.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActUserRelationDao.java @@ -19,6 +19,8 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.dto.ActUserRelationDTO; +import com.epmet.dto.result.work.DeniedUserResultDTO; +import com.epmet.dto.result.work.ObtainedUserResultDTO; import com.epmet.dto.result.work.UserHistoricalActInfoDTO; import com.epmet.entity.ActUserRelationEntity; import org.apache.ibatis.annotations.Mapper; @@ -136,4 +138,22 @@ public interface ActUserRelationDao extends BaseDao { * @Date 2020/7/24 13:02 **/ List selectInProgressUserIds(String actId); + + /** + * @return java.util.List + * @param actId + * @author yinzuomei + * @description 积分发放-已发放列表 + * @Date 2020/7/26 18:48 + **/ + List selectAgreedList(String actId); + + /** + * @return java.util.List + * @param actId + * @author yinzuomei + * @description 积分发放-已拒绝列表 + * @Date 2020/7/26 19:11 + **/ + List selectDeniedList(String actId); } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/LatestActContentDao.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/LatestActContentDao.java index a0cbb2b6e5..acf7fe8557 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/LatestActContentDao.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/LatestActContentDao.java @@ -60,4 +60,13 @@ public interface LatestActContentDao extends BaseDao { * @Date 2020/7/21 18:07 **/ List previewActContent(String actId); + + /** + * @return int + * @param actId + * @author yinzuomei + * @description 根据活动id删除活动详情 物理删除 + * @Date 2020/7/24 16:08 + **/ + int deleteByActId(String actId); } \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/ActOperationRecEntity.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/ActOperationRecEntity.java index aef5e68fe0..5a54f8f5c5 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/ActOperationRecEntity.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/ActOperationRecEntity.java @@ -49,8 +49,12 @@ public class ActOperationRecEntity extends BaseEpmetEntity { private String type; /** - * 1通知用户0不通知 + * 1通知用户0不通知,取消活动时默认true */ private Boolean noticeUser; + /** + * 备注,取消活动时此列有值 + */ + private String remark; } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/GrantPointsService.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/GrantPointsService.java index 92d306ac92..e8d53e3b44 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/GrantPointsService.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/GrantPointsService.java @@ -1,8 +1,13 @@ package com.epmet.service; +import com.epmet.dto.form.work.ActIdFormDTO; import com.epmet.dto.form.work.GrantPointsFormDTO; +import com.epmet.dto.result.work.DeniedUserResultDTO; +import com.epmet.dto.result.work.ObtainedUserResultDTO; import com.epmet.dto.result.work.PendingUserResultDTO; +import java.util.List; + /** * 描述一下 * @@ -45,4 +50,22 @@ public interface GrantPointsService { * @Date 2020/7/24 15:16 **/ void reset(GrantPointsFormDTO formDTO); + + /** + * @return java.util.List + * @param actIdFormDTO + * @author yinzuomei + * @description 积分发放-已发放列表 + * @Date 2020/7/26 18:47 + **/ + List agreedList(ActIdFormDTO actIdFormDTO); + + /** + * @return java.util.List + * @param actIdFormDTO + * @author yinzuomei + * @description 积分发放-已拒绝列表 + * @Date 2020/7/26 19:02 + **/ + List deniedList(ActIdFormDTO actIdFormDTO); } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/WorkActDraftService.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/WorkActDraftService.java index e08b1671e4..cc0683b91c 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/WorkActDraftService.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/WorkActDraftService.java @@ -2,8 +2,10 @@ package com.epmet.service; import com.epmet.dto.form.work.ActPreviewFormDTO; import com.epmet.dto.form.work.DraftActInfoFormDTO; -import com.epmet.dto.form.work.PublishActInfoFormDTO; -import com.epmet.dto.result.work.*; +import com.epmet.dto.result.work.ActPreviewResultDTO; +import com.epmet.dto.result.work.LatestDraftActInfoResultDTO; +import com.epmet.dto.result.work.PublishActInitResultDTO; +import com.epmet.dto.result.work.SaveActDraftResultDTO; /** * 工作端活动草稿 @@ -22,15 +24,6 @@ public interface WorkActDraftService { **/ PublishActInitResultDTO publishActInit(); - /** - * @return void - * @param - * @author yinzuomei - * @description 发布活动-删除历史活动草稿 - * @Date 2020/7/20 18:15 - **/ - void deleteDraft(); - /** * @return com.epmet.dto.result.work.LatestDraftActInfoResultDTO * @param @@ -58,12 +51,4 @@ public interface WorkActDraftService { **/ ActPreviewResultDTO previewActDetail(ActPreviewFormDTO formDTO); - /** - * @return com.epmet.dto.result.work.PublishActResultDTO - * @param formDTO - * @author yinzuomei - * @description 发布活动 - * @Date 2020/7/21 18:33 - **/ - PublishActResultDTO publishAct(PublishActInfoFormDTO formDTO); } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/WorkActService.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/WorkActService.java index 3945c19213..b4e83a2aa1 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/WorkActService.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/WorkActService.java @@ -1,10 +1,9 @@ package com.epmet.service; import com.epmet.dto.form.work.ActListCommonFormDTO; -import com.epmet.dto.result.work.CanceledActResultDTO; -import com.epmet.dto.result.work.FinishedActResultDTO; -import com.epmet.dto.result.work.InProgressActResultDTO; -import com.epmet.dto.result.work.SponsorResultDTO; +import com.epmet.dto.form.work.CancelActFormDTO; +import com.epmet.dto.form.work.PublishActInfoFormDTO; +import com.epmet.dto.result.work.*; import java.util.List; @@ -15,6 +14,15 @@ import java.util.List; * @date 2020/7/23 20:36 */ public interface WorkActService { + /** + * @return void + * @param + * @author yinzuomei + * @description 发布活动-删除历史活动草稿 + * @Date 2020/7/20 18:15 + **/ + void deleteDraft(); + /** * @return com.epmet.dto.result.work.SponsorResultDTO * @param @@ -24,6 +32,15 @@ public interface WorkActService { **/ SponsorResultDTO querySponsorList(); + /** + * @return com.epmet.dto.result.work.PublishActResultDTO + * @param formDTO + * @author yinzuomei + * @description 发布活动 + * @Date 2020/7/21 18:33 + **/ + PublishActResultDTO publishAct(PublishActInfoFormDTO formDTO); + /** * @return com.epmet.dto.result.work.InProgressActResultDTO * @param formDTO @@ -50,4 +67,22 @@ public interface WorkActService { * @Date 2020/7/23 23:21 **/ List queryFinishedList(ActListCommonFormDTO formDTO); + + /** + * @return void + * @param formDTO + * @author yinzuomei + * @description 取消活动 + * @Date 2020/7/26 17:26 + **/ + void cancelAct(CancelActFormDTO formDTO); + + /** + * @return void + * @param actId + * @author yinzuomei + * @description 已取消-活动详情 + * @Date 2020/7/26 18:00 + **/ + CanceledActDetailResultDTO canceledDetail(String actId); } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/GrantPointsServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/GrantPointsServiceImpl.java index 7374577050..024b325ff9 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/GrantPointsServiceImpl.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/GrantPointsServiceImpl.java @@ -9,8 +9,11 @@ import com.epmet.dao.ActUserRelationDao; import com.epmet.dto.ActInfoDTO; import com.epmet.dto.ActPointLogDTO; import com.epmet.dto.ActUserRelationDTO; +import com.epmet.dto.form.work.ActIdFormDTO; import com.epmet.dto.form.work.GrantPointsFormDTO; import com.epmet.dto.result.UserBaseInfoResultDTO; +import com.epmet.dto.result.work.DeniedUserResultDTO; +import com.epmet.dto.result.work.ObtainedUserResultDTO; import com.epmet.dto.result.work.PendingUserResultDTO; import com.epmet.dto.result.work.UserBaseInfo; import com.epmet.service.*; @@ -233,4 +236,68 @@ public class GrantPointsServiceImpl implements GrantPointsService { actPointLogDTO.setEffectFlag(false); actPointLogService.save(actPointLogDTO); } + + /** + * @param actIdFormDTO + * @return java.util.List + * @author yinzuomei + * @description 积分发放-已发放列表 + * @Date 2020/7/26 18:47 + **/ + @Override + public List agreedList(ActIdFormDTO actIdFormDTO) { + List list = actUserRelationDao.selectAgreedList(actIdFormDTO.getActId()); + if (null == list || list.size() < 0) { + return new ArrayList<>(); + } + List userIdList = new ArrayList<>(); + for (ObtainedUserResultDTO obtainedUserResultDTO : list) { + obtainedUserResultDTO.setVolunteerFlag(workActUserService.getVolunteerFlag(obtainedUserResultDTO.getUserId())); + userIdList.add(obtainedUserResultDTO.getUserId()); + } + List userBaseInfoResultDTOList = workActUserService.queryUserBaseInfoList(userIdList); + for (ObtainedUserResultDTO obtainedUser : list) { + for (UserBaseInfoResultDTO userBaseInfoResultDTO : userBaseInfoResultDTOList) { + if (obtainedUser.getUserId().equals(userBaseInfoResultDTO.getUserId())) { + obtainedUser.setRealName(userBaseInfoResultDTO.getRealName()); + obtainedUser.setNickName(userBaseInfoResultDTO.getNickname()); + obtainedUser.setHeadImgUrl(userBaseInfoResultDTO.getHeadImgUrl()); + break; + } + } + } + return list; + } + + /** + * @param actIdFormDTO + * @return java.util.List + * @author yinzuomei + * @description 积分发放-已拒绝列表 + * @Date 2020/7/26 19:02 + **/ + @Override + public List deniedList(ActIdFormDTO actIdFormDTO) { + List list = actUserRelationDao.selectDeniedList(actIdFormDTO.getActId()); + if (null == list || list.size() < 0) { + return new ArrayList<>(); + } + List userIdList = new ArrayList<>(); + for (DeniedUserResultDTO deniedUserResultDTO : list) { + deniedUserResultDTO.setVolunteerFlag(workActUserService.getVolunteerFlag(deniedUserResultDTO.getUserId())); + userIdList.add(deniedUserResultDTO.getUserId()); + } + List userBaseInfoResultDTOList = workActUserService.queryUserBaseInfoList(userIdList); + for (DeniedUserResultDTO deniedUser : list) { + for (UserBaseInfoResultDTO userBaseInfoResultDTO : userBaseInfoResultDTOList) { + if (deniedUser.getUserId().equals(userBaseInfoResultDTO.getUserId())) { + deniedUser.setRealName(userBaseInfoResultDTO.getRealName()); + deniedUser.setNickName(userBaseInfoResultDTO.getNickname()); + deniedUser.setHeadImgUrl(userBaseInfoResultDTO.getHeadImgUrl()); + break; + } + } + } + return list; + } } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/LatestActContentServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/LatestActContentServiceImpl.java index e60c7d539e..38930a1467 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/LatestActContentServiceImpl.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/LatestActContentServiceImpl.java @@ -93,7 +93,7 @@ public class LatestActContentServiceImpl extends BaseServiceImpl dtoList) { //先删除之前的 - this.deleteByActId(dtoList.get(0).getActId()); + baseDao.deleteByActId(dtoList.get(0).getActId()); //再插入新的 for(LatestActContentDTO dto:dtoList){ LatestActContentEntity entity = ConvertUtils.sourceToTarget(dto, LatestActContentEntity.class); diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActDraftServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActDraftServiceImpl.java index 1c75dfdb57..a1b008430e 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActDraftServiceImpl.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActDraftServiceImpl.java @@ -1,31 +1,13 @@ package com.epmet.service.impl; -import com.alibaba.fastjson.JSON; -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.DateUtils; -import com.epmet.commons.tools.utils.Result; -import com.epmet.commons.tools.utils.ScanContentUtils; -import com.epmet.constant.ActConstant; -import com.epmet.dao.ActContentDao; -import com.epmet.dao.ActInfoDao; -import com.epmet.dao.ActOperationRecDao; -import com.epmet.dto.CustomerAgencyDTO; import com.epmet.dto.LatestActContentDTO; import com.epmet.dto.LatestActInfoDTO; -import com.epmet.dto.form.work.*; +import com.epmet.dto.form.work.ActPreviewFormDTO; +import com.epmet.dto.form.work.DraftActContentFormDTO; +import com.epmet.dto.form.work.DraftActInfoFormDTO; 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.GovOrgOpenFeignClient; import com.epmet.service.LatestActContentService; import com.epmet.service.LatestActInfoService; import com.epmet.service.WorkActDraftService; @@ -33,14 +15,11 @@ 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.util.ArrayList; import java.util.Date; import java.util.List; -import java.util.UUID; /** * 工作端活动草稿 @@ -57,20 +36,6 @@ public class WorkActDraftServiceImpl implements WorkActDraftService { private LatestActInfoService latestActInfoService; @Autowired private LatestActContentService latestActContentService; - @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 ActInfoDao actInfoDao; - @Autowired - private ActContentDao actContentDao; - @Autowired - private ActOperationRecDao actOperationRecDao; - @Autowired - private GovOrgOpenFeignClient govOrgOpenFeignClient; /** * @return com.epmet.dto.form.work.PublishActInitResultDTO @@ -96,19 +61,6 @@ public class WorkActDraftServiceImpl implements WorkActDraftService { return resultDTO; } - /** - * @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.LatestDraftActInfoResultDTO @@ -148,7 +100,7 @@ public class WorkActDraftServiceImpl implements WorkActDraftService { if(null!=formDTO.getActContent()&&formDTO.getActContent().size()>0){ //保存活动内容 List actContentList=this.constructLatestActContent(formDTO.getActContent(),actDraftId); - //删除之前的内容 + //删除之前的内容,保存本次的修改 物理删除 latestActContentService.saveLatestActContentDTOList(actContentList); } SaveActDraftResultDTO resultDTO=new SaveActDraftResultDTO(); @@ -175,266 +127,6 @@ public class WorkActDraftServiceImpl implements WorkActDraftService { return actPreviewResultDTO; } - /** - * @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) { - PublishActResultDTO publishActResultDTO=new PublishActResultDTO(); - //内容审核(活动标题、招募要求、活动内容图文) - this.auditAct(formDTO); - logger.info("发布活动,审核成功"); - - //构造属性保存活动属性,活动内容 - ActInfoEntity actInfoEntity=this.constructActInfo(formDTO); - actInfoDao.insert(actInfoEntity); - - List 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); - actOperationRecDao.insert(actOperationRecEntity); - - //删除所有的草稿 - this.deleteDraft(); - publishActResultDTO.setActId(actInfoEntity.getId()); - - return publishActResultDTO; - } - - /** - * @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 TODO - Result 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 - * @param actContent - * @param actId - * @author yinzuomei - * @description 发布活动-构造活动详情act_content - * @Date 2020/7/21 19:59 - **/ - private List constructActContent(List actContent, String actId) { - List 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 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 textList=new ArrayList<>(); - List 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 void - * @param textList - * @param imgList - * @author yinzuomei - * @description 活动详情审核 - * @Date 2020/7/21 19:21 - **/ - private void auditActContent(List textList, List 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 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 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 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 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 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("活动标题审核通过"); - } - /** * @return java.util.List * @param actContent 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 cdeb80c3d3..257b8a810d 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 @@ -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 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 textList=new ArrayList<>(); + List 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 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 + * @param actContent + * @param actId + * @author yinzuomei + * @description 发布活动-构造活动详情act_content + * @Date 2020/7/21 19:59 + **/ + private List constructActContent(List actContent, String actId) { + List 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 textList, List 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 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 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 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 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 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 userIdList=actUserRelationDao.selectUserIdList(formDTO.getActId(),ActConstant.ACT_USER_STATUS_PASSED); + if(null!=userIdList&&userIdList.size()>0){ + List 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; + } } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActUserServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActUserServiceImpl.java index 3ec8d2dea5..411e6f1cc6 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActUserServiceImpl.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActUserServiceImpl.java @@ -369,6 +369,10 @@ public class WorkActUserServiceImpl implements WorkActUserService { if(!actInfo.getCreatedBy().equals(loginUserUtil.getLoginUserId())){ throw new RenException(EpmetErrorCode.REQUIRE_PERMISSION.getCode()); } + if(actInfo.getActStatus().equals(ActConstant.ACT_STATUS_CANCELED)){ + logger.info("活动已经取消,无需处理"); + return; + } Date auditTime=new Date(); actUserRelationEntity.setStatus(ActConstant.ACT_USER_STATUS_PASSED); actUserRelationEntity.setPassedType(ActConstant.PASSEDTYPE_MANUAL); @@ -408,6 +412,10 @@ public class WorkActUserServiceImpl implements WorkActUserService { logger.error("查询活动为空actId="+actUserRelationEntity.getActId()); return; } + if(actInfo.getActStatus().equals(ActConstant.ACT_STATUS_CANCELED)){ + logger.info("活动已经取消,无需处理"); + return; + } if(!actInfo.getCreatedBy().equals(loginUserUtil.getLoginUserId())){ throw new RenException(EpmetErrorCode.REQUIRE_PERMISSION.getCode()); } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActContentDao.xml b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActContentDao.xml index 4f6c46667e..6d38c0a679 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActContentDao.xml +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActContentDao.xml @@ -17,5 +17,16 @@ - + + \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActInfoDao.xml b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActInfoDao.xml index 380e0197a7..368115e3e2 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActInfoDao.xml +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActInfoDao.xml @@ -577,4 +577,30 @@ AND aur.ACT_ID =#{actId} order by aur.CANCEL_TIME desc + + + diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActUserRelationDao.xml b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActUserRelationDao.xml index d2872098fd..507206fa64 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActUserRelationDao.xml +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActUserRelationDao.xml @@ -189,4 +189,43 @@ AND aur.PROCESS_FLAG != 'handled' AND aur.ACT_ID = #{actId} + + + + + + diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/LatestActContentDao.xml b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/LatestActContentDao.xml index 68f536b24d..a4aade9b30 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/LatestActContentDao.xml +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/LatestActContentDao.xml @@ -50,4 +50,9 @@ ORDER BY lac.ORDER_NUM ASC + + + + delete from latest_act_content lac where lac.ACT_ID=#{actId} + \ No newline at end of file