Browse Source

政府端-部门模块部分接口

dev
sunyuchao 5 years ago
parent
commit
2ee793e872
  1. 4
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java
  2. 53
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AddDepartmentFormDTO.java
  3. 43
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/DepartmentInAgencyFormDTO.java
  4. 43
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/DepartmentListFormDTO.java
  5. 43
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/DepartmentdetailFormDTO.java
  6. 54
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/EditDepartmentFormDTO.java
  7. 42
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/RemoveDepartmentFormDTO.java
  8. 40
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AddDepartmentResultDTO.java
  9. 60
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/DepartInStaffListResultDTO.java
  10. 57
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/DepartmentDetailResultDTO.java
  11. 47
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/DepartmentInAgencyResultDTO.java
  12. 49
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/DepartmentListResultDTO.java
  13. 30
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/constant/CustomerDepartmentConstant.java
  14. 110
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/DepartmentController.java
  15. 21
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerDepartmentDao.java
  16. 6
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerStaffDepartmentDao.java
  17. 11
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/EpmetUserFeignClient.java
  18. 8
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallBack.java
  19. 80
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/DepartmentService.java
  20. 200
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/DepartmentServiceImpl.java
  21. 5
      epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml
  22. 10
      epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerStaffDepartmentDao.xml
  23. 33
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/DepartmentInStaffFormDTO.java
  24. 6
      epmet-user/epmet-user-server/src/main/java/com/epmet/constant/UserRoleConstant.java
  25. 14
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/CustomerStaffController.java
  26. 10
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/CustomerStaffDao.java
  27. 10
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/CustomerStaffService.java
  28. 18
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java
  29. 17
      epmet-user/epmet-user-server/src/main/resources/mapper/CustomerStaffDao.xml

4
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java

@ -27,7 +27,9 @@ public enum EpmetErrorCode {
MESSAGE_SMS_SEND_ERROR(8105, "短信发送失败"),
CANNOT_AUDIT_WARM(8201, "请完善居民信息"),
NOT_DEL_AGENCY(8202, "该机关存在下级机关,不允许删除");
NOT_DEL_AGENCY(8202, "该机关存在下级机关,不允许删除"),
NOT_DEL_AGENCY_PER(8203, "该机关存在工作人员,不允许删除"),
NOT_DEL_DEPARTMENT(8204, "该部门存在工作人员,不允许删除");
private int code;

53
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AddDepartmentFormDTO.java

@ -0,0 +1,53 @@
/**
* 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.form;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* 添加部门-接口入参
*
* @author sun
*/
@Data
public class AddDepartmentFormDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 所属组织机构IDcustomer_agency.id
*/
@NotBlank(message = "组织机构Id不能为空")
private String agencyId;
/**
* 部门名称
*/
private String departmentName;
/**
* 部门职责
*/
private String departmentDuty;
}

43
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/DepartmentInAgencyFormDTO.java

@ -0,0 +1,43 @@
/**
* 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.form;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* 组织首页-获取机关下部门列表-接口入参
*
* @author sun
*/
@Data
public class DepartmentInAgencyFormDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 机关组织Id
*/
@NotBlank(message = "组织机构ID不能为空")
private String agencyId;
}

43
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/DepartmentListFormDTO.java

@ -0,0 +1,43 @@
/**
* 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.form;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* 获取部门列表-接口入参
*
* @author sun
*/
@Data
public class DepartmentListFormDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 机关组织Id
*/
@NotBlank(message = "组织机构ID不能为空")
private String agencyId;
}

43
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/DepartmentdetailFormDTO.java

@ -0,0 +1,43 @@
/**
* 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.form;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* 获取部门详情-接口入参
*
* @author sun
*/
@Data
public class DepartmentdetailFormDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 部门Id
*/
@NotBlank(message = "部门ID不能为空")
private String departmentId;
}

54
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/EditDepartmentFormDTO.java

@ -0,0 +1,54 @@
/**
* 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.form;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* 部门信息修改-接口入参
*
* @author sun
*/
@Data
public class EditDepartmentFormDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 部门Id
*/
@NotBlank(message = "部门ID不能为空")
private String departmentId;
/**
* 部门名称
*/
@NotBlank(message = "部门名称不能为空")
private String departmentName;
/**
* 部门职责
*/
@NotBlank(message = "部门职责不能为空")
private String departmentDuty;
}

42
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/RemoveDepartmentFormDTO.java

@ -0,0 +1,42 @@
/**
* 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.form;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* 删除部门-接口入参
*
* @author sun
*/
@Data
public class RemoveDepartmentFormDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 部门Id
*/
@NotBlank(message = "部门ID不能为空")
private String departmentId;
}

40
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AddDepartmentResultDTO.java

@ -0,0 +1,40 @@
/**
* 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;
/**
* 添加部门-接口返参
*
* @author sun
*/
@Data
public class AddDepartmentResultDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 新增部门Id
*/
private String departmentId;
}

60
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/DepartInStaffListResultDTO.java

@ -0,0 +1,60 @@
/**
* 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;
/**
* 获取部门详情-部门下工作人员列表
*
* @author sun
*/
@Data
public class DepartInStaffListResultDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 用户ID
*/
private String staffId;
/**
* 用户姓名
*/
private String staffName;
/**
* 用户头像
*/
private String staffHeadPhoto;
/**
* 性别
*/
private Integer gender;
/**
* 角色名称
*/
private String roleName;
}

57
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/DepartmentDetailResultDTO.java

@ -0,0 +1,57 @@
/**
* 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 DepartmentDetailResultDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 部门Id
*/
private String departmentId;
/**
* 部门名称
*/
private String departmentName;
/**
* 部门职责
*/
private String departmentDuty;
/**
* 部门下工作人员列表
*/
private List<DepartInStaffListResultDTO> staffList;
}

47
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/DepartmentInAgencyResultDTO.java

@ -0,0 +1,47 @@
/**
* 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 DepartmentInAgencyResultDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 机关下总部门数
*/
private Integer departmentCount;
/**
* 机关下部门列表
*/
private List<DepartmentListResultDTO> departmentList;
}

49
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/DepartmentListResultDTO.java

@ -0,0 +1,49 @@
/**
* 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;
/**
* 组织首页-获取机关下部门列表-部门详情数据
*
* @author sun
*/
@Data
public class DepartmentListResultDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 部门Id
*/
private String departmentId;
/**
* 部门名称
*/
private String departmentName;
/**
* 部门下总人数
*/
private Integer totalUser;
}

30
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/constant/CustomerDepartmentConstant.java

@ -0,0 +1,30 @@
package com.epmet.constant;
/**
* @author sun
* @dscription
*/
public interface CustomerDepartmentConstant {
/**
* 部门信息编辑修改失败
*/
String UPDATE_EXCEPTION = "部门信息更新失败";
/**
* 添加部门失败
*/
String SAVE_EXCEPTION = "添加部门失败";
/**
* 部门删除失败
*/
String DEL_EXCEPTION = "删除部门失败";
/**
* 查询用户基本信息失败
*/
String SELECT_STAFFINFO_EXCEPTION = "根据用户Id未查询到用户基本信息";
/**
* 查询部门人员角色
*/
String SELECT_ROLE_EXCEPTION = "查询部门人员角色失败";
}

110
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/DepartmentController.java

@ -0,0 +1,110 @@
/**
* 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.controller;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.form.*;
import com.epmet.dto.result.*;
import com.epmet.service.DepartmentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* 部门
*
* @author sun
*/
@RestController
@RequestMapping("department")
public class DepartmentController {
@Autowired
private DepartmentService departmentService;
/**
* @param formDTO
* @return
* @Author sun
* @Description 添加部门
*/
@PostMapping("adddepartment")
public Result<AddDepartmentResultDTO> addDepartment(@RequestBody AddDepartmentFormDTO formDTO) {
return departmentService.addDepartment(formDTO);
}
/**
* @param formDTO
* @return
* @Author sun
* @Description 部门信息修改
*/
@PostMapping("editdepartment")
public Result editDepartment(@RequestBody EditDepartmentFormDTO formDTO) {
return departmentService.editDepartment(formDTO);
}
/**
* @param formDTO
* @return
* @Author sun
* @Description 删除部门
*/
@PostMapping("removedepartment")
public Result removeDepartment(@RequestBody RemoveDepartmentFormDTO formDTO) {
return departmentService.removeDepartment(formDTO);
}
/**
* @param formDTO
* @return
* @Author sun
* @Description 获取部门详情
*/
@PostMapping("departmentdetail")
public Result<DepartmentDetailResultDTO> departmentDetail(@RequestBody DepartmentdetailFormDTO formDTO) {
return departmentService.departmentDetail(formDTO);
}
/**
* @param formDTO
* @return
* @Author sun
* @Description 组织首页-获取机关下部门列表
*/
@PostMapping("departmentinagencylist")
public Result<DepartmentInAgencyResultDTO> departmentInAgencyList(@RequestBody DepartmentInAgencyFormDTO formDTO) {
return departmentService.departmentInAgencyList(formDTO);
}
/**
* @param formDTO
* @return
* @Author sun
* @Description 获取机构下部门列表
*/
@PostMapping("departmentlist")
public Result<List<DepartmentListResultDTO>> departmentList(@RequestBody DepartmentListFormDTO formDTO) {
return departmentService.departmentList(formDTO);
}
}

21
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerDepartmentDao.java

@ -18,8 +18,13 @@
package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.result.DepartmentListResultDTO;
import com.epmet.dto.result.SubListResultDTO;
import com.epmet.entity.CustomerDepartmentEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 客户部门表
@ -29,5 +34,19 @@ import org.apache.ibatis.annotations.Mapper;
*/
@Mapper
public interface CustomerDepartmentDao extends BaseDao<CustomerDepartmentEntity> {
/**
* @param agencyId
* @return
* @Author sun
* @Description 根据当前机关Id查询该机关下的直属部门列表,只查询前十条
**/
List<DepartmentListResultDTO> selectDepartmentListByAgencyId(@Param("agencyId") String agencyId);
/**
* @param agencyId
* @return
* @Author sun
* @Description 根据当前机关Id查询该机关下的直属部门列表
**/
List<DepartmentListResultDTO> selectDepartmentList(@Param("agencyId") String agencyId);
}

6
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerStaffDepartmentDao.java

@ -20,6 +20,9 @@ package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.entity.CustomerStaffDepartmentEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 部门人员关系表
@ -29,5 +32,6 @@ import org.apache.ibatis.annotations.Mapper;
*/
@Mapper
public interface CustomerStaffDepartmentDao extends BaseDao<CustomerStaffDepartmentEntity> {
List<String> selectUserIdByDepartmentId(@Param("departmentId") String departmentId);
}

11
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/EpmetUserFeignClient.java

@ -5,7 +5,9 @@ import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.CustomerStaffDTO;
import com.epmet.dto.CustomerStaffGridDTO;
import com.epmet.dto.StaffGridListDTO;
import com.epmet.dto.form.DepartmentInStaffFormDTO;
import com.epmet.dto.form.StaffsInAgencyFromDTO;
import com.epmet.dto.result.DepartInStaffListResultDTO;
import com.epmet.dto.result.StaffInfoResultDTO;
import com.epmet.feign.fallback.EpmetUserFeignClientFallBack;
import org.springframework.cloud.openfeign.FeignClient;
@ -43,4 +45,13 @@ public interface EpmetUserFeignClient {
@PostMapping("/epmetuser/customerstaff/staffsinagency")
Result<List<StaffInfoResultDTO>> getStaffInfoForHome(StaffsInAgencyFromDTO fromDTO);
/**
* @param departmentInStaffFormDTO
* @return
* @Author sun
* @Description 根据客户Id及userId集合查询用户基本信息
*/
@PostMapping("/epmetuser/customerstaff/getdepartmentstafflist")
Result<List<DepartInStaffListResultDTO>> getDepartmentStaffList(DepartmentInStaffFormDTO departmentInStaffFormDTO);
}

8
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallBack.java

@ -6,7 +6,9 @@ import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.CustomerStaffDTO;
import com.epmet.dto.CustomerStaffGridDTO;
import com.epmet.dto.StaffGridListDTO;
import com.epmet.dto.form.DepartmentInStaffFormDTO;
import com.epmet.dto.form.StaffsInAgencyFromDTO;
import com.epmet.dto.result.DepartInStaffListResultDTO;
import com.epmet.dto.result.StaffInfoResultDTO;
import com.epmet.feign.EpmetUserFeignClient;
import org.springframework.stereotype.Component;
@ -32,4 +34,10 @@ public class EpmetUserFeignClientFallBack implements EpmetUserFeignClient {
public Result<List<StaffInfoResultDTO>> getStaffInfoForHome(StaffsInAgencyFromDTO fromDTO) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getStaffInfoForHome", fromDTO);
}
@Override
public Result<List<DepartInStaffListResultDTO>> getDepartmentStaffList(DepartmentInStaffFormDTO departmentInStaffFormDTO) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getDepartmentStaffList", departmentInStaffFormDTO);
}
}

80
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/DepartmentService.java

@ -0,0 +1,80 @@
/**
* 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.service;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.form.*;
import com.epmet.dto.result.*;
import java.util.List;
/**
* 机关单位信息
*
* @author sun
*/
public interface DepartmentService {
/**
* @param formDTO
* @return
* @Author sun
* @Description 添加部门
*/
Result<AddDepartmentResultDTO> addDepartment(AddDepartmentFormDTO formDTO);
/**
* @param formDTO
* @return
* @Author sun
* @Description 部门信息修改
*/
Result editDepartment(EditDepartmentFormDTO formDTO);
/**
* @param formDTO
* @return
* @Author sun
* @Description 删除部门
*/
Result removeDepartment(RemoveDepartmentFormDTO formDTO);
/**
* @param formDTO
* @return
* @Author sun
* @Description 获取部门详情
*/
Result<DepartmentDetailResultDTO> departmentDetail(DepartmentdetailFormDTO formDTO);
/**
* @param formDTO
* @return
* @Author sun
* @Description 组织首页-获取机关下部门列表
*/
Result<DepartmentInAgencyResultDTO> departmentInAgencyList(DepartmentInAgencyFormDTO formDTO);
/**
* @param formDTO
* @return
* @Author sun
* @Description 获取机构下部门列表
*/
Result<List<DepartmentListResultDTO>> departmentList(DepartmentListFormDTO formDTO);
}

200
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/DepartmentServiceImpl.java

@ -0,0 +1,200 @@
/**
* 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.service.impl;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.constant.CustomerDepartmentConstant;
import com.epmet.dao.CustomerAgencyDao;
import com.epmet.dao.CustomerDepartmentDao;
import com.epmet.dao.CustomerStaffDepartmentDao;
import com.epmet.dto.StaffRoleDTO;
import com.epmet.dto.form.*;
import com.epmet.dto.result.*;
import com.epmet.entity.CustomerAgencyEntity;
import com.epmet.entity.CustomerDepartmentEntity;
import com.epmet.feign.EpmetUserFeignClient;
import com.epmet.service.DepartmentService;
import com.epmet.util.ModuleConstant;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Arrays;
import java.util.List;
/**
* 机关单位信息
*
* @author sun
*/
@Service
public class DepartmentServiceImpl implements DepartmentService {
private static final Logger log = LoggerFactory.getLogger(DepartmentServiceImpl.class);
@Autowired
private CustomerAgencyDao customerAgencyDao;
@Autowired
private CustomerDepartmentDao customerDepartmentDao;
@Autowired
private CustomerStaffDepartmentDao customerStaffDepartmentDao;
@Autowired
private EpmetUserFeignClient epmetUserFeignClient;
/**
* @param formDTO
* @return
* @Author sun
* @Description 添加部门
*/
@Override
@Transactional(rollbackFor = Exception.class)
public Result<AddDepartmentResultDTO> addDepartment(AddDepartmentFormDTO formDTO) {
Result<AddDepartmentResultDTO> result = new Result<AddDepartmentResultDTO>();
AddDepartmentResultDTO addDepartmentResultDTO = new AddDepartmentResultDTO();
CustomerDepartmentEntity entity = ConvertUtils.sourceToTarget(formDTO, CustomerDepartmentEntity.class);
entity.setTotalUser(NumConstant.ZERO);
//1:查询当前组织机构信息,获取客户Id
CustomerAgencyEntity parentEntity = customerAgencyDao.selectById(formDTO.getAgencyId());
entity.setCustomerId(parentEntity.getCustomerId());
//2:保存部门信息
if (customerDepartmentDao.insert(entity) < NumConstant.ONE) {
log.error(CustomerDepartmentConstant.SAVE_EXCEPTION);
throw new RenException(CustomerDepartmentConstant.SAVE_EXCEPTION);
}
//3:返回新部门Id
addDepartmentResultDTO.setDepartmentId(entity.getId());
return result.ok(addDepartmentResultDTO);
}
/**
* @param formDTO
* @return
* @Author sun
* @Description 部门信息修改
*/
@Override
@Transactional(rollbackFor = Exception.class)
public Result editDepartment(EditDepartmentFormDTO formDTO) {
Result result = new Result();
CustomerDepartmentEntity entity = new CustomerDepartmentEntity();
entity.setId(formDTO.getDepartmentId());
entity.setDepartmentName(formDTO.getDepartmentName());
entity.setDepartmentDuty(formDTO.getDepartmentDuty());
if (customerDepartmentDao.updateById(entity) < NumConstant.ONE) {
log.error(CustomerDepartmentConstant.UPDATE_EXCEPTION);
throw new RenException(CustomerDepartmentConstant.UPDATE_EXCEPTION);
}
return result;
}
/**
* @param formDTO
* @return
* @Author sun
* @Description 删除部门
*/
@Override
@Transactional(rollbackFor = Exception.class)
public Result removeDepartment(RemoveDepartmentFormDTO formDTO) {
Result result = new Result();
//1:判断当前部门下是否存在工作人员,不存在的可以删除
CustomerDepartmentEntity entity = customerDepartmentDao.selectById(formDTO.getDepartmentId());
if (null != entity && entity.getTotalUser() > NumConstant.ZERO) {
result.setCode(EpmetErrorCode.NOT_DEL_DEPARTMENT.getCode());
result.setMsg(EpmetErrorCode.NOT_DEL_DEPARTMENT.getMsg());
return result;
}
//2:删除部门信息(逻辑删)
if (customerDepartmentDao.deleteById(formDTO.getDepartmentId()) < NumConstant.ONE) {
log.error(CustomerDepartmentConstant.DEL_EXCEPTION);
throw new RenException(CustomerDepartmentConstant.DEL_EXCEPTION);
}
return result;
}
/**
* @param formDTO
* @return
* @Author sun
* @Description 获取部门详情
*/
@Override
public Result<DepartmentDetailResultDTO> departmentDetail(DepartmentdetailFormDTO formDTO) {
Result<DepartmentDetailResultDTO> result = new Result<DepartmentDetailResultDTO>();
DepartmentDetailResultDTO departmentDetailResultDTO = new DepartmentDetailResultDTO();
//1:根据部门Id查询部门详情信息
CustomerDepartmentEntity entity = customerDepartmentDao.selectById(formDTO.getDepartmentId());
departmentDetailResultDTO = ConvertUtils.sourceToTarget(entity, DepartmentDetailResultDTO.class);
departmentDetailResultDTO.setDepartmentId(entity.getId());
//2:查询部门下工作人员的用户Id集合
List<String> userIdList = customerStaffDepartmentDao.selectUserIdByDepartmentId(formDTO.getDepartmentId());
if (null == userIdList || userIdList.size() < NumConstant.ONE) {
return result.ok(departmentDetailResultDTO);
}
DepartmentInStaffFormDTO departmentInStaffFormDTO = new DepartmentInStaffFormDTO();
//部门Id用于查询部门领导角色使用
departmentInStaffFormDTO.setDepartmentId(formDTO.getDepartmentId());
departmentInStaffFormDTO.setCustomerId(entity.getCustomerId());
departmentInStaffFormDTO.setUserIdList(userIdList);
//3:调用epmet_user服务,查询人员基本信息,按姓名对应的拼音升序
Result<List<DepartInStaffListResultDTO>> resultList = epmetUserFeignClient.getDepartmentStaffList(departmentInStaffFormDTO);
if (!resultList.success() || null == resultList.getData()) {
log.error(CustomerDepartmentConstant.SELECT_STAFFINFO_EXCEPTION);
throw new RenException(CustomerDepartmentConstant.SELECT_STAFFINFO_EXCEPTION);
}
//部门下所有工作人员基本信息
List<DepartInStaffListResultDTO> staffList = resultList.getData();
departmentDetailResultDTO.setStaffList(staffList);
return new Result<DepartmentDetailResultDTO>().ok(departmentDetailResultDTO);
}
/**
* @param formDTO
* @return
* @Author sun
* @Description 组织首页-获取机关下部门列表
*/
@Override
public Result<DepartmentInAgencyResultDTO> departmentInAgencyList(DepartmentInAgencyFormDTO formDTO) {
DepartmentInAgencyResultDTO departmentInAgencyResultDTO = new DepartmentInAgencyResultDTO();
//1:根据当前机关Id查询该机关下的直属部门列表
List<DepartmentListResultDTO> departmentList = customerDepartmentDao.selectDepartmentListByAgencyId(formDTO.getAgencyId());
departmentInAgencyResultDTO.setDepartmentList(departmentList);
//2:统计下一级机关数
departmentInAgencyResultDTO.setDepartmentCount(departmentList.size());
return new Result<DepartmentInAgencyResultDTO>().ok(departmentInAgencyResultDTO);
}
/**
* @param formDTO
* @return
* @Author sun
* @Description 获取机构下部门列表
*/
@Override
public Result<List<DepartmentListResultDTO>> departmentList(DepartmentListFormDTO formDTO) {
List<DepartmentListResultDTO> departmentList = customerDepartmentDao.selectDepartmentList(formDTO.getAgencyId());
return new Result<List<DepartmentListResultDTO>>().ok(departmentList);
}
}

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

@ -57,7 +57,8 @@
FROM customer_agency
WHERE del_flag = '0'
AND pid = #{pId}
ORDER BY CREATED_TIME DESC
ORDER BY created_time DESC
LIMIT 10
</select>
<select id="selectAgencyList" resultType="com.epmet.dto.result.AgencyListResultDTO">
@ -68,6 +69,6 @@
FROM customer_agency
WHERE del_flag = '0'
AND pid = #{pId}
ORDER BY CREATED_TIME DESC
ORDER BY created_time DESC
</select>
</mapper>

10
epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerStaffDepartmentDao.xml

@ -15,6 +15,16 @@
<result property="updatedBy" column="UPDATED_BY"/>
<result property="updatedTime" column="UPDATED_TIME"/>
</resultMap>
<select id="selectUserIdByDepartmentId" resultType="java.lang.String">
SELECT
user_id
FROM
customer_staff_department
WHERE
del_flag = '0'
AND department_id = #{}
</select>
</mapper>

33
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/DepartmentInStaffFormDTO.java

@ -0,0 +1,33 @@
package com.epmet.dto.form;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* @Description 根据客户Id和用户Id查询用户基本信息
* @Author sun
*/
@Data
public class DepartmentInStaffFormDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 部门Id
*/
private String departmentId;
/**
* 客户Id CUSTOMER.id
*/
private String customerId;
/**
* 用户Id集合
*/
private List<String> userIdList;
}

6
epmet-user/epmet-user-server/src/main/java/com/epmet/constant/UserRoleConstant.java

@ -11,4 +11,10 @@ public interface UserRoleConstant {
* 角色表对应的是居民角色时grid_id的默认值
*/
String DEFAULT_GRID_ID = "all";
/**
* 部门领导角色值
*/
String DEPT_LEADER = "dept_leader";
}

14
epmet-user/epmet-user-server/src/main/java/com/epmet/controller/CustomerStaffController.java

@ -28,9 +28,10 @@ import com.epmet.commons.tools.validator.group.UpdateGroup;
import com.epmet.dto.CustomerStaffDTO;
import com.epmet.dto.CustomerStaffGridDTO;
import com.epmet.dto.StaffGridListDTO;
import com.epmet.dto.form.CustomerGridFormDTO;
import com.epmet.dto.form.CustomerStaffFormDTO;
import com.epmet.dto.form.DepartmentInStaffFormDTO;
import com.epmet.dto.form.StaffsInAgencyFromDTO;
import com.epmet.dto.result.DepartInStaffListResultDTO;
import com.epmet.dto.result.StaffInfoResultDTO;
import com.epmet.excel.CustomerStaffExcel;
import com.epmet.service.CustomerStaffService;
@ -155,4 +156,15 @@ public class CustomerStaffController {
public Result<List<StaffInfoResultDTO>> getStaffInfoForHome(StaffsInAgencyFromDTO fromDTO) {
return customerStaffService.getStaffInfoForHome(fromDTO);
}
/**
* @param fromDTO
* @return
* @Author sun
* @Description 根据客户Id及userId集合查询用户基本信息
*/
@PostMapping("getdepartmentstafflist")
public Result<List<DepartInStaffListResultDTO>> getDepartmentStaffList(DepartmentInStaffFormDTO fromDTO) {
return customerStaffService.getDepartmentStaffList(fromDTO);
}
}

10
epmet-user/epmet-user-server/src/main/java/com/epmet/dao/CustomerStaffDao.java

@ -22,7 +22,9 @@ import com.epmet.dto.CustomerStaffDTO;
import com.epmet.dto.CustomerStaffGridDTO;
import com.epmet.dto.StaffGridListDTO;
import com.epmet.dto.form.CustomerStaffFormDTO;
import com.epmet.dto.form.DepartmentInStaffFormDTO;
import com.epmet.dto.form.StaffsInAgencyFromDTO;
import com.epmet.dto.result.DepartInStaffListResultDTO;
import com.epmet.dto.result.StaffInfoResultDTO;
import com.epmet.entity.CustomerStaffEntity;
import org.apache.ibatis.annotations.Mapper;
@ -82,4 +84,12 @@ public interface CustomerStaffDao extends BaseDao<CustomerStaffEntity> {
* @Date 2020/4/23 16:46
**/
CustomerStaffEntity selectByUserId(String userId);
/**
* @param fromDTO
* @return
* @Author sun
* @Description 根据客户Id及userId集合查询用户基本信息
*/
List<DepartInStaffListResultDTO> selectDepartmentStaffList(DepartmentInStaffFormDTO fromDTO);
}

10
epmet-user/epmet-user-server/src/main/java/com/epmet/service/CustomerStaffService.java

@ -24,7 +24,9 @@ import com.epmet.dto.CustomerStaffDTO;
import com.epmet.dto.CustomerStaffGridDTO;
import com.epmet.dto.StaffGridListDTO;
import com.epmet.dto.form.CustomerStaffFormDTO;
import com.epmet.dto.form.DepartmentInStaffFormDTO;
import com.epmet.dto.form.StaffsInAgencyFromDTO;
import com.epmet.dto.result.DepartInStaffListResultDTO;
import com.epmet.dto.result.StaffInfoResultDTO;
import com.epmet.entity.CustomerStaffEntity;
@ -140,4 +142,12 @@ public interface CustomerStaffService extends BaseService<CustomerStaffEntity> {
* @return
*/
Result<List<StaffInfoResultDTO>> getStaffInfoForHome(StaffsInAgencyFromDTO fromDTO);
/**
* @param fromDTO
* @return
* @Author sun
* @Description 根据客户Id及userId集合查询用户基本信息
*/
Result<List<DepartInStaffListResultDTO>> getDepartmentStaffList(DepartmentInStaffFormDTO fromDTO);
}

18
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java

@ -22,16 +22,22 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.constant.UserConstant;
import com.epmet.constant.UserRoleConstant;
import com.epmet.dao.CustomerStaffDao;
import com.epmet.dto.CustomerStaffDTO;
import com.epmet.dto.CustomerStaffGridDTO;
import com.epmet.dto.StaffGridListDTO;
import com.epmet.dto.StaffRoleDTO;
import com.epmet.dto.form.CustomerStaffFormDTO;
import com.epmet.dto.form.DepartmentInStaffFormDTO;
import com.epmet.dto.form.StaffRoleFormDTO;
import com.epmet.dto.form.StaffsInAgencyFromDTO;
import com.epmet.dto.result.DepartInStaffListResultDTO;
import com.epmet.dto.result.StaffInfoResultDTO;
import com.epmet.entity.CustomerStaffEntity;
import com.epmet.redis.CustomerStaffRedis;
@ -156,4 +162,16 @@ public class CustomerStaffServiceImpl extends BaseServiceImpl<CustomerStaffDao,
return new Result<List<StaffInfoResultDTO>>().ok(list);
}
@Override
public Result<List<DepartInStaffListResultDTO>> getDepartmentStaffList(DepartmentInStaffFormDTO formDTO) {
//1:根据userId集合查询人员基本信息
List<DepartInStaffListResultDTO> list = baseDao.selectDepartmentStaffList(formDTO);
//2:根据部门Id查询部门下是领导角色的用户
StaffRoleFormDTO staffRoleFormDTO = new StaffRoleFormDTO();
staffRoleFormDTO.setOrgId(formDTO.getDepartmentId());
staffRoleFormDTO.setRoleKey(UserRoleConstant.DEPT_LEADER);
return new Result<List<DepartInStaffListResultDTO>>().ok(list);
}
}

17
epmet-user/epmet-user-server/src/main/resources/mapper/CustomerStaffDao.xml

@ -79,4 +79,21 @@
cs.DEL_FLAG = '0'
AND CS.USER_ID =#{userId}
</select>
<select id="selectDepartmentStaffList" resultType="com.epmet.dto.result.DepartInStaffListResultDTO">
SELECT
user_id AS 'staffId',
real_name AS 'staffName',
IF (head_photo IS NULL,'',head_photo) AS 'staffHeadPhoto',
gender AS 'gender'
FROM
customer_staff
WHERE
del_flag = '0'
AND customer_id = #{customerId}
AND user_id in
<foreach item="userId" collection="userIdList" separator="," open="(" close=")" index="">
#{userId}
</foreach>
ORDER BY CONVERT (real_name USING gbk) ASC<!--按中文对应的拼音升序排列-->
</select>
</mapper>
Loading…
Cancel
Save