package com.gic.haoban.manage.web.qo.chat;

import com.alibaba.fastjson.JSONObject;
import org.apache.commons.lang3.StringUtils;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;

/**
 * @author shangfeng
 * @date 2024-06-20 16:02:41
 */
public class GroupChatChatDetailReq implements Serializable {

    private static final long serialVersionUID = -6843739232435242253L;


    /**
     * yyyy-MM-dd
     */
    private String startDate;

    /**
     * yyyy-MM-dd
     */
    private String endDate;

    /**
     * 导购模糊查询
     */
    private String vagueQueryClerk;

    /**
     * 用户模糊查询
     */
    private String vagueQueryUser;

    /**
     * 用户身份
     */
    private String userType;

    /**
     * 消息类型
     * 1文本2图片3视频4小程序5链接6gif表情7红包8文件9位置10名片11视频电话12语音电话
     */
    private String msgType;

    /**
     * 排序类型 1 正序  2 倒序
     */
    private Integer orderByType;

    /**
     * 排序字段名称
     */
    private String orderByFields;

    private Integer pageNum;

    private Integer pageSize;


    /**
     * 下载导出参数：数据脱敏 1:脱敏 2:完整
     */
    private Integer dataType = 1;

    /**
     * 下载导出参数：为了兼容前端传参
     */
    private String requestProject;

    /**
     * 群名称、id
     */
    private String groupSearchParams ;


    private String content ;

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public String getGroupSearchParams() {
        return groupSearchParams;
    }

    public void setGroupSearchParams(String groupSearchParams) {
        this.groupSearchParams = groupSearchParams;
    }

    public Integer getDataApiOrderField() {
        Map<String, Integer> map = new HashMap<>(4);
        map.put("joinTime", 1);
        return map.get(orderByFields) == null ? 1 : map.get(orderByFields);
    }

    public void dealWithParam(JSONObject jsonObject) {
        if (jsonObject == null) {
            jsonObject = new JSONObject();
        }
        if (StringUtils.isNotBlank(startDate)) {
            jsonObject.put("startDate", startDate);
        }
        if (StringUtils.isNotBlank(endDate)) {
            jsonObject.put("endDate", endDate);
        }
        if (orderByType != null) {
            jsonObject.put("orderByType", orderByType);
        }
        if (msgType != null) {
            jsonObject.put("msgType", msgType);
        }
        if (orderByFields != null) {
            jsonObject.put("orderByFields", getDataApiOrderField());
        }
        jsonObject.put("pageNum", pageNum);
        jsonObject.put("pageSize", pageSize);
        if (StringUtils.isNotBlank(vagueQueryClerk)) {
            jsonObject.put("vagueQueryClerk", vagueQueryClerk);
        }
        if (StringUtils.isNotBlank(vagueQueryUser)) {
            jsonObject.put("vagueQueryUser", vagueQueryUser);
            jsonObject.put("phoneNum", vagueQueryUser);
        }
        if (StringUtils.isNotBlank(userType)) {
            jsonObject.put("userType", userType);
        }
        if(StringUtils.isNotBlank(groupSearchParams)) {
            jsonObject.put("groupSearchParams",groupSearchParams) ;
        }
        if(StringUtils.isNotBlank(content)) {
            jsonObject.put("content",content) ;
        }
    }


    public String getStartDate() {
        return startDate;
    }

    public void setStartDate(String startDate) {
        this.startDate = startDate;
    }

    public String getEndDate() {
        return endDate;
    }

    public void setEndDate(String endDate) {
        this.endDate = endDate;
    }

    public String getVagueQueryClerk() {
        return vagueQueryClerk;
    }

    public void setVagueQueryClerk(String vagueQueryClerk) {
        this.vagueQueryClerk = vagueQueryClerk;
    }

    public String getVagueQueryUser() {
        return vagueQueryUser;
    }

    public void setVagueQueryUser(String vagueQueryUser) {
        this.vagueQueryUser = vagueQueryUser;
    }

    public String getUserType() {
        return userType;
    }

    public void setUserType(String userType) {
        this.userType = userType;
    }

    public Integer getOrderByType() {
        return orderByType;
    }

    public void setOrderByType(Integer orderByType) {
        this.orderByType = orderByType;
    }

    public String getOrderByFields() {
        return orderByFields;
    }

    public void setOrderByFields(String orderByFields) {
        this.orderByFields = orderByFields;
    }

    public Integer getPageNum() {
        return pageNum;
    }

    public void setPageNum(Integer pageNum) {
        this.pageNum = pageNum;
    }

    public Integer getPageSize() {
        return pageSize;
    }

    public void setPageSize(Integer pageSize) {
        this.pageSize = pageSize;
    }

    public Integer getDataType() {
        return dataType;
    }

    public void setDataType(Integer dataType) {
        this.dataType = dataType;
    }

    public String getMsgType() {
        return msgType;
    }

    public void setMsgType(String msgType) {
        this.msgType = msgType;
    }

    public String getRequestProject() {
        return requestProject;
    }

    public void setRequestProject(String requestProject) {
        this.requestProject = requestProject;
    }
}
