Commit 7eae0b3f authored by 单奇雲's avatar 单奇雲

新增一周安全指数统计接口,联调接口

parent 09e4faa0
package com.yeejoin.amos.fas.business.bo;
import com.alibaba.fastjson.JSONArray;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
......@@ -32,24 +34,24 @@ public class BasePointPositionBo {
return ue4Location;
}
public void setUe4Location(String ue4Location) {
this.ue4Location = ue4Location;
public void setUe4Location(JSONArray ue4Location) {
this.ue4Location = ue4Location.toString();
}
public String getUe4Rotation() {
return ue4Rotation;
}
public void setUe4Rotation(String ue4Rotation) {
this.ue4Rotation = ue4Rotation;
public void setUe4Rotation(JSONArray ue4Rotation) {
this.ue4Rotation = ue4Rotation.toString();
}
public String getUe4Extent() {
return ue4Extent;
}
public void setUe4Extent(String ue4Extent) {
this.ue4Extent = ue4Extent;
public void setUe4Extent(JSONArray ue4Extent) {
this.ue4Extent = ue4Extent.toString();
}
public String getPosition3d() {
......
......@@ -92,6 +92,7 @@ public class View3dController extends BaseController {
public CommonResponse safetyIndexWeek(String type,Long pointId) {
ReginParams reginParams =getSelectedOrgInfo();
String orgCode = this.getOrgCode(reginParams);
orgCode = "10";
return CommonResponseUtil.success(view3dService.getSafetyIndexWeek(orgCode));
}
......
......@@ -55,7 +55,7 @@ public interface View3dMapper extends BaseMapper{
* @param orgCode
* @return
*/
HashMap<String, Object> getSafetyIndexWeek(String orgCode);
List<HashMap<String, Object>> getSafetyIndexWeek(@Param("orgCode")String orgCode);
/**
* 今日安全指数详情
......
......@@ -38,6 +38,7 @@ import org.typroject.tyboot.component.cache.Redis;
import org.typroject.tyboot.component.cache.enumeration.CacheType;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
......@@ -1777,6 +1778,13 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
if(regionDetail != null) {
Long isBind = (Long) regionDetail.get("isBind");
regionDetail.put("isBind", isBind == 0 ? false : true);
String ue4Location = (String)regionDetail.get("ue4Location");
regionDetail.put("ue4Location", ue4Location == null ? new JSONArray() : JSON.parseArray(ue4Location));
String ue4Rotation = (String)regionDetail.get("ue4Rotation");
regionDetail.put("ue4Rotation", ue4Rotation == null ? new JSONArray() : JSON.parseArray(ue4Rotation));
String ue4Extent = (String)regionDetail.get("ue4Extent");
regionDetail.put("ue4Extent", ue4Extent == null ? new JSONArray() : JSON.parseArray(ue4Extent));
}
return regionDetail;
}
......
......@@ -12,6 +12,9 @@ import com.itextpdf.text.pdf.PdfStructTreeController.returnType;
import java.math.BigDecimal;
import java.util.*;
import java.util.stream.Collectors;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.google.common.collect.Lists;
import com.yeejoin.amos.fas.business.bo.BindPointBo;
import com.yeejoin.amos.fas.business.bo.CheckErrorBo;
......@@ -213,7 +216,14 @@ public class View3dServiceImpl implements IView3dService {
@Override
public HashMap<String, Object> getPointDetailByTypeAndId(String type, Long pointId,String orgCode) {
return view3dMapper.getPointDetailByTypeAndId(type,pointId,orgCode);
HashMap<String, Object> detail = view3dMapper.getPointDetailByTypeAndId(type,pointId,orgCode);
String ue4Location = (String)detail.get("ue4Location");
detail.put("ue4Location", ue4Location == null ? new JSONArray() : JSON.parseArray(ue4Location));
String ue4Rotation = (String)detail.get("ue4Rotation");
detail.put("ue4Rotation", ue4Rotation == null ? new JSONArray() : JSON.parseArray(ue4Rotation));
String ue4Extent = (String)detail.get("ue4Extent");
detail.put("ue4Extent", ue4Location == null ? new JSONArray() : JSON.parseArray(ue4Extent));
return detail;
}
@Override
......@@ -314,7 +324,7 @@ public class View3dServiceImpl implements IView3dService {
}
@Override
public HashMap<String, Object> getSafetyIndexWeek(String orgCode) {
public List<HashMap<String, Object>> getSafetyIndexWeek(String orgCode) {
return view3dMapper.getSafetyIndexWeek(orgCode);
}
}
......@@ -65,6 +65,6 @@ public interface IView3dService {
* @param orgCode
* @return
*/
HashMap<String, Object> getSafetyIndexWeek(String orgCode);
List<HashMap<String, Object>> getSafetyIndexWeek(String orgCode);
}
spring.application.name = AMOS-FIREAUTOSYS
spring.application.name = Amos-autosys-sqy
server.port = 8083
......@@ -31,6 +32,7 @@ mybatis.mapper-locations = classpath:db/mapper/*.xml
# mybatis entity package
mybatis.type-aliases-package = com.yeejoin.amos.fas.business.entity.mybatis
mybatis.configuration.mapUnderscoreToCamelCase=true
logging.level.com.yeejoin.amos.fas.business.dao.mapper=debug
#liquibase
spring.liquibase.change-log = classpath:/db/changelog/changelog-master.xml
......
......@@ -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(replace(trim(ue4_rotation),'[]','')='',NULL,ue4_rotation))
AND ISNULL(IF(replace(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},'%')
......@@ -688,7 +689,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(replace(trim(ue4_rotation),'[]','')='',NULL,ue4_rotation))
AND ISNULL(IF(replace(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},'%')
......
......@@ -8,7 +8,8 @@
<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)) AND ISNULL(IF(trim(R.ue4_location)='',NULL,R.ue4_location)),0,1) as is_bind,
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,
#{type} as type,
IF(is_region = 'TRUE',1,0) as is_region
from f_risk_source R
......@@ -17,7 +18,8 @@
<when test="type == 'patrol'">
select
R.id,R.parent_id,
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,
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,
#{type} as type,
B.name as name,B.point_no,B.ue4_location,B.ue4_rotation,
1 as is_region
......@@ -29,7 +31,8 @@
<when test="type == 'impEquipment'">
select
R.id,R.parent_id,
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,
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,
#{type} as type,
B.name,B.code,B.ue4_location,B.ue4_rotation,
1 as is_region
......@@ -41,7 +44,8 @@
<when test="type == 'monitorEquipment'">
select
R.id,R.parent_id,
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,
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,
#{type} as type,
B.name,B.code,B.ue4_location,B.ue4_rotation,
0 as is_region
......@@ -53,7 +57,8 @@
<when test="type == 'video'">
select
R.id,R.parent_id,
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,
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,
#{type} as type,
B.name,B.code,B.ue4_location,B.ue4_rotation,
0 as is_region
......@@ -65,7 +70,18 @@
<when test="type == 'fireEquipment'">
select
R.id,R.parent_id,
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,
<!-- 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)
WHEN ISNULL(E.id) = 0 then IF(ISNULL(IF(replace(trim(E.ue4_rotation),'[]','')='',NULL,E.ue4_rotation))
AND ISNULL(IF(replace(trim(E.ue4_rotation),'[]','')='',NULL,E.ue4_location)),0,1)
WHEN ISNULL(S.id) = 0 then IF(ISNULL(IF(replace(trim(S.ue4_rotation),'[]','')='',NULL,S.ue4_rotation))
AND ISNULL(IF(replace(trim(S.ue4_rotation),'[]','')='',NULL,S.ue4_location)),0,1)
WHEN ISNULL(W.id) = 0 then IF(ISNULL(IF(replace(trim(W.ue4_rotation),'[]','')='',NULL,W.ue4_rotation))
AND ISNULL(IF(replace(trim(W.ue4_rotation),'[]','')='',NULL,W.ue4_location)),0,1)
END as is_bind,
CASE
WHEN ISNULL(C.id) = 0 then 'fireCar'
WHEN ISNULL(E.id) = 0 then 'fireEquipment'
......@@ -75,29 +91,29 @@
WHEN ISNULL(W.id) = 0 AND W.type = 2 then 'pool'
END as type,
CASE
WHEN ISNULL(C.name) = 0 then C.name
WHEN ISNULL(E.name) = 0 then E.name
WHEN ISNULL(S.name) = 0 then S.name
WHEN ISNULL(W.name) = 0 then W.name
WHEN ISNULL(C.id) = 0 then C.name
WHEN ISNULL(E.id) = 0 then E.name
WHEN ISNULL(S.id) = 0 then S.name
WHEN ISNULL(W.id) = 0 then W.name
END as name,
CASE
WHEN ISNULL(C.name) = 0 then C.car_num
WHEN ISNULL(E.name) = 0 then E.code
WHEN ISNULL(S.name) = 0 then S.code
WHEN ISNULL(W.name) = 0 then W.code
WHEN ISNULL(C.id) = 0 then C.car_num
WHEN ISNULL(E.id) = 0 then E.code
WHEN ISNULL(S.id) = 0 then S.code
WHEN ISNULL(W.id) = 0 then W.code
END as code,
CASE
WHEN ISNULL(C.name) = 0 then C.ue4_location
WHEN ISNULL(E.name) = 0 then E.ue4_location
WHEN ISNULL(S.name) = 0 then S.ue4_location
WHEN ISNULL(W.name) = 0 then W.ue4_location
WHEN ISNULL(C.id) = 0 then C.ue4_location
WHEN ISNULL(E.id) = 0 then E.ue4_location
WHEN ISNULL(S.id) = 0 then S.ue4_location
WHEN ISNULL(W.id) = 0 then W.ue4_location
END as ue4_location,
CASE
WHEN ISNULL(C.name) = 0 then C.ue4_rotation
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,
WHEN ISNULL(C.id) = 0 then C.ue4_rotation
WHEN ISNULL(E.id) = 0 then E.ue4_rotation
WHEN ISNULL(S.id) = 0 then S.ue4_rotation
WHEN ISNULL(W.id) = 0 then W.ue4_rotation
END as ue4_rotation,
0 as is_region
from f_risk_source R
left join f_fire_car C on C.risk_source_id = R.id
......@@ -181,7 +197,17 @@
</select>
<select id="getSafetyIndexWeek" resultType="java.util.HashMap">
<![CDATA[
SELECT temp1.*,S.safety_index as value
FROM (
SELECT @s :=@s + 1 as `index`, DATE(DATE_SUB(CURRENT_DATE, INTERVAL @s DAY)) AS date
FROM mysql.help_topic,(SELECT @s := 0) temp
WHERE @s < 7
) temp1
left join f_safety_index_change_log S on s.collect_date = temp1.date
WHERE S.org_code = #{orgCode}
ORDER BY temp1.date
]]>
</select>
<select id="countUpperRiskPoint" resultType="long">
......
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