| | |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.redis.core.RedisTemplate; |
| | | import org.springframework.scheduling.annotation.Async; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.*; |
| | |
| | | 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(")", "")); |
| | |
| | | return status;// 默认失败 |
| | | } |
| | | public void saveInterfaceLog(String url,String name,String param,Integer success,String respone){ |
| | | if(crmInterfaceLogMapper ==null){ |
| | | return; |
| | | } |
| | | CrmInterfaceLog log = new CrmInterfaceLog(); |
| | | log.setCreateDate(new Date()); |
| | | log.setUrl(url); |