dsx 2 年之前
父節點
當前提交
05c69d0f34

+ 1 - 0
4dkankan-common-utils/src/main/java/com/fdkankan/common/constant/ErrorCode.java

@@ -85,6 +85,7 @@ public enum ErrorCode {
     FAILURE_CODE_4001(4001, "缺少必要文件:%s"),
     FAILURE_CODE_4002(4002, "文件不存在:%s"),
     FAILURE_CODE_4003(4003, "图片大小不能超过:%s"),
+    FAILURE_CODE_4004(4004, "此接口仅支持看看和看见相机场景"),
 
 
     FAILURE_CODE_5001(5001, "modeldata.json为空"),

+ 4 - 8
4dkankan-utils-elasticsearch/src/main/java/com/fdkankan/elasticsearch/service/DocumentService.java

@@ -12,46 +12,42 @@ public interface  DocumentService {
      * 增加文档信息
      *
      * @param indexName 索引名
-     * @param type      文档类型
      * @param keyId     主键
      * @param data      json数据
      * @return 增加文档信息状态
      * @throws IOException 异常信息
      */
-    RestStatus addDocument(String indexName, String type, String keyId,String data) throws IOException;
+    RestStatus addDocument(String indexName, String keyId,String data) throws IOException;
 
     /**
      * 获取文档信息
      *
      * @param indexName 索引名
-     * @param type      文档类型
      * @param id        文档ID
      * @return 商品数据
      * @throws Exception 异常信息
      */
-    String getDocument(String indexName, String type, String id) throws Exception;
+    String getDocument(String indexName, String id) throws Exception;
 
     /**
      * 更新文档信息
      *
      * @param indexName 索引名
-     * @param type      文档类型
      * @param data      数据
      * @return 更新文档信息状态
      * @throws IOException 异常信息
      */
-    RestStatus updateDocument(String indexName, String type, String id ,String data) throws IOException;
+    RestStatus updateDocument(String indexName, String id ,String data) throws IOException;
 
     /**
      * 删除文档信息
      *
      * @param indexName 索引名
-     * @param type      文档类型
      * @param id        文档ID
      * @return 删除文档信息状态
      * @throws IOException 异常信息
      */
-    RestStatus deleteDocument(String indexName, String type, String id) throws IOException;
+    RestStatus deleteDocument(String indexName, String id) throws IOException;
 
     /**
      * 批量导入

+ 10 - 30
4dkankan-utils-elasticsearch/src/main/java/com/fdkankan/elasticsearch/service/impl/DocumentServiceImpl.java

@@ -39,21 +39,16 @@ public class DocumentServiceImpl implements DocumentService {
      * 增加文档信息
      *
      * @param indexName 索引名
-     * @param type      文档类型
      * @param keyId     主键
      * @param data      json数据
      * @return 增加文档信息状态
      * @throws IOException 异常信息
      */
     @Override
-    public RestStatus addDocument(String indexName, String type,String keyId, String data) throws IOException {
-        /*1.默认类型为_doc*/
-        if (StringUtils.isBlank(type)) {
-            type = "_doc";
-        }
+    public RestStatus addDocument(String indexName, String keyId, String data) throws IOException {
         /*2.将对象转为json*/
         /*3.创建索引请求对象*/
-        IndexRequest indexRequest = new IndexRequest(indexName, type).id(keyId).source(data, XContentType.JSON);
+        IndexRequest indexRequest = new IndexRequest(indexName).id(keyId).source(data, XContentType.JSON);
         /*4.执行增加文档*/
         IndexResponse response = restHighLevelClient.index(indexRequest, RequestOptions.DEFAULT);
 
@@ -64,19 +59,14 @@ public class DocumentServiceImpl implements DocumentService {
      * 获取文档信息
      *
      * @param indexName 索引名
-     * @param type      文档类型
      * @param id        文档ID
      * @return 商品数据
      * @throws Exception 异常信息
      */
     @Override
-    public String getDocument(String indexName, String type, String id) throws Exception {
-        /*1.默认类型为_doc*/
-        if (StringUtils.isBlank(type)) {
-            type = "_doc";
-        }
+    public String getDocument(String indexName, String id) throws Exception {
         /*2.创建获取请求对象*/
-        GetRequest getRequest = new GetRequest(indexName, type, id);
+        GetRequest getRequest = new GetRequest(indexName, id);
         GetResponse response = restHighLevelClient.get(getRequest, RequestOptions.DEFAULT);
 
         return response.getSourceAsString();
@@ -86,20 +76,15 @@ public class DocumentServiceImpl implements DocumentService {
      * 更新文档信息
      *
      * @param indexName 索引名
-     * @param type      文档类型
      * @param data      数据
      * @return 更新文档信息状态
      * @throws IOException 异常信息
      */
     @Override
-    public RestStatus updateDocument(String indexName, String type, String id ,String data) throws IOException {
-        /*1.默认类型为_doc*/
-        if (StringUtils.isBlank(type)) {
-            type = "_doc";
-        }
+    public RestStatus updateDocument(String indexName, String id ,String data) throws IOException {
 
         /*2.创建索引请求对象*/
-        UpdateRequest updateRequest = new UpdateRequest(indexName, type, id);
+        UpdateRequest updateRequest = new UpdateRequest(indexName, id);
         /*3.设置更新文档内容*/
         updateRequest.doc(data, XContentType.JSON);
         /*4.执行更新文档*/
@@ -118,14 +103,9 @@ public class DocumentServiceImpl implements DocumentService {
      * @throws IOException 异常信息
      */
     @Override
-    public RestStatus deleteDocument(String indexName, String type, String id) throws IOException {
-        /*1.默认类型为_doc*/
-        if (StringUtils.isBlank(type)) {
-            type = "_doc";
-        }
-
+    public RestStatus deleteDocument(String indexName, String id) throws IOException {
         /*2.创建删除请求对象*/
-        DeleteRequest deleteRequest = new DeleteRequest(indexName, type, id);
+        DeleteRequest deleteRequest = new DeleteRequest(indexName, id);
         /*3.执行删除文档*/
         DeleteResponse response = restHighLevelClient.delete(deleteRequest, RequestOptions.DEFAULT);
 
@@ -149,8 +129,8 @@ public class DocumentServiceImpl implements DocumentService {
         BulkRequest bulkRequest = new BulkRequest();
         for (JSONObject data : dataList) {
             //将goods对象转换为json字符串
-            IndexRequest indexRequest = new IndexRequest(index, "_doc");
-            indexRequest.id(data.getString("id")).source(data, XContentType.JSON);
+            IndexRequest indexRequest = new IndexRequest(index);
+            indexRequest.id(data.getString("id")).source(JSON.toJSONString(data), XContentType.JSON);
             bulkRequest.add(indexRequest);
         }
 

+ 0 - 75
4dkankan-utils-es/pom.xml

@@ -1,75 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-  <modelVersion>4.0.0</modelVersion>
-
-  <groupId>com.fdkankan</groupId>
-  <artifactId>4dkankan-utils-es</artifactId>
-  <version>3.0.0-SNAPSHOT</version>
-
-  <name>4dkankan-utils-es</name>
-  <!-- FIXME change it to the project's website -->
-  <url>http://www.example.com</url>
-
-  <properties>
-    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
-    <maven.compiler.source>1.7</maven.compiler.source>
-    <maven.compiler.target>1.7</maven.compiler.target>
-  </properties>
-
-  <dependencies>
-    <dependency>
-      <groupId>junit</groupId>
-      <artifactId>junit</artifactId>
-      <version>4.11</version>
-      <scope>test</scope>
-    </dependency>
-  </dependencies>
-
-  <build>
-    <pluginManagement><!-- lock down plugins versions to avoid using Maven defaults (may be moved to parent pom) -->
-      <plugins>
-        <!-- clean lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#clean_Lifecycle -->
-        <plugin>
-          <artifactId>maven-clean-plugin</artifactId>
-          <version>3.1.0</version>
-        </plugin>
-        <!-- default lifecycle, jar packaging: see https://maven.apache.org/ref/current/maven-core/default-bindings.html#Plugin_bindings_for_jar_packaging -->
-        <plugin>
-          <artifactId>maven-resources-plugin</artifactId>
-          <version>3.0.2</version>
-        </plugin>
-        <plugin>
-          <artifactId>maven-compiler-plugin</artifactId>
-          <version>3.8.0</version>
-        </plugin>
-        <plugin>
-          <artifactId>maven-surefire-plugin</artifactId>
-          <version>2.22.1</version>
-        </plugin>
-        <plugin>
-          <artifactId>maven-jar-plugin</artifactId>
-          <version>3.0.2</version>
-        </plugin>
-        <plugin>
-          <artifactId>maven-install-plugin</artifactId>
-          <version>2.5.2</version>
-        </plugin>
-        <plugin>
-          <artifactId>maven-deploy-plugin</artifactId>
-          <version>2.8.2</version>
-        </plugin>
-        <!-- site lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#site_Lifecycle -->
-        <plugin>
-          <artifactId>maven-site-plugin</artifactId>
-          <version>3.7.1</version>
-        </plugin>
-        <plugin>
-          <artifactId>maven-project-info-reports-plugin</artifactId>
-          <version>3.0.0</version>
-        </plugin>
-      </plugins>
-    </pluginManagement>
-  </build>
-</project>

+ 0 - 13
4dkankan-utils-es/src/main/java/com/fdkankan/App.java

@@ -1,13 +0,0 @@
-package com.fdkankan;
-
-/**
- * Hello world!
- *
- */
-public class App 
-{
-    public static void main( String[] args )
-    {
-        System.out.println( "Hello World!" );
-    }
-}

+ 0 - 20
4dkankan-utils-es/src/test/java/com/fdkankan/AppTest.java

@@ -1,20 +0,0 @@
-package com.fdkankan;
-
-import static org.junit.Assert.assertTrue;
-
-import org.junit.Test;
-
-/**
- * Unit test for simple App.
- */
-public class AppTest 
-{
-    /**
-     * Rigorous Test :-)
-     */
-    @Test
-    public void shouldAnswerWithTrue()
-    {
-        assertTrue( true );
-    }
-}

+ 5 - 0
4dkankan-utils-model/src/main/java/com/fdkankan/model/constants/ConstantFilePath.java

@@ -139,6 +139,11 @@ public class ConstantFilePath {
      */
     public static final String FILE_CONVERT_PATH = BASE_PATH + "/fileConvert/";
 
+    /**
+     * 文件转换目录
+     */
+    public static final String OPENAPI_DOWNLOAD_PATH = SCENE_V4_PATH + "%s/openApi/download/";
+