Browse Source

在支付订单同步的定时器中加入查询富友订单的程序

Yangzw 8 months ago
parent
commit
f9190aee91
47 changed files with 2131 additions and 55 deletions
  1. 11 14
      feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/service/ordercalc/OrderCalcServiceImpl.java
  2. 5 29
      feifan-module-mall/feifan-module-trade-biz/src/main/java/cn/newfeifan/mall/module/trade/job/order/TradeOrderAutoCalcJob.java
  3. 25 0
      feifan-module-pay/feifan-module-pay-api/src/main/java/cn/newfeifan/mall/module/pay/enums/DictTypeConstants.java
  4. 46 0
      feifan-module-pay/feifan-module-pay-api/src/main/java/cn/newfeifan/mall/module/pay/enums/fuyouorder/AfterSaleOrderTypeEnum.java
  5. 40 0
      feifan-module-pay/feifan-module-pay-api/src/main/java/cn/newfeifan/mall/module/pay/enums/fuyouorder/FuYouPayOrderTypeEnum.java
  6. 18 0
      feifan-module-pay/feifan-module-pay-biz/pom.xml
  7. 5 9
      feifan-module-pay/feifan-module-pay-biz/src/main/java/cn/newfeifan/mall/module/pay/dal/dataobject/order/PayOrderDO.java
  8. 43 0
      feifan-module-pay/feifan-module-pay-biz/src/main/java/cn/newfeifan/mall/module/pay/fuiou/client/CommonQueryClient.java
  9. 34 0
      feifan-module-pay/feifan-module-pay-biz/src/main/java/cn/newfeifan/mall/module/pay/fuiou/client/GetMchntKeyClient.java
  10. 49 0
      feifan-module-pay/feifan-module-pay-biz/src/main/java/cn/newfeifan/mall/module/pay/fuiou/client/MicroPayClient.java
  11. 55 0
      feifan-module-pay/feifan-module-pay-biz/src/main/java/cn/newfeifan/mall/module/pay/fuiou/client/PreCreateClient.java
  12. 34 0
      feifan-module-pay/feifan-module-pay-biz/src/main/java/cn/newfeifan/mall/module/pay/fuiou/client/QueryChnlPayAmtClient.java
  13. 32 0
      feifan-module-pay/feifan-module-pay-biz/src/main/java/cn/newfeifan/mall/module/pay/fuiou/client/QueryFeeAmtClient.java
  14. 31 0
      feifan-module-pay/feifan-module-pay-biz/src/main/java/cn/newfeifan/mall/module/pay/fuiou/client/QueryWithdrawAmtClient.java
  15. 46 0
      feifan-module-pay/feifan-module-pay-biz/src/main/java/cn/newfeifan/mall/module/pay/fuiou/client/RefundClient.java
  16. 59 0
      feifan-module-pay/feifan-module-pay-biz/src/main/java/cn/newfeifan/mall/module/pay/fuiou/client/WapPreCreateClient.java
  17. 33 0
      feifan-module-pay/feifan-module-pay-biz/src/main/java/cn/newfeifan/mall/module/pay/fuiou/client/WithdrawClient.java
  18. 58 0
      feifan-module-pay/feifan-module-pay-biz/src/main/java/cn/newfeifan/mall/module/pay/fuiou/client/WxPreCreateClient.java
  19. 27 0
      feifan-module-pay/feifan-module-pay-biz/src/main/java/cn/newfeifan/mall/module/pay/fuiou/reqdata/CommonQueryDataReq.java
  20. 18 0
      feifan-module-pay/feifan-module-pay-biz/src/main/java/cn/newfeifan/mall/module/pay/fuiou/reqdata/GetMchntKeyDataReq.java
  21. 13 0
      feifan-module-pay/feifan-module-pay-biz/src/main/java/cn/newfeifan/mall/module/pay/fuiou/reqdata/GetOpenIdReq.java
  22. 54 0
      feifan-module-pay/feifan-module-pay-biz/src/main/java/cn/newfeifan/mall/module/pay/fuiou/reqdata/MicroPayDataReq.java
  23. 78 0
      feifan-module-pay/feifan-module-pay-biz/src/main/java/cn/newfeifan/mall/module/pay/fuiou/reqdata/PreCreateDataReq.java
  24. 28 0
      feifan-module-pay/feifan-module-pay-biz/src/main/java/cn/newfeifan/mall/module/pay/fuiou/reqdata/QueryChnlPayAmtDataReq.java
  25. 18 0
      feifan-module-pay/feifan-module-pay-biz/src/main/java/cn/newfeifan/mall/module/pay/fuiou/reqdata/QueryFeeAmtDataReq.java
  26. 19 0
      feifan-module-pay/feifan-module-pay-biz/src/main/java/cn/newfeifan/mall/module/pay/fuiou/reqdata/QueryWithdrawAmtDataReq.java
  27. 34 0
      feifan-module-pay/feifan-module-pay-biz/src/main/java/cn/newfeifan/mall/module/pay/fuiou/reqdata/RefundDataReq.java
  28. 63 0
      feifan-module-pay/feifan-module-pay-biz/src/main/java/cn/newfeifan/mall/module/pay/fuiou/reqdata/WapPreCreateDataReq.java
  29. 25 0
      feifan-module-pay/feifan-module-pay-biz/src/main/java/cn/newfeifan/mall/module/pay/fuiou/reqdata/WebPreCreateDeviceInfo.java
  30. 26 0
      feifan-module-pay/feifan-module-pay-biz/src/main/java/cn/newfeifan/mall/module/pay/fuiou/reqdata/WithdrawDataReq.java
  31. 61 0
      feifan-module-pay/feifan-module-pay-biz/src/main/java/cn/newfeifan/mall/module/pay/fuiou/reqdata/WxPreCreateDataReq.java
  32. 28 0
      feifan-module-pay/feifan-module-pay-biz/src/main/java/cn/newfeifan/mall/module/pay/fuiou/reqvo/SubmitOrderRequestVO.java
  33. 42 0
      feifan-module-pay/feifan-module-pay-biz/src/main/java/cn/newfeifan/mall/module/pay/fuiou/respVO/FuYouPayOrderSubmitRespVO.java
  34. 88 0
      feifan-module-pay/feifan-module-pay-biz/src/main/java/cn/newfeifan/mall/module/pay/fuiou/respVO/FuYouPayRefundResponse.java
  35. 133 0
      feifan-module-pay/feifan-module-pay-biz/src/main/java/cn/newfeifan/mall/module/pay/fuiou/respVO/FuYouPaymentResponseVO.java
  36. 139 0
      feifan-module-pay/feifan-module-pay-biz/src/main/java/cn/newfeifan/mall/module/pay/fuiou/respVO/FuYouQueryPayOrderResponseVO.java
  37. 79 0
      feifan-module-pay/feifan-module-pay-biz/src/main/java/cn/newfeifan/mall/module/pay/fuiou/util/DateUtils.java
  38. 155 0
      feifan-module-pay/feifan-module-pay-biz/src/main/java/cn/newfeifan/mall/module/pay/fuiou/util/FuiouHttpPoster.java
  39. 85 0
      feifan-module-pay/feifan-module-pay-biz/src/main/java/cn/newfeifan/mall/module/pay/fuiou/util/MD5.java
  40. 113 0
      feifan-module-pay/feifan-module-pay-biz/src/main/java/cn/newfeifan/mall/module/pay/fuiou/util/MySSLSocketFactory.java
  41. 6 2
      feifan-module-pay/feifan-module-pay-biz/src/main/java/cn/newfeifan/mall/module/pay/service/channel/PayChannelService.java
  42. 11 0
      feifan-module-pay/feifan-module-pay-biz/src/main/java/cn/newfeifan/mall/module/pay/service/channel/PayChannelServiceImpl.java
  43. 23 0
      feifan-module-pay/feifan-module-pay-biz/src/main/java/cn/newfeifan/mall/module/pay/service/fuyouorder/FuYouPayOrderService.java
  44. 98 0
      feifan-module-pay/feifan-module-pay-biz/src/main/java/cn/newfeifan/mall/module/pay/service/fuyouorder/FuYouPayOrderServiceImpl.java
  45. 1 0
      feifan-module-pay/feifan-module-pay-biz/src/main/java/cn/newfeifan/mall/module/pay/service/order/PayOrderService.java
  46. 25 1
      feifan-module-pay/feifan-module-pay-biz/src/main/java/cn/newfeifan/mall/module/pay/service/order/PayOrderServiceImpl.java
  47. 17 0
      sql/mysql/建空库SQL/17_20240710.sql

+ 11 - 14
feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/service/ordercalc/OrderCalcServiceImpl.java

@@ -26,11 +26,8 @@ import cn.newfeifan.mall.module.distri.service.ptprofitlog.PtProfitLogService;
 import cn.newfeifan.mall.module.distri.service.ptprofitlogdetails.PtProfitLogDetailsService;
 import cn.newfeifan.mall.module.distri.service.sharepath.SharePathService;
 import cn.newfeifan.mall.module.distri.service.shopsettlement.ShopSettlementService;
-import cn.newfeifan.mall.module.infra.dal.dataobject.job.JobDO;
-import cn.newfeifan.mall.module.infra.dal.dataobject.job.JobLogDO;
 import cn.newfeifan.mall.module.infra.dal.mysql.job.JobLogMapper;
 import cn.newfeifan.mall.module.infra.dal.mysql.job.JobMapper;
-import cn.newfeifan.mall.module.infra.enums.job.JobLogStatusEnum;
 import org.springframework.context.annotation.Lazy;
 import org.springframework.stereotype.Service;
 
@@ -200,17 +197,17 @@ public class OrderCalcServiceImpl implements OrderCalcService {
             System.out.println("=================计算程序结束====================");
         }
 
-        // 不是用的quzt 手动加上日志
-        JobDO job = jobMapper.selectOne(JobDO::getHandlerName, "tradeOrderAutoCalcJob");
-        JobLogDO log = new JobLogDO();
-        log.setBeginTime(LocalDateTime.now());
-        log.setStatus(JobLogStatusEnum.SUCCESS.getStatus());
-        log.setJobId(job.getId());
-        log.setHandlerName(job.getHandlerName());
-        log.setHandlerParam(job.getHandlerParam());
-        log.setExecuteIndex(1);
-
-        jobLogMapper.insert(log);
+//        // 不是用的quzt 手动加上日志
+//        JobDO job = jobMapper.selectOne(JobDO::getHandlerName, "tradeOrderAutoCalcJob");
+//        JobLogDO log = new JobLogDO();
+//        log.setBeginTime(LocalDateTime.now());
+//        log.setStatus(JobLogStatusEnum.SUCCESS.getStatus());
+//        log.setJobId(job.getId());
+//        log.setHandlerName(job.getHandlerName());
+//        log.setHandlerParam(job.getHandlerParam());
+//        log.setExecuteIndex(1);
+//
+//        jobLogMapper.insert(log);
     }
 
     /**

+ 5 - 29
feifan-module-mall/feifan-module-trade-biz/src/main/java/cn/newfeifan/mall/module/trade/job/order/TradeOrderAutoCalcJob.java

@@ -5,17 +5,10 @@ import cn.newfeifan.mall.framework.tenant.core.job.TenantJob;
 import cn.newfeifan.mall.module.distri.mq.message.order.CalcMessage;
 import cn.newfeifan.mall.module.distri.mq.message.order.DistriOrderMessage;
 import cn.newfeifan.mall.module.distri.mq.message.order.OrderCalcMessage;
-import cn.newfeifan.mall.module.infra.dal.dataobject.job.JobDO;
-import cn.newfeifan.mall.module.infra.dal.mysql.job.JobMapper;
 import cn.newfeifan.mall.module.trade.mq.producer.order.DistriOrderProducer;
 import cn.newfeifan.mall.module.trade.service.order.TradeOrderQueryService;
-import lombok.extern.slf4j.Slf4j;
 import org.quartz.DisallowConcurrentExecution;
 import org.springframework.context.annotation.Lazy;
-import org.springframework.scheduling.annotation.EnableScheduling;
-import org.springframework.scheduling.annotation.SchedulingConfigurer;
-import org.springframework.scheduling.config.ScheduledTaskRegistrar;
-import org.springframework.scheduling.support.CronTrigger;
 import org.springframework.stereotype.Component;
 
 import javax.annotation.Resource;
@@ -29,9 +22,7 @@ import java.util.List;
 @Component
 @DisallowConcurrentExecution
 @Lazy(false)
-@EnableScheduling
-@Slf4j
-public class TradeOrderAutoCalcJob implements SchedulingConfigurer {
+public class TradeOrderAutoCalcJob implements JobHandler {
 
     @Resource
     private DistriOrderProducer distriOrderProducer;
@@ -39,12 +30,9 @@ public class TradeOrderAutoCalcJob implements SchedulingConfigurer {
     @Resource
     private TradeOrderQueryService tradeOrderQueryService;
 
-    @Resource
-    private JobMapper jobMapper;
-
-    //    @Override
-//    @TenantJob
-    public void execute() {
+    @Override
+    @TenantJob
+    public String execute(String param) {
         //发货七天前订单
         List<DistriOrderMessage> appTradeOrderDetailRespVos = tradeOrderQueryService.queryAllOrder();
         List<OrderCalcMessage> orderCalcMessages = tradeOrderQueryService.getOrderCalcMessage(appTradeOrderDetailRespVos);
@@ -55,21 +43,9 @@ public class TradeOrderAutoCalcJob implements SchedulingConfigurer {
 
         CalcMessage calcMessage = CalcMessage.builder().orderCalcMessages(orderCalcMessages).bonusQuotaOrderDO(orderCalcMessages2).distriOrderMessages(appTradeOrderDetailRespVos).build();
         distriOrderProducer.sendDistriOrderMessage(calcMessage);
-//        return "计算订单信息结束";
-        log.info("==========计算订单信息结束==========");
+        return "计算订单信息结束";
 
-    }
 
-    @Override
-    public void configureTasks(ScheduledTaskRegistrar scheduledTaskRegistrar) {
-        scheduledTaskRegistrar.addTriggerTask(this::execute,
-                triggerContext -> {
-                    String cron = jobMapper.selectOne(JobDO::getHandlerName,"tradeOrderAutoCalcJob").getCronExpression();
-                    if (cron.isEmpty()) {
-                        log.error("==========没有找到启动  [tradeOrderAutoCalcJob] 任务的 定时任务 ==========");
-                    }
-                    return new CronTrigger(cron).nextExecutionTime(triggerContext);
-                });
     }
 
 }

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

@@ -15,4 +15,29 @@ public interface DictTypeConstants {
 
     String NOTIFY_STATUS = "pay_notify_status"; // 回调状态
 
+    // 富友支付的商户私钥
+    String privateKey = "b58ef4203dbe11ef3effcedc419c26ae";
+
+    // 查询富友支付订单状态为支付成功
+    String transStatus = "SUCCESS";
+
+    // 查询富友支付订单响应码为支功
+    String resultCode = "000000";
+
+    // 富友支付的商户号
+    String mchnt_cd = "0006420F7357129";
+
+    String term_id = "88888888";
+
+    String version = "1.0";
+
+    String term_ip = "192.168.8.8";
+
+    String FUYOU_TRADE_ORDER_NO_PREFIX = "16103-";
+
+    String ORDER_NO_PREFIX = "P";
+
+
+    String TRADE_NO = "trade_no:";
+
 }

+ 46 - 0
feifan-module-pay/feifan-module-pay-api/src/main/java/cn/newfeifan/mall/module/pay/enums/fuyouorder/AfterSaleOrderTypeEnum.java

@@ -0,0 +1,46 @@
+package cn.newfeifan.mall.module.pay.enums.fuyouorder;
+
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+
+/**
+ * 富友退款的订单类型
+ */
+
+@Getter
+@AllArgsConstructor
+public enum AfterSaleOrderTypeEnum {
+
+    ALIPAY("ALIPAY","(统一下单、条码支付、服务窗支付)"),
+    WECHAT("WECHAT","(统一下单、条码支付、公众号支付、小程序)"),
+    UNIONPAY("UNIONPAY","富友没有备注"),
+    WXAPP("WXAPP","(微信app)"),
+    ALIAPP("ALIAPP","(支付宝app)"),
+    WXH5("WXH5","(微信h5)"),
+    ALIH5("ALIH5","(支付宝h5)"),
+    WXBX("WXBX","(微信保险类)"),
+    ALBX("ALBX","(支付宝保险类)"),
+    WXXS("WXXS","(微信线上所有交易)(不支持线下类型)"),
+    ;
+
+
+    /**
+     * 类型
+     */
+    private final String type;
+
+    /**
+     * 描述
+     */
+    private final String describe;
+
+    public static String getType(String code){
+        for (AfterSaleOrderTypeEnum type : AfterSaleOrderTypeEnum.values()) {
+            if(code.equals(FuYouPayOrderTypeEnum.JSAPI.getCode()) && type.getType().equals(WECHAT.getType())){
+                return type.getType();
+            }
+        }
+        return null;
+    }
+
+}

+ 40 - 0
feifan-module-pay/feifan-module-pay-api/src/main/java/cn/newfeifan/mall/module/pay/enums/fuyouorder/FuYouPayOrderTypeEnum.java

@@ -0,0 +1,40 @@
+package cn.newfeifan.mall.module.pay.enums.fuyouorder;
+
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+
+/**
+ * 富友支付订单的类型枚举
+ */
+
+@Getter
+@AllArgsConstructor
+public enum FuYouPayOrderTypeEnum {
+
+    JSAPI("JSAPI","公众号线下支付"),
+    APP("APP","app支付(暂不可用)"),
+    FWC("FWC","支付宝服务窗"),
+    LETPAY("LETPAY","小程序"),
+    WXBXJS("WXBXJS","(微信公众号保险类)"),
+    WXBXLET("WXBXLET","(微信小程序保险类)"),
+    WXBXAPP("WXBXAPP","(微信APP保险类)"),
+    ALBXJS("ALBXJS","(支付宝服务窗保险类)"),
+    APPLEPAY("APPLEPAY","相机扫码)"),
+    UNIONPAY("UNIONPAY","(云闪付扫码)"),
+    BESTPAY("BESTPAY","(翼支付js)"),
+    ;
+
+
+    private final String code;
+
+    private final String describe;
+
+    public static String getCode(String code){
+        for (FuYouPayOrderTypeEnum type : FuYouPayOrderTypeEnum.values()) {
+            if(type.getCode().equals(code)){
+                return type.getCode();
+            }
+        }
+        return null;
+    }
+}

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

@@ -90,6 +90,24 @@
             <artifactId>feifan-spring-boot-starter-biz-dict</artifactId>
         </dependency>
 
+        <dependency>
+            <groupId>commons-codec</groupId>
+            <artifactId>commons-codec</artifactId>
+            <version>1.2</version>
+        </dependency>
+
+        <dependency>
+            <groupId>commons-httpclient</groupId>
+            <artifactId>commons-httpclient</artifactId>
+            <version>3.0</version>
+        </dependency>
+
+        <dependency>
+            <groupId>commons-logging</groupId>
+            <artifactId>commons-logging</artifactId>
+            <version>1.2</version>
+        </dependency>
+
     </dependencies>
 
 </project>

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

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

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

@@ -0,0 +1,43 @@
+package cn.newfeifan.mall.module.pay.fuiou.client;
+
+import cn.newfeifan.mall.module.pay.fuiou.respVO.FuYouQueryPayOrderResponseVO;
+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;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+import static cn.newfeifan.mall.module.pay.enums.DictTypeConstants.*;
+
+/**
+ * 2.3 订单查询接口
+ * @author user
+ *
+ */
+public class CommonQueryClient {
+	
+	public static void main(String[] args) throws Exception {
+		FuiouHttpPoster http = new FuiouHttpPoster();
+		http.setCharset("utf-8");
+		http.setUrl("https://aipay.fuioupay.com/aggregatePay/commonQuery");
+		CommonQueryDataReq req=new CommonQueryDataReq();
+		req.setVersion("1.0");
+		req.setMchnt_cd(mchnt_cd);
+		req.setRandom_str("201707041112123456");
+		req.setOrder_type("JSAPI");
+		req.setMchnt_order_no("16103-202407112111001");
+		req.setTerm_id("88888888");
+		String data = MD5.MD5Encode(req.getMchnt_cd() + "|" + req.getOrder_type() + "|" + 
+				req.getMchnt_order_no() + "|" + req.getTerm_id() + "|" + req.getRandom_str() + "|" + 
+				req.getVersion() + "|" + privateKey);
+		req.setSign(data);
+		String res = http.newPost(JSON.toJSONString(req));
+		System.out.println("====resp====\n");
+		System.out.println(res);
+
+		ObjectMapper mapper = new ObjectMapper();
+		FuYouQueryPayOrderResponseVO resp = mapper.readValue(res, FuYouQueryPayOrderResponseVO.class);
+		System.out.println(resp.getResult_code());
+	}
+
+}

+ 34 - 0
feifan-module-pay/feifan-module-pay-biz/src/main/java/cn/newfeifan/mall/module/pay/fuiou/client/GetMchntKeyClient.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.GetMchntKeyDataReq;
+import cn.newfeifan.mall.module.pay.fuiou.util.FuiouHttpPoster;
+import cn.newfeifan.mall.module.pay.fuiou.util.MD5;
+
+/**
+ * 
+ * 2.11 商户获取密钥
+ * 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");
+         String sb = req.getMchnt_cd().trim() + "|" +
+                 req.getTerm_id() + "|" +
+                 privateKey;
+		req.setSign(MD5.MD5Encode(sb));
+		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("|").append(req.getAuth_code()).append("|").append(req.getRandom_str())
+				.append("|").append(req.getVersion()).append("|").append(privateKey);
+		System.out.println("请求sign:" + sb);
+		req.setSign(MD5.MD5Encode(sb.toString(), "UTF-8"));
+		String res = http.newPost(JSON.toJSONString(req));
+		System.out.println(res);
+	}
+}

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

@@ -0,0 +1,55 @@
+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
+ *  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");
+        String sb = req.getMchnt_cd().trim() + "|" +
+                req.getOrder_type().trim() + "|" +
+                req.getOrder_amt().trim() + "|" +
+                req.getMchnt_order_no().trim() + "|" +
+                req.getTxn_begin_ts() + "|" +
+                req.getGoods_des() + "|" +
+                req.getTerm_id() + "|" +
+                req.getTerm_ip() + "|" +
+                req.getNotify_url() + "|" +
+                req.getRandom_str() + "|" +
+                req.getVersion() + "|" +
+                privateKey;
+		req.setSign(MD5.MD5Encode(sb));
+		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);
+	}
+}

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

@@ -0,0 +1,46 @@
+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;
+
+import static cn.newfeifan.mall.module.pay.enums.DictTypeConstants.*;
+
+/**
+ * 类功能描述
+ * RefundClient.java
+ * 2.4 退款
+ * 
+ * @author user
+ * @version 0.1.0
+ */
+public class RefundClient {
+
+
+	public static void main(String[] args) throws Exception {
+		FuiouHttpPoster http = new FuiouHttpPoster();
+		http.setCharset("utf-8");
+		http.setUrl("https://aipay.fuioupay.com/aggregatePay/commonRefund");
+		RefundDataReq req = new RefundDataReq();
+		req.setVersion("1.0");
+		req.setMchnt_cd(mchnt_cd);
+		req.setTerm_id(term_id);
+		req.setRandom_str("20240713175056568974");
+		req.setMchnt_order_no("16103-202407112111001");
+		req.setRefund_order_no("16103-202407131750580");
+		req.setOrder_type("WECHAT");
+		req.setTotal_amt("100");
+		req.setRefund_amt("100");
+		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);
+		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("|").append(req.getVersion()).append("|").append(privateKey);
+		System.out.println("请求sign:" + sb);
+		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);
+	}
+
+}

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

@@ -0,0 +1,58 @@
+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;
+
+import static cn.newfeifan.mall.module.pay.enums.DictTypeConstants.*;
+
+/**
+ * 
+ *2.6 公众号或服务窗下单
+ * WxPreCreateClient.java
+ * 2017年7月17日  创建WxPreCreateClient.java
+ * 
+ * @version 0.1.0
+ */
+public class WxPreCreateClient {
+	
+	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");
+        String sb = req.getMchnt_cd().trim() + "|" +
+                req.getTrade_type().trim() + "|" +
+                req.getOrder_amt().trim() + "|" +
+                req.getMchnt_order_no().trim() + "|" +
+                req.getTxn_begin_ts() + "|" +
+                req.getGoods_des() + "|" +
+                req.getTerm_id() + "|" +
+                req.getTerm_ip() + "|" +
+                req.getNotify_url() + "|" +
+                req.getRandom_str() + "|" +
+                req.getVersion() + "|" +
+                privateKey;
+		req.setSign(MD5.MD5Encode(sb));
+		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;
+
+
+}

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

@@ -0,0 +1,25 @@
+package cn.newfeifan.mall.module.pay.fuiou.reqdata;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * 类功能描述
+ * WEB/APP下单,支付场景信息
+ * BarCodePayDeviceInfo.java
+ * 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;
+
+}

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

@@ -0,0 +1,28 @@
+package cn.newfeifan.mall.module.pay.fuiou.reqvo;
+
+import cn.newfeifan.mall.module.pay.fuiou.reqdata.WxPreCreateDataReq;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+import javax.validation.constraints.NotEmpty;
+import javax.validation.constraints.NotNull;
+
+/**
+ * 提交订单请求
+ */
+
+@Data
+@Schema(description = "管理后台 - 支付订单提交 Request VO")
+public class SubmitOrderRequestVO {
+
+    @Schema(description = "支付单编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
+    @NotNull(message = "支付单编号不能为空")
+    private Long id;
+
+    @Schema(description = "支付渠道", requiredMode = Schema.RequiredMode.REQUIRED, example = "wx_pub")
+    @NotEmpty(message = "支付渠道不能为空")
+    private String channelCode;
+
+    @Schema(description = "支付渠道的额外参数", requiredMode = Schema.RequiredMode.REQUIRED, example = "wx_pub")
+    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;
+
+}

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

@@ -0,0 +1,88 @@
+package cn.newfeifan.mall.module.pay.fuiou.respVO;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+@Schema(description = "管理后台 - 申请富友退款 Response")
+@Data
+public class FuYouPayRefundResponse {
+    /**
+     * 000000 成功,其他详细参见错误列表
+     */
+    private String result_code;
+
+    /**
+     * 代码描述
+     */
+    private String result_msg;
+
+    /**
+     * 富友分配的商户号
+     */
+    private String mchnt_cd;
+
+    /**
+     * 终端号,用于标识交易的终端设备
+     */
+    private String term_id;
+
+    /**
+     * 随机字符串,用于保证请求的唯一性
+     */
+    private String random_str;
+
+    /**
+     * 订单类型:
+     * ALIPAY (统一下单、条码支付、服务窗支付)
+     * WECHAT(统一下单、条码支付,公众号支付)
+     * UNIONPAY
+     * WXAPP(微信app)
+     * ALIAPP(支付宝app)
+     * WXH5(微信h5)
+     * ALIH5(支付宝h5)
+     * WXBX(微信保险类)
+     * ALBX(支付宝保险类)
+     * 【公众号相关的交易为空,其他都有】
+     */
+    private String order_type;
+
+    /**
+     * 渠道交易流水号
+     */
+    private String transaction_id;
+
+    /**
+     * 退款流水号
+     */
+    private String refund_id;
+
+    /**
+     * 商户订单号,由商户为交易生成的唯一标识
+     */
+    private String mchnt_order_no;
+
+    /**
+     * 商户退款号,由商户为退款生成的唯一标识
+     */
+    private String refund_order_no;
+
+    /**
+     * 富友清算日
+     */
+    private String reserved_fy_settle_dt;
+
+    /**
+     * 退款金额
+     */
+    private String reserved_refund_amt;
+
+    /**
+     * 富友追踪号
+     */
+    private String reserved_fy_trace_no;
+
+    /**
+     * 签名字段,用于验证数据的完整性和真实性
+     */
+    private String sign;
+}

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

@@ -0,0 +1,133 @@
+package cn.newfeifan.mall.module.pay.fuiou.respVO;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+@Schema(description = "管理后台 - 富友支付订单提交 Response")
+@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;
+}

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

@@ -0,0 +1,139 @@
+package cn.newfeifan.mall.module.pay.fuiou.respVO;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+@Schema(description = "管理后台 - 查询富友支付订单 Response")
+@Data
+public class FuYouQueryPayOrderResponseVO {
+    /**
+     * 000000 成功,其他详细参见错误列表
+     */
+    private String result_code;
+
+    /**
+     * 代码描述
+     */
+    private String result_msg;
+
+    /**
+     * 富友分配的商户号
+     */
+    private String mchnt_cd;
+
+    /**
+     * 终端号
+     */
+    private String term_id;
+
+    /**
+     * 随机字符串,用于保证交易请求的唯一性。
+     */
+    private String random_str;
+
+    /**
+     * 订单类型,用于区分不同类型的订单。
+     */
+    private String order_type;
+
+    /**
+     * 订单金额,交易的总金额。
+     */
+    private String order_amt;
+
+    /**
+     * 买家在渠道账号
+     */
+    private String buyer_id;
+
+    /**
+     * 渠道交易流水号
+     */
+    private String transaction_id;
+
+    /**
+     * 额外信息,用于传递附加的业务数据。
+     */
+    private String addn_inf;
+
+    /**
+     * 富友清算日
+     */
+    private String reserved_fy_settle_dt;
+
+    /**
+     * 商户系统内部的订单号
+     */
+    private String mchnt_order_no;
+
+    /**
+     * 交易状态,表示交易的当前状态。
+     */
+    private String trans_stat;
+
+    /**
+     * 优惠金额
+     */
+    private String reserved_coupon_fee;
+
+    /**
+     * 买家在渠道登录账号
+     */
+    private String reserved_buyer_logon_id;
+
+    /**
+     * 支付宝交易资金渠道,详细渠道
+     */
+    private String reserved_fund_bill_list;
+
+    /**
+     * 富友系统内部追踪号
+     */
+    private String reserved_fy_trace_no;
+
+    /**
+     * 银行返回的交易号
+     */
+    private String reserved_channel_order_id;
+
+    /**
+     * 富友的POS终端号,如果不是用的富友的POS终端请忽略
+     */
+    private String reserved_fy_term_id;
+
+    /**
+     * 1:表示信用卡或者花呗
+     * 0:表示其他(非信用方式)
+     * 不填,表示未知
+     */
+    private String reserved_is_credit;
+
+    /**
+     * 付款方式
+     */
+    private String reserved_bank_type;
+
+    /**
+     * 支付完成时间
+     */
+    private String reserved_txn_fin_ts;
+
+    /**
+     * 以分为单位的整数
+     * 只有成功交易才会返回
+     * 如果使用了商户免充值优惠券,该值为订单金额-商户免充值
+     * 如果没有使用商户免充值,该值等于订单金额
+     */
+    private String reserved_settlement_amt;
+
+    /**
+     * 微信营销详情
+     */
+    private String reserved_promotion_detail;
+
+    /**
+     * 签名,用于验证交易请求或响应的完整性。
+     */
+    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;
+	}
+	
+	
+}

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

@@ -0,0 +1,155 @@
+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 cn.newfeifan.mall.framework.common.exception.ErrorCode;
+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;
+
+import static cn.newfeifan.mall.framework.common.exception.util.ServiceExceptionUtil.exception;
+
+
+/**
+ * @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) {
+					ErrorCode err = new ErrorCode(1, e.getMessage());
+					throw exception(err);
+				}
+			}
+		});
+	}
+	
+	
+
+	/**
+	 * 使用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) {
+			ErrorCode err = new ErrorCode(1, ex2.getMessage());
+//			throw exception(err);
+//			System.out.println("报文发送到[" + url + "]失败:" + ex2.getMessage());
+//			throw new Exception("报文发送异常");
+		} catch (Exception ex) {
+			ErrorCode err = new ErrorCode(1, ex.getMessage());
+			throw exception(err);
+//			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) {
+				ErrorCode err = new ErrorCode(1, e.getMessage());
+				throw exception(err);
+			}
+		}
+
+		return null;
+	}
+
+	/**
+	 * 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[] {};
+		}
+	}
+
+}

+ 6 - 2
feifan-module-pay/feifan-module-pay-biz/src/main/java/cn/newfeifan/mall/module/pay/service/channel/PayChannelService.java

@@ -66,7 +66,6 @@ public interface PayChannelService {
 
     /**
      * 支付渠道的合法性
-     *
      * 如果不合法,抛出 {@link ServiceException} 业务异常
      *
      * @param id 渠道编号
@@ -76,7 +75,6 @@ public interface PayChannelService {
 
     /**
      * 支付渠道的合法性
-     *
      * 如果不合法,抛出 {@link ServiceException} 业务异常
      *
      * @param appId 应用编号
@@ -101,4 +99,10 @@ public interface PayChannelService {
      */
     PayClient getPayClient(Long id);
 
+    /**
+     * 判断支付渠道是否符合要求
+     * @param channelId 通道ID
+     * @return 是否符合
+     */
+    boolean getChannelById(Long channelId);
 }

+ 11 - 0
feifan-module-pay/feifan-module-pay-biz/src/main/java/cn/newfeifan/mall/module/pay/service/channel/PayChannelServiceImpl.java

@@ -13,6 +13,7 @@ import cn.newfeifan.mall.module.pay.controller.admin.channel.vo.PayChannelUpdate
 import cn.newfeifan.mall.module.pay.convert.channel.PayChannelConvert;
 import cn.newfeifan.mall.module.pay.dal.dataobject.channel.PayChannelDO;
 import cn.newfeifan.mall.module.pay.dal.mysql.channel.PayChannelMapper;
+import cn.newfeifan.mall.module.pay.enums.fuyouorder.FuYouPayOrderTypeEnum;
 import cn.newfeifan.mall.module.pay.framework.pay.core.WalletPayClient;
 import com.google.common.cache.CacheLoader;
 import com.google.common.cache.LoadingCache;
@@ -205,4 +206,14 @@ public class PayChannelServiceImpl implements PayChannelService {
         return clientCache.getUnchecked(id);
     }
 
+    @Override
+    public boolean getChannelById(Long channelId) {
+        PayChannelDO payChannelDO = payChannelMapper.selectById(channelId);
+
+        if(payChannelDO == null) return false;
+
+        String code = FuYouPayOrderTypeEnum.getCode(payChannelDO.getCode());
+        return code != null;
+    }
+
 }

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

@@ -0,0 +1,23 @@
+package cn.newfeifan.mall.module.pay.service.fuyouorder;
+
+
+import cn.newfeifan.mall.module.pay.dal.dataobject.order.PayOrderDO;
+import cn.newfeifan.mall.module.pay.dal.dataobject.order.PayOrderExtensionDO;
+
+/**
+ * 富有支付订单 Service 接口
+ *
+ * @author aquan
+ */
+public interface FuYouPayOrderService {
+
+
+    /**
+     * 获得支付订单
+     *
+     * @param payOrderExtensionDO 支付扩展订单
+     * @param payOrderDO 支付订单
+     */
+    PayOrderDO getPayOrderByStatus(PayOrderExtensionDO payOrderExtensionDO, PayOrderDO payOrderDO);
+
+}

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

@@ -0,0 +1,98 @@
+package cn.newfeifan.mall.module.pay.service.fuyouorder;
+
+import cn.newfeifan.mall.framework.common.exception.ErrorCode;
+import cn.newfeifan.mall.module.pay.dal.dataobject.order.PayOrderDO;
+import cn.newfeifan.mall.module.pay.dal.dataobject.order.PayOrderExtensionDO;
+import cn.newfeifan.mall.module.pay.dal.mysql.order.PayOrderExtensionMapper;
+import cn.newfeifan.mall.module.pay.enums.order.PayOrderStatusEnum;
+import cn.newfeifan.mall.module.pay.fuiou.reqdata.CommonQueryDataReq;
+import cn.newfeifan.mall.module.pay.fuiou.respVO.FuYouQueryPayOrderResponseVO;
+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 cn.newfeifan.mall.module.pay.service.order.PayOrderService;
+import com.alibaba.fastjson.JSON;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.context.annotation.Lazy;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+
+import static cn.newfeifan.mall.framework.common.exception.util.ServiceExceptionUtil.exception;
+import static cn.newfeifan.mall.module.pay.enums.DictTypeConstants.*;
+
+@Slf4j
+@Service
+public class FuYouPayOrderServiceImpl implements FuYouPayOrderService {
+
+    @Resource
+    @Lazy
+    private PayOrderService payOrderService;
+
+    @Resource
+    private PayOrderExtensionMapper orderExtensionMapper;
+
+
+    @Override
+    public PayOrderDO getPayOrderByStatus(PayOrderExtensionDO payOrderExtensionDO, PayOrderDO payOrder) {
+
+        // 用一个新的对象接收,避免修改原对象
+        PayOrderDO payOrderDO = payOrderService.getOrder(payOrder.getId());
+
+        FuiouHttpPoster http = new FuiouHttpPoster();
+        http.setCharset("utf-8");
+        http.setUrl("https://aipay.fuioupay.com/aggregatePay/commonQuery");
+        CommonQueryDataReq req = new CommonQueryDataReq();
+        req.setVersion("1.0");
+        req.setMchnt_cd(mchnt_cd);
+        req.setRandom_str(DateUtils.getCurrentDate("yyyyMMddHHmmss")
+                + "568974");
+        req.setOrder_type(payOrderExtensionDO.getChannelCode());
+        req.setMchnt_order_no(payOrderDO.getPayOrderNo());
+        req.setTerm_id(term_id);
+        String data = MD5.MD5Encode(req.getMchnt_cd() + "|" + req.getOrder_type() + "|" +
+                req.getMchnt_order_no() + "|" + req.getTerm_id() + "|" + req.getRandom_str() + "|" +
+                req.getVersion() + "|" + privateKey);
+        req.setSign(data);
+
+        String res;
+        try {
+            res = http.newPost(JSON.toJSONString(req));
+
+            ObjectMapper mapper = new ObjectMapper();
+            FuYouQueryPayOrderResponseVO resp = mapper.readValue(res, FuYouQueryPayOrderResponseVO.class);
+
+            // 当响应结果为000000且交易状态为SUCCESS时才是支付成功
+            if (resp.getResult_code().equals(resultCode) && resp.getTrans_stat().equals(transStatus)) {
+                // 修改订单扩展信息
+                payOrderExtensionDO.setStatus(PayOrderStatusEnum.SUCCESS.getStatus());
+
+                // 修改订单信息
+                payOrderDO.setStatus(PayOrderStatusEnum.SUCCESS.getStatus());
+                payOrderDO.setExtensionId(payOrderExtensionDO.getId());
+                payOrderDO.setNo(payOrderExtensionDO.getNo());
+                payOrderDO.setChannelOrderNo(resp.getTransaction_id());
+                payOrderDO.setChannelUserId(resp.getBuyer_id());
+                payOrderDO.setChannelId(payOrderExtensionDO.getChannelId());
+                payOrderDO.setChannelCode(payOrderExtensionDO.getChannelCode());
+
+                payOrderService.updatePayOrder(payOrderDO);
+            } else {
+                // 否则支付失败, 记录错误信息
+                payOrderExtensionDO.setChannelErrorCode(resp.getResult_code());
+                payOrderExtensionDO.setChannelErrorMsg(resp.getResult_msg());
+
+            }
+            payOrderExtensionDO.setChannelNotifyData(res);
+            orderExtensionMapper.updateById(payOrderExtensionDO);
+
+        } catch (Exception e) {
+            ErrorCode ERROR = new ErrorCode(1_007_901_006, "查询支付订单失败");
+            throw exception(ERROR);
+        }
+
+        return payOrderDO;
+    }
+
+}

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

@@ -153,4 +153,5 @@ public interface PayOrderService {
      */
     PayOrderDO getOrderByTradeOrderId(Long id);
 
+    void updatePayOrder(PayOrderDO payOrderDO);
 }

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

@@ -31,6 +31,7 @@ import cn.newfeifan.mall.module.pay.framework.pay.config.PayProperties;
 import cn.newfeifan.mall.module.pay.order.TradeOrderProducer;
 import cn.newfeifan.mall.module.pay.service.app.PayAppService;
 import cn.newfeifan.mall.module.pay.service.channel.PayChannelService;
+import cn.newfeifan.mall.module.pay.service.fuyouorder.FuYouPayOrderService;
 import cn.newfeifan.mall.module.pay.service.notify.PayNotifyService;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.google.common.annotations.VisibleForTesting;
@@ -80,6 +81,9 @@ public class PayOrderServiceImpl implements PayOrderService {
     @Resource
     private TradeOrderProducer tradeOrderProducer;
 
+    @Resource
+    private FuYouPayOrderService fuYouPayOrderService;
+
     @Override
     public PayOrderDO getOrder(Long id) {
         return orderMapper.selectById(id);
@@ -518,7 +522,12 @@ public class PayOrderServiceImpl implements PayOrderService {
 
     @Override
     public PayOrderDO getOrderByTradeOrderId(Long id) {
-        return   orderMapper.selectOne(new LambdaQueryWrapper<PayOrderDO>().eq(PayOrderDO::getMerchantOrderId,id));
+        return orderMapper.selectOne(new LambdaQueryWrapper<PayOrderDO>().eq(PayOrderDO::getMerchantOrderId, id));
+    }
+
+    @Override
+    public void updatePayOrder(PayOrderDO order) {
+        orderMapper.updateById(order);
     }
 
     /**
@@ -535,12 +544,27 @@ public class PayOrderServiceImpl implements PayOrderService {
                 if (PayOrderStatusEnum.isClosed(orderExtension.getStatus())) {
                     continue;
                 }
+
                 // 情况一:校验数据库中的 orderExtension 是不是已支付
                 if (PayOrderStatusEnum.isSuccess(orderExtension.getStatus())) {
                     log.error("[expireOrder][order({}) 的 extension({}) 已支付,可能是数据不一致]",
                             order.getId(), orderExtension.getId());
                     return false;
                 }
+
+                // 如果是对接富友的支付单,则查询富友的订单状态
+                if (channelService.getChannelById(orderExtension.getChannelId())) {
+                    // 查询状态,修改支付订单状态
+                    PayOrderDO payOrder = fuYouPayOrderService.getPayOrderByStatus(orderExtension, order);
+
+                    // 支付单状态发生变化才更新
+                    if (payOrder != null && !payOrder.getStatus().equals(order.getStatus()) && payOrder.getStatus().equals(PayOrderStatusEnum.SUCCESS.getStatus())) {
+                        // 修改订单状态
+                        tradeOrderProducer.sendTradeOrderMessage(order.getId());
+                    }
+                    return false;
+                }
+
                 // 情况二:调用三方接口,查询支付单状态,是不是已支付/已退款
                 PayClient payClient = channelService.getPayClient(orderExtension.getChannelId());
                 if (payClient == null) {

+ 17 - 0
sql/mysql/建空库SQL/17_20240710.sql

@@ -0,0 +1,17 @@
+ALTER TABLE pay_order
+    ADD COLUMN `pay_order_no` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '支付订单号';
+
+ALTER TABLE pay_app
+    ADD COLUMN `fuyou_order_notify_url` varchar(1024) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '富友支付结果的回调地址',
+  ADD COLUMN `fuyou_refund_notify_url` varchar(1024) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '富友退款结果的回调地址';
+
+ALTER TABLE pay_order_extension
+    ADD COLUMN `channel_response` text COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '支付渠道的响应体';
+
+ALTER TABLE pay_order_extension
+    MODIFY COLUMN channel_extras text COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '支付渠道的额外参数';
+
+ALTER TABLE pay_refund
+    ADD COLUMN `pay_refund_no` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '支付订单号',
+	ADD COLUMN `channel_request` text COLLATE utf8mb4_unicode_ci COMMENT '退款渠道的请求体',
+	ADD COLUMN `channel_response` text COLLATE utf8mb4_unicode_ci COMMENT '退款渠道的响应体';