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

联调接口

parent f72c369e
......@@ -3,18 +3,24 @@ package com.yeejoin.amos.fas.core.common.response;
import java.util.ArrayList;
import java.util.List;
import com.alibaba.druid.util.StringUtils;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
public class RegionTreeResponse {
private Long id;
private String name;
private String code;
private Long parentId;
private String ue4Location;
private String ue4Rotation;
private String ue4Extent;
private JSONArray ue4Location = new JSONArray();
private JSONArray ue4Rotation = new JSONArray();
private JSONArray ue4Extent = new JSONArray();
private Boolean isBind;
private List<RegionTreeResponse> children = new ArrayList<>();
private String type;
private Boolean isRegion;
private List<RegionTreeResponse> children = new ArrayList<>();
public Long getId() {
return id;
......@@ -40,23 +46,23 @@ public class RegionTreeResponse {
public void setParentId(Long parentId) {
this.parentId = parentId;
}
public String getUe4Location() {
public JSONArray getUe4Location() {
return ue4Location;
}
public void setUe4Location(String ue4Location) {
this.ue4Location = ue4Location;
this.ue4Location = StringUtils.isEmpty(ue4Location) ? new JSONArray() : JSONArray.parseArray(ue4Location);
}
public String getUe4Rotation() {
public JSONArray getUe4Rotation() {
return ue4Rotation;
}
public void setUe4Rotation(String ue4Rotation) {
this.ue4Rotation = ue4Rotation;
this.ue4Rotation = StringUtils.isEmpty(ue4Rotation) ? new JSONArray() : JSON.parseArray(ue4Rotation);
}
public String getUe4Extent() {
public JSONArray getUe4Extent() {
return ue4Extent;
}
public void setUe4Extent(String ue4Extent) {
this.ue4Extent = ue4Extent;
this.ue4Extent = StringUtils.isEmpty(ue4Extent) ? new JSONArray() : JSON.parseArray(ue4Extent);
}
public Boolean getIsBind() {
return isBind;
......@@ -76,6 +82,12 @@ public class RegionTreeResponse {
public void setType(String type) {
this.type = type;
}
public Boolean getIsRegion() {
return isRegion;
}
public void setIsRegion(Boolean isRegion) {
this.isRegion = isRegion;
}
......
......@@ -37,6 +37,7 @@ public class View3dController extends BaseController {
public CommonResponse getRegionTree() {
ReginParams reginParams =getSelectedOrgInfo();
String orgCode = this.getOrgCode(reginParams);
orgCode = "10";
return CommonResponseUtil.success(riskSourceService.findRegionTree(orgCode));
}
......@@ -45,6 +46,7 @@ public class View3dController extends BaseController {
public CommonResponse getRegionDetail(@PathVariable("riskSourceId") Long riskSourceId) {
ReginParams reginParams =getSelectedOrgInfo();
String orgCode = this.getOrgCode(reginParams);
orgCode = "10";
return CommonResponseUtil.success(riskSourceService.findRegionById(riskSourceId,orgCode));
}
......@@ -71,6 +73,7 @@ public class View3dController extends BaseController {
if(ResourceTypeDefEnum.containsTypeCode(type)) {
ReginParams reginParams =getSelectedOrgInfo();
String orgCode = this.getOrgCode(reginParams);
orgCode = "10";
return CommonResponseUtil.success(view3dService.getPointTreeByType(type,orgCode));
}
return CommonResponseUtil.failure(type + " 类型不存在");
......@@ -84,6 +87,14 @@ public class View3dController extends BaseController {
return CommonResponseUtil.success(view3dService.getPointDetailByTypeAndId(type,pointId,orgCode));
}
@ApiOperation(value = "一周安全指数趋势查询", notes = "一周安全指数趋势查询")
@GetMapping(value = "safetyIndex/week")
public CommonResponse safetyIndexWeek(String type,Long pointId) {
ReginParams reginParams =getSelectedOrgInfo();
String orgCode = this.getOrgCode(reginParams);
return CommonResponseUtil.success(view3dService.getSafetyIndexWeek(orgCode));
}
@ApiOperation(value = "今日安全指数查询",notes = "按照日期查询安全指数及分类数据")
@GetMapping(value = "/statistics/safetyIndex")
public CommonResponse getSafetyIndexInfoByDate(@RequestParam(name = "date",required = false) String date){
......
......@@ -49,4 +49,11 @@ public interface View3dMapper extends BaseMapper{
*/
List<RiskPointRpnChangeBo> getAllErrorRiskPoint(Map<String, Object> params);
/**
* 一周安全指数趋势查询
* @param orgCode
* @return
*/
HashMap<String, Object> getSafetyIndexWeek(String orgCode);
}
......@@ -292,4 +292,9 @@ public class View3dServiceImpl implements IView3dService {
//计算规则:除10 减100 求绝对值,结果保留1位小数
return rpn.divide(new BigDecimal("10")).subtract(new BigDecimal("100")).abs().setScale(1,BigDecimal.ROUND_HALF_UP).doubleValue();
}
@Override
public HashMap<String, Object> getSafetyIndexWeek(String orgCode) {
return view3dMapper.getSafetyIndexWeek(orgCode);
}
}
......@@ -60,4 +60,11 @@ public interface IView3dService {
*/
List<SafetyIndexDetailVo> getSafetyIndexDetail(String type,String orgCode);
/**
* 一周安全指数趋势查询
* @param orgCode
* @return
*/
HashMap<String, Object> getSafetyIndexWeek(String orgCode);
}
......@@ -679,7 +679,8 @@
<select id="getRegionList" parameterType="string" resultType="com.yeejoin.amos.fas.core.common.response.RegionTreeResponse">
select
id,name,code,parent_id,ue4_location,ue4_rotation,ue4_extent,
IF(ISNULL(IF(trim(ue4_rotation)='',NULL,ue4_rotation)) OR ISNULL(IF(trim(ue4_location)='',NULL,ue4_location)),0,1) as is_bind
IF(ISNULL(IF(trim(ue4_rotation)='',NULL,ue4_rotation)) OR ISNULL(IF(trim(ue4_location)='',NULL,ue4_location)),0,1) as is_bind,
IF(is_region = 'TRUE',1,0) as is_region
from f_risk_source
where is_region = 'TRUE' AND org_code like CONCAT(#{orgCode},'%')
</select>
......@@ -687,7 +688,8 @@
<select id="findRegionById" resultType="java.util.HashMap">
select
id,name,code,parent_id as parentId,ue4_location as ue4Location,ue4_rotation as ue4Rotation,ue4_extent as ue4Extent,
IF(ISNULL(IF(trim(ue4_rotation)='',NULL,ue4_rotation)) OR ISNULL(IF(trim(ue4_location)='',NULL,ue4_location)),0,1) as isBind
IF(ISNULL(IF(trim(ue4_rotation)='',NULL,ue4_rotation)) OR ISNULL(IF(trim(ue4_location)='',NULL,ue4_location)),0,1) as isBind,
IF(is_region = 'TRUE',1,0) as isRegion
from f_risk_source
where id=#{id} AND org_code like CONCAT(#{orgCode},'%')
</select>
......
......@@ -8,17 +8,19 @@
<when test="type == 'riskSource'">
select
R.id,R.name,R.code,R.parent_id,R.ue4_location,R.ue4_rotation,R.ue4_extent,
IF(ISNULL(IF(trim(R.ue4_rotation)='',NULL,R.ue4_rotation)) OR ISNULL(IF(trim(R.ue4_location)='',NULL,R.ue4_location)),0,1) as is_bind,
#{type} as type
IF(ISNULL(IF(trim(R.ue4_rotation)='',NULL,R.ue4_rotation)) AND ISNULL(IF(trim(R.ue4_location)='',NULL,R.ue4_location)),0,1) as is_bind,
#{type} as type,
IF(is_region = 'TRUE',1,0) as is_region
from f_risk_source R
where 1=1
</when>
<when test="type == 'patrol'">
select
R.id,R.parent_id,
IF(ISNULL(IF(trim(R.ue4_rotation)='',NULL,R.ue4_rotation)) OR ISNULL(IF(trim(R.ue4_location)='',NULL,R.ue4_location)),0,1) as is_bind,
IF(ISNULL(IF(trim(R.ue4_rotation)='',NULL,R.ue4_rotation)) AND ISNULL(IF(trim(R.ue4_location)='',NULL,R.ue4_location)),0,1) as is_bind,
#{type} as type,
B.name as name,B.point_no,B.ue4_location,B.ue4_rotation
B.name as name,B.point_no,B.ue4_location,B.ue4_rotation,
1 as is_region
from f_risk_source R
left join p_point B on B.risk_source_id = R.id AND R.is_region='TRUE'
where 1=1
......@@ -27,9 +29,10 @@
<when test="type == 'impEquipment'">
select
R.id,R.parent_id,
IF(ISNULL(IF(trim(R.ue4_rotation)='',NULL,R.ue4_rotation)) OR ISNULL(IF(trim(R.ue4_location)='',NULL,R.ue4_location)),0,1) as is_bind,
IF(ISNULL(IF(trim(R.ue4_rotation)='',NULL,R.ue4_rotation)) AND ISNULL(IF(trim(R.ue4_location)='',NULL,R.ue4_location)),0,1) as is_bind,
#{type} as type,
B.name,B.code,B.ue4_location,B.ue4_rotation
B.name,B.code,B.ue4_location,B.ue4_rotation,
1 as is_region
from f_risk_source R
left join f_equipment B on B.risk_source_id = R.id AND R.is_region='TRUE'
where 1=1
......@@ -38,9 +41,10 @@
<when test="type == 'monitorEquipment'">
select
R.id,R.parent_id,
IF(ISNULL(IF(trim(R.ue4_rotation)='',NULL,R.ue4_rotation)) OR ISNULL(IF(trim(R.ue4_location)='',NULL,R.ue4_location)),0,1) as is_bind,
IF(ISNULL(IF(trim(R.ue4_rotation)='',NULL,R.ue4_rotation)) AND ISNULL(IF(trim(R.ue4_location)='',NULL,R.ue4_location)),0,1) as is_bind,
#{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
from f_risk_source R
left join f_fire_equipment B on B.risk_source_id = R.id AND B.equip_classify = 0
where 1=1
......@@ -49,9 +53,10 @@
<when test="type == 'video'">
select
R.id,R.parent_id,
IF(ISNULL(IF(trim(R.ue4_rotation)='',NULL,R.ue4_rotation)) OR ISNULL(IF(trim(R.ue4_location)='',NULL,R.ue4_location)),0,1) as is_bind,
IF(ISNULL(IF(trim(R.ue4_rotation)='',NULL,R.ue4_rotation)) AND ISNULL(IF(trim(R.ue4_location)='',NULL,R.ue4_location)),0,1) as is_bind,
#{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
from f_risk_source R
left join f_fire_equipment B on B.risk_source_id = R.id AND B.equip_classify = 2
where 1=1
......@@ -60,7 +65,7 @@
<when test="type == 'fireEquipment'">
select
R.id,R.parent_id,
IF(ISNULL(IF(trim(R.ue4_rotation)='',NULL,R.ue4_rotation)) OR ISNULL(IF(trim(R.ue4_location)='',NULL,R.ue4_location)),0,1) as is_bind,
IF(ISNULL(IF(trim(R.ue4_rotation)='',NULL,R.ue4_rotation)) AND ISNULL(IF(trim(R.ue4_location)='',NULL,R.ue4_location)),0,1) as is_bind,
CASE
WHEN ISNULL(C.id) = 0 then 'fireCar'
WHEN ISNULL(E.id) = 0 then 'fireEquipment'
......@@ -92,7 +97,8 @@
WHEN ISNULL(E.name) = 0 then E.ue4_rotation
WHEN ISNULL(S.name) = 0 then S.ue4_rotation
WHEN ISNULL(W.name) = 0 then W.ue4_rotation
END as code
END as code,
0 as is_region
from f_risk_source R
left join f_fire_car C on C.risk_source_id = R.id
left join f_fire_equipment E on E.risk_source_id = R.id AND equip_classify = 3
......@@ -173,6 +179,11 @@
AND org_code like CONCAT(#{orgCode},'%')
</if>
</select>
<select id="getSafetyIndexWeek" resultType="java.util.HashMap">
</select>
<select id="countUpperRiskPoint" resultType="long">
SELECT
count(DISTINCT frcl.id)
......
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