Commit 578e3634 authored by yanghao's avatar yanghao

chore: 客户跟进联系人由名称修改为id,并在列表中返回联系人电话.

parent 0121e121
......@@ -99,6 +99,7 @@ CREATE TABLE `ecw_customer_followup` (
`offer_id` bigint NULL DEFAULT NULL COMMENT '报价单',
`follow_type` tinyint NULL DEFAULT NULL COMMENT '跟进类型 字典customer_followup_type',
`follow_time` datetime NULL DEFAULT NULL COMMENT '跟进时间',
`contact_id` bigint NULL DEFAULT NULL COMMENT '联系人id',
`contact_name` varchar(63) NULL DEFAULT NULL COMMENT '联系人',
`follow_method` tinyint NULL DEFAULT NULL COMMENT '跟进方式 字典customer_followup_method',
`follow_user_id` bigint NULL DEFAULT NULL COMMENT '客户经理/跟进业务员id',
......
package cn.iocoder.yudao.module.customer.dal.dataobject.customerFollowup;
import com.alibaba.excel.annotation.ExcelProperty;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;
import java.util.*;
import com.baomidou.mybatisplus.annotation.*;
......@@ -57,6 +58,11 @@ public class CustomerFollowupDO extends BaseDO {
* 跟进时间
*/
private Date followTime;
/**
* 联系人id
*/
private Long contactId;
/**
* 联系人
*/
......@@ -109,4 +115,10 @@ public class CustomerFollowupDO extends BaseDO {
@TableField(exist = false)
private String followUserName;
@ApiModelProperty(value = "联系人电话")
private String contactPhone;
}
......@@ -12,7 +12,9 @@ import cn.iocoder.yudao.framework.mybatis.core.util.MyBatisUtils;
import cn.iocoder.yudao.framework.security.core.LoginUser;
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
import cn.iocoder.yudao.module.customer.dal.dataobject.customer.CustomerDO;
import cn.iocoder.yudao.module.customer.dal.dataobject.customerContacts.CustomerContactsDO;
import cn.iocoder.yudao.module.customer.dal.mysql.customer.CustomerMapper;
import cn.iocoder.yudao.module.customer.dal.mysql.customerContacts.CustomerContactsMapper;
import cn.iocoder.yudao.module.customer.service.customerOperateLog.CustomerOperateLogService;
import cn.iocoder.yudao.module.customer.vo.customerOperateLog.CustomerOperateLogCreateReqVO;
import cn.iocoder.yudao.module.ecw.enums.CustomerFollowupStatusEnum;
......@@ -49,6 +51,9 @@ public class CustomerFollowupServiceImpl extends AbstractService<CustomerFollowu
@Resource
private CustomerMapper customerMapper;
@Resource
private CustomerContactsMapper customerContactsMapper;
/**
* 跟进单编号生成方式:GJ+年份+六位数字,按年份累计
* @return
......@@ -78,6 +83,10 @@ public class CustomerFollowupServiceImpl extends AbstractService<CustomerFollowu
// 插入
CustomerFollowupDO followup = CustomerFollowupConvert.INSTANCE.convert(createReqVO);
// 设置联系人名称
setContactName(followup);
followupMapper.insert(followup);
Long customerId = createReqVO.getCustomerId();
......@@ -108,6 +117,17 @@ public class CustomerFollowupServiceImpl extends AbstractService<CustomerFollowu
return followup.getId();
}
private void setContactName(CustomerFollowupDO followup) {
// 设置联系人名称
Long contactId = followup.getContactId();
if (contactId != null) {
CustomerContactsDO customerContactsDO = customerContactsMapper.selectById(contactId);
if (customerContactsDO != null) {
followup.setContactName(I18nMessage.getLang() == 0 ? customerContactsDO.getName() : customerContactsDO.getNameEn());
}
}
}
@Override
public void updateFollowup(CustomerFollowupUpdateReqVO updateReqVO) {
// 校验存在
......@@ -121,6 +141,10 @@ public class CustomerFollowupServiceImpl extends AbstractService<CustomerFollowu
}
// 更新
CustomerFollowupDO updateObj = CustomerFollowupConvert.INSTANCE.convert(updateReqVO);
// 设置联系人名称
setContactName(updateObj);
followupMapper.updateById(updateObj);
Long customerId = updateReqVO.getCustomerId();
......
......@@ -46,12 +46,14 @@ public class CustomerFollowupBackVO {
@ApiModelProperty(value = "客户编号")
private String customerNumber;
// 联系人id
@ApiModelProperty(value = "联系人id")
private Long contactId;
@ExcelProperty("联系人")
@ApiModelProperty(value = "联系人")
private String contactName;
//TODO 联系方式
@ApiModelProperty(value = "客户经理/跟进业务员id")
private Long followUserId;
@ExcelProperty("客户经理")
......@@ -133,4 +135,10 @@ public class CustomerFollowupBackVO {
private String attatchment;
@ExcelProperty("联系人电话")
@ApiModelProperty(value = "联系人电话")
private String contactPhone;
}
......@@ -37,6 +37,10 @@ public class CustomerFollowupBaseVO {
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private Date followTime;
//联系人id
@ApiModelProperty(value = "联系人id")
private Long contactId;
@ApiModelProperty(value = "联系人")
private String contactName;
......
......@@ -41,6 +41,10 @@ public class CustomerFollowupQueryVO extends PageParam {
@ApiModelProperty(value = "结束跟进时间")
private Date endFollowTime;
//联系人id
@ApiModelProperty(value = "联系人id")
private Long contactId;
@ApiModelProperty(value = "联系人")
private String contactName;
......
......@@ -44,13 +44,15 @@
select a.*, b.number as customer_number, c.number as offer_number,
d.nickname as creator_name, e.nickname as updater_name,
f.nickname as follow_user_name
f.nickname as follow_user_name,
concat_ws( '', g.area_code, g.phone_new) as contact_phone
from ecw_customer_followup a
left join ecw_customer b on a.customer_id = b.id
left join ecw_offer c on a.offer_id = c.offer_id
left join system_user d on a.creator = d.id
left join system_user e on a.updater = e.id
left join system_user f on a.follow_user_id = f.id
left join ecw_customer_contacts g on a.contact_id = g.id
WHERE 1=1 AND a.deleted = 0
......
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