兴安添加我的审核,人脸检测替换宇泛接口
This commit is contained in:
@@ -47,6 +47,12 @@
|
||||
<artifactId>fastdfs-client</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>cn.hutool</groupId>
|
||||
<artifactId>hutool-all</artifactId>
|
||||
<version>5.3.3</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Minio -->
|
||||
<dependency>
|
||||
<groupId>io.minio</groupId>
|
||||
@@ -65,6 +71,10 @@
|
||||
<groupId>com.dcsoft</groupId>
|
||||
<artifactId>dcsoft-common-swagger</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.dcsoft</groupId>
|
||||
<artifactId>dcsoft-common-redis</artifactId>
|
||||
</dependency>
|
||||
|
||||
|
||||
</dependencies>
|
||||
|
||||
@@ -1,49 +1,47 @@
|
||||
package com.dcsoft.file.controller;
|
||||
|
||||
import com.alibaba.csp.sentinel.slots.block.BlockException;
|
||||
import cn.hutool.http.HttpUtil;
|
||||
import com.alibaba.csp.sentinel.slots.block.RuleConstant;
|
||||
import com.alibaba.csp.sentinel.slots.block.flow.FlowRule;
|
||||
import com.alibaba.csp.sentinel.slots.block.flow.FlowRuleManager;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.dcsoft.common.core.domain.R;
|
||||
import com.dcsoft.common.core.exception.ServiceException;
|
||||
import com.dcsoft.file.service.IAlgoService;
|
||||
import com.dcsoft.common.core.utils.StringUtils;
|
||||
import com.dcsoft.common.core.utils.file.FileUtils;
|
||||
import com.dcsoft.common.redis.service.RedisService;
|
||||
import com.dcsoft.file.service.IFaceService;
|
||||
import com.dcsoft.file.utils.*;
|
||||
import com.dcsoft.system.api.RemoteStudentService;
|
||||
import com.dcsoft.file.service.ISysFileService;
|
||||
import com.dcsoft.file.utils.FileUploadUtils;
|
||||
import com.dcsoft.file.utils.ImageToBase64Utils;
|
||||
import com.dcsoft.file.utils.MinioUtil;
|
||||
import com.dcsoft.file.utils.PictureUtils;
|
||||
import com.dcsoft.system.api.domain.SysFile;
|
||||
import io.minio.MinioClient;
|
||||
import io.minio.RemoveObjectArgs;
|
||||
import net.coobird.thumbnailator.Thumbnails;
|
||||
import org.apache.commons.codec.binary.Base64;
|
||||
import org.apache.commons.io.FilenameUtils;
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.aspectj.lang.reflect.MethodSignature;
|
||||
import org.apache.commons.codec.digest.DigestUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.util.ClassUtils;
|
||||
import org.springframework.util.MultiValueMap;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import com.dcsoft.common.core.domain.R;
|
||||
import com.dcsoft.common.core.utils.file.FileUtils;
|
||||
import com.dcsoft.file.service.ISysFileService;
|
||||
import com.dcsoft.system.api.domain.SysFile;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.lang.annotation.Annotation;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static com.dcsoft.file.utils.MinioUtil.getBase64String;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* 文件请求处理
|
||||
@@ -51,11 +49,12 @@ import static com.dcsoft.file.utils.MinioUtil.getBase64String;
|
||||
* @author dcsoft
|
||||
*/
|
||||
@RestController
|
||||
public class SysFileController
|
||||
{
|
||||
public class SysFileController {
|
||||
private static final Logger log = LoggerFactory.getLogger(SysFileController.class);
|
||||
|
||||
/** 获取yml配置类里的桶名称*/
|
||||
/**
|
||||
* 获取yml配置类里的桶名称
|
||||
*/
|
||||
@Value("${minio.bucket-name}")
|
||||
private String bucketName;
|
||||
|
||||
@@ -69,7 +68,7 @@ public class SysFileController
|
||||
private String bucketName3;
|
||||
|
||||
@Autowired
|
||||
private IAlgoService algoService;
|
||||
private RedisService redisService;
|
||||
|
||||
@Autowired
|
||||
private IFaceService faceService;
|
||||
@@ -98,14 +97,27 @@ public class SysFileController
|
||||
@Value("${file.gwurl}")
|
||||
private String filegwurl;
|
||||
|
||||
@Value("${yf.url:http://wo-api.uni-ubi.com}")
|
||||
private String yfUrl;
|
||||
|
||||
@Value("${yf.projectGuid:3C1BA78F6FAD489AA0E6C7D285D8CFDC}")
|
||||
private String yfProjectGuid;
|
||||
|
||||
@Value("${yf.appKey:7E28496B107D45D3B683B143E944D64B}")
|
||||
private String yfAppKey;
|
||||
|
||||
@Value("${yf.appSecret:9D397690DAD64CFE9278FED5C3BCA68F}")
|
||||
private String yfAppSecret;
|
||||
|
||||
private final String yfFaceDetectUrl = "/v2/algor/face/detect";
|
||||
|
||||
|
||||
/**
|
||||
* 文件上传请求
|
||||
*/
|
||||
@PostMapping("upload")
|
||||
public R<SysFile> upload(MultipartFile file)
|
||||
{
|
||||
try
|
||||
{
|
||||
public R<SysFile> upload(MultipartFile file) {
|
||||
try {
|
||||
// 上传并返回访问地址
|
||||
String url = sysFileService.uploadFile(file);
|
||||
SysFile sysFile = new SysFile();
|
||||
@@ -113,9 +125,7 @@ public class SysFileController
|
||||
url = url.replace(fileurl, filegwurl);
|
||||
sysFile.setUrl(url);
|
||||
return R.ok(sysFile);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
} catch (Exception e) {
|
||||
log.error("上传文件失败", e);
|
||||
return R.fail(e.getMessage());
|
||||
}
|
||||
@@ -125,29 +135,23 @@ public class SysFileController
|
||||
* 文件上传请求
|
||||
*/
|
||||
@PostMapping("avatar")
|
||||
public R<SysFile> avatar(@RequestParam("avatarfile") MultipartFile file)
|
||||
{
|
||||
try
|
||||
{
|
||||
public R<SysFile> avatar(@RequestParam("avatarfile") MultipartFile file) {
|
||||
try {
|
||||
// 上传并返回访问地址
|
||||
String url = sysFileService.uploadFile(file);
|
||||
SysFile sysFile = new SysFile();
|
||||
sysFile.setName(FileUtils.getName(url));
|
||||
sysFile.setUrl(url);
|
||||
return R.ok(sysFile);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
} catch (Exception e) {
|
||||
log.error("上传文件失败", e);
|
||||
return R.fail(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping("uploadMinioCar")
|
||||
public R<SysFile> uploadMinioCar(@RequestParam("file") MultipartFile file)
|
||||
{
|
||||
try
|
||||
{
|
||||
public R<SysFile> uploadMinioCar(@RequestParam("file") MultipartFile file) {
|
||||
try {
|
||||
String fileNames = FileUploadUtils.uploadMinio(file, this.bucketName2, file.getName());
|
||||
SysFile sysFile = new SysFile();
|
||||
sysFile.setName(FileUtils.getName(fileNames));
|
||||
@@ -182,13 +186,11 @@ public class SysFileController
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 文件上传请求
|
||||
*/
|
||||
@PostMapping("uploadMinio")
|
||||
public R<SysFile> uploadMinio(MultipartFile file, String fileName)
|
||||
{
|
||||
public R<SysFile> uploadMinio(MultipartFile file, String fileName) {
|
||||
/* //判断压缩图片
|
||||
if((1024 * 1024 * 0.1) <= file.getSize()){
|
||||
// 小于 1M 的
|
||||
@@ -213,8 +215,7 @@ public class SysFileController
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}*/
|
||||
try
|
||||
{
|
||||
try {
|
||||
/*initFlowRules();//
|
||||
// 上传并返回访问地址
|
||||
//上传前进行人脸检测
|
||||
@@ -245,8 +246,7 @@ public class SysFileController
|
||||
* 文件上传请求
|
||||
*/
|
||||
@PostMapping("uploadMinios")
|
||||
public R<SysFile> uploadMinios(MultipartFile file,String fileName)
|
||||
{
|
||||
public R<SysFile> uploadMinios(MultipartFile file, String fileName) {
|
||||
|
||||
//判断压缩图片
|
||||
if ((1024 * 1024 * 0.1) <= file.getSize()) {
|
||||
@@ -274,8 +274,7 @@ public class SysFileController
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
try
|
||||
{
|
||||
try {
|
||||
// 上传并返回访问地址
|
||||
String fileNames = FileUploadUtils.uploadMinio(file, this.bucketName, fileName);
|
||||
SysFile sysFile = new SysFile();
|
||||
@@ -325,6 +324,7 @@ public class SysFileController
|
||||
|
||||
// 上传并返回访问地址
|
||||
String fileNames = FileUploadUtils.uploadMinio(file, this.bucketName1, fileName);
|
||||
// checkPhoto(fileNames);
|
||||
SysFile sysFile = new SysFile();
|
||||
sysFile.setName(FileUtils.getName(fileNames));
|
||||
fileNames = fileNames.replace(miniourl, miniogwurl);
|
||||
@@ -361,30 +361,58 @@ public class SysFileController
|
||||
* @param imgBase64
|
||||
*/
|
||||
private void checkPhoto(String imgBase64) {
|
||||
if (StringUtils.isNotEmpty(imgBase64)) {
|
||||
String token = redisService.getCacheObject("yf-Token");
|
||||
if (StringUtils.isBlank(token)) {
|
||||
try {
|
||||
long l = System.currentTimeMillis();
|
||||
String sign = DigestUtils.md5Hex(yfAppKey + l + yfAppSecret);
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("imgBase64", imgBase64);
|
||||
String body = HttpUtil.postData(upload, map);
|
||||
log.info("checkPhoto_body:{}", body);
|
||||
JSONObject object = JSONObject.parseObject(body);
|
||||
log.info("返回校验结果:{}", JSON.toJSONString(object));
|
||||
if (501 == object.getInteger("code")) {
|
||||
throw new ServiceException("系统繁忙,请稍后再试!");
|
||||
} else if (200 != object.getInteger("code")) {
|
||||
throw new ServiceException("未检测到人脸信息,请重新上传!");
|
||||
} else if (null != object.getInteger("data") && 90 > object.getInteger("data")) {
|
||||
throw new ServiceException("人脸照片校验不合格,请重新上传!");
|
||||
map.put("projectGuid", yfProjectGuid);
|
||||
|
||||
String result = HttpUtil.createGet(yfUrl + "/v1/" + yfProjectGuid + "/auth")
|
||||
.header("appKey", yfAppKey)
|
||||
.header("timestamp", String.valueOf(l))
|
||||
.header("sign", sign)
|
||||
.form(map)
|
||||
.timeout(5000).execute().body();
|
||||
JSONObject jsonObject1 = JSONObject.parseObject(result);
|
||||
if (jsonObject1.getInteger("result") == 1 && StringUtils.isNotBlank(jsonObject1.getString("data"))) {
|
||||
token = jsonObject1.getString("data");
|
||||
redisService.setCacheObject("yf-Token", token, 20 * 60 * 60L, TimeUnit.SECONDS);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new ServiceException("宇泛鉴权失败!");
|
||||
}
|
||||
}
|
||||
|
||||
//https://api.uni-ubi.com/wo/apis/V2.1/ai/portrait.html#%E4%BA%BA%E5%83%8F%E6%A3%80%E6%B5%8B
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("imageUrl", "");
|
||||
map.put("imageBase64", imgBase64);
|
||||
map.put("returnLandmark", "true");
|
||||
map.put("returnAttributes", "true");
|
||||
map.put("unitTag", "");
|
||||
//0:检测全部属性是否合格
|
||||
map.put("validLevel", "0");
|
||||
|
||||
//人脸算法校验
|
||||
String result = HttpUtil.createPost(yfUrl + yfFaceDetectUrl)
|
||||
.header("token", token)
|
||||
.header("projectGuid", yfProjectGuid)
|
||||
.body(JSON.toJSONString(map))
|
||||
.timeout(5000).execute().body();
|
||||
log.info("请求宇泛人脸返回:{}", result);
|
||||
JSONObject jsonObject1 = JSONObject.parseObject(result);
|
||||
if (jsonObject1.getInteger("result") != 1 || !jsonObject1.getBoolean("success")) {
|
||||
throw new ServiceException("人脸检测失败,请重新上传");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("uploadMinio2")
|
||||
public R<SysFile> uploadMinio2(MultipartFile file,String fileName, String name)
|
||||
{
|
||||
try
|
||||
{
|
||||
public R<SysFile> uploadMinio2(MultipartFile file, String fileName, String name) {
|
||||
try {
|
||||
// 上传并返回访问地址
|
||||
String fileNames = FileUploadUtils.uploadMinio(file, this.bucketName1, fileName);
|
||||
SysFile sysFile = new SysFile();
|
||||
@@ -392,9 +420,7 @@ public class SysFileController
|
||||
fileNames = fileNames.replace(miniourl, miniogwurl);
|
||||
sysFile.setUrl(fileNames);
|
||||
return R.ok(sysFile);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
} catch (Exception e) {
|
||||
log.error("上传文件失败", e);
|
||||
return R.fail(e.getMessage());
|
||||
}
|
||||
@@ -406,16 +432,13 @@ public class SysFileController
|
||||
*/
|
||||
@GetMapping("compareTwoPic")
|
||||
public R<Float> compareTwoPic(@RequestParam("url1") String url1, @RequestParam("url2") String url2) {
|
||||
try
|
||||
{
|
||||
try {
|
||||
//进行人脸1v1
|
||||
byte[] image1 = Base64.decodeBase64(ImageToBase64Utils.getImgUrlToBase64(url1));
|
||||
byte[] image2 = Base64.decodeBase64(ImageToBase64Utils.getImgUrlToBase64(url2));
|
||||
float data = faceService.compareTwoPic(image1, image2);
|
||||
return R.ok(data);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
} catch (Exception e) {
|
||||
log.error("上传文件失败", e);
|
||||
return R.fail(e.getMessage());
|
||||
}
|
||||
@@ -426,14 +449,11 @@ public class SysFileController
|
||||
*/
|
||||
@GetMapping("comparePic")
|
||||
public R<Float> comparePic(@RequestParam("feature1") String feature1, @RequestParam("feature2") String feature2) {
|
||||
try
|
||||
{
|
||||
try {
|
||||
//进行人脸1v1
|
||||
float data = faceService.compareTwoPic(feature1, feature2);
|
||||
return R.ok(data);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
} catch (Exception e) {
|
||||
log.error("上传文件失败", e);
|
||||
return R.fail(e.getMessage());
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package com.dcsoft.system.mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.dcsoft.system.api.domain.SysUser;
|
||||
import com.dcsoft.system.domain.SysPeople;
|
||||
import com.dcsoft.system.domain.SysPeopleLeave;
|
||||
import com.dcsoft.system.domain.vo.OfficialAccountVo;
|
||||
@@ -108,4 +110,6 @@ public interface SysPeopleMapper
|
||||
List<SysPeople> queryPeopleByPosition(String position);
|
||||
|
||||
List<SysPeople> querySysPeopleInfo(Long userId);
|
||||
|
||||
Long selectAppSysPeople(SysUser sysUser);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package com.dcsoft.system.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.dcsoft.system.api.domain.SysUser;
|
||||
import com.dcsoft.system.domain.SysPeople;
|
||||
import com.dcsoft.system.domain.vo.OfficialAccountVo;
|
||||
|
||||
@@ -113,4 +115,6 @@ public interface ISysPeopleService
|
||||
List<SysPeople> queryPeopleByPosition(String position);
|
||||
|
||||
List<SysPeople> querySysPeopleInfo(Long userId);
|
||||
|
||||
Long selectAppSysPeople(SysUser sysUser);
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import com.dcsoft.common.core.utils.DateUtils;
|
||||
import com.dcsoft.common.core.utils.StringUtils;
|
||||
import com.dcsoft.common.core.utils.uuid.IdUtils;
|
||||
import com.dcsoft.common.datascope.annotation.DataScope;
|
||||
import com.dcsoft.system.api.domain.SysUser;
|
||||
import com.dcsoft.system.domain.SysBranch;
|
||||
import com.dcsoft.system.domain.SysPeople;
|
||||
import com.dcsoft.system.domain.vo.JjDivisionVo;
|
||||
@@ -137,6 +138,11 @@ public class SysPeopleServiceImpl implements ISysPeopleService
|
||||
return sysPeopleMapper.querySysPeopleInfo(userId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long selectAppSysPeople(SysUser sysUser) {
|
||||
return sysPeopleMapper.selectAppSysPeople(sysUser);
|
||||
}
|
||||
|
||||
@Override
|
||||
@DataScope(deptAlias = "d", userAlias = "u")
|
||||
public List<SysPeople> selectSysPeopleLists(SysPeople sysPeople)
|
||||
|
||||
@@ -242,7 +242,7 @@ public class SysSdkServiceImpl implements ISysSdkService {
|
||||
}
|
||||
paramMap.put("imgUrl", imgUrl);
|
||||
String response = HttpUtil.sendxwwwform(url, paramMap);
|
||||
log.info("imageCreateUrl:{}", response);
|
||||
log.info("ip:{},imageCreateUrl:{}", ip, response);
|
||||
return response;
|
||||
}
|
||||
|
||||
|
||||
@@ -30,6 +30,7 @@ import com.dcsoft.common.security.utils.SecurityUtils;
|
||||
import com.dcsoft.common.sms.config.properties.SmsProperties;
|
||||
import com.dcsoft.common.sms.entity.SmsResult;
|
||||
import com.dcsoft.common.sms.service.SmsTemplate;
|
||||
import com.dcsoft.system.api.domain.SysUser;
|
||||
import com.dcsoft.system.api.model.LoginUser;
|
||||
import com.dcsoft.system.domain.*;
|
||||
import com.dcsoft.system.domain.vo.KeyLabelVo;
|
||||
@@ -120,6 +121,9 @@ public class VisitorController extends BaseController {
|
||||
@Resource
|
||||
private IVisCarryStuffService visCarryStuffService;
|
||||
|
||||
@Resource
|
||||
private ISysUserService sysUserService;
|
||||
|
||||
@Value("${qd.url}")
|
||||
public String qdUrl;
|
||||
|
||||
@@ -617,42 +621,6 @@ public class VisitorController extends BaseController {
|
||||
return "https://fk.xyxaks.cn/h5/?c=" + code + "1";
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 组织链接内容(申请人&随访人基本信息)
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String getContent(Visitor visitor, List<Visitor> itemList) {
|
||||
String matterName = "";
|
||||
if (StringUtils.isNotBlank(visitor.getMatter())) {
|
||||
matterName = MatterEnum.getByCode(visitor.getMatter());
|
||||
}
|
||||
String startTime = DateUtil.format(visitor.getStartTime(), DatePattern.NORM_DATETIME_FORMATTER);
|
||||
String endTime = DateUtil.format(visitor.getEndTime(), DatePattern.NORM_DATETIME_FORMATTER);
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("收到新的访客申请:").append(matterName).append("\n");
|
||||
//面试
|
||||
if (StringUtils.equals(visitor.getMatter(), MatterEnum.INTERVIEW.getCode())) {
|
||||
SysBranch sysBranch = sysBranchService.selectSysBranchById(visitor.getDeptId());
|
||||
sb.append("面试公司:").append(sysBranch.getName()).append("\n");
|
||||
} else {//访客
|
||||
sb.append("来访公司:").append(visitor.getVisitingUnit() == null ? "用户未填写" : visitor.getVisitingUnit()).append("\n");
|
||||
}
|
||||
sb.append("申请人:").append(visitor.getName()).append("\n");
|
||||
sb.append("申请人联系方式:").append(visitor.getPhone() == null ? "用户未填写" : visitor.getPhone()).append("\n");
|
||||
sb.append("预约申请时间:").append(startTime).append("至").append(endTime).append("\n");
|
||||
if (CollUtil.isNotEmpty(itemList)) {
|
||||
for (Visitor item : itemList) {
|
||||
sb.append("随访人:").append(item.getName()).append("\n");
|
||||
sb.append("随访人联系方式:").append(item.getPhone() == null ? "未填写" : item.getPhone()).append("\n");
|
||||
}
|
||||
}
|
||||
sb.append("点击链接进行审核:");
|
||||
log.info("getContent:{}", JSON.toJSONString(sb));
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 钉工牌消息通知
|
||||
*/
|
||||
@@ -1009,6 +977,7 @@ public class VisitorController extends BaseController {
|
||||
try {
|
||||
String telephone = StringUtils.isBlank(visitor.getTelephone()) ? "1" : visitor.getTelephone();
|
||||
Boolean lock = redisService.lock(APPROVE_KEY, telephone, 60 * 5, TimeUnit.SECONDS);
|
||||
log.info("流程审核-lock:{}", lock);
|
||||
if (!lock) {
|
||||
log.error("approve-审核人员正在审核中");
|
||||
return error("正在审核中");
|
||||
@@ -1028,7 +997,7 @@ public class VisitorController extends BaseController {
|
||||
examine.setVisitorId(visitor.getId());
|
||||
visitor.setState(examine.getExamine());
|
||||
|
||||
Map<String, String> map = dictDataService.queryDictData("sys_park_group");
|
||||
// Map<String, String> map = dictDataService.queryDictData("sys_park_group");
|
||||
|
||||
//审核通过
|
||||
if (Constants.ZERO.equals(examine.getExamine())) {
|
||||
@@ -1081,7 +1050,6 @@ public class VisitorController extends BaseController {
|
||||
} catch (Exception e) {
|
||||
log.error("访客approve-sendWeCom异常:", e);
|
||||
}
|
||||
|
||||
} else {//最后一级审核
|
||||
visitor.setExamineState(examine.getExamine());
|
||||
//保存审核历史表
|
||||
@@ -1097,6 +1065,7 @@ public class VisitorController extends BaseController {
|
||||
// 园区人脸下发到设备
|
||||
if (StringUtils.isEmpty(visitor1.getGuid())) {
|
||||
List<Visitor> listVisitorId = new ArrayList<>();
|
||||
log.info("======开始下发主数据人脸信息:{}", visitor1.getId());
|
||||
Visitor s = deviceDistribute(visitor1, 1);
|
||||
Visitor visitor3 = new Visitor();
|
||||
visitor3.setGuid(s.getGuid());
|
||||
@@ -1111,6 +1080,8 @@ public class VisitorController extends BaseController {
|
||||
Visitor visitorInfo = new Visitor();
|
||||
visitor2.setUserId(visitor1.getUserId());
|
||||
visitor2.setRuleGuid(s.getRuleGuid());
|
||||
log.info("======开始下发从数据人脸信息:{}", visitor1.getId());
|
||||
log.info("从数据规则id:{}", s.getRuleGuid());
|
||||
Visitor visitorId = deviceDistribute(visitor2, 2);
|
||||
visitorInfo.setId(visitor2.getId());
|
||||
visitorInfo.setGuid(visitorId.getGuid());
|
||||
@@ -1159,7 +1130,6 @@ public class VisitorController extends BaseController {
|
||||
log.error("访客approve-sendWeCom驳回异常:", e);
|
||||
}
|
||||
// 申请人发送短信(审核不通过)
|
||||
|
||||
log.info("approve-发拒绝短信:{}", visitor.getPhone());
|
||||
try {
|
||||
sendMessage(visitor.getPhone(), "1", parkName, smsProperties.getTemplate3());
|
||||
@@ -1516,6 +1486,7 @@ public class VisitorController extends BaseController {
|
||||
String ruleGuid = visitor.getRuleGuid();
|
||||
if(type == 1) {
|
||||
String s1 = sdkService.ruleCreate("vis_" + visitor.getId(), ip, pass, visitor.getStartTime(), visitor.getEndTime());
|
||||
log.info("设备:{}-创建规则结果:{}", e.getIp(), s1);
|
||||
JSONObject jsonObject1 = JSONObject.parseObject(s1);
|
||||
if (!StringUtils.equals("LAN_SUS-0", jsonObject1.getString("code"))) {
|
||||
log.error("临时访客创建规则下发失败visitorId:{},ip:{}", visitor.getId(), e.getIp());
|
||||
@@ -1535,7 +1506,9 @@ public class VisitorController extends BaseController {
|
||||
person.setRule(objects);
|
||||
|
||||
//创建人员
|
||||
log.info("设备:{},临时访客创建人员:{}", ip, JSON.toJSONString(person));
|
||||
String s2 = sdkService.personCreate(person, ip, pass);
|
||||
log.info("设备:{},临时访客创建人员返回:{}", ip, s2);
|
||||
JSONObject jsonObject3 = JSONObject.parseObject(s2);
|
||||
if (!StringUtils.equals("LAN_SUS-0", jsonObject3.getString("code"))) {
|
||||
log.error("临时访客创建人员下发失败visitorId:{},ip:{}", visitor.getId(), e.getIp());
|
||||
@@ -1852,4 +1825,56 @@ public class VisitorController extends BaseController {
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 查询我的审核列表
|
||||
*/
|
||||
@GetMapping(value = "/getReviewList")
|
||||
public TableDataInfo getReviewList(Visitor visitor) {
|
||||
|
||||
//查询当前登陆人
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
|
||||
Long userId = loginUser.getUserid();
|
||||
SysUser sysUser = sysUserService.selectUserById(userId);
|
||||
|
||||
Long peopleId = sysPeopleService.selectAppSysPeople(sysUser);
|
||||
|
||||
startPage();
|
||||
//临时访客
|
||||
if (StringUtils.equals("0", visitor.getVisitorType())) {
|
||||
List<Visitor> list = visitorService.queryReviewList(peopleId);
|
||||
return getDataTable(list);
|
||||
}
|
||||
//出门证
|
||||
if (StringUtils.equals("1", visitor.getVisitorType())) {
|
||||
List<VisExitOutVo> list = visCarryStuffService.queryReviewList(peopleId);
|
||||
|
||||
//查询物品信息列表
|
||||
List<Long> collect = list.stream().map(VisExitOutVo::getId).collect(Collectors.toList());
|
||||
VisStuffInfoVo visStuffInfoVo = new VisStuffInfoVo();
|
||||
visStuffInfoVo.setExitIds(collect);
|
||||
List<VisStuffInfoVo> stuffList = visCarryStuffService.selectStuffList(visStuffInfoVo);
|
||||
if (CollUtil.isEmpty(stuffList)) {
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
//处理字典值
|
||||
Map<String, String> map = dictDataService.queryDictData("vis_out_stuff_type");
|
||||
stuffList.forEach(stuff -> {
|
||||
if (StrUtil.isNotBlank(stuff.getType())) {
|
||||
stuff.setTypeName(map.get(stuff.getType()));
|
||||
}
|
||||
});
|
||||
|
||||
//构造数据
|
||||
Map<Long, List<VisStuffInfoVo>> collect1 = stuffList.stream().collect(Collectors.groupingBy(VisStuffInfoVo::getExitId));
|
||||
list.forEach(exit -> {
|
||||
exit.setVisStuffInfoList(collect1.get(exit.getId()));
|
||||
});
|
||||
|
||||
return getDataTable(list);
|
||||
}
|
||||
return getDataTable(new ArrayList<>());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,4 +41,6 @@ public interface VisCarryStuffMapper {
|
||||
List<Long> selectexpireVisCarryStuff(Date dateTime);
|
||||
|
||||
void updateStaffState(VisExitOutVo visExitOutVo);
|
||||
|
||||
List<VisExitOutVo> queryReviewList(Long peopleId);
|
||||
}
|
||||
|
||||
@@ -256,4 +256,6 @@ public interface VisitorMapper
|
||||
void deleteVisitorReviewProcess(@Param("id") Long id);
|
||||
|
||||
List<String> addVisitorCheck(@Param("phones") List<String> phones,@Param("startTime") Date startTime);
|
||||
|
||||
List<Visitor> queryReviewList(Long peopleId);
|
||||
}
|
||||
|
||||
@@ -40,4 +40,6 @@ public interface IVisCarryStuffService {
|
||||
List<Long> selectexpireVisCarryStuff(Date dateTime);
|
||||
|
||||
void updateStaffState(VisExitOutVo visExitOutVo);
|
||||
|
||||
List<VisExitOutVo> queryReviewList(Long peopleId);
|
||||
}
|
||||
|
||||
@@ -268,4 +268,6 @@ public interface IVisitorService
|
||||
void cancel(Visitor visitor);
|
||||
|
||||
List<String> addVisitorCheck(List<String> phones, Date startTime);
|
||||
|
||||
List<Visitor> queryReviewList(Long peopleId);
|
||||
}
|
||||
|
||||
@@ -97,6 +97,11 @@ public class VisCarryStuffImpl implements IVisCarryStuffService {
|
||||
visCarryStuffMapper.updateStaffState(visExitOutVo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<VisExitOutVo> queryReviewList(Long peopleId) {
|
||||
return visCarryStuffMapper.queryReviewList(peopleId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public VisExitOutVo selectVisExitOutById(Long id) {
|
||||
return visCarryStuffMapper.selectVisExitOutById(id);
|
||||
|
||||
@@ -823,4 +823,9 @@ public class VisitorServiceImpl implements IVisitorService {
|
||||
return visitorMapper.addVisitorCheck(phones, startTime);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Visitor> queryReviewList(Long peopleId) {
|
||||
return visitorMapper.queryReviewList(peopleId);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -325,4 +325,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<select id="querySysPeopleInfo" resultType="com.dcsoft.system.domain.SysPeople">
|
||||
select ifnull(phone, '0') phone, id from sys_people where del_flag = '0' and user_id = #{userId}
|
||||
</select>
|
||||
|
||||
<select id="selectAppSysPeople" resultType="java.lang.Long">
|
||||
select id from sys_people where del_flag = '0' and (phone = #{phonenumber} or phone = #{userName})
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@@ -333,6 +333,23 @@
|
||||
and e.update_time >= #{dateTime}
|
||||
</select>
|
||||
|
||||
<select id="queryReviewList" resultMap="VisitorResult">
|
||||
SELECT
|
||||
e.id,
|
||||
e.name username,
|
||||
e.visiting_unit,
|
||||
e.vis_time,
|
||||
e.exit_permit_no,
|
||||
e.examine_state
|
||||
FROM
|
||||
`vis_exit_out` e
|
||||
LEFT JOIN `vis_visitor_review_process` p ON e.id = p.exit_id
|
||||
WHERE
|
||||
p.reviewer = #{peopleId}
|
||||
GROUP BY
|
||||
e.id
|
||||
</select>
|
||||
|
||||
<insert id="insertVisExitOut" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into vis_exit_out
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
|
||||
@@ -1040,4 +1040,16 @@
|
||||
<select id="queryReviewProcessOld" resultType="java.lang.String">
|
||||
select reviewer from vis_visitor_review_process where visitor_id = #{id} and type = #{position}
|
||||
</select>
|
||||
|
||||
<select id="queryReviewList" resultType="com.dcsoft.system.visitor.domain.Visitor">
|
||||
SELECT
|
||||
v.*
|
||||
FROM
|
||||
vis_visitor v
|
||||
LEFT JOIN `vis_visitor_review_process` p ON v.id = p.visitor_id
|
||||
WHERE
|
||||
p.reviewer = #{peopleId}
|
||||
GROUP BY
|
||||
v.id
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
Reference in New Issue
Block a user