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
*/
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.LatestActUnitRelationEntity;
import com.epmet.service.*;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@ -133,29 +134,32 @@ public class WorkActDraftServiceImpl implements WorkActDraftService {
//保存活动与服务关系
latestActServiceRelationService.deleteByAct(actDraftId);
AtomicInteger i = new AtomicInteger(NumConstant.ONE);
List<LatestActServiceRelationEntity> 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);
if (CollectionUtils.isNotEmpty(formDTO.getServiceMatterList())) {
AtomicInteger i = new AtomicInteger(NumConstant.ONE);
List<LatestActServiceRelationEntity> 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<LatestActUnitRelationEntity> 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);
if (CollectionUtils.isNotEmpty(formDTO.getServiceMatterList())) {
AtomicInteger j = new AtomicInteger(NumConstant.ONE);
List<LatestActUnitRelationEntity> 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;
}

Loading…
Cancel
Save