|
|
@ -127,6 +127,7 @@ public class CrmCustomerTempService extends MybatisBaseService<CrmCustomerTempMa |
|
|
|
private CrmCustomerOrgLinkService crmCustomerOrgLinkService; |
|
|
|
@Autowired |
|
|
|
private CrmCustomerOrgService crmCustomerOrgService; |
|
|
|
|
|
|
|
public PagerVo<CrmCustomerTemp> listPage(PagerQuery<CrmCustomerTempQuery> pq) { |
|
|
|
CrmCustomerTempQuery query = pq.getParams(); |
|
|
|
QueryWrapper<CrmCustomerTemp> qw = createQueryWrapper(query); |
|
|
@ -372,6 +373,53 @@ public class CrmCustomerTempService extends MybatisBaseService<CrmCustomerTempMa |
|
|
|
return rb.success().setData(sid); |
|
|
|
} |
|
|
|
|
|
|
|
public ResultBean saveOrUpdateAppCustomerTempWx(AppCrmCustomerTempDto dto) { |
|
|
|
ResultBean rb = ResultBean.fireFail(); |
|
|
|
/** |
|
|
|
* 2023-02-10: |
|
|
|
* 先查询客户编码是否存在: |
|
|
|
* 1、存在 |
|
|
|
* 1.1、是否是当前用户的客户: |
|
|
|
* 1.1.1、是,提示客户已存在,不能新增 |
|
|
|
* 1.1.2、否,提示:为xxx销售专员客户 |
|
|
|
* 2、不存在 |
|
|
|
* 2.1、新增客户信息(新增跟进记录),保存时添加二次提醒:保存后客户名称、手机号码将不能修改 |
|
|
|
*/ |
|
|
|
//根据用户sid获取业务员信息
|
|
|
|
SysUser sysUser = sysUserFeign.fetchBySidWx(dto.getUserSid()).getData(); |
|
|
|
if (sysUser == null) { |
|
|
|
return rb.setMsg("该用户不存在"); |
|
|
|
} |
|
|
|
CrmCustomerTempVo crmCustomerTempVo = baseMapper.selByMobile(sysUser.getMobile()); |
|
|
|
CrmCustomerTemp customerTemp = fetchBySid(crmCustomerTempVo.getSid()); |
|
|
|
if (customerTemp == null) { |
|
|
|
return rb.setMsg("该客户不存在"); |
|
|
|
} |
|
|
|
//对比客户名称以及手机号是否变化
|
|
|
|
if (!customerTemp.getName().equals(dto.getName())) { |
|
|
|
return rb.setMsg("客户名称不允许修改"); |
|
|
|
} |
|
|
|
if (!customerTemp.getMobile().equals(dto.getMobile())) { |
|
|
|
return rb.setMsg("客户手机号不允许修改"); |
|
|
|
} |
|
|
|
BeanUtil.copyProperties(dto, customerTemp, "sid"); |
|
|
|
String adCode = dto.getAdCode(); |
|
|
|
if (StringUtils.isNotBlank(adCode)) { |
|
|
|
customerTemp.setAddress_province(adCode.substring(0, 2)); |
|
|
|
customerTemp.setAddress_city(adCode.substring(2, 4)); |
|
|
|
customerTemp.setAddress_county(adCode.substring(4, 6)); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(customerTemp.getCustomerPhoto())) { |
|
|
|
customerTemp.setCustomerPhoto(customerTemp.getCustomerPhoto().replace(fileUploadComponent.getUrlPrefix(), "")); |
|
|
|
} |
|
|
|
customerTemp.setUpdateBySid(dto.getUserSid()); |
|
|
|
boolean updateBoolean = updateById(customerTemp); |
|
|
|
if (!updateBoolean) { |
|
|
|
return rb.fail().setMsg("更新失败"); |
|
|
|
} |
|
|
|
return rb.success(); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 生成潜在客户编号 |
|
|
|
* |
|
|
@ -1008,7 +1056,7 @@ public class CrmCustomerTempService extends MybatisBaseService<CrmCustomerTempMa |
|
|
|
} |
|
|
|
baseMapper.updateById(customerTemp); |
|
|
|
if (StringUtils.isNotBlank(dto.getCustomerOrgSid())) { |
|
|
|
crmCustomerOrgLinkService.saveOrgLink(sid,dto.getCustomerOrgSid()); |
|
|
|
crmCustomerOrgLinkService.saveOrgLink(sid, dto.getCustomerOrgSid()); |
|
|
|
} |
|
|
|
//更新运营信息
|
|
|
|
CrmBusinessDto crmBusinessDto = dto.getCrmBusinessDto(); |
|
|
@ -1046,6 +1094,32 @@ public class CrmCustomerTempService extends MybatisBaseService<CrmCustomerTempMa |
|
|
|
return vo; |
|
|
|
} |
|
|
|
|
|
|
|
public AppCrmCustomerTempBasicsDetailsVo customerTempDetailsBySidWx(String sid) { |
|
|
|
SysUser sysUser = sysUserFeign.fetchBySidWx(sid).getData(); |
|
|
|
CrmCustomerTempVo crmCustomerTempVo = baseMapper.selByMobile(sysUser.getMobile()); |
|
|
|
AppCrmCustomerTempBasicsDetailsVo vo = baseMapper.customerTempDetailsBySid(crmCustomerTempVo.getSid()); |
|
|
|
vo.setSid(sid); |
|
|
|
String adCode = vo.getAddress_province() + vo.getAddress_city() + vo.getAddress_county(); |
|
|
|
if (StringUtils.isNotBlank(adCode)) { |
|
|
|
vo.setAdCode(adCode); |
|
|
|
} else { |
|
|
|
vo.setAdCode(""); |
|
|
|
} |
|
|
|
String type = "customerType"; |
|
|
|
DictCommonVo customerType = dictCommonFeign.selectBykey(vo.getCustomerTypeKey(), type).getData(); |
|
|
|
vo.setParentSid(customerType.getSid()); |
|
|
|
List<CrmFileDetailsVo> crmFileDetailsVos = crmFileService.fetchByLinkSid(sid); |
|
|
|
List<String> list = new ArrayList<>(); |
|
|
|
if (crmFileDetailsVos != null) { |
|
|
|
for (CrmFileDetailsVo crmFileDetailsVo : crmFileDetailsVos) { |
|
|
|
String filePath = crmFileDetailsVo.getFilePath(); |
|
|
|
list.add(fileUploadComponent.getUrlPrefix() + filePath); |
|
|
|
} |
|
|
|
} |
|
|
|
vo.setCrmVisitFileList(list); |
|
|
|
return vo; |
|
|
|
} |
|
|
|
|
|
|
|
public CrmCustomerTempVo selByMobile(String mobile) { |
|
|
|
return baseMapper.selByMobile(mobile); |
|
|
|
} |
|
|
|