|
|
@@ -7,6 +7,7 @@ import com.tiangua.star.enmus.CommercialCallBackReadyEnum;
|
|
|
import com.tiangua.star.model.*;
|
|
|
import com.tiangua.star.service.CallBackService;
|
|
|
import com.tiangua.star.util.HttpClientThreeUtil;
|
|
|
+import com.tiangua.star.util.MD5Util;
|
|
|
import com.tiangua.star.util.SignUtil;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.codec.digest.DigestUtils;
|
|
|
@@ -72,6 +73,19 @@ public class CasllBackDataProcessor implements CallBackService {
|
|
|
sendGetRequest(CommercialCallBackReadyEnum.Commercial_ONE.getCode(),
|
|
|
CommercialCallBackReadyEnum.Commercial_ONE.getBusid(),commercialCallBackReadyEnum.getUrl(),md5List);
|
|
|
break;
|
|
|
+ case Commercial_HNJS://海南谨昇信息服务有限公司
|
|
|
+ List<String> md5ListHNJS = callBackMap.get(productBizId);
|
|
|
+ log.info("开始处理机构id:{},海南谨昇信息服务有限公司 当日订单数:{},条数:{}", productBizId,md5ListHNJS,md5ListHNJS.size());
|
|
|
+ if (CollectionUtils.isEmpty(md5ListHNJS)) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ String appid="373cd4a2-0b01-409e-8c74-81fce8962aef";
|
|
|
+ String secretKey="wn2c213vPDF04T3PRbzOUzED19J8Tukh";
|
|
|
+ sendGetRequestHNJS(commercialCallBackReadyEnum.getCode(),
|
|
|
+ commercialCallBackReadyEnum.getBusid(),commercialCallBackReadyEnum.getUrl(),appid,secretKey,"海南谨昇信息服务有限公司",md5ListHNJS,resultMap);
|
|
|
+ break;
|
|
|
+
|
|
|
+
|
|
|
case Commercial_ZZCF://郑州澄丰信息咨询有限公司
|
|
|
List<String> md5ListZZCF = callBackMap.get(productBizId);
|
|
|
log.info("开始处理机构id:{},郑州澄丰信息咨询有限公司 当日订单数:{},条数:{}", productBizId,md5ListZZCF,md5ListZZCF.size());
|
|
|
@@ -1143,6 +1157,117 @@ public class CasllBackDataProcessor implements CallBackService {
|
|
|
// handleMappedData(busiId,followupList);
|
|
|
//
|
|
|
// }
|
|
|
+
|
|
|
+ private void sendGetRequestHNJS(String productBizId,String busiId,String url,String appid,String secretKey,String companyName,List<String> md5ListGZWA,Map<String, String> resultMap){
|
|
|
+
|
|
|
+ JSONObject object = new JSONObject();
|
|
|
+ object.put("md5s", md5ListGZWA);
|
|
|
+ String paramString = JSONObject.toJSONString(object);
|
|
|
+ String sign = MD5Util.MD5(paramString.concat(secretKey)).toLowerCase();
|
|
|
+ String checkUrl = url + "?appid=" + appid + "&sign=" + sign;
|
|
|
+ log.info("星级回传请求参数{}:{}",companyName,paramString);
|
|
|
+ String responseStr = HttpClientThreeUtil.post(checkUrl, paramString);
|
|
|
+ JSONObject response = JSON.parseObject(responseStr);
|
|
|
+ if (StringUtils.isEmpty(responseStr)) {
|
|
|
+ log.error("busiId:{},companyName:{} 星级回传响应为空", busiId, companyName);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ log.info("星级回传返回参数{}:{}",companyName,response);
|
|
|
+ String code = response.getString("code");
|
|
|
+ if (!"200".equals(code)) {
|
|
|
+ log.info("busiId:{},companyName {},24h返回数据错误: {},{}" ,busiId,companyName,
|
|
|
+ response.getString("msg"),response.getString("code"));
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ JSONArray dataArray = response.getJSONArray("data");
|
|
|
+ List<CustomerFollowup> followupList = new ArrayList<>();
|
|
|
+ String s = resultMap.get(busiId);
|
|
|
+ JSONObject jsonObject = JSON.parseObject(s);
|
|
|
+ // 遍历 data 数组,创建实体对象并设置对应字段
|
|
|
+ for (int i = 0; i < dataArray.size(); i++) {
|
|
|
+ JSONObject obj = dataArray.getJSONObject(i);
|
|
|
+ CustomerFollowup followup = new CustomerFollowup();
|
|
|
+ followup.setBusiId(busiId);
|
|
|
+ followup.setProductBizId(Integer.parseInt(productBizId));
|
|
|
+ followup.setPhoneMd5(obj.getString("phone_md5"));
|
|
|
+ String star = obj.getString("star");
|
|
|
+ if (StringUtils.isEmpty(star)) {
|
|
|
+ log.info("busiId:{} companyName {}, mobile_md5{} 没有填星级:", busiId, companyName ,followup.getPhoneMd5());
|
|
|
+ continue;
|
|
|
+ } else {
|
|
|
+ if (StringUtils.isEmpty(s)){//没有配置映射
|
|
|
+ if ("0".equals(star)) {
|
|
|
+ followup.setStarLevel(new BigDecimal(0));
|
|
|
+ } else if ("1".equals(star)) {
|
|
|
+ followup.setStarLevel(new BigDecimal(1));
|
|
|
+ }else if ("2".equals(star)) {
|
|
|
+ followup.setStarLevel(new BigDecimal(2));
|
|
|
+ }else if ("3".equals(star)) {
|
|
|
+ followup.setStarLevel(new BigDecimal(3));
|
|
|
+ }else if ("4".equals(star)) {
|
|
|
+ followup.setStarLevel(new BigDecimal(4));
|
|
|
+ }else if ("5".equals(star)) {
|
|
|
+ followup.setStarLevel(new BigDecimal(5));
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ //{ 客户 : 我方
|
|
|
+ // "1星": "5星",
|
|
|
+ // "2星": "4星",
|
|
|
+ // "3星": "3星",
|
|
|
+ // "4星": "2星",
|
|
|
+ // "5星": "1星"
|
|
|
+ //}
|
|
|
+ try {
|
|
|
+ Map<String, String> starMap = JSON.parseObject(jsonObject.toString(), Map.class);
|
|
|
+ String level = starMap.get(star);
|
|
|
+ if (StringUtils.isEmpty(level)) {
|
|
|
+ if ("0".equals(star)) {
|
|
|
+ followup.setStarLevel(new BigDecimal(0));
|
|
|
+ } else if ("1".equals(star)) {
|
|
|
+ followup.setStarLevel(new BigDecimal(1));
|
|
|
+ }else if ("2".equals(star)) {
|
|
|
+ followup.setStarLevel(new BigDecimal(2));
|
|
|
+ }else if ("3".equals(star)) {
|
|
|
+ followup.setStarLevel(new BigDecimal(3));
|
|
|
+ }else if ("4".equals(star)) {
|
|
|
+ followup.setStarLevel(new BigDecimal(4));
|
|
|
+ }else if ("5".equals(star)) {
|
|
|
+ followup.setStarLevel(new BigDecimal(5));
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ followup.setStarLevel(new BigDecimal(level));
|
|
|
+ }
|
|
|
+ }catch (Exception e){
|
|
|
+ if ("0".equals(star)) {
|
|
|
+ followup.setStarLevel(new BigDecimal(0));
|
|
|
+ } else if ("1".equals(star)) {
|
|
|
+ followup.setStarLevel(new BigDecimal(1));
|
|
|
+ }else if ("2".equals(star)) {
|
|
|
+ followup.setStarLevel(new BigDecimal(2));
|
|
|
+ }else if ("3".equals(star)) {
|
|
|
+ followup.setStarLevel(new BigDecimal(3));
|
|
|
+ }else if ("4".equals(star)) {
|
|
|
+ followup.setStarLevel(new BigDecimal(4));
|
|
|
+ }else if ("5".equals(star)) {
|
|
|
+ followup.setStarLevel(new BigDecimal(5));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ followup.setSourceType(3);
|
|
|
+ followup.setFollowTime(new Date());
|
|
|
+ followupList.add(followup);
|
|
|
+ }
|
|
|
+ if (CollectionUtils.isEmpty(followupList)) {
|
|
|
+ log.info("busiId:{} companyName:{},没有24h星级数据", busiId,companyName);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ log.info("busiId:{} companyName:{} 处理数据条:{}", busiId, companyName,followupList.size());
|
|
|
+ handleMappedData(busiId,followupList);
|
|
|
+
|
|
|
+ }
|
|
|
//融享客通用
|
|
|
private void sendGetRequestGZWA(String productBizId,String busiId,String url,String channelType,String accessKey,String companyName,List<String> md5ListGZWA,Map<String, String> resultMap){
|
|
|
|