@RequestMapping(value = "/search")
 public ModelAndView search(
     HttpServletRequest request,
     @PathVariable String orgi,
     @ModelAttribute("data") SinoLocation data) {
   String key = "%" + data.getProvince() + "%";
   ResponseData responseData = new ResponseData("/pages/manage/sinosig/location/list");
   String pro = request.getParameter("result");
   if (pro == null || "".equals(pro) || "0".equals(pro)) {
     responseData.setDataList(
         super.getService()
             .findPageByCriteria(
                 DetachedCriteria.forClass(SinoLocation.class)
                     .add(
                         Restrictions.and(
                             Restrictions.eq("orgi", orgi),
                             Restrictions.eq("type", data.getType())))
                     .add(
                         Restrictions.or(
                             Restrictions.or(
                                 Restrictions.like("province", key),
                                 Restrictions.like("city", key)),
                             Restrictions.or(
                                 Restrictions.like("address", key),
                                 Restrictions.like("dept", key))))));
   } else {
     responseData.setDataList(
         super.getService()
             .findPageByCriteria(
                 DetachedCriteria.forClass(SinoLocation.class)
                     .add(
                         Restrictions.and(
                             Restrictions.and(
                                 Restrictions.eq("orgi", orgi), Restrictions.eq("province", pro)),
                             Restrictions.eq("type", data.getType())))
                     .add(
                         Restrictions.or(
                             Restrictions.or(
                                 Restrictions.like("province", key),
                                 Restrictions.like("city", key)),
                             Restrictions.or(
                                 Restrictions.like("address", key),
                                 Restrictions.like("dept", key))))));
   }
   return request(responseData, orgi, null);
 }
Пример #2
0
 public void outFailResult(AjaxRespCode retCode) {
   ResponseData resp = new ResponseData();
   resp.setRetinfo(retCode.message);
   resp.setRetCode(retCode.code.toString());
   resp.setSuccess(false);
   outResult(resp);
 }
 @RequestMapping(value = "/rm/{id}")
 public ModelAndView rm(
     HttpServletRequest request,
     @PathVariable String orgi,
     @PathVariable String id,
     @ModelAttribute("data") SinoLocation data) {
   data.setId(id);
   data.setStatus("3"); // 删除
   super.getService().deleteIObject(data);
   // 发消息给GW,在GW更新百度信息
   APIContext.getRpcServer()
       .sendMessageToServer(
           new Message(
               EapDataContext.HANDLER,
               JSON.toJSONString(
                   new SystemMessage(SINOSIG_LOCATION, data), SerializerFeature.WriteClassName)));
   ResponseData responseData = new ResponseData("/pages/manage/sinosig/location/list");
   responseData.setDataList(
       super.getService()
           .findPageByCriteria(
               DetachedCriteria.forClass(SinoLocation.class)
                   .add(
                       Restrictions.and(
                           Restrictions.eq("orgi", orgi),
                           Restrictions.and(
                               Restrictions.eq("type", data.getType()),
                               Restrictions.eq("province", data.getProvince()))))));
   return request(responseData, orgi, null);
 }
Пример #4
0
 /**
  * false时候错误返回
  *
  * @param exp
  * @param msg
  * @author Joeson
  */
 protected void isTrue(boolean exp, String msg) {
   if (!exp) {
     ResponseData resp = new ResponseData();
     resp.setRetinfo(msg);
     resp.setSuccess(false);
     outResult(resp);
   }
 }
Пример #5
0
 protected void checkRequired(Object obj, String message) {
   boolean isNullOrEmpty =
       (null == obj)
           || (obj instanceof String && obj.toString().isEmpty())
           || obj.toString().equalsIgnoreCase("null");
   if (isNullOrEmpty) {
     ResponseData resp = new ResponseData();
     resp.setRetinfo("缺少必填参数:" + message);
     resp.setSuccess(false);
     outResult(resp);
   }
 }
 @RequestMapping(value = "/edit/{id}")
 public ModelAndView edit(
     HttpServletRequest request,
     @PathVariable String orgi,
     @PathVariable String id,
     @ModelAttribute("data") SinoLocation data) {
   SinoLocation ptype = (SinoLocation) super.getService().getIObjectByPK(SinoLocation.class, id);
   ResponseData responseData =
       new ResponseData("/pages/manage/sinosig/location/edit", "/pages/include/iframeindex");
   responseData.setData(ptype);
   return request(responseData, orgi, null);
 }
Пример #7
0
  private BasicOCSPResponse(ASN1Sequence seq) {
    this.tbsResponseData = ResponseData.getInstance(seq.getObjectAt(0));
    this.signatureAlgorithm = AlgorithmIdentifier.getInstance(seq.getObjectAt(1));
    this.signature = (DERBitString) seq.getObjectAt(2);

    if (seq.size() > 3) {
      this.certs = ASN1Sequence.getInstance((ASN1TaggedObject) seq.getObjectAt(3), true);
    }
  }
 @RequestMapping(value = "/tablelist/provs/{type}")
 public ModelAndView provincelist(
     HttpServletRequest request,
     @PathVariable String orgi,
     @PathVariable String type,
     @ModelAttribute("data") RequestData data) {
   ResponseData responseData = new ResponseData("/pages/manage/sinosig/location/provincelist");
   responseData.setRqdata(data);
   List<SinoLocation> lists =
       super.getService()
           .findAllByCriteria(
               DetachedCriteria.forClass(SinoLocation.class)
                   .add(Restrictions.eq("orgi", orgi))
                   .add(Restrictions.eq("type", type)));
   Map<String, SinoLocation> provincesmap = new HashMap<String, SinoLocation>();
   List<SinoLocation> list = new ArrayList<SinoLocation>();
   String indexpro = null;
   for (SinoLocation local : lists) {
     if (!provincesmap.containsKey(local.getProvince())) {
       if (indexpro == null) {
         indexpro = local.getProvince();
       }
       provincesmap.put(local.getProvince(), local);
     }
   }
   if (lists != null && lists.size() > 0) {
     if (provincesmap != null) {
       Iterator<SinoLocation> iterator = provincesmap.values().iterator();
       while (iterator.hasNext()) {
         list.add(iterator.next());
       }
     }
   }
   responseData.setValueList(list);
   /*responseData.setValueList(Arrays.asList(provincesmap.values()));
   responseData.setDataList(Arrays.asList(citysmap.values()));*/
   ModelAndView view = request(responseData, orgi, data);
   return view;
 }
Пример #9
0
 /**
  * json格式成功返回
  *
  * @param data
  * @param message
  */
 public <T> void outSucResult(T data) {
   ResponseData responseData = new ResponseData();
   responseData.setResult(data);
   responseData.setSuccess(true);
   outResult(responseData);
 }
Пример #10
0
 public void outFailResult(String message) {
   ResponseData resp = new ResponseData();
   resp.setRetinfo(message);
   resp.setSuccess(false);
   outResult(resp);
 }
  /**
   * Verifies the response from server and calls appropriate callback method.
   *
   * @param publicKey public key associated with the developer account
   * @param responseCode server response code
   * @param signedData signed data from server
   * @param signature server signature
   */
  public void verify(PublicKey publicKey, int responseCode, String signedData, String signature) {
    String userId = null;
    // Skip signature check for unsuccessful requests
    ResponseData data = null;
    if (responseCode == LICENSED
        || responseCode == NOT_LICENSED
        || responseCode == LICENSED_OLD_KEY) {
      // Verify signature.
      try {
        Signature sig = Signature.getInstance(SIGNATURE_ALGORITHM);
        sig.initVerify(publicKey);
        sig.update(signedData.getBytes());

        if (!sig.verify(Base64.decode(signature))) {
          Log.e(TAG, "Signature verification failed.");
          handleInvalidResponse();
          return;
        }
      } catch (NoSuchAlgorithmException e) {
        // This can't happen on an Android compatible device.
        throw new RuntimeException(e);
      } catch (InvalidKeyException e) {
        handleApplicationError(LicenseCheckerCallback.ERROR_INVALID_PUBLIC_KEY);
        return;
      } catch (SignatureException e) {
        throw new RuntimeException(e);
      } catch (Base64DecoderException e) {
        Log.e(TAG, "Could not Base64-decode signature.");
        handleInvalidResponse();
        return;
      }

      // Parse and validate response.
      try {
        data = ResponseData.parse(signedData);
      } catch (IllegalArgumentException e) {
        Log.e(TAG, "Could not parse response.");
        handleInvalidResponse();
        return;
      }

      if (data.responseCode != responseCode) {
        Log.e(TAG, "Response codes don't match.");
        handleInvalidResponse();
        return;
      }

      if (data.nonce != mNonce) {
        Log.e(TAG, "Nonce doesn't match.");
        handleInvalidResponse();
        return;
      }

      if (!data.packageName.equals(mPackageName)) {
        Log.e(TAG, "Package name doesn't match.");
        handleInvalidResponse();
        return;
      }

      if (!data.versionCode.equals(mVersionCode)) {
        Log.e(TAG, "Version codes don't match.");
        handleInvalidResponse();
        return;
      }

      // Application-specific user identifier.
      userId = data.userId;
      if (TextUtils.isEmpty(userId)) {
        Log.e(TAG, "User identifier is empty.");
        handleInvalidResponse();
        return;
      }
    }

    switch (responseCode) {
      case LICENSED:
      case LICENSED_OLD_KEY:
        int limiterResponse = mDeviceLimiter.isDeviceAllowed(userId, data);
        handleResponse(limiterResponse, data);
        break;
      case NOT_LICENSED:
        handleResponse(Policy.NOT_LICENSED, data);
        break;
      case ERROR_CONTACTING_SERVER:
        Log.w(TAG, "Error contacting licensing server.");
        handleResponse(Policy.RETRY, data);
        break;
      case ERROR_SERVER_FAILURE:
        Log.w(TAG, "An error has occurred on the licensing server.");
        handleResponse(Policy.RETRY, data);
        break;
      case ERROR_OVER_QUOTA:
        Log.w(TAG, "Licensing server is refusing to talk to this device, over quota.");
        handleResponse(Policy.RETRY, data);
        break;
      case ERROR_INVALID_PACKAGE_NAME:
        handleApplicationError(LicenseCheckerCallback.ERROR_INVALID_PACKAGE_NAME);
        break;
      case ERROR_NON_MATCHING_UID:
        handleApplicationError(LicenseCheckerCallback.ERROR_NON_MATCHING_UID);
        break;
      case ERROR_NOT_MARKET_MANAGED:
        handleApplicationError(LicenseCheckerCallback.ERROR_NOT_MARKET_MANAGED);
        break;
      default:
        Log.e(TAG, "Unknown response code for license check.");
        handleInvalidResponse();
    }
  }
 @SuppressWarnings("unused")
 @RequestMapping(value = "/tablelist/{type}/{pro}")
 public ModelAndView list(
     HttpServletRequest request,
     @PathVariable String orgi,
     @PathVariable String type,
     @PathVariable String pro,
     @ModelAttribute("data") RequestData data) {
   ResponseData responseData = new ResponseData("/pages/manage/sinosig/location/list");
   responseData.setRqdata(data);
   String search = request.getParameter("search");
   String key = "%" + search + "%";
   if (search == null) {
     if ("0".equals(pro) || "".equals(pro)) {
       // responseData.setValueList(super.getService().findAllByCriteria(DetachedCriteria.forClass(SinoLocation.class).add(Restrictions.and(Restrictions.eq("orgi", orgi), Restrictions.eq("type", type))),null,Projections.distinct(Projections.property("province"))));
       responseData.setDataList(
           super.getService()
               .findPageByCriteria(
                   DetachedCriteria.forClass(SinoLocation.class)
                       .add(
                           Restrictions.and(
                               Restrictions.eq("orgi", orgi), Restrictions.eq("type", type))),
                   data.getPs(),
                   data.getP()));
     } else {
       responseData.setDataList(
           super.getService()
               .findPageByCriteria(
                   DetachedCriteria.forClass(SinoLocation.class)
                       .add(
                           Restrictions.and(
                               Restrictions.eq("orgi", orgi), Restrictions.eq("province", pro)))
                       .add(Restrictions.eq("type", type)),
                   data.getPs(),
                   data.getP()));
     }
   } else {
     if ("0".equals(pro) || "".equals(pro)) {
       // responseData.setValueList(super.getService().findAllByCriteria(DetachedCriteria.forClass(SinoLocation.class).add(Restrictions.and(Restrictions.eq("orgi", orgi), Restrictions.eq("type", type))),null,Projections.distinct(Projections.property("province"))));
       responseData.setDataList(
           super.getService()
               .findPageByCriteria(
                   DetachedCriteria.forClass(SinoLocation.class)
                       .add(
                           Restrictions.and(
                               Restrictions.eq("orgi", orgi), Restrictions.eq("type", type)))
                       .add(
                           Restrictions.or(
                               Restrictions.or(
                                   Restrictions.like("province", key),
                                   Restrictions.like("city", key)),
                               Restrictions.or(
                                   Restrictions.like("address", key),
                                   Restrictions.like("dept", key)))),
                   data.getPs(),
                   data.getP()));
     } else {
       responseData.setDataList(
           super.getService()
               .findPageByCriteria(
                   DetachedCriteria.forClass(SinoLocation.class)
                       .add(
                           Restrictions.and(
                               Restrictions.eq("orgi", orgi), Restrictions.eq("province", pro)))
                       .add(Restrictions.eq("type", type))
                       .add(
                           Restrictions.or(
                               Restrictions.or(
                                   Restrictions.like("province", key),
                                   Restrictions.like("city", key)),
                               Restrictions.or(
                                   Restrictions.like("address", key),
                                   Restrictions.like("dept", key)))),
                   data.getPs(),
                   data.getP()));
     }
   }
   /*responseData.setValueList(Arrays.asList(provincesmap.values()));
   responseData.setDataList(Arrays.asList(citysmap.values()));*/
   ModelAndView view = request(responseData, orgi, data);
   return view;
 }