|
@@ -1,113 +1,91 @@
|
|
|
-//package com.fdkankan.job.job;
|
|
|
-//
|
|
|
-//import cn.hutool.core.collection.CollUtil;
|
|
|
-//import cn.hutool.core.img.ImgUtil;
|
|
|
-//import cn.hutool.core.util.StrUtil;
|
|
|
-//import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
-//import com.fdkankan.common.constant.CommonOperStatus;
|
|
|
-//import com.fdkankan.common.util.DateExtUtil;
|
|
|
-//import com.fdkankan.dingtalk.DingTalkSendUtils;
|
|
|
-//import com.fdkankan.job.entity.SceneBuildProcessLog;
|
|
|
-//import com.fdkankan.job.entity.ScenePlus;
|
|
|
-//import com.fdkankan.job.entity.ScenePro;
|
|
|
-//import com.fdkankan.job.service.ISceneBuildProcessLogService;
|
|
|
-//import com.fdkankan.job.service.ISceneCleanOrigService;
|
|
|
-//import com.fdkankan.job.service.IScenePlusService;
|
|
|
-//import com.fdkankan.job.service.ISceneProService;
|
|
|
-//import com.fdkankan.model.constants.SceneBuildProcessType;
|
|
|
-//import com.fdkankan.redis.constant.RedisLockKey;
|
|
|
-//import com.fdkankan.redis.util.RedisLockUtil;
|
|
|
-//import com.xxl.job.core.context.XxlJobHelper;
|
|
|
-//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.cloud.context.config.annotation.RefreshScope;
|
|
|
-//import org.springframework.stereotype.Component;
|
|
|
-//
|
|
|
-//import java.io.File;
|
|
|
-//import java.sql.SQLException;
|
|
|
-//import java.util.ArrayList;
|
|
|
-//import java.util.Calendar;
|
|
|
-//import java.util.Date;
|
|
|
-//import java.util.List;
|
|
|
-//import java.util.concurrent.atomic.AtomicInteger;
|
|
|
-//import java.util.stream.Collectors;
|
|
|
-//
|
|
|
-///**
|
|
|
-// * <p>
|
|
|
-// * 场景冻结定时任务
|
|
|
-// * </p>
|
|
|
-// *
|
|
|
-// * @author dengsixing
|
|
|
-// * @since 2022/12/16
|
|
|
-// **/
|
|
|
-//@RefreshScope
|
|
|
-//@Component
|
|
|
-//@Slf4j
|
|
|
-//public class SceneColdStorageHandler {
|
|
|
-//
|
|
|
-// @Value("${env}")
|
|
|
-// private String env;
|
|
|
-//
|
|
|
-// @Autowired
|
|
|
-// private IScenePlusService scenePlusService;
|
|
|
-// @Autowired
|
|
|
-// private ISceneProService sceneProService;
|
|
|
-// @Autowired
|
|
|
-// private RedisLockUtil redisLockUtil;
|
|
|
-// @Autowired
|
|
|
-// private ISceneCleanOrigService sceneCleanOrigService;
|
|
|
-//
|
|
|
-// @XxlJob("coldStorageHomeV3")
|
|
|
-// public void coldStorageHomeV3() throws Exception {
|
|
|
-// XxlJobHelper.log("coldStorageHomeV3 start.....");
|
|
|
-//
|
|
|
-// log.info("冻结v3场景原始资源开始");
|
|
|
-// String lockKey = RedisLockKey.LOCK_CLEAN_SCENE_ORIG_V3;
|
|
|
-// try {
|
|
|
-// boolean lock = redisLockUtil.lock(lockKey, 24*60*60);
|
|
|
-// if(!lock){
|
|
|
-// return;
|
|
|
-// }
|
|
|
-// sceneCleanOrigService.coldStorageHomeV3();
|
|
|
-// }finally {
|
|
|
-// redisLockUtil.unlockLua(lockKey);
|
|
|
-// }
|
|
|
-// log.info("冻结v3场景原始资源结束");
|
|
|
-//
|
|
|
-//
|
|
|
-//
|
|
|
-// XxlJobHelper.log("coldStorageHomeV3 end.....");
|
|
|
-// }
|
|
|
-//
|
|
|
-// @XxlJob("coldStorageHomeV4")
|
|
|
-// public void coldStorageHomeV4() throws Exception {
|
|
|
-// XxlJobHelper.log("coldStorageHomeV4 start.....");
|
|
|
-//
|
|
|
-// log.info("冻结v4场景原始资源开始");
|
|
|
-// String lockKey = RedisLockKey.LOCK_CLEAN_SCENE_ORIG_V4;
|
|
|
-// try {
|
|
|
-// boolean lock = redisLockUtil.lock(lockKey, 24*60*60);
|
|
|
-// if(!lock){
|
|
|
-// return;
|
|
|
-// }
|
|
|
-// sceneCleanOrigService.coldStorageHomeV4();
|
|
|
-// }finally {
|
|
|
-// redisLockUtil.unlockLua(lockKey);
|
|
|
-// }
|
|
|
-// log.info("冻结v4场景原始资源结束");
|
|
|
-//
|
|
|
-//
|
|
|
-//
|
|
|
-// XxlJobHelper.log("coldStorageHomeV4 end.....");
|
|
|
-// }
|
|
|
-//
|
|
|
-// public static void main(String[] args) throws SQLException {
|
|
|
-//
|
|
|
-// ImgUtil.scale(new File("C:\\Users\\dsx\\Desktop\\test\\20230116173304.jpg"), new File("C:\\Users\\dsx\\Desktop\\test\\3.jpg"), (float) 0.3);
|
|
|
-//
|
|
|
-// }
|
|
|
-//
|
|
|
-//
|
|
|
-//}
|
|
|
+package com.fdkankan.job.job;
|
|
|
+
|
|
|
+import cn.hutool.core.img.ImgUtil;
|
|
|
+import com.fdkankan.job.service.ISceneCleanOrigService;
|
|
|
+import com.fdkankan.job.service.IScenePlusService;
|
|
|
+import com.fdkankan.job.service.ISceneProService;
|
|
|
+import com.fdkankan.redis.constant.RedisLockKey;
|
|
|
+import com.fdkankan.redis.util.RedisLockUtil;
|
|
|
+import com.xxl.job.core.context.XxlJobHelper;
|
|
|
+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.cloud.context.config.annotation.RefreshScope;
|
|
|
+import org.springframework.stereotype.Component;
|
|
|
+
|
|
|
+import java.io.File;
|
|
|
+import java.sql.SQLException;
|
|
|
+
|
|
|
+/**
|
|
|
+ * <p>
|
|
|
+ * 场景冻结定时任务
|
|
|
+ * </p>
|
|
|
+ *
|
|
|
+ * @author dengsixing
|
|
|
+ * @since 2022/12/16
|
|
|
+ **/
|
|
|
+@RefreshScope
|
|
|
+@Component
|
|
|
+@Slf4j
|
|
|
+public class SceneColdStorageHandler {
|
|
|
+
|
|
|
+ @Value("${env}")
|
|
|
+ private String env;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IScenePlusService scenePlusService;
|
|
|
+ @Autowired
|
|
|
+ private ISceneProService sceneProService;
|
|
|
+ @Autowired
|
|
|
+ private RedisLockUtil redisLockUtil;
|
|
|
+ @Autowired
|
|
|
+ private ISceneCleanOrigService sceneCleanOrigService;
|
|
|
+
|
|
|
+ @XxlJob("coldStorageHomeV3")
|
|
|
+ public void coldStorageHomeV3() throws Exception {
|
|
|
+ XxlJobHelper.log("coldStorageHomeV3 start.....");
|
|
|
+
|
|
|
+ log.info("冻结v3场景原始资源开始");
|
|
|
+ String lockKey = RedisLockKey.LOCK_CLEAN_SCENE_ORIG_V3;
|
|
|
+ try {
|
|
|
+ boolean lock = redisLockUtil.lock(lockKey, 24*60*60);
|
|
|
+ if(!lock){
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ sceneCleanOrigService.coldStorageHomeV3();
|
|
|
+ }finally {
|
|
|
+ redisLockUtil.unlockLua(lockKey);
|
|
|
+ }
|
|
|
+ log.info("冻结v3场景原始资源结束");
|
|
|
+
|
|
|
+ XxlJobHelper.log("coldStorageHomeV3 end.....");
|
|
|
+ }
|
|
|
+
|
|
|
+ @XxlJob("coldStorageHomeV4")
|
|
|
+ public void coldStorageHomeV4() throws Exception {
|
|
|
+ XxlJobHelper.log("coldStorageHomeV4 start.....");
|
|
|
+ log.info("冻结v4场景原始资源开始");
|
|
|
+ String lockKey = RedisLockKey.LOCK_CLEAN_SCENE_ORIG_V4;
|
|
|
+ try {
|
|
|
+ boolean lock = redisLockUtil.lock(lockKey, 24*60*60);
|
|
|
+ if(!lock){
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ sceneCleanOrigService.coldStorageHomeV4();
|
|
|
+ }finally {
|
|
|
+ redisLockUtil.unlockLua(lockKey);
|
|
|
+ }
|
|
|
+ log.info("冻结v4场景原始资源结束");
|
|
|
+
|
|
|
+ XxlJobHelper.log("coldStorageHomeV4 end.....");
|
|
|
+ }
|
|
|
+
|
|
|
+ public static void main(String[] args) throws SQLException {
|
|
|
+
|
|
|
+ ImgUtil.scale(new File("C:\\Users\\dsx\\Desktop\\test\\20230116173304.jpg"), new File("C:\\Users\\dsx\\Desktop\\test\\3.jpg"), (float) 0.3);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+}
|