浏览代码

5/17 修改支付回调路径

lrj 6 月之前
父节点
当前提交
d7f8a75ee6

+ 121 - 0
src/main/java/com/example/xiaoshiweixinback/business/utils/commonUtil/FormatUtil.java

@@ -0,0 +1,121 @@
+package com.example.xiaoshiweixinback.business.utils.commonUtil;
+
+
+import org.springframework.beans.BeanWrapper;
+import org.springframework.beans.BeanWrapperImpl;
+
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+public class FormatUtil {
+
+    private List<String> s;
+    private List<String> strs;
+
+    public static String toString(Object o) {
+        return o == null ? "" : o.toString();
+    }
+
+    public static String MD5(String src) {
+        // 需要加密的字符串
+        try {
+            // 加密对象,指定加密方式
+            MessageDigest md5 = MessageDigest.getInstance("md5");
+            // 准备要加密的数据
+            byte[] b = src.getBytes();
+            // 加密
+            byte[] digest = md5.digest(b);
+            // 十六进制的字符
+            char[] chars = new char[]{'0', '1', '2', '3', '4', '5',
+                    '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'};
+            StringBuffer sb = new StringBuffer();
+            // 处理成十六进制的字符串(通常)
+            for (byte bb : digest) {
+                sb.append(chars[(bb >> 4) & 15]);
+                sb.append(chars[bb & 15]);
+            }
+            return sb.toString();
+        } catch (NoSuchAlgorithmException e) {
+            e.printStackTrace();
+        }
+        return "";
+    }
+
+    public static String[] getNullPropertyNames(Object source) {
+        final BeanWrapper src = new BeanWrapperImpl(source);
+        java.beans.PropertyDescriptor[] pds = src.getPropertyDescriptors();
+        Set emptyNames = new HashSet();
+        for (java.beans.PropertyDescriptor pd : pds) {
+            //check if value of this property is null then add it to the collection
+            Object srcValue = src.getPropertyValue(pd.getName());
+            if (srcValue == null) {//特定字符写在此处过滤,收集不需要copy的字段列表。此处过滤null为例
+                emptyNames.add(pd.getName());
+            }
+        }
+        String[] result = new String[emptyNames.size()];
+        return (String[]) emptyNames.toArray(result);
+
+
+    }
+
+    public static String getPictureFormat(String appAn) {
+        return appAn + "_p";
+
+    }
+
+    public static String getPDFFormat(String appAn, Integer type) {
+        if (type.equals(0)) {
+            return appAn + "_public";
+        } else {
+            return appAn + "_grant";
+        }
+    }
+
+    public static List<String> getDistinctList(List<String> a, List<String> b) {
+        if (a == null || a.size() == 0 &&(b==null||b.size()==0)) {
+            return null;
+        } else if (b == null || b.size() == 0) {
+            return  new ArrayList<>(a);
+        }
+        else if(a==null||a.size()==0){
+            return new ArrayList<>(b);
+        }
+        a.addAll(b);
+        List<String> newList = new ArrayList<>(new HashSet<>(a));
+        return newList;
+    }
+
+
+    public static List<Integer> StringTOIntegerList(List<String> strs) {
+        List<Integer> integers =new ArrayList<>();
+        strs.forEach(item->{
+            integers.add(Integer.parseInt(item));
+        });
+        return  integers;
+    }
+
+    public static List<String> IntegerTOStringList(List<Integer> integers) {
+        List<String> strs =new ArrayList<>();
+        integers.forEach(item->{
+            strs.add(item.toString());
+        });
+        return  strs;
+    }
+    public static List<Integer> StringTOIntegerList(String str,String regex) {
+        List<Integer> reInteger =new ArrayList<>();
+        if (str==null||str.trim().equals("")){
+             return  reInteger;
+        }
+        String[] strings =str.split(regex);
+
+        for (int i=0;i<strings.length;i++){
+            reInteger.add(Integer.parseInt(strings[i]));
+        }
+
+        return  reInteger;
+    }
+}

+ 1 - 1
src/main/java/com/example/xiaoshiweixinback/controller/PatentController.java

@@ -114,7 +114,7 @@ public class PatentController {
     @Operation(summary = "根据专利号获取相关图片--zero")
     @PostMapping(value = "/getPictureByNo")
     public Response getPictureByNo(@RequestBody EsPictureNoDTO pictureNoDTO) throws Exception {
-        List<EsPictureNoVo> pictureByNo = esDenseVectorService.getPictureByNo(pictureNoDTO);
+        List<EsPictureNoVo> pictureByNo = esDenseVectorService.getPictureByNo3(pictureNoDTO);
         return Response.success(pictureByNo);
     }
 

+ 103 - 4
src/main/java/com/example/xiaoshiweixinback/service/importPatent/EsDenseVectorService.java

@@ -96,7 +96,7 @@ public class EsDenseVectorService {
     private EsPatentService esPatentService;
 
     @Autowired
-    private VipService vipService;
+    private PatentStarApiService patentStarApiService;
 
     @Autowired
     private RedisService redisService;
@@ -104,7 +104,8 @@ public class EsDenseVectorService {
     private String patentVectorName;
     @Value("${ES.patent}")
     private String patentMapName;
-
+    @Value("${ImageHttp}")
+    private String imageHttp;
     private final UseFunctionFactory useFunctionFactory;
     private final UseFunctionRecordService useFunctionRecordService;
     private static String FACTORY_CLASS = "checkQueryPatent";
@@ -134,7 +135,7 @@ public class EsDenseVectorService {
         }
 
         if (size != -1L && allNum > size) {
-            if (assoVipFunction==null||assoVipFunction.getVipType()==null||assoVipFunction.getVipType().equals(0)) {
+            if (assoVipFunction == null || assoVipFunction.getVipType() == null || assoVipFunction.getVipType().equals(0)) {
                 throw new BusinessException(ExceptionEnum.PERMISSION_NO_VIP, "未开通vip");
             } else {
                 throw new BusinessException(ExceptionEnum.PERMISSION_BEYOND_USETIME, "超过可查看专利数量");
@@ -247,7 +248,7 @@ public class EsDenseVectorService {
         builder.index(patentVectorName);
         Query query = QueryBuilders.term(i -> i.field("app_no").value(noDTO.getAppNo()));
         builder.query(query);
-        builder.size(30);
+        builder.size(300);
         SearchResponse<PatentVector> response = client.search(builder.build(), PatentVector.class);
         List<Hit<PatentVector>> hits = response.hits().hits();
         for (Hit<PatentVector> hit : hits) {
@@ -462,4 +463,102 @@ public class EsDenseVectorService {
         return records;
     }
 
+    /**
+     * 根据专利号获取相关图片
+     *
+     * @param noDTO
+     * @return
+     * @throws IOException
+     */
+    public List<EsPictureNoVo> getPictureByNo2(EsPictureNoDTO noDTO) throws Exception {
+        List<EsPictureNoVo> pictureNoVos = new ArrayList<>();
+        String no = noDTO.getAppNo();
+        if (no.startsWith("CN")) {
+            no = no.substring(2, 14);
+            System.out.println(no);
+            List<String> list = new ArrayList<>();
+            String wgPictureApi = patentStarApiService.getWGPictureApi(no);
+            if (StringUtils.isNotEmpty(wgPictureApi)) {
+                if (wgPictureApi.contains("|http")) {
+                    String[] urlArr = wgPictureApi.split("\\|");
+                    list.addAll(Arrays.asList(urlArr));
+                } else {
+                    list.add(wgPictureApi);
+                }
+            }
+            for (int i = 0; i < list.size(); i++) {
+                EsPictureNoVo noVo = new EsPictureNoVo();
+                noVo.setGuid(list.get(i));
+                noVo.setImageIndex(i);
+                pictureNoVos.add(noVo);
+            }
+            return pictureNoVos;
+        }
+        SearchRequest.Builder builder = new SearchRequest.Builder();
+        //设置查询索引
+        builder.index(patentVectorName);
+        Query query = QueryBuilders.term(i -> i.field("app_no").value(noDTO.getAppNo()));
+        builder.query(query);
+        builder.size(30);
+        SearchResponse<PatentVector> response = client.search(builder.build(), PatentVector.class);
+        List<Hit<PatentVector>> hits = response.hits().hits();
+        for (Hit<PatentVector> hit : hits) {
+            PatentVector vector = hit.source();
+            EsPictureNoVo noVo = new EsPictureNoVo();
+            noVo.setGuid(vector.getGuid());
+            noVo.setImageIndex(vector.getImageIndex());
+            pictureNoVos.add(noVo);
+        }
+        return pictureNoVos.stream().sorted(Comparator.comparing(EsPictureNoVo::getImageIndex)).collect(Collectors.toList());
+    }
+
+    public List<EsPictureNoVo> getPictureByNo3(EsPictureNoDTO noDTO) throws Exception {
+        List<EsPictureNoVo> esPictureNoVos = new ArrayList<>();
+        String appNo = noDTO.getAppNo();
+        if (appNo == null) {
+            return esPictureNoVos;
+        }
+        if (appNo.startsWith("CN")) {
+            esPictureNoVos = this.getPictureByNoCN(noDTO);
+        } else {
+            esPictureNoVos = this.getPictureByNoWG(noDTO);
+        }
+        return esPictureNoVos;
+    }
+
+    public List<EsPictureNoVo> getPictureByNoWG(EsPictureNoDTO noDTO) throws Exception {
+        List<EsPictureNoVo> pictureNoVos = new ArrayList<>();
+        SearchRequest.Builder builder = new SearchRequest.Builder();
+        //设置查询索引
+        builder.index(patentVectorName);
+        Query query = QueryBuilders.term(i -> i.field("app_no").value(noDTO.getAppNo()));
+        builder.query(query);
+        builder.size(300);
+        SearchResponse<PatentVector> response = client.search(builder.build(), PatentVector.class);
+        List<Hit<PatentVector>> hits = response.hits().hits();
+        for (Hit<PatentVector> hit : hits) {
+            PatentVector vector = hit.source();
+            EsPictureNoVo noVo = new EsPictureNoVo();
+            noVo.setGuid(imageHttp+vector.getGuid());
+            noVo.setImageIndex(vector.getImageIndex());
+            pictureNoVos.add(noVo);
+        }
+        return pictureNoVos.stream().sorted(Comparator.comparing(EsPictureNoVo::getImageIndex)).collect(Collectors.toList());
+    }
+
+    public List<EsPictureNoVo> getPictureByNoCN(EsPictureNoDTO noDTO) throws Exception {
+        String appNo = noDTO.getAppNo();
+        String[] appNoStrs = appNo.split("\\.");
+        String rowAppNo = appNoStrs[0];
+        rowAppNo = rowAppNo.replace("CN", "");
+        List<String> urls = patentStarApiService.getExternalFigure(rowAppNo);
+        List<EsPictureNoVo> pictureNoVos = new ArrayList<>();
+        for (int i = 0; i < urls.size(); i++) {
+            EsPictureNoVo esPictureNoVo = new EsPictureNoVo();
+            esPictureNoVo.setImageIndex(i);
+            esPictureNoVo.setGuid(urls.get(i));
+            pictureNoVos.add(esPictureNoVo);
+        }
+        return pictureNoVos;
+    }
 }

+ 2 - 2
src/main/java/com/example/xiaoshiweixinback/service/importPatent/EsPatentService.java

@@ -354,7 +354,7 @@ public class EsPatentService {
                 //获取专利的多张摘要附图
                 EsPictureNoDTO esPictureNoDTO = new EsPictureNoDTO();
                 esPictureNoDTO.setAppNo(appNo);
-                List<EsPictureNoVo> noVos = esDenseVectorService.getPictureByNo(esPictureNoDTO);
+                List<EsPictureNoVo> noVos = esDenseVectorService.getPictureByNo3(esPictureNoDTO);
                 List<String> guids = noVos.stream().map(EsPictureNoVo::getGuid).collect(Collectors.toList());
 
                 //根据专利申请号appNo获取专利信息
@@ -371,7 +371,7 @@ public class EsPatentService {
                     //获取专利的多张摘要附图
                     EsPictureNoDTO esPictureNoDTO = new EsPictureNoDTO();
                     esPictureNoDTO.setAppNo(appNo);
-                    List<EsPictureNoVo> noVos = esDenseVectorService.getPictureByNo(esPictureNoDTO);
+                    List<EsPictureNoVo> noVos = esDenseVectorService.getPictureByNo3(esPictureNoDTO);
                     List<String> guids = noVos.stream().map(EsPictureNoVo::getGuid).collect(Collectors.toList());
 
                     //根据专利申请号appNo获取专利信息

+ 0 - 1
src/main/java/com/example/xiaoshiweixinback/service/importPatent/PatentStarApiService.java

@@ -738,5 +738,4 @@ public class PatentStarApiService {
     public String getPictureGuid(String appNo) {
         return this.getPictureApi(appNo);
     }
-
 }

+ 3 - 1
src/main/resources/application-prodNetIn.yml

@@ -84,4 +84,6 @@ Keypath: apiclient_key.pem
 ES:
   patentVector: patent_vector
   patent: wxpatent
-  config: es-cn-em93o8856000ho9e7.elasticsearch.aliyuncs.com
+  config: es-cn-em93o8856000ho9e7.elasticsearch.aliyuncs.com
+activity:
+  jar-path:

+ 25 - 4
src/main/resources/application-prodNetOut.yml

@@ -1,6 +1,24 @@
 spring:
+  rabbitmq:
+    host: 172.27.247.174
+    port: 5672
+    username: admin
+    password: 123456
+  data:
+    redis:
+      host: 139.224.34.118
+      port: 6379
+      database: 3
+      password: Xx0GWxdWQJxx6Swe
+      lettuce:
+        pool:
+          max-active: 20
+          max-idle: 20
+          min-idle: 0
+          max-wait: -1ms
+      timeout: 2000ms
   datasource:
-    url: jdbc:mysql://47.101.137.223:3306/ecs?autoReconnect=true&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=CONVERT_TO_NULL&useSSL=false&serverTimezone=GMT%2B8
+    url: jdbc:mysql://139.224.34.118:3306/ecs?autoReconnect=true&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=CONVERT_TO_NULL&useSSL=false&serverTimezone=GMT%2B8
     username: root
     password: TU5x6IeBi7rl
     driver-class-name: com.mysql.cj.jdbc.Driver
@@ -18,8 +36,8 @@ PCSUrl: http://localhost:8871
 OPSUrl: http://139.224.24.90:5001
 PASUrl: http://localhost:8877
 RMSUrl: http://localhost:8872
-FMSUrl: http://localhost:8802
-VectorUrl: http://139.224.24.90:8000
+FMSUrl: https://xsip.cn
+VectorUrl: http://192.168.2.24:8000
 FileSource: 5
 
 ##################  短信 ####################
@@ -38,4 +56,7 @@ queueName: emailProd.queue
 ES:
   patentVector: patent_vector
   patent: wxpatent
-  config: es-cn-em93o8856000ho9e7.public.elasticsearch.aliyuncs.com
+  config: es-cn-em93o8856000ho9e7.public.elasticsearch.aliyuncs.com
+activity:
+  jar-path:
+ImageHttp: https://www.xsip.cn/fileManager/downloadFile?fileId=