Commit a11bd69a by 水库浪子

针对客户列表与详情,做权限隔离;

1 parent 36cf79e7
package com.linkwechat.web.controller.system;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.linkwechat.common.constant.Constants;
import com.linkwechat.common.core.domain.AjaxResult;
import com.linkwechat.common.core.domain.entity.SysMenu;
......@@ -154,19 +155,31 @@ public class SysLoginController
}
/**
* 租户登录
* 通过企业id和企业密钥登录
* @param corpId
* @param corpSecret
* @return
*/
@GetMapping("/tenantLogin")
public AjaxResult tenantLogin(String corpId,String corpSecret){
AjaxResult ajax = AjaxResult.success();
@GetMapping("/corpLogin")
public AjaxResult corpLogin(String corpId,String corpSecret){
WeCorpAccount weCorpAccount = iWxCorpAccountService.getOne(new LambdaQueryWrapper<WeCorpAccount>()
.eq(WeCorpAccount::getCorpId, corpId)
.eq(WeCorpAccount::getCorpSecret, corpSecret)
.eq(WeCorpAccount::getDelFlag, Constants.NORMAL_CODE));
return ajax;
if(weCorpAccount == null){
return AjaxResult.error("当前企业id与企业密码不匹配或不存在");
}
return AjaxResult.success(
loginService.noPwdLogin(weCorpAccount.getCorpAccount())
);
}
}
......@@ -71,7 +71,7 @@ public interface WeCustomerMapper extends BaseMapper<WeCustomer>
* @param externalUserid
* @return
*/
public List<WeUser> getCustomersByUserId(@Param("externalUserid") String externalUserid);
public List<WeUser> getCustomersByUserId(@Param("externalUserid") String externalUserid,@Param("userId") String userId);
/**
* 通过标签查询客户列表
......
......@@ -4,7 +4,9 @@ import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.ArrayUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.linkwechat.common.constant.Constants;
import com.linkwechat.common.constant.WeConstans;
import com.linkwechat.common.core.domain.entity.SysUser;
import com.linkwechat.common.utils.DateUtils;
import com.linkwechat.common.utils.SecurityUtils;
import com.linkwechat.common.utils.SnowFlakeUtil;
......@@ -112,6 +114,12 @@ public class WeCustomerServiceImpl extends ServiceImpl<WeCustomerMapper, WeCusto
*/
@Override
public List<WeCustomer> selectWeCustomerList(WeCustomer weCustomer) {
//当前登录用户为企业用户
if(Constants.USER_TYPE_WECOME
.equals(SecurityUtils.getLoginUser().getUser().getUserType())){
weCustomer.setUserIds((SecurityUtils.getLoginUser().getUser().getUserName()));
}
return weCustomerMapper.selectWeCustomerList(weCustomer);
}
......@@ -468,7 +476,11 @@ public class WeCustomerServiceImpl extends ServiceImpl<WeCustomerMapper, WeCusto
*/
@Override
public List<WeUser> getCustomersByUserId(String externalUserid) {
return this.baseMapper.getCustomersByUserId(externalUserid);
String userId=null;
if(Constants.USER_TYPE_WECOME.equals(SecurityUtils.getLoginUser().getUser().getUserType())){
userId=SecurityUtils.getLoginUser().getUser().getUserName();
}
return this.baseMapper.getCustomersByUserId(externalUserid,userId);
}
@Override
......
......@@ -77,7 +77,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectWeCustomerList" parameterType="WeCustomer" resultMap="WeCustomerResult">
SELECT
DISTINCT wc.external_userid,
DISTINCT wc.external_userid,
wc.`name`,
wc.avatar,
wc.type,
......@@ -128,8 +128,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="endTime != null and endTime != ''"><!-- 结束时间检索 -->
AND date_format(wfcr.create_time,'%y%m%d') &lt;= date_format(#{endTime},'%y%m%d')
</if>
<if test="tagIds != null and tagIds !=''">
<if test="tagIds.indexOf(',') != -1">
AND wt.tag_id in
......@@ -278,7 +276,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
wfcrf.flower_customer_rel_id,
wt.tag_id,
wt.create_time,
wt.`name` as tagName,
DISTINCT wt.`name` as tagName,
(SELECT GROUP_CONCAT(wd.`name`) FROM we_department wd WHERE wd.id=wu.department) as department
FROM
we_customer wc
......@@ -287,6 +285,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
LEFT JOIN we_flower_customer_tag_rel wfcrf ON wfcrf.flower_customer_rel_id = wfcr.id
LEFT JOIN we_tag wt ON wt.tag_id = wfcrf.tag_id
WHERE wc.external_userid=#{externalUserid}
<if test="userId != null and userId !=''">
AND wfcr.user_id=#{userId}
</if>
</select>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!