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());
......
......@@ -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