Browse Source

工作端查询工作人员所属组织及下级

master
sunyuchao 5 years ago
parent
commit
470b205d4b
  1. 6
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AgencyResultDTO.java
  2. 44
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/StaffInAgencyListResultDTO.java
  3. 4
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/constant/CustomerAgencyConstant.java
  4. 13
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java
  5. 7
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerAgencyDao.java
  6. 8
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java
  7. 24
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java
  8. 14
      epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml

6
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AgencyResultDTO.java

@ -17,6 +17,7 @@
package com.epmet.dto.result;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;
import java.io.Serializable;
@ -40,4 +41,9 @@ public class AgencyResultDTO implements Serializable {
* 机关组织名称
*/
private String agencyName = "";
/**
* 所有上级组织机构ID(以英文:隔开)
*/
@JsonIgnore
private String pids = "";
}

44
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/StaffInAgencyListResultDTO.java

@ -0,0 +1,44 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.dto.result;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* 工作端-查询当前人员所属组织及所有下级组织--接口返参
*
* @author sun
*/
@Data
public class StaffInAgencyListResultDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 当前组织信息
*/
private AgencyResultDTO agencyList;
/**
* 下级组织信息(递归)
*/
private List<AgencySubResultDTO> subAgencyList;
}

4
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/constant/CustomerAgencyConstant.java

@ -67,4 +67,8 @@ public interface CustomerAgencyConstant {
* 网格党建指导员角色
*/
String GRID_PARTY_DIRECTOR = "grid_party_director";
/**
* 获取工作人员组织信息失败
*/
String SELECT_STAFF_AGENCY_EXCEPTION = "获取工作人员组织信息失败";
}

13
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java

@ -17,7 +17,9 @@
package com.epmet.controller;
import com.epmet.commons.tools.annotation.LoginUser;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.ExcelUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.AssertUtils;
@ -229,4 +231,15 @@ public class CustomerAgencyController {
Result<ExtUserInfoResultDTO> userInfoExt(@RequestBody ExtUserInfoResultDTO result){
return new Result<ExtUserInfoResultDTO>().ok(customerAgencyService.extUserInfo(result));
}
/**
* @param tokenDTO
* @return
* @Author sun
* @Description 工作端-查询当前人员所属组织及所有下级组织
**/
@PostMapping("staffinagencylist")
public Result<StaffInAgencyListResultDTO> staffInAgencyList(@LoginUser TokenDto tokenDTO) {
return new Result<StaffInAgencyListResultDTO>().ok(customerAgencyService.staffInAgencyList(tokenDTO.getUserId()));
}
}

7
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerAgencyDao.java

@ -161,4 +161,11 @@ public interface CustomerAgencyDao extends BaseDao<CustomerAgencyEntity> {
**/
List<ExtDeptResultDTO> selectDeptList(@Param("agencyId") String agencyId);
/**
* @param staffId
* @return
* @Author sun
* @Description 查询工作人员所属组织信息
**/
AgencyResultDTO selectAgencyByStaffId(@Param("staffId") String staffId);
}

8
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java

@ -205,4 +205,12 @@ public interface CustomerAgencyService extends BaseService<CustomerAgencyEntity>
* @date 2020.08.21 17:31
**/
ExtUserInfoResultDTO extUserInfo(ExtUserInfoResultDTO result);
/**
* @param staffId
* @return
* @Author sun
* @Description 工作端-查询当前人员所属组织及所有下级组织
**/
StaffInAgencyListResultDTO staffInAgencyList(String staffId);
}

24
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java

@ -971,4 +971,28 @@ public class CustomerAgencyServiceImpl extends BaseServiceImpl<CustomerAgencyDao
}
}
/**
* @param staffId
* @return
* @Author sun
* @Description 工作端-查询当前人员所属组织及所有下级组织
**/
@Override
public StaffInAgencyListResultDTO staffInAgencyList(String staffId) {
StaffInAgencyListResultDTO resultDTO = new StaffInAgencyListResultDTO();
//1.查询工作人员所属组织信息
AgencyResultDTO agencyList = baseDao.selectAgencyByStaffId(staffId);
if (null == agencyList) {
logger.error(String.format("查询工作人员所属组织信息失败,staffId->%s", staffId));
throw new RenException(CustomerAgencyConstant.SELECT_STAFF_AGENCY_EXCEPTION);
}
resultDTO.setAgencyList(agencyList);
//2.递归查询所有下级组织信息
List<AgencySubResultDTO> subAgencyList = getDepartmentList(("".equals(agencyList.getPids()) ? "" : agencyList.getPids() + ":") + agencyList.getAgencyId());
resultDTO.setSubAgencyList(subAgencyList);
return resultDTO;
}
}

14
epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml

@ -258,4 +258,18 @@
AND agency.PID = #{pid}
</select>
<select id="selectAgencyByStaffId" resultType="com.epmet.dto.result.AgencyResultDTO">
SELECT
ca.id AS "agencyId",
ca.organization_name AS "agencyName",
ca.pids AS "pids"
FROM
customer_agency ca
INNER JOIN customer_staff_agency csa ON ca.id = csa.agency_id
WHERE
ca.del_flag = '0'
AND csa.del_flag = '0'
AND csa.user_id = #{staffId}
</select>
</mapper>
Loading…
Cancel
Save