Ver Código Fonte

Merge branch 'master' of http://10.1.235.20:3000/asiainfo/ebc

wangchao 4 anos atrás
pai
commit
da8b46c6ba

+ 1 - 1
ebc-middle-platform/src/modules/attendance/track.vue

@ -31,7 +31,7 @@
31 31
        <t-table-column prop="entityName" label="姓名"></t-table-column>
32 32
        <t-table-column prop="entityPosition" label="职务"></t-table-column>
33 33
        <t-table-column prop="mapAreaName" label="位置区域"></t-table-column>
34
        <t-table-column prop="durationTime" label="停留时长(h)"></t-table-column>
34
        <t-table-column prop="durationTime" label="停留时长"></t-table-column>
35 35
        <t-table-column prop="inTime" :formatter="timestampToTime" label="进入时间"></t-table-column>
36 36
        <t-table-column prop="outTime" :formatter="timestampToTime" label="离开时间"></t-table-column>
37 37
      </t-table>

+ 98 - 31
security-protection-service/src/main/java/com/ai/bss/security/protection/controller/EmployeeManagementController.java

@ -4,17 +4,20 @@ import java.util.ArrayList;
4 4
import java.util.List;
5 5
import java.util.Map;
6 6
7
import org.apache.commons.lang.StringUtils;
7 8
import org.springframework.beans.factory.annotation.Autowired;
8 9
import org.springframework.stereotype.Controller;
10
import org.springframework.web.bind.annotation.ModelAttribute;
9 11
import org.springframework.web.bind.annotation.RequestBody;
10 12
import org.springframework.web.bind.annotation.RequestMapping;
11 13
import org.springframework.web.bind.annotation.RequestParam;
12 14
import org.springframework.web.bind.annotation.ResponseBody;
15
import org.springframework.web.multipart.MultipartFile;
13 16
14
import com.ai.abc.api.model.CommonRequest;
15 17
import com.ai.abc.api.model.CommonResponse;
16 18
import com.ai.bss.components.common.model.PageBean;
17 19
import com.ai.bss.person.model.Organization;
20
import com.ai.bss.security.protection.model.AttendanceReport;
18 21
import com.ai.bss.security.protection.service.interfaces.EmployeeManagementService;
19 22
import com.ai.bss.security.protection.utils.EbcConstant;
20 23
import com.ai.bss.user.dto.EmployeeDto;
@ -32,63 +35,127 @@ public class EmployeeManagementController {
32 35
33 36
	/**
34 37
	 * 分页查询用户信息
38
	 * @param attendanceReport
39
	 * @return
40
	 * @throws Exception
35 41
	 */
36 42
	@ResponseBody
37
	@RequestMapping("/queryWorkEmployee")
38
	public CommonResponse<PageBean<UserDto>> queryWorkEmployee(@RequestBody CommonRequest<UserDto> request)
43
	@RequestMapping("/queryEmployeeList")
44
	public CommonResponse<PageBean<UserDto>> queryEmployeeList(@ModelAttribute AttendanceReport attendanceReport)
39 45
			throws Exception {
40
		/*UserDto userDto = new UserDto();
41
		userDto.setOrgId(params.get("orgId"));
42
		userDto.setCode(params.get("code"));
43
		userDto.setName(params.get("name"));
44
		// TODO 组织编码
45
		userDto.setOrgCode("0000");
46
		
47 46
		// 当前页数
48
		int pageNumber  = Integer.parseInt(params.get("pageNumber"));
47
		int pageNumber = attendanceReport.getPageNumber() < 1 ? 1 : attendanceReport.getPageNumber();
49 48
		// 每页条数
50
		int pageSize = Integer.parseInt(params.get("pageSize"));
51
		
52
		CommonRequest<UserDto> request=new CommonRequest<UserDto>(userDto, pageNumber, pageSize);
53
		*/
54
		// CommonRequest<UserDto> request = CommonRequest.<UserDto>builder().data(userDto).pageNumber(pageNum).pageSize(pageSize).build();
49
		int pageSize = attendanceReport.getPageSize() < 1 ? EbcConstant.DEFAULT_PAGE_SIZE
50
				: attendanceReport.getPageSize();
51
52
		UserDto userDto = new UserDto();
53
		if (StringUtils.isNotEmpty(attendanceReport.getOrgId())) {
54
			userDto.setOrgId(attendanceReport.getOrgId());
55
		}
55 56
56
		return employeeManagementService.queryWorkEmployee(request);
57
		return employeeManagementService.queryEmployeeList(userDto, pageNumber, pageSize);
57 58
	}
58 59
59 60
	/**
60
	 * 增加用户信息
61
	 * 查询单个用户信息
62
	 * @param employeeId
63
	 * @return
64
	 * @throws Exception
61 65
	 */
62 66
	@ResponseBody
63
	@RequestMapping("/createWorkEmployee")
64
	public CommonResponse<Void> createWorkEmployee(@RequestBody EmployeeDto employeeDto) throws Exception {
65
		return employeeManagementService.createWorkEmployee(employeeDto);
67
	@RequestMapping("/queryOneEmployee")
68
	public CommonResponse<EmployeeDto> queryOneEmployee(@RequestParam Long employeeId) throws Exception {
69
		if (employeeId == null) {
70
			return CommonResponse.fail("500", "操作失败");
71
		}
72
73
		return employeeManagementService.queryOneEmployee(employeeId);
66 74
	}
67 75
68 76
	/**
69
	 * 删除用户信息
77
	 * 新增用户信息
78
	 * @param employeeDto
79
	 * @return
80
	 * @throws Exception
70 81
	 */
71 82
	@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", "删除失败");
83
	@RequestMapping("/createEmployee")
84
	public CommonResponse<Void> createEmployee(@RequestBody EmployeeDto employeeDto) throws Exception {
85
		if (employeeDto == null || StringUtils.isEmpty(employeeDto.getName())) {
86
			return CommonResponse.fail("500", "新增失败");
76 87
		}
77 88
78
		return employeeManagementService.deleteWorkEmployee(params);
89
		return employeeManagementService.createEmployee(employeeDto);
79 90
	}
80 91
81 92
	/**
82 93
	 * 修改用户信息
94
	 * @param employeeDto
95
	 * @return
96
	 * @throws Exception
83 97
	 */
84 98
	@ResponseBody
85
	@RequestMapping("/modifyWorkEmployee")
86
	public CommonResponse<Void> modifyWorkEmployee(@RequestBody EmployeeDto employeeDto) throws Exception {
87
		if (employeeDto == null || employeeDto.getId() == null || "".equals(employeeDto.getId())) {
99
	@RequestMapping("/modifyEmployee")
100
	public CommonResponse<Void> modifyEmployee(@RequestBody EmployeeDto employeeDto) throws Exception {
101
		if (employeeDto == null || employeeDto.getId() == null || StringUtils.isEmpty(employeeDto.getName())) {
88 102
			return CommonResponse.fail("500", "修改失败");
89 103
		}
90 104
91
		return employeeManagementService.modifyWorkEmployee(employeeDto);
105
		return employeeManagementService.modifyEmployee(employeeDto);
106
	}
107
108
	/**
109
	 * 删除用户信息
110
	 * @param employeeId
111
	 * @return
112
	 * @throws Exception
113
	 */
114
	@ResponseBody
115
	@RequestMapping("/deleteEmployee")
116
	public CommonResponse<Void> deleteEmployee(@RequestParam String employeeId) throws Exception {
117
		if (StringUtils.isEmpty(employeeId)) {
118
			return CommonResponse.fail("500", "删除失败");
119
		}
120
121
		return employeeManagementService.deleteEmployee(employeeId);
122
	}
123
124
	/**
125
	 * 上传用户照片
126
	 * @param meFile
127
	 * @param pictureUrl
128
	 * @return
129
	 * @throws Exception
130
	 */
131
	@ResponseBody
132
	@RequestMapping("/uploadEmployeePicture")
133
	public CommonResponse<Map<String, String>> uploadEmployeePicture(
134
			@RequestParam(value = "picture") MultipartFile meFile, @RequestParam(required = false) String pictureUrl)
135
			throws Exception {
136
		if (meFile == null || StringUtils.isEmpty(meFile.getOriginalFilename())) {
137
			return CommonResponse.fail("500", "上传失败");
138
		}
139
140
		Map<String, String> resultMap = employeeManagementService.uploadEmployeePicture(meFile, pictureUrl);
141
142
		return CommonResponse.ok(resultMap);
143
	}
144
145
	/**
146
	 * 审核用户照片
147
	 * @param employeeId
148
	 * @return
149
	 * @throws Exception
150
	 */
151
	@ResponseBody
152
	@RequestMapping("/auditEmployeePicture")
153
	public CommonResponse<Void> auditEmployeePicture(@RequestParam String employeeId) throws Exception {
154
		if (StringUtils.isEmpty(employeeId)) {
155
			return CommonResponse.fail("500", "审核失败");
156
		}
157
158
		return employeeManagementService.auditEmployeePicture(employeeId);
92 159
	}
93 160
94 161
	/**

+ 53 - 13
security-protection-service/src/main/java/com/ai/bss/security/protection/service/impl/EmployeeManagementServiceImpl.java

@ -1,5 +1,6 @@
1 1
package com.ai.bss.security.protection.service.impl;
2 2
3
import java.util.HashMap;
3 4
import java.util.List;
4 5
import java.util.Map;
5 6
@ -7,21 +8,21 @@ import org.slf4j.Logger;
7 8
import org.slf4j.LoggerFactory;
8 9
import org.springframework.beans.factory.annotation.Autowired;
9 10
import org.springframework.stereotype.Service;
11
import org.springframework.web.multipart.MultipartFile;
10 12
11 13
import com.ai.abc.api.model.CommonRequest;
12 14
import com.ai.abc.api.model.CommonResponse;
13
import com.ai.bss.characteristic.spec.model.CharacteristicSpecValue;
14 15
import com.ai.bss.components.common.model.PageBean;
16
import com.ai.bss.components.minio.config.MinioConfig;
15 17
import com.ai.bss.person.model.Organization;
16 18
import com.ai.bss.person.service.api.OrganizationQuery;
17 19
import com.ai.bss.security.protection.service.interfaces.CharSpecService;
18 20
import com.ai.bss.security.protection.service.interfaces.EmployeeManagementService;
19
import com.ai.bss.security.protection.utils.EbcConstant;
21
import com.ai.bss.security.protection.service.interfaces.UploadFileService;
20 22
import com.ai.bss.user.dto.EmployeeDto;
21 23
import com.ai.bss.user.dto.UserDto;
22 24
import com.ai.bss.user.service.api.EmployeeService;
23 25
import com.ai.bss.user.service.api.UserDtoQuery;
24
import com.ai.bss.worker.service.api.EmployeeTerminalRelaQuery;
25 26
26 27
@Service
27 28
public class EmployeeManagementServiceImpl implements EmployeeManagementService {
@ -35,26 +36,45 @@ public class EmployeeManagementServiceImpl implements EmployeeManagementService
35 36
36 37
	@Autowired
37 38
	private EmployeeService employeeService;
39
	
40
	@Autowired
41
	private UploadFileService uploadFileService;
42
43
	@Autowired
44
	private MinioConfig minioConfig;
45
46
	@Autowired
47
	private CharSpecService charSpecService;
38 48
39 49
	@Override
40
	public CommonResponse<PageBean<UserDto>> queryWorkEmployee(CommonRequest<UserDto> request) throws Exception {
41
		// TODO 组织编码
42
		// request.getData().setOrgCode("0000");
50
	public CommonResponse<PageBean<UserDto>> queryEmployeeList(UserDto userDto,int pageNumber,int pageSize) throws Exception {
51
		CommonRequest<UserDto> request=new CommonRequest<UserDto>(userDto,pageNumber, pageSize);
43 52
		return userDtoQuery.queryWorkEmployee(request);
44 53
	}
45 54
46 55
	@Override
47
	public CommonResponse<Void> createWorkEmployee(EmployeeDto employeeDto) throws Exception {
56
	public CommonResponse<EmployeeDto> queryOneEmployee(Long employeeId) throws Exception{
57
		// TODO Auto-generated method stub
58
		return null;
59
	}
60
	
61
	@Override
62
	public CommonResponse<Void> createEmployee(EmployeeDto employeeDto) throws Exception {
48 63
		CommonRequest<EmployeeDto> request = CommonRequest.<EmployeeDto>builder().data(employeeDto).build();
49 64
		return employeeService.createWorkEmployee(request);
50 65
	}
51 66
52 67
	@Override
53
	public CommonResponse<Void> deleteWorkEmployee(Map<String, String> params) {
68
	public CommonResponse<Void> modifyEmployee(EmployeeDto employeeDto) {
69
		CommonRequest<EmployeeDto> request = CommonRequest.<EmployeeDto>builder().data(employeeDto).build();
70
		return employeeService.modifyEmployee(request);
71
	}
72
	
73
	@Override
74
	public CommonResponse<Void> deleteEmployee(String employeeId) {
54 75
		boolean success = true;
55 76
56
		String ids = params.get("ids");
57
		String[] idsArray = ids.split(",");
77
		String[] idsArray = employeeId.split(",");
58 78
		EmployeeDto employeeDto = new EmployeeDto();
59 79
		for (String id : idsArray) {
60 80
			long lid = Long.parseLong(id);
@ -72,12 +92,32 @@ public class EmployeeManagementServiceImpl implements EmployeeManagementService
72 92
	}
73 93
74 94
	@Override
75
	public CommonResponse<Void> modifyWorkEmployee(EmployeeDto employeeDto) {
76
		CommonRequest<EmployeeDto> request = CommonRequest.<EmployeeDto>builder().data(employeeDto).build();
77
		return employeeService.modifyEmployee(request);
95
	public Map<String, String> uploadEmployeePicture(MultipartFile meFile, String pictureUrl) throws Exception {
96
		/*if (StringUtils.isNotBlank(pictureUrl) && !"#".equals(pictureUrl)) {
97
	 	//删除照片
98
		uploadFileService.removeFile(pictureUrl, minioConfig.getBucketToolImage());
99
	}*/
100
101
	// 上传
102
	String minioFileName = uploadFileService.uploadFile(meFile, minioConfig.getBucketHeaderImage());
103
104
	// 获取照片的url地址
105
	String toolPictureUrl = uploadFileService.getFileUrl(minioFileName, minioConfig.getBucketHeaderImage());
106
107
	// 返回信息
108
	Map<String, String> resultMap = new HashMap<String, String>();
109
	resultMap.put("pictureUrl", minioFileName);
110
	resultMap.put("toolPictureUrl", toolPictureUrl);
111
	return resultMap;
78 112
	}
79 113
80 114
	@Override
115
	public CommonResponse<Void> auditEmployeePicture(String employeeId) throws Exception {
116
		// TODO Auto-generated method stub
117
		return null;
118
	}
119
	
120
	@Override
81 121
	public CommonResponse<List<Organization>> queryChildOrgById(Long orgId) {
82 122
		CommonRequest<Long> organize=new CommonRequest<Long>(orgId);
83 123
		return organizationQuery.querySubOrgByOrgId(organize);

+ 43 - 18
security-protection-service/src/main/java/com/ai/bss/security/protection/service/interfaces/EmployeeManagementService.java

@ -3,48 +3,74 @@ 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;
6
import org.springframework.web.multipart.MultipartFile;
7 7
8
import com.ai.abc.api.model.CommonRequest;
9 8
import com.ai.abc.api.model.CommonResponse;
10
import com.ai.bss.characteristic.spec.model.CharacteristicSpecValue;
11 9
import com.ai.bss.components.common.model.PageBean;
12 10
import com.ai.bss.person.model.Organization;
13 11
import com.ai.bss.user.dto.EmployeeDto;
14 12
import com.ai.bss.user.dto.UserDto;
15
import com.ai.bss.worker.model.EmployeeTerminalRelaDto;
16 13
17 14
public interface EmployeeManagementService {
18 15
19 16
	/**
20
	 * 人员列表分页查询
21
	 * @param request
17
	 * 分页查询用户信息
18
	 * @param userDto
19
	 * @param pageNumber
20
	 * @param pageSize
22 21
	 * @return
23 22
	 * @throws Exception
24 23
	 */
25
	CommonResponse<PageBean<UserDto>> queryWorkEmployee(CommonRequest<UserDto> request) throws Exception;
24
	CommonResponse<PageBean<UserDto>> queryEmployeeList(UserDto userDto, int pageNumber, int pageSize) throws Exception;
26 25
27 26
	/**
28
	 * 创建人员
29
	 * @param employeeDto
27
	 * 查询单个用户信息
28
	 * @param employeeId
30 29
	 * @return
31 30
	 * @throws Exception
32 31
	 */
33
	CommonResponse<Void> createWorkEmployee(EmployeeDto employeeDto) throws Exception;
32
	CommonResponse<EmployeeDto> queryOneEmployee(Long employeeId) throws Exception;
34 33
35 34
	/**
36
	 * 删除人员
37
	 * @param params
35
	 * 新增用户信息
36
	 * @param employeeDto
38 37
	 * @return
38
	 * @throws Exception
39 39
	 */
40
	CommonResponse<Void> deleteWorkEmployee(Map<String, String> params);
40
	CommonResponse<Void> createEmployee(EmployeeDto employeeDto) throws Exception;
41 41
42 42
	/**
43
	 * 修改人员
43
	 * 修改用户信息
44 44
	 * @param employeeDto
45 45
	 * @return
46
	 * @throws Exception
46 47
	 */
47
	CommonResponse<Void> modifyWorkEmployee(EmployeeDto employeeDto);
48
	CommonResponse<Void> modifyEmployee(EmployeeDto employeeDto) throws Exception;
49
50
	/**
51
	 * 删除用户信息
52
	 * @param employeeId
53
	 * @return
54
	 * @throws Exception
55
	 */
56
	CommonResponse<Void> deleteEmployee(String employeeId) throws Exception;
57
58
	/**
59
	 * 上传用户照片
60
	 * @param meFile
61
	 * @param pictureUrl
62
	 * @return
63
	 * @throws Exception
64
	 */
65
	Map<String, String> uploadEmployeePicture(MultipartFile meFile, String pictureUrl) throws Exception;
66
67
	/**
68
	 * 审核用户照片
69
	 * @param employeeId
70
	 * @return
71
	 * @throws Exception
72
	 */
73
	CommonResponse<Void> auditEmployeePicture(String employeeId) throws Exception;
48 74
49 75
	/**
50 76
	 * 根据部门ID查询子部门列表
@ -52,13 +78,12 @@ public interface EmployeeManagementService {
52 78
	 * @return
53 79
	 */
54 80
	CommonResponse<List<Organization>> queryChildOrgById(Long orgId);
55
	
81
56 82
	/**
57 83
	 * 根据部门ID查询下级及下下级部门列表
58 84
	 * @param orgId
59 85
	 * @return
60 86
	 */
61 87
	CommonResponse<List<Organization>> queryCycleChildOrg(Long orgId);
62
	
63
	
88
64 89
}