feat: 新增计算接口
This commit is contained in:
@@ -11,4 +11,16 @@ public interface DataToolApi {
|
|||||||
Call<NcHttpResponse<JsonObject>> refreshTask(
|
Call<NcHttpResponse<JsonObject>> refreshTask(
|
||||||
@Path(value = "task_id") String task_id
|
@Path(value = "task_id") String task_id
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@GET("/data/calculate")
|
||||||
|
Call<NcHttpResponse<String>> calculate(
|
||||||
|
@Query(value = "year") Integer year,
|
||||||
|
@Query(value = "month") Integer month
|
||||||
|
);
|
||||||
|
|
||||||
|
@GET("/data/collect")
|
||||||
|
Call<NcHttpResponse<String>> collect(
|
||||||
|
@Query(value = "year") Integer year,
|
||||||
|
@Query(value = "month") Integer month
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
@@ -25,5 +25,17 @@ public class DataToolService implements ApiService<DataToolApi> {
|
|||||||
var response = this.getResponse(call).body();
|
var response = this.getResponse(call).body();
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public NcHttpResponse<String> calculate (Integer year, Integer month) throws Exception {
|
||||||
|
var call = this.api.calculate(year, month);
|
||||||
|
var response = this.getResponse(call).body();
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
|
public NcHttpResponse<String> collect (Integer year, Integer month) throws Exception {
|
||||||
|
var call = this.api.collect(year, month);
|
||||||
|
var response = this.getResponse(call).body();
|
||||||
|
return response;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -6,6 +6,7 @@ import io.swagger.annotations.ApiOperation;
|
|||||||
import io.swagger.annotations.ApiParam;
|
import io.swagger.annotations.ApiParam;
|
||||||
import mjkf.xinke.auth.core.util.StpLoginUserUtil;
|
import mjkf.xinke.auth.core.util.StpLoginUserUtil;
|
||||||
import mjkf.xinke.common.annotation.CommonLog;
|
import mjkf.xinke.common.annotation.CommonLog;
|
||||||
|
import mjkf.xinke.main.common.api.DataToolService;
|
||||||
import mjkf.xinke.main.common.http.FuHttpResponse;
|
import mjkf.xinke.main.common.http.FuHttpResponse;
|
||||||
import mjkf.xinke.main.constant.HttpErrorResponseEnum;
|
import mjkf.xinke.main.constant.HttpErrorResponseEnum;
|
||||||
import mjkf.xinke.main.constant.PricePublishStatus;
|
import mjkf.xinke.main.constant.PricePublishStatus;
|
||||||
@@ -121,4 +122,17 @@ public class PricePublishController {
|
|||||||
return FuHttpResponse.Builder().dataResponse(result).build();
|
return FuHttpResponse.Builder().dataResponse(result).build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
DataToolService dataToolService;
|
||||||
|
|
||||||
|
@ApiOperation("计算发布数据")
|
||||||
|
@CommonLog("计算发布数据")
|
||||||
|
@GetMapping("/collect")
|
||||||
|
public HttpResponse collect(
|
||||||
|
@ApiParam("年份") @RequestParam("year") Integer year,
|
||||||
|
@ApiParam("月份") @RequestParam(value = "month") Integer month
|
||||||
|
) throws Exception {
|
||||||
|
var result = dataToolService.collect(year, month);
|
||||||
|
return FuHttpResponse.Builder().dataResponse(result).build();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -11,6 +11,7 @@ import lombok.Data;
|
|||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
import mjkf.xinke.common.annotation.CommonLog;
|
import mjkf.xinke.common.annotation.CommonLog;
|
||||||
|
import mjkf.xinke.main.common.api.DataToolService;
|
||||||
import mjkf.xinke.main.common.http.FuHttpResponse;
|
import mjkf.xinke.main.common.http.FuHttpResponse;
|
||||||
import mjkf.xinke.main.constant.HttpErrorResponseEnum;
|
import mjkf.xinke.main.constant.HttpErrorResponseEnum;
|
||||||
import mjkf.xinke.main.model.db.PriceResult;
|
import mjkf.xinke.main.model.db.PriceResult;
|
||||||
@@ -129,4 +130,18 @@ public class PriceResultController {
|
|||||||
|
|
||||||
return FuHttpResponse.Builder().dataResponse(result).build();
|
return FuHttpResponse.Builder().dataResponse(result).build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
DataToolService dataToolService;
|
||||||
|
|
||||||
|
@ApiOperation("计算趋势表数据")
|
||||||
|
@CommonLog("计算趋势表数据")
|
||||||
|
@GetMapping("/calculate")
|
||||||
|
public HttpResponse calculate(
|
||||||
|
@ApiParam("年份") @RequestParam("year") Integer year,
|
||||||
|
@ApiParam("月份") @RequestParam(value = "month") Integer month
|
||||||
|
) throws Exception {
|
||||||
|
var result = dataToolService.calculate(year, month);
|
||||||
|
return FuHttpResponse.Builder().dataResponse(result).build();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -19,7 +19,7 @@ main:
|
|||||||
|
|
||||||
api:
|
api:
|
||||||
host:
|
host:
|
||||||
data-tool: http://192.168.1.3:50000
|
data-tool: http://material_api:7072
|
||||||
|
|
||||||
path:
|
path:
|
||||||
predict-file-dir: /predict
|
predict-file-dir: /predict
|
Reference in New Issue
Block a user