增加定时任务删除不存在的图标

This commit is contained in:
2025-09-13 19:36:07 +08:00
parent d9071fdef5
commit b3352a2864
8 changed files with 189 additions and 8 deletions

View File

@@ -3,16 +3,10 @@ package com.onekeycall.videotablet.controller.user;
import com.onekeycall.videotablet.config.PushIdConfig;
import com.onekeycall.videotablet.controller.pub.LoginController;
import com.onekeycall.videotablet.dto.TokenPair;
import com.onekeycall.videotablet.entity.DeviceApkInfo;
import com.onekeycall.videotablet.entity.DeviceInfo;
import com.onekeycall.videotablet.entity.DeviceLocation;
import com.onekeycall.videotablet.entity.User;
import com.onekeycall.videotablet.entity.*;
import com.onekeycall.videotablet.gson.GsonUtils;
import com.onekeycall.videotablet.result.Result;
import com.onekeycall.videotablet.service.DeviceApkInfoService;
import com.onekeycall.videotablet.service.DeviceLocationService;
import com.onekeycall.videotablet.service.DeviceSnService;
import com.onekeycall.videotablet.service.UserService;
import com.onekeycall.videotablet.service.*;
import com.onekeycall.videotablet.utils.DevicePushUtils;
import com.onekeycall.videotablet.utils.JwtUtil;
import com.onekeycall.videotablet.utils.TextUtils;
@@ -26,7 +20,9 @@ import org.springframework.web.bind.annotation.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.concurrent.ExecutionException;
import java.util.function.Consumer;
@RestController
@RequestMapping("/user")
@@ -45,6 +41,8 @@ public class UserController {
private DeviceLocationService deviceLocationService;
@Autowired
private DeviceApkInfoService deviceApkInfoService;
@Autowired
private ApkIconService apkIconService;
Logger logger = LoggerFactory.getLogger(LoginController.class);
@@ -190,6 +188,14 @@ public class UserController {
if (deviceApkInfo == null || deviceApkInfo.getApkList() == null) {
return Result.notFound().message("未找到设备APK信息");
}
List<ApkInfo> apkList = deviceApkInfo.getApkList();
apkList.stream().forEach(new Consumer<ApkInfo>() {
@Override
public void accept(ApkInfo apkInfo) {
Optional<ApkIconFileInfo> apkIconFileInfo = apkIconService.findMaxVersionCodeByPackageName(apkInfo.getPackageName());
apkIconFileInfo.ifPresent(iconFileInfo -> apkInfo.setIconUrl(iconFileInfo.getFileName()));
}
});
return Result.ok().data(deviceApkInfo.getApkList());
}