开发DOE分析功能
This commit is contained in:
parent
35199327c4
commit
f1c70f4cb1
|
|
@ -1,9 +1,13 @@
|
|||
package com.ruoyi.dfm.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.utils.http.HttpUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
|
|
@ -11,6 +15,8 @@ import org.springframework.stereotype.Controller;
|
|||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Collections;
|
||||
|
||||
|
||||
/**
|
||||
* DOE分析控制器
|
||||
|
|
@ -23,9 +29,17 @@ public class DoeAnalysisController extends BaseController {
|
|||
|
||||
private static final Logger log = LoggerFactory.getLogger(DoeAnalysisController.class);
|
||||
|
||||
private static final String DATA_TYPE_KEY_PARAM = "keyParam";
|
||||
private static final String DATA_TYPE_REWORK = "rework";
|
||||
|
||||
private static final Integer SUCCESS_CODE = new Integer(20);
|
||||
|
||||
@Value("${api.doe.GetDataByKeyParam}")
|
||||
private String getDataByKeyParamUrl;
|
||||
|
||||
@Value("${api.doe.GetDataByRework}")
|
||||
private String getDataByReworkUrl;
|
||||
|
||||
/**
|
||||
* 获取分析页面
|
||||
*
|
||||
|
|
@ -45,12 +59,28 @@ public class DoeAnalysisController extends BaseController {
|
|||
@PostMapping("/list")
|
||||
@ResponseBody
|
||||
public TableDataInfo list(@RequestParam("productname") String productname, @RequestParam("version") String version, @RequestParam("dataType") String dataType) {
|
||||
String apiUrl = apiRootUrl + getDataByKeyParamUrl;
|
||||
String apiUrl = apiRootUrl;
|
||||
String param = "productname=" + productname +"&version=" + version;
|
||||
if(DATA_TYPE_KEY_PARAM.equals(dataType)) {
|
||||
apiUrl += getDataByKeyParamUrl;
|
||||
} else if(DATA_TYPE_REWORK.equals(dataType)) {
|
||||
apiUrl += getDataByReworkUrl;
|
||||
}
|
||||
log.info("request remote api, url={}, param={}", apiUrl, param);
|
||||
String result = HttpUtils.sendGet(apiUrl, param);
|
||||
log.info("response remote api, url={}, param={}, result={}", apiUrl, param, result);
|
||||
return getDataTable(null);
|
||||
if(StringUtils.isBlank(result)) {
|
||||
log.error("reponse result is null. url={}, param={}", apiUrl, param);
|
||||
return getDataTable(Collections.emptyList());
|
||||
}
|
||||
JSONObject resultObj = JSON.parseObject(result);
|
||||
if(null != resultObj && SUCCESS_CODE.equals(resultObj.getInteger("code"))) {
|
||||
JSONArray data = resultObj.getJSONArray("data");
|
||||
return getDataTable(data);
|
||||
} else {
|
||||
log.error("reponse result failed. url={}, param={}, result={}", apiUrl, param, result);
|
||||
}
|
||||
return getDataTable(Collections.emptyList());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -150,4 +150,7 @@ api:
|
|||
root:
|
||||
url: http://101.133.130.84:8210/
|
||||
doe:
|
||||
GetDataByKeyParam: api/DOEAnalysis/GetDataByKeyParam
|
||||
GetDataByKeyParam: api/DOEAnalysis/GetDataByKeyParam
|
||||
GetDataByRework: api/DOEAnalysis/GetDataByRework
|
||||
Calculate: api/DOEAnalysis/Calculate
|
||||
Save: api/DOEAnalysis/Save
|
||||
Loading…
Reference in New Issue