| | |
| | | |
| | | /** |
| | | * 业务统一处理服务方法 |
| | | * |
| | | * @param reqJson 请求报文json |
| | | * @return |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 刷返回值 |
| | | * |
| | | * @param dataFlow |
| | | */ |
| | | private void refreshOrderDataFlowResJson(IOrderDataFlowContext dataFlow){ |
| | |
| | | |
| | | /** |
| | | * 抒写返回头信息 |
| | | * |
| | | * @param dataFlow |
| | | */ |
| | | private void putResponseHeader(DataFlow dataFlow,Map<String,String> headers) { |
| | |
| | | |
| | | /** |
| | | * 解密 |
| | | * |
| | | * @param reqJson |
| | | * @return |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 加密 |
| | | * |
| | | * @param resJson |
| | | * @param headers |
| | | * @return |
| | |
| | | } |
| | | return resJson; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | |
| | | //OrderDataFlowContextFactory.addCostTime(dataFlow, "updateOrderAndBusinessError", "订单状态改为失败耗时", startDate); |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 将订单状态改为作废状态。 |
| | | * |
| | |
| | | //doAddDeleteOrderBusinessData(dataFlow); |
| | | |
| | | |
| | | |
| | | OrderDataFlowContextFactory.addCostTime(dataFlow, "updateOrderAndBusinessError", "订单状态改为失败耗时", startDate); |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 加入撤单记录 |
| | | * |
| | | * @param dataFlow |
| | | */ |
| | | private void doAddDeleteOrderBusinessData(IOrderDataFlowContext dataFlow){ |
| | |
| | | |
| | | /** |
| | | * 加入撤单记录 |
| | | * |
| | | * @param dataFlow |
| | | */ |
| | | private void doAddDeleteOrderBusinessData(IOrderNotifyDataFlowContext dataFlow){ |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 接受业务系统通知消息 |
| | | * |
| | | * @param receiveJson 接受报文 |
| | | * @throws SMOException |
| | | */ |
| | |
| | | |
| | | /** |
| | | * Instance过程 |
| | | * |
| | | * @param dataFlow |
| | | */ |
| | | private void doSendInstance(IOrderNotifyDataFlowContext dataFlow) { |
| | |
| | | |
| | | /** |
| | | * 判断是否是 business 或者 instance过程 |
| | | * |
| | | * @param dataFlow |
| | | * @throws NoSupportException |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 判断是否都成功了 |
| | | * |
| | | * @param dataFlow |
| | | */ |
| | | private void judgeBusinessStatusAndCompleteBusiness(IOrderNotifyDataFlowContext dataFlow) throws BusinessStatusException{ |
| | |
| | | |
| | | /** |
| | | * //4.0当所有业务动作是否都是C,将订单信息改为 C 并且发布竣工消息,这里在广播之前确认 |
| | | * |
| | | * @param dataFlow |
| | | */ |
| | | private void judgeSendToInstance(IOrderNotifyDataFlowContext dataFlow) throws Exception{ |
| | |
| | | |
| | | /** |
| | | * 通知 订单已经完成,后端需要完成数据 |
| | | * |
| | | * @param dataFlow |
| | | */ |
| | | private void notifyBusinessSystemSuccessMessage(IOrderNotifyDataFlowContext dataFlow) throws Exception{ |
| | |
| | | |
| | | /** |
| | | * 处理同步业务 |
| | | * |
| | | * @param dataFlow |
| | | */ |
| | | private void doSynchronousBusinesses(IOrderDataFlowContext dataFlow) throws BusinessException{ |
| | |
| | | |
| | | /** |
| | | * 发起撤单业务 |
| | | * |
| | | * @param dataFlow |
| | | * @param deleteBusinesses |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 将BusinessTable 中的数据保存到 InstanceTable |
| | | * |
| | | * @param dataFlow |
| | | * @param synchronousBusinesses |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 业务系统撤单 |
| | | * |
| | | * @param dataFlow |
| | | * @param deleteBusinesses |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 调用下游系统 |
| | | * |
| | | * @param dataFlow |
| | | * @param serviceBusiness |
| | | * @param requestBusinessJson 请求报文 |
| | |
| | | String responseMessage; |
| | | |
| | | Assert.hasLength(serviceBusiness.getInvokeType(),"c_service_business表配置出错,invoke_type 不能为空"+ serviceBusiness.getBusinessTypeCd()); |
| | | String httpUrl = ""; |
| | | if(ServiceBusinessConstant.INVOKE_TYPE_WEBSERVICE.equals(serviceBusiness.getInvokeType())) {//webservice方式 |
| | | String url = serviceBusiness.getUrl(); |
| | | String[] urls = url.split("#"); |
| | |
| | | if(urls.length != 2){ |
| | | throw new ConfigDataException(ResponseConstant.RESULT_CODE_CONFIG_ERROR,"配置错误:c_service_business配置url字段错误"+serviceBusiness.getBusinessTypeCd()); |
| | | } |
| | | String webserviceUrl = MappingCache.getValue(urls[0]); |
| | | httpUrl = MappingCache.getValue(urls[0]); |
| | | String method = MappingCache.getValue(urls[1]); |
| | | responseMessage = (String) WebServiceAxisClient.callWebService(webserviceUrl,method, |
| | | responseMessage = (String) WebServiceAxisClient.callWebService(httpUrl, method, |
| | | new Object[]{requestBusinessJson.toJSONString()}, |
| | | serviceBusiness.getTimeout()); |
| | | }else if(ServiceBusinessConstant.INVOKE_TYPE_HTTP_POST.equals(serviceBusiness.getInvokeType())){ |
| | | //http://user-service/test/sayHello |
| | | String httpPostUrl = MappingCache.getValue(serviceBusiness.getUrl()); |
| | | responseMessage = restTemplate.postForObject(httpPostUrl,requestBusinessJson.toJSONString(),String.class); |
| | | httpUrl = MappingCache.getValue(serviceBusiness.getUrl()); |
| | | responseMessage = restTemplate.postForObject(httpUrl, requestBusinessJson.toJSONString(), String.class); |
| | | }else if(ServiceBusinessConstant.INVOKE_TYPE_OUT_HTTP_POST.equals(serviceBusiness.getInvokeType())){ |
| | | String httpPostUrl = MappingCache.getValue(serviceBusiness.getUrl()); |
| | | responseMessage = restTemplateNoLoadBalanced.postForObject(httpPostUrl,requestBusinessJson.toJSONString(),String.class); |
| | | } |
| | | else {//post方式 |
| | | httpUrl = MappingCache.getValue(serviceBusiness.getUrl()); |
| | | responseMessage = restTemplateNoLoadBalanced.postForObject(httpUrl, requestBusinessJson.toJSONString(), String.class); |
| | | } else {//post方式 |
| | | throw new ConfigDataException(ResponseConstant.RESULT_CODE_CONFIG_ERROR,"配置错误:c_service_business配置url字段错误,当前无法识别"+serviceBusiness.getBusinessTypeCd()); |
| | | } |
| | | |
| | | |
| | | logger.debug("订单服务调用下游服务请求报文:{},返回报文:{}",requestBusinessJson,responseMessage); |
| | | logger.debug("调用地址:{}, 订单服务调用下游服务请求报文:{},返回报文:{}", httpUrl, requestBusinessJson, responseMessage); |
| | | |
| | | if(StringUtil.isNullOrNone(responseMessage) || !Assert.isJsonObject(responseMessage)){ |
| | | throw new BusinessException(ResponseConstant.RESULT_CODE_INNER_ERROR,"下游系统返回格式不正确,请按协议规范处理"); |
| | |
| | | |
| | | /** |
| | | * 数据保存到BusinessTable 中 |
| | | * |
| | | * @param dataFlow |
| | | * @param synchronousBusinesses |
| | | * @param responseBusinesses |
| | |
| | | |
| | | /** |
| | | * 处理异步业务 |
| | | * |
| | | * @param |
| | | */ |
| | | private void doAsynchronousBusinesses(IOrderDataFlowContext dataFlow) throws BusinessException{ |
| | |
| | | |
| | | /** |
| | | * 保存日志信息 |
| | | * @param dataFlow 数据流对象 封装用户请求的信息 |
| | | * |
| | | * @param dataFlow 数据流对象 封装用户请求的信息 |
| | | * @param requestJson 请求报文 格式为 |
| | | * {"headers":"", |
| | | * "body":"" |
| | |
| | | |
| | | /** |
| | | * 保存日志信息 |
| | | * |
| | | * @param requestJson |
| | | */ |
| | | private void saveLogMessage(String requestJson,String responseJson){ |
| | |
| | | |
| | | /** |
| | | * 保存耗时信息 |
| | | * |
| | | * @param dataFlow |
| | | */ |
| | | private void saveCostTimeLogMessage(DataFlow dataFlow){ |
| | |
| | | |
| | | /** |
| | | * 修改c_business状态 |
| | | * |
| | | * @param bId |
| | | * @param statusCd |
| | | */ |