package com.lutao.cloud.collect.controller;


import com.lutao.cloud.collect.dto.DataAddDTO;
import com.lutao.cloud.collect.service.CollectDataService;
import com.lutao.cloud.common.core.util.MessageInfo;
import com.lutao.cloud.common.security.annotation.Inner;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;

/**
 * 数据同步
 *
 * @author guoyc
 * @date 2019-06-18 17:18:42
 */
//@Api(value = "/sync", tags = {"同步数据"})
@RestController
@AllArgsConstructor
@RequestMapping
@Slf4j
public class DataCollectController {

    private final CollectDataService collectDataService;

    /**
     * 测试内容
     * @param
     * @return
     */
    @ApiOperation(value = "批量同步业务数据接口(根据指令进行数据的增删改操作)", notes = "批量同步业务数据接口(根据指令进行数据的增删改操作)", httpMethod = "POST")
    @PostMapping("/sync")
    @Inner(value = false)
    public MessageInfo sync(@Valid @RequestBody DataAddDTO addDTO, HttpServletRequest request) {
        return collectDataService.collectStaticDataSync(addDTO,request);
    }



    /**
     * 实时业务数据同接口，批量数据条数暂定200条
     * @param
     * @return
     */
    @ApiOperation(value = "实时业务数据同接口，批量数据条数暂定200条", notes = "实时业务数据同接口，批量数据条数暂定200条", httpMethod = "POST")
    @PostMapping("/batch")
    @Inner(value = false)
    public MessageInfo batch(@Valid @RequestBody DataAddDTO addDTO,HttpServletRequest request) {
        return collectDataService.collectDynamicBatch(addDTO,request);
    }


    /**
     * 测试内容
     * @param
     * @return
     */
//    //@ApiOperation(value = "测试内容", notes = "测试内容", httpMethod = "POST")
//    @PostMapping("/upload")
////    @Inner(value = false)
//    public MessageInfo upload(@Valid @RequestBody DataAddDTO addDTO,HttpServletRequest request) {
//        return collectDataService.collectBase64Upload(addDTO,request);
//    }
//
//    /**
//     * 测试内容
//     * @param
//     * @return
//     */
//    @ApiOperation(value = "测试内容", notes = "测试内容", httpMethod = "POST")
//
//    @PostMapping("/list")
//    @Inner(value = false)
//    public MessageInfo list(@Valid @RequestBody DataAddDTO addDTO,HttpServletRequest request) {
//        return collectDataService.collectDataFindList(addDTO,request);
//    }





}
