浏览代码

修改 用户注册 用户停用 用户启用等功能

wuxw 7 年之前
父节点
当前提交
3138c292bc

+ 5 - 3
Api/src/main/java/com/java110/api/listener/UserRegisterServiceListener.java

@@ -74,15 +74,17 @@ public class UserRegisterServiceListener extends AbstractServiceApiDataFlowListe
         String paramIn = dataFlowContext.getReqData();
         Assert.isJsonObject(paramIn,"用户注册请求参数有误,不是有效的json格式 "+paramIn);
         JSONObject business = JSONObject.parseObject("{\"datas\":{}}");
-        business.put(CommonConstant.HTTP_BUSINESS_SERVICE_CODE,ServiceCodeConstant.SERVICE_CODE_SAVE_USER_INFO);
-        business.put(CommonConstant.HTTP_BUSINESS_SERVICE_NAME,"用户注册");
+        business.put(CommonConstant.HTTP_BUSINESS_TYPE_CD, BusinessTypeConstant.BUSINESS_TYPE_SAVE_USER_INFO);
+        business.put(CommonConstant.HTTP_SEQ,1);
+        business.put(CommonConstant.HTTP_INVOKE_MODEL,CommonConstant.HTTP_INVOKE_MODEL_S);
 
         business.getJSONObject(CommonConstant.HTTP_BUSINESS_DATAS).put("businessUser",refreshParamIn(paramIn));
         HttpHeaders header = new HttpHeaders();
         dataFlowContext.getRequestCurrentHeaders().put(CommonConstant.HTTP_USER_ID,"-1");
         dataFlowContext.getRequestCurrentHeaders().put(CommonConstant.HTTP_ORDER_TYPE_CD,"D");
         String paramInObj = super.restToCenterProtocol(business,dataFlowContext.getRequestCurrentHeaders()).toJSONString();
-
+        //将 rest header 信息传递到下层服务中去
+        super.freshHttpHeader(header,dataFlowContext.getRequestCurrentHeaders());
         HttpEntity<String> httpEntity = new HttpEntity<String>(paramInObj, header);
         //http://user-service/test/sayHello
         super.doRequest(dataFlowContext, service, httpEntity);

+ 7 - 2
Api/src/main/java/com/java110/api/listener/users/DisableStaffServiceListener.java

@@ -2,6 +2,7 @@ package com.java110.api.listener.users;
 
 import com.alibaba.fastjson.JSONObject;
 import com.java110.api.listener.AbstractServiceApiDataFlowListener;
+import com.java110.common.constant.BusinessTypeConstant;
 import com.java110.common.constant.CommonConstant;
 import com.java110.common.constant.ServiceCodeConstant;
 import com.java110.common.util.Assert;
@@ -55,14 +56,18 @@ public class DisableStaffServiceListener  extends AbstractServiceApiDataFlowList
         Assert.jsonObjectHaveKey(paramIn,"userId","当前请求报文中未包含userId节点");
 
         JSONObject business = JSONObject.parseObject("{\"datas\":{}}");
-        business.put(CommonConstant.HTTP_BUSINESS_SERVICE_CODE,ServiceCodeConstant.SERVICE_CODE_REMOVE_USER_INFO);
-        business.put(CommonConstant.HTTP_BUSINESS_SERVICE_NAME,"停用用户");
+        business.put(CommonConstant.HTTP_BUSINESS_TYPE_CD, BusinessTypeConstant.BUSINESS_TYPE_REMOVE_USER_INFO);
+        business.put(CommonConstant.HTTP_SEQ,1);
+        business.put(CommonConstant.HTTP_INVOKE_MODEL,CommonConstant.HTTP_INVOKE_MODEL_S);
 
         business.getJSONObject(CommonConstant.HTTP_BUSINESS_DATAS).put("businessUser",refreshParamIn(paramIn));
         HttpHeaders header = new HttpHeaders();
         dataFlowContext.getRequestCurrentHeaders().put(CommonConstant.HTTP_ORDER_TYPE_CD,"D");
         String paramInObj = super.restToCenterProtocol(business,dataFlowContext.getRequestCurrentHeaders()).toJSONString();
 
+        //将 rest header 信息传递到下层服务中去
+        super.freshHttpHeader(header,dataFlowContext.getRequestCurrentHeaders());
+
         HttpEntity<String> httpEntity = new HttpEntity<String>(paramInObj, header);
         //http://user-service/test/sayHello
         super.doRequest(dataFlowContext, service, httpEntity);

+ 7 - 2
Api/src/main/java/com/java110/api/listener/users/EnableStaffServiceListener.java

@@ -2,6 +2,7 @@ package com.java110.api.listener.users;
 
 import com.alibaba.fastjson.JSONObject;
 import com.java110.api.listener.AbstractServiceApiDataFlowListener;
+import com.java110.common.constant.BusinessTypeConstant;
 import com.java110.common.constant.CommonConstant;
 import com.java110.common.constant.ServiceCodeConstant;
 import com.java110.common.util.Assert;
@@ -55,14 +56,18 @@ public class EnableStaffServiceListener extends AbstractServiceApiDataFlowListen
         Assert.jsonObjectHaveKey(paramIn,"userId","当前请求报文中未包含userId节点");
 
         JSONObject business = JSONObject.parseObject("{\"datas\":{}}");
-        business.put(CommonConstant.HTTP_BUSINESS_SERVICE_CODE,ServiceCodeConstant.SERVICE_CODE_RECOVER_USER_INFO);
-        business.put(CommonConstant.HTTP_BUSINESS_SERVICE_NAME,"停用用户");
+        business.put(CommonConstant.HTTP_BUSINESS_TYPE_CD, BusinessTypeConstant.BUSINESS_TYPE_RECOVER_USER_INFO);
+        business.put(CommonConstant.HTTP_SEQ,1);
+        business.put(CommonConstant.HTTP_INVOKE_MODEL,CommonConstant.HTTP_INVOKE_MODEL_S);
 
         business.getJSONObject(CommonConstant.HTTP_BUSINESS_DATAS).put("businessUser",refreshParamIn(paramIn));
         HttpHeaders header = new HttpHeaders();
         dataFlowContext.getRequestCurrentHeaders().put(CommonConstant.HTTP_ORDER_TYPE_CD,"D");
         String paramInObj = super.restToCenterProtocol(business,dataFlowContext.getRequestCurrentHeaders()).toJSONString();
 
+        //将 rest header 信息传递到下层服务中去
+        super.freshHttpHeader(header,dataFlowContext.getRequestCurrentHeaders());
+
         HttpEntity<String> httpEntity = new HttpEntity<String>(paramInObj, header);
         //http://user-service/test/sayHello
         super.doRequest(dataFlowContext, service, httpEntity);