Commit 8a2f800e authored by 单奇雲's avatar 单奇雲

Merge

parents 595aa6ed 9b5c5017
package com.yeejoin.amos.fas.business.controller; package com.yeejoin.amos.fas.business.controller;
import com.yeejoin.amos.fas.business.service.intfc.IPlanVisual3dService; import com.yeejoin.amos.fas.business.service.intfc.IPlanVisual3dService;
import com.yeejoin.amos.fas.core.util.StringUtil;
import com.yeejoin.amos.fas.dao.entity.TextPlan; import com.yeejoin.amos.fas.dao.entity.TextPlan;
import com.yeejoin.amos.op.core.common.response.CommonResponse; import com.yeejoin.amos.op.core.common.response.CommonResponse;
import com.yeejoin.amos.op.core.util.CommonResponseUtil; import com.yeejoin.amos.op.core.util.CommonResponseUtil;
...@@ -24,11 +25,7 @@ import org.slf4j.Logger; ...@@ -24,11 +25,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -109,29 +106,41 @@ public class PlanVisual3dController extends BaseController { ...@@ -109,29 +106,41 @@ public class PlanVisual3dController extends BaseController {
return response; return response;
} }
/** /**
* 资源设备信息查询 * 资源设备查询、数据项查询
*
* @param type or type && id
* @return 资源设备 or 数据项
*/ */
@ApiOperation(httpMethod = "GET", value = "资源查询", notes = "资源查询")
@Authorization(ingore = true) @Authorization(ingore = true)
@GetMapping(value = "/resource/{type}/list") @GetMapping(value = "resource/common")
public CommonResponse getResourceList(@ApiParam(value = "资源类型", required = true) @PathVariable String type) { @ApiOperation(value = "设备、数据项查询", notes = "按照资源类型type查询设备,按照资源类型type和设备id查询数据项")
return planVisual3dService.getResourceListByType(type); public CommonResponse getResourceCommon(
@ApiParam(value = "资源类型") @RequestParam(required = false) String type,
@ApiParam(value = "主键id") @RequestParam(required = false) Long id) {
if(!StringUtil.isNotEmpty(type)){
return CommonResponseUtil.success();
}
if(StringUtil.isNotEmpty(type) && !StringUtil.isNotEmpty(id)){
return planVisual3dService.getResourceListByType(type);
}
if(StringUtil.isNotEmpty(type) && StringUtil.isNotEmpty(id)){
List<Map<String, Object>> list = planVisual3dService.getResourceById(type, id);
return CommonResponseUtil.success(list);
}
return CommonResponseUtil.success();
} }
/** /**
* 资源设备数据项查询 * 资源类型查询
* * @return list
* @param id
* @return
*/ */
@Authorization(ingore = true) @Authorization(ingore = true)
@GetMapping(value = "/{type}/detail/{id}") @ApiOperation(value = "资源类型查询",notes = "资源类型查询")
@ApiOperation(value = "数据项查询", notes = "按照分类及id查询数据项") @GetMapping(value ="resource/type/list")
public CommonResponse getResourceDetail( public CommonResponse getResourceList(){
@ApiParam(value = "资源类型", required = true) @PathVariable String type, return CommonResponseUtil.success(planVisual3dService.getResourceTypeList());
@ApiParam(value = "主键id", required = true) @PathVariable Long id) {
List<Map<String, Object>> list = planVisual3dService.getResourceById(type, id);
return CommonResponseUtil.success(list);
} }
} }
...@@ -2,6 +2,7 @@ package com.yeejoin.amos.fas.business.service.impl; ...@@ -2,6 +2,7 @@ package com.yeejoin.amos.fas.business.service.impl;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.yeejoin.amos.fas.business.constants.FasConstant; import com.yeejoin.amos.fas.business.constants.FasConstant;
import com.yeejoin.amos.fas.business.dao.mapper.DictMapper;
import com.yeejoin.amos.fas.business.dao.mapper.PlanVisual3dMapper; import com.yeejoin.amos.fas.business.dao.mapper.PlanVisual3dMapper;
import com.yeejoin.amos.fas.business.dao.repository.ITextPlanDao; import com.yeejoin.amos.fas.business.dao.repository.ITextPlanDao;
import com.yeejoin.amos.fas.business.feign.IMaasVisualServer; import com.yeejoin.amos.fas.business.feign.IMaasVisualServer;
...@@ -34,6 +35,9 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService { ...@@ -34,6 +35,9 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService {
@Autowired @Autowired
IDictService dictService; IDictService dictService;
@Autowired
private DictMapper dictMapper;
@Override @Override
public List<TreeSubjectVo> getPlanTree() { public List<TreeSubjectVo> getPlanTree() {
...@@ -174,5 +178,20 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService { ...@@ -174,5 +178,20 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService {
return list; return list;
} }
@Override
public List<Map<String, Object>> getResourceTypeList() {
Dict dict = new Dict();
dict.setDictCode(FasConstant.PLAN_SOURCE_TYPE);
List<Dict> dictList = dictMapper.getDictList(dict);
List<Map<String, Object>> list = new ArrayList<>();
list = dictList.stream().map(e->{
Map<String, Object> newMap = new HashMap<String, Object>();
newMap.put("key",e.getDictValue());
newMap.put("label",e.getDictName());
return newMap;
}).collect(Collectors.toList());
return list;
}
} }
...@@ -4,7 +4,6 @@ import com.yeejoin.amos.fas.business.vo.TreeSubjectVo; ...@@ -4,7 +4,6 @@ import com.yeejoin.amos.fas.business.vo.TreeSubjectVo;
import com.yeejoin.amos.fas.dao.entity.TextPlan; import com.yeejoin.amos.fas.dao.entity.TextPlan;
import com.yeejoin.amos.op.core.common.response.CommonResponse; import com.yeejoin.amos.op.core.common.response.CommonResponse;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -35,4 +34,6 @@ public interface IPlanVisual3dService { ...@@ -35,4 +34,6 @@ public interface IPlanVisual3dService {
CommonResponse getResourceListByType(String type); CommonResponse getResourceListByType(String type);
List<Map<String,Object>> getResourceById(String type,Long id); List<Map<String,Object>> getResourceById(String type,Long id);
List<Map<String,Object>> getResourceTypeList();
} }
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
<!--查询--> <!--查询-->
<select id="getResourceListByType" resultType="java.util.HashMap"> <select id="getResourceListByType" resultType="java.util.HashMap">
SELECT SELECT
rs.id,rs.name,rs.code rs.id as `key` ,rs.name as label,rs.code
from from
<choose> <choose>
<when test="type=='fireCar'"> <when test="type=='fireCar'">
......
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