提交 98c1cff1 authored 作者: 刘海泉's avatar 刘海泉

commit es code

上级 330547c9
...@@ -100,6 +100,16 @@ ...@@ -100,6 +100,16 @@
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId> <artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<exclusion>
<groupId>org.elasticsearch.client</groupId>
<artifactId>elasticsearch-rest-high-level-client</artifactId>
</exclusion>
<exclusion>
<groupId>org.elasticsearch</groupId>
<artifactId>elasticsearch</artifactId>
</exclusion>
</exclusions>
</dependency> </dependency>
<dependency> <dependency>
...@@ -261,6 +271,25 @@ ...@@ -261,6 +271,25 @@
<version>1.7.0</version> <version>1.7.0</version>
</dependency> </dependency>
<dependency>
<groupId>org.elasticsearch.client</groupId>
<artifactId>elasticsearch-rest-high-level-client</artifactId>
<version>7.14.0</version>
</dependency>
<dependency>
<groupId>org.elasticsearch</groupId>
<artifactId>elasticsearch</artifactId>
<version>7.14.0</version>
</dependency>
<dependency>
<groupId>org.dromara.easy-es</groupId>
<artifactId>easy-es-boot-starter</artifactId>
<version>2.0.0-beta7</version>
</dependency>
</dependencies> </dependencies>
......
package com.clx.performance; package com.clx.performance;
import com.msl.common.config.ViewScan; import com.msl.common.config.ViewScan;
import org.dromara.easyes.starter.register.EsMapperScan;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient; import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
...@@ -18,6 +19,7 @@ import org.springframework.scheduling.annotation.EnableAsync; ...@@ -18,6 +19,7 @@ import org.springframework.scheduling.annotation.EnableAsync;
@ComponentScan({"com.clx.performance.*", "com.msl.*"}) @ComponentScan({"com.clx.performance.*", "com.msl.*"})
@EnableFeignClients(basePackages = {"com.msl.*", "com.clx.performance.*", "com.clx.order.*", "com.clx.user.*", "com.clx.message.*"}) @EnableFeignClients(basePackages = {"com.msl.*", "com.clx.performance.*", "com.clx.order.*", "com.clx.user.*", "com.clx.message.*"})
@ViewScan(basePackage = "com.clx.user.view") @ViewScan(basePackage = "com.clx.user.view")
@EsMapperScan("com.clx.performance.esplus.mapper")
public class PerformanceApplication { public class PerformanceApplication {
public static void main(String[] args) { public static void main(String[] args) {
......
package com.clx.performance.esplus.mapper;
import com.clx.performance.esplus.model.DriverTraceESPlus;
import org.dromara.easyes.core.kernel.BaseEsMapper;
public interface DriverTraceESPlusMapper extends BaseEsMapper<DriverTraceESPlus> {
}
\ No newline at end of file
package com.clx.performance.esplus.mapper;
import com.clx.performance.esplus.model.TruckTraceESPlus;
import org.dromara.easyes.core.kernel.BaseEsMapper;
public interface TruckTraceESPlusMapper extends BaseEsMapper<TruckTraceESPlus> {
}
\ No newline at end of file
package com.clx.performance.esplus.model;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.dromara.easyes.annotation.IndexField;
import org.dromara.easyes.annotation.IndexId;
import org.dromara.easyes.annotation.IndexName;
import org.dromara.easyes.annotation.rely.FieldType;
import org.dromara.easyes.annotation.rely.IdType;
import java.math.BigDecimal;
@Data
@IndexName("clx_trace_driver_trace_index1")
public class DriverTraceESPlus {
@IndexId(type= IdType.UUID)
private String id;
@ApiModelProperty("用户编号")
private Long userNo;
@ApiModelProperty("1-正常上传,2-离线上传")
private Integer dataType;
@IndexField(fieldType = FieldType.GEO_POINT)
private BigDecimal[] location; //位置
@ApiModelProperty("速度")
private BigDecimal speed;
@IndexField(fieldType = FieldType.DATE)
private String positionTime;
@IndexField(fieldType = FieldType.DATE)
private String createTime;
@IndexField(fieldType = FieldType.DATE)
private String modifiedTime;
}
\ No newline at end of file
package com.clx.performance.esplus.model;
import lombok.Data;
import org.dromara.easyes.annotation.IndexField;
import org.dromara.easyes.annotation.IndexId;
import org.dromara.easyes.annotation.IndexName;
import org.dromara.easyes.annotation.rely.FieldType;
import org.dromara.easyes.annotation.rely.IdType;
import java.math.BigDecimal;
@Data
@IndexName(value = "clx_truck_trace")
public class TruckTraceESPlus {
@IndexId(type= IdType.UUID)
private String id;
@IndexField(fieldType = FieldType.KEYWORD)
private String truckNo; //车辆编号
private BigDecimal angle; //agl
private BigDecimal speed; //速度
private BigDecimal mileage; //里程
private BigDecimal height; //海拔
private BigDecimal[] location; //位置
@IndexField(fieldType = FieldType.DATE)
private String gpsTime; //时间
private String createTime;
}
\ No newline at end of file
...@@ -572,6 +572,13 @@ public class OrderChildServiceImpl implements OrderChildService { ...@@ -572,6 +572,13 @@ public class OrderChildServiceImpl implements OrderChildService {
PerformanceResultEnum.DATA_NOT_FIND); PerformanceResultEnum.DATA_NOT_FIND);
OrderGoods orderGoods = orderGoodsDao.getByOrderGoodsNo(orderChild.getOrderGoodsNo()).orElseThrow( OrderGoods orderGoods = orderGoodsDao.getByOrderGoodsNo(orderChild.getOrderGoodsNo()).orElseThrow(
PerformanceResultEnum.DATA_NOT_FIND); PerformanceResultEnum.DATA_NOT_FIND);
BigDecimal longitude = null;
BigDecimal latitude = null;
/* if(){
}else{
}*/
double distance = GpsUtil.distance(orderGoods.getSendLongitude().doubleValue(), double distance = GpsUtil.distance(orderGoods.getSendLongitude().doubleValue(),
orderGoods.getSendLatitude().doubleValue(), param.getLongitude().doubleValue(), orderGoods.getSendLatitude().doubleValue(), param.getLongitude().doubleValue(),
param.getLatitude().doubleValue()) / 1000; param.getLatitude().doubleValue()) / 1000;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论