wangqifan 3 gadi atpakaļ
vecāks
revīzija
a37d0681d4

+ 5 - 5
src/main/java/com/izouma/nineth/service/CollectionService.java

@@ -657,16 +657,16 @@ public class CollectionService {
             PageWrapper<Collection> dtoPage = new PageWrapper<>(page.getContent(), page.getPageable().getPageNumber(),
                     page.getPageable().getPageSize(), page.getTotalElements());
             Page<CollectionDTO> pageNew = toDTO(dtoPage.toPage());
-            if (CollectionUtils.isNotEmpty(pageNew.getContent())){
+            if (CollectionUtils.isNotEmpty(pageNew.getContent())) {
                 LocalDateTime dateTime = null;
-                List<CollectionDTO>  collectionDtoList = new ArrayList<>();
+                List<CollectionDTO> collectionDtoList = new ArrayList<>();
                 for (CollectionDTO collectionDTO : pageNew.getContent()) {
                     if (dateTime == null) {
                         dateTime = collectionDTO.getStartTime();
                         collectionDtoList.add(collectionDTO);
-                    }else if (dateTime.equals(collectionDTO.getStartTime())){
+                    } else if (dateTime.equals(collectionDTO.getStartTime())) {
                         collectionDtoList.add(collectionDTO);
-                    }else {
+                    } else {
                         subscribeMapDtoList.add(SubscribeMapDto.builder()
                                 .localTime(dateTime.toLocalTime())
                                 .collectionDTOS(new ArrayList<>(collectionDtoList))
@@ -687,7 +687,7 @@ public class CollectionService {
                         .subscribeMapDto(new ArrayList<>(subscribeMapDtoList))
                         .build());
             }
-            if (CollectionUtils.isNotEmpty(subscribeMapDtoList)){
+            if (CollectionUtils.isNotEmpty(subscribeMapDtoList)) {
                 subscribeMapDtoList.clear();
             }
         });

+ 30 - 32
src/main/java/com/izouma/nineth/service/SandPayService.java

@@ -180,7 +180,7 @@ public class SandPayService {
         return requestServer(header, body, "https://cashier.sandpay.com.cn/qr/api/order/create");
     }
 
-    public JSONObject requestQuick(String orderId, BigDecimal amount, String subject, String desc,
+    public JSONObject requestQuick(Long userId, String orderId, BigDecimal amount, String subject, String desc,
                                    int timeout, String extend, String frontUrl) {
         if (orderId.length() < 12) {
             for (int i = orderId.length(); i < 12; i++) {
@@ -188,36 +188,32 @@ public class SandPayService {
             }
         }
         JSONObject header = new JSONObject();
-        header.put("version", "1.0");                         //版本号
-        header.put("method", "sandpay.trade.pay");            //接口名称:统一下单
-        header.put("mid", sandPayProperties.getMid());        //商户号
-        header.put("accessType", "1");                        //接入类型设置为平台商户接入		//接入类型设置为普通商户接入
-        header.put("channelType", "07");                      //渠道类型:07-互联网   08-移动端
-        header.put("reqTime", getReqTime());                  //请求时间
-        header.put("productId", "00000008");                  //产品编码
+        header.put("version", "1.0");                      //版本号
+        header.put("method", "sandPay.fastPay.quickPay.index");   //接口名称:统一下单并支付
+        header.put("productId", "00000016");               //产品编码
+        header.put("mid", sandPayProperties.getMid());     //商户号
+        header.put("accessType", "1");                     //接入类型设置为普通商户接入
+        header.put("channelType", "07");                   //渠道类型:07-互联网   08-移动端
+        header.put("reqTime", getReqTime());               //请求时间
 
         JSONObject body = new JSONObject();
-        body.put("orderCode", orderId);                                           //商户订单号
-        body.put("totalAmount", convertAmount(amount));                           //订单金额
-        body.put("subject", subject);                                             //订单标题
-        body.put("body", desc);                                                   //订单描述
-        body.put("txnTimeOut", getTimeout(timeout));                              //订单超时时间
-        body.put("clientIp", "192.168.22.55");                                    //客户端IP
-        body.put("limitPay", "");                                                 //限定支付方式	送1-限定不能使用贷记卡送	4-限定不能使用花呗	送5-限定不能使用贷记卡+花呗
-        body.put("notifyUrl", sandPayProperties.getNotifyUrl());                  //异步通知地址
-        body.put("frontUrl", frontUrl);                                           //前台通知地址
-        body.put("storeId", "");                                                  //商户门店编号
-        body.put("terminalId", "");                                               //商户终端编号
-        body.put("operatorId", "");                                               //操作员编号
-        body.put("clearCycle", "");                                               //清算模式
-        body.put("royaltyInfo", "");                                              //分账信息
-        body.put("riskRateInfo", "");                                             //风控信息域
-        body.put("bizExtendParams", "");                                          //业务扩展参数
-        body.put("merchExtendParams", "");                                        //商户扩展参数
-        body.put("extend", extend);                                               //扩展域
-        body.put("payMode", "sand_h5");                                           //支付模式
-
-        return requestServer(header, body, "https://cashier.sandpay.com.cn/gateway/api/order/pay");
+        body.put("userId", userId);//支付工具: 固定填写0401
+        body.put("orderCode", orderId);
+        body.put("orderTime", getReqTime());  //商户订单号
+        body.put("totalAmount", convertAmount(amount));               //订单金额 12位长度,精确到分
+        //body.put("limitPay", "5");                                  //限定支付方式 送1-限定不能使用贷记卡	送4-限定不能使用花呗	送5-限定不能使用贷记卡+花呗
+        body.put("subject", subject);                                 //订单标题
+        body.put("body", desc);                                       //订单描述
+        body.put("txnTimeOut", timeout);
+        body.put("currencyCode", 156);   //订单超时时间
+        body.put("notifyUrl", sandPayProperties.getNotifyUrl());
+        body.put("frontUrl", frontUrl);
+        //异步通知地址
+//        body.put("bizExtendParams", "");                              //业务扩展参数
+//        body.put("merchExtendParams", "");                            //商户扩展参数
+        body.put("extend", extend);
+
+        return requestServer(header, body, "https://cashier.sandpay.com.cn/fastPay/quickPay/index");
     }
 
     public JSONObject query(String orderId) {
@@ -297,7 +293,8 @@ public class SandPayService {
         extend.put("type", "order");
         extend.put("id", orderId);
 
-        JSONObject res = requestQuick(orderId.toString(), order.getTotalPrice(), order.getName(), order.getName(),
+        JSONObject res = requestQuick(order.getUserId(), orderId.toString(), order.getTotalPrice(), order
+                        .getName(), order.getName(),
                 180, extend.toJSONString(), generalProperties.getHost() + "/9th/orderDetail?id=" + orderId);
         if (res == null)
             throw new BusinessException("下单失败,请稍后再试");
@@ -325,7 +322,8 @@ public class SandPayService {
         extend.put("type", "gift");
         extend.put("id", orderId);
 
-        JSONObject res = requestQuick(orderId.toString(), order.getGasPrice(), "转增" + order.getAssetId(),
+        JSONObject res = requestQuick(order.getUserId(), orderId.toString(), order.getGasPrice(), "转增" + order
+                        .getAssetId(),
                 "转增" + order.getAssetId(), 180, extend.toJSONString(),
                 generalProperties.getHost() + "/9th/");
         if (res == null)
@@ -354,7 +352,7 @@ public class SandPayService {
         extend.put("type", "mintOrder");
         extend.put("id", orderId);
 
-        JSONObject res = requestQuick(orderId.toString(), order.getGasPrice(),
+        JSONObject res = requestQuick(order.getUserId(), orderId.toString(), order.getGasPrice(),
                 "铸造活动:" + order.getMintActivityId(), "铸造活动:" + order.getMintActivityId(),
                 180, extend.toJSONString(), generalProperties.getHost() + "/9th/");
         if (res == null)