package com.cm.common.controller.app.apis.bigdatatemplate;


import com.cm.common.constants.ISystemConstant;
import com.cm.common.exception.SearchException;
import com.cm.common.result.ErrorResult;
import com.cm.common.result.SuccessResult;
import com.cm.common.service.bigdatatemplate.IBigdataTemplateService;
import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;
import java.util.Map;

/**
 * @ClassName: NewsAntistopAppController
 * @Description: 大数据模板
 * @Author: WenG
 * @Date: 2020-05-08 23:30
 * @Version: 1.0
 **/
@Api(tags = ISystemConstant.API_TAGS_APP_PREFIX + "大数据模板接口")
@RestController
@RequestMapping(ISystemConstant.APP_PREFIX + "/bigdatatemplate")
public class BigdataTemplateAppController {

    @Autowired
    private IBigdataTemplateService bigdataTemplateService;

    @ApiOperation(value = "大数据模板编码批量生成", notes = "大数据模板编码批量生成")
    @ApiImplicitParams({
    })
    @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
    @GetMapping("buiderbigdatatemplateall"+ISystemConstant.APP_RELEASE_SUFFIX)
    public SuccessResult buiderBigdataTemplateAll() throws Exception {
        return bigdataTemplateService.buiderBigdataTemplateAll();
    }

    @ApiOperation(value = "大数据模板编码生成", notes = "大数据模板编码生成")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "bigdataTemplateCode", value = "大数据模板编码", paramType = "path")
    })
    @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
    @GetMapping("buiderbigdatatemplate"+ISystemConstant.APP_RELEASE_SUFFIX+"/{bigdataTemplateCode}")
    public SuccessResult buiderBigdataTemplateByBigdataTemplateId(@PathVariable("bigdataTemplateCode") String bigdataTemplateCode) throws Exception {
        return bigdataTemplateService.buiderBigdataTemplateByBigdataTemplateCode(bigdataTemplateCode);
    }

    @ApiOperation(value = "大数据模板编码生成", notes = "大数据模板编码生成")
    @ApiImplicitParams({
    })
    @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
    @GetMapping("getdata"+ISystemConstant.APP_RELEASE_SUFFIX)
    @ResponseBody
    public Map<String, Object> getData() throws Exception {
        Map<String, Object> map = new HashMap<String, Object>();
        map.put("state", 200);
        map.put("msg", "查询成功");
        Integer[] list = {590,932,901,934,1290,1330,1320};
        map.put("list", list);
        return map;
    }

}
