Commit 146bb97a authored by maoying's avatar maoying

Merge branch 'dev_upgrade' of 172.16.10.76:station/YeeAmosFireAutoSysRoot into upgrade

parents e0b4f586 c0768549
......@@ -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;
private String tips;
RiskSourceLevelEum(String level, String name) {
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() {
......@@ -48,5 +64,13 @@ public enum RiskSourceLevelEum {
return nameList;
}
public String getTips() {
return tips;
}
public void setTips(String tips) {
this.tips = tips;
}
}
package com.yeejoin.amos.fas.core.common.response;
import java.util.ArrayList;
import java.util.List;
import com.alibaba.druid.util.StringUtils;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import java.util.ArrayList;
import java.util.List;
public class RegionTreeResponse {
private Long id;
......@@ -19,12 +19,19 @@ public class RegionTreeResponse {
private Boolean isBind;
private String type;
private Boolean isRegion;
private String position3d;
private JSONArray position3d;
private String routePath;
private String level;
private String levelStr;
private List<RegionTreeResponse> children = new ArrayList<>();
public JSONArray getPosition3d() {
return position3d;
}
public void setPosition3d(String position3d) {
this.position3d = StringUtils.isEmpty(position3d) ? new JSONArray() : JSON.parseArray(position3d);
}
public Long getId() {
return id;
......@@ -92,12 +99,7 @@ public class RegionTreeResponse {
public void setIsRegion(Boolean isRegion) {
this.isRegion = isRegion;
}
public String getPosition3d() {
return position3d;
}
public void setPosition3d(String position3d) {
this.position3d = position3d;
}
/**
* @return the routePath
*/
......
......@@ -44,6 +44,11 @@ public class FireSourceController extends BaseController {
fireEquipment.setCreateBy(getUserId());
fireEquipment.setCreateDate(new Date());
fireEquipment.setOrgCode(compCode);
//设备状态默认为正常
fireEquipment.setEquipStatus(0);
return CommonResponseUtil.success(iFireEquipService.save(fireEquipment));
}
......
......@@ -141,7 +141,7 @@ public class FireStationController extends BaseController {
throw new Exception("数据校验失败.");
ReginParams reginParams =getSelectedOrgInfo();
String compCode=getOrgCode(reginParams);
fireStation.setCreateBy("0");
fireStation.setCreateBy(getUserId());
fireStation.setCreateDate(new Date());
fireStation.setOrgCode(compCode);
return CommonResponseUtil.success(iFireStationService.saveAndUpd(fireStation, file));
......
......@@ -12,8 +12,6 @@ import com.yeejoin.amos.fas.core.util.CommonResponseUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import io.swagger.annotations.Authorization;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.web.bind.annotation.*;
......@@ -144,8 +142,7 @@ public class View3dController extends BaseController {
public CommonResponse getStatisticsDuty(){
ReginParams reginParams =getSelectedOrgInfo();
String orgCode = this.getOrgCode(reginParams);
CommonResponse statisticsDuty = view3dService.getStatisticsDuty(getAppKey(),getProduct(),orgCode);
return statisticsDuty;
return view3dService.getStatisticsDuty(getAppKey(),getProduct(),orgCode);
}
@ApiOperation(value = "异常区域信息查询",notes = "异常区域信息查询")
......@@ -157,7 +154,7 @@ public class View3dController extends BaseController {
return CommonResponseUtil.success(exceptionRegionVoList);
}
@ApiOperation(value = "异常区域信息查询",notes = "异常区域信息查询")
@ApiOperation(value = "设备状态信息查询",notes = "设备状态信息查询")
@GetMapping(value = "equipStatus/list")
public CommonResponse getEquipStatusList(){
ReginParams reginParams =getSelectedOrgInfo();
......@@ -233,4 +230,10 @@ public class View3dController extends BaseController {
public CommonResponse pointLevel(@ApiParam(value = "点类型") @RequestParam String type){
return CommonResponseUtil.success(view3dService.pointLevelList(type));
}
@ApiOperation(value = "重新区域下包含点",notes = "重新区域下包含点")
@GetMapping(value = "point/list/{regionId}")
public CommonResponse listPointsByRegion(@PathVariable Long regionId, @RequestParam(required = false, defaultValue = "all") String type){
return CommonResponseUtil.success(view3dService.listPointsByRegionId(regionId,type));
}
}
......@@ -149,4 +149,11 @@ public interface View3dMapper extends BaseMapper{
Long retrieveAllCount(String type, String inputText,String orgCode,String dataLevel,String protectObjName);
List<HashMap<String, Object>> retrieveAll(String type, String inputText, long start, int length,String orgCode,String dataLevel,String protectObjName);
/**
* 查询区域下点
* @param ids 区域ids
* @return list
*/
List<Map<String, Object>> getAllPointInRegions(@Param("ids") List<Long> ids);
}
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;
......@@ -99,8 +77,6 @@ public class View3dServiceImpl implements IView3dService {
private ISafetyIndexChangeLogDao iSafetyIndexChangeLogDao;
@Autowired
private RemoteWebSocketServer remoteWebSocketServer;
@Autowired
private IDutyModeServer dutyModeServer;
@Value("${param.system.online.date}")
......@@ -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+" 不存在");
}
......@@ -614,5 +600,42 @@ public class View3dServiceImpl implements IView3dService {
throw new YeeException("不支持的类型 -->"+ type);
}
}
@Override
public List<Map<String, Object>> listPointsByRegionId(Long regionId, String type) {
List<Map<String, Object>> pointList = new ArrayList<>();
if(FasConstant.ALL_POINT.equalsIgnoreCase(type)){//分支1:查询区域及子区域下所有点
List<Long> regionIds = new ArrayList<>();
List<RiskSource> riskSourceList = iRiskSourceDao.findByParentId(regionId);
this.getAllRiskRegion(regionIds,riskSourceList);
regionIds.add(regionId);
pointList = this.getPointsByRegionIds(regionIds);
} else {//分支2:查询指定区域下所有点
pointList = this.getPointsByRegionIds(Collections.singletonList(regionId));
}
return pointList;
}
private List<Map<String,Object>> getPointsByRegionIds(List<Long> ids){
return view3dMapper.getAllPointInRegions(ids);
}
/**
* 获得子节点:区域
* @param ids 返回
* @param riskSourceList 风险点区域列表
*/
private void getAllRiskRegion(List<Long> ids, List<RiskSource> riskSourceList) {
//TODO 递归
for (RiskSource riskSource : riskSourceList) {
if (riskSource.getIsRegion().equalsIgnoreCase("TRUE")) {
ids.add(riskSource.getId());
List<RiskSource> list = iRiskSourceDao.findByParentId(riskSource.getId());
if (list != null) {
this.getAllRiskRegion(ids, list);
}
}
}
}
}
......@@ -165,4 +165,11 @@ public interface IView3dService {
*/
List<Map<String,String>> pointLevelList(String type);
/**
* 查询区域下的各类点
* @param regionId 区域id
* @param type 类型
* @return list
*/
List<Map<String, Object>> listPointsByRegionId(Long regionId, String type);
}
......@@ -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;
......
......@@ -7,7 +7,7 @@
count(p.id)
FROM
p_point p
where 1=1
where p.is_delete='0'
<if test="orgCode!=null"> and p.org_code = #{orgCode} </if>
<if test="departmentId!=null"> and p.charge_dept_id = #{departmentId} </if>
<if test="pointNo!=null"> and p.point_no like concat(concat("%",#{pointNo}),"%") </if>
......@@ -26,7 +26,7 @@
p.point_no pointNo
FROM
p_point p
where 1=1
where p.is_delete='0'
<if test="orgCode!=null"> and p.org_code = #{orgCode} </if>
<if test="departmentId!=null"> and p.charge_dept_id = #{departmentId} </if>
<if test="pointNo!=null"> and p.point_no like concat(concat("%",#{pointNo}),"%") </if>
......
......@@ -1385,4 +1385,54 @@ from (select concat('riskSource',r.id) as id,r.name,r.code,r.ue4_location as ue4
</if>
LIMIT ${start},${length}
</select>
<select id="getAllPointInRegions" resultType="java.util.Map">
select
CONCAT(type,'-',id) as `key`,
id as pointId,
name,
type,
risk_source_id as regionId,
position3d
from
(select id,name,'riskSource' as type, parent_id as risk_source_id,position3d
from f_risk_source where is_region = 'FALSE'
UNION all
select id,name,'patrol' as type,risk_source_id,coordinates as position3d
from p_point WHERE is_delete = FALSE
UNION all
select id,name ,'impEquipment' as type,risk_source_id,position3d
from f_equipment e
UNION all
select id,name,'monitorEquipment' as type,risk_source_id,position3d
from f_fire_equipment where equip_classify = 0
UNION all
select id,name,'video' as type,risk_source_id,position3d
from f_fire_equipment where equip_classify = 2
UNION all
select id,name ,'hydrant' as type,risk_source_id,position3d
from f_water_resource where type = 1
UNION all
select id,name,'pool' as type,risk_source_id,position3d
from f_water_resource where type = 2
UNION all
select id,name,'fireCar' as type,risk_source_id,position3d
from f_fire_car
UNION all
select id,name,'fireEquipment' as type,risk_source_id,position3d
from f_fire_equipment where equip_classify = 3
UNION all
select id,name,'fireChamber' as type,risk_source_id,position3d
from f_fire_station where type = 2
UNION all
select id,name,'fireFoamRoom' as type,risk_source_id,position3d
from f_fire_station where type = 1
) as sp
where
position3d <![CDATA[<>]]> '' and
risk_source_id in
<foreach collection="ids" open="(" separator="," close=")" item="id">
#{id}
</foreach>
order by regionId
</select>
</mapper>
\ No newline at end of file
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