类com.alibaba.fastjson.JSONObject源码实例Demo

下面列出了怎么用com.alibaba.fastjson.JSONObject的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: teaching   文件: SysDepartRoleController.java
/**
 * 保存数据规则至角色菜单关联表
 */
@PostMapping(value = "/datarule")
public Result<?> saveDatarule(@RequestBody JSONObject jsonObject) {
 try {
	 String permissionId = jsonObject.getString("permissionId");
	 String roleId = jsonObject.getString("roleId");
	 String dataRuleIds = jsonObject.getString("dataRuleIds");
	 log.info("保存数据规则>>"+"菜单ID:"+permissionId+"角色ID:"+ roleId+"数据权限ID:"+dataRuleIds);
	 LambdaQueryWrapper<SysDepartRolePermission> query = new LambdaQueryWrapper<SysDepartRolePermission>()
			 .eq(SysDepartRolePermission::getPermissionId, permissionId)
			 .eq(SysDepartRolePermission::getRoleId,roleId);
	 SysDepartRolePermission sysRolePermission = sysDepartRolePermissionService.getOne(query);
	 if(sysRolePermission==null) {
		 return Result.error("请先保存角色菜单权限!");
	 }else {
		 sysRolePermission.setDataRuleIds(dataRuleIds);
		 this.sysDepartRolePermissionService.updateById(sysRolePermission);
	 }
 } catch (Exception e) {
	 log.error("SysRoleController.saveDatarule()发生异常:" + e.getMessage(),e);
	 return Result.error("保存失败");
 }
 return Result.ok("保存成功!");
}
 
源代码2 项目: leetcode-editor   文件: QuestionManager.java
private static List<Tag> parseList(String str) {
    List<Tag> tags = new ArrayList<Tag>();

    if (StringUtils.isNotBlank(str)) {

        JSONArray jsonArray = JSONArray.parseArray(str);
        for (int i = 0; i < jsonArray.size(); i++) {
            JSONObject object = jsonArray.getJSONObject(i);
            Tag tag = new Tag();
            tag.setSlug(object.getString("id"));
            tag.setType(object.getString("type"));
            String name = object.getString("name");
            if (StringUtils.isBlank(name)) {
                name = object.getString("name");
            }
            tag.setName(name);
            JSONArray questionArray = object.getJSONArray("questions");
            for (int j = 0; j < questionArray.size(); j++) {
                tag.addQuestion(questionArray.getInteger(j).toString());
            }
            tags.add(tag);
        }
    }
    return tags;
}
 
源代码3 项目: zhcc-server   文件: JwtRealm.java
@Override
protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principals) {
    /*********************************************
     * RestfulPermissionFilter 过滤器说明:
     * Actions representing HTTP Method values (GET -> read, POST -> create, etc)
     * private static final String CREATE_ACTION = "create";
     * private static final String READ_ACTION = "read";
     * private static final String UPDATE_ACTION = "update";
     * private static final String DELETE_ACTION = "delete";
     *********************************************/
    // 如果不为securityManager配置缓存管理器,该方法在每次鉴权前都会从数据库中查询权限数据。
    // 分布式环境下,建议将权限保存在redis中,避免每次从数据库中加载。
    //JSONObject json = JSONObject.parseObject(principals.toString());
    Claims claims = jwtUtils.parseJWT(principals.toString());
    JSONObject json = JSONObject.parseObject(claims.getSubject());
    // 得到用户的权限code
    List<String> permissionCodeList = resourceService.listPermissionCodeByUserId(json.getIntValue("userId"));
    SimpleAuthorizationInfo simpleAuthorInfo = new SimpleAuthorizationInfo();
    for (String permissionCode : permissionCodeList) {
        if (permissionCode != null && !permissionCode.trim().equals("")) {
            simpleAuthorInfo.addStringPermission(permissionCode);
        }
        // 如果要添加基于角色的鉴权,可调用simpleAuthorInfo.addRole("role_name")添加用户所属角色。
    }
    return simpleAuthorInfo;
}
 
源代码4 项目: RCT   文件: TTLDataConverse.java
private Map<String, ReportData> toReportDataMap(Set<String> newSetData){
    Map<String, ReportData> reportDataHashMap = new HashMap<String, ReportData>(100);
    if(null != newSetData) {
        JSONObject jsonObject = null;
        String prefix = null;
        ReportData reportData = null;
        for(String object : newSetData) {
            jsonObject = JSON.parseObject(object);
            prefix = jsonObject.getString("prefix");
            reportData = reportDataHashMap.get(prefix);
            if(null == reportData) {
                reportData = new ReportData();
                reportData.setCount(Long.parseLong(jsonObject.getString("noTTL")));
                reportData.setBytes(Long.parseLong(jsonObject.getString("TTL")));
                reportData.setKey(prefix);
            }
            else {
                reportData.setCount(Long.parseLong(jsonObject.getString("noTTL")) + reportData.getCount());
                reportData.setBytes(Long.parseLong(jsonObject.getString("TTL")) + reportData.getBytes());
            }
            reportDataHashMap.put(prefix, reportData);
        }
    }
    return reportDataHashMap;
}
 
源代码5 项目: MicroCommunity   文件: RemoveUserInfoListener.java
/**
 * 修改用户信息至 business表中
 *
 * @param dataFlowContext 数据对象
 * @param business        当前业务对象
 */
@Override
protected void doSaveBusiness(DataFlowContext dataFlowContext, Business business) {
    JSONObject data = business.getDatas();

    Assert.notEmpty(data, "没有datas 节点,或没有子节点需要处理");

    Assert.jsonObjectHaveKey(data, UserPo.class.getSimpleName(), "datas 节点下没有包含 businessUser 节点");

    JSONObject businessUser = data.getJSONArray(UserPo.class.getSimpleName()).getJSONObject(0);

    Assert.jsonObjectHaveKey(businessUser, "userId", "businessUser 节点下没有包含 userId 节点");

    if (businessUser.getString("userId").startsWith("-")) {
        throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR, "userId 错误,不能自动生成(必须已经存在的userId)" + businessUser);
    }

    //自动插入DEL
    autoSaveDelBusinessUser(business, businessUser);
}
 
源代码6 项目: MicroCommunity   文件: UpdateVisitInfoListener.java
/**
 * business to instance 过程
 *
 * @param dataFlowContext 数据对象
 * @param business        当前业务对象
 */
@Override
protected void doBusinessToInstance(DataFlowContext dataFlowContext, Business business) {

    JSONObject data = business.getDatas();

    Map info = new HashMap();
    info.put("bId", business.getbId());
    info.put("operate", StatusConstant.OPERATE_ADD);

    //访客信息信息
    List<Map> businessVisitInfos = visitServiceDaoImpl.getBusinessVisitInfo(info);
    if (businessVisitInfos != null && businessVisitInfos.size() > 0) {
        for (int _visitIndex = 0; _visitIndex < businessVisitInfos.size(); _visitIndex++) {
            Map businessVisitInfo = businessVisitInfos.get(_visitIndex);
            flushBusinessVisitInfo(businessVisitInfo, StatusConstant.STATUS_CD_VALID);
            visitServiceDaoImpl.updateVisitInfoInstance(businessVisitInfo);
            if (businessVisitInfo.size() == 1) {
                dataFlowContext.addParamOut("vId", businessVisitInfo.get("v_id"));
            }
        }
    }

}
 
源代码7 项目: javabase   文件: WeiXinController.java
@RequestMapping("/weixin/auth")
	public String weiXinAuth(Model model, String code, String token) throws Exception {
		String url = String.format(weiXinConfig.getAccessTokenUrl(), weiXinConfig.getAppid(), weiXinConfig.getSecret(), code);
		String result = Request.Get(url).execute().returnContent().asString();
		if (StringUtils.isNotEmpty(result)) {
			JSONObject jsonObject = JSONObject.parseObject(result);
			if (!jsonObject.containsKey("errcode")) {
				String openid = jsonObject.getString("openid");
				String accessToken = jsonObject.getString("access_token");
				String userInfoUrl = String.format(weiXinConfig.getUserinfoUrl(), accessToken, openid);
				String userInfoResult = Request.Get(userInfoUrl).execute().returnContent()
						.asString(Charset.forName("utf-8"));
				log.info("userInfoResult=" + userInfoResult);
				redisTemplate.opsForValue().set(token, "1",2, TimeUnit.MINUTES);
				redisTemplate.opsForValue().set(token + "info", userInfoResult, 30, TimeUnit.MINUTES);
				model.addAttribute("result","登录成功!");
			}else{
				model.addAttribute("result","登录失败!");
			}
		}
//		return "weixin/loginResult";
		return "redirect:https://ggj2010.bid/tiebaimage";
	}
 
源代码8 项目: jeewx-boot   文件: WebAuthWeixinApi.java
/**
 * 获取用户信息
 * @param openid
 * @param accessToken
 * @return
 */
public static JSONObject getWebAuthUserInfo(String openid,String accessToken){
	try {
		if(StringUtils.isEmpty(openid)){
			logger.info("openid为空");
			return null;
		}
		if(StringUtils.isEmpty(accessToken)){
			logger.info("accessToken为空");
			return null;
		}
		return httpRequest(getUserInfoUrl.replace("ACCESS_TOKEN", accessToken).replace("OPENID", openid), "GET", null);
	} catch (Exception e) {
		logger.error("获取用户信息异常",e);
	}
	return null;
}
 
源代码9 项目: GOAi   文件: HuobiProExchange.java
/**
 * 获取account id
 * @param access access
 * @param secret secret
 * @return account id
 */
private String getAccountId(String access, String secret) {
    String id = this.getCache().get(access);
    if (!useful(id)) {
        String result = this.getAccounts(access, secret);
        if (useful(result)) {
            JSONObject r = JSON.parseObject(result);
            if (r.containsKey(STATUS) && OK.equals(r.getString(STATUS))) {
                JSONArray data = r.getJSONArray(DATA);
                for (int i = 0, s = data.size(); i < s; i++) {
                    JSONObject t = data.getJSONObject(i);
                    String accountId = t.getString("id");
                    String type = t.getString("type");
                    if ("spot".equals(type)) {
                        id = accountId;
                        this.getCache().set(access, id);
                        return id;
                    }
                }
            }
        }
        throw new ExchangeException(super.name.getName() + " " + Seal.seal(access)
                + " account_id: result is " + result);
    }
    return id;
}
 
源代码10 项目: Jpom   文件: NginxController.java
/**
     * 获取配置文件信息页面
     *
     * @param path 白名单路径
     * @param name 名称
     * @return 页面
     */
    @RequestMapping(value = "item_data", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public String itemData(String path, String name) {
        String newName = pathSafe(name);
        if (whitelistDirectoryService.checkNgxDirectory(path)) {
            File file = FileUtil.file(path, newName);
            JSONObject jsonObject = new JSONObject();
            String string = FileUtil.readUtf8String(file);
            jsonObject.put("context", string);
            String rName = StringUtil.delStartPath(file, path, true);
            // nginxService.paresName(path, file.getAbsolutePath())
            jsonObject.put("name", rName);
            jsonObject.put("whitePath", path);
            return JsonMessage.getString(200, "", jsonObject);
//            setAttribute("data", jsonObject);
        }
        return JsonMessage.getString(400, "错误");
    }
 
源代码11 项目: MicroCommunity   文件: ApplicationKeyBMOImpl.java
/**
 * 添加物业费用
 *
 * @param paramInJson     接口调用放传入入参
 * @param dataFlowContext 数据上下文
 * @return 订单服务能够接受的报文
 */
public void addOwnerKeyPhoto(JSONObject paramInJson, DataFlowContext dataFlowContext) {


    JSONObject businessUnit = new JSONObject();
    businessUnit.put("fileRelId", "-1");
    businessUnit.put("relTypeCd", "10000");
    businessUnit.put("saveWay", "table");
    businessUnit.put("objId", paramInJson.getString("memberId"));
    businessUnit.put("fileRealName", paramInJson.getString("ownerPhotoId"));
    businessUnit.put("fileSaveName", paramInJson.getString("fileSaveName"));

    FileRelPo fileRelPo = BeanConvertUtil.covertBean(businessUnit, FileRelPo.class);

    super.insert(dataFlowContext, fileRelPo, BusinessTypeConstant.BUSINESS_TYPE_SAVE_FILE_REL);

}
 
源代码12 项目: RCT   文件: RDBAnalyzeController.java
/**
 * 动态改变属性值
 * 
 * 目前接受更改的属性值有: {@link Analyzer#FILTER_Bytes} {@link Analyzer#FILTER_ItemCount}
 * 
 * <code>
 * {
 *    "filterBytes": 1024,
 *    "filterItemCount": 10,
 *    "useCustomAlgo": boolean,
 *    "includeNoMatchPrefixKey": boolean,
 *    "maxEsSenderThreadNum": 2,
 *    "maxQueueSize": 1000,
 *    "maxMapSize": 1000
 * }
 * </code>
 * 
 * @param json
 * @return
 */
@RequestMapping(value = "/properties", method = RequestMethod.POST)
@ResponseBody
public String dynamicSetting(@RequestBody JSONObject json) {
	if (json.containsKey("filterBytes")) {
		Analyzer.FILTER_Bytes = json.getLong("filterBytes");
	}
	if (json.containsKey("filterItemCount")) {
		Analyzer.FILTER_ItemCount = json.getInteger("filterItemCount");
	}
	if (json.containsKey("useCustomAlgo")) {
		Analyzer.USE_Custom_Algo = json.getBoolean("useCustomAlgo");
	}
	if (json.containsKey("includeNoMatchPrefixKey")) {
		Analyzer.INCLUDE_NoMatchPrefixKey = json.getBoolean("includeNoMatchPrefixKey");
	}
	if (json.containsKey("maxEsSenderThreadNum")) {
		Analyzer.MAX_EsSenderThreadNum = json.getInteger("maxEsSenderThreadNum");
		AnalyzerWorker.workerNumChanged();
	}
	if (json.containsKey("maxQueueSize")) {
		Analyzer.MAX_QUEUE_SIZE = json.getInteger("maxQueueSize");
	}

	return this.settingObj().toJSONString();
}
 
源代码13 项目: DBus   文件: SinkerWriteBolt.java
@Override
public void execute(Tuple input) {
    List<DBusConsumerRecord<String, byte[]>> data = (List<DBusConsumerRecord<String, byte[]>>) input.getValueByField("data");
    try {
        if (isCtrl(data)) {
            JSONObject json = JSON.parseObject(new String(data.get(0).value(), "utf-8"));
            logger.info("[write bolt] received reload message .{} ", json);
            Long id = json.getLong("id");
            if (ctrlMsgId == id) {
                logger.info("[write bolt] ignore duplicate ctrl messages . {}", json);
            } else {
                ctrlMsgId = id;
                processCtrlMsg(json);
            }
        } else {
            sendData(data);
        }
        collector.ack(input);
    } catch (Exception e) {
        logger.error("[write bolt] execute error.", e);
        collector.fail(input);
    }
}
 
源代码14 项目: EasyML   文件: DataParser.java
/**
 * Parse csv data to json object
 * 
 * @param datas  csv data list
 * @param columns   csv data column
 * @return
 */
public static List<JSONObject> parseCsvToJson(List<String> datas,List<String> columns)
{
	int startIndex = 0;
	List<JSONObject> results = new ArrayList<JSONObject>();
	for(int i = startIndex ; i<datas.size(); i++)
	{
		if(datas.get(i) == null || datas.get(i).equals(""))
		{
			results.add(null);
			continue;
		}
		String[] colDatas = datas.get(i).split(",");
		if(columns.get(0).equals(colDatas[0]))
			continue;
		JSONObject obj = new JSONObject();
		for(int k=0;k<colDatas.length;k++)
		{
			String colName = columns.get(k);
			String colValue = colDatas[k];
			obj.put(colName, colValue);
		}
		results.add(obj);
	}
	return results;
}
 
源代码15 项目: MicroCommunity   文件: SaveWorkflowInfoListener.java
/**
 * business 数据转移到 instance
 *
 * @param dataFlowContext 数据对象
 * @param business        当前业务对象
 */
@Override
protected void doBusinessToInstance(DataFlowContext dataFlowContext, Business business) {
    JSONObject data = business.getDatas();

    Map info = new HashMap();
    info.put("bId", business.getbId());
    info.put("operate", StatusConstant.OPERATE_ADD);

    //工作流信息
    List<Map> businessWorkflowInfo = workflowServiceDaoImpl.getBusinessWorkflowInfo(info);
    if (businessWorkflowInfo != null && businessWorkflowInfo.size() > 0) {
        reFreshShareColumn(info, businessWorkflowInfo.get(0));
        workflowServiceDaoImpl.saveWorkflowInfoInstance(info);
        if (businessWorkflowInfo.size() == 1) {
            dataFlowContext.addParamOut("flowId", businessWorkflowInfo.get(0).get("flow_id"));
        }
    }
}
 
源代码16 项目: app-version   文件: DingtalkChatbotClient.java
public SendResult send(String webhook, Message message) throws IOException {
    HttpPost httppost = new HttpPost(webhook);
    httppost.addHeader("Content-Type", "application/json; charset=utf-8");
    StringEntity se = new StringEntity(message.toJsonString(), "utf-8");
    httppost.setEntity(se);
    SendResult sendResult = new SendResult();
    HttpResponse response = this.httpclient.execute(httppost);
    if (response.getStatusLine().getStatusCode() == 200) {
        String result = EntityUtils.toString(response.getEntity());
        JSONObject obj = JSONObject.parseObject(result);
        Integer errcode = obj.getInteger("errcode");
        sendResult.setErrorCode(errcode);
        sendResult.setErrorMsg(obj.getString("errmsg"));
        sendResult.setIsSuccess(errcode.equals(0));
    }

    return sendResult;
}
 
/**
 * 当修改数据时,查询instance表中的数据 自动保存删除数据到business中
 *
 * @param business      当前业务
 * @param communityAttr 小区属性
 */
protected void autoSaveDelBusinessCommunityAttr(Business business, JSONObject communityAttr) {
    Map info = new HashMap();
    info.put("attrId", communityAttr.getString("attrId"));
    info.put("communityId", communityAttr.getString("communityId"));
    info.put("statusCd", StatusConstant.STATUS_CD_VALID);
    List<Map> currentCommunityAttrs = getCommunityServiceDaoImpl().getCommunityAttrs(info);
    if (currentCommunityAttrs == null || currentCommunityAttrs.size() != 1) {
        throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR, "未找到需要修改数据信息,入参错误或数据有问题,请检查" + info);
    }
    Map currentCommunityAttr = currentCommunityAttrs.get(0);
    currentCommunityAttr.put("bId", business.getbId());
    currentCommunityAttr.put("attrId", currentCommunityAttr.get("attr_id"));
    currentCommunityAttr.put("communityId", currentCommunityAttr.get("community_id"));
    currentCommunityAttr.put("specCd", currentCommunityAttr.get("spec_cd"));
    currentCommunityAttr.put("operate", StatusConstant.OPERATE_DEL);
    getCommunityServiceDaoImpl().saveBusinessCommunityAttr(currentCommunityAttr);
    for(Object key : currentCommunityAttr.keySet()) {
        if(communityAttr.get(key) == null) {
            communityAttr.put(key.toString(), currentCommunityAttr.get(key));
        }
    }
}
 
源代码18 项目: MicroCommunity   文件: OrderServiceSMOImpl.java
/**
 * 保存耗时信息
 *
 * @param dataFlow
 */
private void saveCostTimeLogMessage(DataFlow dataFlow) {
    try {
        if (MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_COST_TIME_ON_OFF))) {
            List<DataFlowLinksCost> dataFlowLinksCosts = dataFlow.getLinksCostDates();
            JSONObject costDate = new JSONObject();
            JSONArray costDates = new JSONArray();
            JSONObject newObj = null;
            for (DataFlowLinksCost dataFlowLinksCost : dataFlowLinksCosts) {
                newObj = JSONObject.parseObject(JSONObject.toJSONString(dataFlowLinksCost));
                newObj.put("dataFlowId", dataFlow.getDataFlowId());
                newObj.put("transactionId", dataFlow.getTransactionId());
                costDates.add(newObj);
            }
            costDate.put("costDates", costDates);

            KafkaFactory.sendKafkaMessage(KafkaConstant.TOPIC_COST_TIME_LOG_NAME, "", costDate.toJSONString());
        }
    } catch (Exception e) {
        logger.error("报错日志出错了,", e);
    }
}
 
源代码19 项目: ns4_gear_watchdog   文件: ChatBotUtil.java
/**
 * 发送消息
 * @param message 消息内容
 * @return
 */
public static String send(BotMessage message) {
    if (URL.equals("")) {
        init();
    }

    String  valid = validMessage(message);
    if (!StringUtils.isEmpty(valid)) {
        return valid;
    }

    HashMap<String,String> param = convertHashMap(message);

    return JSONObject.toJSONString(HttpClientUtil.doUmpHttp_HttpClient(param , URL));

}
 
源代码20 项目: java-unified-sdk   文件: AVNotificationManager.java
static Date getExpiration(String msg) {
  String result = "";
  try {
    JSONObject object = JSON.parseObject(msg);
    result = object.getString("_expiration_time");
  } catch (JSONException e) {
    // LogUtil.avlog.i(e);
    // 不应该当做一个Error发出来,既然expire仅仅是一个option的数据
    // Log.e(LOGTAG, "Get expiration date error.", e);
  }
  if (StringUtil.isEmpty(result)) {
    return null;
  }
  Date date = StringUtil.dateFromString(result);
  return date;
}
 
源代码21 项目: jeecg-cloud   文件: PopupProperty.java
@Override
public Map<String, Object> getPropertyJson() {
	Map<String,Object> map = new HashMap<>();
	map.put("key",getKey());
	JSONObject prop = getCommonJson();
	if(code!=null) {
		prop.put("code",code);
	}
	if(destFields!=null) {
		prop.put("destFields",destFields);
	}
	if(orgFields!=null) {
		prop.put("orgFields",orgFields);
	}
	map.put("prop",prop);
	return map;
}
 
源代码22 项目: vscrawler   文件: JedisScoredQueueStore.java
@Override
public boolean addLast(String queueID, ResourceItem e) {
    if (!lockQueue(queueID)) {
        return false;
    }
    remove(queueID, e.getKey());
    Jedis jedis = jedisPool.getResource();
    try {
        jedis.rpush(makePoolQueueKey(queueID), e.getKey());
        jedis.hset(makeDataKey(queueID), e.getKey(), JSONObject.toJSONString(e));
    } finally {
        IOUtils.closeQuietly(jedis);
        unLockQueue(queueID);
    }
    return true;
}
 
源代码23 项目: weex   文件: WXDomStatement.java
/**
 * Create a command object for scroll the given view to the specified position.
 * @param ref {@link WXDomObject#ref} of the dom.
 * @param options the specified position
 */
void scrollToDom(final String ref, final JSONObject options) {
  if (mDestroy) {
    return;
  }
  WXSDKInstance instance = WXSDKManager.getInstance().getSDKInstance(mInstanceId);

  mNormalTasks.add(new IWXRenderTask() {

    @Override
    public void execute() {
      mWXRenderManager.scrollToComponent(mInstanceId, ref, options);
    }
  });

  mDirty = true;
  if (instance != null) {
    instance.commitUTStab(WXConst.DOM_MODULE, WXErrorCode.WX_SUCCESS);
  }
}
 
源代码24 项目: MicroCommunity   文件: SaveAdvertInfoListener.java
/**
 * business 数据转移到 instance
 *
 * @param dataFlowContext 数据对象
 * @param business        当前业务对象
 */
@Override
protected void doBusinessToInstance(DataFlowContext dataFlowContext, Business business) {
    JSONObject data = business.getDatas();

    Map info = new HashMap();
    info.put("bId", business.getbId());
    info.put("operate", StatusConstant.OPERATE_ADD);

    //广告信息信息
    List<Map> businessAdvertInfo = advertServiceDaoImpl.getBusinessAdvertInfo(info);
    if (businessAdvertInfo != null && businessAdvertInfo.size() > 0) {
        reFreshShareColumn(info, businessAdvertInfo.get(0));
        advertServiceDaoImpl.saveAdvertInfoInstance(info);
        if (businessAdvertInfo.size() == 1) {
            dataFlowContext.addParamOut("advertId", businessAdvertInfo.get(0).get("advert_id"));
        }
    }
}
 
源代码25 项目: MicroCommunity   文件: StoreServiceDaoImpl.java
/**
 * 保存物业用户信息
 *
 * @param info
 * @throws DAOException
 */
public void saveBusinessStoreUser(Map info) throws DAOException {
    info.put("month", DateUtil.getCurrentMonth());
    logger.debug("保存物业用户信息入参 info : {}", info);

    int saveFlag = sqlSessionTemplate.insert("storeServiceDaoImpl.saveBusinessStoreUser", info);

    if (saveFlag < 1) {
        throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR, "保存商户用户信息数据失败:" + JSONObject.toJSONString(info));
    }
}
 
源代码26 项目: jpress   文件: Kuaidi100ExpressQuerier.java
@Override
public List<ExpressInfo> query(ExpressCompany company, String num) {

    String appId = JPressOptions.get("express_api_appid");
    String appSecret = JPressOptions.get("express_api_appsecret");

    String param = "{\"com\":\"" + company.getCode() + "\",\"num\":\"" + num + "\"}";
    String sign = HashKit.md5(param + appSecret + appId).toUpperCase();
    HashMap params = new HashMap();
    params.put("param", param);
    params.put("sign", sign);
    params.put("customer", appId);


    String result = HttpUtil.httpPost("http://poll.kuaidi100.com/poll/query.do", params);
    if (StrUtil.isBlank(result)) {
        return null;
    }

    try {
        JSONObject jsonObject = JSON.parseObject(result);
        JSONArray jsonArray = jsonObject.getJSONArray("data");
        if (jsonArray != null && jsonArray.size() > 0) {
            List<ExpressInfo> list = new ArrayList<>();
            for (int i = 0; i < jsonArray.size(); i++) {
                JSONObject expObject = jsonArray.getJSONObject(i);
                ExpressInfo ei = new ExpressInfo();
                ei.setInfo(expObject.getString("context"));
                ei.setTime(expObject.getString("time"));
                list.add(ei);
            }
            return list;
        }
    } catch (Exception ex) {
        LOG.error(ex.toString(), ex);
    }

    LOG.error(result);
    return null;
}
 
源代码27 项目: EasyReport   文件: ReportUtils.java
public static JSONObject getDefaultChartData() {
    return new JSONObject(6) {
        {
            put("dimColumnMap", null);
            put("dimColumns", null);
            put("statColumns", null);
            put("dataRows", null);
            put("msg", "");
        }
    };
}
 
源代码28 项目: jeecg-boot   文件: WebSocket.java
@OnMessage
public void onMessage(String message) {
    //todo 现在有个定时任务刷,应该去掉
	log.debug("【websocket消息】收到客户端消息:"+message);
	JSONObject obj = new JSONObject();
	obj.put(WebsocketConst.MSG_CMD, WebsocketConst.CMD_CHECK);//业务类型
	obj.put(WebsocketConst.MSG_TXT, "心跳响应");//消息内容
	session.getAsyncRemote().sendText(obj.toJSONString());
}
 
源代码29 项目: weex-uikit   文件: WXSDKInstance.java
public void setSize(int width, int height) {
  if (width < 0 || height < 0 || isDestroy || !mRendered) {
    return;
  }
  float realWidth = WXViewUtils.getWebPxByWidth(width,getViewPortWidth());
  float realHeight = WXViewUtils.getWebPxByWidth(height,getViewPortWidth());

  View godView = mRenderContainer;
  if (godView != null) {
    ViewGroup.LayoutParams layoutParams = godView.getLayoutParams();
    if (layoutParams != null) {
      if(godView.getWidth() != width || godView.getHeight() != height) {
        layoutParams.width = width;
        layoutParams.height = height;
        godView.setLayoutParams(layoutParams);
      }

      JSONObject style = new JSONObject();
      WXComponent rootComponent = mRootComp;

      if(rootComponent == null){
        return;
      }
      style.put(Constants.Name.DEFAULT_WIDTH, realWidth);
      style.put(Constants.Name.DEFAULT_HEIGHT, realHeight);
      updateRootComponentStyle(style);
    }
  }
}
 
源代码30 项目: MicroCommunity   文件: DeleteAdvertInfoListener.java
/**
 * 处理 businessAdvert 节点
 *
 * @param business       总的数据节点
 * @param businessAdvert 广告信息节点
 */
private void doBusinessAdvert(Business business, JSONObject businessAdvert) {

    Assert.jsonObjectHaveKey(businessAdvert, "advertId", "businessAdvert 节点下没有包含 advertId 节点");

    if (businessAdvert.getString("advertId").startsWith("-")) {
        throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR, "advertId 错误,不能自动生成(必须已经存在的advertId)" + businessAdvert);
    }
    //自动插入DEL
    autoSaveDelBusinessAdvert(business, businessAdvert);
}
 
 类所在包
 同包方法