|
@@ -14,10 +14,7 @@ import com.iformall.domain.po.sm.PersonPhoto; |
|
|
import com.iformall.enums.EnumComposeOrder; |
|
|
import com.iformall.enums.EnumComposeOrder; |
|
|
import com.iformall.enums.EnumProductOrderPayVendor; |
|
|
import com.iformall.enums.EnumProductOrderPayVendor; |
|
|
import com.iformall.enums.EnumProductOrderStatus; |
|
|
import com.iformall.enums.EnumProductOrderStatus; |
|
|
import com.iformall.service.ProductOrderService; |
|
|
|
|
|
import com.iformall.service.ProductService; |
|
|
|
|
|
import com.iformall.service.WxAppinfoService; |
|
|
|
|
|
import com.iformall.service.WxPayAccountService; |
|
|
|
|
|
|
|
|
import com.iformall.service.*; |
|
|
import com.iformall.service.pay.PayServiceFactory; |
|
|
import com.iformall.service.pay.PayServiceFactory; |
|
|
import com.iformall.service.pay.entity.PayExtraParam; |
|
|
import com.iformall.service.pay.entity.PayExtraParam; |
|
|
import com.iformall.service.pay.service.pay.PayAdapterService; |
|
|
import com.iformall.service.pay.service.pay.PayAdapterService; |
|
@@ -55,6 +52,9 @@ public class ProductOrderController extends BaseController { |
|
|
@Autowired |
|
|
@Autowired |
|
|
WxPayAccountService wxPayAccountService; |
|
|
WxPayAccountService wxPayAccountService; |
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
|
WxCUserBasicInfoService wxCUserBasicInfoService; |
|
|
|
|
|
|
|
|
@Autowired |
|
|
@Autowired |
|
|
PayServiceFactory payServiceFactory; |
|
|
PayServiceFactory payServiceFactory; |
|
|
|
|
|
|
|
@@ -212,4 +212,61 @@ public class ProductOrderController extends BaseController { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@AuthIgnore |
|
|
|
|
|
@ApiOperation(value = "获取详情链接", notes = "") |
|
|
|
|
|
@PostMapping("getPayUrl") |
|
|
|
|
|
public ResultData getPayUrl(@RequestBody ProductOrder record) { |
|
|
|
|
|
logger.debug("[" + getIpAddr() + "] ProductOrderController::getPayUrl"); |
|
|
|
|
|
|
|
|
|
|
|
return new ResultData(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@AuthIgnore |
|
|
|
|
|
@ApiOperation(value = "创建支付(不验证)", notes = "") |
|
|
|
|
|
@PostMapping("pay") |
|
|
|
|
|
public ResultData pay(@RequestBody ProductOrder record) { |
|
|
|
|
|
logger.debug("[" + getIpAddr() + "] ProductOrderController::pay"); |
|
|
|
|
|
if(record.getPayVendor() == null){ |
|
|
|
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"支付方式为空"); |
|
|
|
|
|
} |
|
|
|
|
|
EnumProductOrderPayVendor payVendorEnum = EnumProductOrderPayVendor.getEnum(record.getPayVendor()); |
|
|
|
|
|
if(payVendorEnum == null){ |
|
|
|
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"支付方式参数错误"); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if(EnumProductOrderPayVendor.PAY_WAY_WECHAT.getCode().equals(record.getPayVendor())){ |
|
|
|
|
|
if(StringUtils.isBlank(record.getOpenId())){ |
|
|
|
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"openId为空"); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
record.setProfitSharing(payVendorEnum.getProfitSharing()); |
|
|
|
|
|
|
|
|
|
|
|
if(record.getUserId() == null){ |
|
|
|
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"用户编号为空"); |
|
|
|
|
|
} |
|
|
|
|
|
WxCUserBasicInfo basicUser = wxCUserBasicInfoService.getById(record.getUserId()); |
|
|
|
|
|
if(basicUser == null){ |
|
|
|
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"未查询到用户"); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if(record.getProductId() == null){ |
|
|
|
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"商品编号为空"); |
|
|
|
|
|
} |
|
|
|
|
|
Product product = productService.getById(record.getProductId()); |
|
|
|
|
|
if(product == null){ |
|
|
|
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"未查询到商品"); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
record.setProductTitle(product.getTitle()); |
|
|
|
|
|
record.setProductEnTitle(product.getEnTitle()); |
|
|
|
|
|
record.setOrderStatus(EnumProductOrderStatus.ORDER_STATUS_PENDING_PAYMENT.getCode()); |
|
|
|
|
|
record.setProjectType(product.getProjectType()); |
|
|
|
|
|
record.setOrderPrice(product.getPriceRmb()); |
|
|
|
|
|
productOrderService.saveOrUpdate(record); |
|
|
|
|
|
|
|
|
|
|
|
return productOrderService.createPay(record); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |