Commit ad561ab9 authored by ysongq's avatar ysongq

commit

parent 1e9b3f69
......@@ -201,7 +201,7 @@ public final class WebUtils {
* @param data
* @return
*/
public static String postJSON(String uri, Object data) {
public static String postJSON(String uri, Object data) throws Exception{
log.info("向银行发起参数:{}", JSONObject.toJSONString(data));
CloseableHttpClient httpClient = getHttpClient(uri);
HttpPost method = new HttpPost(uri);
......@@ -240,6 +240,7 @@ public final class WebUtils {
log.info("Get Response Content():\n {}", readContent);
} catch (IOException e) {
e.printStackTrace();
throw e;
} finally {
try {
httpClient.close();
......
......@@ -85,13 +85,9 @@ public class DataGoodsController extends BaseController {
Result result = new Result();
try{
result = dataGoodsService.uploadApi(dataApiUpReq);
result.getMessage();
result.getCode();
result.getData();
}catch (Exception e) {
e.printStackTrace();
result.getMessage();
result.getCode();
result = new Result(false, "api上传失败");
}
return result;
}
......
......@@ -66,4 +66,7 @@ public class MakeDataBankApiReq implements Serializable {
@ApiModelProperty(value = "api样例",required = false)
public String apiExample;
@ApiModelProperty(value = "文件id")
public Long fileId;
}
......@@ -200,7 +200,7 @@ public class DataGoodsServiceImpl implements DataGoodsService {
*/
@Override
@Transactional(rollbackFor = Exception.class)
public Result uploadApi(DataApiUpReq dataApiUpReq) {
public Result uploadApi(DataApiUpReq dataApiUpReq) throws Exception {
// 获取当前用户
SysUserDto user = (SysUserDto) redisTemplate.opsForValue().get("user_" + RedisMessageConstant.SENDTYPE_LOGIN_SYS);
......@@ -259,6 +259,9 @@ public class DataGoodsServiceImpl implements DataGoodsService {
apiReq.setRequestParam("sdadasdd");
apiReq.setResponseParam("fklfhklfhlh");
apiReq.setRespCode("sdkadlahlf");
// apiReq.setFileId(1L);
// 赋值params
Long goodsApi = dataGoodsApi.getGoodsApi();
if (goodsApi != null) {
......@@ -281,6 +284,7 @@ public class DataGoodsServiceImpl implements DataGoodsService {
WebUtils.postJSON(url, apiReq);
} catch (Exception e) {
e.printStackTrace();
throw e;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment