Browse Source

联建活动添加网格

master
zhaoqifeng 3 years ago
parent
commit
628bcae96c
  1. 2
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/LatestActInfoEntity.java
  2. 46
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActDraftServiceImpl.java

2
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/LatestActInfoEntity.java

@ -43,7 +43,7 @@ public class LatestActInfoEntity extends BaseEpmetEntity {
* 客户id * 客户id
*/ */
private String customerId; private String customerId;
private String gridId;
/** /**
* 活动标题 * 活动标题
*/ */

46
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActDraftServiceImpl.java

@ -18,6 +18,7 @@ import com.epmet.dto.result.work.*;
import com.epmet.entity.LatestActServiceRelationEntity; import com.epmet.entity.LatestActServiceRelationEntity;
import com.epmet.entity.LatestActUnitRelationEntity; import com.epmet.entity.LatestActUnitRelationEntity;
import com.epmet.service.*; import com.epmet.service.*;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
@ -133,29 +134,32 @@ public class WorkActDraftServiceImpl implements WorkActDraftService {
//保存活动与服务关系 //保存活动与服务关系
latestActServiceRelationService.deleteByAct(actDraftId); latestActServiceRelationService.deleteByAct(actDraftId);
AtomicInteger i = new AtomicInteger(NumConstant.ONE); if (CollectionUtils.isNotEmpty(formDTO.getServiceMatterList())) {
List<LatestActServiceRelationEntity> serviceList = formDTO.getServiceMatterList().stream().map(service -> { AtomicInteger i = new AtomicInteger(NumConstant.ONE);
LatestActServiceRelationEntity entity = new LatestActServiceRelationEntity(); List<LatestActServiceRelationEntity> serviceList = formDTO.getServiceMatterList().stream().map(service -> {
entity.setCustomerId(formDTO.getCustomerId()); LatestActServiceRelationEntity entity = new LatestActServiceRelationEntity();
entity.setActId(actDraftId); entity.setCustomerId(formDTO.getCustomerId());
entity.setServiceMatter(service); entity.setActId(actDraftId);
entity.setSort(i.getAndIncrement()); entity.setServiceMatter(service);
return entity; entity.setSort(i.getAndIncrement());
}).collect(Collectors.toList()); return entity;
latestActServiceRelationService.insertBatch(serviceList); }).collect(Collectors.toList());
latestActServiceRelationService.insertBatch(serviceList);
}
//保存活动与单位关系 //保存活动与单位关系
latestActUnitRelationService.deleteByAct(actDraftId); latestActUnitRelationService.deleteByAct(actDraftId);
AtomicInteger j = new AtomicInteger(NumConstant.ONE); if (CollectionUtils.isNotEmpty(formDTO.getServiceMatterList())) {
List<LatestActUnitRelationEntity> unitList = formDTO.getUnitIdList().stream().map(unitId -> { AtomicInteger j = new AtomicInteger(NumConstant.ONE);
LatestActUnitRelationEntity entity = new LatestActUnitRelationEntity(); List<LatestActUnitRelationEntity> unitList = formDTO.getUnitIdList().stream().map(unitId -> {
entity.setCustomerId(formDTO.getCustomerId()); LatestActUnitRelationEntity entity = new LatestActUnitRelationEntity();
entity.setActId(actDraftId); entity.setCustomerId(formDTO.getCustomerId());
entity.setUnitId(unitId); entity.setActId(actDraftId);
entity.setSort(j.getAndIncrement()); entity.setUnitId(unitId);
return entity; entity.setSort(j.getAndIncrement());
}).collect(Collectors.toList()); return entity;
latestActUnitRelationService.insertBatch(unitList); }).collect(Collectors.toList());
latestActUnitRelationService.insertBatch(unitList);
}
return resultDTO; return resultDTO;
} }

Loading…
Cancel
Save