|
@@ -117,16 +117,22 @@ public class SavePayResultService {
|
|
|
hrgParam.put("agtOrdNum", order.getSerialNo());
|
|
|
hrgParam.put("payTime", successTime);
|
|
|
int tryTimes = 1;
|
|
|
- ExceptionEnum mzFeeResponse = saveMzPayResult(hrgParam, tryTimes, hisOrdNum, tradeNo);
|
|
|
+ ExceptionEnum mzFeeResponse = saveMzPayResult(hrgParam, tryTimes);
|
|
|
if (mzFeeResponse == ExceptionEnum.SUCCESS) {
|
|
|
+ updateHisChargeStatus(hisOrdNum, tradeNo);
|
|
|
return ResultVoUtil.success("保存门诊缴费信息成功。");
|
|
|
}
|
|
|
while (mzFeeResponse == ExceptionEnum.FETCH_SERIAL_NO_FAILURE && tryTimes < 5) {
|
|
|
tryTimes ++;
|
|
|
TimeUnit.SECONDS.sleep(tryTimes > 3 ? 2 : tryTimes);
|
|
|
- mzFeeResponse = saveMzPayResult(hrgParam, tryTimes, hisOrdNum, tradeNo);
|
|
|
+ mzFeeResponse = saveMzPayResult(hrgParam, tryTimes);
|
|
|
}
|
|
|
if (mzFeeResponse == ExceptionEnum.SUCCESS) {
|
|
|
+ updateHisChargeStatus(hisOrdNum, tradeNo);
|
|
|
+ return ResultVoUtil.success("保存门诊缴费信息成功。");
|
|
|
+ }
|
|
|
+ if (dao.alreadyPayed(tradeNo) == 1) {
|
|
|
+ updateHisChargeStatus(hisOrdNum, tradeNo);
|
|
|
return ResultVoUtil.success("保存门诊缴费信息成功。");
|
|
|
}
|
|
|
log.info("【订单号:{}】发起自动退款:{}", tradeNo, mzFeeResponse.getMessage());
|
|
@@ -140,18 +146,13 @@ public class SavePayResultService {
|
|
|
return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "【" + mzFeeResponse.getMessage() + "】自动退款失败,请联系服务中心进行退款。");
|
|
|
}
|
|
|
|
|
|
- private ExceptionEnum saveMzPayResult(JSONObject hrgParam, int times, String hisOrdNum, String tradeNo) {
|
|
|
+ private ExceptionEnum saveMzPayResult(JSONObject hrgParam, int times) {
|
|
|
RestTemplate template = new RestTemplate();
|
|
|
SaveMzFeeResponse mzFeeResponse = template.postForObject(hrgApiUrl + "/payChargeDetailFormHaiCi",
|
|
|
hrgParam, SaveMzFeeResponse.class);
|
|
|
log.info("第{}次尝试保存门诊缴费信息:\n参数:{},\n结果:{}", times, hrgParam, mzFeeResponse);
|
|
|
mzFeeResponse = null == mzFeeResponse ? new SaveMzFeeResponse() : mzFeeResponse;
|
|
|
if (mzFeeResponse.getResultCode() == 0) {
|
|
|
- updateHisChargeStatus(hisOrdNum, tradeNo);
|
|
|
- return ExceptionEnum.SUCCESS;
|
|
|
- }
|
|
|
- if (dao.alreadyPayed(tradeNo) == 1) {
|
|
|
- updateHisChargeStatus(hisOrdNum, tradeNo);
|
|
|
return ExceptionEnum.SUCCESS;
|
|
|
}
|
|
|
if (mzFeeResponse.getResultMessage().contains("获取缴费流水号失败")) {
|