|
@@ -8,6 +8,7 @@ import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.web.client.RestTemplate;
|
|
import org.springframework.web.client.RestTemplate;
|
|
|
|
|
+import thyyxxk.wxservice_server.config.exception.BizException;
|
|
|
import thyyxxk.wxservice_server.config.exception.ExceptionEnum;
|
|
import thyyxxk.wxservice_server.config.exception.ExceptionEnum;
|
|
|
import thyyxxk.wxservice_server.constant.OrderType;
|
|
import thyyxxk.wxservice_server.constant.OrderType;
|
|
|
import thyyxxk.wxservice_server.dao.WxApiDao;
|
|
import thyyxxk.wxservice_server.dao.WxApiDao;
|
|
@@ -155,7 +156,7 @@ public class WxApiService {
|
|
|
TradeVectorUtil.addBeingQuery(tradeNo);
|
|
TradeVectorUtil.addBeingQuery(tradeNo);
|
|
|
WxPayOrder order = dao.selectOrderByTradeNo(tradeNo);
|
|
WxPayOrder order = dao.selectOrderByTradeNo(tradeNo);
|
|
|
if (null == order) {
|
|
if (null == order) {
|
|
|
- return "ERROR:订单不存在。【订单号:" + tradeNo + "】";
|
|
|
|
|
|
|
+ throw new BizException(ExceptionEnum.LOGICAL_ERROR, "订单不存在。【订单号:" + tradeNo + "】");
|
|
|
}
|
|
}
|
|
|
OrderType orderType = OrderType.get(order.getOrderType());
|
|
OrderType orderType = OrderType.get(order.getOrderType());
|
|
|
int hasSaved = 0;
|
|
int hasSaved = 0;
|
|
@@ -193,9 +194,11 @@ public class WxApiService {
|
|
|
case CLINIC_REGISTER:
|
|
case CLINIC_REGISTER:
|
|
|
return savePayResultService.saveClinicRegister(order, successTime);
|
|
return savePayResultService.saveClinicRegister(order, successTime);
|
|
|
case REGISTRATION:
|
|
case REGISTRATION:
|
|
|
|
|
+ case SELF_MACHINE_REG:
|
|
|
return savePayResultService.saveAppointment(order, successTime);
|
|
return savePayResultService.saveAppointment(order, successTime);
|
|
|
case OUTPATIENT:
|
|
case OUTPATIENT:
|
|
|
case AESTHETIC_MEDICINE:
|
|
case AESTHETIC_MEDICINE:
|
|
|
|
|
+ case SELF_MACHINE_PAY:
|
|
|
return savePayResultService.saveMzChargeInfo(order, successTime);
|
|
return savePayResultService.saveMzChargeInfo(order, successTime);
|
|
|
case INPATIENT_PRE_PAY:
|
|
case INPATIENT_PRE_PAY:
|
|
|
return savePayResultService.saveZyYjjInfo(order, successTime);
|
|
return savePayResultService.saveZyYjjInfo(order, successTime);
|
|
@@ -211,14 +214,15 @@ public class WxApiService {
|
|
|
case WXMALL_PACKAGE:
|
|
case WXMALL_PACKAGE:
|
|
|
return savePayResultService.saveWxMallPackage(order, successTime);
|
|
return savePayResultService.saveWxMallPackage(order, successTime);
|
|
|
default:
|
|
default:
|
|
|
- return "ERROR:未识别到的订单类型,请联系服务中心。";
|
|
|
|
|
|
|
+ throw new BizException(ExceptionEnum.LOGICAL_ERROR, "未识别到的订单类型,请联系服务中心。");
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
dao.updatePayStatusAndQueryTimes(tradeNo, tradeState);
|
|
dao.updatePayStatusAndQueryTimes(tradeNo, tradeState);
|
|
|
return "ERROR:" + transaction.getTradeStateDesc();
|
|
return "ERROR:" + transaction.getTradeStateDesc();
|
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
|
log.error("查询订单状态出错:", e);
|
|
log.error("查询订单状态出错:", e);
|
|
|
- return "ERROR:服务器错误,请联系管理员处理。【订单号:" + tradeNo + "】";
|
|
|
|
|
|
|
+ throw new BizException(ExceptionEnum.INTERNAL_SERVER_ERROR,
|
|
|
|
|
+ "服务器错误,请联系管理员处理。【订单号:" + tradeNo + "】");
|
|
|
} finally {
|
|
} finally {
|
|
|
TradeVectorUtil.removeBeingQuery(tradeNo);
|
|
TradeVectorUtil.removeBeingQuery(tradeNo);
|
|
|
}
|
|
}
|
|
@@ -269,6 +273,9 @@ public class WxApiService {
|
|
|
order.setPatientName(patName);
|
|
order.setPatientName(patName);
|
|
|
}
|
|
}
|
|
|
switch (orderType) {
|
|
switch (orderType) {
|
|
|
|
|
+ case SELF_MACHINE_REG:
|
|
|
|
|
+ order.setMzyRequestId(param.getMzyRequestId());
|
|
|
|
|
+ break;
|
|
|
case INPATIENT_PRE_PAY:
|
|
case INPATIENT_PRE_PAY:
|
|
|
if (StringUtil.isBlank(param.getInpatientNo())) {
|
|
if (StringUtil.isBlank(param.getInpatientNo())) {
|
|
|
return ResultVoUtil.fail(ExceptionEnum.NULL_POINTER, "费用类型为住院预交金时,住院号不能为空!");
|
|
return ResultVoUtil.fail(ExceptionEnum.NULL_POINTER, "费用类型为住院预交金时,住院号不能为空!");
|
|
@@ -287,6 +294,7 @@ public class WxApiService {
|
|
|
order.setSglCheckNotified(Boolean.FALSE);
|
|
order.setSglCheckNotified(Boolean.FALSE);
|
|
|
break;
|
|
break;
|
|
|
case AESTHETIC_MEDICINE:
|
|
case AESTHETIC_MEDICINE:
|
|
|
|
|
+ case SELF_MACHINE_PAY:
|
|
|
if (StringUtil.isBlank(param.getHisOrdNum())) {
|
|
if (StringUtil.isBlank(param.getHisOrdNum())) {
|
|
|
return ResultVoUtil.fail(ExceptionEnum.NULL_POINTER, "HIS单号不能为空!");
|
|
return ResultVoUtil.fail(ExceptionEnum.NULL_POINTER, "HIS单号不能为空!");
|
|
|
}
|
|
}
|
|
@@ -315,10 +323,10 @@ public class WxApiService {
|
|
|
order.setTradeState(Transaction.TradeStateEnum.NOTPAY);
|
|
order.setTradeState(Transaction.TradeStateEnum.NOTPAY);
|
|
|
order.setSerialNo(SnowFlakeId.instance().nextId());
|
|
order.setSerialNo(SnowFlakeId.instance().nextId());
|
|
|
order.setOrderType(param.getOrderType());
|
|
order.setOrderType(param.getOrderType());
|
|
|
- order.setFundpayAmt(BigDecimal.ZERO);
|
|
|
|
|
- order.setAcctpayAmt(BigDecimal.ZERO);
|
|
|
|
|
|
|
+ order.setFundpayAmt(param.getFundpayAmt());
|
|
|
|
|
+ order.setAcctpayAmt(param.getAcctpayAmt());
|
|
|
order.setCouponAmt(BigDecimal.ZERO);
|
|
order.setCouponAmt(BigDecimal.ZERO);
|
|
|
- order.setCashpayAmt(order.getTotalFee());
|
|
|
|
|
|
|
+ order.setCashpayAmt(param.getCashpayAmt());
|
|
|
dao.insertNewOrder(order);
|
|
dao.insertNewOrder(order);
|
|
|
|
|
|
|
|
Map<String, String> map = new HashMap<>();
|
|
Map<String, String> map = new HashMap<>();
|