xiongzhu 4 years ago
parent
commit
ffcb21a760

+ 23 - 0
src/main/java/com/izouma/nineth/domain/PayOrderRecord.java

@@ -0,0 +1,23 @@
+package com.izouma.nineth.domain;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import javax.persistence.Entity;
+
+@Data
+@Entity
+@AllArgsConstructor
+@NoArgsConstructor
+public class PayOrderRecord extends BaseEntity {
+
+    private Long orderId;
+
+    private String transactionId;
+
+    private String channel;
+
+    private int type;
+
+}

+ 4 - 1
src/main/java/com/izouma/nineth/domain/SysConfig.java

@@ -29,6 +29,8 @@ public class SysConfig extends AuditedEntity {
     @Enumerated(EnumType.STRING)
     private ValueType type;
 
+    private String options;
+
     public enum ValueType {
         STRING,
         TIME,
@@ -36,6 +38,7 @@ public class SysConfig extends AuditedEntity {
         DATETIME,
         BOOLEAN,
         NUMBER,
-        FILE
+        FILE,
+        SELECT
     }
 }

+ 3 - 0
src/main/java/com/izouma/nineth/listener/BroadcastEventListener.java

@@ -6,6 +6,7 @@ import com.izouma.nineth.config.EventNames;
 import com.izouma.nineth.enums.SearchMode;
 import com.izouma.nineth.service.AdapayMerchantService;
 import com.izouma.nineth.service.OrderCancelService;
+import com.izouma.nineth.service.OrderPayService;
 import com.izouma.nineth.utils.JpaUtils;
 import lombok.AllArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
@@ -49,6 +50,8 @@ public class BroadcastEventListener implements RocketMQListener<JSONObject> {
                         } else if ("order_cancel_time".equals(data.getString("name"))) {
                             int interval = Integer.parseInt(data.getString("value"));
                             OrderCancelService.setOrderCancelInterval(interval);
+                        } else if ("pay_channel".equals(data.getString("name"))) {
+                            OrderPayService.setPayChannel(data.getString("value"));
                         }
                     } catch (Exception e) {
                         log.error("event error", e);

+ 11 - 9
src/main/java/com/izouma/nineth/service/HMPayService.java

@@ -21,10 +21,7 @@ import java.math.RoundingMode;
 import java.net.URLEncoder;
 import java.nio.charset.StandardCharsets;
 import java.time.LocalDateTime;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 
 @Service
 @Slf4j
@@ -82,12 +79,17 @@ public class HMPayService {
         return DateTimeUtils.format(LocalDateTime.now(), "yyyyMMddHHmmss");
     }
 
-    public String getTimeout(int seconds) {
+    public static String getTimeout(int seconds) {
         return DateTimeUtils.format(LocalDateTime.now().plusSeconds(seconds), "yyyyMMddHHmmss");
     }
 
+    public static String getTimeout(LocalDateTime createTime, int seconds) {
+        return DateTimeUtils.format(Optional.ofNullable(createTime).orElse(LocalDateTime.now())
+                .plusSeconds(seconds), "yyyyMMddHHmmss");
+    }
+
     public JSONObject requestAlipayRaw(String orderId, BigDecimal amount, String subject,
-                                       int timeout, String type, String returnUrl) {
+                                       String timeout, String type, String returnUrl) {
         if (orderId.length() < 12) {
             for (int i = orderId.length(); i < 12; i++) {
                 orderId = "0" + orderId;
@@ -98,7 +100,7 @@ public class HMPayService {
         params.put("mer_no", hmPayProperties.getMerNo());
         params.put("mer_order_no", orderId);
         params.put("create_time", getReqTime());
-        params.put("expire_time", getTimeout(timeout));
+        params.put("expire_time", timeout);
         params.put("order_amt", amount.setScale(2, RoundingMode.HALF_UP).stripTrailingZeros().toPlainString());
         params.put("notify_url", hmPayProperties.getNotifyUrl());
         params.put("return_url", returnUrl);
@@ -125,7 +127,7 @@ public class HMPayService {
     }
 
     public String requestAlipay(String orderId, BigDecimal amount, String subject,
-                                int timeout, String type, String returnUrl) {
+                                String timeout, String type, String returnUrl) {
         JSONObject res = requestAlipayRaw(orderId, amount, subject, timeout, type, returnUrl);
         if ("000000".equals(res.getString("ret_code"))) {
             return res.getJSONObject("data").getString("token_id");
@@ -133,7 +135,7 @@ public class HMPayService {
         throw new BusinessException("绿洲宇宙冷却系统已启动,请稍后支付");
     }
 
-    public JSONObject queryOrder(String orderId) {
+    public JSONObject query(String orderId) {
         Map<String, String> bizContent = new HashMap<>();
         bizContent.put("out_order_no", orderId);
         return requestApi("trade.query", bizContent);

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

@@ -1,17 +1,25 @@
 package com.izouma.nineth.service;
 
+import com.alibaba.fastjson.JSONObject;
 import com.izouma.nineth.config.GeneralProperties;
+import com.izouma.nineth.domain.GiftOrder;
+import com.izouma.nineth.domain.MintOrder;
 import com.izouma.nineth.domain.Order;
+import com.izouma.nineth.enums.MintOrderStatus;
 import com.izouma.nineth.enums.OrderStatus;
 import com.izouma.nineth.exception.BusinessException;
 import com.izouma.nineth.repo.GiftOrderRepo;
 import com.izouma.nineth.repo.MintOrderRepo;
 import com.izouma.nineth.repo.OrderRepo;
+import com.izouma.nineth.utils.DateTimeUtils;
 import lombok.AllArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.cache.annotation.Cacheable;
 import org.springframework.stereotype.Service;
 
+import java.time.LocalDateTime;
+import java.util.Optional;
+
 @Service
 @Slf4j
 @AllArgsConstructor
@@ -26,10 +34,12 @@ public class OrderPayService {
     private final GeneralProperties generalProperties;
 
     public static void setPayChannel(String payChannel) {
-        PAY_CHANNEL = payChannel;
+        if ("hmPay".equals(payChannel) || "sandPay".equals(payChannel)) {
+            PAY_CHANNEL = payChannel;
+        }
     }
 
-    @Cacheable(value = "payOrder", key = "#orderId")
+    @Cacheable(value = "payOrder", key = "'order#'+#orderId")
     public String payOrder(Long orderId) {
         Order order = orderRepo.findById(orderId).orElseThrow(new BusinessException("订单不存在"));
         if (order.getStatus() != OrderStatus.NOT_PAID) {
@@ -38,11 +48,55 @@ public class OrderPayService {
         switch (PAY_CHANNEL) {
             case "sandPay":
                 return sandPayService.requestAlipay(orderId + "", order.getTotalPrice(), order.getName(),
-                        order.getName(), 180, "{\"type\":\"order\",\"id\":\"" + orderId + "\"}");
+                        order.getName(), SandPayService.getTimeout(order.getCreatedAt(), 180),
+                        "{\"type\":\"order\",\"id\":\"" + orderId + "\"}");
             case "hmPay":
-                return hmPayService.requestAlipay(orderId + "", order.getTotalPrice(), order.getName(), 180,
+                return hmPayService.requestAlipay(orderId + "", order.getTotalPrice(), order.getName(),
+                        HMPayService.getTimeout(order.getCreatedAt(), 180),
                         "order", generalProperties.getHost() + "/9th/orderDetail?id=" + orderId);
         }
-        return null;
+        throw new BusinessException("绿洲宇宙冷却系统已启动,请稍后支付");
+    }
+
+    @Cacheable(value = "payOrder", key = "'gift#'+#orderId")
+    public String payGiftOrder(Long orderId) {
+        GiftOrder order = giftOrderRepo.findById(orderId).orElseThrow(new BusinessException("订单不存在"));
+        if (order.getStatus() != OrderStatus.NOT_PAID) {
+            throw new BusinessException("订单状态错误");
+        }
+        switch (PAY_CHANNEL) {
+            case "sandPay":
+                return sandPayService.requestAlipay(orderId + "", order.getGasPrice(),
+                        "转赠" + order.getAssetId(), "转赠" + order.getAssetId(),
+                        SandPayService.getTimeout(order.getCreatedAt(), 180),
+                        "{\"type\":\"gift\",\"id\":\"" + orderId + "\"}");
+            case "hmPay":
+                return hmPayService.requestAlipay(orderId + "", order.getGasPrice(),
+                        "转赠" + order.getAssetId(),
+                        HMPayService.getTimeout(order.getCreatedAt(), 180),
+                        "gift", generalProperties.getHost() + "/9th/home");
+        }
+        throw new BusinessException("绿洲宇宙冷却系统已启动,请稍后支付");
+    }
+
+    @Cacheable(value = "payOrder", key = "'mintOrder#'+#orderId")
+    public String payMintOrder(Long orderId) {
+        MintOrder order = mintOrderRepo.findById(orderId).orElseThrow(new BusinessException("订单不存在"));
+        if (order.getStatus() != MintOrderStatus.NOT_PAID) {
+            throw new BusinessException("订单状态错误");
+        }
+        switch (PAY_CHANNEL) {
+            case "sandPay":
+                return sandPayService.requestAlipay(orderId + "", order.getGasPrice(),
+                        "铸造活动:" + order.getMintActivityId(), "铸造活动:" + order.getMintActivityId(),
+                        SandPayService.getTimeout(order.getCreatedAt(), 180),
+                        "{\"type\":\"mintOrder\",\"id\":\"" + orderId + "\"}");
+            case "hmPay":
+                return hmPayService.requestAlipay(orderId + "", order.getGasPrice(),
+                        "铸造活动:" + order.getMintActivityId(),
+                        HMPayService.getTimeout(order.getCreatedAt(), 180),
+                        "mintOrder", generalProperties.getHost() + "/9th/home");
+        }
+        throw new BusinessException("绿洲宇宙冷却系统已启动,请稍后支付");
     }
 }

+ 16 - 8
src/main/java/com/izouma/nineth/service/SandPayService.java

@@ -27,10 +27,12 @@ import java.net.URLDecoder;
 import java.nio.charset.StandardCharsets;
 import java.text.DecimalFormat;
 import java.text.DecimalFormatSymbols;
+import java.time.LocalDate;
 import java.time.LocalDateTime;
 import java.util.HashMap;
 import java.util.Locale;
 import java.util.Map;
+import java.util.Optional;
 
 @Service
 @AllArgsConstructor
@@ -47,10 +49,15 @@ public class SandPayService {
         return DateTimeUtils.format(LocalDateTime.now(), "yyyyMMddHHmmss");
     }
 
-    public String getTimeout(int seconds) {
+    public static String getTimeout(int seconds) {
         return DateTimeUtils.format(LocalDateTime.now().plusSeconds(seconds), "yyyyMMddHHmmss");
     }
 
+    public static String getTimeout(LocalDateTime createTime, int seconds) {
+        return DateTimeUtils.format(Optional.ofNullable(createTime).orElse(LocalDateTime.now())
+                .plusSeconds(seconds), "yyyyMMddHHmmss");
+    }
+
     public String convertAmount(BigDecimal amount) {
         DecimalFormat df = new DecimalFormat("000000000000", DecimalFormatSymbols.getInstance(Locale.US));
         return df.format(amount.multiply(new BigDecimal("100")));
@@ -120,7 +127,7 @@ public class SandPayService {
     }
 
     public String requestAlipay(String orderId, BigDecimal amount, String subject, String desc,
-                                int timeout, String extend) {
+                                String timeout, String extend) {
         JSONObject res = requestAlipayRaw(orderId, amount, subject, desc, timeout, extend);
         if ("000000".equals(res.getJSONObject("head").getString("respCode"))) {
             return "alipays://platformapi/startapp?saId=10000007&qrcode=" + res.getJSONObject("body").getString("qrCode");
@@ -129,7 +136,7 @@ public class SandPayService {
     }
 
     public JSONObject requestAlipayRaw(String orderId, BigDecimal amount, String subject, String desc,
-                                       int timeout, String extend) {
+                                       String timeout, String extend) {
         if (orderId.length() < 12) {
             for (int i = orderId.length(); i < 12; i++) {
                 orderId = "0" + orderId;
@@ -151,7 +158,7 @@ public class SandPayService {
         //body.put("limitPay", "5");                                  //限定支付方式 送1-限定不能使用贷记卡	送4-限定不能使用花呗	送5-限定不能使用贷记卡+花呗
         body.put("subject", subject);                                 //订单标题
         body.put("body", desc);                                       //订单描述
-        body.put("txnTimeOut", getTimeout(timeout));                  //订单超时时间
+        body.put("txnTimeOut", timeout);                              //订单超时时间
         body.put("notifyUrl", sandPayProperties.getNotifyUrl());      //异步通知地址
         body.put("bizExtendParams", "");                              //业务扩展参数
         body.put("merchExtendParams", "");                            //商户扩展参数
@@ -249,7 +256,7 @@ public class SandPayService {
         extend.put("id", orderId);
 
         JSONObject res = requestAlipayRaw(orderId.toString(), order.getTotalPrice(), order.getName(), order.getName(),
-                180, extend.toJSONString());
+                getTimeout(order.getCreatedAt(), 180), extend.toJSONString());
         if (res == null)
             throw new BusinessException("下单失败,请稍后再试");
 
@@ -305,8 +312,9 @@ public class SandPayService {
         extend.put("type", "gift");
         extend.put("id", orderId);
 
-        JSONObject res = requestAlipayRaw(orderId.toString(), order.getGasPrice(), "转增" + order.getAssetId(), "转增" + order.getAssetId(),
-                180, extend.toJSONString());
+        JSONObject res = requestAlipayRaw(orderId.toString(), order.getGasPrice(), "转增" + order.getAssetId(),
+                "转增" + order.getAssetId(),
+                getTimeout(order.getCreatedAt(), 180), extend.toJSONString());
         if (res == null)
             throw new BusinessException("下单失败,请稍后再试");
 
@@ -335,7 +343,7 @@ public class SandPayService {
         extend.put("id", orderId);
 
         JSONObject res = requestAlipayRaw(orderId.toString(), order.getGasPrice(), "铸造活动:" + order.getMintActivityId(),
-                "铸造活动:" + order.getMintActivityId(), 180, extend.toJSONString());
+                "铸造活动:" + order.getMintActivityId(), getTimeout(order.getCreatedAt(), 180), extend.toJSONString());
         if (res == null)
             throw new BusinessException("下单失败,请稍后再试");
 

+ 11 - 0
src/main/java/com/izouma/nineth/service/SysConfigService.java

@@ -106,7 +106,18 @@ public class SysConfigService {
                     .value("210")
                     .build());
         }
+        if (sysConfigRepo.findByName("pay_channel").isEmpty()) {
+            sysConfigRepo.save(SysConfig.builder()
+                    .name("pay_channel")
+                    .desc("支付通道")
+                    .type(SysConfig.ValueType.SELECT)
+                    .value("sandPay")
+                    .options("hmPay,sandPay")
+                    .build());
+        }
         SearchMode searchMode = SearchMode.valueOf(sysConfigRepo.findByName("default_search_mode").get().getValue());
         JpaUtils.setDefaultSearchMode(searchMode);
+
+        OrderPayService.setPayChannel(sysConfigRepo.findByName("pay_channel").get().getValue());
     }
 }

+ 1 - 1
src/main/java/com/izouma/nineth/web/HmPayController.java

@@ -65,6 +65,6 @@ public class HmPayController extends BaseController {
                     mintOrderService.mintNotify(id, PayMethod.ALIPAY, plat_trx_no);
             }
         }
-        return "respCode=000000";
+        return "SUCCESS";
     }
 }

+ 88 - 0
src/main/java/com/izouma/nineth/web/OrderPayControllerV2.java

@@ -0,0 +1,88 @@
+package com.izouma.nineth.web;
+
+import com.alibaba.fastjson.JSON;
+import com.github.binarywang.wxpay.bean.order.WxPayMpOrderResult;
+import com.github.binarywang.wxpay.constant.WxPayConstants;
+import com.github.binarywang.wxpay.exception.WxPayException;
+import com.huifu.adapay.core.exception.BaseAdaPayException;
+import com.izouma.nineth.domain.Order;
+import com.izouma.nineth.enums.OrderStatus;
+import com.izouma.nineth.exception.BusinessException;
+import com.izouma.nineth.repo.OrderRepo;
+import com.izouma.nineth.service.*;
+import io.swagger.annotations.ApiOperation;
+import lombok.AllArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import me.chanjar.weixin.common.error.WxErrorException;
+import me.chanjar.weixin.mp.api.WxMpService;
+import me.chanjar.weixin.mp.bean.result.WxMpOAuth2AccessToken;
+import me.chanjar.weixin.mp.bean.result.WxMpUser;
+import org.apache.commons.codec.EncoderException;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.regex.Pattern;
+
+@Controller
+@RequestMapping("/payOrder/v2")
+@Slf4j
+@AllArgsConstructor
+public class OrderPayControllerV2 {
+    private final OrderRepo       orderRepo;
+    private final SandPayService  sandPayService;
+    private final OrderPayService orderPayService;
+
+    @RequestMapping(value = "/alipay", method = RequestMethod.GET)
+    @ResponseBody
+    public String payOrderAlipayH5(Long id) {
+        return orderPayService.payOrder(id);
+    }
+
+    @RequestMapping(value = "/alipay_wx", method = RequestMethod.GET)
+    public String payOrderAlipayWx(Long id, Model model) {
+        Order order = orderRepo.findById(id).orElseThrow(new BusinessException("订单不存在"));
+        if (order.getStatus() != OrderStatus.NOT_PAID) {
+            return "redirect:/9th/store";
+        }
+        String payUrl = orderPayService.payOrder(id);
+        model.addAttribute("payUrl", payUrl);
+        model.addAttribute("orderId", id);
+        return "AlipayHtml";
+    }
+
+    @ApiOperation("衫德h5快捷")
+    @RequestMapping(value = "/sandQuick", method = RequestMethod.GET, produces = "text/html")
+    @ResponseBody
+    public String sandQuick(@RequestParam Long id) {
+        return sandPayService.payOrderQuick(id);
+    }
+
+    @RequestMapping(value = "/gift/alipay", method = RequestMethod.GET)
+    @ResponseBody
+    public String payGiftOrderAlipayH5(Long id) {
+        return orderPayService.payGiftOrder(id);
+    }
+
+    @RequestMapping(value = "/gift/alipay_wx", method = RequestMethod.GET)
+    public String payGiftOrderAlipayWx(Long id, Model model) {
+        String payUrl = orderPayService.payGiftOrder(id);
+        model.addAttribute("payUrl", payUrl);
+        model.addAttribute("orderId", id);
+        return "AlipayHtml";
+    }
+
+    @RequestMapping(value = "/mint/alipay", method = RequestMethod.GET)
+    @ResponseBody
+    public String payMintOrderAlipayH5(Long id) {
+        return orderPayService.payMintOrder(id);
+    }
+
+    @RequestMapping(value = "/mint/alipay_wx", method = RequestMethod.GET)
+    public String payMintOrderAlipayWx(Long id, Model model) {
+        String payUrl = orderPayService.payMintOrder(id);
+        model.addAttribute("payUrl", payUrl);
+        model.addAttribute("orderId", id);
+        return "AlipayHtml2";
+    }
+}

+ 71 - 0
src/main/java/com/izouma/nineth/web/PayChannelMgmtController.java

@@ -0,0 +1,71 @@
+package com.izouma.nineth.web;
+
+import com.alibaba.fastjson.JSON;
+import com.izouma.nineth.service.HMPayService;
+import com.izouma.nineth.service.SandPayService;
+import com.izouma.nineth.utils.SnowflakeIdWorker;
+import lombok.AllArgsConstructor;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.math.BigDecimal;
+
+@RestController
+@RequestMapping("/payChannelMgmt")
+@AllArgsConstructor
+@PreAuthorize("hasRole('ADMIN')")
+public class PayChannelMgmtController {
+    private final SandPayService    sandPayService;
+    private final HMPayService      hmPayService;
+    private final SnowflakeIdWorker snowflakeIdWorker;
+
+    @GetMapping(value = "/pay")
+    private String pay(@RequestParam String channel) {
+        switch (channel) {
+            case "sandPay":
+                return sandPayService.requestAlipay(snowflakeIdWorker.nextId() + "",
+                        new BigDecimal("0.01"), "话费充值", "话费充值",
+                        SandPayService.getTimeout(180), "{\"type\":\"test\",\"id\":1}");
+            case "hmPay":
+                return hmPayService.requestAlipay(snowflakeIdWorker.nextId() + "",
+                        new BigDecimal("0.01"), "话费充值",
+                        HMPayService.getTimeout(180), "test", "https://www.baidu.com");
+        }
+        return null;
+    }
+
+    @GetMapping(value = "/transfer")
+    private String testTransfer(@RequestParam String name, @RequestParam String bank, @RequestParam BigDecimal amount) {
+        return JSON.toJSONString(sandPayService.transfer(snowflakeIdWorker.nextId() + "", name, bank, amount), true);
+    }
+
+    @GetMapping(value = "/refund")
+    public String refund(@RequestParam String channel, @RequestParam String orderId, @RequestParam BigDecimal amount) {
+        switch (channel) {
+            case "sandPay":
+                return JSON.toJSONString(sandPayService.refund(orderId, amount), true);
+            case "hmPay":
+                return JSON.toJSONString(hmPayService.refund(orderId, amount), true);
+        }
+        return null;
+    }
+
+    @GetMapping(value = "/query")
+    public String refund(@RequestParam String channel, @RequestParam String id) {
+        switch (channel) {
+            case "sandPay":
+                return JSON.toJSONString(sandPayService.query(id), true);
+            case "hmPay":
+                return JSON.toJSONString(hmPayService.query(id), true);
+        }
+        return null;
+    }
+
+    @GetMapping("/queryTransfer")
+    public String queryTransfer(@RequestParam String tranTime, @RequestParam String orderId) {
+        return JSON.toJSONString(sandPayService.queryTransfer(tranTime, orderId), true);
+    }
+}

+ 0 - 53
src/main/java/com/izouma/nineth/web/SandPayTestController.java

@@ -1,53 +0,0 @@
-package com.izouma.nineth.web;
-
-import com.alibaba.fastjson.JSON;
-import com.alibaba.fastjson.JSONObject;
-import com.izouma.nineth.service.SandPayService;
-import com.izouma.nineth.utils.SnowflakeIdWorker;
-import lombok.AllArgsConstructor;
-import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.RestController;
-
-import java.math.BigDecimal;
-
-@RestController
-@RequestMapping("/sandPayMgr")
-@AllArgsConstructor
-@PreAuthorize("hasRole('ADMIN')")
-public class SandPayTestController {
-    private final SandPayService    sandPayService;
-    private final SnowflakeIdWorker snowflakeIdWorker;
-
-    @GetMapping(value = "/pay")
-    private String pay() {
-        JSONObject extend = new JSONObject();
-        extend.put("type", "test");
-        extend.put("id", 1);
-        JSONObject res = sandPayService.requestAlipayRaw(snowflakeIdWorker.nextId() + "", new BigDecimal("0.01"),
-                "话费充值", "话费充值", 180, extend.toJSONString());
-        return JSON.toJSONString(res, true);
-    }
-
-    @GetMapping(value = "/transfer")
-    private String testTransfer(@RequestParam String name, @RequestParam String bank, @RequestParam BigDecimal amount) {
-        return JSON.toJSONString(sandPayService.transfer(snowflakeIdWorker.nextId() + "", name, bank, amount), true);
-    }
-
-    @GetMapping(value = "/refund")
-    public String refund(@RequestParam String orderId, @RequestParam BigDecimal amount) {
-        return JSON.toJSONString(sandPayService.refund(orderId, amount), true);
-    }
-
-    @GetMapping(value = "/query")
-    public String refund(@RequestParam String id) {
-        return JSON.toJSONString(sandPayService.query(id), true);
-    }
-
-    @GetMapping("/queryTransfer")
-    public String queryTransfer(@RequestParam String tranTime, @RequestParam String orderId) {
-        return JSON.toJSONString(sandPayService.queryTransfer(tranTime, orderId), true);
-    }
-}

+ 13 - 1
src/main/vue/src/views/SysConfigList.vue

@@ -96,6 +96,14 @@
                         active-value="1"
                         inactive-value="0"
                     ></el-switch>
+                    <el-select v-if="formData.type === 'SELECT'" v-model="formData.value">
+                        <el-option
+                            v-for="item in formData.options.split(',')"
+                            :key="item"
+                            :label="item"
+                            :value="item"
+                        ></el-option>
+                    </el-select>
                     <el-input-number v-model="formData.value" v-if="formData.type === 'NUMBER'"></el-input-number>
                     <file-upload v-model="formData.value" v-if="formData.type === 'FILE'" :limit="1"></file-upload>
                 </el-form-item>
@@ -163,9 +171,13 @@ export default {
                 {
                     label: '文件',
                     value: 'FILE'
+                },
+                {
+                    label: '选择',
+                    value: 'SELECT'
                 }
             ],
-            htmlContents:['']
+            htmlContents: ['']
         };
     },
     computed: {

+ 5 - 2
src/test/java/com/izouma/nineth/service/SandPayServiceTest.java

@@ -2,11 +2,13 @@ package com.izouma.nineth.service;
 
 import com.alibaba.fastjson.JSONObject;
 import com.izouma.nineth.ApplicationTests;
+import com.izouma.nineth.utils.DateTimeUtils;
 import com.izouma.nineth.utils.SnowflakeIdWorker;
 import org.junit.jupiter.api.Test;
 import org.springframework.beans.factory.annotation.Autowired;
 
 import java.math.BigDecimal;
+import java.time.LocalDateTime;
 
 class SandPayServiceTest extends ApplicationTests {
     @Autowired
@@ -16,8 +18,9 @@ class SandPayServiceTest extends ApplicationTests {
 
     @Test
     void requestAlipay() {
-        JSONObject jsonObject = sandPayService.requestAlipayRaw(snowflakeIdWorker.nextId() + "", new BigDecimal("0.01"),
-                "话费充值", "话费充值", 180, "");
+        JSONObject jsonObject = sandPayService.requestAlipayRaw(snowflakeIdWorker.nextId() + "",
+                new BigDecimal("0.01"), "话费充值", "话费充值",
+                DateTimeUtils.format(LocalDateTime.now().plusSeconds(3), "yyyyMMddHHmmss"), "");
         System.out.println(JSONObject.toJSONString(jsonObject, true));
     }