瀏覽代碼

去除打印

yumeng 4 年之前
父節點
當前提交
80fb7ec351

File diff suppressed because it is too large
+ 0 - 1
jeecg-boot-base-common/src/main/java/org/jeecg/common/util/MD5Util.java


+ 0 - 2
jeecg-boot-module-system/src/main/java/org/jeecg/modules/opencv/utils/CornerCheck.java

@@ -220,8 +220,6 @@ public class CornerCheck {
             List<Point> checkPoints = new ArrayList<>();
             Point rightDown = cornerPoints.get(cornerPoints.size() - 1);
             for (Point point : cornerPoints) {
-//                System.out.println("cornerPoint:" + point.toString());
-//                System.out.println(imageGR.get((int) point.y, (int) point.x)[1]);
                 if (imageGR.get((int) point.y, (int) point.x)[1] >= 120) {
                     if (point.x <= rightDown.x) {
                         checkPoints.add(point);

+ 21 - 27
module-common/src/main/java/cn/com/ctop/common/module/utils/HttpUtils.java

@@ -188,7 +188,7 @@ public class HttpUtils {
                 }
             }
             List<NameValuePair> paramList = new ArrayList<NameValuePair>();
-            if (param != null){
+            if (param != null) {
                 for (String key : param.keySet()) {
                     BasicNameValuePair basicNameValuePair = new BasicNameValuePair(key, String.valueOf(param.get(key)));
                     paramList.add(basicNameValuePair);
@@ -415,22 +415,20 @@ public class HttpUtils {
         return strReturn;
     }
 
-    public static void main(String[] args){
+    public static void main(String[] args) {
         String res = HttpUtils.getKuaishouShareUrl("http://yongzhou.s.gifshow.com/i/photo/lwx?userId=1400097524&photoId=5191805968879099278");
         String path = res.split("\\?")[0];
-        String photoId = path.substring(path.lastIndexOf("/")+1,path.length());
-        path =path.substring(0,path.lastIndexOf("/"));
-        String uid = path.substring(path.lastIndexOf("/")+1,path.length());
-        System.out.println(uid);
-        System.out.println(photoId);
-        res = HttpUtils.postKuaishouVideoUrl("https://live.kuaishou.com/m_graphql",uid,photoId);
-        System.out.println(res);
+        String photoId = path.substring(path.lastIndexOf("/") + 1, path.length());
+        path = path.substring(0, path.lastIndexOf("/"));
+        String uid = path.substring(path.lastIndexOf("/") + 1, path.length());
+
+        res = HttpUtils.postKuaishouVideoUrl("https://live.kuaishou.com/m_graphql", uid, photoId);
     }
 
-    public static String postKuaishouVideoUrl(String url,String uid,String photoId){
+    public static String postKuaishouVideoUrl(String url, String uid, String photoId) {
         HttpClient httpClient = createSslClientDefault();
         String strReturn = "";
-        String paramBody = "{\"operationName\":\"FeedQuery\",\"variables\":{\"principalId\":\""+uid+"\",\"photoId\":\""+photoId+"\"},\"query\":\"query FeedQuery($principalId: String, $photoId: String) {\\n  feedById(principalId: $principalId, photoId: $photoId) {\\n    currentWork {\\n                 timestamp\\n           __typename\\n    }\\n       __typename\\n  }\\n}\\n\"}";
+        String paramBody = "{\"operationName\":\"FeedQuery\",\"variables\":{\"principalId\":\"" + uid + "\",\"photoId\":\"" + photoId + "\"},\"query\":\"query FeedQuery($principalId: String, $photoId: String) {\\n  feedById(principalId: $principalId, photoId: $photoId) {\\n    currentWork {\\n                 timestamp\\n           __typename\\n    }\\n       __typename\\n  }\\n}\\n\"}";
         try {
             HttpPost httppost = new HttpPost(url);
             httppost.setHeader("User-Agent", USER_AGENT);
@@ -454,7 +452,8 @@ public class HttpUtils {
         }
         return strReturn;
     }
-    public static String getKuaishouShareUrl(String url){
+
+    public static String getKuaishouShareUrl(String url) {
         HttpClient httpClient = HttpClientBuilder.create().build();
         HttpResponse response = null;
         HttpGet httpGet = new HttpGet(url);
@@ -470,10 +469,8 @@ public class HttpUtils {
             httpGet.setHeader("Accept-Language", "zh-CN,zh;q=0.9");
             response = httpClient.execute(httpGet);
             int statusCode = response.getStatusLine().getStatusCode();
-            System.out.println(statusCode);
             if (statusCode == HttpStatus.SC_MOVED_PERMANENTLY || statusCode == HttpStatus.SC_MOVED_TEMPORARILY) {
                 String newUrl = response.getFirstHeader("Location").getValue();
-                System.out.println(newUrl);
                 return newUrl;
             }
 
@@ -492,10 +489,8 @@ public class HttpUtils {
             httpGet.setHeader("User-Agent", USER_AGENT);
             response = httpClient.execute(httpGet);
             int statusCode = response.getStatusLine().getStatusCode();
-            System.out.println(statusCode);
             if (statusCode == HttpStatus.SC_MOVED_PERMANENTLY || statusCode == HttpStatus.SC_MOVED_TEMPORARILY) {
                 String newUrl = response.getFirstHeader("Location").getValue();
-                System.out.println(newUrl);
                 return httpGetRequest(newUrl);
             } else if (statusCode == HttpStatus.SC_OK) {
                 BufferedReader reader = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
@@ -768,9 +763,9 @@ public class HttpUtils {
             HttpResponse response = httpclient.execute(httpget);
             respEntity = response.getEntity();
             Header[] responseHeaders = response.getHeaders("Set-Cookie");
-            if(responseHeaders != null){
+            if (responseHeaders != null) {
 
-                for(Header header : responseHeaders){
+                for (Header header : responseHeaders) {
                     String[] ckArray = header.getValue().split(";");
                     BasicClientCookie ck = new BasicClientCookie(ckArray[0].split("=")[0], ckArray[0].split("=")[1]);
                     ck.setPath(ckArray[1].split("=")[1]);
@@ -871,11 +866,12 @@ public class HttpUtils {
         return strReturn;
     }
 
-    public static JSONObject feishuGetRequest(String url, JSONObject params){
-        return feishuGetRequest(null,url,params);
+    public static JSONObject feishuGetRequest(String url, JSONObject params) {
+        return feishuGetRequest(null, url, params);
     }
-    public static JSONObject feishuPostRequest(String url,JSONObject params){
-        return feishuPostRequest(null,url,params);
+
+    public static JSONObject feishuPostRequest(String url, JSONObject params) {
+        return feishuPostRequest(null, url, params);
     }
 
     public static String feishuGetRequestString(String url) {
@@ -922,7 +918,6 @@ public class HttpUtils {
     }
 
     public static JSONObject feishuGetRequest(String accessToken, String url, JSONObject params) {
-        System.out.println(url);
         // 构造请求
         HttpEntityEnclosingRequestBase httpEntity = new HttpEntityEnclosingRequestBase() {
             @Override
@@ -930,7 +925,7 @@ public class HttpUtils {
                 return "GET";
             }
         };
-        if(accessToken != null){
+        if (accessToken != null) {
             httpEntity.setHeader("Authorization", accessToken);
         }
         CloseableHttpResponse response = null;
@@ -938,7 +933,7 @@ public class HttpUtils {
         try {
             client = HttpClientBuilder.create().build();
             httpEntity.setURI(URI.create(url));
-            if (params != null){
+            if (params != null) {
                 httpEntity.setEntity(new StringEntity(params.toJSONString(), ContentType.APPLICATION_JSON));
             }
             RequestConfig requestConfig = RequestConfig.custom().setSocketTimeout(12000).setConnectTimeout(12000).build();
@@ -972,11 +967,10 @@ public class HttpUtils {
     }
 
 
-
     public static JSONObject feishuPostRequest(String accessToken, String url, JSONObject params) {
         // 构造请求
         HttpPost httpEntity = new HttpPost(url);
-        if(accessToken != null){
+        if (accessToken != null) {
             httpEntity.setHeader("Authorization", accessToken);
         }
         CloseableHttpResponse response = null;

+ 0 - 9
module-crawler/src/main/java/cn/com/ctop/crawler/modules/core/service/impl/KuaishouCrawlerServiceImpl.java

@@ -125,15 +125,6 @@ public class KuaishouCrawlerServiceImpl implements IKuaishouCrawlerService {
         return crawlerLog.getRequestBody();
     }
 
-    public static void main(String[] args){
-        KuaishouCrawlerServiceImpl kuaishouCrawlerService = new KuaishouCrawlerServiceImpl();
-        try {
-            System.out.println(kuaishouCrawlerService.musicSearchList("少年"));
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
-    }
-
     @Override
     public String getAdFeeds(){
         IpPool ipPool = iIpPoolService.getAvaliableIp();

+ 0 - 5
module-crawler/src/main/java/cn/com/ctop/crawler/modules/core/util/KuaishouUtil.java

@@ -43,11 +43,9 @@ public class KuaishouUtil {
         allMap.putAll(staticParams);
         allMap.putAll(dynamicParams);
         if (staticParams.get("kpf") != null && "ANDROID_PHONE".equals(staticParams.get("kpf"))) {
-            System.out.println(HttpParamUtil.mapToString(SortUtil.sortMapByKey(allMap), ignoreKeyList));
             String sig = SignUtil.getMd5Sign(HttpParamUtil.mapToString(SortUtil.sortMapByKey(allMap), ignoreKeyList), salt);
             dynamicParams.put("sig",sig);
             allMap.put("sig",sig);
-            System.out.println(sig);
         }
 
         String dynamicQueryString = HttpParamUtil.mapToUrlStringNoEncoder(dynamicParams,null);
@@ -76,7 +74,6 @@ public class KuaishouUtil {
             }
             CloseableHttpClient httpClient = HttpClients.custom().setDefaultCookieStore(cookieStore).setDefaultRequestConfig(globalConfig).setConnectionReuseStrategy((response, context) -> false ).setSSLSocketFactory(sslFactory).build();
             HttpPost httppost = new HttpPost(httpEntity.getUrl()+httpEntity.getPath()+"?"+staticQueryString);
-            System.out.println(httpEntity.getUrl()+httpEntity.getPath()+"?"+staticQueryString);
             HttpHeader header = httpEntity.getHttpHeader();
             Map<String,String> headers = header.getHeaders();
             if(headers != null){
@@ -85,12 +82,10 @@ public class KuaishouUtil {
                 }
             }
             httppost.setEntity(new StringEntity(dynamicQueryString));
-            System.out.println(dynamicQueryString);
             HttpResponse response = httpClient.execute(httppost);
             int code = response.getStatusLine().getStatusCode();
             org.apache.http.HttpEntity respentity = response.getEntity();
             String strReturn = EntityUtils.toString(respentity);
-            System.out.println(strReturn);
             long endTime = System.currentTimeMillis();
             crawlerLog.setUrl(httpEntity.getUrl());
             crawlerLog.setPath(httpEntity.getPath());

File diff suppressed because it is too large
+ 40 - 52
module-crawler/src/main/java/cn/com/ctop/crawler/modules/taobao/service/impl/TaobaoJhsbybtServiceImpl.java


+ 41 - 61
module-crawler/src/main/java/cn/com/ctop/crawler/modules/taobao/service/impl/TaobaoTttmServiceImpl.java

@@ -1,7 +1,6 @@
 package cn.com.ctop.crawler.modules.taobao.service.impl;
 
 import cn.com.ctop.common.module.utils.HttpUtils;
-import cn.com.ctop.crawler.modules.taobao.service.TaobaoJhsbybtService;
 import cn.com.ctop.crawler.modules.taobao.service.TaobaoTttmService;
 import com.fasterxml.jackson.databind.JsonNode;
 import com.fasterxml.jackson.databind.ObjectMapper;
@@ -16,68 +15,66 @@ import java.util.*;
 @Service
 public class TaobaoTttmServiceImpl implements TaobaoTttmService {
 
-    public String getGoodsList(int page){
+    public String getGoodsList(int page) {
         String url = "https://h5api.m.taobao.com/h5/mtop.panama.fiona.commonbizservice/1.1/";
-        Map<String,Object> paramMap = new HashMap<String,Object>();
-        paramMap.put("jsv","2.6.0");
-        paramMap.put("appKey","12574478");
-        paramMap.put("t",new Date().getTime());
-        paramMap.put("sign","56b679fe3a6de0cd4ffa8ccb8680ff83");
-        paramMap.put("timeout",3000);
-        paramMap.put("api","mtop.panama.fiona.commonbizservice");
-        paramMap.put("params","[object Object]");
-        paramMap.put("dataType","jsonp");
-        paramMap.put("v","1.0");
-        paramMap.put("preventFallback",true);
-        paramMap.put("type","jsonp");
-        paramMap.put("callback","mtopjsonp2");
-        paramMap.put("data","{\"bizCode\":\"home_feeds\",\"optStr\":\"preview=false;outerBackupKey=prod-home_feeds-currentPage_"+page+"\",\"currentPage\":"+page+",\"outerBackupKey\":\"prod-home_feeds-currentPage_"+page+"\"}");
-        Map<String,String> headerMap = new HashMap<String,String>();
-        headerMap.put("Accept-Encoding","gzip, deflate, br");
-        headerMap.put("Connection","keep-alive");
-        headerMap.put("User-Agent","Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.108 Safari/537.36");
-        headerMap.put("Accept","*/*");
-        headerMap.put("Content-Type","application/xml");
-        headerMap.put("Referer","https://market.m.taobao.com/app/tmall-def/jhsbybt/web/index.html?disableNav=YES&itemIds=617136337387&spm=608.14027681/8.bubbles.d0");
-        String result = HttpUtils.httpGet(url,paramMap,headerMap);
+        Map<String, Object> paramMap = new HashMap<String, Object>();
+        paramMap.put("jsv", "2.6.0");
+        paramMap.put("appKey", "12574478");
+        paramMap.put("t", new Date().getTime());
+        paramMap.put("sign", "56b679fe3a6de0cd4ffa8ccb8680ff83");
+        paramMap.put("timeout", 3000);
+        paramMap.put("api", "mtop.panama.fiona.commonbizservice");
+        paramMap.put("params", "[object Object]");
+        paramMap.put("dataType", "jsonp");
+        paramMap.put("v", "1.0");
+        paramMap.put("preventFallback", true);
+        paramMap.put("type", "jsonp");
+        paramMap.put("callback", "mtopjsonp2");
+        paramMap.put("data", "{\"bizCode\":\"home_feeds\",\"optStr\":\"preview=false;outerBackupKey=prod-home_feeds-currentPage_" + page + "\",\"currentPage\":" + page + ",\"outerBackupKey\":\"prod-home_feeds-currentPage_" + page + "\"}");
+        Map<String, String> headerMap = new HashMap<String, String>();
+        headerMap.put("Accept-Encoding", "gzip, deflate, br");
+        headerMap.put("Connection", "keep-alive");
+        headerMap.put("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.108 Safari/537.36");
+        headerMap.put("Accept", "*/*");
+        headerMap.put("Content-Type", "application/xml");
+        headerMap.put("Referer", "https://market.m.taobao.com/app/tmall-def/jhsbybt/web/index.html?disableNav=YES&itemIds=617136337387&spm=608.14027681/8.bubbles.d0");
+        String result = HttpUtils.httpGet(url, paramMap, headerMap);
         List<Cookie> cookieList = HttpUtils.COOKIESTORE.getCookies();
         String token = "";
         String cookie = "";
-        for (Cookie ck : cookieList){
-            if(ck.getName().equals("_m_h5_tk")){
+        for (Cookie ck : cookieList) {
+            if (ck.getName().equals("_m_h5_tk")) {
                 token = ck.getValue().split("_")[0];
             }
-            cookie = cookie + ck.getName()+"="+ck.getValue()+";";
+            cookie = cookie + ck.getName() + "=" + ck.getValue() + ";";
         }
-        String sign = DigestUtils.md5Hex(token+"&"+paramMap.get("t")+"&"+paramMap.get("appKey")+"&"+paramMap.get("data"));
-        paramMap.put("sign",sign);
-        headerMap.put("Cookie",cookie);
-        result = HttpUtils.httpGet(url,paramMap,headerMap);
+        String sign = DigestUtils.md5Hex(token + "&" + paramMap.get("t") + "&" + paramMap.get("appKey") + "&" + paramMap.get("data"));
+        paramMap.put("sign", sign);
+        headerMap.put("Cookie", cookie);
+        result = HttpUtils.httpGet(url, paramMap, headerMap);
         return result;
     }
 
-    public static void main(String[] args){
+    public static void main(String[] args) {
         try {
             PrintStream out = new PrintStream("D:/tttm0831.csv");
             System.setOut(out);
         } catch (FileNotFoundException e) {
             e.printStackTrace();
         }
-        System.out.println("商品id,商品名,销量,商品图,商品链接,优惠价,原价");
         TaobaoTttmServiceImpl tb = new TaobaoTttmServiceImpl();
         int i = 2;
         Boolean hasMore = true;
-        while (hasMore){
+        while (hasMore) {
             try {
                 String result = tb.getGoodsList(i);
-                result = result.replace("mtopjsonp2(","");
-                result = result.substring(0,result.length()-1);
-//                System.out.println(result);
+                result = result.replace("mtopjsonp2(", "");
+                result = result.substring(0, result.length() - 1);
                 ObjectMapper mapper = new ObjectMapper();
                 JsonNode rootNode = mapper.readTree(result);
                 Boolean success = rootNode.get("data").get("data").get("homeFeeds").isNull();
                 int size = rootNode.get("data").get("data").get("homeFeeds").size();
-                if(size == 0){
+                if (size == 0) {
                     hasMore = false;
                 }
 //                while (!success){
@@ -92,13 +89,13 @@ public class TaobaoTttmServiceImpl implements TaobaoTttmService {
 //                hasMore = rootNode.get("data").get("resultValue").get("8613423").get("data").get("hasMore").asBoolean();
                 Iterator<JsonNode> items = rootNode.get("data").get("data").get("homeFeeds").iterator();
 
-                while (items.hasNext()){
+                while (items.hasNext()) {
 
                     JsonNode itemNode = items.next();
                     String itemType = itemNode.get("itemType").asText();
-                    if (itemType.equals("rankList")){
+                    if (itemType.equals("rankList")) {
                         Iterator<JsonNode> subitems = itemNode.get("items").iterator();
-                        while (subitems.hasNext()){
+                        while (subitems.hasNext()) {
                             JsonNode subNode = subitems.next();
                             String cjmsItemName = subNode.get("shortName").asText();
                             Integer itemSoldInfo = 0;
@@ -112,17 +109,8 @@ public class TaobaoTttmServiceImpl implements TaobaoTttmService {
 //                    String cutPrice = itemNode.get("cutPrice").asText();
                             String itemUrl = subNode.get("itemHref").asText();
                             String itemId = subNode.get("itemId").asText();
-                            System.out.println(itemId+","+cjmsItemName+","+
-                                    itemSoldInfo+","+
-//                            brandLogo+","+
-                                    picUrl+","+
-//                            cjmsTaobaoEntrance+","+
-                                    itemUrl+","+
-                                    actPrice+","+
-//                            cutPrice+","+
-                                    orgPrice+",");
                         }
-                    }else if(itemType.equals("item")){
+                    } else if (itemType.equals("item")) {
                         String cjmsItemName = itemNode.get("shortName").asText();
                         Integer itemSoldInfo = itemNode.get("soldCount").asInt();
                         String picUrl = itemNode.get("preview").asText();
@@ -135,21 +123,13 @@ public class TaobaoTttmServiceImpl implements TaobaoTttmService {
 //                    String cutPrice = itemNode.get("cutPrice").asText();
                         String itemUrl = itemNode.get("itemHref").asText();
                         String itemId = itemNode.get("itemId").asText();
-                        System.out.println(itemId+","+cjmsItemName+","+
-                                itemSoldInfo+","+
-//                            brandLogo+","+
-                                picUrl+","+
-//                            cjmsTaobaoEntrance+","+
-                                itemUrl+","+
-                                actPrice+","+
-//                            cutPrice+","+
-                                orgPrice+",");
+
                     }
 
                 }
                 i++;
                 Thread.sleep(3000L);
-            }catch (Exception e){
+            } catch (Exception e) {
                 e.printStackTrace();
             }
         }

+ 0 - 1
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/impl/KuaishouReportDailyAgentServiceImpl.java

@@ -202,7 +202,6 @@ public class KuaishouReportDailyAgentServiceImpl extends ServiceImpl<KuaishouRep
             String postData = "{\"pageInfo\":{\"currentPage\":" + currentPage + ",\"pageSize\":200,\"total\":1000},\"reviewStatus\":\"-1\",\"selectType\":1,\"selectValue\":\"\",\"createBeginTime\":0,\"createEndTime\":0}";
             String listUrl = "https://agent.e.kuaishou.com/rest/dsp/agent/account/list";
             String result = HttpUtils2.httpPostRequestTest(listUrl, postData, headerMap);
-            System.out.println(result);
             ObjectMapper mapper = new ObjectMapper();
             mapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);
             JsonNode resultNode = mapper.readTree(result);