Commit 54e18aae by 杨卫

feat:1047852:运营去重

1 parent beb54bdf
...@@ -9,6 +9,7 @@ import javax.validation.constraints.NotBlank; ...@@ -9,6 +9,7 @@ import javax.validation.constraints.NotBlank;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Objects;
/** /**
* BI-事项管理响应对象 * BI-事项管理响应对象
...@@ -85,5 +86,18 @@ public class MerchantBiMatterDTO implements Serializable { ...@@ -85,5 +86,18 @@ public class MerchantBiMatterDTO implements Serializable {
*/ */
@NotBlank(message = "运营人员名称不能为空") @NotBlank(message = "运营人员名称不能为空")
private String username; private String username;
@Override
public boolean equals(Object o) {
if (this == o) {return true;}
if (o == null || getClass() != o.getClass()) {return false;}
OperatorDTO that = (OperatorDTO) o;
return Objects.equals(uuid, that.uuid);
}
@Override
public int hashCode() {
return Objects.hash(uuid);
}
} }
} }
...@@ -772,13 +772,14 @@ public class BiAnalyseBackgroundService { ...@@ -772,13 +772,14 @@ public class BiAnalyseBackgroundService {
request.setDirectorTypes(directorTypeEnums.stream().map(ele -> ObjectUtil.toString(ele.getValue())).collect(Collectors.toList())); request.setDirectorTypes(directorTypeEnums.stream().map(ele -> ObjectUtil.toString(ele.getValue())).collect(Collectors.toList()));
List<ShopMerchantDirectorConfig> directorConfigs = merchantBiMatterMapper.selectBiMerchantOperator(request); List<ShopMerchantDirectorConfig> directorConfigs = merchantBiMatterMapper.selectBiMerchantOperator(request);
Map<Byte, List<MerchantBiMatterDTO.OperatorDTO>> directorTypeMapOperator = directorConfigs.stream() Map<Byte, Set<MerchantBiMatterDTO.OperatorDTO>> directorTypeMapOperator = directorConfigs.stream()
.collect(Collectors.groupingBy(ShopMerchantDirectorConfig::getDirectorType, .collect(Collectors.groupingBy(ShopMerchantDirectorConfig::getDirectorType,
Collectors.mapping(ele -> MerchantBiMatterDTO.OperatorDTO.builder() Collectors.mapping(ele -> MerchantBiMatterDTO.OperatorDTO.builder()
.uuid(ele.getDirectorUserId()) .uuid(ele.getDirectorUserId())
.username(ele.getDirectorName()) .username(ele.getDirectorName())
.build(), .build(),
Collectors.toList()))); Collectors.toSet())));
// 处理区域运营和线上运营 // 处理区域运营和线上运营
MerchantOperatorDetailDTO result = new MerchantOperatorDetailDTO(); MerchantOperatorDetailDTO result = new MerchantOperatorDetailDTO();
...@@ -792,11 +793,24 @@ public class BiAnalyseBackgroundService { ...@@ -792,11 +793,24 @@ public class BiAnalyseBackgroundService {
Optional.ofNullable(directorTypeMapOperator.get(DirectorTypeEnum.AREA_SUPERVISION_1_1.getValue())) Optional.ofNullable(directorTypeMapOperator.get(DirectorTypeEnum.AREA_SUPERVISION_1_1.getValue()))
.ifPresent(r -> result.getAreaOperator().addAll(r)); .ifPresent(r -> result.getAreaOperator().addAll(r));
// 无关联的线上运营或区域运营,则无法提交并toast:无可跟进的线上运营或区域运营,请确认后重新操作; // 无关联的线上运营或区域运营,则无法提交并toast:无可跟进的线上运营或区域运营,请确认后重新操作;
if (CollUtil.isEmpty(result.getOnlineOperator()) && CollUtil.isEmpty(result.getAreaOperator())) { if (CollUtil.isEmpty(result.getOnlineOperator()) && CollUtil.isEmpty(result.getAreaOperator())) {
throw new RpcServiceException(BiErrorEnum.NO_ONLINE_AREA_OPERATOR_ERROR); throw new RpcServiceException(BiErrorEnum.NO_ONLINE_AREA_OPERATOR_ERROR);
} }
// 去重
List<MerchantBiMatterDTO.OperatorDTO> onlineOperator = result.getOnlineOperator();
if (CollUtil.isNotEmpty(onlineOperator)) {
result.setOnlineOperator(onlineOperator.stream()
.distinct()
.collect(Collectors.toList()));
}
List<MerchantBiMatterDTO.OperatorDTO> areaOperator = result.getAreaOperator();
if (CollUtil.isNotEmpty(areaOperator)) {
result.setAreaOperator(areaOperator.stream().distinct().collect(Collectors.toList()));
}
return result; return result;
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!