| | |
| | | import com.yuanchu.mom.pojo.DataConfig; |
| | | import com.yuanchu.mom.pojo.Device; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.util.*; |
| | | import java.util.regex.Matcher; |
| | | import java.util.regex.Pattern; |
| | |
| | | * @return |
| | | */ |
| | | public static Map<String, String> dataAcquisitionEntrance(List<DataConfig> dataConfig, Device device, String entrustCode, String sampleCode, String ip) { |
| | | String http = HTTP + ip + GETFILE + "?filePath=" + device.getCollectUrl() + "&fileExtension=" + device.getFileType(); |
| | | String http = HTTP + ip + GETFILE + |
| | | "?filePath=" + device.getCollectUrl() + |
| | | "&fileExtension=" + device.getFileType() + |
| | | "&entrustCode=" + entrustCode + |
| | | "&sampleCode=" + sampleCode; |
| | | String result = null; |
| | | try { |
| | | result = HttpUtil.get(http); |
| | |
| | | private static Map<String, String> analysisDb(String data, Map<String, List<DataConfig>> dataConfig, String entrustCode, String sampleCode) { |
| | | JSONObject jsonObject = JSON.parseObject(data); |
| | | JSONArray dataList = JSONArray.parseArray(jsonObject.get("data").toString()); |
| | | JSONArray columnList = JSONArray.parseArray(jsonObject.get("column").toString()); |
| | | Map<String, String> map = new HashMap<>(); |
| | | dataConfig.forEach((k, v) -> { |
| | | List<Object> list = new ArrayList<>(); |
| | |
| | | private static Map<String, String> analysisMdb(String data, Map<String, List<DataConfig>> dataConfig, String entrustCode, String sampleCode) { |
| | | JSONObject jsonObject = JSON.parseObject(data); |
| | | JSONArray dataList = JSONArray.parseArray(jsonObject.get("data").toString()); |
| | | JSONArray columnList = JSONArray.parseArray(jsonObject.get("column").toString()); |
| | | Map<String, String> map = new HashMap<>(); |
| | | dataConfig.forEach((k, v) -> { |
| | | List<Object> list = new ArrayList<>(); |
| | |
| | | return value; |
| | | } |
| | | } |
| | | |
| | | public static String getIp(HttpServletRequest request) { |
| | | String ipAddress = request.getRemoteAddr(); |
| | | // 防止回环地址变为IPv6 |
| | | return ipAddress.equals("0:0:0:0:0:0:0:1") ? "127.0.0.1" : ipAddress; |
| | | } |
| | | } |