Эх сурвалжийг харах

游记,旅游项目,劳务项目都增加二维码字段

chenchen 5 сар өмнө
parent
commit
706f31deea
15 өөрчлөгдсөн 208 нэмэгдсэн , 6 устгасан
  1. 5 0
      application-webadmin/pom.xml
  2. 5 2
      application-webadmin/src/main/java/com/tourism/webadmin/back/dao/mapper/JobProjectMapper.xml
  3. 5 2
      application-webadmin/src/main/java/com/tourism/webadmin/back/dao/mapper/TourTourismProjectTravelNotesMapper.xml
  4. 5 2
      application-webadmin/src/main/java/com/tourism/webadmin/back/dao/mapper/TourismProjectMapper.xml
  5. 6 0
      application-webadmin/src/main/java/com/tourism/webadmin/back/dto/JobProjectDto.java
  6. 114 0
      application-webadmin/src/main/java/com/tourism/webadmin/back/dto/MultipartFileDto.java
  7. 6 0
      application-webadmin/src/main/java/com/tourism/webadmin/back/dto/TourTourismProjectTravelNotesDto.java
  8. 6 0
      application-webadmin/src/main/java/com/tourism/webadmin/back/dto/TourismProjectDto.java
  9. 7 0
      application-webadmin/src/main/java/com/tourism/webadmin/back/model/JobProject.java
  10. 7 0
      application-webadmin/src/main/java/com/tourism/webadmin/back/model/TourTourismProjectTravelNotes.java
  11. 7 0
      application-webadmin/src/main/java/com/tourism/webadmin/back/model/TourismProject.java
  12. 5 0
      application-webadmin/src/main/java/com/tourism/webadmin/back/vo/JobProjectVo.java
  13. 6 0
      application-webadmin/src/main/java/com/tourism/webadmin/back/vo/TourTourismProjectTravelNotesVo.java
  14. 6 0
      application-webadmin/src/main/java/com/tourism/webadmin/back/vo/TourismProjectVo.java
  15. 18 0
      common/common-additional/src/main/java/com/tourism/common/additional/utils/JsonUtils.java

+ 5 - 0
application-webadmin/pom.xml

@@ -116,6 +116,11 @@
             <version>69.1</version>
         </dependency>
 
+        <dependency>
+            <groupId>commons-codec</groupId>
+            <artifactId>commons-codec</artifactId>
+            <version>1.15</version> <!-- 请根据实际情况调整版本号 -->
+        </dependency>
 
         <!--        <dependency>-->
 <!--            <groupId>com.anji-plus</groupId>-->

+ 5 - 2
application-webadmin/src/main/java/com/tourism/webadmin/back/dao/mapper/JobProjectMapper.xml

@@ -39,6 +39,7 @@
         <result column="age_floor" jdbcType="TINYINT" property="ageFloor"/>
         <result column="favourite_count" jdbcType="INTEGER" property="favouriteCount"/>
         <result column="is_urgent" jdbcType="TINYINT" property="isUrgent"/>
+        <result column="contact_code" jdbcType="VARCHAR" property="contactCode"/>
     </resultMap>
 
     <insert id="insertList">
@@ -79,7 +80,8 @@
             age_cap,
             age_floor,
             favourite_count,
-            is_urgent)
+            is_urgent,
+            contact_code)
         VALUES
         <foreach collection="list" index="index" item="item" separator="," >
             (#{item.id},
@@ -118,7 +120,8 @@
             #{item.ageCap},
             #{item.ageFloor},
             #{item.favouriteCount},
-            #{item.isUrgent}))
+            #{item.isUrgent},
+            #{item.contactCode})
         </foreach>
     </insert>
 

+ 5 - 2
application-webadmin/src/main/java/com/tourism/webadmin/back/dao/mapper/TourTourismProjectTravelNotesMapper.xml

@@ -36,6 +36,7 @@
         <result column="average_cost" jdbcType="VARCHAR" property="averageCost"/>
         <result column="recommendation_rate" jdbcType="TINYINT" property="recommendationRate"/>
         <result column="hot_value" jdbcType="INTEGER" property="hotValue"/>
+        <result column="contact_code" jdbcType="VARCHAR" property="contactCode"/>
     </resultMap>
 
     <insert id="insertList">
@@ -73,7 +74,8 @@
             departure_time,
             average_cost,
             recommendation_rate,
-            hot_value)
+            hot_value,
+            contact_code)
         VALUES
         <foreach collection="list" index="index" item="item" separator="," >
             (#{item.id},
@@ -109,7 +111,8 @@
             #{item.departureTime},
             #{item.averageCost},
             #{item.recommendationRate},
-            #{item.hotValue})
+            #{item.hotValue},
+            #{item.contactCode})
         </foreach>
     </insert>
 

+ 5 - 2
application-webadmin/src/main/java/com/tourism/webadmin/back/dao/mapper/TourismProjectMapper.xml

@@ -35,6 +35,7 @@
         <result column="departure_time" jdbcType="TIMESTAMP" property="departureTime"/>
         <result column="average_cost" jdbcType="VARCHAR" property="averageCost"/>
         <result column="recommendation_rate" jdbcType="TINYINT" property="recommendationRate"/>
+        <result column="contact_code" jdbcType="VARCHAR" property="contactCode"/>
     </resultMap>
 
     <resultMap id="BaseResultMapWithTourTravelNotesProjectRelation" type="com.tourism.webadmin.back.model.TourismProject" extends="BaseResultMap">
@@ -76,7 +77,8 @@
             role,
             departure_time,
             average_cost,
-            recommendation_rate)
+            recommendation_rate,
+            contact_code)
             VALUES
         <foreach collection="list" index="index" item="item" separator="," >
             (#{item.id},
@@ -111,7 +113,8 @@
             #{item.role},
             #{item.departureTime},
             #{item.averageCost},
-            #{item.recommendationRate})
+            #{item.recommendationRate},
+            #{item.contactCode})
         </foreach>
     </insert>
 

+ 6 - 0
application-webadmin/src/main/java/com/tourism/webadmin/back/dto/JobProjectDto.java

@@ -228,6 +228,12 @@ public class JobProjectDto {
     private Integer isUrgent;
 
     /**
+     * 上传的联系二维码。
+     */
+    @Schema(description = "上传的联系二维码。")
+    private String contactCode;
+
+    /**
      * 菜单id。
      */
     private List<Long> directoryInfoIds;

+ 114 - 0
application-webadmin/src/main/java/com/tourism/webadmin/back/dto/MultipartFileDto.java

@@ -0,0 +1,114 @@
+package com.tourism.webadmin.back.dto;
+
+import org.springframework.util.FileCopyUtils;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.io.ByteArrayInputStream;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+
+/**
+ * @Author: szz
+ * @Date: 2019/1/16 下午4:33
+ * @Version 1.0
+ *
+ * 负责将InputStream转换MultipartFile,可以少引一个jar包,本来用的是spring-test-4.3.9中的MockMultipartFile,直接提取出来使用
+ */
+public class MultipartFileDto implements MultipartFile {
+    private final String name;
+
+    private String originalFilename;
+
+    private String contentType;
+
+    private final byte[] content;
+
+    /**
+     * Create a new MultipartFileDto with the given content.
+     * @param name the name of the file
+     * @param content the content of the file
+     */
+    public MultipartFileDto(String name, byte[] content) {
+        this(name, "", null, content);
+    }
+
+    /**
+     * Create a new MultipartFileDto with the given content.
+     * @param name the name of the file
+     * @param contentStream the content of the file as stream
+     * @throws IOException if reading from the stream failed
+     */
+    public MultipartFileDto(String name, InputStream contentStream) throws IOException {
+        this(name, "", null, FileCopyUtils.copyToByteArray(contentStream));
+    }
+
+    /**
+     * Create a new MultipartFileDto with the given content.
+     * @param name the name of the file
+     * @param originalFilename the original filename (as on the client's machine)
+     * @param contentType the content type (if known)
+     * @param content the content of the file
+     */
+    public MultipartFileDto(String name, String originalFilename, String contentType, byte[] content) {
+        this.name = name;
+        this.originalFilename = (originalFilename != null ? originalFilename : "");
+        this.contentType = contentType;
+        this.content = (content != null ? content : new byte[0]);
+    }
+
+    /**
+     * Create a new MultipartFileDto with the given content.
+     * @param name the name of the file
+     * @param originalFilename the original filename (as on the client's machine)
+     * @param contentType the content type (if known)
+     * @param contentStream the content of the file as stream
+     * @throws IOException if reading from the stream failed
+     */
+    public MultipartFileDto(String name, String originalFilename, String contentType, InputStream contentStream)
+            throws IOException {
+
+        this(name, originalFilename, contentType, FileCopyUtils.copyToByteArray(contentStream));
+    }
+
+    @Override
+    public String getName() {
+        return this.name;
+    }
+
+    @Override
+    public String getOriginalFilename() {
+        return this.originalFilename;
+    }
+
+    @Override
+    public String getContentType() {
+        return this.contentType;
+    }
+
+    @Override
+    public boolean isEmpty() {
+        return (this.content.length == 0);
+    }
+
+    @Override
+    public long getSize() {
+        return this.content.length;
+    }
+
+    @Override
+    public byte[] getBytes() throws IOException {
+        return this.content;
+    }
+
+    @Override
+    public InputStream getInputStream() throws IOException {
+        return new ByteArrayInputStream(this.content);
+    }
+
+    @Override
+    public void transferTo(File dest) throws IOException, IllegalStateException {
+        FileCopyUtils.copy(this.content, dest);
+    }
+
+}

+ 6 - 0
application-webadmin/src/main/java/com/tourism/webadmin/back/dto/TourTourismProjectTravelNotesDto.java

@@ -212,6 +212,12 @@ public class TourTourismProjectTravelNotesDto {
     private Integer hotValue;
 
     /**
+     * 上传的联系二维码。
+     */
+    @Schema(description = "上传的联系二维码。")
+    private String contactCode;
+
+    /**
      * remarks / project_label / start_place / end_place / short_title / short_description / contact_description LIKE搜索字符串。
      * NOTE: 可支持LIKE操作符的列表数据过滤。
      */

+ 6 - 0
application-webadmin/src/main/java/com/tourism/webadmin/back/dto/TourismProjectDto.java

@@ -202,6 +202,12 @@ public class TourismProjectDto {
     private Integer recommendationRate;
 
     /**
+     * 上传的联系二维码。
+     */
+    @Schema(description = "上传的联系二维码。")
+    private String contactCode;
+
+    /**
      * project_title LIKE搜索字符串。
      * NOTE: 可支持LIKE操作符的列表数据过滤。
      */

+ 7 - 0
application-webadmin/src/main/java/com/tourism/webadmin/back/model/JobProject.java

@@ -226,6 +226,13 @@ public class JobProject extends BaseModel {
     private Integer isUrgent;
 
     /**
+     * 上传的联系二维码。
+     */
+    @UploadFlagColumn(storeType = UploadStoreTypeEnum.HUAWEI_OBS_SYSTEM)
+    @TableField(value = "contact_code")
+    private String contactCode;
+
+    /**
      * job_title LIKE搜索字符串。
      */
     @TableField(exist = false)

+ 7 - 0
application-webadmin/src/main/java/com/tourism/webadmin/back/model/TourTourismProjectTravelNotes.java

@@ -211,6 +211,13 @@ public class TourTourismProjectTravelNotes extends BaseModel {
     private Integer hotValue;
 
     /**
+     * 上传的联系二维码。
+     */
+    @UploadFlagColumn(storeType = UploadStoreTypeEnum.HUAWEI_OBS_SYSTEM)
+    @TableField(value = "contact_code")
+    private String contactCode;
+
+    /**
      * remarks / project_label / start_place / end_place / short_title / short_description / contact_description LIKE搜索字符串。
      */
     @TableField(exist = false)

+ 7 - 0
application-webadmin/src/main/java/com/tourism/webadmin/back/model/TourismProject.java

@@ -205,6 +205,13 @@ public class TourismProject extends BaseModel {
     private Integer recommendationRate;
 
     /**
+     * 上传的联系二维码。
+     */
+    @UploadFlagColumn(storeType = UploadStoreTypeEnum.HUAWEI_OBS_SYSTEM)
+    @TableField(value = "contact_code")
+    private String contactCode;
+
+    /**
      * project_title LIKE搜索字符串。
      */
     @TableField(exist = false)

+ 5 - 0
application-webadmin/src/main/java/com/tourism/webadmin/back/vo/JobProjectVo.java

@@ -214,6 +214,11 @@ public class JobProjectVo extends BaseVo {
     @Schema(description = "是否急聘(0:否 1:是)")
     private Integer isUrgent;
 
+    /**
+     * 上传的联系二维码。
+     */
+    @Schema(description = "上传的联系二维码")
+    private String contactCode;
 
     /**
      * id 的一对一关联数据对象,数据对应类型为JobFileVo。

+ 6 - 0
application-webadmin/src/main/java/com/tourism/webadmin/back/vo/TourTourismProjectTravelNotesVo.java

@@ -196,6 +196,12 @@ public class TourTourismProjectTravelNotesVo extends BaseVo {
     private Integer hotValue;
 
     /**
+     * 上传的联系二维码。
+     */
+    @Schema(description = "上传的联系二维码")
+    private String contactCode;
+
+    /**
      * id 的一对一关联数据对象,数据对应类型为TourTourismTravelNotesFileVo。
      */
     @Schema(description = "id 的一对一关联数据对象,数据对应类型为TourTourismTravelNotesFileVo")

+ 6 - 0
application-webadmin/src/main/java/com/tourism/webadmin/back/vo/TourismProjectVo.java

@@ -191,6 +191,12 @@ public class TourismProjectVo extends BaseVo {
     private Integer recommendationRate;
 
     /**
+     * 上传的联系二维码。
+     */
+    @Schema(description = "上传的联系二维码")
+    private String contactCode;
+
+    /**
      * id 的一对一关联数据对象,数据对应类型为TourismFileVo。
      */
     @Schema(description = "id 的一对一关联数据对象,数据对应类型为TourismFileVo")

+ 18 - 0
common/common-additional/src/main/java/com/tourism/common/additional/utils/JsonUtils.java

@@ -14,7 +14,9 @@ import lombok.NoArgsConstructor;
 
 import java.io.IOException;
 import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 /**
  * JSON 工具类
@@ -186,4 +188,20 @@ public class JsonUtils {
             throw new RuntimeException(e);
         }
     }
+
+    public static String convertToJson(String name, String downloadUri, String filename, String uploadPath) {
+        // 创建一个Map来存储数据
+        Map<String, String> dataMap = new HashMap<>();
+        dataMap.put("name", name);
+        dataMap.put("downloadUri", downloadUri);
+        dataMap.put("filename", filename);
+        dataMap.put("uploadPath", uploadPath);
+
+        // 创建一个List来存储Map
+        List<Map<String, String>> dataList = new ArrayList<>();
+        dataList.add(dataMap);
+
+        // 使用Gson将List转换为JSON字符串
+        return toJsonString(dataList);
+    }
 }