|
|
@@ -52,22 +52,22 @@ public class ProductOrderController extends BaseController { |
|
|
|
public ResultData createOrder(@RequestBody ProductOrder record) { |
|
|
|
logger.debug("[" + getIpAddr() + "] ProductOrderController::createOrder"); |
|
|
|
Long productId = record.getProductId(); |
|
|
|
Integer payVendor = record.getPayVendor(); |
|
|
|
// Integer payVendor = record.getPayVendor(); |
|
|
|
if(productId == null){ |
|
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"商品编号为空"); |
|
|
|
} |
|
|
|
if(payVendor == null){ |
|
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"支付方式为空"); |
|
|
|
} |
|
|
|
// if(payVendor == null){ |
|
|
|
// return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"支付方式为空"); |
|
|
|
// } |
|
|
|
|
|
|
|
Product product = productService.getById(productId); |
|
|
|
if(product == null){ |
|
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"未查询到商品"); |
|
|
|
} |
|
|
|
EnumProductOrderPayVendor payVendorEnum = EnumProductOrderPayVendor.getEnum(payVendor); |
|
|
|
if(payVendorEnum == null){ |
|
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"支付方式参数错误"); |
|
|
|
} |
|
|
|
// EnumProductOrderPayVendor payVendorEnum = EnumProductOrderPayVendor.getEnum(payVendor); |
|
|
|
// if(payVendorEnum == null){ |
|
|
|
// return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"支付方式参数错误"); |
|
|
|
// } |
|
|
|
|
|
|
|
record = new ProductOrder(); |
|
|
|
record.setUserId(getMemberId()); |
|
|
@@ -76,10 +76,10 @@ public class ProductOrderController extends BaseController { |
|
|
|
record.setProductEnTitle(product.getEnTitle()); |
|
|
|
record.setOrderStatus(EnumProductOrderStatus.ORDER_STATUS_PENDING_PAYMENT.getCode()); |
|
|
|
record.setProjectType(product.getProjectType()); |
|
|
|
record.setPayVendor(payVendorEnum.getCode()); |
|
|
|
// record.setPayVendor(payVendorEnum.getCode()); |
|
|
|
record.setOrderPrice(product.getPriceRmb()); |
|
|
|
|
|
|
|
record.setProfitSharing(payVendorEnum.getProfitSharing()); |
|
|
|
// record.setProfitSharing(payVendorEnum.getProfitSharing()); |
|
|
|
|
|
|
|
productOrderService.saveOrUpdate(record); |
|
|
|
return new ResultData(record.getOrderNumber()); |
|
|
@@ -116,9 +116,17 @@ public class ProductOrderController extends BaseController { |
|
|
|
logger.debug("[" + getIpAddr() + "] ProductOrderController::createPay"); |
|
|
|
String orderNumber = record.getOrderNumber(); |
|
|
|
String openId = record.getOpenId(); |
|
|
|
Integer payVendor = record.getPayVendor(); |
|
|
|
if(StringUtils.isBlank(orderNumber)){ |
|
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"订单号为空"); |
|
|
|
} |
|
|
|
if(payVendor == null){ |
|
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"支付方式为空"); |
|
|
|
} |
|
|
|
EnumProductOrderPayVendor payVendorEnum = EnumProductOrderPayVendor.getEnum(payVendor); |
|
|
|
if(payVendorEnum == null){ |
|
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"支付方式参数错误"); |
|
|
|
} |
|
|
|
Long id = null; |
|
|
|
try{ |
|
|
|
id = Long.parseLong(orderNumber); |
|
|
@@ -131,7 +139,7 @@ public class ProductOrderController extends BaseController { |
|
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"未查询到订单"); |
|
|
|
} |
|
|
|
|
|
|
|
if(EnumProductOrderPayVendor.PAY_WAY_WECHAT.getCode().equals(productOrder.getPayVendor())){ |
|
|
|
if(EnumProductOrderPayVendor.PAY_WAY_WECHAT.getCode().equals(record.getPayVendor())){ |
|
|
|
if(StringUtils.isBlank(openId)){ |
|
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"openId为空"); |
|
|
|
} |
|
|
|