|
@@ -38,6 +38,7 @@ import com.pj.utils.cache.RedisUtil;
|
|
import com.pj.utils.sg.AjaxJson;
|
|
import com.pj.utils.sg.AjaxJson;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
+import org.springframework.scheduling.annotation.Async;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import com.pj.utils.so.*;
|
|
import com.pj.utils.so.*;
|
|
@@ -196,7 +197,7 @@ public class TbTerminalService extends ServiceImpl<TbTerminalMapper, TbTerminal>
|
|
.setTerminalName(tbTerminal.getName()).setCreateTime(new Date()).setCreateBy(StpUserUtil.getAdminName());
|
|
.setTerminalName(tbTerminal.getName()).setCreateTime(new Date()).setCreateBy(StpUserUtil.getAdminName());
|
|
//日志记录
|
|
//日志记录
|
|
tbCommandLogService.save(tbCommandLog);
|
|
tbCommandLogService.save(tbCommandLog);
|
|
- RedisUtil.set(myConfig.getCommandPrefix() + sn, JSONUtil.toJsonStr(commandList));
|
|
|
|
|
|
+ RedisUtil.set(key, JSONUtil.toJsonStr(commandList));
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -327,6 +328,12 @@ public class TbTerminalService extends ServiceImpl<TbTerminalMapper, TbTerminal>
|
|
*/
|
|
*/
|
|
public AjaxJson check(CheckBO checkBO) {
|
|
public AjaxJson check(CheckBO checkBO) {
|
|
log.info("设备请求放行接口:{}", JSONUtil.toJsonStr(checkBO));
|
|
log.info("设备请求放行接口:{}", JSONUtil.toJsonStr(checkBO));
|
|
|
|
+ if (StrUtil.isEmpty(checkBO.getIdentity_number())) {
|
|
|
|
+ return AjaxJson.getError("身份证不能为空");
|
|
|
|
+ }
|
|
|
|
+ if (StrUtil.isEmpty(checkBO.getSn())) {
|
|
|
|
+ return AjaxJson.getError("设备编号不能为空");
|
|
|
|
+ }
|
|
int acidLimit = SpCfgUtil.getAcidLimit();
|
|
int acidLimit = SpCfgUtil.getAcidLimit();
|
|
int tourLimit = SpCfgUtil.getTourLimit();
|
|
int tourLimit = SpCfgUtil.getTourLimit();
|
|
String now = DateUtil.now();
|
|
String now = DateUtil.now();
|
|
@@ -336,9 +343,18 @@ public class TbTerminalService extends ServiceImpl<TbTerminalMapper, TbTerminal>
|
|
.setTrip_restrict(tourLimit).setIs_pass(0);
|
|
.setTrip_restrict(tourLimit).setIs_pass(0);
|
|
//是否备案、备案是否通过审核
|
|
//是否备案、备案是否通过审核
|
|
TbPersonFiling tbPersonFiling = tbPersonFilingService.findByIdCard(idCard);
|
|
TbPersonFiling tbPersonFiling = tbPersonFilingService.findByIdCard(idCard);
|
|
- if (tbPersonFiling == null || tbPersonFiling.getJudgeState() == 0) {
|
|
|
|
- log.info("返回信息:{},{}", "人员未备案", JSONUtil.toJsonStr(checkDataDTO));
|
|
|
|
- return AjaxJson.getSuccess("人员未备案", checkDataDTO);
|
|
|
|
|
|
+ if (tbPersonFiling == null) {
|
|
|
|
+ if (SpCfgUtil.termianlFilling()) {
|
|
|
|
+ log.info("返回信息:{},{}", "首次备案", JSONUtil.toJsonStr(checkDataDTO));
|
|
|
|
+ return AjaxJson.getSuccess(checkBO.getName() + "首次备案", checkDataDTO);
|
|
|
|
+ } else {
|
|
|
|
+ log.info("返回信息:{},{}", "人员未备案", JSONUtil.toJsonStr(checkDataDTO));
|
|
|
|
+ return AjaxJson.getSuccess(checkBO.getName() + "未备案", checkDataDTO);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if (tbPersonFiling.getJudgeState() == 0) {
|
|
|
|
+ log.info("返回信息:{},{}", "人员备案未审核", JSONUtil.toJsonStr(checkDataDTO));
|
|
|
|
+ return AjaxJson.getSuccess(checkBO.getName() + "未审核", checkDataDTO);
|
|
}
|
|
}
|
|
TbDept tbDept = tbDeptService.getById(tbPersonFiling.getDeptId());
|
|
TbDept tbDept = tbDeptService.getById(tbPersonFiling.getDeptId());
|
|
String msg = tbDept.getName() + tbPersonFiling.getName();
|
|
String msg = tbDept.getName() + tbPersonFiling.getName();
|
|
@@ -346,7 +362,7 @@ public class TbTerminalService extends ServiceImpl<TbTerminalMapper, TbTerminal>
|
|
double minTemperature = SpCfgUtil.getMinTemperature();
|
|
double minTemperature = SpCfgUtil.getMinTemperature();
|
|
if (minTemperature < checkBO.getTemperature()) {
|
|
if (minTemperature < checkBO.getTemperature()) {
|
|
log.info("返回信息体温过高:{},{}", msg, JSONUtil.toJsonStr(checkDataDTO));
|
|
log.info("返回信息体温过高:{},{}", msg, JSONUtil.toJsonStr(checkDataDTO));
|
|
- return AjaxJson.getSuccess(msg, checkDataDTO);
|
|
|
|
|
|
+ return AjaxJson.getSuccess(msg + "\n体温异常", checkDataDTO);
|
|
}
|
|
}
|
|
//健康码是否绿码
|
|
//健康码是否绿码
|
|
if (!StrUtil.equals(TbPersonVisitRecord.HealthEnum.GREEN.getStatus(), checkBO.getHealth_status())) {
|
|
if (!StrUtil.equals(TbPersonVisitRecord.HealthEnum.GREEN.getStatus(), checkBO.getHealth_status())) {
|
|
@@ -361,17 +377,28 @@ public class TbTerminalService extends ServiceImpl<TbTerminalMapper, TbTerminal>
|
|
}
|
|
}
|
|
//通道是否开放
|
|
//通道是否开放
|
|
TbTerminal tbTerminal = this.findBySN(checkBO.getSn());
|
|
TbTerminal tbTerminal = this.findBySN(checkBO.getSn());
|
|
- if (tbTerminal==null){
|
|
|
|
|
|
+ if (tbTerminal == null) {
|
|
log.info("返回信息非法设备:{},{}", msg, JSONUtil.toJsonStr(checkDataDTO));
|
|
log.info("返回信息非法设备:{},{}", msg, JSONUtil.toJsonStr(checkDataDTO));
|
|
return AjaxJson.getSuccess("非法设备", checkDataDTO);
|
|
return AjaxJson.getSuccess("非法设备", checkDataDTO);
|
|
}
|
|
}
|
|
TbVenues tbVenues = tbVenuesService.getById(tbTerminal.getChannelId());
|
|
TbVenues tbVenues = tbVenuesService.getById(tbTerminal.getChannelId());
|
|
- if (tbVenues.getStatus()==0){
|
|
|
|
|
|
+ if (tbVenues.getStatus() == 0) {
|
|
log.info("返回信息通道关闭放行:{},{}", msg, JSONUtil.toJsonStr(checkDataDTO));
|
|
log.info("返回信息通道关闭放行:{},{}", msg, JSONUtil.toJsonStr(checkDataDTO));
|
|
return AjaxJson.getSuccess(msg, checkDataDTO);
|
|
return AjaxJson.getSuccess(msg, checkDataDTO);
|
|
}
|
|
}
|
|
checkDataDTO.setIs_pass(1);
|
|
checkDataDTO.setIs_pass(1);
|
|
return AjaxJson.getSuccess(msg, checkDataDTO);
|
|
return AjaxJson.getSuccess(msg, checkDataDTO);
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+ public void down(Long id) {
|
|
|
|
+ TbTerminal tbTerminal = this.getById(id);
|
|
|
|
+ if (TbTerminal.StateType.OFFLINE.getState().equals(tbTerminal.getState())) {
|
|
|
|
+ throw new BusinessException("设备已离线");
|
|
|
|
+ }
|
|
|
|
+ tbPersonFilingService.issued(tbTerminal);
|
|
|
|
+ tbPersonBlackService.issued(tbTerminal);
|
|
|
|
+ String sn = tbTerminal.getSn();
|
|
|
|
+ String key = myConfig.getCommandPrefix() + sn;
|
|
|
|
+ log.info("list:{}",RedisUtil.get(key));
|
|
|
|
+ this.startHeartCommand(tbTerminal.getSn());
|
|
|
|
+ }
|
|
}
|
|
}
|