|
@@ -35,7 +35,9 @@ import org.dromara.system.api.*;
|
|
|
import org.dromara.system.api.domain.bo.RemoteUserBo;
|
|
import org.dromara.system.api.domain.bo.RemoteUserBo;
|
|
|
import org.dromara.system.api.domain.dto.AddressAreaDTO;
|
|
import org.dromara.system.api.domain.dto.AddressAreaDTO;
|
|
|
import org.dromara.system.api.domain.vo.RemoteDeptVo;
|
|
import org.dromara.system.api.domain.vo.RemoteDeptVo;
|
|
|
|
|
+import org.dromara.system.api.domain.vo.RemoteComStaffVo;
|
|
|
import org.dromara.system.api.domain.vo.RemoteDictDataVo;
|
|
import org.dromara.system.api.domain.vo.RemoteDictDataVo;
|
|
|
|
|
+import org.dromara.system.api.domain.dto.AddressAreaDTO;
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
|
@@ -186,32 +188,17 @@ public class CustomerInfoServiceImpl extends ServiceImpl<CustomerInfoMapper, Cus
|
|
|
|
|
|
|
|
// 2. 查询关联信息 - 工商信息 (增加供应商表作为备选)
|
|
// 2. 查询关联信息 - 工商信息 (增加供应商表作为备选)
|
|
|
CustomerBusinessInfo businessInfo = customerBusinessInfoMapper.selectByCustomerId(id);
|
|
CustomerBusinessInfo businessInfo = customerBusinessInfoMapper.selectByCustomerId(id);
|
|
|
- if (businessInfo == null) {
|
|
|
|
|
- // 尝试从供应商工商信息表查询
|
|
|
|
|
- SupplierBusinessInfo supplierBiz = supplierBusinessInfoMapper.selectById(id);
|
|
|
|
|
- if (supplierBiz != null) {
|
|
|
|
|
- businessInfo = BeanUtil.toBean(supplierBiz, CustomerBusinessInfo.class);
|
|
|
|
|
- businessInfo.setCustomerId(id);
|
|
|
|
|
- // 字段名映射差异处理
|
|
|
|
|
- businessInfo.setBusinessCustomerName(supplierBiz.getBusinessName());
|
|
|
|
|
- businessInfo.setSocialCreditCode(supplierBiz.getSocialCreditCode());
|
|
|
|
|
- businessInfo.setLegalPersonName(supplierBiz.getLegalPersonName());
|
|
|
|
|
- businessInfo.setRegisteredCapital(supplierBiz.getRegisteredCapital());
|
|
|
|
|
- businessInfo.setEstablishmentDate(supplierBiz.getEstablishmentDate());
|
|
|
|
|
- businessInfo.setRevocationDate(supplierBiz.getRevocationDate());
|
|
|
|
|
- businessInfo.setRegistrationStatus(supplierBiz.getRegistrationStatus());
|
|
|
|
|
- businessInfo.setBusinessAddress(supplierBiz.getBusinessAddress());
|
|
|
|
|
- businessInfo.setBusinessLicense(supplierBiz.getBusinessLicense());
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
if (businessInfo != null) {
|
|
if (businessInfo != null) {
|
|
|
vo.setCustomerBusinessInfoVo(MapstructUtils.convert(businessInfo, CustomerBusinessInfoVo.class));
|
|
vo.setCustomerBusinessInfoVo(MapstructUtils.convert(businessInfo, CustomerBusinessInfoVo.class));
|
|
|
// 补充主表缺失字段
|
|
// 补充主表缺失字段
|
|
|
- if (StringUtils.isBlank(vo.getSocialCreditCode()))
|
|
|
|
|
|
|
+ if (StringUtils.isBlank(vo.getSocialCreditCode())){
|
|
|
vo.setSocialCreditCode(businessInfo.getSocialCreditCode());
|
|
vo.setSocialCreditCode(businessInfo.getSocialCreditCode());
|
|
|
- if (StringUtils.isBlank(vo.getBusinessCustomerName()))
|
|
|
|
|
|
|
+ }
|
|
|
|
|
+ if (StringUtils.isBlank(vo.getBusinessCustomerName())){
|
|
|
vo.setBusinessCustomerName(businessInfo.getBusinessCustomerName());
|
|
vo.setBusinessCustomerName(businessInfo.getBusinessCustomerName());
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ vo.setCustomerBusinessInfoVo(BeanUtil.toBean(businessInfo, CustomerBusinessInfoVo.class));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 销售信息
|
|
// 销售信息
|
|
@@ -981,10 +968,9 @@ public class CustomerInfoServiceImpl extends ServiceImpl<CustomerInfoMapper, Cus
|
|
|
Long customerId = bo.getId();
|
|
Long customerId = bo.getId();
|
|
|
|
|
|
|
|
// 2. 删除旧的关联数据
|
|
// 2. 删除旧的关联数据
|
|
|
- customerBusinessInfoMapper.deleteByCustomerId(customerId);
|
|
|
|
|
- customerSalesInfoMapper.deleteByCustomerId(customerId);
|
|
|
|
|
|
|
+
|
|
|
// customerContactMapper.deleteByCustomerId(customerId);
|
|
// customerContactMapper.deleteByCustomerId(customerId);
|
|
|
- customerInvoiceInfoMapper.deleteByCustomerId(customerId);
|
|
|
|
|
|
|
+
|
|
|
|
|
|
|
|
// 3. 插入新的关联数据
|
|
// 3. 插入新的关联数据
|
|
|
saveAssociatedData(customerId, bo);
|
|
saveAssociatedData(customerId, bo);
|
|
@@ -1029,6 +1015,7 @@ public class CustomerInfoServiceImpl extends ServiceImpl<CustomerInfoMapper, Cus
|
|
|
private void saveAssociatedData(Long customerId, CustomerInfoBo bo) {
|
|
private void saveAssociatedData(Long customerId, CustomerInfoBo bo) {
|
|
|
// 业务信息
|
|
// 业务信息
|
|
|
if (bo.getCustomerBusinessBo() != null) {
|
|
if (bo.getCustomerBusinessBo() != null) {
|
|
|
|
|
+ customerBusinessInfoMapper.deleteByCustomerId(customerId);
|
|
|
CustomerBusinessInfo business = MapstructUtils.convert(bo.getCustomerBusinessBo(), CustomerBusinessInfo.class);
|
|
CustomerBusinessInfo business = MapstructUtils.convert(bo.getCustomerBusinessBo(), CustomerBusinessInfo.class);
|
|
|
business.setCustomerId(customerId);
|
|
business.setCustomerId(customerId);
|
|
|
customerBusinessInfoMapper.insert(business);
|
|
customerBusinessInfoMapper.insert(business);
|
|
@@ -1036,6 +1023,7 @@ public class CustomerInfoServiceImpl extends ServiceImpl<CustomerInfoMapper, Cus
|
|
|
|
|
|
|
|
// 销售信息
|
|
// 销售信息
|
|
|
if (bo.getCustomerSalesInfoBo() != null) {
|
|
if (bo.getCustomerSalesInfoBo() != null) {
|
|
|
|
|
+ customerSalesInfoMapper.deleteByCustomerId(customerId);
|
|
|
CustomerSalesInfo sales = MapstructUtils.convert(bo.getCustomerSalesInfoBo(), CustomerSalesInfo.class);
|
|
CustomerSalesInfo sales = MapstructUtils.convert(bo.getCustomerSalesInfoBo(), CustomerSalesInfo.class);
|
|
|
sales.setCustomerId(customerId);
|
|
sales.setCustomerId(customerId);
|
|
|
customerSalesInfoMapper.insert(sales);
|
|
customerSalesInfoMapper.insert(sales);
|
|
@@ -1052,6 +1040,7 @@ public class CustomerInfoServiceImpl extends ServiceImpl<CustomerInfoMapper, Cus
|
|
|
|
|
|
|
|
// 发票信息列表
|
|
// 发票信息列表
|
|
|
if (bo.getCustomerInvoiceInfoBoList() != null && !bo.getCustomerInvoiceInfoBoList().isEmpty()) {
|
|
if (bo.getCustomerInvoiceInfoBoList() != null && !bo.getCustomerInvoiceInfoBoList().isEmpty()) {
|
|
|
|
|
+ customerInvoiceInfoMapper.deleteByCustomerId(customerId);
|
|
|
for (CustomerInvoiceInfoBo invoiceBo : bo.getCustomerInvoiceInfoBoList()) {
|
|
for (CustomerInvoiceInfoBo invoiceBo : bo.getCustomerInvoiceInfoBoList()) {
|
|
|
CustomerInvoiceInfo invoice = MapstructUtils.convert(invoiceBo, CustomerInvoiceInfo.class);
|
|
CustomerInvoiceInfo invoice = MapstructUtils.convert(invoiceBo, CustomerInvoiceInfo.class);
|
|
|
invoice.setCustomerId(customerId);
|
|
invoice.setCustomerId(customerId);
|