ソースを参照

Merge remote-tracking branch 'origin/master'

wangdong6 4 年 前
コミット
35d93804b9

+ 67 - 0
security-protection-service/src/main/java/com/ai/bss/security/protection/controller/InAndOutRecordController.java

@ -0,0 +1,67 @@
1
package com.ai.bss.security.protection.controller;
2
3
4
import com.ai.abc.api.model.CommonResponse;
5
import com.ai.bss.components.common.model.PageBean;
6
import com.ai.bss.security.protection.model.AiQuery;
7
import com.ai.bss.security.protection.model.AttendanceReport;
8
import com.ai.bss.security.protection.service.interfaces.AttendanceReportService;
9
import com.ai.bss.security.protection.service.interfaces.InAndOutRecordService;
10
import com.ai.bss.security.protection.utils.EbcConstant;
11
import org.slf4j.Logger;
12
import org.slf4j.LoggerFactory;
13
import org.springframework.beans.factory.annotation.Autowired;
14
import org.springframework.stereotype.Controller;
15
import org.springframework.web.bind.annotation.ModelAttribute;
16
import org.springframework.web.bind.annotation.RequestMapping;
17
import org.springframework.web.bind.annotation.ResponseBody;
18
19
import java.util.HashMap;
20
import java.util.Map;
21
22
/**
23
 * 进出记录
24
 */
25
@Controller
26
@RequestMapping("/inAndOutRecord")
27
public class InAndOutRecordController {
28
	Logger logger = LoggerFactory.getLogger(InAndOutRecordController.class);
29
30
	@Autowired
31
	InAndOutRecordService inAndOutRecordService;
32
33
	/**
34
	 * 分页查询进出记录 (查询识别详情)
35
	 * @param  aiQuery
36
	 *                                workOrgRoleId: 组织标识
37
	 *                                aiIdenModel: AI识别模型
38
	 *                                relateEmployeeRoleId: 员工ID
39
	 *                                relateEmployeeName : 员工名称(精确匹配)
40
	 *                                relateEmployeeNameAsLike : 员工名称(模糊匹配)
41
	 *                                beginTime: 执行时间(开始)
42
	 *                                endTime: 执行时间(结束)
43
	 */
44
45
	@ResponseBody
46
	@RequestMapping("/queryPageInAndOutRecord")
47
	public CommonResponse<PageBean<Map<String,Object>>> queryPageInAndOutRecord(@ModelAttribute AiQuery aiQuery) throws Exception {
48
		// 当前页数
49
		int pageNumber = aiQuery.getPageNumber() < 1 ? 1 : aiQuery.getPageNumber();
50
		// 每页条数
51
		int pageSize = aiQuery.getPageSize() < 1 ? EbcConstant.DEFAULT_PAGE_SIZE : aiQuery.getPageSize();
52
53
		Map<String, Object> params = new HashMap<>();
54
		params.put("relateEmployeeRoleId",aiQuery.getRelateEmployeeRoleId());
55
		params.put("relateEmployeeName",aiQuery.getRelateEmployeeName());
56
		params.put("relateEmployeeNameAsLike",aiQuery.getRelateEmployeeNameAsLike());
57
		params.put("beginTime",aiQuery.getBeginTime());
58
		params.put("endTime",aiQuery.getEndTime());
59
60
		CommonResponse<PageBean<Map<String,Object>>> commonResponse = inAndOutRecordService.queryPageInAndOutRecord(params, pageNumber, pageSize);
61
62
63
		return commonResponse;
64
65
	}
66
67
}

+ 38 - 0
security-protection-service/src/main/java/com/ai/bss/security/protection/controller/UploadFileController.java

@ -0,0 +1,38 @@
1
package com.ai.bss.security.protection.controller;
2
3
import org.apache.commons.lang.StringUtils;
4
import org.springframework.beans.factory.annotation.Autowired;
5
import org.springframework.stereotype.Controller;
6
import org.springframework.web.bind.annotation.RequestMapping;
7
import org.springframework.web.bind.annotation.RequestParam;
8
import org.springframework.web.bind.annotation.ResponseBody;
9
10
import com.ai.abc.api.model.CommonResponse;
11
import com.ai.bss.security.protection.service.interfaces.UploadFileService;
12
13
@Controller
14
@RequestMapping("/uploadFile")
15
public class UploadFileController {
16
17
	@Autowired
18
	private UploadFileService uploadFileService;
19
20
	/**
21
	 * 上传设备照片
22
	 * @param meFile
23
	 * @return
24
	 * @throws Exception
25
	 */
26
	@ResponseBody
27
	@RequestMapping("/getFileUrl")
28
	public CommonResponse<String> getFileUrl(@RequestParam String fileName) throws Exception {
29
		if (StringUtils.isEmpty(fileName)) {
30
			return CommonResponse.fail("501", "获取失败");
31
		}
32
33
		String minioFileUrl = uploadFileService.getFileUrl(fileName);
34
35
		return CommonResponse.ok(minioFileUrl);
36
	}
37
38
}

+ 10 - 2
security-protection-service/src/main/java/com/ai/bss/security/protection/model/AiQuery.java

@ -37,9 +37,9 @@ public class AiQuery {
37 37
38 38
    private String workEmployeeRoleId; // 处理人
39 39
40
    private String beginTime; // 报警开始时间
40
    private String beginTime; // 报警开始时间  执行时间(开始)
41 41
42
    private String endTime; // 报警结束时间
42
    private String endTime; // 报警结束时间  执行时间(结束)
43 43
44 44
    private String workOrgRoleId; // 组织ID
45 45
@ -48,4 +48,12 @@ public class AiQuery {
48 48
    private String workTaskId; // 任务ID
49 49
50 50
    private String processMemo; // 处理详情必选
51
52
    private String relateEmployeeRoleId; // 员工ID
53
54
    private String relateEmployeeName; // 员工名称(精确匹配)
55
56
    private String relateEmployeeNameAsLike; // 员工名称(模糊匹配)
57
58
51 59
}

+ 65 - 0
security-protection-service/src/main/java/com/ai/bss/security/protection/service/impl/InAndOutRecordServiceImpl.java

@ -0,0 +1,65 @@
1
package com.ai.bss.security.protection.service.impl;
2
3
import com.ai.abc.api.model.CommonRequest;
4
import com.ai.abc.api.model.CommonResponse;
5
import com.ai.bss.components.common.model.PageBean;
6
import com.ai.bss.security.protection.service.interfaces.InAndOutRecordService;
7
import com.ai.bss.user.dto.EmployeeDto;
8
import com.ai.bss.user.service.api.EmployeeService;
9
import com.ai.bss.work.safety.service.api.AiTaskQuery;
10
import org.apache.bcel.verifier.statics.LONG_Upper;
11
import org.springframework.beans.factory.annotation.Autowired;
12
import org.springframework.stereotype.Service;
13
14
import java.util.List;
15
import java.util.Map;
16
17
/**
18
 * @Auther: 王超
19
 * @Date: 2020/12/15 14:34
20
 * @Description:
21
 */
22
@Service
23
public class InAndOutRecordServiceImpl implements InAndOutRecordService {
24
25
    @Autowired
26
    AiTaskQuery aiTaskQuery;
27
28
    @Autowired
29
    EmployeeService employeeService;
30
31
32
    @Override
33
    public CommonResponse<PageBean<Map<String, Object>>> queryPageInAndOutRecord(Map<String, Object> params, int pageNumber, int pageSize) {
34
35
        CommonResponse<PageBean<Map<String, Object>>> queryResult = aiTaskQuery.queryAiIdenLog(new CommonRequest<>(params, pageNumber, pageSize));
36
37
        List<Map<String, Object>> inAndOutRecordList = queryResult.getData().getData();
38
39
        if(null!=inAndOutRecordList&&inAndOutRecordList.size()>0){
40
            inAndOutRecordList.forEach((inAndOutRecord)->{
41
                if(null!=inAndOutRecord.get("relateEmployeeRoleId")){
42
                    long relateEmployeeRoleId = Long.parseLong((String) inAndOutRecord.get("relateEmployeeRoleId"));
43
44
                    EmployeeDto employeeDto = new EmployeeDto();
45
                    employeeDto.setId(relateEmployeeRoleId);
46
                    CommonRequest<EmployeeDto> request = CommonRequest.<EmployeeDto>builder().data(employeeDto).build();
47
                    CommonResponse<EmployeeDto> response = employeeService.queryEmployee(request);
48
                    EmployeeDto employee = response.getData();
49
50
                    if(employee!=null){
51
                        inAndOutRecord.put("headerUrl", employee.getHeaderUrl());
52
                        inAndOutRecord.put("name", employee.getName());
53
                        inAndOutRecord.put("mainJobPosition", employee.getMainJobPosition());
54
                        inAndOutRecord.put("orgName", employee.getOrgName());
55
                        inAndOutRecord.put("organizeCode", employee.getOrganizeCode());
56
                        inAndOutRecord.put("code", employee.getCode());
57
                    }
58
                }
59
            });
60
        }
61
62
        return queryResult;
63
    }
64
65
}

+ 3 - 3
security-protection-service/src/main/java/com/ai/bss/security/protection/service/impl/UploadFileServiceImpl.java

@ -91,7 +91,7 @@ public class UploadFileServiceImpl implements UploadFileService {
91 91
	}
92 92
93 93
	@Override
94
	public List<Map<String, Object>> getFileUrl(List<Map<String, Object>> minioFileListMap, String mapkey,
94
	public List<Map<String, Object>> getFileUrlForListMap(List<Map<String, Object>> minioFileListMap, String mapkey,
95 95
			String minioFileUrlKey) throws Exception {
96 96
		if (CollectionUtils.isEmpty(minioFileListMap)) {
97 97
			log.debug("批量获取文件的url为空");
@ -100,11 +100,11 @@ public class UploadFileServiceImpl implements UploadFileService {
100 100
101 101
		String minioFileName = String.valueOf(minioFileListMap.get(0).get(mapkey));
102 102
103
		return getFileUrl(minioFileListMap, mapkey, minioFileUrlKey, getBucketName(minioFileName));
103
		return getFileUrlForListMap(minioFileListMap, mapkey, minioFileUrlKey, getBucketName(minioFileName));
104 104
	}
105 105
106 106
	@Override
107
	public List<Map<String, Object>> getFileUrl(List<Map<String, Object>> minioFileListMap, String mapkey,
107
	public List<Map<String, Object>> getFileUrlForListMap(List<Map<String, Object>> minioFileListMap, String mapkey,
108 108
			String minioFileUrlKey, String bucketName) throws Exception {
109 109
		if (CollectionUtils.isEmpty(minioFileListMap)) {
110 110
			log.debug("批量获取文件的url为空");

+ 11 - 0
security-protection-service/src/main/java/com/ai/bss/security/protection/service/interfaces/InAndOutRecordService.java

@ -0,0 +1,11 @@
1
package com.ai.bss.security.protection.service.interfaces;
2
3
import com.ai.abc.api.model.CommonResponse;
4
import com.ai.bss.components.common.model.PageBean;
5
6
import java.util.Map;
7
8
public interface InAndOutRecordService {
9
    CommonResponse<PageBean<Map<String, Object>>> queryPageInAndOutRecord(Map<String, Object> params, int pageNumber, int pageSize);
10
11
}

+ 13 - 10
security-protection-service/src/main/java/com/ai/bss/security/protection/service/interfaces/UploadFileService.java

@ -31,24 +31,27 @@ public interface UploadFileService {
31 31
32 32
	/**
33 33
	 * 批量获取文件的url地址
34
	 * @param minioFileListMap
35
	 * @param mapkey
36
	 * @param minioFileUrlKey
34
	 * @param minioFileListMap 数据列表
35
	 * @param mapkey 数据列表中minioFileName的key
36
	 * @param minioFileUrlKey 数据列表中minioFileUrl的key
37 37
	 * @return
38 38
	 * @throws Exception
39 39
	 */
40
	List<Map<String,Object>> getFileUrl(List<Map<String,Object>> minioFileListMap,String mapkey,String minioFileUrlKey) throws Exception;
41
	
40
	List<Map<String, Object>> getFileUrlForListMap(List<Map<String, Object>> minioFileListMap, String mapkey,
41
			String minioFileUrlKey) throws Exception;
42
42 43
	/**
43 44
	 * 批量获取文件的url地址
44
	 * @param minioFileListMap
45
	 * @param key
46
	 * @param bucketName
45
	 * @param minioFileListMap 数据列表
46
	 * @param mapkey 数据列表中minioFileName的key
47
	 * @param minioFileUrlKey 数据列表中minioFileUrl的key
48
	 * @param bucketName 存储文件的桶名(文件夹)
47 49
	 * @return
48 50
	 * @throws Exception
49 51
	 */
50
	List<Map<String,Object>> getFileUrl(List<Map<String,Object>> minioFileListMap,String mapkey,String minioFileUrlKey, String bucketName) throws Exception;
51
	
52
	List<Map<String, Object>> getFileUrlForListMap(List<Map<String, Object>> minioFileListMap, String mapkey,
53
			String minioFileUrlKey, String bucketName) throws Exception;
54
52 55
	/**
53 56
	 * 移除文件
54 57
	 * @param minioFileName minio文件标识