Commit a11bd69a by 水库浪子

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

1 parent 36cf79e7
package com.linkwechat.web.controller.system; package com.linkwechat.web.controller.system;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.linkwechat.common.constant.Constants; import com.linkwechat.common.constant.Constants;
import com.linkwechat.common.core.domain.AjaxResult; import com.linkwechat.common.core.domain.AjaxResult;
import com.linkwechat.common.core.domain.entity.SysMenu; import com.linkwechat.common.core.domain.entity.SysMenu;
...@@ -154,19 +155,31 @@ public class SysLoginController ...@@ -154,19 +155,31 @@ public class SysLoginController
} }
/** /**
* 租户登录 * 通过企业id和企业密钥登录
* @param corpId * @param corpId
* @param corpSecret * @param corpSecret
* @return * @return
*/ */
@GetMapping("/tenantLogin") @GetMapping("/corpLogin")
public AjaxResult tenantLogin(String corpId,String corpSecret){ public AjaxResult corpLogin(String corpId,String corpSecret){
AjaxResult ajax = AjaxResult.success();
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> ...@@ -71,7 +71,7 @@ public interface WeCustomerMapper extends BaseMapper<WeCustomer>
* @param externalUserid * @param externalUserid
* @return * @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; ...@@ -4,7 +4,9 @@ import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.ArrayUtil; import cn.hutool.core.util.ArrayUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.linkwechat.common.constant.Constants;
import com.linkwechat.common.constant.WeConstans; 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.DateUtils;
import com.linkwechat.common.utils.SecurityUtils; import com.linkwechat.common.utils.SecurityUtils;
import com.linkwechat.common.utils.SnowFlakeUtil; import com.linkwechat.common.utils.SnowFlakeUtil;
...@@ -112,6 +114,12 @@ public class WeCustomerServiceImpl extends ServiceImpl<WeCustomerMapper, WeCusto ...@@ -112,6 +114,12 @@ public class WeCustomerServiceImpl extends ServiceImpl<WeCustomerMapper, WeCusto
*/ */
@Override @Override
public List<WeCustomer> selectWeCustomerList(WeCustomer weCustomer) { 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); return weCustomerMapper.selectWeCustomerList(weCustomer);
} }
...@@ -468,7 +476,11 @@ public class WeCustomerServiceImpl extends ServiceImpl<WeCustomerMapper, WeCusto ...@@ -468,7 +476,11 @@ public class WeCustomerServiceImpl extends ServiceImpl<WeCustomerMapper, WeCusto
*/ */
@Override @Override
public List<WeUser> getCustomersByUserId(String externalUserid) { 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 @Override
......
...@@ -128,8 +128,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -128,8 +128,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="endTime != null and endTime != ''"><!-- 结束时间检索 --> <if test="endTime != null and endTime != ''"><!-- 结束时间检索 -->
AND date_format(wfcr.create_time,'%y%m%d') &lt;= date_format(#{endTime},'%y%m%d') AND date_format(wfcr.create_time,'%y%m%d') &lt;= date_format(#{endTime},'%y%m%d')
</if> </if>
<if test="tagIds != null and tagIds !=''"> <if test="tagIds != null and tagIds !=''">
<if test="tagIds.indexOf(',') != -1"> <if test="tagIds.indexOf(',') != -1">
AND wt.tag_id in AND wt.tag_id in
...@@ -278,7 +276,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -278,7 +276,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
wfcrf.flower_customer_rel_id, wfcrf.flower_customer_rel_id,
wt.tag_id, wt.tag_id,
wt.create_time, 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 (SELECT GROUP_CONCAT(wd.`name`) FROM we_department wd WHERE wd.id=wu.department) as department
FROM FROM
we_customer wc we_customer wc
...@@ -287,6 +285,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -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_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 LEFT JOIN we_tag wt ON wt.tag_id = wfcrf.tag_id
WHERE wc.external_userid=#{externalUserid} WHERE wc.external_userid=#{externalUserid}
<if test="userId != null and userId !=''">
AND wfcr.user_id=#{userId}
</if>
</select> </select>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!