Forráskód Böngészése

优化预约退款处理。

lighter 4 éve
szülő
commit
45f652d568

+ 1 - 1
pom.xml

@@ -10,7 +10,7 @@
     </parent>
     <groupId>thyyxxk</groupId>
     <artifactId>wxservice-server</artifactId>
-    <version>5.1</version>
+    <version>5.2</version>
     <name>wxservice-server</name>
     <description>server for wxservice-web</description>
 

+ 25 - 5
src/main/java/thyyxxk/wxservice_server/service/BookableService.java

@@ -218,11 +218,31 @@ public class BookableService {
 
     public ResultVo<String> applyRefund(Integer reqNo) {
         WxPayOrder order = dao.selectWxPayOrder(reqNo);
-        ResultVo<String> refundResult = wxApiService.autoRefund(order.getTradeNo(), "驳回的医技预约,患者选择退款。");
-        log.info("【reqNo: {}】驳回的检查预约,患者选择退款,退款结果:{}", reqNo, refundResult);
-        if (null != refundResult && refundResult.getCode() == 200) {
-            return ResultVoUtil.success("退款成功,资金已原路返还,请您留意退款到账信息(可能有1到3分钟延迟)。");
+        if (null == order) {
+            return ResultVoUtil.fail(ExceptionEnum.NULL_POINTER, "您本条预约尚未支付,无法退款。");
+        }
+        if (order.getPayStatus() == 1) {
+            JSONObject param = new JSONObject();
+            param.put("hisOrdNum", order.getHisOrdNum());
+            RestTemplate template = new RestTemplate();
+            SaveMzFeeResponse response = template.postForObject(hrgApiUrl + "/saveRefundFeeFormHaiCi",
+                    param, SaveMzFeeResponse.class);
+            log.info("【hisOrdNum: {}】撤销处方结果:{}", order.getHisOrdNum(), response);
+            if (null == response || null == response.getResultCode()) {
+                return ResultVoUtil.fail(ExceptionEnum.INTERNAL_SERVER_ERROR, "服务器内部错误,请联系服务中心(0731-88518888)。");
+            }
+            if (response.getResultCode() == 0) {
+                ResultVo<String> refundResult = wxApiService.autoRefund(order.getTradeNo(), "驳回的医技预约,患者选择退款。");
+                log.info("【reqNo: {}】驳回的检查预约,退款结果:{}", reqNo, refundResult);
+                if (null != refundResult && refundResult.getCode() == ExceptionEnum.SUCCESS.getCode()) {
+                    return ResultVoUtil.success("退款成功,资金已原路返还,请您留意退款到账信息(可能有1到3分钟延迟)。");
+                }
+                return refundResult;
+            }
+            if (response.getResultCode() != 0) {
+                return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, response.getResultMessage());
+            }
         }
-        return refundResult;
+        return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "您本条预约尚未支付,或者缴费暂未入库。请稍后再试(建议30分钟后再操作)。");
     }
 }

+ 1 - 1
src/main/resources/application-prod.yml

@@ -1,5 +1,5 @@
 server:
-  port: 8085
+  port: 8083
   servlet:
     context-path: /wxserver
 spring:

+ 4 - 4
src/main/resources/application.yml

@@ -8,8 +8,8 @@ spring:
   thymeleaf:
     cache: false
   datasource:
-#    url: jdbc:jtds:sqlserver://172.16.32.179:1433/thxyhisdb
-    url: jdbc:jtds:sqlserver://172.16.32.168:1433/thxyhisdb
+    url: jdbc:jtds:sqlserver://172.16.32.179:1433/thxyhisdb
+#    url: jdbc:jtds:sqlserver://172.16.32.168:1433/thxyhisdb
     hikari:
       username: sa
       password:
@@ -31,6 +31,6 @@ mybatis:
   configuration:
     map-underscore-to-camel-case: true
 
-#hrgApiUrl: http://172.16.30.33:8089/thmz/api/v1
-hrgApiUrl: http://webhis.thyy.cn:81/thmz/api/v1
+hrgApiUrl: http://172.16.30.33:8089/thmz/api/v1
+#hrgApiUrl: http://webhis.thyy.cn:81/thmz/api/v1
 inspectionUrl: http://172.16.32.178:622/pushservice.asmx?wsdl