Browse Source

新增支付通道

Yangzw 8 months ago
parent
commit
1bbb065b65
48 changed files with 2160 additions and 11 deletions
  1. 2 0
      feifan-module-infra/feifan-module-infra-biz/src/main/java/cn/newfeifan/mall/module/infra/framework/security/config/SecurityConfiguration.java
  2. 6 0
      feifan-module-pay/feifan-module-pay-api/src/main/java/cn/newfeifan/mall/module/pay/enums/DictTypeConstants.java
  3. 2 1
      feifan-module-pay/feifan-module-pay-api/src/main/java/cn/newfeifan/mall/module/pay/enums/ErrorCodeConstants.java
  4. BIN
      feifan-module-pay/feifan-module-pay-api/src/main/web/WEB-INF/lib/commons-codec-1.5.jar
  5. BIN
      feifan-module-pay/feifan-module-pay-api/src/main/web/WEB-INF/lib/commons-httpclient-3.0.jar
  6. BIN
      feifan-module-pay/feifan-module-pay-api/src/main/web/WEB-INF/lib/commons-logging-1.1.1.jar
  7. BIN
      feifan-module-pay/feifan-module-pay-api/src/main/web/WEB-INF/lib/fastjson-1.2.29.jar
  8. 33 0
      feifan-module-pay/feifan-module-pay-biz/pom.xml
  9. 3 0
      feifan-module-pay/feifan-module-pay-biz/src/main/java/cn/newfeifan/mall/module/pay/controller/admin/order/vo/PayOrderBaseVO.java
  10. 55 0
      feifan-module-pay/feifan-module-pay-biz/src/main/java/cn/newfeifan/mall/module/pay/controller/app/fuyouorder/NewPayOrderController.java
  11. 262 0
      feifan-module-pay/feifan-module-pay-biz/src/main/java/cn/newfeifan/mall/module/pay/controller/app/fuyouorder/vo/FuYouPaymentRequestVO.java
  12. 58 0
      feifan-module-pay/feifan-module-pay-biz/src/main/java/cn/newfeifan/mall/module/pay/controller/app/fuyouorder/vo/Test.java
  13. 5 9
      feifan-module-pay/feifan-module-pay-biz/src/main/java/cn/newfeifan/mall/module/pay/dal/dataobject/order/PayOrderDO.java
  14. 36 0
      feifan-module-pay/feifan-module-pay-biz/src/main/java/cn/newfeifan/mall/module/pay/fuiou/client/CommonQueryClient.java
  15. 35 0
      feifan-module-pay/feifan-module-pay-biz/src/main/java/cn/newfeifan/mall/module/pay/fuiou/client/GetMchntKeyClient.java
  16. 49 0
      feifan-module-pay/feifan-module-pay-biz/src/main/java/cn/newfeifan/mall/module/pay/fuiou/client/MicroPayClient.java
  17. 57 0
      feifan-module-pay/feifan-module-pay-biz/src/main/java/cn/newfeifan/mall/module/pay/fuiou/client/PreCreateClient.java
  18. 34 0
      feifan-module-pay/feifan-module-pay-biz/src/main/java/cn/newfeifan/mall/module/pay/fuiou/client/QueryChnlPayAmtClient.java
  19. 32 0
      feifan-module-pay/feifan-module-pay-biz/src/main/java/cn/newfeifan/mall/module/pay/fuiou/client/QueryFeeAmtClient.java
  20. 31 0
      feifan-module-pay/feifan-module-pay-biz/src/main/java/cn/newfeifan/mall/module/pay/fuiou/client/QueryWithdrawAmtClient.java
  21. 45 0
      feifan-module-pay/feifan-module-pay-biz/src/main/java/cn/newfeifan/mall/module/pay/fuiou/client/RefundClient.java
  22. 59 0
      feifan-module-pay/feifan-module-pay-biz/src/main/java/cn/newfeifan/mall/module/pay/fuiou/client/WapPreCreateClient.java
  23. 33 0
      feifan-module-pay/feifan-module-pay-biz/src/main/java/cn/newfeifan/mall/module/pay/fuiou/client/WithdrawClient.java
  24. 61 0
      feifan-module-pay/feifan-module-pay-biz/src/main/java/cn/newfeifan/mall/module/pay/fuiou/client/WxPreCreateClient.java
  25. 27 0
      feifan-module-pay/feifan-module-pay-biz/src/main/java/cn/newfeifan/mall/module/pay/fuiou/reqdata/CommonQueryDataReq.java
  26. 18 0
      feifan-module-pay/feifan-module-pay-biz/src/main/java/cn/newfeifan/mall/module/pay/fuiou/reqdata/GetMchntKeyDataReq.java
  27. 13 0
      feifan-module-pay/feifan-module-pay-biz/src/main/java/cn/newfeifan/mall/module/pay/fuiou/reqdata/GetOpenIdReq.java
  28. 54 0
      feifan-module-pay/feifan-module-pay-biz/src/main/java/cn/newfeifan/mall/module/pay/fuiou/reqdata/MicroPayDataReq.java
  29. 78 0
      feifan-module-pay/feifan-module-pay-biz/src/main/java/cn/newfeifan/mall/module/pay/fuiou/reqdata/PreCreateDataReq.java
  30. 28 0
      feifan-module-pay/feifan-module-pay-biz/src/main/java/cn/newfeifan/mall/module/pay/fuiou/reqdata/QueryChnlPayAmtDataReq.java
  31. 18 0
      feifan-module-pay/feifan-module-pay-biz/src/main/java/cn/newfeifan/mall/module/pay/fuiou/reqdata/QueryFeeAmtDataReq.java
  32. 19 0
      feifan-module-pay/feifan-module-pay-biz/src/main/java/cn/newfeifan/mall/module/pay/fuiou/reqdata/QueryWithdrawAmtDataReq.java
  33. 34 0
      feifan-module-pay/feifan-module-pay-biz/src/main/java/cn/newfeifan/mall/module/pay/fuiou/reqdata/RefundDataReq.java
  34. 63 0
      feifan-module-pay/feifan-module-pay-biz/src/main/java/cn/newfeifan/mall/module/pay/fuiou/reqdata/WapPreCreateDataReq.java
  35. 26 0
      feifan-module-pay/feifan-module-pay-biz/src/main/java/cn/newfeifan/mall/module/pay/fuiou/reqdata/WebPreCreateDeviceInfo.java
  36. 26 0
      feifan-module-pay/feifan-module-pay-biz/src/main/java/cn/newfeifan/mall/module/pay/fuiou/reqdata/WithdrawDataReq.java
  37. 61 0
      feifan-module-pay/feifan-module-pay-biz/src/main/java/cn/newfeifan/mall/module/pay/fuiou/reqdata/WxPreCreateDataReq.java
  38. 19 0
      feifan-module-pay/feifan-module-pay-biz/src/main/java/cn/newfeifan/mall/module/pay/fuiou/reqvo/SubmitOrderRequestVO.java
  39. 42 0
      feifan-module-pay/feifan-module-pay-biz/src/main/java/cn/newfeifan/mall/module/pay/fuiou/respVO/FuYouPayOrderSubmitRespVO.java
  40. 131 0
      feifan-module-pay/feifan-module-pay-biz/src/main/java/cn/newfeifan/mall/module/pay/fuiou/respVO/FuYouPaymentResponseVO.java
  41. 79 0
      feifan-module-pay/feifan-module-pay-biz/src/main/java/cn/newfeifan/mall/module/pay/fuiou/util/DateUtils.java
  42. 149 0
      feifan-module-pay/feifan-module-pay-biz/src/main/java/cn/newfeifan/mall/module/pay/fuiou/util/FuiouHttpPoster.java
  43. 85 0
      feifan-module-pay/feifan-module-pay-biz/src/main/java/cn/newfeifan/mall/module/pay/fuiou/util/MD5.java
  44. 113 0
      feifan-module-pay/feifan-module-pay-biz/src/main/java/cn/newfeifan/mall/module/pay/fuiou/util/MySSLSocketFactory.java
  45. 121 0
      feifan-module-pay/feifan-module-pay-biz/src/main/java/cn/newfeifan/mall/module/pay/service/fuyouorder/FiYouPayOrderServiceImpl.java
  46. 27 0
      feifan-module-pay/feifan-module-pay-biz/src/main/java/cn/newfeifan/mall/module/pay/service/fuyouorder/FuYouPayOrderService.java
  47. 7 0
      feifan-module-pay/feifan-module-pay-biz/src/main/java/cn/newfeifan/mall/module/pay/service/order/PayOrderService.java
  48. 24 1
      feifan-module-pay/feifan-module-pay-biz/src/main/java/cn/newfeifan/mall/module/pay/service/order/PayOrderServiceImpl.java

+ 2 - 0
feifan-module-infra/feifan-module-infra-biz/src/main/java/cn/newfeifan/mall/module/infra/framework/security/config/SecurityConfiguration.java

@@ -39,6 +39,8 @@ public class SecurityConfiguration {
                         .antMatchers(adminSeverContextPath + "/**").anonymous();
                 // 文件读取
                 registry.antMatchers(buildAdminApi("/infra/file/*/get/**")).permitAll();
+                //富友支付回调
+                registry.antMatchers(buildAdminApi("/fuYou/pay/order/notify")).permitAll();
             }
 
         };

+ 6 - 0
feifan-module-pay/feifan-module-pay-api/src/main/java/cn/newfeifan/mall/module/pay/enums/DictTypeConstants.java

@@ -15,4 +15,10 @@ public interface DictTypeConstants {
 
     String NOTIFY_STATUS = "pay_notify_status"; // 回调状态
 
+    // 富友支付的商户私钥
+    String privateKey = "b58ef4203dbe11ef3effcedc419c26ae";
+
+    // 富有支付的商户号
+    String mchnt_cd = "0006420F7357129";
+
 }

+ 2 - 1
feifan-module-pay/feifan-module-pay-api/src/main/java/cn/newfeifan/mall/module/pay/enums/ErrorCodeConstants.java

@@ -4,7 +4,6 @@ import cn.newfeifan.mall.framework.common.exception.ErrorCode;
 
 /**
  * Pay 错误码 Core 枚举类
- *
  * pay 系统,使用 1-007-000-000 段
  */
 public interface ErrorCodeConstants {
@@ -89,4 +88,6 @@ public interface ErrorCodeConstants {
     ErrorCode DEMO_TRANSFER_NOT_FOUND = new ErrorCode(1_007_901_001, "示例转账单不存在");
     ErrorCode DEMO_TRANSFER_FAIL_TRANSFER_ID_ERROR = new ErrorCode(1_007_901_002, "转账失败,转账单编号不匹配");
     ErrorCode DEMO_TRANSFER_FAIL_PRICE_NOT_MATCH = new ErrorCode(1_007_901_003, "转账失败,转账单金额不匹配");
+    ErrorCode SIGN_MD5_ERROR = new ErrorCode(1_007_901_004, "转账失败,转账单金额不匹配");
+    ErrorCode SUBMIT_ORDER_ERROR = new ErrorCode(1_007_901_005, "提交订单失败");
 }

BIN
feifan-module-pay/feifan-module-pay-api/src/main/web/WEB-INF/lib/commons-codec-1.5.jar


BIN
feifan-module-pay/feifan-module-pay-api/src/main/web/WEB-INF/lib/commons-httpclient-3.0.jar


BIN
feifan-module-pay/feifan-module-pay-api/src/main/web/WEB-INF/lib/commons-logging-1.1.1.jar


BIN
feifan-module-pay/feifan-module-pay-api/src/main/web/WEB-INF/lib/fastjson-1.2.29.jar


+ 33 - 0
feifan-module-pay/feifan-module-pay-biz/pom.xml

@@ -83,6 +83,39 @@
             <artifactId>feifan-spring-boot-starter-biz-dict</artifactId>
         </dependency>
 
+        <dependency>
+            <groupId>commons-codec</groupId>
+            <artifactId>commons-codec</artifactId>
+            <version>1.2</version>
+            <scope>system</scope>
+            <systemPath>${project.basedir}/../feifan-module-pay-api/src/main/web/WEB-INF/lib/commons-codec-1.5.jar</systemPath>
+        </dependency>
+
+        <dependency>
+            <groupId>commons-httpclient</groupId>
+            <artifactId>commons-httpclient</artifactId>
+            <version>1.11</version>
+            <scope>system</scope>
+            <systemPath>${project.basedir}/../feifan-module-pay-api/src/main/web/WEB-INF/lib/commons-httpclient-3.0.jar</systemPath>
+        </dependency>
+
+        <dependency>
+            <groupId>commons-logging</groupId>
+            <artifactId>commons-logging</artifactId>
+            <version>1.11</version>
+            <scope>system</scope>
+            <systemPath>${project.basedir}/../feifan-module-pay-api/src/main/web/WEB-INF/lib/commons-logging-1.1.1.jar</systemPath>
+        </dependency>
+
+
+
+<!--        测试-->
+        <dependency>
+            <groupId>org.apache.httpcomponents</groupId>
+            <artifactId>httpclient</artifactId>
+            <version>4.5.6</version>
+        </dependency>
+
     </dependencies>
 
 </project>

+ 3 - 0
feifan-module-pay/feifan-module-pay-biz/src/main/java/cn/newfeifan/mall/module/pay/controller/admin/order/vo/PayOrderBaseVO.java

@@ -86,4 +86,7 @@ public class PayOrderBaseVO {
     @Schema(description = "渠道订单号", example = "4096")
     private String channelOrderNo;
 
+    @Schema(description = "支付订单号")
+    private String payOrderNo;
+
 }

+ 55 - 0
feifan-module-pay/feifan-module-pay-biz/src/main/java/cn/newfeifan/mall/module/pay/controller/app/fuyouorder/NewPayOrderController.java

@@ -0,0 +1,55 @@
+package cn.newfeifan.mall.module.pay.controller.app.fuyouorder;
+
+import cn.newfeifan.mall.framework.common.pojo.CommonResult;
+import cn.newfeifan.mall.module.pay.fuiou.reqvo.SubmitOrderRequestVO;
+import cn.newfeifan.mall.module.pay.fuiou.respVO.FuYouPaymentResponseVO;
+import cn.newfeifan.mall.module.pay.service.fuyouorder.FuYouPayOrderService;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
+
+import javax.annotation.Resource;
+
+import static cn.newfeifan.mall.framework.common.pojo.CommonResult.success;
+
+@Tag(name = "用户 APP - 富有支付订单")
+@RestController
+@RequestMapping("/fuYou/pay/order")
+@Validated
+@Slf4j
+public class NewPayOrderController {
+
+    @Resource
+    private FuYouPayOrderService fuYouPayOrderService;
+
+    @PostMapping("/submit")
+    @Operation(summary = "向富友提交支付订单")
+    public CommonResult<String> submitFuYouPayOrder(@RequestBody SubmitOrderRequestVO reqVO) {
+
+        String respVO = fuYouPayOrderService.submitOrder(reqVO);
+
+        return success(respVO);
+    }
+
+    @PostMapping("/notify")
+    @Operation(summary = "富友支付订单回调")
+    public CommonResult<String> notifyFuYouPayOrder(@RequestBody FuYouPaymentResponseVO responseVO) {
+
+
+        System.out.println(responseVO.toString());
+//        fiYouPayOrderService.notifyOrder(notify);
+
+        return success("success");
+    }
+
+    @PostMapping("/afterSale")
+    @Operation(summary = "向富友申请退款")
+    public CommonResult<String> afterSaleFuYouPayOrder(Long afterSaleId) {
+
+        fuYouPayOrderService.afterSale(afterSaleId);
+
+        return success("success");
+    }
+}

+ 262 - 0
feifan-module-pay/feifan-module-pay-biz/src/main/java/cn/newfeifan/mall/module/pay/controller/app/fuyouorder/vo/FuYouPaymentRequestVO.java

@@ -0,0 +1,262 @@
+package cn.newfeifan.mall.module.pay.controller.app.fuyouorder.vo;
+
+import lombok.Data;
+
+import java.math.BigInteger;
+import java.nio.charset.StandardCharsets;
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+import java.time.LocalDateTime;
+
+import static cn.newfeifan.mall.framework.common.exception.util.ServiceExceptionUtil.exception;
+import static cn.newfeifan.mall.module.pay.enums.ErrorCodeConstants.SIGN_MD5_ERROR;
+
+@Data
+public class FuYouPaymentRequestVO {
+
+    /**
+     * 版本号
+     */
+    private String version;
+
+    /**
+     * 商户号,富友分配的商户号
+     */
+    private String mchntCd;
+
+    /**
+     * 随机字符串
+     */
+    private String randomStr;
+
+    /**
+     * 订单总金额,以分为单位
+     */
+    private Double orderAmt;
+
+    /**
+     * 商户订单号
+     */
+    private String mchntOrderNo;
+
+    /**
+     * 商品标识
+     */
+    private String productId;
+
+    /**
+     * 交易开始时间,格式: yyyyMMddHHmmss
+     */
+    private LocalDateTime txnBeginTs;
+
+    /**
+     * 商品描述
+     */
+    private String goodsDes;
+
+    /**
+     * 商品详情
+     */
+    private String goodsDetail;
+
+    /**
+     * 商品标记
+     */
+    private String goodsTag;
+
+    /**
+     * 终端标识,如设备8字节数字字母组合
+     */
+    private String termId;
+
+    /**
+     * 终端IP
+     */
+    private String termIp;
+
+    /**
+     * 附加信息
+     */
+    private String addnInf;
+
+    /**
+     * 货币类型,默认人民币: CNY
+     */
+    private String currType;
+
+    /**
+     * 接收富友异步通知回调地址
+     */
+    private String notifyUrl;
+
+    /**
+     * 支付限制,如不能使用信用卡
+     */
+    private String limitPay;
+
+    /**
+     * 交易类型
+     */
+    private String tradeType;
+
+    /**
+     * 用户标识,支付宝服务窗为user_id,微信公众号为用户的openid
+     */
+    private String openid;
+
+    /**
+     * 子商户用户标识
+     */
+    private String subOpenid;
+
+    /**
+     * 子商户公众号或商户的appid
+     */
+    private String subAppid;
+
+    /**
+     * 富友终端号,如果不是富友的POS终端,此字段不要填,否则会影响清算
+     */
+    private String reservedFyTermId;
+
+    /**
+     * 交易关闭时间,单位分钟,例如:60(1小时),默认填0(2小时)
+     */
+    private Integer reservedExpireMinute;
+
+    /**
+     * 用户身份证号码,实名保险类交易必填
+     */
+    private String reservedUserCreid;
+
+    /**
+     * 用户姓名
+     */
+    private String reservedUserTruename;
+
+    /**
+     * 用户手机号
+     * */
+    private String reservedUserMobile;
+
+    /**
+     * 保险公司订单号,认证机构单号(使用英文逗号分隔)
+     */
+    private String reservedBxnoInf;
+
+    /**
+     * 富友终端类型
+     * 0: 其他
+     * 1: 富友终端
+     * 2: POS机
+     * 3: 台卡
+     * 4: PC软件
+     */
+    private Integer reservedFyTermType;
+
+    /**
+     * 终端序列号
+     */
+    private String reservedFyTermSn;
+
+//    /**
+//     * 设备信息,透传给微信,用于单品券核销
+//     */
+//    private String reservedDeviceInfo;
+
+//    /**
+//     * 花呗分期相关信息的JSON串
+//     */
+//    private String reservedAliExtendParams;
+//
+//    /**
+//     * 花呗分期期数:仅支持3、6期
+//     */
+//    private Integer lhbFqNum;
+//
+//    /**
+//     * 花呗分期商家手续费比例,目前仅支持用户出资,如需使用,请填写0
+//     */
+//    private Double lhbFqSellerPercent;
+//
+//    /**
+//     * 行业数据回流信息
+//     */
+//    private String lindustryRefluxInfo;
+//
+//    /**
+//     * 点餐场景类型
+//     * qr_order: 店内扫码点餐
+//     * pre_order: 预点到店自提
+//     * home_delivery: 外送到家
+//     */
+//    private String lfoodOrderType;
+
+
+    /**
+     * 商户密钥,系统分配
+     */
+    private String mchntKey;
+
+    /**
+     * 签名
+     */
+    private String sign;
+
+    /**
+     * 生成签名
+     *
+     * @return 签名字符串
+     */
+    public String getSign() {
+        // 拼接签名字符串,字段间用 "|" 分隔
+        StringBuilder signContent = new StringBuilder();
+        signContent.append(this.orderAmt)
+                .append("|")
+                .append(this.mchntOrderNo)
+                .append("|")
+                .append(this.txnBeginTs)
+                .append("|")
+                .append(this.goodsDes)
+                .append("|")
+                .append(this.termId)
+                .append("|")
+                .append(this.termIp)
+                .append("|")
+                .append(this.mchntCd)
+                .append("|")
+                .append(this.notifyUrl)
+                .append("!")
+                .append(this.tradeType)
+                .append("(")
+                .append(this.randomStr)
+                .append(")")
+                .append(this.version)
+                .append("|")
+                .append(this.mchntKey);
+
+        // 使用 MD5 算法加密签名字符串
+        return encryptMd5(signContent.toString());
+    }
+
+    /**
+     * 使用MD5算法加密给定字符串。注意:MD5算法在安全性要求高的场景中不再安全,应考虑使用更安全的算法。
+     *
+     * @param content 需要加密的字符串
+     * @return 加密后的字符串
+     */
+    private String encryptMd5(String content) {
+        try {
+            // 指定使用UTF-8字符编码,避免不同环境下的不一致问题
+            MessageDigest md = MessageDigest.getInstance("MD5");
+            byte[] messageDigest = md.digest(content.getBytes(StandardCharsets.UTF_8));
+            BigInteger no = new BigInteger(1, messageDigest);
+
+            // 使用String.format简化了补0的逻辑,提高代码的可读性和简洁性
+
+            return String.format("%032x", no);
+        } catch (NoSuchAlgorithmException e) {
+            throw exception(SIGN_MD5_ERROR);
+        }
+    }
+}

+ 58 - 0
feifan-module-pay/feifan-module-pay-biz/src/main/java/cn/newfeifan/mall/module/pay/controller/app/fuyouorder/vo/Test.java

@@ -0,0 +1,58 @@
+package cn.newfeifan.mall.module.pay.controller.app.fuyouorder.vo;
+
+import cn.newfeifan.mall.module.pay.fuiou.reqdata.WxPreCreateDataReq;
+import cn.newfeifan.mall.module.pay.fuiou.util.DateUtils;
+import cn.newfeifan.mall.module.pay.fuiou.util.FuiouHttpPoster;
+import cn.newfeifan.mall.module.pay.fuiou.util.MD5;
+import com.alibaba.fastjson.JSON;
+
+import static cn.newfeifan.mall.module.pay.fuiou.client.WxPreCreateClient.privateKey;
+
+public class Test {
+    public static void main(String[] args) {
+        WxPreCreateDataReq req = new WxPreCreateDataReq();
+        FuiouHttpPoster http = new FuiouHttpPoster();
+        http.setCharset("utf-8");
+        http.setUrl("https://aipaytest.fuioupay.com/aggregatePay/wxPreCreate");
+        req.setTerm_id("88888888");
+        req.setTerm_ip("192.168.8.8");
+        req.setRandom_str(DateUtils.getCurrentDate("yyyyMMddHHmmss")
+                + "568974");
+        req.setMchnt_cd("0002900F1503036");
+        req.setTrade_type("JSAPI");
+//        req.setOpenid("oDax96l0bZdXqRQ2uVfn_2LV-DxM");//微信支付此字段必填
+//		req.setSub_openid("221122121");//支付宝支付此字段必填
+        req.setOrder_amt("1");
+        req.setGoods_des("测试订单");
+        req.setOpenid("oDax96l0bZdXqRQ2uVfn_2LV-DxM");
+        req.setSub_openid("oDax96l0bZdXqRQ2uVfn_2LV-DxM");
+        req.setSub_appid("wxe133514440a8829d");
+        req.setMchnt_order_no("1066" + "o202406121152101");//不能重复
+        req.setTxn_begin_ts(DateUtils.getCurrentDate("yyyyMMddHHmmss"));
+        req.setNotify_url("wwww.baidu.com");
+        req.setVersion("1.0");
+        StringBuilder sb = new StringBuilder();
+        sb.append(req.getMchnt_cd().trim()).append("|")
+                .append(req.getTrade_type().trim()).append("|")
+                .append(req.getOrder_amt().trim()).append("|")
+                .append(req.getMchnt_order_no().trim()).append("|")
+                .append(req.getTxn_begin_ts()).append("|")
+                .append(req.getGoods_des()).append("|")
+                .append(req.getTerm_id()).append("|")
+                .append(req.getTerm_ip()).append("|")
+                .append(req.getNotify_url()).append("|")
+                .append(req.getRandom_str()).append("|")
+                .append(req.getVersion()).append("|")
+                .append(privateKey);
+        req.setSign(MD5.MD5Encode(sb.toString()));
+        String res = null;
+        try {
+            res = http.newPost(JSON.toJSONString(req));
+        } catch (Exception e) {
+            throw new RuntimeException(e);
+        }
+        System.out.println("=====resp=====");
+        System.out.println(res);
+    }
+
+}

+ 5 - 9
feifan-module-pay/feifan-module-pay-biz/src/main/java/cn/newfeifan/mall/module/pay/dal/dataobject/order/PayOrderDO.java

@@ -38,19 +38,16 @@ public class PayOrderDO extends BaseDO {
 
     /**
      * 应用编号
-     *
      * 关联 {@link PayAppDO#getId()}
      */
     private Long appId;
     /**
      * 渠道编号
-     *
      * 关联 {@link PayChannelDO#getId()}
      */
     private Long channelId;
     /**
      * 渠道编码
-     *
      * 枚举 {@link PayChannelEnum}
      */
     private String channelCode;
@@ -59,7 +56,6 @@ public class PayOrderDO extends BaseDO {
 
     /**
      * 商户订单编号
-     *
      * 例如说,内部系统 A 的订单号,需要保证每个 PayAppDO 唯一
      */
     private String merchantOrderId;
@@ -84,7 +80,6 @@ public class PayOrderDO extends BaseDO {
     private Integer price;
     /**
      * 渠道手续费,单位:百分比
-     *
      * 冗余 {@link PayChannelDO#getFeeRate()}
      */
     private Double channelFeeRate;
@@ -94,7 +89,6 @@ public class PayOrderDO extends BaseDO {
     private Integer channelFeePrice;
     /**
      * 支付状态
-     *
      * 枚举 {@link PayOrderStatusEnum}
      */
     private Integer status;
@@ -112,13 +106,11 @@ public class PayOrderDO extends BaseDO {
     private LocalDateTime successTime;
     /**
      * 支付成功的订单拓展单编号
-     *
      * 关联 {@link PayOrderExtensionDO#getId()}
      */
     private Long extensionId;
     /**
      * 支付成功的外部订单号
-     *
      * 关联 {@link PayOrderExtensionDO#getNo()}
      */
     private String no;
@@ -132,7 +124,6 @@ public class PayOrderDO extends BaseDO {
     // ========== 渠道相关字段 ==========
     /**
      * 渠道用户编号
-     *
      * 例如说,微信 openid、支付宝账号
      */
     private String channelUserId;
@@ -141,4 +132,9 @@ public class PayOrderDO extends BaseDO {
      */
     private String channelOrderNo;
 
+    /**
+     * 支付订单号
+     */
+    private String payOrderNo;
+
 }

+ 36 - 0
feifan-module-pay/feifan-module-pay-biz/src/main/java/cn/newfeifan/mall/module/pay/fuiou/client/CommonQueryClient.java

@@ -0,0 +1,36 @@
+package cn.newfeifan.mall.module.pay.fuiou.client;
+
+import com.alibaba.fastjson.JSON;
+import cn.newfeifan.mall.module.pay.fuiou.reqdata.CommonQueryDataReq;
+import cn.newfeifan.mall.module.pay.fuiou.util.FuiouHttpPoster;
+import cn.newfeifan.mall.module.pay.fuiou.util.MD5;
+
+/**
+ * 2.3 订单查询接口
+ * @author user
+ *
+ */
+public class CommonQueryClient {
+	
+	public static String mchnt_key = "4e092f20607e11e71d2214ad47a356fa";
+	public static void main(String[] args) throws Exception {
+		FuiouHttpPoster http = new FuiouHttpPoster();
+		http.setCharset("utf-8");
+		http.setUrl("http://192.168.8.45:45002/aggregatePay/commonQuery");
+		CommonQueryDataReq req=new CommonQueryDataReq();
+		req.setVersion("1.0");
+		req.setMchnt_cd("0002900F0370586");
+		req.setRandom_str("201707041112123456");
+		req.setOrder_type("WECHAT");
+		req.setMchnt_order_no("100000000000004");
+		req.setTerm_id("ab123456");
+		String data = MD5.MD5Encode(req.getMchnt_cd() + "|" + req.getOrder_type() + "|" + 
+				req.getMchnt_order_no() + "|" + req.getTerm_id() + "|" + req.getRandom_str() + "|" + 
+				req.getVersion() + "|" + mchnt_key);
+		req.setSign(data);
+		String res = http.newPost(JSON.toJSONString(req));
+		System.out.println("====resp====\n");
+		System.out.println(res);
+	}
+
+}

+ 35 - 0
feifan-module-pay/feifan-module-pay-biz/src/main/java/cn/newfeifan/mall/module/pay/fuiou/client/GetMchntKeyClient.java

@@ -0,0 +1,35 @@
+package cn.newfeifan.mall.module.pay.fuiou.client;
+
+
+import com.alibaba.fastjson.JSON;
+import cn.newfeifan.mall.module.pay.fuiou.reqdata.GetMchntKeyDataReq;
+import cn.newfeifan.mall.module.pay.fuiou.util.FuiouHttpPoster;
+import cn.newfeifan.mall.module.pay.fuiou.util.MD5;
+
+/**
+ * 
+ * 2.11 商户获取密钥
+ * @history 2017年7月17日  创建GetMchntKeyClient.java
+ * 
+ * @version 0.1.0
+ */
+public class GetMchntKeyClient {
+	
+	 private static String privateKey = "MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBAJgAzD8fEvBHQTyxUEeK963mjziMWG7nxpi+pDMdtWiakc6xVhhbaipLaHo4wVI92A2wr3ptGQ1/YsASEHm3m2wGOpT2vrb2Ln/S7lz1ShjTKaT8U6rKgCdpQNHUuLhBQlpJer2mcYEzG/nGzcyalOCgXC/6CySiJCWJmPyR45bJAgMBAAECgYBHFfBvAKBBwIEQ2jeaDbKBIFcQcgoVa81jt5xgz178WXUg/awu3emLeBKXPh2i0YtN87hM/+J8fnt3KbuMwMItCsTD72XFXLM4FgzJ4555CUCXBf5/tcKpS2xT8qV8QDr8oLKA18sQxWp8BMPrNp0epmwun/gwgxoyQrJUB5YgZQJBAOiVXHiTnc3KwvIkdOEPmlfePFnkD4zzcv2UwTlHWgCyM/L8SCAFclXmSiJfKSZZS7o0kIeJJ6xe3Mf4/HSlhdMCQQCnTow+TnlEhDTPtWa+TUgzOys83Q/VLikqKmDzkWJ7I12+WX6AbxxEHLD+THn0JGrlvzTEIZyCe0sjQy4LzQNzAkEAr2SjfVJkuGJlrNENSwPHMugmvusbRwH3/38ET7udBdVdE6poga1Z0al+0njMwVypnNwy+eLWhkhrWmpLh3OjfQJAI3BV8JS6xzKh5SVtn/3Kv19XJ0tEIUnn2lCjvLQdAixZnQpj61ydxie1rggRBQ/5vLSlvq3H8zOelNeUF1fT1QJADNo+tkHVXLY9H2kdWFoYTvuLexHAgrsnHxONOlSA5hcVLd1B3p9utOt3QeDf6x2i1lqhTH2w8gzjvsnx13tWqg==";
+	
+	 public static void main(String[] args) throws Exception {
+		FuiouHttpPoster http = new FuiouHttpPoster();
+		http.setCharset("utf-8");
+		http.setUrl("http://192.168.8.45:45002/aggregatePay/getMchntKey");
+		GetMchntKeyDataReq  req = new GetMchntKeyDataReq();
+		req.setTerm_id("88888888");
+		req.setMchnt_cd("0002900F0370586");
+		StringBuilder sb = new StringBuilder();
+		sb.append(req.getMchnt_cd().trim()).append("|")
+		.append(req.getTerm_id()).append("|")
+		.append(privateKey);
+		req.setSign(MD5.MD5Encode(sb.toString()));
+		String res = http.newPost(JSON.toJSONString(req));
+		System.out.println(res);
+	}
+}

+ 49 - 0
feifan-module-pay/feifan-module-pay-biz/src/main/java/cn/newfeifan/mall/module/pay/fuiou/client/MicroPayClient.java

@@ -0,0 +1,49 @@
+package cn.newfeifan.mall.module.pay.fuiou.client;
+
+import cn.newfeifan.mall.module.pay.fuiou.util.DateUtils;
+import com.alibaba.fastjson.JSON;
+import cn.newfeifan.mall.module.pay.fuiou.reqdata.MicroPayDataReq;
+import cn.newfeifan.mall.module.pay.fuiou.util.FuiouHttpPoster;
+import cn.newfeifan.mall.module.pay.fuiou.util.MD5;
+
+/**
+ * 类功能描述
+ * MicroPayClient.java
+ * 2.2 条码支付
+ * 
+ * @author user
+ * @version 0.1.0
+ */
+public class MicroPayClient {
+
+	public static String privateKey = "f00dac5077ea11e754e14c9541bc0170";
+	
+	public static void main(String[] args) throws Exception {
+		FuiouHttpPoster http = new FuiouHttpPoster();
+		http.setCharset("utf-8");
+		http.setUrl("http://192.168.8.45:45002/aggregatePay/micropay");
+		MicroPayDataReq req = new MicroPayDataReq();
+		req.setVersion("1.0");
+		req.setMchnt_cd("0002900F0313432");
+		req.setRandom_str("201707140000015");
+		req.setOrder_type("ALIPAY");
+		req.setOrder_amt("1");
+		req.setMchnt_order_no("200000000000006");//不能重复
+		req.setTxn_begin_ts(DateUtils.getCurrentDateTime());
+		req.setGoods_des("测试");
+		req.setTerm_id("88888888");
+		req.setTerm_ip("192.168.8.8");
+		req.setAuth_code("4545465465");
+		req.setAddn_inf("hyjfservice18217072673");
+		StringBuilder sb = new StringBuilder();
+		sb.append(req.getMchnt_cd()).append("|").append(req.getOrder_type()).append("|")
+				.append(req.getOrder_amt()).append("|").append(req.getMchnt_order_no()).append("|")
+				.append(req.getTxn_begin_ts()).append("|").append(req.getGoods_des()).append("|").append(req.getTerm_id())
+				.append("|").append(req.getTerm_ip()).append("|" + req.getAuth_code()).append("|").append(req.getRandom_str())
+				.append("|").append(req.getVersion()).append("|").append(privateKey);
+		System.out.println("请求sign:" + sb.toString());
+		req.setSign(MD5.MD5Encode(sb.toString(), "UTF-8"));
+		String res = http.newPost(JSON.toJSONString(req));
+		System.out.println(res);
+	}
+}

+ 57 - 0
feifan-module-pay/feifan-module-pay-biz/src/main/java/cn/newfeifan/mall/module/pay/fuiou/client/PreCreateClient.java

@@ -0,0 +1,57 @@
+package cn.newfeifan.mall.module.pay.fuiou.client;
+
+
+import cn.newfeifan.mall.module.pay.fuiou.util.DateUtils;
+import com.alibaba.fastjson.JSON;
+import cn.newfeifan.mall.module.pay.fuiou.reqdata.PreCreateDataReq;
+import cn.newfeifan.mall.module.pay.fuiou.util.FuiouHttpPoster;
+import cn.newfeifan.mall.module.pay.fuiou.util.MD5;
+
+/**
+ * 
+ * 2.1 统一下单
+ * PreCreateClient.java
+ *
+ * @history 2017年7月17日  创建PreCreateClient.java
+ * 
+ * @version 0.1.0
+ */
+public class PreCreateClient {
+	
+    public static String privateKey = "4e092f20607e11e71d2214ad47a356fa";
+    
+	public static void main(String[] args) throws Exception {
+		FuiouHttpPoster http = new FuiouHttpPoster();
+		http.setCharset("utf-8");
+		http.setUrl("http://192.168.8.45:45002/aggregatePay/preCreate");
+		PreCreateDataReq  req = new PreCreateDataReq();
+		req.setTerm_id("88888888");
+		req.setTerm_ip("192.168.8.8");
+		req.setRandom_str("20170714000006");//随机字符串
+		req.setMchnt_cd("0002900F0370586");
+		req.setOrder_type("QQ");
+		req.setOrder_amt("1");
+		req.setGoods_des("测试订单1");
+		req.setMchnt_order_no("2017082910000000890003");//不能重复
+		req.setTxn_begin_ts(DateUtils.getCurrentDateTime());//交易开始时间
+		req.setNotify_url("wwww.baidu.com");
+		req.setVersion("1.0");
+		StringBuilder sb = new StringBuilder();
+		sb.append(req.getMchnt_cd().trim()).append("|")
+		.append(req.getOrder_type().trim()).append("|")
+		.append(req.getOrder_amt().trim()).append("|")
+		.append(req.getMchnt_order_no().trim()).append("|")
+		.append(req.getTxn_begin_ts()).append("|")
+		.append(req.getGoods_des()).append("|")
+		.append(req.getTerm_id()).append("|")
+		.append(req.getTerm_ip()).append("|")
+		.append(req.getNotify_url()).append("|")
+		.append(req.getRandom_str()).append("|")
+		.append(req.getVersion()).append("|")
+		.append(privateKey);
+		req.setSign(MD5.MD5Encode(sb.toString()));
+		String res = http.newPost(JSON.toJSONString(req));
+		System.out.println(res);
+		
+	}
+}

+ 34 - 0
feifan-module-pay/feifan-module-pay-biz/src/main/java/cn/newfeifan/mall/module/pay/fuiou/client/QueryChnlPayAmtClient.java

@@ -0,0 +1,34 @@
+package cn.newfeifan.mall.module.pay.fuiou.client;
+
+import com.alibaba.fastjson.JSON;
+import cn.newfeifan.mall.module.pay.fuiou.reqdata.QueryChnlPayAmtDataReq;
+import cn.newfeifan.mall.module.pay.fuiou.util.FuiouHttpPoster;
+import cn.newfeifan.mall.module.pay.fuiou.util.MD5;
+
+/**
+ * 2.10 资金划拨查询
+ * @author user
+ *
+ */
+public class QueryChnlPayAmtClient {
+	
+	public static String mchnt_key = "4e092f20607e11e71d2214ad47a356fa";
+	public static void main(String[] args) throws Exception {
+		FuiouHttpPoster http = new FuiouHttpPoster();
+		http.setCharset("utf-8");
+		http.setUrl("http://192.168.8.45:45002/aggregatePay/queryChnlPayAmt");
+		QueryChnlPayAmtDataReq req=new QueryChnlPayAmtDataReq();
+		req.setMchnt_cd("0002900F0370586");
+		req.setStart_date("20170704");
+		req.setEnd_date("20170704");
+		req.setStart_index("1");
+		req.setEnd_index("2");
+		req.setRandom_str("201707041112123456");
+		String data =  MD5.MD5Encode(req.getMchnt_cd() + "|" + req.getStart_date() + "|" + req.getEnd_date() + "|" + 
+				req.getStart_index() + "|" + req.getEnd_index() + "|" + req.getRandom_str() + "|" + mchnt_key);
+		req.setSign(data);
+		String res = http.newPost(JSON.toJSONString(req));
+		System.out.println(res);
+	}
+
+}

+ 32 - 0
feifan-module-pay/feifan-module-pay-biz/src/main/java/cn/newfeifan/mall/module/pay/fuiou/client/QueryFeeAmtClient.java

@@ -0,0 +1,32 @@
+package cn.newfeifan.mall.module.pay.fuiou.client;
+
+import cn.newfeifan.mall.module.pay.fuiou.util.FuiouHttpPoster;
+import cn.newfeifan.mall.module.pay.fuiou.util.MD5;
+import com.alibaba.fastjson.JSON;
+import cn.newfeifan.mall.module.pay.fuiou.reqdata.QueryFeeAmtDataReq;
+
+/**
+ * 类功能描述
+ * QueryFeeAmtClient.java
+ * 2.8 查询提现手续费
+ * 
+ * @author user
+ * @version 0.1.0
+ */
+public class QueryFeeAmtClient {
+
+	public static String privateKey = "4e092f20607e11e71d2214ad47a356fa";
+	
+	public static void main(String[] args) throws Exception {
+		FuiouHttpPoster http = new FuiouHttpPoster();
+		http.setCharset("utf-8");
+		http.setUrl("http://192.168.8.45:45002/aggregatePay/queryFeeAmt");
+		QueryFeeAmtDataReq req = new QueryFeeAmtDataReq();
+		req.setMchnt_cd("0002900F0370586");
+		req.setRandom_str("123456");
+		req.setAmt("200000");
+		req.setSign(MD5.MD5Encode(req.getMchnt_cd() + "|" + req.getAmt() + "|" + req.getRandom_str() + "|" + privateKey, "UTF-8"));
+		String res = http.newPost(JSON.toJSONString(req));
+		System.out.println(res);
+	}
+}

+ 31 - 0
feifan-module-pay/feifan-module-pay-biz/src/main/java/cn/newfeifan/mall/module/pay/fuiou/client/QueryWithdrawAmtClient.java

@@ -0,0 +1,31 @@
+package cn.newfeifan.mall.module.pay.fuiou.client;
+
+import cn.newfeifan.mall.module.pay.fuiou.util.FuiouHttpPoster;
+import cn.newfeifan.mall.module.pay.fuiou.util.MD5;
+import com.alibaba.fastjson.JSON;
+import cn.newfeifan.mall.module.pay.fuiou.reqdata.QueryWithdrawAmtDataReq;
+
+/**
+ * 类功能描述
+ * QueryWithdrawAmtClient.java
+ * 2.7 查询可提现资金
+ * 
+ * @author user
+ * @version 0.1.0
+ */
+public class QueryWithdrawAmtClient {
+
+	public static String privateKey = "4e092f20607e11e71d2214ad47a356fa";
+	
+	public static void main(String[] args) throws Exception {
+		FuiouHttpPoster http = new FuiouHttpPoster();
+		http.setCharset("utf-8");
+		http.setUrl("http://192.168.8.45:45002/aggregatePay/queryWithdrawAmt");
+		QueryWithdrawAmtDataReq req = new QueryWithdrawAmtDataReq();
+		req.setMchnt_cd("0002900F0370586");
+		req.setRandom_str("123456");
+		req.setSign(MD5.MD5Encode(req.getMchnt_cd() + "|" + req.getRandom_str() + "|" + privateKey, "UTF-8"));
+		String res = http.newPost(JSON.toJSONString(req));
+		System.out.println(res);
+	}
+}

+ 45 - 0
feifan-module-pay/feifan-module-pay-biz/src/main/java/cn/newfeifan/mall/module/pay/fuiou/client/RefundClient.java

@@ -0,0 +1,45 @@
+package cn.newfeifan.mall.module.pay.fuiou.client;
+
+import cn.newfeifan.mall.module.pay.fuiou.util.FuiouHttpPoster;
+import cn.newfeifan.mall.module.pay.fuiou.util.MD5;
+import com.alibaba.fastjson.JSON;
+import cn.newfeifan.mall.module.pay.fuiou.reqdata.RefundDataReq;
+
+/**
+ * 类功能描述
+ * RefundClient.java
+ * 2.4 退款
+ * 
+ * @author user
+ * @version 0.1.0
+ */
+public class RefundClient {
+
+	public static String privateKey = "4e092f20607e11e71d2214ad47a356fa";
+	
+	public static void main(String[] args) throws Exception {
+		FuiouHttpPoster http = new FuiouHttpPoster();
+		http.setCharset("utf-8");
+		http.setUrl("http://192.168.8.45:45002/aggregatePay/commonRefund");
+		RefundDataReq req = new RefundDataReq();
+		req.setVersion("1.0");
+		req.setMchnt_cd("0002900F0370586");
+		req.setTerm_id("0a1b0000");
+		req.setRandom_str("123456");
+		req.setMchnt_order_no("100000000000005");
+		req.setRefund_order_no("10000000006");
+		req.setOrder_type("WECHAT");
+		req.setTotal_amt("1");
+		req.setRefund_amt("1");
+		StringBuilder sb = new StringBuilder();
+		sb.append(req.getMchnt_cd()).append("|").append(req.getOrder_type()).append("|")
+		.append(req.getMchnt_order_no()).append("|").append(req.getRefund_order_no())
+		.append("|").append(req.getTotal_amt()).append("|").append(req.getRefund_amt())
+		.append("|").append(req.getTerm_id()).append("|").append(req.getRandom_str())
+		.append("|").append(req.getVersion()).append("|").append(privateKey);
+		System.out.println("请求sign:"+ sb.toString());
+		req.setSign(MD5.MD5Encode(sb.toString(), "UTF-8"));
+		String res = http.newPost(JSON.toJSONString(req));
+		System.out.println(res);
+	}
+}

+ 59 - 0
feifan-module-pay/feifan-module-pay-biz/src/main/java/cn/newfeifan/mall/module/pay/fuiou/client/WapPreCreateClient.java

@@ -0,0 +1,59 @@
+package cn.newfeifan.mall.module.pay.fuiou.client;
+
+import cn.newfeifan.mall.module.pay.fuiou.util.DateUtils;
+import cn.newfeifan.mall.module.pay.fuiou.util.FuiouHttpPoster;
+import cn.newfeifan.mall.module.pay.fuiou.util.MD5;
+import com.alibaba.fastjson.JSON;
+import cn.newfeifan.mall.module.pay.fuiou.reqdata.WapPreCreateDataReq;
+import cn.newfeifan.mall.module.pay.fuiou.reqdata.WebPreCreateDeviceInfo;
+
+/**
+ * 类功能描述
+ * WapPreCreateClient.java
+ * 2.12 扫码wap/app下单
+ * 
+ * @author user
+ * @version 0.1.0
+ */
+public class WapPreCreateClient {
+
+	public static String privateKey = "4e092f20607e11e71d2214ad47a356fa";
+	
+	public static void main(String[] args) throws Exception {
+		FuiouHttpPoster http = new FuiouHttpPoster();
+		http.setCharset("utf-8");
+		http.setUrl("http://192.168.8.45:45002/aggregatePay/wapPreCreate");
+		WapPreCreateDataReq req = new WapPreCreateDataReq();
+		req.setVersion("1.0");
+		req.setMchnt_cd("0002900F0370586");
+		req.setRandom_str("123456");
+		req.setOrder_type("ALIPAY");
+		req.setMchnt_order_no("10000000014");//不能重复
+		req.setOrder_amt("1");
+		req.setTxn_begin_ts(DateUtils.getCurrentDateTime());
+		req.setGoods_des("测试");
+		req.setTerm_id("0a1b0000");
+		req.setTerm_ip("192");
+		req.setTrade_type("H5");
+		
+		// H5 支付场景信息必填!
+		WebPreCreateDeviceInfo info = new WebPreCreateDeviceInfo();
+		info.setType("Wap");
+		info.setApp_name("淘宝");
+		info.setApp_url("www.taobao.com");
+		req.setReserved_device_info(JSON.toJSONString(info));
+		
+		req.setNotify_url("http://www.baidu.com");
+		StringBuilder sb = new StringBuilder();
+		sb.append(req.getMchnt_cd()).append("|").append(req.getOrder_type()).append("|")
+		.append(req.getTrade_type()).append("|").append(req.getOrder_amt()).append("|")
+		.append(req.getMchnt_order_no()).append("|").append(req.getTxn_begin_ts())
+		.append("|").append(req.getGoods_des()).append("|").append(req.getTerm_id())
+		.append("|").append(req.getTerm_ip()).append("|").append(req.getNotify_url())
+		.append("|").append(req.getRandom_str()).append("|" + req.getVersion()).append("|").append(privateKey);
+		System.out.println("请求sign:" + sb.toString());
+		req.setSign(MD5.MD5Encode(sb.toString(), "UTF-8"));
+		String res = http.newPost(JSON.toJSONString(req));
+		System.out.println(res);
+	}
+}

+ 33 - 0
feifan-module-pay/feifan-module-pay-biz/src/main/java/cn/newfeifan/mall/module/pay/fuiou/client/WithdrawClient.java

@@ -0,0 +1,33 @@
+package cn.newfeifan.mall.module.pay.fuiou.client;
+
+import cn.newfeifan.mall.module.pay.fuiou.reqdata.WithdrawDataReq;
+import cn.newfeifan.mall.module.pay.fuiou.util.FuiouHttpPoster;
+import cn.newfeifan.mall.module.pay.fuiou.util.MD5;
+import com.alibaba.fastjson.JSON;
+
+/**
+ * 2.9 发起提现
+ * @author user
+ *
+ */
+public class WithdrawClient {
+	
+	public static String mchnt_key = "4e092f20607e11e71d2214ad47a356fa";
+	public static void main(String[] args) throws Exception {
+		FuiouHttpPoster http = new FuiouHttpPoster();
+		http.setCharset("utf-8");
+		http.setUrl("http://192.168.8.45:45002/aggregatePay/withdraw");
+		WithdrawDataReq req=new WithdrawDataReq();
+		req.setMchnt_cd("0002900F0370586");
+		req.setAmt("100");
+		req.setFee_amt("1");
+		req.setTxn_type("2");
+		req.setRandom_str("201707041112123456");
+		String data = MD5.MD5Encode(req.getMchnt_cd() + "|" + req.getAmt() + "|" + req.getFee_amt() + "|" +
+				req.getTxn_type() + "|" + req.getRandom_str() + "|" + mchnt_key);
+		req.setSign(data);
+		String res = http.newPost(JSON.toJSONString(req));
+		System.out.println(res);
+	}
+
+}

+ 61 - 0
feifan-module-pay/feifan-module-pay-biz/src/main/java/cn/newfeifan/mall/module/pay/fuiou/client/WxPreCreateClient.java

@@ -0,0 +1,61 @@
+package cn.newfeifan.mall.module.pay.fuiou.client;
+
+
+import cn.newfeifan.mall.module.pay.fuiou.reqdata.WxPreCreateDataReq;
+import cn.newfeifan.mall.module.pay.fuiou.util.DateUtils;
+import cn.newfeifan.mall.module.pay.fuiou.util.FuiouHttpPoster;
+import cn.newfeifan.mall.module.pay.fuiou.util.MD5;
+import com.alibaba.fastjson.JSON;
+
+/**
+ * 
+ *2.6 公众号或服务窗下单
+ * WxPreCreateClient.java
+ *
+ * @history 2017年7月17日  创建WxPreCreateClient.java
+ * 
+ * @version 0.1.0
+ */
+public class WxPreCreateClient {
+	
+//    public static String privateKey = "4e092f20607e11e71d2214ad47a356fa";
+    public static String privateKey = "b58ef4203dbe11ef3effcedc419c26ae";
+
+	public static void main(String[] args) throws Exception {
+		FuiouHttpPoster http = new FuiouHttpPoster();
+		http.setCharset("utf-8");
+		http.setUrl("http://192.168.8.45:45002/aggregatePay/wxPreCreate");
+		WxPreCreateDataReq req = new WxPreCreateDataReq();
+		req.setTerm_id("88888888");
+		req.setTerm_ip("192.168.8.8");
+		req.setRandom_str(DateUtils.getCurrentDate("yyyyMMddHHmmss")
+					+ "568974");
+		req.setMchnt_cd("0002900F0370586");
+		req.setTrade_type("FWC");
+		req.setOpenid("oDax96l0bZdXqRQ2uVfn_2LV-DxM");//微信支付此字段必填
+//		req.setSub_openid("221122121");//支付宝支付此字段必填
+		req.setOrder_amt("1");
+		req.setGoods_des("测试订单");
+		req.setMchnt_order_no("201707191000000000011");//不能重复
+		req.setTxn_begin_ts(DateUtils.getCurrentDate("yyyyMMddHHmmss"));
+		req.setNotify_url("wwww.baidu.com");
+		req.setVersion("1.0");
+		StringBuilder sb = new StringBuilder();
+		sb.append(req.getMchnt_cd().trim()).append("|")
+		.append(req.getTrade_type().trim()).append("|")
+		.append(req.getOrder_amt().trim()).append("|")
+		.append(req.getMchnt_order_no().trim()).append("|")
+		.append(req.getTxn_begin_ts()).append("|")
+		.append(req.getGoods_des()).append("|")
+		.append(req.getTerm_id()).append("|")
+		.append(req.getTerm_ip()).append("|")
+		.append(req.getNotify_url()).append("|")
+		.append(req.getRandom_str()).append("|")
+		.append(req.getVersion()).append("|")
+		.append(privateKey);
+		req.setSign(MD5.MD5Encode(sb.toString()));
+		String res = http.newPost(JSON.toJSONString(req));
+		System.out.println("=====resp=====");
+		System.out.println(res);
+	}
+}

+ 27 - 0
feifan-module-pay/feifan-module-pay-biz/src/main/java/cn/newfeifan/mall/module/pay/fuiou/reqdata/CommonQueryDataReq.java

@@ -0,0 +1,27 @@
+package cn.newfeifan.mall.module.pay.fuiou.reqdata;
+
+import lombok.Getter;
+import lombok.Setter;
+
+@Setter
+@Getter
+public class CommonQueryDataReq {
+	
+    private String version;
+	
+    private String mchnt_cd;
+	
+	private String random_str;
+	
+    private String order_type;
+	
+    private String mchnt_order_no;
+	
+	private String term_id;
+	
+	private String sign;
+	
+    private String ins_cd;
+
+
+}

+ 18 - 0
feifan-module-pay/feifan-module-pay-biz/src/main/java/cn/newfeifan/mall/module/pay/fuiou/reqdata/GetMchntKeyDataReq.java

@@ -0,0 +1,18 @@
+package cn.newfeifan.mall.module.pay.fuiou.reqdata;
+
+
+import lombok.Getter;
+import lombok.Setter;
+
+@Setter
+@Getter
+public class GetMchntKeyDataReq {
+	
+	private String mchnt_cd;
+	
+	private String term_id = "";
+	
+	private String sign;
+
+
+}

+ 13 - 0
feifan-module-pay/feifan-module-pay-biz/src/main/java/cn/newfeifan/mall/module/pay/fuiou/reqdata/GetOpenIdReq.java

@@ -0,0 +1,13 @@
+package cn.newfeifan.mall.module.pay.fuiou.reqdata;
+
+import lombok.Data;
+
+@Data
+public class GetOpenIdReq {
+
+    private String mchnt_cd;
+
+    private String redirect_uri;
+
+    private String sign;
+}

+ 54 - 0
feifan-module-pay/feifan-module-pay-biz/src/main/java/cn/newfeifan/mall/module/pay/fuiou/reqdata/MicroPayDataReq.java

@@ -0,0 +1,54 @@
+package cn.newfeifan.mall.module.pay.fuiou.reqdata;
+
+import lombok.Getter;
+import lombok.Setter;
+
+@Setter
+@Getter
+public class MicroPayDataReq {
+
+    private String version = "";
+	
+	private String mchnt_cd = "";
+	
+	private String random_str = "";
+	
+	private String order_type = "";
+	
+	private String order_amt = "";
+	
+	private String mchnt_order_no = "";
+	
+	private String txn_begin_ts = "";
+	
+	private String goods_des = "";
+	
+	private String goods_detail = "";
+	
+	private String goods_tag = "";
+	
+	private String term_id = "";
+	
+	private String term_ip = "";
+	
+	private String addn_inf = "";
+	
+	private String curr_type = "";
+	
+	private String auth_code = "";
+	
+	private String sence = "";
+	
+	private String sign;
+	
+	private String reserved_sub_appid;
+	
+	private String reserved_limit_pay;
+	
+	private String reserved_expire_minute = "0";
+	
+	private String reserved_fy_term_id;
+	
+	private String ins_cd = "";
+
+}

+ 78 - 0
feifan-module-pay/feifan-module-pay-biz/src/main/java/cn/newfeifan/mall/module/pay/fuiou/reqdata/PreCreateDataReq.java

@@ -0,0 +1,78 @@
+package cn.newfeifan.mall.module.pay.fuiou.reqdata;
+
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+  *实体类
+  时间2017-05-24 10:36:46
+*/
+
+@Setter
+@Getter
+public class PreCreateDataReq {
+	
+	
+	private String addn_inf = "";
+
+	
+	private String curr_type = "CNY";
+	
+	
+	private String goods_des = "";
+	
+
+	private String goods_detail = "";
+	
+	
+	private String goods_tag = "";
+	
+	
+	
+	private String mchnt_cd = "";
+	
+	
+	private String mchnt_order_no;
+	
+
+	private String notify_url = "";
+	
+	
+	private String order_amt = "";
+	
+
+	private String order_type = "";
+	
+
+	private String random_str = "";
+	
+
+	private String reserved_expire_minute = "0";
+	
+	
+	private String reserved_fy_term_id = "";
+	
+
+	private String reserved_limit_pay = "";
+	
+
+	private String reserved_sub_appid = "";
+	
+	
+	private String sign = "";
+	
+
+	private String term_id = "";
+	
+
+	private String term_ip = "";
+	
+	
+	private String txn_begin_ts = "";
+	
+	
+    private String version = "";
+
+
+}

+ 28 - 0
feifan-module-pay/feifan-module-pay-biz/src/main/java/cn/newfeifan/mall/module/pay/fuiou/reqdata/QueryChnlPayAmtDataReq.java

@@ -0,0 +1,28 @@
+package cn.newfeifan.mall.module.pay.fuiou.reqdata;
+
+
+import lombok.Getter;
+import lombok.Setter;
+
+@Setter
+@Getter
+public class QueryChnlPayAmtDataReq {
+	
+    private String mchnt_cd;
+	
+    private String Start_date;
+	
+    private String End_date;
+	
+	private String Start_index;
+	
+	private String End_index;
+	
+	private String random_str;
+	
+	private String sign;
+	
+    private String ins_cd;
+
+
+}

+ 18 - 0
feifan-module-pay/feifan-module-pay-biz/src/main/java/cn/newfeifan/mall/module/pay/fuiou/reqdata/QueryFeeAmtDataReq.java

@@ -0,0 +1,18 @@
+package cn.newfeifan.mall.module.pay.fuiou.reqdata;
+
+import lombok.Data;
+
+@Data
+public class QueryFeeAmtDataReq {
+	
+	private String ins_cd = "";
+	
+	private String mchnt_cd = "";
+	
+	private String random_str = "";
+	
+	private String sign;
+	
+	private String amt = "";
+
+}

+ 19 - 0
feifan-module-pay/feifan-module-pay-biz/src/main/java/cn/newfeifan/mall/module/pay/fuiou/reqdata/QueryWithdrawAmtDataReq.java

@@ -0,0 +1,19 @@
+package cn.newfeifan.mall.module.pay.fuiou.reqdata;
+
+import lombok.Getter;
+import lombok.Setter;
+
+@Setter
+@Getter
+public class QueryWithdrawAmtDataReq {
+
+
+	private String mchnt_cd = "";
+	
+	private String random_str = "";
+	
+	private String sign;
+	
+	private String ins_cd = "";
+
+}

+ 34 - 0
feifan-module-pay/feifan-module-pay-biz/src/main/java/cn/newfeifan/mall/module/pay/fuiou/reqdata/RefundDataReq.java

@@ -0,0 +1,34 @@
+package cn.newfeifan.mall.module.pay.fuiou.reqdata;
+
+import lombok.Data;
+
+@Data
+public class RefundDataReq {
+
+    private String version = "";
+	
+	private String mchnt_cd = "";
+	
+	private String term_id = "";
+	
+	private String random_str = "";
+	
+	private String mchnt_order_no = "";
+	
+	private String refund_order_no = "";
+	
+	private String order_type = "";
+	
+	private String total_amt = "";
+	
+	private String refund_amt = "";
+	
+	private String operator_id = "";
+	
+	private String reserved_fy_term_id;
+	
+	private String sign;
+	
+	private String ins_cd = "";
+
+}

+ 63 - 0
feifan-module-pay/feifan-module-pay-biz/src/main/java/cn/newfeifan/mall/module/pay/fuiou/reqdata/WapPreCreateDataReq.java

@@ -0,0 +1,63 @@
+package cn.newfeifan.mall.module.pay.fuiou.reqdata;
+
+import lombok.Getter;
+import lombok.Setter;
+
+@Setter
+@Getter
+public class WapPreCreateDataReq {
+
+	private String addn_inf = "";
+
+	private String curr_type = "";
+	
+	private String order_type;
+	
+	private String goods_des = "";
+	
+	private String goods_detail = "";
+	
+	private String goods_tag = "";
+	
+    private String ins_cd;
+	
+	private String limit_pay = "";
+	
+	private String mchnt_cd;
+	
+	private String mchnt_order_no;
+	
+	private String notify_url;
+	
+	private String order_amt;
+	
+	private String openid = "";
+	
+	private String product_id = "";
+	
+	private String random_str = "";
+	
+	private String sign;
+	
+	private String sub_openid = "";
+	
+	private String sub_appid = "";
+	
+	private String term_id = "";
+	
+	private String term_ip = "";
+	
+	private String txn_begin_ts;
+	
+	private String trade_type;
+	
+    private String version = "1.0";
+	
+	private String reserved_fy_term_id;
+	
+	private String reserved_expire_minute;
+	
+	private String reserved_device_info;
+
+
+}

+ 26 - 0
feifan-module-pay/feifan-module-pay-biz/src/main/java/cn/newfeifan/mall/module/pay/fuiou/reqdata/WebPreCreateDeviceInfo.java

@@ -0,0 +1,26 @@
+package cn.newfeifan.mall.module.pay.fuiou.reqdata;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * 类功能描述
+ * WEB/APP下单,支付场景信息
+ * BarCodePayDeviceInfo.java
+ *
+ * @history 2017年7月17日 廖灿 创建BarCodePayDeviceInfo.java
+ * 
+ * @author user
+ * @version 0.1.0
+ */
+@Setter
+@Getter
+public class WebPreCreateDeviceInfo {
+
+	private String type;
+	
+	private String app_name;
+	
+	private String app_url;
+
+}

+ 26 - 0
feifan-module-pay/feifan-module-pay-biz/src/main/java/cn/newfeifan/mall/module/pay/fuiou/reqdata/WithdrawDataReq.java

@@ -0,0 +1,26 @@
+package cn.newfeifan.mall.module.pay.fuiou.reqdata;
+
+
+import lombok.Getter;
+import lombok.Setter;
+
+@Setter
+@Getter
+public class WithdrawDataReq {
+	
+    private String mchnt_cd;
+	
+    private String amt;
+	
+    private String fee_amt;
+	
+	private String txn_type;
+	
+	private String random_str;
+	
+	private String sign;
+	
+    private String ins_cd;
+
+
+}

+ 61 - 0
feifan-module-pay/feifan-module-pay-biz/src/main/java/cn/newfeifan/mall/module/pay/fuiou/reqdata/WxPreCreateDataReq.java

@@ -0,0 +1,61 @@
+package cn.newfeifan.mall.module.pay.fuiou.reqdata;
+
+
+import lombok.Data;
+
+/**
+  *实体类
+  时间2017-05-24 10:36:46
+*/
+@Data
+public class WxPreCreateDataReq {
+	
+	private String addn_inf = "";
+
+	private String curr_type = "";
+	
+	private String order_type;
+	
+	private String goods_des = "";
+	
+	private String goods_detail = "";
+	
+	private String goods_tag = "";
+	
+	private String limit_pay = "";
+	
+	private String mchnt_cd;
+	
+	private String mchnt_order_no;
+	
+	private String notify_url;
+	
+	private String order_amt;
+	
+	private String openid = "";
+	
+	private String product_id = "";
+	
+	private String random_str = "";
+	
+	private String sign;
+	
+	private String sub_openid = "";
+	
+	private String sub_appid = "";
+	
+	private String term_id = "";
+	
+	private String term_ip = "";
+	
+	private String txn_begin_ts;
+	
+	private String trade_type;
+	
+    private String version = "1.0";
+	
+	private String reserved_fy_term_id;
+	
+	private String reserved_expire_minute;
+
+}

+ 19 - 0
feifan-module-pay/feifan-module-pay-biz/src/main/java/cn/newfeifan/mall/module/pay/fuiou/reqvo/SubmitOrderRequestVO.java

@@ -0,0 +1,19 @@
+package cn.newfeifan.mall.module.pay.fuiou.reqvo;
+
+import cn.newfeifan.mall.module.pay.fuiou.reqdata.WxPreCreateDataReq;
+import lombok.Data;
+
+/**
+ * 提交订单请求
+ */
+
+@Data
+public class SubmitOrderRequestVO {
+
+    /*
+     * 支付订单编号
+     */
+    private Long id;
+
+    private WxPreCreateDataReq req;
+}

+ 42 - 0
feifan-module-pay/feifan-module-pay-biz/src/main/java/cn/newfeifan/mall/module/pay/fuiou/respVO/FuYouPayOrderSubmitRespVO.java

@@ -0,0 +1,42 @@
+package cn.newfeifan.mall.module.pay.fuiou.respVO;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Builder;
+import lombok.Data;
+
+@Schema(description = "管理后台 - 富友支付订单提交 Response")
+@Data
+@Builder
+public class FuYouPayOrderSubmitRespVO {
+
+    /**
+     * 公众号id
+     */
+    private String appId;
+
+    /**
+     * 时间戳,自1970年1月1日0点0分0秒以来的秒数
+     */
+    private String timeStamp;
+
+    /**
+     * 随机字符串,不长于32位。
+     */
+    private String nonceStr;
+
+    /**
+     * 订单性情扩展字符串
+     */
+    private String sdk_package;
+
+    /**
+     * 签名方式,trade_type为JSAPI、LETPAY时才返回
+     */
+    private String signType;
+
+    /**
+     * 签名,使用字段appId、timeStamp、nonceStr、package计算得出的签名值
+     */
+    private String paySign;
+
+}

+ 131 - 0
feifan-module-pay/feifan-module-pay-biz/src/main/java/cn/newfeifan/mall/module/pay/fuiou/respVO/FuYouPaymentResponseVO.java

@@ -0,0 +1,131 @@
+package cn.newfeifan.mall.module.pay.fuiou.respVO;
+
+import lombok.Data;
+
+@Data
+public class FuYouPaymentResponseVO {
+    /**
+     * 响应代码
+     */
+    private String result_code;
+
+    /**
+     * 代码描述
+     */
+    private String result_msg;
+
+    /**
+     * 商户号,富友分配的商户号
+     */
+    private String mchnt_cd;
+
+    /**
+     * 终端号
+     */
+    private String term_id;
+
+    /**
+     * 随机字符串
+     */
+    private String random_str	;
+
+    /**
+     * 支付通道对应的子商户识别码
+     */
+    private String sub_mer_id;
+
+    /**
+     * 会话标识,预支付交易会话标识,用于后续接口调用中使用
+     */
+    private String session_id;
+
+    /**
+     * 支付链接(直接重定向调起支付)
+     */
+    private String qr_code;
+
+    /**
+     * 子商户公众号id
+     */
+    private String sub_appid;
+
+    /**
+     * 子商户用户标识
+     */
+    private String sub_openid;
+
+    /**
+     * 微信sdk_appid
+     */
+    private String sdk_appid;
+
+    /**
+     * 微信sdk_timestamp 时间戳
+     */
+    private String sdk_timestamp;
+
+    /**
+     * 微信sdk_noncestr 随机字符串
+     */
+    private String sdk_noncestr;
+
+    /**
+     * 微信扩展订单信息扩展字符串
+     */
+    private String sdk_package;
+
+    /**
+     * 签名方式,trade_type为JSAPI、LETPAY时才返回
+     */
+    private String sdk_signtype;
+
+    /**
+     * 签名
+     */
+    private String sdk_paysign;
+
+    /**
+     * trade_type为APP时才返回
+     */
+    private String sdk_partnerid;
+
+    /**
+     * 富友生成的订单号,需要商户与商户订单号进行关联
+     */
+    private String reserved_fy_order_no;
+
+    /**
+     * 富友清算日
+     */
+    private String reserved_fy_settle_dt;
+
+    /**
+     * 交易流水号,trade_type为FWC时返回
+     */
+    private String reserved_transaction_id;
+
+    /**
+     * 支付追踪号
+     */
+    private String reserved_fy_trace_no;
+
+    /**
+     * 支付不确定参数
+     */
+    private String reserved_pay_info;
+
+    /**
+     * 银行交易号
+     */
+    private String reserved_channel_order_id;
+
+    /**
+     * 附加数据
+     */
+    private String reserved_addn_inf;
+
+    /**
+     * 签名
+     */
+    private String sign;
+}

+ 79 - 0
feifan-module-pay/feifan-module-pay-biz/src/main/java/cn/newfeifan/mall/module/pay/fuiou/util/DateUtils.java

@@ -0,0 +1,79 @@
+package cn.newfeifan.mall.module.pay.fuiou.util;
+
+import java.text.ParsePosition;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+
+
+/**
+ * @description 日期处理工具类
+ * @version 1.0.0
+ *
+ */
+public class DateUtils {
+	/**
+	 * 没有分隔符的日期格式
+	 */
+	public static final String FULL_TIME_WITH_OUT_SEPARATOR = "yyyyMMddHHmmss";
+	/**
+	 * 最为常见的日期格式
+	 */
+	public static final String FULL_TIME_WITH_COMMON_SEPARATOR = "yyyy-MM-dd HH:mm:ss";
+
+	/**
+	 * @description 取得当前日期的String。
+	 * @return String 返回值为日期,格式自定义,需要符合标准,参考Java Doc “SimpleDateFormat”
+	 */
+	public static String getCurrentDate(String aFormat) {
+		String tDate = new SimpleDateFormat(aFormat).format(new java.util.Date(
+				System.currentTimeMillis()));
+		return tDate;
+	}
+
+	/**
+	 * 获得当前时间格式yyyyMMddHHmmss
+	 * @return
+	 */
+	public static String getCurrentDateTime() {
+		return DateUtils.getCurrentDate("yyyyMMddHHmmss");
+	}
+
+	
+
+
+
+
+	
+	/**
+	 * @description 获取当前系统时间
+	 * @return 当前系统时间
+	 */
+	public static Date getNowDate() {
+		Date currentTime = new Date();
+		SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+		String dateString = formatter.format(currentTime);
+		ParsePosition pos = new ParsePosition(0);
+		Date currentTime_2 = formatter.parse(dateString, pos);
+		return currentTime_2;
+	}
+	
+	/**
+	 * @description 按指定格式获取指定时间字符串
+	 * @param date
+	 *            待转换日期
+	 * @param patterns
+	 *            时间格式 e.g yyyy-MM-dd HH:mm:ss
+	 * @return 返回指定格式指定时间字符串
+	 */
+	public static String getDateStr(Date date, String patterns) {
+		if (date == null) {
+			date = new Date();
+		}
+		SimpleDateFormat formatter = new SimpleDateFormat(patterns);
+		String dateString = formatter.format(date);
+		return dateString;
+	}
+	
+	
+}

+ 149 - 0
feifan-module-pay/feifan-module-pay-biz/src/main/java/cn/newfeifan/mall/module/pay/fuiou/util/FuiouHttpPoster.java

@@ -0,0 +1,149 @@
+/**
+ * 
+ */
+package cn.newfeifan.mall.module.pay.fuiou.util;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.UnsupportedEncodingException;
+import java.nio.charset.Charset;
+import java.util.ArrayList;
+import java.util.List;
+
+import lombok.Setter;
+import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.methods.PostMethod;
+import org.apache.commons.httpclient.methods.StringRequestEntity;
+import org.apache.commons.httpclient.params.HttpMethodParams;
+import org.apache.commons.httpclient.protocol.Protocol;
+
+
+/**
+ * @author Administrator
+ * 
+ */
+@Setter
+public class FuiouHttpPoster {
+
+	public FuiouHttpPoster() {
+	}
+
+	private String url;
+
+	private String charset;
+
+	public FuiouHttpPoster(String url, String charset) {
+		super();
+		this.url = url;
+		this.charset = charset;
+	}
+
+	public FuiouHttpPoster(String url) {
+		super();
+		this.url = url;
+		this.charset = Charset.defaultCharset().name();
+	}
+
+	
+	
+	public String newPost(final String body) throws Exception {
+		return post(new PostMethodCallback() {
+
+			@Override
+			public void doInPostMethod(PostMethod postMethod) {
+
+				try {
+					postMethod.setRequestEntity(new StringRequestEntity(body,"application/json","UTF-8"));
+				} catch (UnsupportedEncodingException e) {
+					e.printStackTrace();
+				}
+			}
+		});
+	}
+	
+	
+
+	/**
+	 * 使用http协议发送xmltext到url
+//	 *
+//	 * @param url
+//	 *            将要发送的地址
+//	 * @param xmltext
+//	 *            将要发送的内容
+//	 * @return http返回码
+//	 * @throws LoanException
+//	 * @throws Exception
+	 */
+	private String post(PostMethodCallback callback) throws Exception {
+		PostMethod xmlpost = null;
+		HttpClient httpclient = new HttpClient();
+		try {
+			// https设置
+			if (url.indexOf("https://") != -1) {
+				// 创建SSL连接
+				@SuppressWarnings("deprecation")
+				Protocol myhttps = new Protocol("https",
+						new MySSLSocketFactory(), 443);
+				Protocol.registerProtocol("https", myhttps);
+			}	
+			httpclient.getHttpConnectionManager().getParams().setConnectionTimeout(60 * 1000);
+			httpclient.getHttpConnectionManager().getParams().setSoTimeout(60 * 1000);
+			xmlpost = new PostMethod(url);
+			httpclient.getParams().setParameter(
+					HttpMethodParams.HTTP_CONTENT_CHARSET, charset);
+			httpclient.getParams().setContentCharset(charset);
+			// xmlpost.setRequestHeader("content-type", "text/xml; charset=" +
+			// charset);
+
+			// 内部回调,发送数据,设置参数用
+			callback.doInPostMethod(xmlpost);
+			// 执行请求
+			httpclient.executeMethod(xmlpost);
+
+			// 获取返回信息
+			InputStream ips = xmlpost.getResponseBodyAsStream();
+			List<Byte> byteList = new ArrayList<Byte>();
+
+			int is = 0;
+			while ((is = ips.read()) != -1)
+				byteList.add((byte) is);
+
+			byte[] allb = new byte[byteList.size()];
+			for (int j = 0; j < byteList.size(); j++)
+				allb[j] = byteList.get(j);
+			String responseString = new String(allb, charset);
+			// LogWriter.debug(this, "HTTP返回码=" + responseStatCode);
+			System.out.println("应答数据=" + responseString);
+
+			if (url.indexOf("https://") != -1)
+				Protocol.unregisterProtocol("https");
+			return responseString;
+		} catch (IOException ex2) {
+			ex2.printStackTrace();
+			System.out.println("报文发送到[" + url + "]失败:" + ex2.getMessage());
+			throw new Exception("报文发送异常");
+		} catch (Exception ex) {
+			ex.printStackTrace();
+			System.out.println("报文发送到[" + url + "]失败:" + ex.getMessage());
+			throw new Exception("报文发送异常");
+		} finally {
+			try {
+				if(xmlpost != null)
+					xmlpost.releaseConnection();
+				if(httpclient != null)
+					httpclient.getHttpConnectionManager().closeIdleConnections(0);
+			} catch (Exception e) {
+				e.printStackTrace();
+			}
+		}
+	}
+
+	/**
+	 * PostMethod回调处理
+	 * 
+	 */
+	public interface PostMethodCallback {
+		public void doInPostMethod(PostMethod postMethod);
+	}
+
+}

+ 85 - 0
feifan-module-pay/feifan-module-pay-biz/src/main/java/cn/newfeifan/mall/module/pay/fuiou/util/MD5.java

@@ -0,0 +1,85 @@
+package cn.newfeifan.mall.module.pay.fuiou.util;
+import java.security.MessageDigest;
+
+public class MD5 {
+	private final static String[] hexDigits = { "0", "1", "2", "3", "4", "5",
+			"6", "7", "8", "9", "a", "b", "c", "d", "e", "f" };
+
+	/**
+	 * 转换字节数组为16进制字串
+	 * 
+	 * @param b
+	 *            字节数组
+	 * @return 16进制字串
+	 */
+	public static String byteArrayToHexString(byte[] b) {
+		StringBuffer resultSb = new StringBuffer();
+		for (int i = 0; i < b.length; i++) {
+			resultSb.append(byteToHexString(b[i]));
+		}
+		return resultSb.toString();
+	}
+
+	/**
+	 * J 转换byte到16进制
+	 * 
+	 * @param b
+	 * @return
+	 */
+	private static String byteToHexString(byte b) {
+		int n = b;
+		if (n < 0) {
+			n = 256 + n;
+		}
+		int d1 = n / 16;
+		int d2 = n % 16;
+		return hexDigits[d1] + hexDigits[d2];
+	}
+
+	/**
+	 * J 编码
+	 * 
+	 * @param origin
+	 * @return
+	 */
+
+	// MessageDigest 为 JDK 提供的加密类
+	public static String MD5Encode(String origin) {
+		String resultString = null;
+		try {
+			resultString = new String(origin);
+			MessageDigest md = MessageDigest.getInstance("MD5");
+			resultString = byteArrayToHexString(md.digest(resultString
+					.getBytes("UTF-8")));
+		} catch (Exception ex) {
+		}
+		return resultString;
+	}
+	
+	// MessageDigest 为 JDK 提供的加密类
+	public static String MD5Encode(byte[] bytes) {
+		String resultString = null;
+		try {
+//			resultString = new String(origin);
+			MessageDigest md = MessageDigest.getInstance("MD5");
+			resultString = byteArrayToHexString(md.digest(bytes));
+		} catch (Exception ex) {
+			ex.printStackTrace();
+		}
+		return resultString;
+	}
+	
+	public static String MD5Encode(String origin,String charsetName) {
+		origin =origin.trim();
+		String resultString = null;
+		try {
+			resultString = new String(origin);
+			MessageDigest md = MessageDigest.getInstance("MD5");
+			resultString = byteArrayToHexString(md.digest(resultString
+					.getBytes(charsetName)));
+		} catch (Exception ex) {
+		}
+		return resultString;
+	}
+
+}

+ 113 - 0
feifan-module-pay/feifan-module-pay-biz/src/main/java/cn/newfeifan/mall/module/pay/fuiou/util/MySSLSocketFactory.java

@@ -0,0 +1,113 @@
+/**
+ * 
+ */
+package cn.newfeifan.mall.module.pay.fuiou.util;
+
+import java.io.IOException;
+import java.net.InetAddress;
+import java.net.InetSocketAddress;
+import java.net.Socket;
+import java.net.SocketAddress;
+import java.net.UnknownHostException;
+import java.security.KeyManagementException;
+import java.security.NoSuchAlgorithmException;
+import java.security.cert.CertificateException;
+import java.security.cert.X509Certificate;
+
+import javax.net.SocketFactory;
+import javax.net.ssl.SSLContext;
+import javax.net.ssl.TrustManager;
+import javax.net.ssl.X509TrustManager;
+
+import org.apache.commons.httpclient.ConnectTimeoutException;
+import org.apache.commons.httpclient.params.HttpConnectionParams;
+import org.apache.commons.httpclient.protocol.SecureProtocolSocketFactory;
+
+/**
+ * @author Administrator
+ * 
+ */
+public class MySSLSocketFactory implements SecureProtocolSocketFactory {
+	static {
+		System.out.println(">>>>in MySSLSocketFactory>>");
+	}
+	private SSLContext sslcontext = null;
+
+	private SSLContext createSSLContext() {
+		SSLContext sslcontext = null;
+		try {
+			sslcontext = SSLContext.getInstance("SSL");
+			sslcontext.init(null,
+					new TrustManager[] { new TrustAnyTrustManager() },
+					new java.security.SecureRandom());
+		} catch (NoSuchAlgorithmException e) {
+			e.printStackTrace();
+		} catch (KeyManagementException e) {
+			e.printStackTrace();
+		}
+		return sslcontext;
+	}
+
+	private SSLContext getSSLContext() {
+		if (this.sslcontext == null) {
+			this.sslcontext = createSSLContext();
+		}
+		return this.sslcontext;
+	}
+
+	public Socket createSocket(Socket socket, String host, int port,
+			boolean autoClose) throws IOException, UnknownHostException {
+		return getSSLContext().getSocketFactory().createSocket(socket, host,
+				port, autoClose);
+	}
+
+	public Socket createSocket(String host, int port) throws IOException,
+			UnknownHostException {
+		return getSSLContext().getSocketFactory().createSocket(host, port);
+	}
+
+	public Socket createSocket(String host, int port, InetAddress clientHost,
+			int clientPort) throws IOException, UnknownHostException {
+		return getSSLContext().getSocketFactory().createSocket(host, port,
+				clientHost, clientPort);
+	}
+
+	public Socket createSocket(String host, int port, InetAddress localAddress,
+			int localPort, HttpConnectionParams params) throws IOException,
+			UnknownHostException, ConnectTimeoutException {
+		if (params == null) {
+			throw new IllegalArgumentException("Parameters may not be null");
+		}
+		int timeout = params.getConnectionTimeout();
+		SocketFactory socketfactory = getSSLContext().getSocketFactory();
+		if (timeout == 0) {
+			return socketfactory.createSocket(host, port, localAddress,
+					localPort);
+		} else {
+			Socket socket = socketfactory.createSocket();
+			SocketAddress localaddr = new InetSocketAddress(localAddress,
+					localPort);
+			SocketAddress remoteaddr = new InetSocketAddress(host, port);
+			socket.bind(localaddr);
+			socket.connect(remoteaddr, timeout);
+			return socket;
+		}
+	}
+
+	//
+	private static class TrustAnyTrustManager implements X509TrustManager {
+
+		public void checkClientTrusted(X509Certificate[] chain, String authType)
+				throws CertificateException {
+		}
+
+		public void checkServerTrusted(X509Certificate[] chain, String authType)
+				throws CertificateException {
+		}
+
+		public X509Certificate[] getAcceptedIssuers() {
+			return new X509Certificate[] {};
+		}
+	}
+
+}

+ 121 - 0
feifan-module-pay/feifan-module-pay-biz/src/main/java/cn/newfeifan/mall/module/pay/service/fuyouorder/FiYouPayOrderServiceImpl.java

@@ -0,0 +1,121 @@
+package cn.newfeifan.mall.module.pay.service.fuyouorder;
+
+import cn.newfeifan.mall.module.pay.dal.dataobject.order.PayOrderDO;
+import cn.newfeifan.mall.module.pay.fuiou.reqvo.SubmitOrderRequestVO;
+import cn.newfeifan.mall.module.pay.fuiou.respVO.FuYouPayOrderSubmitRespVO;
+import cn.newfeifan.mall.module.pay.fuiou.respVO.FuYouPaymentResponseVO;
+import cn.newfeifan.mall.module.pay.service.order.PayOrderService;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+
+import cn.newfeifan.mall.module.pay.fuiou.util.DateUtils;
+import cn.newfeifan.mall.module.pay.fuiou.util.FuiouHttpPoster;
+import cn.newfeifan.mall.module.pay.fuiou.util.MD5;
+import com.alibaba.fastjson.JSON;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Service;
+import org.springframework.validation.annotation.Validated;
+
+import javax.annotation.Resource;
+
+import static cn.newfeifan.mall.framework.common.exception.util.ServiceExceptionUtil.exception;
+import static cn.newfeifan.mall.module.pay.enums.DictTypeConstants.*;
+import static cn.newfeifan.mall.module.pay.enums.ErrorCodeConstants.SUBMIT_ORDER_ERROR;
+
+@Service
+@Validated
+@Slf4j
+public class FiYouPayOrderServiceImpl implements FuYouPayOrderService {
+
+    @Value("${wx.mp.app-id}")
+    private String appid;
+
+    @Resource
+    private PayOrderService payOrderService;
+
+    @Override
+    public String submitOrder(SubmitOrderRequestVO requestVO) {
+
+        // 1.1 获得 PayOrderDO ,并校验其是否存在
+        PayOrderDO payOrder = payOrderService.validateOrderCanSubmit(requestVO.getId());
+
+        FuiouHttpPoster http = new FuiouHttpPoster();
+        http.setCharset("utf-8");
+        http.setUrl("https://aipay.fuioupay.com/aggregatePay/wxPreCreate");
+        requestVO.getReq().setTerm_id("88888888");
+        requestVO.getReq().setTerm_ip("192.168.8.8");
+        requestVO.getReq().setRandom_str(DateUtils.getCurrentDate("yyyyMMddHHmmss")
+                + "568974");
+        requestVO.getReq().setMchnt_cd(mchnt_cd);
+//        requestVO.getReq().setTrade_type("JSAPI");
+//      req.setOpenid("oDax96l0bZdXqRQ2uVfn_2LV-DxM");//微信支付此字段必填
+//		req.setSub_openid("221122121");//支付宝支付此字段必填
+        requestVO.getReq().setOrder_amt(String.valueOf(payOrder.getPrice() / 100));
+        requestVO.getReq().setGoods_des(payOrder.getBody());
+//        requestVO.getReq().setOpenid("osMm86Ggu3iLCkdCO2j4Zan-fHOQ");
+//        requestVO.getReq().setSub_openid("osMm86Ggu3iLCkdCO2j4Zan-fHOQ");
+//        requestVO.getReq().setSub_appid("wxe133514440a8829d");
+        requestVO.getReq().setSub_appid(appid);
+        requestVO.getReq().setMchnt_order_no(payOrder.getPayOrderNo());//不能重复
+        requestVO.getReq().setTxn_begin_ts(DateUtils.getCurrentDate("yyyyMMddHHmmss"));
+        requestVO.getReq().setNotify_url("https://zxpt.newfeifan.cn/fuYou/pay/order/notify");
+        requestVO.getReq().setVersion("1.0");
+        StringBuilder sb = new StringBuilder();
+        sb.append(requestVO.getReq().getMchnt_cd().trim()).append("|")
+                .append(requestVO.getReq().getTrade_type().trim()).append("|")
+                .append(requestVO.getReq().getOrder_amt().trim()).append("|")
+                .append(requestVO.getReq().getMchnt_order_no().trim()).append("|")
+                .append(requestVO.getReq().getTxn_begin_ts()).append("|")
+                .append(requestVO.getReq().getGoods_des()).append("|")
+                .append(requestVO.getReq().getTerm_id()).append("|")
+                .append(requestVO.getReq().getTerm_ip()).append("|")
+                .append(requestVO.getReq().getNotify_url()).append("|")
+                .append(requestVO.getReq().getRandom_str()).append("|")
+                .append(requestVO.getReq().getVersion()).append("|")
+                .append(privateKey);
+        requestVO.getReq().setSign(MD5.MD5Encode(sb.toString()));
+        String res = null;
+        try {
+            res = http.newPost(JSON.toJSONString(requestVO.getReq()));
+
+            // 解析返回结果,获取参数
+            ObjectMapper mapper = new ObjectMapper();
+            FuYouPaymentResponseVO resp = mapper.readValue(res, FuYouPaymentResponseVO.class);
+
+            if(!"000000".equals(resp.getResult_code())){
+                throw exception(SUBMIT_ORDER_ERROR);
+            }
+
+            FuYouPayOrderSubmitRespVO vo = FuYouPayOrderSubmitRespVO.builder()
+                    .appId(resp.getSdk_appid())
+                    .timeStamp(resp.getSdk_timestamp())
+                    .nonceStr(resp.getRandom_str())
+                    .sdk_package(resp.getSdk_package())
+                    .signType(resp.getSdk_signtype())
+                    .paySign(resp.getSdk_paysign())
+                    .build();
+            return JSON.toJSONString(vo);
+        } catch (Exception e) {
+            throw exception(SUBMIT_ORDER_ERROR);
+        }
+    }
+
+    @Override
+    public void afterSale(Long afterSaleId) {
+
+    }
+
+    /**
+     * 生成随机字符串
+     */
+    private static String generateRandomString(int length) {
+        String characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
+        StringBuilder sb = new StringBuilder();
+        for (int i = 0; i < length; i++) {
+            int index = (int) (characters.length() * Math.random());
+            sb.append(characters.charAt(index));
+        }
+        return sb.toString();
+    }
+}

+ 27 - 0
feifan-module-pay/feifan-module-pay-biz/src/main/java/cn/newfeifan/mall/module/pay/service/fuyouorder/FuYouPayOrderService.java

@@ -0,0 +1,27 @@
+package cn.newfeifan.mall.module.pay.service.fuyouorder;
+
+import cn.newfeifan.mall.module.pay.fuiou.reqvo.SubmitOrderRequestVO;
+
+import javax.validation.Valid;
+
+/**
+ * 富有支付订单 Service 接口
+ *
+ * @author aquan
+ */
+public interface FuYouPayOrderService {
+
+    /**
+     * 提交支付
+     * 此时,会发起支付渠道的调用
+     *
+     * @param reqVO  提交请求
+     */
+    String submitOrder(@Valid SubmitOrderRequestVO reqVO);
+
+    /**
+     * 申请退款
+     * @param afterSaleId 售后编号
+     */
+    void afterSale(Long afterSaleId);
+}

+ 7 - 0
feifan-module-pay/feifan-module-pay-biz/src/main/java/cn/newfeifan/mall/module/pay/service/order/PayOrderService.java

@@ -101,6 +101,13 @@ public interface PayOrderService {
     PayOrderSubmitRespVO submitOrder(@Valid PayOrderSubmitReqVO reqVO,
                                      @NotEmpty(message = "提交 IP 不能为空") String userIp);
 
+    /**
+     * 验证支付单是否可以提交
+     * @param id 支付单编号
+     * @return 支付订单
+     */
+    PayOrderDO validateOrderCanSubmit(Long id);
+
     /**
      * 通知支付单成功
      *

+ 24 - 1
feifan-module-pay/feifan-module-pay-biz/src/main/java/cn/newfeifan/mall/module/pay/service/order/PayOrderServiceImpl.java

@@ -1,6 +1,8 @@
 package cn.newfeifan.mall.module.pay.service.order;
 
 import cn.hutool.core.collection.CollUtil;
+import cn.hutool.core.date.DatePattern;
+import cn.hutool.core.date.DateUtil;
 import cn.hutool.core.util.ObjectUtil;
 import cn.hutool.core.util.StrUtil;
 import cn.hutool.extra.spring.SpringUtil;
@@ -33,11 +35,13 @@ import cn.newfeifan.mall.module.pay.service.channel.PayChannelService;
 import cn.newfeifan.mall.module.pay.service.notify.PayNotifyService;
 import com.google.common.annotations.VisibleForTesting;
 import lombok.extern.slf4j.Slf4j;
+import org.springframework.data.redis.core.StringRedisTemplate;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.validation.annotation.Validated;
 
 import javax.annotation.Resource;
+import java.time.Duration;
 import java.time.LocalDateTime;
 import java.util.Collection;
 import java.util.Collections;
@@ -58,6 +62,13 @@ import static cn.newfeifan.mall.module.pay.enums.ErrorCodeConstants.*;
 @Slf4j
 public class PayOrderServiceImpl implements PayOrderService {
 
+    public static final String TRADE_NO = "trade_no:";
+    public static final String FUYOU_TRADE_ORDER_NO_PREFIX = "16103-";
+
+    @Resource
+    StringRedisTemplate stringRedisTemplate;
+
+
     @Resource
     private PayProperties payProperties;
 
@@ -166,10 +177,21 @@ public class PayOrderServiceImpl implements PayOrderService {
                 .setRefundPrice(0);
         order.setParentPayOrderId(reqDTO.getParentPayOrderId());//设置父支付订单ID
         order.setExpireTime(order.getExpireTime());//把父支付订单的过期时间,设置到子订单
+        order.setPayOrderNo(generate(FUYOU_TRADE_ORDER_NO_PREFIX));
         orderMapper.insert(order);
         return order.getId();
     }
 
+    private String generate(String prefix) {
+        // 递增序号
+        String noPrefix = prefix + DateUtil.format(LocalDateTime.now(), DatePattern.PURE_DATETIME_PATTERN);
+        String key = TRADE_NO + noPrefix;
+        Long no = stringRedisTemplate.opsForValue().increment(key);
+        // 设置过期时间
+        stringRedisTemplate.expire(key, Duration.ofMinutes(1L));
+        return noPrefix + no;
+    }
+
     @Override // 注意,这里不能添加事务注解,避免调用支付渠道失败时,将 PayOrderExtensionDO 回滚了
     public PayOrderSubmitRespVO submitOrder(PayOrderSubmitReqVO reqVO, String userIp) {
 
@@ -222,7 +244,8 @@ public class PayOrderServiceImpl implements PayOrderService {
         return PayOrderConvert.INSTANCE.convert(order, unifiedOrderResp);
     }
 
-    private PayOrderDO validateOrderCanSubmit(Long id) {
+    @Override
+    public PayOrderDO validateOrderCanSubmit(Long id) {
         PayOrderDO order = orderMapper.selectById(id);
         if (order == null) { // 是否存在
             throw exception(PAY_ORDER_NOT_FOUND);