Commit f571ae6a authored by suhuiguang's avatar suhuiguang

1.增加安全值

parent 790b6023
......@@ -6,19 +6,35 @@ import java.util.List;
import java.util.Map;
public enum RiskSourceLevelEum {
level_1("1","1级"),
level_2("2","2级"),
level_3("3","3级"),
level_4("4","4级"),
level_5("5","5级");
/**
* 风险等级 名称 安全提示
*/
level_1("1","1级", "警告"),
level_2("2","2级","注意"),
level_3("3","3级","安全"),
level_4("4","4级","安全"),
level_5("5","5级","安全");
private String level;
private String name;
RiskSourceLevelEum(String level, String name) {
private String tips;
RiskSourceLevelEum(String level, String name, String tips) {
this.level = level;
this.name = name;
this.tips = tips;
}
public static String getTipsByLevel(String level){
String tips = null;
for (RiskSourceLevelEum eum: RiskSourceLevelEum.values()){
if(eum.getLevel().equals(level) ){
tips = eum.getTips();
break;
}
}
return tips;
}
public String getLevel() {
......@@ -47,6 +63,14 @@ public enum RiskSourceLevelEum {
}
return nameList;
}
public String getTips() {
return tips;
}
public void setTips(String tips) {
this.tips = tips;
}
}
package com.yeejoin.amos.fas.business.service.impl;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.stream.Collectors;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.google.common.collect.Lists;
import com.google.gson.JsonObject;
import com.yeejoin.amos.fas.business.bo.BindPointBo;
import com.yeejoin.amos.fas.business.bo.CheckErrorBo;
import com.yeejoin.amos.fas.business.bo.RiskPointRpnChangeBo;
......@@ -38,12 +16,11 @@ import com.yeejoin.amos.fas.business.dao.mapper.View3dMapper;
import com.yeejoin.amos.fas.business.dao.repository.*;
import com.yeejoin.amos.fas.business.feign.IDutyModeServer;
import com.yeejoin.amos.fas.business.feign.RemoteSecurityService;
import com.yeejoin.amos.fas.business.feign.RemoteWebSocketServer;
import com.yeejoin.amos.fas.business.service.intfc.IDataRefreshService;
import com.yeejoin.amos.fas.business.service.intfc.IView3dService;
import com.yeejoin.amos.fas.core.common.request.CommonPageable;
import com.yeejoin.amos.fas.business.vo.*;
import com.yeejoin.amos.fas.common.enums.*;
import com.yeejoin.amos.fas.core.common.request.CommonPageable;
import com.yeejoin.amos.fas.core.common.request.DateUtil;
import com.yeejoin.amos.fas.core.common.response.CoordDTO;
import com.yeejoin.amos.fas.core.common.response.Node3DVoResponse;
......@@ -54,12 +31,13 @@ import com.yeejoin.amos.fas.core.util.StringUtil;
import com.yeejoin.amos.fas.dao.entity.*;
import com.yeejoin.amos.fas.exception.YeeException;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
......@@ -97,9 +75,7 @@ public class View3dServiceImpl implements IView3dService {
private IRiskLevelDao iRiskLevelDao;
@Autowired
private ISafetyIndexChangeLogDao iSafetyIndexChangeLogDao;
@Autowired
private RemoteWebSocketServer remoteWebSocketServer;
@Autowired
private IDutyModeServer dutyModeServer;
......@@ -313,6 +289,16 @@ public class View3dServiceImpl implements IView3dService {
vo.setCheckExceptionNum(checkExceptionNum);
//4.统计故障数量-日期+机构
vo.setFireExceptionNum(getFireExceptionNum(orgCode,date));
//5.安全值提示
if (riskSource.getRiskLevelId() != null){
Optional<RiskLevel> opt = iRiskLevelDao.findById(riskSource.getRiskLevelId());
if(opt.isPresent()){
Integer level = opt.get().getLevel();
String tips = RiskSourceLevelEum.getTipsByLevel(String.valueOf(level));
vo.setSafetyTips(tips);
vo.setLevel(level);
}
}
} else {
throw new YeeException("机构:"+orgCode+" 不存在");
}
......
......@@ -13,6 +13,31 @@ public class TodaySafetyIndexVo {
private Long fireExceptionNum;
/**
* 安全提示
*/
private String safetyTips;
/**
* 点击code 1到4
*/
private Integer level;
public Integer getLevel() {
return level;
}
public void setLevel(Integer level) {
this.level = level;
}
public String getSafetyTips() {
return safetyTips;
}
public void setSafetyTips(String safetyTips) {
this.safetyTips = safetyTips;
}
public Long getRiskExceptionNum() {
return riskExceptionNum;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment