| @@ -7,6 +7,8 @@ import com.iformall.domain.po.base.BaseEntity; | |||||
| import com.iformall.domain.po.base.BaseTenantEntity; | import com.iformall.domain.po.base.BaseTenantEntity; | ||||
| import com.iformall.domain.po.base.TenantEntity; | import com.iformall.domain.po.base.TenantEntity; | ||||
| import com.iformall.utils.Constant; | import com.iformall.utils.Constant; | ||||
| import com.iformall.utils.UserUtil; | |||||
| import lombok.Data; | import lombok.Data; | ||||
| import lombok.EqualsAndHashCode; | import lombok.EqualsAndHashCode; | ||||
| import lombok.ToString; | import lombok.ToString; | ||||
| @@ -161,9 +163,6 @@ public class WxCUser extends TenantEntity { | |||||
| * @return | * @return | ||||
| */ | */ | ||||
| public boolean isBasicInfo() { | public boolean isBasicInfo() { | ||||
| if(null == this.getUserId()) { | |||||
| return false; | |||||
| } | |||||
| return true; | |||||
| return UserUtil.CuserIsBasicInfo(this.getUserId()); | |||||
| } | } | ||||
| } | } | ||||
| @@ -19,6 +19,7 @@ import com.iformall.pay.*; | |||||
| import com.iformall.service.*; | import com.iformall.service.*; | ||||
| import com.iformall.service.helper.WxPayOrderServiceHelper; | import com.iformall.service.helper.WxPayOrderServiceHelper; | ||||
| import com.iformall.service.pay.PayServiceFactory; | import com.iformall.service.pay.PayServiceFactory; | ||||
| import com.iformall.service.pay.entity.CreateCUser; | |||||
| import com.iformall.service.pay.entity.PayAdapterResult; | import com.iformall.service.pay.entity.PayAdapterResult; | ||||
| import com.iformall.service.pay.entity.PayExtraParam; | import com.iformall.service.pay.entity.PayExtraParam; | ||||
| import com.iformall.service.pay.entity.PayQueryAdapterResult; | import com.iformall.service.pay.entity.PayQueryAdapterResult; | ||||
| @@ -1096,13 +1097,20 @@ public class WxPayOrderServiceImpl implements WxPayOrderService { | |||||
| @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) | @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) | ||||
| public void handleMicroOrderPaySuccess(Object result,String transcationId,EnumPayWay payWay, WxPayOrder record ,WxMerchantBUser user,WxAppinfo appInfo,PayExtraParam params) { | public void handleMicroOrderPaySuccess(Object result,String transcationId,EnumPayWay payWay, WxPayOrder record ,WxMerchantBUser user,WxAppinfo appInfo,PayExtraParam params) { | ||||
| //B端操作,需要生成cUser | //B端操作,需要生成cUser | ||||
| Long cUserId; | |||||
| CreateCUser cUser = null; | |||||
| try { | try { | ||||
| cUserId = payServiceFactory.getCPassivePayService(payWay.getCode()).createCUserAfterPay(result, appInfo); | |||||
| cUser = payServiceFactory.getCPassivePayService(payWay.getCode()).createCUserAfterPay(result, appInfo); | |||||
| } catch (Exception e1) { | } catch (Exception e1) { | ||||
| logger.error("创建C端用户失败: " ,e1); | logger.error("创建C端用户失败: " ,e1); | ||||
| throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "创建C端用户失败: " + e1.getMessage()); | throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "创建C端用户失败: " + e1.getMessage()); | ||||
| } | } | ||||
| //如果用户是会员,则用会员ID, 如果没有,则用渠道用户ID(如wxCuser,支付宝user) | |||||
| Long cUserId = null; | |||||
| if (cUser.isBasicInfo()) { | |||||
| cUserId = cUser.getBasicUserId(); | |||||
| }else { | |||||
| cUserId = cUser.getCUserId(); | |||||
| } | |||||
| WxPayOrderServiceImpl proxy = (WxPayOrderServiceImpl) AopContext.currentProxy(); | WxPayOrderServiceImpl proxy = (WxPayOrderServiceImpl) AopContext.currentProxy(); | ||||
| WxOrder order = proxy.handler(record,transcationId,cUserId); | WxOrder order = proxy.handler(record,transcationId,cUserId); | ||||
| if (null == order) { | if (null == order) { | ||||
| @@ -0,0 +1,22 @@ | |||||
| package com.iformall.service.pay.entity; | |||||
| import java.io.Serializable; | |||||
| import com.iformall.utils.UserUtil; | |||||
| import lombok.AllArgsConstructor; | |||||
| import lombok.Data; | |||||
| @Data | |||||
| @AllArgsConstructor | |||||
| public class CreateCUser implements Serializable{ | |||||
| private static final long serialVersionUID = 877618734961866171L; | |||||
| private Long cUserId; | |||||
| private Long basicUserId; | |||||
| public boolean isBasicInfo() { | |||||
| return UserUtil.CuserIsBasicInfo(basicUserId); | |||||
| } | |||||
| } | |||||
| @@ -7,6 +7,7 @@ import com.iformall.domain.po.WxOrder; | |||||
| import com.iformall.domain.po.WxPayAccount; | import com.iformall.domain.po.WxPayAccount; | ||||
| import com.iformall.domain.po.WxPayOrder; | import com.iformall.domain.po.WxPayOrder; | ||||
| import com.iformall.enums.EnumPayShare; | import com.iformall.enums.EnumPayShare; | ||||
| import com.iformall.service.pay.entity.CreateCUser; | |||||
| import com.iformall.service.pay.entity.PayAdapterResult; | import com.iformall.service.pay.entity.PayAdapterResult; | ||||
| import com.iformall.service.pay.entity.PayExtraParam; | import com.iformall.service.pay.entity.PayExtraParam; | ||||
| @@ -28,6 +29,6 @@ public interface CPassivePayService extends PayAdapterService{ | |||||
| * @param params | * @param params | ||||
| * @throws Exception | * @throws Exception | ||||
| */ | */ | ||||
| public Long createCUserAfterPay(Object result,WxAppinfo appInfo) throws Exception; | |||||
| public CreateCUser createCUserAfterPay(Object result,WxAppinfo appInfo) throws Exception; | |||||
| } | } | ||||
| @@ -22,6 +22,7 @@ import com.iformall.pay.WxMicroPayOrderSP; | |||||
| import com.iformall.pay.WxPay; | import com.iformall.pay.WxPay; | ||||
| import com.iformall.pay.WxPayment; | import com.iformall.pay.WxPayment; | ||||
| import com.iformall.service.WxCUserService; | import com.iformall.service.WxCUserService; | ||||
| import com.iformall.service.pay.entity.CreateCUser; | |||||
| import com.iformall.service.pay.entity.PayAdapterResult; | import com.iformall.service.pay.entity.PayAdapterResult; | ||||
| import com.iformall.service.pay.entity.PayExtraParam; | import com.iformall.service.pay.entity.PayExtraParam; | ||||
| import com.iformall.service.pay.entity.PayQueryAdapterResult; | import com.iformall.service.pay.entity.PayQueryAdapterResult; | ||||
| @@ -195,7 +196,7 @@ public class WxMiniMaPayAdapterService extends BaseWxPayAdapterService implement | |||||
| WxCUserService wxCUserService; | WxCUserService wxCUserService; | ||||
| @Override | @Override | ||||
| public Long createCUserAfterPay(Object result,WxAppinfo appInfo) throws Exception { | |||||
| public CreateCUser createCUserAfterPay(Object result,WxAppinfo appInfo) throws Exception { | |||||
| // add c_user, 收银台支付和券支付可能不是同一个人 | // add c_user, 收银台支付和券支付可能不是同一个人 | ||||
| Date curDate = new Date(); | Date curDate = new Date(); | ||||
| WxCUser userQ = new WxCUser(); | WxCUser userQ = new WxCUser(); | ||||
| @@ -225,7 +226,7 @@ public class WxMiniMaPayAdapterService extends BaseWxPayAdapterService implement | |||||
| } | } | ||||
| wxCUserService.saveOrUpdate(userQ); | wxCUserService.saveOrUpdate(userQ); | ||||
| } | } | ||||
| return userQ.getId(); | |||||
| return new CreateCUser(userQ.getId(),userQ.getUserId()); | |||||
| } | } | ||||
| @Override | @Override | ||||
| @@ -35,4 +35,11 @@ public class UserUtil { | |||||
| //} | //} | ||||
| } | } | ||||
| public static boolean CuserIsBasicInfo(Long basicUserId) { | |||||
| if(null == basicUserId) { | |||||
| return false; | |||||
| } | |||||
| return true; | |||||
| } | |||||
| } | } | ||||