Пример #1
0
  @Override
  protected JSONObject check(PAppDetail detail) {

    // 新增一个插件的版本
    if (null != detail.getpAppdetailApkactionid()) {
      //			AppDetail oldOne = dDao.getMaxVersionDetail(detail.getApp_apkactionid());
      PAppDetailDao pAppDetailDao = (PAppDetailDao) SpringContextUtil.getBean("pAppDetailDao");

      PAppDetail oldOne = pAppDetailDao.selectOneByActionId(detail.getpAppdetailApkactionid());

      if (null != oldOne) {
        if (detail.getpAppdetailVersion() <= oldOne.getpAppdetailVersion()) {
          return JSONUtil.checkResult(501, "必须高于已发布最新版本!");
        }

        if (!oldOne.getpAppdetailAdminid().equals(super.getAdminId())) {
          return JSONUtil.checkResult(503, "请勿非法操作!");
        }

        if (oldOne.getpAppdetailAuditstate().equals("5")) {
          return JSONUtil.checkResult(501, "插件已经被下线,无法上传新版本!");
        }
      }
    }
    return null;
  }
Пример #2
0
 @Override
 protected JSONObject insertDB(PAppDetail detail) {
   boolean addNew = false;
   if (detail.getpAppdetailApkactionid() == null) {
     addNew = true;
   }
   try {
     PAppDetailDao pAppDetailDao = (PAppDetailDao) SpringContextUtil.getBean("pAppDetailDao");
     pAppDetailDao.insert(detail);
     return super.returnJson(true);
   } catch (Exception e) {
     return super.returnJson(false);
   }
 }
Пример #3
0
  @Override
  public void check(JSONObject json, ApkinformatonUtil util, PAppDetail detail) {
    if (null == detail.getpAppdetailId() && detail.getpAppdetailApkactionid() != null) {

      String version_check = "";
      String digest_check = "";
      String package_check = "";
      String name_check = "";

      PAppDetailDao pAppDetailDao = (PAppDetailDao) SpringContextUtil.getBean("pAppDetailDao");
      PAppDetail oldOne = pAppDetailDao.selectOneByActionId(detail.getpAppdetailApkactionid());

      if (oldOne != null) {
        if (Integer.parseInt(util.getVersionCode()) <= oldOne.getpAppdetailVersion()) {
          version_check = "必须高于已发布最新版本";
        }

        if (oldOne.getpAppdetailPackagename() != null
            && !oldOne.getpAppdetailPackagename().equals(util.getPackagename())) {
          package_check = "该版本包名与已发布版本不一致";
        }

        if (null == util.getAppname()) {
          name_check = "插件名称不存在";
        } else if (!util.getAppname().equals(oldOne.getpAppdetailName())) {
          name_check = "该版本名称与已发布版本不一致";
        }

        if (oldOne.getpAppdetailCertdigest() != null
            && !oldOne.getpAppdetailCertdigest().equals(util.getDigest())) {
          digest_check = "该版本数字签名与已发布版本不一致";
        }
      }

      json.getAppNode().setVersion_check(version_check);
      json.getAppNode().setPackage_check(package_check);
      json.getAppNode().setName_check(name_check);
      json.getAppNode().setDigest_check(digest_check);
    } else {
      if (next != null) {
        this.next.check(json, util, detail);
      }
    }
  }
Пример #4
0
 @Override
 public void offLine(Integer appId) {
   try {
     PApplication app = new PApplication();
     app.setpAppId(appId);
     app = pApplicationDao.getById(app);
     if (app != null) {
       PAppDetail detail = new PAppDetail();
       detail.setpAppdetailApkactionid(appId);
       detail.setpAppdetailAuditstate("5");
       pAppDetailDao.offLineApp(detail);
     }
   } catch (Exception e) {
     System.out.println(e.getMessage());
   }
 }
Пример #5
0
 @Override
 public List<PApplication> selectHot(PApplication pApplication) {
   return pAppDetailDao.selectHot(pApplication);
 }
Пример #6
0
 @Override
 public String getLatestApkName(String packageName) {
   return pAppDetailDao.selectLatestApkName(packageName);
 }
Пример #7
0
 @Override
 public PAppDetail hasNewVersion() {
   String packageName = ApkinformatonUtil.PLUGIN_CERTER_PACKAGENAME;
   PAppDetail detail = pAppDetailDao.selectLatestVersion(packageName);
   return detail;
 }