package cn.cecep.talroad.controller.effective;

/**
 * @author zhangshiji
 * @date 2022/9/15
 */
/*@Api(tags = "目标管理")
@RestController
@RequestMapping(value = "target")*/
public class BasTargetController {

   /* @Autowired
    private BasTargetService basTargetService;

    @ApiOperation(value = "计算月目标值")
    @ApiOperationSupport(author = "zsj")
    @PostMapping(value = "makeUpTarget")
    public boolean makeUpTarget(
            @RequestBody BasTargetDto basTargetDto,
            String userRegionCode

    ) {
        return basTargetService.saveAllTarget(basTargetDto, userRegionCode);
    }


    @GetMapping("/findReachabilityAnalysis")
    @ApiOperation(value = "可达性分析—可达性分析数据查询")
    @ApiOperationSupport(author = "何云龙")
    public List<QEnvgasAreaTargetVo> findReachabilityAnalysis(String userRegionCode, ReachabilityDto reachabilityDto) {
        reachabilityDto.setUserRegionCode(userRegionCode);
        if(userRegionCode==null){
            reachabilityDto.setUserRegionCode(SecurityUtils.getLoginUser().getSysUser().getRegionCode());
        }

        return basTargetService.findReachabilityAnalysis(reachabilityDto);
    }


    @GetMapping("/findStandardMonitoring")
    @ApiOperation(value = "达标监控—达标监控数据查询")
    @ApiOperationSupport(author = "何云龙")
    @ApiImplicitParams(value = {
            @ApiImplicitParam(name = "type", value = "1日 2 本月累计 3 本年累计 ", dataType = "String")
    })
    public List<QEnvgasAreaTargetVo> findStandardMonitoring(String userRegionCode, String type) {
        Assert.notNull(type, "type参数为空");
        Assert.notNull(userRegionCode, "userRegionCode参数为空");
        return basTargetService.findStandardMonitoring(userRegionCode, type);
    }


    @ApiOperation(value = "年/月目标值")
    @ApiOperationSupport(author = "zsj")
    @PostMapping(value = "targets")
    public Map<String, Object> targets(String userRegionCode) {
        return basTargetService.regionTarget(userRegionCode);
    }


    @ApiOperation(value = "秋冬防目标值")
    @ApiOperationSupport(author = "zsj")
    @PostMapping(value = "findAutumnTarget")
    public List<Map<String, Object>> findAutumnTarget(String userRegionCode) {
        return basTargetService.findAutumnWinterTarget(userRegionCode);
    }


    @ApiOperation(value = "计算秋冬防目标值")
    @ApiOperationSupport(author = "zsj")
    @PostMapping(value = "calcAutumnTarget")
    public R calcAutumnTarget(@RequestBody BasTargetDto basTargetDto) {
        R r = new R();
        try {
            basTargetService.calcWinterTarget(basTargetDto.getUserRegionCode(), basTargetDto);
            r.setCode(200);
            r.setMsg("计算成功");
        } catch (Exception e) {
            r.setCode(500);
            r.setMsg(e.getMessage());
        }
        return r;
    }*/

}
