refactor(crm): 调整报价信息中的供货方关联逻辑

- 修改查询逻辑,从CrmSupplierInfo获取供应商信息替代原联系人方式
- 将供货方联系人ID字段注释更新为供货方ID
- 移除供货方联系人真实名称字段,新增供应商名称字段
- 优化CrmSupplierInfoServiceImpl分页查询方法调用自定义SQL
dev
zangch@mesnac.com 1 month ago
parent 16ee5b8d01
commit 6c62fc7507

@ -156,7 +156,7 @@ public class CrmQuoteInfo extends TenantEntity {
private String customerContactEmail;
/**
* ID
* ID
*/
private Long supplierContactId;
@ -221,9 +221,13 @@ public class CrmQuoteInfo extends TenantEntity {
/**
* CrmCustomerContact
*/
/* @TableField(exist = false)
private String supplierContactRealName;*/
/**
*
*/
@TableField(exist = false)
private String supplierContactRealName;
private String supplierName;
/**
* -

@ -155,7 +155,7 @@ public class CrmQuoteInfoBo extends BaseEntity {
private String customerContactEmail;
/**
* ID
* ID
*/
private Long supplierContactId;

@ -195,9 +195,9 @@ public class CrmQuoteInfoVo implements Serializable {
private String customerContactEmail;
/**
* ID
* ID
*/
@ExcelProperty(value = "供货方联系人ID")
@ExcelProperty(value = "供货方ID")
private Long supplierContactId;
/**
@ -261,8 +261,12 @@ public class CrmQuoteInfoVo implements Serializable {
private String customerContactRealName;
/** 派生供货方联系人真实名称CrmCustomerContact */
@ExcelProperty(value = "供货方联系人(实时)")
private String supplierContactRealName;
/* @ExcelProperty(value = "供货方联系人(实时)")
private String supplierContactRealName;*/
/**
*
*/
private String supplierName;
/**

@ -9,12 +9,10 @@ import org.dromara.common.core.utils.MapstructUtils;
import org.dromara.common.core.utils.StringUtils;
import org.dromara.common.mybatis.core.page.PageQuery;
import org.dromara.common.mybatis.core.page.TableDataInfo;
import org.dromara.oa.crm.domain.CrmCustomerContact;
import org.dromara.oa.crm.domain.CrmCustomerInfo;
import org.dromara.oa.crm.domain.CrmQuoteInfo;
import org.dromara.oa.crm.domain.CrmQuoteMaterial;
import org.dromara.oa.crm.domain.*;
import org.dromara.oa.crm.domain.bo.CrmQuoteInfoBo;
import org.dromara.oa.crm.domain.bo.CrmQuoteMaterialBo;
import org.dromara.oa.crm.domain.bo.CrmSupplierInfoBo;
import org.dromara.oa.crm.domain.vo.CrmCustomerContactVo;
import org.dromara.oa.crm.domain.vo.CrmQuoteInfoVo;
import org.dromara.oa.crm.domain.vo.CrmQuoteMaterialVo;
@ -103,10 +101,14 @@ public class CrmQuoteInfoServiceImpl implements ICrmQuoteInfoService {
.selectAs("CustomerContact", CrmCustomerContact::getContactName, CrmQuoteInfo::getCustomerContactRealName)
.leftJoin(CrmCustomerContact.class, "CustomerContact", CrmCustomerContact::getContactId, CrmQuoteInfo::getCustomerContactId)
/*
// 供货方联系人CrmCustomerContact别名SupplierContact
.selectAs("SupplierContact", CrmCustomerContact::getContactName, CrmQuoteInfo::getSupplierContactRealName)
.leftJoin(CrmCustomerContact.class, "SupplierContact", CrmCustomerContact::getContactId, CrmQuoteInfo::getSupplierContactId)
*/
//供应商
.select(CrmSupplierInfo::getSupplierName)
.leftJoin(CrmSupplierInfo.class, CrmSupplierInfo::getSupplierId, CrmQuoteInfo::getSupplierContactId)
.eq(StringUtils.isNotBlank(bo.getQuoteCode()), CrmQuoteInfo::getQuoteCode, bo.getQuoteCode())
.like(StringUtils.isNotBlank(bo.getQuoteName()), CrmQuoteInfo::getQuoteName, bo.getQuoteName())
@ -284,11 +286,14 @@ public class CrmQuoteInfoServiceImpl implements ICrmQuoteInfoService {
MPJLambdaWrapper<CrmQuoteInfo> lqw = JoinWrappers.lambda(CrmQuoteInfo.class)
.selectAll(CrmQuoteInfo.class)
// 别名连接与派生字段选择
.leftJoin(CrmCustomerContact.class, "CustomerContact", CrmCustomerContact::getContactId, CrmQuoteInfo::getCustomerContactId)
.leftJoin(CrmCustomerContact.class, "SupplierContact", CrmCustomerContact::getContactId, CrmQuoteInfo::getSupplierContactId)
.leftJoin(CrmCustomerInfo.class, "Customer", CrmCustomerInfo::getCustomerId, CrmCustomerContact::getCustomerId)
.selectAs("CustomerContact", CrmCustomerContact::getContactName, CrmQuoteInfo::getCustomerContactRealName)
.selectAs("SupplierContact", CrmCustomerContact::getContactName, CrmQuoteInfo::getSupplierContactRealName)
.leftJoin(CrmCustomerContact.class, "CustomerContact", CrmCustomerContact::getContactId, CrmQuoteInfo::getCustomerContactId)
// .leftJoin(CrmCustomerContact.class, "SupplierContact", CrmCustomerContact::getContactId, CrmQuoteInfo::getSupplierContactId)
.leftJoin(CrmCustomerInfo.class, "Customer", CrmCustomerInfo::getCustomerId, CrmCustomerContact::getCustomerId)
//供应商信息
.select(CrmSupplierInfo::getSupplierName)
.leftJoin(CrmSupplierInfo.class, CrmSupplierInfo::getSupplierId, CrmQuoteInfo::getSupplierContactId)
// .selectAs("SupplierContact", CrmCustomerContact::getContactName, CrmQuoteInfo::getSupplierContactRealName)
.eq(CrmQuoteInfo::getQuoteName, base.getQuoteName())
// 使用客户方联系人别名的 customer_id 过滤同一客户
.eq(customerId != null, CrmCustomerContact::getCustomerId, customerId)

@ -40,6 +40,7 @@ import java.util.stream.Collectors;
public class CrmSupplierInfoServiceImpl implements ICrmSupplierInfoService {
private final CrmSupplierInfoMapper baseMapper;
@DubboReference(mock = "true")
private RemoteFileService remoteFileService;
@ -66,7 +67,7 @@ public class CrmSupplierInfoServiceImpl implements ICrmSupplierInfoService {
@Override
public TableDataInfo<CrmSupplierInfoVo> queryPageList(CrmSupplierInfoBo bo, PageQuery pageQuery) {
MPJLambdaWrapper<CrmSupplierInfo> lqw = buildQueryWrapper(bo);
Page<CrmSupplierInfoVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
Page<CrmSupplierInfoVo> result = baseMapper.selectCustomCrmSupplierInfoVoList(pageQuery.build(), lqw);
fillAttachmentInfo(result.getRecords());
return TableDataInfo.build(result);
}
@ -89,9 +90,6 @@ public class CrmSupplierInfoServiceImpl implements ICrmSupplierInfoService {
Map<String, Object> params = bo.getParams();
MPJLambdaWrapper<CrmSupplierInfo> lqw = JoinWrappers.lambda(CrmSupplierInfo.class)
.selectAll(CrmSupplierInfo.class)
// // 左连接 sys_user 表获取归属人员名称
// .selectAs(SysUser::getNickName, CrmSupplierInfo::getOwnerName)
// .leftJoin(SysUser.class, SysUser::getUserId, CrmSupplierInfo::getOwnerId)
.eq(CrmSupplierInfo::getDelFlag, "0")
.like(StringUtils.isNotBlank(bo.getSupplierName()), CrmSupplierInfo::getSupplierName, bo.getSupplierName())
.like(StringUtils.isNotBlank(bo.getMnemonicName()), CrmSupplierInfo::getMnemonicName, bo.getMnemonicName())

Loading…
Cancel
Save