|
@@ -2,6 +2,7 @@ package com.zd.laboratory.onemachine.service;
|
|
|
|
|
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
import cn.hutool.core.collection.CollUtil;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
import com.zd.algorithm.api.face.feign.RemoteFaceService;
|
|
import com.zd.algorithm.api.face.feign.RemoteFaceService;
|
|
|
import com.zd.common.core.exception.NoRollException;
|
|
import com.zd.common.core.exception.NoRollException;
|
|
|
import com.zd.common.core.exception.ServiceException;
|
|
import com.zd.common.core.exception.ServiceException;
|
|
@@ -307,7 +308,7 @@ public class OneMachineService implements ValidationSignInPerInfo {
|
|
|
*/
|
|
*/
|
|
|
public ResultData postSign(String code, SignEnum signEnum, byte[] face) {
|
|
public ResultData postSign(String code, SignEnum signEnum, byte[] face) {
|
|
|
try {
|
|
try {
|
|
|
- logger.info("&&&&&&&&&&&&&&&&&&&&&&" + code + "," + signEnum);
|
|
|
|
|
|
|
+ logger.info("sign starting....,code:{},signEnum:{}",code,signEnum);
|
|
|
if (StringUtils.isEmpty(code)) {
|
|
if (StringUtils.isEmpty(code)) {
|
|
|
return ResultData.fail(600, "签到验证码错误,请重新刷卡重试!");
|
|
return ResultData.fail(600, "签到验证码错误,请重新刷卡重试!");
|
|
|
}
|
|
}
|
|
@@ -412,6 +413,7 @@ public class OneMachineService implements ValidationSignInPerInfo {
|
|
|
*/
|
|
*/
|
|
|
public R commitSign(Long id) {
|
|
public R commitSign(Long id) {
|
|
|
String key = BaseConstants.SINGIN_id_KEY + id;
|
|
String key = BaseConstants.SINGIN_id_KEY + id;
|
|
|
|
|
+ logger.info("commitSign starting,id:{}",id);
|
|
|
Long subId = redisService.getCacheObject(key);
|
|
Long subId = redisService.getCacheObject(key);
|
|
|
if (subId == null) {
|
|
if (subId == null) {
|
|
|
return R.fail(600, "签到已超时,请重新刷卡重试!");
|
|
return R.fail(600, "签到已超时,请重新刷卡重试!");
|
|
@@ -419,20 +421,25 @@ public class OneMachineService implements ValidationSignInPerInfo {
|
|
|
//获取实验室配置的签到检查项
|
|
//获取实验室配置的签到检查项
|
|
|
LabSubject subject = subjectService.selectLabSubjectById(subId);
|
|
LabSubject subject = subjectService.selectLabSubjectById(subId);
|
|
|
Assert.isNotNull(subject, "实验室不存在");
|
|
Assert.isNotNull(subject, "实验室不存在");
|
|
|
-
|
|
|
|
|
|
|
+ logger.info("subject info:{}", JSON.toJSONString(subject));
|
|
|
// 如果是白老师证号则不校验
|
|
// 如果是白老师证号则不校验
|
|
|
LabSubjectAccessRecord record = subjectAccessRecordService.selectLabSubjectAccessRecordById(id);
|
|
LabSubjectAccessRecord record = subjectAccessRecordService.selectLabSubjectAccessRecordById(id);
|
|
|
|
|
+ logger.info("subject access record:{}", JSON.toJSONString(record));
|
|
|
if (record != null && record.getJoinUserId() != null && record.getJoinUserId() != 92612) {
|
|
if (record != null && record.getJoinUserId() != null && record.getJoinUserId() != 92612) {
|
|
|
Optional.ofNullable(subject.getCheckIn())
|
|
Optional.ofNullable(subject.getCheckIn())
|
|
|
.filter(a -> StrUtil.isNotBlank(a))
|
|
.filter(a -> StrUtil.isNotBlank(a))
|
|
|
.ifPresent(a -> {
|
|
.ifPresent(a -> {
|
|
|
String[] split = a.split(",");
|
|
String[] split = a.split(",");
|
|
|
|
|
+ logger.info("split:{}",split.toString());
|
|
|
//获取检查记录
|
|
//获取检查记录
|
|
|
List<String> strings = labSubAccessCheckLogService.selectSuccessTypeBySignId(id);
|
|
List<String> strings = labSubAccessCheckLogService.selectSuccessTypeBySignId(id);
|
|
|
|
|
+ logger.info("subject access check in logs:{}", JSON.toJSONString(strings));
|
|
|
if (CollUtil.isEmpty(strings) || strings.size() != split.length) {
|
|
if (CollUtil.isEmpty(strings) || strings.size() != split.length) {
|
|
|
|
|
+ logger.error("fail 1");
|
|
|
throw new ServiceException("未完成全部检查记录!");
|
|
throw new ServiceException("未完成全部检查记录!");
|
|
|
}
|
|
}
|
|
|
Arrays.stream(split).filter(b -> !strings.contains(b)).findFirst().ifPresent(b -> {
|
|
Arrays.stream(split).filter(b -> !strings.contains(b)).findFirst().ifPresent(b -> {
|
|
|
|
|
+ logger.error("fail 2,b:{}",b);
|
|
|
throw new ServiceException("未完成全部检查记录!");
|
|
throw new ServiceException("未完成全部检查记录!");
|
|
|
});
|
|
});
|
|
|
});
|
|
});
|
|
@@ -441,12 +448,15 @@ public class OneMachineService implements ValidationSignInPerInfo {
|
|
|
//更新签到记录
|
|
//更新签到记录
|
|
|
boolean b = subjectAccessRecordService.updateCheck(id);
|
|
boolean b = subjectAccessRecordService.updateCheck(id);
|
|
|
if (!b) {
|
|
if (!b) {
|
|
|
|
|
+ logger.error("updateCheck fail");
|
|
|
throw new ServiceException("更新签到记录失败!!");
|
|
throw new ServiceException("更新签到记录失败!!");
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
//删除key
|
|
//删除key
|
|
|
redisService.deleteObject(key);
|
|
redisService.deleteObject(key);
|
|
|
LabSubjectAccessRecord labSubjectAccessRecord = subjectAccessRecordService.selectLabSubjectAccessRecordById(id);
|
|
LabSubjectAccessRecord labSubjectAccessRecord = subjectAccessRecordService.selectLabSubjectAccessRecordById(id);
|
|
|
if (null == labSubjectAccessRecord) {
|
|
if (null == labSubjectAccessRecord) {
|
|
|
|
|
+ logger.error("query sign record fail");
|
|
|
throw new ServiceException("查询签到记录失败!!");
|
|
throw new ServiceException("查询签到记录失败!!");
|
|
|
}
|
|
}
|
|
|
|
|
|