package com.mosty.base.manager.remote;

import com.alibaba.fastjson.JSON;
import com.mosty.base.feign.service.MostyQwzxFeignService;
import com.mosty.base.model.dto.qwzx.TbQwJlDto;
import com.mosty.base.model.dto.qwzx.TbQwXfbbQueryByJlDto;
import com.mosty.base.model.dto.qwzx.TbQwXfbbVo;
import com.mosty.base.model.entity.qwzx.TbQwXfbb;
import com.mosty.common.base.domain.ResponseResult;
import com.mosty.common.base.exception.BusinessException;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * 勤务中心远程调用
 */
@Slf4j
@Service
@AllArgsConstructor
public class TbQwzxAdaptRemoteService {

    private final MostyQwzxFeignService mostyQwzxFeignService;

    // 查询部门的报备的数量
    public Integer getBbCount(String ssbmdm, String time) {
        ResponseResult<Integer> responseResult = mostyQwzxFeignService.getBbCount(ssbmdm, time);
        if (responseResult == null || !responseResult.isSuccess()) {
            log.error("查询部门的报备的数量 异常responseResult = {}", JSON.toJSONString(responseResult));
            throw new BusinessException("查询部门的报备的数量异常！");
        }
        return responseResult.getData();
    }
    // 查询查询部门时长、里程
    public Map<String, Integer> getScLc(String ssbmdm, String time) {
        ResponseResult<Map<String, Integer>> responseResult = mostyQwzxFeignService.getScLc(ssbmdm, time);
        if (responseResult == null || !responseResult.isSuccess()) {
            log.error("查询部门时长、里程 异常responseResult = {}", JSON.toJSONString(responseResult));
            throw new BusinessException("查询部门时长、里程！");
        }
        return responseResult.getData();
    }
}
