Bläddra i källkod

d 度小满素材审核定时任务

zhaoxian 2 år sedan
förälder
incheckning
dde96b901b

+ 2 - 0
module-common/src/main/java/cn/com/ctop/common/module/mapper/MaterialInfoMapper.java

@@ -50,5 +50,7 @@ public interface MaterialInfoMapper extends BaseMapper<MaterialInfo> {
 
     void updateByteDanceByCode(@Param("code") String code);
 
+    List<Long> getDuxiaomanMaterialInfoByStatus(@Param("status") Integer status);
+
     // List<MaterialInfo> getListByParams(String tagCode, String type, Integer status, String materialName, String code, String startDate, String endDate, List<Long> projectIds, String ascription, String clipId, String shotId, String planId, Integer offlineFlag);
 }

+ 8 - 0
module-common/src/main/java/cn/com/ctop/common/module/mapper/xml/MaterialInfoMapper.xml

@@ -205,6 +205,14 @@
          GROUP BY `code`
 
     </select>
+
+    <select id="getDuxiaomanMaterialInfoByStatus" resultType="java.lang.String">
+        SELECT id FROM `ctop_duxiaoman_material_info`
+        WHERE stat_date >= DATE_FORMAT(DATE_SUB(NOW(),INTERVAL 1 DAY),'%Y-%m-%d')
+        AND stat_date &lt;= DATE_FORMAT(NOW(),'%Y-%m-%d')
+        AND `status` = #{status}
+    </select>
+
     <select id="getBytedanceCountByCode" resultType="java.lang.Integer">
         SELECT count(1)  from  ctop_bytedance_video_info WHERE signature = #{code}
     </select>

+ 2 - 0
module-common/src/main/java/cn/com/ctop/common/module/service/IMaterialInfoService.java

@@ -94,4 +94,6 @@ public interface IMaterialInfoService extends IService<MaterialInfo> {
     Integer getBytedanceCountByCode(String s);
 
     void updateByteDanceByCode(String s);
+
+    List<Long> getDuxiaomanMaterialInfoByStatus(Integer status);
 }

+ 4 - 0
module-common/src/main/java/cn/com/ctop/common/module/service/impl/MaterialInfoServiceImpl.java

@@ -890,6 +890,10 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
         materialInfoMapper.updateByteDanceByCode(s);
     }
 
+    @Override
+    public List<Long> getDuxiaomanMaterialInfoByStatus(Integer status) {
+        return baseMapper.getDuxiaomanMaterialInfoByStatus(status);
+    }
 
     @Override
     public JSONArray getIdListByProject(Long projectId) {

+ 85 - 0
module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/DuxiaomanJob.java

@@ -0,0 +1,85 @@
+package cn.com.ctop.job.kuaishou.handler;
+
+import cn.com.ctop.common.module.service.IMaterialInfoService;
+import cn.com.ctop.common.module.utils.Check;
+import cn.com.ctop.common.module.utils.HttpUtils2;
+import com.xxl.job.core.handler.annotation.XxlJob;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+@Slf4j
+@Component
+public class DuxiaomanJob {
+
+    @Value("${xxl-job.requestUrl}")
+    private String jobUrl;
+
+    @Autowired
+    private IMaterialInfoService materialInfoService;
+
+    /**
+     * 将1-待上传状态de素材 进行 上传媒体
+     */
+    @XxlJob("uploadMaterial")
+    public void uploadMaterial() throws InterruptedException {
+        String url = jobUrl + "/jeecg-boot/duxiaoman/materialInfo/uploadMaterial";
+
+        //0-待审核,1-待上传,2-审批中,3-审核通过,4-审核不通过,5-预审核,6-预审核拒绝,7-上传成功,8-上传失败
+        List<Long> idList = materialInfoService.getDuxiaomanMaterialInfoByStatus(1);
+        if (Check.isNull(idList)) {
+            return;
+        }
+        for (Long id : idList) {
+            Map<String, Object> requestMap = new HashMap<>();
+            requestMap.put("id", id);
+            HttpUtils2.httpGet(url, requestMap, null);
+            Thread.sleep(2000);
+        }
+    }
+
+    /**
+     * 将7-上传成功状态de素材 进行 素材报备
+     */
+    @XxlJob("materialReport")
+    public void materialReport() throws InterruptedException {
+        String url = jobUrl + "/jeecg-boot/duxiaoman/materialInfo/materialReport";
+
+        //0-待审核,1-待上传,2-审批中,3-审核通过,4-审核不通过,5-预审核,6-预审核拒绝,7-上传成功,8-上传失败
+        List<Long> idList = materialInfoService.getDuxiaomanMaterialInfoByStatus(7);
+        if (Check.isNull(idList)) {
+            return;
+        }
+        for (Long id : idList) {
+            Map<String, Object> requestMap = new HashMap<>();
+            requestMap.put("id", id);
+            HttpUtils2.httpGet(url, requestMap, null);
+            Thread.sleep(2000);
+        }
+    }
+
+    /**
+     * 将2-审批中状态的素材 进行 更新报备状态
+     */
+    @XxlJob("materialDetail")
+    public void materialDetail() throws InterruptedException {
+        String url = jobUrl + "/jeecg-boot/duxiaoman/materialInfo/materialDetail";
+
+        //0-待审核,1-待上传,2-审批中,3-审核通过,4-审核不通过,5-预审核,6-预审核拒绝,7-上传成功,8-上传失败
+        List<Long> idList = materialInfoService.getDuxiaomanMaterialInfoByStatus(2);
+        if (Check.isNull(idList)) {
+            return;
+        }
+        for (Long id : idList) {
+            Map<String, Object> requestMap = new HashMap<>();
+            requestMap.put("id", id);
+            HttpUtils2.httpGet(url, requestMap, null);
+            Thread.sleep(2000);
+        }
+    }
+}