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

1.新增等级查询接口,2.调试接口

parent 95ff9119
......@@ -105,4 +105,17 @@ public enum PlanTaskDetailStatusEnum {
public void setType(String type) {
this.type = type;
}
public static List<Map<String,String>> getErrorLevelEnumList() {
List<Map<String,String>> nameList = new ArrayList<>();
for (PlanTaskDetailStatusEnum c: PlanTaskDetailStatusEnum.values()) {
if(!c.getName().equals("合格")) {
Map<String, String> map = new HashMap<String, String>();
map.put("name", c.getName());
map.put("level", c.getType() +"");
nameList.add(map);
}
}
return nameList;
}
}
package com.yeejoin.amos.fas.common.enums;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public enum RiskSourceLevelEum {
level_1("1","1级"),
level_2("2","2级"),
level_3("3","3级"),
level_4("4","4级"),
level_5("5","5级");
private String level;
private String name;
RiskSourceLevelEum(String level, String name) {
this.level = level;
this.name = name;
}
public String getLevel() {
return level;
}
public void setLevel(String level) {
this.level = level;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public static List<Map<String,String>> getLevelEnumList() {
List<Map<String,String>> nameList = new ArrayList<>();
for (RiskSourceLevelEum c: RiskSourceLevelEum.values()) {
Map<String, String> map = new HashMap<String, String>();
map.put("name", c.getName());
map.put("level", c.getLevel());
nameList.add(map);
}
return nameList;
}
}
package com.yeejoin.amos.fas.common.enums;
public enum RiskSourceRegionEum {
TRUE("TRUE"),
FALSE("FALSE");
private String code;
private RiskSourceRegionEum(String code) {
this.code = code;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
}
......@@ -103,7 +103,7 @@ public class View3dController extends BaseController {
ReginParams reginParams =getSelectedOrgInfo();
String orgCode = this.getOrgCode(reginParams);
//TODO:待删除
orgCode = "1*2";
orgCode = "1";
return CommonResponseUtil.success(view3dService.getPointDetailByTypeAndId(type,pointId,orgCode));
}
......@@ -177,6 +177,7 @@ public class View3dController extends BaseController {
public CommonResponse getExceptionRegion(){
ReginParams reginParams =getSelectedOrgInfo();
String orgCode = this.getOrgCode(reginParams);
orgCode = "1*2";
List<ExceptionRegionVo> exceptionRegionVoList = view3dService.getExceptionRegion(orgCode);
return CommonResponseUtil.success(exceptionRegionVoList);
}
......@@ -191,12 +192,12 @@ public class View3dController extends BaseController {
@ApiOperation(value = "资源显示",notes = "资源显示")
@GetMapping(value = "initViewNode")
public CommonResponse initViewNode(String type){
public CommonResponse initViewNode(String type,Long riskSourceId){
ReginParams reginParams =getSelectedOrgInfo();
String orgCode = this.getOrgCode(reginParams);
//TODO:待删除
orgCode = "1*2";
return CommonResponseUtil.success(view3dService.initViewErrorNode(type,orgCode));
return CommonResponseUtil.success(view3dService.initViewErrorNode(type,riskSourceId,orgCode));
}
@ApiOperation(value = "按照点类型查询点列表",notes = "按照点类型查询点列表")
......@@ -229,11 +230,13 @@ public class View3dController extends BaseController {
@GetMapping(value = "/init3dViewNode", produces = "application/json;charset=UTF-8")
@ApiOperation(value = "初始化三维视图节点", notes = "初始化三维视图节点")
public CommonResponse init3dViewNode(
@ApiParam(value = "节点类型", required = false) @RequestParam(required = false) String type) {
if (StringUtil.isNotEmpty(type)) {
return CommonResponseUtil.success(view3dService.find3dViewDataByType(type));
}
return CommonResponseUtil.failure();
@ApiParam(value = "节点类型", required = false) @RequestParam(required = false) String type,
@ApiParam(value = "区域ID", required = false) @RequestParam(required = false) Long riskSourceId) {
ReginParams reginParams =getSelectedOrgInfo();
String orgCode = this.getOrgCode(reginParams);
//TODO:待删除
orgCode = "1*2";
return CommonResponseUtil.success(view3dService.find3dViewDataByType(type,riskSourceId,orgCode));
}
@GetMapping(value = "/retrieve/all",produces = "application/json;charset=UTF-8")
......@@ -249,5 +252,11 @@ public class View3dController extends BaseController {
orgCode = "1*2";
return view3dService.retrieveAll(type,inputText,current,pageSize,orgCode);
}
@ApiOperation(value = "等级查询",notes = "等级查询")
@GetMapping(value = "point/level")
public CommonResponse pointLevel(@ApiParam(value = "点类型") @RequestParam String type){
return CommonResponseUtil.success(view3dService.pointLevelList(type));
}
}
......@@ -110,11 +110,12 @@ public interface View3dMapper extends BaseMapper{
* 异常点
* @param type
* @param orgCode
* @param riskSourceId 区域id
* @return
*/
List<View3dNodeVo> initViewErrorNode(String type, String orgCode);
List<View3dNodeVo> initViewErrorNode(String type,Long riskSourceId, String orgCode);
List<Node3DVoResponse> findViewDataByType(String type);
List<Node3DVoResponse> findViewDataByType(String type,Long riskSourceId,String orgCode);
Long retrieveAllCount(String type, String inputText,String orgCode);
......
......@@ -37,4 +37,6 @@ public interface IRiskSourceDao extends BaseDao<RiskSource, Long> {
Optional<RiskSource> findByOrgCodeAndParentId(String orgCode, Long parentId);
List<RiskSource> findByParentIdAndIsRegion(long id, String string);
}
......@@ -32,6 +32,7 @@ import com.yeejoin.amos.fas.business.bo.RiskPointRpnChangeBo;
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.RiskSourceMapper;
import com.yeejoin.amos.fas.business.dao.mapper.View3dMapper;
import com.yeejoin.amos.fas.business.dao.repository.*;
import com.yeejoin.amos.fas.business.feign.IDutyModeServer;
......@@ -103,8 +104,6 @@ public class View3dServiceImpl implements IView3dService {
@Autowired
private IDataRefreshService iDataRefreshService;
@Override
@Transactional(rollbackFor = Exception.class)
public CommonResponse setPoint3dPosition(List<BindPointBo> pointBoList) {
......@@ -396,7 +395,7 @@ public class View3dServiceImpl implements IView3dService {
Optional<RiskSource> optional = iRiskSourceDao.findByOrgCodeAndParentId(orgCode,0L);
List<ExceptionRegionVo> exceptionList = new ArrayList<>();
if (optional.isPresent()) {
List<RiskSource> regionList = iRiskSourceDao.findByParentId(optional.get().getId());
List<RiskSource> regionList = iRiskSourceDao.findByParentIdAndIsRegion(optional.get().getId(),RiskSourceRegionEum.TRUE.getCode());
exceptionList = regionList.stream().filter(riskSource -> {
//TODO:待毛颖确认,增加判断故障的规则(统计数据:故障或者rpn上升)
BigDecimal rpnBig = riskSource.getRpn() == null ? new BigDecimal("0") : riskSource.getRpn();
......@@ -496,8 +495,8 @@ public class View3dServiceImpl implements IView3dService {
}
@Override
public List<View3dNodeVo> initViewErrorNode(String type, String orgCode) {
return view3dMapper.initViewErrorNode(type,orgCode);
public List<View3dNodeVo> initViewErrorNode(String type,Long riskSourceId, String orgCode) {
return view3dMapper.initViewErrorNode(type,riskSourceId,orgCode);
}
@Override
......@@ -555,8 +554,8 @@ public class View3dServiceImpl implements IView3dService {
}
@Override
public List<Node3DVoResponse> find3dViewDataByType(String type) {
return view3dMapper.findViewDataByType(type);
public List<Node3DVoResponse> find3dViewDataByType(String type,Long riskSourceId,String orgCode) {
return view3dMapper.findViewDataByType(type,riskSourceId,orgCode);
}
@Override
......@@ -567,5 +566,17 @@ public class View3dServiceImpl implements IView3dService {
Page result = new PageImpl(retrieveAll,pageable,count);
return CommonResponseUtil.success(result);
}
@Override
public List<Map<String,String>> pointLevelList(String type) {
switch (type) {
case "riskSource":
return RiskSourceLevelEum.getLevelEnumList();
case "patrol":
return PlanTaskDetailStatusEnum.getErrorLevelEnumList();
default:
throw new YeeException("不支持的类型 -->"+ type);
}
}
}
......@@ -118,9 +118,10 @@ public interface IView3dService {
* 左侧菜单(异常点)
* @param type
* @param orgCode
* @param riskSourceId 风险区域
* @return
*/
List<View3dNodeVo> initViewErrorNode(String type, String orgCode);
List<View3dNodeVo> initViewErrorNode(String type,Long riskSourceId, String orgCode);
/**
* 查询类型的点
* @param orgCode 机构
......@@ -134,9 +135,32 @@ public interface IView3dService {
* @param runData 日切日期
*/
void safetyIndexLogGenJob(String runData);
/**
* 3维异常点查询
* @param type
* @param orgCode
* @param riskSourceId区域id
* @return
*/
List<Node3DVoResponse> find3dViewDataByType(String type,Long riskSourceId,String orgCode);
List<Node3DVoResponse> find3dViewDataByType(String type);
/**
* 检索
* @param type类型
* @param inputText关键字
* @param current
* @param pageSize
* @param orgCode
* @return
*/
CommonResponse retrieveAll(String type, String inputText, int current, int pageSize,String orgCode);
/**
* 等级查询
* @param type
* @return
*/
List<Map<String,String>> pointLevelList(String type);
}
......@@ -17,6 +17,8 @@ public class View3dNodeVo {
private String type;
private String key;
private String[] relationKeys;
private String level;
private String levelStr;
public Long getId() {
return id;
......@@ -68,5 +70,29 @@ public class View3dNodeVo {
this.relationKeys = relationKeys.split(",");
}
}
/**
* @return the level
*/
public String getLevel() {
return level;
}
/**
* @param level the level to set
*/
public void setLevel(String level) {
this.level = level;
}
/**
* @return the levelStr
*/
public String getLevelStr() {
return levelStr;
}
/**
* @param levelStr the levelStr to set
*/
public void setLevelStr(String levelStr) {
this.levelStr = levelStr;
}
}
......@@ -117,5 +117,27 @@
END#
</sql>
</changeSet>
<changeSet author="shanqiyun" id="1588901126338-1" runOnChange="true">
<comment>f_risk_source 查询所有子节点id</comment>
<sql endDelimiter="#">
DROP FUNCTION IF EXISTS queryRiskSourceChildrenIds;
CREATE FUNCTION queryRiskSourceChildrenIds(id INT)
RETURNS VARCHAR(4000)
BEGIN
DECLARE sTemp VARCHAR(4000);
DECLARE sTempChd VARCHAR(4000);
SET sTemp='$';
SET sTempChd = CAST(id AS char);
WHILE sTempChd IS NOT NULL DO
SET sTemp= CONCAT(sTemp,',',sTempChd);
SELECT GROUP_CONCAT(r.id) INTO sTempChd FROM f_risk_source r WHERE FIND_IN_SET(parent_id,sTempChd)>0;
END WHILE;
RETURN sTemp;
END#
</sql>
</changeSet>
</databaseChangeLog>
\ No newline at end of file
......@@ -541,34 +541,47 @@
</select>
<select id="initViewErrorNode" resultType="com.yeejoin.amos.fas.business.vo.View3dNodeVo">
<choose>
<when test="type == 'riskSource'">
select
select * from (
select
R.id,R.name,R.code,R.ue4_location,R.ue4_rotation,
#{type} as type
'riskSource' as type,
rl.level,
CONCAT('level_',rl.level) as level_str,
R.id as risk_source_id
from f_risk_source R
left join f_risk_level rl on rl.id = r.risk_level_id
where is_region <![CDATA[<>]]> 'TRUE' AND status = 'ANOMALY'
AND R.org_code like CONCAT(#{orgCode},'%')
</when>
<when test="type == 'patrol'">
select
UNION ALL
select
p.id,p.name,p.point_no as code,p.ue4_location,p.ue4_rotation,
#{type} as type
'patrol' as type,
p.status as level,
CONCAT('level_',p.status) as level_str,
p.risk_source_id
from p_point p
where status in (2,3)
where status in (0,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
UNION ALL
select
distinct e.id,e.name,e.code,e.ue4_location,e.ue4_rotation,
'impEquipment' as type,
0 as level,
'level_0' as kevek_str,
e.risk_source_id
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>
) tmp
where 1=1
<if test="riskSourceId != null"></if>
AND FIND_IN_SET(tmp.risk_source_id,queryRiskSourceChildrenIds(#{riskSourceId}))
<if test="type != null">
AND tmp.type = #{type}
</if>
</select>
<select id="findViewDataByType" resultType="com.yeejoin.amos.fas.core.common.response.Node3DVoResponse">
......@@ -608,7 +621,9 @@
'{ "x": 1, "y": 1, "z": 1 }' scaleDTO,
false showInfo,
rs. CODE title,
'riskSource' type
'riskSource' type,
rs.org_code as orgCode,
rs.id as riskSourceId
FROM
f_risk_source rs
LEFT JOIN f_risk_level rl ON rl.id = rs.risk_level_id
......@@ -650,7 +665,9 @@
'{ "x": 1, "y": 1, "z": 1 }' scaleDTO,
FALSE showInfo,
CODE title,
'impEquipment' type
'impEquipment' type,
eq.org_code as orgCode,
eq.risk_source_id as riskSourceId
FROM
f_equipment eq
WHERE
......@@ -694,7 +711,9 @@
'{ "x": 1, "y": 1, "z": 1 }' scaleDTO,
FALSE showInfo,
p.point_no title,
'patrol' as type
'patrol' as type,
p.org_code as orgCode,
p.risk_source_id as riskSourceId
from
p_point p
left join f_risk_source rs on p.risk_source_id = rs.id AND rs.is_region='TRUE'
......@@ -702,7 +721,16 @@
AND p.status in ('2','3')
AND p.coordinates != '' AND p.coordinates is not null
) temp
WHERE temp.type = #{type}
WHERE 1=1
<if test="riskSourceId != null">
AND FIND_IN_SET(temp.riskSourceId,queryRiskSourceChildrenIds(#{riskSourceId}))
</if>
<if test="type != null">
AND temp.type = #{type}
</if>
<if test="orgCode != null">
AND temp.orgCode like CONCAT(#{orgCode},'%')
</if>
</select>
......
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