优化--用户消息列表添加判断那个用户是商家字段

上级 ba617980
...@@ -84,4 +84,7 @@ public class CompanyInfoVO implements Serializable { ...@@ -84,4 +84,7 @@ public class CompanyInfoVO implements Serializable {
@ApiModelProperty(value = "企业视频") @ApiModelProperty(value = "企业视频")
private String profileUrl; private String profileUrl;
@ApiModelProperty(value = "绑定的客服id")
private Integer companyBindUserId;
} }
...@@ -224,4 +224,6 @@ public interface CompanyDao { ...@@ -224,4 +224,6 @@ public interface CompanyDao {
Integer selectUserByUserRcd(Integer userId); Integer selectUserByUserRcd(Integer userId);
List<CompanyMemberDO> selectUserAndRoleList(Integer companyInfoId); List<CompanyMemberDO> selectUserAndRoleList(Integer companyInfoId);
List<Integer> getBindCompanyUserIdList(Integer backUserId);
} }
...@@ -177,4 +177,14 @@ public interface CompanyService { ...@@ -177,4 +177,14 @@ public interface CompanyService {
ResultBody insertUserRcd(Integer rUserId,List<Integer> userIds); ResultBody insertUserRcd(Integer rUserId,List<Integer> userIds);
ResultBody listUserAndRoleByCompanyId(Integer companyInfoId); ResultBody listUserAndRoleByCompanyId(Integer companyInfoId);
/**
* 获取后台公司绑定的用户id是用户1还是用户2
* @param userId1 用户1
* @param userId2 用户2
* @param backUserId 后台id
* @return
*/
Integer getCompanyBindUserId(Integer userId1,Integer userId2,Integer backUserId);
} }
...@@ -133,7 +133,9 @@ public class CompanyServiceImpl implements CompanyService { ...@@ -133,7 +133,9 @@ public class CompanyServiceImpl implements CompanyService {
public CompanyInfoVO getCompanyInfoByAppLoginUserId(Integer backUserAccountId) { public CompanyInfoVO getCompanyInfoByAppLoginUserId(Integer backUserAccountId) {
CompanyInfoDO companyInfoDO = companyDao.getCompanyInfoByAppLoginUserId(backUserAccountId); CompanyInfoDO companyInfoDO = companyDao.getCompanyInfoByAppLoginUserId(backUserAccountId);
if (companyInfoDO != null) { if (companyInfoDO != null) {
return companyInfoDO.buildCompanyInfoVO(); CompanyInfoVO companyInfoVO = companyInfoDO.buildCompanyInfoVO();
companyInfoVO.setBackUserId(backUserAccountId);
return companyInfoVO;
} }
return null; return null;
} }
...@@ -321,5 +323,19 @@ public class CompanyServiceImpl implements CompanyService { ...@@ -321,5 +323,19 @@ public class CompanyServiceImpl implements CompanyService {
return ResultBody.success(companyMemberVOS); return ResultBody.success(companyMemberVOS);
} }
@Override
public Integer getCompanyBindUserId(Integer userId1, Integer userId2,Integer backUserId) {
List<Integer> listUserIds = companyDao.getBindCompanyUserIdList(backUserId);
if(listUserIds.contains(userId1)) {
if(listUserIds.contains(userId2)) {
return null;
}else {
return userId1;
}
}else {
return userId2;
}
}
} }
...@@ -252,7 +252,11 @@ public class MessageServiceImpl implements MessageService { ...@@ -252,7 +252,11 @@ public class MessageServiceImpl implements MessageService {
if(backUserId != null){ if(backUserId != null){
CompanyInfoVO companyInfo = companyService.getCompanyInfoByAppLoginUserId(backUserId); CompanyInfoVO companyInfo = companyService.getCompanyInfoByAppLoginUserId(backUserId);
userDO.setCompanyInfoVO(companyInfo); Integer companyBindUserId = companyService.getCompanyBindUserId(senderUserId, userDO.getUserAccountId(), backUserId);
if(companyBindUserId != null) {
companyInfo.setCompanyBindUserId(companyBindUserId);
userDO.setCompanyInfoVO(companyInfo);
}
} }
userAccountDOList.add(userDO); userAccountDOList.add(userDO);
} }
......
...@@ -299,4 +299,10 @@ ...@@ -299,4 +299,10 @@
FROM company_member me INNER JOIN company_role rol ON me.is_leader = rol.id FROM company_member me INNER JOIN company_role rol ON me.is_leader = rol.id
where company_info_id = #{companyInfoId} where company_info_id = #{companyInfoId}
</select> </select>
<select id="getBindCompanyUserIdList" resultType="java.lang.Integer">
select cm.user_account_id from back_user_account bua
left join company_back_user cbu on bua.id = cbu.back_user_account_id
left join company_member cm on cbu.company_info_id = cm.company_info_id
where cbu.id = #{backUserId}
</select>
</mapper> </mapper>
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论