获取重量api接口测试1.2
This commit is contained in:
parent
6ae3fac4e9
commit
cfc2451fd2
|
|
@ -1,6 +1,8 @@
|
|||
package com.ruoyi.operation.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.ruoyi.basedata.domain.Truepound;
|
||||
import com.ruoyi.basedata.service.ITruepoundService;
|
||||
import com.ruoyi.common.core.domain.entity.SysDictData;
|
||||
import com.ruoyi.common.utils.DictUtils;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
|
|
@ -23,11 +25,18 @@ import java.math.BigDecimal;
|
|||
public class getPoundWeightData {
|
||||
@Autowired
|
||||
private ISysConfigService sysConfigService;
|
||||
@Autowired
|
||||
private ITruepoundService truepoundService;
|
||||
|
||||
@GetMapping(value = "/getWeight/{poundid}")
|
||||
public BigDecimal getPoundWeight(@PathVariable("poundid")String poundid) {
|
||||
Truepound truepound = truepoundService.selectTruepoundById(poundid);
|
||||
if(truepound==null){
|
||||
throw new RuntimeException("磅点id:"+poundid+"不存在对应的实际磅点不存在");
|
||||
}
|
||||
String usrcode = truepound.getUsrcode();
|
||||
//根据地磅编码,在系统参数中获取接口地址,调用接口返回数据。
|
||||
String pound_api = DictUtils.getDictLabel("pound_api", poundid);
|
||||
String pound_api = DictUtils.getDictLabel("pound_api", usrcode);
|
||||
if(StringUtils.isBlank(pound_api)){
|
||||
throw new RuntimeException("磅点api未维护!无法获取重量");
|
||||
}
|
||||
|
|
@ -55,8 +64,8 @@ public class getPoundWeightData {
|
|||
connection = (HttpURLConnection) url.openConnection();
|
||||
connection.setRequestMethod("GET");
|
||||
connection.setRequestProperty("Content-Type", "application/json; charset=utf-8");
|
||||
connection.setConnectTimeout(20000);
|
||||
connection.setReadTimeout(20000);
|
||||
connection.setConnectTimeout(10000);
|
||||
connection.setReadTimeout(10000);
|
||||
|
||||
int responseCode = connection.getResponseCode();
|
||||
if (responseCode == HttpURLConnection.HTTP_OK) {
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ import request from '@/utils/request'
|
|||
export function getWeight(poundid) {
|
||||
return request({
|
||||
url: '/util/getPound/getWeight/'+poundid,
|
||||
method: 'get'
|
||||
method: 'get',
|
||||
timeout: 3600000
|
||||
})
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue