|
@@ -7,7 +7,10 @@ import com.fdkankan.ucenter.common.RedisKeyUtil;
|
|
|
import com.fdkankan.ucenter.constant.QrCodeFilePath;
|
|
|
import java.io.File;
|
|
|
import java.util.Date;
|
|
|
+import java.util.Map;
|
|
|
import java.util.Objects;
|
|
|
+
|
|
|
+import com.fdkankan.ucenter.service.ISceneProService;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.scheduling.annotation.Scheduled;
|
|
@@ -19,11 +22,12 @@ public class TaskService {
|
|
|
|
|
|
@Autowired
|
|
|
RedisUtil redisUtil;
|
|
|
+ @Autowired
|
|
|
+ ISceneProService sceneProService;
|
|
|
|
|
|
@Scheduled(cron = "0 */10 * * * ?")
|
|
|
public void delLoginQrCode(){
|
|
|
long startTime = new Date().getTime();
|
|
|
- log.info("delLoginQrCode:开始定时清理本地登录二维码" );
|
|
|
String qrCodePath = QrCodeFilePath.LOGIN_QR_CODE_PATH;
|
|
|
String aliQrCodePath = QrCodeFilePath.ALI_QRCODE_FOLDER;
|
|
|
String wxCodePath = QrCodeFilePath.WEIXIN_QRCODE_FOLDER;
|
|
@@ -37,6 +41,17 @@ public class TaskService {
|
|
|
delFile(files1);
|
|
|
delFile(files2);
|
|
|
log.info("delLoginQrCode:结束定时清理本地登录二维码:耗时{}秒",(new Date().getTime() - startTime)/1000 );
|
|
|
+
|
|
|
+ this.updateSceneViewCount();
|
|
|
+ }
|
|
|
+
|
|
|
+ private void updateSceneViewCount() {
|
|
|
+ String redisKey = RedisKeyUtil.V4_SCENE_VISIT_CNT;
|
|
|
+ Map<String,String> hmget = redisUtil.hmget(redisKey);
|
|
|
+ for (String key : hmget.keySet()) {
|
|
|
+ log.info("定时更新场景viewCount--num:{},viewCount:{}",key,hmget.get(key));
|
|
|
+ sceneProService.updateDbViewCount(key,hmget.get(key));
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
private void delFile(File[] files){
|