Explorar o código

企业用户我的显示企业名称、部门、真实姓名、手机号

liangpeile hai 1 ano
pai
achega
70ed610676

+ 8 - 0
crmeb-common/src/main/java/com/zbkj/common/response/UserCenterResponse.java

@@ -70,4 +70,12 @@ public class UserCenterResponse implements Serializable {
 
     @ApiModelProperty(value = "个人中心服务")
     private List<HashMap<String, Object>> centerMenu;
+
+    @ApiModelProperty(value = "企业名称")
+    private String qyName;
+
+    @ApiModelProperty(value = "部门名称")
+    private String bmName;
+
+
 }

+ 21 - 0
crmeb-front/src/main/java/com/zbkj/front/service/impl/UserCenterServiceImpl.java

@@ -11,6 +11,9 @@ import com.zbkj.common.constants.DateConstants;
 import com.zbkj.common.constants.GroupDataConstants;
 import com.zbkj.common.constants.SysConfigConstants;
 import com.zbkj.common.exception.CrmebException;
+import com.zbkj.common.model.organization.Organization;
+import com.zbkj.common.model.organization.OrganizationDepartment;
+import com.zbkj.common.model.organization.OrganizationDepartmentUser;
 import com.zbkj.common.model.product.Product;
 import com.zbkj.common.model.record.BrowseRecord;
 import com.zbkj.common.model.system.SystemUserLevel;
@@ -73,6 +76,12 @@ public class UserCenterServiceImpl extends ServiceImpl<UserDao, User> implements
     private UserVisitRecordService userVisitRecordService;
     @Autowired
     private AsyncService asyncService;
+    @Autowired
+    private OrganizationDepartmentUserService organizationDepartmentUserService;
+    @Autowired
+    private OrganizationService organizationService;
+    @Autowired
+    private OrganizationDepartmentService organizationDepartmentService;
 
 
     /**
@@ -117,6 +126,18 @@ public class UserCenterServiceImpl extends ServiceImpl<UserDao, User> implements
         if (retailStoreSwitch.equals(Constants.COMMON_SWITCH_OPEN) && user.getIsPromoter()) {
             response.setIsPromoter(true);
         }
+        //企业用户获取企业以及部门
+        Integer isEnterpriseUser = user.getIsEnterpriseUser();
+        if (null==isEnterpriseUser||1==isEnterpriseUser){
+            response.setQyName("");
+            response.setBmName("");
+        }else{
+            OrganizationDepartmentUser organizationDepartmentUser= organizationDepartmentUserService.selectIdByUserId(user.getId());
+            Organization organization = organizationService.getById(organizationDepartmentUser.getOrganizationId());
+            OrganizationDepartment organizationDepartment = organizationDepartmentService.getById(organizationDepartmentUser.getDepartmentId());
+            response.setQyName(organization.getCompanyName());
+            response.setBmName(organizationDepartment.getDepartmentName());
+        }
 
         // 保存用户访问记录
         asyncService.visitUserCenter(user.getId());

+ 2 - 0
crmeb-service/src/main/java/com/zbkj/service/dao/OrganizationDeparementUserDao.java

@@ -12,4 +12,6 @@ public interface OrganizationDeparementUserDao extends BaseMapper<OrganizationDe
     List<OrganizationDepartmentUser> selectMainByOrganizationId(@Param("id") String id);
 
     List<OrganizationDepartmentUser> selectMainBydepartmentId(@Param("id")String id);
+
+    OrganizationDepartmentUser selectIdByUserId(Integer id);
 }

+ 2 - 0
crmeb-service/src/main/java/com/zbkj/service/service/OrganizationDepartmentUserService.java

@@ -13,4 +13,6 @@ public interface OrganizationDepartmentUserService extends IService<Organization
     List<OrganizationDepartmentUser> selectMainByOrganizationId(String id);
 
     List<OrganizationDepartmentUser> selectMainBydepartmentId(String id);
+
+    OrganizationDepartmentUser selectIdByUserId(Integer id);
 }

+ 5 - 0
crmeb-service/src/main/java/com/zbkj/service/service/impl/OrganizationDepartmentUserServiceImpl.java

@@ -39,5 +39,10 @@ public class OrganizationDepartmentUserServiceImpl extends ServiceImpl<Organizat
     public List<OrganizationDepartmentUser> selectMainBydepartmentId(String id) {
         return organizationDeparementUserDao.selectMainBydepartmentId(id);
     }
+
+    @Override
+    public OrganizationDepartmentUser selectIdByUserId(Integer id) {
+        return organizationDeparementUserDao.selectIdByUserId(id);
+    }
 }
 

+ 5 - 0
crmeb-service/src/main/resources/mapper/organization/OrganizationDepaermentUserMapper.xml

@@ -11,4 +11,9 @@
 <select id="selectMainBydepartmentId" parameterType="java.lang.String" resultType="com.zbkj.common.model.organization.OrganizationDepartmentUser">
     select * from eb_organization_department_user where department_id =#{id}
     </select>
+
+<select id="selectIdByUserId" parameterType="java.lang.Integer"  resultType="com.zbkj.common.model.organization.OrganizationDepartmentUser">
+            select * from eb_organization_department_user where user_id =#{id}
+
+</select>
 </mapper>