java110
2023-06-07 e050a2ab2fa176ebd0d2461681a41df34838c028
java110-service/src/main/java/com/java110/service/smo/impl/CmdServiceSMOImpl.java
@@ -9,6 +9,7 @@
import com.java110.core.event.cmd.ServiceCmdEventPublishing;
import com.java110.core.factory.DataFlowFactory;
import com.java110.core.smo.ISaveTransactionLogSMO;
import com.java110.core.trace.Java110TraceLog;
import com.java110.entity.center.DataFlowLinksCost;
import com.java110.service.smo.ICmdServiceSMO;
import com.java110.utils.cache.MappingCache;
@@ -21,7 +22,8 @@
import com.java110.utils.util.DateUtil;
import com.java110.vo.ResultVo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.java110.core.log.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;
@@ -51,7 +53,7 @@
    /**
     * 服务调度
     * cmd 服务调度
     *
     * @param reqJson 请求报文json
     * @param headers
@@ -59,6 +61,7 @@
     * @throws SMOException
     */
    @Override
    @Java110TraceLog
    public ResponseEntity<String> cmd(String reqJson, Map<String, String> headers) throws Exception {
        ICmdDataFlowContext cmdDataFlowContext = null;
@@ -67,11 +70,11 @@
        ResponseEntity<String> responseEntity = null;
        //1.0 创建数据流 appId serviceCode
        //todo 1.0 创建数据流 appId serviceCode
        cmdDataFlowContext = DataFlowFactory.newInstance(CmdDataFlow.class).builder(reqJson, headers);
        //6.0 调用下游系统
        //todo 2.0 调用下游系统
        invokeBusinessSystem(cmdDataFlowContext);
        responseEntity = cmdDataFlowContext.getResponseEntity();
@@ -86,12 +89,13 @@
    /**
     * 6.0 调用下游系统
     * 2.0 调用下游系统
     *
     * @param cmdDataFlowContext
     * @throws BusinessException
     */
    private void invokeBusinessSystem(ICmdDataFlowContext cmdDataFlowContext) throws BusinessException {
    private void invokeBusinessSystem(ICmdDataFlowContext cmdDataFlowContext) throws Exception {
        //todo 发布 cmd 事件
        ServiceCmdEventPublishing.multicastEvent(cmdDataFlowContext);
    }
@@ -104,7 +108,7 @@
    private void saveLogMessage(String requestJson, String responseJson) {
        try {
            if (MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_LOG_ON_OFF))) {
            if (MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.DOMAIN_SYSTEM_SWITCH,MappingConstant.KEY_LOG_ON_OFF))) {
                JSONObject log = new JSONObject();
                log.put("request", requestJson);
                log.put("response", responseJson);
@@ -122,7 +126,7 @@
     */
    private void saveCostTimeLogMessage(DataFlow cmdDataFlowContext) {
        try {
            if (MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_COST_TIME_ON_OFF))) {
            if (MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.DOMAIN_SYSTEM_SWITCH,MappingConstant.KEY_COST_TIME_ON_OFF))) {
                List<DataFlowLinksCost> cmdDataFlowContextLinksCosts = cmdDataFlowContext.getLinksCostDates();
                JSONObject costDate = new JSONObject();
                JSONArray costDates = new JSONArray();