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

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

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