1/3 参数优化1.0

Lhxyy
wangwei 2 months ago
parent 39ca067dc9
commit 94b050ae3f

@ -77,28 +77,6 @@ import java.util.stream.Collectors;
@Service(value = "100016HttpClient") //bean注册名称使用编码 + HttpClient文件接口加 FileClient
public class LhzyyClient extends CommonHttpClient {
public String getMsgHeader(String methodName) {
return "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
"<root>" +
"<serverName>" +
methodName +
"</serverName>" +
"</root>";
}
public String parserResult(String response) {
if (response.contains("<root")) {
try {
Document document = DocumentHelper.parseText(response);
String message = document.getRootElement().element("message").getText();
return message;
} catch (DocumentException e) {
log.info("解析龙海中医院接口返回结果异常, 返回结果:{}", response);
log.error("异常信息:", e);
}
}
return response;
}
@Resource
@ -447,31 +425,32 @@ public class LhzyyClient extends CommonHttpClient {
}
materialDictEntity.setSfybfw(Integer.valueOf(udiRelevanceResponse.getBasicPrductRemak13()));
LhzyyRequest lhzyyRequest = new LhzyyRequest();
lhzyyRequest.setMsgHeader(getMsgHeader("addMaterialDict"));
lhzyyRequest.setMsgBody(JSONUtil.toJsonStr(materialDictEntity));
String response = httpClient.postJson(thrSystemDetailService.getUrlExclude(Constants.URL_NAME_PRODUCT_SUBMIT_URL), lhzyyRequest);
response = parserResult(response);
try {
log.error("提交新增产品信息:" + lhzyyRequest.getMsgBody());
LhBaseResponse baseResponse = JSONObject.parseObject(response, LhBaseResponse.class);
if (baseResponse.getCode() != 20000) {
String errMsg = "提交新增产品信息,异常:{}" + response;
log.error(errMsg);
return ResultVOUtils.error(500, "提交新增产品失败!");
} else {
// materialDictEntity.setMaterialNo(baseResponse.getMaterialNo());
log.error("提交新增产品信息,成功:{}", response);
return ResultVOUtils.success(baseResponse.getYpid());
}
} catch (Exception e) {
String errMsg = "提交新增产品信息,异常:{}" + response;
log.error(errMsg);
log.error("异常信息:{}", e);
return ResultVOUtils.error(500, errMsg);
}
String response = httpClient.postJson(thrSystemDetailService.getUrlExclude(Constants.URL_NAME_PRODUCT_SUBMIT_URL), materialDictEntity);
log.error("提交新增产品信息返回:" + response);
// String third = String.valueOf(response.getData());
// try {
// log.error("提交新增产品信息:" + materialDictEntity);
// BaseResponse baseResponse = JSONObject.parseObject(response, BaseResponse.class);
//// LhBaseResponse baseResponse = JSONObject.parseObject(response, LhBaseResponse.class);
// if (baseResponse.getCode() != 20000) {
// String errMsg = "提交新增产品信息,异常:{}" + response;
// log.error(errMsg);
// return ResultVOUtils.error(500, "提交新增产品失败!");
//
// } else {
//// materialDictEntity.setMaterialNo(baseResponse.getMaterialNo());
// log.error("提交新增产品信息,成功:{}", response);
// return ResultVOUtils.success();
// }
// } catch (Exception e) {
// String errMsg = "提交新增产品信息,异常:{}" + response;
// log.error(errMsg);
// log.error("异常信息:{}", e);
// return ResultVOUtils.error(500, errMsg);
//
// }
return null;
}
}

Loading…
Cancel
Save