Commit 3b517953 authored by 高建强's avatar 高建强

item:三维查询搜索接口新增

parent 70a6e9f7
......@@ -279,6 +279,30 @@ public class View3dController extends BaseController {
params.getProtectObjName(),
token,appKey,product);
}
@Permission
@PostMapping(value = "/retrieve3/all",produces = "application/json;charset=UTF-8")
@ApiOperation(value = "右侧边栏搜索", notes = "右侧边栏搜索")
public CommonResponse retrieve3All(
@RequestBody RetrieveParams params
) {
ReginParams reginParams =getSelectedOrgInfo();
String orgCode = this.getOrgCode(reginParams);
String token = this.getToken();
String appKey = this.getAppKey();
String product = this.getProduct();
return view3dService.retrieve3All(params.getType(),
params.getRiskSourceId(),
params.getAreaId(),
params.getEquipmentId(),
params.getInputText(),
params.getCurrent(),
params.getPageSize(),
orgCode,
params.getDataLevel(),
token,appKey,product);
}
@Permission
@ApiOperation(value = "等级查询",notes = "等级查询")
......
package com.yeejoin.amos.fas.business.dao.mapper;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.yeejoin.amos.fas.business.bo.CheckErrorBo;
import com.yeejoin.amos.fas.business.bo.RiskPointRpnChangeBo;
import com.yeejoin.amos.fas.business.bo.SafetyExecuteBo;
import com.yeejoin.amos.fas.business.vo.View3dNodeVo;
import com.yeejoin.amos.fas.dao.entity.RiskSource;
import org.apache.ibatis.annotations.Param;
import com.yeejoin.amos.fas.core.common.response.Node3DVoResponse;
import com.yeejoin.amos.fas.core.common.response.RegionTreeResponse;
public interface View3dMapper extends BaseMapper{
/**
* 按类型查询点
* @param type
* @param orgCode
* @return
*/
List<RegionTreeResponse> getPointByType(@Param("type")String type,@Param("orgCode")String orgCode,@Param("channelType") String channelType);
/**
* 获取点详情
* @param type
* @param pointId
* @return map
*/
HashMap<String, Object> getPointDetailByTypeAndId(@Param("type")String type, @Param("pointId")Long pointId);
/**
* 统计风险上升异常数量(风险点)-日期+机构
* @param param:{type,orgCode}
* @return Long
*/
Long countUpperRiskPoint(Map<String,Object> param);
/**
* 统计巡检异常数量(不合格、漏检)-日期+机构
* @param param{}
* @return Long
*/
Long countCheckException(Map<String,Object> param);
/**
* 统计故障告警数量(不合格、漏检)-日期+机构
* @param param
* @return
*/
Long countFireException(Map<String,Object> param);
/**
* 今日安全指数详情
* @param params orgCode,date
* @return list
*/
List<RiskPointRpnChangeBo> getAllErrorRiskPoint(Map<String, Object> params);
/**
* 一周安全指数趋势查询
* @param orgCode
* @return
*/
List<HashMap<String, Object>> getSafetyIndexWeek(@Param("orgCode")String orgCode);
/**
* 今日安全指数详情
* @param params orgCode,date
* @return list
*/
List<CheckErrorBo> getAllErrorPatrolPoint(Map<String, Object> params);
/**
* 今日安全指数故障告警详情
* @param params orgCode,date
* @return list
*/
List<CheckErrorBo> getAllFaultAlarm(Map<String, Object> params);
/**
* 今日巡检统计接口
* @param orgCode
* @return
*/
List<HashMap<String, Object>> getStatisticsCheck(String orgCode);
/**
* 风险异常显示最新5条
* @param orgCode
* @return
*/
List<SafetyExecuteBo> getRiskErrorTop5(String orgCode);
/**
* 巡检异常示最新5条
* @param orgCode
* @return
*/
List<SafetyExecuteBo> getCheckErrorTop5(String orgCode);
/**
* 火灾告警最新5条
* @param orgCode
* @return
*/
List<SafetyExecuteBo> getFireAlarmTop5(String orgCode);
/**
* 设备状态最新5条
* @param orgCode
* @return
*/
List<SafetyExecuteBo> getEquipStatusTop5(String orgCode);
/**
* 按照类型查询点
* @param params {orgCode,type}
* @return 列表
*/
List<HashMap<String, Object>> getPintsByType(Map<String, Object> params);
/**
* 更新safetyIndexchangelog
*/
void safetyIndexRefresh();
/**
* 重点模式设备
* @return
*/
List<View3dNodeVo> getImpEqu3dPoints(String orgCode);
/**
* 异常点
* @param type
* @param orgCode
* @param riskSourceId 区域id
* @return
*/
List<View3dNodeVo> initViewErrorNode(String type,Long riskSourceId, String orgCode);
List<Node3DVoResponse> findViewDataByType(@Param("type")String type,@Param("riskSourceId")Long riskSourceId,@Param("orgCode")String orgCode,@Param("abnormalStatus")Boolean abnormalStatus);
Long retrieveAllCount(String type, Long riskSourceId, String inputText,String orgCode,String dataLevel,String protectObjName);
List<HashMap<String, Object>> retrieveAll(String type, Long riskSourceId, 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.dao.mapper;
import com.yeejoin.amos.fas.business.bo.CheckErrorBo;
import com.yeejoin.amos.fas.business.bo.RiskPointRpnChangeBo;
import com.yeejoin.amos.fas.business.bo.SafetyExecuteBo;
import com.yeejoin.amos.fas.business.vo.View3dNodeVo;
import com.yeejoin.amos.fas.core.common.response.Node3DVoResponse;
import com.yeejoin.amos.fas.core.common.response.RegionTreeResponse;
import org.apache.ibatis.annotations.Param;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public interface View3dMapper extends BaseMapper {
/**
* 按类型查询点
*
* @param type
* @param orgCode
* @return
*/
List<RegionTreeResponse> getPointByType(@Param("type") String type, @Param("orgCode") String orgCode, @Param("channelType") String channelType);
/**
* 获取点详情
*
* @param type
* @param pointId
* @return map
*/
HashMap<String, Object> getPointDetailByTypeAndId(@Param("type") String type, @Param("pointId") Long pointId);
/**
* 统计风险上升异常数量(风险点)-日期+机构
*
* @param param:{type,orgCode}
* @return Long
*/
Long countUpperRiskPoint(Map<String, Object> param);
/**
* 统计巡检异常数量(不合格、漏检)-日期+机构
*
* @param param{}
* @return Long
*/
Long countCheckException(Map<String, Object> param);
/**
* 统计故障告警数量(不合格、漏检)-日期+机构
*
* @param param
* @return
*/
Long countFireException(Map<String, Object> param);
/**
* 今日安全指数详情
*
* @param params orgCode,date
* @return list
*/
List<RiskPointRpnChangeBo> getAllErrorRiskPoint(Map<String, Object> params);
/**
* 一周安全指数趋势查询
*
* @param orgCode
* @return
*/
List<HashMap<String, Object>> getSafetyIndexWeek(@Param("orgCode") String orgCode);
/**
* 今日安全指数详情
*
* @param params orgCode,date
* @return list
*/
List<CheckErrorBo> getAllErrorPatrolPoint(Map<String, Object> params);
/**
* 今日安全指数故障告警详情
*
* @param params orgCode,date
* @return list
*/
List<CheckErrorBo> getAllFaultAlarm(Map<String, Object> params);
/**
* 今日巡检统计接口
*
* @param orgCode
* @return
*/
List<HashMap<String, Object>> getStatisticsCheck(String orgCode);
/**
* 风险异常显示最新5条
*
* @param orgCode
* @return
*/
List<SafetyExecuteBo> getRiskErrorTop5(String orgCode);
/**
* 巡检异常示最新5条
*
* @param orgCode
* @return
*/
List<SafetyExecuteBo> getCheckErrorTop5(String orgCode);
/**
* 火灾告警最新5条
*
* @param orgCode
* @return
*/
List<SafetyExecuteBo> getFireAlarmTop5(String orgCode);
/**
* 设备状态最新5条
*
* @param orgCode
* @return
*/
List<SafetyExecuteBo> getEquipStatusTop5(String orgCode);
/**
* 按照类型查询点
*
* @param params {orgCode,type}
* @return 列表
*/
List<HashMap<String, Object>> getPintsByType(Map<String, Object> params);
/**
* 更新safetyIndexchangelog
*/
void safetyIndexRefresh();
/**
* 重点模式设备
*
* @return
*/
List<View3dNodeVo> getImpEqu3dPoints(String orgCode);
/**
* 异常点
*
* @param type
* @param orgCode
* @param riskSourceId 区域id
* @return
*/
List<View3dNodeVo> initViewErrorNode(String type, Long riskSourceId, String orgCode);
List<Node3DVoResponse> findViewDataByType(@Param("type") String type, @Param("riskSourceId") Long riskSourceId, @Param("orgCode") String orgCode, @Param("abnormalStatus") Boolean abnormalStatus);
Long retrieveAllCount(String type, Long riskSourceId, String inputText, String orgCode, String dataLevel, String protectObjName);
List<HashMap<String, Object>> retrieveAll(String type, Long riskSourceId, String inputText, long start, int length, String orgCode, String dataLevel, String protectObjName);
Long retrieve3AllCount(String type, Long riskSourceId, Long areaId, Long equipmentId, String inputText, String orgCode, String dataLevel);
List<HashMap<String, Object>> retrieve3All(String type, Long riskSourceId, Long areaId, Long equipmentId, String inputText, long start, int length, String orgCode, String dataLevel);
/**
* 查询区域下点
*
* @param ids 区域ids
* @return list
*/
List<Map<String, Object>> getAllPointInRegions(@Param("ids") List<Long> ids);
}
......@@ -9,6 +9,8 @@ public class RetrieveParams {
private String dataLevel;
private String protectObjName;
private String riskSourceId;
private Long areaId;
private Long equipmentId;
public String getRiskSourceId() {
return riskSourceId;
......@@ -54,7 +56,20 @@ public class RetrieveParams {
public void setProtectObjName(String protectObjName) {
this.protectObjName = protectObjName;
}
public Long getAreaId() {
return areaId;
}
public void setAreaId(Long areaId) {
this.areaId = areaId;
}
public Long getEquipmentId() {
return equipmentId;
}
public void setEquipmentId(Long equipmentId) {
this.equipmentId = equipmentId;
}
}
......@@ -64,19 +64,18 @@ import java.util.stream.Collectors;
*/
@Service("view3dService")
public class View3dServiceImpl implements IView3dService {
Logger log = LoggerFactory.getLogger(View3dServiceImpl.class);
@Autowired
private View3dMapper view3dMapper;
Logger log = LoggerFactory.getLogger(View3dServiceImpl.class);
@Autowired
private View3dMapper view3dMapper;
@Autowired
private IRiskSourceDao iRiskSourceDao;
@Autowired
private IEquipmentDao iEquipmentDao;
// @Autowired
// @Autowired
// private IWaterResourceDao iWaterResourceDao;
@Autowired
private PatrolMapper patrolMapper;
......@@ -87,7 +86,7 @@ public class View3dServiceImpl implements IView3dService {
@Autowired
private IDutyModeServer dutyModeServer;
@Value("${param.system.online.date}")
private String onLineDate;
......@@ -101,17 +100,17 @@ public class View3dServiceImpl implements IView3dService {
@Override
@Transactional(rollbackFor = Exception.class)
public CommonResponse setPoint3dPosition(List<BindPointBo> pointBoList) {
if (CollectionUtils.isEmpty(pointBoList)){
if (CollectionUtils.isEmpty(pointBoList)) {
return CommonResponseUtil.failure("点不能为空");
}
pointBoList.forEach(pointBo ->{
this.savePointPositionByType(pointBo.getPointType(),pointBo);
pointBoList.forEach(pointBo -> {
this.savePointPositionByType(pointBo.getPointType(), pointBo);
});
return CommonResponseUtil.success();
}
public void savePointPositionByType(String pointType,BindPointBo pointBo){
switch (pointType){
public void savePointPositionByType(String pointType, BindPointBo pointBo) {
switch (pointType) {
case "riskSource":
this.updateRiskSourcePosition(pointBo);
break;
......@@ -199,16 +198,16 @@ public class View3dServiceImpl implements IView3dService {
}
public void updateEquipmentPosition(BindPointBo pointBo) {
Optional<Equipment> data=iEquipmentDao.findById(pointBo.getPointId());
Equipment equipment = null;
if(data.isPresent()){
Optional<Equipment> data = iEquipmentDao.findById(pointBo.getPointId());
Equipment equipment = null;
if (data.isPresent()) {
equipment = data.get();
String ue4Location = pointBo.getUe4Location();
String ue4Rotation = pointBo.getUe4Rotation();
String position3d = pointBo.getPosition3d();
if(ue4Location != null) equipment.setUe4Location(ue4Location);
if(ue4Rotation != null) equipment.setUe4Rotation(ue4Rotation);
if(position3d != null) equipment.setPosition3d(position3d);
if (ue4Location != null) equipment.setUe4Location(ue4Location);
if (ue4Rotation != null) equipment.setUe4Rotation(ue4Rotation);
if (position3d != null) equipment.setPosition3d(position3d);
iEquipmentDao.save(equipment);
}
}
......@@ -219,75 +218,75 @@ public class View3dServiceImpl implements IView3dService {
public void updateRiskSourcePosition(BindPointBo pointBo) {
Optional<RiskSource> data = iRiskSourceDao.findById(pointBo.getPointId());
if(data.isPresent()){
if (data.isPresent()) {
RiskSource riskSource = data.get();
String ue4Location = pointBo.getUe4Location();
String ue4Rotation = pointBo.getUe4Rotation();
String position3d = pointBo.getPosition3d();
if(ue4Location != null) riskSource.setUe4Location(ue4Location);
if(ue4Rotation != null) riskSource.setUe4Rotation(pointBo.getUe4Rotation());
if(position3d != null) riskSource.setPosition3d(position3d);
if (ue4Location != null) riskSource.setUe4Location(ue4Location);
if (ue4Rotation != null) riskSource.setUe4Rotation(pointBo.getUe4Rotation());
if (position3d != null) riskSource.setPosition3d(position3d);
iRiskSourceDao.save(riskSource);
}
}
@Override
public List<Map<String, String>> getPointType() {
return ResourceTypeDefEnum.getTypeList();
}
@Override
public List<RegionTreeResponse> getPointTreeByType(String type,String orgCode,String channelType) {
//查询点
List<RegionTreeResponse> regionList = riskSourceMapper.getRegionList(channelType, orgCode);
//查询区域
List<RegionTreeResponse> pointByType = view3dMapper.getPointByType(type,orgCode,channelType);
pointByType.addAll(regionList);
return convertPointTree(pointByType);
}
//区域列表转树
private static List<RegionTreeResponse> convertPointTree(List<RegionTreeResponse> list) {
HashMap<Long, RegionTreeResponse> hashMap = new HashMap<>();
list.forEach( e -> hashMap.put(e.getId(), e));
List<RegionTreeResponse> treeList = new ArrayList<RegionTreeResponse>();
list.forEach( r -> {
Long parentId = r.getParentId();
if(parentId != null) {
RegionTreeResponse pRegion = hashMap.get(parentId);
if(pRegion != null) {
pRegion.getChildren().add(r);
}else {
treeList.add(r);
}
}
@Override
public List<Map<String, String>> getPointType() {
return ResourceTypeDefEnum.getTypeList();
}
@Override
public List<RegionTreeResponse> getPointTreeByType(String type, String orgCode, String channelType) {
//查询点
List<RegionTreeResponse> regionList = riskSourceMapper.getRegionList(channelType, orgCode);
//查询区域
List<RegionTreeResponse> pointByType = view3dMapper.getPointByType(type, orgCode, channelType);
pointByType.addAll(regionList);
return convertPointTree(pointByType);
}
//区域列表转树
private static List<RegionTreeResponse> convertPointTree(List<RegionTreeResponse> list) {
HashMap<Long, RegionTreeResponse> hashMap = new HashMap<>();
list.forEach(e -> hashMap.put(e.getId(), e));
List<RegionTreeResponse> treeList = new ArrayList<RegionTreeResponse>();
list.forEach(r -> {
Long parentId = r.getParentId();
if (parentId != null) {
RegionTreeResponse pRegion = hashMap.get(parentId);
if (pRegion != null) {
pRegion.getChildren().add(r);
} else {
treeList.add(r);
}
}
});
return treeList;
}
@Override
public HashMap<String, Object> getPointDetailByTypeAndId(String type, Long pointId) {
HashMap<String, Object> detail = view3dMapper.getPointDetailByTypeAndId(type,pointId);
if(detail != null) {
String ue4Location = (String)detail.get("ue4Location");
detail.put("ue4Location", ue4Location == null ? new JSONArray() : JSON.parseArray(ue4Location));
String ue4Rotation = (String)detail.get("ue4Rotation");
detail.put("ue4Rotation", ue4Rotation == null ? new JSONArray() : JSON.parseArray(ue4Rotation));
String ue4Extent = (String)detail.get("ue4Extent");
detail.put("ue4Extent", ue4Location == null ? new JSONArray() : JSON.parseArray(ue4Extent));
detail.put("position3d", this.strPositionToArry(detail.get("position3d")));
}
return detail;
}
@Override
public HashMap<String, Object> getPointDetailByTypeAndId(String type, Long pointId) {
HashMap<String, Object> detail = view3dMapper.getPointDetailByTypeAndId(type, pointId);
if (detail != null) {
String ue4Location = (String) detail.get("ue4Location");
detail.put("ue4Location", ue4Location == null ? new JSONArray() : JSON.parseArray(ue4Location));
String ue4Rotation = (String) detail.get("ue4Rotation");
detail.put("ue4Rotation", ue4Rotation == null ? new JSONArray() : JSON.parseArray(ue4Rotation));
String ue4Extent = (String) detail.get("ue4Extent");
detail.put("ue4Extent", ue4Location == null ? new JSONArray() : JSON.parseArray(ue4Extent));
detail.put("position3d", this.strPositionToArry(detail.get("position3d")));
}
return detail;
}
@Override
public TodaySafetyIndexVo getSafetyIndexInfoByDate(String orgCode,String date) {
if(!StringUtil.isNotEmpty(date)){
date = DateUtil.getDateFormat(new Date(),DateUtil.DATE_DEFAULT_FORMAT);
public TodaySafetyIndexVo getSafetyIndexInfoByDate(String orgCode, String date) {
if (!StringUtil.isNotEmpty(date)) {
date = DateUtil.getDateFormat(new Date(), DateUtil.DATE_DEFAULT_FORMAT);
}
Optional<RiskSource> optional = iRiskSourceDao.findByOrgCodeAndParentId(orgCode,0L);
Optional<RiskSource> optional = iRiskSourceDao.findByOrgCodeAndParentId(orgCode, 0L);
TodaySafetyIndexVo vo = new TodaySafetyIndexVo();
if(optional.isPresent()){ //1.按照等级进行转换rpn为分数-机构
if (optional.isPresent()) { //1.按照等级进行转换rpn为分数-机构
RiskSource riskSource = optional.get();
double safetyIndex = this.changeRpnToSafetyIndex(riskSource.getRpn());
vo.setSafetyIndex(safetyIndex);
......@@ -295,14 +294,14 @@ public class View3dServiceImpl implements IView3dService {
Long upperNum = this.getRiskUpperNum(orgCode, date);
vo.setRiskExceptionNum(upperNum);
//3.统计巡检异常数量(不合格、漏检)-日期+机构
Long checkExceptionNum = this.getCheckExceptionNum(orgCode,date);
Long checkExceptionNum = this.getCheckExceptionNum(orgCode, date);
vo.setCheckExceptionNum(checkExceptionNum);
//4.统计故障数量-日期+机构
vo.setFireExceptionNum(getFireExceptionNum(orgCode,date));
vo.setFireExceptionNum(getFireExceptionNum(orgCode, date));
//5.安全值提示
if (riskSource.getRiskLevelId() != null){
if (riskSource.getRiskLevelId() != null) {
Optional<RiskLevel> opt = iRiskLevelDao.findById(riskSource.getRiskLevelId());
if(opt.isPresent()){
if (opt.isPresent()) {
Integer level = opt.get().getLevel();
String tips = RiskSourceLevelEum.getTipsByLevel(String.valueOf(level));
vo.setSafetyTips(tips);
......@@ -310,120 +309,119 @@ public class View3dServiceImpl implements IView3dService {
}
}
} else {
throw new YeeException("机构:"+orgCode+" 不存在");
throw new YeeException("机构:" + orgCode + " 不存在");
}
return vo;
}
@Override
public List<SafetyIndexDetailVo> getSafetyIndexDetail(String type,String orgCode) {
public List<SafetyIndexDetailVo> getSafetyIndexDetail(String type, String orgCode) {
List<SafetyIndexDetailVo> resultList = Lists.newArrayList();
String dateStr = DateUtil.getDateFormat(new Date(),DateUtil.DATE_DEFAULT_FORMAT);
Map<String,Object> params = new HashMap<>();
params.put("orgCode",orgCode);
params.put("date",dateStr);
if(StatisticsErrorTypeEum.risk.getCode().equals(type)){
String dateStr = DateUtil.getDateFormat(new Date(), DateUtil.DATE_DEFAULT_FORMAT);
Map<String, Object> params = new HashMap<>();
params.put("orgCode", orgCode);
params.put("date", dateStr);
if (StatisticsErrorTypeEum.risk.getCode().equals(type)) {
//1.按照日期+机构,查询出所有风险点
List<RiskPointRpnChangeBo> risks = view3dMapper.getAllErrorRiskPoint(params);
//2.按照 风险等级id进行分组,加工数据
Map<Long,List<RiskPointRpnChangeBo>> map = risks.stream().collect(Collectors.groupingBy(RiskPointRpnChangeBo::getRiskLevelId));
Map<Long, List<RiskPointRpnChangeBo>> map = risks.stream().collect(Collectors.groupingBy(RiskPointRpnChangeBo::getRiskLevelId));
List<RiskLevel> riskLevelList = iRiskLevelDao.findAll();
Map<Long,RiskLevel> riskLevelMap = riskLevelList.stream().collect(Collectors.toMap(RiskLevel::getId, Function.identity()));
map.forEach((k,v)->{
Map<Long, RiskLevel> riskLevelMap = riskLevelList.stream().collect(Collectors.toMap(RiskLevel::getId, Function.identity()));
map.forEach((k, v) -> {
SafetyIndexDetailVo safetyIndexDetailVo = new SafetyIndexDetailVo();
safetyIndexDetailVo.setTypeCode(String.valueOf(riskLevelMap.get(k).getLevel()));
safetyIndexDetailVo.setTypeName(riskLevelMap.get(k).getName());
safetyIndexDetailVo.setContent(getErrorContentVos(v));
resultList.add(safetyIndexDetailVo);
});
} else if(StatisticsErrorTypeEum.check.getCode().equals(type)){
} else if (StatisticsErrorTypeEum.check.getCode().equals(type)) {
//1.按照日期+机构,查询出异常巡检
List<CheckErrorBo> checkErrorBoList = view3dMapper.getAllErrorPatrolPoint(params);
//2.按照状态进行分组,加工返回数据
Map<String,List<CheckErrorBo>> map = checkErrorBoList.stream().collect(Collectors.groupingBy(CheckErrorBo::getStatus));
map.forEach((k,v)->{
Map<String, List<CheckErrorBo>> map = checkErrorBoList.stream().collect(Collectors.groupingBy(CheckErrorBo::getStatus));
map.forEach((k, v) -> {
SafetyIndexDetailVo safetyIndexDetailVo = new SafetyIndexDetailVo();
safetyIndexDetailVo.setTypeCode(k);
safetyIndexDetailVo.setTypeName(CheckStatusEnum.getEnum(k).getName());
safetyIndexDetailVo.setContent(getErrorContentVos(v));
resultList.add(safetyIndexDetailVo);
});
} else if(StatisticsErrorTypeEum.equip.getCode().equals(type)){
} else if (StatisticsErrorTypeEum.equip.getCode().equals(type)) {
//TODO:待毛颖确认调整完成后继续
List<CheckErrorBo> checkErrorBoList = view3dMapper.getAllFaultAlarm(params);
Map<String,List<CheckErrorBo>> map = checkErrorBoList.stream().collect(Collectors.groupingBy(CheckErrorBo::getStatus));
map.forEach((k,v)->{
SafetyIndexDetailVo safetyIndexDetailVo = new SafetyIndexDetailVo();
safetyIndexDetailVo.setTypeCode(k);
safetyIndexDetailVo.setTypeName(k);
safetyIndexDetailVo.setContent(getErrorContentVos(v));
resultList.add(safetyIndexDetailVo);
});
List<CheckErrorBo> checkErrorBoList = view3dMapper.getAllFaultAlarm(params);
Map<String, List<CheckErrorBo>> map = checkErrorBoList.stream().collect(Collectors.groupingBy(CheckErrorBo::getStatus));
map.forEach((k, v) -> {
SafetyIndexDetailVo safetyIndexDetailVo = new SafetyIndexDetailVo();
safetyIndexDetailVo.setTypeCode(k);
safetyIndexDetailVo.setTypeName(k);
safetyIndexDetailVo.setContent(getErrorContentVos(v));
resultList.add(safetyIndexDetailVo);
});
}
return resultList;
}
private List<ErrorContentVo> getErrorContentVos(List<?> v) {
List<ErrorContentVo> errorContentVoList = new ArrayList<>();
errorContentVoList = v.stream().map(e->{
errorContentVoList = v.stream().map(e -> {
ErrorContentVo errorContentVo = new ErrorContentVo();
BeanUtils.copyProperties(e,errorContentVo);
BeanUtils.copyProperties(e, errorContentVo);
return errorContentVo;
}).collect(Collectors.toList());
return errorContentVoList;
}
private Long getCheckExceptionNum(String orgCode, String date) {
Map<String,Object> params = new HashMap<>();
Map<String, Object> params = new HashMap<>();
params.put("orgCode", orgCode);
params.put("date", date);
return view3dMapper.countCheckException(params);
}
private Long getRiskUpperNum(String orgCode, String date) {
Map<String,Object> param = new HashMap<>();
Map<String, Object> param = new HashMap<>();
param.put("type", RpnChangeTypeEum.upper.getValue());
param.put("orgCode", orgCode);
param.put("date", date);
return view3dMapper.countUpperRiskPoint(param);
}
private Long getFireExceptionNum(String orgCode, String date) {
Map<String,Object> params = new HashMap<>();
Map<String, Object> params = new HashMap<>();
params.put("orgCode", orgCode);
params.put("date", date);
return view3dMapper.countFireException(params);
}
private double changeRpnToSafetyIndex(BigDecimal rpn) {
BigDecimal rpnBig = rpn == null ? new BigDecimal("0") : rpn;
BigDecimal rpnBig = rpn == null ? new BigDecimal("0") : rpn;
//计算规则:除10 减100 求绝对值,结果保留1位小数
return rpnBig.divide(new BigDecimal("10")).subtract(new BigDecimal("100")).abs().setScale(1,BigDecimal.ROUND_HALF_UP).doubleValue();
return rpnBig.divide(new BigDecimal("10")).subtract(new BigDecimal("100")).abs().setScale(1, BigDecimal.ROUND_HALF_UP).doubleValue();
}
@Override
public List<HashMap<String, Object>> getSafetyIndexWeek(String orgCode) {
return view3dMapper.getSafetyIndexWeek(orgCode);
}
@Override
public List<HashMap<String, Object>> getSafetyIndexWeek(String orgCode) {
return view3dMapper.getSafetyIndexWeek(orgCode);
}
@Override
public Map<String, Object> getSystemOnlineDate(String orgCode) {
Date beginDate = DateUtil.formatDate(onLineDate,DateUtil.DATE_DEFAULT_FORMAT);
Date beginDate = DateUtil.formatDate(onLineDate, DateUtil.DATE_DEFAULT_FORMAT);
Date now = DateUtil.getNow();
return DateUtil.dayComparePrecise(beginDate,now);
return DateUtil.dayComparePrecise(beginDate, now);
}
@Override
public List<ExceptionRegionVo> getExceptionRegion(String orgCode) {
Optional<RiskSource> optional = iRiskSourceDao.findByOrgCodeAndParentId(orgCode,0L);
Optional<RiskSource> optional = iRiskSourceDao.findByOrgCodeAndParentId(orgCode, 0L);
List<ExceptionRegionVo> exceptionList = new ArrayList<>();
if (optional.isPresent()) {
List<RiskSource> regionList = iRiskSourceDao.findByParentIdAndIsRegion(optional.get().getId(),RiskSourceRegionEum.TRUE.getCode());
List<RiskSource> regionList = iRiskSourceDao.findByParentIdAndIsRegion(optional.get().getId(), RiskSourceRegionEum.TRUE.getCode());
exceptionList = regionList.stream().filter(riskSource -> {
BigDecimal rpn = riskSource.getRpn() == null ? new BigDecimal("0") : riskSource.getRpn();
BigDecimal rpni = riskSource.getRpni() == null ? new BigDecimal("0") : riskSource.getRpni();
BigDecimal rpn = riskSource.getRpn() == null ? new BigDecimal("0") : riskSource.getRpn();
BigDecimal rpni = riskSource.getRpni() == null ? new BigDecimal("0") : riskSource.getRpni();
return rpn.subtract(rpni).doubleValue() > 0;
}).map(riskSource -> {
ExceptionRegionVo regionVo = new ExceptionRegionVo();
......@@ -440,192 +438,217 @@ public class View3dServiceImpl implements IView3dService {
return exceptionList;
}
private JSONArray getInitJSONArray(String str){
if(StringUtil.isNotEmpty(str)){
private JSONArray getInitJSONArray(String str) {
if (StringUtil.isNotEmpty(str)) {
return JSON.parseArray(str);
} else {
return new JSONArray();
}
}
private JSONObject changeStringToJson(String str){
if(StringUtil.isNotEmpty(str)){
private JSONObject changeStringToJson(String str) {
if (StringUtil.isNotEmpty(str)) {
return JSON.parseObject(str);
}else {
} else {
return new JSONObject();
}
}
private Boolean isBreakDown(Long id){
private Boolean isBreakDown(Long id) {
return true;
}
@Override
public List<Map<String, Object>> getStatisticsCheck(String orgCode) {
List<HashMap<String, Object>> statisticsCheck = view3dMapper.getStatisticsCheck(orgCode);
List<Map<String, Object>> stateList = PlanTaskDetailStatusEnum.getEnumList();
stateList.forEach(s -> {
if(statisticsCheck !=null ) {
Long value = 0L;
for(HashMap<String, Object> sc:statisticsCheck) {
String typeString = sc.get("type").toString();
String enumType = s.get("type").toString();
if(typeString.equals(enumType)) {
value = (Long)sc.get("value");
break;
}
}
s.put("value", value);
}
});
return stateList;
}
@Override
public List<SafetyExecuteBo> getSafetyExecuteListTop5(String type,String orgCode) {
StatisticsErrorTypeEum.risk.getCode();
switch (type) {
case "risk"://风险异常
return view3dMapper.getRiskErrorTop5(orgCode);
case "check"://巡检异常
return view3dMapper.getCheckErrorTop5(orgCode);
case "fire"://火灾告警
return view3dMapper.getFireAlarmTop5(orgCode);
default:
throw new YeeException("不支持的类型 -->"+ type);
}
}
@Override
public CommonResponse getStatisticsDuty(String appKey,String product,String token, String orgCode) {
Date curDate = new Date();
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
JSONObject param = new JSONObject();
param.put("dutyDate", curDate);
return dutyModeServer.dutyListByDay(appKey,product,token,orgCode,param.toJSONString());
}
@Override
public List<SafetyExecuteBo> getEquipStatusList(String orgCode) {
return view3dMapper.getEquipStatusTop5(orgCode);
}
@Override
public List<View3dNodeVo> initViewErrorNode(String type,Long riskSourceId, String orgCode) {
return view3dMapper.initViewErrorNode(type,riskSourceId,orgCode);
}
@Override
public CommonResponse get3dPointsByModel(String orgCode,String model) {
if(model.equals("grain")) {
List<HashMap<String, Object>> points = new ArrayList<>();
return CommonResponseUtil.success(this.getPointsByType(orgCode,FasConstant.ALL_POINT));
}else if(model.equals("impEquipment")) {
return CommonResponseUtil.success(view3dMapper.getImpEqu3dPoints(orgCode));
}
log.error("模式暂不支持 --> " + model);
return CommonResponseUtil.failure("模式暂不支持 --> " + model);
}
private List<HashMap<String, Object>> getPointsByType(String orgCode,String type){
public List<Map<String, Object>> getStatisticsCheck(String orgCode) {
List<HashMap<String, Object>> statisticsCheck = view3dMapper.getStatisticsCheck(orgCode);
List<Map<String, Object>> stateList = PlanTaskDetailStatusEnum.getEnumList();
stateList.forEach(s -> {
if (statisticsCheck != null) {
Long value = 0L;
for (HashMap<String, Object> sc : statisticsCheck) {
String typeString = sc.get("type").toString();
String enumType = s.get("type").toString();
if (typeString.equals(enumType)) {
value = (Long) sc.get("value");
break;
}
}
s.put("value", value);
}
});
return stateList;
}
@Override
public List<SafetyExecuteBo> getSafetyExecuteListTop5(String type, String orgCode) {
StatisticsErrorTypeEum.risk.getCode();
switch (type) {
case "risk"://风险异常
return view3dMapper.getRiskErrorTop5(orgCode);
case "check"://巡检异常
return view3dMapper.getCheckErrorTop5(orgCode);
case "fire"://火灾告警
return view3dMapper.getFireAlarmTop5(orgCode);
default:
throw new YeeException("不支持的类型 -->" + type);
}
}
@Override
public CommonResponse getStatisticsDuty(String appKey, String product, String token, String orgCode) {
Date curDate = new Date();
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
JSONObject param = new JSONObject();
param.put("dutyDate", curDate);
return dutyModeServer.dutyListByDay(appKey, product, token, orgCode, param.toJSONString());
}
@Override
public List<SafetyExecuteBo> getEquipStatusList(String orgCode) {
return view3dMapper.getEquipStatusTop5(orgCode);
}
@Override
public List<View3dNodeVo> initViewErrorNode(String type, Long riskSourceId, String orgCode) {
return view3dMapper.initViewErrorNode(type, riskSourceId, orgCode);
}
@Override
public CommonResponse get3dPointsByModel(String orgCode, String model) {
if (model.equals("grain")) {
List<HashMap<String, Object>> points = new ArrayList<>();
return CommonResponseUtil.success(this.getPointsByType(orgCode, FasConstant.ALL_POINT));
} else if (model.equals("impEquipment")) {
return CommonResponseUtil.success(view3dMapper.getImpEqu3dPoints(orgCode));
}
log.error("模式暂不支持 --> " + model);
return CommonResponseUtil.failure("模式暂不支持 --> " + model);
}
private List<HashMap<String, Object>> getPointsByType(String orgCode, String type) {
//1.查询数据
List<HashMap<String, Object>> points = new ArrayList<>();
Map<String,Object> params = new HashMap<>();
params.put("orgCode",orgCode);
Map<String, Object> params = new HashMap<>();
params.put("orgCode", orgCode);
params.put("type", FasConstant.ALL_POINT.equalsIgnoreCase(type) ? null : type);
points = view3dMapper.getPintsByType(params);
//2.坐标相关字段转json
points.forEach(point ->{
points.forEach(point -> {
JSONArray ue4Location = this.getInitJSONArray(String.valueOf(point.get("ue4Location")));
JSONArray ue4Rotation = this.getInitJSONArray(String.valueOf(point.get("ue4Rotation")));
String[] relationKeys = point.get("relationKeys") != null ? String.valueOf(point.get("relationKeys")).split(",") : null;
point.put("ue4Location",ue4Location);
point.put("ue4Rotation",ue4Rotation);
point.put("relationKeys",relationKeys);
point.put("ue4Location", ue4Location);
point.put("ue4Rotation", ue4Rotation);
point.put("relationKeys", relationKeys);
});
return points;
}
@Override
public void safetyIndexLogGenJob(String runData) {
Date collectDate = StringUtil.isNotEmpty(runData) ? DateUtil.formatDate(runData,DateUtil.DATE_DEFAULT_FORMAT) : DateUtil.getDayBefore(new Date());
//1.安全指数流水生成
@Override
public void safetyIndexLogGenJob(String runData) {
Date collectDate = StringUtil.isNotEmpty(runData) ? DateUtil.formatDate(runData, DateUtil.DATE_DEFAULT_FORMAT) : DateUtil.getDayBefore(new Date());
//1.安全指数流水生成
try {
List<RiskSource> riskSources = iRiskSourceDao.findByParentId(0L);
List<SafetyIndexChangeLog> safetyIndexChangeLogs = new ArrayList<>();
List<RiskSource> riskSources = iRiskSourceDao.findByParentId(0L);
List<SafetyIndexChangeLog> safetyIndexChangeLogs = new ArrayList<>();
safetyIndexChangeLogs = riskSources.stream().map(riskSource -> {
SafetyIndexChangeLog safetyIndexChangeLog = new SafetyIndexChangeLog();
safetyIndexChangeLog.setOrgCode(riskSource.getOrgCode());
double changeRpnToSafetyIndex = this.changeRpnToSafetyIndex(riskSource.getRpn());
safetyIndexChangeLog.setSafetyIndex(BigDecimal.valueOf(changeRpnToSafetyIndex));
safetyIndexChangeLog.setCollectDate(collectDate);
return safetyIndexChangeLog;
}).collect(Collectors.toList());;
iSafetyIndexChangeLogDao.saveAll(safetyIndexChangeLogs);
} catch (Exception e) {
log.error("安全指数流水生成失败: " + e.getMessage());
}
//2.通知日切进行数据刷新
SafetyIndexChangeLog safetyIndexChangeLog = new SafetyIndexChangeLog();
safetyIndexChangeLog.setOrgCode(riskSource.getOrgCode());
double changeRpnToSafetyIndex = this.changeRpnToSafetyIndex(riskSource.getRpn());
safetyIndexChangeLog.setSafetyIndex(BigDecimal.valueOf(changeRpnToSafetyIndex));
safetyIndexChangeLog.setCollectDate(collectDate);
return safetyIndexChangeLog;
}).collect(Collectors.toList());
;
iSafetyIndexChangeLogDao.saveAll(safetyIndexChangeLogs);
} catch (Exception e) {
log.error("安全指数流水生成失败: " + e.getMessage());
}
//2.通知日切进行数据刷新
iDataRefreshService.refreshViewData(DataRefreshTypeEum.dateChange.getCode());
}
@Override
public List<Node3DVoResponse> find3dViewDataByType(String type,Long riskSourceId,String orgCode,Boolean abnormalStatus) {
return view3dMapper.findViewDataByType(type,riskSourceId,orgCode,abnormalStatus);
}
@Override
public CommonResponse retrieveAll(String type, String riskSourceId, String inputText, int current, int pageSize,String orgCode,String dataLevel,String protectObjName,String token,String appKey,String product) {
CommonPageable pageable = new CommonPageable( current, pageSize);
Long riskSource = StringUtils.isEmpty(riskSourceId) ? null : Long.parseLong(riskSourceId);
Long count = view3dMapper.retrieveAllCount(type,riskSource,inputText,orgCode,dataLevel,protectObjName);
List<HashMap<String, Object>> retrieveAll = view3dMapper.retrieveAll(type, riskSource,inputText,pageable.getOffset(),pageable.getPageSize(),orgCode,dataLevel,protectObjName);
Set<Object> userIds = new HashSet<>();
retrieveAll.forEach(action->{
if(!ObjectUtils.isEmpty(action.get("person"))){
userIds.add(action.get("person").toString());
}
});
Map<String,String> userMap = remoteSecurityService.getUserRealName(token, product, appKey, userIds);
retrieveAll.stream().forEach(e->{
String positionDTO = (String)e.get("positionDTO");
JSONArray ue4Location = this.getInitJSONArray(String.valueOf(e.get("ue4Location")));
JSONArray ue4Rotation = this.getInitJSONArray(String.valueOf(e.get("ue4Rotation")));
if(!ObjectUtils.isEmpty(e.get("person"))){
e.put("person", userMap.get(e.get("person").toString()));
}
CoordDTO position = null;
if(positionDTO != null && !positionDTO.equals("")) {
position = JSONObject.parseObject(positionDTO, CoordDTO.class);
}
e.put("position",position);
e.put("ue4Location",ue4Location);
e.put("ue4Rotation",ue4Rotation);
e.put("showInfo",true);
});
Page result = new PageImpl(retrieveAll,pageable,count);
return CommonResponseUtil.success(result);
}
@Override
public List<Map<String,String>> pointLevelList(String type) {
switch (type) {
case "riskSource":
return RiskSourceLevelEum.getLevelEnumList();
case "patrol":
return PlanTaskDetailStatusEnum.getErrorLevelEnumList();
default:
throw new YeeException("不支持的类型 -->"+ type);
}
}
}
@Override
public List<Node3DVoResponse> find3dViewDataByType(String type, Long riskSourceId, String orgCode, Boolean abnormalStatus) {
return view3dMapper.findViewDataByType(type, riskSourceId, orgCode, abnormalStatus);
}
@Override
public CommonResponse retrieveAll(String type, String riskSourceId, String inputText, int current, int pageSize, String orgCode, String dataLevel, String protectObjName, String token, String appKey, String product) {
CommonPageable pageable = new CommonPageable(current, pageSize);
Long riskSource = StringUtils.isEmpty(riskSourceId) ? null : Long.parseLong(riskSourceId);
Long count = view3dMapper.retrieveAllCount(type, riskSource, inputText, orgCode, dataLevel, protectObjName);
List<HashMap<String, Object>> retrieveAll = view3dMapper.retrieveAll(type, riskSource, inputText, pageable.getOffset(), pageable.getPageSize(), orgCode, dataLevel, protectObjName);
Set<Object> userIds = new HashSet<>();
retrieveAll.forEach(action -> {
if (!ObjectUtils.isEmpty(action.get("person"))) {
userIds.add(action.get("person").toString());
}
});
Map<String, String> userMap = remoteSecurityService.getUserRealName(token, product, appKey, userIds);
retrieveAll.stream().forEach(e -> {
String positionDTO = (String) e.get("positionDTO");
JSONArray ue4Location = this.getInitJSONArray(String.valueOf(e.get("ue4Location")));
JSONArray ue4Rotation = this.getInitJSONArray(String.valueOf(e.get("ue4Rotation")));
if (!ObjectUtils.isEmpty(e.get("person"))) {
e.put("person", userMap.get(e.get("person").toString()));
}
CoordDTO position = null;
if (positionDTO != null && !positionDTO.equals("")) {
position = JSONObject.parseObject(positionDTO, CoordDTO.class);
}
e.put("position", position);
e.put("ue4Location", ue4Location);
e.put("ue4Rotation", ue4Rotation);
e.put("showInfo", true);
});
Page result = new PageImpl(retrieveAll, pageable, count);
return CommonResponseUtil.success(result);
}
@Override
public CommonResponse retrieve3All(String type, String riskSourceId, Long areaId, Long equipmentId, String inputText, int current, int pageSize, String orgCode, String dataLevel, String token, String appKey, String product) {
CommonPageable pageable = new CommonPageable(current, pageSize);
Long riskSource = StringUtils.isEmpty(riskSourceId) ? null : Long.parseLong(riskSourceId);
Long count = view3dMapper.retrieve3AllCount(type, riskSource, areaId, equipmentId, inputText, orgCode, dataLevel);
List<HashMap<String, Object>> retrieveAll = view3dMapper.retrieve3All(type, riskSource, areaId, equipmentId, inputText, pageable.getOffset(), pageable.getPageSize(), orgCode, dataLevel);
Set<Object> userIds = new HashSet<>();
retrieveAll.forEach(action -> {
if (!ObjectUtils.isEmpty(action.get("person"))) {
userIds.add(action.get("person").toString());
}
});
Map<String, String> userMap = remoteSecurityService.getUserRealName(token, product, appKey, userIds);
retrieveAll.stream().forEach(e -> {
String positionDTO = (String) e.get("positionDTO");
if (!ObjectUtils.isEmpty(e.get("person"))) {
e.put("person", userMap.get(e.get("person").toString()));
}
e.put("showInfo", true);
});
Page result = new PageImpl(retrieveAll, pageable, count);
return CommonResponseUtil.success(result);
}
@Override
public List<Map<String, String>> pointLevelList(String type) {
switch (type) {
case "riskSource":
return RiskSourceLevelEum.getLevelEnumList();
case "patrol":
return PlanTaskDetailStatusEnum.getErrorLevelEnumList();
default:
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:查询区域及子区域下所有点
if (FasConstant.ALL_POINT.equalsIgnoreCase(type)) {//分支1:查询区域及子区域下所有点
List<Long> regionIds = new ArrayList<>();
List<RiskSource> riskSourceList = iRiskSourceDao.findByParentId(regionId);
this.getAllRiskRegion(regionIds,riskSourceList);
this.getAllRiskRegion(regionIds, riskSourceList);
regionIds.add(regionId);
pointList = this.getPointsByRegionIds(regionIds);
} else {//分支2:查询指定区域下所有点
......@@ -635,12 +658,13 @@ public class View3dServiceImpl implements IView3dService {
}
private List<Map<String,Object>> getPointsByRegionIds(List<Long> ids){
private List<Map<String, Object>> getPointsByRegionIds(List<Long> ids) {
return view3dMapper.getAllPointInRegions(ids);
}
/**
* 获得子节点:区域
*
* @param ids 返回
* @param riskSourceList 风险点区域列表
*/
......@@ -656,9 +680,10 @@ public class View3dServiceImpl implements IView3dService {
}
}
}
private JSONArray strPositionToArry(Object position3d){
private JSONArray strPositionToArry(Object position3d) {
JSONArray jsonArray = new JSONArray();
if(StringUtil.isNotEmpty(position3d)){
if (StringUtil.isNotEmpty(position3d)) {
String[] arryStr = position3d.toString().split(",");
List<Double> collect = Arrays.stream(arryStr).map(Double::parseDouble).collect(Collectors.toList());
jsonArray.addAll(collect);
......
package com.yeejoin.amos.fas.business.service.intfc;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.yeejoin.amos.fas.business.bo.BindPointBo;
import com.yeejoin.amos.fas.business.bo.SafetyExecuteBo;
import com.yeejoin.amos.fas.business.vo.ExceptionRegionVo;
......@@ -15,6 +11,10 @@ import com.yeejoin.amos.fas.core.common.response.Node3DVoResponse;
import com.yeejoin.amos.fas.core.common.response.RegionTreeResponse;
import com.yeejoin.amos.fas.core.util.CommonResponse;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author DELL
*/
......@@ -84,7 +84,7 @@ public interface IView3dService {
List<ExceptionRegionVo> getExceptionRegion(String orgCode);
/**
* 今日巡检统计接口
* @param orgCode
......@@ -112,7 +112,7 @@ public interface IView3dService {
* @return
*/
List<SafetyExecuteBo> getEquipStatusList(String orgCode);
/**
* 左侧菜单(异常点)
* @param type
......@@ -134,7 +134,7 @@ public interface IView3dService {
* @param runData 日切日期
*/
void safetyIndexLogGenJob(String runData);
/**
* 3维异常点查询
* @param type
......@@ -159,12 +159,27 @@ public interface IView3dService {
*/
CommonResponse retrieveAll(String type, String riskRourceId, String inputText, int current, int pageSize,String orgCode,String dataLevel,String protectObjName,String token,String appKey,String product);
/**
* 等级查询
* @param type
* @return
*/
List<Map<String,String>> pointLevelList(String type);
/**
* 检索
*
* @param type 类型
* @param riskRourceId
* @param inputText 关键字
* @param dataLevel 风险等级
* @param current
* @param pageSize
* @param orgCode
* @return
*/
CommonResponse retrieve3All(String type, String riskRourceId, Long areaId, Long equipmentId, String inputText, int current, int pageSize, String orgCode, String dataLevel, String token, String appKey, String product);
/**
* 等级查询
*
* @param type
* @return
*/
List<Map<String, String>> pointLevelList(String type);
/**
* 查询区域下的各类点
......
......@@ -3,325 +3,325 @@
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yeejoin.amos.fas.business.dao.mapper.View3dMapper">
<!-- <select id="getPointByType" resultType="com.yeejoin.amos.fas.core.common.response.RegionTreeResponse">-->
<!-- <choose>-->
<!-- <when test="type == 'riskSource'">-->
<!-- select-->
<!-- R.id,R.name,R.code,R.parent_id,R.ue4_location,R.ue4_rotation,R.ue4_extent,-->
<!-- <choose>-->
<!-- <when test="channelType == '3dpage'">-->
<!-- IF(ISNULL(position3d) || LENGTH(trim(position3d)) <![CDATA[ <]]> 1,0,1) as is_bind,-->
<!-- </when>-->
<!-- <otherwise>-->
<!-- IF(ISNULL(IF(replace(trim(ue4_rotation),'[]','')='',NULL,R.ue4_rotation))-->
<!-- AND ISNULL(IF(replace(trim(ue4_location),'[]','')='',NULL,R.ue4_location)),0,1) as is_bind,-->
<!-- </otherwise>-->
<!-- </choose>-->
<!-- #{type} as type,-->
<!-- route_path,-->
<!-- rl.level,-->
<!-- CONCAT('level_',rl.level) as level_str,-->
<!-- 0 as is_region,-->
<!-- R.position3d-->
<!-- from f_risk_source R-->
<!-- left join f_risk_level rl on rl.id = R.risk_level_id-->
<!-- where 1=1-->
<!-- AND R.risk_level_id is not null-->
<!-- AND R.is_region = 'FALSE'-->
<!-- </when>-->
<!-- <when test="type == 'patrol'">-->
<!-- select-->
<!-- B.id,B.risk_source_id as parent_id,-->
<!-- <choose>-->
<!-- <when test="channelType == '3dpage'">-->
<!-- IF(ISNULL(B.coordinates) || LENGTH(trim(B.coordinates)) <![CDATA[ <]]> 1,0,1) as is_bind,-->
<!-- </when>-->
<!-- <otherwise>-->
<!-- IF(ISNULL(IF(replace(trim(B.ue4_rotation),'[]','')='',NULL,B.ue4_rotation))-->
<!-- AND ISNULL(IF(replace(trim(B.ue4_location),'[]','')='',NULL,B.ue4_location)),0,1) as is_bind,-->
<!-- </otherwise>-->
<!-- </choose>-->
<!-- #{type} as type,-->
<!-- B.name as name,B.point_no as code,B.ue4_location,B.ue4_rotation,-->
<!-- 0 as is_region,-->
<!-- B.coordinates as position3d,-->
<!-- B.status as level,-->
<!-- CONCAT('level_',B.status) as level_str-->
<!-- from f_risk_source R-->
<!-- left join p_point B on B.risk_source_id = R.id AND R.is_region='TRUE'-->
<!-- where 1=1-->
<!-- AND B.id is not null AND B.is_delete = 0-->
<!-- </when>-->
<!-- <when test="type == 'impEquipment'">-->
<!-- select-->
<!-- B.id,B.risk_source_id as parent_id,-->
<!-- <choose>-->
<!-- <when test="channelType == '3dpage'">-->
<!-- IF(ISNULL(B.position3d) || LENGTH(trim(B.position3d)) <![CDATA[ <]]> 1,0,1) as is_bind,-->
<!-- </when>-->
<!-- <otherwise>-->
<!-- IF(ISNULL(IF(replace(trim(B.ue4_rotation),'[]','')='',NULL,B.ue4_rotation))-->
<!-- AND ISNULL(IF(replace(trim(B.ue4_location),'[]','')='',NULL,B.ue4_location)),0,1) as is_bind,-->
<!-- </otherwise>-->
<!-- </choose>-->
<!-- #{type} as type,-->
<!-- B.name,B.code,B.ue4_location,B.ue4_rotation,-->
<!-- 0 as is_region,-->
<!-- B.position3d-->
<!-- from f_risk_source R-->
<!-- left join f_equipment B on B.risk_source_id = R.id AND R.is_region='TRUE'-->
<!-- where 1=1-->
<!-- AND B.id is not null-->
<!-- </when>-->
<!-- <when test="type == 'monitorEquipment'">-->
<!-- select-->
<!-- B.id,B.risk_source_id as parent_id,-->
<!-- <choose>-->
<!-- <when test="channelType == '3dpage'">-->
<!-- IF(ISNULL(B.position3d) || LENGTH(trim(B.position3d)) <![CDATA[ <]]> 1,0,1) as is_bind,-->
<!-- </when>-->
<!-- <otherwise>-->
<!-- IF(ISNULL(IF(replace(trim(B.ue4_rotation),'[]','')='',NULL,B.ue4_rotation))-->
<!-- AND ISNULL(IF(replace(trim(B.ue4_location),'[]','')='',NULL,B.ue4_location)),0,1) as is_bind,-->
<!-- </otherwise>-->
<!-- </choose>-->
<!-- #{type} as type,-->
<!-- B.name,B.code,B.ue4_location,B.ue4_rotation,-->
<!-- 0 as is_region,-->
<!-- B.position3d-->
<!-- from f_risk_source R-->
<!-- left join f_fire_equipment B on B.risk_source_id = R.id AND B.equip_classify = 0-->
<!-- where 1=1-->
<!-- AND B.id is not null-->
<!-- </when>-->
<!-- <when test="type == 'video'">-->
<!-- select-->
<!-- B.id,B.risk_source_id as parent_id,-->
<!-- <choose>-->
<!-- <when test="channelType == '3dpage'">-->
<!-- IF(ISNULL(B.position3d) || LENGTH(trim(B.position3d)) <![CDATA[ <]]> 1,0,1) as is_bind,-->
<!-- </when>-->
<!-- <otherwise>-->
<!-- IF(ISNULL(IF(replace(trim(B.ue4_rotation),'[]','')='',NULL,B.ue4_rotation))-->
<!-- AND ISNULL(IF(replace(trim(B.ue4_location),'[]','')='',NULL,B.ue4_location)),0,1) as is_bind,-->
<!-- </otherwise>-->
<!-- </choose>-->
<!-- #{type} as type,-->
<!-- B.name,B.code,B.ue4_location,B.ue4_rotation,-->
<!-- 0 as is_region,-->
<!-- B.position3d-->
<!-- from f_risk_source R-->
<!-- left join f_fire_equipment B on B.risk_source_id = R.id AND B.equip_classify = 2-->
<!-- where 1=1-->
<!-- AND B.id is not null-->
<!-- </when>-->
<!-- <when test="type == 'fireEquipment'">-->
<!-- select tmp.id,tmp.name,tmp.type,tmp.position3d,tmp.ue4_rotation,tmp.ue4_location,tmp.code,R.id as parent_id,-->
<!-- <choose>-->
<!-- <when test="channelType == '3dpage'">-->
<!-- IF(ISNULL(tmp.position3d) || LENGTH(trim(tmp.position3d)) <![CDATA[ <]]> 1,0,1) as isBind-->
<!-- </when>-->
<!-- <otherwise>-->
<!-- IF(ISNULL(IF(replace(trim(tmp.ue4_rotation),'[]','')='',NULL,tmp.ue4_rotation))-->
<!-- AND ISNULL(IF(replace(trim(tmp.ue4_location),'[]','')='',NULL,tmp.ue4_location)),0,1) as isBind-->
<!-- </otherwise>-->
<!-- </choose>-->
<!-- from (-->
<!-- select id,name,'fireCar' as type,position3d,car_num as code,ue4_location,ue4_rotation,risk_source_id-->
<!-- from f_fire_car-->
<!-- union all-->
<!-- select id,name,'fireEquipment' as type,position3d,code,ue4_location,ue4_rotation,risk_source_id-->
<!-- from f_fire_equipment-->
<!-- where equip_classify =3-->
<!-- union all-->
<!-- select id,name,CASE-->
<!-- WHEN S.type = 1 then 'fireChamber'-->
<!-- WHEN S.type = 2 then 'fireFoamRoom'-->
<!-- END as type,position3d,code,ue4_location,ue4_rotation,risk_source_id-->
<!-- from f_fire_station s-->
<!-- union all-->
<!-- select id,name,-->
<!-- CASE-->
<!-- WHEN W.type = 1 then 'hydrant'-->
<!-- WHEN W.type = 2 then 'pool'-->
<!-- END as type,position3d,code,ue4_location,ue4_rotation,risk_source_id-->
<!-- from f_water_resource w-->
<!-- ) tmp-->
<!-- left join f_risk_source R on R.id = tmp.risk_source_id-->
<!-- <select id="getPointByType" resultType="com.yeejoin.amos.fas.core.common.response.RegionTreeResponse">-->
<!-- <choose>-->
<!-- <when test="type == 'riskSource'">-->
<!-- select-->
<!-- R.id,R.name,R.code,R.parent_id,R.ue4_location,R.ue4_rotation,R.ue4_extent,-->
<!-- <choose>-->
<!-- <when test="channelType == '3dpage'">-->
<!-- IF(ISNULL(position3d) || LENGTH(trim(position3d)) <![CDATA[ <]]> 1,0,1) as is_bind,-->
<!-- </when>-->
<!-- <otherwise>-->
<!-- IF(ISNULL(IF(replace(trim(ue4_rotation),'[]','')='',NULL,R.ue4_rotation))-->
<!-- AND ISNULL(IF(replace(trim(ue4_location),'[]','')='',NULL,R.ue4_location)),0,1) as is_bind,-->
<!-- </otherwise>-->
<!-- </choose>-->
<!-- #{type} as type,-->
<!-- route_path,-->
<!-- rl.level,-->
<!-- CONCAT('level_',rl.level) as level_str,-->
<!-- 0 as is_region,-->
<!-- R.position3d-->
<!-- from f_risk_source R-->
<!-- left join f_risk_level rl on rl.id = R.risk_level_id-->
<!-- where 1=1-->
<!-- AND R.risk_level_id is not null-->
<!-- AND R.is_region = 'FALSE'-->
<!-- </when>-->
<!-- <when test="type == 'patrol'">-->
<!-- select-->
<!-- B.id,B.risk_source_id as parent_id,-->
<!-- <choose>-->
<!-- <when test="channelType == '3dpage'">-->
<!-- IF(ISNULL(B.coordinates) || LENGTH(trim(B.coordinates)) <![CDATA[ <]]> 1,0,1) as is_bind,-->
<!-- </when>-->
<!-- <otherwise>-->
<!-- IF(ISNULL(IF(replace(trim(B.ue4_rotation),'[]','')='',NULL,B.ue4_rotation))-->
<!-- AND ISNULL(IF(replace(trim(B.ue4_location),'[]','')='',NULL,B.ue4_location)),0,1) as is_bind,-->
<!-- </otherwise>-->
<!-- </choose>-->
<!-- #{type} as type,-->
<!-- B.name as name,B.point_no as code,B.ue4_location,B.ue4_rotation,-->
<!-- 0 as is_region,-->
<!-- B.coordinates as position3d,-->
<!-- B.status as level,-->
<!-- CONCAT('level_',B.status) as level_str-->
<!-- from f_risk_source R-->
<!-- left join p_point B on B.risk_source_id = R.id AND R.is_region='TRUE'-->
<!-- where 1=1-->
<!-- AND B.id is not null AND B.is_delete = 0-->
<!-- </when>-->
<!-- <when test="type == 'impEquipment'">-->
<!-- select-->
<!-- B.id,B.risk_source_id as parent_id,-->
<!-- <choose>-->
<!-- <when test="channelType == '3dpage'">-->
<!-- IF(ISNULL(B.position3d) || LENGTH(trim(B.position3d)) <![CDATA[ <]]> 1,0,1) as is_bind,-->
<!-- </when>-->
<!-- <otherwise>-->
<!-- IF(ISNULL(IF(replace(trim(B.ue4_rotation),'[]','')='',NULL,B.ue4_rotation))-->
<!-- AND ISNULL(IF(replace(trim(B.ue4_location),'[]','')='',NULL,B.ue4_location)),0,1) as is_bind,-->
<!-- </otherwise>-->
<!-- </choose>-->
<!-- #{type} as type,-->
<!-- B.name,B.code,B.ue4_location,B.ue4_rotation,-->
<!-- 0 as is_region,-->
<!-- B.position3d-->
<!-- from f_risk_source R-->
<!-- left join f_equipment B on B.risk_source_id = R.id AND R.is_region='TRUE'-->
<!-- where 1=1-->
<!-- AND B.id is not null-->
<!-- </when>-->
<!-- <when test="type == 'monitorEquipment'">-->
<!-- select-->
<!-- B.id,B.risk_source_id as parent_id,-->
<!-- <choose>-->
<!-- <when test="channelType == '3dpage'">-->
<!-- IF(ISNULL(B.position3d) || LENGTH(trim(B.position3d)) <![CDATA[ <]]> 1,0,1) as is_bind,-->
<!-- </when>-->
<!-- <otherwise>-->
<!-- IF(ISNULL(IF(replace(trim(B.ue4_rotation),'[]','')='',NULL,B.ue4_rotation))-->
<!-- AND ISNULL(IF(replace(trim(B.ue4_location),'[]','')='',NULL,B.ue4_location)),0,1) as is_bind,-->
<!-- </otherwise>-->
<!-- </choose>-->
<!-- #{type} as type,-->
<!-- B.name,B.code,B.ue4_location,B.ue4_rotation,-->
<!-- 0 as is_region,-->
<!-- B.position3d-->
<!-- from f_risk_source R-->
<!-- left join f_fire_equipment B on B.risk_source_id = R.id AND B.equip_classify = 0-->
<!-- where 1=1-->
<!-- AND B.id is not null-->
<!-- </when>-->
<!-- <when test="type == 'video'">-->
<!-- select-->
<!-- B.id,B.risk_source_id as parent_id,-->
<!-- <choose>-->
<!-- <when test="channelType == '3dpage'">-->
<!-- IF(ISNULL(B.position3d) || LENGTH(trim(B.position3d)) <![CDATA[ <]]> 1,0,1) as is_bind,-->
<!-- </when>-->
<!-- <otherwise>-->
<!-- IF(ISNULL(IF(replace(trim(B.ue4_rotation),'[]','')='',NULL,B.ue4_rotation))-->
<!-- AND ISNULL(IF(replace(trim(B.ue4_location),'[]','')='',NULL,B.ue4_location)),0,1) as is_bind,-->
<!-- </otherwise>-->
<!-- </choose>-->
<!-- #{type} as type,-->
<!-- B.name,B.code,B.ue4_location,B.ue4_rotation,-->
<!-- 0 as is_region,-->
<!-- B.position3d-->
<!-- from f_risk_source R-->
<!-- left join f_fire_equipment B on B.risk_source_id = R.id AND B.equip_classify = 2-->
<!-- where 1=1-->
<!-- AND B.id is not null-->
<!-- </when>-->
<!-- <when test="type == 'fireEquipment'">-->
<!-- select tmp.id,tmp.name,tmp.type,tmp.position3d,tmp.ue4_rotation,tmp.ue4_location,tmp.code,R.id as parent_id,-->
<!-- <choose>-->
<!-- <when test="channelType == '3dpage'">-->
<!-- IF(ISNULL(tmp.position3d) || LENGTH(trim(tmp.position3d)) <![CDATA[ <]]> 1,0,1) as isBind-->
<!-- </when>-->
<!-- <otherwise>-->
<!-- IF(ISNULL(IF(replace(trim(tmp.ue4_rotation),'[]','')='',NULL,tmp.ue4_rotation))-->
<!-- AND ISNULL(IF(replace(trim(tmp.ue4_location),'[]','')='',NULL,tmp.ue4_location)),0,1) as isBind-->
<!-- </otherwise>-->
<!-- </choose>-->
<!-- from (-->
<!-- select id,name,'fireCar' as type,position3d,car_num as code,ue4_location,ue4_rotation,risk_source_id-->
<!-- from f_fire_car-->
<!-- union all-->
<!-- select id,name,'fireEquipment' as type,position3d,code,ue4_location,ue4_rotation,risk_source_id-->
<!-- from f_fire_equipment-->
<!-- where equip_classify =3-->
<!-- union all-->
<!-- select id,name,CASE-->
<!-- WHEN S.type = 1 then 'fireChamber'-->
<!-- WHEN S.type = 2 then 'fireFoamRoom'-->
<!-- END as type,position3d,code,ue4_location,ue4_rotation,risk_source_id-->
<!-- from f_fire_station s-->
<!-- union all-->
<!-- select id,name,-->
<!-- CASE-->
<!-- WHEN W.type = 1 then 'hydrant'-->
<!-- WHEN W.type = 2 then 'pool'-->
<!-- END as type,position3d,code,ue4_location,ue4_rotation,risk_source_id-->
<!-- from f_water_resource w-->
<!-- ) tmp-->
<!-- left join f_risk_source R on R.id = tmp.risk_source_id-->
<!-- </when>-->
<!-- </choose>-->
<!-- <if test="orgCode != null">-->
<!-- AND (R.org_code = #{orgCode} OR R.org_code like CONCAT(#{orgCode},'-%'))-->
<!-- </if>-->
<!-- </select>-->
<!-- </when>-->
<!-- </choose>-->
<!-- <if test="orgCode != null">-->
<!-- AND (R.org_code = #{orgCode} OR R.org_code like CONCAT(#{orgCode},'-%'))-->
<!-- </if>-->
<!-- </select>-->
<!-- <select id="getPointDetailByTypeAndId" resultType="java.util.HashMap">-->
<!-- <choose>-->
<!-- <when test="type == 'riskSource'">-->
<!-- select rs.id,rs.name,rs.code,rs.ue4_location as ue4Location,rs.ue4_rotation as ue4Rotation,rs.position3d,-->
<!-- rl.level,rl.name as levelStr,rs.floor3d ,rs.is_indoor as isIndoor,-->
<!-- rs.flicker_frequency as frequency,-->
<!-- true as 'showInfo',-->
<!-- #{type} as type,-->
<!-- rs.rpn as title-->
<!-- from f_risk_source rs-->
<!-- left join f_risk_level rl ON rl.id = rs.risk_level_id-->
<!-- where 1=1-->
<!-- <if test="pointId != null">-->
<!-- AND rs.id = #{pointId}-->
<!-- </if>-->
<!-- </when>-->
<!-- <when test="type == 'patrol'">-->
<!-- select id,name,point_no as code,ue4_location as ue4Location,ue4_rotation as ue4Rotation,coordinates as position3d,-->
<!-- status,floor as floor3d,is_indoor as isIndoor,-->
<!-- 0 as frequency,-->
<!-- case p.status-->
<!-- when '0' then false-->
<!-- when '1' then false-->
<!-- else true-->
<!-- end as `showInfo`,-->
<!-- case p.status-->
<!-- when '0' then '未计划'-->
<!-- when '1' then '合格'-->
<!-- when '2' then '不合格'-->
<!-- when '3' then '漏检'-->
<!-- end as title,-->
<!-- case p.status-->
<!-- when '0' then '未计划'-->
<!-- when '1' then '合格'-->
<!-- when '2' then '不合格'-->
<!-- when '3' then '漏检'-->
<!-- end as levelStr,-->
<!-- #{type} as type,-->
<!-- status as level-->
<!-- from p_point p-->
<!-- where 1=1 and is_delete = 0-->
<!-- <if test="pointId != null">-->
<!-- AND id = #{pointId}-->
<!-- </if>-->
<!-- </when>-->
<!-- <when test="type == 'impEquipment'">-->
<!-- select id,name,code,ue4_location as ue4Location,ue4_rotation as ue4Rotation,position3d,-->
<!-- floor3d,is_indoor as isIndoor,-->
<!-- 0 as frequency,-->
<!-- false as 'showInfo',-->
<!-- #{type} as type,-->
<!-- name as 'title'-->
<!-- from f_equipment-->
<!-- where 1=1-->
<!-- <if test="pointId != null">-->
<!-- AND id = #{pointId}-->
<!-- </if>-->
<!-- </when>-->
<!-- <when test="type == 'monitorEquipment'">-->
<!-- select id,name,code,ue4_location as ue4Location,ue4_rotation as ue4Rotation,position3d,-->
<!-- floor3d,is_indoor as isIndoor,-->
<!-- 0 as frequency,-->
<!-- false as 'showInfo',-->
<!-- #{type} as type,-->
<!-- name as 'title'-->
<!-- from f_fire_equipment-->
<!-- where equip_classify = 0-->
<!-- <if test="pointId != null">-->
<!-- AND id = #{pointId}-->
<!-- </if>-->
<!-- </when>-->
<!-- <when test="type == 'video'">-->
<!-- select id,name,code,ue4_location as ue4Location,ue4_rotation as ue4Rotation,position3d,-->
<!-- floor3d,is_indoor as isIndoor,-->
<!-- 0 as frequency,-->
<!-- false as 'showInfo',-->
<!-- #{type} as type,-->
<!-- name as 'title'-->
<!-- from f_fire_equipment-->
<!-- where equip_classify = 2-->
<!-- <if test="pointId != null">-->
<!-- AND id = #{pointId}-->
<!-- </if>-->
<!-- </when>-->
<!-- <when test="type == 'hydrant'">-->
<!-- select id,name,code,ue4_location as ue4Location,ue4_rotation as ue4Rotation,position3d,-->
<!-- floor3d,is_indoor as isIndoor,-->
<!-- 0 as frequency,-->
<!-- false as 'showInfo',-->
<!-- #{type} as type,-->
<!-- name as 'title'-->
<!-- from f_water_resource-->
<!-- where type = 1-->
<!-- <if test="pointId != null">-->
<!-- AND id = #{pointId}-->
<!-- </if>-->
<!-- </when>-->
<!-- <when test="type == 'pool'">-->
<!-- select id,name,code,ue4_location as ue4Location,ue4_rotation as ue4Rotation,position3d,-->
<!-- floor3d,is_indoor as isIndoor,-->
<!-- 0 as frequency,-->
<!-- false as 'showInfo',-->
<!-- #{type} as type,-->
<!-- name as 'title'-->
<!-- from f_water_resource-->
<!-- where type = 2-->
<!-- <if test="pointId != null">-->
<!-- AND id = #{pointId}-->
<!-- </if>-->
<!-- </when>-->
<!-- <when test="type == 'fireCar'">-->
<!-- select id,name,car_num as code,ue4_location as ue4Location,ue4_rotation as ue4Rotation,position3d,-->
<!-- floor3d,is_indoor as isIndoor,-->
<!-- 0 as frequency,-->
<!-- true as 'showInfo',-->
<!-- #{type} as type,-->
<!-- name as 'title'-->
<!-- from f_fire_car-->
<!-- where 1=1-->
<!-- <if test="pointId != null">-->
<!-- AND id = #{pointId}-->
<!-- </if>-->
<!-- </when>-->
<!-- <when test="type == 'fireEquipment'">-->
<!-- select id,name,code,ue4_location as ue4Location,ue4_rotation as ue4Rotation,position3d,-->
<!-- floor3d,is_indoor as isIndoor,-->
<!-- 0 as frequency,-->
<!-- true as 'showInfo',-->
<!-- #{type} as type,-->
<!-- name as 'title'-->
<!-- from f_fire_equipment-->
<!-- where equip_classify = 3-->
<!-- <if test="pointId != null">-->
<!-- AND id = #{pointId}-->
<!-- </if>-->
<!-- </when>-->
<!-- <when test="type == 'fireChamber'">-->
<!-- select id,name,code,ue4_location as ue4Location,ue4_rotation as ue4Rotation,position3d,-->
<!-- floor3d,is_indoor as isIndoor,-->
<!-- 0 as frequency,-->
<!-- true as 'showInfo',-->
<!-- #{type} as type,-->
<!-- name as 'title'-->
<!-- from f_fire_station-->
<!-- where type = 1-->
<!-- <if test="pointId != null">-->
<!-- AND id = #{pointId}-->
<!-- </if>-->
<!-- </when>-->
<!-- <when test="type == 'fireFoamRoom'">-->
<!-- select id,name,code,ue4_location as ue4Location,ue4_rotation as ue4Rotation,position3d,-->
<!-- floor3d,is_indoor as isIndoor,-->
<!-- 0 as frequency,-->
<!-- true as 'showInfo',-->
<!-- #{type} as type,-->
<!-- name as 'title'-->
<!-- from f_fire_station-->
<!-- where type = 2-->
<!-- <if test="pointId != null">-->
<!-- AND id = #{pointId}-->
<!-- </if>-->
<!-- </when>-->
<!-- </choose>-->
<!-- </select>-->
<!-- <select id="getPointDetailByTypeAndId" resultType="java.util.HashMap">-->
<!-- <choose>-->
<!-- <when test="type == 'riskSource'">-->
<!-- select rs.id,rs.name,rs.code,rs.ue4_location as ue4Location,rs.ue4_rotation as ue4Rotation,rs.position3d,-->
<!-- rl.level,rl.name as levelStr,rs.floor3d ,rs.is_indoor as isIndoor,-->
<!-- rs.flicker_frequency as frequency,-->
<!-- true as 'showInfo',-->
<!-- #{type} as type,-->
<!-- rs.rpn as title-->
<!-- from f_risk_source rs-->
<!-- left join f_risk_level rl ON rl.id = rs.risk_level_id-->
<!-- where 1=1-->
<!-- <if test="pointId != null">-->
<!-- AND rs.id = #{pointId}-->
<!-- </if>-->
<!-- </when>-->
<!-- <when test="type == 'patrol'">-->
<!-- select id,name,point_no as code,ue4_location as ue4Location,ue4_rotation as ue4Rotation,coordinates as position3d,-->
<!-- status,floor as floor3d,is_indoor as isIndoor,-->
<!-- 0 as frequency,-->
<!-- case p.status-->
<!-- when '0' then false-->
<!-- when '1' then false-->
<!-- else true-->
<!-- end as `showInfo`,-->
<!-- case p.status-->
<!-- when '0' then '未计划'-->
<!-- when '1' then '合格'-->
<!-- when '2' then '不合格'-->
<!-- when '3' then '漏检'-->
<!-- end as title,-->
<!-- case p.status-->
<!-- when '0' then '未计划'-->
<!-- when '1' then '合格'-->
<!-- when '2' then '不合格'-->
<!-- when '3' then '漏检'-->
<!-- end as levelStr,-->
<!-- #{type} as type,-->
<!-- status as level-->
<!-- from p_point p-->
<!-- where 1=1 and is_delete = 0-->
<!-- <if test="pointId != null">-->
<!-- AND id = #{pointId}-->
<!-- </if>-->
<!-- </when>-->
<!-- <when test="type == 'impEquipment'">-->
<!-- select id,name,code,ue4_location as ue4Location,ue4_rotation as ue4Rotation,position3d,-->
<!-- floor3d,is_indoor as isIndoor,-->
<!-- 0 as frequency,-->
<!-- false as 'showInfo',-->
<!-- #{type} as type,-->
<!-- name as 'title'-->
<!-- from f_equipment-->
<!-- where 1=1-->
<!-- <if test="pointId != null">-->
<!-- AND id = #{pointId}-->
<!-- </if>-->
<!-- </when>-->
<!-- <when test="type == 'monitorEquipment'">-->
<!-- select id,name,code,ue4_location as ue4Location,ue4_rotation as ue4Rotation,position3d,-->
<!-- floor3d,is_indoor as isIndoor,-->
<!-- 0 as frequency,-->
<!-- false as 'showInfo',-->
<!-- #{type} as type,-->
<!-- name as 'title'-->
<!-- from f_fire_equipment-->
<!-- where equip_classify = 0-->
<!-- <if test="pointId != null">-->
<!-- AND id = #{pointId}-->
<!-- </if>-->
<!-- </when>-->
<!-- <when test="type == 'video'">-->
<!-- select id,name,code,ue4_location as ue4Location,ue4_rotation as ue4Rotation,position3d,-->
<!-- floor3d,is_indoor as isIndoor,-->
<!-- 0 as frequency,-->
<!-- false as 'showInfo',-->
<!-- #{type} as type,-->
<!-- name as 'title'-->
<!-- from f_fire_equipment-->
<!-- where equip_classify = 2-->
<!-- <if test="pointId != null">-->
<!-- AND id = #{pointId}-->
<!-- </if>-->
<!-- </when>-->
<!-- <when test="type == 'hydrant'">-->
<!-- select id,name,code,ue4_location as ue4Location,ue4_rotation as ue4Rotation,position3d,-->
<!-- floor3d,is_indoor as isIndoor,-->
<!-- 0 as frequency,-->
<!-- false as 'showInfo',-->
<!-- #{type} as type,-->
<!-- name as 'title'-->
<!-- from f_water_resource-->
<!-- where type = 1-->
<!-- <if test="pointId != null">-->
<!-- AND id = #{pointId}-->
<!-- </if>-->
<!-- </when>-->
<!-- <when test="type == 'pool'">-->
<!-- select id,name,code,ue4_location as ue4Location,ue4_rotation as ue4Rotation,position3d,-->
<!-- floor3d,is_indoor as isIndoor,-->
<!-- 0 as frequency,-->
<!-- false as 'showInfo',-->
<!-- #{type} as type,-->
<!-- name as 'title'-->
<!-- from f_water_resource-->
<!-- where type = 2-->
<!-- <if test="pointId != null">-->
<!-- AND id = #{pointId}-->
<!-- </if>-->
<!-- </when>-->
<!-- <when test="type == 'fireCar'">-->
<!-- select id,name,car_num as code,ue4_location as ue4Location,ue4_rotation as ue4Rotation,position3d,-->
<!-- floor3d,is_indoor as isIndoor,-->
<!-- 0 as frequency,-->
<!-- true as 'showInfo',-->
<!-- #{type} as type,-->
<!-- name as 'title'-->
<!-- from f_fire_car-->
<!-- where 1=1-->
<!-- <if test="pointId != null">-->
<!-- AND id = #{pointId}-->
<!-- </if>-->
<!-- </when>-->
<!-- <when test="type == 'fireEquipment'">-->
<!-- select id,name,code,ue4_location as ue4Location,ue4_rotation as ue4Rotation,position3d,-->
<!-- floor3d,is_indoor as isIndoor,-->
<!-- 0 as frequency,-->
<!-- true as 'showInfo',-->
<!-- #{type} as type,-->
<!-- name as 'title'-->
<!-- from f_fire_equipment-->
<!-- where equip_classify = 3-->
<!-- <if test="pointId != null">-->
<!-- AND id = #{pointId}-->
<!-- </if>-->
<!-- </when>-->
<!-- <when test="type == 'fireChamber'">-->
<!-- select id,name,code,ue4_location as ue4Location,ue4_rotation as ue4Rotation,position3d,-->
<!-- floor3d,is_indoor as isIndoor,-->
<!-- 0 as frequency,-->
<!-- true as 'showInfo',-->
<!-- #{type} as type,-->
<!-- name as 'title'-->
<!-- from f_fire_station-->
<!-- where type = 1-->
<!-- <if test="pointId != null">-->
<!-- AND id = #{pointId}-->
<!-- </if>-->
<!-- </when>-->
<!-- <when test="type == 'fireFoamRoom'">-->
<!-- select id,name,code,ue4_location as ue4Location,ue4_rotation as ue4Rotation,position3d,-->
<!-- floor3d,is_indoor as isIndoor,-->
<!-- 0 as frequency,-->
<!-- true as 'showInfo',-->
<!-- #{type} as type,-->
<!-- name as 'title'-->
<!-- from f_fire_station-->
<!-- where type = 2-->
<!-- <if test="pointId != null">-->
<!-- AND id = #{pointId}-->
<!-- </if>-->
<!-- </when>-->
<!-- </choose>-->
<!-- </select>-->
<select id="getSafetyIndexWeek" resultType="java.util.HashMap">
<select id="getSafetyIndexWeek" resultType="java.util.HashMap">
<![CDATA[
SELECT distinct temp1.*,IFNULL(S.safety_index,0) as value
FROM (
......@@ -353,7 +353,7 @@
and b.risk_level_id is not NULL
) as frcl
</select>
<select id="countCheckException" resultType="long">
<select id="countCheckException" resultType="long">
SELECT
count(distinct pc.point_id)
FROM
......@@ -367,7 +367,7 @@
AND pc.`is_ok` = '2'
</select>
<select id="countFireException" resultType="long">
<select id="countFireException" resultType="long">
SELECT
count(1)
FROM
......@@ -379,7 +379,7 @@
AND date_format(a.update_date, '%Y-%m-%d') = #{date}
</select>
<select id="getAllErrorRiskPoint" resultType="com.yeejoin.amos.fas.business.bo.RiskPointRpnChangeBo" >
<select id="getAllErrorRiskPoint" resultType="com.yeejoin.amos.fas.business.bo.RiskPointRpnChangeBo">
SELECT
rcl.id,
rcl.create_date AS changeDate,
......@@ -403,7 +403,7 @@
AND (rs.org_code = #{orgCode} OR rs.org_code like CONCAT(#{orgCode},'-%'))
</select>
<select id="getAllErrorPatrolPoint" resultType="com.yeejoin.amos.fas.business.bo.CheckErrorBo">
<select id="getAllErrorPatrolPoint" resultType="com.yeejoin.amos.fas.business.bo.CheckErrorBo">
SELECT
pc.point_id id,
......@@ -422,7 +422,7 @@
GROUP BY pc.point_id,pc.`is_ok`,pc.point_name
</select>
<select id="getAllFaultAlarm" resultType="com.yeejoin.amos.fas.business.bo.CheckErrorBo">
<select id="getAllFaultAlarm" resultType="com.yeejoin.amos.fas.business.bo.CheckErrorBo">
select
ala.id,
ala.equipment_specific_name as name,
......@@ -441,7 +441,7 @@
</select>
<select id="getStatisticsCheck" resultType="java.util.HashMap">
<select id="getStatisticsCheck" resultType="java.util.HashMap">
<![CDATA[
SELECT IFNULL(d.STATUS,'') AS type, count(1) as value
FROM p_plan_task_detail d
......@@ -460,7 +460,7 @@
]]>
</select>
<select id="getRiskErrorTop5" resultType="com.yeejoin.amos.fas.business.bo.SafetyExecuteBo">
<select id="getRiskErrorTop5" resultType="com.yeejoin.amos.fas.business.bo.SafetyExecuteBo">
SELECT n.id,r.code,r.name as label,r.id as pointId,'risk' as type,n.create_date as changeDate
FROM f_rpn_change_log n
LEFT JOIN f_risk_source r ON r.id = n.risk_source_id
......@@ -470,7 +470,7 @@
limit 0,5
</select>
<select id="getCheckErrorTop5" resultType="com.yeejoin.amos.fas.business.bo.SafetyExecuteBo">
<select id="getCheckErrorTop5" resultType="com.yeejoin.amos.fas.business.bo.SafetyExecuteBo">
SELECT p.id,I.point_no as code,
IF(p.is_ok = '2', CONCAT(I.name,' 不合格') ,CONCAT(I.name,' 漏检') ) as label,
p.point_id,'patrol' as type,p.check_time as changeDate
......@@ -483,7 +483,7 @@
limit 0,5
</select>
<select id="getFireAlarmTop5" resultType="com.yeejoin.amos.fas.business.bo.SafetyExecuteBo">
<select id="getFireAlarmTop5" resultType="com.yeejoin.amos.fas.business.bo.SafetyExecuteBo">
SELECT
ala.id,
ala.equipment_specific_id AS pointId,
......@@ -524,7 +524,7 @@
limit 0,5
</select>
<select id="getEquipStatusTop5" resultType="com.yeejoin.amos.fas.business.bo.SafetyExecuteBo">
<select id="getEquipStatusTop5" resultType="com.yeejoin.amos.fas.business.bo.SafetyExecuteBo">
SELECT
wlesi.id,
wlesi.`value` STATUS,
......@@ -557,226 +557,226 @@
5
</select>
<!-- <select id="getPintsByType" resultType="hashmap">-->
<!-- select CONCAT(type,'-',id) as `key`,sp.* from-->
<!-- (select id,name,code,ue4_location as ue4Location,ue4_rotation as ue4Rotation ,'riskSource' as type,org_code as orgCode,-->
<!-- null as relationKeys-->
<!-- from f_risk_source where is_region = 'FALSE'-->
<!-- UNION all-->
<!-- select id,name,point_no as code,ue4_location as ue4Location,ue4_rotation as ue4Rotation ,'patrol' as type,org_code as orgCode,-->
<!-- null as relationKeys-->
<!-- from p_point WHERE is_delete = FALSE-->
<!-- UNION all-->
<!-- select id,name,code,ue4_location as ue4Location,ue4_rotation as ue4Rotation ,'impEquipment' as type,org_code as orgCode,-->
<!-- tmp.relationKeys-->
<!-- from f_equipment e-->
<!-- LEFT JOIN-->
<!-- (select GROUP_CONCAT(fire_equipment_id) as relationKeys,equipment_id from f_equipment_fire_equipment GROUP BY equipment_id) tmp-->
<!-- ON TMP.equipment_id = e.id-->
<!-- UNION all-->
<!-- select id,name,code,ue4_location as ue4Location,ue4_rotation as ue4Rotation ,'monitorEquipment' as type,org_code as orgCode,-->
<!-- null as relationKeys-->
<!-- from f_fire_equipment where equip_classify = 0-->
<!-- UNION all-->
<!-- select id,name,code,ue4_location as ue4Location,ue4_rotation as ue4Rotation ,'video' as type,org_code as orgCode,-->
<!-- null as relationKeys-->
<!-- from f_fire_equipment where equip_classify = 2-->
<!-- UNION all-->
<!-- select id,name,code,ue4_location as ue4Location,ue4_rotation as ue4Rotation ,'hydrant' as type,org_code as orgCode,-->
<!-- null as relationKeys-->
<!-- from f_water_resource where type = 1-->
<!-- UNION all-->
<!-- select id,name,code,ue4_location as ue4Location,ue4_rotation as ue4Rotation,'pool' as type,org_code as orgCode,-->
<!-- null as relationKeys-->
<!-- from f_water_resource where type = 2-->
<!-- UNION all-->
<!-- select id,name,car_num as code,ue4_location as ue4Location,ue4_rotation as ue4Rotation, 'fireCar' as type,org_code as orgCode,-->
<!-- null as relationKeys-->
<!-- from f_fire_car-->
<!-- UNION all-->
<!-- select id,name,code,ue4_location as ue4Location,ue4_rotation as ue4Rotation,'fireEquipment' as type,org_code as orgCode,-->
<!-- null as relationKeys-->
<!-- from f_fire_equipment where equip_classify = 3-->
<!-- UNION all-->
<!-- select id,name,code,ue4_location as ue4Location,ue4_rotation as ue4Rotation , 'fireChamber' as type,org_code as orgCode,-->
<!-- null as relationKeys-->
<!-- from f_fire_station where type = 2-->
<!-- UNION all-->
<!-- select id,name,code,ue4_location as ue4Location,ue4_rotation as ue4Rotation ,'fireFoamRoom' as type,org_code as orgCode,-->
<!-- null as relationKeys-->
<!-- from f_fire_station where type = 1-->
<!-- ) as sp-->
<!-- where-->
<!-- sp.orgCode = #{orgCode}-->
<!-- <if test="type!=null">and sp.type =#{type}</if>-->
<!-- </select>-->
<!-- <select id="getPintsByType" resultType="hashmap">-->
<!-- select CONCAT(type,'-',id) as `key`,sp.* from-->
<!-- (select id,name,code,ue4_location as ue4Location,ue4_rotation as ue4Rotation ,'riskSource' as type,org_code as orgCode,-->
<!-- null as relationKeys-->
<!-- from f_risk_source where is_region = 'FALSE'-->
<!-- UNION all-->
<!-- select id,name,point_no as code,ue4_location as ue4Location,ue4_rotation as ue4Rotation ,'patrol' as type,org_code as orgCode,-->
<!-- null as relationKeys-->
<!-- from p_point WHERE is_delete = FALSE-->
<!-- UNION all-->
<!-- select id,name,code,ue4_location as ue4Location,ue4_rotation as ue4Rotation ,'impEquipment' as type,org_code as orgCode,-->
<!-- tmp.relationKeys-->
<!-- from f_equipment e-->
<!-- LEFT JOIN-->
<!-- (select GROUP_CONCAT(fire_equipment_id) as relationKeys,equipment_id from f_equipment_fire_equipment GROUP BY equipment_id) tmp-->
<!-- ON TMP.equipment_id = e.id-->
<!-- UNION all-->
<!-- select id,name,code,ue4_location as ue4Location,ue4_rotation as ue4Rotation ,'monitorEquipment' as type,org_code as orgCode,-->
<!-- null as relationKeys-->
<!-- from f_fire_equipment where equip_classify = 0-->
<!-- UNION all-->
<!-- select id,name,code,ue4_location as ue4Location,ue4_rotation as ue4Rotation ,'video' as type,org_code as orgCode,-->
<!-- null as relationKeys-->
<!-- from f_fire_equipment where equip_classify = 2-->
<!-- UNION all-->
<!-- select id,name,code,ue4_location as ue4Location,ue4_rotation as ue4Rotation ,'hydrant' as type,org_code as orgCode,-->
<!-- null as relationKeys-->
<!-- from f_water_resource where type = 1-->
<!-- UNION all-->
<!-- select id,name,code,ue4_location as ue4Location,ue4_rotation as ue4Rotation,'pool' as type,org_code as orgCode,-->
<!-- null as relationKeys-->
<!-- from f_water_resource where type = 2-->
<!-- UNION all-->
<!-- select id,name,car_num as code,ue4_location as ue4Location,ue4_rotation as ue4Rotation, 'fireCar' as type,org_code as orgCode,-->
<!-- null as relationKeys-->
<!-- from f_fire_car-->
<!-- UNION all-->
<!-- select id,name,code,ue4_location as ue4Location,ue4_rotation as ue4Rotation,'fireEquipment' as type,org_code as orgCode,-->
<!-- null as relationKeys-->
<!-- from f_fire_equipment where equip_classify = 3-->
<!-- UNION all-->
<!-- select id,name,code,ue4_location as ue4Location,ue4_rotation as ue4Rotation , 'fireChamber' as type,org_code as orgCode,-->
<!-- null as relationKeys-->
<!-- from f_fire_station where type = 2-->
<!-- UNION all-->
<!-- select id,name,code,ue4_location as ue4Location,ue4_rotation as ue4Rotation ,'fireFoamRoom' as type,org_code as orgCode,-->
<!-- null as relationKeys-->
<!-- from f_fire_station where type = 1-->
<!-- ) as sp-->
<!-- where-->
<!-- sp.orgCode = #{orgCode}-->
<!-- <if test="type!=null">and sp.type =#{type}</if>-->
<!-- </select>-->
<!-- <select id="getImpEqu3dPoints" resultType="com.yeejoin.amos.fas.business.vo.View3dNodeVo">-->
<!-- SELECT id,name,code,ue4_location,ue4_rotation,-->
<!-- case-->
<!-- when equip_classify= 0 then 'monitorEquipment'-->
<!-- when equip_classify= 2 then 'video'-->
<!-- when equip_classify= 3 then 'fireEquipment'-->
<!-- end as type,-->
<!-- case-->
<!-- when equip_classify= 0 then 'monitorEquipment'-->
<!-- when equip_classify= 2 then 'video'-->
<!-- when equip_classify= 3 then 'fireEquipment'-->
<!-- end as level,-->
<!-- null as relationKeys,-->
<!-- CASE-->
<!-- WHEN (-->
<!-- ISNULL(fe.position3d) || LENGTH(trim(fe.position3d)) <![CDATA[ <]]> 1-->
<!-- ) THEN-->
<!-- NULL-->
<!-- ELSE-->
<!-- CONCAT(-->
<!-- '{"x":',-->
<!-- substring_index(fe.position3d, ',', 1),-->
<!-- ',"y":',-->
<!-- substring_index(-->
<!-- substring_index(fe.position3d, ',', - 2),-->
<!-- ',',-->
<!-- 1-->
<!-- ),-->
<!-- ',"z":',-->
<!-- substring_index(fe.position3d, ',', - 1),-->
<!-- '}'-->
<!-- )-->
<!-- END position,-->
<!-- concat('monitorEquipment-',fe.id) as `key`-->
<!-- FROM f_fire_equipment fe-->
<!-- WHERE fe.id IN (-->
<!-- select fire_equipment_id from f_equipment_fire_equipment-->
<!-- ) AND (org_code = #{orgCode} OR org_code LIKE CONCAT(#{orgCode},'-%'))-->
<!-- AND fe.equip_classify <![CDATA[ <> ]]> 1-->
<!-- UNION ALL-->
<!-- SELECT e.id,e.name,e.code,e.ue4_location,e.ue4_rotation,'impEquipment' as type,'impEquipment' as level,-->
<!-- TMP.relationKeys,-->
<!-- CASE-->
<!-- WHEN (-->
<!-- ISNULL(e.position3d) || LENGTH(trim(e.position3d)) <![CDATA[ <]]> 1-->
<!-- ) THEN-->
<!-- NULL-->
<!-- ELSE-->
<!-- CONCAT(-->
<!-- '{"x":',-->
<!-- substring_index(e.position3d, ',', 1),-->
<!-- ',"y":',-->
<!-- substring_index(-->
<!-- substring_index(e.position3d, ',', - 2),-->
<!-- ',',-->
<!-- 1-->
<!-- ),-->
<!-- ',"z":',-->
<!-- substring_index(e.position3d, ',', - 1),-->
<!-- '}'-->
<!-- )-->
<!-- END position,-->
<!-- concat('impEquipment-',e.id) as `key`-->
<!-- FROM f_equipment e-->
<!-- LEFT JOIN-->
<!-- (select GROUP_CONCAT(fire_equipment_id) as relationKeys,equipment_id from f_equipment_fire_equipment GROUP BY equipment_id) tmp-->
<!-- ON TMP.equipment_id = e.id-->
<!-- WHERE e.org_code = #{orgCode} OR e.org_code like CONCAT(#{orgCode},'-%')-->
<!-- UNION ALL-->
<!-- SELECT id,name,code,ue4_location,ue4_rotation,-->
<!-- case type-->
<!-- when 1 then 'hydrant'-->
<!-- when 2 then 'pool'-->
<!-- end as type,-->
<!-- case type-->
<!-- when 1 then 'hydrant'-->
<!-- when 2 then 'pool'-->
<!-- end as level,-->
<!-- null as relationKeys,-->
<!-- CASE-->
<!-- WHEN (-->
<!-- ISNULL(position3d) || LENGTH(trim(position3d)) <![CDATA[ <]]> 1-->
<!-- ) THEN-->
<!-- NULL-->
<!-- ELSE-->
<!-- CONCAT(-->
<!-- '{"x":',-->
<!-- substring_index(position3d, ',', 1),-->
<!-- ',"y":',-->
<!-- substring_index(-->
<!-- substring_index(position3d, ',', - 2),-->
<!-- ',',-->
<!-- 1-->
<!-- ),-->
<!-- ',"z":',-->
<!-- substring_index(position3d, ',', - 1),-->
<!-- '}'-->
<!-- )-->
<!-- END position,-->
<!-- case type-->
<!-- when 1 then concat('hydrant-',id)-->
<!-- when 2 then concat('pool-',id)-->
<!-- end as `key`-->
<!-- FROM f_water_resource-->
<!-- WHERE org_code = #{orgCode} OR org_code like CONCAT(#{orgCode},'-%')-->
<!-- UNION ALL-->
<!-- SELECT id,name,code,ue4_location,ue4_rotation,-->
<!-- case-->
<!-- when type = 1 then 'fireChamber'-->
<!-- when type = 2 then 'fireFoamRoom'-->
<!-- end as type,-->
<!-- case-->
<!-- when type = 1 then 'fireChamber'-->
<!-- when type = 2 then 'fireFoamRoom'-->
<!-- end as level,-->
<!-- null as relationKeys,-->
<!-- CASE-->
<!-- WHEN (-->
<!-- ISNULL(position3d) || LENGTH(trim(position3d)) <![CDATA[ <]]> 1-->
<!-- ) THEN-->
<!-- NULL-->
<!-- ELSE-->
<!-- CONCAT(-->
<!-- '{"x":',-->
<!-- substring_index(position3d, ',', 1),-->
<!-- ',"y":',-->
<!-- substring_index(-->
<!-- substring_index(position3d, ',', - 2),-->
<!-- ',',-->
<!-- 1-->
<!-- ),-->
<!-- ',"z":',-->
<!-- substring_index(position3d, ',', - 1),-->
<!-- '}'-->
<!-- )-->
<!-- END position,-->
<!-- concat('fireChamber-',id) as `key`-->
<!-- FROM f_fire_station-->
<!-- WHERE org_code = #{orgCode} OR org_code LIKE CONCAT(#{orgCode},'-%')-->
<!-- UNION ALL-->
<!-- SELECT id,name,car_num as code,ue4_location,ue4_rotation,'fireCar' as type,'fireCar' as level,-->
<!-- null as relationKeys,-->
<!-- CASE-->
<!-- WHEN (-->
<!-- ISNULL(position3d) || LENGTH(trim(position3d)) <![CDATA[ <]]> 1-->
<!-- ) THEN-->
<!-- NULL-->
<!-- ELSE-->
<!-- CONCAT(-->
<!-- '{"x":',-->
<!-- substring_index(position3d, ',', 1),-->
<!-- ',"y":',-->
<!-- substring_index(-->
<!-- substring_index(position3d, ',', - 2),-->
<!-- ',',-->
<!-- 1-->
<!-- ),-->
<!-- ',"z":',-->
<!-- substring_index(position3d, ',', - 1),-->
<!-- '}'-->
<!-- )-->
<!-- END position,-->
<!-- concat('fireCar-',id) as `key`-->
<!-- FROM f_fire_car-->
<!-- WHERE org_code = #{orgCode} OR org_code LIKE CONCAT(#{orgCode},'-%')-->
<!-- </select>-->
<!-- <select id="getImpEqu3dPoints" resultType="com.yeejoin.amos.fas.business.vo.View3dNodeVo">-->
<!-- SELECT id,name,code,ue4_location,ue4_rotation,-->
<!-- case-->
<!-- when equip_classify= 0 then 'monitorEquipment'-->
<!-- when equip_classify= 2 then 'video'-->
<!-- when equip_classify= 3 then 'fireEquipment'-->
<!-- end as type,-->
<!-- case-->
<!-- when equip_classify= 0 then 'monitorEquipment'-->
<!-- when equip_classify= 2 then 'video'-->
<!-- when equip_classify= 3 then 'fireEquipment'-->
<!-- end as level,-->
<!-- null as relationKeys,-->
<!-- CASE-->
<!-- WHEN (-->
<!-- ISNULL(fe.position3d) || LENGTH(trim(fe.position3d)) <![CDATA[ <]]> 1-->
<!-- ) THEN-->
<!-- NULL-->
<!-- ELSE-->
<!-- CONCAT(-->
<!-- '{"x":',-->
<!-- substring_index(fe.position3d, ',', 1),-->
<!-- ',"y":',-->
<!-- substring_index(-->
<!-- substring_index(fe.position3d, ',', - 2),-->
<!-- ',',-->
<!-- 1-->
<!-- ),-->
<!-- ',"z":',-->
<!-- substring_index(fe.position3d, ',', - 1),-->
<!-- '}'-->
<!-- )-->
<!-- END position,-->
<!-- concat('monitorEquipment-',fe.id) as `key`-->
<!-- FROM f_fire_equipment fe-->
<!-- WHERE fe.id IN (-->
<!-- select fire_equipment_id from f_equipment_fire_equipment-->
<!-- ) AND (org_code = #{orgCode} OR org_code LIKE CONCAT(#{orgCode},'-%'))-->
<!-- AND fe.equip_classify <![CDATA[ <> ]]> 1-->
<!-- UNION ALL-->
<!-- SELECT e.id,e.name,e.code,e.ue4_location,e.ue4_rotation,'impEquipment' as type,'impEquipment' as level,-->
<!-- TMP.relationKeys,-->
<!-- CASE-->
<!-- WHEN (-->
<!-- ISNULL(e.position3d) || LENGTH(trim(e.position3d)) <![CDATA[ <]]> 1-->
<!-- ) THEN-->
<!-- NULL-->
<!-- ELSE-->
<!-- CONCAT(-->
<!-- '{"x":',-->
<!-- substring_index(e.position3d, ',', 1),-->
<!-- ',"y":',-->
<!-- substring_index(-->
<!-- substring_index(e.position3d, ',', - 2),-->
<!-- ',',-->
<!-- 1-->
<!-- ),-->
<!-- ',"z":',-->
<!-- substring_index(e.position3d, ',', - 1),-->
<!-- '}'-->
<!-- )-->
<!-- END position,-->
<!-- concat('impEquipment-',e.id) as `key`-->
<!-- FROM f_equipment e-->
<!-- LEFT JOIN-->
<!-- (select GROUP_CONCAT(fire_equipment_id) as relationKeys,equipment_id from f_equipment_fire_equipment GROUP BY equipment_id) tmp-->
<!-- ON TMP.equipment_id = e.id-->
<!-- WHERE e.org_code = #{orgCode} OR e.org_code like CONCAT(#{orgCode},'-%')-->
<!-- UNION ALL-->
<!-- SELECT id,name,code,ue4_location,ue4_rotation,-->
<!-- case type-->
<!-- when 1 then 'hydrant'-->
<!-- when 2 then 'pool'-->
<!-- end as type,-->
<!-- case type-->
<!-- when 1 then 'hydrant'-->
<!-- when 2 then 'pool'-->
<!-- end as level,-->
<!-- null as relationKeys,-->
<!-- CASE-->
<!-- WHEN (-->
<!-- ISNULL(position3d) || LENGTH(trim(position3d)) <![CDATA[ <]]> 1-->
<!-- ) THEN-->
<!-- NULL-->
<!-- ELSE-->
<!-- CONCAT(-->
<!-- '{"x":',-->
<!-- substring_index(position3d, ',', 1),-->
<!-- ',"y":',-->
<!-- substring_index(-->
<!-- substring_index(position3d, ',', - 2),-->
<!-- ',',-->
<!-- 1-->
<!-- ),-->
<!-- ',"z":',-->
<!-- substring_index(position3d, ',', - 1),-->
<!-- '}'-->
<!-- )-->
<!-- END position,-->
<!-- case type-->
<!-- when 1 then concat('hydrant-',id)-->
<!-- when 2 then concat('pool-',id)-->
<!-- end as `key`-->
<!-- FROM f_water_resource-->
<!-- WHERE org_code = #{orgCode} OR org_code like CONCAT(#{orgCode},'-%')-->
<!-- UNION ALL-->
<!-- SELECT id,name,code,ue4_location,ue4_rotation,-->
<!-- case-->
<!-- when type = 1 then 'fireChamber'-->
<!-- when type = 2 then 'fireFoamRoom'-->
<!-- end as type,-->
<!-- case-->
<!-- when type = 1 then 'fireChamber'-->
<!-- when type = 2 then 'fireFoamRoom'-->
<!-- end as level,-->
<!-- null as relationKeys,-->
<!-- CASE-->
<!-- WHEN (-->
<!-- ISNULL(position3d) || LENGTH(trim(position3d)) <![CDATA[ <]]> 1-->
<!-- ) THEN-->
<!-- NULL-->
<!-- ELSE-->
<!-- CONCAT(-->
<!-- '{"x":',-->
<!-- substring_index(position3d, ',', 1),-->
<!-- ',"y":',-->
<!-- substring_index(-->
<!-- substring_index(position3d, ',', - 2),-->
<!-- ',',-->
<!-- 1-->
<!-- ),-->
<!-- ',"z":',-->
<!-- substring_index(position3d, ',', - 1),-->
<!-- '}'-->
<!-- )-->
<!-- END position,-->
<!-- concat('fireChamber-',id) as `key`-->
<!-- FROM f_fire_station-->
<!-- WHERE org_code = #{orgCode} OR org_code LIKE CONCAT(#{orgCode},'-%')-->
<!-- UNION ALL-->
<!-- SELECT id,name,car_num as code,ue4_location,ue4_rotation,'fireCar' as type,'fireCar' as level,-->
<!-- null as relationKeys,-->
<!-- CASE-->
<!-- WHEN (-->
<!-- ISNULL(position3d) || LENGTH(trim(position3d)) <![CDATA[ <]]> 1-->
<!-- ) THEN-->
<!-- NULL-->
<!-- ELSE-->
<!-- CONCAT(-->
<!-- '{"x":',-->
<!-- substring_index(position3d, ',', 1),-->
<!-- ',"y":',-->
<!-- substring_index(-->
<!-- substring_index(position3d, ',', - 2),-->
<!-- ',',-->
<!-- 1-->
<!-- ),-->
<!-- ',"z":',-->
<!-- substring_index(position3d, ',', - 1),-->
<!-- '}'-->
<!-- )-->
<!-- END position,-->
<!-- concat('fireCar-',id) as `key`-->
<!-- FROM f_fire_car-->
<!-- WHERE org_code = #{orgCode} OR org_code LIKE CONCAT(#{orgCode},'-%')-->
<!-- </select>-->
<select id="initViewErrorNode" resultType="com.yeejoin.amos.fas.business.vo.View3dNodeVo">
select * from (
......@@ -1833,80 +1833,335 @@
END
) AS orgCode
FROM
`wl_form_instance` a where a.group_code in('fireRoom','r_fireRoom')
GROUP BY
a.instance_id) s,
f_risk_source r
where s.instanceId = r.source_id
) as tmp
<where>
<if test="inputText!=null and inputText != ''" >
AND (
tmp.code LIKE '%${inputText}%'
OR tmp.name LIKE '%${inputText}%'
)
</if>
<if test="type!=null and type!=''">
AND tmp.typeCode = #{type}
</if>
<if test="riskSourceId != null">
AND tmp.riskSourceId = #{riskSourceId}
</if>
<if test="orgCode!=null">
AND (tmp.orgCode = #{orgCode} OR tmp.orgCode like CONCAT(#{orgCode},'-%') )
</if>
</where>
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>-->
FROM
`wl_form_instance` a where a.group_code in('fireRoom','r_fireRoom')
GROUP BY
a.instance_id) s,
f_risk_source r
where s.instanceId = r.source_id
) as tmp
<where>
<if test="inputText!=null and inputText != ''">
AND (
tmp.code LIKE '%${inputText}%'
OR tmp.name LIKE '%${inputText}%'
)
</if>
<if test="type!=null and type!=''">
AND tmp.typeCode = #{type}
</if>
<if test="riskSourceId != null">
AND tmp.riskSourceId = #{riskSourceId}
</if>
<if test="orgCode!=null">
AND (tmp.orgCode = #{orgCode} OR tmp.orgCode like CONCAT(#{orgCode},'-%') )
</if>
</where>
LIMIT ${start},${length}
</select>
<select id="retrieve3AllCount" resultType="long">
SELECT COUNT(1) FROM (
SELECT
concat( 'riskSource-', r.id ) AS id,
concat( r.id ) AS originId,
r.NAME,
r.CODE,
'riskSource' AS type,
r.org_code as orgCode,
rl.LEVEL AS LEVEL,
rl.NAME AS levelStr,
r.is_indoor AS isIndoor,
'风险点' AS typeName,
'riskSource' AS typeCode,
r.NAME AS label,
'' AS routeName,
'' AS person,
r.rpn AS title,
CONCAT( 'riskSource-', r.id ) AS `key`,
r.id AS riskSourceId,
null AS areaId,
'' AS room
FROM
f_risk_source r
LEFT JOIN f_risk_level rl ON rl.id = r.risk_level_id
WHERE
r.is_region = 'FALSE'
<if test="dataLevel != null and dataLevel != ''">
AND rl.level = #{dataLevel}
</if>
UNION ALL
SELECT
concat( 'patrol-', p.id ) AS id,
concat( p.id ) AS originId,
p.NAME,
p.point_no AS CODE,
'patrol' AS type,
p.org_code as orgCode,
p.STATUS AS LEVEL,
CONCAT( 'level_', p.STATUS ) AS levelStr,
p.is_indoor AS isIndoor,
'巡检点' AS typeName,
'patrol' AS typeCode,
p.NAME AS label,
p.route_name AS routeName,
p.charge_person_id AS person,
CASE
WHEN p.STATUS = '0' THEN
'未执行'
WHEN p.STATUS = '1' THEN
'合格'
WHEN p.STATUS = '2' THEN
'不合格'
WHEN p.STATUS = '3' THEN
'漏检'
END AS title,
concat( 'patrol-', p.id ) AS `key`,
p.risk_source_id AS riskSourceId,
p.area_id AS areaId,
r.NAME AS room
FROM
p_point p
LEFT JOIN f_risk_source r ON r.id = p.risk_source_id
<where>
is_delete = FALSE
<if test="areaId != null">
AND p.area_id = #{areaId}
</if>
</where>
UNION ALL
SELECT
concat( 'fireEquipment-', m.id ) AS id,
concat( m.id ) AS originId,
det.NAME,
m.CODE AS CODE,
'fireEquipment' AS type,
m.org_code as orgCode,
NULL AS LEVEL,
concat( 'level_', NULL ) AS levelStr,
NULL AS isIndoor,
'消防设备' AS typeName,
'fireEquipment' AS typeCode,
det.NAME AS label,
'' AS routeName,
'' AS person,
det.NAME AS title,
concat( 'fireEquipment-', m.id ) AS `key`,
risk.id AS riskSourceId,
m.area_id AS areaId,
str.full_name AS room
FROM
wl_equipment_specific m
LEFT JOIN wl_equipment_detail AS det ON m.equipment_detail_id = det.id
LEFT JOIN wl_equipment AS equ ON det.equipment_id = equ.id
LEFT JOIN wl_equipment_category AS cat ON equ.category_id = cat.id
LEFT JOIN wl_stock_detail AS sto ON sto.qr_code = m.qr_code
LEFT JOIN wl_warehouse_structure AS str ON sto.warehouse_structure_id = str.source_id
LEFT JOIN f_risk_source AS risk ON str.source_id = risk.source_id
<where>
<if test="areaId != null">
m.area_id = #{areaId}
</if>
<if test="equipmentId != null">
AND equ.id = #{equipmentId}
</if>
</where>
GROUP BY
m.CODE) as tmp
<where>
<if test="inputText!=null and inputText != ''">
AND (
tmp.code LIKE '%${inputText}%'
OR tmp.name LIKE '%${inputText}%'
)
</if>
<if test="type!=null and type!=''">
AND tmp.typeCode = #{type}
</if>
<if test="riskSourceId != null">
AND tmp.riskSourceId = #{riskSourceId}
</if>
<if test="orgCode!=null">
AND (tmp.orgCode = #{orgCode} OR tmp.orgCode like CONCAT(#{orgCode},'-%') )
</if>
</where>
</select>
<select id="retrieve3All" resultType="java.util.HashMap">
SELECT * FROM (
SELECT
concat( 'riskSource-', r.id ) AS id,
concat( r.id ) AS originId,
r.NAME,
r.CODE,
'riskSource' AS type,
r.org_code as orgCode,
rl.LEVEL AS LEVEL,
rl.NAME AS levelStr,
r.is_indoor AS isIndoor,
'风险点' AS typeName,
'riskSource' AS typeCode,
r.NAME AS label,
'' AS routeName,
'' AS person,
r.rpn AS title,
CONCAT( 'riskSource-', r.id ) AS `key`,
r.id AS riskSourceId,
null AS areaId,
'' AS room
FROM
f_risk_source r
LEFT JOIN f_risk_level rl ON rl.id = r.risk_level_id
WHERE
r.is_region = 'FALSE'
<if test="dataLevel != null and dataLevel != ''">
AND rl.level = #{dataLevel}
</if>
UNION ALL
SELECT
concat( 'patrol-', p.id ) AS id,
concat( p.id ) AS originId,
p.NAME,
p.point_no AS CODE,
'patrol' AS type,
p.org_code as orgCode,
p.STATUS AS LEVEL,
CONCAT( 'level_', p.STATUS ) AS levelStr,
p.is_indoor AS isIndoor,
'巡检点' AS typeName,
'patrol' AS typeCode,
p.NAME AS label,
p.route_name AS routeName,
p.charge_person_id AS person,
CASE
WHEN p.STATUS = '0' THEN
'未执行'
WHEN p.STATUS = '1' THEN
'合格'
WHEN p.STATUS = '2' THEN
'不合格'
WHEN p.STATUS = '3' THEN
'漏检'
END AS title,
concat( 'patrol-', p.id ) AS `key`,
p.risk_source_id AS riskSourceId,
p.area_id AS areaId,
r.NAME AS room
FROM
p_point p
LEFT JOIN f_risk_source r ON r.id = p.risk_source_id
<where>
is_delete = FALSE
<if test="areaId != null">
AND p.area_id = #{areaId}
</if>
</where>
UNION ALL
SELECT
concat( 'fireEquipment-', m.id ) AS id,
concat( m.id ) AS originId,
det.NAME,
m.CODE AS CODE,
'fireEquipment' AS type,
m.org_code as orgCode,
NULL AS LEVEL,
concat( 'level_', NULL ) AS levelStr,
NULL AS isIndoor,
'消防设备' AS typeName,
'fireEquipment' AS typeCode,
det.NAME AS label,
'' AS routeName,
'' AS person,
det.NAME AS title,
concat( 'fireEquipment-', m.id ) AS `key`,
risk.id AS riskSourceId,
m.area_id AS areaId,
str.full_name AS room
FROM
wl_equipment_specific m
LEFT JOIN wl_equipment_detail AS det ON m.equipment_detail_id = det.id
LEFT JOIN wl_equipment AS equ ON det.equipment_id = equ.id
LEFT JOIN wl_equipment_category AS cat ON equ.category_id = cat.id
LEFT JOIN wl_stock_detail AS sto ON sto.qr_code = m.qr_code
LEFT JOIN wl_warehouse_structure AS str ON sto.warehouse_structure_id = str.source_id
LEFT JOIN f_risk_source AS risk ON str.source_id = risk.source_id
<where>
<if test="areaId != null">
m.area_id = #{areaId}
</if>
<if test="equipmentId != null">
AND equ.id = #{equipmentId}
</if>
</where>
GROUP BY
m.CODE) as tmp
<where>
<if test="inputText!=null and inputText != ''">
AND (
tmp.code LIKE '%${inputText}%'
OR tmp.name LIKE '%${inputText}%'
)
</if>
<if test="type!=null and type!=''">
AND tmp.typeCode = #{type}
</if>
<if test="riskSourceId != null">
AND tmp.riskSourceId = #{riskSourceId}
</if>
<if test="orgCode!=null">
AND (tmp.orgCode = #{orgCode} OR tmp.orgCode like CONCAT(#{orgCode},'-%') )
</if>
</where>
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