package com.ruoyi.clock.domain.vo;

import cn.hutool.core.util.ObjectUtil;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import com.ruoyi.clock.service.IAgentService;
import com.ruoyi.common.annotation.ExcelDictFormat;
import com.ruoyi.common.convert.ExcelDictConvert;
import com.ruoyi.common.core.domain.entity.SysDept;
import com.ruoyi.common.utils.spring.SpringUtils;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;


/**
 * 门店信息视图对象 tb_shop
 *
 * @author pengc
 * @date 2026-03-04
 */
@Data
@ApiModel("门店信息视图对象")
@ExcelIgnoreUnannotated
public class ShopVo {

    private static final long serialVersionUID = 1L;

    /**
     * 店铺id
     */
    @ApiModelProperty("店铺id")
    private Long shopId;

    /**
     * 代理商id
     */
    @ApiModelProperty("代理商id")
    private Long agentId;

    /**
     * 店铺名称
     */
    @ExcelProperty(value = "店铺名称")
    @ApiModelProperty("店铺名称")
    private String shopName;

    @ApiModelProperty("所属代理商")
    @ExcelProperty(value = "所属代理商")
    private String agentName;

    /**
     * 地址
     */
    @ExcelProperty(value = "地址")
    @ApiModelProperty("地址")
    private String address;

    /**
     * 联系人
     */
    @ExcelProperty(value = "联系人")
    @ApiModelProperty("联系人")
    private String contact;

    /**
     * 联系电话
     */
    @ExcelProperty(value = "联系电话")
    @ApiModelProperty("联系电话")
    private String phonenumber;

    @ApiModelProperty("代理商信息")
    private AgentVo agent;

    public AgentVo loadAgentVo(){
        if (ObjectUtil.isNotNull(this.agentId)){
            IAgentService agentService = SpringUtils.getBean("agentServiceImpl", IAgentService.class);
            this.agent = agentService.queryById(this.agentId);
            if (ObjectUtil.isNotNull(this.agent)){
                this.agentName = agent.getAgentName();
            }
        }
        return this.agent;
    }
}
