瀏覽代碼

敏感词/百科视频保存

Aslee 2 年之前
父節點
當前提交
b1260fc908

+ 11 - 1
src/main/java/com/caimei365/user/controller/ShopApi.java

@@ -56,7 +56,7 @@ public class ShopApi {
      *                      shopId                    供应商Id
      *                      userId                    用户Id
      *                      name                      组织名称
-     *                      shortName                     供应商公司简称(shortName)
+     *                      shortName                 供应商公司简称(shortName)
      *                      email                     邮箱
      *                      contractPhone             固定电话
      *                      linkMan                   联系人
@@ -247,5 +247,15 @@ public class ShopApi {
         return shopService.deleteBaikeProduct(productId);
     }
 
+    @ApiOperation("查询敏感词")
+    @ApiImplicitParam(required = true, name = "checkPoint", value = "检查位置:1供应商端文章,2供应商端百科,3管理员端文章,4管理员端百科")
+    @GetMapping("/sensitive/words")
+    public ResponseJson<String> getSensitiveWords(Integer checkPoint){
+        if (null == checkPoint) {
+            return ResponseJson.error("参数异常", null);
+        }
+        return shopService.getSensitiveWords(checkPoint);
+    }
+
 
 }

+ 7 - 0
src/main/java/com/caimei365/user/mapper/BaikeProductMapper.java

@@ -1,6 +1,7 @@
 package com.caimei365.user.mapper;
 
 import com.caimei365.user.model.dto.BaikeProductDto;
+import com.caimei365.user.model.po.BaikeProductFilePo;
 import com.caimei365.user.model.po.BaikeProductParamPo;
 import com.caimei365.user.model.po.BaikeProductPo;
 import com.caimei365.user.model.po.BaikeProductQuestionPo;
@@ -72,4 +73,10 @@ public interface BaikeProductMapper {
     List<String> getImageList(@Param("productId") Integer productId, @Param("imageType") int imageType);
 
     List<BaikeProductQuestionPo> getQuestionList(Integer productId);
+
+    void deleteFilesByProductId(Integer productId);
+
+    void insertProductFile(@Param("fileTitle") String fileTitle, @Param("fileName") String fileName, @Param("ossName") String ossName, @Param("productId") Integer productId);
+
+    List<BaikeProductFilePo> getVideoList(Integer productId);
 }

+ 5 - 0
src/main/java/com/caimei365/user/mapper/BaseMapper.java

@@ -127,4 +127,9 @@ public interface BaseMapper {
      * @param clubId   用户Id
      */
     void updateClubMobileByClubId(String mobile, Integer clubId);
+
+    /**
+     * 查询敏感词
+     */
+    String getSensitiveWords(Integer checkPoint);
 }

+ 3 - 0
src/main/java/com/caimei365/user/model/dto/BaikeProductDto.java

@@ -110,4 +110,7 @@ public class BaikeProductDto {
 
 	@ApiModelProperty("问题列表")
 	private String questionList;
+
+	@ApiModelProperty("视频文件列表")
+	private String videoList;
 }

+ 33 - 0
src/main/java/com/caimei365/user/model/po/BaikeProductFilePo.java

@@ -0,0 +1,33 @@
+package com.caimei365.user.model.po;
+
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * 采美百科商品问题
+ * @author Aslee
+ * @version 2021-12-13
+ */
+@Data
+public class BaikeProductFilePo implements Serializable {
+
+	private static final long serialVersionUID = 1L;
+	/**
+	 * 标题
+	 */
+	private String fileTitle;
+	/**
+	 * 文件名
+	 */
+	private String fileName;
+	/**
+	 * oss名称
+	 */
+	private String ossName;
+	/**
+	 * 链接
+	 */
+	private String fileUrl;
+}

+ 6 - 0
src/main/java/com/caimei365/user/model/vo/BaikeProductFormVo.java

@@ -1,5 +1,6 @@
 package com.caimei365.user.model.vo;
 
+import com.caimei365.user.model.po.BaikeProductFilePo;
 import com.caimei365.user.model.po.BaikeProductParamPo;
 import com.caimei365.user.model.po.BaikeProductQuestionPo;
 import io.swagger.annotations.ApiModel;
@@ -158,4 +159,9 @@ public class BaikeProductFormVo {
 	 * 问题列表
 	 */
 	private List<BaikeProductQuestionPo> questionList;
+
+	/**
+	 * 视频列表
+	 */
+	private List<BaikeProductFilePo> videoList;
 }

+ 7 - 0
src/main/java/com/caimei365/user/service/ShopService.java

@@ -187,4 +187,11 @@ public interface ShopService {
      * @return
      */
     ResponseJson<Void> deleteBaikeProduct(Integer productId);
+
+    /**
+     * 查询敏感词
+     * @param checkPoint
+     * @return
+     */
+    ResponseJson<String> getSensitiveWords(Integer checkPoint);
 }

+ 26 - 1
src/main/java/com/caimei365/user/service/impl/ShopServiceImpl.java

@@ -15,6 +15,7 @@ import com.caimei365.user.service.ShopService;
 import com.caimei365.user.utils.DateUtil;
 import com.caimei365.user.utils.GenerateUtils;
 import com.caimei365.user.utils.ImageUtils;
+import com.caimei365.user.utils.OssUtil;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
 import lombok.extern.slf4j.Slf4j;
@@ -565,11 +566,12 @@ public class ShopServiceImpl implements ShopService {
             baikeProductMapper.updateBaikeProduct(baikeProductPo);
         }
         Integer productId = baikeProductPo.getProductId();
-        // 删除原先的图片/参数/问题数据
+        // 删除原先的图片/参数/问题/视频文件数据
         if (!newProductFlag) {
             baikeProductMapper.deleteParamsByProductId(productId);
             baikeProductMapper.deleteImagesByProductId(productId);
             baikeProductMapper.deleteQuestionsByProductId(productId);
+            baikeProductMapper.deleteFilesByProductId(productId);
         }
         // 保存参数
         JSONArray paramArray = JSONArray.parseArray(baikeProductDto.getParamList());
@@ -605,6 +607,19 @@ public class ShopServiceImpl implements ShopService {
                 }
             });
         }
+        // 保存视频文件
+        JSONArray videoArray = JSONArray.parseArray(baikeProductDto.getVideoList());
+        if (null != videoArray) {
+            videoArray.forEach(videoObject->{
+                Map<String,String> videoMap = (Map<String,String>) videoObject;
+                String fileTitle = videoMap.get("fileTitle");
+                String fileName = videoMap.get("fileName");
+                String ossName = videoMap.get("ossName");
+                if (StringUtils.isNotEmpty(ossName)) {
+                    baikeProductMapper.insertProductFile(fileTitle, fileName, ossName, productId);
+                }
+            });
+        }
         return ResponseJson.success(null);
     }
 
@@ -630,6 +645,10 @@ public class ShopServiceImpl implements ShopService {
         // 问题列表
         List<BaikeProductQuestionPo> questionList = baikeProductMapper.getQuestionList(productId);
         baikeProduct.setQuestionList(questionList);
+        // 视频列表
+        List<BaikeProductFilePo> videoList = baikeProductMapper.getVideoList(productId);
+        videoList.forEach(video -> video.setFileUrl(OssUtil.getOssUrl(video.getOssName())));
+        baikeProduct.setVideoList(videoList);
         return ResponseJson.success(baikeProduct);
     }
 
@@ -668,4 +687,10 @@ public class ShopServiceImpl implements ShopService {
         return ResponseJson.success(null);
     }
 
+    @Override
+    public ResponseJson<String> getSensitiveWords(Integer checkPoint) {
+        String sensitiveWords = baseMapper.getSensitiveWords(checkPoint);
+        return ResponseJson.success(sensitiveWords);
+    }
+
 }

+ 12 - 0
src/main/resources/mapper/BaikeProductMapper.xml

@@ -26,6 +26,10 @@
         insert into cm_baike_product_question (productId, question, answer)
         values (#{productId}, #{question}, #{answer})
     </insert>
+    <insert id="insertProductFile">
+        insert into cm_baike_product_file (productId, fileTitle, fileName, ossName)
+        values (#{productId}, #{fileTitle}, #{fileName}, #{ossName})
+    </insert>
     <update id="updateBaikeProduct">
         update cm_baike_product
         set name            = #{name},
@@ -69,6 +73,9 @@
     <delete id="deleteQuestionsByProductId">
         delete from cm_baike_product_question where productId = #{productId}
     </delete>
+    <delete id="deleteFilesByProductId">
+        delete from cm_baike_product_file where productId = #{productId}
+    </delete>
     <select id="getBaikeProductById" resultType="com.caimei365.user.model.vo.BaikeProductFormVo">
         select id as productId,
                commodityType,
@@ -145,4 +152,9 @@
         from cm_baike_product_question
         where productId = #{productId}
     </select>
+    <select id="getVideoList" resultType="com.caimei365.user.model.po.BaikeProductFilePo">
+        select fileTitle, fileName, ossName
+        from cm_baike_product_file
+        where productId = #{productId}
+    </select>
 </mapper>

+ 8 - 0
src/main/resources/mapper/BaseMapper.xml

@@ -104,4 +104,12 @@
     <select id="getAfterSalesPhone" resultType="java.lang.String">
         select contactNumber from cm_mall_organize where id = 0 and delFlag = '0'
     </select>
+    <select id="getSensitiveWords" resultType="java.lang.String">
+        select words
+        from cm_sensitive_words
+        where id = 1 and status = 1
+        <if test="checkPoint != null">
+            and checkPoints like concat('%',#{checkPoint},'%')
+        </if>
+    </select>
 </mapper>