diff --git a/suimangCApi/src/main/java/com/iformall/controller/MiniAppUserController.java b/suimangCApi/src/main/java/com/iformall/controller/MiniAppUserController.java index 840b0f6..61d72cb 100644 --- a/suimangCApi/src/main/java/com/iformall/controller/MiniAppUserController.java +++ b/suimangCApi/src/main/java/com/iformall/controller/MiniAppUserController.java @@ -213,7 +213,6 @@ public class MiniAppUserController extends BaseController { }catch(Exception e){} } - Map resultMap = new HashMap(); try { @@ -255,7 +254,6 @@ public class MiniAppUserController extends BaseController { return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "appId 不能为空"); } - WxAppinfo wxAppinfo = wxAppinfoService.getOnlyByAppIdFromRedis(appId); if(wxAppinfo == null){ return new ResultData(ErrorCode.APP_ID_NOT_FOUND); diff --git a/suimangCApi/src/main/java/com/iformall/controller/ProductOrderController.java b/suimangCApi/src/main/java/com/iformall/controller/ProductOrderController.java index efeebad..b6a135c 100644 --- a/suimangCApi/src/main/java/com/iformall/controller/ProductOrderController.java +++ b/suimangCApi/src/main/java/com/iformall/controller/ProductOrderController.java @@ -14,10 +14,7 @@ import com.iformall.domain.po.sm.PersonPhoto; import com.iformall.enums.EnumComposeOrder; import com.iformall.enums.EnumProductOrderPayVendor; 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.entity.PayExtraParam; import com.iformall.service.pay.service.pay.PayAdapterService; @@ -55,6 +52,9 @@ public class ProductOrderController extends BaseController { @Autowired WxPayAccountService wxPayAccountService; + @Autowired + WxCUserBasicInfoService wxCUserBasicInfoService; + @Autowired 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); + } + + } diff --git a/suimangCApi/src/main/resources/application-dev.yml b/suimangCApi/src/main/resources/application-dev.yml index eba9878..bfd2747 100644 --- a/suimangCApi/src/main/resources/application-dev.yml +++ b/suimangCApi/src/main/resources/application-dev.yml @@ -192,5 +192,5 @@ photo: url: http://111.198.0.15:22299 hy_url: http://111.198.0.15:22288 talk: http://nas.pucao.cn:2001 - digital_avatar: http://nas.pucao.cn:2005 + digital_avatar: http://111.198.0.15:22200 callbackUrl: https://phototest.metavatar.cc/C diff --git a/suimangCApi/src/main/resources/application-prod.yml b/suimangCApi/src/main/resources/application-prod.yml index b29124e..64042e1 100644 --- a/suimangCApi/src/main/resources/application-prod.yml +++ b/suimangCApi/src/main/resources/application-prod.yml @@ -147,5 +147,5 @@ photo: url: http://111.198.0.15:22299 hy_url: http://111.198.0.15:22288 talk: http://111.198.0.15:22266 - digital_avatar: http://nas.pucao.cn:2005 + digital_avatar: http://111.198.0.15:22200 callbackUrl: https://photo.metavatar.cc/C diff --git a/suimangSchedule/src/main/resources/application-dev.yml b/suimangSchedule/src/main/resources/application-dev.yml index dc6688e..3103062 100644 --- a/suimangSchedule/src/main/resources/application-dev.yml +++ b/suimangSchedule/src/main/resources/application-dev.yml @@ -195,5 +195,5 @@ photo: url: http://111.198.0.15:22299 hy_url: http://111.198.0.15:22288 talk: http://nas.pucao.cn:2001 - digital_avatar: http://nas.pucao.cn:2005 + digital_avatar: http://111.198.0.15:22200 callbackUrl: https://phototest.metavatar.cc/C \ No newline at end of file diff --git a/suimangSchedule/src/main/resources/application-prod.yml b/suimangSchedule/src/main/resources/application-prod.yml index e737637..95bf759 100644 --- a/suimangSchedule/src/main/resources/application-prod.yml +++ b/suimangSchedule/src/main/resources/application-prod.yml @@ -151,5 +151,5 @@ photo: url: http://111.198.0.15:22299 hy_url: http://111.198.0.15:22288 talk: http://111.198.0.15:22266 - digital_avatar: http://nas.pucao.cn:2005 + digital_avatar: http://111.198.0.15:22200 callbackUrl: https://photo.metavatar.cc/C \ No newline at end of file