package com.huimv.video.dhicc.test.controller;

import com.dahuatech.icc.exception.ClientException;
import com.huimv.video.dhicc.test.config.OauthConfigBaseInfo;
import com.huimv.video.dhicc.test.config.OauthConfigBaseInfo02;
import com.huimv.video.dhicc.test.config.OauthConfigBaseInfo03;
import com.huimv.video.dhicc.test.request.PersonListRequestCn;
import com.huimv.video.dhicc.test.request.PersonListRequestHn;
import com.huimv.video.dhicc.test.request.PersonListRequestSg;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
@RequestMapping("personTest")
public class ClientPersonManageControllerTest {
    @Autowired
    private OauthConfigBaseInfo oauthConfigBaseInfo;
    @Autowired
    private OauthConfigBaseInfo02 oauthConfigBaseInfo02;
    @Autowired
    private OauthConfigBaseInfo03 oauthConfigBaseInfo03;


    @RequestMapping("/ge_person_list")
    public String ge_person_list(@RequestBody PersonListRequestSg personListRequestSg) throws ClientException {
        Integer farmId = personListRequestSg.getFarmId();
        if (farmId == 1) {
            System.out.println("曙光");
            PersonListRequestSg requestSg = new PersonListRequestSg(oauthConfigBaseInfo);
            requestSg.setDepartmentId(personListRequestSg.getDepartmentId());
            requestSg.setIsContain(personListRequestSg.getIsContain());
            requestSg.setPageNum(personListRequestSg.getPageNum());
            requestSg.setPageSize(personListRequestSg.getPageSize());
            requestSg.setSearchKey(personListRequestSg.getSearchKey());
            requestSg.setStatusList(personListRequestSg.getStatusList());
            String s = requestSg.doAction();
            return s;
        } else if (farmId == 2) {
            PersonListRequestHn requestHn = new PersonListRequestHn(oauthConfigBaseInfo02);
            requestHn.setDepartmentId(personListRequestSg.getDepartmentId());
            requestHn.setIsContain(personListRequestSg.getIsContain());
            requestHn.setPageNum(personListRequestSg.getPageNum());
            requestHn.setPageSize(personListRequestSg.getPageSize());
            requestHn.setSearchKey(personListRequestSg.getSearchKey());
            requestHn.setStatusList(personListRequestSg.getStatusList());
            String s = requestHn.doAction();
            System.out.println("海宁");
            return s;
        } else {
            PersonListRequestCn requestCn = new PersonListRequestCn(oauthConfigBaseInfo03);
            requestCn.setDepartmentId(personListRequestSg.getDepartmentId());
            requestCn.setIsContain(personListRequestSg.getIsContain());
            requestCn.setPageNum(personListRequestSg.getPageNum());
            requestCn.setPageSize(personListRequestSg.getPageSize());
            requestCn.setSearchKey(personListRequestSg.getSearchKey());
            requestCn.setStatusList(personListRequestSg.getStatusList());
            String s = requestCn.doAction();
            System.out.println("苍南");
            return s;
        }


    }
}
