package com.gic.haoban.manage.service.service.out.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.gic.api.base.commons.ServiceResponse;
import com.gic.haoban.manage.api.dto.StaffActiveDataDTO;
import com.gic.haoban.manage.api.service.WxEnterpriseActiveDataApiService;
import com.gic.haoban.manage.service.service.WxEnterpriseActiveDataService;

import cn.hutool.core.util.ObjectUtil;

/**
 * @description:
 * @Author: wenhua
 * @Date: 2023/2/2 10:21
 */
@Service("wxEnterpriseActiveDataApiService")
public class WxEnterpriseActiveDataApiServiceImpl implements WxEnterpriseActiveDataApiService {
    @Autowired
    private WxEnterpriseActiveDataService wxEnterpriseActiveDataService;

    @Override
    public ServiceResponse<Integer> saveOrUpdate(String wxEnterpriseId) {
        return ServiceResponse.success(wxEnterpriseActiveDataService.saveOrUpdate(wxEnterpriseId));
    }

    @Override
    public ServiceResponse<StaffActiveDataDTO> getWxEnterpriseActiveDataByWxEnterpriseId(String wxEnterpriseId) {
        StaffActiveDataDTO staffActiveDataDTO= wxEnterpriseActiveDataService.getWxEnterpriseActiveDataByWxEnterpriseId(wxEnterpriseId);
        if (ObjectUtil.isNotNull(staffActiveDataDTO)) {
            return ServiceResponse.success(staffActiveDataDTO);
        } else {
            StaffActiveDataDTO dto = new StaffActiveDataDTO() ;
            return ServiceResponse.success(dto) ;
        }
    }
}
