浏览代码

5/17 修改支付回调路径

lwhhszx 1 年之前
父节点
当前提交
b1d34d6628

+ 3 - 1
src/main/java/com/example/xiaoshiweixinback/business/config/ElasticSearchClientConfig.java

@@ -28,6 +28,8 @@ public class ElasticSearchClientConfig {
     public class ElasticSearchConfig {
 @Value("${ES.config}")
 private String config;
+        @Value("${ES.password}")
+        private String password;
         //注入IOC容器
 //        @Bean
 //        public ElasticsearchClient elasticsearchClient() throws Exception {
@@ -48,7 +50,7 @@ private String config;
         public ElasticsearchClient elasticsearchClient() throws Exception {
             RestClientBuilder builder = RestClient.builder(new HttpHost(config, 9200, "http"));
             CredentialsProvider credentialsProvider = new BasicCredentialsProvider();
-            credentialsProvider.setCredentials(AuthScope.ANY, new UsernamePasswordCredentials("elastic", "Xiaoshi221101"));
+            credentialsProvider.setCredentials(AuthScope.ANY, new UsernamePasswordCredentials("elastic", password));
             SSLContext sslContext = SSLContextBuilder.create()
                     .loadTrustMaterial(new TrustSelfSignedStrategy())
                     .build();

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

@@ -126,7 +126,7 @@ public class EsDenseVectorService {
         }
 
         GetImageVO imageVO = this.getImageList(dto.getProductId(), file, dto.getDescription());
-        List<Float> imageList = null;
+        List<Float> imageList = imageVO.getImageList();
         List<String> getGuids = imageVO.getGetGuids();
         if (!CollectionUtils.isEmpty(imageList)) {
             String source = "cosineSimilarity(params.queryVector, 'my_vector') + 1.0";

+ 5 - 0
src/main/java/com/example/xiaoshiweixinback/service/importPatent/GetCataloguingFromWebService.java

@@ -35,11 +35,16 @@ public class GetCataloguingFromWebService {
         //根据专利申请号查询著录并装载信息
         StarPatentVO starPatentVO = uploadPatentWebDTO.getStarPatentVO();
         String patentZhuLuStr = "";
+        Long s1= System.currentTimeMillis();
         if (starPatentVO.getApplicationNo().startsWith("CN")) {
+
             patentZhuLuStr = patentStarApiService.getCnBibApi(uploadPatentWebDTO.getStarPatentVO().getRowApplicationNo());
+
         } else {
             patentZhuLuStr = patentStarApiService.getENBibApi(uploadPatentWebDTO.getStarPatentVO().getPublicNo());
         }
+        Long e1= System.currentTimeMillis();
+        System.out.println("获取著录信息耗时"+(e1-s1));
         if (patentZhuLuStr != null && !patentZhuLuStr.trim().equals("") && !patentZhuLuStr.equals("{}") && !patentZhuLuStr.contains("请求不合法")) {
             this.loadPatent(uploadPatentWebDTO);
             if (starPatentVO.getApplicationNo().startsWith("CN")) {

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

@@ -64,7 +64,7 @@ public class GetPatentPictureFromExcelService {
         patentVector.setAppNo(patent.getAppNo());
         patentVector.setTitle(patent.getTitle());
         patentVector.setRightHolder(patent.getApplicant());
-        patentVector.setAppDate(patent.getAppDate());
+        patentVector.setAppDate(patent.getPublicDate());
         patentVector.setAbstractStr(patent.getAbstractStr());
         patentVector.setAppCountry("US");
         patentVector.setLoc(patent.getIpc());

+ 49 - 27
src/main/java/com/example/xiaoshiweixinback/service/importPatent/GetPatentPictureFromWebService.java

@@ -37,33 +37,51 @@ public class GetPatentPictureFromWebService {
     private OPSService opsService;
 
     public void getPatentPicture(UploadPatentWebDTO uploadPatentWebDTO) {
-       String appNo=uploadPatentWebDTO.getPatent().getAppNo();
-       if(appNo.contains("CN")){
-           this.getCNPatentPicture(uploadPatentWebDTO);
-       }
-       else {
-           this.getWdPatentPicture(uploadPatentWebDTO);
-       }
+        String appNo = uploadPatentWebDTO.getPatent().getAppNo();
+
+        if (appNo == null) {
+            return;
+        }
+        if (appNo.contains("CN")) {
+            this.getCNPatentPicture(uploadPatentWebDTO);
+        } else {
+            this.getWdPatentPicture(uploadPatentWebDTO);
+        }
     }
 
     public void getCNPatentPicture(UploadPatentWebDTO uploadPatentWebDTO) {
         try {
-
+            Long startMillis = System.currentTimeMillis();
             List<String> pictureUrls = patentStarApiService.getExternalFigure(uploadPatentWebDTO.getStarPatentVO().getRowApplicationNo());
+            Long endMillis = System.currentTimeMillis();
+
+            System.out.println("获取图片时间"+(endMillis-startMillis));
             Patent patent = uploadPatentWebDTO.getPatent();
-            if (pictureUrls != null && pictureUrls.size()>0) {
-                for (int i=0;i<pictureUrls.size();i++){
+            if (pictureUrls != null && pictureUrls.size() > 0) {
+                for (int i = 0; i < pictureUrls.size(); i++) {
                     PatentVector patentVectorOrg = esService.getVectorByIndex(patent.getAppNo(), i);
-                    if(patentVectorOrg!=null){
-                        continue;
-                    }
-                    String pictureUrl =pictureUrls.get(i);
+                    Long s1 = System.currentTimeMillis();
+                    String pictureUrl = pictureUrls.get(i);
+                    Long s4 = System.currentTimeMillis();
                     File file = FileUtils.getPictureFileByUrl(pictureUrl);
-                    String guid = FormatUtil.getPictureFormat(patent.getAppNo())+i;
+                    Long e4 = System.currentTimeMillis();
+                    System.out.println("下载文件耗时"+(e4-s4));
+                    String guid = FormatUtil.getPictureFormat(patent.getAppNo()) + i;
                     fileManagerService.uploadFileWithGuid(file, guid);
-
-                    this.addPatentVector(uploadPatentWebDTO, file, i,patentVectorOrg);
-                    org.apache.commons.io.FileUtils.deleteQuietly(file);
+                    Long e1 = System.currentTimeMillis();
+                    System.out.println("上传文件耗时"+(e1-s1));
+                    System.out.println("P" + i);
+                    if (patentVectorOrg != null) {
+                        continue;
+                    }
+                    Long s2 = System.currentTimeMillis();
+                    this.addPatentVector(uploadPatentWebDTO, file, i, patentVectorOrg);
+                    Long e2 = System.currentTimeMillis();
+                    System.out.println("向量部分耗时"+(e2-s2));
+                    Long s3 =System.currentTimeMillis();
+                     file.delete();
+                     Long e3 =System.currentTimeMillis();
+                     System.out.println("删除文件耗时"+(e3-s3));
                 }
 
             }
@@ -82,12 +100,12 @@ public class GetPatentPictureFromWebService {
             List<File> files = opsService.getImageFiles(infoVO, appNo);
             if (files != null && files.size() > 0) {
                 for (int i = 0; i < files.size(); i++) {
-                    String guid = FormatUtil.getPictureFormat(uploadPatentWebDTO.getPatent().getAppNo())+i;
+                    String guid = FormatUtil.getPictureFormat(uploadPatentWebDTO.getPatent().getAppNo()) + i;
                     File file = files.get(i);
                     fileManagerService.uploadFileWithGuid(file, guid);
                     PatentVector patentVectorOrg = esService.getVectorByIndex(patent.getAppNo(), i);
 
-                        this.addPatentVector(uploadPatentWebDTO, file, i,patentVectorOrg);
+                    this.addPatentVector(uploadPatentWebDTO, file, i, patentVectorOrg);
 
                     org.apache.commons.io.FileUtils.deleteQuietly(file);
                 }
@@ -99,10 +117,9 @@ public class GetPatentPictureFromWebService {
     }
 
 
-    public void addPatentVector(UploadPatentWebDTO uploadPatentWebDTO, File file, Integer index,PatentVector patentVectorOrg) throws Exception {
-
+    public void addPatentVector(UploadPatentWebDTO uploadPatentWebDTO, File file, Integer index, PatentVector patentVectorOrg) throws Exception {
 
-        String guid = FormatUtil.getPictureFormat(uploadPatentWebDTO.getPatent().getAppNo())+index;
+        String guid = FormatUtil.getPictureFormat(uploadPatentWebDTO.getPatent().getAppNo()) + index;
 
         Patent patent = uploadPatentWebDTO.getPatent();
         PatentVector patentVector = new PatentVector();
@@ -115,7 +132,10 @@ public class GetPatentPictureFromWebService {
         patentVector.setLoc(uploadPatentWebDTO.getPatent().getIpc());
         patentVector.setImageIndex(index);
         patentVector.setGuid(guid);
+      Long s1=  System.currentTimeMillis();
         List<String> stringList = getVectorService.getVectorByFile(file);
+        Long e1 =System.currentTimeMillis();
+        System.out.println("获取向量耗时"+(e1-s1));
         List<Float> floats = new ArrayList<>();
         stringList.forEach(item -> {
             Float a = Float.parseFloat(item);
@@ -123,11 +143,13 @@ public class GetPatentPictureFromWebService {
 
         });
         patentVector.setMyVector(floats);
-        if(patentVectorOrg!=null){
-            esService.updatePatentVector(patentVector,patentVectorOrg.getId());
-        }
-        else {
+        if (patentVectorOrg != null) {
+            esService.updatePatentVector(patentVector, patentVectorOrg.getId());
+        } else {
+            Long s2=  System.currentTimeMillis();
             esService.addPatentVector(patentVector);
+            Long e2 =System.currentTimeMillis();
+            System.out.println("保存向量耗时"+(e2-s2));
         }
 
     }

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

@@ -100,9 +100,10 @@ private GetFiguresService getFiguresService;
                     patentStarListDTOTemp.setPageNum(i + 1);
                     patentStarListDTOTemp.setRowCount(50);
                     //调用一般接口返回一批专利著录相关数据
-
+                Long s1=    System.currentTimeMillis();
                     Map<String, Object> resultMap = patentStarApiService.patentStarSearchApi(patentStarListDTOTemp);
-
+                 Long e1 =System.currentTimeMillis();
+                 System.out.println("检索专利耗时"+(e1-s1));
                     if (resultMap == null || (Integer) resultMap.get("total") == 0) {
                         continue;
                     }
@@ -129,9 +130,18 @@ private GetFiguresService getFiguresService;
                         uploadPatentWebDTO.setCounter(0);
                         uploadPatentWebDTO.setIndex(index);
                         uploadPatentWebDTO.setHaveSaveCounter(0);
+                        Long s2=    System.currentTimeMillis();
                         getCataloguingFromWebService.loadPatentMessage(uploadPatentWebDTO);
+                        Long e2 =System.currentTimeMillis();
+                        System.out.println("装载著录信息耗时"+(e2-s2));
+                        Long s3=    System.currentTimeMillis();
                          savePatentToEsService.saveOrUpdate(uploadPatentWebDTO);
+                        Long e3 =System.currentTimeMillis();
+                        System.out.println("保存专利耗时"+(e3-s3));
+                        Long s4=    System.currentTimeMillis();
                          getPatentPictureFromWebService.getPatentPicture(uploadPatentWebDTO);
+                        Long e4 =System.currentTimeMillis();
+                        System.out.println("保存图片信息耗时"+(e4-s4));
                         ifHaveGet = true;
                         index += 1;
                         System.out.println(index);

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

@@ -69,6 +69,7 @@ public class PatentStarApiService {
                 PatentStarListDTO.setFormed(true);
             }
         } catch (Exception e) {
+            e.printStackTrace();
             return null;
         }
         JSONObject configObject = this.getConfigObject(4, 1);

+ 2 - 1
src/main/resources/application-dev.yml

@@ -87,4 +87,5 @@ queueName: emailProd.queue
 ES:
   patentVector: cn_patent_vector_v4
   patent: cn_weixin_patent_v3
-  config: 192.168.2.24
+  config: 192.168.2.24
+  password: xiaoshi221101

+ 91 - 0
src/main/resources/application-localImport.yml

@@ -0,0 +1,91 @@
+spring:
+  rabbitmq:
+    host: 192.168.2.24
+    port: 5672
+    username: admin
+    password: 123456
+  data:
+   redis:
+     host: 192.168.2.24
+     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://192.168.2.24:3306/ecs?autoReconnect=true&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=CONVERT_TO_NULL&useSSL=false&serverTimezone=GMT%2B8
+    userName: root
+    password: rrzTwWAYX8Gxh5JH
+    driver-class-name: com.mysql.cj.jdbc.Driver
+    type: com.alibaba.druid.pool.DruidDataSource
+    druid:
+      stat-view-servlet:
+        login-username: admin
+        login-password: Cslg2022+
+      web-stat-filter:
+        exclusions: "*.js,*.gif,*.jpg,*.png,*.css,*.ico,/druid/*"
+  quartz:
+    #相关属性配置
+    properties:
+      org:
+        quartz:
+          scheduler:
+            instanceName: DefaultQuartzScheduler
+            instanceId: AUTO
+          jobStore:
+            class: org.springframework.scheduling.quartz.LocalDataSourceJobStore
+            driverDelegateClass: org.quartz.impl.jdbcjobstore.StdJDBCDelegate
+            tablePrefix: QRTZ_
+            isClustered: false
+            clusterCheckinInterval: 10000
+            useProperties: false
+          threadPool:
+            class: org.quartz.simpl.SimpleThreadPool
+            threadCount: 10
+            threadPriority: 5
+            threadsInheritContextClassLoaderOfInitializingThread: true
+          dataSource:
+            default:
+              URL: jdbc:mysql://192.168.2.24:3306/ecs?autoReconnect=true&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=CONVERT_TO_NULL&useSSL=false&serverTimezone=GMT%2B8
+              user: root
+              password: rrzTwWAYX8Gxh5JH
+              driver: com.mysql.jdbc.Driver
+
+    #数据库方式
+    job-store-type: jdbc
+    #初始化表结构
+    jdbc:
+      initialize-schema: always
+PCSUrl: http://localhost:8871
+#OPSUrl: http://192.168.1.24:5001
+OPSUrl: http://139.224.24.90:5001
+PASUrl: http://localhost:8877
+RMSUrl: http://localhost:8872
+FMSUrl: http://localhost:8702
+VectorUrl: http://192.168.2.24:8000
+authorUrl: http://localhost:8871
+FileSource: 2
+
+##################  短信 ####################
+SMS:
+  regionId: cn-shanghai
+  accessKeyId: LTAI5tGyG1Q7fKprgg1nWhXj
+  secret: Y6Erboh5lEFiRPR4XK8oCPMvUzYGLN
+
+##################  微信小程序  ####################
+WeChat:
+  appId: wxaefb842bd0b93ff0
+  appSecret: 89fe0fb96472548d48f63b2f5c956537
+
+Keypath: C:\Users\admin\Desktop\小程序证书\1673179188_20240408_cert\apiclient_key.pem
+queueName: emailProd.queue
+ES:
+  patentVector: cn_patent_vector_v5
+  patent: cn_weixin_patent_v4
+  config: 192.168.2.24
+  password: xiaoshi221101

+ 91 - 0
src/main/resources/application-localImportserver.yml

@@ -0,0 +1,91 @@
+spring:
+  rabbitmq:
+    host: 192.168.2.24
+    port: 5672
+    username: admin
+    password: 123456
+  data:
+   redis:
+     host: 192.168.2.24
+     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://192.168.2.24:3306/ecs?autoReconnect=true&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=CONVERT_TO_NULL&useSSL=false&serverTimezone=GMT%2B8
+    userName: root
+    password: rrzTwWAYX8Gxh5JH
+    driver-class-name: com.mysql.cj.jdbc.Driver
+    type: com.alibaba.druid.pool.DruidDataSource
+    druid:
+      stat-view-servlet:
+        login-username: admin
+        login-password: Cslg2022+
+      web-stat-filter:
+        exclusions: "*.js,*.gif,*.jpg,*.png,*.css,*.ico,/druid/*"
+  quartz:
+    #相关属性配置
+    properties:
+      org:
+        quartz:
+          scheduler:
+            instanceName: DefaultQuartzScheduler
+            instanceId: AUTO
+          jobStore:
+            class: org.springframework.scheduling.quartz.LocalDataSourceJobStore
+            driverDelegateClass: org.quartz.impl.jdbcjobstore.StdJDBCDelegate
+            tablePrefix: QRTZ_
+            isClustered: false
+            clusterCheckinInterval: 10000
+            useProperties: false
+          threadPool:
+            class: org.quartz.simpl.SimpleThreadPool
+            threadCount: 10
+            threadPriority: 5
+            threadsInheritContextClassLoaderOfInitializingThread: true
+          dataSource:
+            default:
+              URL: jdbc:mysql://192.168.2.24:3306/ecs?autoReconnect=true&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=CONVERT_TO_NULL&useSSL=false&serverTimezone=GMT%2B8
+              user: root
+              password: rrzTwWAYX8Gxh5JH
+              driver: com.mysql.jdbc.Driver
+
+    #数据库方式
+    job-store-type: jdbc
+    #初始化表结构
+    jdbc:
+      initialize-schema: always
+PCSUrl: http://localhost:8871
+#OPSUrl: http://192.168.1.24:5001
+OPSUrl: http://139.224.24.90:5001
+PASUrl: http://localhost:8877
+RMSUrl: http://localhost:8872
+FMSUrl: http://localhost:8802
+VectorUrl: http://localhost:8000
+authorUrl: http://localhost:8871
+FileSource: 2
+
+##################  短信 ####################
+SMS:
+  regionId: cn-shanghai
+  accessKeyId: LTAI5tGyG1Q7fKprgg1nWhXj
+  secret: Y6Erboh5lEFiRPR4XK8oCPMvUzYGLN
+
+##################  微信小程序  ####################
+WeChat:
+  appId: wxaefb842bd0b93ff0
+  appSecret: 89fe0fb96472548d48f63b2f5c956537
+
+Keypath: C:\Users\admin\Desktop\小程序证书\1673179188_20240408_cert\apiclient_key.pem
+queueName: emailProd.queue
+ES:
+  patentVector: cn_patent_vector_v5
+  patent: cn_weixin_patent_v4
+  config: 192.168.2.24
+  password: xiaoshi221101

+ 88 - 0
src/main/resources/application-prodNetEn.yml

@@ -0,0 +1,88 @@
+spring:
+  rabbitmq:
+    host: 172.27.247.174
+    port: 5672
+    username: admin
+    password: 123456
+  data:
+   redis:
+     host: 172.27.247.174
+     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://172.27.247.174: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
+    type: com.alibaba.druid.pool.DruidDataSource
+    druid:
+      stat-view-servlet:
+        login-username: admin
+        login-password: Cslg2022+
+      web-stat-filter:
+        exclusions: "*.js,*.gif,*.jpg,*.png,*.css,*.ico,/druid/*"
+  quartz:
+    #相关属性配置
+    properties:
+      org:
+        quartz:
+          scheduler:
+            instanceName: DefaultQuartzScheduler
+            instanceId: AUTO
+          jobStore:
+            class: org.springframework.scheduling.quartz.LocalDataSourceJobStore
+            driverDelegateClass: org.quartz.impl.jdbcjobstore.StdJDBCDelegate
+            tablePrefix: QRTZ_
+            isClustered: false
+            clusterCheckinInterval: 10000
+            useProperties: false
+          threadPool:
+            class: org.quartz.simpl.SimpleThreadPool
+            threadCount: 10
+            threadPriority: 5
+            threadsInheritContextClassLoaderOfInitializingThread: true
+          dataSource:
+            default:
+              URL: jdbc:mysql://172.27.247.174:3306:3306/pas-prod2?autoReconnect=true&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=CONVERT_TO_NULL&useSSL=false&serverTimezone=GMT%2B8
+              user: root
+              password: TU5x6IeBi7rl
+              driver: com.mysql.jdbc.Driver
+
+    #数据库方式
+    job-store-type: jdbc
+    #初始化表结构
+    jdbc:
+      initialize-schema: always
+authorUrl: http://localhost:8871
+PCSUrl: http://localhost:8871
+#OPSUrl: http://192.168.1.24:5001
+OPSUrl: http://139.224.24.90:5001
+PASUrl: http://localhost:8877
+FMSUrl: http://localhost:8802
+VectorUrl: http://127.0.0.1:8000
+FileSource: 5
+
+##################  短信 ####################
+SMS:
+  regionId: cn-shanghai
+  accessKeyId: LTAI5tGyG1Q7fKprgg1nWhXj
+  secret: Y6Erboh5lEFiRPR4XK8oCPMvUzYGLN
+
+##################  微信小程序  ####################
+WeChat:
+  appId: wxaefb842bd0b93ff0
+  appSecret: 89fe0fb96472548d48f63b2f5c956537
+Keypath: apiclient_key.pem
+ES:
+  patentVector: patent_vector_v5
+  patent: weixin_patent_v4
+  config: es-cn-em93o8856000ho9e7.elasticsearch.aliyuncs.com
+  password: Xiaoshi221101

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

@@ -82,6 +82,7 @@ WeChat:
   appSecret: 89fe0fb96472548d48f63b2f5c956537
 Keypath: apiclient_key.pem
 ES:
-  patentVector: cn_patent_vector_v4
-  patent: cn_weixin_patent_v3
-  config: es-cn-em93o8856000ho9e7.elasticsearch.aliyuncs.com
+  patentVector: cn_patent_vector_v5
+  patent: cn_weixin_patent_v4
+  config: es-cn-em93o8856000ho9e7.elasticsearch.aliyuncs.com
+  password: Xiaoshi221101

+ 2 - 2
src/main/resources/application.yml

@@ -1,7 +1,7 @@
 server:
   servlet:
     context-path: /
-  port: 8904
+  port: 8905
 #  sa-token:
 #  activity-timeout: 18000
 #  token-name: token
@@ -20,7 +20,7 @@ spring:
       max-file-size: 1000MB
       max-request-size: 1000MB
   profiles:
-    active: prodNetInAll
+    active: localImport
   jackson:
     default-property-inclusion: non_null
     serialization: