Browse Source

feat: 创建分销商时绑定用户ID

luofeiyun 1 week ago
parent
commit
884f19d005

+ 5 - 0
ship-module-ota/ship-module-ota-biz/src/main/java/com/yc/ship/module/ota/dal/dataobject/distributor/DistributorDO.java

@@ -185,4 +185,9 @@ public class DistributorDO extends TenantBaseDO {
     private String externalPoiIds;
 
     private String custCode;
+
+    /**
+     * 系统用户ID
+     */
+    private Long userId;
 }

+ 2 - 3
ship-module-ota/ship-module-ota-biz/src/main/java/com/yc/ship/module/ota/service/distributor/DistributorServiceImpl.java

@@ -124,10 +124,10 @@ public class DistributorServiceImpl implements DistributorService {
         }
         LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
         Long tenantId = loginUser.getTenantId();
+        Long userId = createSystemUser(createReqVO);
         if (createReqVO.getType() == 2) {
             //若为旅行社,则创建新租户
             try {
-                Long userId = createSystemUser(createReqVO);
                 if (userId==null) {
                     throw exception(OTA_TENANT_EXISTS);
                 } else {
@@ -139,15 +139,14 @@ public class DistributorServiceImpl implements DistributorService {
                 throw exception(DISTRIBUTOR_TENANT_EXISTS);
             }
         } else {
-            Long userId = createSystemUser(createReqVO);
             if (userId==null) {
                 throw exception(OTA_TENANT_EXISTS);
             } else {
                 //创建分销商默认绑定分销商角色
                 createSystemUserRole(userId, "ota");
-
             }
         }
+        distributor.setUserId(userId);
         distributor.setAccountTenantId(tenantId);
         distributorMapper.insert(distributor);
         // 返回