yumeng 3 年之前
父節點
當前提交
5ffdc3d454

+ 10 - 9
jeecg-boot-module-system/src/main/java/org/jeecg/modules/fileupload/controller/FileController.java

@@ -8,12 +8,10 @@ import cn.com.ctop.common.module.utils.StatusCode;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import org.apache.shiro.SecurityUtils;
+import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.system.vo.LoginUser;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 
 import java.util.HashMap;
 import java.util.Map;
@@ -31,6 +29,9 @@ public class FileController {
     @Autowired
     private IMaterialImageInfoService materialImageInfoService;
 
+
+
+
     @RequestMapping("file/check")
     public Map<String, Object> chenckFile(String code, Long projectId) {
         return materialInfoService.checkMaterialInfo(code, projectId);
@@ -51,21 +52,21 @@ public class FileController {
 
     @PostMapping("/insertV3")
     public Map<String, Object> insertV3(@RequestBody JSONObject data) {
-        Map<String,Object>result = new HashMap<>();
+        Map<String, Object> result = new HashMap<>();
         LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
         Long projectId = data.getLong("projectId");
         JSONArray array = data.getJSONArray("videoArray");
         //校验重复code逻辑
         JSONArray checkArray = materialInfoService.checkArrayCode(array);
-        if(null!=checkArray&&!checkArray.isEmpty()){
-            for (int i=0;i<array.size();i++){
+        if (null != checkArray && !checkArray.isEmpty()) {
+            for (int i = 0; i < array.size(); i++) {
                 JSONObject json = array.getJSONObject(i);
                 json.put("userId", user.getId());
-                json.put("projectId",projectId);
+                json.put("projectId", projectId);
                 materialInfoService.correlationUploadV2(json);
             }
         }
-        ResultMapUtils.setResultMap(result,StatusCode.COMMON_SUCCESS);
+        ResultMapUtils.setResultMap(result, StatusCode.COMMON_SUCCESS);
         return result;
     }
 

+ 37 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/fileupload/controller/MaterialUsrController.java

@@ -0,0 +1,37 @@
+package org.jeecg.modules.fileupload.controller;
+
+import cn.com.ctop.common.module.utils.Check;
+import com.alibaba.fastjson.JSONObject;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.modules.fileupload.service.IMaterialUsrService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+@RequestMapping("materialUse")
+@RestController
+public class MaterialUsrController {
+    @Autowired
+    private IMaterialUsrService materialUsrService;
+
+    @GetMapping("/getMaterialUseDetail")
+    public Result<JSONObject> getMaterialUseDetail(String code) {
+        Result<JSONObject> result = new Result<>();
+        try {
+            if (Check.isNull(code)) {
+                throw new Exception("素材md5不能为空");
+            }
+            JSONObject json = materialUsrService.getMaterialUseInfo(code);
+            result.setSuccess(true);
+            result.setResult(json);
+        } catch (Exception e) {
+            result.setSuccess(false);
+            result.setMessage(e.getMessage());
+        }
+        return result;
+
+    }
+
+
+}

+ 19 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/fileupload/mapper/MaterialUsrServiceMapper.java

@@ -0,0 +1,19 @@
+package org.jeecg.modules.fileupload.mapper;
+
+import com.alibaba.fastjson.JSONObject;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+public interface MaterialUsrServiceMapper {
+
+    List<JSONObject> getAccountInfo(@Param("code") String code);
+
+    Integer getKuiShouRelationCount(@Param("accountId") Long accountId, @Param("photoId") String photoId);
+
+    JSONObject getKuiShouRefuseRelationCount(@Param("accountId") Long accountId, @Param("photoId") String photoId);
+
+    List<JSONObject> getByteDanceAccountInfo(String code);
+
+    Integer getByteDanceRelationCount(@Param("accountId") String accountId, @Param("vid") String vid);
+}

+ 65 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/fileupload/mapper/xml/MaterialUseMapper.xml

@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="org.jeecg.modules.fileupload.mapper.MaterialUsrServiceMapper">
+
+
+    <select id="getAccountInfo" resultType="com.alibaba.fastjson.JSONObject">
+    SELECT
+	t1.account_id as 'accountId',
+	t1.photo_id as 'photoId',
+	t2.user_name as 'userName',
+	t2.account_status as 'accountStatus'
+    FROM
+	(
+		SELECT
+			account_id,
+			photo_id
+		FROM
+			ctop_kuaishou_video_get
+		WHERE
+			signature = #{code}
+	) t1
+    LEFT JOIN ctop_user_allocation t2 ON t1.account_id = t2.account_id
+    order by t2.account_status;
+    </select>
+
+    <select id="getKuiShouRelationCount" resultType="java.lang.Integer">
+		SELECT count(1)  from  ctop_kuaishou_creative WHERE account_id = #{accountId} AND photo_id =  #{photoId}
+	</select>
+    <select id="getKuiShouRefuseRelationCount" resultType="com.alibaba.fastjson.JSONObject">
+		SELECT count(1) as 'refuseCount',
+		GROUP_CONCAT(DISTINCT review_detail  SEPARATOR '@#')  as 'refuseDetail'
+		from  ctop_kuaishou_creative
+		WHERE account_id = #{accountId}
+		AND photo_id = #{photoId}
+		AND `status` = 42
+
+	</select>
+    <select id="getByteDanceAccountInfo" resultType="com.alibaba.fastjson.JSONObject">
+	SELECT
+	CONCAT(t1.account_id,'') as 'accountId',
+	t1.vid as 'vid',
+	CONCAT(t1.material_id,'')  as 'materialId',
+	t2.user_name as 'userName',
+	t2.account_status as 'accountStatus'
+    FROM
+	(
+		SELECT
+			account_id,
+			vid,
+			material_id
+		FROM
+			ctop_bytedance_video_info
+		WHERE
+			signature = #{code}
+	) t1
+    LEFT JOIN ctop_user_allocation t2 ON t1.account_id = t2.account_id
+      order by t2.account_status;
+
+	</select>
+    <select id="getByteDanceRelationCount" resultType="java.lang.Integer">
+		select  count(1)  from ctop_bytedance_creative where  account_id = #{accountId}
+		and video_id = #{vid}
+
+	</select>
+</mapper>

+ 7 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/fileupload/service/IMaterialUsrService.java

@@ -0,0 +1,7 @@
+package org.jeecg.modules.fileupload.service;
+
+import com.alibaba.fastjson.JSONObject;
+
+public interface IMaterialUsrService {
+    JSONObject getMaterialUseInfo(String code);
+}

+ 69 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/fileupload/service/impl/MaterialUsrServiceImpl.java

@@ -0,0 +1,69 @@
+package org.jeecg.modules.fileupload.service.impl;
+
+import cn.com.ctop.common.module.utils.Check;
+import com.alibaba.fastjson.JSONObject;
+import org.jeecg.modules.fileupload.mapper.MaterialUsrServiceMapper;
+import org.jeecg.modules.fileupload.service.IMaterialUsrService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+@Service
+public class MaterialUsrServiceImpl implements IMaterialUsrService {
+    @Autowired
+    private MaterialUsrServiceMapper materialUsrServiceMapper;
+
+
+    @Override
+    public JSONObject getMaterialUseInfo(String code) {
+        JSONObject returnJson = new JSONObject();
+        List<JSONObject> kuaishouInfo = this.getKuaiShouMaterialInfo(code);
+        returnJson.put("kuaishou", kuaishouInfo);
+        List<JSONObject> byteDanceInfo = this.getbyteDanceMaterialInfo(code);
+        returnJson.put("byteDance", byteDanceInfo);
+        return returnJson;
+
+
+    }
+
+
+    private List<JSONObject> getKuaiShouMaterialInfo(String code) {
+        List<JSONObject> accountInfos = materialUsrServiceMapper.getAccountInfo(code);
+        if (Check.isNull(accountInfos)) {
+            return null;
+        }
+        for (int i = 0; i < accountInfos.size(); i++) {
+            JSONObject accountJson = accountInfos.get(i);
+            Long accountId = accountJson.getLong("accountId");
+            String photoId = accountJson.getString("photoId");
+            Integer relationCount = materialUsrServiceMapper.getKuiShouRelationCount(accountId, photoId);
+            accountJson.put("relationCount", relationCount);
+            JSONObject refuseInfo = materialUsrServiceMapper.getKuiShouRefuseRelationCount(accountId, photoId);
+            accountJson.put("refuseInfo", refuseInfo);
+        }
+
+
+        return accountInfos;
+    }
+
+
+    private List<JSONObject> getbyteDanceMaterialInfo(String code) {
+        List<JSONObject> accountInfos = materialUsrServiceMapper.getByteDanceAccountInfo(code);
+        if (Check.isNull(accountInfos)) {
+            return null;
+        }
+        for (int i = 0; i < accountInfos.size(); i++) {
+            JSONObject accountJson = accountInfos.get(i);
+            String accountId = accountJson.getString("accountId");
+            String vid = accountJson.getString("vid");
+            Integer relationCount = materialUsrServiceMapper.getByteDanceRelationCount(accountId, vid);
+            accountJson.put("relationCount", relationCount);
+        }
+
+
+        return accountInfos;
+    }
+
+
+}