增加上传apk安装信息,未加鉴权

This commit is contained in:
2025-09-05 09:53:21 +08:00
parent 5ce369db71
commit 153137379d
13 changed files with 186 additions and 155 deletions

View File

@@ -1,37 +0,0 @@
package com.onekeycall.videotablet.controller;
import com.onekeycall.videotablet.entity.ApkInfo;
import com.onekeycall.videotablet.service.ApkInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@RestController
@RequestMapping("/api/apks")
public class ApkInfoController {
@Autowired
private ApkInfoService apkInfoService;
@GetMapping("/device/{deviceId}")
public List<ApkInfo> getApksByDeviceId(@PathVariable String deviceId) {
return apkInfoService.getApkInfosByDeviceId(deviceId);
}
@PostMapping
public ApkInfo saveApkInfo(@RequestBody ApkInfo apkInfo) {
return apkInfoService.saveOrUpdateApkInfo(apkInfo);
}
@PostMapping("/batch")
public List<ApkInfo> saveApkInfos(@RequestBody List<ApkInfo> apkInfos) {
return apkInfoService.saveAllApkInfos(apkInfos);
}
@DeleteMapping("/{packageName}")
public void deleteApkInfo(@PathVariable String packageName) {
apkInfoService.deleteApkInfoByPackageName(packageName);
}
}

View File

@@ -0,0 +1,43 @@
package com.onekeycall.videotablet.controller;
import com.aliyun.core.annotation.Body;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.onekeycall.videotablet.bean.ApkUploadRequest;
import com.onekeycall.videotablet.entity.ApkInfo;
import com.onekeycall.videotablet.entity.DeviceApkInfo;
import com.onekeycall.videotablet.result.Result;
import com.onekeycall.videotablet.service.DeviceApkInfoService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@RestController
@RequestMapping("/sn")
public class DeviceApkInfoController {
static Logger logger = LoggerFactory.getLogger(DeviceApkInfoController.class);
private final ObjectMapper objectMapper; // Spring默认已注入
public DeviceApkInfoController(ObjectMapper objectMapper) {
this.objectMapper = objectMapper;
}
@Autowired
private DeviceApkInfoService deviceApkInfoService;
@PostMapping("/upload_install_apks")
public Result uploadInstallApks(@RequestBody ApkUploadRequest request) {
String sn = request.getSn();
List<ApkInfo> apkList = request.getApk_list();
if (apkList == null || apkList.size() == 0) {
return Result.error().message("应用列表为空");
}
deviceApkInfoService.saveOrUpdateDeviceApkInfo(sn, apkList);
return Result.ok();
}
}

View File

@@ -2,10 +2,12 @@ package com.onekeycall.videotablet.controller;
import com.nimbusds.openid.connect.sdk.claims.UserInfo;
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.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;
@@ -36,6 +38,8 @@ public class UserController {
private DeviceSnService deviceSnService;
@Autowired
private DeviceLocationService deviceLocationService;
@Autowired
private DeviceApkInfoService deviceApkInfoService;
Logger logger = LoggerFactory.getLogger(LoginController.class);
@@ -137,4 +141,10 @@ public class UserController {
return Result.ok().data("device_location", deviceLocation);
}
@GetMapping("/get_device_apk_list")
public Result getDeviceApkList(@RequestParam String sn) {
DeviceApkInfo deviceApkInfo = deviceApkInfoService.getDeviceApkInfoBySn(sn);
return Result.ok().data("deviceApkInfo", deviceApkInfo);
}
}