|  | @@ -2,7 +2,11 @@ package com.zanxiang.sdk.controller;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  import com.alibaba.nacos.common.utils.IPUtil;
 | 
	
		
			
				|  |  |  import com.zanxiang.common.domain.ResultMap;
 | 
	
		
			
				|  |  | +import com.zanxiang.common.domain.ResultVo;
 | 
	
		
			
				|  |  | +import com.zanxiang.common.enums.HttpStatusEnum;
 | 
	
		
			
				|  |  |  import com.zanxiang.common.enums.PayWayEnum;
 | 
	
		
			
				|  |  | +import com.zanxiang.common.utils.StringUtils;
 | 
	
		
			
				|  |  | +import com.zanxiang.sdk.domain.bo.PlatformOrderBO;
 | 
	
		
			
				|  |  |  import com.zanxiang.sdk.domain.bo.ProductPayParamBO;
 | 
	
		
			
				|  |  |  import com.zanxiang.sdk.domain.dto.PlatformOrderDTO;
 | 
	
		
			
				|  |  |  import com.zanxiang.sdk.domain.params.ProductPayParam;
 | 
	
	
		
			
				|  | @@ -12,12 +16,15 @@ import io.swagger.annotations.Api;
 | 
	
		
			
				|  |  |  import io.swagger.annotations.ApiOperation;
 | 
	
		
			
				|  |  |  import org.jdom.JDOMException;
 | 
	
		
			
				|  |  |  import org.springframework.beans.factory.annotation.Autowired;
 | 
	
		
			
				|  |  | +import org.springframework.validation.annotation.Validated;
 | 
	
		
			
				|  |  |  import org.springframework.web.bind.annotation.*;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  import javax.annotation.Resource;
 | 
	
		
			
				|  |  |  import javax.servlet.http.HttpServletRequest;
 | 
	
		
			
				|  |  |  import javax.servlet.http.HttpServletResponse;
 | 
	
		
			
				|  |  |  import java.io.IOException;
 | 
	
		
			
				|  |  | +import java.math.BigDecimal;
 | 
	
		
			
				|  |  | +import java.util.Objects;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  /**
 | 
	
		
			
				|  |  |   * 支付公共入口
 | 
	
	
		
			
				|  | @@ -37,10 +44,24 @@ public class PayController {
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      @ApiOperation(value = "支付参数生成")
 | 
	
		
			
				|  |  |      @GetMapping(value = "/create")
 | 
	
		
			
				|  |  | -    public ResultMap create(@RequestBody ProductPayParam product) {
 | 
	
		
			
				|  |  | +    public ResultMap create(@Validated @RequestBody ProductPayParam product) {
 | 
	
		
			
				|  |  | +        String userId = "1";
 | 
	
		
			
				|  |  | +        if (StringUtils.isEmpty(product.getOrderId())) {
 | 
	
		
			
				|  |  | +            //虚拟充值情况,直接传金额实时生成订单
 | 
	
		
			
				|  |  | +            if (product.getAmount() == null || Objects.equals(product.getAmount(), BigDecimal.ZERO)) {
 | 
	
		
			
				|  |  | +                return ResultMap.error(HttpStatusEnum.ORDER_AMOUNT_IS_NULL.getMsg());
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            PlatformOrderBO orderBO = new PlatformOrderBO();
 | 
	
		
			
				|  |  | +            orderBO.setAmount(product.getAmount());
 | 
	
		
			
				|  |  | +            orderBO.setProductName("充值" + product.getAmount());
 | 
	
		
			
				|  |  | +            orderBO.setProductId("ptb_charge");
 | 
	
		
			
				|  |  | +            orderBO.setMgUserId(product.getMgUserId());
 | 
	
		
			
				|  |  | +            orderBO.setUserId(userId);
 | 
	
		
			
				|  |  | +            String orderId = platformOrderService.create(orderBO);
 | 
	
		
			
				|  |  | +            product.setOrderId(orderId);
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  |          PlatformOrderDTO info = platformOrderService.info("1", "1");
 | 
	
		
			
				|  |  |          System.out.println(info);
 | 
	
		
			
				|  |  | -        String userId = "1";
 | 
	
		
			
				|  |  |          ProductPayParamBO bo = new ProductPayParamBO();
 | 
	
		
			
				|  |  |          bo.setUserId(userId);
 | 
	
		
			
				|  |  |          bo.setPayDevice(product.getPayDevice());
 |