From b555f5a7d80de77de5ce43c1643ea2a6983a3586 Mon Sep 17 00:00:00 2001
From: jiangping <jp@doumee.com>
Date: 星期三, 24 七月 2024 17:35:14 +0800
Subject: [PATCH] 提交

---
 server/service/src/main/java/com/doumee/core/utils/Constants.java |  138 +++++++++++++++++++++++++++++++++++-----------
 1 files changed, 105 insertions(+), 33 deletions(-)

diff --git a/server/service/src/main/java/com/doumee/core/utils/Constants.java b/server/service/src/main/java/com/doumee/core/utils/Constants.java
index 0db86a1..433d72c 100644
--- a/server/service/src/main/java/com/doumee/core/utils/Constants.java
+++ b/server/service/src/main/java/com/doumee/core/utils/Constants.java
@@ -2,16 +2,35 @@
 
 
 import com.alibaba.fastjson.JSONObject;
+import com.doumee.core.constants.ResponseStatus;
+import com.doumee.core.exception.BusinessException;
 import com.doumee.dao.business.vo.UnitCodeVo;
 import com.fasterxml.jackson.annotation.JsonInclude;
 import com.fasterxml.jackson.core.JsonProcessingException;
 import com.fasterxml.jackson.databind.ObjectMapper;
 import com.fasterxml.jackson.databind.PropertyNamingStrategy;
+import okhttp3.OkHttpClient;
+import okhttp3.Request;
+import okhttp3.Response;
 import org.apache.commons.collections4.CollectionUtils;
 import org.apache.commons.lang3.StringUtils;
+import org.apache.http.client.methods.CloseableHttpResponse;
+import org.apache.http.client.methods.HttpGet;
+import org.apache.http.client.utils.URIBuilder;
+import org.apache.http.impl.client.CloseableHttpClient;
+import org.apache.http.impl.client.HttpClients;
+import org.apache.http.util.EntityUtils;
+import org.jsoup.Jsoup;
+import org.jsoup.nodes.Document;
+import org.jsoup.nodes.Element;
+import org.jsoup.select.Elements;
 
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
 import java.io.IOException;
+import java.io.InputStream;
 import java.math.BigDecimal;
+import java.net.URI;
 import java.net.URLDecoder;
 import java.text.SimpleDateFormat;
 import java.util.*;
@@ -38,9 +57,6 @@
     public static final String HK_ROOTORG_CODE ="HK_ROOTORG_CODE" ;
     public static final String HK_ROOTORG_NAME ="HK_ROOTORG_NAME" ;
     public static final String REDIS_TOKEN_KEY = "token_";
-    public static final String CUSTOMER = "CUSTOMER";    
-    public static final String BUSINESS = "BUSINESS";
-
 
     //琚嫓璁夸汉淇℃伅鏍¢獙鏂瑰紡锛�0鎵嬫満鍙峰崟鐙牎楠� 1鎵嬫満鍙峰拰濮撳悕缁勫悎鏍¢獙锛�
     public static final String ZBOM_CRM_AUTH_API_KEY = "ZBOM_CRM_AUTH_API_KEY";
@@ -93,6 +109,11 @@
     public static final String ZBOM = "ZBOM" ;
     public static final String ZBOM_IAM_APPKEY = "ZBOM_IAM_APPKEY";
     public static final String ZBOM_IAM_APPID = "ZBOM_IAM_APPID";
+    public static final String USER_CARD_HEADER_IMG ="USER_CARD_HEADER_IMG" ;
+    public static final String USER_CARD_PHONE_IMG ="USER_CARD_PHONE_IMG" ;
+    public static final String USER_CARD_ADDR_IMG ="USER_CARD_ADDR_IMG" ;
+    public static final String USER_CARD_SHOP_IMG ="USER_CARD_SHOP_IMG" ;
+    public static final String USER_CARD_LOGO_IMG ="USER_CARD_LOGO_IMG" ;
 
     public static Integer parseIntByStr(String idtOrgStatus) {
         try {
@@ -199,7 +220,7 @@
      *   鍒ゆ柇鏄惁涓烘湁鏁堣溅鐗屽彿
      */
     public static boolean checkCarNo(String str) {
-//        String patt="^[浜触娌笣鍐�璞簯杈介粦婀樼殩椴佹柊鑻忔禉璧i剛妗傜敇鏅嬭挋闄曞悏闂借吹宸濋潚钘忕惣瀹佺Е宸漖\\\\d{5}[A-Z]$";
+//        String patt="^[浜触娌笣鍐�璞簯杈介粦婀樼殩椴佹柊鑻忔禉璧i剛妗傜敇鏅嬭挋闄曞悏闂借吹宸濋潚钘忕惣瀹佺Е宸漖d{5}[A-Z]$";
 //        Pattern r = Pattern.compile(patt);
 //        Matcher matcher = r.matcher(str);
 //        String regex = "^[\u4e00-\u9fa5]{1}[A-Z]{1}[A-HJ-NP-Z]{1}[A-HJ-NP-Z0-9]{4}[D0-9X]$";
@@ -305,12 +326,18 @@
     public static final String ACCESS_ID="ACCESS_ID";
     public static final String BUCKETNAME = "BUCKETNAME";
     public static final String OBJCET_STORAGE = "OBJCET_STORAGE";
+    public static final String ZBOM_CUSTOMIZED = "ZBOM_CUSTOMIZED";
+
 
     public static final String ACCESS_KEY = "ACCESS_KEY";
     public static final String ENDPOINT = "ENDPOINT";
     public static final String RESOURCE_PATH = "RESOURCE_PATH";
+    public static final String WEIXIN_DEFAULT_IMGS = "WEIXIN_DEFAULT_IMGS";
+    public static final String USER_CARD_DEFAULT_IMG = "USER_CARD_DEFAULT_IMG";
     public static final String USERS_FILE = "USERS_FILE";
+    public static final String SHARES_FILE = "SHARES_FILE";
     public static final String NEWS_FILE = "NEWS_FILE";
+    public static final String USER_LABEL = "USER_LABEL";
     //鍙戦�佷細璁紑濮�  瀹氭椂鎻愬墠澶氬皯鍒嗛挓鍙戦��
 
     public static final String SYSTEM ="SYSTEM";
@@ -326,6 +353,7 @@
 
     public static final String WX_PLATFORM = "WX_PLATFORM";
     public static final String ZBOM_ZHONGTAI_API_URL = "ZBOM_ZHONGTAI_API_URL";
+    public static final String ZBOM_ZHONGTAI_SYS_API_URL = "ZBOM_ZHONGTAI_SYS_API_URL";
     public static final String WX_PLATFORM_ACCESS_TOKEN = "WX_PLATFORM_ACCESS_TOKEN";
     public static final String ZBOM_ENCODE_URL = "ZBOM_ENCODE_URL";
     public static final String WX_PLATFORM_APPID = "WX_PLATFORM_APPID";
@@ -341,10 +369,14 @@
 
 
     public static final String WX_MINI_CONFIG = "WX_MINI_CONFIG";
+    public static final String SHARE_HAIBAO_HEADER_TITLE = "SHARE_HAIBAO_HEADER_TITLE";
     public static final String WX_APPID_CUSTOMER = "WX_APPID_CUSTOMER";
     public static final String WX_SECRET_CUSTOMER = "WX_SECRET_CUSTOMER";
     public static final String WX_APPID_PERSONNEL = "WX_APPID_PERSONNEL";
     public static final String WX_SECRET_PERSONNEL = "WX_SECRET_PERSONNEL";
+    public static final String WX_TOKEN_CUSTOMER = "WX_TOKEN_CUSTOMER";
+    public static final String WX_TOKEN_PERSONNEL = "WX_TOKEN_PERSONNEL";
+    public static final String ZBOM_CRM_POSTCUS_API_KEY  = "ZBOM_CRM_POSTCUS_API_KEY";
 
 
     public interface RedisKeys {
@@ -358,6 +390,9 @@
        String ZBOM_ENCODE_URL ="ZBOM_ENCODE_URL";
        String ZBOM_SMS_API_KEY ="ZBOM_SMS_API_KEY";
        String ZBOM_ZHONGTAI_API_URL ="ZBOM_ZHONGTAI_API_URL";
+       String ZBOM_ZHONGTAI_SYS_API_URL ="ZBOM_ZHONGTAI_SYS_API_URL";
+       String ZBOM_CRM_POSTCUS_API_KEY ="ZBOM_CRM_POSTCUS_API_KEY";
+       String ZBOM_AREA_REDIS_KEY ="ZBOM_AREA_REDIS_KEY";
        String ZBOM_SMS_API_URL ="ZBOM_SMS_API_URL";
        String IAM_APPKEY ="IAM_APPKEY";
        String SHOP_TREE ="SHOP_TREE";
@@ -493,6 +528,11 @@
         return null;
     }
 
+    public static String desensitizationPhone(String phone)  {
+        return phone.replaceAll("(d{3})d{4}(d{4})", "$1****$2");
+    }
+
+
 
     public enum VehiclePlateNoEnum {
         /**
@@ -545,35 +585,7 @@
     }
 
     public static void main(String[] args) {
-        System.out.println((DESUtil.decrypt(Constants.EDS_PWD, "En35O2o+Mpw5bThqkT8lmE6UPG+W6LFs")));
-
-        Map<String,String> map = new HashMap<>();
-        map.put("101","蹇楅偊鏈儴");
-        map.put("102","鍒堕�犱簨涓氶儴");
-        map.put("103","鑲ヤ笢閿�鍞叕鍙�");
-        map.put("104","ZB/蹇楅偊鍘ㄦ煖");
-        map.put("105","鍟嗗搧浜嬩笟閮�");
-        map.put("106","宸㈡箹閿�鍞叕鍙�");
-        map.put("107","IK/鍏ㄥ眿瀹氬埗");
-        map.put("108","宸ョ▼浜嬩笟閮�");
-        map.put("109","鍚堣偉閿�鍞叕鍙�");
-        map.put("110","澶栬锤浜嬩笟閮�");
-        map.put("111","蹇楅偊瀹跺眳鍏徃");
-        map.put("112","ZB/蹇楅偊琛f煖");
-        map.put("127","蹇楅偊鍘ㄦ煖鑲′唤鏈夐檺鍏徃");
-        map.put("141","鍚堣偉蹇楅偊鏈ㄤ笟鏈夐檺鍏徃");
-        map.put("161","ZB/蹇楅偊鏈ㄩ棬");
-        map.put("263","鍥借锤鍏徃");
-        List<UnitCodeVo> list = new ArrayList<>();
-        Iterator<Map.Entry<String, String>> iterator = map.entrySet().iterator();
-        while (iterator.hasNext()) {
-            Map.Entry<String, String> entry = iterator.next();
-            UnitCodeVo m = new UnitCodeVo();
-            m.setCode(entry.getKey());
-            m.setName(entry.getValue());
-            list.add(m);
-        }
-System.out.println(JSONObject.toJSONString(list));
+         getImgsFromHtmlText("content: \"<p><img src=\"https://osswebcdn.zbom.com//zbkitchen/20240429/1973fb5c-58ea-4d51-b05f-87c7cd098d9e.jpg\"/></p><p><img src=\"https://osswebcdn.zbom.com//zbkitchen/20240429/04c46631-c42c-4b2f-9c92-df9ddb216f73.jpg\"/></p><p><img src=\"https://osswebcdn.zbom.com//zbkitchen/20240429/6dc9d538-d260-4970-8580-c248924e3d3f.jpg\"/></p><p><img src=\"https://osswebcdn.zbom.com//zbkitchen/20240429/a2ca4806-8d69-40c5-9a89-36381780369d.jpg\"/></p><p><img src=\"https://osswebcdn.zbom.com//zbkitchen/20240429/e9bf2963-5b52-411a-8348-c1259a3bd6d3.jpg\"/></p><p><img src=\"https://osswebcdn.zbom.com//zbkitchen/20240429/1872ed8b-35f7-4850-8aed-b3bf63573da6.jpg\"/></p><p><img src=\"https://osswebcdn.zbom.com//zbkitchen/20240429/afc39c7d-8c46-4f71-9212-6c8bc797c92c.jpg\"/></p><p><img src=\"https://osswebcdn.zbom.com//zbkitchen/20240429/78b11cda-fb5b-4983-aa6c-ed371bcd5dcc.jpg\"/></p><p><img src=\"https://osswebcdn.zbom.com//zbkitchen/20240429/f09b5a64-7d8a-423c-b423-f45d0e08e010.jpg\"/></p><p><br/></p>\"\n");
 
     }
 
@@ -658,4 +670,64 @@
 
         return sb.toString();
     }
+
+
+    public static InputStream generateWxMiniImgStream(String accessToken,String scene,String page) {
+        //鐢熸垚鍥剧墖涓婁紶OSS
+        Map<String,Object> body = new HashMap<>();
+        // 鍦烘櫙鐮侊紝涓庡墠绔害瀹氾紝鏈�缁堟槸闇�瑕佸墠绔В鏋�
+        body.put("scene", scene);
+        // 姝e紡鐗堜负 "release"锛屼綋楠岀増涓� "trial"锛屽紑鍙戠増涓� "develop"銆傞粯璁ゆ槸姝e紡鐗堛��
+        body.put("env_version", "develop");
+        body.put("page", page);
+        // 閫忔槑锛屾牴鎹綘鐨勫満鏅嚜琛岃缃産ody鍙傛暟
+        body.put("is_hyaline", true);
+        OkHttpClient client = new OkHttpClient().newBuilder().build();
+        okhttp3.MediaType mediaType = okhttp3.MediaType.parse("application/json");
+        okhttp3.RequestBody requestBody = okhttp3.RequestBody.create(mediaType, JSONObject.toJSONString(body));
+        Request request = new Request.Builder().url("https://api.weixin.qq.com/wxa/getwxacodeunlimit?access_token="+accessToken)
+                .method("POST", requestBody).build();
+        try {
+            Response response = client.newCall(request).execute();
+            if (response.isSuccessful()) {
+                InputStream inputStream = new ByteArrayInputStream(response.body().bytes());
+          /*      ByteArrayOutputStream baos = new ByteArrayOutputStream();
+                    byte[] buffer = new byte[1024];
+                    int len = -1;
+                    while ((len = inputStream.read(buffer)) != -1) {
+                        baos.write(buffer, 0, len);
+                    }
+                System.out.println("data:mediatype;base64," + Base64.getEncoder().encodeToString(baos.toByteArray()));*/
+                return inputStream;
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return  null;
+//        throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"鐢熸垚鍥剧墖澶辫触");
+    }
+
+
+
+    public  static  List<String>   getImgsFromHtmlText(String content) {
+        try {
+            if(StringUtils.isNotBlank(content)){
+                List<String> urls = new ArrayList<>();
+                Document doc = Jsoup.parse(content);
+                Elements imgElements = doc.select("img[src]");
+                for (Element imgElement : imgElements) {
+                    String imgUrl = imgElement.attr("src");
+                    System.out.println(imgUrl);
+                    urls.add(imgUrl);
+                }
+            return urls;
+        }
+        }catch (Exception e){
+          e.printStackTrace();
+        }
+        return  new ArrayList<>();
+    }
+
+
+
 }

--
Gitblit v1.9.3