|
@@ -24,7 +24,7 @@ import com.zd.common.core.utils.ServletUtils;
|
|
|
import com.zd.common.core.utils.StringUtils;
|
|
import com.zd.common.core.utils.StringUtils;
|
|
|
import com.zd.common.mqtt.model.MessageBody;
|
|
import com.zd.common.mqtt.model.MessageBody;
|
|
|
import com.zd.laboratory.api.feign.RemoteLaboratoryService;
|
|
import com.zd.laboratory.api.feign.RemoteLaboratoryService;
|
|
|
-import com.zd.model.constant.Constants;
|
|
|
|
|
|
|
+import com.zd.model.constant.BaseConstants;
|
|
|
import com.zd.model.constant.SecurityConstants;
|
|
import com.zd.model.constant.SecurityConstants;
|
|
|
import com.zd.model.domain.R;
|
|
import com.zd.model.domain.R;
|
|
|
import com.zd.model.entity.Algorithm;
|
|
import com.zd.model.entity.Algorithm;
|
|
@@ -44,14 +44,12 @@ import org.springframework.util.MultiValueMap;
|
|
|
import org.springframework.web.client.RestTemplate;
|
|
import org.springframework.web.client.RestTemplate;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
import sun.misc.BASE64Decoder;
|
|
import sun.misc.BASE64Decoder;
|
|
|
-
|
|
|
|
|
import javax.annotation.Resource;
|
|
import javax.annotation.Resource;
|
|
|
import java.io.File;
|
|
import java.io.File;
|
|
|
import java.io.FileOutputStream;
|
|
import java.io.FileOutputStream;
|
|
|
import java.io.IOException;
|
|
import java.io.IOException;
|
|
|
import java.io.OutputStream;
|
|
import java.io.OutputStream;
|
|
|
import java.util.*;
|
|
import java.util.*;
|
|
|
-
|
|
|
|
|
import static com.zd.alg.forward.utils.HttpUtils.*;
|
|
import static com.zd.alg.forward.utils.HttpUtils.*;
|
|
|
|
|
|
|
|
@Service
|
|
@Service
|
|
@@ -160,9 +158,9 @@ public class CheckService {
|
|
|
if (StringUtils.isNotEmpty(labSkipped) && labSkipped.equals("1")) {
|
|
if (StringUtils.isNotEmpty(labSkipped) && labSkipped.equals("1")) {
|
|
|
//如果没有通过则次数加一
|
|
//如果没有通过则次数加一
|
|
|
//键为前缀+签到id +下划线+验证类型
|
|
//键为前缀+签到id +下划线+验证类型
|
|
|
- String key = Constants.SINGIN_CHECK_JUMP_KEY + id + "_" + code;
|
|
|
|
|
|
|
+ String key = BaseConstants.SINGIN_CHECK_JUMP_KEY + id + "_" + code;
|
|
|
Long increment = redisTemplate.opsForValue().increment(key);
|
|
Long increment = redisTemplate.opsForValue().increment(key);
|
|
|
- redisService.expire(key, Constants.SINGIN_OUT_TIME);
|
|
|
|
|
|
|
+ redisService.expire(key, BaseConstants.SINGIN_OUT_TIME);
|
|
|
if (increment != null && increment >= Integer.parseInt(labCheckCount)) {
|
|
if (increment != null && increment >= Integer.parseInt(labCheckCount)) {
|
|
|
//黎晨这里让把跳过时状态码改为700,所以700的含义为检查失败并且跳过
|
|
//黎晨这里让把跳过时状态码改为700,所以700的含义为检查失败并且跳过
|
|
|
return R.fail(700, "符合跳过条件执行跳过");
|
|
return R.fail(700, "符合跳过条件执行跳过");
|
|
@@ -228,9 +226,9 @@ public class CheckService {
|
|
|
if (!f && algorithmYml.getJumpThreshold() != -1) {
|
|
if (!f && algorithmYml.getJumpThreshold() != -1) {
|
|
|
//如果没有通过则次数加一
|
|
//如果没有通过则次数加一
|
|
|
//键为前缀+签到id +下划线+验证类型
|
|
//键为前缀+签到id +下划线+验证类型
|
|
|
- String key = Constants.SINGIN_CHECK_JUMP_KEY + id + "_" + code;
|
|
|
|
|
|
|
+ String key = BaseConstants.SINGIN_CHECK_JUMP_KEY + id + "_" + code;
|
|
|
Long increment = redisTemplate.opsForValue().increment(key);
|
|
Long increment = redisTemplate.opsForValue().increment(key);
|
|
|
- redisService.expire(key, Constants.SINGIN_OUT_TIME);
|
|
|
|
|
|
|
+ redisService.expire(key, BaseConstants.SINGIN_OUT_TIME);
|
|
|
if (increment >= algorithmYml.getJumpThreshold()) {
|
|
if (increment >= algorithmYml.getJumpThreshold()) {
|
|
|
//黎晨这里让把跳过时状态码改为700,所以700的含义为检查失败并且跳过
|
|
//黎晨这里让把跳过时状态码改为700,所以700的含义为检查失败并且跳过
|
|
|
apply.setCode(700);
|
|
apply.setCode(700);
|
|
@@ -374,12 +372,12 @@ public class CheckService {
|
|
|
|
|
|
|
|
|
|
|
|
|
private R<Long> getObjectR(Long id) {
|
|
private R<Long> getObjectR(Long id) {
|
|
|
- Long subId = redisService.getCacheObject(Constants.SINGIN_id_KEY + id);
|
|
|
|
|
|
|
+ Long subId = redisService.getCacheObject(BaseConstants.SINGIN_id_KEY + id);
|
|
|
if (subId == null) {
|
|
if (subId == null) {
|
|
|
return R.fail(600, "签到&签出已超时,请重新刷卡重试!");
|
|
return R.fail(600, "签到&签出已超时,请重新刷卡重试!");
|
|
|
}
|
|
}
|
|
|
//刷新key
|
|
//刷新key
|
|
|
- boolean expire = redisService.expire(Constants.SINGIN_id_KEY + id, 120);
|
|
|
|
|
|
|
+ boolean expire = redisService.expire(BaseConstants.SINGIN_id_KEY + id, 120);
|
|
|
if (!expire) {
|
|
if (!expire) {
|
|
|
return R.fail(600, "签到&签出已超时,请重新刷卡重试!");
|
|
return R.fail(600, "签到&签出已超时,请重新刷卡重试!");
|
|
|
}
|
|
}
|
|
@@ -402,9 +400,9 @@ public class CheckService {
|
|
|
//如果没有通过则次数加一
|
|
//如果没有通过则次数加一
|
|
|
Map<String, Boolean> map = new HashMap(1);
|
|
Map<String, Boolean> map = new HashMap(1);
|
|
|
//键为前缀+签到id +下划线+验证类型
|
|
//键为前缀+签到id +下划线+验证类型
|
|
|
- String key = Constants.SINGIN_CHECK_JUMP_KEY + id + "_" + code;
|
|
|
|
|
|
|
+ String key = BaseConstants.SINGIN_CHECK_JUMP_KEY + id + "_" + code;
|
|
|
Long increment = redisTemplate.opsForValue().increment(key);
|
|
Long increment = redisTemplate.opsForValue().increment(key);
|
|
|
- redisService.expire(key, Constants.SINGIN_OUT_TIME);
|
|
|
|
|
|
|
+ redisService.expire(key, BaseConstants.SINGIN_OUT_TIME);
|
|
|
Boolean isJump = increment >= algorithmYml.getJumpThreshold();
|
|
Boolean isJump = increment >= algorithmYml.getJumpThreshold();
|
|
|
map.put("jump", isJump);
|
|
map.put("jump", isJump);
|
|
|
R<Object> fail = R.fail();
|
|
R<Object> fail = R.fail();
|