Commit 447bda8b authored by 郭武斌's avatar 郭武斌

*)新增elasticsearch,实现相似警情搜索

parent d1569044
......@@ -20,6 +20,11 @@ spring.redis.lettuce.pool.max-idle=10
spring.redis.lettuce.pool.min-idle=0
spring.redis.expire.time=300
#ES
spring.data.elasticsearch.cluster-name=elasticsearch
spring.data.elasticsearch.cluster-nodes=172.16.3.3:9300
spring.elasticsearch.rest.uris=http://172.16.3.3:9200
security.systemctl.name=AMOS-API-SYSTEMCTL
......
package com.yeejoin.amos.boot.module.jcs.api.entity;
import java.util.Date;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.DateFormat;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
/**
*
* <pre>
* 警情信息ES实体
* </pre>
*
* @author gwb
* @version $Id: ESAlertCalled.java, v 0.1 2021年6月19日 下午5:12:31 gwb Exp $
*/
@Data
@Accessors(chain = true)
@Document(indexName = "jcs", type = "alertCalled", shards = 1, replicas = 0)
public class ESAlertCalled {
/** 主键 */
@Id
private Long sequenceNbr;
/**
* 警情状态
*/
@ApiModelProperty(value = " 警情状态")
@Field(type = FieldType.Text, searchAnalyzer = "ik_smart", analyzer = "ik_smart")
private Boolean alertStatus;
// /**
// * 系统/人工
// */
// @Field(type = FieldType.Text, searchAnalyzer = "ik_max_word", analyzer = "ik_max_word")
// private String type;
// @Field(type = FieldType.Text, searchAnalyzer = "ik_max_word", analyzer = "ik_max_word")
// private String alertStage;
// /**
// * 报警类型
// */
// @Field(type = FieldType.Text, searchAnalyzer = "ik_max_word", analyzer = "ik_max_word")
// private String alarmType;
/**
* 响应级别字典code 为了过滤用(只有航空器故障有)
*/
@ApiModelProperty(value = "响应级别")
@Field(type = FieldType.Text)
private String responseLevelCode;
/**
* 警情阶段
*/
@ApiModelProperty(value = "警情阶段")
@Field(type = FieldType.Text)
private String alertStage;
// /**
// * 报警类型code
// */
// @Field(type = FieldType.Text, searchAnalyzer = "ik_max_word", analyzer = "ik_max_word")
// private String alarmTypeCode;
// /**
// * 通话记录信息id
// */
// @Field(type = FieldType.Text, searchAnalyzer = "ik_max_word", analyzer = "ik_max_word")
// private Integer callRecordId;
// /**
// * 父警情id
// */
// private Long fatherAlert;
/**
* 联系人姓名
*/
@ApiModelProperty(value = "联系人姓名")
@Field(type = FieldType.Text)
private String contactUser;
/**
* 联系人电话
*/
@ApiModelProperty(value = "联系人电话")
@Field(type = FieldType.Text)
private String contactPhone;
/**
* 接警时间
*/
@ApiModelProperty(value = "接警时间")
@Field(type = FieldType.Date, format = DateFormat.basic_date_time)
private Date callTime;
// /**
// * 接警时长
// */
// private Double callTimeNum;
// /**
// * 警情来源
// */
// private String alertSource;
// /**
// * 警情来源code
// */
// private String alertSourceCode;
/**
* 警情类型
*/
@ApiModelProperty(value = "警情类型")
@Field(type = FieldType.Text, searchAnalyzer = "ik_smart", analyzer = "ik_smart")
private String alertType;
// /**
// * 警情类型code
// */
// private String alertTypeCode;
/**
* 事发单位
*/
@ApiModelProperty(value = "事发单位")
@Field(type = FieldType.Text, searchAnalyzer = "ik_max_word", analyzer = "ik_max_word")
private String unitInvolved;
// /**
// * 被困人数
// */
// private Integer trappedNum;
// /**
// * 伤亡人数
// */
// private Integer casualtiesNum;
/**
* 地址
*/
@ApiModelProperty(value = "地址")
@Field(type = FieldType.Text, searchAnalyzer = "ik_max_word", analyzer = "ik_max_word")
private String address;
// /**
// * 救援方格
// */
// private String rescueGrid;
/**
* 坐标x
*/
@ApiModelProperty(value = "坐标x")
private String coordinateX;
/**
* 坐标y
*/
@ApiModelProperty(value = "坐标y")
private String coordinateY;
// /**
// * 更新时间
// */
// private Date updateTime;
// /**
// * 发送人名称
// */
// private String recUserName;
// /**
// * 接警时间开始---用于列表过滤
// */
// private Date callTimeStart ;
// /**
// * 接警时间结束---用于列表过滤
// */
// private Date callTimeEnd ;
// /**
// * 是否处警
// */
// private Boolean isFatherAlert;
}
......@@ -2,17 +2,19 @@ package com.yeejoin.amos.boot.module.jcs.biz.controller;
import com.yeejoin.amos.boot.biz.common.utils.CommonResponseUtil;
import com.yeejoin.amos.boot.module.jcs.api.entity.AlertFormValue;
import com.yeejoin.amos.boot.module.jcs.api.entity.ESAlertCalled;
import com.yeejoin.amos.boot.module.jcs.api.service.IAlertFormValueService;
import com.yeejoin.amos.boot.module.jcs.api.vo.AlertCalledFormVo;
import com.yeejoin.amos.boot.module.jcs.api.vo.AlertCalledVo;
import com.yeejoin.amos.boot.module.jcs.api.vo.FormValue;
import com.yeejoin.amos.boot.module.jcs.biz.service.impl.ESAlertCalledService;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestMapping;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.Api;
import org.apache.commons.lang3.StringUtils;
import org.springframework.web.bind.annotation.RestController;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.module.jcs.api.service.IAlertCalledService;
......@@ -27,7 +29,6 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.jcs.api.entity.AlertCalled;
import com.yeejoin.amos.boot.module.jcs.api.entity.AlertForm;
import com.yeejoin.amos.boot.biz.common.utils.NameUtils;
import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
......@@ -35,6 +36,7 @@ import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.lang.reflect.Field;
......@@ -60,6 +62,8 @@ public class AlertCalledController extends BaseController {
@Autowired
IAlertFormValueService iAlertFormValueService;
@Autowired
private ESAlertCalledService eSAlertCalledService;
@Autowired
RedisUtils redisUtils;
@Value("${redis.cache.failure.time}")
private long time;
......@@ -177,6 +181,28 @@ public class AlertCalledController extends BaseController {
page = iAlertCalledService.page(pageBean, alertCalledQueryWrapper);
return CommonResponseUtil.success(page);
}
/**
*
* <pre>
* 相似警情分页查询
* </pre>
*
* @param alertCalled
* @param current
* @param size
* @return
* @throws Exception
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "相似警情分页查询")
@RequestMapping(value = "/page/similar", method = RequestMethod.POST)
public ResponseModel<Page<ESAlertCalled>> pageBySimilar(
@RequestBody ESAlertCalled alertCalled,
@RequestParam(value = "current") int current,
@RequestParam(value = "size") int size) throws Exception {
return ResponseHelper.buildResponse(eSAlertCalledService.queryByKeys(alertCalled, current, size));
}
/**
* 列表无分页查询
......
package com.yeejoin.amos.boot.module.jcs.biz.dao;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.stereotype.Repository;
import com.yeejoin.amos.boot.module.jcs.api.entity.ESAlertCalled;
/**
*
* <pre>
* 警情信息ES数据查询
* </pre>
*
* @author gwb
* @version $Id: ESAlertCalledRepository.java, v 0.1 2021年6月19日 下午5:12:50 gwb Exp $
*/
@Repository
public interface ESAlertCalledRepository extends PagingAndSortingRepository<ESAlertCalled, Long> {
}
......@@ -13,6 +13,11 @@
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-elasticsearch</artifactId>
</dependency>
</dependencies>
<modules>
......
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