コード例 #1
0
ファイル: IpavsayService.java プロジェクト: Alan666156/ipav
 /**
  * 好友分享
  *
  * @param ctuser
  * @param ly
  * @param ep
  * @return
  */
 public JSONObject recommendSharing(IpavuserEntity ctuser, String ly, String ep) {
   JSONObject rtn = new JSONObject();
   Pattern p = Pattern.compile("^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(\\.([a-zA-Z0-9_-])+)+$");
   Matcher m = p.matcher(ep);
   boolean b = m.matches();
   if (b) {
     try {
       messageUtil.sendrecommendMail(ctuser.getUsername(), ep, ly);
     } catch (Exception e) {
       rtn.put("msg", e.getMessage());
       return rtn;
     }
     rtn.put("msg", "分享成功");
   } else {
     p = Pattern.compile("^((170)|(13[0-9])|(15[^4,\\D])|(18[0,5-9]))\\d{8}$");
     m = p.matcher(ep);
     b = m.matches();
     if (b == true) {
       try {
         messageUtil.sendrecommendPhone(ctuser.getUsername(), ep, ly);
       } catch (Exception e) {
         rtn.put("msg", e.getMessage());
         return rtn;
       }
       rtn.put("msg", "分享成功");
     } else {
       rtn.put("msg", "邮箱或手机号码有误");
     }
   }
   return rtn;
 }
コード例 #2
0
 /**
  * 报销申请
  *
  * @return
  */
 @RequestMapping(
     value = "expenseApply",
     method = {RequestMethod.GET, RequestMethod.POST})
 public @ResponseBody Object addExpense(HttpServletRequest request) {
   ResponseResult responseResult = new ResponseResult();
   // 获取请假申请信息
   String jsonExpenseApplyInfo = HttpRequestUtil.getInst().getString("expenseApplyInfo");
   if (StringUtils.isEmpty(jsonExpenseApplyInfo)) {
     throw new VyiyunException("报销申请信息为空!");
   }
   try {
     JSONObject jsonExpenseApplyInfoObj =
         JSON.parseObject(URLDecoder.decode(jsonExpenseApplyInfo, "UTF-8"));
     String id = jsonExpenseApplyInfoObj.getString("id");
     // 存在id说明是重新发起
     if (StringUtils.isNotEmpty(id)) {
       jsonExpenseApplyInfoObj.put("isAgain", true);
     } else if (StringUtils.isEmpty(id)) {
       id = CommonUtil.GeneGUID();
       jsonExpenseApplyInfoObj.put("id", id);
     }
     responseResult.setValue(id);
     expenseService.doApply(jsonExpenseApplyInfoObj);
   } catch (Exception e) {
     e.printStackTrace();
     responseResult.setErrorMsg("请联系系统管理员");
     responseResult.setStatus(-1);
   }
   // 返回数据
   return responseResult;
 }
コード例 #3
0
  public JSONObject checkUpdate(String clientVersionName) {

    // 服务器上 app 最新版本号
    String currentVersionName = getCurrentVersionName();

    // 若客户端已经是最新版本,则不需要更新
    if (currentVersionName.equals(clientVersionName)) {
      JSONObject result = new JSONObject();
      result.put("needUpdate", false);
      return result;
    }

    // 获取对应的差分包地址
    AppDiff appDiff =
        appDiffDao.findOneByVersionNameAndClientVersionNameAndDeleteFlag(
            currentVersionName, clientVersionName, 0);
    JSONObject result = new JSONObject();
    result.put("needUpdate", true);
    result.put("diff", appDiff.getDiff());

    String apkPath = explodedPath + File.separator + "app.apk";
    File apk = new File(apkPath);
    String md5Sign = MD5Utils.getMd5ByFile(apk);
    result.put("md5Sign", md5Sign);

    return result;
  }
コード例 #4
0
  public void test_1() throws Exception {
    JSONObject res = new JSONObject();
    res.put("a", 1);
    res.put("b", 2);
    res.put("c", 3);

    String[] tests = {
      "{ 'a':1, 'b':2, 'c':3 }",
      "{ 'a':1,,'b':2, 'c':3 }",
      "{,'a':1, 'b':2, 'c':3 }",
      "{'a':1, 'b':2, 'c':3,,}",
      "{,,'a':1,,,,'b':2,'c':3,,,,,}",
    };

    for (String t : tests) {
      DefaultJSONParser ext = new DefaultJSONParser(t);
      ext.config(Feature.AllowArbitraryCommas, true);

      JSONObject extRes = ext.parseObject();
      Assert.assertEquals(res, extRes);

      DefaultJSONParser basic = new DefaultJSONParser(t);
      basic.config(Feature.AllowArbitraryCommas, true);
      JSONObject basicRes = basic.parseObject();
      Assert.assertEquals(res, basicRes);
    }
  }
コード例 #5
0
  @ResponseBody
  @RequestMapping("doneDBRepay")
  public JSONObject doneDBRepayManage(
      RepayPlanQueryOrder queryOrder, PageParam pageParam, Model model) throws Exception {
    JSONObject jsonObject = new JSONObject();
    queryOrder.setPageSize(pageParam.getPageSize());
    queryOrder.setPageNumber(pageParam.getPageNo());
    List<String> status = new ArrayList<String>(1);
    status.add(RepayPlanStatusEnum.REPAY_SUCCESS.getCode());
    queryOrder.setGuaranteeId(getGuaranteeUserId());
    queryOrder.setStatusList(status);
    QueryBaseBatchResult<RepayPlanInfo> queryBaseBatchResult =
        repayPlanService.queryRepayPlanInfoGuarantee(queryOrder);
    Map<String, String> map = new HashMap<String, String>();
    List<RepayPlanInfo> recordList = queryBaseBatchResult.getPageList();
    if (ListUtil.isNotEmpty(recordList)) {
      for (RepayPlanInfo item : recordList) {
        Date date = new Date();
        if (date.after(item.getRepayDate())) {
          item.setCanPay("Y");
          getTradeLoanDemandId(map, item.getTradeId());
        }
      }
    }

    jsonObject.put("map", map);
    jsonObject.put("page", PageUtil.getCovertPage(queryBaseBatchResult));
    jsonObject.put("queryConditions", queryOrder);
    return jsonObject;
  }
コード例 #6
0
 /**
  * 统计注册人数
  *
  * @creationDate. 2015-12-25 下午4:22:25
  * @throws ParseException
  */
 public void statistics() throws ParseException {
   List<YwUser> data = getData();
   SimpleDateFormat sdf = new SimpleDateFormat("yyyy-M-dd");
   JSONObject jsonData = new JSONObject();
   List<String> listXdata = new ArrayList<String>();
   List<Integer> incomeDataList = new ArrayList<Integer>();
   List<Highcharts> dataList = new ArrayList<Highcharts>();
   Highcharts incomeChart = new Highcharts();
   if (CollectionUtils.isNotEmpty(data)) {
     for (YwUser obj : data) {
       listXdata.add(sdf.format(obj.getCreateTime()).toString()); // 日期
       incomeDataList.add(obj.getRegiestCount()); // 当前日期注册数
       regCounts += obj.getRegiestCount(); // 总注册数
     }
   }
   incomeChart.setName("注册用户数");
   incomeChart.setData(incomeDataList);
   dataList.add(incomeChart);
   jsonData.put("regCounts", regCounts);
   jsonData.put("listYdata", dataList);
   jsonData.put("listXdata", listXdata);
   try {
     super.writeNoLog(jsonData);
   } catch (IOException e) {
     e.printStackTrace();
   }
 }
コード例 #7
0
 /**
  * 订单管理页面载入
  *
  * @param page 页码,默认为1
  * @param order_status 订单状态,为空时查找所有状态(0未分配状态,10表示未配送,20表示配送中,30表示配送完成,40表示结算完成,50表示返回入库,60表示已返回入库)
  * @param key 按关键字查找,为空时不按关键字查找(order_id-订单号、staff_id-配送人员编号)
  * @param value 查找关键字、key不为空时起作用
  */
 @RequestMapping(value = "/getAllOrder", method = RequestMethod.GET)
 @ResponseBody
 public JSONObject getAllOrder(
     HttpSession httpSession,
     @RequestParam(required = false, value = "page") Long page,
     @RequestParam(required = false, value = "order_status") Integer order_status,
     @RequestParam(required = false, value = "key") String key,
     @RequestParam(required = false, value = "value") String value) {
   staff staff = (staff) httpSession.getAttribute("staff"); // 获取员工
   if (staff == null) {
     return CommonUtil.constructResponse(0, "员工不存在", null);
   }
   JSONObject jo = new JSONObject();
   List<Order> orders = new ArrayList<Order>();
   if (page == null || page <= 0) {
     page = Long.valueOf(1);
   }
   long total =
       orderService.getCountOrderManage(
           staff.getStaff_id(), staff.getStaff_rank(), order_status, key, value);
   if (total > 0) {
     orders =
         orderService.getOrderManage(
             staff.getStaff_id(), staff.getStaff_rank(), order_status, page, 10, key, value);
   }
   jo.put("total", total);
   jo.put("nowPage", page);
   jo.put("orders", orders);
   return CommonUtil.constructResponse(1, "success", jo);
 }
コード例 #8
0
ファイル: User.java プロジェクト: Delicate90/mj_logistics
 public static JSONObject headerEdit(String username, File header) {
   JSONObject items = new JSONObject();
   boolean rs = false;
   if (!username.equals("")) {
     Record user =
         Db.findFirst("SELECT * FROM b_user WHERE username = ? AND status = 1", username);
     if (user != null) {
       System.out.println(header.getName());
       String fileName =
           "head_"
               + username
               + String.valueOf(System.currentTimeMillis())
               + "."
               + header.getName().split("\\.")[1];
       String QNToken = qiNiuKit.getUpToken();
       boolean qnRs = new qiNiuKit().uploadFile(header, fileName, QNToken);
       if (qnRs) {
         user.set("head", qiNiuKit.headSave(fileName));
         rs = Db.update("b_user", user);
         if (rs) {
           user =
               Db.findFirst(
                   "SELECT bu.*,fur.content AS roleValue,fus.content AS sexValue FROM b_user AS bu LEFT JOIN f_user_role AS fur ON bu.role = fur.id LEFT JOIN f_user_sex AS fus ON bu.sex = fus.id WHERE bu.username = ? AND bu.status = 1",
                   username);
           items.put("user", user.toJson());
         }
       }
     }
   }
   items.put("rs", rs);
   return items;
 }
コード例 #9
0
  // 编辑器上传图片
  @RequestMapping("/upload")
  @ResponseBody
  public JSONObject upload(
      @RequestParam("imgFile") MultipartFile file, HttpServletRequest request, ModelMap m)
      throws IOException {

    // String filetype =
    // StringUtils.substringAfterLast(file.getOriginalFilename(), ".");
    SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
    String ymd = sdf.format(new Date());

    String realRootPath =
        getServletContext().getResource("/").toString() + "upload/choicenesscontent/" + ymd + "/";
    YztUtil.writeFile(file.getInputStream(), realRootPath, file.getOriginalFilename());

    /**/
    String path = request.getContextPath();
    String basePath =
        request.getScheme()
            + "://"
            + request.getServerName()
            + ":"
            + request.getServerPort()
            + path
            + "/";
    // System.out.println("getContextPath==="+
    // basePath+"upload/user/headimg/"+user.getId()+"."+filetype);
    String picurl = basePath + "upload/choicenesscontent/" + ymd + "/" + file.getOriginalFilename();
    // user.setPicurl(picurl);

    JSONObject json = new JSONObject();
    json.put("error", 0);
    json.put("url", picurl);
    return json;
  }
コード例 #10
0
ファイル: JMServer.java プロジェクト: is00hcw/Mycat-Web
 @RequestMapping("/dumpThead")
 @ResponseBody
 public void doDumpThread(HttpServletRequest request, HttpServletResponse response) {
   try {
     String app = request.getParameter("app");
     String threadId = request.getParameter("threadId");
     ThreadMXBean tBean = JMConnManager.getThreadMBean(app);
     JSONObject data = new JSONObject();
     if (threadId != null) {
       Long id = Long.valueOf(threadId);
       ThreadInfo threadInfo = tBean.getThreadInfo(id, Integer.MAX_VALUE);
       data.put("info", threadInfo.toString());
     } else {
       ThreadInfo[] dumpAllThreads = tBean.dumpAllThreads(false, false);
       StringBuffer info = new StringBuffer();
       for (ThreadInfo threadInfo : dumpAllThreads) {
         info.append("\n").append(threadInfo);
       }
       data.put("info", info);
     }
     writeFile(request, response, data);
   } catch (IOException e) {
     throw new RuntimeException(e);
   }
 }
コード例 #11
0
 /**
  * 签到处理
  *
  * @return
  * @throws UnsupportedEncodingException
  */
 @RequestMapping(
     value = "doSign",
     method = {RequestMethod.GET, RequestMethod.POST})
 public @ResponseBody Object doSign() {
   ResponseResult responseResult = new ResponseResult();
   try {
     // 获取请假申请信息
     JSONObject jsonSignInfoObj =
         JSON.parseObject(
             URLDecoder.decode(HttpRequestUtil.getInstance().getString("signInfo"), "UTF-8"));
     Map<String, Object> resultData = new HashMap<String, Object>();
     responseResult.setValue(resultData);
     if (null != jsonSignInfoObj) {
       String sSignTime = DateUtil.dateToString(new Date(), "yyyy-MM-dd HH:mm");
       Date signTime = DateUtil.stringToDate(sSignTime + ":00");
       String id = CommonUtil.GeneGUID();
       jsonSignInfoObj.put("signTime", signTime);
       jsonSignInfoObj.put("id", id);
       resultData.put("id", id);
       resultData.put("signTime", DateUtil.dateToString(signTime, "HH:mm"));
     }
     signService.doSign(jsonSignInfoObj);
   } catch (Exception e) {
     e.printStackTrace();
     responseResult.setStatus(-1);
   }
   return responseResult;
 }
コード例 #12
0
 /**
  * 创建临时二维码Ticket
  *
  * @param accessToken
  * @param expireSeconds 有效时间,单位:秒
  * @param qrID 二维码标识
  * @return
  * @throws IOException
  * @throws WechatExceprion
  */
 @Bizlet("createTempQRImage")
 public static WechatQRCodeModel createTempQRImage(
     String accessToken, long expireSeconds, int qrID) throws IOException, WechatExceprion {
   String uri = "https://api.weixin.qq.com/cgi-bin/qrcode/create";
   NameValuePair[] queryStr = new NameValuePair[1];
   queryStr[0] = new NameValuePair(IWechatConstants.KEY_ACCESS_TOKEN, accessToken);
   JSONObject jsonObj = new JSONObject();
   jsonObj.put("expire_secondes", expireSeconds);
   jsonObj.put("action_name", WechatQRCodeModel.QR_IMAGE_TEMPORARY);
   JSONObject obj = new JSONObject();
   obj.put("scene_id", qrID);
   JSONObject obj1 = new JSONObject();
   obj1.put("scene", obj);
   jsonObj.put("action_info", obj1);
   RequestEntity requestEntity =
       new StringRequestEntity(
           jsonObj.toJSONString(),
           IWechatConstants.CONTENT_TYPE,
           IWechatConstants.DEFAULT_CHARSET);
   String result = HttpExecuter.executePostAsString(uri, queryStr, requestEntity);
   String returnCode = JSONObject.parseObject(result).getString(IWechatConstants.ERROR_CODE);
   if (returnCode == null || IWechatConstants.RETURN_CODE_SUCCESS.equals(returnCode)) {
     return JSONObject.parseObject(result, WechatQRCodeModel.class);
   } else throw new WechatExceprion("[AccountOperations#createTempQRImage]" + result);
 }
コード例 #13
0
ファイル: JMServer.java プロジェクト: is00hcw/Mycat-Web
 private static JSONObject toJson(MemoryUsage useage) {
   JSONObject item = new JSONObject();
   item.put("commit", useage.getCommitted());
   item.put("used", useage.getUsed());
   item.put("init", useage.getInit());
   item.put("max", useage.getMax());
   return item;
 }
コード例 #14
0
 @Test
 public void testDoAudit() {
   JSONObject jsonApprovalInfo = new JSONObject();
   JSONObject jsonCommandInfo = new JSONObject();
   jsonCommandInfo.put("commandType", "undo");
   jsonApprovalInfo.put("commandInfo", jsonCommandInfo);
   jsonApprovalInfo.put("approvalId", "ff5768cfe78b4db489581d433e8272fd");
   approvalService.doAudit(jsonApprovalInfo);
 }
コード例 #15
0
 private boolean validateUserInfo(UserInfo loginInfo, JSONObject result) {
   if (StringUtil.isBlank(loginInfo.getUserName())
       || StringUtil.isBlank(loginInfo.getPassword())) {
     result.put("code", "400");
     result.put("message", "Username or password is null");
     return true;
   }
   return false;
 }
コード例 #16
0
  @Override
  protected String toJsonData(Object data, String provider, String desc, int code)
      throws JSONException {
    JSONObject ret = new JSONObject();
    ret.put("errno", code);
    ret.put("errText", StringUtils.isEmpty(desc) ? "OK" : desc);
    ret.put("data", data);

    return ret.toString();
  }
コード例 #17
0
ファイル: FileInfo.java プロジェクト: eseawind/appkit-web
 public String toJSONString() {
   JSONObject jsonObject = new JSONObject();
   jsonObject.put("name", name);
   jsonObject.put("size", size);
   jsonObject.put("url", url);
   jsonObject.put("thumbnailUrl", thumbnailUrl);
   jsonObject.put("deleteUrl", deleteUrl);
   jsonObject.put("deleteType", deleteType);
   return jsonObject.toString();
 }
コード例 #18
0
 @RequestMapping(value = "create", method = RequestMethod.GET)
 public String createUser(ModelMap model) {
   Resource resource = new Resource(Init.appId, Init.appKey, "");
   JSONObject property = new JSONObject();
   property.put("username", "admin");
   property.put("password", "123456");
   property.put("email", "*****@*****.**");
   JSONObject json = resource.createObject("admin", property);
   model.addAttribute("result", json + "");
   return "admin/login";
 }
コード例 #19
0
 /**
  * @Title: selectCommentCountByProductId @Description: TODO(根据货品id查询评论数量)
  *
  * @author <a href="*****@*****.**">赖彩妙</a>
  * @date 2015-5-18 下午5:14:12
  * @version 1.0.0
  * @param @param data
  * @param @return
  * @return Object 返回类型
  * @throws
  */
 public Object selectCommentCountByProductId(Object data) {
   log.info("start[MemberCommentService.selectCommentCountByProductId]");
   Long productId = (Long) data;
   Long commentCount = orderCommentMapper.selectCommentCountByProductId(productId);
   Long sumPoint = orderCommentMapper.selectSumPointByProductId(productId);
   JSONObject jsonObject = new JSONObject();
   jsonObject.put("commentCount", commentCount != null ? commentCount : 0);
   jsonObject.put("sumPoint", sumPoint != null ? sumPoint : 0);
   log.info("end[MemberCommentService.selectCommentCountByProductId]");
   return new ResultObject(new HeadObject(ErrorCode.SUCCESS), jsonObject);
 }
コード例 #20
0
ファイル: UserManager.java プロジェクト: whueric/wechat4j
 /**
  * 删除分组
  *
  * @param groupId
  * @throws WeChatException
  */
 public void deleteGroup(int groupId) throws WeChatException {
   JSONObject idJson = new JSONObject();
   idJson.put("id", groupId);
   JSONObject groupJson = new JSONObject();
   groupJson.put("group", idJson);
   String requestData = groupJson.toJSONString();
   logger.info("request data " + requestData);
   String resultStr = HttpUtils.post(GROUP_DELETE_POST_URL + this.accessToken, requestData);
   logger.info("return data " + resultStr);
   WeChatUtil.isSuccess(resultStr);
 }
コード例 #21
0
ファイル: UserManager.java プロジェクト: whueric/wechat4j
 /**
  * 批量移动用户分组
  *
  * @param openids 用户唯一标识符openid的列表(size不能超过50)
  * @param toGroupid 分组id
  * @return 是否修改成功
  * @throws WeChatException
  */
 public void membersDatchUpdateGroup(String[] openIds, int groupId) throws WeChatException {
   JSONObject jsonObject = new JSONObject();
   jsonObject.put("openid_list", openIds);
   jsonObject.put("to_groupid", groupId);
   String requestData = jsonObject.toString();
   logger.info("request data " + requestData);
   String resultStr =
       HttpUtils.post(GROUP_MEMBERS_DATCHUPDATE_POST_URL + this.accessToken, requestData);
   logger.info("return data " + resultStr);
   WeChatUtil.isSuccess(resultStr);
 }
コード例 #22
0
ファイル: JMServer.java プロジェクト: is00hcw/Mycat-Web
  private JSONObject doRemoteDump(String app, String date, String host) throws IOException {
    RuntimeMXBean mBean = JMConnManager.getRuntimeMBean(app);
    String dir = mBean.getSystemProperties().get("user.dir");
    String dumpFile = String.format("%s/%s_%s_heap.hprof", dir, app, date);
    JMConnManager.getHotspotBean(app).dumpHeap(dumpFile, false);

    JSONObject res = new JSONObject();
    res.put("file", host + ":" + dumpFile);
    res.put("local", false);
    return res;
  }
コード例 #23
0
 /**
  * 获取用户的未读消息
  *
  * @param id 目标用户id
  * @param session 获取自己的userId
  * @return 未读消息集合
  */
 @RequestMapping("getUserUnReadTalking")
 @ResponseBody
 public JSONObject getUserUnReadTalking(int id, HttpSession session) {
   User user = (User) session.getAttribute("user");
   if (user == null) {
     return AjaxReturn.Data2Ajax(0, "未登陆", null);
   }
   JSONObject js = new JSONObject();
   js.put("userId", id);
   js.put("rows", messageService.getUserUnReadTalking(user.getUser_id(), id));
   return AjaxReturn.Data2Ajax(1, null, js);
 }
コード例 #24
0
 @RequestMapping("updateradiostation")
 public @ResponseBody String updateRadioStation(RadioStation radioStation) {
   JSONObject o = new JSONObject();
   try {
     radioStationService.updateRadioStation(radioStation);
     o.put("success", true);
   } catch (Exception e) {
     e.printStackTrace();
     o.put("success", false);
   }
   return o.toJSONString();
 }
コード例 #25
0
ファイル: UserManager.java プロジェクト: whueric/wechat4j
 /**
  * 创建分组
  *
  * @param name 分组名字(30个字符以内)
  * @return
  * @throws WeChatException
  */
 public Group createGroup(String name) throws WeChatException {
   JSONObject nameJson = new JSONObject();
   JSONObject groupJson = new JSONObject();
   nameJson.put("name", name);
   groupJson.put("group", nameJson);
   String requestData = groupJson.toString();
   logger.info("request data " + requestData);
   String resultStr = HttpUtils.post(GROUP_CREATE_POST_URL + this.accessToken, requestData);
   logger.info("return data " + resultStr);
   WeChatUtil.isSuccess(resultStr);
   return JSONObject.parseObject(resultStr).getObject("group", Group.class);
 }
コード例 #26
0
  /**
   * 移动用户分组
   *
   * @param user 用户对象
   * @param group 分组对象
   * @throws ServiceException ServiceException
   */
  public static void updateGroupOfUser(WechatUserDto user, Group group, String accessToken)
      throws ServiceException {

    // url and params
    String url = getRequestUrl(WechatUrlConstants.GROUPS_MEMBERS_UPDATE, accessToken);
    JSONObject requestJson = new JSONObject();
    requestJson.put("openid", user.getOpenId());
    requestJson.put("to_groupid", group.getId());

    // call weixin service and get group object
    getWxJSONObjectResponseFromHttpPostMethod(url, requestJson);
  }
コード例 #27
0
  /**
   * 删除分组
   *
   * @param group 组对象
   * @param accessToken
   * @throws ServiceException ServiceException
   */
  public static void deleteGroup(Group group, String accessToken) throws ServiceException {

    // url and params
    String url = getRequestUrl(WechatUrlConstants.GROUPS_DELETE, accessToken);
    JSONObject groupJson = new JSONObject();
    groupJson.put("id", group.getId());
    JSONObject requestJson = new JSONObject();
    requestJson.put("group", groupJson);

    // call weixin service and get group object
    getWxJSONObjectResponseFromHttpPostMethod(url, requestJson);
  }
コード例 #28
0
ファイル: UserOldRest.java プロジェクト: zyflao/rest
  @Path("/get/userInfo")
  @POST
  @Produces("application/json;charset=utf-8")
  public String getUserInfo(@Context HttpServletRequest request, String content) {
    if (StringUtils.isEmpty(content)) {
      return OpenResult.parameterError("无参数").buildJson();
    }
    JSONObject json = JSONObject.parseObject(content);
    String idNumber = json.getString("idNumber");
    String captcha = json.getString("captcha");
    String uuId = json.getString("uuId");
    if (StringUtils.isEmpty(idNumber)
        || StringUtils.isEmpty(captcha)
        || StringUtils.isEmpty(uuId)) {
      return OpenResult.parameterError("参数错误").buildJson();
    }
    try {
      if (!ValidateUtil.isIdNumber(idNumber)) {
        return OpenResult.parameterError(10103, "身份证号有误,请正确填写您的18位身份证号").buildJson();
      }
      if (!ImageCaptchaValidator.validateResponse(uuId, captcha)) {
        return OpenResult.parameterError(10203, "验证码不正确").buildJson();
      }
      JSONObject result = personalService.queryUserInfo(idNumber);
      if (result != null) {
        int retcode = result.getIntValue("retcode");
        if (retcode != 0) {
          return result.toJSONString();
        }
        NoPwdResult pwdResult = new NoPwdResult();
        String mobileNo = result.getString("mobileno");
        mobileNo = InfoMasker.masker(mobileNo, 3, 4, "*", 1);
        pwdResult.setMobileno(mobileNo);

        JSONObject userInfo = new JSONObject();
        userInfo.put("mobileno", result.getString("mobileno"));
        userInfo.put("userid", result.getString("userid"));
        userInfo.put("email", result.getString("email"));
        setMemcacheJSON(idNumber, userInfo);

        return OpenResult.ok().add("data", pwdResult).buildJson();
      } else {
        return OpenResult.unknown("服务异常").buildJson();
      }

    } catch (StockRestException e) {
      log.error("找回密码时获取用户信息异常:" + e);
      return OpenResult.serviceError(e.getRetcode(), e.getMsg()).buildJson();
    } catch (StockServiceException e) {
      log.error("找回密码时获取用户信息异常:" + e);
      return OpenResult.serviceError(e.getRetcode(), e.getMsg()).buildJson();
    }
  }
コード例 #29
0
ファイル: UserManager.java プロジェクト: whueric/wechat4j
 /**
  * 修改分组名
  *
  * @param groupId 分组id
  * @param name 分组名称
  * @throws WeChatException
  */
 public void updateGroup(int groupId, String name) throws WeChatException {
   JSONObject nameJson = new JSONObject();
   JSONObject groupJson = new JSONObject();
   nameJson.put("id", groupId);
   nameJson.put("name", name);
   groupJson.put("group", nameJson);
   String requestData = groupJson.toString();
   logger.info("request data " + requestData);
   String resultStr = HttpUtils.post(GROUP_UPDATE_POST_URL + this.accessToken, requestData);
   logger.info("return data " + resultStr);
   WeChatUtil.isSuccess(resultStr);
 }
コード例 #30
0
 @RequestMapping("deleteradiostation")
 public @ResponseBody String deleteRadioStation(int id) {
   JSONObject o = new JSONObject();
   int count = radioStationService.removeRadioStation(id);
   if (count > 0) {
     o.put("success", true);
     return o.toJSONString();
   } else {
     o.put("success", false);
     return o.toJSONString();
   }
 }