Commit f00dcd2c authored by zhengyi's avatar zhengyi

补充完善跟进记录的数据权限业务

parent 62f37383
-- 补充跟进记录列表的客户经理所属部门id
alter table ecw_customer_followup
add COLUMN `dept_id` bigint DEFAULT NULL COMMENT '客户经理/跟进业务员所属部门id' after `follow_user_id`;
update `ecw_customer_followup` f left join `system_user` u on f.follow_user_id = u.id set f.dept_id = u.dept_id;
\ No newline at end of file
......@@ -75,6 +75,10 @@ public class CustomerFollowupDO extends BaseDO {
* 客户经理/跟进业务员id
*/
private Long followUserId;
@ApiModelProperty(value = "客户经理/跟进业务员所属部门id")
private Long deptId;
/**
* 目的
*/
......
......@@ -22,6 +22,7 @@ import cn.iocoder.yudao.module.customer.vo.customerFollowup.*;
import cn.iocoder.yudao.module.customer.vo.customerOperateLog.CustomerOperateLogCreateReqVO;
import cn.iocoder.yudao.module.ecw.enums.CustomerFollowupStatusEnum;
import cn.iocoder.yudao.module.ecw.enums.CustomerOperateTypeEnum;
import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Service;
......@@ -32,6 +33,7 @@ import javax.annotation.Resource;
import java.util.Collection;
import java.util.Date;
import java.util.List;
import java.util.Objects;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.module.customer.enums.ErrorCodeConstants.FOLLOWUP_ALREADY_SUBMITTED;
......@@ -49,7 +51,8 @@ public class CustomerFollowupServiceImpl extends AbstractService<CustomerFollowu
@Resource
private CustomerFollowupMapper followupMapper;
@Resource
private AdminUserApi adminUserApi;
@Resource
private CustomerOperateLogService customerOperateLogService;
......@@ -107,6 +110,10 @@ public class CustomerFollowupServiceImpl extends AbstractService<CustomerFollowu
// 设置联系人名称
setContactName(followup);
followup.setNumber(newNumber);
if (Objects.nonNull(followup.getFollowUserId())){
// 获取客户经理的部门id
followup.setDeptId(adminUserApi.getUserDeptId(followup.getFollowUserId()));
}
followupMapper.insert(followup);
Long customerId = createReqVO.getCustomerId();
......@@ -164,7 +171,10 @@ public class CustomerFollowupServiceImpl extends AbstractService<CustomerFollowu
// 设置联系人名称
setContactName(updateObj);
if (Objects.nonNull(updateObj.getFollowUserId())){
// 获取客户经理的部门id
updateObj.setDeptId(adminUserApi.getUserDeptId(updateObj.getFollowUserId()));
}
followupMapper.updateById(updateObj);
Long customerId = updateReqVO.getCustomerId();
......
......@@ -57,9 +57,16 @@ public class CustomerFollowupBackVO {
@ApiModelProperty(value = "客户经理/跟进业务员id")
private Long followUserId;
@ExcelProperty("客户经理")
@ApiModelProperty("客户经理")
private String followUserName;
@ApiModelProperty(value = "客户经理/跟进业务员所属部门id")
private Long deptId;
@ApiModelProperty("部门名称")
private String deptName;
......
......@@ -50,6 +50,9 @@ public class CustomerFollowupBaseVO {
@ApiModelProperty(value = "客户经理/跟进业务员id")
private Long followUserId;
@ApiModelProperty(value = "客户经理/跟进业务员所属部门id")
private Long deptId;
@ApiModelProperty(value = "目的")
private String purpose;
......
......@@ -24,6 +24,10 @@
AND a.offer_id in
<foreach item='item' index="index" collection='query.offerIds' open='(' separator=',' close=')'>#{item}</foreach>
</if>
<if test="query.deptIdList != null and query.deptIdList.size() > 0">
AND a.dept_id in
<foreach item='deptId' index="index" collection='query.deptIdList' open='(' separator=',' close=')'>#{deptId}</foreach>
</if>
<if test="query.followType != null">
AND a.follow_type = #{query.followType}
......
......@@ -228,7 +228,7 @@ public class CustomerFollowupController {
// 非全部数据权限时查询限制条件
if (CollectionUtil.isEmpty(deptIdList) || deptIdList.size() == 0){
// 没有部门限制条件时,只查询当前用户自己的
query.setFollowUserId(String.valueOf(loginUser.getId()));
query.setFollowUserId(loginUser.getId());
}else {
// 查询限定部门的数据
query.setDeptIdList(deptIdList);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment