红黄绿码修改
This commit is contained in:
parent
6a0a44b2b5
commit
8a8bb8fed4
@ -6,6 +6,7 @@ import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.zhgd.xmgl.util.PropertiesUtil;
|
||||
import com.zhgd.jeecg.common.execption.OpenPromptException;
|
||||
import com.zhgd.jeecg.common.util.SpringContextUtils;
|
||||
import com.zhgd.jeecg.common.util.pass.HttpUtils;
|
||||
@ -551,7 +552,7 @@ public class AsyncHikvision {
|
||||
if (userId != null) {
|
||||
java.text.DateFormat format1 = new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
String redNotice = "";
|
||||
List<String> redNameList = workerList.stream().filter(w -> NumberUtils.lt(w.getSafeScore(), 80D)).map(WorkerInfo::getWorkerName).collect(Collectors.toList());
|
||||
List<String> redNameList = workerList.stream().filter(w -> NumberUtils.lt(w.getSafeScore(), PropertiesUtil.getWorkerInfoRedScore())).map(WorkerInfo::getWorkerName).collect(Collectors.toList());
|
||||
if (CollUtil.isNotEmpty(redNameList)) {
|
||||
redNotice = StrUtil.format(",{}是红码不下发", StrUtil.join(",", redNameList));
|
||||
}
|
||||
|
||||
@ -309,7 +309,7 @@ public class ProjectUfaceConfigServiceImpl extends ServiceImpl<ProjectUfaceConfi
|
||||
//海康门禁isc
|
||||
String devSns = "";
|
||||
String notDevSns = "";
|
||||
if (NumberUtils.lt(workerInfo.getSafeScore(), 80D)) {
|
||||
if (NumberUtils.lt(workerInfo.getSafeScore(), PropertiesUtil.getWorkerInfoRedScore())) {
|
||||
//红码不能通行
|
||||
List<UfaceDev> allList = ufaceDevMapper.selectList(new LambdaQueryWrapper<UfaceDev>().eq(UfaceDev::getProjectSn, workerInfo.getProjectSn()));
|
||||
if (CollUtil.isNotEmpty(allList)) {
|
||||
@ -516,7 +516,7 @@ public class ProjectUfaceConfigServiceImpl extends ServiceImpl<ProjectUfaceConfi
|
||||
List<JSONObject> workerAndDevSnList = new ArrayList<>();
|
||||
for (WorkerInfo workerInfo : workerList) {
|
||||
//海康门禁isc
|
||||
if (NumberUtils.lt(workerInfo.getSafeScore(), 80D)) {
|
||||
if (NumberUtils.lt(workerInfo.getSafeScore(), PropertiesUtil.getWorkerInfoRedScore())) {
|
||||
log.info("安全评分红码不下发权限,名称:{}", workerInfo.getWorkerName());
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -2349,8 +2349,8 @@ public class WorkerInfoServiceImpl extends ServiceImpl<WorkerInfoMapper, WorkerI
|
||||
* @return
|
||||
*/
|
||||
public boolean notNeedSend(WorkerInfo old, WorkerInfo newWi) {
|
||||
boolean bothRed = NumberUtils.lt(old.getSafeScore(), 80D) && NumberUtils.lt(newWi.getSafeScore(), 80D);
|
||||
boolean bothNotRed = !NumberUtils.lt(old.getSafeScore(), 80D) && !NumberUtils.lt(newWi.getSafeScore(), 80D);
|
||||
boolean bothRed = NumberUtils.lt(old.getSafeScore(), PropertiesUtil.getWorkerInfoRedScore()) && NumberUtils.lt(newWi.getSafeScore(), PropertiesUtil.getWorkerInfoRedScore());
|
||||
boolean bothNotRed = !NumberUtils.lt(old.getSafeScore(), PropertiesUtil.getWorkerInfoRedScore()) && !NumberUtils.lt(newWi.getSafeScore(), PropertiesUtil.getWorkerInfoRedScore());
|
||||
if ((bothRed || bothNotRed) && Objects.equals(old.getSendSuccessStatus(), 1)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
35
src/main/java/com/zhgd/xmgl/util/PropertiesUtil.java
Normal file
35
src/main/java/com/zhgd/xmgl/util/PropertiesUtil.java
Normal file
@ -0,0 +1,35 @@
|
||||
package com.zhgd.xmgl.util;
|
||||
|
||||
import lombok.Data;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* 属性工具类
|
||||
*/
|
||||
@Component
|
||||
public class PropertiesUtil {
|
||||
/**
|
||||
* 红黄绿码:红 < workerInfoRedScore <= 黄 < workerInfoGreenScore <=绿
|
||||
*/
|
||||
private static Double workerInfoRedScore;
|
||||
private static Double workerInfoGreenScore;
|
||||
|
||||
@Value("${workerInfoRedScore:60}")
|
||||
public void setWorkerInfoRedScore(Double workerInfoRedScore) {
|
||||
PropertiesUtil.workerInfoRedScore = workerInfoRedScore;
|
||||
}
|
||||
|
||||
@Value("${workerInfoGreenScore:80}")
|
||||
public void setWorkerInfoGreenScore(Double workerInfoGreenScore) {
|
||||
PropertiesUtil.workerInfoGreenScore = workerInfoGreenScore;
|
||||
}
|
||||
|
||||
public static Double getWorkerInfoRedScore() {
|
||||
return workerInfoRedScore;
|
||||
}
|
||||
|
||||
public static Double getWorkerInfoGreenScore() {
|
||||
return workerInfoGreenScore;
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user