跟进记录完善

This commit is contained in:
wuyibo
2023-08-03 15:45:16 +08:00
parent b3519d6782
commit e4339a1e13
26 changed files with 1956 additions and 614 deletions

View File

@@ -77,7 +77,15 @@
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common-swagger</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
<!-- mybatis-flex -->
<dependency>
<groupId>com.mybatis-flex</groupId>
<artifactId>mybatis-flex-spring-boot-starter</artifactId>
</dependency>
</dependencies>
<build>

View File

@@ -6,4 +6,27 @@ server:
spring:
application:
# 应用名称
name: ruoyi-gen
name: ruoyi-gen
# Mybatis开启驼峰映射
mybatis:
configuration:
mapUnderscoreToCamelCase: true
# MyBatis配置
mybatis-flex:
# 搜索指定包别名
typeAliasesPackage: com.ruoyi.**.domain
# 配置mapper的扫描找到所有的mapper.xml映射文件
mapper-locations: classpath*:mapper/**/*Mapper.xml
cacheEnabled: true
useGeneratedKeys: true
defaultExecutorType: SIMPLE
configuration:
# 更详细的日志输出 会有性能损耗 org.apache.ibatis.logging.stdout.StdOutImpl
# 关闭日志记录 (可单纯使用 p6spy 分析) org.apache.ibatis.logging.nologging.NoLoggingImpl
# 默认日志输出 org.apache.ibatis.logging.slf4j.Slf4jImpl
logImpl: org.apache.ibatis.logging.slf4j.Slf4jImpl
# PageHelper分页插件
pagehelper:
helperDialect: mysql
supportMethodsArguments: true
params: count=countSql

View File

@@ -49,6 +49,18 @@ public class CustomerController extends BaseController
return getDataTable(list);
}
/**
* 查询客户信息列表
*/
@RequiresPermissions("system:customer:makerList")
@GetMapping("/makerList")
public TableDataInfo makerList(CustomerVo customer)
{
startPage();
List<CustomerVo> list = customerService.selectCustomerMakerList(customer);
return getDataTable(list);
}
/**
* 导出客户信息列表
*/

View File

@@ -0,0 +1,121 @@
package com.ruoyi.system.controller;
import java.util.List;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
import com.ruoyi.system.domain.Customer;
import com.ruoyi.system.domain.vo.CustomerOrderVo;
import com.ruoyi.system.service.ICustomerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.log.annotation.Log;
import com.ruoyi.common.log.enums.BusinessType;
import com.ruoyi.common.security.annotation.RequiresPermissions;
import com.ruoyi.system.domain.CustomerOrder;
import com.ruoyi.system.service.ICustomerOrderService;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.utils.poi.ExcelUtil;
import com.ruoyi.common.core.web.page.TableDataInfo;
/**
* 客户-订车Controller
*
* @author ruoyi
* @date 2023-08-01
*/
@RestController
@RequestMapping("/customerOrder")
public class CustomerOrderController extends BaseController
{
@Autowired
private ICustomerOrderService customerOrderService;
@Autowired
private ICustomerService customerService;
/**
* 查询客户-订车列表
*/
@RequiresPermissions("system:customerOrder:list")
@GetMapping("/list")
public TableDataInfo list(CustomerOrder customerOrder)
{
startPage();
List<CustomerOrder> list = customerOrderService.selectCustomerOrderList(customerOrder);
return getDataTable(list);
}
@GetMapping("/getCustomerOrderPage")
public TableDataInfo getCustomerOrderPage(CustomerOrderVo customerOrder)
{
startPage();
List<CustomerOrderVo> list = customerOrderService.getCustomerOrderPage(customerOrder);
return getDataTable(list);
}
/**
* 导出客户-订车列表
*/
@RequiresPermissions("system:customerOrder:export")
@Log(title = "客户-订车", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, CustomerOrder customerOrder)
{
List<CustomerOrder> list = customerOrderService.selectCustomerOrderList(customerOrder);
ExcelUtil<CustomerOrder> util = new ExcelUtil<CustomerOrder>(CustomerOrder.class);
util.exportExcel(response, list, "客户-订车数据");
}
/**
* 获取客户-订车详细信息
*/
@RequiresPermissions("system:customerOrder:query")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return AjaxResult.success(customerOrderService.selectCustomerOrderById(id));
}
/**
* 新增客户-订车
*/
@Log(title = "客户-订车", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody CustomerOrder customerOrder)
{
Customer customer = new Customer();
customer.setId(customerOrder.getCustomerId());
customer.setStatus("order");
customerService.updateCustomer(customer);
return toAjax(customerOrderService.insertCustomerOrder(customerOrder));
}
/**
* 修改客户-订车
*/
@RequiresPermissions("system:customerOrder:edit")
@Log(title = "客户-订车", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody CustomerOrder customerOrder)
{
return toAjax(customerOrderService.updateCustomerOrder(customerOrder));
}
/**
* 删除客户-订车
*/
@RequiresPermissions("system:customerOrder:remove")
@Log(title = "客户-订车", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(customerOrderService.deleteCustomerOrderByIds(ids));
}
}

View File

@@ -0,0 +1,49 @@
package com.ruoyi.system.domain;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.core.annotation.Excel;
import com.ruoyi.common.core.web.domain.BaseEntity;
/**
* 客户-订车对象 f_customer_order
*
* @author ruoyi
* @date 2023-08-01
*/
@Data
public class CustomerOrder extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** id */
private Long id;
/** 客户id */
@Excel(name = "客户id")
private Long customerId;
/** 订车时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "订车时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date orderDate;
/** 车辆详细 */
@Excel(name = "车辆详细")
private String carInfo;
/** 车辆VIN */
@Excel(name = "车辆VIN")
private String carVin;
/** 车辆状态 */
@Excel(name = "车辆状态")
private String carStatus;
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "出库日期", width = 30, dateFormat = "yyyy-MM-dd")
private Date outDate;
}

View File

@@ -36,21 +36,47 @@ public class FollowUp extends BaseEntity
@Excel(name = "跟进日期", width = 30, dateFormat = "yyyy-MM-dd")
private Date followUpDate;
/** 跟进记录 */
@Excel(name = "跟进记录")
private String followUpRecord;
/** 再次预约到店日期 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "再次预约到店日期", width = 30, dateFormat = "yyyy-MM-dd")
private Date preToStoreDate;
/** 级别 */
@Excel(name = "级别")
private String followLevel;
@Excel(name = "跟进结果")
private String followResult;
/** 跟进方式 */
@Excel(name = "跟进方式")
private String followUpMethod;
/** 跟进结果 */
@Excel(name = "跟进结果")
private String followResult;
/** 意向级别 */
@Excel(name = "意向级别")
private String intentionLevel;
/** 本次跟进记录 */
@Excel(name = "本次跟进记录")
private String followUpRecord;
/** 下次跟进备注 */
@Excel(name = "下次跟进备注")
private String nextFollowUpRecord;
/** 下次跟进时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "下次跟进时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date nextFollowUpTime;
/** 预约时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "预约时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date appointmentTime;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "到店时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date arrivalTime;
/** 战败原因 */
@Excel(name = "战败原因")
private String defeatReasons;
@Excel(name = "预约状态")
private String makerStatus;
@Excel(name = "跟进类型(销售回访,潜客跟进)")
private String followType;
@Excel(name = "跟进目的")
private String objective;
}

View File

@@ -0,0 +1,48 @@
package com.ruoyi.system.domain.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.core.annotation.Excel;
import lombok.Data;
import java.util.Date;
/**
* @author 吴一博
* @date 2023年08月03日 8:36
* @Description
*/
@Data
public class CustomerOrderVo extends CustomerVo{
/** 客户id */
@Excel(name = "客户id")
private Long customerId;
/** 订车时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "订车时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date orderDate;
/** 车辆详细 */
@Excel(name = "车辆详细")
private String carInfo;
/** 车辆VIN */
@Excel(name = "车辆VIN")
private String carVin;
/** 车辆状态 */
@Excel(name = "车辆状态")
private String carStatus;
/** 车辆状态 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "出库日期", width = 30, dateFormat = "yyyy-MM-dd")
private String outDate;
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "计划跟进日期", width = 30, dateFormat = "yyyy-MM-dd")
private String planFollowUpDate;
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "实际跟进日期", width = 30, dateFormat = "yyyy-MM-dd")
private String actualFollowUpDate;
}

View File

@@ -27,4 +27,18 @@ public class CustomerVo extends Customer {
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "跟进超期", width = 30, dateFormat = "yyyy-MM-dd")
private String followUpOverdueDate;
/** 意向级别 */
@Excel(name = "意向级别")
private String intentionLevel;
@Excel(name = "跟进方式")
private String followUpMethod;
/** 预约时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "预约时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date appointmentTime;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "到店时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date arrivalTime;
@Excel(name = "预约状态")
private String makerStatus;
}

View File

@@ -85,4 +85,6 @@ public interface CustomerMapper
* @return 结果
*/
public int deleteFollowUpByCustomerId(Long id);
//预约记录列表
List<CustomerVo> selectCustomerMakerList(CustomerVo customer);
}

View File

@@ -0,0 +1,66 @@
package com.ruoyi.system.mapper;
import java.util.List;
import com.mybatisflex.core.BaseMapper;
import com.ruoyi.system.domain.CustomerOrder;
import com.ruoyi.system.domain.vo.CustomerOrderVo;
/**
* 客户-订车Mapper接口
*
* @author ruoyi
* @date 2023-08-01
*/
public interface CustomerOrderMapper extends BaseMapper<CustomerOrder>
{
/**
* 查询客户-订车
*
* @param id 客户-订车主键
* @return 客户-订车
*/
public CustomerOrder selectCustomerOrderById(Long id);
/**
* 查询客户-订车列表
*
* @param customerOrder 客户-订车
* @return 客户-订车集合
*/
public List<CustomerOrder> selectCustomerOrderList(CustomerOrder customerOrder);
/**
* 新增客户-订车
*
* @param customerOrder 客户-订车
* @return 结果
*/
public int insertCustomerOrder(CustomerOrder customerOrder);
/**
* 修改客户-订车
*
* @param customerOrder 客户-订车
* @return 结果
*/
public int updateCustomerOrder(CustomerOrder customerOrder);
/**
* 删除客户-订车
*
* @param id 客户-订车主键
* @return 结果
*/
public int deleteCustomerOrderById(Long id);
/**
* 批量删除客户-订车
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteCustomerOrderByIds(Long[] ids);
List<CustomerOrderVo> getCustomerOrderPage(CustomerOrderVo customerOrder);
}

View File

@@ -0,0 +1,66 @@
package com.ruoyi.system.service;
import java.util.List;
import com.mybatisflex.core.service.IService;
import com.ruoyi.system.domain.CustomerOrder;
import com.ruoyi.system.domain.vo.CustomerOrderVo;
/**
* 客户-订车Service接口
*
* @author ruoyi
* @date 2023-08-01
*/
public interface ICustomerOrderService extends IService<CustomerOrder>
{
/**
* 查询客户-订车
*
* @param id 客户-订车主键
* @return 客户-订车
*/
public CustomerOrder selectCustomerOrderById(Long id);
/**
* 查询客户-订车列表
*
* @param customerOrder 客户-订车
* @return 客户-订车集合
*/
public List<CustomerOrder> selectCustomerOrderList(CustomerOrder customerOrder);
/**
* 新增客户-订车
*
* @param customerOrder 客户-订车
* @return 结果
*/
public int insertCustomerOrder(CustomerOrder customerOrder);
/**
* 修改客户-订车
*
* @param customerOrder 客户-订车
* @return 结果
*/
public int updateCustomerOrder(CustomerOrder customerOrder);
/**
* 批量删除客户-订车
*
* @param ids 需要删除的客户-订车主键集合
* @return 结果
*/
public int deleteCustomerOrderByIds(Long[] ids);
/**
* 删除客户-订车信息
*
* @param id 客户-订车主键
* @return 结果
*/
public int deleteCustomerOrderById(Long id);
List<CustomerOrderVo> getCustomerOrderPage(CustomerOrderVo customerOrder);
}

View File

@@ -59,4 +59,6 @@ public interface ICustomerService
* @return 结果
*/
public int deleteCustomerById(Long id);
List<CustomerVo> selectCustomerMakerList(CustomerVo customer);
}

View File

@@ -0,0 +1,104 @@
package com.ruoyi.system.service.impl;
import java.util.List;
import com.mybatisflex.spring.service.impl.ServiceImpl;
import com.ruoyi.common.core.utils.DateUtils;
import com.ruoyi.system.domain.vo.CustomerOrderVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.CustomerOrderMapper;
import com.ruoyi.system.domain.CustomerOrder;
import com.ruoyi.system.service.ICustomerOrderService;
/**
* 客户-订车Service业务层处理
*
* @author ruoyi
* @date 2023-08-01
*/
@Service
public class CustomerOrderServiceImpl extends ServiceImpl<CustomerOrderMapper, CustomerOrder> implements ICustomerOrderService
{
@Autowired
private CustomerOrderMapper customerOrderMapper;
/**
* 查询客户-订车
*
* @param id 客户-订车主键
* @return 客户-订车
*/
@Override
public CustomerOrder selectCustomerOrderById(Long id)
{
return customerOrderMapper.selectCustomerOrderById(id);
}
/**
* 查询客户-订车列表
*
* @param customerOrder 客户-订车
* @return 客户-订车
*/
@Override
public List<CustomerOrder> selectCustomerOrderList(CustomerOrder customerOrder)
{
return customerOrderMapper.selectCustomerOrderList(customerOrder);
}
/**
* 新增客户-订车
*
* @param customerOrder 客户-订车
* @return 结果
*/
@Override
public int insertCustomerOrder(CustomerOrder customerOrder)
{
customerOrder.setCreateTime(DateUtils.getNowDate());
return customerOrderMapper.insertCustomerOrder(customerOrder);
}
/**
* 修改客户-订车
*
* @param customerOrder 客户-订车
* @return 结果
*/
@Override
public int updateCustomerOrder(CustomerOrder customerOrder)
{
customerOrder.setUpdateTime(DateUtils.getNowDate());
return customerOrderMapper.updateCustomerOrder(customerOrder);
}
/**
* 批量删除客户-订车
*
* @param ids 需要删除的客户-订车主键
* @return 结果
*/
@Override
public int deleteCustomerOrderByIds(Long[] ids)
{
return customerOrderMapper.deleteCustomerOrderByIds(ids);
}
/**
* 删除客户-订车信息
*
* @param id 客户-订车主键
* @return 结果
*/
@Override
public int deleteCustomerOrderById(Long id)
{
return customerOrderMapper.deleteCustomerOrderById(id);
}
@Override
public List<CustomerOrderVo> getCustomerOrderPage(CustomerOrderVo customerOrder) {
return customerOrderMapper.getCustomerOrderPage(customerOrder);
}
}

View File

@@ -109,6 +109,11 @@ public class CustomerServiceImpl implements ICustomerService
return customerMapper.deleteCustomerById(id);
}
@Override
public List<CustomerVo> selectCustomerMakerList(CustomerVo customer) {
return customerMapper.selectCustomerMakerList(customer);
}
/**
* 新增跟进模块-客户跟进记录信息
*

View File

@@ -63,12 +63,9 @@ public class FollowUpServiceImpl extends ServiceImpl<FollowUpMapper, FollowUp> i
Customer customer = new Customer();
customer.setId(followUp.getCustomerId());
//如果跟进记录的跟进级别选择
if("战败".equals(followUp.getFollowLevel())){
if("fail".equals(followUp.getFollowResult())){
customer.setStatus("defeat");
customerMapper.updateCustomer(customer);
}else if("订车".equals(followUp.getFollowLevel())||"成交".equals(followUp.getFollowLevel())){
customer.setStatus("order");
customerMapper.updateCustomer(customer);
}
return followUpMapper.insertFollowUp(followUp);
}

View File

@@ -65,34 +65,30 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</sql>
<select id="selectCustomerList" resultType="com.ruoyi.system.domain.vo.CustomerVo">
SELECT t.*,f.follow_up_date as followUpLastDate,f.follow_level as followUpLastLevel,
(CASE f.follow_level
WHEN 'H' THEN
date_add(f.follow_up_date,interval 1 day)
WHEN 'A' THEN
date_add(f.follow_up_date,interval 3 day)
WHEN 'B' THEN
date_add(f.follow_up_date,interval 7 day)
WHEN 'C' THEN
date_add(f.follow_up_date,interval 13 day)
ELSE
IF(ISNULL(f.follow_level),f.follow_level,'暂不回访')
END
SELECT t.*,f.follow_up_date as followUpLastDate,f.intention_level as followUpLastLevel,
(CASE f.intention_level
WHEN 'H' THEN
date_add(f.follow_up_date,interval 1 day)
WHEN 'A' THEN
date_add(f.follow_up_date,interval 3 day)
WHEN 'B' THEN
date_add(f.follow_up_date,interval 7 day)
WHEN 'C' THEN
date_add(f.follow_up_date,interval 13 day)
ELSE
IF(ISNULL(f.intention_level),f.intention_level,'暂不回访')
END
) as followUpOverdueDate,
(case f.follow_level
WHEN 'H' THEN '24小时内回访'
WHEN 'A' THEN
date_add(f.follow_up_date,interval 3 day)
WHEN 'B' THEN
date_add(f.follow_up_date,interval 5 day)
WHEN 'C' THEN
date_add(f.follow_up_date,interval 7 day)
when '成交' then '成交'
when '战败' then '战败'
when '休眠' then '休眠'
when '订车' then '订车'
ELSE ''
end
(case f.intention_level
WHEN 'H' THEN '24小时内回访'
WHEN 'A' THEN
date_add(f.follow_up_date,interval 3 day)
WHEN 'B' THEN
date_add(f.follow_up_date,interval 5 day)
WHEN 'C' THEN
date_add(f.follow_up_date,interval 7 day)
ELSE ''
end
) as proposalNextFollowDate,f1.followUpTimes FROM f_customer t
LEFT JOIN (
SELECT a.* FROM f_follow_up AS a
@@ -130,20 +126,63 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="storeName != null and storeName != ''"> and t.store_name like concat('%', #{storeName}, '%')</if>
<if test="orderDate != null "> and t.order_date = #{orderDate}</if>
<if test="followUpLastDate != null "> and f.follow_up_date = #{followUpLastDate}</if>
<if test="followUpLastLevel != null "> and f.follow_level = #{followUpLastLevel}</if>
<if test="proposalNextFollowDate != null "> and f.pre_to_store_date = #{proposalNextFollowDate}</if>
<if test="followUpLastLevel != null "> and f.intention_level = #{followUpLastLevel}</if>
<if test="proposalNextFollowDate != null "> and f.next_follow_up_time = #{proposalNextFollowDate}</if>
</where>
</select>
<select id="selectCustomerById" parameterType="Long" resultMap="CustomerFollowUpResult">
select a.id, a.user_name,a.store_status, a.nick_name, a.user_type, a.email, a.phonenumber, a.sex, a.avatar, a.clue_channel, a.data_source, a.live_address, a.status, a.del_flag, a.login_ip, a.login_date, a.create_by, a.create_time, a.update_by, a.update_time, a.remark, a.wechat, a.buy_car_type, a.exist_models, a.is_assessment, a.intention_car_models, a.contrast_car_models, a.is_test_drive, a.is_offer, a.is_finance, a.un_booking_car_reason, a.pre_to_store_date, a.last_to_store_date, a.store_name, a.order_date,
b.id as sub_id, b.customer_id as sub_customer_id, b.follow_up_date as sub_follow_up_date, b.follow_up_record as sub_follow_up_record, b.pre_to_store_date as sub_pre_to_store_date, b.create_by as sub_create_by, b.create_time as sub_create_time, b.update_by as sub_update_by, b.update_time as sub_update_time, b.remark as sub_remark, b.follow_level as sub_follow_level
from f_customer a
left join f_follow_up b on b.customer_id = a.id
SELECT
a.id,
a.user_name,
a.store_status,
a.nick_name,
a.user_type,
a.email,
a.phonenumber,
a.sex,
a.avatar,
a.clue_channel,
a.data_source,
a.live_address,
a.STATUS,
a.del_flag,
a.login_ip,
a.login_date,
a.create_by,
a.create_time,
a.update_by,
a.update_time,
a.remark,
a.wechat,
a.buy_car_type,
a.exist_models,
a.is_assessment,
a.intention_car_models,
a.contrast_car_models,
a.is_test_drive,
a.is_offer,
a.is_finance,
a.un_booking_car_reason,
a.pre_to_store_date,
a.last_to_store_date,
a.store_name,
a.order_date,
b.id as sub_id, b.customer_id as sub_customer_id, b.follow_up_date as sub_follow_up_date, b.follow_up_record, b.appointment_time, b.create_by as sub_create_by, b.create_time as sub_create_time, b.update_by as sub_update_by, b.update_time as sub_update_time, b.remark as sub_remark, b.intention_level
from f_customer a left join f_follow_up b on b.customer_id = a.id
where a.id = #{id}
</select>
<select id="selectCustomerMakerList" resultType="com.ruoyi.system.domain.vo.CustomerVo">
SELECT * from f_follow_up t LEFT JOIN f_customer c on c.id = t.customer_id
where t.follow_result = 'maker' and c.status = 'potential'
<if test="phoneNumber != null and phoneNumber != ''"> and c.phone_number like concat('%', #{phoneNumber}, '%')</if>
<if test="userName != null and userName != ''"> and c.user_name like concat('%', #{userName}, '%')</if>
<if test="makerStatus != null and makerStatus != ''"> and t.maker_status =#{makerStatus}</if>
<if test="intentionLevel != null and intentionLevel != ''"> and t.intention_level =#{intentionLevel}</if>
</select>
<insert id="insertCustomer" parameterType="Customer" useGeneratedKeys="true" keyProperty="id">
insert into f_customer
<trim prefix="(" suffix=")" suffixOverrides=",">

View File

@@ -0,0 +1,123 @@
<?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.ruoyi.system.mapper.CustomerOrderMapper">
<resultMap type="CustomerOrder" id="CustomerOrderResult">
<result property="id" column="id" />
<result property="customerId" column="customer_id" />
<result property="orderDate" column="order_date" />
<result property="carInfo" column="car_info" />
<result property="carVin" column="car_vin" />
<result property="carStatus" column="car_status" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
<result property="outDate" column="out_date"/>
<result property="carStatus" column="car_status"/>
</resultMap>
<sql id="selectCustomerOrderVo">
select id, customer_id, order_date, car_info, car_vin,out_date, car_status, create_by, create_time, update_by, update_time, remark from f_customer_order
</sql>
<select id="selectCustomerOrderList" parameterType="CustomerOrder" resultMap="CustomerOrderResult">
<include refid="selectCustomerOrderVo"/>
<where>
<if test="customerId != null "> and customer_id = #{customerId}</if>
<if test="outDate != null "> and out_date = #{outDate}</if>
<if test="orderDate != null "> and order_date = #{orderDate}</if>
<if test="carInfo != null and carInfo != ''"> and car_info = #{carInfo}</if>
<if test="carVin != null and carVin != ''"> and car_vin = #{carVin}</if>
<if test="carStatus != null and carStatus != ''"> and car_status = #{carStatus}</if>
</where>
</select>
<select id="selectCustomerOrderById" parameterType="Long" resultMap="CustomerOrderResult">
<include refid="selectCustomerOrderVo"/>
where id = #{id}
</select>
<select id="getCustomerOrderPage" resultType="com.ruoyi.system.domain.vo.CustomerOrderVo">
SELECT *,DATE_ADD(t.order_date, INTERVAL 7 DAY) as planFollowUpDate,f.create_time as actualFollowUpDate FROM f_customer_order t
LEFT JOIN f_customer c ON c.id = t.customer_id
LEFT JOIN (
SELECT a.* FROM f_follow_up AS a
LEFT JOIN (
SELECT MAX(create_time) AS create_time, customer_id FROM f_follow_up GROUP BY customer_id
) AS b ON a.customer_id = b.customer_id where a.create_time = b.create_time
) f on f.customer_id = c.id
<where>
<if test="phoneNumber != null and phoneNumber != ''"> and c.phone_number like concat('%', #{phoneNumber}, '%')</if>
<if test="userName != null and userName != ''"> and c.user_name like concat('%', #{userName}, '%')</if>
<if test="status != null "> and c.status = #{status}</if>
<if test="customerId != null "> and t.customer_id = #{customerId}</if>
<if test="orderDate != null "> and t.order_date = #{orderDate}</if>
<if test="outDate != null "> and t.out_date = #{outDate}</if>
<if test="carInfo != null and carInfo != ''"> and t.car_info like concat('%', #{carInfo}, '%')</if>
<if test="carVin != null and carVin != ''"> and t.car_vin like concat('%', #{carVin}, '%')</if>
<if test="carStatus != null and carStatus != ''"> and t.car_status like concat('%', #{carStatus}, '%') </if>
</where>
</select>
<insert id="insertCustomerOrder" parameterType="CustomerOrder" useGeneratedKeys="true" keyProperty="id">
insert into f_customer_order
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="customerId != null">customer_id,</if>
<if test="orderDate != null">order_date,</if>
<if test="outDate != null">out_date,</if>
<if test="carInfo != null">car_info,</if>
<if test="carVin != null">car_vin,</if>
<if test="carStatus != null">car_status,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="remark != null">remark,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="customerId != null">#{customerId},</if>
<if test="orderDate != null">#{orderDate},</if>
<if test="outDate != null">#{outDate},</if>
<if test="carInfo != null">#{carInfo},</if>
<if test="carVin != null">#{carVin},</if>
<if test="carStatus != null">#{carStatus},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="remark != null">#{remark},</if>
</trim>
</insert>
<update id="updateCustomerOrder" parameterType="CustomerOrder">
update f_customer_order
<trim prefix="SET" suffixOverrides=",">
<if test="customerId != null">customer_id = #{customerId},</if>
<if test="orderDate != null">order_date = #{orderDate},</if>
<if test="outDate != null">out_date = #{outDate},</if>
<if test="carInfo != null">car_info = #{carInfo},</if>
<if test="carVin != null">car_vin = #{carVin},</if>
<if test="carStatus != null">car_status = #{carStatus},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="remark != null">remark = #{remark},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteCustomerOrderById" parameterType="Long">
delete from f_customer_order where id = #{id}
</delete>
<delete id="deleteCustomerOrderByIds" parameterType="String">
delete from f_customer_order where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@@ -3,102 +3,134 @@
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.system.mapper.FollowUpMapper">
<resultMap type="FollowUp" id="FollowUpResult">
<result property="id" column="id" />
<result property="customerId" column="customer_id" />
<result property="followUpDate" column="follow_up_date" />
<result property="followUpMethod" column="follow_up_method" />
<result property="followResult" column="follow_result" />
<result property="intentionLevel" column="intention_level" />
<result property="followUpRecord" column="follow_up_record" />
<result property="preToStoreDate" column="pre_to_store_date" />
<result property="nextFollowUpRecord" column="next_follow_up_record" />
<result property="nextFollowUpTime" column="next_follow_up_time" />
<result property="appointmentTime" column="appointment_time" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
<result property="followLevel" column="follow_level" />
<result property="followResult" column="follow_result" />
<result property="followUpMethod" column="follow_up_method" />
<result property="defeatReasons" column="defeat_reasons" />
<result property="arrivalTime" column="arrival_time"/>
<result column="maker_status" property="makerStatus"/>
<result column="follow_type" property="followType"/>
<result column="objective" property="objective"/>
</resultMap>
<sql id="selectFollowUpVo">
select id, customer_id, follow_up_date, follow_up_record, pre_to_store_date, create_by, create_time, update_by, update_time, remark, follow_level,follow_result,follow_up_method from f_follow_up
select id, customer_id,objective,follow_type,maker_status,arrival_time, follow_up_date, follow_up_method, follow_result, intention_level, follow_up_record, next_follow_up_record, next_follow_up_time, appointment_time, create_by, create_time, update_by, update_time, remark, defeat_reasons from f_follow_up
</sql>
<select id="selectFollowUpList" parameterType="FollowUp" resultMap="FollowUpResult">
<include refid="selectFollowUpVo"/>
<where>
<if test="customerId != null and customerId != ''"> and customer_id = #{customerId}</if>
<if test="followResult != null and followResult != ''"> and follow_result = #{followResult}</if>
<if test="followUpMethod != null and followUpMethod != ''"> and follow_up_method = #{followUpMethod}</if>
<where>
<if test="customerId != null "> and customer_id = #{customerId}</if>
<if test="followUpDate != null "> and follow_up_date = #{followUpDate}</if>
<if test="followType != null "> and follow_type = #{followType}</if>
<if test="followUpMethod != null and followUpMethod != ''"> and follow_up_method = #{followUpMethod}</if>
<if test="followResult != null and followResult != ''"> and follow_result = #{followResult}</if>
<if test="intentionLevel != null and intentionLevel != ''"> and intention_level = #{intentionLevel}</if>
<if test="followUpRecord != null and followUpRecord != ''"> and follow_up_record = #{followUpRecord}</if>
<if test="preToStoreDate != null "> and pre_to_store_date = #{preToStoreDate}</if>
<if test="followLevel != null and followLevel != ''"> and follow_level = #{followLevel}</if>
<if test="nextFollowUpRecord != null and nextFollowUpRecord != ''"> and next_follow_up_record = #{nextFollowUpRecord}</if>
<if test="nextFollowUpTime != null "> and next_follow_up_time = #{nextFollowUpTime}</if>
<if test="appointmentTime != null "> and appointment_time = #{appointmentTime}</if>
<if test="defeatReasons != null and defeatReasons != ''"> and defeat_reasons = #{defeatReasons}</if>
</where>
</select>
<select id="selectFollowUpById" parameterType="Integer" resultMap="FollowUpResult">
<select id="selectFollowUpById" parameterType="Long" resultMap="FollowUpResult">
<include refid="selectFollowUpVo"/>
where id = #{id}
</select>
<insert id="insertFollowUp" parameterType="FollowUp" useGeneratedKeys="true" keyProperty="id">
insert into f_follow_up
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="customerId != null">customer_id,</if>
<if test="makerStatus != null">maker_status,</if>
<if test="followType != null">follow_type,</if>
<if test="arrivalTime != null">arrival_time,</if>
<if test="followUpDate != null">follow_up_date,</if>
<if test="followUpMethod != null">follow_up_method,</if>
<if test="followResult != null">follow_result,</if>
<if test="intentionLevel != null">intention_level,</if>
<if test="followUpRecord != null">follow_up_record,</if>
<if test="preToStoreDate != null">pre_to_store_date,</if>
<if test="nextFollowUpRecord != null">next_follow_up_record,</if>
<if test="nextFollowUpTime != null">next_follow_up_time,</if>
<if test="appointmentTime != null">appointment_time,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="remark != null">remark,</if>
<if test="followLevel != null">follow_level,</if>
<if test="followResult != null ">follow_result ,</if>
<if test="followUpMethod != null">follow_up_method ,</if>
</trim>
<if test="defeatReasons != null">defeat_reasons,</if>
<if test="objective != null">objective,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="customerId != null">#{customerId},</if>
<if test="makerStatus != null">#{makerStatus},</if>
<if test="followType != null">#{followType},</if>
<if test="arrivalTime != null">#{arrivalTime},</if>
<if test="followUpDate != null">#{followUpDate},</if>
<if test="followUpMethod != null">#{followUpMethod},</if>
<if test="followResult != null">#{followResult},</if>
<if test="intentionLevel != null">#{intentionLevel},</if>
<if test="followUpRecord != null">#{followUpRecord},</if>
<if test="preToStoreDate != null">#{preToStoreDate},</if>
<if test="nextFollowUpRecord != null">#{nextFollowUpRecord},</if>
<if test="nextFollowUpTime != null">#{nextFollowUpTime},</if>
<if test="appointmentTime != null">#{appointmentTime},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="remark != null">#{remark},</if>
<if test="followLevel != null">#{followLevel},</if>
<if test="followResult != null ">#{followResult},</if>
<if test="followUpMethod != null">#{followUpMethod},</if>
</trim>
<if test="defeatReasons != null">#{defeatReasons},</if>
<if test="objective != null">#{objective},</if>
</trim>
</insert>
<update id="updateFollowUp" parameterType="FollowUp">
update f_follow_up
<trim prefix="SET" suffixOverrides=",">
<if test="customerId != null">customer_id = #{customerId},</if>
<if test="makerStatus != null">maker_status = #{makerStatus},</if>
<if test="followType != null">follow_type = #{followType},</if>
<if test="arrivalTime != null">arrival_time = #{arrivalTime},</if>
<if test="followUpDate != null">follow_up_date = #{followUpDate},</if>
<if test="followUpMethod != null">follow_up_method = #{followUpMethod},</if>
<if test="followResult != null">follow_result = #{followResult},</if>
<if test="intentionLevel != null">intention_level = #{intentionLevel},</if>
<if test="followUpRecord != null">follow_up_record = #{followUpRecord},</if>
<if test="preToStoreDate != null">pre_to_store_date = #{preToStoreDate},</if>
<if test="nextFollowUpRecord != null">next_follow_up_record = #{nextFollowUpRecord},</if>
<if test="nextFollowUpTime != null">next_follow_up_time = #{nextFollowUpTime},</if>
<if test="appointmentTime != null">appointment_time = #{appointmentTime},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="followLevel != null">follow_level = #{followLevel},</if>
<if test="followResult != null "> follow_result = #{followResult},</if>
<if test="followUpMethod != null "> follow_up_method = #{followUpMethod},</if>
<if test="defeatReasons != null">defeat_reasons = #{defeatReasons},</if>
<if test="objective != null">objective = #{objective},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteFollowUpById" parameterType="Integer">
<delete id="deleteFollowUpById" parameterType="Long">
delete from f_follow_up where id = #{id}
</delete>
<delete id="deleteFollowUpByIds" parameterType="String">
delete from f_follow_up where id in
delete from f_follow_up where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>