package com.gtiit.shr.controller;

import com.gtiit.shr.common.Result;
import com.gtiit.shr.service.SynOrgAndDeptService;
import java.text.SimpleDateFormat;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class ShrAdmPosPerController {
    @Autowired
    SynOrgAndDeptService synOrgAndDeptService;


    @GetMapping({"/admin"})
    public Result admin(@RequestParam String statrTime, @RequestParam String endTime) {
        Result result = new Result();

        try {
            result = this.synOrgAndDeptService.SynOrg(statrTime, endTime);
            return result;
        } catch (Exception var5) {
            result.setMessage("系统异常，请联系管理员分析日志:" + var5.getMessage());
            result.setCode(0);
            return result;
        }
    }

    @GetMapping({"/position"})
    public Result position(@RequestParam String statrTime, @RequestParam String endTime) {
        SimpleDateFormat dat = new SimpleDateFormat("yyyy-MM-dd");
        Result result = new Result();

        try {
            result = this.synOrgAndDeptService.SynPosition(dat.parse(statrTime), dat.parse(endTime));
            return result;
        } catch (Exception var6) {
            result.setMessage("系统异常，请联系管理员分析日志:" + var6.getMessage());
            result.setCode(0);
            return result;
        }
    }
}
