private StringBuilder innAddOrUpdGroupFlowCtrlRule(HttpServletRequest req,
            StringBuilder sBuffer,
            ProcessResult result,
            boolean isAddOp) {
        // check and get operation info
        if (!WebParameterUtils.getAUDBaseInfo(req, isAddOp, null, sBuffer, result)) {
            WebParameterUtils.buildFailResult(sBuffer, result.getErrMsg());
            return sBuffer;
        }
        BaseEntity opEntity = (BaseEntity) result.getRetData();
        // get group list
        if (!WebParameterUtils.getStringParamValue(req,
                WebFieldDef.COMPSGROUPNAME, true, null, sBuffer, result)) {
            WebParameterUtils.buildFailResult(sBuffer, result.getErrMsg());
            return sBuffer;
        }
        final Set<String> groupNameSet = (Set<String>) result.getRetData();
        // get and valid qryPriorityId info
        if (!WebParameterUtils.getQryPriorityIdParameter(req,
                false, TBaseConstants.META_VALUE_UNDEFINED,
                TServerConstants.QRY_PRIORITY_MIN_VALUE, sBuffer, result)) {
            WebParameterUtils.buildFailResult(sBuffer, result.getErrMsg());
            return sBuffer;
        }
        int qryPriorityId = (int) result.getRetData();
        // get flowCtrlEnable's statusId info
        if (!WebParameterUtils.getFlowCtrlStatusParamValue(req,
                false, null, sBuffer, result)) {
            WebParameterUtils.buildFailResult(sBuffer, result.getErrMsg());
            return sBuffer;
        }
        EnableStatus flowCtrlEnable = (EnableStatus) result.getRetData();
        // get and flow control rule info
        int flowRuleCnt = WebParameterUtils.getAndCheckFlowRules(req,
                (isAddOp ? TServerConstants.BLANK_FLOWCTRL_RULES : null), sBuffer, result);
        if (!result.isSuccess()) {
            WebParameterUtils.buildFailResult(sBuffer, result.getErrMsg());
            return sBuffer;
        }
        String flowCtrlInfo = (String) result.getRetData();
        // add or modify records
        GroupResCtrlEntity ctrlEntity;
        List<GroupProcessResult> retInfoList = new ArrayList<>();
        for (String groupName : groupNameSet) {
            ctrlEntity = defMetaDataService.getGroupCtrlConf(groupName);
            if (ctrlEntity == null) {
                if (isAddOp) {
                    retInfoList.add(defMetaDataService.insertGroupCtrlConf(opEntity, groupName,
                            qryPriorityId, flowCtrlEnable, flowRuleCnt, flowCtrlInfo, sBuffer, result));
                } else {
                    result.setFailResult(DataOpErrCode.DERR_NOT_EXIST.getCode(),
                            DataOpErrCode.DERR_NOT_EXIST.getDescription());
                    retInfoList.add(new GroupProcessResult(groupName, "", result));
                }
            } else {
                retInfoList.add(defMetaDataService.insertGroupCtrlConf(opEntity, groupName,
                        qryPriorityId, flowCtrlEnable, flowRuleCnt, flowCtrlInfo, sBuffer, result));
            }
        }
        return buildRetInfo(retInfoList, sBuffer);
    }
add or modify flow control rule

@param req       Http Servlet Request
@param sBuffer   string buffer
@param result    process result
@return    process result
inlong-tubemq/tubemq-server/src/main/java/org/apache/inlong/tubemq/server/master/web/handler/WebAdminFlowRuleHandler.java