|
|
@@ -6,10 +6,13 @@ import com.alipay.api.request.*;
|
|
|
import com.alipay.api.response.*;
|
|
|
import com.payment.platform.common.exception.BusinessException;
|
|
|
import com.payment.platform.core.alipay.AlipayClientFactory;
|
|
|
+import com.payment.platform.core.security.LoginUser;
|
|
|
import com.payment.platform.module.payment.enterprise.entity.EnterpriseEntity;
|
|
|
import com.payment.platform.module.payment.enterprise.mapper.EnterpriseMapper;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.springframework.security.core.Authentication;
|
|
|
+import org.springframework.security.core.context.SecurityContextHolder;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.util.*;
|
|
|
@@ -38,7 +41,7 @@ public class AlipayEnterpriseService {
|
|
|
request.setBizModel(model);
|
|
|
|
|
|
AlipayCommerceEcEnterpriseRegisterinviteCreateResponse response =
|
|
|
- alipayClientFactory.getClient((String) null).execute(request);
|
|
|
+ alipayClientFactory.getClientByProvider(Long.valueOf(data.get("service_provider_id").toString())).execute(request);
|
|
|
|
|
|
if (!response.isSuccess()) {
|
|
|
log.error("支付宝邀请码申请失败: {} - {}", response.getCode(), response.getMsg());
|
|
|
@@ -63,6 +66,11 @@ public class AlipayEnterpriseService {
|
|
|
pending.setBusinessContracts((String) data.get("business_contracts"));
|
|
|
pending.setLegalRepIdPhoto((String) data.get("legal_rep_id_photo"));
|
|
|
pending.setWanlihuiUid((String) data.get("wanlihui_uid"));
|
|
|
+ // 从认证上下文获取 tenantId
|
|
|
+ Authentication auth = SecurityContextHolder.getContext().getAuthentication();
|
|
|
+ if (auth != null && auth.getPrincipal() instanceof LoginUser user) {
|
|
|
+ pending.setTenantId(user.getTenantId());
|
|
|
+ }
|
|
|
enterpriseMapper.insert(pending);
|
|
|
|
|
|
Map<String, Object> result = new LinkedHashMap<>();
|