// 到货操作
 @RequestMapping(value = "/addArr.json", method = RequestMethod.POST)
 @ResponseBody
 private Object addArr(String purchaseArr, String data) {
   JSONObject purchase = JSONObject.fromObject(purchaseArr);
   PurchaseArrival arr = (PurchaseArrival) JSONObject.toBean(purchase, PurchaseArrival.class);
   JSONArray array = JSONArray.fromObject(data);
   List<PurchaseOrderDetail> list = new ArrayList<PurchaseOrderDetail>();
   for (int i = 0; i < array.toArray().length; i++) { // 遍历循环,去除最后一项统计栏的信息
     JSONObject json = JSONObject.fromObject(array.toArray()[i]);
     PurchaseOrderDetail resourceBean =
         (PurchaseOrderDetail) JSONObject.toBean(json, PurchaseOrderDetail.class);
     if (resourceBean.getGoodsCode().equals("<b>统计:</b>")) {
       continue;
     }
     if (arr.getNotPayAmo() == null) {
       arr.setNotPayAmo(new BigDecimal(0));
     }
     if (arr.getAlrInvAmo() == null) {
       arr.setAlrInvAmo(new BigDecimal(0));
     }
     if (arr.getNotReturnAmo() == null) {
       arr.setNotReturnAmo(new BigDecimal(0));
     }
     arr.setNotPayAmo(arr.getNotPayAmo().add(resourceBean.getMoney())); // 未付款金额
     arr.setAlrInvAmo(arr.getAlrInvAmo().add(resourceBean.getMoney())); // 已开票金额
     arr.setNotReturnAmo(arr.getNotReturnAmo().add(resourceBean.getMoney())); // 未退货金额
     list.add(resourceBean);
   }
   return purchaseOrderService.addPurchaseArr(arr, list);
 }
Пример #2
0
 /**
  * 保存策略
  *
  * @param mapping
  * @param actionForm
  * @param request
  * @param response
  * @return
  * @throws Exception
  */
 public ActionForward saveTactics(
     ActionMapping mapping,
     ActionForm actionForm,
     HttpServletRequest request,
     HttpServletResponse response)
     throws Exception {
   try {
     JSONObject jsonObject = readJson(request);
     Tactics tactics = (Tactics) JSONObject.toBean(jsonObject, Tactics.class);
     if (StringUtils.isNotEmpty(tactics.validate())) {
       throw new TacticsException(tactics.validate());
     }
     if (tactics.getVenueId() == null) {
       tactics.setVenueId(UserUtil.getCurrentVenueLongId(request));
     }
     getBaseManager().insertOrUpdate(tactics);
     printSuccess(response);
   } catch (TacticsException e) {
     e.printStackTrace();
     log.error("保存价格策略时:" + e.getMessage());
     printErrorInfo(e.getMessage(), response);
   } catch (Exception e) {
     e.printStackTrace();
     log.error("保存价格策略时:" + e.getMessage());
     printErrorLabel(response);
   }
   return null;
 }
Пример #3
0
 @SuppressWarnings("unchecked")
 public static <T> T str2Obj(String content, Class<T> cls) {
   if (StringUtils.isNotBlank(content)) {
     return (T) JSONObject.toBean(JSONObject.fromObject(content), cls);
   }
   return null;
 }
Пример #4
0
  /**
   * 保存投资计划的主记录信息
   *
   * @param request
   * @param response
   * @author: Ivy
   * @throws IOException
   * @createDate: 2010-12-12
   */
  private void savePlanMaster(HttpServletRequest request, HttpServletResponse response)
      throws IOException {
    String rtn = "{success:";
    String lsh = "";
    try {
      String json = StringUtil.getInputStream(request.getInputStream(), Constant.ENCODING);

      String ITEMBEAN = PlanMaster.class.getName();
      PlanMaster master =
          (PlanMaster) JSONObject.toBean(JSONObject.fromObject(json), Class.forName(ITEMBEAN));
      String dateStr = master.getOperateTimeStr();
      DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
      df.setTimeZone(TimeZone.getTimeZone("GMT+8"));
      if (dateStr != null && !dateStr.equals("")) {
        master.setOperateTime(df.parse(dateStr));
      }
      lsh = this.investmentPlanService.savePlanMaster(master);

      if (lsh != null) {
        rtn += "true,msg:'" + lsh + "'}";
      } else {
        rtn += "false,msg:'保存失败!'}";
      }
    } catch (Exception ex) {
      rtn += "false,msg:'" + ex.getMessage() + "'}";
      ex.printStackTrace();
    }
    outputStr(response, rtn);
  }
Пример #5
0
  @SuppressWarnings("rawtypes")
  public List<Code> GetCodeCache() {
    List<Code> list = new ArrayList<Code>();

    if (MemCached.used()) {
      Object obj = MemCached.getInstance().get("Code");
      if (obj != null && !obj.equals("")) {
        String json = MemCached.getInstance().get("Code").toString();

        JSONArray array = JSONArray.fromObject(json);
        for (Iterator iter = array.iterator(); iter.hasNext(); ) {
          JSONObject jsonObject = (JSONObject) iter.next();
          list.add((Code) JSONObject.toBean(jsonObject, Code.class));
        }
      } else {
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("status", "Y");
        list = this.findForUnPage(params);

        JSONArray jsonObject = JSONArray.fromObject(list);

        MemCached.getInstance().set("Code", jsonObject);
      }
    }

    return list;
  }
Пример #6
0
  /**
   * 微网站会员中心首页
   *
   * @param Id
   * @param form
   * @param request
   * @param response
   * @return
   */
  @RequestMapping(value = "/memberCenter", method = RequestMethod.GET)
  public ModelAndView memberCenter(
      MemberForm form, HttpServletRequest request, HttpServletResponse response) {
    String memberId = CookieUtils.getMember(request, response);
    form.setMemberId(memberId);
    WebServiceResponseModel webModel = MemberCardService.getMemberInfoIndex(form.getMemberId());
    if (webModel.getError_code().equals("")) {
      VCardModel members = (VCardModel) JSONObject.toBean(webModel.getResponse(), VCardModel.class);
      if (members.getVipPhoto() == null || members.getVipPhoto().trim().equals("")) {
        members.setVipPhoto(Constants.vipCommonPhoto);
      }
      if (members.getBalance() == null || members.getBalance().trim().equals("")) {
        members.setBalance("0");
      }
      if (members.getPoints() == null || members.getPoints().trim().equals("")) {
        members.setPoints("0");
      }
      if (members.getConsumeCount() == null || members.getConsumeCount().trim().equals("")) {
        members.setConsumeCount("0");
      }
      // int infoFinish = MemberCardService.getInfoFinish(form.getMemberId());
      // members.setInfoFinish(Integer.toString(infoFinish));
      form.setMember(members);
      // form.setIsShowMenu(1);// 根据微信来判断

      return new ModelAndView("memberCenter/member-m", Constants.DEFAULT_COMMAND, form);
    } else {
      PersonInfoForm personForm = new PersonInfoForm();
      personForm.setShowShortCut(1);
      return new ModelAndView("/account/login-m", Constants.DEFAULT_COMMAND, personForm);
    }
  }
Пример #7
0
 /**
  * 查询会员详情,用户ID就是会员ID
  *
  * @param Id
  * @param form
  * @param request
  * @param response
  * @return
  */
 @RequestMapping(value = "/memberCenter/memberInfo/{Id}", method = RequestMethod.GET)
 public ModelAndView queryMemberDetail(
     @PathVariable String Id,
     MemberForm form,
     HttpServletRequest request,
     HttpServletResponse response) {
   // // 测试,会员资料
   // Id = 1000;
   // Members selectByPrimaryKey = membersService.selectByPrimaryKey(Id);
   // form.setMember(selectByPrimaryKey);
   String memberId = CookieUtils.getMember(request, response);
   form.setMemberId(memberId);
   WebServiceResponseModel webModel = MemberCardService.getMemberInfo(Id);
   if (webModel.getError_code().equals("")) {
     PersonInfoModel person =
         (PersonInfoModel) JSONObject.toBean(webModel.getResponse(), PersonInfoModel.class);
     // form.setMember(members);
     if (person.getVipPhoto() == null || person.getVipPhoto().trim().equals("")) {
       person.setVipPhoto(Constants.vipCommonPhoto);
     }
     form.setPerson(person);
     return new ModelAndView("memberCenter/memberDetail-m", Constants.DEFAULT_COMMAND, form);
   } else {
     return toErrorPage(form, webModel);
   }
 }
Пример #8
0
 /**
  * 验证响应 thinkpad dushaofei
  *
  * @param clientData
  * @param signatureData
  * @param keyHandle
  * @return
  */
 @SuppressWarnings({"unchecked", "static-access"})
 @RequestMapping(value = "/v1/test/AuthenticateResponse")
 public ProcessResult<Integer> AuthResponse(@RequestBody AuthenticateResponseData responseData) {
   ProcessResult<Integer> pr = new ProcessResult<Integer>();
   String url = "http://192.168.1.8:8080/FIDOServer/rp/AuthenticateResponse";
   HttpUriRequest post = new HttpPost(url);
   JSONObject jsonP = new JSONObject();
   jsonP.accumulate("clientData", responseData.getClientData());
   jsonP.accumulate("signatureData", responseData.getSignatureData());
   jsonP.accumulate("keyHandle", responseData.getKeyHandle());
   StringEntity entity;
   try {
     entity = new StringEntity(jsonP.toString(), HTTP.UTF_8);
     ((HttpPost) post).setEntity(entity);
     JSONObject jsonObj = getJsonObject(post);
     pr = (ProcessResult<Integer>) jsonObj.toBean(jsonObj, pr.getClass());
     return pr;
   } catch (UnsupportedEncodingException e) {
     e.printStackTrace();
   } catch (IOException io) {
     io.printStackTrace();
   }
   System.out.println(pr.getErrorNum());
   return pr;
 }
Пример #9
0
  /**
   * 查询菜单
   *
   * @param token
   * @return Menu 菜单对象
   */
  public static Menu getMenu(String token) {
    JSONObject json = getMenuJson(token).getJSONObject("menu");
    log.info(json);
    Menu menu = (Menu) JSONObject.toBean(json, Menu.class);

    return menu;
  }
  public static AccessTokenReturnMessage sendMessage(CorpSendBase message) {
    String SEND_MSG_URL = QyWxURLUtil.getMsgSendURL();
    try {
      // 创建连接
      URL url = new URL(SEND_MSG_URL);
      HttpURLConnection connection = (HttpURLConnection) url.openConnection();
      connection.setDoOutput(true);
      connection.setDoInput(true);
      connection.setRequestMethod("POST");
      connection.setUseCaches(false);
      connection.setInstanceFollowRedirects(true);
      connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");

      connection.connect();

      // POST请求
      JSONObject obj = JSONObject.fromObject(message);
      System.out.println("JsonObject:" + obj.toString());

      // DataOutputStream out = new DataOutputStream(
      //        connection.getOutputStream());
      // out.writeBytes(obj.toString());
      BufferedWriter out =
          new BufferedWriter(new OutputStreamWriter(connection.getOutputStream(), "utf-8"));
      out.write(obj.toString());
      out.flush();
      out.close();

      // 读取响应
      BufferedReader reader =
          new BufferedReader(new InputStreamReader(connection.getInputStream()));
      String lines;
      StringBuffer sb = new StringBuffer("");
      while ((lines = reader.readLine()) != null) {
        lines = new String(lines.getBytes(), "utf-8");
        sb.append(lines);
      }
      System.out.println(sb);
      reader.close();

      JSONObject jsonObj1 = JSONObject.fromObject(sb.toString());
      AccessTokenReturnMessage p2;
      p2 = (AccessTokenReturnMessage) JSONObject.toBean(jsonObj1, AccessTokenReturnMessage.class);

      // 断开连接
      connection.disconnect();
      return p2;
    } catch (MalformedURLException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    } catch (UnsupportedEncodingException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    } catch (IOException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
    return null;
  }
 // 修改订购合同
 @RequestMapping(value = "/edit.json", method = RequestMethod.POST)
 @ResponseBody
 private Object editPurchaseOrder(String purchaseOrder, String data) {
   JSONObject purchase = JSONObject.fromObject(purchaseOrder);
   PurchaseOrder order = (PurchaseOrder) JSONObject.toBean(purchase, PurchaseOrder.class);
   JSONArray array = JSONArray.fromObject(data);
   List<PurchaseOrderDetail> list = new ArrayList<PurchaseOrderDetail>();
   for (int i = 0; i < array.toArray().length; i++) { // 遍历循环,去除最后一项统计栏的信息
     JSONObject json = JSONObject.fromObject(array.toArray()[i]);
     PurchaseOrderDetail resourceBean =
         (PurchaseOrderDetail) JSONObject.toBean(json, PurchaseOrderDetail.class);
     if (resourceBean.getGoodsCode().equals("<b>统计:</b>") == false) {
       list.add(resourceBean);
     }
   }
   return purchaseOrderService.editPurchaseOrder(order, list);
 }
Пример #12
0
 /** @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) */
 protected void doGet(HttpServletRequest request, HttpServletResponse response)
     throws ServletException, IOException {
   JSONObject reqJSON = StringUtil.fromReaderToJSON(request.getReader());
   Thought t = (Thought) JSONObject.toBean(reqJSON, Thought.class, Thought.loadClassMap());
   JSONObject result = dao.postThought(t);
   response.setContentType("text/json;charset=UTF-8");
   response.getWriter().write(result.toString());
 }
Пример #13
0
 public TreeNode getTreeData() {
   if (StringUtils.isEmpty(treeDataStr)) {
     init();
   }
   JSONObject json = JSONObject.fromObject(treeDataStr);
   Map<String, Class> classMap = new HashMap<String, Class>();
   classMap.put("children", TreeNode.class);
   return (TreeNode) JSONObject.toBean(json.getJSONObject("root"), TreeNode.class, classMap);
 }
Пример #14
0
  /**
   * 将一个页面挂件json参数格式转为Map格式
   *
   * @param paramJson
   * @return
   */
  public static List<Map<String, String>> jsonToMapList(String paramJson) {
    JSONArray tempArray = JSONArray.fromObject(paramJson);
    List<Map<String, String>> paramList = new ArrayList<Map<String, String>>();
    Object[] paramArray = tempArray.toArray();
    for (Object param : paramArray) {
      JSONObject paramObj = JSONObject.fromObject(param);
      paramList.add((Map<String, String>) JSONObject.toBean(paramObj, Map.class));
    }

    return paramList;
  }
  @RequestMapping(value = "/generateHistoryFile", method = RequestMethod.POST)
  @ResponseBody
  public void generateHistoryFile(HttpServletRequest request, HttpServletResponse response) {
    String foldername = request.getParameter("foldername");
    String reqstate = request.getParameter("reqstate");
    if (reqstate.equalsIgnoreCase("success")) {
      JSONArray ja = JSONArray.fromObject(request.getParameter("testresultitemcollectionjson"));
      for (int i = 0; i < ja.length(); i++) {
        TestResultItem tri = new TestResultItem();
        try {
          JSONObject itemobj = ja.getJSONObject(i);
          String result = itemobj.getString("result");
          tri.setResult(result);
          if (!result.equals(TestStatus.exception)) {
            Set<CheckPointItem> cps = new HashSet<CheckPointItem>();

            tri.setTime(itemobj.getString("time"));
            tri.setRequestInfo(itemobj.getString("requestInfo"));
            tri.setResponseInfo(itemobj.getString("responseInfo"));
            tri.setDuration(itemobj.getString("duration"));

            Object[] callbackarr = JSONArray.fromObject(itemobj.get("callback")).toArray();
            tri.setCallback(new HashSet(Arrays.asList(callbackarr)));
            JSONArray jsonarr = JSONArray.fromObject(itemobj.get("checkPoint"));
            for (int j = 0; j < jsonarr.length(); j++) {
              CheckPointItem item =
                  (CheckPointItem)
                      JSONObject.toBean(jsonarr.getJSONObject(j), CheckPointItem.class);
              cps.add(item);
            }
            tri.setCheckPoint(cps);
          } else tri.setComment(itemobj.getString("comment"));
        } catch (Exception e) {
          tri.setDuration("");
          tri.setResult(TestStatus.exception);
          tri.setComment(e.getClass().toString() + ": " + e.getMessage());
        } finally {
          testExecuteService.generateHistoryFile(foldername, tri);
        }
      }
    } else {
      TestResultItem tri = new TestResultItem();
      tri.setDuration("");
      tri.setResult(TestStatus.exception);
      String comment = "";
      String json = request.getParameter("obj");
      if (json.startsWith("{") && json.endsWith("}"))
        comment = JSONObject.fromObject(json).get("comment").toString();
      else if (json.startsWith("[") && json.endsWith("]"))
        comment = JSONArray.fromObject(json).getJSONObject(0).get("comment").toString();
      tri.setComment(comment);
      testExecuteService.generateHistoryFile(foldername, tri);
    }
  }
Пример #16
0
 private <T> Object getBean(JSONObject jsonObject, Class<T> clazz) {
   // 声明JsonConfig对象
   JsonConfig cfg = new JsonConfig();
   // 设置属性包装器
   cfg.setPropertySetStrategy(new PropertyStrategyWrapper(PropertySetStrategy.DEFAULT));
   // 设置要转换成的JavaBean
   cfg.setRootClass(clazz);
   // 转换
   Object object = JSONObject.toBean(jsonObject, cfg);
   return object;
 }
Пример #17
0
 public static <T> T convetStr2Object(String source, Class<T> className) {
   T returnT = null;
   Object obj = null;
   try {
     obj = JSONObject.toBean(JSONObject.fromObject(source), className);
     if (obj != null) returnT = (T) obj;
   } catch (Exception e) {
     System.err.println("String [" + source + "] invalid string with method [convetStr2Object]");
   }
   return returnT;
 }
 // 根据json格式的字符串进行构造
 public QueryTranslateWeight(String basicHql, String condition) {
   this.basicQry = basicHql;
   if (!StringHelp.isEmpty(condition)) {
     JSONObject jsonObject = JSONObject.fromObject(condition);
     for (Iterator iterator = jsonObject.keySet().iterator(); iterator.hasNext(); ) {
       conditions.add(
           (Condition)
               JSONObject.toBean(
                   jsonObject.getJSONObject(iterator.next().toString()), Condition.class));
     }
   }
 }
Пример #19
0
 public static Set json2Set(String jsonString, Class pojoClass) {
   JSONArray jsonArray = JSONArray.fromObject(jsonString);
   JSONObject jsonObject;
   Object pojoValue;
   Set set = new HashSet();
   for (int i = 0; i < jsonArray.size(); i++) {
     jsonObject = jsonArray.getJSONObject(i);
     pojoValue = JSONObject.toBean(jsonObject, pojoClass);
     set.add(pojoValue);
   }
   return set;
 }
Пример #20
0
 // 寰楀埌鐢ㄦ埛鍩烘湰淇℃伅;
 public static JsonMemberInfo jsontoMemberInfo(String jsondata) {
   JsonMemberInfo message = null;
   JSONObject jsonobj;
   try {
     jsonobj = JSONObject.fromObject(jsondata);
     message = (JsonMemberInfo) JSONObject.toBean(jsonobj, JsonMemberInfo.class);
   } catch (Exception ex) {
     System.out.println(jsondata);
     ex.printStackTrace();
   }
   return message;
 }
Пример #21
0
 /** 从JSON 对象集合表达式中得到 复杂的JAVA 对象列表 */
 public static List getListComp4Json(String jsonString, Class pojoClass) {
   JSONArray jsonArray = JSONArray.fromObject(jsonString);
   JSONObject jsonObject;
   Object pojoValue;
   List list = new ArrayList();
   for (int i = 0; i < jsonArray.size(); i++) {
     jsonObject = jsonArray.getJSONObject(i);
     pojoValue = JSONObject.toBean(jsonObject, pojoClass);
     list.add(pojoValue);
   }
   return list;
 }
Пример #22
0
  public static void testJson2Java() {
    String productImageListStore =
        "[{\"bigProductImagePath\":\"/upload/image/201307/b955bd91c8b64844b4681b2eb44849d1_big.jpg\",\"id\":\"b955bd91c8b64844b4681b2eb44849d1\",\"smallProductImagePath\":\"/upload/image/201307/b955bd91c8b64844b4681b2eb44849d1_small.jpg\",\"sourceProductImagePath\":\"/upload/image/201307/b955bd91c8b64844b4681b2eb44849d1.jpeg\",\"thumbnailProductImagePath\":\"/upload/image/201307/b955bd91c8b64844b4681b2eb44849d1_thumbnail.jpg\"}]";
    JSONArray jsonArray = JSONArray.fromObject(productImageListStore);
    List productImageList = (List) JSONSerializer.toJava(jsonArray);

    // JSONObject.toBean(p, ProductImage.class);
    for (Object o : productImageList) {
      JSONObject jsonObject = JSONObject.fromObject(o);
      ProductImage obj = (ProductImage) JSONObject.toBean(jsonObject, ProductImage.class);
      System.out.println(obj.getBigProductImagePath());
    }
  }
 @Override
 public Parameter convertParameter(String request) {
   try {
     Map<String, Class<?>> classMap = new HashMap<String, Class<?>>();
     classMap.put("head", Head.class);
     classMap.put("body", AccountRechargeByTransferReq.class);
     Parameter param =
         (Parameter) JSONObject.toBean(JSONObject.fromObject(request), Parameter.class, classMap);
     return param;
   } catch (Exception e) {
     throw new ClientException("E000005", Common.E000005);
   }
 }
Пример #24
0
 private Member selectMember(Integer accountId) throws Exception {
   if (accountId != null && accountId != 0) {
     HeadObject headObject =
         CommonHeadUtil.geneHeadObject("memberService.selectMemberByAccountId");
     JSONObject jsonObject = new JSONObject();
     jsonObject.put("accountId", accountId);
     ResultObject resultObject =
         (ResultObject) memberService.doServiceByServer(new RequestObject(headObject, jsonObject));
     return (Member)
         JSONObject.toBean(JSONObject.fromObject(resultObject.getContent()), Member.class);
   }
   return null;
 }
Пример #25
0
 @Override
 public void handle(Context ctx) throws FtdException {
   switch (ctx.getOpr()) {
     case QUERY:
       {
         ctx.putResult("rows", RcmdProjectDao.selectAll());
       }
       break;
     case INSERT:
       {
         JSONObject obj = JSONObject.fromObject(ctx.paramMap);
         RcmdProject rp = (RcmdProject) JSONObject.toBean(obj, RcmdProject.class);
         RcmdProjectDao.insert(rp);
       }
       break;
     case DELETE:
       {
         String[] ids = ctx.request.getParameterValues("ids[]");
         if (ids != null) {
           for (String idStr : ids) {
             int id = StrUtil.parseInt(idStr, 0);
             if (id != 0) RcmdProjectDao.delete(id);
           }
         }
       }
       break;
     case UPDATE:
       {
         JSONObject obj = JSONObject.fromObject(ctx.paramMap);
         RcmdProject rp = (RcmdProject) JSONObject.toBean(obj, RcmdProject.class);
         RcmdProjectDao.update(rp);
       }
       break;
     default:
       break;
   }
 }
  /**
   * 获取成员 请求说明 Https请求方式: GET
   * https://qyapi.weixin.qq.com/cgi-bin/user/get?access_token=ACCESS_TOKEN&userid=lisi 参数说明 参数 必须
   * 说明 access_token 是 调用接口凭证 userid 是 员工UserID。对应管理端的帐号 返回结果 { "errcode": 0, "errmsg": "ok",
   * "userid": "zhangsan", "name": "李四", "department": [1, 2], "position": "后台工程师", "mobile":
   * "15913215421", "email": "*****@*****.**", "weixinid": "lisifordev", "avatar":
   * "http://wx.qlogo.cn/mmopen/ajNVdqHZLLA3WJ6DSZUfiakYe37PKnQhBIeOQBO4czqrnZDS79FH5Wm5m4X69TBicnHFlhiafvDwklOpZeXYQQ2icg/0",
   * "status": 1, "extattr":
   * {"attrs":[{"name":"爱好","value":"旅游"},{"name":"卡号","value":"1234567234"}]} }
   *
   * <p>参数 说明 errcode 返回码 errmsg 对返回码的文本描述内容 userid 员工UserID。对应管理端的帐号 name 成员名称 department
   * 成员所属部门id列表 position 职位信息 mobile 手机号码 email 邮箱 weixinid 微信号 avatar
   * 头像url。注:如果要获取小图将url最后的"/0"改成"/64"即可 status 关注状态: 1=已关注,2=已冻结,4=未关注 extattr 扩展属性 权限说明
   * 管理员须拥有’获取成员’的接口权限,以及成员的查看权限。
   *
   * @param acessToken
   * @param userId
   * @return
   * @throws Exception
   */
  public static UserInfo getUserInfoFromUserID(String userId) throws Exception {
    System.out.println("getUserInfoFromUserID.userId" + userId);
    String queryUserURL = QyWxURLUtil.getQueryUserURL();
    queryUserURL = MessageFormat.format(queryUserURL, 0, userId);
    System.out.println("getUserInfoFromUserID.queryUserURL" + queryUserURL);
    String returnMsg = HttpUtil.httpGet(queryUserURL);

    JSONObject jsonObj1 = JSONObject.fromObject(returnMsg);
    Map<String, Class> classMap = new HashMap<String, Class>();
    classMap.put("extattr", UserInfoExtraAttr.class);
    classMap.put("attrs", Attr.class);
    UserInfo info = (UserInfo) JSONObject.toBean(jsonObj1, UserInfo.class, classMap);

    return info;
  }
Пример #27
0
 /**
  * 注册请求 thinkpad dushaofei
  *
  * @param test
  * @return
  */
 @SuppressWarnings("unchecked")
 @RequestMapping(value = "/v1/RegisterRequest/{username}")
 @ResponseBody
 public ProcessResult<RegisterRequestData> test(@PathVariable String username) { // 注册请求
   ProcessResult<RegisterRequestData> pr = new ProcessResult<RegisterRequestData>();
   String url = "http://192.168.1.8:8080/FIDOServer/rp/RegisterRequest/" + username;
   HttpGet get = new HttpGet(url);
   try {
     JSONObject json = getJsonObject(get);
     pr = (ProcessResult<RegisterRequestData>) JSONObject.toBean(json, pr.getClass());
   } catch (Exception e) {
     System.out.println("注册请求异常:" + e.getMessage());
     e.printStackTrace();
   }
   return pr;
 }
  /**
   * Recibe la peticion para registrar un numero de telefono movil en el perfil de los clientes para
   * realizar transferencias desde una cuenta propia.
   *
   * @param req Request
   * @param resp Response
   * @return Respuesta del servicio al registrar el numero movil en el perfil del cliente
   * @throws Exception la exception
   */
  public ModelAndView registrarMovil(HttpServletRequest req, HttpServletResponse resp)
      throws Exception {
    JSONResponseBean response = new JSONResponseBean();
    JSONObject jsonResponse = new JSONObject();
    HttpSession session = req.getSession();
    ClienteBean cliente = (ClienteBean) session.getAttribute(LITERAL_CLIENTE);
    Map<String, String> resOper;

    if (cliente != null) {
      try {
        BitacoraBean bitacora = getBitacoraBean(req);
        JSONObject altaMovilTercerosJSON = getJSONRequestObject(req);
        JSONObject jMovilTerceros =
            JSONObject.fromObject(altaMovilTercerosJSON.get("movilTerceros").toString());
        NumeroMovilTerceros movilTerceros =
            (NumeroMovilTerceros) JSONObject.toBean(jMovilTerceros, NumeroMovilTerceros.class);
        String token = altaMovilTercerosJSON.getString("token");

        LOG.info("ALTA DE MOVIL: ".concat(jMovilTerceros.toString()));

        validarOperacion(
            req,
            resp,
            SantanderConstantesMovilService.TRMT,
            LITERAL_0_01,
            movilTerceros.getClaveBanco(),
            cliente.getClaveCliente());

        resOper = movilTercerosService.registrarMovil(cliente, movilTerceros, bitacora, token);
        jsonResponse = JSONObject.fromObject(resOper);

        LOG.info("RESPUESTA SERVICIO ALTA DE MOVIL: ".concat(jsonResponse.toString()));

        response.setDto(jsonResponse.toString());
        response.setError(ErrorBean.SUCCESS);
        req.getSession().removeAttribute(SALTOSUCCESS);
        req.getSession().removeAttribute(LITERAL_TIPOPER);
      } catch (BusinessException e) {
        response.setError(e.getError());
      }
    } else {
      response.setError(LITERAL_GBL_03);
    }

    return getResponseView(response);
  }
Пример #29
0
  /**
   * 验证请求 thinkpad dushaofei
   *
   * @param username
   * @return
   */
  @SuppressWarnings({"unchecked", "static-access"})
  @RequestMapping(value = "/v1/AuthenticateRequest")
  @ResponseBody
  public ProcessResult<AuthenticateRequestData> AuthRequest(@PathVariable String username) {
    ProcessResult<AuthenticateRequestData> pr = new ProcessResult<AuthenticateRequestData>();
    String url = "http://192.168.1.8:8080/FIDOServer/rp/AuthenticateRequest/" + username;
    HttpGet get = new HttpGet(url);
    try {
      JSONObject jsonObj = getJsonObject(get);
      pr = (ProcessResult<AuthenticateRequestData>) jsonObj.toBean(jsonObj, pr.getClass());
    } catch (ClientProtocolException e) {

      e.printStackTrace();
    } catch (IOException e) {

      e.printStackTrace();
    }
    return pr;
  }
  /* (non-Javadoc)
   * @see com.enation.app.setting.service.ISettingService#getSetting()
   */
  @Override
  public Map<String, Map<String, String>> getSetting() {
    String sql = "select * from settings";
    List<Map<String, String>> list = this.baseDaoSupport.queryForList(sql);
    Map<String, Map<String, String>> cfg = new HashMap();

    for (Map<String, String> map : list) {
      String setting_value = map.get("cfg_value");
      if (StringUtil.isEmpty(setting_value)) {
        cfg.put(map.get("cfg_group"), new HashMap<String, String>());
      } else {
        JSONObject jsonObject = JSONObject.fromObject(setting_value);
        Map itemMap = (Map) JSONObject.toBean(jsonObject, Map.class);
        cfg.put(map.get("cfg_group"), itemMap);
      }
    }

    return cfg;
  }