Java Code Examples for com.alibaba.fastjson.JSONObject#putAll()

The following examples show how to use com.alibaba.fastjson.JSONObject#putAll() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: tephra   File: PptxImpl.java    License: MIT License 6 votes vote down vote up
private void getBorder(JSONArray elements, JSONObject element, XSLFSimpleShape xslfSimpleShape) {
    if (xslfSimpleShape.getLineDash() == null)
        return;

    int width = numeric.toInt(xslfSimpleShape.getLineWidth() * 96 / 72);
    if (width <= 0)
        return;

    JSONObject object = new JSONObject();
    object.putAll(element);
    object.put("type", "border");
    object.put("color", parserHelper.toHex(xslfSimpleShape.getLineColor()));
    object.put("dash", xslfSimpleShape.getLineDash().name().toLowerCase());
    object.put("border", width);
    elements.add(object);
}
 
Example 2
/**
 * 将插件中的配置以及任务的配置合并,以便在容器中运行
 * @param pluginConf
 * @param jobPluginConfig
 * @return
 */
private String mergeConfig(String pluginConf, String jobPluginConfig){

    if(StringUtils.isBlank(pluginConf)){
        return jobPluginConfig;
    }
    if(StringUtils.isBlank(jobPluginConfig)){
        return pluginConf;
    }

    JSONObject jobPluginConfigObj = JSONObject.parseObject(jobPluginConfig);
    JSONObject pluginConfigObj = JSONObject.parseObject(pluginConf);
    jobPluginConfigObj.putAll(pluginConfigObj);

    return JSONUtils.toJSONStringWithoutCircleDetect(jobPluginConfigObj);
}
 
Example 3
/**
 * 构建员工信息
 *
 * @param paramObj
 * @param dataFlowContext
 * @return
 */
private JSONObject builderStaffInfo(JSONObject paramObj, DataFlowContext dataFlowContext) {

    UserDto userDto = new UserDto();
    userDto.setStatusCd("0");
    userDto.setUserId(paramObj.getString("userId"));
    List<UserDto> userDtos = userInnerServiceSMOImpl.getUserHasPwd(userDto);

    Assert.listOnlyOne(userDtos, "数据错误查询到多条用户信息或单条");

    JSONObject userInfo = JSONObject.parseObject(JSONObject.toJSONString(userDtos.get(0)));
    String pwd = GenerateCodeFactory.getRandomCode(6);
    userInfo.putAll(paramObj);
    userInfo.put("password", AuthenticationFactory.passwdMd5(pwd));
    paramObj.put("pwd", pwd);

    return userInfo;
}
 
Example 4
/**
 * 添加物品管理信息
 *
 * @param paramInJson     接口调用放传入入参
 * @param dataFlowContext 数据上下文
 * @return 订单服务能够接受的报文
 */
public void updateResourceStore(JSONObject paramInJson, DataFlowContext dataFlowContext) {

    ResourceStoreDto resourceStoreDto = new ResourceStoreDto();
    resourceStoreDto.setResId(paramInJson.getString("resId"));
    resourceStoreDto.setStoreId(paramInJson.getString("storeId"));

    List<ResourceStoreDto> resourceStoreDtos = resourceStoreInnerServiceSMOImpl.queryResourceStores(resourceStoreDto);

    Assert.isOne(resourceStoreDtos, "查询到多条物品 或未查到物品,resId=" + resourceStoreDto.getResId());

    JSONObject businessResourceStore = new JSONObject();
    businessResourceStore.putAll(paramInJson);
    businessResourceStore.put("stock", resourceStoreDtos.get(0).getStock());
    ResourceStorePo resourceStorePo = BeanConvertUtil.covertBean(businessResourceStore, ResourceStorePo.class);
    super.update(dataFlowContext, resourceStorePo, BusinessTypeConstant.BUSINESS_TYPE_UPDATE_RESOURCE_STORE);
}
 
Example 5
@Override
protected ResponseEntity<String> doBusinessProcess(IPageData pd, JSONObject paramIn) {
    ComponentValidateResult result = super.validateStoreStaffCommunityRelationship(pd, restTemplate);

    Map paramMap = BeanConvertUtil.beanCovertMap(result);
    paramIn.putAll(paramMap);
    //将用户ID刷掉
    paramIn.remove("userId");

    String apiUrl = ServiceConstant.SERVICE_API_URL + "/api/notice.listNotices" + mapToUrlParam(paramIn);


    ResponseEntity<String> responseEntity = this.callCenterService(restTemplate, pd, "",
            apiUrl,
            HttpMethod.GET);

    return responseEntity;
}
 
Example 6
Source Project: MicroCommunity   File: OwnerBMOImpl.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * 添加业主应用用户关系
 *
 * @param paramInJson
 * @return
 */
public void addOwnerAppUser(JSONObject paramInJson, CommunityDto communityDto, OwnerDto ownerDto, DataFlowContext dataFlowContext) {

    JSONObject businessOwnerAppUser = new JSONObject();
    businessOwnerAppUser.putAll(paramInJson);
    //状态类型,10000 审核中,12000 审核成功,13000 审核失败
    businessOwnerAppUser.put("state", "12000");
    businessOwnerAppUser.put("appTypeCd", "10010");
    businessOwnerAppUser.put("appUserId", "-1");
    businessOwnerAppUser.put("memberId", ownerDto.getMemberId());
    businessOwnerAppUser.put("communityName", communityDto.getName());
    businessOwnerAppUser.put("communityId", communityDto.getCommunityId());
    businessOwnerAppUser.put("appUserName", ownerDto.getName());
    businessOwnerAppUser.put("idCard", ownerDto.getIdCard());
    businessOwnerAppUser.put("link", ownerDto.getLink());
    businessOwnerAppUser.put("userId", paramInJson.getString("userId"));
    OwnerAppUserPo ownerAppUserPo = BeanConvertUtil.covertBean(businessOwnerAppUser, OwnerAppUserPo.class);
    super.insert(dataFlowContext, ownerAppUserPo, BusinessTypeConstant.BUSINESS_TYPE_SAVE_OWNER_APP_USER);
}
 
Example 7
Source Project: MicroCommunity   File: OwnerBMOImpl.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * 添加小区楼信息
 *
 * @param paramInJson 接口调用放传入入参
 * @return 订单服务能够接受的报文
 */
public void editOwner(JSONObject paramInJson, DataFlowContext dataFlowContext) {

    OwnerDto ownerDto = new OwnerDto();
    ownerDto.setMemberId(paramInJson.getString("memberId"));
    List<OwnerDto> ownerDtos = ownerInnerServiceSMOImpl.queryOwnerMembers(ownerDto);

    Assert.listOnlyOne(ownerDtos, "未查询到业主信息或查询到多条");

    JSONObject businessOwner = new JSONObject();
    businessOwner.putAll(BeanConvertUtil.beanCovertMap(ownerDtos.get(0)));
    businessOwner.putAll(paramInJson);
    businessOwner.put("state", ownerDtos.get(0).getState());
    OwnerPo ownerPo = BeanConvertUtil.covertBean(businessOwner, OwnerPo.class);
    super.delete(dataFlowContext, ownerPo, BusinessTypeConstant.BUSINESS_TYPE_UPDATE_OWNER_INFO);
}
 
Example 8
/**
 * 异常
 * @return
 */
public String toJsonString() {
    JSONObject exceptionJson = JSONObject.parseObject("{\"exception\":{}");
    JSONObject exceptionJsonObj = exceptionJson.getJSONObject("exception");

    if (getResult() != null)
        exceptionJsonObj.putAll(JSONObject.parseObject(result.toString()));

    exceptionJsonObj.put("exceptionTrace",getMessage());

    return exceptionJsonObj.toString();
}
 
Example 9
Source Project: MicroCommunity   File: RoomBMOImpl.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * 售卖房屋信息
 *
 * @param paramInJson     接口调用放传入入参
 * @param dataFlowContext 数据上下文
 * @return 订单服务能够接受的报文
 */
public void sellRoom(JSONObject paramInJson, DataFlowContext dataFlowContext) {

    JSONObject businessUnit = new JSONObject();
    businessUnit.putAll(paramInJson);
    businessUnit.put("relId", "-1");
    businessUnit.put("userId", dataFlowContext.getRequestCurrentHeaders().get(CommonConstant.HTTP_USER_ID));
    OwnerRoomRelPo ownerRoomRelPo = BeanConvertUtil.covertBean(businessUnit, OwnerRoomRelPo.class);
    super.insert(dataFlowContext, ownerRoomRelPo, BusinessTypeConstant.BUSINESS_TYPE_SAVE_OWNER_ROOM_REL);
}
 
Example 10
/**
 * 添加活动信息
 *
 * @param paramInJson     接口调用放传入入参
 * @param dataFlowContext 数据上下文
 * @return 订单服务能够接受的报文
 */
public JSONObject updateActivities(JSONObject paramInJson, DataFlowContext dataFlowContext) {

    ActivitiesDto activitiesDto = new ActivitiesDto();
    activitiesDto.setActivitiesId(paramInJson.getString("activitiesId"));
    activitiesDto.setCommunityId(paramInJson.getString("communityId"));
    List<ActivitiesDto> activitiesDtos = activitiesInnerServiceSMOImpl.queryActivitiess(activitiesDto);

    Assert.listOnlyOne(activitiesDtos, "未找到需要修改的活动 或多条数据");


    JSONObject business = JSONObject.parseObject("{\"datas\":{}}");
    business.put(CommonConstant.HTTP_BUSINESS_TYPE_CD, BusinessTypeConstant.BUSINESS_TYPE_UPDATE_ACTIVITIES);
    business.put(CommonConstant.HTTP_SEQ, DEFAULT_SEQ);
    business.put(CommonConstant.HTTP_INVOKE_MODEL, CommonConstant.HTTP_INVOKE_MODEL_S);
    JSONObject businessActivities = new JSONObject();
    businessActivities.putAll(paramInJson);
    businessActivities.put("userId",activitiesDtos.get(0).getUserId());
    businessActivities.put("userName",activitiesDtos.get(0).getUserName());
    businessActivities.put("readCount",activitiesDtos.get(0).getReadCount());
    businessActivities.put("likeCount",activitiesDtos.get(0).getLikeCount());
    businessActivities.put("collectCount",activitiesDtos.get(0).getCollectCount());
    businessActivities.put("state",activitiesDtos.get(0).getState()); // 先设置为不审核
    //计算 应收金额
    business.getJSONObject(CommonConstant.HTTP_BUSINESS_DATAS).put("businessActivities", businessActivities);
    return business;
}
 
Example 11
Source Project: MicroCommunity   File: VisitBMOImpl.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * 添加小区信息
 *
 * @param paramInJson     接口调用放传入入参
 * @param dataFlowContext 数据上下文
 * @return 订单服务能够接受的报文
 */
public void addVisit(JSONObject paramInJson, DataFlowContext dataFlowContext) {

    JSONObject businessVisit = new JSONObject();
    businessVisit.putAll(paramInJson);

    VisitPo visitPo = BeanConvertUtil.covertBean(businessVisit, VisitPo.class);
    super.insert(dataFlowContext, visitPo, BusinessTypeConstant.BUSINESS_TYPE_SAVE_VISIT);
}
 
Example 12
public static Text parseLog(String row) throws ParseException {
    String[] logPart = StringUtils.split(row, "\u1111");
    SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
    long timeTag = dateFormat.parse(logPart[0]).getTime();

    String activeName = logPart[1];

    JSONObject bizData = JSON.parseObject(logPart[2]);
    JSONObject logData = new JSONObject();
    logData.put("active_name", activeName);
    logData.put("time_tag", timeTag);
    logData.putAll(bizData);

    return new Text(logData.toJSONString());
}
 
Example 13
Source Project: MicroCommunity   File: RoomBMOImpl.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * 添加小区楼信息
 *
 * @param paramInJson     接口调用放传入入参
 * @param dataFlowContext 数据上下文
 * @return 订单服务能够接受的报文
 */
public void updateShellRoom(JSONObject paramInJson, DataFlowContext dataFlowContext) {

    JSONObject businessUnit = new JSONObject();
    businessUnit.putAll(paramInJson);
    businessUnit.put("userId", dataFlowContext.getRequestCurrentHeaders().get(CommonConstant.HTTP_USER_ID));
    RoomPo roomPo = BeanConvertUtil.covertBean(businessUnit, RoomPo.class);
    super.update(dataFlowContext, roomPo, BusinessTypeConstant.BUSINESS_TYPE_UPDATE_ROOM_INFO);
}
 
Example 14
Source Project: MicroCommunity   File: FeeBMOImpl.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * 添加费用项信息
 *
 * @param paramInJson     接口调用放传入入参
 * @param dataFlowContext 数据上下文
 * @return 订单服务能够接受的报文
 */
public void updateFeeConfig(JSONObject paramInJson, DataFlowContext dataFlowContext) {
    FeeConfigDto feeConfigDto = new FeeConfigDto();
    feeConfigDto.setCommunityId(paramInJson.getString("communityId"));
    feeConfigDto.setConfigId(paramInJson.getString("configId"));
    List<FeeConfigDto> feeConfigDtos = feeConfigInnerServiceSMOImpl.queryFeeConfigs(feeConfigDto);
    Assert.listOnlyOne(feeConfigDtos, "未找到该费用项");

    JSONObject businessFeeConfig = new JSONObject();
    businessFeeConfig.putAll(paramInJson);
    businessFeeConfig.put("isDefault", feeConfigDtos.get(0).getIsDefault());
    PayFeeConfigPo payFeeConfigPo = BeanConvertUtil.covertBean(businessFeeConfig, PayFeeConfigPo.class);

    super.update(dataFlowContext, payFeeConfigPo, BusinessTypeConstant.BUSINESS_TYPE_UPDATE_FEE_CONFIG);
}
 
Example 15
/**
 * 异常
 * @return
 */
public String toJsonString() {
    JSONObject exceptionJson = JSONObject.parseObject("{\"exception\":{}");
    JSONObject exceptionJsonObj = exceptionJson.getJSONObject("exception");

    if (getResult() != null)
        exceptionJsonObj.putAll(JSONObject.parseObject(result.toString()));

    exceptionJsonObj.put("exceptionTrace",getMessage());

    return exceptionJsonObj.toString();
}
 
Example 16
@Override
protected ResponseEntity<String> doBusinessProcess(IPageData pd, JSONObject paramIn) {
    ComponentValidateResult result = super.validateStoreStaffCommunityRelationship(pd, restTemplate);

    Map paramMap = BeanConvertUtil.beanCovertMap(result);
    paramIn.putAll(paramMap);

    String apiUrl = ServiceConstant.SERVICE_API_URL + "/api/serviceImpl.listServiceImpls" + mapToUrlParam(paramIn);


    ResponseEntity<String> responseEntity = this.callCenterService(restTemplate, pd, "",
            apiUrl,
            HttpMethod.GET);

    return responseEntity;
}
 
Example 17
@Override
protected ResponseEntity<String> doBusinessProcess(IPageData pd, JSONObject paramIn) {
    ComponentValidateResult result = super.validateStoreStaffCommunityRelationship(pd, restTemplate);

    Map paramMap = BeanConvertUtil.beanCovertMap(result);
    paramIn.putAll(paramMap);

    String apiUrl = ServiceConstant.SERVICE_API_URL + "/api/inspectionPoint.listInspectionPoints" + mapToUrlParam(paramIn);


    ResponseEntity<String> responseEntity = this.callCenterService(restTemplate, pd, "",
            apiUrl,
            HttpMethod.GET);

    return responseEntity;
}
 
Example 18
Source Project: EserKnife   File: BatchContentVo.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public String toString() {
    Assert.notNull(batchActionEnum, "batchActionEnum 不能为空!");
    if(!BatchActionEnum.DELETE.equals(batchActionEnum)) {
        Assert.notNull(content, "content 不能为空!");
    }
    StringBuilder sb = new StringBuilder();
    JSONObject actionJson = new JSONObject();
    JSONObject actionBodyJson =  new JSONObject();

    if(!StringUtils.isBlank(index)) {
        actionBodyJson.put("_index", index);
    }

    if(!StringUtils.isBlank(type)) {
        actionBodyJson.put("_type", type);
    }

    if(!StringUtils.isBlank(id)) {
        actionBodyJson.put("_id", id);
    }

    actionBodyJson.putAll(selfConfig);

    actionJson.put(batchActionEnum.getName(), actionBodyJson);

    sb.append(actionJson.toJSONString()).append("\n");
    if(content != null) {

        String json = null;
        if(retainNullValue) {
            json = JSONObject.toJSONString(content, SerializerFeature.WriteMapNullValue);
        }else {
            json = JSONObject.toJSONString(content);
        }

        if(BatchActionEnum.UPDATE.equals(batchActionEnum)) {
            json = "{ \"doc\" : " + json + " }";
        }

        sb.append(json).append("\n");
    }
    return sb.toString();
}
 
Example 19
@Override
protected ResponseEntity<String> doBusinessProcess(IPageData pd, JSONObject paramIn) {
    ComponentValidateResult result = super.validateStoreStaffCommunityRelationship(pd, restTemplate);

    Map paramMap = BeanConvertUtil.beanCovertMap(result);
    paramIn.putAll(paramMap);

    String apiUrl = ServiceConstant.SERVICE_API_URL + "/api/feeConfig.listFeeConfigs" + mapToUrlParam(paramIn);


    ResponseEntity<String> responseEntity = this.callCenterService(restTemplate, pd, "",
            apiUrl,
            HttpMethod.GET);

    return responseEntity;
}
 
Example 20
@Override
public ResponseEntity<String> saveCar(IPageData pd) {

    validateSaveCar(pd);

    //校验员工是否有权限操作
    super.checkUserHasPrivilege(pd, restTemplate, PrivilegeCodeConstant.PRIVILEGE_CAR);

    JSONObject paramIn = JSONObject.parseObject(pd.getReqData());

    JSONArray infos = paramIn.getJSONArray("data");
    String communityId = paramIn.getString("communityId");
    ResponseEntity responseEntity = super.getStoreInfo(pd, restTemplate);
    if (responseEntity.getStatusCode() != HttpStatus.OK) {
        return responseEntity;
    }
    Assert.jsonObjectHaveKey(responseEntity.getBody().toString(), "storeId", "根据用户ID查询商户ID失败,未包含storeId节点");
    Assert.jsonObjectHaveKey(responseEntity.getBody().toString(), "storeTypeCd", "根据用户ID查询商户类型失败,未包含storeTypeCd节点");

    String storeId = JSONObject.parseObject(responseEntity.getBody().toString()).getString("storeId");
    String storeTypeCd = JSONObject.parseObject(responseEntity.getBody().toString()).getString("storeTypeCd");
    //数据校验是否 商户是否入驻该小区
    super.checkStoreEnterCommunity(pd, storeId, storeTypeCd, communityId, restTemplate);

    JSONObject viewSelectParkingSpace = this.getObj(infos, "viewSelectParkingSpace");
    JSONObject viewOwnerInfo = this.getObj(infos, "viewOwnerInfo");
    JSONObject addCar = this.getObj(infos, "addCar");
    JSONObject parkingSpaceFee = null;
    if(hasThisFlowComponent(infos, "hireParkingSpaceFee")) {
        parkingSpaceFee = this.getObj(infos, "hireParkingSpaceFee");
    }else{
        parkingSpaceFee = this.getObj(infos, "sellParkingSpaceFee");
    }
    JSONObject newParamIn = new JSONObject();
    newParamIn.putAll(addCar);
    newParamIn.putAll(parkingSpaceFee);
    newParamIn.put("communityId", communityId);
    newParamIn.put("ownerId", viewOwnerInfo.getString("ownerId"));
    newParamIn.put("psId", viewSelectParkingSpace.getString("psId"));
    newParamIn.put("userId", pd.getUserId());
    newParamIn.put("storeId", storeId);
    responseEntity = this.callCenterService(restTemplate, pd, newParamIn.toJSONString(),
            ServiceConstant.SERVICE_API_URL + "/api/parkingSpace.sellParkingSpace",
            HttpMethod.POST);

    return responseEntity;
}