package com.securitycontrol.background.controller;

import com.securitycontrol.background.service.DutyPlanService;
import com.securitycontrol.background.service.TeamService;
import com.securitycontrol.common.core.web.controller.BaseController;
import com.securitycontrol.common.core.web.domain.AjaxResult;
import com.securitycontrol.common.core.web.page.TableDataInfo;
import com.securitycontrol.common.log.annotation.Log;
import com.securitycontrol.common.log.enums.OperationType;
import com.securitycontrol.entity.background.dto.ParamDto;
import com.securitycontrol.entity.background.vo.DutyPlanVo;
import com.securitycontrol.entity.background.vo.TeamManageVo;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;

/**
 * 值班计划管理
 *
 * @author jsk
 */
@RequestMapping(value = "/back/dutyPlan/")
@RestController
public class DutyPlanController extends BaseController {

    @Resource(name = "DutyPlanService")
    private DutyPlanService service;

    @ApiOperation(value = "获取时间列表")
    @GetMapping("getTimeLists")
    @Log(title = "值班计划管理", menu = "风险值班管理->值班计划管理", grade = OperationType.QUERY_BUSINESS, details = "查询时间列表", type = "业务日志")
    public Map<String, Object> getTeamLists() {
        Map<String, Object> map =new HashMap<>();
        map = service.getTimeLists();
        return map;
    }

    @ApiOperation(value = "编辑值班计划")
    @PostMapping("addOrUpdateDutyPlan")
    @Log(title = "值班计划管理", menu = "风险值班管理->班组管理", grade = OperationType.ADD_BUSINESS, details = "新增修改值班计划", type = "业务日志")
    public AjaxResult addDutyPlan(@RequestBody DutyPlanVo vo) {
        return service.addOrUpdateDutyPlan(vo);
    }



    @ApiOperation(value = "获取值班列表")
    @GetMapping("getDutyPlanLists")
    @Log(title = "值班计划管理", menu = "风险值班管理->值班计划管理", grade = OperationType.QUERY_BUSINESS, details = "查询值班计划", type = "业务日志")
    public AjaxResult  getDutyPlanLists(DutyPlanVo vo) {
        List<DutyPlanVo> list = service.getDutyPlan(vo);
        return    AjaxResult.success(list);

    }
}
