Ver Código Fonte

新增部门和公司的查询

konghl 4 anos atrás
pai
commit
a3125fe5f1

+ 101 - 50
security-protection-service/src/main/java/com/ai/bss/security/protection/controller/EmployeeManagementController.java

@ -1,17 +1,22 @@
1 1
package com.ai.bss.security.protection.controller;
2 2
3
import java.util.ArrayList;
4
import java.util.List;
3 5
import java.util.Map;
4 6
5 7
import org.springframework.beans.factory.annotation.Autowired;
6 8
import org.springframework.stereotype.Controller;
7 9
import org.springframework.web.bind.annotation.RequestBody;
8 10
import org.springframework.web.bind.annotation.RequestMapping;
11
import org.springframework.web.bind.annotation.RequestParam;
9 12
import org.springframework.web.bind.annotation.ResponseBody;
10 13
11 14
import com.ai.abc.api.model.CommonRequest;
12 15
import com.ai.abc.api.model.CommonResponse;
13 16
import com.ai.bss.components.common.model.PageBean;
17
import com.ai.bss.person.model.Organization;
14 18
import com.ai.bss.security.protection.service.interfaces.EmployeeManagementService;
19
import com.ai.bss.security.protection.utils.EbcConstant;
15 20
import com.ai.bss.user.dto.EmployeeDto;
16 21
import com.ai.bss.user.dto.UserDto;
17 22
@ -22,67 +27,113 @@ import com.ai.bss.user.dto.UserDto;
22 27
@RequestMapping("/employeeManagement")
23 28
public class EmployeeManagementController {
24 29
25
    @Autowired
26
    private EmployeeManagementService employeeManagementService;
30
	@Autowired
31
	private EmployeeManagementService employeeManagementService;
27 32
28
    /**
29
     * 分页查询用户信息
30
     */
31
    @ResponseBody
32
    @RequestMapping("/queryWorkEmployee")
33
    public CommonResponse<PageBean<UserDto>> queryWorkEmployee(@RequestBody CommonRequest<UserDto> request) throws Exception {
33
	/**
34
	 * 分页查询用户信息
35
	 */
36
	@ResponseBody
37
	@RequestMapping("/queryWorkEmployee")
38
	public CommonResponse<PageBean<UserDto>> queryWorkEmployee(@RequestBody CommonRequest<UserDto> request)
39
			throws Exception {
34 40
		/*UserDto userDto = new UserDto();
35 41
		userDto.setOrgId(params.get("orgId"));
36 42
		userDto.setCode(params.get("code"));
37 43
		userDto.setName(params.get("name"));
38 44
		// TODO 组织编码
39 45
		userDto.setOrgCode("0000");
40
46
		
41 47
		// 当前页数
42 48
		int pageNumber  = Integer.parseInt(params.get("pageNumber"));
43 49
		// 每页条数
44 50
		int pageSize = Integer.parseInt(params.get("pageSize"));
45
51
		
46 52
		CommonRequest<UserDto> request=new CommonRequest<UserDto>(userDto, pageNumber, pageSize);
47
*/
48
        //CommonRequest<UserDto> request = CommonRequest.<UserDto>builder().data(userDto).pageNumber(pageNum).pageSize(pageSize).build();
49
50
        return employeeManagementService.queryWorkEmployee(request);
51
    }
52
53
    /**
54
     * 增加用户信息
55
     */
56
    @ResponseBody
57
    @RequestMapping("/createWorkEmployee")
58
    public CommonResponse<Void> createWorkEmployee(@RequestBody EmployeeDto employeeDto) throws Exception {
59
        return employeeManagementService.createWorkEmployee(employeeDto);
60
    }
61
62
    /**
63
     * 删除用户信息
64
     */
65
    @ResponseBody
66
    @RequestMapping("/deleteWorkEmployee")
67
    public CommonResponse<Void> deleteWorkEmployee(@RequestBody Map<String, String> params) throws Exception {
68
        if (params == null || params.get("ids") == null || "".equals(params.get("ids"))) {
69
            return CommonResponse.fail("500", "删除失败");
70
        }
71
72
        return employeeManagementService.deleteWorkEmployee(params);
73
    }
74
75
    /**
76
     * 修改用户信息
77
     */
78
    @ResponseBody
79
    @RequestMapping("/modifyWorkEmployee")
80
    public CommonResponse<Void> modifyWorkEmployee(@RequestBody EmployeeDto employeeDto) throws Exception {
81
        if (employeeDto == null || employeeDto.getId() == null || "".equals(employeeDto.getId())) {
82
            return CommonResponse.fail("500", "修改失败");
83
        }
84
85
        return employeeManagementService.modifyWorkEmployee(employeeDto);
86
    }
53
		*/
54
		// CommonRequest<UserDto> request = CommonRequest.<UserDto>builder().data(userDto).pageNumber(pageNum).pageSize(pageSize).build();
55
56
		return employeeManagementService.queryWorkEmployee(request);
57
	}
58
59
	/**
60
	 * 增加用户信息
61
	 */
62
	@ResponseBody
63
	@RequestMapping("/createWorkEmployee")
64
	public CommonResponse<Void> createWorkEmployee(@RequestBody EmployeeDto employeeDto) throws Exception {
65
		return employeeManagementService.createWorkEmployee(employeeDto);
66
	}
67
68
	/**
69
	 * 删除用户信息
70
	 */
71
	@ResponseBody
72
	@RequestMapping("/deleteWorkEmployee")
73
	public CommonResponse<Void> deleteWorkEmployee(@RequestBody Map<String, String> params) throws Exception {
74
		if (params == null || params.get("ids") == null || "".equals(params.get("ids"))) {
75
			return CommonResponse.fail("500", "删除失败");
76
		}
77
78
		return employeeManagementService.deleteWorkEmployee(params);
79
	}
80
81
	/**
82
	 * 修改用户信息
83
	 */
84
	@ResponseBody
85
	@RequestMapping("/modifyWorkEmployee")
86
	public CommonResponse<Void> modifyWorkEmployee(@RequestBody EmployeeDto employeeDto) throws Exception {
87
		if (employeeDto == null || employeeDto.getId() == null || "".equals(employeeDto.getId())) {
88
			return CommonResponse.fail("500", "修改失败");
89
		}
90
91
		return employeeManagementService.modifyWorkEmployee(employeeDto);
92
	}
93
94
	/**
95
	 * 查询公司列表
96
	 * 部门的根节点为集团,集团的下一级为公司,公司的下一级为部门
97
	 * @return
98
	 * @throws Exception
99
	 */
100
	@ResponseBody
101
	@RequestMapping("/queryCompanyList")
102
	public CommonResponse<List<Organization>> queryCompanyList() throws Exception {
103
		return employeeManagementService.queryChildOrgById(EbcConstant.ORGANIZE_ROOT_ID);
104
	}
105
106
	/**
107
	 * 根据部门ID查询子部门列表
108
	 * @param orgId
109
	 * @return
110
	 * @throws Exception
111
	 */
112
	@ResponseBody
113
	@RequestMapping("/queryChildOrgById")
114
	public CommonResponse<List<Organization>> queryChildOrgById(@RequestParam(required = false) Long orgId)
115
			throws Exception {
116
		if (orgId == null || orgId < 0) {
117
			return CommonResponse.ok(new ArrayList<Organization>());
118
		}
119
120
		return employeeManagementService.queryChildOrgById(orgId);
121
	}
122
123
	/**
124
	 * 根据部门ID查询下级及下下级部门列表
125
	 * @param orgId
126
	 * @return
127
	 * @throws Exception
128
	 */
129
	@ResponseBody
130
	@RequestMapping("/queryCycleChildOrg")
131
	public CommonResponse<List<Organization>> queryCycleChildOrg(@RequestParam(required = false) Long orgId)
132
			throws Exception {
133
		if (orgId == null || orgId < 0) {
134
			return CommonResponse.ok(new ArrayList<Organization>());
135
		}
87 136
137
		return employeeManagementService.queryCycleChildOrg(orgId);
138
	}
88 139
}

+ 12 - 0
security-protection-service/src/main/java/com/ai/bss/security/protection/service/impl/EmployeeManagementServiceImpl.java

@ -77,4 +77,16 @@ public class EmployeeManagementServiceImpl implements EmployeeManagementService
77 77
		return employeeService.modifyEmployee(request);
78 78
	}
79 79
80
	@Override
81
	public CommonResponse<List<Organization>> queryChildOrgById(Long orgId) {
82
		CommonRequest<Long> organize=new CommonRequest<Long>(orgId);
83
		return organizationQuery.querySubOrgByOrgId(organize);
84
	}
85
86
	@Override
87
	public CommonResponse<List<Organization>> queryCycleChildOrg(Long orgId) {
88
		CommonRequest<Long> organize=new CommonRequest<Long>(orgId);
89
		return organizationQuery.queryAllSubOrgByOrgId(organize);
90
	}
91
80 92
}

+ 17 - 0
security-protection-service/src/main/java/com/ai/bss/security/protection/service/interfaces/EmployeeManagementService.java

@ -3,6 +3,8 @@ package com.ai.bss.security.protection.service.interfaces;
3 3
import java.util.List;
4 4
import java.util.Map;
5 5
6
import org.springframework.web.bind.annotation.RequestParam;
7
6 8
import com.ai.abc.api.model.CommonRequest;
7 9
import com.ai.abc.api.model.CommonResponse;
8 10
import com.ai.bss.characteristic.spec.model.CharacteristicSpecValue;
@ -44,4 +46,19 @@ public interface EmployeeManagementService {
44 46
	 */
45 47
	CommonResponse<Void> modifyWorkEmployee(EmployeeDto employeeDto);
46 48
49
	/**
50
	 * 根据部门ID查询子部门列表
51
	 * @param orgId
52
	 * @return
53
	 */
54
	CommonResponse<List<Organization>> queryChildOrgById(Long orgId);
55
	
56
	/**
57
	 * 根据部门ID查询下级及下下级部门列表
58
	 * @param orgId
59
	 * @return
60
	 */
61
	CommonResponse<List<Organization>> queryCycleChildOrg(Long orgId);
62
	
63
	
47 64
}

+ 3 - 0
security-protection-service/src/main/java/com/ai/bss/security/protection/utils/EbcConstant.java

@ -12,6 +12,9 @@ public class EbcConstant {
12 12
	// 每页默认查询条数
13 13
	public static final int DEFAULT_PAGE_SIZE = 20;
14 14
15
	// 部门列表的根节点(部门的根节点为集团,集团的下一级为公司,公司的下一级为部门)
16
	public static final Long ORGANIZE_ROOT_ID=1L;
17
	
15 18
	// 异常考勤查询常量异常取值 abnormal,
16 19
	public static final String ATTENDANCE_STATUSTYPE_ABNORMAL = "ABNORMAL";
17 20