Commit 43dfdf86 authored by tangwei's avatar tangwei

解决冲突

parents 0904fe2a 846accb8
...@@ -42,6 +42,11 @@ ...@@ -42,6 +42,11 @@
<version>1.8.5-SNAPSHOT</version> <version>1.8.5-SNAPSHOT</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<dependency>
<groupId>com.taosdata.jdbc</groupId>
<artifactId>taos-jdbcdriver</artifactId>
<version>3.2.4</version>
</dependency>
</dependencies> </dependencies>
<build> <build>
......
...@@ -45,7 +45,7 @@ import java.net.InetAddress; ...@@ -45,7 +45,7 @@ import java.net.InetAddress;
@EnableScheduling @EnableScheduling
@MapperScan({ "org.typroject.tyboot.demo.face.orm.dao*", "org.typroject.tyboot.face.*.orm.dao*", @MapperScan({ "org.typroject.tyboot.demo.face.orm.dao*", "org.typroject.tyboot.face.*.orm.dao*",
"org.typroject.tyboot.core.auth.face.orm.dao*", "org.typroject.tyboot.component.*.face.orm.dao*", "org.typroject.tyboot.core.auth.face.orm.dao*", "org.typroject.tyboot.component.*.face.orm.dao*",
"com.yeejoin.amos.boot.module.**.api.mapper", "com.yeejoin.amos.boot.biz.common.dao.mapper","com.yeejoin.amos.boot.module.common.biz.*","com.yeejoin.amos.boot.module.jxiop.api.mapper" }) "com.yeejoin.amos.boot.module.**.api.mapper", "com.yeejoin.amos.boot.biz.common.dao.mapper","com.yeejoin.amos.boot.module.common.biz.*","com.yeejoin.amos.boot.module.jxiop.api.mapper","com.yeejoin.amos.boot.module.jxiop.biz.tdmapper" })
@ComponentScan(basePackages = { "org.typroject", "com.yeejoin.amos" }) @ComponentScan(basePackages = { "org.typroject", "com.yeejoin.amos" })
@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class, DruidDataSourceAutoConfigure.class}) @SpringBootApplication(exclude = {DataSourceAutoConfiguration.class, DruidDataSourceAutoConfigure.class})
//@SpringBootApplication //@SpringBootApplication
......
...@@ -40,7 +40,7 @@ public class ESEquipments { ...@@ -40,7 +40,7 @@ public class ESEquipments {
@Field(type = FieldType.Text, index = false) @Field(type = FieldType.Text, index = false)
private String value; private String value;
@Field(type = FieldType.Double, index = false) @Field(type = FieldType.Double, index = false)
private Double valueDouble; private Double valueF;
@Field(type = FieldType.Text , index = false) @Field(type = FieldType.Text , index = false)
private String valueLabel; private String valueLabel;
@Field(type = FieldType.Text , index = false) @Field(type = FieldType.Text , index = false)
...@@ -59,9 +59,9 @@ public class ESEquipments { ...@@ -59,9 +59,9 @@ public class ESEquipments {
private String displayName; private String displayName;
public ESEquipments(Double valueDouble,String id, String address, String dataType, String equipmentSpecificName, String gatewayId, String isAlarm, Date createdTime, String unit, String value, String valueLabel, String traceId, String equipmentIndexName, String equipmentNumber, String frontModule, String systemType, String pictureName, String displayName) { public ESEquipments(Double valueF, String id, String address, String dataType, String equipmentSpecificName, String gatewayId, String isAlarm, Date createdTime, String unit, String value, String valueLabel, String traceId, String equipmentIndexName, String equipmentNumber, String frontModule, String systemType, String pictureName, String displayName) {
this.valueDouble = valueDouble; this.valueF = valueF;
this.id = id; this.id = id;
this.address = address; this.address = address;
this.dataType = dataType; this.dataType = dataType;
......
package com.yeejoin.amos.config; package com.yeejoin.amos.boot.module.jxiop.biz.config;
import com.alibaba.druid.pool.DruidDataSource; import com.alibaba.druid.pool.DruidDataSource;
...@@ -21,7 +21,7 @@ import javax.sql.DataSource; ...@@ -21,7 +21,7 @@ import javax.sql.DataSource;
* 若需要配置更多数据源 , 直接在yml中添加数据源配置再增加相应的新的数据源配置类即可 * 若需要配置更多数据源 , 直接在yml中添加数据源配置再增加相应的新的数据源配置类即可
*/ */
@Configuration @Configuration
@MapperScan(basePackages = "com.yeejoin.amos.api.householdapi.face.orm.mapper.tdengine", sqlSessionFactoryRef = "taosSqlSessionFactory") @MapperScan(basePackages = "com.yeejoin.amos.boot.module.jxiop.biz.tdmapper", sqlSessionFactoryRef = "taosSqlSessionFactory")
public class TdEngineConfig { public class TdEngineConfig {
private Logger logger = LoggerFactory.getLogger(TdEngineConfig.class); private Logger logger = LoggerFactory.getLogger(TdEngineConfig.class);
// 精确到 cluster 目录,以便跟其他数据源隔离 // 精确到 cluster 目录,以便跟其他数据源隔离
...@@ -64,7 +64,7 @@ public class TdEngineConfig { ...@@ -64,7 +64,7 @@ public class TdEngineConfig {
sessionFactory.setDataSource(culsterDataSource); sessionFactory.setDataSource(culsterDataSource);
sessionFactory.setMapperLocations(new PathMatchingResourcePatternResolver() sessionFactory.setMapperLocations(new PathMatchingResourcePatternResolver()
.getResources(TdEngineConfig.MAPPER_LOCATION)); .getResources(TdEngineConfig.MAPPER_LOCATION));
sessionFactory.setTypeAliasesPackage("com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.tdeingine"); sessionFactory.setTypeAliasesPackage("com.yeejoin.amos.boot.module.jxiop.biz.entity");
//mybatis 数据库字段与实体类属性驼峰映射配置 //mybatis 数据库字段与实体类属性驼峰映射配置
sessionFactory.getObject().getConfiguration().setMapUnderscoreToCamelCase(true); sessionFactory.getObject().getConfiguration().setMapUnderscoreToCamelCase(true);
return sessionFactory.getObject(); return sessionFactory.getObject();
......
...@@ -15,6 +15,7 @@ import org.typroject.tyboot.core.restful.utils.ResponseModel; ...@@ -15,6 +15,7 @@ import org.typroject.tyboot.core.restful.utils.ResponseModel;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* *
...@@ -112,4 +113,21 @@ public class IdxBizFanPointTagController extends BaseController { ...@@ -112,4 +113,21 @@ public class IdxBizFanPointTagController extends BaseController {
public ResponseModel<List<IdxBizFanPointTagDto>> selectForList() { public ResponseModel<List<IdxBizFanPointTagDto>> selectForList() {
return ResponseHelper.buildResponse(idxBizFanPointTagServiceImpl.queryForIdxBizFanPointTagList()); return ResponseHelper.buildResponse(idxBizFanPointTagServiceImpl.queryForIdxBizFanPointTagList());
} }
/**
* 列表全部数据查询
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@ApiOperation(httpMethod = "GET",value = "筛选条件级联查询", notes = "筛选条件级联查询")
@GetMapping(value = "/params")
public ResponseModel<List<Map<String,Object>> > selectForListByParams(@RequestParam Map<String, Object> map) {
return ResponseHelper.buildResponse(idxBizFanPointTagServiceImpl.selectForListByParams(map));
}
} }
package com.yeejoin.amos.boot.module.jxiop.biz.controller;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.IndicatorData;
import com.yeejoin.amos.boot.module.jxiop.biz.tdmapper.IndicatorDataMapper;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import java.util.List;
@RestController
@RequestMapping(value = "/test")
@Api(tags = "测试Api")
public class TestController extends BaseController {
@Autowired
IndicatorDataMapper indicatorDataMapper;
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@ApiOperation(httpMethod = "GET", value = "test1", notes = "test1")
@GetMapping("/test1")
public List<IndicatorData> test1(@RequestParam(value = "startTime") String startTime, @RequestParam(value = "endTime") String endTime, @RequestParam(value = "address") String address, @RequestParam(value = "gatewayId") String gatewayId) {
List<IndicatorData> indicatorData = indicatorDataMapper.selectDataByAddressAndtime(address, startTime, endTime,gatewayId);
return indicatorData;
}
}
...@@ -8,6 +8,7 @@ import lombok.EqualsAndHashCode; ...@@ -8,6 +8,7 @@ import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.Date;
/** /**
* *
...@@ -39,7 +40,7 @@ public class IdxBizFanPointTag{ ...@@ -39,7 +40,7 @@ public class IdxBizFanPointTag{
* *
*/ */
@TableField("REC_DATE") @TableField("REC_DATE")
private LocalDateTime recDate; private Date recDate;
/** /**
* *
......
package com.yeejoin.amos.boot.module.jxiop.biz.entity;
import lombok.Data;
import java.sql.Timestamp;
@Data
public class IndicatorData {
private Timestamp createdTime;
private String id;
private String address;
private String gatewayId;
private String dataType;
private Long isAlarm;
private String unit;
private String equipmentIndexName;
private String equipmentSpecificName;
private String value;
private Float valueF;
private String valueLabel;
private String equipmentNumber;
private String displayName;
}
package com.yeejoin.amos.boot.module.jxiop.biz.service.impl; package com.yeejoin.amos.boot.module.jxiop.biz.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.jxiop.biz.dto.IdxBizFanPointTagDto; import com.yeejoin.amos.boot.module.jxiop.biz.dto.IdxBizFanPointTagDto;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizFanPointTag; import com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizFanPointTag;
import com.yeejoin.amos.boot.module.jxiop.biz.mapper2.IdxBizFanPointTagMapper; import com.yeejoin.amos.boot.module.jxiop.biz.mapper2.IdxBizFanPointTagMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.service.IIdxBizFanPointTagService; import com.yeejoin.amos.boot.module.jxiop.biz.service.IIdxBizFanPointTagService;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
import org.typroject.tyboot.core.rdbms.service.BaseService; import org.typroject.tyboot.core.rdbms.service.BaseService;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/** /**
* 服务实现类 * 服务实现类
...@@ -21,14 +27,52 @@ public class IdxBizFanPointTagServiceImpl extends BaseService<IdxBizFanPointTagD ...@@ -21,14 +27,52 @@ public class IdxBizFanPointTagServiceImpl extends BaseService<IdxBizFanPointTagD
/** /**
* 分页查询 * 分页查询
*/ */
public Page<IdxBizFanPointTagDto> queryForIdxBizFanPointTagPage(Page<IdxBizFanPointTagDto> page) { public Page<IdxBizFanPointTagDto> queryForIdxBizFanPointTagPage(Page<IdxBizFanPointTagDto> page) {
return this.queryForPage(page, null, false); return this.queryForPage(page, null, false);
} }
/** /**
* 列表查询 示例 * 列表查询 示例
*/ */
public List<IdxBizFanPointTagDto> queryForIdxBizFanPointTagList() { public List<IdxBizFanPointTagDto> queryForIdxBizFanPointTagList() {
return this.queryForList("" , false); return this.queryForList("", false);
}
public List<Map<String,Object>> selectForListByParams(Map<String, Object> map) {
LambdaQueryWrapper<IdxBizFanPointTag> queryWrapper = new LambdaQueryWrapper<>();
List<Map<String,Object>> result = new ArrayList<>();
if (ObjectUtils.isEmpty(map)) {
queryWrapper.groupBy(IdxBizFanPointTag::getArae);
List<IdxBizFanPointTag> idxBizFanPointTags = this.getBaseMapper().selectList(queryWrapper);
for (IdxBizFanPointTag idxBizFanPointTag : idxBizFanPointTags) {
Map<String,Object> maps = new HashMap<>();
map.put("value",idxBizFanPointTag.getArae());
result.add(map);
}
} else if (map.containsKey("ARAE") && !map.containsKey("STATION")) {
queryWrapper.eq(IdxBizFanPointTag::getArae, map.get("ARAE"));
queryWrapper.groupBy(IdxBizFanPointTag::getStation);
List<IdxBizFanPointTag> idxBizFanPointTags = this.getBaseMapper().selectList(queryWrapper);
for (IdxBizFanPointTag idxBizFanPointTag : idxBizFanPointTags) {
Map<String,Object> maps = new HashMap<>();
map.put("value",idxBizFanPointTag.getStation());
result.add(map);
}
} else if (map.containsKey("STATION")) {
queryWrapper.eq(IdxBizFanPointTag::getArae, map.get("ARAE"));
queryWrapper.eq(IdxBizFanPointTag::getStation, map.get("STATION"));
queryWrapper.groupBy(IdxBizFanPointTag::getNumber);
List<IdxBizFanPointTag> idxBizFanPointTags = this.getBaseMapper().selectList(queryWrapper);
for (IdxBizFanPointTag idxBizFanPointTag : idxBizFanPointTags) {
Map<String,Object> maps = new HashMap<>();
map.put("value",idxBizFanPointTag.getNumber());
result.add(map);
}
}
return result;
} }
} }
\ No newline at end of file
package com.yeejoin.amos.boot.module.jxiop.biz.tdmapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.IndicatorData;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository
public interface IndicatorDataMapper extends BaseMapper<IndicatorData> {
@Select("select `value` from iot_data.indicator_data where address=#{address} and createdtime >= #{startTime} and createdtime <= #{endTime} and gateway_id =#{gatewayId}")
List<IndicatorData> selectDataByAddressAndtime(@Param("address")String address,@Param("startTime") String startTime, @Param("endTime")String endTime, @Param("gatewayId")String gatewayId);
}
...@@ -53,16 +53,28 @@ lettuce.timeout=10000 ...@@ -53,16 +53,28 @@ lettuce.timeout=10000
emqx.clean-session=true emqx.clean-session=true
emqx.client-id=${spring.application.name}-${random.int[1024,65536]} emqx.client-id=${spring.application.name}-${random.int[1024,65536]}
emqx.broker=tcp://172.16.10.220:1883 emqx.broker=tcp://172.16.10.253:1883
emqx.user-name=admin emqx.user-name=admin
emqx.password=public emqx.password=public
mqtt.scene.host=mqtt://172.16.10.220:8083/mqtt mqtt.scene.host=mqtt://172.16.10.253:8083/mqtt
mqtt.client.product.id=mqtt mqtt.client.product.id=mqtt
mqtt.topic=topic_mqtt mqtt.topic=topic_mqtt
spring.mqtt.completionTimeout=3000 spring.mqtt.completionTimeout=3000
emqx.max-inflight=1000 emqx.max-inflight=1000
tdengine-server:
driver-class-name: com.taosdata.jdbc.rs.RestfulDriver
jdbc-url: jdbc:TAOS-RS://139.9.170.47:6041/iot_data_1?user=root&password=taosdata&timezone=GMT%2b8&allowMultiQueries=true
username: root
password: taosdata
#spring.db3.datasource.type: com.alibaba.druid.pool.DruidDataSource
spring.db3.datasource.url=jdbc:TAOS-RS://139.9.170.47:6041/iot_data?user=root&password=taosdata&timezone=GMT%2b8&allowMultiQueries=true
spring.db3.datasource.username=root
spring.db3.datasource.password=taosdata
spring.db3.datasource.driver-class-name: com.taosdata.jdbc.rs.RestfulDriver
## influxDB ## influxDB
#spring.influx.url= http://172.16.3.155:18186 #spring.influx.url= http://172.16.3.155:18186
#spring.influx.password=Yeejoin@2020 #spring.influx.password=Yeejoin@2020
......
<?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.boot.module.jxiop.biz.tdmapper.IndicatorDataMapper">
</mapper>
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