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 f00ebe792f..a88d1d393f 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 @@ -170,7 +170,7 @@ public class DraftActInfoFormDTO implements Serializable { * 联建单位 */ private String unitId; - + private List unitIdList; /** * 活动目标 */ @@ -180,5 +180,6 @@ public class DraftActInfoFormDTO implements Serializable { * 服务事项 */ private String serviceMatter; + private List serviceMatterList; } 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 ef1f3c3e19..099fa38e60 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 @@ -5,10 +5,7 @@ import lombok.Data; import org.hibernate.validator.constraints.Length; import javax.validation.Valid; -import javax.validation.constraints.Min; -import javax.validation.constraints.NotBlank; -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Size; +import javax.validation.constraints.*; import java.io.Serializable; import java.math.BigDecimal; import java.util.List; @@ -200,9 +197,9 @@ public class PublishActInfoFormDTO implements Serializable { /** * 联建单位 */ - @NotBlank(message = "联建单位不能为空", groups = {AddPartyActivityGroup.class}) private String unitId; - + @NotEmpty(message = "联建单位不能为空", groups = {AddPartyActivityGroup.class}) + private List unitIdList; /** * 活动目标 */ @@ -212,6 +209,7 @@ public class PublishActInfoFormDTO implements Serializable { /** * 服务事项 */ - @NotBlank(message = "服务事项不能为空", groups = {AddPartyActivityGroup.class}) private String serviceMatter; + @NotEmpty(message = "服务事项不能为空", groups = {AddPartyActivityGroup.class}) + private List serviceMatterList; } 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 b093e9dcba..587a60a0ff 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 @@ -5,10 +5,7 @@ import lombok.Data; import org.hibernate.validator.constraints.Length; import javax.validation.Valid; -import javax.validation.constraints.Min; -import javax.validation.constraints.NotBlank; -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Size; +import javax.validation.constraints.*; import java.io.Serializable; import java.math.BigDecimal; import java.util.List; @@ -206,8 +203,9 @@ public class RePublishFormDTO implements Serializable { /** * 联建单位 */ - @NotBlank(message = "联建单位不能为空", groups = {AddPartyActivityGroup.class}) private String unitId; + @NotEmpty(message = "联建单位不能为空", groups = {PublishActInfoFormDTO.AddPartyActivityGroup.class}) + private List unitIdList; /** * 活动目标 @@ -218,6 +216,7 @@ public class RePublishFormDTO implements Serializable { /** * 服务事项 */ - @NotBlank(message = "服务事项不能为空", groups = {AddPartyActivityGroup.class}) private String serviceMatter; + @NotEmpty(message = "服务事项不能为空", groups = {PublishActInfoFormDTO.AddPartyActivityGroup.class}) + private List serviceMatterList; } 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 5e3df9d139..caeed480d5 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 @@ -1,6 +1,7 @@ package com.epmet.dto.result.work; import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.annotation.JsonIgnore; import lombok.Data; import java.io.Serializable; @@ -74,7 +75,12 @@ public class ActPreviewResultDTO implements Serializable { * 主办方名称 */ private String sponsorName; - + @JsonIgnore + private String sponsorType; + @JsonIgnore + private String sponsorId; + @JsonIgnore + private String pid; /** * 联系人 */ @@ -100,6 +106,8 @@ public class ActPreviewResultDTO implements Serializable { */ private String unitId; private String unitName; + private List unitIdList; + private List unitNameList; /** * 活动目标 */ @@ -110,4 +118,6 @@ public class ActPreviewResultDTO implements Serializable { */ private String serviceMatter; private String serviceMatterName; + private List serviceMatterList; + private List serviceMatterNameList; } 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 3da7fade52..764d3ffabf 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 @@ -158,6 +158,8 @@ public class CanceledActDetailResultDTO implements Serializable { */ private String unitId; private String unitName; + private List unitIdList; + private List unitNameList; /** * 活动目标 */ @@ -168,4 +170,6 @@ public class CanceledActDetailResultDTO implements Serializable { */ private String serviceMatter; private String serviceMatterName; + private List serviceMatterList; + private List serviceMatterNameList; } 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 3e4bfbdc9a..5bf9c4bfb1 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 @@ -147,6 +147,8 @@ public class FinishedActDetailResultDTO implements Serializable { */ private String unitId; private String unitName; + private List unitIdList; + private List unitNameList; /** * 活动目标 */ @@ -157,4 +159,6 @@ public class FinishedActDetailResultDTO implements Serializable { */ private String serviceMatter; private String serviceMatterName; + private List serviceMatterList; + private List serviceMatterNameList; } 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 8dc4ad2fb2..03fdbf576b 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 @@ -142,6 +142,8 @@ public class InProgressActDetailResultDTO implements Serializable { */ private String unitId; private String unitName; + private List unitIdList; + private List unitNameList; /** * 活动目标 */ @@ -152,4 +154,6 @@ public class InProgressActDetailResultDTO implements Serializable { */ private String serviceMatter; private String serviceMatterName; + private List serviceMatterList; + private List serviceMatterNameList; } 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 a360fd53c3..367ab0ec1d 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 @@ -159,6 +159,8 @@ public class ReEditActInfoResultDTO implements Serializable { */ private String unitId; private String unitName; + private List unitIdList; + private List unitNameList; /** * 活动目标 */ @@ -169,4 +171,6 @@ public class ReEditActInfoResultDTO implements Serializable { */ private String serviceMatter; private String serviceMatterName; + private List serviceMatterList; + private List serviceMatterNameList; } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/LatestActServiceRelationEntity.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/LatestActServiceRelationEntity.java index a7d81ad2c1..20e20de39b 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/LatestActServiceRelationEntity.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/LatestActServiceRelationEntity.java @@ -23,16 +23,6 @@ public class LatestActServiceRelationEntity extends BaseEpmetEntity { */ private String customerId; - /** - * 组织ID - */ - private String agencyId; - - /** - * 组织的所有上级 - */ - private String pids; - /** * latest_act_info表ID */ diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/LatestActUnitRelationEntity.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/LatestActUnitRelationEntity.java index 4940c49cd3..d386197d79 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/LatestActUnitRelationEntity.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/LatestActUnitRelationEntity.java @@ -23,16 +23,6 @@ public class LatestActUnitRelationEntity extends BaseEpmetEntity { */ private String customerId; - /** - * 组织ID - */ - private String agencyId; - - /** - * 组织的所有上级 - */ - private String pids; - /** * latest_act_info表ID */ diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/LatestActServiceRelationService.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/LatestActServiceRelationService.java index e400a6d1ab..d5274af182 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/LatestActServiceRelationService.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/LatestActServiceRelationService.java @@ -3,6 +3,8 @@ package com.epmet.service; import com.epmet.commons.mybatis.service.BaseService; import com.epmet.entity.LatestActServiceRelationEntity; +import java.util.List; + /** * 联建活动与服务事项关联表 * @@ -10,5 +12,23 @@ import com.epmet.entity.LatestActServiceRelationEntity; * @since v1.0.0 2022-02-21 */ public interface LatestActServiceRelationService extends BaseService { + /** + * 获取活动所属服务事项列表 + * + * @Param actId + * @Return {@link List < String>} + * @Author zhaoqifeng + * @Date 2022/2/22 14:53 + */ + List getServiceMatterList(String actId); + /** + * 删除活动所属服务事项 + * + * @Param actId + * @Return + * @Author zhaoqifeng + * @Date 2022/2/22 14:54 + */ + void deleteByAct(String actId); } \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/LatestActUnitRelationService.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/LatestActUnitRelationService.java index 5da8fb584b..bcfa1bfb82 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/LatestActUnitRelationService.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/LatestActUnitRelationService.java @@ -3,6 +3,8 @@ package com.epmet.service; import com.epmet.commons.mybatis.service.BaseService; import com.epmet.entity.LatestActUnitRelationEntity; +import java.util.List; + /** * 联建活动与单位关联表 * @@ -10,5 +12,24 @@ import com.epmet.entity.LatestActUnitRelationEntity; * @since v1.0.0 2022-02-21 */ public interface LatestActUnitRelationService extends BaseService { + /** + * 获取活动所属联建单位列表 + * + * @Param actId + * @Return {@link List< String>} + * @Author zhaoqifeng + * @Date 2022/2/22 14:53 + */ + List getUnitList(String actId); + + /** + * 删除活动所属单位列表 + * + * @Param actId + * @Return + * @Author zhaoqifeng + * @Date 2022/2/22 14:54 + */ + void deleteByAct(String actId); } \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/LatestActServiceRelationServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/LatestActServiceRelationServiceImpl.java index 611207bd98..3575719a68 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/LatestActServiceRelationServiceImpl.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/LatestActServiceRelationServiceImpl.java @@ -1,10 +1,17 @@ package com.epmet.service.impl; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.dao.LatestActServiceRelationDao; import com.epmet.entity.LatestActServiceRelationEntity; import com.epmet.service.LatestActServiceRelationService; +import org.apache.commons.collections4.CollectionUtils; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; /** * 联建活动与服务事项关联表 @@ -16,4 +23,39 @@ import org.springframework.stereotype.Service; public class LatestActServiceRelationServiceImpl extends BaseServiceImpl implements LatestActServiceRelationService { + /** + * 获取活动所属服务事项列表 + * + * @param actId + * @Param actId + * @Return {@link List < String>} + * @Author zhaoqifeng + * @Date 2022/2/22 14:53 + */ + @Override + public List getServiceMatterList(String actId) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(LatestActServiceRelationEntity::getActId, actId); + wrapper.orderByAsc(LatestActServiceRelationEntity::getSort); + List list = baseDao.selectList(wrapper); + if (CollectionUtils.isEmpty(list)) { + return Collections.emptyList(); + } + return list.stream().map(LatestActServiceRelationEntity::getServiceMatter).collect(Collectors.toList()); + } + + /** + * 删除活动所属服务事项 + * + * @param actId + * @Param actId + * @Return + * @Author zhaoqifeng + * @Date 2022/2/22 14:54 + */ + @Override + @Transactional(rollbackFor = Exception.class) + public void deleteByAct(String actId) { + baseDao.deleteByActivity(actId); + } } \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/LatestActUnitRelationServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/LatestActUnitRelationServiceImpl.java index aee966d2ea..0614854d87 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/LatestActUnitRelationServiceImpl.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/LatestActUnitRelationServiceImpl.java @@ -1,10 +1,17 @@ package com.epmet.service.impl; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.dao.LatestActUnitRelationDao; import com.epmet.entity.LatestActUnitRelationEntity; import com.epmet.service.LatestActUnitRelationService; +import org.apache.commons.collections4.CollectionUtils; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; /** * 联建活动与单位关联表 @@ -16,4 +23,39 @@ import org.springframework.stereotype.Service; public class LatestActUnitRelationServiceImpl extends BaseServiceImpl implements LatestActUnitRelationService { + /** + * 获取活动所属联建单位列表 + * + * @param actId + * @Param actId + * @Return {@link List < String>} + * @Author zhaoqifeng + * @Date 2022/2/22 14:53 + */ + @Override + public List getUnitList(String actId) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(LatestActUnitRelationEntity::getActId, actId); + wrapper.orderByAsc(LatestActUnitRelationEntity::getSort); + List list = baseDao.selectList(wrapper); + if (CollectionUtils.isEmpty(list)) { + return Collections.emptyList(); + } + return list.stream().map(LatestActUnitRelationEntity::getUnitId).collect(Collectors.toList()); + } + + /** + * 删除活动所属单位列表 + * + * @param actId + * @Param actId + * @Return + * @Author zhaoqifeng + * @Date 2022/2/22 14:54 + */ + @Override + @Transactional(rollbackFor = Exception.class) + public void deleteByAct(String actId) { + baseDao.deleteByActivity(actId); + } } \ No newline at end of file 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 5572a48f48..4739cff8fe 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,8 +1,10 @@ package com.epmet.service.impl; +import com.epmet.commons.tools.constant.NumConstant; 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.constant.ActConstant; import com.epmet.dto.IcPartyUnitDTO; import com.epmet.dto.LatestActContentDTO; import com.epmet.dto.LatestActInfoDTO; @@ -11,6 +13,8 @@ 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.entity.LatestActServiceRelationEntity; +import com.epmet.entity.LatestActUnitRelationEntity; import com.epmet.service.*; import org.apache.commons.lang3.StringUtils; import org.apache.logging.log4j.LogManager; @@ -24,6 +28,7 @@ import java.util.ArrayList; import java.util.Date; import java.util.List; import java.util.Map; +import java.util.concurrent.atomic.AtomicInteger; import java.util.stream.Collectors; /** @@ -45,7 +50,10 @@ public class WorkActDraftServiceImpl implements WorkActDraftService { private IcServiceItemDictService icServiceItemDictService; @Resource private IcPartyUnitService icPartyUnitService; - + @Resource + private LatestActServiceRelationService latestActServiceRelationService; + @Resource + private LatestActUnitRelationService latestActUnitRelationService; /** * @return com.epmet.dto.form.work.PublishActInitResultDTO @@ -116,6 +124,32 @@ public class WorkActDraftServiceImpl implements WorkActDraftService { } SaveActDraftResultDTO resultDTO=new SaveActDraftResultDTO(); resultDTO.setActDraftId(actDraftId); + + //保存活动与服务关系 + latestActServiceRelationService.deleteByAct(actDraftId); + AtomicInteger i = new AtomicInteger(NumConstant.ONE); + List serviceList = formDTO.getServiceMatterList().stream().map(service -> { + LatestActServiceRelationEntity entity = new LatestActServiceRelationEntity(); + entity.setCustomerId(formDTO.getCustomerId()); + entity.setActId(actDraftId); + entity.setServiceMatter(service); + entity.setSort(i.getAndIncrement()); + return entity; + }).collect(Collectors.toList()); + latestActServiceRelationService.insertBatch(serviceList); + + //保存活动与单位关系 + latestActUnitRelationService.deleteByAct(actDraftId); + AtomicInteger j = new AtomicInteger(NumConstant.ONE); + List unitList = formDTO.getUnitIdList().stream().map(unitId -> { + LatestActUnitRelationEntity entity = new LatestActUnitRelationEntity(); + entity.setCustomerId(formDTO.getCustomerId()); + entity.setActId(actDraftId); + entity.setUnitId(unitId); + entity.setSort(j.getAndIncrement()); + return entity; + }).collect(Collectors.toList()); + latestActUnitRelationService.insertBatch(unitList); return resultDTO; } @@ -146,6 +180,24 @@ public class WorkActDraftServiceImpl implements WorkActDraftService { IcPartyUnitDTO unitDTO = icPartyUnitService.get(actPreviewResultDTO.getUnitId()); actPreviewResultDTO.setUnitName(unitDTO.getUnitName()); } + if (ActConstant.PARTY.equals(actPreviewResultDTO.getActType())) { + //获取服务事项 + List serviceItemList = icServiceItemDictService.queryDictList(formDTO.getCustomerId()); + Map categoryMap = serviceItemList.stream().collect(Collectors.toMap(OptionDTO::getValue, OptionDTO::getLabel)); + List services = latestActServiceRelationService.getServiceMatterList(formDTO.getActDraftId()); + List serviceNames = services.stream().map(categoryMap::get).collect(Collectors.toList()); + actPreviewResultDTO.setServiceMatterList(services); + actPreviewResultDTO.setServiceMatterNameList(serviceNames); + + //获取联建单位 + IcPartyUnitDTO unitDTO = new IcPartyUnitDTO(); + unitDTO.setAgencyId(ActConstant.SPONSOR_AGENCY.equals(actPreviewResultDTO.getSponsorType())?actPreviewResultDTO.getSponsorId():actPreviewResultDTO.getPid()); + Map option = icPartyUnitService.option(unitDTO).stream().collect(Collectors.toMap(OptionDTO::getValue, OptionDTO::getLabel)); + List unitIds = latestActUnitRelationService.getUnitList(formDTO.getActDraftId()); + List unitNames = unitIds.stream().map(option::get).collect(Collectors.toList()); + actPreviewResultDTO.setUnitIdList(unitIds); + actPreviewResultDTO.setUnitNameList(unitNames); + } } return actPreviewResultDTO; } 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 7b076059b9..31e38f1b01 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 @@ -33,7 +33,6 @@ import com.epmet.entity.*; import com.epmet.feign.EpmetMessageOpenFeignClient; import com.epmet.feign.GovOrgOpenFeignClient; import com.epmet.service.*; -import org.apache.commons.collections4.MapUtils; import org.apache.commons.lang3.StringUtils; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -44,6 +43,7 @@ import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; import java.util.*; +import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicReference; import java.util.stream.Collectors; @@ -102,6 +102,10 @@ public class WorkActServiceImpl implements WorkActService { private IcPartyUnitService icPartyUnitService; @Resource private IcServiceItemDictService icServiceItemDictService; + @Resource + private IcActivityUnitRelationService icActivityUnitRelationService; + @Resource + private IcActivityServiceRelationService icActivityServiceRelationService; /** @@ -232,6 +236,36 @@ public class WorkActServiceImpl implements WorkActService { if (ActConstant.PARTY.equals(formDTO.getActType())) { IcPartyActivityEntity activity = getPartyActivityEntity(formDTO, actInfoEntity); icPartyActivityService.insert(activity); + + //保存活动与单位关系 + icActivityUnitRelationService.deleteByActivity(activity.getId()); + AtomicInteger i = new AtomicInteger(NumConstant.ONE); + List unitRelationList = formDTO.getUnitIdList().stream().map(unitId -> { + IcActivityUnitRelationEntity relation = new IcActivityUnitRelationEntity(); + relation.setCustomerId(activity.getCustomerId()); + relation.setAgencyId(activity.getAgencyId()); + relation.setPids(activity.getPids()); + relation.setActivityId(activity.getId()); + relation.setUnitId(unitId); + relation.setSort(i.getAndIncrement()); + return relation; + }).collect(Collectors.toList()); + icActivityUnitRelationService.insertBatch(unitRelationList); + + //保存活动与服务关系 + icActivityServiceRelationService.deleteByActivity(activity.getId()); + AtomicInteger j = new AtomicInteger(NumConstant.ONE); + List serviceRelationList = formDTO.getServiceMatterList().stream().map(service -> { + IcActivityServiceRelationEntity relation = new IcActivityServiceRelationEntity(); + relation.setCustomerId(activity.getCustomerId()); + relation.setAgencyId(activity.getAgencyId()); + relation.setPids(activity.getPids()); + relation.setActivityId(activity.getId()); + relation.setServiceMatter(service); + relation.setSort(j.getAndIncrement()); + return relation; + }).collect(Collectors.toList()); + icActivityServiceRelationService.insertBatch(serviceRelationList); } return publishActResultDTO; @@ -779,17 +813,26 @@ public class WorkActServiceImpl implements WorkActService { canceledActDetailResultDTO.setIsMyPublish(false); } - if (StringUtils.isNotBlank(canceledActDetailResultDTO.getServiceMatter())) { - //获取服务事项 - List serviceItemList = icServiceItemDictService.queryDictList(customerId); - Map categoryMap = serviceItemList.stream().collect(Collectors.toMap(OptionDTO::getValue, OptionDTO::getLabel)); - canceledActDetailResultDTO.setServiceMatterName(MapUtils.isNotEmpty(categoryMap) && categoryMap.containsKey(canceledActDetailResultDTO.getServiceMatter()) ? - categoryMap.get(canceledActDetailResultDTO.getServiceMatter()) : StrConstant.EPMETY_STR); - } - if (StringUtils.isNotBlank(canceledActDetailResultDTO.getUnitId())) { - //获取单位名称 - IcPartyUnitDTO unitDTO = icPartyUnitService.get(canceledActDetailResultDTO.getUnitId()); - canceledActDetailResultDTO.setUnitName(unitDTO.getUnitName()); + if (ActConstant.PARTY.equals(canceledActDetailResultDTO.getActType())) { + IcPartyActivityDTO dto = icPartyActivityService.getActivityByActId(actId); + if (null != dto) { + //获取服务事项 + List serviceItemList = icServiceItemDictService.queryDictList(customerId); + Map categoryMap = serviceItemList.stream().collect(Collectors.toMap(OptionDTO::getValue, OptionDTO::getLabel)); + List services = icActivityServiceRelationService.getServiceList(dto.getId()); + List serviceNames = services.stream().map(categoryMap::get).collect(Collectors.toList()); + canceledActDetailResultDTO.setServiceMatterList(services); + canceledActDetailResultDTO.setServiceMatterNameList(serviceNames); + + //获取联建单位 + IcPartyUnitDTO unitDTO = new IcPartyUnitDTO(); + unitDTO.setAgencyId(dto.getAgencyId()); + Map option = icPartyUnitService.option(unitDTO).stream().collect(Collectors.toMap(OptionDTO::getValue, OptionDTO::getLabel)); + List unitIds = icActivityUnitRelationService.getUnitList(dto.getId()); + List unitNames = unitIds.stream().map(option::get).collect(Collectors.toList()); + canceledActDetailResultDTO.setUnitIdList(unitIds); + canceledActDetailResultDTO.setUnitNameList(unitNames); + } } } return canceledActDetailResultDTO; @@ -835,17 +878,26 @@ public class WorkActServiceImpl implements WorkActService { }else{ resultDTO.setIsMyPublish(false); } - - if (StringUtils.isNotBlank(resultDTO.getServiceMatter())) { - //获取服务事项 - List serviceItemList = icServiceItemDictService.queryDictList(formDTO.getCustomerId()); - Map categoryMap = serviceItemList.stream().collect(Collectors.toMap(OptionDTO::getValue, OptionDTO::getLabel)); - resultDTO.setServiceMatterName(MapUtils.isNotEmpty(categoryMap) && categoryMap.containsKey(resultDTO.getServiceMatter()) ? categoryMap.get(resultDTO.getServiceMatter()) : StrConstant.EPMETY_STR); - } - if (StringUtils.isNotBlank(resultDTO.getUnitId())) { - //获取单位名称 - IcPartyUnitDTO unitDTO = icPartyUnitService.get(resultDTO.getUnitId()); - resultDTO.setUnitName(unitDTO.getUnitName()); + if (ActConstant.PARTY.equals(resultDTO.getActType())) { + IcPartyActivityDTO dto = icPartyActivityService.getActivityByActId(formDTO.getActId()); + if (null != dto) { + //获取服务事项 + List serviceItemList = icServiceItemDictService.queryDictList(formDTO.getCustomerId()); + Map categoryMap = serviceItemList.stream().collect(Collectors.toMap(OptionDTO::getValue, OptionDTO::getLabel)); + List services = icActivityServiceRelationService.getServiceList(dto.getId()); + List serviceNames = services.stream().map(categoryMap::get).collect(Collectors.toList()); + resultDTO.setServiceMatterList(services); + resultDTO.setServiceMatterNameList(serviceNames); + + //获取联建单位 + IcPartyUnitDTO unitDTO = new IcPartyUnitDTO(); + unitDTO.setAgencyId(dto.getAgencyId()); + Map option = icPartyUnitService.option(unitDTO).stream().collect(Collectors.toMap(OptionDTO::getValue, OptionDTO::getLabel)); + List unitIds = icActivityUnitRelationService.getUnitList(dto.getId()); + List unitNames = unitIds.stream().map(option::get).collect(Collectors.toList()); + resultDTO.setUnitIdList(unitIds); + resultDTO.setUnitNameList(unitNames); + } } } return resultDTO; @@ -915,16 +967,26 @@ public class WorkActServiceImpl implements WorkActService { }else{ resultDTO.setIsMyPublish(false); } - if (StringUtils.isNotBlank(resultDTO.getServiceMatter())) { - //获取服务事项 - List serviceItemList=icServiceItemDictService.queryDictList(customerId); - Map categoryMap=serviceItemList.stream().collect(Collectors.toMap(OptionDTO::getValue, OptionDTO::getLabel)); - resultDTO.setServiceMatterName(MapUtils.isNotEmpty(categoryMap) && categoryMap.containsKey(resultDTO.getServiceMatter()) ? categoryMap.get(resultDTO.getServiceMatter()) : StrConstant.EPMETY_STR); - } - if (StringUtils.isNotBlank(resultDTO.getUnitId())) { - //获取单位名称 - IcPartyUnitDTO unitDTO = icPartyUnitService.get(resultDTO.getUnitId()); - resultDTO.setUnitName(unitDTO.getUnitName()); + if (ActConstant.PARTY.equals(resultDTO.getActType())) { + IcPartyActivityDTO dto = icPartyActivityService.getActivityByActId(actId); + if (null != dto) { + //获取服务事项 + List serviceItemList = icServiceItemDictService.queryDictList(customerId); + Map categoryMap = serviceItemList.stream().collect(Collectors.toMap(OptionDTO::getValue, OptionDTO::getLabel)); + List services = icActivityServiceRelationService.getServiceList(dto.getId()); + List serviceNames = services.stream().map(categoryMap::get).collect(Collectors.toList()); + resultDTO.setServiceMatterList(services); + resultDTO.setServiceMatterNameList(serviceNames); + + //获取联建单位 + IcPartyUnitDTO unitDTO = new IcPartyUnitDTO(); + unitDTO.setAgencyId(dto.getAgencyId()); + Map option = icPartyUnitService.option(unitDTO).stream().collect(Collectors.toMap(OptionDTO::getValue, OptionDTO::getLabel)); + List unitIds = icActivityUnitRelationService.getUnitList(dto.getId()); + List unitNames = unitIds.stream().map(option::get).collect(Collectors.toList()); + resultDTO.setUnitIdList(unitIds); + resultDTO.setUnitNameList(unitNames); + } } } return resultDTO; @@ -1309,16 +1371,26 @@ public class WorkActServiceImpl implements WorkActService { List actContent=actContentDao.selectByActId(actId); resultDTO.setActContent(actContent); - if (StringUtils.isNotBlank(resultDTO.getServiceMatter())) { - //获取服务事项 - List serviceItemList=icServiceItemDictService.queryDictList(customerId); - Map categoryMap=serviceItemList.stream().collect(Collectors.toMap(OptionDTO::getValue, OptionDTO::getLabel)); - resultDTO.setServiceMatterName(MapUtils.isNotEmpty(categoryMap) && categoryMap.containsKey(resultDTO.getServiceMatter()) ? categoryMap.get(resultDTO.getServiceMatter()) : StrConstant.EPMETY_STR); - } - if (StringUtils.isNotBlank(resultDTO.getUnitId())) { - //获取单位名称 - IcPartyUnitDTO unitDTO = icPartyUnitService.get(resultDTO.getUnitId()); - resultDTO.setUnitName(unitDTO.getUnitName()); + if (ActConstant.PARTY.equals(resultDTO.getActType())) { + IcPartyActivityDTO dto = icPartyActivityService.getActivityByActId(actId); + if (null != dto) { + //获取服务事项 + List serviceItemList = icServiceItemDictService.queryDictList(customerId); + Map categoryMap = serviceItemList.stream().collect(Collectors.toMap(OptionDTO::getValue, OptionDTO::getLabel)); + List services = icActivityServiceRelationService.getServiceList(dto.getId()); + List serviceNames = services.stream().map(categoryMap::get).collect(Collectors.toList()); + resultDTO.setServiceMatterList(services); + resultDTO.setServiceMatterNameList(serviceNames); + + //获取联建单位 + IcPartyUnitDTO unitDTO = new IcPartyUnitDTO(); + unitDTO.setAgencyId(dto.getAgencyId()); + Map option = icPartyUnitService.option(unitDTO).stream().collect(Collectors.toMap(OptionDTO::getValue, OptionDTO::getLabel)); + List unitIds = icActivityUnitRelationService.getUnitList(dto.getId()); + List unitNames = unitIds.stream().map(option::get).collect(Collectors.toList()); + resultDTO.setUnitIdList(unitIds); + resultDTO.setUnitNameList(unitNames); + } } return resultDTO; @@ -1438,6 +1510,36 @@ public class WorkActServiceImpl implements WorkActService { IcPartyActivityEntity activity = getPartyActivityEntity(ConvertUtils.sourceToTarget(rePublishFormDTO, PublishActInfoFormDTO.class), newActInfoEntity); activity.setId(activityDTO.getId()); icPartyActivityService.updateById(activity); + + //保存活动与单位关系 + icActivityUnitRelationService.deleteByActivity(activity.getId()); + AtomicInteger i = new AtomicInteger(NumConstant.ONE); + List unitRelationList = rePublishFormDTO.getUnitIdList().stream().map(unitId -> { + IcActivityUnitRelationEntity relation = new IcActivityUnitRelationEntity(); + relation.setCustomerId(activity.getCustomerId()); + relation.setAgencyId(activity.getAgencyId()); + relation.setPids(activity.getPids()); + relation.setActivityId(activity.getId()); + relation.setUnitId(unitId); + relation.setSort(i.getAndIncrement()); + return relation; + }).collect(Collectors.toList()); + icActivityUnitRelationService.insertBatch(unitRelationList); + + //保存活动与服务关系 + icActivityServiceRelationService.deleteByActivity(activity.getId()); + AtomicInteger j = new AtomicInteger(NumConstant.ONE); + List serviceRelationList = rePublishFormDTO.getServiceMatterList().stream().map(service -> { + IcActivityServiceRelationEntity relation = new IcActivityServiceRelationEntity(); + relation.setCustomerId(activity.getCustomerId()); + relation.setAgencyId(activity.getAgencyId()); + relation.setPids(activity.getPids()); + relation.setActivityId(activity.getId()); + relation.setServiceMatter(service); + relation.setSort(j.getAndIncrement()); + return relation; + }).collect(Collectors.toList()); + icActivityServiceRelationService.insertBatch(serviceRelationList); } } @@ -1462,8 +1564,6 @@ public class WorkActServiceImpl implements WorkActService { 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())); 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 67f4cb64a7..1bcd53d153 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 @@ -114,6 +114,9 @@ lai.SPONSOR_NAME AS sponsorName, lai.SPONSOR_CONTACTS AS sponsorContacts, lai.SPONSOR_TEL AS sponsorTel, + lai.SPONSOR_TYPE, + lai.SPONSOR_ID, + lai.PID, lai.ACT_TYPE, lai.UNIT_ID, lai.SERVICE_MATTER,