private synchronized void refreshAppList(boolean auto) { try { updating = true; Set<String> imgSet = getImgs(); List<Machine> machines = MachineUtils.getMachineList(); appDao.deleteAutoUpdatedRecords(); HashSet<String> set = new HashSet<String>(); for (Machine machine : machines) { String data = thirdAppService.getAppData(machine.getCode(), "3.0"); AppVO appVO = jsonMapper.fromJson(data, AppVO.class); if (appVO.getState().equals("0000")) { for (AppInfo appInfo : appVO.getZone()) { App app = new App(); app.setActionUrl(jsonMapper.toJson(appInfo.getData())); app.setUrl1080(upload(appInfo.getIcon())); app.setClientType(machine.getCode()); app.setTitle(jsonMapper.toJson(new String[] {appInfo.getName()})); app.setUpdateRefer("app:1"); if (auto) { User user = new User(); user.setId(1L); app.setUser(user); } else { app.setUser(UserUtils.getUser()); } appDao.save(app); set.add(app.getUpdateRefer()); } } } for (String ur : set) { templateService.evictTplByUpdateRefer(ur); } } catch (Exception e) { throw new RuntimeException(e); } finally { updating = false; } }
@Log(context = "资源管理", object = "App管理", action = 1, detail = "保存App") public void saveApp(App app) { appDao.save(app); }