Commit 24879f28 authored by lcl's avatar lcl

客户跟进记录相关功能添加

parent 977ddd29
......@@ -10,10 +10,7 @@ import com.dsk.system.domain.customer.dto.CustomerSearchDto;
import com.dsk.system.service.ICustomerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
/**
* 客户相关
......@@ -44,7 +41,7 @@ public class CustomerController extends BaseController {
@PreAuthorize("@ss.hasPermi('customer:add')")
@PostMapping()
@RepeatSubmit
public AjaxResult add(Customer customer){
public AjaxResult add(@RequestBody Customer customer){
return AjaxResult.success(baseService.add(customer));
}
......@@ -52,9 +49,9 @@ public class CustomerController extends BaseController {
* 编辑客户
*/
@PreAuthorize("@ss.hasPermi('customer:edit')")
@PostMapping()
@PutMapping()
@RepeatSubmit
public AjaxResult edit(Customer customer){
public AjaxResult edit(@RequestBody Customer customer){
return AjaxResult.success(baseService.edit(customer));
}
......
package com.dsk.web.controller.customer;
import com.dsk.common.annotation.RepeatSubmit;
import com.dsk.common.core.controller.BaseController;
import com.dsk.common.core.domain.AjaxResult;
import com.dsk.common.core.page.TableDataInfo;
import com.dsk.system.domain.customer.Customer;
import com.dsk.system.domain.customer.CustomerFollowRecord;
import com.dsk.system.domain.customer.dto.CustomerFollowRecordSearchDto;
import com.dsk.system.domain.customer.dto.CustomerSearchDto;
import com.dsk.system.service.ICustomerFollowRecordService;
import com.dsk.system.service.ICustomerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
/**
* 客户跟进记录相关
*
* @author lcl
* @create 2023/5/18
*/
@RestController
@RequestMapping("/customer/follow/record")
public class CustomerFollowRecordController extends BaseController {
@Autowired
private ICustomerFollowRecordService baseService;
/**
* 查询客户跟进记录列表
*/
// @PreAuthorize("@ss.hasPermi('customer:follow:record:list')")
@GetMapping("/list")
public TableDataInfo selectPageList(CustomerFollowRecordSearchDto dto){
startPage();
return getDataTable(baseService.selectList(dto));
}
/**
* 添加客户跟进记录
*/
// @PreAuthorize("@ss.hasPermi('customer:follow:record:add')")
@PostMapping()
@RepeatSubmit
public AjaxResult add(@RequestBody CustomerFollowRecord followRecord){
return AjaxResult.success(baseService.add(followRecord));
}
}
package com.dsk.system.domain.customer;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.util.Date;
/**
* 客户跟进记录(CustomerFollowRecord)实体类
*
* @author makejava
* @since 2023-05-18 15:07:59
*/
@Data
@NoArgsConstructor
@Accessors(chain = true)
@TableName("customer_follow_record")
public class CustomerFollowRecord implements Serializable {
private static final long serialVersionUID = -17639570424991398L;
@TableId(value = "id",type = IdType.AUTO)
private Long id;
/**
* 客户id
*/
private String customerId;
/**
* 用户id
*/
private Long userId;
/**
* 拜访方式(visit_mode_type)
*/
private String visitMode;
/**
* 下次拜访时间
*/
private Date nextVisitTime;
/**
* 拜访对象姓名
*/
private String name;
/**
* 拜访对象职务
*/
private String position;
/**
* 拜访内容
*/
private String content;
@TableField(fill = FieldFill.INSERT)
private Date createTime;
}
package com.dsk.system.domain.customer.dto;
import lombok.Data;
import java.io.Serializable;
/**
* 客户跟进记录筛选对象
*
* @author lcl
* @create 2023/5/18
*/
@Data
public class CustomerFollowRecordSearchDto implements Serializable {
/**
* 客户id
*/
private String customerId;
/**
* 用户id
*/
private Long userId;
}
package com.dsk.system.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.dsk.system.domain.customer.CustomerFollowRecord;
import org.apache.ibatis.annotations.Mapper;
/**
* 客户跟进记录(CustomerFollowRecord)表数据库访问层
*
* @author makejava
* @since 2023-05-18 15:07:59
*/
@Mapper
public interface CustomerFollowRecordMapper extends BaseMapper<CustomerFollowRecord> {
}
package com.dsk.system.service;
import com.dsk.system.domain.customer.CustomerFollowRecord;
import com.dsk.system.domain.customer.dto.CustomerFollowRecordSearchDto;
import java.util.List;
/**
* 客户跟进记录(CustomerFollowRecord)表服务接口
*
* @author makejava
* @since 2023-05-18 15:07:59
*/
public interface ICustomerFollowRecordService {
List<CustomerFollowRecord> selectList(CustomerFollowRecordSearchDto dto);
boolean add(CustomerFollowRecord followRecord);
}
package com.dsk.system.service.impl;
import cn.hutool.core.bean.BeanException;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.dsk.common.utils.SecurityUtils;
import com.dsk.system.domain.customer.CustomerFollowRecord;
import com.dsk.system.domain.customer.dto.CustomerFollowRecordSearchDto;
import com.dsk.system.mapper.CustomerFollowRecordMapper;
import com.dsk.system.service.ICustomerFollowRecordService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
import javax.annotation.Resource;
import java.util.List;
/**
* 客户跟进记录(CustomerFollowRecord)表服务实现类
*
* @author makejava
* @since 2023-05-18 15:07:59
*/
@Slf4j
@Service
public class CustomerFollowRecordServiceImpl implements ICustomerFollowRecordService {
@Resource
private CustomerFollowRecordMapper baseMapper;
@Override
public List<CustomerFollowRecord> selectList(CustomerFollowRecordSearchDto dto) {
LambdaQueryWrapper<CustomerFollowRecord> wrapper = Wrappers.lambdaQuery();
if (!ObjectUtils.isEmpty(dto.getCustomerId())) {
wrapper.eq(CustomerFollowRecord::getCustomerId, dto.getCustomerId());
}
wrapper.eq(CustomerFollowRecord::getUserId, SecurityUtils.getUserId())
.orderByDesc(CustomerFollowRecord::getCreateTime);
return baseMapper.selectList(wrapper);
}
@Override
public boolean add(CustomerFollowRecord followRecord) {
if (ObjectUtils.isEmpty(followRecord.getContent())) throw new BeanException("跟进内容不能为空");
if (ObjectUtils.isEmpty(followRecord.getCustomerId())) throw new BeanException("跟进客户不能为空");
followRecord.setUserId(SecurityUtils.getUserId());
return baseMapper.insert(followRecord) != 0;
}
}
......@@ -69,7 +69,7 @@ public class CustomerServiceImpl implements ICustomerService {
@Override
@Transactional(rollbackFor = Exception.class)
public boolean edit(Customer customer) {
if (ObjectUtils.isEmpty(customer.getCompanyId())) throw new BeanException("客户id不能为空");
if (ObjectUtils.isEmpty(customer.getCustomerId())) throw new BeanException("客户id不能为空");
customer.setUpdateId(SecurityUtils.getUserId());
int u = baseMapper.updateById(customer);
return u != 0;
......
<?xml version="1.0" encoding="UTF-8"?>
<!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>
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