Commit b505fa5e authored by 单奇雲's avatar 单奇雲

调整接口

parent ae3d96f5
......@@ -154,7 +154,10 @@ public class View3dController extends BaseController {
@ApiOperation(value = "今日值班统计",notes = "今日值班统计")
@GetMapping(value = "statistics/duty")
public CommonResponse getStatisticsDuty(){
return CommonResponseUtil.success(view3dService.getStatisticsDuty());
ReginParams reginParams =getSelectedOrgInfo();
String orgCode = this.getOrgCode(reginParams);
orgCode = "10*11-28";
return view3dService.getStatisticsDuty(getAppKey(),getProduct(),orgCode);
}
@ApiOperation(value = "异常区域信息查询",notes = "异常区域信息查询")
......@@ -180,16 +183,16 @@ public class View3dController extends BaseController {
ReginParams reginParams =getSelectedOrgInfo();
String orgCode = this.getOrgCode(reginParams);
orgCode = "1*2";
return CommonResponseUtil.success(view3dService.initViewNode(type,orgCode));
return CommonResponseUtil.success(view3dService.initViewErrorNode(type,orgCode));
}
@ApiOperation(value = "按照点类型查询点列表",notes = "按照点类型查询点列表")
@GetMapping(value = "point/list")
public CommonResponse get3dPointsByType(@RequestParam(required = false,defaultValue = "all") String type){
public CommonResponse get3dPointsByType(@RequestParam(required = false,defaultValue = "grain") String model){
ReginParams reginParams =getSelectedOrgInfo();
String orgCode = this.getOrgCode(reginParams);
List<HashMap<String,Object>> pointList = view3dService.get3dPointsByType(orgCode,type);
return CommonResponseUtil.success(pointList);
orgCode = "1*2";
return CommonResponseUtil.success(view3dService.get3dPointsByModel(orgCode,model));
}
@Scheduled(cron = "${param.safetyIndexchange.cron}")
......
......@@ -87,14 +87,29 @@ public interface View3dMapper extends BaseMapper{
*/
List<SafetyExecuteBo> getCheckErrorTop5(String orgCode);
List<View3dNodeVo> initViewImpEquipmentNode(String orgCode);
/**
* 按照类型查询点
* @param params {orgCode,type}
* @return 列表
*/
List<HashMap<String, Object>> getPintsByType(Map<String, Object> params);
/**
* 更新safetyIndexchangelog
*/
void safetyIndexRefresh();
/**
* 重点模式设备
* @return
*/
List<View3dNodeVo> getImpEqu3dPoints(String orgCode);
/**
* 异常点
* @param type
* @param orgCode
* @return
*/
List<View3dNodeVo> initViewErrorNode(String type, String orgCode);
}
package com.yeejoin.amos.fas.business.feign;
import com.yeejoin.amos.fas.core.util.CommonResponse;
import com.yeejoin.amos.fas.core.util.CommonResponseUtil;
public class DutyModeServerFallback implements IDutyModeServer{
@Override
public CommonResponse dutyListByDay(String appKey,String product,String orgCode,String dutyDate) {
return CommonResponseUtil.failure("fegin调用失败!!!");
}
}
......@@ -25,5 +25,6 @@ public class FeignBasicAuthRequestInterceptor implements RequestInterceptor{
authToken = request.getParameter("token");
}
template.header("X-Access-Token", authToken);
template.header("token", authToken);
}
}
package com.yeejoin.amos.fas.business.feign;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import com.yeejoin.amos.fas.core.util.CommonResponse;
@FeignClient(name="${dutyMode.fegin.name}", fallback=DutyModeServerFallback.class, configuration=FeignConfiguration.class)
public interface IDutyModeServer {
@RequestMapping(value = "/duty/listByDay", method = RequestMethod.POST,consumes = "application/json")
public CommonResponse dutyListByDay(
@RequestHeader(name="appKey",required = true) String appKey,
@RequestHeader(name="product",required = true) String product,
@RequestHeader(name="orgCode",required = true) String orgCode,
@RequestBody String param);
}
package com.yeejoin.amos.fas.business.service.impl;
import static org.hamcrest.CoreMatchers.either;
import static org.springframework.test.web.client.match.MockRestRequestMatchers.method;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.alibaba.fastjson.JSONObject;
import com.itextpdf.text.pdf.PdfStructTreeController.returnType;
import java.math.BigDecimal;
import java.util.*;
import java.util.Optional;
import java.util.stream.Collectors;
import javax.persistence.criteria.CriteriaBuilder.Case;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.google.common.collect.Lists;
import com.yeejoin.amos.fas.business.bo.BindPointBo;
import com.yeejoin.amos.fas.business.bo.CheckErrorBo;
......@@ -27,7 +31,15 @@ import com.yeejoin.amos.fas.business.bo.SafetyExecuteBo;
import com.yeejoin.amos.fas.business.constants.FasConstant;
import com.yeejoin.amos.fas.business.dao.mapper.PatrolMapper;
import com.yeejoin.amos.fas.business.dao.mapper.View3dMapper;
import com.yeejoin.amos.fas.business.dao.repository.*;
import com.yeejoin.amos.fas.business.dao.repository.IEquipmentDao;
import com.yeejoin.amos.fas.business.dao.repository.IFireCarDao;
import com.yeejoin.amos.fas.business.dao.repository.IFireEquipmentDao;
import com.yeejoin.amos.fas.business.dao.repository.IFireStationDao;
import com.yeejoin.amos.fas.business.dao.repository.IRiskLevelDao;
import com.yeejoin.amos.fas.business.dao.repository.IRiskSourceDao;
import com.yeejoin.amos.fas.business.dao.repository.ISafetyIndexChangeLogDao;
import com.yeejoin.amos.fas.business.dao.repository.IWaterResourceDao;
import com.yeejoin.amos.fas.business.feign.IDutyModeServer;
import com.yeejoin.amos.fas.business.feign.RemoteWebSocketServer;
import com.yeejoin.amos.fas.business.service.intfc.IView3dService;
import com.yeejoin.amos.fas.business.vo.ErrorContentVo;
......@@ -37,28 +49,24 @@ import com.yeejoin.amos.fas.business.vo.TodaySafetyIndexVo;
import com.yeejoin.amos.fas.business.vo.View3dNodeVo;
import com.yeejoin.amos.fas.common.enums.CheckStatusEnum;
import com.yeejoin.amos.fas.common.enums.PlanTaskDetailStatusEnum;
import com.yeejoin.amos.fas.common.enums.ResourceTypeDefEnum;
import com.yeejoin.amos.fas.common.enums.RpnChangeTypeEum;
import com.yeejoin.amos.fas.common.enums.StatisticsErrorTypeEum;
import com.yeejoin.amos.fas.common.enums.*;
import com.yeejoin.amos.fas.common.enums.View3dRefreshAreaEum;
import com.yeejoin.amos.fas.core.common.request.DateUtil;
import com.yeejoin.amos.fas.core.common.response.RegionTreeResponse;
import com.yeejoin.amos.fas.core.util.CommonResponse;
import com.yeejoin.amos.fas.core.util.CommonResponseUtil;
import com.yeejoin.amos.fas.core.util.StringUtil;
import com.yeejoin.amos.fas.dao.entity.*;
import com.yeejoin.amos.fas.dao.entity.Equipment;
import com.yeejoin.amos.fas.dao.entity.FireCar;
import com.yeejoin.amos.fas.dao.entity.FireEquipment;
import com.yeejoin.amos.fas.dao.entity.FireStation;
import com.yeejoin.amos.fas.dao.entity.RiskLevel;
import com.yeejoin.amos.fas.dao.entity.RiskSource;
import com.yeejoin.amos.fas.dao.entity.SafetyIndexChangeLog;
import com.yeejoin.amos.fas.dao.entity.WaterResource;
import com.yeejoin.amos.fas.exception.YeeException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import java.math.BigDecimal;
import java.util.*;
import java.util.stream.Collectors;
/**
* @author DELL
......@@ -91,6 +99,8 @@ public class View3dServiceImpl implements IView3dService {
@Autowired
private RemoteWebSocketServer remoteWebSocketServer;
@Autowired
private IDutyModeServer dutyModeServer;
@Value("${param.system.online.date}")
private String onLineDate;
......@@ -449,12 +459,12 @@ public class View3dServiceImpl implements IView3dService {
}
@Override
public Object getStatisticsDuty() {
return JSON.parse("{\r\n" +
" \"dutyPersonNumber\": 10,\r\n" +
" \"firePersonNumber\": 15,\r\n" +
" \"securityPersonNumber\": 20,\r\n" +
" }");
public CommonResponse getStatisticsDuty(String appKey,String product,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,orgCode,param.toJSONString());
}
@Override
......@@ -464,21 +474,20 @@ public class View3dServiceImpl implements IView3dService {
}
@Override
public List<View3dNodeVo> initViewNode(String type, String orgCode) {
switch (type) {
case "impEquipment":
return view3dMapper.initViewImpEquipmentNode(orgCode);
default:
break;
}
return null;
public List<View3dNodeVo> initViewErrorNode(String type, String orgCode) {
return view3dMapper.initViewErrorNode(type,orgCode);
}
@Override
public List<HashMap<String, Object>> get3dPointsByType(String orgCode,String type) {
List<HashMap<String, Object>> points = new ArrayList<>();
points = this.getPointsByType(orgCode,type);
return points;
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){
......@@ -492,8 +501,10 @@ public class View3dServiceImpl implements IView3dService {
points.forEach(point ->{
JSONArray ue4Location = this.getInitJSONArray(String.valueOf(point.get("ue4Location")));
JSONArray ue4Rotation = this.getInitJSONArray(String.valueOf(point.get("ue4Rotation")));
String[] relationKeys = point.get("relationKeys") != null ? String.valueOf(point.get("relationKeys")).split(",") : null;
point.put("ue4Location",ue4Location);
point.put("ue4Rotation",ue4Rotation);
point.put("relationKeys",relationKeys);
});
return points;
}
......
......@@ -103,7 +103,7 @@ public interface IView3dService {
* 今日值班统计
* @return
*/
Object getStatisticsDuty();
CommonResponse getStatisticsDuty(String appKey, String product, String orgCode);
/**
* 设备状态消息最新5条
......@@ -113,19 +113,19 @@ public interface IView3dService {
Object getEquipStatusList(String orgCode);
/**
* 左侧菜单
* 左侧菜单(异常点)
* @param type
* @param orgCode
* @return
*/
List<View3dNodeVo> initViewNode(String type, String orgCode);
List<View3dNodeVo> initViewErrorNode(String type, String orgCode);
/**
* 查询类型的点
* @param orgCode 机构
* @param type 点类型
* @param model 模式类型
* @return list
*/
List<HashMap<String, Object>> get3dPointsByType(String orgCode,String type);
CommonResponse get3dPointsByModel(String orgCode,String model);
/**
* 刷新安全指数
......
package com.yeejoin.amos.fas.business.vo;
import java.util.List;
import com.alibaba.druid.util.StringUtils;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.yeejoin.amos.fas.business.util.StringUtil;
public class View3dNodeVo {
......@@ -12,6 +15,9 @@ public class View3dNodeVo {
private JSONArray ue4Location = new JSONArray();
private JSONArray ue4Rotation = new JSONArray();
private String type;
private String key;
private String[] relationKeys;
public Long getId() {
return id;
}
......@@ -48,5 +54,19 @@ public class View3dNodeVo {
public void setType(String type) {
this.type = type;
}
public String getKey() {
return key;
}
public void setKey(String key) {
this.key = key;
}
public String[] getRelationKeys() {
return relationKeys;
}
public void setRelationKeys(String relationKeys) {
if(StringUtil.isNotEmpty(relationKeys)) {
this.relationKeys = relationKeys.split(",");
}
}
}
......@@ -710,6 +710,9 @@
<if test="item.ue4Extent != null" >
ue4_extent = #{item.ue4Extent,jdbcType=VARCHAR},
</if>
<if test="item.position3d != null" >
position3d = #{item.position3d,jdbcType=VARCHAR},
</if>
</set>
where id = #{item.riskSourceId,jdbcType=BIGINT}
</foreach>
......
......@@ -70,8 +70,6 @@
<when test="type == 'fireEquipment'">
select
R.id,R.parent_id,
<!-- IF(ISNULL(IF(replace(trim(R.ue4_rotation),'[]','')='',NULL,R.ue4_rotation))
AND ISNULL(IF(replace(trim(R.4_rotation),'[]','')='',NULL,R.ue4_location)),0,1) as is_bind, -->
CASE
WHEN ISNULL(C.id) = 0 then IF(ISNULL(IF(replace(trim(C.ue4_rotation),'[]','')='',NULL,C.ue4_rotation))
AND ISNULL(IF(replace(trim(C.ue4_rotation),'[]','')='',NULL,C.ue4_location)),0,1)
......@@ -133,7 +131,7 @@
<select id="getPointDetailByTypeAndId" resultType="java.util.HashMap">
<choose>
<when test="type == 'riskSource'">
select id,name,code,ue4_location as ue4Location,ue4_rotation as ue4Rotation
select id,name,code,ue4_location as ue4Location,ue4_rotation as ue4Rotation,position3d
from f_risk_source
where 1=1
</when>
......@@ -308,61 +306,126 @@
ORDER BY p.check_time desc
limit 0,5
</select>
<select id="getPintsByType" resultType="hashmap">
select CONCAT(type,'-',id) as `key`,sp.* from
(select id,name,code,ue4_location as ue4Location,ue4_rotation as ue4Rotation ,'riskSource' as type,org_code as orgCode from f_risk_source where is_region = 'FALSE'
(select id,name,code,ue4_location as ue4Location,ue4_rotation as ue4Rotation ,'riskSource' as type,org_code as orgCode,
null as relationKeys
from f_risk_source where is_region = 'FALSE'
UNION all
select id,name,point_no as code,ue4_location as ue4Location,ue4_rotation as ue4Rotation ,'patrol' as type,org_code as orgCode from p_point WHERE is_delete = FALSE
select id,name,point_no as code,ue4_location as ue4Location,ue4_rotation as ue4Rotation ,'patrol' as type,org_code as orgCode,
null as relationKeys
from p_point WHERE is_delete = FALSE
UNION all
select id,name,code,ue4_location as ue4Location,ue4_rotation as ue4Rotation ,'impEquipment' as type,org_code as orgCode from f_equipment
select id,name,code,ue4_location as ue4Location,ue4_rotation as ue4Rotation ,'impEquipment' as type,org_code as orgCode,
tmp.relationKeys
from f_equipment e
LEFT JOIN
(select GROUP_CONCAT(fire_equipment_id) as relationKeys,equipment_id from f_equipment_fire_equipment GROUP BY equipment_id) tmp
ON TMP.equipment_id = e.id
UNION all
select id,name,code,ue4_location as ue4Location,ue4_rotation as ue4Rotation ,'monitorEquipment' as type,org_code as orgCode from f_fire_equipment where equip_classify = 0
select id,name,code,ue4_location as ue4Location,ue4_rotation as ue4Rotation ,'monitorEquipment' as type,org_code as orgCode,
null as relationKeys
from f_fire_equipment where equip_classify = 0
UNION all
select id,name,code,ue4_location as ue4Location,ue4_rotation as ue4Rotation ,'video' as type,org_code as orgCode from f_fire_equipment where equip_classify = 2
select id,name,code,ue4_location as ue4Location,ue4_rotation as ue4Rotation ,'video' as type,org_code as orgCode,
null as relationKeys
from f_fire_equipment where equip_classify = 2
UNION all
select id,name,code,ue4_location as ue4Location,ue4_rotation as ue4Rotation ,'hydrant' as type,org_code as orgCode from f_water_resource where type = 1
select id,name,code,ue4_location as ue4Location,ue4_rotation as ue4Rotation ,'hydrant' as type,org_code as orgCode,
null as relationKeys
from f_water_resource where type = 1
UNION all
select id,name,code,ue4_location as ue4Location,ue4_rotation as ue4Rotation,'pool' as type,org_code as orgCode from f_water_resource where type = 2
select id,name,code,ue4_location as ue4Location,ue4_rotation as ue4Rotation,'pool' as type,org_code as orgCode,
null as relationKeys
from f_water_resource where type = 2
UNION all
select id,name,car_num as code,ue4_location as ue4Location,ue4_rotation as ue4Rotation, 'fireCar' as type,org_code as orgCode from f_fire_car
select id,name,car_num as code,ue4_location as ue4Location,ue4_rotation as ue4Rotation, 'fireCar' as type,org_code as orgCode,
null as relationKeys
from f_fire_car
UNION all
select id,name,code,ue4_location as ue4Location,ue4_rotation as ue4Rotation,'fireEquipment' as type,org_code as orgCode from f_fire_equipment where equip_classify = 3
select id,name,code,ue4_location as ue4Location,ue4_rotation as ue4Rotation,'fireEquipment' as type,org_code as orgCode,
null as relationKeys
from f_fire_equipment where equip_classify = 3
UNION all
select id,name,code,ue4_location as ue4Location,ue4_rotation as ue4Rotation , 'fireChamber' as type,org_code as orgCode from f_fire_station where type = 2
select id,name,code,ue4_location as ue4Location,ue4_rotation as ue4Rotation , 'fireChamber' as type,org_code as orgCode,
null as relationKeys
from f_fire_station where type = 2
UNION all
select id,name,code,ue4_location as ue4Location,ue4_rotation as ue4Rotation ,'fireFoamRoom' as type,org_code as orgCode from f_fire_station where type = 1
select id,name,code,ue4_location as ue4Location,ue4_rotation as ue4Rotation ,'fireFoamRoom' as type,org_code as orgCode,
null as relationKeys
from f_fire_station where type = 1
) as sp
where
sp.orgCode = #{orgCode}
<if test="type!=null">and sp.type =#{type}</if>
</select>
<select id="initViewImpEquipmentNode" resultType="com.yeejoin.amos.fas.business.vo.View3dNodeVo">
SELECT id,name,code,ue4_location,ue4_rotation,'monitorEquipment' as type
<select id="getImpEqu3dPoints" resultType="com.yeejoin.amos.fas.business.vo.View3dNodeVo">
SELECT id,name,code,ue4_location,ue4_rotation,'monitorEquipment' as type,
null as relationKeys
FROM f_fire_equipment fe
WHERE fe.id IN (
select fire_equipment_id from f_equipment_fire_equipment
) AND org_code like CONCAT(#{orgCode},'%')
UNION ALL
SELECT id,name,code,ue4_location,ue4_rotation,'impEquipment' as type
FROM f_equipment
WHERE org_code like CONCAT(#{orgCode},'%')
SELECT e.id,e.name,e.code,e.ue4_location,e.ue4_rotation,'impEquipment' as type,
TMP.relationKeys
FROM f_equipment e
LEFT JOIN
(select GROUP_CONCAT(fire_equipment_id) as relationKeys,equipment_id from f_equipment_fire_equipment GROUP BY equipment_id) tmp
ON TMP.equipment_id = e.id
WHERE e.org_code like CONCAT(#{orgCode},'%')
UNION ALL
SELECT id,name,code,ue4_location,ue4_rotation,
case type
when 1 then 'hydrant'
when 2 then 'pool'
end as type
end as type,
null as relationKeys
FROM f_water_resource
WHERE org_code like CONCAT(#{orgCode},'%')
UNION ALL
SELECT id,name,code,ue4_location,ue4_rotation,'fireChamber' as type
SELECT id,name,code,ue4_location,ue4_rotation,'fireChamber' as type,
null as relationKeys
FROM f_fire_station
WHERE type = 1 AND org_code like CONCAT(#{orgCode},'%')
UNION ALL
SELECT id,name,car_num as code,ue4_location,ue4_rotation,'fireCar' as type
SELECT id,name,car_num as code,ue4_location,ue4_rotation,'fireCar' as type,
null as relationKeys
FROM f_fire_car
WHERE org_code like CONCAT(#{orgCode},'%')
</select>
<select id="initViewErrorNode" resultType="com.yeejoin.amos.fas.business.vo.View3dNodeVo">
<choose>
<when test="type == 'riskSource'">
select
R.id,R.name,R.code,R.ue4_location,R.ue4_rotation,
#{type} as type
from f_risk_source R
where is_region <![CDATA[<>]]> 'TRUE' AND status = 'ANOMALY'
AND R.org_code like CONCAT(#{orgCode},'%')
</when>
<when test="type == 'patrol'">
select
p.id,p.name,p.point_no as code,p.ue4_location,p.ue4_rotation,
#{type} as type
from p_point p
where status in (2,3)
AND p.org_code like CONCAT(#{orgCode},'%')
</when>
<when test="type == 'impEquipment'">
select distinct e.id,e.name,e.code,e.ue4_location,e.ue4_rotation,
#{type} as type
from
f_equipment e
left join f_equipment_fire_equipment efe ON e.id = efe.equipment_id
left join f_fire_equipment fe ON efe.fire_equipment_id = fe.id
where fe.equip_status = 1
AND e.org_code like CONCAT(#{orgCode},'%')
</when>
</choose>
</select>
</mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment