Commit dde016d2 authored by lcl's avatar lcl

客户相关

parent e1798884
...@@ -35,6 +35,15 @@ public class CustomerController extends BaseController { ...@@ -35,6 +35,15 @@ public class CustomerController extends BaseController {
return getDataTable(baseService.selectList(dto)); return getDataTable(baseService.selectList(dto));
} }
/**
* 客户详情
*/
@PreAuthorize("@ss.hasPermi('customer:info')")
@GetMapping("/{customerId}")
public AjaxResult info(@PathVariable("customerId") String customerId){
return AjaxResult.success(baseService.info(customerId));
}
/** /**
* 添加客户 * 添加客户
*/ */
...@@ -55,4 +64,13 @@ public class CustomerController extends BaseController { ...@@ -55,4 +64,13 @@ public class CustomerController extends BaseController {
return AjaxResult.success(baseService.edit(customer)); return AjaxResult.success(baseService.edit(customer));
} }
/**
* 获取个人客户列表
*/
@PreAuthorize("@ss.hasPermi('customer:user:list')")
@GetMapping("/user/list")
public AjaxResult selectUserList(){
return AjaxResult.success(baseService.selectUserList());
}
} }
...@@ -36,13 +36,13 @@ public class Customer implements Serializable { ...@@ -36,13 +36,13 @@ public class Customer implements Serializable {
*/ */
private String legalPerson; private String legalPerson;
/** /**
* 注册资本(字符串) * 注册资本
*/ */
private String registerCapitalStr; private String registerCapital;
/** /**
* 注册资本 * 社会统一信用代码
*/ */
private Double registerCapital; private String creditCode;
/** /**
* 企业性质(company_nature_type) * 企业性质(company_nature_type)
*/ */
......
package com.dsk.system.domain.customer.dto; package com.dsk.system.domain.customer.dto;
import com.dsk.common.core.domain.BaseEntity;
import lombok.Data; import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
import java.util.Map;
/** /**
* 客户跟进记录筛选对象 * 客户跟进记录筛选对象
...@@ -11,7 +13,7 @@ import java.io.Serializable; ...@@ -11,7 +13,7 @@ import java.io.Serializable;
* @create 2023/5/18 * @create 2023/5/18
*/ */
@Data @Data
public class CustomerFollowRecordSearchDto implements Serializable { public class CustomerFollowRecordSearchDto extends BaseEntity implements Serializable {
/** /**
* 客户id * 客户id
......
package com.dsk.system.domain.customer.vo;
import com.dsk.system.domain.customer.Customer;
import lombok.Data;
import java.io.Serializable;
/**
* 客户详情
*
* @author makejava
* @since 2023-05-16 09:27:55
*/
@Data
public class CustomerVo extends Customer implements Serializable {
/**
* 负责人id
*/
private Long userId;
}
...@@ -2,7 +2,11 @@ package com.dsk.system.mapper; ...@@ -2,7 +2,11 @@ package com.dsk.system.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.dsk.system.domain.customer.CustomerFollowRecord; import com.dsk.system.domain.customer.CustomerFollowRecord;
import com.dsk.system.domain.customer.dto.CustomerFollowRecordSearchDto;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/** /**
...@@ -14,5 +18,7 @@ import org.apache.ibatis.annotations.Mapper; ...@@ -14,5 +18,7 @@ import org.apache.ibatis.annotations.Mapper;
@Mapper @Mapper
public interface CustomerFollowRecordMapper extends BaseMapper<CustomerFollowRecord> { public interface CustomerFollowRecordMapper extends BaseMapper<CustomerFollowRecord> {
List<CustomerFollowRecord> selectList(@Param("dto") CustomerFollowRecordSearchDto dto);
} }
...@@ -3,6 +3,7 @@ package com.dsk.system.service; ...@@ -3,6 +3,7 @@ package com.dsk.system.service;
import com.dsk.system.domain.customer.Customer; import com.dsk.system.domain.customer.Customer;
import com.dsk.system.domain.customer.dto.CustomerSearchDto; import com.dsk.system.domain.customer.dto.CustomerSearchDto;
import com.dsk.system.domain.customer.vo.CustomerListVo; import com.dsk.system.domain.customer.vo.CustomerListVo;
import com.dsk.system.domain.customer.vo.CustomerVo;
import java.util.List; import java.util.List;
...@@ -16,8 +17,12 @@ public interface ICustomerService { ...@@ -16,8 +17,12 @@ public interface ICustomerService {
List<CustomerListVo> selectList(CustomerSearchDto dto); List<CustomerListVo> selectList(CustomerSearchDto dto);
CustomerVo info(String customerId);
boolean add(Customer customer); boolean add(Customer customer);
boolean edit(Customer customer); boolean edit(Customer customer);
List<Customer> selectUserList();
} }
...@@ -3,6 +3,7 @@ package com.dsk.system.service.impl; ...@@ -3,6 +3,7 @@ package com.dsk.system.service.impl;
import cn.hutool.core.bean.BeanException; import cn.hutool.core.bean.BeanException;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.dsk.common.annotation.DataScope;
import com.dsk.common.utils.SecurityUtils; import com.dsk.common.utils.SecurityUtils;
import com.dsk.system.domain.customer.CustomerFollowRecord; import com.dsk.system.domain.customer.CustomerFollowRecord;
import com.dsk.system.domain.customer.dto.CustomerFollowRecordSearchDto; import com.dsk.system.domain.customer.dto.CustomerFollowRecordSearchDto;
...@@ -29,6 +30,7 @@ public class CustomerFollowRecordServiceImpl implements ICustomerFollowRecordSer ...@@ -29,6 +30,7 @@ public class CustomerFollowRecordServiceImpl implements ICustomerFollowRecordSer
private CustomerFollowRecordMapper baseMapper; private CustomerFollowRecordMapper baseMapper;
@Override @Override
// @DataScope(deptAlias = "d",userAlias = "u")
public List<CustomerFollowRecord> selectList(CustomerFollowRecordSearchDto dto) { public List<CustomerFollowRecord> selectList(CustomerFollowRecordSearchDto dto) {
LambdaQueryWrapper<CustomerFollowRecord> wrapper = Wrappers.lambdaQuery(); LambdaQueryWrapper<CustomerFollowRecord> wrapper = Wrappers.lambdaQuery();
if (!ObjectUtils.isEmpty(dto.getCustomerId())) { if (!ObjectUtils.isEmpty(dto.getCustomerId())) {
...@@ -37,6 +39,9 @@ public class CustomerFollowRecordServiceImpl implements ICustomerFollowRecordSer ...@@ -37,6 +39,9 @@ public class CustomerFollowRecordServiceImpl implements ICustomerFollowRecordSer
wrapper.eq(CustomerFollowRecord::getUserId, SecurityUtils.getUserId()) wrapper.eq(CustomerFollowRecord::getUserId, SecurityUtils.getUserId())
.orderByDesc(CustomerFollowRecord::getCreateTime); .orderByDesc(CustomerFollowRecord::getCreateTime);
return baseMapper.selectList(wrapper); return baseMapper.selectList(wrapper);
// dto.setUserId(SecurityUtils.getUserId());
// return baseMapper.selectList(dto);
} }
@Override @Override
......
package com.dsk.system.service.impl; package com.dsk.system.service.impl;
import cn.hutool.core.bean.BeanException; import cn.hutool.core.bean.BeanException;
import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.dsk.common.exception.ServiceException; import com.dsk.common.exception.ServiceException;
import com.dsk.common.utils.DskOpenApiUtil;
import com.dsk.common.utils.SecurityUtils; import com.dsk.common.utils.SecurityUtils;
import com.dsk.system.domain.customer.Customer; import com.dsk.system.domain.customer.Customer;
import com.dsk.system.domain.customer.CustomerUser; import com.dsk.system.domain.customer.CustomerUser;
import com.dsk.system.domain.customer.dto.CustomerSearchDto; import com.dsk.system.domain.customer.dto.CustomerSearchDto;
import com.dsk.system.domain.customer.vo.CustomerListVo; import com.dsk.system.domain.customer.vo.CustomerListVo;
import com.dsk.system.domain.customer.vo.CustomerVo;
import com.dsk.system.mapper.CustomerMapper; import com.dsk.system.mapper.CustomerMapper;
import com.dsk.system.mapper.CustomerUserMapper; import com.dsk.system.mapper.CustomerUserMapper;
import com.dsk.system.service.ICustomerService; import com.dsk.system.service.ICustomerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
...@@ -31,6 +36,9 @@ public class CustomerServiceImpl implements ICustomerService { ...@@ -31,6 +36,9 @@ public class CustomerServiceImpl implements ICustomerService {
@Resource @Resource
private CustomerUserMapper customerUserMapper; private CustomerUserMapper customerUserMapper;
@Autowired
private DskOpenApiUtil dskOpenApiUtil;
@Override @Override
public List<CustomerListVo> selectList(CustomerSearchDto dto) { public List<CustomerListVo> selectList(CustomerSearchDto dto) {
dto.setUserId(SecurityUtils.getUserId()); dto.setUserId(SecurityUtils.getUserId());
...@@ -47,6 +55,16 @@ public class CustomerServiceImpl implements ICustomerService { ...@@ -47,6 +55,16 @@ public class CustomerServiceImpl implements ICustomerService {
return vos; return vos;
} }
@Override
public CustomerVo info(String customerId) {
CustomerVo vo = new CustomerVo();
BeanUtil.copyProperties(baseMapper.selectById(customerId), vo);
CustomerUser customerUser = customerUserMapper.selectOne(Wrappers.<CustomerUser>lambdaQuery()
.eq(CustomerUser::getCustomerId, customerId));
vo.setUserId(customerUser.getUserId());
return vo;
}
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public boolean add(Customer customer) { public boolean add(Customer customer) {
...@@ -54,8 +72,6 @@ public class CustomerServiceImpl implements ICustomerService { ...@@ -54,8 +72,6 @@ public class CustomerServiceImpl implements ICustomerService {
final Long userId = SecurityUtils.getUserId(); final Long userId = SecurityUtils.getUserId();
customer.setCreateId(userId); customer.setCreateId(userId);
customer.setUpdateId(userId); customer.setUpdateId(userId);
//TODO 查询企业id
customer.setCompanyId(0);
int i = baseMapper.insert(customer); int i = baseMapper.insert(customer);
if (i == 0) throw new ServiceException("客户信息添加错误!"); if (i == 0) throw new ServiceException("客户信息添加错误!");
...@@ -74,4 +90,9 @@ public class CustomerServiceImpl implements ICustomerService { ...@@ -74,4 +90,9 @@ public class CustomerServiceImpl implements ICustomerService {
int u = baseMapper.updateById(customer); int u = baseMapper.updateById(customer);
return u != 0; return u != 0;
} }
@Override
public List<Customer> selectUserList() {
return baseMapper.selectList(Wrappers.<Customer>lambdaQuery());
}
} }
...@@ -2,6 +2,23 @@ ...@@ -2,6 +2,23 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.dsk.system.mapper.CustomerFollowRecordMapper"> <mapper namespace="com.dsk.system.mapper.CustomerFollowRecordMapper">
<sql id="Base_Bean">
cfr.id, cfr.customer_id, cfr.user_id, cfr.visit_mode, cfr.next_visit_time, cfr.name, cfr.position,
cfr.content, cfr.create_time
</sql>
<select id="selectList" resultType="com.dsk.system.domain.customer.CustomerFollowRecord">
select
<include refid="Base_Bean"></include>
from customer_follow_record cfr
join sys_user u on u.user_id = cfr.user_id
join sys_dept d on d.dept_id = u.dept_id
where cfr.user_id = #{dto.userId}
<if test="dto.customerId != null and dto.customerId != '' "> and cfr.customer_id = #{dto.customerId} </if>
<!-- 数据范围过滤 -->
${params.dataScope}
order by cfr.create_time desc
</select>
</mapper> </mapper>
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