This commit is contained in:
zhangwenzan 2025-09-12 16:13:30 +08:00
parent b2638f3552
commit ce525ad955
9 changed files with 199 additions and 10 deletions

View File

@ -6,6 +6,7 @@ public enum CrmPoolEnum {
PXQDMDPOOL("培训签到企业名单公海",34553),
XDMRPOOL("系统默认公海",34552),
GSMGWZKH("公司门户网站客户",34556),
GSXKYDJXX("工商新开业登记信息",34557),
;
private final String name;
private final int id;

View File

@ -23,7 +23,6 @@ public class CrmQyjbxxController {
@Autowired
private ICrmQyjbxxService crmQyjbxxService;
@ParamAspect
@PostMapping("/sync")
public void syncQyjbxx(){
crmQyjbxxService.syncQyjbxx();

View File

@ -1,6 +1,9 @@
package com.kakarote.crm.entity.PO;
import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFilter;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.kakarote.core.security.converter.SensitiveDataConverter;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

View File

@ -15,6 +15,7 @@ import com.kakarote.crm.entity.BO.*;
import com.kakarote.crm.entity.PO.CrmContacts;
import com.kakarote.crm.entity.PO.CrmCustomer;
import com.kakarote.crm.entity.PO.CrmCustomerSetting;
import com.kakarote.crm.entity.PO.CrmGsdjxx;
import com.kakarote.crm.entity.VO.CrmDataCheckVO;
import com.kakarote.crm.entity.VO.CrmGetPlaintextVO;
import com.kakarote.crm.entity.VO.CrmInfoNumVO;
@ -66,6 +67,8 @@ public interface ICrmCustomerService extends BaseService<CrmCustomer> {
*/
Map<String,Object> addOrUpdate(CrmModelSaveBO crmModel,boolean isExcel,Integer poolId);
void addCustomerByDjxx(CrmGsdjxx gsdjxx);
CrmCustomer addOrUpdateByOpenApi(CrmModelSaveBO crmModel);
/**
* 删除客户数据

View File

@ -142,6 +142,9 @@ public class CrmCustomerServiceImpl extends BaseServiceImpl<CrmCustomerMapper, C
@Autowired
private ICrmContactsService contactsService;
@Autowired
private ICrmOpenApiService crmOpenApiService;
/**
* 查询字段配置
*
@ -624,6 +627,151 @@ public class CrmCustomerServiceImpl extends BaseServiceImpl<CrmCustomerMapper, C
return map;
}
@Override
public void addCustomerByDjxx(CrmGsdjxx gsdjxx) {
CrmBusinessSaveBO crmModel = new CrmBusinessSaveBO();
Map<String, Object> entity = new HashMap<>();
entity.put("customerName",gsdjxx.getNsrmc());
entity.put("telephone","");
entity.put("mobile","");
entity.put("email","");
entity.put("website","");
entity.put("remark","");
entity.put("address",gsdjxx.getScjydz());
crmModel.setEntity(entity);
List<CrmModelFiledVO> list = new ArrayList<>();
//加入时间
CrmModelFiledVO fieldDomqff = new CrmModelFiledVO();
fieldDomqff.setFieldId(1101923);
fieldDomqff.setFieldName("fieldDomqff");
fieldDomqff.setName("加入时间");
fieldDomqff.setFieldType(0);
fieldDomqff.setType(13);
fieldDomqff.setValue(new Date());
list.add(fieldDomqff);
//企业税号
CrmModelFiledVO fieldZzmdcm = new CrmModelFiledVO();
fieldZzmdcm.setFieldId(1101926);
fieldZzmdcm.setFieldName("fliedMjrdbe");
fieldZzmdcm.setName("纳税人识别号");
fieldZzmdcm.setFieldType(0);
fieldZzmdcm.setType(1);
fieldZzmdcm.setValue("");
list.add(fieldZzmdcm);
// 所属税务局
CrmModelFiledVO fieldAvfjfa = new CrmModelFiledVO();
fieldAvfjfa.setFieldId(1101925);
fieldAvfjfa.setFieldName("fliedJhsivt");
fieldAvfjfa.setName("所属税务局");
fieldAvfjfa.setFieldType(0);
fieldAvfjfa.setType(3);
fieldAvfjfa.setValue("");
list.add(fieldAvfjfa);
//用户标记
CrmModelFiledVO fliedMtfnrf = new CrmModelFiledVO();
fliedMtfnrf.setFieldId(1101920);
fliedMtfnrf.setFieldName("fliedMtfnrf");
fliedMtfnrf.setName("用户标记");
fliedMtfnrf.setFieldType(0);
fliedMtfnrf.setType(3);
fliedMtfnrf.setValue("");
list.add(fliedMtfnrf);
//fliedGrasid 金财云联客户 1101921
CrmModelFiledVO fliedGrasid = new CrmModelFiledVO();
fliedGrasid.setFieldId(1101921);
fliedGrasid.setFieldName("fliedGrasid");
fliedGrasid.setName("金财云联客户");
fliedGrasid.setFieldType(0);
fliedGrasid.setType(3);
fliedGrasid.setValue("");
list.add(fliedGrasid);
//fliedKjhmgc 客户详细地址
CrmModelFiledVO fliedKjhmgc = new CrmModelFiledVO();
fliedKjhmgc.setFieldId(1101927);
fliedKjhmgc.setFieldName("fliedKjhmgc");
fliedKjhmgc.setName("客户详细地址");
fliedKjhmgc.setFieldType(0);
fliedKjhmgc.setType(2);
fliedKjhmgc.setValue("");
list.add(fliedKjhmgc);
//姓名 fliedJeqgso 1101928
CrmModelFiledVO fliedJeqgso = new CrmModelFiledVO();
fliedJeqgso.setFieldId(1101928);
fliedJeqgso.setFieldName("fliedJeqgso");
fliedJeqgso.setName("联系人职位");
fliedJeqgso.setFieldType(0);
fliedJeqgso.setType(1);
fliedJeqgso.setValue("");
list.add(fliedJeqgso);
//客户所在地区 industry 1101832
CrmModelFiledVO industry = new CrmModelFiledVO();
industry.setFieldId(1101832);
industry.setFieldName("industry");
industry.setName("客户所在地区");
industry.setFieldType(2);
industry.setType(3);
industry.setValue("");
list.add(industry);
//客户级别 level 1101833
CrmModelFiledVO level = new CrmModelFiledVO();
level.setFieldId(1101833);
level.setFieldName("level");
level.setName("客户级别");
level.setFieldType(2);
level.setType(3);
level.setValue("");
list.add(level);
//开通时间 fieldAcqnin 1101917
CrmModelFiledVO fieldAcqnin = new CrmModelFiledVO();
fieldAcqnin.setFieldId(1101917);
fieldAcqnin.setFieldName("fieldAcqnin");
fieldAcqnin.setName("开通时间");
fieldAcqnin.setFieldType(0);
fieldAcqnin.setType(13);
fieldAcqnin.setValue("");
list.add(fieldAcqnin);
//客户来源 source 1101828
CrmModelFiledVO source = new CrmModelFiledVO();
source.setFieldId(1101828);
source.setFieldName("source");
source.setName("客户来源");
source.setFieldType(2);
source.setType(3);
source.setValue("");
list.add(source);
// //5 新开票数 fieldYbwemm 1101919
// CrmModelFiledVO fieldYbwemm = new CrmModelFiledVO();
// fieldYbwemm.setFieldId(1101919);
// fieldYbwemm.setFieldName("fieldYbwemm");
// fieldYbwemm.setName("新开票数");
// fieldYbwemm.setFieldType(0);
// fieldYbwemm.setType(5);
// fieldYbwemm.setValue("");
// list.add(fieldYbwemm);
// //总开票数 fliedBcethz 1101918
// CrmModelFiledVO fliedBcethz = new CrmModelFiledVO();
// fliedBcethz.setFieldId(1101918);
// fliedBcethz.setFieldName("fliedBcethz");
// fliedBcethz.setName("总开票数");
// fliedBcethz.setFieldType(0);
// fliedBcethz.setType(5);
// fliedBcethz.setValue("");
// list.add(fliedBcethz);
// crmModel.setField(list);
//添加客户数据
Integer customerId = crmOpenApiService.crmAddCustomer(crmModel, "工商新开业登记信息");
//添加联系人数据
// 税局信息
// 法定代表人
if (StrUtil.isNotEmpty(gsdjxx.getFddbrxm()) && StrUtil.isNotEmpty(gsdjxx.getFddbryddh())) {
addContacts(customerId, gsdjxx.getFddbrxm(), "法定代表人", gsdjxx.getFddbryddh(), gsdjxx.getFddbrgddh(), "");
}
// 财务负责人
if (StrUtil.isNotEmpty(gsdjxx.getCwfzrxm()) && StrUtil.isNotEmpty(gsdjxx.getCwfzryddh())) {
addContacts(customerId, gsdjxx.getCwfzrxm(), "财务负责人", gsdjxx.getCwfzryddh(), gsdjxx.getCwfzrgddh(), "");
}
}
/**
* @param customerId 客户id
* @param name 联系人名称

View File

@ -3,6 +3,7 @@ package com.kakarote.crm.service.impl;
import cn.hutool.log.Log;
import cn.hutool.log.LogFactory;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
import com.fasterxml.jackson.core.type.TypeReference;
import com.kakarote.core.servlet.BaseServiceImpl;
@ -12,6 +13,7 @@ import com.kakarote.crm.entity.DTO.CrmWebServiceResponseDTO;
import com.kakarote.crm.entity.PO.CrmGsdjxx;
import com.kakarote.crm.entity.VO.CrmQueryGsdjxxVO;
import com.kakarote.crm.mapper.CrmGsdjxxMapper;
import com.kakarote.crm.service.ICrmCustomerService;
import com.kakarote.crm.service.ICrmGsdjxxService;
import com.kakarote.crm.util.JsonUtil;
import com.kakarote.crm.util.WebServiceHandlerUtil;
@ -19,9 +21,11 @@ import com.kakarote.crm.webService.config.TaxWebServiceConfig;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
@Service
@ -33,6 +37,9 @@ public class CrmGsdjxxServiceImpl extends BaseServiceImpl<CrmGsdjxxMapper,CrmGsd
@Autowired
private TaxWebServiceConfig config;
@Autowired
private ICrmCustomerService customerService;
private static final Log log = LogFactory.get();
@Override
@ -60,6 +67,7 @@ public class CrmGsdjxxServiceImpl extends BaseServiceImpl<CrmGsdjxxMapper,CrmGsd
List<CrmGsdjxx> crmGsdjxxList = responseDTO.getData();
return processAndSaveData(crmGsdjxxList, crmQueryGsdjxxDTO);
}
@ -115,16 +123,24 @@ public class CrmGsdjxxServiceImpl extends BaseServiceImpl<CrmGsdjxxMapper,CrmGsd
private List<CrmQueryGsdjxxVO> processAndSaveData(List<CrmGsdjxx> crmGsdjxxList,CrmQueryGsdjxxDTO crmQueryGsdjxxDTO) {
log.info(crmGsdjxxList.toString());
List<CrmGsdjxx> crmGsdjxxesNew = new ArrayList<>();
crmGsdjxxList.forEach(crmGsdjxx -> {
crmGsdjxx.setYf(crmQueryGsdjxxDTO.getYf());
crmGsdjxx.setXzqhDm(crmQueryGsdjxxDTO.getXzqhDm());
CrmGsdjxx one = new LambdaQueryChainWrapper<>(crmGsdjxxMapper)
.eq(CrmGsdjxx::getNsrmc, crmGsdjxx.getNsrmc())
.last("limit 1").one();
if (one == null) {
crmGsdjxx.setYf(crmQueryGsdjxxDTO.getYf());
crmGsdjxx.setXzqhDm(crmQueryGsdjxxDTO.getXzqhDm());
crmGsdjxxesNew.add(crmGsdjxx);
customerService.addCustomerByDjxx(crmGsdjxx);
}
});
new Thread(() -> {
int inserted = crmGsdjxxMapper.insertBatch(crmGsdjxxesNew);
log.info("成功插入了" + inserted + "条数据");
}).start();
int inserted = crmGsdjxxMapper.insertBatch(crmGsdjxxList);
log.info("成功插入了" + inserted + "条数据");
return convertListToVO(crmGsdjxxList);
return convertListToVO(crmGsdjxxesNew);
}
}

View File

@ -442,6 +442,15 @@ public class CrmLeadsServiceImpl extends BaseServiceImpl<CrmLeadsMapper, CrmLead
CrmModelSaveBO crmModelSaveBO = new CrmModelSaveBO();
crmModelSaveBO.setEntity(BeanUtil.beanToMap(crmCustomer));
List<CrmModelFiledVO> collect = customerDataList.stream().map(field -> BeanUtil.copyProperties(field, CrmModelFiledVO.class)).collect(Collectors.toList());
//fliedKjhmgc 客户详细地址
CrmModelFiledVO fliedKjhmgc = new CrmModelFiledVO();
fliedKjhmgc.setFieldId(1101927);
fliedKjhmgc.setFieldName("fliedKjhmgc");
fliedKjhmgc.setName("客户详细地址");
fliedKjhmgc.setFieldType(0);
fliedKjhmgc.setType(2);
fliedKjhmgc.setValue(crmLeads.getAddress());
collect.add(fliedKjhmgc);
crmModelSaveBO.setField(collect);
crmModelSaveBoMap.put(customerId,crmModelSaveBO);

View File

@ -14,8 +14,7 @@ import java.util.*;
import static com.kakarote.core.common.SystemCodeEnum.SYSTEM_NO_AUTH;
import static com.kakarote.crm.constant.CrmCodeEnum.CUSTOMER_XX_Y;
import static com.kakarote.crm.constant.CrmPoolEnum.GSMGWZKH;
import static com.kakarote.crm.constant.CrmPoolEnum.PXQDMDPOOL;
import static com.kakarote.crm.constant.CrmPoolEnum.*;
@Slf4j
@Service
@ -230,6 +229,8 @@ public class CrmOpenApiServiceImpl implements ICrmOpenApiService {
poolBO.setPoolId(PXQDMDPOOL.getId());
}else if ("公司门户网站客户".equals(source)){
poolBO.setPoolId(GSMGWZKH.getId());
}else if ("工商新开业登记信息".equals(source)){
poolBO.setPoolId(GSXKYDJXX.getId());
}
customerService.updateCustomerByIds(poolBO);
return customerId;

View File

@ -15,6 +15,7 @@ import com.kakarote.crm.entity.DTO.CrmWebServiceResponseDTO;
import com.kakarote.crm.entity.PO.CrmQyjbxx;
import com.kakarote.crm.entity.PO.CrmQyjbxxDjrqDetail;
import com.kakarote.crm.entity.PO.CrmSwjgDm;
import com.kakarote.crm.entity.PO.CrmSyQyjbxxErr;
import com.kakarote.crm.mapper.CrmQyjbxxMapper;
import com.kakarote.crm.service.*;
import com.kakarote.crm.util.AecUtils;
@ -54,6 +55,8 @@ public class CrmQyjbxxServiceImpl extends BaseServiceImpl<CrmQyjbxxMapper, CrmQy
@Autowired
private ICrmGsdjxxService crmGsdjxxService;
private ICrmSyQyjbxxErrService crmSyQyjbxxErrService;
// 在类中定义线程池
private ExecutorService executorService = Executors.newFixedThreadPool(30);
@ -240,6 +243,12 @@ public class CrmQyjbxxServiceImpl extends BaseServiceImpl<CrmQyjbxxMapper, CrmQy
this.syncDataBySwjgdmAndTime(crmSyncQyjbxxDTO);
} catch (Exception e) {
log.error("同步企业出现异常:{}", e.getMessage());
//记录失败信息
CrmSyQyjbxxErr crmSyQyjbxxErr = new CrmSyQyjbxxErr();
crmSyQyjbxxErr.setKs(monthRange.getStartDate());
crmSyQyjbxxErr.setJs(monthRange.getEndDate());
crmSyQyjbxxErr.setErr(e.getMessage());
crmSyQyjbxxErrService.insert(crmSyQyjbxxErr);
throw new RuntimeException(e);
}
});