实体
package com.wanshun.carlifeservice.cardatamodel.po.carlifechannel;
import lombok.Data;
import lombok.ToString;
import java.util.Date;
@Data
@ToString
public class CarLifeChannel {
private long id;
private long code;
private int platform;
/**
* 业务类型:0车辆服务,1生活服务,2其他服务,适用于渠道配置
*/
private Integer businessType;
private int putawayPosition;
private String cityIdList;
private String name;
private String channelInfo;
private int encryptType;
private String secretKey;
private int otherParameter;
private int needLatLon;
private String iconUrl;
private int jumpType;
/**
* sdk来源:1快电
*/
private Integer sdkResource;
private String jumpUrl;
private int status;
private String remark;
/**
* 用户代理,用于手机端webView做的配置
*/
private String userAgent;
/**
* H5和app交互用的名字
*/
private String exposeName;
private long createUserId;
private String createUserName;
private long lastOperatorId;
private String lastOperator;
private Date createTime;
private Date updateTime;
}
求差集
/**
* 渠道icon 部分降级策略
*
* @param type
* @param launchType
* @param limit
* @param cityCarLifeChannelList 已经查询到的全国的数据
* @return
*/
@SuppressWarnings("all")
public List<CarLifeChannel> channelInfoPartitionFallback(Integer type, Integer launchType, Integer limit, List<CarLifeChannel> cityCarLifeChannelList) {
// 获取全国的数据
List<CarLifeChannel> allChannelList = this.channelAllCityInfoFallback(type, launchType, limit);
List<CarLifeChannel> backCityCarLifeChannelList = cityCarLifeChannelList;
// 差集
List<CarLifeChannel> finalCityCarLifeChannelList = cityCarLifeChannelList;
List<CarLifeChannel> distinctByUniqueList = allChannelList.stream()
.filter(item -> !finalCityCarLifeChannelList.stream()
.map(e -> e.getPutawayPosition())
.collect(Collectors.toList())
.contains(item.getPutawayPosition()))
.collect(Collectors.toList());
backCityCarLifeChannelList.addAll(distinctByUniqueList);
backCityCarLifeChannelList = backCityCarLifeChannelList
.stream()
.sorted(Comparator.comparingInt(CarLifeChannel::getPutawayPosition))
.collect(Collectors.toList());
return backCityCarLifeChannelList;
}