package com.supServer.project.service.impl;

import cn.hutool.core.util.ObjectUtil;
import com.supServer.framework.web.domain.AjaxResult;
import com.supServer.project.entity.BizCompanyInfo;
import com.supServer.project.entity.dto.CompanyAuthenticationDto;
import com.supServer.project.entity.vo.AttestationVo;
import com.supServer.project.mapper.BizCompanyInfoMapper;
import com.supServer.project.service.BizCompanyInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import static com.supServer.common.utils.SecurityUtils.getLoginUser;

@Service
public class BizCompanyInfoServiceImpl implements BizCompanyInfoService {

    @Autowired
    private BizCompanyInfoMapper bizCompanyInfoMapper;

    @Override
    public int insertCompany(BizCompanyInfo companyInfo) {
        return bizCompanyInfoMapper.insertCompany(companyInfo);
    }

    @Override
    public AjaxResult information(String phone) {
        CompanyAuthenticationDto dto=bizCompanyInfoMapper.information(phone);
        if(ObjectUtil.isNotEmpty(dto)){

        }
        return null;
    }

    @Override
    public Integer selectBycode(String creditCode) {
        return bizCompanyInfoMapper.selectBycode(creditCode);
    }

    @Override
    public BizCompanyInfo selectCompanyInfo(String creditCode) {
        return bizCompanyInfoMapper.selectCompanyInfo(creditCode);
    }

    @Override
    public int updateCompany(BizCompanyInfo bizcompanyInfoId) {
        return bizCompanyInfoMapper.updateCompany(bizcompanyInfoId);
    }

    /**
     * 认证管理信息
     * @return
     */
    @Override
    public AjaxResult seleceById() {
        String userId = getLoginUser().getUserId();
        AttestationVo vo=bizCompanyInfoMapper.seleceById(userId);
        return AjaxResult.success("操作成功", vo);
    }
}
