|
@ -0,0 +1,84 @@
|
|
|
package com.yihu.wlyy.statistics.controller;
|
|
|
|
|
|
import com.yihu.wlyy.statistics.service.ExtractDataService;
|
|
|
import com.yihu.wlyy.statistics.vo.SaveModel;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import io.swagger.annotations.ApiParam;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestMethod;
|
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
/**
|
|
|
* Created by chenweida on 2017/10/16.
|
|
|
*/
|
|
|
|
|
|
@RestController
|
|
|
@RequestMapping("/extractData")
|
|
|
@Api(description = "抽取mysql数据到es")
|
|
|
public class ExtractDataController extends BaseController {
|
|
|
@Autowired
|
|
|
private ExtractDataService extractDataService;
|
|
|
|
|
|
|
|
|
@ApiOperation(value = "从mysql抽取某一天的全部指标数据到ES")
|
|
|
@RequestMapping(value = "/extractOneDate", method = RequestMethod.POST)
|
|
|
public String extractOneDate(
|
|
|
@ApiParam(name = "date", value = "时间(yyyy-MM-dd)", required = true) @RequestParam(value = "date", required = true) String date) {
|
|
|
try {
|
|
|
extractDataService.extractOneDate(date);
|
|
|
return success("启动成功!");
|
|
|
} catch (Exception e) {
|
|
|
error(e);
|
|
|
return invalidUserException(e, -1, "启动失败:" + e.getMessage());
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "从mysql抽取某一天的某一个指标数据到ES")
|
|
|
@RequestMapping(value = "/extractOneDateWithId", method = RequestMethod.POST)
|
|
|
public String extractOneDateWithId(
|
|
|
@ApiParam(name = "date", value = "时间(yyyy-MM-dd)", required = true) @RequestParam(value = "date", required = true) String date,
|
|
|
@ApiParam(name = "quotaId", value = "指标ID", required = true) @RequestParam(value = "quotaId", required = true) String quotaId) {
|
|
|
try {
|
|
|
|
|
|
extractDataService.extractOneDateWithId(date,quotaId);
|
|
|
return success("启动成功!");
|
|
|
} catch (Exception e) {
|
|
|
error(e);
|
|
|
return invalidUserException(e, -1, "启动失败:" + e.getMessage());
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "从mysql抽取某一天到某一天的全部指标数据到ES")
|
|
|
@RequestMapping(value = "/extractDate2Date", method = RequestMethod.POST)
|
|
|
public String extractDate2Date(
|
|
|
@ApiParam(name = "startDate", value = "开始时间包含头(yyyy-MM-dd)", required = true) @RequestParam(value = "startDate", required = true) String startDate,
|
|
|
@ApiParam(name = "endDate", value = "结束时间包含尾(yyyy-MM-dd)", required = true) @RequestParam(value = "endDate", required = true) String endDate) {
|
|
|
try {
|
|
|
|
|
|
extractDataService.extractDate2Date(startDate,endDate);
|
|
|
return success("启动成功!");
|
|
|
} catch (Exception e) {
|
|
|
error(e);
|
|
|
return invalidUserException(e, -1, "启动失败:" + e.getMessage());
|
|
|
}
|
|
|
}
|
|
|
@ApiOperation(value = "从mysql抽取某一天到某一天的某一个指标数据到ES")
|
|
|
@RequestMapping(value = "/extractDate2DateWithId", method = RequestMethod.POST)
|
|
|
public String extractDate2DateWithId(
|
|
|
@ApiParam(name = "startDate", value = "开始时间包含头(yyyy-MM-dd)", required = true) @RequestParam(value = "startDate", required = true) String startDate,
|
|
|
@ApiParam(name = "endDate", value = "结束时间包含尾(yyyy-MM-dd)", required = true) @RequestParam(value = "endDate", required = true) String endDate,
|
|
|
@ApiParam(name = "quotaId", value = "指标ID", required = true) @RequestParam(value = "quotaId", required = true) String quotaId) {
|
|
|
try {
|
|
|
extractDataService.extractDate2DateWithId(startDate,endDate,quotaId);
|
|
|
return success("启动成功!");
|
|
|
} catch (Exception e) {
|
|
|
error(e);
|
|
|
return invalidUserException(e, -1, "启动失败:" + e.getMessage());
|
|
|
}
|
|
|
}
|
|
|
}
|