wuxw před 3 roky
rodič
revize
47a182ad93

+ 1 - 1
java110-bean/src/main/java/com/java110/dto/org/OrgTreeDto.java

@@ -29,7 +29,7 @@ public class OrgTreeDto implements Serializable {
     }
 
     private String id;
-    private String icon;
+    private String icon ="/img/org.png";
     private String text;
     private String parentId;
     private List<OrgTreeDto> children;

+ 21 - 38
java110-db/src/main/resources/mapper/user/UserServiceDaoImplMapper.xml

@@ -456,36 +456,25 @@
     <!-- 查询员工总量 -->
     <select id="getStaffCount" parameterType="Map" resultType="Map">
         select count(1) count
-        from
-        u_user a
-        ,u_org uo
-        ,u_org_staff_rel uosr
-        ,u_org puo
-        where a.level_cd = '01'
-        and a.user_id = uosr.staff_id
+        u_user u
+        left join u_org_staff_rel uosr on u.user_id = uosr.staff_id and uosr.status_cd = '0'
+        left join u_org uo on uosr.org_id = uo.org_id and uo.status_cd = '0'
+        where u.level_cd = '01'
         <if test="storeId !=null and storeId != ''">
             and uosr.store_id = #{storeId}
         </if>
-        and uosr.org_id = uo.org_id
-        and uo.parent_org_id = puo.org_id
-        <if test="parentOrgId !=null and parentOrgId != ''">
-            and uo.parent_org_id = #{parentOrgId}
-        </if>
-        <if test="departmentOrgId !=null and departmentOrgId != ''">
-            and uosr.org_id = #{departmentOrgId}
+        <if test="orgId !=null and orgId != ''">
+            and uosr.org_id = #{orgId}
         </if>
-        and a.status_cd = '0'
-        and uo.status_cd = '0'
-        and uosr.status_cd = '0'
-        and puo.status_cd = '0'
+        and u.status_cd = '0'
         <if test="tel !=null and tel != ''">
-            and a.tel= #{tel}
+            and u.tel= #{tel}
         </if>
         <if test="name !=null and name != ''">
-            and a.name like concat('%',#{name},'%')
+            and u.name like concat('%',#{name},'%')
         </if>
         <if test="staffName !=null and staffName != ''">
-            and a.name like concat('%',#{staffName},'%')
+            and u.name like concat('%',#{staffName},'%')
         </if>
         <if test="staffId != null and staffId !=''">
             and uosr.staff_id = #{staffId}
@@ -496,37 +485,31 @@
         <if test="bId != null and bId !=''">
             and u.b_id = #{bId}
         </if>
+        <if test="userIds != null and userIds != null">
+            and u.user_id in
+            <foreach collection="userIds" item="item" open="(" close=")" separator=",">
+                #{item}
+            </foreach>
+        </if>
     </select>
 
     <!-- 查询员工总量 -->
     <select id="getStaffs" parameterType="Map" resultType="Map">
         select uo.org_id orgId,uo.org_name,uo.org_name orgName,u.user_id, u.user_id userId,u.name,u.name
         userName,u.email,u.address,u.location_cd,u.location_cd locationCd,
-        u.age,u.sex,u.tel,u.level_cd levelCd,u.b_id,puo.org_id parentOrgId,puo.org_name
-        parentOrgName,puo.belong_community_id belongCommunityId,
-        uosr.store_id storeId,uosr.rel_cd relCd
+        u.age,u.sex,u.tel,u.level_cd levelCd,u.b_id,uosr.store_id storeId,uosr.rel_cd relCd
         from
         u_user u
-        ,u_org uo
-        ,u_org_staff_rel uosr
-        ,u_org puo
+        left join u_org_staff_rel uosr on u.user_id = uosr.staff_id and uosr.status_cd = '0'
+        left join u_org uo on uosr.org_id = uo.org_id and uo.status_cd = '0'
         where u.level_cd = '01'
-        and u.user_id = uosr.staff_id
         <if test="storeId !=null and storeId != ''">
             and uosr.store_id = #{storeId}
         </if>
-        and uosr.org_id = uo.org_id
-        and uo.parent_org_id = puo.org_id
-        <if test="parentOrgId !=null and parentOrgId != ''">
-            and uo.parent_org_id = #{parentOrgId}
-        </if>
-        <if test="departmentOrgId !=null and departmentOrgId != ''">
-            and uosr.org_id = #{departmentOrgId}
+        <if test="orgId !=null and orgId != ''">
+            and uosr.org_id = #{orgId}
         </if>
         and u.status_cd = '0'
-        and uo.status_cd = '0'
-        and uosr.status_cd = '0'
-        and puo.status_cd = '0'
         <if test="tel !=null and tel != ''">
             and u.tel= #{tel}
         </if>

+ 0 - 144
service-api/src/main/java/com/java110/api/listener/user/QueryStaffServiceListener.java

@@ -1,144 +0,0 @@
-package com.java110.api.listener.user;
-
-import com.alibaba.fastjson.JSONObject;
-import com.java110.api.listener.AbstractServiceApiListener;
-import com.java110.intf.user.IUserInnerServiceSMO;
-import com.java110.dto.user.UserDto;
-import com.java110.utils.constant.CommonConstant;
-import com.java110.utils.constant.ServiceCodeConstant;
-import com.java110.utils.exception.ListenerExecuteException;
-import com.java110.utils.util.Assert;
-import com.java110.utils.util.BeanConvertUtil;
-import com.java110.utils.util.PinYinUtil;
-import com.java110.utils.util.StringUtil;
-import com.java110.core.annotation.Java110Listener;
-import com.java110.core.context.DataFlowContext;
-import com.java110.entity.center.AppService;
-import com.java110.core.event.service.api.ServiceDataFlowEvent;
-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 java.util.ArrayList;
-import java.util.List;
-
-/**
- * 查询员工信息
- * Created by Administrator on 2019/4/2.
- */
-@Java110Listener("queryStaffServiceListener")
-public class QueryStaffServiceListener extends AbstractServiceApiListener {
-
-    @Autowired
-    private IUserInnerServiceSMO userInnerServiceSMOImpl;
-
-    @Override
-    public int getOrder() {
-        return 0;
-    }
-
-
-
-    @Override
-    public String getServiceCode() {
-        return ServiceCodeConstant.SERVICE_CODE_QUERY_STAFF_INFOS;
-    }
-
-    @Override
-    public HttpMethod getHttpMethod() {
-        return HttpMethod.GET;
-    }
-
-    @Override
-    protected void validate(ServiceDataFlowEvent event, JSONObject reqJson) {
-        Assert.hasKeyAndValue(reqJson,"page","请求报文中未包含page节点");
-        Assert.hasKeyAndValue(reqJson,"row","请求报文中未包含rows节点");
-        if (!reqJson.containsKey("storeId")) {
-            String storeId = event.getDataFlowContext().getRequestCurrentHeaders().get("store-id");
-            reqJson.put("storeId", storeId);
-        }
-        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);
-            refreshInitials(staffs);
-        } 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);
-    }
-
-    /**
-     * 刷入首字母
-     * @param staffs
-     */
-    private void refreshInitials(List<ApiStaffDataVo> staffs) {
-
-        for(ApiStaffDataVo staffDataVo : staffs){
-            if(StringUtil.isEmpty(staffDataVo.getName())){
-                continue;
-            }
-            staffDataVo.setInitials(PinYinUtil.getFirstSpell(staffDataVo.getName()).toUpperCase().charAt(0)+"");
-        }
-    }
-
-    /**
-     * 查询用户信息
-     * @param tmpObj
-     */
-    private void queryUserInfoByUserId( DataFlowContext dataFlowContext,JSONObject tmpObj,AppService appService){
-
-        String userId = tmpObj.getString("userId");
-
-        if(StringUtil.isEmpty(userId)){
-            return ;
-        }
-
-        ResponseEntity responseEntity= null;
-
-        String requestUrl = appService.getUrl();
-        HttpHeaders header = new HttpHeaders();
-        header.add(CommonConstant.HTTP_SERVICE.toLowerCase(),ServiceCodeConstant.SERVICE_CODE_QUERY_USER_USERINFO);
-
-        //先查询商户服务查询员工userId
-        requestUrl = requestUrl + "?userId="+userId;
-        dataFlowContext.getRequestHeaders().put("REQUEST_URL",requestUrl);
-        HttpEntity<String> httpEntity = new HttpEntity<String>("", header);
-        doRequest(dataFlowContext,appService,httpEntity);
-        responseEntity = dataFlowContext.getResponseEntity();
-
-        if(responseEntity.getStatusCode() != HttpStatus.OK){
-            throw new ListenerExecuteException(1999,"查询用户信息异常 "+responseEntity.getBody());
-        }
-        tmpObj.putAll(JSONObject.parseObject(responseEntity.getBody().toString()));
-    }
-
-
-    public IUserInnerServiceSMO getUserInnerServiceSMOImpl() {
-        return userInnerServiceSMOImpl;
-    }
-
-    public void setUserInnerServiceSMOImpl(IUserInnerServiceSMO userInnerServiceSMOImpl) {
-        this.userInnerServiceSMOImpl = userInnerServiceSMOImpl;
-    }
-}

+ 80 - 0
service-user/src/main/java/com/java110/user/cmd/user/QueryStaffInfosCmd.java

@@ -0,0 +1,80 @@
+package com.java110.user.cmd.user;
+
+import com.alibaba.fastjson.JSONObject;
+import com.java110.core.annotation.Java110Cmd;
+import com.java110.core.context.ICmdDataFlowContext;
+import com.java110.core.event.cmd.Cmd;
+import com.java110.core.event.cmd.CmdEvent;
+import com.java110.dto.user.UserDto;
+import com.java110.intf.user.IUserInnerServiceSMO;
+import com.java110.utils.exception.CmdException;
+import com.java110.utils.util.Assert;
+import com.java110.utils.util.BeanConvertUtil;
+import com.java110.utils.util.PinYinUtil;
+import com.java110.utils.util.StringUtil;
+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.HttpStatus;
+import org.springframework.http.ResponseEntity;
+
+import java.util.ArrayList;
+import java.util.List;
+
+@Java110Cmd(serviceCode = "query.staff.infos")
+public class QueryStaffInfosCmd extends Cmd {
+
+    @Autowired
+    private IUserInnerServiceSMO userInnerServiceSMOImpl;
+
+    @Override
+    public void validate(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJson) throws CmdException {
+        Assert.hasKeyAndValue(reqJson,"page","请求报文中未包含page节点");
+        Assert.hasKeyAndValue(reqJson,"row","请求报文中未包含rows节点");
+        if (!reqJson.containsKey("storeId")) {
+            String storeId = context.getReqHeaders().get("store-id");
+            reqJson.put("storeId", storeId);
+        }
+        Assert.hasKeyAndValue(reqJson,"storeId","请求报文中未包含storeId节点");
+    }
+
+    @Override
+    public void doCmd(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJson) throws CmdException {
+        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);
+            refreshInitials(staffs);
+        } 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);
+    }
+
+    /**
+     * 刷入首字母
+     * @param staffs
+     */
+    private void refreshInitials(List<ApiStaffDataVo> staffs) {
+
+        for(ApiStaffDataVo staffDataVo : staffs){
+            if(StringUtil.isEmpty(staffDataVo.getName())){
+                continue;
+            }
+            staffDataVo.setInitials(PinYinUtil.getFirstSpell(staffDataVo.getName()).toUpperCase().charAt(0)+"");
+        }
+    }
+}