Merge remote-tracking branch 'origin/breach-zhy'

master
xs 1 month ago
commit 3e0a38416f

@ -63,8 +63,8 @@ public interface RemoteTdEngineService {
@PostMapping("/tdengine/getDeviceStatusList")
R<List<Map<String, Object>>> getDeviceStatusList(@Validated @RequestBody DeviceStatus queryDeviceStatus, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
@PostMapping("/tdengine/getDeviceLocation")
R<Map<String,Object>> getDeviceLocation(@Validated @RequestBody TdSelectDto tdSelectDto, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
@PostMapping("/tdengine/dropTable")
R<?> dropTable(@Validated @RequestBody TdTableDropVo tdTableDropVo, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
}

@ -102,6 +102,11 @@ public class RemoteTdEngineFallbackFactory implements FallbackFactory<RemoteTdEn
return R.fail("获取设备状态信息失败:" + throwable.getMessage());
}
@Override
public R<Map<String, Object>> getDeviceLocation(TdSelectDto tdSelectDto, String source) {
return R.fail("获取设备位置失败:" + throwable.getMessage());
}
@Override
public R<?> dropTable(TdTableDropVo tdTableDropVo, String source) {
return R.fail("drop子表失败:" + throwable.getMessage());

@ -2,17 +2,29 @@ package com.ruoyi.basic.controller;
import com.baomidou.dynamic.datasource.DynamicRoutingDataSource;
import com.baomidou.dynamic.datasource.creator.DataSourceCreator;
import com.baomidou.dynamic.datasource.creator.DruidDataSourceCreator;
import com.baomidou.dynamic.datasource.spring.boot.autoconfigure.DataSourceProperty;
import com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.ruoyi.basic.domain.HwTemplate;
import com.ruoyi.basic.domain.LayoutConfig;
import com.ruoyi.basic.domain.LayoutDesc;
import com.ruoyi.basic.service.HwTemplateService;
import com.ruoyi.basic.service.LayoutConfigService;
import com.ruoyi.basic.service.LayoutDescService;
import com.ruoyi.common.core.web.domain.AjaxResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.sql.DataSource;
import java.util.List;
import java.util.Map;
@ -30,6 +42,10 @@ public class LayoutConfigController {
*/
@Resource
private LayoutConfigService layoutConfigService;
@Autowired
private LayoutDescService layoutDescService;
@Autowired
private HwTemplateService hwTemplateService;
/**
*
@ -89,10 +105,10 @@ public class LayoutConfigController {
// 添加组件新配置
@PostMapping("/insertLayoutConfig")
public AjaxResult insertLayoutConfig(@RequestBody Map<String,Object> config) throws JsonProcessingException {
System.out.println(config.get("items"));
List<Object> items = (List<Object>)config.get("items");
String option = config.get("option").toString();
return layoutConfigService.insertSceneConfig(items,option);
String layoutName = config.get("layoutDesc").toString();
return layoutConfigService.insertSceneConfig(items,option,layoutName);
}
// 查询所有场景
@ -106,5 +122,4 @@ public class LayoutConfigController {
public AjaxResult selectConfigById(String sceneId){
return layoutConfigService.selectConfigById(sceneId);
}
}

@ -4,6 +4,7 @@ package com.ruoyi.basic.mapper;
import com.ruoyi.basic.domain.LayoutDesc;
import java.util.List;
import java.util.Map;
/**
* (LayoutConfig)访
@ -18,4 +19,7 @@ public interface LayoutDescDao {
List<LayoutDesc> selectAllScenes();
LayoutDesc queryById();
}

@ -57,10 +57,11 @@ public interface LayoutConfigService {
*/
boolean deleteById(Long configId);
AjaxResult insertSceneConfig(List<Object> items, String option) throws JsonProcessingException;
AjaxResult insertSceneConfig(List<Object> items, String option,String layoutName) throws JsonProcessingException;
AjaxResult selectConfigById(String sceneId);
AjaxResult selectAllScenes();
}

@ -20,10 +20,7 @@ import org.springframework.data.domain.PageRequest;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.UUID;
import java.util.*;
/**
* (LayoutConfig)
@ -99,12 +96,13 @@ public class LayoutConfigServiceImpl implements LayoutConfigService {
}
@Override
public AjaxResult insertSceneConfig(List<Object> items, String option) throws JsonProcessingException {
public AjaxResult insertSceneConfig(List<Object> items, String option,String layoutName) throws JsonProcessingException {
String layoutId = UUID.randomUUID().toString().replaceAll("-", "");
LoginUser loginUser = SecurityUtils.getLoginUser();
LayoutDesc layoutDesc = new LayoutDesc();
layoutDesc.setLayoutId(layoutId);
layoutDesc.setSceneConfig(option);
layoutDesc.setLayoutDesc(layoutName);
// layoutDesc.setCreateBy(loginUser.getUsername());
Date date = new Date();
layoutDesc.setCreateTime(date);

@ -27,7 +27,7 @@ public class LayoutDescServiceImpl implements LayoutDescService {
@Override
public LayoutDesc queryById(Long layoutId) {
return null;
return layoutDescDao.queryById();
}
@Override

@ -13,11 +13,8 @@
</resultMap>
<!--查询单个-->
<select id="queryById" resultMap="LayoutDescMap">
select
layout_id, layout_desc, create_by, create_time, update_by, update_time
from layout_desc
where layout_id = #{layoutId}
<select id="queryById" resultType="com.ruoyi.basic.domain.LayoutDesc">
</select>
<!--查询指定行数据-->
@ -76,6 +73,9 @@
<select id="selectAllScenes" resultType="com.ruoyi.basic.domain.LayoutDesc">
select * from layout_desc
</select>
<select id="test" resultType="java.util.Map">
select * from base_line_loss
</select>
<!--新增所有列-->
<insert id="insert" keyProperty="layoutId" useGeneratedKeys="true">

@ -6,6 +6,7 @@ import java.util.Map;
import com.ruoyi.business.domain.HwScene;
import com.ruoyi.business.domain.VO.HwSceneVo;
import com.ruoyi.business.domain.VO.TreeDeviceVo;
import org.apache.ibatis.annotations.Param;
/**
* Mapper
@ -74,4 +75,6 @@ public interface HwSceneMapper
*
* */
public List<TreeDeviceVo> selectHwSceneListReturnMap();
HwScene selectHwSceneByTenantId(@Param("tenantId") Long tenantId);
}

@ -80,6 +80,8 @@ public class HwSceneServiceImpl implements IHwSceneService {
@Override
public List<HwSceneVo> selectHwSceneJoinList(HwSceneVo hwScene) {
Long tenantId = SecurityUtils.getTenantId();
hwScene.setTenantId(tenantId);
hwScene.setSceneStatus(HwDictConstants.SCENE_STATUS_NORMAL);
return hwSceneMapper.selectHwSceneVoList(hwScene);
}

@ -207,4 +207,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectHwSceneListReturnMap" resultMap="TreeDeviceVoResult">
select scene_id as vo_id,scene_name as vo_name from hw_scene hs where scene_status = 1
</select>
<select id="selectHwSceneByTenantId" resultType="com.ruoyi.business.domain.HwScene">
SELECT x.* FROM `hwsaas-cloud`.hw_scene x where x.scene_status != 9 and x.tenant_id = #{tenantId}
</select>
</mapper>

Loading…
Cancel
Save