Sfoglia il codice sorgente

个人详情增加字段

liangpeile 1 anno fa
parent
commit
0399b312ea

+ 7 - 0
crmeb-common/src/main/java/com/zbkj/common/response/UserAdminDetailResponse.java

@@ -146,4 +146,11 @@ public class UserAdminDetailResponse implements Serializable {
 
     @ApiModelProperty(value = "上级推广员昵称")
     private String spreadName;
+
+    @ApiModelProperty(value = "企业名称")
+    private String compName;
+    @ApiModelProperty(value = "用户类型")
+    private String userType;
+
+
 }

+ 49 - 4
crmeb-service/src/main/java/com/zbkj/service/service/impl/UserServiceImpl.java

@@ -313,9 +313,9 @@ public class UserServiceImpl extends ServiceImpl<UserDao, User> implements UserS
         User user = getInfo();
         //修改昵称后  修改企业账户信息
         LambdaQueryWrapper<UserEnterprise> enterpriseLambdaQueryWrapper = new LambdaQueryWrapper<>();
-        enterpriseLambdaQueryWrapper.eq(UserEnterprise::getUserId,user.getId());
+        enterpriseLambdaQueryWrapper.eq(UserEnterprise::getUserId, user.getId());
         List<UserEnterprise> list = userEnterpriseService.list(enterpriseLambdaQueryWrapper);
-        if (null!=list&&list.size()>0){
+        if (null != list && list.size() > 0) {
             for (UserEnterprise userEnterprise : list) {
                 userEnterprise.setNickname(request.getNickname());
                 userEnterpriseService.updateById(userEnterprise);
@@ -1172,7 +1172,7 @@ public class UserServiceImpl extends ServiceImpl<UserDao, User> implements UserS
         LambdaQueryWrapper<UserEnterprise> enterpriseLambdaQueryWrapper = new LambdaQueryWrapper<>();
         enterpriseLambdaQueryWrapper.eq(UserEnterprise::getUserId, user.getId());
         List<UserEnterprise> one = userEnterpriseService.list(enterpriseLambdaQueryWrapper);
-        if (null!=one&one.size()>0){
+        if (null != one & one.size() > 0) {
             for (UserEnterprise userEnterprise : one) {
                 BigDecimal usedLineOfCredit = userEnterprise.getUsedLineOfCredit();
                 int i = usedLineOfCredit.compareTo(BigDecimal.valueOf(0));
@@ -1184,7 +1184,7 @@ public class UserServiceImpl extends ServiceImpl<UserDao, User> implements UserS
         }
 
         userEnterpriseService.remove(enterpriseLambdaQueryWrapper);
-        if (null != one&&one.size()>0) {
+        if (null != one && one.size() > 0) {
             for (UserEnterprise userEnterprise : one) {
                 LambdaQueryWrapper<UserBypassAccount> queryWrapper = new LambdaQueryWrapper<>();
                 queryWrapper.eq(UserBypassAccount::getEnterpriseId, userEnterprise.getId());
@@ -1240,6 +1240,51 @@ public class UserServiceImpl extends ServiceImpl<UserDao, User> implements UserS
         }
         UserAdminDetailResponse response = new UserAdminDetailResponse();
         BeanUtils.copyProperties(user, response);
+        Integer isEnterpriseUser = user.getIsEnterpriseUser();
+        if (null != isEnterpriseUser) {
+            if (2 == user.getIsEnterpriseUser()) {
+                response.setUserType("企业主账号");
+                LambdaQueryWrapper<UserEnterprise> enterpriseLambdaQueryWrapper = new LambdaQueryWrapper<>();
+                enterpriseLambdaQueryWrapper.eq(UserEnterprise::getUserId, response.getId());
+                enterpriseLambdaQueryWrapper.eq(UserEnterprise::getIsDelete, 0);
+                UserEnterprise userEnterprise1 = userEnterpriseService.getOne(enterpriseLambdaQueryWrapper);
+                if (null != userEnterprise1) {
+                    response.setCompName(userEnterprise1.getEnterpriseName());
+                } else {
+                    response.setUserType("企业主账号");
+                    response.setCompName("");
+                }
+
+            } else if (3 == user.getIsEnterpriseUser()) {
+                response.setUserType("企业子账号");
+                LambdaQueryWrapper<UserBypassAccount> userBypassAccountLambdaQueryWrapper = new LambdaQueryWrapper<>();
+                userBypassAccountLambdaQueryWrapper.eq(UserBypassAccount::getUserId, response.getId());
+                userBypassAccountLambdaQueryWrapper.eq(UserBypassAccount::getIsDelete, 0);
+                UserBypassAccount one = userBypassAccountService.getOne(userBypassAccountLambdaQueryWrapper);
+                if (null != one) {
+                    Integer enterpriseId = one.getEnterpriseId();
+                    LambdaQueryWrapper<UserEnterprise> enterpriseLambdaQueryWrapper = new LambdaQueryWrapper<>();
+                    enterpriseLambdaQueryWrapper.eq(UserEnterprise::getId, enterpriseId);
+                    enterpriseLambdaQueryWrapper.eq(UserEnterprise::getIsDelete, 0);
+                    UserEnterprise userEnterprise2 = userEnterpriseService.getOne(enterpriseLambdaQueryWrapper);
+                    if (null != userEnterprise2) {
+                        response.setCompName(userEnterprise2.getEnterpriseName());
+                    } else {
+                        response.setUserType("企业子账号");
+                        response.setCompName("");
+                    }
+
+                } else {
+                    response.setUserType("企业子账号");
+                    response.setCompName("");
+                }
+
+            }
+        } else {
+            response.setUserType("普通用户");
+            response.setCompName("");
+        }
+
         if (user.getSpreadUid() > 0) {
             User spreadUser = getById(user.getSpreadUid());
             response.setSpreadName(spreadUser.getNickname());