|
@@ -3,18 +3,30 @@ package com.java110.api.listener.users;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.java110.api.listener.AbstractServiceApiDataFlowListener;
|
|
import com.java110.api.listener.AbstractServiceApiDataFlowListener;
|
|
|
|
|
+import com.java110.api.listener.AbstractServiceApiListener;
|
|
|
|
|
+import com.java110.core.smo.user.IUserInnerServiceSMO;
|
|
|
|
|
+import com.java110.dto.UserDto;
|
|
|
|
|
+import com.java110.dto.org.OrgDto;
|
|
|
import com.java110.utils.constant.CommonConstant;
|
|
import com.java110.utils.constant.CommonConstant;
|
|
|
import com.java110.utils.constant.ServiceCodeConstant;
|
|
import com.java110.utils.constant.ServiceCodeConstant;
|
|
|
import com.java110.utils.exception.ListenerExecuteException;
|
|
import com.java110.utils.exception.ListenerExecuteException;
|
|
|
import com.java110.utils.util.Assert;
|
|
import com.java110.utils.util.Assert;
|
|
|
|
|
+import com.java110.utils.util.BeanConvertUtil;
|
|
|
import com.java110.utils.util.StringUtil;
|
|
import com.java110.utils.util.StringUtil;
|
|
|
import com.java110.core.annotation.Java110Listener;
|
|
import com.java110.core.annotation.Java110Listener;
|
|
|
import com.java110.core.context.DataFlowContext;
|
|
import com.java110.core.context.DataFlowContext;
|
|
|
import com.java110.core.factory.DataFlowFactory;
|
|
import com.java110.core.factory.DataFlowFactory;
|
|
|
import com.java110.entity.center.AppService;
|
|
import com.java110.entity.center.AppService;
|
|
|
import com.java110.event.service.api.ServiceDataFlowEvent;
|
|
import com.java110.event.service.api.ServiceDataFlowEvent;
|
|
|
|
|
+import com.java110.vo.api.org.ApiOrgDataVo;
|
|
|
|
|
+import com.java110.vo.api.org.ApiOrgVo;
|
|
|
|
|
+import com.java110.vo.api.staff.ApiStaffDataVo;
|
|
|
|
|
+import com.java110.vo.api.staff.ApiStaffVo;
|
|
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.http.*;
|
|
import org.springframework.http.*;
|
|
|
|
|
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
|
|
+import java.util.List;
|
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -22,12 +34,18 @@ import java.util.Map;
|
|
|
* Created by Administrator on 2019/4/2.
|
|
* Created by Administrator on 2019/4/2.
|
|
|
*/
|
|
*/
|
|
|
@Java110Listener("queryStaffServiceListener")
|
|
@Java110Listener("queryStaffServiceListener")
|
|
|
-public class QueryStaffServiceListener extends AbstractServiceApiDataFlowListener {
|
|
|
|
|
|
|
+public class QueryStaffServiceListener extends AbstractServiceApiListener {
|
|
|
|
|
+
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private IUserInnerServiceSMO userInnerServiceSMOImpl;
|
|
|
|
|
+
|
|
|
@Override
|
|
@Override
|
|
|
public int getOrder() {
|
|
public int getOrder() {
|
|
|
return 0;
|
|
return 0;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
@Override
|
|
@Override
|
|
|
public String getServiceCode() {
|
|
public String getServiceCode() {
|
|
|
return ServiceCodeConstant.SERVICE_CODE_QUERY_STAFF_INFOS;
|
|
return ServiceCodeConstant.SERVICE_CODE_QUERY_STAFF_INFOS;
|
|
@@ -42,13 +60,13 @@ public class QueryStaffServiceListener extends AbstractServiceApiDataFlowListene
|
|
|
*
|
|
*
|
|
|
* @param event
|
|
* @param event
|
|
|
*/
|
|
*/
|
|
|
- @Override
|
|
|
|
|
- public void soService(ServiceDataFlowEvent event) {
|
|
|
|
|
|
|
+
|
|
|
|
|
+ public void soService1(ServiceDataFlowEvent event) {
|
|
|
|
|
|
|
|
|
|
|
|
|
DataFlowContext dataFlowContext = event.getDataFlowContext();
|
|
DataFlowContext dataFlowContext = event.getDataFlowContext();
|
|
|
AppService service = event.getAppService();
|
|
AppService service = event.getAppService();
|
|
|
- Map<String,String> headers = dataFlowContext.getRequestHeaders();
|
|
|
|
|
|
|
+ /*Map<String,String> headers = dataFlowContext.getRequestHeaders();
|
|
|
|
|
|
|
|
Assert.hasKeyAndValue(headers,"page","请求报文中未包含page节点");
|
|
Assert.hasKeyAndValue(headers,"page","请求报文中未包含page节点");
|
|
|
Assert.hasKeyAndValue(headers,"rows","请求报文中未包含rows节点");
|
|
Assert.hasKeyAndValue(headers,"rows","请求报文中未包含rows节点");
|
|
@@ -92,9 +110,43 @@ public class QueryStaffServiceListener extends AbstractServiceApiDataFlowListene
|
|
|
JSONObject tmpObj = rows.getJSONObject(rowIndex);
|
|
JSONObject tmpObj = rows.getJSONObject(rowIndex);
|
|
|
queryUserInfoByUserId(dataFlowContext,tmpObj,appService);
|
|
queryUserInfoByUserId(dataFlowContext,tmpObj,appService);
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
dataFlowContext.setResponseEntity(new ResponseEntity(staffs.toJSONString(),HttpStatus.OK));
|
|
dataFlowContext.setResponseEntity(new ResponseEntity(staffs.toJSONString(),HttpStatus.OK));
|
|
|
|
|
|
|
|
|
|
+*/
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ protected void validate(ServiceDataFlowEvent event, JSONObject reqJson) {
|
|
|
|
|
+ Assert.hasKeyAndValue(reqJson,"page","请求报文中未包含page节点");
|
|
|
|
|
+ Assert.hasKeyAndValue(reqJson,"rows","请求报文中未包含rows节点");
|
|
|
|
|
+ Assert.hasKeyAndValue(reqJson,"storeId","请求报文中未包含storeId节点");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ protected void doSoService(ServiceDataFlowEvent event, DataFlowContext context, JSONObject reqJson) {
|
|
|
|
|
+
|
|
|
|
|
+ UserDto userDto = BeanConvertUtil.covertBean(reqJson, UserDto.class);
|
|
|
|
|
+
|
|
|
|
|
+ int count = userInnerServiceSMOImpl.getStaffCount(userDto);
|
|
|
|
|
+
|
|
|
|
|
+ List<ApiStaffDataVo> staffs = null;
|
|
|
|
|
+
|
|
|
|
|
+ if (count > 0) {
|
|
|
|
|
+ staffs = BeanConvertUtil.covertBeanList(userInnerServiceSMOImpl.getStaffs(userDto), ApiStaffDataVo.class);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ staffs = new ArrayList<>();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ ApiStaffVo apiStaffVo = new ApiStaffVo();
|
|
|
|
|
+
|
|
|
|
|
+ apiStaffVo.setTotal(count);
|
|
|
|
|
+ apiStaffVo.setRecords((int) Math.ceil((double) count / (double) reqJson.getInteger("row")));
|
|
|
|
|
+ apiStaffVo.setStaffs(staffs);
|
|
|
|
|
+
|
|
|
|
|
+ ResponseEntity<String> responseEntity = new ResponseEntity<String>(JSONObject.toJSONString(apiStaffVo), HttpStatus.OK);
|
|
|
|
|
+
|
|
|
|
|
+ context.setResponseEntity(responseEntity);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -127,4 +179,13 @@ public class QueryStaffServiceListener extends AbstractServiceApiDataFlowListene
|
|
|
}
|
|
}
|
|
|
tmpObj.putAll(JSONObject.parseObject(responseEntity.getBody().toString()));
|
|
tmpObj.putAll(JSONObject.parseObject(responseEntity.getBody().toString()));
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ public IUserInnerServiceSMO getUserInnerServiceSMOImpl() {
|
|
|
|
|
+ return userInnerServiceSMOImpl;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public void setUserInnerServiceSMOImpl(IUserInnerServiceSMO userInnerServiceSMOImpl) {
|
|
|
|
|
+ this.userInnerServiceSMOImpl = userInnerServiceSMOImpl;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|