ソースを参照

对接富有支付完成 测试通过

java110 5 年 前
コミット
39f8474776
共有15 個のファイルを変更した55 個の追加39 個の削除を含む
  1. 21 3
      service-front/src/main/java/com/java110/front/smo/assetExport/impl/ExportRoomSMOImpl.java
  2. 1 1
      service-front/src/main/java/com/java110/front/smo/payment/adapt/IOweFeeToNotifyAdapt.java
  3. 1 1
      service-front/src/main/java/com/java110/front/smo/payment/adapt/IPayNotifyAdapt.java
  4. 1 1
      service-front/src/main/java/com/java110/front/smo/payment/adapt/IRentingToNotifyAdapt.java
  5. 3 4
      service-front/src/main/java/com/java110/front/smo/payment/adapt/fuiouPay/FuiouOweFeeToNotifyAdapt.java
  6. 9 12
      service-front/src/main/java/com/java110/front/smo/payment/adapt/fuiouPay/FuiouPayAdapt.java
  7. 4 6
      service-front/src/main/java/com/java110/front/smo/payment/adapt/fuiouPay/FuiouPayNotifyAdapt.java
  8. 1 1
      service-front/src/main/java/com/java110/front/smo/payment/adapt/fuiouPay/FuiouRentingToNotifyAdapt.java
  9. 1 1
      service-front/src/main/java/com/java110/front/smo/payment/adapt/wechatPay/WechatOweFeeToNotifyAdapt.java
  10. 1 1
      service-front/src/main/java/com/java110/front/smo/payment/adapt/wechatPay/WechatPayNotifyAdapt.java
  11. 1 1
      service-front/src/main/java/com/java110/front/smo/payment/adapt/wechatPay/WechatRentingToNotifyAdapt.java
  12. 2 1
      service-front/src/main/java/com/java110/front/smo/payment/impl/OweFeeToNotifySMOImpl.java
  13. 2 1
      service-front/src/main/java/com/java110/front/smo/payment/impl/RentingToNotifySMOImpl.java
  14. 3 1
      service-front/src/main/java/com/java110/front/smo/payment/impl/ToNotifySMOImpl.java
  15. 4 4
      service-front/src/main/resources/wechatAuth.properties

+ 21 - 3
service-front/src/main/java/com/java110/front/smo/assetExport/impl/ExportRoomSMOImpl.java

@@ -4,12 +4,12 @@ import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.java110.core.component.BaseComponentSMO;
 import com.java110.core.context.IPageData;
+import com.java110.dto.fee.FeeDto;
 import com.java110.entity.component.ComponentValidateResult;
 import com.java110.front.smo.assetExport.IExportRoomSMO;
 import com.java110.utils.constant.ServiceConstant;
 import com.java110.utils.util.Assert;
 import com.java110.utils.util.DateUtil;
-import org.apache.poi.hssf.usermodel.HSSFWorkbook;
 import org.apache.poi.ss.usermodel.*;
 import org.apache.poi.ss.util.CellRangeAddress;
 import org.apache.poi.xssf.usermodel.XSSFWorkbook;
@@ -47,13 +47,21 @@ public class ExportRoomSMOImpl extends BaseComponentSMO implements IExportRoomSM
 
         ComponentValidateResult result = this.validateStoreStaffCommunityRelationship(pd, restTemplate);
 
+        JSONObject paramIn = JSONObject.parseObject(pd.getReqData());
+
         Assert.hasKeyAndValue(JSONObject.parseObject(pd.getReqData()), "communityId", "请求中未包含小区");
+        Assert.hasKeyAndValue(paramIn, "objType", "请求中未包含费用对象");
 
         Workbook workbook = null;  //工作簿
         //工作表
         workbook = new XSSFWorkbook();
-        //获取楼信息
-        getRooms(pd, result, workbook);
+
+        if (FeeDto.PAYER_OBJ_TYPE_ROOM.equals(paramIn.getString("objType"))) {
+            //获取楼信息
+            getRooms(pd, result, workbook);
+        } else {
+            getCars(pd, result, workbook);
+        }
 
 
         ByteArrayOutputStream os = new ByteArrayOutputStream();
@@ -79,6 +87,16 @@ public class ExportRoomSMOImpl extends BaseComponentSMO implements IExportRoomSM
         return new ResponseEntity<Object>(context, headers, HttpStatus.OK);
     }
 
+    /**
+     * 查询车辆
+     *
+     * @param pd
+     * @param result
+     * @param workbook
+     */
+    private void getCars(IPageData pd, ComponentValidateResult result, Workbook workbook) {
+    }
+
 
     /**
      * 查询存在的房屋信息

+ 1 - 1
service-front/src/main/java/com/java110/front/smo/payment/adapt/IOweFeeToNotifyAdapt.java

@@ -27,7 +27,7 @@ public interface IOweFeeToNotifyAdapt {
      * @return
      * @throws Exception
      */
-    String confirmPayFee(String param);
+    String confirmPayFee(String param,String wId);
 
 
 }

+ 1 - 1
service-front/src/main/java/com/java110/front/smo/payment/adapt/IPayNotifyAdapt.java

@@ -29,7 +29,7 @@ public interface IPayNotifyAdapt {
      * @return
      * @throws Exception
      */
-    String confirmPayFee(String param);
+    String confirmPayFee(String param,String wId);
 
 
 

+ 1 - 1
service-front/src/main/java/com/java110/front/smo/payment/adapt/IRentingToNotifyAdapt.java

@@ -27,7 +27,7 @@ public interface IRentingToNotifyAdapt {
      * @return
      * @throws Exception
      */
-    String confirmPayFee(String param);
+    String confirmPayFee(String param,String wId);
 
 
 }

+ 3 - 4
service-front/src/main/java/com/java110/front/smo/payment/adapt/fuiouPay/FuiouOweFeeToNotifyAdapt.java

@@ -77,7 +77,7 @@ public class FuiouOweFeeToNotifyAdapt implements IOweFeeToNotifyAdapt {
      * @return
      * @throws Exception
      */
-    public String confirmPayFee(String param) {
+    public String confirmPayFee(String param, String wId) {
         JSONObject resJson = new JSONObject();
         resJson.put("result_code", "010002");
         resJson.put("result_msg", "失败");
@@ -87,7 +87,7 @@ public class FuiouOweFeeToNotifyAdapt implements IOweFeeToNotifyAdapt {
             String resultCode = map.getString("result_code");
             if ("000000".equals(resultCode)) {
                 //更新数据
-                int result = confirmPayFee(map);
+                int result = confirmPayFee(map, wId);
                 if (result > 0) {
                     //支付成功
                     resJson.put("result_code", "000000");
@@ -103,8 +103,7 @@ public class FuiouOweFeeToNotifyAdapt implements IOweFeeToNotifyAdapt {
     }
 
 
-    public int confirmPayFee(JSONObject map) {
-        String wId = map.get("wId").toString();
+    public int confirmPayFee(JSONObject map, String wId) {
         wId = wId.replace(" ", "+");
         ResponseEntity<String> responseEntity = null;
 

+ 9 - 12
service-front/src/main/java/com/java110/front/smo/payment/adapt/fuiouPay/FuiouPayAdapt.java

@@ -28,8 +28,7 @@ import com.java110.utils.util.StringUtil;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.http.HttpStatus;
-import org.springframework.http.ResponseEntity;
+import org.springframework.http.*;
 import org.springframework.stereotype.Component;
 import org.springframework.web.client.RestTemplate;
 
@@ -121,12 +120,8 @@ public class FuiouPayAdapt implements IPayAdapt {
 
         if ("000000".equals(resMap.getString("result_code"))) {
             if (WechatAuthProperties.TRADE_TYPE_JSAPI.equals(tradeType)) {
-                resultMap.put("appId", smallWeChatDto.getAppId());
-                resultMap.put("timeStamp", PayUtil.getCurrentTimeStamp());
-                resultMap.put("nonceStr", PayUtil.makeUUID(32));
-                resultMap.put("package", "prepay_id=" + resMap.get("session_id"));
-                resultMap.put("signType", "MD5");
-                resultMap.put("sign", PayUtil.createSign(resultMap, smallWeChatDto.getPayPassword()));
+                resultMap.putAll(JSONObject.toJavaObject(JSONObject.parseObject(resMap.getString("reserved_pay_info")), Map.class));
+                resultMap.put("sign",resultMap.get("paySign"));
             } else if (WechatAuthProperties.TRADE_TYPE_APP.equals(tradeType)) {
                 resultMap.put("appId", smallWeChatDto.getAppId());
                 resultMap.put("timeStamp", PayUtil.getCurrentTimeStamp());
@@ -173,7 +168,7 @@ public class FuiouPayAdapt implements IPayAdapt {
         paramMap.put("mchnt_cd", smallWeChatDto.getMchId()); // 富友分配给二级商户的商户号
         paramMap.put("random_str", PayUtil.makeUUID(32));
         paramMap.put("order_amt", PayUtil.moneyToIntegerStr(payAmount));
-        paramMap.put("mchnt_order_no", orderNum);
+        paramMap.put("mchnt_order_no", "9457" + orderNum);
         paramMap.put("txn_begin_ts", DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_DEFAULT));
         paramMap.put("goods_des", systemName + feeName);
         paramMap.put("term_id", "abcdefgh");
@@ -186,9 +181,11 @@ public class FuiouPayAdapt implements IPayAdapt {
         paramMap.put("sign", createSign(paramMap, smallWeChatDto.getPayPassword()));
 
         logger.debug("调用支付统一下单接口" + paramMap.toJSONString());
-
-        ResponseEntity<String> responseEntity = outRestTemplate.postForEntity(
-                PAY_UNIFIED_ORDER_URL, paramMap.toJSONString(), String.class);
+        HttpHeaders headers = new HttpHeaders();
+        headers.add("Content-Type", "application/json");
+        HttpEntity httpEntity = new HttpEntity(paramMap.toJSONString(), headers);
+        ResponseEntity<String> responseEntity = outRestTemplate.exchange(
+                PAY_UNIFIED_ORDER_URL, HttpMethod.POST, httpEntity, String.class);
 
         logger.debug("统一下单返回" + responseEntity);
 

+ 4 - 6
service-front/src/main/java/com/java110/front/smo/payment/adapt/fuiouPay/FuiouPayNotifyAdapt.java

@@ -22,7 +22,6 @@ import com.java110.dto.smallWeChat.SmallWeChatDto;
 import com.java110.front.properties.WechatAuthProperties;
 import com.java110.front.smo.payment.adapt.IPayNotifyAdapt;
 import com.java110.utils.constant.CommonConstant;
-import com.java110.utils.constant.ServiceCodeConstant;
 import com.java110.utils.constant.ServiceConstant;
 import com.java110.utils.util.BeanConvertUtil;
 import com.java110.utils.util.DateUtil;
@@ -75,7 +74,7 @@ public class FuiouPayNotifyAdapt implements IPayNotifyAdapt {
      * @return
      * @throws Exception
      */
-    public String confirmPayFee(String param) {
+    public String confirmPayFee(String param,String wId) {
         JSONObject resJson = new JSONObject();
         resJson.put("result_code", "010002");
         resJson.put("result_msg", "失败");
@@ -85,7 +84,7 @@ public class FuiouPayNotifyAdapt implements IPayNotifyAdapt {
             String resultCode = map.getString("result_code");
             if ("000000".equals(resultCode)) {
                 //更新数据
-                int result = confirmPayFee(map);
+                int result = confirmPayFee(map,wId);
                 if (result > 0) {
                     //支付成功
                     resJson.put("result_code", "000000");
@@ -101,8 +100,7 @@ public class FuiouPayNotifyAdapt implements IPayNotifyAdapt {
     }
 
 
-    public int confirmPayFee(JSONObject map) {
-        String wId = map.getString("wId");
+    public int confirmPayFee(JSONObject map,String wId) {
         wId = wId.replace(" ", "+");
 
         ResponseEntity<String> responseEntity = null;
@@ -127,7 +125,7 @@ public class FuiouPayNotifyAdapt implements IPayNotifyAdapt {
 
         //查询用户ID
         JSONObject paramIn = new JSONObject();
-        paramIn.put("oId", outTradeNo);
+        paramIn.put("oId", outTradeNo.substring(4));
         String url = ServiceConstant.SERVICE_API_URL + "/api/fee.payFeeConfirm";
         responseEntity = this.callCenterService(restTemplate, "-1", paramIn.toJSONString(), url, HttpMethod.POST);
 

+ 1 - 1
service-front/src/main/java/com/java110/front/smo/payment/adapt/fuiouPay/FuiouRentingToNotifyAdapt.java

@@ -74,7 +74,7 @@ public class FuiouRentingToNotifyAdapt implements IPayNotifyAdapt {
      * @return
      * @throws Exception
      */
-    public String confirmPayFee(String param) {
+    public String confirmPayFee(String param,String wId) {
         JSONObject resJson = new JSONObject();
         resJson.put("result_code", "010002");
         resJson.put("result_msg", "失败");

+ 1 - 1
service-front/src/main/java/com/java110/front/smo/payment/adapt/wechatPay/WechatOweFeeToNotifyAdapt.java

@@ -66,7 +66,7 @@ public class WechatOweFeeToNotifyAdapt implements IOweFeeToNotifyAdapt {
      * @return
      * @throws Exception
      */
-    public String confirmPayFee(String param) {
+    public String confirmPayFee(String param,String wId) {
         String resXml = "";
         try {
             Map<String, Object> map = PayUtil.getMapFromXML(param);

+ 1 - 1
service-front/src/main/java/com/java110/front/smo/payment/adapt/wechatPay/WechatPayNotifyAdapt.java

@@ -66,7 +66,7 @@ public class WechatPayNotifyAdapt implements IPayNotifyAdapt {
      * @return
      * @throws Exception
      */
-    public String confirmPayFee(String param) {
+    public String confirmPayFee(String param,String wId) {
         String resXml = "";
         try {
             Map<String, Object> map = PayUtil.getMapFromXML(param);

+ 1 - 1
service-front/src/main/java/com/java110/front/smo/payment/adapt/wechatPay/WechatRentingToNotifyAdapt.java

@@ -63,7 +63,7 @@ public class WechatRentingToNotifyAdapt implements IPayNotifyAdapt {
      * @return
      * @throws Exception
      */
-    public String confirmPayFee(String param) {
+    public String confirmPayFee(String param,String wId) {
         String resXml = "";
         try {
             Map<String, Object> map = PayUtil.getMapFromXML(param);

+ 2 - 1
service-front/src/main/java/com/java110/front/smo/payment/impl/OweFeeToNotifySMOImpl.java

@@ -26,11 +26,12 @@ public class OweFeeToNotifySMOImpl implements IOweFeeToNotifySMO {
 
     @Override
     public ResponseEntity<String> toNotify(String param, HttpServletRequest request) {
+        String wId = request.getParameter("wId");
         String payNotifyAdapt = MappingCache.getValue(WechatConstant.WECHAT_DOMAIN, WechatConstant.PAY_NOTIFY_ADAPT);
         payNotifyAdapt = StringUtil.isEmpty(payNotifyAdapt) ? DEFAULT_OWE_FEE_TO_NOTIFY_ADAPT : payNotifyAdapt;
         //支付适配器
         IOweFeeToNotifyAdapt tPayNotifyAdapt = ApplicationContextFactory.getBean(payNotifyAdapt, IOweFeeToNotifyAdapt.class);
-        String resXml = tPayNotifyAdapt.confirmPayFee(param);
+        String resXml = tPayNotifyAdapt.confirmPayFee(param,wId);
         logger.info("【小程序支付回调响应】 响应内容:\n" + resXml);
         return new ResponseEntity<String>(resXml, HttpStatus.OK);
     }

+ 2 - 1
service-front/src/main/java/com/java110/front/smo/payment/impl/RentingToNotifySMOImpl.java

@@ -36,11 +36,12 @@ public class RentingToNotifySMOImpl implements IRentingToNotifySMO {
 
     @Override
     public ResponseEntity<String> toNotify(String param, HttpServletRequest request) {
+        String wId = request.getParameter("wId");
         String payNotifyAdapt = MappingCache.getValue(WechatConstant.WECHAT_DOMAIN, WechatConstant.PAY_NOTIFY_ADAPT);
         payNotifyAdapt = StringUtil.isEmpty(payNotifyAdapt) ? DEFAULT_RENTING_TO_NOTIFY_ADAPT : payNotifyAdapt;
         //支付适配器
         IRentingToNotifyAdapt tPayNotifyAdapt = ApplicationContextFactory.getBean(payNotifyAdapt, IRentingToNotifyAdapt.class);
-        String resXml = tPayNotifyAdapt.confirmPayFee(param);
+        String resXml = tPayNotifyAdapt.confirmPayFee(param,wId);
         logger.info("【小程序支付回调响应】 响应内容:\n" + resXml);
         return new ResponseEntity<String>(resXml, HttpStatus.OK);
     }

+ 3 - 1
service-front/src/main/java/com/java110/front/smo/payment/impl/ToNotifySMOImpl.java

@@ -41,11 +41,13 @@ public class ToNotifySMOImpl implements IToNotifySMO {
     @Override
     public ResponseEntity<String> toNotify(String param, HttpServletRequest request) {
 
+        String wId = request.getParameter("wId");
+
         String payNotifyAdapt = MappingCache.getValue(WechatConstant.WECHAT_DOMAIN, WechatConstant.PAY_NOTIFY_ADAPT);
         payNotifyAdapt = StringUtil.isEmpty(payNotifyAdapt) ? DEFAULT_PAY_NOTIFY_ADAPT : payNotifyAdapt;
         //支付适配器
         IPayNotifyAdapt tPayNotifyAdapt = ApplicationContextFactory.getBean(payNotifyAdapt, IPayNotifyAdapt.class);
-        String resXml = tPayNotifyAdapt.confirmPayFee(param);
+        String resXml = tPayNotifyAdapt.confirmPayFee(param,wId);
         logger.info("【小程序支付回调响应】 响应内容:\n" + resXml);
         return new ResponseEntity<String>(resXml, HttpStatus.OK);
     }

+ 4 - 4
service-front/src/main/resources/wechatAuth.properties

@@ -5,10 +5,10 @@ java110.auth.wechat.grantType=authorization_code
 java110.auth.wechat.key=key
 java110.auth.wechat.mchId=mchId
 java110.auth.wechat.wxPayUnifiedOrder=https://api.mch.weixin.qq.com/pay/unifiedorder
-java110.auth.wechat.wxNotifyUrl=https://app.demo.winqi.cn/app/payment/notify
-java110.auth.wechat.rentingNotifyUrl=https://app.demo.winqi.cn/app/payment/rentingNotify
-java110.auth.wechat.goodsNotifyUrl=https://app.demo.winqi.cn/goods/notify
-java110.auth.wechat.oweFeeNotifyUrl=https://app.demo.winqi.cn/app/payment/oweFeeNotify
+java110.auth.wechat.wxNotifyUrl=http://www.vipwuye.com/app/payment/notify
+java110.auth.wechat.rentingNotifyUrl=http://www.vipwuye.com/app/payment/rentingNotify
+java110.auth.wechat.goodsNotifyUrl=http://www.vipwuye.com/goods/notify
+java110.auth.wechat.oweFeeNotifyUrl=http://www.vipwuye.com/app/payment/oweFeeNotify
 
 # ¹«ÖÚºÅÐÅÏ¢
 java110.auth.wechat.wechatAppId=key