wuxw
2021-04-23 e9be8d15ab3ee20685793e16071c56485b32e33a
service-order/src/main/java/com/java110/order/smo/impl/CenterServiceCacheSMOImpl.java
old mode 100644 new mode 100755
@@ -4,6 +4,7 @@
import com.java110.core.factory.DataTransactionFactory;
import com.java110.db.dao.IQueryServiceDAO;
import com.java110.dto.basePrivilege.BasePrivilegeDto;
import com.java110.dto.businessDatabus.BusinessDatabusDto;
import com.java110.entity.center.AppRoute;
import com.java110.entity.mapping.Mapping;
import com.java110.entity.order.ServiceBusiness;
@@ -60,6 +61,9 @@
        //5.0 刷新基础权限
        flushPrivilege(dataQuery);
        //刷新databus
        doFlushDatabus(dataQuery);
        dataQuery.setResponseInfo(DataTransactionFactory.createBusinessResponseJson(ResponseConstant.RESULT_CODE_SUCCESS, "刷新成功"));
    }
@@ -82,6 +86,8 @@
        //5.0 刷新基础权限
        flushPrivilege(headers);
        flushDatabus(headers);
    }
    /**
@@ -97,11 +103,14 @@
        //3.0 分装 ServiceSql
        doFlushServiceSql();
        //5.0 刷新全新
        doFlushServiceBusiness();
        //5.0 刷新全新
        doFlushPrivilege();
        //刷新databus
        doFlushDatabus();
    }
@@ -227,6 +236,20 @@
    /**
     * 刷新 Mapping 数据
     */
    private void doFlushDatabus(DataQuery dataQuery) {
        JSONObject params = dataQuery.getRequestParams();
        if (!CommonConstant.CACHE_DATABUS.equals(params.getString(CommonConstant.CACHE_PARAM_NAME))) {
            return;
        }
        doFlushDatabus();
    }
    /**
     * 刷新 Mapping 数据
     */
    private void flushPrivilege(Map<String, String> headers) {
        Assert.hasKey(headers, CommonConstant.CACHE_PARAM, "未包含cache参数" + headers.toString());
@@ -237,6 +260,21 @@
        }
        doFlushPrivilege();
    }
    /**
     * 刷新 databus 数据
     */
    private void flushDatabus(Map<String, String> headers) {
        Assert.hasKey(headers, CommonConstant.CACHE_PARAM, "未包含cache参数" + headers.toString());
        if (!CommonConstant.CACHE_DATABUS.equals(headers.get(CommonConstant.CACHE_PARAM))
                && !CommonConstant.CACHE_ALL.equals(headers.get(CommonConstant.CACHE_PARAM))) {
            return;
        }
        doFlushDatabus();
    }
    /**
@@ -289,6 +327,14 @@
        PrivilegeCache.setValue(basePrivilegeDtos);
    }
    private void doFlushDatabus() {
        logger.debug("开始刷新 Mapping数据到redis数据库中");
        List<BusinessDatabusDto> businessDatabusDtos = centerServiceDAOImpl.getDatabusAll();
        //删除原始数据
        DatabusCache.removeData(DatabusCache.DEFAULT_DATABUS);
        DatabusCache.setValue(businessDatabusDtos);
    }
    /**
     * 刷新AppRoute数据
     */