yumeng 5 일 전
부모
커밋
6bc5621430

+ 0 - 14
job-adq/src/main/java/cn/com/ctop/job/adq/data/mapper/MovieLevelMapper.java

@@ -1,14 +0,0 @@
-package cn.com.ctop.job.adq.data.mapper;
-
-import com.alibaba.fastjson.JSONObject;
-import org.apache.ibatis.annotations.Param;
-
-import java.util.List;
-
-public interface MovieLevelMapper {
-    List<JSONObject> getMovieList();
-
-    Integer checkLog(@Param("videoProjectId") String videoProjectId, @Param("level") String level);
-
-    void insertSendLog(@Param("videoProjectId") String videoProjectId, @Param("level") String level);
-}

+ 0 - 25
job-adq/src/main/java/cn/com/ctop/job/adq/data/mapper/xml/MovieLevelMapper.xml

@@ -1,25 +0,0 @@
-<?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="cn.com.ctop.job.adq.data.mapper.MovieLevelMapper">
-    <insert id="insertSendLog">
-        INSERT INTO thirtpart.send_movie_level_log(video_project_id, video_project_level)
-        VALUES (#{videoProjectId}, #{level});
-
-    </insert>
-
-
-    <select id="getMovieList" resultType="com.alibaba.fastjson.JSONObject">
-        select video_project_id as 'videoProjectId', video_project_name as 'videoProjectName', diff_day as 'diffDay', sum_cost as 'sumCost',
-            t2.source as 'source',t2.content_type as 'contentType'
-        from application.video_project_cost_detail t1 left join thirtpart.ly_video_project t2
-                                                                on t1.video_project_id = t2.id
-        where diff_day &lt;= 91
-
-    </select>
-    <select id="checkLog" resultType="java.lang.Integer">
-        select count(1)
-        from thirtpart.send_movie_level_log
-        where video_project_id = #{videoProjectId}
-          and video_project_level = #{level}
-    </select>
-</mapper>

+ 0 - 10
job-adq/src/main/java/cn/com/ctop/job/adq/data/service/IMovieLevelService.java

@@ -1,10 +0,0 @@
-package cn.com.ctop.job.adq.data.service;
-
-import com.alibaba.fastjson.JSONObject;
-
-import java.util.List;
-
-public interface IMovieLevelService {
-
-    void sendMovieLevel();
-}

+ 0 - 156
job-adq/src/main/java/cn/com/ctop/job/adq/data/service/impl/MovieLevelServiceImpl.java

@@ -1,156 +0,0 @@
-package cn.com.ctop.job.adq.data.service.impl;
-
-import cn.com.ctop.job.adq.data.mapper.MovieLevelMapper;
-import cn.com.ctop.job.adq.data.service.IMovieLevelService;
-import cn.com.ctop.job.adq.data.utils.Check;
-import cn.com.ctop.job.adq.data.utils.HttpUtils;
-import com.alibaba.fastjson.JSONObject;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import java.math.BigDecimal;
-import java.util.List;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-
-
-@Service
-@Slf4j
-public class MovieLevelServiceImpl implements IMovieLevelService {
-    @Autowired
-    private MovieLevelMapper movieLevelMapper;
-    private static ExecutorService executorService = Executors.newFixedThreadPool(3);
-
-    @Override
-    public void sendMovieLevel() {
-        List<JSONObject> movieList = movieLevelMapper.getMovieList();
-        if (Check.isNull(movieList)) {
-            return;
-        }
-
-        for (int i = 0; i < movieList.size(); i++) {
-            JSONObject movieJson = movieList.get(i);
-            BigDecimal sumCost = movieJson.getBigDecimal("sumCost");
-            if (Check.isNull(sumCost)) {
-                continue;
-            }
-
-            Integer diffDay = movieJson.getInteger("diffDay");
-            String videoProjectId = movieJson.getString("videoProjectId");
-            String videoProjectName = movieJson.getString("videoProjectName");
-            Integer source = movieJson.getInteger("source");
-            Integer contentType = movieJson.getInteger("contentType");
-            String idNo = getIdNo(contentType, source, videoProjectId);
-
-            String level = getLevelByCost(sumCost);
-            if (Check.isNull(level)) {
-                continue;
-            }
-            if ("C".equals(level)) {
-                if (diffDay < 8) {
-                    log.info("项目ID:{},评级为c上线时间小于8天,不执行消息发送", videoProjectId);
-                    continue;
-                }
-                if (diffDay == 8 || diffDay == 91) { //当上线为第八天和第九十一天时 发送C评级通知
-                    // 验证是否已发送此评级的消息通知
-                    boolean isSend = checkLog(videoProjectId, level);
-                    if (isSend) {
-                        insertAndSendLog(videoProjectId, idNo, videoProjectName, level, diffDay - 1);
-                    } else {
-                        log.info("此评级消息已发送,项目ID:{},评级:{}", videoProjectId, level);
-                    }
-
-                }
-            } else {
-                boolean isSend = checkLog(videoProjectId, level);
-                if (isSend) {
-                    insertAndSendLog(videoProjectId, idNo, videoProjectName, level, diffDay);
-                } else {
-                    log.info("此评级消息已发送,项目ID:{},评级:{}", videoProjectId, level);
-                }
-            }
-        }
-    }
-
-    private synchronized void insertAndSendLog(String videoProjectId, String idNo, String videoProjectName, String level, Integer diffDay) {
-        executorService.submit(new Runnable() {
-            @Override
-            public void run() {
-                sendMessage(idNo, videoProjectName, level, diffDay);
-            }
-        });
-        movieLevelMapper.insertSendLog(videoProjectId, level);
-    }
-
-
-    public void sendMessage(String videoProjectId, String videoProjectName, String level, Integer diffDay) {
-        String url = "https://open.feishu.cn/open-apis/bot/v2/hook/d83f0bf7-add8-462b-b5a2-281a5dfa129c";
-        JSONObject param = new JSONObject();
-        param.put("msg_type", "interactive");
-        JSONObject card = new JSONObject();
-        card.put("type", "template");
-        JSONObject data = new JSONObject();
-        data.put("template_id", "AAqvEjmLDN0jG");
-        JSONObject template_variable = new JSONObject();
-        template_variable.put("videoProjectId", videoProjectId);
-        template_variable.put("videoProjectName", videoProjectName);
-        template_variable.put("diffDay", diffDay);
-        template_variable.put("videoProjectLevel", level);
-        data.put("template_variable", template_variable);
-        card.put("data", data);
-        param.put("card", card);
-        String s = HttpUtils.httpPostRequest(url, param, null);
-        JSONObject jsonObject = JSONObject.parseObject(s);
-        log.info("项目评级发送消息返回:{}", jsonObject);
-
-    }
-
-
-    private String getIdNo(Integer contentType, Integer source, String projectId) {
-        String idNo = "";
-        String prefix = "DJ_";
-        if (contentType != null && contentType == 2) {
-            prefix = "MJ_";
-        }
-        //:1-欢瑞自制,2-欢瑞引入,3-爱奇艺分销,4-穿山甲联盟
-        if (source == 1) {
-            idNo = prefix + "ZZ" + projectId;
-        } else if (source == 2) {
-            idNo = prefix + "YR" + projectId;
-        } else if (source == 3) {
-            idNo = prefix + "FX" + projectId;
-        } else {
-            idNo = prefix + "CSJ" + projectId;
-        }
-        return idNo;
-    }
-
-    private boolean checkLog(String videoProjectId, String level) {
-        Integer count = movieLevelMapper.checkLog(videoProjectId, level);
-        return count == 0;
-    }
-
-    private static String getLevelByCost(BigDecimal sumCost) {
-        if (sumCost.compareTo(new BigDecimal(1000000)) < 0) {
-            return "C";
-        }
-        if (sumCost.compareTo(new BigDecimal(1000000)) >= 0 && sumCost.compareTo(new BigDecimal(2000000)) < 0) {
-            return "B";
-        }
-        if (sumCost.compareTo(new BigDecimal(2000000)) >= 0 && sumCost.compareTo(new BigDecimal(5000000)) < 0) {
-            return "B+";
-        }
-        if (sumCost.compareTo(new BigDecimal(5000000)) >= 0 && sumCost.compareTo(new BigDecimal(8000000)) < 0) {
-            return "A";
-        }
-        if (sumCost.compareTo(new BigDecimal(8000000)) >= 0 && sumCost.compareTo(new BigDecimal(10000000)) < 0) {
-            return "A+";
-        }
-        if (sumCost.compareTo(new BigDecimal(10000000)) >= 0) {
-            return "S";
-        }
-        return null;
-    }
-
-}

+ 0 - 25
job-adq/src/main/java/cn/com/ctop/job/adq/handler/MovieLevelJob.java

@@ -1,25 +0,0 @@
-package cn.com.ctop.job.adq.handler;
-
-
-import cn.com.ctop.job.adq.data.service.IMovieLevelService;
-
-import com.xxl.job.core.handler.annotation.XxlJob;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
-
-
-
-@Slf4j
-@Component
-public class MovieLevelJob {
-    @Autowired
-    private IMovieLevelService movieLevelService;
-
-    @XxlJob("sendMovieLevel")
-    public void sendMovieLevel() throws Exception {
-        movieLevelService.sendMovieLevel();
-    }
-
-
-}

+ 0 - 25
job-adq/src/main/java/cn/com/ctop/job/adq/handler/ProductJob.java

@@ -1,25 +0,0 @@
-package cn.com.ctop.job.adq.handler;
-
-import cn.com.ctop.job.adq.data.utils.HttpUtils;
-import com.xxl.job.core.handler.annotation.XxlJob;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.stereotype.Component;
-
-/**
- * 定时更新产品库
- * https://youhuo.tencent.com/yh/u/58117453/commodity/product_manage/feed_detail/catalog/1075547/feed/37390
- */
-@Slf4j
-@Component
-public class ProductJob {
-    /**
-     * 调取接口上传商品库文件到oss
-     */
-    @XxlJob("upProductFile")
-    public void flowDetailsDaily() throws Exception {
-        log.info("[upProductFile] 任务启动...");
-        String url = "https://api.deepthink.artlinkworld.cn/ossUp/upProductFile?id=hrsj2025";
-        String result = HttpUtils.httpGet(url, null, null);
-        log.info("[upProductFile] 任务完成! 结果:{}", result);
-    }
-}

+ 0 - 38
job-adq/src/main/java/cn/com/ctop/job/adq/handler/ToolsSiteJob.java

@@ -1,38 +0,0 @@
-package cn.com.ctop.job.adq.handler;
-
-
-import cn.com.ctop.job.adq.data.utils.HttpUtils;
-import com.xxl.job.core.handler.annotation.XxlJob;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.stereotype.Component;
-
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-
-
-/**
- * 定时更新
- */
-@Slf4j
-@Component
-public class ToolsSiteJob {
-
-    private static ExecutorService reviewExecutorService = Executors.newFixedThreadPool(3);
-
-    private final String KEY = "bb3648b0b93f2f82135a6dac38dc418f808346a434";
-
-    @XxlJob("regularReview")
-    public void regularReview() throws Exception {
-        try {
-            log.info("[定时催评] 任务启动...");
-            //定期更新短剧审核信息
-            String url = "https://api.cms.artlinkworld.cn/script/review/regularReview";
-            HttpUtils.httpGet(String.format("%s?platform=1&id=%s", url, KEY), null, null);
-            log.info("[定时催评] 执行完成");
-        } catch (Exception e) {
-            log.error("[定时催评] 执行异常");
-            e.printStackTrace();
-        }
-    }
-
-}