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 491ed210f8..011a57519f 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 @@ -43,7 +43,7 @@ public class LatestActInfoEntity extends BaseEpmetEntity { * 客户id */ private String customerId; - + private String gridId; /** * 活动标题 */ 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 a5fb199d5a..99fda3fbcf 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 @@ -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 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 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); + if (CollectionUtils.isNotEmpty(formDTO.getServiceMatterList())) { + 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; }