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 14:30:30
 */
public class GroupChatDetailReq extends ChatBaseReq implements Serializable {
    private static final long serialVersionUID = -7059200818173428309L;

    /**
     * 门店模糊
     */
    private String vagueQueryStore;

    /**
     * 导购名称/code
     */
    private String vagueQueryClerk;

    /**
     * 成员模糊
     */
    private String vagueQueryStaff;

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

    /**
     * 获取排序
     * * *
     * @return
     */
    public Integer getDataApiOrderField() {
        Map<String, Integer> map = new HashMap<>(8);
        map.put("groupCustNum", 1);
        map.put("newGroupCustNum", 2);
        map.put("actGroupCustNum", 3);
        map.put("newExitGroupCustNum", 4);
        map.put("groupSessionsNum", 5);
        return map.get(getOrderByFields()) == null ? 1 : map.get(getOrderByFields());
    }

    /**
     * 处理请求参数
     * * *
     * @param jsonObject
     */
    public void dealWithParam(JSONObject jsonObject) {
        if (jsonObject == null) {
            jsonObject = new JSONObject();
        }
        if (getOrderByFields() != null) {
            jsonObject.put("orderByFields", getDataApiOrderField());
        }
        if (StringUtils.isNotBlank(vagueQueryClerk)) {
            jsonObject.put("vagueQueryClerk", vagueQueryClerk);
        }
        if (StringUtils.isNotBlank(vagueQueryStore)) {
            jsonObject.put("vagueQueryStore", vagueQueryStore);
        }
        if (StringUtils.isNotBlank(vagueQueryStaff)) {
            jsonObject.put("vagueQueryStaff", vagueQueryStaff);
        }
    }

    public String getVagueQueryStore() {
        return vagueQueryStore;
    }

    public void setVagueQueryStore(String vagueQueryStore) {
        this.vagueQueryStore = vagueQueryStore;
    }

    public String getVagueQueryClerk() {
        return vagueQueryClerk;
    }

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

    public String getVagueQueryStaff() {
        return vagueQueryStaff;
    }

    public void setVagueQueryStaff(String vagueQueryStaff) {
        this.vagueQueryStaff = vagueQueryStaff;
    }

    public String getRequestProject() {
        return requestProject;
    }

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