/** @param args */ public static void main(String[] args) { for (int i = 0; i < 1; i++) { String params = "{'apple_id':'1069287597','source':'mopin','ip':'0.0.0.1','idfa':'" + UUID.randomUUID().toString().trim().replaceAll("-", "") + "'}"; JSONObject paramMap = (JSONObject) JSONObject.parse(params); String result = returnGet("http://172.16.3.65:7329/web/notify", paramMap); } }
public static boolean isSuccess(String respstr) { try { if (respstr != null) { JSONObject jo = (JSONObject) JSONObject.parse(respstr); int code = jo.getInteger("code"); if (code == 200) { return true; } } return false; } catch (Exception ex) { Log.d("MyLog", "调用删除异常"); return false; } }
@Override public Object fromMessage(Message message) throws MessageConversionException { Object content = null; try { MessageProperties properties = message.getMessageProperties(); String encoding = properties.getContentEncoding(); if (encoding == null) { encoding = this.defaultCharset; } content = new String(message.getBody(), encoding); content = JSONObject.parse((String) content); } catch (UnsupportedEncodingException e) { throw new MessageConversionException("failed to convert text-based Message content", e); } return content; }
private boolean renew4Commit(WfAwt prev, WfTask currtask, WfInstance wfInst, String currUserId) { String instId = prev.getInstId(); if (WFConstants.TxTypes.COUNTERSIGN.equals(currtask.getTxType())) { prev.setCompleteFlag("Y"); this.updateById(prev); WfAwt parm = new WfAwt(); parm.setInstId(instId); parm.setCompleteFlag("N"); int incompletedCount = this.selectCount(parm); if (incompletedCount == 0) { return true; // 没有未完成的待办事宜 } String csOptJson = currtask.getSignChoices(); JSONObject csOpt = (JSONObject) JSONObject.parse(csOptJson); parm.setCompleteFlag("Y"); int completedCount = this.selectCount(parm); if (Boolean.TRUE.toString().equals(csOpt.getString("AllHandledThenGo"))) { parm.setCompleteFlag(null); int allCount = this.selectCount(parm); if (allCount != completedCount) { updateCurrAssigners4CS(wfInst, currUserId); // not finished, return return false; } } else { if (Boolean.TRUE.toString().equals(csOpt.getString("PartHandledThenGo"))) { int AtLeastHandled = csOpt.getIntValue("AtLeastHandled"); if (AtLeastHandled == 0) { AtLeastHandled = 1; } if (completedCount < AtLeastHandled) { updateCurrAssigners4CS(wfInst, currUserId); return false; } } } } else { wfInst.setOptUsersPre(currUserId + ","); } return true; }