| | |
| | | import com.java110.core.context.DataFlowContext; |
| | | import com.java110.core.factory.DataFlowFactory; |
| | | import com.java110.entity.center.AppService; |
| | | import com.java110.entity.order.Orders; |
| | | import com.java110.event.service.api.ServiceDataFlowEvent; |
| | | import com.java110.core.event.service.api.ServiceDataFlowEvent; |
| | | import com.java110.utils.constant.CommonConstant; |
| | | import com.java110.utils.constant.ServiceCodeConstant; |
| | | import com.java110.utils.util.BeanConvertUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.http.*; |
| | | import org.springframework.web.client.HttpStatusCodeException; |
| | |
| | | * @return |
| | | */ |
| | | public ResponseEntity<String> callService(DataFlowContext context, String serviceCode,JSONArray businesses) { |
| | | context.getRequestCurrentHeaders().put(CommonConstant.HTTP_ORDER_TYPE_CD, "D"); |
| | | JSONObject paramInObj = restToCenterProtocol(businesses, context.getRequestCurrentHeaders()); |
| | | return callService(context,serviceCode,paramInObj); |
| | | } |
| | |
| | | |
| | | //将 rest header 信息传递到下层服务中去 |
| | | HttpHeaders header = new HttpHeaders(); |
| | | |
| | | freshHttpHeader(header, context.getRequestCurrentHeaders()); |
| | | |
| | | ResponseEntity responseEntity = null; |
| | |
| | | if(CommonConstant.ORDER_PROCESS.equals(key)){ |
| | | orders.put("orderProcess", headers.get(CommonConstant.ORDER_PROCESS)); |
| | | } |
| | | |
| | | if(CommonConstant.O_ID.equals(key)){ |
| | | orders.put("oId", headers.get(CommonConstant.O_ID)); |
| | | } |
| | | } |
| | | |
| | | } |
| | |
| | | } |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 新增数据方法 |
| | | * |
| | | * @param context 上下文对象 |
| | | * @param param po对象 |
| | | */ |
| | | public void insert(DataFlowContext context, Object param, String businessType) { |
| | | JSONObject business = JSONObject.parseObject("{\"datas\":{}}"); |
| | | business.put(CommonConstant.HTTP_BUSINESS_TYPE_CD, businessType); |
| | | business.put(CommonConstant.HTTP_SEQ, DEFAULT_SEQ); |
| | | business.put(CommonConstant.HTTP_INVOKE_MODEL, CommonConstant.HTTP_INVOKE_MODEL_S); |
| | | JSONObject businessObj = new JSONObject(); |
| | | businessObj = JSONObject.parseObject(JSONObject.toJSONString(BeanConvertUtil.beanCovertMap(param))); |
| | | JSONArray businessArr = new JSONArray(); |
| | | businessArr.add(businessObj); |
| | | business.getJSONObject(CommonConstant.HTTP_BUSINESS_DATAS).put(param.getClass().getSimpleName(), businessArr); |
| | | context.addServiceBusiness(business); |
| | | } |
| | | |
| | | /** |
| | | * 新增数据方法 |
| | | * |
| | | * @param context 上下文对象 |
| | | * @param param po对象 |
| | | */ |
| | | public void update(DataFlowContext context, Object param, String businessType) { |
| | | JSONObject business = JSONObject.parseObject("{\"datas\":{}}"); |
| | | business.put(CommonConstant.HTTP_BUSINESS_TYPE_CD, businessType); |
| | | business.put(CommonConstant.HTTP_SEQ, DEFAULT_SEQ); |
| | | business.put(CommonConstant.HTTP_INVOKE_MODEL, CommonConstant.HTTP_INVOKE_MODEL_S); |
| | | JSONObject businessObj = new JSONObject(); |
| | | businessObj = JSONObject.parseObject(JSONObject.toJSONString(BeanConvertUtil.beanCovertMap(param))); |
| | | JSONArray businessArr = new JSONArray(); |
| | | businessArr.add(businessObj); |
| | | business.getJSONObject(CommonConstant.HTTP_BUSINESS_DATAS).put(param.getClass().getSimpleName(), businessArr); |
| | | context.addServiceBusiness(business); |
| | | } |
| | | |
| | | /** |
| | | * 新增数据方法 |
| | | * |
| | | * @param context 上下文对象 |
| | | * @param param po对象 |
| | | */ |
| | | public void delete(DataFlowContext context, Object param, String businessType) { |
| | | JSONObject business = JSONObject.parseObject("{\"datas\":{}}"); |
| | | business.put(CommonConstant.HTTP_BUSINESS_TYPE_CD, businessType); |
| | | business.put(CommonConstant.HTTP_SEQ, DEFAULT_SEQ); |
| | | business.put(CommonConstant.HTTP_INVOKE_MODEL, CommonConstant.HTTP_INVOKE_MODEL_S); |
| | | JSONObject businessObj = new JSONObject(); |
| | | businessObj = JSONObject.parseObject(JSONObject.toJSONString(BeanConvertUtil.beanCovertMap(param))); |
| | | JSONArray businessArr = new JSONArray(); |
| | | businessArr.add(businessObj); |
| | | business.getJSONObject(CommonConstant.HTTP_BUSINESS_DATAS).put(param.getClass().getSimpleName(), businessArr); |
| | | context.addServiceBusiness(business); |
| | | } |
| | | } |