Commit e31e2595 authored by suhuiguang's avatar suhuiguang

1.电子预案按照类型查询资源

parent 5fd83797
......@@ -43,4 +43,5 @@ public class FasConstant {
public static final String RISK_SOURCE_STATUS_NORMAL = "NORMAL";//风险点状态-正常
public static final String RISK_SOURCE_STATUS_ANOMALY = "ANOMALY";//风险点状态-正常
public static final String PLAN_SOURCE_TYPE = "plan_source_type";//预案资源类型
}
package com.yeejoin.amos.fas.business.controller;
import com.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.fas.business.service.intfc.IMaasVisualService;
import com.yeejoin.amos.fas.business.service.intfc.IPlanVisual3dService;
import com.yeejoin.amos.fas.core.util.*;
import com.yeejoin.amos.op.core.common.response.CommonResponse;
import com.yeejoin.amos.op.core.util.CommonResponseUtil;
......@@ -45,7 +45,7 @@ public class FileController extends BaseController {
private String readUrl;
@Autowired
private IMaasVisualService iMaasVisualService;
private IPlanVisual3dService iMaasVisualService;
//文件上传
@RequestMapping(value = "/uploadfile", method = RequestMethod.POST)
......
package com.yeejoin.amos.fas.business.controller;
import com.yeejoin.amos.fas.business.service.intfc.IMaasVisualService;
import com.yeejoin.amos.fas.business.dao.repository.IDictDao;
import com.yeejoin.amos.fas.business.service.intfc.IDictService;
import com.yeejoin.amos.fas.business.service.intfc.IPlanVisual3dService;
import com.yeejoin.amos.op.core.common.response.CommonResponse;
import com.yeejoin.amos.op.core.util.CommonResponseUtil;
import com.yeejoin.amos.security.authorization.Authorization;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -13,25 +17,40 @@ import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.HashMap;
import java.util.List;
@RestController
@RequestMapping(value = "/api/visual")
@Api(tags="预案可视化API")
public class MaasVisualController extends BaseController {
public class PlanVisual3dController extends BaseController {
private final Logger log = LoggerFactory.getLogger(MaasVisualController.class);
private final Logger log = LoggerFactory.getLogger(PlanVisual3dController.class);
@Autowired
private IMaasVisualService maasVisualService;
private IPlanVisual3dService planVisual3dService;
@Autowired
private IDictService dictService;
@ApiOperation(value = "预案应用树", notes = "预案应用树")
@GetMapping(value = "/plan/tree")
public CommonResponse getPlanTree() {
return CommonResponseUtil.success(maasVisualService.getPlanTree());
return CommonResponseUtil.success(planVisual3dService.getPlanTree());
}
@ApiOperation(value = "根据ID获取文字预案", notes = "根据ID获取文字预案")
@GetMapping(value = "/plan/text/{id}")
public CommonResponse getTextPlanById(@PathVariable(value = "id") Long id) {
return CommonResponseUtil.success(maasVisualService.getTextPlanInfoById(id));
return CommonResponseUtil.success(planVisual3dService.getTextPlanInfoById(id));
}
/**
* 资源设备信息查询
*/
@ApiOperation(httpMethod = "GET",value = "资源查询",notes = "资源查询")
@Authorization(ingore = true)
@RequestMapping(value="/resource/{type}/list")
public CommonResponse getResourceList(@ApiParam(value = "资源类型", required = true) @PathVariable String type){
return planVisual3dService.getResourceListByType(type);
}
}
package com.yeejoin.amos.fas.business.dao.mapper;
import javafx.application.Application;
import javafx.stage.Stage;
import org.apache.ibatis.annotations.Param;
import java.util.HashMap;
import java.util.List;
public interface PlanVisual3dMapper extends BaseMapper {
List<HashMap<String,String>> getResourceListByType(@Param("type") String type);
}
package com.yeejoin.amos.fas.business.service.impl;
import com.google.common.collect.Lists;
import com.yeejoin.amos.fas.business.constants.FasConstant;
import com.yeejoin.amos.fas.business.dao.mapper.PlanVisual3dMapper;
import com.yeejoin.amos.fas.business.dao.repository.ITextPlanDao;
import com.yeejoin.amos.fas.business.feign.IMaasVisualServer;
import com.yeejoin.amos.fas.business.service.intfc.IMaasVisualService;
import com.yeejoin.amos.fas.business.service.intfc.IDictService;
import com.yeejoin.amos.fas.business.service.intfc.IPlanVisual3dService;
import com.yeejoin.amos.fas.business.vo.TreeSubjectVo;
import com.yeejoin.amos.fas.dao.entity.Dict;
import com.yeejoin.amos.fas.dao.entity.TextPlan;
import com.yeejoin.amos.op.core.common.response.CommonResponse;
import com.yeejoin.amos.op.core.util.CommonResponseUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
@Service("maasVisualService")
public class MaasVisualServiceImpl implements IMaasVisualService {
@Service("planVisual3dService")
public class PlanVisual3dServiceImpl implements IPlanVisual3dService {
@Autowired
IMaasVisualServer maasVisualServer;
......@@ -24,6 +30,12 @@ public class MaasVisualServiceImpl implements IMaasVisualService {
@Autowired
ITextPlanDao iTextPlanDao;
@Autowired
PlanVisual3dMapper planVisual3dMapper;
@Autowired
IDictService dictService;
@Override
public List<TreeSubjectVo> getPlanTree() {
......@@ -115,4 +127,18 @@ public class MaasVisualServiceImpl implements IMaasVisualService {
return treeSubjectVos;
}
@Override
public CommonResponse getResourceListByType(String type) {
//1.校验是否是约定的字典,不存在则提示失败
Dict dict = new Dict();
dict.setDictCode(FasConstant.PLAN_SOURCE_TYPE);
dict.setDictValue(type);
List<Dict> dictList = dictService.getDictList(dict);
if(CollectionUtils.isEmpty(dictList)){
return CommonResponseUtil.failure(type + "字典类型不存在");
}
//2.返回存在的数据
return CommonResponseUtil.success(planVisual3dMapper.getResourceListByType(type));
}
}
......@@ -2,11 +2,13 @@ package com.yeejoin.amos.fas.business.service.intfc;
import com.yeejoin.amos.fas.business.vo.TreeSubjectVo;
import com.yeejoin.amos.fas.dao.entity.TextPlan;
import com.yeejoin.amos.op.core.common.response.CommonResponse;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public interface IMaasVisualService {
public interface IPlanVisual3dService {
/**
* 获取预案树
......@@ -29,4 +31,6 @@ public interface IMaasVisualService {
* @return
*/
TextPlan getTextPlanInfoById(Long id);
CommonResponse getResourceListByType(String type);
}
<?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yeejoin.amos.fas.business.dao.mapper.PlanVisual3dMapper">
<!--查询-->
<select id="getResourceListByType" resultType="java.util.HashMap">
SELECT
rs.id,rs.name,rs.code
from
<choose>
<when test="type=='fireCar'">
(SELECT a.id,a.name,a.car_num as code FROM `f_fire_car` a) as rs
</when>
<when test="type=='monitorEquipment'">
(select a.id,a.name,a.code from f_fire_equipment a where a.equip_classify = 0) as rs
</when>
<when test="type=='fireConsumables'">
(select a.id,a.name,a.code from f_fire_equipment a where a.equip_classify = 1) as rs
</when>
<when test="type=='video'">
(select a.id,a.name,a.code from f_fire_equipment a where a.equip_classify = 2) as rs
</when>
<when test="type=='fireEquipment'">
(select a.id,a.name,a.code from f_fire_equipment a where a.equip_classify = 3) as rs
</when>
<when test="type=='impEquipment'">
(select a.id,a.`name`,a.`code` from f_equipment a) as rs
</when>
<when test="type=='fireStrength'">
(select a.id,a.`name`,a.`code` from f_equipment a) as rs
</when>
<when test="type=='fireChamber'">
(select a.id,a.`name`,a.`code` from f_fire_station a where a.type = '1') as rs
</when>
<when test="type=='fireFoamRoom'">
(select a.id,a.`name`,a.`code` from f_fire_station a where a.type = '2') as rs
</when>
<when test="type=='hydrant'">
(SELECT a.id,a.`name`,a.code FROM `f_water_resource` a where a.type = '1') as rs
</when>
<when test="type=='pool'">
(SELECT a.id,a.`name`,a.code FROM `f_water_resource` a where a.type = '2') as rs
</when>
</choose>
</select>
</mapper>
\ No newline at end of file
......@@ -25,8 +25,9 @@
select fd.dict_name, fd.dict_value, fd.dict_code, fd.id, fd.parent_id, fd.remark, fd.dict_order from f_dict fd
<where>
<if test="dictName != null">fd.dict_name like concat('%', #{dict.dictName}, '%')</if>
<if test="dictCode != null">fd.dict_code = #{dictCode}</if>
<if test="parentId != null and parentId > 0 ">fd.parent_id = #{parentId}</if>
<if test="dictCode != null"> and fd.dict_code = #{dictCode}</if>
<if test="dictValue !=null">and fd.dict_value = #{dictValue}</if>
<if test="parentId != null and parentId > 0 ">and fd.parent_id = #{parentId}</if>
</where>
</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