|
@@ -54,17 +54,6 @@ public class THotUpdateController {
|
|
|
@ApiOperation(value = "设备热更新+1")
|
|
|
@PostMapping("/upPatchNum")
|
|
|
public ResponseModel<?> upPatchNum(String patchVersion) {
|
|
|
-// Long patchId = hotUpdateService.lambdaQuery().eq(THotUpdate::getPatchVersion, patchVersion).one().getId();
|
|
|
-// TEquipment equipment = equipmentService.lambdaQuery().eq(TEquipment::getClientId, clientId).one();
|
|
|
-// Long equipmentId = equipment.getId();
|
|
|
-// TEquipmentDesc equipmentDesc = equipmentDescService.lambdaQuery().eq(TEquipmentDesc::getEquipmentId, equipmentId).one();
|
|
|
-// equipmentDesc.setPatchId(patchId);
|
|
|
-// equipmentDescService.saveOrUpdate(equipmentDesc);
|
|
|
-
|
|
|
-// UpdateWrapper<THotUpdate> uw = new UpdateWrapper<>();
|
|
|
-// uw.eq("patch_version", patchVersion)
|
|
|
-// .setSql("have_update_num = have_update_num + 1, modify_time = NOW()");
|
|
|
-// hotUpdateService.update(uw);
|
|
|
|
|
|
THotUpdate hotUpdate = hotUpdateService.lambdaQuery().eq(THotUpdate::getPatchVersion, patchVersion).one();
|
|
|
hotUpdate.setModifyTime(new Date());
|
|
@@ -148,55 +137,6 @@ public class THotUpdateController {
|
|
|
return R.ok(lastTen);
|
|
|
}
|
|
|
|
|
|
-// @ApiOperation(value = "获取补丁下载链接")
|
|
|
-// @GetMapping("/getPatchUrl")
|
|
|
-// public ResponseModel<?> getPatchUrl(String clientId, String isForeign) {
|
|
|
-//
|
|
|
-// if (StringUtils.isEmpty(clientId) || StringUtils.isEmpty(isForeign)) {
|
|
|
-// return R.fail(ResponseCodesEnum.B0001, "参数不能为空");
|
|
|
-// }
|
|
|
-// LambdaQueryWrapper<TEquipment> wrapper = Wrappers.lambdaQuery();
|
|
|
-// wrapper.eq(TEquipment::getClientId, clientId);
|
|
|
-// TEquipment equipment = equipmentService.getOne(wrapper);
|
|
|
-// Long adminId = equipment.getAdminId();
|
|
|
-// TAdmin admin = adminService.getById(adminId);
|
|
|
-// String ifForeign = admin.getIfForeign();
|
|
|
-// if (!isForeign.equals(ifForeign)) {
|
|
|
-// return R.fail(ResponseCodesEnum.B0001, "海外内不匹配");
|
|
|
-// }
|
|
|
-// Long equipmentId = equipment.getId();
|
|
|
-// LambdaQueryWrapper<TEquipmentDesc> lqw = Wrappers.lambdaQuery();
|
|
|
-// lqw.eq(TEquipmentDesc::getEquipmentId, equipmentId);
|
|
|
-// TEquipmentDesc equipmentDesc = equipmentDescService.getOne(lqw);
|
|
|
-// Long patchId = equipmentDesc.getPatchId();
|
|
|
-//
|
|
|
-// LambdaQueryWrapper<THotUpdate> qw = Wrappers.lambdaQuery();
|
|
|
-// qw.eq(THotUpdate::getId, patchId);
|
|
|
-// THotUpdate hotUpdate = hotUpdateService.getOne(qw);
|
|
|
-// return R.ok(hotUpdate);
|
|
|
-// }
|
|
|
-
|
|
|
-// @ApiOperation(value = "测试")
|
|
|
-// @PostMapping("/test")
|
|
|
-// public ResponseModel<?> test() {
|
|
|
-// // 遍历所有设备的apk_version,看多少台设备的apk_version = patch_veriosn
|
|
|
-// // 获取热更新表中所有的 patch_version 信息
|
|
|
-// List<String> patchVersions = hotUpdateService.list().stream().map(THotUpdate::getPatchVersion).collect(Collectors.toList());
|
|
|
-// for (String patchVersion : patchVersions) {
|
|
|
-// // 查询所有设备表中的的 apk_version 等于 patch_version的
|
|
|
-// List<TEquipment> equipmentList = equipmentService.lambdaQuery().eq(TEquipment::getApkVersion, patchVersion).list();
|
|
|
-// // 计算当前的 patch_version = apk_version 的设备数量
|
|
|
-// int count = equipmentList.size();
|
|
|
-// System.out.println("count 》》》" + count);
|
|
|
-// THotUpdate hotUpdate = hotUpdateService.lambdaQuery().eq(THotUpdate::getPatchVersion, patchVersion).one();
|
|
|
-// if (hotUpdate != null) {
|
|
|
-// hotUpdate.setHaveUpdateNum(count);
|
|
|
-// hotUpdateService.updateById(hotUpdate);
|
|
|
-// }
|
|
|
-// }
|
|
|
-// return R.ok();
|
|
|
-// }
|
|
|
-
|
|
|
@ApiOperation(value = "添加热更新信息")
|
|
|
@PostMapping("/postPatchInfo")
|
|
|
public ResponseModel<?> postPatchInfo(@RequestBody THotUpdate hotUpdate) {
|
|
@@ -457,29 +397,6 @@ public class THotUpdateController {
|
|
|
return R.fail(ResponseCodesEnum.B0001, "推送区域为空时,需要填写设备编号");
|
|
|
}
|
|
|
// 推送指定设备
|
|
|
-// tHotUpdate.setClientId(clientIdS);
|
|
|
-// String[] clientIdArray = clientIdS.split(",");
|
|
|
-// ArrayList<Long> equipmentIdList0 = new ArrayList<>();
|
|
|
-//
|
|
|
-// for (String s : clientIdArray) {
|
|
|
-// String clientId = s.trim();
|
|
|
-// if (StringUtils.isNotEmpty(clientId)) {
|
|
|
-// LambdaQueryWrapper<TEquipment> wrapper = Wrappers.lambdaQuery();
|
|
|
-// wrapper.eq(TEquipment::getClientId, clientId);
|
|
|
-// TEquipment equipment = equipmentService.getOne(wrapper);
|
|
|
-// if (Objects.isNull(equipment)) {
|
|
|
-// return R.fail(ResponseCodesEnum.B0001, "设备信息不存在");
|
|
|
-// }
|
|
|
-// Long equipmentId = equipment.getId();
|
|
|
-// equipmentIdList0.add(equipmentId);
|
|
|
-//// saveOrUpdateEquipmentDesc(equipmentId, hotUpdateId);
|
|
|
-// }
|
|
|
-// }
|
|
|
-// if (!equipmentIdList0.isEmpty()) {
|
|
|
-//// saveOrUpdateEquipmentDescBatch(equipmentIdList0, hotUpdateId);
|
|
|
-// hotUpdateService.saveOrUpdateEquipmentDescBatch(equipmentIdList0, hotUpdateId);
|
|
|
-// }
|
|
|
-
|
|
|
List<String> clientIdList = Arrays.asList(clientIdS.split(","));
|
|
|
LambdaQueryWrapper<TEquipment> wrapper1 = Wrappers.lambdaQuery();
|
|
|
wrapper1.in(TEquipment::getClientId, clientIdList);
|
|
@@ -515,47 +432,16 @@ public class THotUpdateController {
|
|
|
break;
|
|
|
case "2":
|
|
|
// 推送海外
|
|
|
-// LambdaQueryWrapper<TAdmin> lambdaQuery = Wrappers.lambdaQuery();
|
|
|
-// lambdaQuery.eq(TAdmin::getIfForeign, "1");
|
|
|
-// List<TAdmin> abroadList = adminService.list(lambdaQuery);
|
|
|
-// ArrayList<Long> equipmentIdList2 = new ArrayList<>();
|
|
|
-// for (TAdmin admin : abroadList) {
|
|
|
-// Long adminId = admin.getId();
|
|
|
-// LambdaQueryWrapper<TEquipment> lqw = Wrappers.lambdaQuery();
|
|
|
-// lqw.eq(TEquipment::getAdminId, adminId);
|
|
|
-// List<TEquipment> equipmentList = equipmentService.list(lqw);
|
|
|
-// for (TEquipment equipment : equipmentList) {
|
|
|
-// Long equipmentId = equipment.getId();
|
|
|
-// equipmentIdList2.add(equipmentId);
|
|
|
-//// saveOrUpdateEquipmentDesc(equipmentId, hotUpdateId);
|
|
|
-// }
|
|
|
-// }
|
|
|
-// if (!equipmentIdList2.isEmpty()) {
|
|
|
-//// saveOrUpdateEquipmentDescBatch(equipmentIdList2, hotUpdateId);
|
|
|
-// hotUpdateService.saveOrUpdateEquipmentDescBatch(equipmentIdList2,hotUpdateId);
|
|
|
-// }
|
|
|
|
|
|
List<TAdmin> adminList = adminService.lambdaQuery().eq(TAdmin::getIfForeign, "1").list();
|
|
|
List<Long> equipmentIdList3 = adminList.stream().flatMap(admin -> equipmentService.lambdaQuery().eq(TEquipment::getAdminId, admin.getId()).list().stream()).map(TEquipment::getId).collect(Collectors.toList());
|
|
|
if (!equipmentIdList3.isEmpty()) {
|
|
|
-// saveOrUpdateEquipmentDescBatch(equipmentIdList3, hotUpdateId);
|
|
|
equipmentDescService.saveOrUpdateEquipmentDescBatch(equipmentIdList3, hotUpdateId);
|
|
|
}
|
|
|
|
|
|
break;
|
|
|
case "3":
|
|
|
// 推送全球
|
|
|
-// List<TEquipmentDesc> equipmentDescAll = equipmentDescService.list();
|
|
|
-// ArrayList<TEquipmentDesc> equipmentDescArrayList = new ArrayList<>();
|
|
|
-//
|
|
|
-// for (TEquipmentDesc equipmentDesc : equipmentDescAll) {
|
|
|
-// equipmentDesc.setPatchId(hotUpdateId);
|
|
|
-// equipmentDescArrayList.add(equipmentDesc);
|
|
|
-//// equipmentDescService.saveOrUpdate(equipmentDesc);
|
|
|
-// }
|
|
|
-// if (!equipmentDescArrayList.isEmpty()) {
|
|
|
-// equipmentDescService.saveOrUpdateBatch(equipmentDescArrayList);
|
|
|
-// }
|
|
|
|
|
|
List<TEquipmentDesc> equipmentDescList = equipmentDescService.list();
|
|
|
equipmentDescList.forEach(d -> d.setPatchId(hotUpdateId));
|