| | |
| | | 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; |
| | |
| | | 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; |
| | |
| | | |
| | | |
| | | /** |
| | | * 服务调度 |
| | | * cmd 服务调度 |
| | | * |
| | | * @param reqJson 请求报文json |
| | | * @param headers |
| | |
| | | * @throws SMOException |
| | | */ |
| | | @Override |
| | | @Java110TraceLog |
| | | public ResponseEntity<String> cmd(String reqJson, Map<String, String> headers) throws Exception { |
| | | |
| | | ICmdDataFlowContext cmdDataFlowContext = null; |
| | |
| | | |
| | | 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(); |
| | |
| | | |
| | | |
| | | /** |
| | | * 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); |
| | | } |
| | | |
| | |
| | | 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); |
| | |
| | | */ |
| | | 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(); |