Browse Source

活动相关接口

dev_shibei_match
zhaoqifeng 4 years ago
parent
commit
2c5e7e140e
  1. 5
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/IcPartyActivityDTO.java
  2. 20
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/LatestActInfoDTO.java
  3. 1
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/work/ActIdFormDTO.java
  4. 1
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/work/ActPreviewFormDTO.java
  5. 20
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/work/DraftActInfoFormDTO.java
  6. 25
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/work/PublishActInfoFormDTO.java
  7. 25
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/work/RePublishFormDTO.java
  8. 21
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/ActPreviewResultDTO.java
  9. 21
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/CanceledActDetailResultDTO.java
  10. 21
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/FinishedActDetailResultDTO.java
  11. 21
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/InProgressActDetailResultDTO.java
  12. 20
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/LatestDraftActInfoResultDTO.java
  13. 21
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/ReEditActInfoResultDTO.java
  14. 8
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/constant/ActConstant.java
  15. 52
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/WorkActController.java
  16. 21
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/ActInfoEntity.java
  17. 5
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/IcPartyActivityEntity.java
  18. 20
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/LatestActInfoEntity.java
  19. 18
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcPartyActivityService.java
  20. 10
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/WorkActService.java
  21. 34
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcPartyActivityServiceImpl.java
  22. 39
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActDraftServiceImpl.java
  23. 277
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActServiceImpl.java
  24. 18
      epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActInfoDao.xml
  25. 6
      epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/LatestActInfoDao.xml

5
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
*/

20
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;
/**
* 乐观锁
*/

1
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;
}

1
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;
}

20
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;
}

25
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;
}

25
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;
}

21
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<ActPreviewContentResultDTO> actContent;
/**
* 活动类型爱心活动heart 联建活动party
*/
private String actType;
/**
* 联建单位
*/
private String unitId;
private String unitName;
/**
* 活动目标
*/
private String target;
/**
* 服务事项
*/
private String serviceMatter;
private String serviceMatterName;
}

21
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;
}

21
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;
}

21
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;
}

20
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<ActDraftContentDTOResultDTO> actContent;
/**
* 活动类型爱心活动heart 联建活动party
*/
private String actType = "heart";
/**
* 联建单位
*/
private String unitId;
/**
* 活动目标
*/
private String target;
/**
* 服务事项
*/
private String serviceMatter;
}

21
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<ActPreviewContentResultDTO> actContent;
/**
* 活动类型爱心活动heart 联建活动party
*/
private String actType;
/**
* 联建单位
*/
private String unitId;
private String unitName;
/**
* 活动目标
*/
private String target;
/**
* 服务事项
*/
private String serviceMatter;
private String serviceMatterName;
}

8
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";
}

52
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<PublishActResultDTO>().ok(workActService.publishAct(formDTO));
}
@PostMapping("publishV2")
public Result<PublishActResultDTO> 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<PublishActResultDTO>().ok(workActService.publishActV2(formDTO));
}
/**
* @return com.epmet.commons.tools.utils.Result<com.epmet.dto.result.work.InProgressActResultDTO>
* @param formDTO
@ -130,9 +150,9 @@ public class WorkActController {
* @Date 2020/7/26 18:00
**/
@PostMapping("canceleddetail")
public Result<CanceledActDetailResultDTO> canceledDetail(@RequestBody ActIdFormDTO actIdFormDTO) {
public Result<CanceledActDetailResultDTO> canceledDetail(@LoginUser TokenDto tokenDto, @RequestBody ActIdFormDTO actIdFormDTO) {
ValidatorUtils.validateEntity(actIdFormDTO, ActIdFormDTO.AddUserInternalGroup.class);
return new Result<CanceledActDetailResultDTO>().ok(workActService.canceledDetail(actIdFormDTO.getActId()));
return new Result<CanceledActDetailResultDTO>().ok(workActService.canceledDetail(tokenDto.getCustomerId(), actIdFormDTO.getActId()));
}
/**
@ -158,8 +178,9 @@ public class WorkActController {
* @Date 2020/7/26 21:01
**/
@PostMapping("finisheddetail")
public Result<FinishedActDetailResultDTO> finishedDeatil(@RequestBody ActIdFormDTO formDTO) {
public Result<FinishedActDetailResultDTO> finishedDeatil(@LoginUser TokenDto tokenDto, @RequestBody ActIdFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, ActIdFormDTO.AddUserInternalGroup.class);
formDTO.setCustomerId(tokenDto.getCustomerId());
return new Result<FinishedActDetailResultDTO>().ok(workActService.finishedDeatil(formDTO));
}
@ -171,9 +192,10 @@ public class WorkActController {
* @Date 2020/7/26 21:33
**/
@PostMapping("inprogressdetail")
public Result<InProgressActDetailResultDTO> inProgressDetail(@RequestBody ActIdFormDTO formDTO) {
public Result<InProgressActDetailResultDTO> inProgressDetail(@LoginUser TokenDto tokenDto, @RequestBody ActIdFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, ActIdFormDTO.AddUserInternalGroup.class);
return new Result<InProgressActDetailResultDTO>().ok(workActService.inProgressDetail(formDTO.getActId()));
return new Result<InProgressActDetailResultDTO>().ok(workActService.inProgressDetail(tokenDto.getCustomerId(), formDTO.getActId()));
}
/**
@ -229,9 +251,9 @@ public class WorkActController {
* @Date 2020/7/27 13:36
**/
@PostMapping("getactinfo")
public Result<ReEditActInfoResultDTO> getActInfo(@RequestBody ActIdFormDTO formDTO){
public Result<ReEditActInfoResultDTO> getActInfo(@LoginUser TokenDto tokenDto, @RequestBody ActIdFormDTO formDTO){
ValidatorUtils.validateEntity(formDTO, ActIdFormDTO.AddUserInternalGroup.class);
return new Result<ReEditActInfoResultDTO>().ok(workActService.getActInfo(formDTO.getActId()));
return new Result<ReEditActInfoResultDTO>().ok(workActService.getActInfo(tokenDto.getCustomerId(), formDTO.getActId()));
}
/**
@ -253,5 +275,21 @@ public class WorkActController {
return new Result<PublishActResultDTO>().ok(workActService.rePublish(rePublishFormDTO));
}
@PostMapping("republishV2")
public Result<PublishActResultDTO> 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<PublishActResultDTO>().ok(workActService.rePublishV2(rePublishFormDTO));
}
}

21
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;
}

5
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
*/

20
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;
}

18
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcPartyActivityService.java

@ -117,4 +117,22 @@ public interface IcPartyActivityService extends BaseService<IcPartyActivityEntit
* @Date 2021/12/9 16:24
*/
PageData<IcPartyActivityDTO> 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);
}

10
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);
}

34
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<IcPartyActivityD
return new PageData<>(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<IcPartyActivityEntity> 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<IcPartyActivityEntity> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(IcPartyActivityEntity::getActId, actId);
baseDao.delete(wrapper);
}
/**
* 近30天开始时间和结束时间 精确到秒
* @Param formDTO

39
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<String, String> 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;
}

277
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<ActContentEntity> actContentEntityList=this.constructActContent(formDTO.getActContent(),actInfoEntity.getId());
for(ActContentEntity actContentEntity:actContentEntityList){
actContentDao.insert(actContentEntity);
}
//插入一条操作日志
ActOperationRecEntity actOperationRecEntity=new ActOperationRecEntity();
actOperationRecEntity.setActId(actInfoEntity.getId());
actOperationRecEntity.setType(ActConstant.ACT_OPER_TYPE_PUBLISH);
actOperationRecEntity.setNoticeUser(false);
actOperationRecEntity.setRemark(StrConstant.EPMETY_STR);
actOperationRecDao.insert(actOperationRecEntity);
//删除所有的草稿
this.deleteDraft();
publishActResultDTO.setActId(actInfoEntity.getId());
//添加信息到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<String, String> 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<String, String> 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<String, String> 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<ActPreviewContentResultDTO> 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<String, String> 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<ActContentEntity> 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<CustomerAgencyDTO> 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<PublishActContentFormDTO> actContent) {
AtomicReference<String> content = new AtomicReference<>("");
actContent.forEach(i -> {
if(ActConstant.ACT_CONTENT_TYPE_TEXT.equals(i.getContentType())) {
content.set(content.get().concat("<p>").concat(i.getContent()).concat("</p>"));
} else {
content.set(content.get().concat("<p>").concat("<img src=\"").concat(i.getContent()).concat("\"/>").concat("</p>"));
}
});
return content.get();
}
}

18
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

6
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

Loading…
Cancel
Save