package com.cyksj.model.views;

import com.baomidou.mybatisplus.annotation.TableField;
import com.ejlchina.searcher.bean.DbField;
import com.ejlchina.searcher.bean.DbIgnore;
import com.ejlchina.searcher.bean.SearchBean;
import lombok.Getter;
import lombok.Setter;

import java.math.BigDecimal;

/**
 * 项目名: yhlxj2
 * 文件名: CorpKfServicerStatisticView
 * 创建者: JavaZou
 * 创建时间:2025/1/13 16:29
 */
@Getter
@Setter
@SearchBean(tables = "corp_kf_servicer_statistic cs",
		where = ":time:",
		groupBy = "open_kf_id,servicer_userid")
public class CorpKfServicerStatisticView {
	/**
	 * openkfid
	 */
	@DbField("cs.open_kf_id")
	private String openKfId;

	/**
	 * 客服人员 ID
	 */
	@DbField("cs.servicer_userid")
	private String servicerUserid;

	/**
	 * 账号
	 */
	@DbIgnore
	@TableField(exist = false)
	private String name;

	/**
	 * 企业成员名
	 */
	@DbIgnore
	@TableField(exist = false)
	private String followName;

	/**
	 * 接入人工会话数
	 */
	@DbField("sum(cs.session_cnt)")
	private Integer sessionCnt;

	/**
	 * 咨询客户数
	 */
	@DbField("sum(cs.customer_cnt)")
	private Integer customerCnt;

	/**
	 * 咨询消息总数
	 */
	@DbField("sum(cs.customer_msg_cnt)")
	private Integer customerMsgCnt;

	/**
	 * 人工回复率
	 */
	@DbField("TRUNCATE(sum(cs.reply_rate)/count(if(cs.session_cnt!=0,1,NULL)),2)")
	private BigDecimal replyRate;

	/**
	 * 平均首次响应时长（秒）
	 */
	@DbField("TRUNCATE(sum(cs.first_reply_average_sec)/count(if(cs.session_cnt!=0,1,NULL)),2)")
	private BigDecimal firstReplyAverageSec;

	/**
	 * 满意度评价发送数
	 */
	@DbField("sum(cs.satisfaction_investgate_cnt)")
	private Integer satisfactionInvestgateCnt;

	/**
	 * 满意度参评率
	 */
	@DbField("TRUNCATE(sum(cs.satisfaction_participation_rate)/count(1),2)")
	private BigDecimal satisfactionParticipationRate;

	/**
	 * 满意评价占比
	 */
	@DbField("sum(cs.satisfied_rate)")
	private BigDecimal satisfiedRate;

	/**
	 * 一般评价占比
	 */
	@DbField("sum(cs.middling_rate)")
	private BigDecimal middlingRate;

	/**
	 * 不满意评价占比
	 */
	@DbField("sum(cs.dissatisfied_rate)")
	private BigDecimal dissatisfiedRate;

	/**
	 * 被拒收消息的客户数
	 */
	@DbField("sum(cs.msg_rejected_customer_cnt)")
	private Integer msgRejectedCustomerCnt;
}
