|
@@ -3,6 +3,7 @@ package org.dromara.customer.service.impl;
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
import cn.hutool.core.collection.CollUtil;
|
|
|
import cn.hutool.crypto.digest.BCrypt;
|
|
import cn.hutool.crypto.digest.BCrypt;
|
|
|
|
|
+import cn.hutool.json.JSONUtil;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
@@ -14,6 +15,7 @@ import org.apache.dubbo.config.annotation.DubboReference;
|
|
|
import org.dromara.common.core.constant.GlobalConstants;
|
|
import org.dromara.common.core.constant.GlobalConstants;
|
|
|
import org.dromara.common.core.context.PlatformContext;
|
|
import org.dromara.common.core.context.PlatformContext;
|
|
|
import org.dromara.common.core.domain.R;
|
|
import org.dromara.common.core.domain.R;
|
|
|
|
|
+import org.dromara.common.core.enums.FormatsType;
|
|
|
import org.dromara.common.core.enums.IsDefault;
|
|
import org.dromara.common.core.enums.IsDefault;
|
|
|
import org.dromara.common.core.exception.ServiceException;
|
|
import org.dromara.common.core.exception.ServiceException;
|
|
|
import org.dromara.common.core.utils.DateUtils;
|
|
import org.dromara.common.core.utils.DateUtils;
|
|
@@ -25,6 +27,10 @@ import org.dromara.common.mybatis.core.page.TableDataInfo;
|
|
|
import org.dromara.common.redis.utils.RedisUtils;
|
|
import org.dromara.common.redis.utils.RedisUtils;
|
|
|
import org.dromara.common.redis.utils.SequenceUtils;
|
|
import org.dromara.common.redis.utils.SequenceUtils;
|
|
|
import org.dromara.common.satoken.utils.LoginHelper;
|
|
import org.dromara.common.satoken.utils.LoginHelper;
|
|
|
|
|
+import org.dromara.customer.api.erp.domain.push.BusConn;
|
|
|
|
|
+import org.dromara.customer.api.erp.domain.push.CustInfo;
|
|
|
|
|
+import org.dromara.customer.api.erp.domain.push.DlvAddr;
|
|
|
|
|
+import org.dromara.customer.api.erp.domain.push.GathBn;
|
|
|
import org.dromara.customer.domain.*;
|
|
import org.dromara.customer.domain.*;
|
|
|
import org.dromara.customer.domain.bo.*;
|
|
import org.dromara.customer.domain.bo.*;
|
|
|
import org.dromara.customer.domain.vo.*;
|
|
import org.dromara.customer.domain.vo.*;
|
|
@@ -746,7 +752,37 @@ public class CustomerInfoServiceImpl extends ServiceImpl<CustomerInfoMapper, Cus
|
|
|
Map<String, Object> params = bo.getParams();
|
|
Map<String, Object> params = bo.getParams();
|
|
|
LambdaQueryWrapper<CustomerInfo> lqw = Wrappers.lambdaQuery();
|
|
LambdaQueryWrapper<CustomerInfo> lqw = Wrappers.lambdaQuery();
|
|
|
lqw.orderByDesc(CustomerInfo::getId);
|
|
lqw.orderByDesc(CustomerInfo::getId);
|
|
|
-
|
|
|
|
|
|
|
+ // 数据权限过滤:只能查看自己创建的、或者是业务负责人、或者是客服支持的客户
|
|
|
|
|
+ // 超级管理员或租户管理员可查看全部数据
|
|
|
|
|
+ if (!LoginHelper.isSuperAdmin() && !LoginHelper.isTenantAdmin()
|
|
|
|
|
+ && (bo.getCreateBy() != null || bo.getSalesPersonId() != null || bo.getServiceStaffId() != null)) {
|
|
|
|
|
+ lqw.and(wrapper -> {
|
|
|
|
|
+ boolean first = true;
|
|
|
|
|
+ if (bo.getCreateBy() != null) {
|
|
|
|
|
+ if (first) {
|
|
|
|
|
+ wrapper.eq(CustomerInfo::getCreateBy, bo.getCreateBy());
|
|
|
|
|
+ first = false;
|
|
|
|
|
+ } else {
|
|
|
|
|
+ wrapper.or().eq(CustomerInfo::getCreateBy, bo.getCreateBy());
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ if (bo.getSalesPersonId() != null) {
|
|
|
|
|
+ if (first) {
|
|
|
|
|
+ wrapper.eq(CustomerInfo::getSalesPersonId, bo.getSalesPersonId());
|
|
|
|
|
+ first = false;
|
|
|
|
|
+ } else {
|
|
|
|
|
+ wrapper.or().eq(CustomerInfo::getSalesPersonId, bo.getSalesPersonId());
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ if (bo.getServiceStaffId() != null) {
|
|
|
|
|
+ if (first) {
|
|
|
|
|
+ wrapper.eq(CustomerInfo::getServiceStaffId, bo.getServiceStaffId());
|
|
|
|
|
+ } else {
|
|
|
|
|
+ wrapper.or().eq(CustomerInfo::getServiceStaffId, bo.getServiceStaffId());
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
lqw.eq(StringUtils.isNotBlank(bo.getCustomerNo()), CustomerInfo::getCustomerNo, bo.getCustomerNo());
|
|
lqw.eq(StringUtils.isNotBlank(bo.getCustomerNo()), CustomerInfo::getCustomerNo, bo.getCustomerNo());
|
|
|
lqw.eq(bo.getBelongCompanyId() != null, CustomerInfo::getBelongCompanyId, bo.getBelongCompanyId());
|
|
lqw.eq(bo.getBelongCompanyId() != null, CustomerInfo::getBelongCompanyId, bo.getBelongCompanyId());
|
|
|
lqw.like(StringUtils.isNotBlank(bo.getCompanyName()), CustomerInfo::getCompanyName, bo.getCompanyName());
|
|
lqw.like(StringUtils.isNotBlank(bo.getCompanyName()), CustomerInfo::getCompanyName, bo.getCompanyName());
|
|
@@ -1023,18 +1059,35 @@ public class CustomerInfoServiceImpl extends ServiceImpl<CustomerInfoMapper, Cus
|
|
|
TeamMemberVo existingUser = teamMemberMapper.selectByObjectNoAndUserNoWithDeleted(objectNo, userNo);
|
|
TeamMemberVo existingUser = teamMemberMapper.selectByObjectNoAndUserNoWithDeleted(objectNo, userNo);
|
|
|
|
|
|
|
|
if (existingUser != null) {
|
|
if (existingUser != null) {
|
|
|
- // 4. 如果人员已存在,恢复并更新其角色信息
|
|
|
|
|
- teamMemberMapper.restoreMemberById(
|
|
|
|
|
- existingUser.getId(),
|
|
|
|
|
- userNo,
|
|
|
|
|
- realName,
|
|
|
|
|
- roleCode,
|
|
|
|
|
- updateAccredit,
|
|
|
|
|
- izManager,
|
|
|
|
|
- LoginHelper.getUserId(),
|
|
|
|
|
- LoginHelper.getDeptId(),
|
|
|
|
|
- PlatformContext.getPlatform()
|
|
|
|
|
- );
|
|
|
|
|
|
|
+ // 如果角色相同,恢复并更新
|
|
|
|
|
+ if (Objects.equals(existingUser.getRoleCode(), roleCode)) {
|
|
|
|
|
+ teamMemberMapper.restoreMemberById(
|
|
|
|
|
+ existingUser.getId(),
|
|
|
|
|
+ userNo,
|
|
|
|
|
+ realName,
|
|
|
|
|
+ roleCode,
|
|
|
|
|
+ updateAccredit,
|
|
|
|
|
+ izManager,
|
|
|
|
|
+ LoginHelper.getUserId(),
|
|
|
|
|
+ LoginHelper.getDeptId(),
|
|
|
|
|
+ PlatformContext.getPlatform()
|
|
|
|
|
+ );
|
|
|
|
|
+ } else {
|
|
|
|
|
+ // 角色不同(如同一个人既是负责人又是客服),新增一条记录
|
|
|
|
|
+ TeamMember member = new TeamMember();
|
|
|
|
|
+ member.setDataType(12);
|
|
|
|
|
+ member.setObjectNo(objectNo);
|
|
|
|
|
+ member.setUserNo(userNo);
|
|
|
|
|
+ member.setRealName(realName);
|
|
|
|
|
+ member.setRoleCode(roleCode);
|
|
|
|
|
+ member.setIzManager(izManager);
|
|
|
|
|
+ member.setUpdateAccredit(updateAccredit);
|
|
|
|
|
+ member.setPlatformCode(PlatformContext.getPlatform());
|
|
|
|
|
+ member.setCreateUserId(LoginHelper.getUserId());
|
|
|
|
|
+ member.setCreateOrgId(LoginHelper.getDeptId());
|
|
|
|
|
+ member.setIsDelete(0);
|
|
|
|
|
+ teamMemberMapper.insert(member);
|
|
|
|
|
+ }
|
|
|
} else {
|
|
} else {
|
|
|
// 5. 如果人员不存在,执行新增
|
|
// 5. 如果人员不存在,执行新增
|
|
|
TeamMember member = new TeamMember();
|
|
TeamMember member = new TeamMember();
|
|
@@ -1083,7 +1136,7 @@ public class CustomerInfoServiceImpl extends ServiceImpl<CustomerInfoMapper, Cus
|
|
|
|
|
|
|
|
// 3. 插入新的关联数据
|
|
// 3. 插入新的关联数据
|
|
|
saveAssociatedData(customerId, bo);
|
|
saveAssociatedData(customerId, bo);
|
|
|
-
|
|
|
|
|
|
|
+ customerInfoJson(customerId);
|
|
|
return true;
|
|
return true;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -1185,10 +1238,15 @@ public class CustomerInfoServiceImpl extends ServiceImpl<CustomerInfoMapper, Cus
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- return baseMapper.update(null,
|
|
|
|
|
|
|
+
|
|
|
|
|
+ Integer num = baseMapper.update(null,
|
|
|
new LambdaUpdateWrapper<CustomerInfo>()
|
|
new LambdaUpdateWrapper<CustomerInfo>()
|
|
|
.set(CustomerInfo::getStatus, status)
|
|
.set(CustomerInfo::getStatus, status)
|
|
|
.eq(CustomerInfo::getId, customerId));
|
|
.eq(CustomerInfo::getId, customerId));
|
|
|
|
|
+ if (num > 0) {
|
|
|
|
|
+ customerInfoJson(customerId);
|
|
|
|
|
+ }
|
|
|
|
|
+ return num;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@@ -1743,6 +1801,26 @@ public class CustomerInfoServiceImpl extends ServiceImpl<CustomerInfoMapper, Cus
|
|
|
customerBusinessInfo.setBusinessCustomerName(bo.getBusinessCustomerName());
|
|
customerBusinessInfo.setBusinessCustomerName(bo.getBusinessCustomerName());
|
|
|
customerBusinessInfo.setSocialCreditCode(bo.getSocialCreditCode());
|
|
customerBusinessInfo.setSocialCreditCode(bo.getSocialCreditCode());
|
|
|
customerBusinessInfoMapper.insert(customerBusinessInfo);
|
|
customerBusinessInfoMapper.insert(customerBusinessInfo);
|
|
|
|
|
+ // 将业务员和客服加入团队成员
|
|
|
|
|
+ Set<Long> staffIds = new HashSet<>();
|
|
|
|
|
+ if (ObjectUtils.isNotEmpty(bo.getSalesPersonId())) {
|
|
|
|
|
+ staffIds.add(bo.getSalesPersonId());
|
|
|
|
|
+ }
|
|
|
|
|
+ if (ObjectUtils.isNotEmpty(bo.getServiceStaffId())) {
|
|
|
|
|
+ staffIds.add(bo.getServiceStaffId());
|
|
|
|
|
+ }
|
|
|
|
|
+ Map<Long, String> staffNameMap = Collections.emptyMap();
|
|
|
|
|
+ if (!staffIds.isEmpty()) {
|
|
|
|
|
+ staffNameMap = remoteComStaffService.selectStaffNameByIds(staffIds);
|
|
|
|
|
+ }
|
|
|
|
|
+ if (ObjectUtils.isNotEmpty(bo.getSalesPersonId())) {
|
|
|
|
|
+ saveOrUpdateTeamMember(add.getCustomerNo(), bo.getSalesPersonId(),
|
|
|
|
|
+ staffNameMap.get(bo.getSalesPersonId()), "1", 1, 1);
|
|
|
|
|
+ }
|
|
|
|
|
+ if (ObjectUtils.isNotEmpty(bo.getServiceStaffId())) {
|
|
|
|
|
+ saveOrUpdateTeamMember(add.getCustomerNo(), bo.getServiceStaffId(),
|
|
|
|
|
+ staffNameMap.get(bo.getServiceStaffId()), "3", 0, 1);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
return flag;
|
|
return flag;
|
|
|
}
|
|
}
|
|
@@ -1775,6 +1853,26 @@ public class CustomerInfoServiceImpl extends ServiceImpl<CustomerInfoMapper, Cus
|
|
|
customerBusinessInfo.setSocialCreditCode(bo.getSocialCreditCode());
|
|
customerBusinessInfo.setSocialCreditCode(bo.getSocialCreditCode());
|
|
|
customerBusinessInfoMapper.updateById(customerBusinessInfo);
|
|
customerBusinessInfoMapper.updateById(customerBusinessInfo);
|
|
|
}
|
|
}
|
|
|
|
|
+ // 将业务员和客服加入团队成员
|
|
|
|
|
+ Set<Long> staffIds = new HashSet<>();
|
|
|
|
|
+ if (ObjectUtils.isNotEmpty(bo.getSalesPersonId())) {
|
|
|
|
|
+ staffIds.add(bo.getSalesPersonId());
|
|
|
|
|
+ }
|
|
|
|
|
+ if (ObjectUtils.isNotEmpty(bo.getServiceStaffId())) {
|
|
|
|
|
+ staffIds.add(bo.getServiceStaffId());
|
|
|
|
|
+ }
|
|
|
|
|
+ Map<Long, String> staffNameMap = Collections.emptyMap();
|
|
|
|
|
+ if (!staffIds.isEmpty()) {
|
|
|
|
|
+ staffNameMap = remoteComStaffService.selectStaffNameByIds(staffIds);
|
|
|
|
|
+ }
|
|
|
|
|
+ if (ObjectUtils.isNotEmpty(bo.getSalesPersonId())) {
|
|
|
|
|
+ saveOrUpdateTeamMember(update.getCustomerNo(), bo.getSalesPersonId(),
|
|
|
|
|
+ staffNameMap.get(bo.getSalesPersonId()), "1", 1, 1);
|
|
|
|
|
+ }
|
|
|
|
|
+ if (ObjectUtils.isNotEmpty(bo.getServiceStaffId())) {
|
|
|
|
|
+ saveOrUpdateTeamMember(update.getCustomerNo(), bo.getServiceStaffId(),
|
|
|
|
|
+ staffNameMap.get(bo.getServiceStaffId()), "3", 0, 1);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
return flag;
|
|
return flag;
|
|
@@ -1819,17 +1917,35 @@ public class CustomerInfoServiceImpl extends ServiceImpl<CustomerInfoMapper, Cus
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
if (existing != null) {
|
|
if (existing != null) {
|
|
|
- teamMemberMapper.restoreMemberById(
|
|
|
|
|
- existing.getId(),
|
|
|
|
|
- userNo,
|
|
|
|
|
- realName,
|
|
|
|
|
- roleCode,
|
|
|
|
|
- updateAccredit,
|
|
|
|
|
- izManager,
|
|
|
|
|
- LoginHelper.getUserId(),
|
|
|
|
|
- LoginHelper.getDeptId(),
|
|
|
|
|
- PlatformContext.getPlatform()
|
|
|
|
|
- );
|
|
|
|
|
|
|
+ // 如果角色相同,恢复并更新
|
|
|
|
|
+ if (Objects.equals(existing.getRoleCode(), roleCode)) {
|
|
|
|
|
+ teamMemberMapper.restoreMemberById(
|
|
|
|
|
+ existing.getId(),
|
|
|
|
|
+ userNo,
|
|
|
|
|
+ realName,
|
|
|
|
|
+ roleCode,
|
|
|
|
|
+ updateAccredit,
|
|
|
|
|
+ izManager,
|
|
|
|
|
+ LoginHelper.getUserId(),
|
|
|
|
|
+ LoginHelper.getDeptId(),
|
|
|
|
|
+ PlatformContext.getPlatform()
|
|
|
|
|
+ );
|
|
|
|
|
+ } else {
|
|
|
|
|
+ // 角色不同(如同一个人既是负责人又是客服),新增一条记录
|
|
|
|
|
+ TeamMember member = new TeamMember();
|
|
|
|
|
+ member.setDataType(12);
|
|
|
|
|
+ member.setObjectNo(objectNo);
|
|
|
|
|
+ member.setUserNo(userNo);
|
|
|
|
|
+ member.setRealName(realName);
|
|
|
|
|
+ member.setRoleCode(roleCode);
|
|
|
|
|
+ member.setIzManager(izManager);
|
|
|
|
|
+ member.setUpdateAccredit(updateAccredit);
|
|
|
|
|
+ member.setPlatformCode(PlatformContext.getPlatform());
|
|
|
|
|
+ member.setCreateUserId(LoginHelper.getUserId());
|
|
|
|
|
+ member.setCreateOrgId(LoginHelper.getDeptId());
|
|
|
|
|
+ member.setIsDelete(0);
|
|
|
|
|
+ teamMemberMapper.insert(member);
|
|
|
|
|
+ }
|
|
|
} else {
|
|
} else {
|
|
|
TeamMember member = new TeamMember();
|
|
TeamMember member = new TeamMember();
|
|
|
member.setDataType(12);
|
|
member.setDataType(12);
|
|
@@ -2281,4 +2397,128 @@ public class CustomerInfoServiceImpl extends ServiceImpl<CustomerInfoMapper, Cus
|
|
|
|
|
|
|
|
return exportList;
|
|
return exportList;
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public String customerInfoJson(Long customerId) {
|
|
|
|
|
+ // 1. 查询客户主信息
|
|
|
|
|
+ CustomerInfoVo customerInfoVo = baseMapper.selectVoById(customerId);
|
|
|
|
|
+ if (customerInfoVo == null) {
|
|
|
|
|
+ return "{}";
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 2. 查询关联数据
|
|
|
|
|
+ CustomerSalesInfo salesInfo = customerSalesInfoMapper.selectByCustomerId(customerInfoVo.getId());
|
|
|
|
|
+ CustomerBusinessInfo businessInfo = customerBusinessInfoMapper.selectByCustomerId(customerInfoVo.getId());
|
|
|
|
|
+ List<CustomerContact> customerContacts = customerContactMapper.selectListByCustomerId(customerInfoVo.getId());
|
|
|
|
|
+ List<CustomerShippingAddressVo> shippingAddressVos = shippingAddressMapper.selectVoList(
|
|
|
|
|
+ new LambdaQueryWrapper<CustomerShippingAddress>()
|
|
|
|
|
+ .eq(CustomerShippingAddress::getCustomerId, customerInfoVo.getId()));
|
|
|
|
|
+ List<CustomerInvoiceInfo> invoiceInfos = customerInvoiceInfoMapper.selectListByCustomerId(customerInfoVo.getId());
|
|
|
|
|
+
|
|
|
|
|
+ // 3. 映射 CustInfo
|
|
|
|
|
+ CustInfo custInfo = new CustInfo();
|
|
|
|
|
+ custInfo.setCustId(customerInfoVo.getCustomerNo());
|
|
|
|
|
+ custInfo.setCustNm(customerInfoVo.getCustomerName());
|
|
|
|
|
+ custInfo.setPerId(remoteComStaffService.selectStaffCodeById((customerInfoVo.getSalesPersonId())));
|
|
|
|
|
+ custInfo.setSalAsstId(remoteComStaffService.selectStaffCodeById((customerInfoVo.getServiceStaffId())));
|
|
|
|
|
+ custInfo.setAddr(customerInfoVo.getAddress());
|
|
|
|
|
+ if (businessInfo != null) {
|
|
|
|
|
+ try {
|
|
|
|
|
+ custInfo.setCapAmt(new BigDecimal(businessInfo.getRegisteredCapital()));
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ log.warn("解析注册资本失败: {}", businessInfo.getRegisteredCapital());
|
|
|
|
|
+ }
|
|
|
|
|
+ custInfo.setPrincipal(businessInfo.getLegalPersonName());
|
|
|
|
|
+ }
|
|
|
|
|
+ if (salesInfo != null) {
|
|
|
|
|
+ custInfo.setChkHalfDa(salesInfo.getBillingDay());
|
|
|
|
|
+ custInfo.setChkoutDa(salesInfo.getBillDate());
|
|
|
|
|
+ custInfo.setChkWeekDa(salesInfo.getAccountPeriod());
|
|
|
|
|
+ custInfo.setCreCls(remoteCreditLevelService.selectCreditLevelCodeById(salesInfo.getCreditLevelId()));
|
|
|
|
|
+ custInfo.setCurId(remoteComCurrencyService.selectCurrencyCodeById(salesInfo.getDealCurrencyId()));
|
|
|
|
|
+ custInfo.setCustSrcId(salesInfo.getCustomerSource());
|
|
|
|
|
+ custInfo.setGathCnd(salesInfo.getSettlementMethod() != null ? salesInfo.getSettlementMethod().intValue() : null);
|
|
|
|
|
+ custInfo.setGathDays(salesInfo.getPayDays());
|
|
|
|
|
+ }
|
|
|
|
|
+ custInfo.setCityId(customerInfoVo.getRegCityNo());
|
|
|
|
|
+ custInfo.setCropSclId(customerInfoVo.getEnterpriseScaleId() != null ? enterpriseScaleMapper.selectVoById(customerInfoVo.getEnterpriseScaleId()).getEnterpriseScaleCode() : null);
|
|
|
|
|
+ custInfo.setCU_comCo(customerInfoVo.getCompanyName());
|
|
|
|
|
+ custInfo.setCU_SalesInvoice(customerInfoVo.getSellInvoiceTypeNo());
|
|
|
|
|
+ custInfo.setCustTyId(remoteComCustomerTypeService.selectCustomerTypeNoNameById(customerInfoVo.getCustomerTypeId()));
|
|
|
|
|
+ custInfo.setEmail(customerInfoVo.getEmail());
|
|
|
|
|
+ custInfo.setFaxNo(customerInfoVo.getFax());
|
|
|
|
|
+ custInfo.setInvoAddr(customerInfoVo.getAddress());
|
|
|
|
|
+ custInfo.setInvoTt(customerInfoVo.getCustomerName());
|
|
|
|
|
+ custInfo.setLkUrl(customerInfoVo.getUrl());
|
|
|
|
|
+ custInfo.setOfiTel(customerInfoVo.getLandline());
|
|
|
|
|
+ custInfo.setPrvnId(customerInfoVo.getRegProvincialNo());
|
|
|
|
|
+ custInfo.setRemark(customerInfoVo.getRemark());
|
|
|
|
|
+ custInfo.setSrtNm(customerInfoVo.getShortName());
|
|
|
|
|
+ custInfo.setTaxChkNo(customerInfoVo.getSocialCreditCode());
|
|
|
|
|
+ custInfo.setGadId(remoteComCustomerLevelService.selectCustomerLevelNoById(customerInfoVo.getCustomerLevelId()));
|
|
|
|
|
+ custInfo.setTradTy(customerInfoVo.getIndustryCategoryId() != null ? industryCategoryMapper.selectVoById(customerInfoVo.getIndustryCategoryId()).getIndustryCode() : null);
|
|
|
|
|
+ if (customerInfoVo.getValidityFromDate() != null) {
|
|
|
|
|
+ custInfo.setValidityFromDate(Integer.parseInt(DateUtils.parseDateToStr(FormatsType.YYYYMMDD, customerInfoVo.getValidityFromDate())));
|
|
|
|
|
+ }
|
|
|
|
|
+ if (customerInfoVo.getValidityToDate() != null) {
|
|
|
|
|
+ custInfo.setValidityToDate(Integer.parseInt(DateUtils.parseDateToStr(FormatsType.YYYYMMDD, customerInfoVo.getValidityToDate())));
|
|
|
|
|
+ }
|
|
|
|
|
+ custInfo.setCountryId(customerInfoVo.getRegCountyNo());
|
|
|
|
|
+ custInfo.setQQMSN(customerInfoVo.getEmail());
|
|
|
|
|
+
|
|
|
|
|
+ // 4. 映射 DlvAddr 列表
|
|
|
|
|
+ List<DlvAddr> dlvAddrList = new ArrayList<>();
|
|
|
|
|
+ if (CollUtil.isNotEmpty(shippingAddressVos)) {
|
|
|
|
|
+ for (CustomerShippingAddressVo vo : shippingAddressVos) {
|
|
|
|
|
+ DlvAddr dlvAddr = new DlvAddr();
|
|
|
|
|
+ dlvAddr.setAddr(vo.getAddress());
|
|
|
|
|
+ dlvAddr.setAddrNo(vo.getShippingAddressNo());
|
|
|
|
|
+ dlvAddr.setCustId(customerInfoVo.getCustomerNo());
|
|
|
|
|
+ dlvAddr.setConnPer(vo.getConsignee());
|
|
|
|
|
+ dlvAddr.setConnPos(vo.getDeptName());
|
|
|
|
|
+ dlvAddr.setConnTel(vo.getPhone());
|
|
|
|
|
+ dlvAddr.setIsMainAddr("0".equals(vo.getDefaultAddress()));
|
|
|
|
|
+ dlvAddr.setPtC(vo.getPostal());
|
|
|
|
|
+ dlvAddrList.add(dlvAddr);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 5. 映射 GathBn 列表
|
|
|
|
|
+ List<GathBn> gathBnList = new ArrayList<>();
|
|
|
|
|
+ if (CollUtil.isNotEmpty(invoiceInfos)) {
|
|
|
|
|
+ int rowNo = 1;
|
|
|
|
|
+ for (CustomerInvoiceInfo info : invoiceInfos) {
|
|
|
|
|
+ GathBn gathBn = new GathBn();
|
|
|
|
|
+ gathBn.setBnAccNo(info.getBankAccount());
|
|
|
|
|
+ gathBn.setCustId(customerInfoVo.getCustomerNo());
|
|
|
|
|
+ gathBn.setAccBn(info.getBankName());
|
|
|
|
|
+ gathBn.setAccNm(customerInfoVo.getCustomerName());
|
|
|
|
|
+ gathBn.setMainAcc("0".equals(info.getIsPrimaryAccount()));
|
|
|
|
|
+ gathBn.setRowNo(rowNo++);
|
|
|
|
|
+ gathBn.setTelNo(info.getPhone());
|
|
|
|
|
+ gathBnList.add(gathBn);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 6. 映射 BusConn 列表
|
|
|
|
|
+ List<BusConn> busConnList = new ArrayList<>();
|
|
|
|
|
+ if (CollUtil.isNotEmpty(customerContacts)) {
|
|
|
|
|
+ for (CustomerContact contact : customerContacts) {
|
|
|
|
|
+ BusConn busConn = new BusConn();
|
|
|
|
|
+ busConn.setCustId(customerInfoVo.getCustomerNo());
|
|
|
|
|
+ busConn.setFrLkmId(contact.getId() != null ? String.valueOf(contact.getId()) : null);
|
|
|
|
|
+ busConn.setIsMainPer("0".equals(contact.getIsPrimary()));
|
|
|
|
|
+ busConn.setRowCd(contact.getId() != null ? contact.getId().intValue() : null);
|
|
|
|
|
+ busConnList.add(busConn);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 7. 组装返回JSON
|
|
|
|
|
+ Map<String, Object> result = new LinkedHashMap<>();
|
|
|
|
|
+ result.put("CustInfo", custInfo);
|
|
|
|
|
+ result.put("DlvAddr", dlvAddrList);
|
|
|
|
|
+ result.put("GathBn", gathBnList);
|
|
|
|
|
+ result.put("BusConn", busConnList);
|
|
|
|
|
+ return JSONUtil.toJsonStr(result);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|