Example #1
0
 @Log(context = "资源管理", object = "App管理", action = 4, detail = "删除App")
 public void deleteApp(String ids) {
   String[] idArray = ids.split(",");
   for (String id : idArray) {
     if (StringUtilsCustom.isNotBlank(id)) {
       App item = appDao.findOne(Long.valueOf(id));
       appDao.delete(item);
     }
   }
 }
Example #2
0
 @Log(context = "资源管理", object = "App管理", action = 2, detail = "查询App")
 public Page<App> getAllApp(
     int pageNumber, int pageSize, String sortType, Map<String, Object> searchParams) {
   PageRequest pageRequest = buildPageRequest(pageNumber, pageSize, sortType);
   Specification<App> spec = buildSpecification(searchParams, App.class);
   return appDao.findAll(spec, pageRequest);
 }
Example #3
0
  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;
    }
  }
Example #4
0
  public String getUpdatedDate() {
    Date date = appDao.recentUpdatedDate();

    if (date != null) {
      return DateUtilsCustom.formatDate(date, "yyyy年MM月dd日 HH:mm:ss");
    } else {
      return "";
    }
  }
Example #5
0
  private Set<String> getImgs() {
    Set<String> imgSet = new HashSet<String>();
    List<App> apps = appDao.findAutoUpdatedList();

    for (App app : apps) {

      String url1080 = app.getUrl1080();

      if (url1080 != null && !url1080.equals("")) {
        imgSet.add(app.getUrl1080());
      }
    }

    return imgSet;
  }
Example #6
0
 @Log(context = "资源管理", object = "App管理", action = 4, detail = "删除App")
 public void deleteApp(Long id) {
   appDao.deleteById(id);
 }
Example #7
0
 @Log(context = "资源管理", object = "App管理", action = 2, detail = "查询指定App")
 public App getApp(Long id) {
   return appDao.findOne(id);
 }
Example #8
0
 @Log(context = "资源管理", object = "App管理", action = 1, detail = "保存App")
 public void saveApp(App app) {
   appDao.save(app);
 }