yumeng 5 년 전
부모
커밋
1b3f78b984

+ 1 - 0
module-common/src/main/java/cn/com/ctop/common/module/mapper/MaterialImageInfoMapper.java

@@ -11,5 +11,6 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
  * @cersion: V1.0
  */
 public interface MaterialImageInfoMapper extends BaseMapper<MaterialImageInfo> {
+    void insertSelective(MaterialImageInfo materialImageInfo);
 
 }

+ 117 - 0
module-common/src/main/java/cn/com/ctop/common/module/mapper/xml/MaterialImageInfoMapper.xml

@@ -2,4 +2,121 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="cn.com.ctop.common.module.mapper.MaterialImageInfoMapper">
 
+    <insert id="insertSelective" parameterType="cn.com.ctop.common.module.entity.MaterialImageInfo" >
+        replace into ctop_material_image_info
+        <trim prefix="(" suffix=")" suffixOverrides="," >
+            <if test="id != null" >
+                id,
+            </if>
+            <if test="code != null" >
+                code,
+            </if>
+            <if test="videoId != null" >
+                video_id,
+            </if>
+            <if test="materialName != null" >
+                material_name,
+            </if>
+            <if test="userId != null" >
+                user_id,
+            </if>
+            <if test="auditorId != null" >
+                auditor_id,
+            </if>
+            <if test="status != null" >
+                status,
+            </if>
+            <if test="projectId != null" >
+                project_id,
+            </if>
+            <if test="width != null" >
+                width,
+            </if>
+            <if test="type != null" >
+                type,
+            </if>
+            <if test="height != null" >
+                height,
+            </if>
+            <if test="size != null" >
+                size,
+            </if>
+            <if test="createTime != null" >
+                create_time,
+            </if>
+            <if test="updateTime != null" >
+                update_time,
+            </if>
+            <if test="url != null" >
+                url,
+            </if>
+            <if test="materialDescribe != null" >
+                material_describe,
+            </if>
+            <if test="refuseReason != null" >
+                refuse_reason,
+            </if>
+            <if test="refuseFile != null" >
+                refuse_file,
+            </if>
+        </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides="," >
+            <if test="id != null" >
+                #{id,jdbcType=VARCHAR},
+            </if>
+            <if test="code != null" >
+                #{code,jdbcType=VARCHAR},
+            </if>
+            <if test="videoId != null" >
+                #{videoId,jdbcType=VARCHAR},
+            </if>
+            <if test="materialName != null" >
+                #{materialName,jdbcType=VARCHAR},
+            </if>
+            <if test="userId != null" >
+                #{userId,jdbcType=VARCHAR},
+            </if>
+            <if test="auditorId != null" >
+                #{auditorId,jdbcType=VARCHAR},
+            </if>
+            <if test="status != null" >
+                #{status,jdbcType=INTEGER},
+            </if>
+            <if test="projectId != null" >
+                #{projectId,jdbcType=BIGINT},
+            </if>
+            <if test="width != null" >
+                #{width,jdbcType=VARCHAR},
+            </if>
+            <if test="type != null" >
+                #{type,jdbcType=VARCHAR},
+            </if>
+            <if test="height != null" >
+                #{height,jdbcType=VARCHAR},
+            </if>
+            <if test="size != null" >
+                #{size,jdbcType=VARCHAR},
+            </if>
+            <if test="createTime != null" >
+                #{createTime,jdbcType=TIMESTAMP},
+            </if>
+            <if test="updateTime != null" >
+                #{updateTime,jdbcType=TIMESTAMP},
+            </if>
+            <if test="url != null" >
+                #{url},
+            </if>
+            <if test="materialDescribe != null" >
+                #{materialDescribe},
+            </if>
+            <if test="refuseReason != null" >
+                #{refuseReason},
+            </if>
+            <if test="refuseFile != null" >
+                #{refuseFile},
+            </if>
+        </trim>
+    </insert>
+
+
 </mapper>

+ 5 - 2
module-common/src/main/java/cn/com/ctop/common/module/service/impl/MaterialImageInfoServiceImpl.java

@@ -8,6 +8,7 @@ import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 /**
@@ -21,6 +22,9 @@ import org.springframework.stereotype.Service;
 @Service
 public class MaterialImageInfoServiceImpl extends ServiceImpl<MaterialImageInfoMapper, MaterialImageInfo> implements IMaterialImageInfoService {
 
+    @Autowired
+    private MaterialImageInfoMapper materialImageInfoMapper;
+
     @Override
     public void insertImage(JSONObject imageJson) {
         String videoId = imageJson.getString("videoId");
@@ -28,10 +32,8 @@ public class MaterialImageInfoServiceImpl extends ServiceImpl<MaterialImageInfoM
             log.error("视频id不能为空");
 
         }
-
         String userId = imageJson.getString("userId");
         Long projectId = imageJson.getLong("projectId");
-
         JSONArray imageArr = imageJson.getJSONArray("imageArr");
         for (int i = 0; i < imageArr.size(); i++) {
             JSONObject json = imageArr.getJSONObject(i);
@@ -49,6 +51,7 @@ public class MaterialImageInfoServiceImpl extends ServiceImpl<MaterialImageInfoM
                 materialImageInfo.setStatus(0);
                 materialImageInfo.setProjectId(projectId);
                 materialImageInfo.setUserId(userId);
+                materialImageInfoMapper.insertSelective(materialImageInfo);
 
 
             }

+ 9 - 7
module-common/src/main/java/cn/com/ctop/common/module/service/impl/MaterialInfoServiceImpl.java

@@ -444,11 +444,10 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
      */
     @Override
     public Map<String, Object> correlationUpload(JSONObject json) {
-
+        String userId = json.getString("userId");
         Map<String, Object> resultMap = new HashMap<>();
         try {
             String type = json.getString("type");
-
             String url = "";
             if (!Check.isNull(json.getString("url"))) {
                 url = "https:" + json.getString("url");
@@ -463,7 +462,7 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
                 info.setWatermarkUrl(json.getString("watermarkUrl"));
             }
             info.setUrl(url);
-            info.setUserId(json.getString("userId"));
+            info.setUserId(userId);
             info.setProjectId(projectId);
             info.setWatermarkCode(json.getString("watermarkCode"));
             info.setStatus(0);
@@ -476,11 +475,15 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
             this.save(info);
 
             JSONArray imageArr = json.getJSONArray("imageArr");
-            if (!Check.isNull(imageArr) && imageArr.size() > 0) {
-                materialImageInfoService.insertImage(info.getId(), imageArr);
+            if (!Check.isNull(imageArr)) {
+                JSONObject imageJson = new JSONObject();
+                imageJson.put("videoId", info.getId());
+                imageJson.put("userId", userId);
+                imageJson.put("projectId", projectId);
+                imageJson.put("imageArr", imageArr);
+                materialImageInfoService.insertImage(imageJson);
             }
 
-
             Map<String, Object> deleteMap = new HashMap<>();
             deleteMap.put("material_id", info.getId());
             JSONObject ascription = json.getJSONObject("ascription");
@@ -519,7 +522,6 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
 
             getFile(info);
 
-
             ResultMapUtils.setResultMap(resultMap, StatusCode.COMMON_SUCCESS.getCode());
         } catch (Exception e) {
             ResultMapUtils.setResultMap(resultMap, StatusCode.MATERIAL_UPLOAD_FAIL.getCode());