29 changed files with 1118 additions and 6 deletions
@ -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; |
||||
|
|
||||
|
/** |
||||
|
* 所属组织机构ID(customer_agency.id) |
||||
|
*/ |
||||
|
@NotBlank(message = "组织机构Id不能为空") |
||||
|
private String agencyId; |
||||
|
|
||||
|
/** |
||||
|
* 部门名称 |
||||
|
*/ |
||||
|
private String departmentName; |
||||
|
|
||||
|
/** |
||||
|
* 部门职责 |
||||
|
*/ |
||||
|
private String departmentDuty; |
||||
|
|
||||
|
|
||||
|
} |
@ -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; |
||||
|
|
||||
|
|
||||
|
} |
@ -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; |
||||
|
|
||||
|
|
||||
|
} |
@ -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; |
||||
|
|
||||
|
|
||||
|
} |
@ -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; |
||||
|
|
||||
|
} |
@ -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; |
||||
|
|
||||
|
} |
@ -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; |
||||
|
|
||||
|
} |
@ -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; |
||||
|
|
||||
|
} |
@ -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; |
||||
|
|
||||
|
|
||||
|
} |
@ -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; |
||||
|
|
||||
|
|
||||
|
} |
@ -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; |
||||
|
} |
@ -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 = "查询部门人员角色失败"; |
||||
|
} |
@ -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); |
||||
|
} |
||||
|
} |
@ -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); |
||||
|
} |
@ -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); |
||||
|
} |
||||
|
} |
@ -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; |
||||
|
|
||||
|
} |
||||
|
|
Loading…
Reference in new issue