package com.tuoheng.admin.service.workorder;

import com.tuoheng.admin.request.workorder.DistributionWorkorderRequest;
import com.tuoheng.admin.request.workorder.QueryWorkOrderPageListRequest;
import com.tuoheng.admin.service.workorder.distribution.DistributionWorkorderService;
import com.tuoheng.admin.service.workorder.generate.GenerateWorkorderService;
import com.tuoheng.admin.service.workorder.query.QueryWorkOrderDetailsService;
import com.tuoheng.admin.service.workorder.query.QueryWorkOrderPageListService;
import com.tuoheng.common.core.utils.JsonResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 工单Service接口实现
 *
 * @author wanjing
 * @team tuoheng
 * @date 2022-12-07
 */
@Slf4j
@Service
public class WorkorderServiceImpl implements IWorkorderService {

    @Autowired
    private GenerateWorkorderService generateWorkorderService;

    @Autowired
    private QueryWorkOrderPageListService queryWorkOrderPageListService;

    @Autowired
    private QueryWorkOrderDetailsService queryWorkOrderDetailsService;

    @Autowired
    private DistributionWorkorderService distributionWorkorderService;

    @Override
    public JsonResult generate(List<String> idList) {
        return generateWorkorderService.generateByManual(idList);
    }

    /**
     * 查询工单分页列表
     *
     * @param request
     * @return
     */
    @Override
    public JsonResult getPageList(QueryWorkOrderPageListRequest request) {
        return queryWorkOrderPageListService.getPageList(request);
    }

    /**
     * 查询工单详情
     *
     * @param id
     * @return
     */
    @Override
    public JsonResult getDetails(String id) {
        return queryWorkOrderDetailsService.getDetails(id);
    }

    /**
     * 分配工单
     *
     * @param request
     * @return
     */
    @Override
    public JsonResult distribution(DistributionWorkorderRequest request) {
        return distributionWorkorderService.distribution(request);
    }
}
