package com.chushang.inspection.terminal.po;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.chushang.common.mybatis.base.BaseEntity;

import java.time.LocalDateTime;

import com.chushang.inspection.terminal.enums.MerTypeOperation;
import com.chushang.inspection.work.dto.WrkIcbcJsReceive;
import com.chushang.inspection.work.enums.BankBranchesEnum;
import com.chushang.inspection.work.po.WrkIcbcJs;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

/**
  * @auther: zhao
  * @date: 2024/6/21 16:39
  */
/**
 * 商户信息表
 */
@Data
@EqualsAndHashCode(callSuper=true)
@AllArgsConstructor
@NoArgsConstructor
@TableName(value = "st_store")
public class Store extends BaseEntity {
    /**
     * 主键
     */
    @TableId(value = "store_id", type = IdType.ASSIGN_ID)
    private Long storeId;

    /**
     * 任务id
     */
    @TableField(value = "task_id")
    private Long taskId;

    /**
     * 下级任务id
     */
    @TableField(value = "lower_task_id")
    private Long lowerTaskId;

    /**
     * 商户编号
     */
    @TableField(value = "store_no")
    private String storeNo;

    /**
     * 商户名称
     */
    @TableField(value = "store_name")
    private String storeName;

    /**
     * 商户联系人
     */
    @TableField(value = "store_contact")
    private String storeContact;

    /**
     * 商户联系电话
     */
    @TableField(value = "store_phone")
    private String storePhone;

    /**
     * 商户地址
     */
    @TableField(value = "store_address")
    private String storeAddress;

    /**
     * 商户特殊编号
     */
    @TableField(value = "special_num")
    private String specialNum;

    /**
     * 门店名称
     */
    @TableField(value = "shop_name")
    private String shopName;

    /**
     * 建档日期
     */
    @TableField(value = "register_time")
    private LocalDateTime registerTime;

    /**
     * 商户类型
     */
    @TableField(value = "store_type")
    private Integer storeType;

    /**
     * 现有其他收单产品
     */
    @TableField(value = "products")
    private String products;

    /**
     * 商户提示工具
     */
    @TableField(value = "tip_tool")
    private String tipTool;

    /**
     * 操作员编号
     */
    @TableField(value = "admin_id")
    private String adminId;

    /**
     * 巡检频次
     */
    @TableField(value = "ins_fre")
    private Integer insFre;

    /**
     * 客户经理
     */
    @TableField(value = "account_manager")
    private String accountManager;

    /**
     * 经理电话
     */
    @TableField(value = "account_phone")
    private String accountPhone;

    /**
     * 注册地址
     */
    @TableField(value = "register_address")
    private String registerAddress;

    /**
     * 租户id
     */
    @TableField(value = "dept_id")
    private Long deptId;

    /**
     * 法人/负责人
     */
    @TableField(value = "legal_name")
    private String legalName;

    /**
     * 是否为业务员录入（1是  2否）
     */
    @TableField(value = "is_enter")
    private Integer isEnter;
    /**
     * 商户状态
     */
    @TableField(value = "state")
    private Integer state;

    @TableField(value = "project_id")
    private Long projectId;

    public Store saveJcIcbc(WrkIcbcJsReceive dto) {
        this.storeNo = dto.getMerId();
        this.storeName = dto.getMerName();
        this.storeContact = dto.getLinkName();
        this.storePhone = dto.getContactWay();
        this.storeAddress = dto.getMerAddress();
        this.storeType = MerTypeOperation.valueOfCode(dto.getMerType());
        this.taskId = 1701151817643495425L;
        this.deptId = 218L;
        this.createBy = "zhuguihua";
        this.isEnter = 2;
        Long lowerTaskId = BankBranchesEnum.getByCode(dto.getArea());
        this.lowerTaskId = lowerTaskId == null ? this.taskId : lowerTaskId;
        this.projectId = BankBranchesEnum.getProjectByCode(dto.getArea());
        return this;
    }

    public Store saveJcIcbc(WrkIcbcJs w) {
        this.storeNo = w.getMerId();
        this.storeName = w.getMerName();
        this.storeContact = w.getLinkName();
        this.storePhone = w.getContactWay();
        this.storeAddress = w.getMerAddress();
        this.storeType = MerTypeOperation.valueOfCode(w.getMerType());
        this.taskId = 1701151817643495425L;
        this.deptId = 218L;
        this.createBy = "zhuguihua";
        this.isEnter = 2;
        Long lowerTaskId = BankBranchesEnum.getByCode(w.getArea());
        this.lowerTaskId = lowerTaskId == null ? this.taskId : lowerTaskId;
        this.projectId = BankBranchesEnum.getProjectByCode(w.getArea());
        return this;
    }
}
