From 2c5e7e140ee9ed1e810e37dac0bf9194e74e0e5e Mon Sep 17 00:00:00 2001 From: zhaoqifeng Date: Fri, 24 Dec 2021 17:22:08 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B4=BB=E5=8A=A8=E7=9B=B8=E5=85=B3=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/epmet/dto/IcPartyActivityDTO.java | 5 + .../java/com/epmet/dto/LatestActInfoDTO.java | 20 ++ .../com/epmet/dto/form/work/ActIdFormDTO.java | 1 + .../dto/form/work/ActPreviewFormDTO.java | 1 + .../dto/form/work/DraftActInfoFormDTO.java | 20 ++ .../dto/form/work/PublishActInfoFormDTO.java | 25 ++ .../epmet/dto/form/work/RePublishFormDTO.java | 25 ++ .../dto/result/work/ActPreviewResultDTO.java | 21 ++ .../work/CanceledActDetailResultDTO.java | 21 ++ .../work/FinishedActDetailResultDTO.java | 21 ++ .../work/InProgressActDetailResultDTO.java | 21 ++ .../work/LatestDraftActInfoResultDTO.java | 20 ++ .../result/work/ReEditActInfoResultDTO.java | 21 ++ .../java/com/epmet/constant/ActConstant.java | 8 + .../epmet/controller/WorkActController.java | 52 +++- .../java/com/epmet/entity/ActInfoEntity.java | 21 +- .../epmet/entity/IcPartyActivityEntity.java | 5 + .../com/epmet/entity/LatestActInfoEntity.java | 20 ++ .../epmet/service/IcPartyActivityService.java | 18 ++ .../com/epmet/service/WorkActService.java | 10 +- .../impl/IcPartyActivityServiceImpl.java | 34 +++ .../service/impl/WorkActDraftServiceImpl.java | 39 ++- .../service/impl/WorkActServiceImpl.java | 277 ++++++++++++++++-- .../src/main/resources/mapper/ActInfoDao.xml | 18 +- .../resources/mapper/LatestActInfoDao.xml | 6 +- 25 files changed, 681 insertions(+), 49 deletions(-) diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/IcPartyActivityDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/IcPartyActivityDTO.java index a8c770f8e9..81edd97c20 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/IcPartyActivityDTO.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/IcPartyActivityDTO.java @@ -58,6 +58,11 @@ public class IcPartyActivityDTO implements Serializable { */ private String pids; + /** + * act_info表ID + */ + private String actId; + /** * 单位ID */ diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/LatestActInfoDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/LatestActInfoDTO.java index 0d0824fdfd..e73c466837 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/LatestActInfoDTO.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/LatestActInfoDTO.java @@ -179,6 +179,26 @@ public class LatestActInfoDTO implements Serializable { */ private Boolean auditSwitch; + /** + * 活动类型爱心活动heart 联建活动party + */ + private String actType; + + /** + * 联建单位 + */ + private String unitId; + + /** + * 活动目标 + */ + private String target; + + /** + * 服务事项 + */ + private String serviceMatter; + /** * 乐观锁 */ diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/work/ActIdFormDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/work/ActIdFormDTO.java index 632b567c11..4ba08831e9 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/work/ActIdFormDTO.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/work/ActIdFormDTO.java @@ -21,4 +21,5 @@ public class ActIdFormDTO implements Serializable { */ @NotBlank(message = "活动id不能为空", groups = { ActIdFormDTO.AddUserInternalGroup.class }) private String actId; + private String customerId; } diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/work/ActPreviewFormDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/work/ActPreviewFormDTO.java index 57166c22f1..78bd1a6cd5 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/work/ActPreviewFormDTO.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/work/ActPreviewFormDTO.java @@ -23,4 +23,5 @@ public class ActPreviewFormDTO implements Serializable { */ @NotBlank(message = "活动草稿id不能为空", groups = {UserInternalGroup.class}) private String actDraftId; + private String customerId; } 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 1d128594ff..f00ebe792f 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 @@ -161,4 +161,24 @@ public class DraftActInfoFormDTO implements Serializable { */ private String sponsorTel; + /** + * 活动类型爱心活动heart 联建活动party + */ + private String actType = "heart"; + + /** + * 联建单位 + */ + private String unitId; + + /** + * 活动目标 + */ + private String target; + + /** + * 服务事项 + */ + private String serviceMatter; + } diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/work/PublishActInfoFormDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/work/PublishActInfoFormDTO.java index fae068b230..ef1f3c3e19 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/work/PublishActInfoFormDTO.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/work/PublishActInfoFormDTO.java @@ -25,6 +25,8 @@ public class PublishActInfoFormDTO implements Serializable { public interface AddUserInternalGroup { } + public interface AddPartyActivityGroup { + } public interface AddUserShowGroup extends CustomerClientShowGroup { } @@ -189,4 +191,27 @@ public class PublishActInfoFormDTO implements Serializable { */ @NotBlank(message = "联系电话不能为空", groups = {AddUserShowGroup.class}) private String sponsorTel; + + /** + * 活动类型爱心活动heart 联建活动party + */ + private String actType = "heart"; + + /** + * 联建单位 + */ + @NotBlank(message = "联建单位不能为空", groups = {AddPartyActivityGroup.class}) + private String unitId; + + /** + * 活动目标 + */ + @NotBlank(message = "活动目标不能为空", groups = {AddPartyActivityGroup.class}) + private String target; + + /** + * 服务事项 + */ + @NotBlank(message = "服务事项不能为空", groups = {AddPartyActivityGroup.class}) + private String serviceMatter; } diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/work/RePublishFormDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/work/RePublishFormDTO.java index dfd1aeed99..b093e9dcba 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/work/RePublishFormDTO.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/work/RePublishFormDTO.java @@ -24,6 +24,8 @@ public class RePublishFormDTO implements Serializable { private static final long serialVersionUID = -959956652123514886L; public interface AddUserInternalGroup { } + public interface AddPartyActivityGroup { + } public interface AddUserShowGroup extends CustomerClientShowGroup { } @@ -195,4 +197,27 @@ public class RePublishFormDTO implements Serializable { */ @NotBlank(message = "联系电话不能为空", groups = {AddUserShowGroup.class}) private String sponsorTel; + + /** + * 活动类型爱心活动heart 联建活动party + */ + private String actType = "heart"; + + /** + * 联建单位 + */ + @NotBlank(message = "联建单位不能为空", groups = {AddPartyActivityGroup.class}) + private String unitId; + + /** + * 活动目标 + */ + @NotBlank(message = "活动目标不能为空", groups = {AddPartyActivityGroup.class}) + private String target; + + /** + * 服务事项 + */ + @NotBlank(message = "服务事项不能为空", groups = {AddPartyActivityGroup.class}) + private String serviceMatter; } 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 eb6f07693c..5e3df9d139 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 @@ -89,4 +89,25 @@ public class ActPreviewResultDTO implements Serializable { * 活动详情 */ private List actContent; + + /** + * 活动类型爱心活动heart 联建活动party + */ + private String actType; + + /** + * 联建单位 + */ + private String unitId; + private String unitName; + /** + * 活动目标 + */ + private String target; + + /** + * 服务事项 + */ + private String serviceMatter; + private String serviceMatterName; } 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 index 3a19c7d4d4..3da7fade52 100644 --- 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 @@ -147,4 +147,25 @@ public class CanceledActDetailResultDTO implements Serializable { * 活动签到打卡半径(单位:米) */ private Integer signInRadius; + + /** + * 活动类型爱心活动heart 联建活动party + */ + private String actType; + + /** + * 联建单位 + */ + private String unitId; + private String unitName; + /** + * 活动目标 + */ + private String target; + + /** + * 服务事项 + */ + private String serviceMatter; + private String serviceMatterName; } diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/FinishedActDetailResultDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/FinishedActDetailResultDTO.java index e96026f842..3e4bfbdc9a 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/FinishedActDetailResultDTO.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/FinishedActDetailResultDTO.java @@ -136,4 +136,25 @@ public class FinishedActDetailResultDTO implements Serializable { * 活动签到打卡半径(单位:米) */ private Integer signInRadius; + + /** + * 活动类型爱心活动heart 联建活动party + */ + private String actType; + + /** + * 联建单位 + */ + private String unitId; + private String unitName; + /** + * 活动目标 + */ + private String target; + + /** + * 服务事项 + */ + private String serviceMatter; + private String serviceMatterName; } diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/InProgressActDetailResultDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/InProgressActDetailResultDTO.java index cd2518f840..8dc4ad2fb2 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/InProgressActDetailResultDTO.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/InProgressActDetailResultDTO.java @@ -131,4 +131,25 @@ public class InProgressActDetailResultDTO implements Serializable { * 活动签到打卡半径(单位:米) */ private Integer signInRadius; + + /** + * 活动类型爱心活动heart 联建活动party + */ + private String actType; + + /** + * 联建单位 + */ + private String unitId; + private String unitName; + /** + * 活动目标 + */ + private String target; + + /** + * 服务事项 + */ + private String serviceMatter; + private String serviceMatterName; } diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/LatestDraftActInfoResultDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/LatestDraftActInfoResultDTO.java index 7906c364d5..c4a250df92 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/LatestDraftActInfoResultDTO.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/LatestDraftActInfoResultDTO.java @@ -166,4 +166,24 @@ public class LatestDraftActInfoResultDTO implements Serializable { * 活动内容- */ private List actContent; + + /** + * 活动类型爱心活动heart 联建活动party + */ + private String actType = "heart"; + + /** + * 联建单位 + */ + private String unitId; + + /** + * 活动目标 + */ + private String target; + + /** + * 服务事项 + */ + private String serviceMatter; } diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/ReEditActInfoResultDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/ReEditActInfoResultDTO.java index 80f668afae..a360fd53c3 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/ReEditActInfoResultDTO.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/ReEditActInfoResultDTO.java @@ -148,4 +148,25 @@ public class ReEditActInfoResultDTO implements Serializable { * 活动详情 */ private List actContent; + + /** + * 活动类型爱心活动heart 联建活动party + */ + private String actType; + + /** + * 联建单位 + */ + private String unitId; + private String unitName; + /** + * 活动目标 + */ + private String target; + + /** + * 服务事项 + */ + private String serviceMatter; + private String serviceMatterName; } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/constant/ActConstant.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/constant/ActConstant.java index c5387c8ce4..9855cee625 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/constant/ActConstant.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/constant/ActConstant.java @@ -161,4 +161,12 @@ public interface ActConstant { String HANDLED="handled"; String RESET="reset"; + /** + * 活动类型-爱心互助 + */ + String HEART = "heart"; + /** + * 活动类型-联建活动 + */ + String PARTY = "party"; } 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 fb0a64e4dc..1383924f57 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 @@ -1,7 +1,10 @@ package com.epmet.controller; +import com.epmet.commons.tools.annotation.LoginUser; +import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.constant.ActConstant; import com.epmet.dto.form.work.*; import com.epmet.dto.result.work.*; import com.epmet.service.WorkActService; @@ -69,6 +72,23 @@ public class WorkActController { return new Result().ok(workActService.publishAct(formDTO)); } + @PostMapping("publishV2") + public Result publishActV2(@RequestBody PublishActInfoFormDTO formDTO) { + if (ActConstant.HEART.equals(formDTO.getActType())) { + ValidatorUtils.validateEntity(formDTO, PublishActInfoFormDTO.AddUserShowGroup.class, PublishActInfoFormDTO.AddUserInternalGroup.class); + } else { + ValidatorUtils.validateEntity(formDTO, PublishActInfoFormDTO.AddUserShowGroup.class, + PublishActInfoFormDTO.AddUserInternalGroup.class, PublishActInfoFormDTO.AddPartyActivityGroup.class); + } + for (PublishActContentFormDTO actContentFormDTO : formDTO.getActContent()) { + ValidatorUtils.validateEntity(actContentFormDTO, + PublishActContentFormDTO.UserShowGroup.class, + PublishActContentFormDTO.UserInternalGroup.class + ); + } + return new Result().ok(workActService.publishActV2(formDTO)); + } + /** * @return com.epmet.commons.tools.utils.Result * @param formDTO @@ -130,9 +150,9 @@ public class WorkActController { * @Date 2020/7/26 18:00 **/ @PostMapping("canceleddetail") - public Result canceledDetail(@RequestBody ActIdFormDTO actIdFormDTO) { + public Result canceledDetail(@LoginUser TokenDto tokenDto, @RequestBody ActIdFormDTO actIdFormDTO) { ValidatorUtils.validateEntity(actIdFormDTO, ActIdFormDTO.AddUserInternalGroup.class); - return new Result().ok(workActService.canceledDetail(actIdFormDTO.getActId())); + return new Result().ok(workActService.canceledDetail(tokenDto.getCustomerId(), actIdFormDTO.getActId())); } /** @@ -158,8 +178,9 @@ public class WorkActController { * @Date 2020/7/26 21:01 **/ @PostMapping("finisheddetail") - public Result finishedDeatil(@RequestBody ActIdFormDTO formDTO) { + public Result finishedDeatil(@LoginUser TokenDto tokenDto, @RequestBody ActIdFormDTO formDTO) { ValidatorUtils.validateEntity(formDTO, ActIdFormDTO.AddUserInternalGroup.class); + formDTO.setCustomerId(tokenDto.getCustomerId()); return new Result().ok(workActService.finishedDeatil(formDTO)); } @@ -171,9 +192,10 @@ public class WorkActController { * @Date 2020/7/26 21:33 **/ @PostMapping("inprogressdetail") - public Result inProgressDetail(@RequestBody ActIdFormDTO formDTO) { + public Result inProgressDetail(@LoginUser TokenDto tokenDto, @RequestBody ActIdFormDTO formDTO) { ValidatorUtils.validateEntity(formDTO, ActIdFormDTO.AddUserInternalGroup.class); - return new Result().ok(workActService.inProgressDetail(formDTO.getActId())); + + return new Result().ok(workActService.inProgressDetail(tokenDto.getCustomerId(), formDTO.getActId())); } /** @@ -229,9 +251,9 @@ public class WorkActController { * @Date 2020/7/27 13:36 **/ @PostMapping("getactinfo") - public Result getActInfo(@RequestBody ActIdFormDTO formDTO){ + public Result getActInfo(@LoginUser TokenDto tokenDto, @RequestBody ActIdFormDTO formDTO){ ValidatorUtils.validateEntity(formDTO, ActIdFormDTO.AddUserInternalGroup.class); - return new Result().ok(workActService.getActInfo(formDTO.getActId())); + return new Result().ok(workActService.getActInfo(tokenDto.getCustomerId(), formDTO.getActId())); } /** @@ -253,5 +275,21 @@ public class WorkActController { return new Result().ok(workActService.rePublish(rePublishFormDTO)); } + @PostMapping("republishV2") + public Result rePublishV2(@RequestBody RePublishFormDTO rePublishFormDTO) { + if (ActConstant.HEART.equals(rePublishFormDTO.getActType())) { + ValidatorUtils.validateEntity(rePublishFormDTO, PublishActInfoFormDTO.AddUserShowGroup.class, PublishActInfoFormDTO.AddUserInternalGroup.class); + } else { + ValidatorUtils.validateEntity(rePublishFormDTO, RePublishFormDTO.AddUserShowGroup.class, RePublishFormDTO.AddUserInternalGroup.class); + } + for (PublishActContentFormDTO actContentFormDTO : rePublishFormDTO.getActContent()) { + ValidatorUtils.validateEntity(actContentFormDTO, + PublishActContentFormDTO.UserShowGroup.class, + PublishActContentFormDTO.UserInternalGroup.class + ); + } + return new Result().ok(workActService.rePublishV2(rePublishFormDTO)); + } + } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/ActInfoEntity.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/ActInfoEntity.java index e227b29ed5..191e639b24 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/ActInfoEntity.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/ActInfoEntity.java @@ -18,7 +18,6 @@ package com.epmet.entity; import com.baomidou.mybatisplus.annotation.TableName; - import com.epmet.commons.mybatis.entity.BaseEpmetEntity; import lombok.Data; import lombok.EqualsAndHashCode; @@ -217,4 +216,24 @@ public class ActInfoEntity extends BaseEpmetEntity { */ private Boolean summaryFlag; + /** + * 活动类型爱心活动heart 联建活动party + */ + private String actType; + + /** + * 联建单位 + */ + private String unitId; + + /** + * 活动目标 + */ + private String target; + + /** + * 服务事项 + */ + private String serviceMatter; + } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/IcPartyActivityEntity.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/IcPartyActivityEntity.java index 529bb4f34a..4919fdd133 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/IcPartyActivityEntity.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/IcPartyActivityEntity.java @@ -53,6 +53,11 @@ public class IcPartyActivityEntity extends BaseEpmetEntity { */ private String pids; + /** + * act_info表ID + */ + private String actId; + /** * 单位ID */ diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/LatestActInfoEntity.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/LatestActInfoEntity.java index 706cf0668b..491ed210f8 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/LatestActInfoEntity.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/LatestActInfoEntity.java @@ -182,4 +182,24 @@ public class LatestActInfoEntity extends BaseEpmetEntity { * 数据库新增ACT_INFO_ID字段,act_info.id */ private String actInfoId; + + /** + * 活动类型爱心活动heart 联建活动party + */ + private String actType; + + /** + * 联建单位 + */ + private String unitId; + + /** + * 活动目标 + */ + private String target; + + /** + * 服务事项 + */ + private String serviceMatter; } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcPartyActivityService.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcPartyActivityService.java index c3931bbd0b..c36db9b2d6 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcPartyActivityService.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcPartyActivityService.java @@ -117,4 +117,22 @@ public interface IcPartyActivityService extends BaseService getActivityList(TokenDto tokenDto, PartyActivityFormDTO formDTO); + + /** + * 根据爱心活动ID获取联建活动 + * @Param actId + * @Return {@link IcPartyActivityDTO} + * @Author zhaoqifeng + * @Date 2021/12/23 16:13 + */ + IcPartyActivityDTO getActivityByActId(String actId); + + /** + * 根据爱心活动ID删除联建活动 + * @Param actId + * @Return {@link IcPartyActivityDTO} + * @Author zhaoqifeng + * @Date 2021/12/23 16:13 + */ + void deleteByActId(String actId); } \ No newline at end of file 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 bc72cc7d67..d470f3571f 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 @@ -38,7 +38,7 @@ public interface WorkActService { * @Date 2020/7/21 18:33 **/ PublishActResultDTO publishAct(PublishActInfoFormDTO formDTO); - + PublishActResultDTO publishActV2(PublishActInfoFormDTO formDTO); /** * @return com.epmet.dto.result.work.InProgressActResultDTO * @param formDTO @@ -82,7 +82,7 @@ public interface WorkActService { * @description 已取消-活动详情 * @Date 2020/7/26 18:00 **/ - CanceledActDetailResultDTO canceledDetail(String actId); + CanceledActDetailResultDTO canceledDetail(String customerId, String actId); /** * @return void @@ -109,7 +109,7 @@ public interface WorkActService { * @description 进行中-活动详情 * @Date 2020/7/26 21:34 **/ - InProgressActDetailResultDTO inProgressDetail(String actId); + InProgressActDetailResultDTO inProgressDetail(String customerId, String actId); /** * @return void @@ -136,7 +136,7 @@ public interface WorkActService { * @description 重新编辑-获取活动详情 * @Date 2020/7/27 13:36 **/ - ReEditActInfoResultDTO getActInfo(String actId); + ReEditActInfoResultDTO getActInfo(String customerId, String actId); /** * @return com.epmet.dto.result.work.PublishActResultDTO @@ -146,6 +146,6 @@ public interface WorkActService { * @Date 2020/7/27 13:55 **/ PublishActResultDTO rePublish(RePublishFormDTO rePublishFormDTO); - + PublishActResultDTO rePublishV2(RePublishFormDTO rePublishFormDTO); void testGrantPoint(TestGrantFormDTO formDTO); } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcPartyActivityServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcPartyActivityServiceImpl.java index 4057d1ba41..045b9564cc 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcPartyActivityServiceImpl.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcPartyActivityServiceImpl.java @@ -382,6 +382,40 @@ public class IcPartyActivityServiceImpl extends BaseServiceImpl(dtoList, pageInfo.getTotal()); } + /** + * 根据爱心活动ID获取联建活动 + * + * @param actId + * @Param actId + * @Return {@link IcPartyActivityDTO} + * @Author zhaoqifeng + * @Date 2021/12/23 16:13 + */ + @Override + public IcPartyActivityDTO getActivityByActId(String actId) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(IcPartyActivityEntity::getActId, actId); + IcPartyActivityEntity entity = baseDao.selectOne(wrapper); + return ConvertUtils.sourceToTarget(entity, IcPartyActivityDTO.class); + } + + /** + * 根据爱心活动ID删除联建活动 + * + * @param actId + * @Param actId + * @Return {@link IcPartyActivityDTO} + * @Author zhaoqifeng + * @Date 2021/12/23 16:13 + */ + @Override + @Transactional(rollbackFor = Exception.class) + public void deleteByActId(String actId) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(IcPartyActivityEntity::getActId, actId); + baseDao.delete(wrapper); + } + /** * 近30天开始时间和结束时间 (精确到秒) * @Param formDTO 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 930d220fc7..6e2a67aa17 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 @@ -3,15 +3,16 @@ package com.epmet.service.impl; import com.epmet.commons.tools.constant.StrConstant; import com.epmet.commons.tools.security.user.LoginUserUtil; import com.epmet.commons.tools.utils.DateUtils; +import com.epmet.dto.IcPartyUnitDTO; import com.epmet.dto.LatestActContentDTO; import com.epmet.dto.LatestActInfoDTO; +import com.epmet.dto.form.demand.SubCodeFormDTO; 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.demand.OptionDTO; import com.epmet.dto.result.work.*; -import com.epmet.service.LatestActContentService; -import com.epmet.service.LatestActInfoService; -import com.epmet.service.WorkActDraftService; +import com.epmet.service.*; import org.apache.commons.lang3.StringUtils; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -19,9 +20,12 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import javax.annotation.Resource; import java.util.ArrayList; import java.util.Date; import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; /** * 工作端活动草稿 @@ -38,6 +42,15 @@ public class WorkActDraftServiceImpl implements WorkActDraftService { private LatestActInfoService latestActInfoService; @Autowired private LatestActContentService latestActContentService; + @Resource + private IcResiDemandDictService icResiDemandDictService; + @Resource + private IcPartyUnitService icPartyUnitService; + + /** + * 服务事项code + */ + private static final String SERVICE_MATTER_CODE = "1010"; /** * @return com.epmet.dto.form.work.PublishActInitResultDTO @@ -126,6 +139,20 @@ public class WorkActDraftServiceImpl implements WorkActDraftService { if (null != actContent && actContent.size() > 0) { actPreviewResultDTO.setActContent(actContent); } + + if (StringUtils.isNotBlank(actPreviewResultDTO.getServiceMatter())) { + //获取服务事项 + SubCodeFormDTO codeFormDTO = new SubCodeFormDTO(); + codeFormDTO.setCustomerId(formDTO.getCustomerId()); + codeFormDTO.setParentCategoryCode(SERVICE_MATTER_CODE); + Map categoryMap = icResiDemandDictService.querySubCodeList(codeFormDTO).stream().collect(Collectors.toMap(OptionDTO::getValue, OptionDTO::getLabel)); + actPreviewResultDTO.setServiceMatterName(categoryMap.get(actPreviewResultDTO.getServiceMatter())); + } + if (StringUtils.isNotBlank(actPreviewResultDTO.getUnitId())) { + //获取单位名称 + IcPartyUnitDTO unitDTO = icPartyUnitService.get(actPreviewResultDTO.getUnitId()); + actPreviewResultDTO.setUnitName(unitDTO.getUnitName()); + } } return actPreviewResultDTO; } @@ -258,6 +285,12 @@ public class WorkActDraftServiceImpl implements WorkActDraftService { latestActInfoDTO.setVolunteerLimit(formDTO.getVolunteerLimit()); //审核开关:1报名人员需要人工审核0不需要 latestActInfoDTO.setAuditSwitch(formDTO.getAuditSwitch()); + + latestActInfoDTO.setActType(formDTO.getActType()); + latestActInfoDTO.setUnitId(formDTO.getUnitId()); + latestActInfoDTO.setTarget(formDTO.getTarget()); + latestActInfoDTO.setServiceMatter(formDTO.getServiceMatter()); + return latestActInfoDTO; } 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 c1fcd18a57..244dd6f2cc 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 @@ -24,8 +24,10 @@ import com.epmet.dto.*; import com.epmet.dto.form.SystemMsgFormDTO; import com.epmet.dto.form.UserMessageFormDTO; import com.epmet.dto.form.WxSubscribeMessageFormDTO; +import com.epmet.dto.form.demand.SubCodeFormDTO; import com.epmet.dto.form.work.*; import com.epmet.dto.result.ActSponsorResultDTO; +import com.epmet.dto.result.demand.OptionDTO; import com.epmet.dto.result.work.*; import com.epmet.entity.*; import com.epmet.feign.EpmetMessageOpenFeignClient; @@ -39,12 +41,10 @@ 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; +import javax.annotation.Resource; +import java.util.*; +import java.util.concurrent.atomic.AtomicReference; +import java.util.stream.Collectors; /** * 描述一下 @@ -54,7 +54,7 @@ import java.util.UUID; */ @Service public class WorkActServiceImpl implements WorkActService { - private Logger logger = LogManager.getLogger(WorkActServiceImpl.class); + private final Logger logger = LogManager.getLogger(WorkActServiceImpl.class); @Value("${openapi.scan.server.url}") private String scanApiUrl; @Value("${openapi.scan.method.textSyncScan}") @@ -95,9 +95,19 @@ public class WorkActServiceImpl implements WorkActService { private UserKindnessTimeLogDao userKindnessTimeLogDao; @Autowired private LatestActInfoDao latestActInfoDao; + @Resource + private IcPartyActivityService icPartyActivityService; + @Resource + private IcResiDemandDictService icResiDemandDictService; + @Resource + private IcPartyUnitService icPartyUnitService; + + /** + * 服务事项code + */ + private static final String SERVICE_MATTER_CODE = "1010"; /** - * @return void * @author yinzuomei * @description 发布活动-删除历史活动草稿 * @Date 2020/7/20 18:15 @@ -182,9 +192,55 @@ public class WorkActServiceImpl implements WorkActService { return publishActResultDTO; } + @Override + @Transactional(rollbackFor = Exception.class) + public PublishActResultDTO publishActV2(PublishActInfoFormDTO formDTO) { + //构造属性保存活动属性,活动内容 + ActInfoEntity actInfoEntity=this.constructActInfo(formDTO); + //校验参数 + + //校验 活动报名截止时间应该大于当前时间 + if (actInfoEntity.getSignUpEndTime().before(DateUtils.minStrToSecondDate(DateUtils.format(new Date(), DateUtils.DATE_TIME_PATTERN_END_WITH_MINUTE)))){ + throw new RenException(EpmetErrorCode.ACT_SIGN_UP_END_TIME_EARLIER_NOW_EERROR.getCode(),EpmetErrorCode.ACT_SIGN_UP_END_TIME_EARLIER_NOW_EERROR.getMsg()); + } + this.checkPublishFormDTO(actInfoEntity); + PublishActResultDTO publishActResultDTO=new PublishActResultDTO(); + //内容审核(活动标题、招募要求、活动内容图文) + this.auditAct(formDTO); + logger.info("发布活动,审核成功"); + + actInfoDao.insert(actInfoEntity); + //如果用户之前点击了预览,需要去更新草稿表里的act_info_id,记录草稿和活动的关系 + if(StringUtils.isNotBlank(formDTO.getActDraftId())){ + logger.info("更新latest_act_info表的act_info_id字段"); + latestActInfoDao.updateActInfoId(formDTO.getActDraftId(),actInfoEntity.getId()); + } + 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()); + + //添加信息到ic_party_activity + if (ActConstant.PARTY.equals(formDTO.getActType())) { + IcPartyActivityEntity activity = getPartyActivityEntity(formDTO, actInfoEntity); + icPartyActivityService.insert(activity); + } + + return publishActResultDTO; + } /** - * @return void * @param actInfoEntity * @author yinzuomei * @description 第一次发布 @@ -207,23 +263,6 @@ public class WorkActServiceImpl implements WorkActService { } } - public static void main(String[] args) { - SimpleDateFormat format=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); - - try { - 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)); - } catch (ParseException e) { - e.printStackTrace(); - } - - } - /** * @return void * @param formDTO @@ -718,7 +757,10 @@ public class WorkActServiceImpl implements WorkActService { if (wxmpMsg.success()) { logger.info("给审核通过的用户推送微信订阅消息成功"); } + } + //取消活动,删除ic_party_activity对应的活动 + icPartyActivityService.deleteByActId(formDTO.getActId()); } @@ -730,7 +772,7 @@ public class WorkActServiceImpl implements WorkActService { * @Date 2020/7/26 18:00 **/ @Override - public CanceledActDetailResultDTO canceledDetail(String actId) { + public CanceledActDetailResultDTO canceledDetail(String customerId, String actId) { CanceledActDetailResultDTO canceledActDetailResultDTO=actInfoDao.selectCanceledActInfo(actId); if(null!=canceledActDetailResultDTO){ canceledActDetailResultDTO.setActContent(actContentDao.selectByActId(actId)); @@ -739,6 +781,20 @@ public class WorkActServiceImpl implements WorkActService { }else{ canceledActDetailResultDTO.setIsMyPublish(false); } + + if (StringUtils.isNotBlank(canceledActDetailResultDTO.getServiceMatter())) { + //获取服务事项 + SubCodeFormDTO codeFormDTO = new SubCodeFormDTO(); + codeFormDTO.setCustomerId(customerId); + codeFormDTO.setParentCategoryCode(SERVICE_MATTER_CODE); + Map categoryMap = icResiDemandDictService.querySubCodeList(codeFormDTO).stream().collect(Collectors.toMap(OptionDTO::getValue, OptionDTO::getLabel)); + canceledActDetailResultDTO.setServiceMatterName(categoryMap.get(canceledActDetailResultDTO.getServiceMatter())); + } + if (StringUtils.isNotBlank(canceledActDetailResultDTO.getUnitId())) { + //获取单位名称 + IcPartyUnitDTO unitDTO = icPartyUnitService.get(canceledActDetailResultDTO.getUnitId()); + canceledActDetailResultDTO.setUnitName(unitDTO.getUnitName()); + } } return canceledActDetailResultDTO; } @@ -783,6 +839,20 @@ public class WorkActServiceImpl implements WorkActService { }else{ resultDTO.setIsMyPublish(false); } + + if (StringUtils.isNotBlank(resultDTO.getServiceMatter())) { + //获取服务事项 + SubCodeFormDTO codeFormDTO = new SubCodeFormDTO(); + codeFormDTO.setCustomerId(customerId); + codeFormDTO.setParentCategoryCode(SERVICE_MATTER_CODE); + Map categoryMap = icResiDemandDictService.querySubCodeList(codeFormDTO).stream().collect(Collectors.toMap(OptionDTO::getValue, OptionDTO::getLabel)); + resultDTO.setServiceMatterName(categoryMap.get(resultDTO.getServiceMatter())); + } + if (StringUtils.isNotBlank(resultDTO.getUnitId())) { + //获取单位名称 + IcPartyUnitDTO unitDTO = icPartyUnitService.get(resultDTO.getUnitId()); + resultDTO.setUnitName(unitDTO.getUnitName()); + } } return resultDTO; } @@ -795,7 +865,7 @@ public class WorkActServiceImpl implements WorkActService { * @Date 2020/7/26 21:34 **/ @Override - public InProgressActDetailResultDTO inProgressDetail(String actId) { + public InProgressActDetailResultDTO inProgressDetail(String customerId, String actId) { InProgressActDetailResultDTO resultDTO = actInfoDao.selectInProgressDetail(actId); if (null != resultDTO) { Date nowDate=new Date(); @@ -851,6 +921,19 @@ public class WorkActServiceImpl implements WorkActService { }else{ resultDTO.setIsMyPublish(false); } + if (StringUtils.isNotBlank(resultDTO.getServiceMatter())) { + //获取服务事项 + SubCodeFormDTO codeFormDTO = new SubCodeFormDTO(); + codeFormDTO.setCustomerId(formDTO.getCustomerId()); + codeFormDTO.setParentCategoryCode(SERVICE_MATTER_CODE); + Map categoryMap = icResiDemandDictService.querySubCodeList(codeFormDTO).stream().collect(Collectors.toMap(OptionDTO::getValue, OptionDTO::getLabel)); + resultDTO.setServiceMatterName(categoryMap.get(resultDTO.getServiceMatter())); + } + if (StringUtils.isNotBlank(resultDTO.getUnitId())) { + //获取单位名称 + IcPartyUnitDTO unitDTO = icPartyUnitService.get(resultDTO.getUnitId()); + resultDTO.setUnitName(unitDTO.getUnitName()); + } } return resultDTO; } @@ -1096,6 +1179,15 @@ public class WorkActServiceImpl implements WorkActService { //拒绝发放积分总人数 actStatisticalDTO.setDenyRewardUserNum(actUserRelationDao.selectCountByReward(actId,ActConstant.ACT_USER_STATUS_DENY)); actStatisticalService.save(actStatisticalDTO); + + //保存服务人数 + IcPartyActivityDTO dto = icPartyActivityService.getActivityByActId(actId); + if (null != dto) { + IcPartyActivityEntity actInfoEntity = new IcPartyActivityEntity(); + actInfoEntity.setId(dto.getId()); + actInfoEntity.setPeopleCount(actStatisticalDTO.getSignedInUserNum()); + icPartyActivityService.updateById(actInfoEntity); + } } /** @@ -1189,6 +1281,15 @@ public class WorkActServiceImpl implements WorkActService { //更新act_info表的SUMMARY_FLAG=true actInfoDTO.setSummaryFlag(true); actInfoService.update(actInfoDTO); + + //保存活动结果 + IcPartyActivityDTO dto = icPartyActivityService.getActivityByActId(formDTO.getActId()); + if (null != dto) { + IcPartyActivityEntity actInfoEntity = new IcPartyActivityEntity(); + actInfoEntity.setId(dto.getId()); + actInfoEntity.setResult(getContent(formDTO.getActSummary())); + icPartyActivityService.updateById(actInfoEntity); + } } /** @@ -1199,7 +1300,7 @@ public class WorkActServiceImpl implements WorkActService { * @Date 2020/7/27 13:36 **/ @Override - public ReEditActInfoResultDTO getActInfo(String actId) { + public ReEditActInfoResultDTO getActInfo(String customerId, String actId) { ActInfoDTO actInfoDTO=actInfoService.get(actId); if(null==actInfoDTO){ logger.error("act_info is null"); @@ -1215,6 +1316,21 @@ public class WorkActServiceImpl implements WorkActService { resultDTO.setActId(actId); List actContent=actContentDao.selectByActId(actId); resultDTO.setActContent(actContent); + + if (StringUtils.isNotBlank(resultDTO.getServiceMatter())) { + //获取服务事项 + SubCodeFormDTO codeFormDTO = new SubCodeFormDTO(); + codeFormDTO.setCustomerId(customerId); + codeFormDTO.setParentCategoryCode(SERVICE_MATTER_CODE); + Map categoryMap = icResiDemandDictService.querySubCodeList(codeFormDTO).stream().collect(Collectors.toMap(OptionDTO::getValue, OptionDTO::getLabel)); + resultDTO.setServiceMatterName(categoryMap.get(resultDTO.getServiceMatter())); + } + if (StringUtils.isNotBlank(resultDTO.getUnitId())) { + //获取单位名称 + IcPartyUnitDTO unitDTO = icPartyUnitService.get(resultDTO.getUnitId()); + resultDTO.setUnitName(unitDTO.getUnitName()); + } + return resultDTO; } @@ -1276,5 +1392,108 @@ public class WorkActServiceImpl implements WorkActService { return publishActResultDTO; } + @Override + @Transactional(rollbackFor = Exception.class) + public PublishActResultDTO rePublishV2(RePublishFormDTO rePublishFormDTO) { + ActInfoDTO originalActInfo=actInfoService.get(rePublishFormDTO.getActId()); + if(null==originalActInfo){ + logger.error("act_info is null"); + throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode()); + } + 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.checkPublishFormDTO(newActInfoEntity); + PublishActResultDTO publishActResultDTO=new PublishActResultDTO(); + //内容审核(活动标题、招募要求、活动内容图文) + this.auditRePublishAct(rePublishFormDTO); + logger.info("重新发布活动,审核成功"); + + newActInfoEntity.setId(rePublishFormDTO.getActId()); + actInfoDao.updateById(newActInfoEntity); + //删除原来的 + actContentDao.updateDelFlagByActId(rePublishFormDTO.getActId()); + //插入编辑后的活动详情 + List actContentEntityList=this.constructActContent(rePublishFormDTO.getActContent(),rePublishFormDTO.getActId()); + for(ActContentEntity actContentEntity:actContentEntityList){ + actContentDao.insert(actContentEntity); + } + //插入一条操作日志 + ActOperationRecEntity actOperationRecEntity=new ActOperationRecEntity(); + actOperationRecEntity.setActId(rePublishFormDTO.getActId()); + actOperationRecEntity.setType(ActConstant.ACT_OPER_TYPE_UPDATE); + actOperationRecEntity.setNoticeUser(rePublishFormDTO.getNoticePassedPeople()); + actOperationRecEntity.setRemark(StrConstant.EPMETY_STR); + actOperationRecDao.insert(actOperationRecEntity); + + //删除所有的草稿 + this.deleteDraft(); + publishActResultDTO.setActId(rePublishFormDTO.getActId()); + //发送消息通知-暂时不做了,前端默认串的是不通知 + //如果用户在重新发布之前点击了预览,需要去更新草稿表里的act_info_id,记录草稿和活动的关系 + if(StringUtils.isNotBlank(rePublishFormDTO.getActDraftId())){ + latestActInfoDao.updateActInfoId(rePublishFormDTO.getActDraftId(),newActInfoEntity.getId()); + } + + //添加信息到ic_party_activity + if (ActConstant.PARTY.equals(rePublishFormDTO.getActType())) { + IcPartyActivityDTO activityDTO = icPartyActivityService.getActivityByActId(newActInfoEntity.getId()); + if (null != activityDTO) { + IcPartyActivityEntity activity = getPartyActivityEntity(ConvertUtils.sourceToTarget(rePublishFormDTO, PublishActInfoFormDTO.class), newActInfoEntity); + activity.setId(activityDTO.getId()); + icPartyActivityService.updateById(activity); + } + } + + return publishActResultDTO; + } + + /** + * 构建联建活动对象 + * @Param formDTO + * @Return {@link IcPartyActivityEntity} + * @Author zhaoqifeng + * @Date 2021/12/23 14:32 + */ + private IcPartyActivityEntity getPartyActivityEntity(PublishActInfoFormDTO formDTO, ActInfoEntity actInfoEntity) { + IcPartyActivityEntity entity = new IcPartyActivityEntity(); + entity.setCustomerId(actInfoEntity.getCustomerId()); + entity.setAgencyId(actInfoEntity.getSponsorId()); + Result result=govOrgOpenFeignClient.getAgencyById(formDTO.getSponsorId()); + if(result.success()&&null!=result.getData()){ + entity.setPids(result.getData().getPids()); + }else{ + logger.warn("根据agencyId查询组织信息失败,agencyId={}",formDTO.getSponsorId()); + } + entity.setActId(actInfoEntity.getId()); + entity.setUnitId(actInfoEntity.getUnitId()); + entity.setServiceMatter(actInfoEntity.getServiceMatter()); + entity.setTitle(actInfoEntity.getTitle()); + entity.setTarget(actInfoEntity.getTarget()); + entity.setContent(getContent(formDTO.getActContent())); + entity.setPeopleCount(NumConstant.ZERO); + entity.setActivityTime(actInfoEntity.getActStartTime()); + entity.setAddress(actInfoEntity.getActAddress()); + entity.setLongitude(actInfoEntity.getActLongitude().toPlainString()); + entity.setLatitude(actInfoEntity.getActLatitude().toPlainString()); + return entity; + } + private String getContent(List actContent) { + AtomicReference content = new AtomicReference<>(""); + actContent.forEach(i -> { + if(ActConstant.ACT_CONTENT_TYPE_TEXT.equals(i.getContentType())) { + content.set(content.get().concat("

").concat(i.getContent()).concat("

")); + } else { + content.set(content.get().concat("

").concat("").concat("

")); + } + }); + return content.get(); + } } 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 4ce15b04c7..796fe5cd93 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 @@ -645,7 +645,11 @@ ai.SIGN_IN_START_TIME as signInStartTime, ai.SIGN_IN_END_TIME as signInEndTime, ai.SIGN_IN_ADDRESS as signInAddress, - ai.SIGN_IN_RADIUS as signInRadius + ai.SIGN_IN_RADIUS as signInRadius, + ai.ACT_TYPE, + ai.UNIT_ID, + ai.SERVICE_MATTER, + ai.TARGET FROM act_info ai WHERE @@ -678,7 +682,11 @@ ai.SIGN_IN_START_TIME as signInStartTime, ai.SIGN_IN_END_TIME as signInEndTime, ai.SIGN_IN_ADDRESS as signInAddress, - ai.SIGN_IN_RADIUS as signInRadius + ai.SIGN_IN_RADIUS as signInRadius, + ai.ACT_TYPE, + ai.UNIT_ID, + ai.SERVICE_MATTER, + ai.TARGET FROM act_info ai WHERE @@ -717,7 +725,11 @@ ai.SIGN_IN_START_TIME as signInStartTime, ai.SIGN_IN_END_TIME as signInEndTime, ai.SIGN_IN_ADDRESS as signInAddress, - ai.SIGN_IN_RADIUS as signInRadius + ai.SIGN_IN_RADIUS as signInRadius, + ai.ACT_TYPE, + ai.UNIT_ID, + ai.SERVICE_MATTER, + ai.TARGET FROM act_info ai WHERE diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/LatestActInfoDao.xml b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/LatestActInfoDao.xml index f0904b26a4..67f4cb64a7 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/LatestActInfoDao.xml +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/LatestActInfoDao.xml @@ -113,7 +113,11 @@ lai.REQUIREMENT AS requirement, lai.SPONSOR_NAME AS sponsorName, lai.SPONSOR_CONTACTS AS sponsorContacts, - lai.SPONSOR_TEL AS sponsorTel + lai.SPONSOR_TEL AS sponsorTel, + lai.ACT_TYPE, + lai.UNIT_ID, + lai.SERVICE_MATTER, + lai.TARGET FROM latest_act_info lai WHERE