package com.tzy.common.dto;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import lombok.Data;
import lombok.experimental.Accessors;
import org.apache.commons.lang3.StringUtils;
import org.springframework.util.CollectionUtils;

import java.io.Serializable;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

@Data
@Accessors(chain = true)
@JsonIgnoreProperties(ignoreUnknown = true)
public class GoodsQuery implements Serializable {
	/**排序用户id*/
	private Integer userId;
	/**调用卡密服务时,用户id条件参数*/
	private Integer userIdCond;
	private String userRole;
	private Long orderId;
	private Long groupInfoId;
	private List<Long> groupInfoIds;
	private Long teamId;
	private Integer selected;
	private Integer status;
	private List<Integer> statusList;
	private List<Long> ids;
	private List<Long> orderIds;
	/**id字符串逗号拼接集合*/
	private String idStr;
	private String team;
	private String playerName;
	private String setName;
	private String conference;
	private Integer lockStatus;
	/**预测队伍id,prop1*/
	private String guessTeamId;
	/**预测类型:team,set,player*/
	private String guessType;
	/**卡密分组*/
	private Integer copiesType;
	//查询字段差异,true为关联公示信息
	private boolean publicFlag=false;
	/**搜索关键词*/
	private String keyword;
	/**聚合查询字段,userId,orderId*/
	private String columnName;
	//每页数据条数
	private Integer pageSize;
	//页码数
	private Integer pageNo;
	//删除标志
	private Integer delFlag;
	/**父标志,暂时不用*/
	private Integer parentId;
	private Long paniniListId;
	/**运动集合*/
	private List<String> sportList;
	/**关联类型*/
	private String refType;
	/**卡密是否已经分配*/
	private Boolean soldFlag;
	protected String sortField;
	/**asc desc*/
	protected String sortType="DESC";

	private List<String> actTypeList;

	private Integer actStatus;

	private String orderIdStr;

	private boolean newDbGoods;

	private Integer playerId;

	private Integer paniniBaseId;

	public List<Long> getIds() {
		if (ids == null && StringUtils.isNotEmpty(idStr)) {
			return Arrays.stream(idStr.split(",")).map(Long::valueOf).collect(Collectors.toList());
		}
		return ids;
	}

	public List<Long> getOrderIds() {
		if (CollectionUtils.isEmpty(this.orderIds) && StringUtils.isNotEmpty(orderIdStr)) {
			return Arrays.stream(orderIdStr.split(",")).map(Long::valueOf).collect(Collectors.toList());
		}
		return orderIds;
	}
}