| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067 |
- package com.tiangua.star.service.impl;
- import com.alibaba.fastjson.JSON;
- import com.alibaba.fastjson.JSONArray;
- import com.alibaba.fastjson.JSONObject;
- import com.tiangua.star.enmus.CommercialCallBackReadyEnum;
- import com.tiangua.star.model.CustomerFollowup;
- import com.tiangua.star.model.ThirdStarDto;
- import com.tiangua.star.model.XdOrderDto;
- import com.tiangua.star.service.CallBackService;
- import com.tiangua.star.util.HttpClientThreeUtil;
- import com.tiangua.star.util.SignUtil;
- import lombok.extern.slf4j.Slf4j;
- import org.apache.commons.codec.digest.DigestUtils;
- import org.apache.commons.collections4.CollectionUtils;
- import org.apache.commons.lang3.StringUtils;
- import org.apache.http.impl.client.CloseableHttpClient;
- import org.apache.http.impl.client.HttpClients;
- import org.springframework.beans.factory.annotation.Value;
- import org.springframework.stereotype.Service;
- import java.math.BigDecimal;
- import java.security.MessageDigest;
- import java.security.NoSuchAlgorithmException;
- import java.util.ArrayList;
- import java.util.Date;
- import java.util.HashMap;
- import java.util.List;
- import java.util.Map;
- import java.util.TreeMap;
- import java.util.function.Function;
- import java.util.stream.Collectors;
- @Service
- @Slf4j
- public class CasllBackDataProcessor implements CallBackService {
- // HTTP请求工具
- private static final CloseableHttpClient httpClient = HttpClients.createDefault();
- @Value("${md5.callback.url}")
- private String url;
- /**
- * 处理机构数据入口
- */
- @Override
- public void processInstitutionData(List<XdOrderDto> xdOrderDtos) {
- Map<String, List<String>> groupedByBusiId = xdOrderDtos.stream()
- .collect(Collectors.groupingBy(
- XdOrderDto::getProductBizId,
- Collectors.mapping(XdOrderDto::getMobileMd5, Collectors.toList())
- ));
- Map<String, List<String>> callBackMap = groupedByBusiId.entrySet().stream()
- .filter(entry -> CommercialCallBackReadyEnum.of(entry.getKey()) != null)
- .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
- log.info("已经对接md5星级回传的机构id:{}", callBackMap.keySet());
- if (CollectionUtils.isEmpty(callBackMap.keySet())) {
- log.info("MD5 无需要处理的星级回传:{}", callBackMap.keySet());
- return;
- }
- for (String productBizId : callBackMap.keySet()) {
- CommercialCallBackReadyEnum commercialCallBackReadyEnum = CommercialCallBackReadyEnum.of(productBizId);
- if (commercialCallBackReadyEnum != null) {
- switch (commercialCallBackReadyEnum) {
- case Commercial_ONE:
- List<String> md5List = callBackMap.get(productBizId);
- log.info("开始处理机构id:{},当日订单数:{},条数:{}", productBizId,md5List,md5List.size());
- if (CollectionUtils.isEmpty(md5List)) {
- return;
- }
- sendGetRequest(CommercialCallBackReadyEnum.Commercial_ONE.getCode(),
- CommercialCallBackReadyEnum.Commercial_ONE.getBusid(),commercialCallBackReadyEnum.getUrl(),md5List);
- break;
- case Commercial_LSDJC://乐山都聚财信息技术咨询有限公司
- List<String> md5ListLSDJC = callBackMap.get(productBizId);
- log.info("开始处理机构id:{},乐山都聚财信息技术咨询有限公司 当日订单数:{},条数:{}", productBizId,md5ListLSDJC,md5ListLSDJC.size());
- if (CollectionUtils.isEmpty(md5ListLSDJC)) {
- return;
- }
- String channelTypeLSDJC="21180";
- String accessKeyLSDJC="3438EBF8-95AC-4739-8B32-59D273D38689";
- sendGetRequestGZWA(commercialCallBackReadyEnum.getCode(),
- commercialCallBackReadyEnum.getBusid(),commercialCallBackReadyEnum.getUrl(),channelTypeLSDJC,accessKeyLSDJC,"乐山都聚财信息技术咨询有限公司",md5ListLSDJC);
- break;
- case Commercial_SCNAZC://四川诺安至诚信息科技有限公司
- List<String> md5ListSCNAZC = callBackMap.get(productBizId);
- log.info("开始处理机构id:{},四川诺安至诚信息科技有限公司 当日订单数:{},条数:{}", productBizId,md5ListSCNAZC,md5ListSCNAZC.size());
- if (CollectionUtils.isEmpty(md5ListSCNAZC)) {
- return;
- }
- String channelTypeSCNAZC="21180";
- String accessKeySCNAZC="818DF3C7-0B11-4043-B7ED-84508F2C00EF";
- sendGetRequestGZWA(commercialCallBackReadyEnum.getCode(),
- commercialCallBackReadyEnum.getBusid(),commercialCallBackReadyEnum.getUrl(),channelTypeSCNAZC,accessKeySCNAZC,"四川诺安至诚信息科技有限公司",md5ListSCNAZC);
- break;
- case Commercial_GZWA://广州维安信息咨询有限公司
- List<String> md5ListGZWA = callBackMap.get(productBizId);
- log.info("开始处理机构id:{},广州维安信息咨询有限公司 当日订单数:{},条数:{}", productBizId,md5ListGZWA,md5ListGZWA.size());
- if (CollectionUtils.isEmpty(md5ListGZWA)) {
- return;
- }
- String channelType="21160";
- String accessKey="4A79FD90-DA94-4D4B-AECD-BC48CD418970";
- sendGetRequestGZWA(commercialCallBackReadyEnum.getCode(),
- commercialCallBackReadyEnum.getBusid(),commercialCallBackReadyEnum.getUrl(),channelType,accessKey,"弘盛信息咨询有限公司",md5ListGZWA);
- break;
- case Commercial_TSSX://唐山硕鑫科技有限公司
- List<String> md5ListTSSX = callBackMap.get(productBizId);
- log.info("开始处理机构id:{},唐山硕鑫科技有限公司 当日订单数:{},条数:{}", productBizId,md5ListTSSX,md5ListTSSX.size());
- if (CollectionUtils.isEmpty(md5ListTSSX)) {
- return;
- }
- String channelTypeTSSX="21540";
- String accessKeyTSSX="5D3842E0-7A2E-4077-8985-16F9782A0950";
- sendGetRequestGZWA(commercialCallBackReadyEnum.getCode(),
- commercialCallBackReadyEnum.getBusid(),commercialCallBackReadyEnum.getUrl(),channelTypeTSSX,accessKeyTSSX,"唐山硕鑫科技有限公司",md5ListTSSX);
- break;
- case Commercial_SZRJX://苏州荣聚鑫科技有限公司
- List<String> md5ListSZRJX = callBackMap.get(productBizId);
- log.info("开始处理机构id:{},苏州荣聚鑫科技有限公司 当日订单数:{},条数:{}", productBizId,md5ListSZRJX,md5ListSZRJX.size());
- if (CollectionUtils.isEmpty(md5ListSZRJX)) {
- return;
- }
- String channelTypeSZRJX="21540";
- String accessKeySZRJX="8AF3F228-913D-4430-883A-2CEA88D8657E";
- sendGetRequestGZWA(commercialCallBackReadyEnum.getCode(),
- commercialCallBackReadyEnum.getBusid(),commercialCallBackReadyEnum.getUrl(),channelTypeSZRJX,accessKeySZRJX,"苏州荣聚鑫科技有限公司",md5ListSZRJX);
- break;
- case Commercial_GZXX://广州星象信息科技有限公司
- List<String> md5ListGZXX = callBackMap.get(productBizId);
- log.info("开始处理机构id:{},广州星象信息科技有限公司 当日订单数:{},条数:{}", productBizId,md5ListGZXX,md5ListGZXX.size());
- if (CollectionUtils.isEmpty(md5ListGZXX)) {
- return;
- }
- String channelTypeGZXX="21540";
- String accessKeyGZXX="8620FAD8-775C-4416-BB10-1486F008D2AA";
- sendGetRequestGZWA(commercialCallBackReadyEnum.getCode(),
- commercialCallBackReadyEnum.getBusid(),commercialCallBackReadyEnum.getUrl(),channelTypeGZXX,accessKeyGZXX,"广州星象信息科技有限公司",md5ListGZXX);
- break;
- case Commercial_YBDSHY://延边鼎晟合盈企业管理有限公司
- List<String> md5ListYBDSHY = callBackMap.get(productBizId);
- log.info("开始处理机构id:{},延边鼎晟合盈企业管理有限公司 当日订单数:{},条数:{}", productBizId,md5ListYBDSHY,md5ListYBDSHY.size());
- if (CollectionUtils.isEmpty(md5ListYBDSHY)) {
- return;
- }
- String channelTypeYBDSHY="21540";
- String accessKeyYBDSHY="73F3F2EB-1687-44A2-B647-4C00B8DDB77A";
- sendGetRequestGZWA(commercialCallBackReadyEnum.getCode(),
- commercialCallBackReadyEnum.getBusid(),commercialCallBackReadyEnum.getUrl(),channelTypeYBDSHY,accessKeyYBDSHY,"延边鼎晟合盈企业管理有限公司",md5ListYBDSHY);
- break;
- case Commercial_XNLJKJ://西宁蓝鲸优享科技有限公司
- List<String> md5ListXNLJKJ = callBackMap.get(productBizId);
- log.info("开始处理机构id:{},西宁蓝鲸优享科技有限公司 当日订单数:{},条数:{}", productBizId,md5ListXNLJKJ,md5ListXNLJKJ.size());
- if (CollectionUtils.isEmpty(md5ListXNLJKJ)) {
- return;
- }
- sendGetRequestHz(commercialCallBackReadyEnum.getCode(),
- commercialCallBackReadyEnum.getBusid(),commercialCallBackReadyEnum.getUrl(),"西宁蓝鲸优享科技有限公司");
- break;
- case Commercial_CQHYJF://重庆寰宇金福信息科技有限公司
- List<String> md5ListCQHYJF = callBackMap.get(productBizId);
- log.info("开始处理机构id:{},重庆寰宇金福信息科技有限公司 当日订单数:{},条数:{}", productBizId,md5ListCQHYJF,md5ListCQHYJF.size());
- if (CollectionUtils.isEmpty(md5ListCQHYJF)) {
- return;
- }
- sendGetRequestHz(commercialCallBackReadyEnum.getCode(),
- commercialCallBackReadyEnum.getBusid(),commercialCallBackReadyEnum.getUrl(),"重庆寰宇金福信息科技有限公司");
- break;
- case Commercial_SRLF://速融(廊坊)信息咨询服务有限公司
- List<String> md5ListSRLF = callBackMap.get(productBizId);
- log.info("开始处理机构id:{},速融(廊坊)信息咨询服务有限公司 当日订单数:{},条数:{}", productBizId,md5ListSRLF,md5ListSRLF.size());
- if (CollectionUtils.isEmpty(md5ListSRLF)) {
- return;
- }
- sendGetRequestHz(commercialCallBackReadyEnum.getCode(),
- commercialCallBackReadyEnum.getBusid(),commercialCallBackReadyEnum.getUrl(),"速融(廊坊)信息咨询服务有限公司");
- break;
- case Commercial_NJCXS://南京诚享顺科技有限公司
- List<String> md5ListNJCXS = callBackMap.get(productBizId);
- log.info("开始处理机构id:{},南京诚享顺科技有限公司 当日订单数:{},条数:{}", productBizId,md5ListNJCXS,md5ListNJCXS.size());
- if (CollectionUtils.isEmpty(md5ListNJCXS)) {
- return;
- }
- sendGetRequestHz(commercialCallBackReadyEnum.getCode(),
- commercialCallBackReadyEnum.getBusid(),commercialCallBackReadyEnum.getUrl(),"南京诚享顺科技有限公司");
- break;
- case Commercial_HS://弘盛信息咨询有限公司
- List<String> md5ListHS = callBackMap.get(productBizId);
- log.info("开始处理机构id:{},弘盛信息咨询有限公司 当日订单数:{},条数:{}", productBizId,md5ListHS,md5ListHS.size());
- if (CollectionUtils.isEmpty(md5ListHS)) {
- return;
- }
- sendGetRequestHz(commercialCallBackReadyEnum.getCode(),
- commercialCallBackReadyEnum.getBusid(),commercialCallBackReadyEnum.getUrl(),"弘盛信息咨询有限公司");
- break;
- case Commercial_JXJJG://4514江西聚金阁
- List<String> md5ListJXJJG = callBackMap.get(productBizId);
- log.info("开始处理机构id:{},江西聚金阁 当日订单数:{},条数:{}", productBizId,md5ListJXJJG,md5ListJXJJG.size());
- if (CollectionUtils.isEmpty(md5ListJXJJG)) {
- return;
- }
- sendGetRequestJXJJG(commercialCallBackReadyEnum.getCode(),
- commercialCallBackReadyEnum.getBusid(),commercialCallBackReadyEnum.getUrl(),md5ListJXJJG);
- break;
- case Commercial_SZYC://苏州央创
- List<String> md5ListSZYC = callBackMap.get(productBizId);
- log.info("开始处理机构id:{},苏州央创 当日订单数:{},条数:{}", productBizId,md5ListSZYC,md5ListSZYC.size());
- if (CollectionUtils.isEmpty(md5ListSZYC)) {
- return;
- }
- sendGetRequestHz(commercialCallBackReadyEnum.getCode(),
- commercialCallBackReadyEnum.getBusid(),commercialCallBackReadyEnum.getUrl(),"苏州央创");
- break;
- case Commercial_SXJLHJ2://陕西聚隆汇金(二店)
- List<String> md5ListSXJLHJ2 = callBackMap.get(productBizId);
- log.info("开始处理机构id:{},陕西聚隆汇金(二店) 当日订单数:{},条数:{}", productBizId,md5ListSXJLHJ2,md5ListSXJLHJ2.size());
- if (CollectionUtils.isEmpty(md5ListSXJLHJ2)) {
- return;
- }
- sendGetRequestHz(commercialCallBackReadyEnum.getCode(),
- commercialCallBackReadyEnum.getBusid(),commercialCallBackReadyEnum.getUrl(),"陕西聚隆汇金(二店)");
- break;
- case Commercial_SXJLHJ://陕西聚隆汇金
- List<String> md5ListSXJLHJ = callBackMap.get(productBizId);
- log.info("开始处理机构id:{},陕西聚隆汇金 当日订单数:{},条数:{}", productBizId,md5ListSXJLHJ,md5ListSXJLHJ.size());
- if (CollectionUtils.isEmpty(md5ListSXJLHJ)) {
- return;
- }
- sendGetRequestHz(commercialCallBackReadyEnum.getCode(),
- commercialCallBackReadyEnum.getBusid(),commercialCallBackReadyEnum.getUrl(),"陕西聚隆汇金");
- break;
- case Commercial_JXJL://嘉兴聚联
- List<String> md5ListJXJL = callBackMap.get(productBizId);
- log.info("开始处理机构id:{},嘉兴聚联 当日订单数:{},条数:{}", productBizId,md5ListJXJL,md5ListJXJL.size());
- if (CollectionUtils.isEmpty(md5ListJXJL)) {
- return;
- }
- sendGetRequestHz(commercialCallBackReadyEnum.getCode(),
- commercialCallBackReadyEnum.getBusid(),commercialCallBackReadyEnum.getUrl(),"嘉兴聚联");
- break;
- case Commercial_JDPHAJ://广州金贷普惠按揭服务有限公司
- List<String> md5ListJDPHAJ = callBackMap.get(productBizId);
- log.info("开始处理机构id:{},广州金贷普惠按揭服务有限公司 当日订单数:{},条数:{}", productBizId,md5ListJDPHAJ,md5ListJDPHAJ.size());
- if (CollectionUtils.isEmpty(md5ListJDPHAJ)) {
- return;
- }
- sendGetRequestHz(commercialCallBackReadyEnum.getCode(),
- commercialCallBackReadyEnum.getBusid(),commercialCallBackReadyEnum.getUrl(),"广州金贷普惠按揭服务有限公司");
- break;
- case Commercial_NXCX://宁夏簇鑫科技有限公司
- List<String> md5ListNXCX = callBackMap.get(productBizId);
- log.info("开始处理机构id:{},宁夏簇鑫科技有限公司 当日订单数:{},条数:{}", productBizId,md5ListNXCX,md5ListNXCX.size());
- if (CollectionUtils.isEmpty(md5ListNXCX)) {
- return;
- }
- sendGetRequestHz(commercialCallBackReadyEnum.getCode(),
- commercialCallBackReadyEnum.getBusid(),commercialCallBackReadyEnum.getUrl(),"宁夏簇鑫科技有限公司");
- break;
- case Commercial_CDHJT://成都汇锦通创商务信息咨询服务有限公司
- List<String> md5ListCDHJT = callBackMap.get(productBizId);
- log.info("开始处理机构id:{},成都汇锦通创商务信息咨询服务有限公司 当日订单数:{},条数:{}", productBizId,md5ListCDHJT,md5ListCDHJT.size());
- if (CollectionUtils.isEmpty(md5ListCDHJT)) {
- return;
- }
- sendGetRequestHz(commercialCallBackReadyEnum.getCode(),
- commercialCallBackReadyEnum.getBusid(),commercialCallBackReadyEnum.getUrl(),"成都汇锦通创商务信息咨询服务有限公司");
- break;
- case Commercial_HBSY://湖北十堰华融信息咨询有限公司
- List<String> md5ListHBSY = callBackMap.get(productBizId);
- log.info("开始处理机构id:{},湖北十堰华融信息咨询有限公司 当日订单数:{},条数:{}", productBizId,md5ListHBSY,md5ListHBSY.size());
- if (CollectionUtils.isEmpty(md5ListHBSY)) {
- return;
- }
- sendGetRequestHz(commercialCallBackReadyEnum.getCode(),
- commercialCallBackReadyEnum.getBusid(),commercialCallBackReadyEnum.getUrl(),"湖北十堰华融信息咨询有限公司");
- break;
- case Commercial_CD://成都蓉鑫诚商有限公司
- List<String> md5ListCD = callBackMap.get(productBizId);
- log.info("开始处理机构id:{},成都蓉鑫诚商有限公司 当日订单数:{},条数:{}", productBizId,md5ListCD,md5ListCD.size());
- if (CollectionUtils.isEmpty(md5ListCD)) {
- return;
- }
- sendGetRequestHz(commercialCallBackReadyEnum.getCode(),
- commercialCallBackReadyEnum.getBusid(),commercialCallBackReadyEnum.getUrl(),"成都蓉鑫诚商有限公司");
- break;
- case Commercial_QT://齐泰圣鑫有限公司
- List<String> md5ListQt = callBackMap.get(productBizId);
- log.info("开始处理机构id:{},齐泰圣鑫有限公司 当日订单数:{},条数:{}", productBizId,md5ListQt,md5ListQt.size());
- if (CollectionUtils.isEmpty(md5ListQt)) {
- return;
- }
- sendGetRequestHz(commercialCallBackReadyEnum.getCode(),
- commercialCallBackReadyEnum.getBusid(),commercialCallBackReadyEnum.getUrl(),"齐泰圣鑫有限公司");
- break;
- case Commercial_HZ:
- List<String> md5ListHz = callBackMap.get(productBizId);
- log.info("开始处理机构id:{},杭州聚壹融商务信息咨询有限公司 当日订单数:{},条数:{}", productBizId,md5ListHz,md5ListHz.size());
- if (CollectionUtils.isEmpty(md5ListHz)) {
- return;
- }
- sendGetRequestHz(commercialCallBackReadyEnum.getCode(),
- commercialCallBackReadyEnum.getBusid(),commercialCallBackReadyEnum.getUrl(),"杭州聚壹融商务信息咨询有限公司");
- break;
- case Commercial_NBHX:
- List<String> md5ListNBHX = callBackMap.get(productBizId);
- log.info("开始处理机构id:{},宁波垣信信息科技有限公司 当日订单数:{},条数:{}", productBizId,md5ListNBHX,md5ListNBHX.size());
- if (CollectionUtils.isEmpty(md5ListNBHX)) {
- return;
- }
- sendGetRequestHz(commercialCallBackReadyEnum.getCode(),
- commercialCallBackReadyEnum.getBusid(),commercialCallBackReadyEnum.getUrl(),"宁波垣信信息科技有限公司");
- break;
- case Commercial_BJQN:
- List<String> md5ListBJQN = callBackMap.get(productBizId);
- log.info("开始处理机构id:{},北京签牛企业管理咨询有限公司 当日订单数:{},条数:{}", productBizId,md5ListBJQN,md5ListBJQN.size());
- if (CollectionUtils.isEmpty(md5ListBJQN)) {
- return;
- }
- sendGetRequestHz(commercialCallBackReadyEnum.getCode(),
- commercialCallBackReadyEnum.getBusid(),commercialCallBackReadyEnum.getUrl(),"北京签牛企业管理咨询有限公司");
- break;
- case Commercial_FOSHAN:
- List<String> md5ListFS = callBackMap.get(productBizId);
- log.info("开始处理机构id:{},佛山市创智盈通企业管理有限公司 当日订单数:{},条数:{}", productBizId,md5ListFS,md5ListFS.size());
- if (CollectionUtils.isEmpty(md5ListFS)) {
- return;
- }
- sendGetRequestFoShan(commercialCallBackReadyEnum.getCode(),
- commercialCallBackReadyEnum.getBusid(),commercialCallBackReadyEnum.getUrl(), md5ListFS);
- break;
- // case Commercial_HLJJC:
- // List<String> md5ListHLJJC = callBackMap.get(productBizId);
- // log.info("开始处理机构id:{},黑龙江省景琛信息咨询有限公司 当日订单数:{},条数:{}", productBizId,md5ListHLJJC,md5ListHLJJC.size());
- // if (CollectionUtils.isEmpty(md5ListHLJJC)) {
- // return;
- // }
- // sendGetRequestHeiLongJiang(commercialCallBackReadyEnum.getCode(),
- // commercialCallBackReadyEnum.getBusid(),commercialCallBackReadyEnum.getUrl(), md5ListHLJJC);
- // break;
- case Commercial_CQYXJ:
- List<String> md5ListCQYXJ = callBackMap.get(productBizId);
- log.info("开始处理机构id:{},重庆优兴嘉 当日订单数:{},条数:{}", productBizId,md5ListCQYXJ,md5ListCQYXJ.size());
- if (CollectionUtils.isEmpty(md5ListCQYXJ)) {
- return;
- }
- sendGetRequestCQYXJ(commercialCallBackReadyEnum.getCode(),
- commercialCallBackReadyEnum.getBusid(),commercialCallBackReadyEnum.getUrl(),md5ListCQYXJ,"1D4C6329-399F-42CA-AC0C-236E0B048AD0",21540);
- break;
- case Commercial_SXRKX:
- List<String> md5ListSXRKX = callBackMap.get(productBizId);
- log.info("开始处理机构id:{},山西瑞凯鑫 当日订单数:{},条数:{}", productBizId,md5ListSXRKX,md5ListSXRKX.size());
- if (CollectionUtils.isEmpty(md5ListSXRKX)) {
- return;
- }
- sendGetRequestSXRKX(commercialCallBackReadyEnum.getCode(),
- commercialCallBackReadyEnum.getBusid(),commercialCallBackReadyEnum.getUrl());
- break;
- // case Commercial_XJZZ:
- // List<String> md5ListXJZZ = callBackMap.get(busiId);
- // log.info("开始处理机构id:{},当日订单数:{},条数:{}", busiId,md5ListXJZZ,md5ListXJZZ.size());
- // if (CollectionUtils.isEmpty(md5ListXJZZ)) {
- // return;
- // }
- // sendGetRequestSXRKX(commercialCallBackReadyEnum.getCode(),
- // commercialCallBackReadyEnum.getBusid(),commercialCallBackReadyEnum.getUrl());
- // break;
- case Commercial_CHONGQINGZC:
- List<String> md5ListCq = callBackMap.get(productBizId);
- log.info("开始处理机构id:{},重庆众诚 当日订单数:{},条数:{}", productBizId,md5ListCq,md5ListCq.size());
- if (CollectionUtils.isEmpty(md5ListCq)) {
- return;
- }
- String url = commercialCallBackReadyEnum.getUrl();
- String[] split = url.split(";");
- for (String urlTemp : split) {
- sendGetRequestHz(commercialCallBackReadyEnum.getCode(),
- commercialCallBackReadyEnum.getBusid(),urlTemp,"重庆众诚");
- }
- break;
- // case Commercial_Test:
- // log.info("开始处理机构id:{}", busiId);
- // List<String> md5List2 = callBackMap.get(busiId);
- // if (CollectionUtils.isEmpty(md5List2)) {
- // return;
- // }
- // sendGetRequest(CommercialCallBackReadyEnum.Commercial_Test.getCode(),
- // CommercialCallBackReadyEnum.Commercial_Test.getBusid(),commercialCallBackReadyEnum.getUrl(),md5List2);
- // break;
- }
- }
- }
- }
- @Override
- public void thirdProcessInstitutionData(List<ThirdStarDto> thirdStarDtos) {
- if (CollectionUtils.isEmpty(thirdStarDtos)) {
- log.info("thirdStarDtos 解析回传数据为null");
- return;
- }
- Map<String, List<String>> groupedByBusiId = thirdStarDtos.stream()
- .collect(Collectors.groupingBy(
- ThirdStarDto::getProductBizId,
- Collectors.mapping(ThirdStarDto::getPhoneMd5, Collectors.toList())
- ));
- Map<String, List<String>> callBackMap = groupedByBusiId.entrySet().stream()
- .filter(entry -> CommercialCallBackReadyEnum.of(entry.getKey()) != null)
- .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
- log.info("已经对接third星级回传的机构id:{}", callBackMap.keySet());
- if (CollectionUtils.isEmpty(callBackMap.keySet())) {
- log.info("third 无需要处理的星级回传:{}", callBackMap.keySet());
- return;
- }
- for (String productBizId : callBackMap.keySet()) {
- CommercialCallBackReadyEnum commercialCallBackReadyEnum = CommercialCallBackReadyEnum.of(productBizId);
- if (commercialCallBackReadyEnum != null) {
- switch (commercialCallBackReadyEnum) {
- case Commercial_DAQN:
- if (CollectionUtils.isEmpty(thirdStarDtos)) {
- return;
- }
- sendDalian(commercialCallBackReadyEnum.getCode(),
- commercialCallBackReadyEnum.getBusid(),
- commercialCallBackReadyEnum.getUrl(),thirdStarDtos);
- break;
- case Commercial_HFYZF:
- if (CollectionUtils.isEmpty(thirdStarDtos)) {
- return;
- }
- sendHeFei(commercialCallBackReadyEnum.getCode(),
- commercialCallBackReadyEnum.getBusid(),
- commercialCallBackReadyEnum.getUrl(),thirdStarDtos);
- break;
- }
- }
- }
- }
- @Override
- public JSONObject kydrequest(JSONObject json) {
- List<CustomerFollowup> followupList = new ArrayList<>();
- CustomerFollowup followup = new CustomerFollowup();
- followup.setPhoneMd5(json.getString("phoneMd5"));
- String businessId = "389fb67410dc250414104756business";
- followup.setBusiId(businessId);
- followup.setProductBizId(4413);
- followup.setFollowTime(new Date());
- followup.setSourceType(3);
- String star = json.getString("star");
- if ("1".equals(star)) {
- followup.setStarLevel(new BigDecimal(0));
- } else if ("2".equals(star)) {
- followup.setStarLevel(new BigDecimal(1));
- }else if ("3".equals(star)) {
- followup.setStarLevel(new BigDecimal(2));
- }else if ("4".equals(star)) {
- followup.setStarLevel(new BigDecimal(3));
- }else if ("5".equals(star)) {
- followup.setStarLevel(new BigDecimal(4));
- }else if ("6".equals(star)) {
- followup.setStarLevel(new BigDecimal(5));
- }
- followupList.add(followup);
- handleMappedData(businessId,followupList);
- JSONObject jsonObject = new JSONObject();
- jsonObject.put("code",0);
- jsonObject.put("msg","成功");
- return jsonObject;
- }
- private void sendGetRequestSXRKX(String productBizId,String busiId,String url){
- JSONObject param = SignUtil.generateSign(81, 43, "730969D3F673BA42432C574378B9A8F1");
- log.info("busiId:{},:山西瑞凯鑫 url:{} ,jsonString:{}" ,busiId, url,param);
- String responseStr = HttpClientThreeUtil.post(url, JSON.toJSONString(param));
- JSONObject jsonObject = JSON.parseObject(responseStr);
- List<CustomerFollowup> followupList = new ArrayList<>();
- if (jsonObject.getIntValue("code") == 0) {
- JSONObject data = jsonObject.getJSONObject("data");
- JSONArray list = data.getJSONArray("list");
- if (CollectionUtils.isEmpty(list)) {
- log.info("busiId:{} 山西瑞凯鑫 list为空 没有星级数据", busiId);
- return;
- }
- for (int i = 0; i < list.size(); i++) {
- JSONObject item = list.getJSONObject(i);
- CustomerFollowup customerFollowup = new CustomerFollowup();
- customerFollowup.setBusiId(busiId);
- customerFollowup.setProductBizId(Integer.parseInt(productBizId));
- customerFollowup.setCustomerName(item.getString("name"));
- customerFollowup.setStarLevel(new BigDecimal(item.getIntValue("stars")));
- customerFollowup.setFollowStatus(item.getString("statusStr"));
- customerFollowup.setFollowRemark(item.getString("remark"));
- String mobile = item.getString("mobile");
- if (StringUtils.isEmpty(mobile)) {
- log.error("busiId:{} 山西瑞凯鑫 手机号为空",busiId);
- continue;
- }
- customerFollowup.setPhoneMd5(DigestUtils.md5Hex(mobile));
- customerFollowup.setFollowTime(new Date());
- followupList.add(customerFollowup);
- }
- }
- if (CollectionUtils.isEmpty(followupList)) {
- log.info("busiId:{} 山西瑞凯鑫 无星级数据", busiId);
- return;
- }
- log.info("busiId:{} 山西瑞凯鑫 处理数据条:{}", busiId, followupList.size());
- handleMappedData(busiId,followupList);
- }
- private void sendGetRequestCQYXJ(String productBizId,String busiId,String url,List<String> md5ListCQYXJ,String accessKey,Integer channelType){
- JSONObject jsonObject = new JSONObject();
- jsonObject.put("accessKey", accessKey);
- jsonObject.put("channelType", channelType);
- jsonObject.put("phoneMd5List", md5ListCQYXJ);
- String jsonString = JSON.toJSONString(jsonObject);
- log.info("busiId:{},:重庆优兴嘉 jsonString:{}" ,busiId, jsonString);
- String responseStr = HttpClientThreeUtil.post(url, jsonString);
- JSONObject response = JSON.parseObject(responseStr);
- String code = response.getString("code");
- if (!"200".equals(code)) {
- log.info("重庆优兴嘉 返回数据错误: " + response.getString("msg"));
- return ;
- }
- JSONArray dataArray = response.getJSONArray("data");
- List<CustomerFollowup> followupList = new ArrayList<>();
- if (CollectionUtils.isEmpty(dataArray)) {
- log.info("busiId:{},:重庆优兴嘉 今天没有星级数据",busiId);
- return;
- }
- for (int i = 0; i < dataArray.size(); i++) {
- JSONObject obj = dataArray.getJSONObject(i);
- CustomerFollowup followup = new CustomerFollowup();
- followup.setPhoneMd5(obj.getString("phoneMd5"));
- followup.setBusiId(busiId);
- followup.setProductBizId(Integer.parseInt(productBizId));
- followup.setFollowTime(new Date());
- followup.setSourceType(3);
- String star = obj.getString("grade");
- if (StringUtils.isEmpty(star)) {
- log.info("busiId:{} 重庆优兴嘉 mobile_md5{} 没有填星级:", busiId, followup.getPhoneMd5());
- continue;
- } else {
- if ("0".equals(star)) {
- followup.setStarLevel(new BigDecimal(0));
- } else if ("10".equals(star)) {
- followup.setStarLevel(new BigDecimal(1));
- }else if ("20".equals(star)) {
- followup.setStarLevel(new BigDecimal(2));
- }else if ("30".equals(star)) {
- followup.setStarLevel(new BigDecimal(3));
- }else if ("40".equals(star)) {
- followup.setStarLevel(new BigDecimal(4));
- }else if ("50".equals(star)) {
- followup.setStarLevel(new BigDecimal(5));
- }
- }
- followupList.add(followup);
- }
- if (CollectionUtils.isEmpty(followupList)) {
- log.info("busiId:{} 重庆优兴嘉 无星级数据", busiId);
- return;
- }
- log.info("busiId:{} 重庆优兴嘉 处理数据条:{}", busiId, followupList.size());
- handleMappedData(busiId,followupList);
- }
- private void sendGetRequestJXJJG(String productBizId,String busiId,String url,List<String> md5ListJXJJG){
- StringBuilder stringBuilder = new StringBuilder();
- Map<String, String> map = new HashMap<>();
- for (int i = 0; i < md5ListJXJJG.size(); i++) {
- stringBuilder.append(md5ListJXJJG.get(i));
- if (i < md5ListJXJJG.size() - 1) {
- stringBuilder.append(",");
- }
- }
- map.put("channel_code", "12");
- map.put("md5_phone_list", stringBuilder.toString());
- String jsonString = JSON.toJSONString(map);
- log.info("busiId:{},:江西聚金阁 jsonString:{}" ,busiId, jsonString);
- String responseStr = HttpClientThreeUtil.post(url, jsonString);
- JSONObject response = JSON.parseObject(responseStr);
- String code = response.getString("code");
- if (!"1".equals(code)) {
- log.info("江西聚金阁 返回数据错误: " + response.getString("msg"));
- return ;
- }
- JSONArray dataArray = response.getJSONArray("data");
- List<CustomerFollowup> followupList = new ArrayList<>();
- if (CollectionUtils.isEmpty(dataArray)) {
- log.info("busiId:{},:江西聚金阁 今天没有星级数据",busiId);
- return;
- }
- for (int i = 0; i < dataArray.size(); i++) {
- JSONObject obj = dataArray.getJSONObject(i);
- CustomerFollowup followup = new CustomerFollowup();
- followup.setPhoneMd5(obj.getString("phoneMd5"));
- followup.setBusiId(busiId);
- followup.setProductBizId(Integer.parseInt(productBizId));
- followup.setFollowTime(new Date());
- followup.setSourceType(3);
- String star = obj.getString("star");
- if (StringUtils.isEmpty(star)) {
- log.info("busiId:{} 江西聚金阁 mobile_md5{} 没有填星级:", busiId, followup.getPhoneMd5());
- continue;
- } else {
- if ("0".equals(star)) {
- followup.setStarLevel(new BigDecimal(0));
- } else if ("1".equals(star)) {
- followup.setStarLevel(new BigDecimal(1));
- }else if ("2".equals(star) || "3".equals(star)) {
- followup.setStarLevel(new BigDecimal(2));
- }else if ("4".equals(star)) {
- followup.setStarLevel(new BigDecimal(3));
- }else if ("5".equals(star)) {
- followup.setStarLevel(new BigDecimal(4));
- }else if ("6".equals(star)) {
- followup.setStarLevel(new BigDecimal(5));
- }
- }
- followupList.add(followup);
- }
- if (CollectionUtils.isEmpty(followupList)) {
- log.info("busiId:{} 江西聚金阁 无星级数据", busiId);
- return;
- }
- log.info("busiId:{} 江西聚金阁 处理数据条:{}", busiId, followupList.size());
- handleMappedData(busiId,followupList);
- }
- private void sendGetRequestFoShan(String productBizId,String busiId,String url,List<String> md5ListFS){
- List<Map<String, String>> jsonList = new ArrayList<>();
- for (String md5 : md5ListFS) {
- Map<String, String> map = new HashMap<>();
- map.put("source", "hr");
- map.put("mobile_md5", md5);
- jsonList.add(map);
- }
- String jsonString = JSON.toJSONString(jsonList);
- log.info("busiId:{},:佛山市创智盈通企业管理有限公司 jsonString:{}" ,busiId, jsonString);
- String responseStr = HttpClientThreeUtil.post(url, jsonString);
- JSONObject response = JSON.parseObject(responseStr);
- String code = response.getString("code");
- if (!"200".equals(code)) {
- log.info("佛山市创智盈通企业管理有限公司 返回数据错误: " + response.getString("msg"));
- return ;
- }
- JSONArray dataArray = response.getJSONArray("data");
- List<CustomerFollowup> followupList = new ArrayList<>();
- if (CollectionUtils.isEmpty(dataArray)) {
- log.info("busiId:{},:佛山市创智盈通企业管理有限公司 今天没有星级数据",busiId);
- return;
- }
- for (int i = 0; i < dataArray.size(); i++) {
- JSONObject obj = dataArray.getJSONObject(i);
- CustomerFollowup followup = new CustomerFollowup();
- followup.setPhoneMd5(obj.getString("mobile_md5"));
- followup.setBusiId(busiId);
- followup.setProductBizId(Integer.parseInt(productBizId));
- followup.setFollowTime(new Date());
- followup.setSourceType(3);
- String star = obj.getString("industry");
- if (StringUtils.isEmpty(star)) {
- log.info("busiId:{} 佛山创智盈通企业管理有限公司 mobile_md5{} 没有填星级:", busiId, followup.getPhoneMd5());
- continue;
- } else {
- 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));
- }
- }
- followupList.add(followup);
- }
- if (CollectionUtils.isEmpty(followupList)) {
- log.info("busiId:{} 佛山创智盈通企业管理有限公司 无星级数据", busiId);
- return;
- }
- log.info("busiId:{} 佛山创智盈通企业管理有限公司 处理数据条:{}", busiId, followupList.size());
- handleMappedData(busiId,followupList);
- }
- // public void sendGetRequestHeiLongJiang(String productBizId, String busiId, String url, List<String> md5ListHLJJC){
- // List<Map<String, String>> jsonList = new ArrayList<>();
- // for (String md5 : md5ListHLJJC) {
- // Map<String, String> map = new HashMap<>();
- // map.put("source", "迅速邦");
- // map.put("mobile_md5", md5);
- // jsonList.add(map);
- // }
- // String jsonString = JSON.toJSONString(jsonList);
- // log.info("busiId:{},:黑龙江省景琛信息咨询有限公司 jsonString:{}" ,busiId, jsonString);
- //
- // String responseStr = HttpClientThreeUtil.post(url, jsonString);
- // JSONObject response = JSON.parseObject(responseStr);
- // String code = response.getString("code");
- // if (!"200".equals(code)) {
- // log.info("黑龙江省景琛信息咨询有限公司 返回数据错误: " + response.getString("msg"));
- // return ;
- // }
- // JSONArray dataArray = response.getJSONArray("data");
- // List<CustomerFollowup> followupList = new ArrayList<>();
- // if (CollectionUtils.isEmpty(dataArray)) {
- // log.info("busiId:{},:黑龙江省景琛信息咨询有限公司 今天没有星级数据",busiId);
- // return;
- // }
- //
- // for (int i = 0; i < dataArray.size(); i++) {
- // JSONObject obj = dataArray.getJSONObject(i);
- // CustomerFollowup followup = new CustomerFollowup();
- // followup.setPhoneMd5(obj.getString("mobile_md5"));
- // followup.setBusiId(busiId);
- // followup.setProductBizId(Integer.parseInt(productBizId));
- // followup.setFollowTime(new Date());
- // followup.setSourceType(3);
- // String star = obj.getString("industry");
- // if (StringUtils.isEmpty(star)) {
- // log.info("busiId:{} 黑龙江省景琛信息咨询有限公司 mobile_md5{} 没有填星级:", busiId, followup.getPhoneMd5());
- // continue;
- // } 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));
- // }
- // }
- // followupList.add(followup);
- // }
- //
- // if (CollectionUtils.isEmpty(followupList)) {
- // log.info("busiId:{} 黑龙江省景琛信息咨询有限公司 无星级数据", busiId);
- // return;
- // }
- // log.info("黑龙江省景琛信息咨询有限公司:{}", followupList);
- // log.info("busiId:{} 黑龙江省景琛信息咨询有限公司 处理数据条:{}", busiId, followupList.size());
- // handleMappedData(busiId,followupList);
- //
- // }
- //融享客通用
- private void sendGetRequestGZWA(String productBizId,String busiId,String url,String channelType,String accessKey,String companyName,List<String> md5ListGZWA){
- JSONObject object = new JSONObject();
- object.put("accessKey",accessKey);
- object.put("channelType", channelType);
- object.put("phoneMd5List", md5ListGZWA);
- String jsonString = JSON.toJSONString(object);
- log.info("星级回传请求参数{}:{}",companyName,jsonString);
- String responseStr = HttpClientThreeUtil.post(url, jsonString);
- JSONObject response = JSON.parseObject(responseStr);
- 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<>();
- // 遍历 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("phoneMd5"));
- String star = obj.getString("grade");
- if (StringUtils.isEmpty(star)) {
- log.info("busiId:{} companyName {}, mobile_md5{} 没有填星级:", busiId, companyName ,followup.getPhoneMd5());
- continue;
- } else {
- if ("0".equals(star)) {
- followup.setStarLevel(new BigDecimal(0));
- } else if ("10".equals(star)) {
- followup.setStarLevel(new BigDecimal(1));
- }else if ("20".equals(star)) {
- followup.setStarLevel(new BigDecimal(2));
- }else if ("30".equals(star)) {
- followup.setStarLevel(new BigDecimal(3));
- }else if ("40".equals(star)) {
- followup.setStarLevel(new BigDecimal(4));
- }else if ("50".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);
- }
- //https://api.zhudaicms.com/ 通用
- private void sendGetRequestHz(String productBizId,String busiId,String url,String companyName){
- String responseStr = HttpClientThreeUtil.get(url,null);
- JSONObject response = JSON.parseObject(responseStr);
- String code = response.getString("code");
- if (!"101".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<>();
- // 遍历 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("md5mobile"));
- followup.setStarLevel(new BigDecimal(obj.getString("stars")));
- 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 sendDalian(String productBizId,String busiId,String url,List<ThirdStarDto> thirdStarDtos){
- if (CollectionUtils.isEmpty(thirdStarDtos)) {
- return;
- }
- List<CustomerFollowup> list = new ArrayList<>();
- Map<String, String> map = new HashMap();
- JSONObject response = null;
- String joined = thirdStarDtos.stream()
- .map(ThirdStarDto::getUniqueIdentify)
- .collect(Collectors.joining(","));
- map.put("app_id", "18");
- map.put("timestamp", String.valueOf(System.currentTimeMillis()/1000));
- map.put("unique_id", joined);
- String sign = makeSign(map, "0xUGDHmMeiCYU7yyVgvSCeTMCillkDLZ");
- map.put("sign", sign);
- log.info("【大连青宁】请求前参数:{}",map);
- String responseStr = HttpClientThreeUtil.post(url, JSON.toJSONString(map));
- response = JSON.parseObject(responseStr);
- log.info("【大连青宁】响应数据:{}",response);
- if (response.getInteger("code") == 200) {
- JSONArray data = response.getJSONArray("data");
- Map<String, ThirdStarDto> dtoMap = thirdStarDtos.stream()
- .collect(Collectors.toMap(ThirdStarDto::getUniqueIdentify, Function.identity(), (a, b) -> a));
- for (int i = 0; i < data.size(); i++) {
- JSONObject obj = data.getJSONObject(i);
- String uniqueId = obj.getString("unique_id");
- Integer star = obj.getInteger("star");
- ThirdStarDto dto = dtoMap.get(uniqueId);
- if (dto != null) {
- CustomerFollowup followup = new CustomerFollowup();
- followup.setStarLevel(new BigDecimal(star));
- followup.setPhoneMd5(dto.getPhoneMd5());
- followup.setBusiId(busiId);
- followup.setProductBizId(Integer.parseInt(productBizId));
- followup.setFollowTime(new Date());
- followup.setSourceType(3);
- list.add(followup);
- } else {
- log.warn("未匹配到 unique_id={} 对应的 ThirdStarDto", uniqueId);
- }
- }
- }
- log.info("busiId:{} 处理数据条:{}", busiId, list.size());
- handleMappedData(busiId,list);
- }
- private void sendHeFei(String productBizId,String busiId,String url,List<ThirdStarDto> thirdStarDtos){
- if (CollectionUtils.isEmpty(thirdStarDtos)) {
- return;
- }
- List<CustomerFollowup> list = new ArrayList<>();
- Map<String, String> map = new HashMap();
- JSONObject response = null;
- String joined = thirdStarDtos.stream()
- .map(ThirdStarDto::getUniqueIdentify)
- .collect(Collectors.joining(","));
- map.put("app_id", "80");
- map.put("timestamp", String.valueOf(System.currentTimeMillis()/1000));
- map.put("unique_id", joined);
- String sign = makeSign(map, "38b1924a86ca479c842953ff59f724be");
- map.put("sign", sign);
- log.info("【合肥裕之丰】请求前参数:{}",map);
- String responseStr = HttpClientThreeUtil.post(url, JSON.toJSONString(map));
- response = JSON.parseObject(responseStr);
- log.info("【合肥裕之丰】响应数据:{}",response);
- if (response.getInteger("code") == 200) {
- JSONArray data = response.getJSONArray("data");
- Map<String, ThirdStarDto> dtoMap = thirdStarDtos.stream()
- .collect(Collectors.toMap(ThirdStarDto::getUniqueIdentify, Function.identity(), (a, b) -> a));
- for (int i = 0; i < data.size(); i++) {
- JSONObject obj = data.getJSONObject(i);
- String uniqueId = obj.getString("unique_id");
- Integer star = obj.getInteger("star");
- ThirdStarDto dto = dtoMap.get(uniqueId);
- if (dto != null) {
- CustomerFollowup followup = new CustomerFollowup();
- followup.setStarLevel(new BigDecimal(star));
- followup.setPhoneMd5(dto.getPhoneMd5());
- followup.setBusiId(busiId);
- followup.setProductBizId(Integer.parseInt(productBizId));
- followup.setFollowTime(new Date());
- followup.setSourceType(3);
- list.add(followup);
- } else {
- log.warn("未匹配到 unique_id={} 对应的 ThirdStarDto", uniqueId);
- }
- }
- }
- log.info("busiId:{} 处理数据条:{}", busiId, list.size());
- handleMappedData(busiId,list);
- }
- public static void main(String[] args) {
- Map<String, String> map = new HashMap();
- map.put("app_id", "45");
- map.put("timestamp", String.valueOf(System.currentTimeMillis()/1000));
- map.put("unique_id", "hryk1744092978");
- String sign = makeSign(map, "THITVXdSPQRQzArVwtssyD4uMdQIUxEY");
- map.put("sign", sign);
- System.out.println(map);
- }
- public static String makeSign(Map<String, String> args, String token) {
- if (args == null || token == null) {
- return "";
- }
- Map<String, String> sortedArgs = new TreeMap<>(args);
- StringBuilder signStr = new StringBuilder();
- for (Map.Entry<String, String> entry : sortedArgs.entrySet()) {
- String key = entry.getKey();
- String value = entry.getValue();
- if (value != null && !value.isEmpty()) {
- signStr.append(key).append(value);
- }
- }
- System.out.println(signStr.toString());
- return md5(md5(signStr.toString()) + token).toUpperCase();
- }
- private static String md5(String str) {
- try {
- MessageDigest md = MessageDigest.getInstance("MD5");
- md.update(str.getBytes());
- byte[] digest = md.digest();
- StringBuilder sb = new StringBuilder();
- for (byte b : digest) {
- sb.append(String.format("%02x", b & 0xff));
- }
- return sb.toString();
- } catch (NoSuchAlgorithmException e) {
- e.printStackTrace();
- return "";
- }
- }
- private void sendGetRequest(String productBizId,String busiId,String url,List<String> md5s){
- List<CustomerFollowup> list = new ArrayList<>();
- JSONObject map = new JSONObject();
- JSONObject response = null;
- for (String md5 : md5s) {
- map.put("customer_phone", md5);
- map.put("customer_source", "LCD-HX");
- String responseStr = HttpClientThreeUtil.post(url, map.toJSONString());
- response = JSON.parseObject(responseStr);
- if (response.getInteger("code") == 1) {
- JSONObject data = response.getJSONObject("data");
- CustomerFollowup param = new CustomerFollowup();
- JSONArray logList = data.getJSONArray("log_list");
- if (CollectionUtils.isNotEmpty(logList)) {
- StringBuilder result = new StringBuilder();
- for (int i = 0; i < logList.size(); i++) {
- JSONObject logEntry = logList.getJSONObject(i);
- String logTime = logEntry.getString("log_time");
- String content = logEntry.getString("content");
- result.append(logTime).append("-").append(content);
- if (i < logList.size() - 1) {
- result.append(";");
- }
- }
- param.setFollowRemark(result.toString());
- }
- param.setPhoneMd5(md5);
- param.setStarLevel(data.getBigDecimal("customer_starlevel"));
- param.setProductBizId(Integer.parseInt(productBizId));
- param.setBusiId(busiId);
- param.setSourceType(3);
- list.add(param);
- } else {
- log.warn("url:{} ,productBizId:{},md5:{} 获取结果失败",url,productBizId,md5);
- }
- }
- log.info("busiId:{} 处理数据条:{}", busiId, list.size());
- handleMappedData(busiId,list);
- }
- private void handleMappedData(String busiId,List<CustomerFollowup> data) {
- log.info("busiId:{} 【CasllBackDataProcessor】成功处理 {} 条映射数据 明细:{}",busiId, data.size(), data);
- String post = HttpClientThreeUtil.post(url, JSON.toJSONString(data));
- log.info("busiId:{}【CasllBackDataProcessor】post结果:{}",busiId, post);
- }
- }
|