jiangping
2024-07-12 de70d21d8dea3e8ae972722456e3e8223a798ae5
server/service/src/main/java/com/doumee/biz/zbom/impl/ZbomCRMServiceImpl.java
@@ -6,6 +6,7 @@
import com.doumee.biz.zbom.model.CrmCustomerInfoModel;
import com.doumee.biz.zbom.model.CrmCustomerSubmmitModel;
import com.doumee.core.utils.Constants;
import com.doumee.core.utils.DateUtil;
import com.doumee.core.utils.HttpsUtil;
import com.doumee.dao.business.CrmInterfaceLogMapper;
import com.doumee.dao.business.CustomerLogMapper;
@@ -36,6 +37,30 @@
    @Autowired
    private RedisTemplate<String, Object> redisTemplate;
    @Override
    @Async
    public void dealCustomerLogData(CustomerLog customerLog){
        CrmCustomerSubmmitModel entity = new CrmCustomerSubmmitModel();
        List<CrmCustomerInfoModel> cusInfo = new ArrayList();
        CrmCustomerInfoModel crmCustomerInfoModel = new CrmCustomerInfoModel();
        crmCustomerInfoModel.setId(customerLog.getId());
        crmCustomerInfoModel.setName(customerLog.getName());
        crmCustomerInfoModel.setPhone(customerLog.getPhone());
        crmCustomerInfoModel.setAreaname(customerLog.getAreaName());
        crmCustomerInfoModel.setAreacode(customerLog.getAreaCode());
        crmCustomerInfoModel.setOpenid(customerLog.getOpenid());
        crmCustomerInfoModel.setSource(Constants.CrmSources.SOURCE_ZBJX);
        crmCustomerInfoModel.setChannel(crmCustomerInfoModel.getSource()+"00");
        crmCustomerInfoModel.setDate(DateUtil.dateToString(customerLog.getCreateDate(),"yyyy/MM/dd HH:mm"));
        cusInfo.add(crmCustomerInfoModel);
        entity.setCusInfo(cusInfo);
        this.postDataToCrm(entity);
    }
    /**
     * 志邦客户信息提交接口
     * @param entity
@@ -51,16 +76,16 @@
        String type = "postCusData";
        String appid = (String) redisTemplate.opsForValue().get(Constants.RedisKeys.ZBOM_CRM_API_KEY);
        String urlStr =  (String)redisTemplate.opsForValue().get(Constants.RedisKeys.ZBOM_CRM_API_URL) ;
        long _t = System.currentTimeMillis();
        String crmInfo="提交失败";
        if (StringUtils.isNotBlank(appid)||StringUtils.isNotBlank(urlStr)) {
            String token = DigestUtils.md5Hex(type + _t + appid);
            String url = urlStr + "?type=" + type + "&_t=" + _t + "&token=" + token;// 提交CRM地址
            String param = JSONObject.toJSONString(entity);
            int success =1;
            String result = null;
            int success =1;
            String url = urlStr;
            try {
                String token = DigestUtils.md5Hex(type + _t + appid);
                  url = urlStr + "?type=" + type + "&_t=" + _t + "&token=" + token;// 提交CRM地址
                  result = HttpsUtil.postJson(url,param);
                if (StringUtils.isNotBlank(result)) {
                    JSONObject r = JSONObject.parseObject(result.replace("(", "").replace(")", ""));
@@ -99,6 +124,7 @@
                .set(CustomerLog::getCrmDate,new Date() ));// 更新状态
        return status;// 默认失败
    }
    public  void  saveInterfaceLog(String url,String name,String  param,Integer success,String respone){
            if(crmInterfaceLogMapper ==null){
                return;