Commit 5b8f9a9f authored by zhengjiangtao's avatar zhengjiangtao

优化mqtt推送及3维屏搜索添加riskSourceId参数

parent 8e11b9c9
......@@ -622,7 +622,9 @@ public class RiskSourceController extends BaseController {
@RequestMapping(value = "/data/patroldata", produces = "application/json;charset=UTF-8", method = RequestMethod.PUT)
public CommonResponse postPatrolData(@RequestBody ProtalDataRo protalData) throws Exception {
log.info("上传巡检数据" + JSONObject.toJSONString(protalData));
riskSourceService.processProtalData(getToken(),getProduct(),getAppKey(),protalData);
ReginParams reginParams =getSelectedOrgInfo();
String compCode=getOrgCode(reginParams);
riskSourceService.processProtalData(getToken(),getProduct(),getAppKey(),protalData, compCode);
return CommonResponseUtil.success();
}
......
......@@ -254,6 +254,7 @@ public class View3dController extends BaseController {
String product = this.getProduct();
return view3dService.retrieveAll(params.getType(),
params.getRiskSourceId(),
params.getInputText(),
params.getCurrent(),
params.getPageSize(),
......
......@@ -145,9 +145,9 @@ public interface View3dMapper extends BaseMapper{
List<Node3DVoResponse> findViewDataByType(@Param("type")String type,@Param("riskSourceId")Long riskSourceId,@Param("orgCode")String orgCode,@Param("abnormalStatus")Boolean abnormalStatus);
Long retrieveAllCount(String type, String inputText,String orgCode,String dataLevel,String protectObjName);
Long retrieveAllCount(String type, Long riskSourceId, String inputText,String orgCode,String dataLevel,String protectObjName);
List<HashMap<String, Object>> retrieveAll(String type, String inputText, long start, int length,String orgCode,String dataLevel,String protectObjName);
List<HashMap<String, Object>> retrieveAll(String type, Long riskSourceId, String inputText, long start, int length,String orgCode,String dataLevel,String protectObjName);
/**
* 查询区域下点
......
......@@ -8,6 +8,16 @@ public class RetrieveParams {
private Integer pageSize;
private String dataLevel;
private String protectObjName;
private String riskSourceId;
public String getRiskSourceId() {
return riskSourceId;
}
public void setRiskSourceId(String riskSourceId) {
this.riskSourceId = riskSourceId;
}
public String getType() {
return type;
}
......
......@@ -22,7 +22,7 @@ public class BizMessageServiceImpl implements IBizMessageService {
public Page queryForPage(String time, String type, String title, String orgCode, CommonPageable pageable)
public Page queryForPage(String time, String type, String title, String orgCode, CommonPageable pageable)
{
Long total = bizMessageMapper.queryCountForPage(time, type, title, orgCode);
List<NodeMessageView> content = bizMessageMapper.queryForPage(time, type, title, orgCode,pageable.getOffset(),pageable.getPageSize());
......
......@@ -20,7 +20,14 @@ import java.util.concurrent.LinkedBlockingQueue;
import java.util.stream.Collectors;
import javax.annotation.PostConstruct;
import javax.servlet.http.HttpServletRequest;
import com.yeejoin.amos.component.feign.config.InnerInvokException;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.fas.business.controller.BaseController;
import com.yeejoin.amos.fas.business.service.intfc.IView3dService;
import com.yeejoin.amos.fas.business.vo.ReginParams;
import com.yeejoin.amos.feign.privilege.Privilege;
import org.apache.commons.lang3.ArrayUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -55,7 +62,6 @@ import com.yeejoin.amos.fas.business.action.model.FireEquimentDataRo;
import com.yeejoin.amos.fas.business.action.model.ProtalDataRo;
import com.yeejoin.amos.fas.business.action.model.RiskSourceRuleRo;
import com.yeejoin.amos.fas.business.action.model.SetpEnum;
import com.yeejoin.amos.fas.business.action.mq.StationEnum;
import com.yeejoin.amos.fas.business.action.mq.WebMqttComponent;
import com.yeejoin.amos.fas.business.bo.BindRegionBo;
import com.yeejoin.amos.fas.business.bo.JpushMsgBo;
......@@ -184,6 +190,9 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
private FireEquipPointMapper fireEquipPointMapper;
@Autowired
private IView3dService view3dService;
@Autowired
private IRiskLevelDao iRiskLevelDao;
......@@ -234,6 +243,9 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
@Autowired
private IRiskFactorDao iRiskFactorDao;
@Autowired
protected HttpServletRequest request;
public static String cacheKeyForCanBeRunning() {
return Redis.genKey(CacheType.ERASABLE.name(), "CONTINGENCYRUNING");
......@@ -278,7 +290,7 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
int count = iRiskSourceDao.countByParentId(rId);
Optional<RiskSource> rs = iRiskSourceDao.findById(rId);
rs.ifPresent(riskSource -> parentIds.add(riskSource.getParentId()));
if (parentIds.contains(0l)) {
if (parentIds.contains(0L)) {
throw new YeeException("公司节点不能删除");
}
if (count > 0) {
......@@ -680,7 +692,7 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
@Override
@Async
public void processProtalData(String toke, String product, String appKey, ProtalDataRo protalData) {
public void processProtalData(String toke, String product, String appKey, ProtalDataRo protalData, String orgCode) {
//巡检消息规则推送
protalRuleMessagePush(protalData, toke, product, appKey);
if (!CollectionUtils.isEmpty(protalData.getPointInputitems())) {
......@@ -716,6 +728,27 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
rsDataQueue.addPatrolMessage(fmeaId, protalData.getCheckUser(), protalData.getName(), protalData.getNodeState()));
}
iDataRefreshService.refreshViewData(DataRefreshTypeEum.check.getCode());
/**
* 推送巡检数据
* 影响区域:今日安全,消防安全=>巡检异常,一周安全趋势
*/
// 今日安全
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
String dateString = formatter.format(new Date());
String topicOne = String.format("/%s/%s/%s/%s", serviceName, "yinan","data/refresh","todaySafetyIndex");
webMqttComponent.publish(topicOne, JSON.toJSONString(view3dService.getSafetyIndexInfoByDate(orgCode, dateString)));
// 巡检异常
String topicTwo = String.format("/%s/%s/%s/%s", serviceName, "yinan","data/refresh","fireSafety");
webMqttComponent.publish(topicTwo, JSON.toJSONString(view3dService.getSafetyExecuteListTop5("check", orgCode)));
// 一周安全趋势
String topicThree = String.format("/%s/%s/%s/%s", serviceName, "yinan","data/refresh","weekSafetyIndex");
webMqttComponent.publish(topicThree, JSON.toJSONString(view3dService.getSafetyIndexWeek(orgCode)));
// 今日巡检
String topicFour = String.format("/%s/%s/%s/%s", serviceName, "yinan","data/refresh","todayCheckStatus");
webMqttComponent.publish(topicThree, JSON.toJSONString(view3dService.getStatisticsCheck(orgCode)));
}
/**
......@@ -869,7 +902,7 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
* @param deviceData
* @param equipment
* @param fireEquipment
* @param fireEquipmentPointType
* @param toke
*/
@Async
void dynamicPlan(AlarmParam deviceData, Equipment equipment, FireEquipment fireEquipment, Toke toke) {
......@@ -930,6 +963,11 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
riskSourceMap.put("equipments", map);
remoteWebSocketServer.sendMessage("equipmentMode", JSON.toJSONString(riskSourceMap));
// 推送设备状态信息
Alarm alarm = iAlarmDao.findByStatusTrueAndFireEquipmentPointCode(param.getPointCode());
String topic = String.format("/%s/%s/%s", serviceName, "yinan","data/refresh/monitorData");
webMqttComponent.publish(topic, JSON.toJSONString(view3dService.getEquipStatusList(alarm.getOrgCode())));
} catch (Exception e) {
log.error("推送前端数据失败-->"+JSON.toJSONString(param));
}
......@@ -971,6 +1009,13 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
} else {
//通知刷新3d页面告警数据
iDataRefreshService.refreshViewData(DataRefreshTypeEum.alarm.getCode());
/**
* 推送告警数据
* 影响区域:消防安全=>火灾告警
*/
String topic = String.format("/%s/%s/%s/%s", serviceName, "yinan","data/refresh","fireSafety");
webMqttComponent.publish(topic, JSON.toJSONString(view3dService.getSafetyExecuteListTop5("fire", fireEquipmentPoint.getOrgCode())));
}
}
} else {
......@@ -995,9 +1040,16 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
content.put("orgCode", fireEquipment.getOrgCode());
content.put("status", deviceData.getSoe());
iDataRefreshService.sendRefreshDataWithArea(View3dRefreshAreaEum.monitor_data.getCode(), content);
/**
* 推送设备状态
* 影响区域:设备状态
*/
String topic = String.format("/%s/%s/%s", serviceName, "yinan","data/refresh/monitorData");
webMqttComponent.publish(topic, JSON.toJSONString(view3dService.getEquipStatusList(fireEquipment.getOrgCode())));
}
}
// String topic = String.format("/%s/%s/%s", serviceName, StationEnum.YINAN.getCode(),"telesignaling");
// String topic = String.format("/%s/%s/%s", serviceName, "yinan","telesignaling");S
// webMqttComponent.publish(topic, JSON.toJSONString(deviceData));
List<AlarmParam> list = new ArrayList<>();
......@@ -1107,7 +1159,7 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
try {
redisTemplate.opsForHash().put("Analogue", data.getPointCode(), data);
// remoteWebSocketServer.sendMessage("plan", JSON.toJSONString(data));
String topic = String.format("/%s/%s/%s", serviceName, StationEnum.YINAN.getCode(),"analogue");
String topic = String.format("/%s/%s/%s", serviceName, "yinan","analogue");
webMqttComponent.publish(topic, JSON.toJSONString(data));
} catch (Exception e) {
e.printStackTrace();
......@@ -1292,8 +1344,8 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
//1.3更新fmea
fmeaMapper.updateRpn(fmea);
//2.计算上级风险值(风险点及父节点)
this.notifyRiskSource(fmeaId, fmea.getRiskSourceId(), nofityType, jpushMsgBo);
String topic = String.format("/%s/%s/%s", serviceName, "shaoxing","data/refresh/incidenceSeverityMatrix");
this.notifyRiskSource(newLevel.getOrgCode(), fmeaId, fmea.getRiskSourceId(), nofityType, jpushMsgBo);
String topic = String.format("/%s/%s/%s", serviceName, "yinan","data/refresh/incidenceSeverityMatrix");
webMqttComponent.publish(topic, JSON.toJSONString(queryForMatrix()));
}
}
......@@ -1398,10 +1450,10 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
}
//1.3.更新fmea的rpn、风险等级及newOid
fmeaMapper.updateRpn(fmea);
String topic = String.format("/%s/%s/%s", serviceName, "shaoxing","data/refresh/incidenceSeverityMatrix");
String topic = String.format("/%s/%s/%s", serviceName, "yinan","data/refresh/incidenceSeverityMatrix");
webMqttComponent.publish(topic, JSON.toJSONString(queryForMatrix()));
//2.计算风险点rpn、rpni、riskLevelId
this.notifyRiskSource(fmeaId, fmea.getRiskSourceId(), notifyType, jpushMsgBo);
this.notifyRiskSource(newLevel.getOrgCode(), fmeaId, fmea.getRiskSourceId(), notifyType, jpushMsgBo);
}
}
}
......@@ -1434,7 +1486,7 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
* fmea的更新导致rpn、rpni的值改变
*/
@Override
public void notifyRiskSource(Long fmeaId, Long riskSourceId, String notifyType, JpushMsgBo jpushMsgBo) {
public void notifyRiskSource(String orgCode, Long fmeaId, Long riskSourceId, String notifyType, JpushMsgBo jpushMsgBo) {
Optional<RiskSource> riskSource1 = iRiskSourceDao.findById(riskSourceId);
RiskSource riskSource = null;
if (riskSource1.isPresent()) {
......@@ -1500,18 +1552,37 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
}
//6.通知全景监控屏幕数据刷新
iDataRefreshService.refreshViewData(DataRefreshTypeEum.rpn.getCode());
}
}
try {
String topic = String.format("/%s/%s/%s", serviceName, "shaoxing","data/refresh/situationMap");
webMqttComponent.publish(topic, JSON.toJSONString(queryRiskAreaRpn()));
topic = String.format("/%s/%s/%s", serviceName, "shaoxing","data/refresh/riskDegreeHistogram");
topic = String.format("/%s/%s/%s", serviceName, "yinan","data/refresh/riskDegreeHistogram");
webMqttComponent.publish(topic, JSON.toJSONString(queryRPNReport()));
topic = String.format("/%s/%s/%s", serviceName, "shaoxing","data/refresh/riskDegreePie");
topic = String.format("/%s/%s/%s", serviceName, "yinan","data/refresh/riskDegreePie");
webMqttComponent.publish(topic, JSON.toJSONString(queryForRiseUp()));
topic = String.format("/%s/%s/%s", serviceName, "shaoxing","data/refresh/incidenceSeverityMatrix");
topic = String.format("/%s/%s/%s", serviceName, "yinan","data/refresh/incidenceSeverityMatrix");
webMqttComponent.publish(topic, JSON.toJSONString(queryForMatrix()));
// 今日安全
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
String dateString = formatter.format(new Date());
if(StringUtils.isEmpty(orgCode)){
orgCode = riskSource.getOrgCode();
}
String topicOne = String.format("/%s/%s/%s", serviceName, "yinan","data/refresh/todaySafetyIndex");
webMqttComponent.publish(topicOne, JSON.toJSONString(view3dService.getSafetyIndexInfoByDate(orgCode, dateString)));
// 消防安全
String topicTow = String.format("/%s/%s/%s", serviceName, "yinan","data/refresh/fireSafety");
webMqttComponent.publish(topicTow, JSON.toJSONString(view3dService.getSafetyExecuteListTop5("risk", orgCode)));
webMqttComponent.publish(topicTow, JSON.toJSONString(view3dService.getSafetyExecuteListTop5("check", orgCode)));
webMqttComponent.publish(topicTow, JSON.toJSONString(view3dService.getSafetyExecuteListTop5("fire", orgCode)));
// 一周安全趋势
String topicThree = String.format("/%s/%s/%s/%s", serviceName, "yinan","data/refresh","weekSafetyIndex");
webMqttComponent.publish(topicThree, JSON.toJSONString(view3dService.getSafetyIndexWeek(orgCode)));
} catch (Exception e) {
log.error("数据获取失败", e);
}
......@@ -1521,15 +1592,60 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
@Override
public void notifyFmeaFromDelete(Long riskSourceId, String from) {
//1.计算风险点风险值信息
this.notifyRiskSource(0L, riskSourceId, from, null);
this.notifyRiskSource(null, 0L, riskSourceId, from, null);
}
@Override
public void notifyRiskSourceDelete(Long parentId) {
Optional<RiskSource> riskSource1 = iRiskSourceDao.findById(parentId);
RiskSource riskSource = null;
if (riskSource1.isPresent()) {
riskSource = riskSource1.get();
} else {
return;
}
//1.风险点删除触发更新父节点rpn、rpni、风险等级
this.updateParentRpn(parentId);
//2.通知全景监控屏幕数据刷新
iDataRefreshService.refreshViewData(DataRefreshTypeEum.rpn.getCode());
try{
String topic = String.format("/%s/%s/%s", serviceName, "shaoxing","data/refresh/situationMap");
webMqttComponent.publish(topic, JSON.toJSONString(queryRiskAreaRpn()));
topic = String.format("/%s/%s/%s", serviceName, "yinan","data/refresh/riskDegreeHistogram");
webMqttComponent.publish(topic, JSON.toJSONString(queryRPNReport()));
topic = String.format("/%s/%s/%s", serviceName, "yinan","data/refresh/riskDegreePie");
webMqttComponent.publish(topic, JSON.toJSONString(queryForRiseUp()));
topic = String.format("/%s/%s/%s", serviceName, "yinan","data/refresh/incidenceSeverityMatrix");
webMqttComponent.publish(topic, JSON.toJSONString(queryForMatrix()));
// 今日安全
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
String dateString = formatter.format(new Date());
String orgCode = riskSource.getOrgCode();
if(StringUtils.isEmpty(orgCode)){
orgCode = riskSource.getOrgCode();
}
String topicOne = String.format("/%s/%s/%s", serviceName, "yinan","data/refresh/todaySafetyIndex");
webMqttComponent.publish(topicOne, JSON.toJSONString(view3dService.getSafetyIndexInfoByDate(orgCode, dateString)));
// 消防安全
String topicTow = String.format("/%s/%s/%s", serviceName, "yinan","data/refresh/fireSafety");
webMqttComponent.publish(topicTow, JSON.toJSONString(view3dService.getSafetyExecuteListTop5("risk", orgCode)));
webMqttComponent.publish(topicTow, JSON.toJSONString(view3dService.getSafetyExecuteListTop5("check", orgCode)));
webMqttComponent.publish(topicTow, JSON.toJSONString(view3dService.getSafetyExecuteListTop5("fire", orgCode)));
// 一周安全趋势
String topicThree = String.format("/%s/%s/%s/%s", serviceName, "yinan","data/refresh","weekSafetyIndex");
webMqttComponent.publish(topicThree, JSON.toJSONString(view3dService.getSafetyIndexWeek(orgCode)));
}catch (Exception e) {
log.error("数据获取失败", e);
}
}
private void updateParentRpn(long parentId) {
......@@ -1704,6 +1820,5 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
}
return null;
}
}
......@@ -570,10 +570,11 @@ public class View3dServiceImpl implements IView3dService {
}
@Override
public CommonResponse retrieveAll(String type, 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);
Long count = view3dMapper.retrieveAllCount(type,inputText,orgCode,dataLevel,protectObjName);
List<HashMap<String, Object>> retrieveAll = view3dMapper.retrieveAll(type, inputText,pageable.getOffset(),pageable.getPageSize(),orgCode,dataLevel,protectObjName);
Long riskSource = StringUtils.isEmpty(riskSourceId) ? null : Long.parseLong(riskSourceId);
Long count = view3dMapper.retrieveAllCount(type,riskSource,inputText,orgCode,dataLevel,protectObjName);
List<HashMap<String, Object>> retrieveAll = view3dMapper.retrieveAll(type, riskSource,inputText,pageable.getOffset(),pageable.getPageSize(),orgCode,dataLevel,protectObjName);
Set<Object> userIds = new HashSet<>();
retrieveAll.forEach(action->{
if(!ObjectUtils.isEmpty(action.get("person"))){
......
......@@ -76,7 +76,7 @@ public interface IRiskSourceService {
boolean processTaskData(ProtalDataRo taskData) throws Exception;
void processProtalData(String toke,String product,String appKey,ProtalDataRo protalData) throws Exception;
void processProtalData(String toke,String product,String appKey,ProtalDataRo protalData, String orgCode) throws Exception;
RiskSourceTreeResponse queryRiskSourceDetailById(Long id);
......@@ -134,7 +134,7 @@ public interface IRiskSourceService {
*/
void batchSaveRegionUe4(List<BindRegionBo> regionBoList);
void notifyRiskSource(Long fmeaId, Long riskSourceId, String notifyType, JpushMsgBo jpushMsgBo);
void notifyRiskSource(String orgCode, Long fmeaId, Long riskSourceId, String notifyType, JpushMsgBo jpushMsgBo);
void notifyFmeaFromDelete(Long handId, String from);
......
......@@ -148,6 +148,7 @@ public interface IView3dService {
/**
* 检索
* @param type类型
* @param riskRourceId
* @param inputText关键字
* @param dataLevel风险等级
* @param protectObjName设备名称
......@@ -156,7 +157,7 @@ public interface IView3dService {
* @param orgCode
* @return
*/
CommonResponse retrieveAll(String type, 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);
/**
* 等级查询
......
......@@ -6,7 +6,9 @@ import javax.servlet.http.HttpServletRequest;
import com.yeejoin.amos.component.feign.config.InnerInvokException;
import com.yeejoin.amos.fas.business.feign.RemoteSecurityService;
import com.yeejoin.amos.fas.business.vo.DepartmentBo;
import com.yeejoin.amos.fas.business.vo.RoleBo;
import com.yeejoin.amos.feign.privilege.model.DepartmentModel;
import com.yeejoin.amos.feign.privilege.model.RoleModel;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
......@@ -86,6 +88,14 @@ public class PermissionAspect {
ReginParams regionParam = new ReginParams();
if(userModel != null){
userId = userModel.getUserId();
Map<Long, List<RoleModel>> orgRoles = userModel.getOrgRoles();
List<RoleModel> roleModels = null;
if(!ObjectUtils.isEmpty(orgRoles)) {
for (Map.Entry<Long, List<RoleModel>> entry : orgRoles.entrySet()) {
roleModels = entry.getValue();
break;
}
}
ReginParams reginParams = JSON.parseObject(redisTemplate.opsForValue().get(buildKey(userModel.getUserId(), token)), ReginParams.class);
if(reginParams == null && userModel.getCompanys().size() > 0){
CompanyModel companyModel = userModel.getCompanys().get(0);
......@@ -96,7 +106,9 @@ public class PermissionAspect {
DepartmentBo departmentBo = convertDepartmentModelToBo(deptList.get(0));
regionParam.setCompany(companyBo);
regionParam.setDepartment(departmentBo);
regionParam.setRole(null);
if(!ObjectUtils.isEmpty(roleModels)){
regionParam.setRole(convertRoleModelToBo(roleModels.get(0)));
}
}
redisTemplate.opsForValue().set(buildKey(userId, token), JSONObject.toJSONString(regionParam));
}
......@@ -140,6 +152,16 @@ public class PermissionAspect {
return companyBo;
}
private RoleBo convertRoleModelToBo(RoleModel roleModel) {
RoleBo roleBo = new RoleBo();
if(roleModel != null){
roleBo.setRoleName(roleModel.getRoleName());
roleBo.setRoleType(roleModel.getRoleType());
roleBo.setSequenceNbr(roleModel.getSequenceNbr().toString());
}
return roleBo;
}
//redi缓存选择的用户信息
private String buildKey(String userId, String token) {
return "region_" + userId + "_" + token;
......
......@@ -1178,7 +1178,7 @@
<select id="retrieveAllCount" resultType="long">
select count(1)
from (
select r.name,r.code,'riskSource' as typeCode,r.org_code as orgCode
select r.name,r.code,'riskSource' as typeCode,r.org_code as orgCode, r.id as riskSourceId
from f_risk_source r
left join f_risk_level rl ON rl.id = r.risk_level_id
where r.is_region = 'FALSE'
......@@ -1186,14 +1186,14 @@
AND rl.level = #{dataLevel}
</if>
UNION all
select p.name,p.point_no as code,'patrol' as typeCode,p.org_code as orgCode
select p.name,p.point_no as code,'patrol' as typeCode,p.org_code as orgCode, p.risk_source_id as riskSourceId
from p_point p
WHERE is_delete = FALSE
UNION all
select name,code,'impEquipment' as typeCode,org_code as orgCode
select name,code,'impEquipment' as typeCode,org_code as orgCode, e.risk_source_id as riskSourceId
from f_equipment e
UNION all
select m.name,m.code,'monitorEquipment' as typeCode,m.org_code as orgCode
select m.name,m.code,'monitorEquipment' as typeCode,m.org_code as orgCode, m.risk_source_id as riskSourceId
from f_fire_equipment m
left join f_equipment_fire_equipment fe on fe.fire_equipment_id = m.id
left join f_equipment f on f.id = fe.equipment_id
......@@ -1202,29 +1202,29 @@
AND f.name = #{protectObjName}
</if>
UNION all
select name,code,'video' as typeCode,org_code as orgCode
select name,code,'video' as typeCode,org_code as orgCode, risk_source_id as riskSourceId
from f_fire_equipment where equip_classify = 2
UNION all
select name,code,'fireEquipment' as typeCode,org_code as orgCode
select name,code,'fireEquipment' as typeCode,org_code as orgCode, risk_source_id as riskSourceId
from f_water_resource where type = 1
UNION all
select name,code,'fireEquipment' as typeCode,org_code as orgCode
select name,code,'fireEquipment' as typeCode,org_code as orgCode, risk_source_id as riskSourceId
from f_water_resource where type = 2
UNION all
select name,car_num as code,'fireEquipment' as typeCode,org_code as orgCode
select name,car_num as code,'fireEquipment' as typeCode,org_code as orgCode, risk_source_id as riskSourceId
from f_fire_car
UNION all
select name,code,'fireEquipment' as typeCode,org_code as orgCode
select name,code,'fireEquipment' as typeCode,org_code as orgCode, risk_source_id as riskSourceId
from f_fire_equipment where equip_classify = 3
UNION all
select name,code,'fireEquipment' as typeCode,org_code as orgCode
select name,code,'fireEquipment' as typeCode,org_code as orgCode, risk_source_id as riskSourceId
from f_fire_station where type = 2
UNION all
select name,code,'fireEquipment' as typeCode,org_code as orgCode
select name,code,'fireEquipment' as typeCode,org_code as orgCode, risk_source_id as riskSourceId
from f_fire_station where type = 1
) as tmp
where 1=1
<if test="inputText!=null" >
<if test="inputText!=null and inputText != ''" >
AND (
tmp.code LIKE '%${inputText}%'
OR tmp.name LIKE '%${inputText}%'
......@@ -1233,6 +1233,9 @@
<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>
......@@ -1267,7 +1270,8 @@ from (select concat('riskSource',r.id) as id,r.id as originId,r.name,r.code,r.ue
'' as routeName,
'' as person,
r.rpn as title,
CONCAT('riskSource-',r.id) as `key`
CONCAT('riskSource-',r.id) as `key`,
r.id as riskSourceId
from f_risk_source r
left join f_risk_level rl ON rl.id = r.risk_level_id
where r.is_region = 'FALSE'
......@@ -1307,7 +1311,8 @@ from (select concat('riskSource',r.id) as id,r.id as originId,r.name,r.code,r.ue
when p.status = '2' then '不合格'
when p.status = '3' then '漏检'
end as title,
concat('patrol-',p.id) as `key`
concat('patrol-',p.id) as `key`,
p.risk_source_id as riskSourceId
from p_point p
WHERE is_delete = FALSE
UNION all
......@@ -1338,7 +1343,8 @@ from (select concat('riskSource',r.id) as id,r.id as originId,r.name,r.code,r.ue
'' as routeName,
'' as person,
name as title,
concat('impEquipment-',e.id) as `key`
concat('impEquipment-',e.id) as `key`,
e.risk_source_id as riskSourceId
from f_equipment e
UNION all
select concat('monitorEquipment-',m.id) as id,m.id as originId,m.name,m.code,m.ue4_location as ue4Location,m.ue4_rotation as ue4Rotation ,'monitorEquipment' as type,m.org_code as orgCode,
......@@ -1368,7 +1374,8 @@ from (select concat('riskSource',r.id) as id,r.id as originId,r.name,r.code,r.ue
'' as routeName,
'' as person,
m.name as title,
concat('monitorEquipment-',m.id) as `key`
concat('monitorEquipment-',m.id) as `key`,
m.risk_source_id as riskSourceId
from f_fire_equipment m
left join f_equipment_fire_equipment fe on fe.fire_equipment_id = m.id
left join f_equipment f on f.id = fe.equipment_id
......@@ -1405,7 +1412,8 @@ from (select concat('riskSource',r.id) as id,r.id as originId,r.name,r.code,r.ue
'' as routeName,
'' as person,
m.name as title,
concat('video-',m.id) as `key`
concat('video-',m.id) as `key`,
m.risk_source_id as riskSourceId
from f_fire_equipment m
left join f_equipment_fire_equipment fe on fe.fire_equipment_id = m.id
left join f_equipment f on f.id = fe.equipment_id
......@@ -1439,7 +1447,8 @@ from (select concat('riskSource',r.id) as id,r.id as originId,r.name,r.code,r.ue
'' as routeName,
'' as person,
name as title,
concat('hydrant-',id) as `key`
concat('hydrant-',id) as `key`,
risk_source_id as riskSourceId
from f_water_resource where type = 1
UNION all
select concat('pool-',id) as id,id as originId,name,code,ue4_location as ue4Location,ue4_rotation as ue4Rotation,'pool' as type,org_code as orgCode,
......@@ -1469,7 +1478,8 @@ from (select concat('riskSource',r.id) as id,r.id as originId,r.name,r.code,r.ue
'' as routeName,
'' as person,
name as title,
concat('pool-',id) as `key`
concat('pool-',id) as `key`,
risk_source_id as riskSourceId
from f_water_resource where type = 2
UNION all
select concat('fireCar-',id) as id,id as originId,name,car_num as code,ue4_location as ue4Location,ue4_rotation as ue4Rotation, 'fireCar' as type,org_code as orgCode,
......@@ -1499,7 +1509,8 @@ from (select concat('riskSource',r.id) as id,r.id as originId,r.name,r.code,r.ue
'' as routeName,
'' as person,
name as title,
concat('fireCar-',id) as `key`
concat('fireCar-',id) as `key`,
risk_source_id as riskSourceId
from f_fire_car
UNION all
select concat('fireEquipment-',id) as id,id as originId,name,code,ue4_location as ue4Location,ue4_rotation as ue4Rotation,'fireEquipment' as type,org_code as orgCode,
......@@ -1529,7 +1540,8 @@ from (select concat('riskSource',r.id) as id,r.id as originId,r.name,r.code,r.ue
'' as routeName,
'' as person,
name as title,
concat('fireEquipment-',id) as `key`
concat('fireEquipment-',id) as `key`,
risk_source_id as riskSourceId
from f_fire_equipment where equip_classify = 3
UNION all
select concat('fireChamber-',id) as id,id as originId,name,code,ue4_location as ue4Location,ue4_rotation as ue4Rotation , 'fireChamber' as type,org_code as orgCode,
......@@ -1559,7 +1571,8 @@ from (select concat('riskSource',r.id) as id,r.id as originId,r.name,r.code,r.ue
'' as routeName,
'' as person,
name as title,
concat('fireChamber-',id) as `key`
concat('fireChamber-',id) as `key`,
risk_source_id as riskSourceId
from f_fire_station where type = 2
UNION all
select concat('fireFoamRoom-',id) as id,id as originId,name,code,ue4_location as ue4Location,ue4_rotation as ue4Rotation ,'fireFoamRoom' as type,org_code as orgCode,
......@@ -1589,11 +1602,12 @@ from (select concat('riskSource',r.id) as id,r.id as originId,r.name,r.code,r.ue
'' as routeName,
'' as person,
name as title,
concat('fireFoamRoom-',id) as `key`
concat('fireFoamRoom-',id) as `key`,
risk_source_id as riskSourceId
from f_fire_station where type = 1
) as tmp
<where>
<if test="inputText!=null" >
<if test="inputText!=null and inputText != ''" >
AND (
tmp.code LIKE '%${inputText}%'
OR tmp.name LIKE '%${inputText}%'
......@@ -1602,6 +1616,9 @@ from (select concat('riskSource',r.id) as id,r.id as originId,r.name,r.code,r.ue
<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>
......
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