Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
amos-boot-biz
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
项目统一框架
amos-boot-biz
Commits
b9725bdc
Commit
b9725bdc
authored
Jun 24, 2021
by
taabe
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
消防力量调派资源树接口
parent
03bbb6e0
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
635 additions
and
578 deletions
+635
-578
FireTeamDto.java
...com/yeejoin/amos/boot/module/jcs/api/dto/FireTeamDto.java
+13
-0
FireBrigadeTypeEnum.java
...n/amos/boot/module/jcs/api/enums/FireBrigadeTypeEnum.java
+20
-0
AlertCalledController.java
...boot/module/jcs/biz/controller/AlertCalledController.java
+287
-287
PowerTransferController.java
...ot/module/jcs/biz/controller/PowerTransferController.java
+2
-1
AlertCalledServiceImpl.java
...t/module/jcs/biz/service/impl/AlertCalledServiceImpl.java
+3
-3
ESAlertCalledService.java
...oot/module/jcs/biz/service/impl/ESAlertCalledService.java
+279
-279
PowerTransferServiceImpl.java
...module/jcs/biz/service/impl/PowerTransferServiceImpl.java
+31
-8
No files found.
amos-boot-module/amos-boot-module-api/amos-boot-module-jcs-api/src/main/java/com/yeejoin/amos/boot/module/jcs/api/dto/FireTeamDto.java
View file @
b9725bdc
...
@@ -7,6 +7,8 @@ import lombok.Data;
...
@@ -7,6 +7,8 @@ import lombok.Data;
import
lombok.EqualsAndHashCode
;
import
lombok.EqualsAndHashCode
;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.List
;
/**
/**
* 消防队伍
* 消防队伍
*
*
...
@@ -59,4 +61,15 @@ public class FireTeamDto extends BaseDto {
...
@@ -59,4 +61,15 @@ public class FireTeamDto extends BaseDto {
@ApiModelProperty
(
value
=
"操作人名称"
)
@ApiModelProperty
(
value
=
"操作人名称"
)
private
String
recUserName
;
private
String
recUserName
;
@ApiModelProperty
(
value
=
"消防队类型(专职消防队,监控大队)"
)
private
String
type
;
@ApiModelProperty
(
value
=
"执勤车辆数"
)
private
String
onDutyCount
;
@ApiModelProperty
(
value
=
"出动车辆数"
)
private
String
outCount
;
@ApiModelProperty
(
value
=
"队伍下车辆"
)
private
List
<
FireCarDto
>
children
;
}
}
amos-boot-module/amos-boot-module-api/amos-boot-module-jcs-api/src/main/java/com/yeejoin/amos/boot/module/jcs/api/enums/FireBrigadeTypeEnum.java
0 → 100644
View file @
b9725bdc
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jcs
.
api
.
enums
;
import
lombok.AllArgsConstructor
;
import
lombok.Getter
;
/**
* 消防队伍类型枚举
*
* @author DELL
*/
@Getter
@AllArgsConstructor
public
enum
FireBrigadeTypeEnum
{
专职消防队
(
"fullTime"
,
"116"
,
"专职消防队"
),
监控大队
(
"monitorTeam"
,
"118"
,
"监控大队"
);
private
String
key
;
private
String
code
;
private
String
name
;
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-jcs-biz/src/main/java/com/yeejoin/amos/boot/module/jcs/biz/controller/AlertCalledController.java
View file @
b9725bdc
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jcs
.
biz
.
controller
;
//package com.yeejoin.amos.boot.module.jcs.biz.controller;
//
import
java.lang.reflect.Field
;
//import java.lang.reflect.Field;
import
java.util.ArrayList
;
//import java.util.ArrayList;
import
java.util.Arrays
;
//import java.util.Arrays;
import
java.util.List
;
//import java.util.List;
import
java.util.stream.Collectors
;
//import java.util.stream.Collectors;
import
java.util.stream.Stream
;
//import java.util.stream.Stream;
//
import
javax.servlet.http.HttpServletRequest
;
//import javax.servlet.http.HttpServletRequest;
//
import
org.apache.commons.lang3.StringUtils
;
//import org.apache.commons.lang3.StringUtils;
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.transaction.annotation.Transactional
;
//import org.springframework.transaction.annotation.Transactional;
import
org.springframework.web.bind.annotation.PathVariable
;
//import org.springframework.web.bind.annotation.PathVariable;
import
org.springframework.web.bind.annotation.PostMapping
;
//import org.springframework.web.bind.annotation.PostMapping;
import
org.springframework.web.bind.annotation.RequestBody
;
//import org.springframework.web.bind.annotation.RequestBody;
import
org.springframework.web.bind.annotation.RequestMapping
;
//import org.springframework.web.bind.annotation.RequestMapping;
import
org.springframework.web.bind.annotation.RequestMethod
;
//import org.springframework.web.bind.annotation.RequestMethod;
import
org.springframework.web.bind.annotation.RequestParam
;
//import org.springframework.web.bind.annotation.RequestParam;
import
org.springframework.web.bind.annotation.RestController
;
//import org.springframework.web.bind.annotation.RestController;
import
org.typroject.tyboot.core.foundation.enumeration.UserType
;
//import org.typroject.tyboot.core.foundation.enumeration.UserType;
import
org.typroject.tyboot.core.foundation.utils.ValidationUtil
;
//import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import
org.typroject.tyboot.core.restful.doc.TycloudOperation
;
//import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import
org.typroject.tyboot.core.restful.exception.instance.BadRequest
;
//import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import
org.typroject.tyboot.core.restful.utils.ResponseHelper
;
//import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import
org.typroject.tyboot.core.restful.utils.ResponseModel
;
//import org.typroject.tyboot.core.restful.utils.ResponseModel;
//
import
com.alibaba.fastjson.JSON
;
//import com.alibaba.fastjson.JSON;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
//import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
//import com.baomidou.mybatisplus.core.metadata.IPage;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
//import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import
com.yeejoin.amos.boot.biz.common.controller.BaseController
;
//import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import
com.yeejoin.amos.boot.biz.common.utils.NameUtils
;
//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.RedisKey;
import
com.yeejoin.amos.boot.biz.common.utils.RedisUtils
;
//import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import
com.yeejoin.amos.boot.module.jcs.api.dto.ESAlertCalledDto
;
//import com.yeejoin.amos.boot.module.jcs.api.dto.ESAlertCalledDto;
import
com.yeejoin.amos.boot.module.jcs.api.dto.ESAlertCalledRequestDto
;
//import com.yeejoin.amos.boot.module.jcs.api.dto.ESAlertCalledRequestDto;
import
com.yeejoin.amos.boot.module.jcs.api.entity.AlertCalled
;
//import com.yeejoin.amos.boot.module.jcs.api.entity.AlertCalled;
import
com.yeejoin.amos.boot.module.jcs.api.entity.AlertFormValue
;
//import com.yeejoin.amos.boot.module.jcs.api.entity.AlertFormValue;
import
com.yeejoin.amos.boot.module.jcs.api.vo.AlertCalledFormVo
;
//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.AlertCalledVo;
import
com.yeejoin.amos.boot.module.jcs.api.vo.FormValue
;
//import com.yeejoin.amos.boot.module.jcs.api.vo.FormValue;
import
com.yeejoin.amos.boot.module.jcs.biz.service.impl.AlertCalledServiceImpl
;
//import com.yeejoin.amos.boot.module.jcs.biz.service.impl.AlertCalledServiceImpl;
import
com.yeejoin.amos.boot.module.jcs.biz.service.impl.AlertFormValueServiceImpl
;
//import com.yeejoin.amos.boot.module.jcs.biz.service.impl.AlertFormValueServiceImpl;
import
com.yeejoin.amos.boot.module.jcs.biz.service.impl.ESAlertCalledService
;
//import com.yeejoin.amos.boot.module.jcs.biz.service.impl.ESAlertCalledService;
//
import
io.swagger.annotations.Api
;
//import io.swagger.annotations.Api;
import
io.swagger.annotations.ApiOperation
;
//import io.swagger.annotations.ApiOperation;
//
/**
///**
* 警情接警记录
// * 警情接警记录
*
// *
* @author tb
// * @author tb
* @date 2021-06-17
// * @date 2021-06-17
*/
// */
@RestController
//@RestController
@Api
(
tags
=
"警情接警记录Api"
)
//@Api(tags = "警情接警记录Api")
@RequestMapping
(
value
=
"/alert-called"
)
//@RequestMapping(value = "/alert-called")
public
class
AlertCalledController
extends
BaseController
{
//public class AlertCalledController extends BaseController {
//
@Autowired
// @Autowired
AlertCalledServiceImpl
iAlertCalledService
;
// AlertCalledServiceImpl iAlertCalledService;
@Autowired
// @Autowired
AlertFormValueServiceImpl
iAlertFormValueService
;
// AlertFormValueServiceImpl iAlertFormValueService;
@Autowired
// @Autowired
private
ESAlertCalledService
eSAlertCalledService
;
// private ESAlertCalledService eSAlertCalledService;
@Autowired
// @Autowired
RedisUtils
redisUtils
;
// RedisUtils redisUtils;
@Value
(
"${redis.cache.failure.time}"
)
// @Value("${redis.cache.failure.time}")
private
long
time
;
// private long time;
/**
// /**
* 新增警情接警记录
// * 新增警情接警记录
*
// *
* @return
// * @return
*/
// */
@TycloudOperation
(
needAuth
=
true
,
ApiLevel
=
UserType
.
AGENCY
)
// @TycloudOperation(needAuth = true, ApiLevel = UserType.AGENCY)
@PostMapping
(
value
=
"/save"
)
// @PostMapping(value = "/save")
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"新增警情接警记录"
,
notes
=
"新增警情接警记录"
)
// @ApiOperation(httpMethod = "POST", value = "新增警情接警记录", notes = "新增警情接警记录")
@Transactional
// @Transactional
public
ResponseModel
<
AlertCalledVo
>
saveAlertCalled
(
HttpServletRequest
request
,
// public ResponseModel<AlertCalledVo> saveAlertCalled(HttpServletRequest request,
@RequestBody
AlertCalledVo
alertCalledVo
)
throws
Exception
{
// @RequestBody AlertCalledVo alertCalledVo) throws Exception{
//
if
(
ValidationUtil
.
isEmpty
(
alertCalledVo
)
// if (ValidationUtil.isEmpty(alertCalledVo)
||
ValidationUtil
.
isEmpty
(
alertCalledVo
.
getAlertCalled
()))
// || ValidationUtil.isEmpty(alertCalledVo.getAlertCalled()))
throw
new
BadRequest
(
"参数校验失败."
);
// throw new BadRequest("参数校验失败.");
//
return
ResponseHelper
.
buildResponse
(
iAlertCalledService
.
createAlertCalled
(
alertCalledVo
));
// return ResponseHelper.buildResponse(iAlertCalledService.createAlertCalled(alertCalledVo));
}
// }
//
/**
// /**
* 根据id删除
// * 根据id删除
*
// *
* @param id
// * @param id
* @return
// * @return
*/
// */
@TycloudOperation
(
needAuth
=
true
,
ApiLevel
=
UserType
.
AGENCY
)
// @TycloudOperation(needAuth = true, ApiLevel = UserType.AGENCY)
@RequestMapping
(
value
=
"/{id}"
,
method
=
RequestMethod
.
DELETE
)
// @RequestMapping(value = "/{id}", method = RequestMethod.DELETE)
@ApiOperation
(
httpMethod
=
"DELETE"
,
value
=
"根据id删除"
,
notes
=
"根据id删除"
)
// @ApiOperation(httpMethod = "DELETE", value = "根据id删除", notes = "根据id删除")
public
boolean
deleteById
(
HttpServletRequest
request
,
@PathVariable
Long
id
)
{
// public boolean deleteById(HttpServletRequest request, @PathVariable Long id) {
return
iAlertCalledService
.
removeById
(
id
);
// return iAlertCalledService.removeById(id);
}
// }
//
/**
// /**
* 修改警情接警记录
// * 修改警情接警记录
*
// *
* @return
// * @return
*/
// */
@TycloudOperation
(
needAuth
=
true
,
ApiLevel
=
UserType
.
AGENCY
)
// @TycloudOperation(needAuth = true, ApiLevel = UserType.AGENCY)
@RequestMapping
(
value
=
"/updateById"
,
method
=
RequestMethod
.
PUT
)
// @RequestMapping(value = "/updateById", method = RequestMethod.PUT)
@ApiOperation
(
httpMethod
=
"PUT"
,
value
=
"修改警情接警记录"
,
notes
=
"修改警情接警记录"
)
// @ApiOperation(httpMethod = "PUT", value = "修改警情接警记录", notes = "修改警情接警记录")
public
boolean
updateByIdAlertCalled
(
HttpServletRequest
request
,
@RequestBody
AlertCalled
alertCalled
)
{
// public boolean updateByIdAlertCalled(HttpServletRequest request, @RequestBody AlertCalled alertCalled) {
return
iAlertCalledService
.
updateById
(
alertCalled
);
// return iAlertCalledService.updateById(alertCalled);
}
// }
//
/**
// /**
* 根据id查询
// * 根据id查询
*
// *
* @param id
// * @param id
* @return
// * @return
*/
// */
@TycloudOperation
(
needAuth
=
true
,
ApiLevel
=
UserType
.
AGENCY
)
// @TycloudOperation(needAuth = true, ApiLevel = UserType.AGENCY)
@RequestMapping
(
value
=
"/{id}"
,
method
=
RequestMethod
.
GET
)
// @RequestMapping(value = "/{id}", method = RequestMethod.GET)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"根据id查询"
,
notes
=
"根据id查询"
)
// @ApiOperation(httpMethod = "GET", value = "根据id查询", notes = "根据id查询")
public
ResponseModel
<
Object
>
selectById
(
HttpServletRequest
request
,
@PathVariable
Long
id
)
{
// public ResponseModel<Object> selectById(HttpServletRequest request, @PathVariable Long id) {
//
if
(
redisUtils
.
hasKey
(
RedisKey
.
ALERTCALLED_ID
+
id
)){
// if(redisUtils.hasKey(RedisKey.ALERTCALLED_ID+id)){
Object
obj
=
redisUtils
.
get
(
RedisKey
.
ALERTCALLED_ID
+
id
);
// Object obj= redisUtils.get(RedisKey.ALERTCALLED_ID+id);
return
ResponseHelper
.
buildResponse
(
obj
);
// return ResponseHelper.buildResponse(obj);
}
else
{
// }else{
// 警情基本信息
// // 警情基本信息
AlertCalled
alertCalled
=
iAlertCalledService
.
getById
(
id
);
// AlertCalled alertCalled = iAlertCalledService.getById(id);
QueryWrapper
<
AlertFormValue
>
queryWrapper
=
new
QueryWrapper
<>();
// QueryWrapper<AlertFormValue> queryWrapper = new QueryWrapper<>();
queryWrapper
.
eq
(
"alert_called_id"
,
id
);
// queryWrapper.eq("alert_called_id", id);
// 警情动态表单数据
// // 警情动态表单数据
List
<
AlertFormValue
>
list
=
iAlertFormValueService
.
list
(
queryWrapper
);
// List<AlertFormValue> list = iAlertFormValueService.list(queryWrapper);
List
<
FormValue
>
formValue
=
new
ArrayList
<
FormValue
>();
// List<FormValue> formValue = new ArrayList<FormValue>();
if
(
list
!=
null
&&
list
.
size
()>
0
)
{
// if(list!=null&&list.size()>0) {
for
(
AlertFormValue
alertFormValue
:
list
)
{
// for (AlertFormValue alertFormValue : list) {
FormValue
value
=
new
FormValue
(
alertFormValue
.
getFieldCode
(),
alertFormValue
.
getFieldName
(),
"text"
,
alertFormValue
.
getFieldValue
(),
alertFormValue
.
isBlock
());
// FormValue value = new FormValue(alertFormValue.getFieldCode(), alertFormValue.getFieldName(), "text", alertFormValue.getFieldValue(),alertFormValue.isBlock());
formValue
.
add
(
value
);
// formValue.add(value);
}
// }
}
// }
AlertCalledFormVo
alertCalledFormVo
=
new
AlertCalledFormVo
(
alertCalled
,
formValue
);
// AlertCalledFormVo alertCalledFormVo = new AlertCalledFormVo(alertCalled, formValue);
//
redisUtils
.
set
(
RedisKey
.
ALERTCALLED_ID
+
id
,
JSON
.
toJSON
(
alertCalledFormVo
),
time
);
// redisUtils.set(RedisKey.ALERTCALLED_ID+id,JSON.toJSON(alertCalledFormVo),time);
return
ResponseHelper
.
buildResponse
(
alertCalledFormVo
);
// return ResponseHelper.buildResponse(alertCalledFormVo);
}
// }
}
// }
//
/**
// /**
* 列表分页查询
// * 列表分页查询
*
// *
* @return
// * @return
*/
// */
@TycloudOperation
(
needAuth
=
true
,
ApiLevel
=
UserType
.
AGENCY
)
// @TycloudOperation(needAuth = true, ApiLevel = UserType.AGENCY)
@RequestMapping
(
value
=
"/list"
,
method
=
RequestMethod
.
GET
)
// @RequestMapping(value = "/list", method = RequestMethod.GET)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"列表分页查询"
,
notes
=
"列表分页查询"
)
// @ApiOperation(httpMethod = "GET", value = "列表分页查询", notes = "列表分页查询")
public
ResponseModel
<
IPage
<
AlertCalled
>>
listPage
(
String
pageNum
,
String
pageSize
,
String
sort
,
AlertCalled
alertCalled
)
{
// public ResponseModel<IPage<AlertCalled>> listPage(String pageNum, String pageSize,String sort, AlertCalled alertCalled) {
Page
<
AlertCalled
>
pageBean
;
// Page<AlertCalled> pageBean;
IPage
<
AlertCalled
>
page
;
// IPage<AlertCalled> page;
QueryWrapper
<
AlertCalled
>
alertCalledQueryWrapper
=
new
QueryWrapper
<>();
// QueryWrapper<AlertCalled> alertCalledQueryWrapper = new QueryWrapper<>();
//
setQueryWrapper
(
alertCalledQueryWrapper
,
alertCalled
,
sort
);
// setQueryWrapper(alertCalledQueryWrapper, alertCalled,sort);
//
if
(
StringUtils
.
isBlank
(
pageNum
)
||
StringUtils
.
isBlank
(
pageSize
))
{
// if (StringUtils.isBlank(pageNum) || StringUtils.isBlank(pageSize)) {
pageBean
=
new
Page
<>(
0
,
Long
.
MAX_VALUE
);
// pageBean = new Page<>(0, Long.MAX_VALUE);
}
else
{
// } else {
pageBean
=
new
Page
<>(
Integer
.
parseInt
(
pageNum
),
Integer
.
parseInt
(
pageSize
));
// pageBean = new Page<>(Integer.parseInt(pageNum), Integer.parseInt(pageSize));
}
// }
page
=
iAlertCalledService
.
page
(
pageBean
,
alertCalledQueryWrapper
);
// page = iAlertCalledService.page(pageBean, alertCalledQueryWrapper);
return
ResponseHelper
.
buildResponse
(
page
);
// return ResponseHelper.buildResponse(page);
}
// }
//
/**
// /**
*
// *
* <pre>
// * <pre>
* 相似警情分页查询
// * 相似警情分页查询
* </pre>
// * </pre>
*
// *
* @param alertCalled
// * @param alertCalled
* @param current
// * @param current
* @param size
// * @param size
* @return
// * @return
* @throws Exception
// * @throws Exception
*/
// */
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
,
needAuth
=
false
)
// @TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation
(
value
=
"相似警情分页查询"
)
// @ApiOperation(value = "相似警情分页查询")
@RequestMapping
(
value
=
"/page/similar"
,
method
=
RequestMethod
.
POST
)
// @RequestMapping(value = "/page/similar", method = RequestMethod.POST)
public
ResponseModel
<
Page
<
ESAlertCalledDto
>>
pageBySimilar
(
// public ResponseModel<Page<ESAlertCalledDto>> pageBySimilar(
@RequestBody
ESAlertCalledRequestDto
alertCalledVo
,
// @RequestBody ESAlertCalledRequestDto alertCalledVo,
@RequestParam
(
value
=
"current"
)
int
current
,
// @RequestParam(value = "current") int current,
@RequestParam
(
value
=
"size"
)
int
size
)
throws
Exception
{
// @RequestParam(value = "size") int size) throws Exception {
return
ResponseHelper
.
buildResponse
(
eSAlertCalledService
.
queryByKeys
(
alertCalledVo
,
current
,
size
));
// return ResponseHelper.buildResponse(eSAlertCalledService.queryByKeys(alertCalledVo, current, size));
}
// }
//
/**
// /**
*
// *
* <pre>
// * <pre>
* 初始化ES
// * 初始化ES
* </pre>
// * </pre>
*
// *
* @return
// * @return
*/
// */
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
,
needAuth
=
false
)
// @TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation
(
value
=
"初始化ES"
)
// @ApiOperation(value = "初始化ES")
@RequestMapping
(
value
=
"/es/init"
,
method
=
RequestMethod
.
PUT
)
// @RequestMapping(value = "/es/init", method = RequestMethod.PUT)
public
ResponseModel
<
Boolean
>
initEs
()
throws
Exception
{
// public ResponseModel<Boolean> initEs() throws Exception {
return
ResponseHelper
.
buildResponse
(
eSAlertCalledService
.
initEs
());
// return ResponseHelper.buildResponse(eSAlertCalledService.initEs());
}
// }
//
/**
// /**
* 列表无分页查询
// * 列表无分页查询
*
// *
* @return
// * @return
*/
// */
@TycloudOperation
(
needAuth
=
true
,
ApiLevel
=
UserType
.
AGENCY
)
// @TycloudOperation(needAuth = true, ApiLevel = UserType.AGENCY)
@RequestMapping
(
value
=
"/getList"
,
method
=
RequestMethod
.
GET
)
// @RequestMapping(value = "/getList", method = RequestMethod.GET)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"列表无分页查询"
,
notes
=
"列表无分页查询"
)
// @ApiOperation(httpMethod = "GET", value = "列表无分页查询", notes = "列表无分页查询")
public
ResponseModel
<
List
<
AlertCalled
>>
list
(
AlertCalled
alertCalled
)
{
// public ResponseModel<List<AlertCalled>> list(AlertCalled alertCalled) {
QueryWrapper
<
AlertCalled
>
alertCalledQueryWrapper
=
new
QueryWrapper
<>();
// QueryWrapper<AlertCalled> alertCalledQueryWrapper = new QueryWrapper<>();
setQueryWrapper
(
alertCalledQueryWrapper
,
alertCalled
,
null
);
// setQueryWrapper(alertCalledQueryWrapper, alertCalled,null);
List
<
AlertCalled
>
list
=
iAlertCalledService
.
list
(
alertCalledQueryWrapper
);
// List<AlertCalled> list = iAlertCalledService.list(alertCalledQueryWrapper);
return
ResponseHelper
.
buildResponse
(
list
);
// return ResponseHelper.buildResponse(list);
}
// }
//
private
QueryWrapper
<
AlertCalled
>
setQueryWrapper
(
QueryWrapper
<
AlertCalled
>
queryWrapper
,
AlertCalled
alertCalled
,
String
sort
){
// private QueryWrapper<AlertCalled> setQueryWrapper(QueryWrapper<AlertCalled> queryWrapper, AlertCalled alertCalled,String sort){
Class
<?
extends
AlertCalled
>
aClass
=
alertCalled
.
getClass
();
// Class<? extends AlertCalled> aClass = alertCalled.getClass();
queryWrapper
.
eq
(
"is_delete"
,
0
);
// queryWrapper.eq("is_delete", 0);
//
if
(
sort
!=
null
)
{
// if(sort!=null) {
String
[]
date
=
sort
.
split
(
","
);
// String[] date= sort.split(",");
if
(
date
[
1
].
equals
(
"ascend"
))
{
// if(date[1].equals("ascend")) {
queryWrapper
.
orderByAsc
(
RedisKey
.
humpToLine
(
date
[
0
]));
// queryWrapper.orderByAsc(RedisKey.humpToLine(date[0]));
}
else
{
// }else {
queryWrapper
.
orderByDesc
(
RedisKey
.
humpToLine
(
date
[
0
]));
// queryWrapper.orderByDesc(RedisKey.humpToLine(date[0]));
}
// }
}
else
{
// }else {
queryWrapper
.
orderByDesc
(
"call_time"
);
// queryWrapper.orderByDesc("call_time");
}
// }
//
if
(
alertCalled
.
getCallTimeStart
()
!=
null
&&
alertCalled
.
getCallTimeEnd
()
!=
null
)
{
// if (alertCalled.getCallTimeStart() != null && alertCalled.getCallTimeEnd() != null) {
queryWrapper
.
between
(
"call_time"
,
alertCalled
.
getCallTimeStart
(),
alertCalled
.
getCallTimeEnd
());
// queryWrapper.between("call_time", alertCalled.getCallTimeStart(), alertCalled.getCallTimeEnd());
}
// }
if
(
alertCalled
.
getIsFatherAlert
())
{
// 0:接警;1:处警
// if (alertCalled.getIsFatherAlert()) { // 0:接警;1:处警
queryWrapper
.
isNull
(
"father_alert"
);
// queryWrapper.isNull("father_alert");
}
// }
if
(!
ValidationUtil
.
isEmpty
(
alertCalled
.
getAlertSourceCodeStr
())){
// if (!ValidationUtil.isEmpty(alertCalled.getAlertSourceCodeStr())){
String
[]
arr
=
alertCalled
.
getAlertSourceCodeStr
().
split
(
","
);
// String[] arr = alertCalled.getAlertSourceCodeStr().split(",");
List
<
String
>
collect
=
Arrays
.
stream
(
arr
).
collect
(
Collectors
.
toList
());
// List<String> collect = Arrays.stream(arr).collect(Collectors.toList());
queryWrapper
.
in
(
"alert_source_code"
,
collect
);
// queryWrapper.in("alert_source_code", collect);
}
// }
Stream
<
Field
>
fieldStream
=
Arrays
.
stream
(
aClass
.
getDeclaredFields
()).
filter
(
field
->
{
// Stream<Field> fieldStream = Arrays.stream(aClass.getDeclaredFields()).filter(field -> {
String
name
=
NameUtils
.
camel2Underline
(
field
.
getName
());
// String name = NameUtils.camel2Underline(field.getName());
return
!(
"IS_FATHER_ALERT"
.
equals
(
name
)
||
"ALERT_SOURCE_CODE_STR"
.
equals
(
name
));
// return !("IS_FATHER_ALERT".equals(name) || "ALERT_SOURCE_CODE_STR".equals(name));
});
// });
fieldStream
.
forEach
(
field
->
{
// fieldStream.forEach(field -> {
try
{
// try {
field
.
setAccessible
(
true
);
// field.setAccessible(true);
Object
o
=
field
.
get
(
alertCalled
);
// Object o = field.get(alertCalled);
if
(
o
!=
null
)
{
// if (o != null) {
Class
<?>
type
=
field
.
getType
();
// Class<?> type = field.getType();
String
name
=
NameUtils
.
camel2Underline
(
field
.
getName
());
// String name = NameUtils.camel2Underline(field.getName());
if
(
type
.
equals
(
Integer
.
class
))
{
// if (type.equals(Integer.class)) {
Integer
fileValue
=
(
Integer
)
field
.
get
(
alertCalled
);
// Integer fileValue = (Integer) field.get(alertCalled);
queryWrapper
.
eq
(
name
,
fileValue
);
// queryWrapper.eq(name, fileValue);
}
else
if
(
type
.
equals
(
String
.
class
))
{
// } else if (type.equals(String.class)) {
String
fileValue
=
(
String
)
field
.
get
(
alertCalled
);
// String fileValue = (String) field.get(alertCalled);
queryWrapper
.
eq
(
name
,
fileValue
);
// queryWrapper.eq(name, fileValue);
}
else
if
(
type
.
equals
(
Boolean
.
class
))
{
// } else if (type.equals(Boolean.class)) {
Boolean
fileValue
=
(
Boolean
)
field
.
get
(
alertCalled
);
// Boolean fileValue = (Boolean) field.get(alertCalled);
queryWrapper
.
eq
(
name
,
fileValue
);
// queryWrapper.eq(name, fileValue);
}
else
if
(
type
.
equals
(
Long
.
class
))
{
// }else if (type.equals(Long.class)) {
Long
fileValue
=
(
Long
)
field
.
get
(
alertCalled
);
// Long fileValue = (Long) field.get(alertCalled);
queryWrapper
.
eq
(
name
,
fileValue
);
// queryWrapper.eq(name, fileValue);
}
// }
}
// }
}
catch
(
Exception
e
)
{
// } catch (Exception e) {
e
.
printStackTrace
();
// e.printStackTrace();
throw
new
RuntimeException
(
"系统异常"
);
// throw new RuntimeException("系统异常");
}
// }
});
// });
return
queryWrapper
;
// return queryWrapper;
}
// }
}
//}
\ No newline at end of file
\ No newline at end of file
amos-boot-module/amos-boot-module-biz/amos-boot-module-jcs-biz/src/main/java/com/yeejoin/amos/boot/module/jcs/biz/controller/PowerTransferController.java
View file @
b9725bdc
...
@@ -4,6 +4,7 @@ import java.util.Arrays;
...
@@ -4,6 +4,7 @@ import java.util.Arrays;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
...
@@ -180,7 +181,7 @@ public class PowerTransferController extends BaseController {
...
@@ -180,7 +181,7 @@ public class PowerTransferController extends BaseController {
@GetMapping
(
value
=
"/power/tree"
)
@GetMapping
(
value
=
"/power/tree"
)
@ApiOperation
(
value
=
"力量调派资源树"
,
notes
=
"力量调派资源树"
)
@ApiOperation
(
value
=
"力量调派资源树"
,
notes
=
"力量调派资源树"
)
public
ResponseModel
<
Object
>
getPowerTree
()
{
public
ResponseModel
<
Object
>
getPowerTree
()
{
iP
owerTransferService
.
getPowerTree
();
p
owerTransferService
.
getPowerTree
();
return
ResponseHelper
.
buildResponse
(
""
);
return
ResponseHelper
.
buildResponse
(
""
);
}
}
}
}
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-jcs-biz/src/main/java/com/yeejoin/amos/boot/module/jcs/biz/service/impl/AlertCalledServiceImpl.java
View file @
b9725bdc
...
@@ -33,8 +33,8 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto,AlertCall
...
@@ -33,8 +33,8 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto,AlertCall
@Autowired
@Autowired
private
AlertFormValueServiceImpl
iAlertFormValueService
;
private
AlertFormValueServiceImpl
iAlertFormValueService
;
@Autowired
//
@Autowired
private
ESAlertCalledService
eSAlertCalledService
;
//
private ESAlertCalledService eSAlertCalledService;
/**
/**
*
*
...
@@ -71,7 +71,7 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto,AlertCall
...
@@ -71,7 +71,7 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto,AlertCall
/**
/**
* 同步保存ES
* 同步保存ES
*/
*/
eSAlertCalledService
.
saveAlertCalledToES
(
alertCalled
);
//
eSAlertCalledService.saveAlertCalledToES(alertCalled);
return
alertCalledVo
;
return
alertCalledVo
;
}
}
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-jcs-biz/src/main/java/com/yeejoin/amos/boot/module/jcs/biz/service/impl/ESAlertCalledService.java
View file @
b9725bdc
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jcs
.
biz
.
service
.
impl
;
//
package com.yeejoin.amos.boot.module.jcs.biz.service.impl;
//
import
java.util.Date
;
//
import java.util.Date;
import
java.util.LinkedList
;
//
import java.util.LinkedList;
import
java.util.List
;
//
import java.util.List;
//
import
javax.annotation.PostConstruct
;
//
import javax.annotation.PostConstruct;
//
import
org.elasticsearch.index.query.BoolQueryBuilder
;
//
import org.elasticsearch.index.query.BoolQueryBuilder;
import
org.elasticsearch.index.query.QueryBuilders
;
//
import org.elasticsearch.index.query.QueryBuilders;
import
org.springframework.beans.factory.annotation.Autowired
;
//
import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.data.domain.PageRequest
;
//
import org.springframework.data.domain.PageRequest;
import
org.springframework.data.elasticsearch.core.ElasticsearchRestTemplate
;
//
import org.springframework.data.elasticsearch.core.ElasticsearchRestTemplate;
import
org.springframework.data.elasticsearch.core.SearchHit
;
//
import org.springframework.data.elasticsearch.core.SearchHit;
import
org.springframework.data.elasticsearch.core.SearchHits
;
//
import org.springframework.data.elasticsearch.core.SearchHits;
import
org.springframework.data.elasticsearch.core.query.NativeSearchQueryBuilder
;
//
import org.springframework.data.elasticsearch.core.query.NativeSearchQueryBuilder;
import
org.springframework.stereotype.Service
;
//
import org.springframework.stereotype.Service;
import
org.typroject.tyboot.core.foundation.utils.ValidationUtil
;
//
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
//
import
com.alibaba.fastjson.JSONObject
;
//
import com.alibaba.fastjson.JSONObject;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
//
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
//
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import
com.yeejoin.amos.boot.module.jcs.api.dto.ESAlertCalledDto
;
//
import com.yeejoin.amos.boot.module.jcs.api.dto.ESAlertCalledDto;
import
com.yeejoin.amos.boot.module.jcs.api.dto.ESAlertCalledRequestDto
;
//
import com.yeejoin.amos.boot.module.jcs.api.dto.ESAlertCalledRequestDto;
import
com.yeejoin.amos.boot.module.jcs.api.entity.AlertCalled
;
//
import com.yeejoin.amos.boot.module.jcs.api.entity.AlertCalled;
import
com.yeejoin.amos.boot.module.jcs.api.entity.ESAlertCalled
;
//
import com.yeejoin.amos.boot.module.jcs.api.entity.ESAlertCalled;
import
com.yeejoin.amos.boot.module.jcs.api.enums.AlertStatusEnum
;
//
import com.yeejoin.amos.boot.module.jcs.api.enums.AlertStatusEnum;
import
com.yeejoin.amos.boot.module.jcs.biz.dao.ESAlertCalledRepository
;
//
import com.yeejoin.amos.boot.module.jcs.biz.dao.ESAlertCalledRepository;
//
/**
/
//
**
*
// *
* <pre>
//
* <pre>
* 警情信息ES检索服务
//
* 警情信息ES检索服务
* </pre>
//
* </pre>
*
//
*
* @author gwb
//
* @author gwb
* @version $Id: ESAlertCalledService.java, v 0.1 2021年6月19日 下午5:12:01 gwb Exp $
//
* @version $Id: ESAlertCalledService.java, v 0.1 2021年6月19日 下午5:12:01 gwb Exp $
*/
//
*/
@Service
//
@Service
public
class
ESAlertCalledService
{
//
public class ESAlertCalledService {
//
@Autowired
//
@Autowired
private
ElasticsearchRestTemplate
elasticsearchTemplate
;
//
private ElasticsearchRestTemplate elasticsearchTemplate;
//
@Autowired
//
@Autowired
private
ESAlertCalledRepository
esAlertCalledRepository
;
//
private ESAlertCalledRepository esAlertCalledRepository;
//
@Autowired
//
@Autowired
private
AlertCalledServiceImpl
alertCalledService
;
//
private AlertCalledServiceImpl alertCalledService;
//
//
//
@PostConstruct
//
@PostConstruct
public
void
init
()
throws
Exception
//
public void init() throws Exception
{
//
{
//初始化ES,重建索引
//
//初始化ES,重建索引
initEs
();
//
initEs();
}
//
}
//
/**
//
/**
* 重建索引
//
* 重建索引
*/
//
*/
public
Boolean
initEs
()
throws
Exception
{
//
public Boolean initEs() throws Exception {
esAlertCalledRepository
.
deleteAll
();
//
esAlertCalledRepository.deleteAll();
/**
//
/**
* 同步历史48小时以内的警情处置记录
//
* 同步历史48小时以内的警情处置记录
*/
//
*/
QueryWrapper
<
AlertCalled
>
wrapper
=
new
QueryWrapper
<>();
//
QueryWrapper<AlertCalled> wrapper = new QueryWrapper<>();
//
long
currentTime
=
System
.
currentTimeMillis
()
;
//
long currentTime = System.currentTimeMillis() ;
currentTime
=
currentTime
-
480
*
60
*
60
*
1000
;
//
currentTime = currentTime - 480*60*60*1000;
Date
date
=
new
Date
(
currentTime
);
//
Date date=new Date(currentTime);
//
wrapper
.
ge
(
"call_time"
,
date
);
//
wrapper.ge("call_time", date);
//
List
<
AlertCalled
>
alertCalleds
=
alertCalledService
.
list
(
wrapper
);
//
List<AlertCalled> alertCalleds = alertCalledService.list(wrapper);
if
(!
ValidationUtil
.
isEmpty
(
alertCalleds
))
//
if (!ValidationUtil.isEmpty(alertCalleds))
{
//
{
for
(
AlertCalled
alertCalled
:
alertCalleds
)
// for (AlertCalled alertCalled : alertCalleds)
{
//
{
saveAlertCalledToES
(
alertCalled
);
//
saveAlertCalledToES(alertCalled);
}
//
}
}
//
}
return
true
;
//
return true;
}
//
}
//
/**
//
/**
*
// *
* <pre>
//
* <pre>
* 批量保存
//
* 批量保存
* </pre>
//
* </pre>
*
//
*
* @param list 警情信息列表
//
* @param list 警情信息列表
*/
//
*/
public
void
saveAll
(
List
<
AlertCalled
>
alertCalleds
)
throws
Exception
{
//
public void saveAll(List<AlertCalled> alertCalleds) throws Exception{
//
if
(!
ValidationUtil
.
isEmpty
(
alertCalleds
))
//
if (!ValidationUtil.isEmpty(alertCalleds))
{
//
{
for
(
AlertCalled
alertCalled
:
alertCalleds
)
//
for (AlertCalled alertCalled : alertCalleds)
{
//
{
this
.
saveAlertCalledToES
(
alertCalled
);
//
this.saveAlertCalledToES(alertCalled);
}
// }
}
//
}
}
//
}
//
/**
//
/**
*
// *
* <pre>
//
* <pre>
* 根据警情记录批量保存
//
* 根据警情记录批量保存
* </pre>
//
* </pre>
*
//
*
* @param alertCalleds 警情信息列表
//
* @param alertCalleds 警情信息列表
*/
//
*/
public
ESAlertCalled
saveAlertCalledToES
(
AlertCalled
alertCalled
)
throws
Exception
//
public ESAlertCalled saveAlertCalledToES(AlertCalled alertCalled) throws Exception
{
//
{
ESAlertCalled
esAlertCalled
=
new
ESAlertCalled
();
//
ESAlertCalled esAlertCalled = new ESAlertCalled();
esAlertCalled
.
setSequenceNbr
(
alertCalled
.
getSequenceNbr
());
//
esAlertCalled.setSequenceNbr(alertCalled.getSequenceNbr());
esAlertCalled
.
setAlertType
(
alertCalled
.
getAlertType
());
//
esAlertCalled.setAlertType(alertCalled.getAlertType());
esAlertCalled
.
setAlertTypeCode
(
alertCalled
.
getAlertTypeCode
());
//
esAlertCalled.setAlertTypeCode(alertCalled.getAlertTypeCode());
esAlertCalled
.
setCallTime
(
alertCalled
.
getCallTime
());
//
esAlertCalled.setCallTime(alertCalled.getCallTime());
esAlertCalled
.
setCallTimeLong
(
alertCalled
.
getCallTime
().
getTime
());
//
esAlertCalled.setCallTimeLong(alertCalled.getCallTime().getTime());
esAlertCalled
.
setContactUser
(
alertCalled
.
getContactUser
());
//
esAlertCalled.setContactUser(alertCalled.getContactUser());
esAlertCalled
.
setContactPhone
(
alertCalled
.
getContactPhone
());
//
esAlertCalled.setContactPhone(alertCalled.getContactPhone());
esAlertCalled
.
setAddress
(
alertCalled
.
getAddress
());
//
esAlertCalled.setAddress(alertCalled.getAddress());
esAlertCalled
.
setAlertStage
(
alertCalled
.
getAlertStage
());
//
esAlertCalled.setAlertStage(alertCalled.getAlertStage());
esAlertCalled
.
setAlertStatus
(
alertCalled
.
getAlertStatus
());
//
esAlertCalled.setAlertStatus(alertCalled.getAlertStatus());
if
(
alertCalled
.
getAlertStatus
())
//
if (alertCalled.getAlertStatus())
{
//
{
esAlertCalled
.
setAlertStatusStr
(
AlertStatusEnum
.
CLOSED
.
getCode
());
//
esAlertCalled.setAlertStatusStr(AlertStatusEnum.CLOSED.getCode());
}
else
// }else
{
//
{
esAlertCalled
.
setAlertStatusStr
(
AlertStatusEnum
.
UNCLOSED
.
getCode
());
//
esAlertCalled.setAlertStatusStr(AlertStatusEnum.UNCLOSED.getCode());
}
//
}
esAlertCalled
.
setResponseLevelCode
(
alertCalled
.
getResponseLevelCode
());
//
esAlertCalled.setResponseLevelCode(alertCalled.getResponseLevelCode());
esAlertCalled
.
setUnitInvolved
(
alertCalled
.
getUnitInvolved
());
//
esAlertCalled.setUnitInvolved(alertCalled.getUnitInvolved());
esAlertCalled
.
setCoordinateX
(
alertCalled
.
getCoordinateX
());
//
esAlertCalled.setCoordinateX(alertCalled.getCoordinateX());
esAlertCalled
.
setCoordinateY
(
alertCalled
.
getCoordinateY
());
//
esAlertCalled.setCoordinateY(alertCalled.getCoordinateY());
//
esAlertCalledRepository
.
save
(
esAlertCalled
);
//
esAlertCalledRepository.save(esAlertCalled);
//
return
esAlertCalled
;
//
return esAlertCalled;
}
//
}
//
/**
//
/**
*
// *
* <pre>
//
* <pre>
* 从ES库批量删除
//
* 从ES库批量删除
* </pre>
//
* </pre>
*
//
*
* @param ids
//
* @param ids
* @return
//
* @return
* @throws Exception
//
* @throws Exception
*/
//
*/
public
Boolean
deleteById
(
List
<
Long
>
ids
)
throws
Exception
{
//
public Boolean deleteById(List<Long> ids) throws Exception{
if
(!
ValidationUtil
.
isEmpty
(
ids
))
{
//
if (!ValidationUtil.isEmpty(ids)) {
for
(
Long
sequenceNbr
:
ids
)
{
//
for (Long sequenceNbr : ids) {
if
(
esAlertCalledRepository
.
existsById
(
sequenceNbr
))
{
//
if (esAlertCalledRepository.existsById(sequenceNbr)) {
esAlertCalledRepository
.
deleteById
(
sequenceNbr
);
//
esAlertCalledRepository.deleteById(sequenceNbr);
}
//
}
}
//
}
}
//
}
//
return
true
;
//
return true;
}
//
}
//
/**
//
/**
* 根据id查询ES存储对象
//
* 根据id查询ES存储对象
*
//
*
* @param sequenceNbr id
//
* @param sequenceNbr id
* @return ES实例
//
* @return ES实例
*/
//
*/
public
ESAlertCalled
queryById
(
Long
sequenceNbr
)
{
//
public ESAlertCalled queryById(Long sequenceNbr) {
return
esAlertCalledRepository
.
findById
(
sequenceNbr
).
orElse
(
null
);
//
return esAlertCalledRepository.findById(sequenceNbr).orElse(null);
}
//
}
//
/**
//
/**
* 根据关键字查询文档,关键字不为空时按相关性从大到小排序
//
* 根据关键字查询文档,关键字不为空时按相关性从大到小排序
*
//
*
* @param queryStr 关键字
//
* @param queryStr 关键字
* @param current 当前页码
//
* @param current 当前页码
* @param size 页面大小
//
* @param size 页面大小
* @return
//
* @return
*/
//
*/
@SuppressWarnings
({
"rawtypes"
})
//
@SuppressWarnings({ "rawtypes" })
public
Page
<
ESAlertCalledDto
>
queryByKeys
(
ESAlertCalledRequestDto
alertCalledVo
,
int
current
,
int
size
)
// public Page<ESAlertCalledDto> queryByKeys(ESAlertCalledRequestDto alertCalledVo, int current, int size)
{
//
{
Page
<
ESAlertCalledDto
>
result
=
new
Page
<
ESAlertCalledDto
>(
current
,
size
);
//
Page<ESAlertCalledDto> result = new Page<ESAlertCalledDto>(current, size);
//
String
[]
alertStatus
=
alertCalledVo
.
getAlertStatus
();
//
String[] alertStatus = alertCalledVo.getAlertStatus();
if
(
ValidationUtil
.
isEmpty
(
alertStatus
))
//
if (ValidationUtil.isEmpty(alertStatus))
{
//
{
return
result
;
//
return result;
}
//
}
//
AlertCalled
alertCalled
=
alertCalledVo
.
getAlertCalled
();
//
AlertCalled alertCalled = alertCalledVo.getAlertCalled();
if
(
ValidationUtil
.
isEmpty
(
alertCalled
))
//
if (ValidationUtil.isEmpty(alertCalled))
{
//
{
return
result
;
//
return result;
}
//
}
/**
//
/**
* 通用匹配规则,条件构建
//
* 通用匹配规则,条件构建
*/
//
*/
BoolQueryBuilder
boolMust
=
QueryBuilders
.
boolQuery
();
//
BoolQueryBuilder boolMust = QueryBuilders.boolQuery();
//警情状态
//
//警情状态
BoolQueryBuilder
qb0
=
QueryBuilders
.
boolQuery
();
//
BoolQueryBuilder qb0 = QueryBuilders.boolQuery();
for
(
String
status
:
alertStatus
)
//
for (String status : alertStatus)
{
//
{
AlertStatusEnum
alertStatusEnum
=
AlertStatusEnum
.
getEnum
(
status
);
//
AlertStatusEnum alertStatusEnum = AlertStatusEnum.getEnum(status);
if
(!
ValidationUtil
.
isEmpty
(
alertStatusEnum
))
//
if (!ValidationUtil.isEmpty(alertStatusEnum))
{
//
{
qb0
.
should
(
QueryBuilders
.
termQuery
(
"alertStatusStr.keyword"
,
alertStatusEnum
.
getName
()));
//
qb0.should(QueryBuilders.termQuery("alertStatusStr.keyword", alertStatusEnum.getName()));
}
//
}
}
//
}
boolMust
.
must
(
qb0
);
//
boolMust.must(qb0);
//接警时间,距离当前时间不超过半小时的
//
//接警时间,距离当前时间不超过半小时的
long
currentTime
=
System
.
currentTimeMillis
()
;
//
long currentTime = System.currentTimeMillis() ;
currentTime
=
currentTime
-
30
*
60
*
1000
;
//
currentTime = currentTime - 30*60*1000;
BoolQueryBuilder
qb1
=
QueryBuilders
.
boolQuery
()
//
BoolQueryBuilder qb1 = QueryBuilders.boolQuery()
.
must
(
QueryBuilders
.
rangeQuery
(
"callTimeLong"
).
gte
(
currentTime
));
//
.must(QueryBuilders.rangeQuery("callTimeLong").gte(currentTime));
boolMust
.
should
(
qb1
);
//
boolMust.should(qb1);
//报警人及报警电话一致
//
//报警人及报警电话一致
if
(!
ValidationUtil
.
isEmpty
(
alertCalled
.
getContactUser
())
&&
!
ValidationUtil
.
isEmpty
(
alertCalled
.
getContactPhone
()))
//
if (!ValidationUtil.isEmpty(alertCalled.getContactUser()) && !ValidationUtil.isEmpty(alertCalled.getContactPhone()))
{
//
{
BoolQueryBuilder
qb2
=
QueryBuilders
.
boolQuery
()
//
BoolQueryBuilder qb2 = QueryBuilders.boolQuery()
.
must
(
QueryBuilders
.
termQuery
(
"contactUser.keyword"
,
alertCalled
.
getContactUser
()))
//
.must(QueryBuilders.termQuery("contactUser.keyword", alertCalled.getContactUser()))
.
must
(
QueryBuilders
.
termQuery
(
"contactPhone.keyword"
,
alertCalled
.
getContactPhone
()));
//
.must(QueryBuilders.termQuery("contactPhone.keyword", alertCalled.getContactPhone()));
boolMust
.
should
(
qb2
);
//
boolMust.should(qb2);
}
//
}
//事发地点一致,或相距不超过200米的
//
//事发地点一致,或相距不超过200米的
if
(!
ValidationUtil
.
isEmpty
(
alertCalled
.
getAddress
()))
//
if (!ValidationUtil.isEmpty(alertCalled.getAddress()))
{
//
{
BoolQueryBuilder
qb3
=
QueryBuilders
.
boolQuery
()
//
BoolQueryBuilder qb3 = QueryBuilders.boolQuery()
.
should
(
QueryBuilders
.
matchQuery
(
"address"
,
alertCalled
.
getAddress
()));
//
.should(QueryBuilders.matchQuery("address", alertCalled.getAddress()));
boolMust
.
should
(
qb3
);
//
boolMust.should(qb3);
}
//
}
//警情类型一致
//
//警情类型一致
BoolQueryBuilder
qb4
=
QueryBuilders
.
boolQuery
()
//
BoolQueryBuilder qb4 = QueryBuilders.boolQuery()
.
must
(
QueryBuilders
.
termQuery
(
"alertTypeCode.keyword"
,
alertCalled
.
getAlertTypeCode
()));
//
.must(QueryBuilders.termQuery("alertTypeCode.keyword", alertCalled.getAlertTypeCode()));
boolMust
.
should
(
qb4
);
//
boolMust.should(qb4);
//事发单位名称一致
//
//事发单位名称一致
if
(!
ValidationUtil
.
isEmpty
(
alertCalled
.
getUnitInvolved
()))
//
if (!ValidationUtil.isEmpty(alertCalled.getUnitInvolved()))
{
//
{
BoolQueryBuilder
qb5
=
QueryBuilders
.
boolQuery
()
//
BoolQueryBuilder qb5 = QueryBuilders.boolQuery()
.
must
(
QueryBuilders
.
matchQuery
(
"unitInvolved"
,
alertCalled
.
getUnitInvolved
()));
//
.must(QueryBuilders.matchQuery("unitInvolved", alertCalled.getUnitInvolved()));
boolMust
.
should
(
qb5
);
//
boolMust.should(qb5);
}
//
}
//
/**
//
/**
* 一般火灾,条件构造
//
* 一般火灾,条件构造
*/
//
*/
//
//
//
// 创建查询构造器
//
// 创建查询构造器
NativeSearchQueryBuilder
queryBuilder
=
new
NativeSearchQueryBuilder
()
//
NativeSearchQueryBuilder queryBuilder = new NativeSearchQueryBuilder()
// 分页
//
// 分页
.
withPageable
(
PageRequest
.
of
(
current
,
size
))
//
.withPageable(PageRequest.of(current, size))
// 排序
//
// 排序
// .withSort(SortBuilders.fieldSort("callTime").order(SortOrder.DESC))
//
//
.withSort(SortBuilders.fieldSort("callTime").order(SortOrder.DESC))
//过滤条件
//
//过滤条件
.
withQuery
(
boolMust
);
//
.withQuery(boolMust);
//
// 对高亮词条进行操作
//
//
对高亮词条进行操作
SearchHits
<
ESAlertCalled
>
searchHits
=
elasticsearchTemplate
.
search
(
queryBuilder
.
build
(),
ESAlertCalled
.
class
);
//
SearchHits<ESAlertCalled> searchHits =elasticsearchTemplate.search(queryBuilder.build(), ESAlertCalled.class);
//
List
<
ESAlertCalledDto
>
list
=
new
LinkedList
<>();
//
List<ESAlertCalledDto> list = new LinkedList<>();
for
(
SearchHit
searchHit
:
searchHits
.
getSearchHits
())
//
for (SearchHit searchHit : searchHits.getSearchHits())
{
//
{
JSONObject
jsonObject
=
(
JSONObject
)
JSONObject
.
toJSON
(
searchHit
.
getContent
());
//
JSONObject jsonObject = (JSONObject) JSONObject.toJSON(searchHit.getContent());
ESAlertCalledDto
eSAlertCalled
=
JSONObject
.
toJavaObject
(
jsonObject
,
ESAlertCalledDto
.
class
);
//
ESAlertCalledDto eSAlertCalled =JSONObject.toJavaObject(jsonObject, ESAlertCalledDto.class);
list
.
add
(
eSAlertCalled
);
//
list.add(eSAlertCalled);
}
//
}
result
.
setRecords
(
list
);
//
result.setRecords(list);
result
.
setTotal
(
searchHits
.
getTotalHits
());
//
result.setTotal(searchHits.getTotalHits());
//
return
result
;
//
return result;
}
//
}
//
}
//
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-jcs-biz/src/main/java/com/yeejoin/amos/boot/module/jcs/biz/service/impl/PowerTransferServiceImpl.java
View file @
b9725bdc
...
@@ -2,7 +2,9 @@ package com.yeejoin.amos.boot.module.jcs.biz.service.impl;
...
@@ -2,7 +2,9 @@ package com.yeejoin.amos.boot.module.jcs.biz.service.impl;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.google.common.collect.Lists
;
import
com.google.common.collect.Lists
;
import
com.yeejoin.amos.boot.biz.common.utils.TreeParser
;
import
com.yeejoin.amos.boot.module.jcs.api.dto.FireCarDto
;
import
com.yeejoin.amos.boot.module.jcs.api.dto.FireCarDto
;
import
com.yeejoin.amos.boot.module.jcs.api.dto.FireTeamDto
;
import
com.yeejoin.amos.boot.module.jcs.api.dto.PowerTransferCompanyDto
;
import
com.yeejoin.amos.boot.module.jcs.api.dto.PowerTransferCompanyDto
;
import
com.yeejoin.amos.boot.module.jcs.api.dto.PowerTransferCompanyResourcesDto
;
import
com.yeejoin.amos.boot.module.jcs.api.dto.PowerTransferCompanyResourcesDto
;
import
com.yeejoin.amos.boot.module.jcs.api.dto.PowerTransferDto
;
import
com.yeejoin.amos.boot.module.jcs.api.dto.PowerTransferDto
;
...
@@ -13,15 +15,11 @@ import com.yeejoin.amos.boot.module.jcs.api.entity.PowerTransfer;
...
@@ -13,15 +15,11 @@ import com.yeejoin.amos.boot.module.jcs.api.entity.PowerTransfer;
import
com.yeejoin.amos.boot.module.jcs.api.entity.PowerTransferCompany
;
import
com.yeejoin.amos.boot.module.jcs.api.entity.PowerTransferCompany
;
import
com.yeejoin.amos.boot.module.jcs.api.entity.PowerTransferCompanyResources
;
import
com.yeejoin.amos.boot.module.jcs.api.entity.PowerTransferCompanyResources
;
import
com.yeejoin.amos.boot.module.jcs.api.entity.Template
;
import
com.yeejoin.amos.boot.module.jcs.api.entity.Template
;
import
com.yeejoin.amos.boot.module.jcs.api.enums.FireBrigadeTypeEnum
;
import
com.yeejoin.amos.boot.module.jcs.api.enums.FireCarStatusEnum
;
import
com.yeejoin.amos.boot.module.jcs.api.enums.FireCarStatusEnum
;
import
com.yeejoin.amos.boot.module.jcs.api.feign.EquipFeignClient
;
import
com.yeejoin.amos.boot.module.jcs.api.mapper.PowerTransferMapper
;
import
com.yeejoin.amos.boot.module.jcs.api.mapper.PowerTransferMapper
;
import
com.yeejoin.amos.boot.module.jcs.api.service.EquipFeignService
;
import
com.yeejoin.amos.boot.module.jcs.api.service.IAlertCalledService
;
import
com.yeejoin.amos.boot.module.jcs.api.service.IAlertFormValueService
;
import
com.yeejoin.amos.boot.module.jcs.api.service.IPowerTransferCompanyResourcesService
;
import
com.yeejoin.amos.boot.module.jcs.api.service.IPowerTransferCompanyService
;
import
com.yeejoin.amos.boot.module.jcs.api.service.IPowerTransferService
;
import
com.yeejoin.amos.boot.module.jcs.api.service.IPowerTransferService
;
import
com.yeejoin.amos.boot.module.jcs.api.service.ITemplateService
;
import
com.yeejoin.amos.boot.module.jcs.api.vo.PowerTransferCompanyResourcesVo
;
import
com.yeejoin.amos.boot.module.jcs.api.vo.PowerTransferCompanyResourcesVo
;
import
com.yeejoin.amos.boot.module.jcs.api.vo.PowerTransferCompanyVo
;
import
com.yeejoin.amos.boot.module.jcs.api.vo.PowerTransferCompanyVo
;
import
com.yeejoin.amos.boot.module.jcs.api.vo.PowerTransferVo
;
import
com.yeejoin.amos.boot.module.jcs.api.vo.PowerTransferVo
;
...
@@ -31,6 +29,7 @@ import org.springframework.beans.BeanUtils;
...
@@ -31,6 +29,7 @@ import org.springframework.beans.BeanUtils;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.util.CollectionUtils
;
import
org.typroject.tyboot.core.foundation.utils.Bean
;
import
org.typroject.tyboot.core.foundation.utils.Bean
;
import
org.typroject.tyboot.core.rdbms.service.BaseService
;
import
org.typroject.tyboot.core.rdbms.service.BaseService
;
import
org.typroject.tyboot.core.restful.utils.ResponseModel
;
import
org.typroject.tyboot.core.restful.utils.ResponseModel
;
...
@@ -66,11 +65,12 @@ public class PowerTransferServiceImpl extends BaseService<PowerTransferDto, Powe
...
@@ -66,11 +65,12 @@ public class PowerTransferServiceImpl extends BaseService<PowerTransferDto, Powe
AlertFormValueServiceImpl
alertFormValueService
;
AlertFormValueServiceImpl
alertFormValueService
;
@Autowired
@Autowired
EquipFeign
Service
equipFeignService
;
EquipFeign
Client
equipFeignService
;
@Autowired
@Autowired
FireTeamServiceImpl
fireTeamService
;
FireTeamServiceImpl
fireTeamService
;
@Override
public
PowerTransferVo
getPowerTransferList
(
Long
alertCalledId
)
{
public
PowerTransferVo
getPowerTransferList
(
Long
alertCalledId
)
{
List
<
PowerTransferCompanyResourcesVo
>
powerTransferList
=
List
<
PowerTransferCompanyResourcesVo
>
powerTransferList
=
this
.
baseMapper
.
getPowerTransferList
(
alertCalledId
);
this
.
baseMapper
.
getPowerTransferList
(
alertCalledId
);
...
@@ -132,7 +132,29 @@ public class PowerTransferServiceImpl extends BaseService<PowerTransferDto, Powe
...
@@ -132,7 +132,29 @@ public class PowerTransferServiceImpl extends BaseService<PowerTransferDto, Powe
});
});
}
}
// 2.查询消防队伍列表
// 2.查询消防队伍列表
List
<
FireTeam
>
fullTimeFireBrigadeList
=
fireTeamService
.
list
(
new
QueryWrapper
<
FireTeam
>().
eq
(
"type_code"
,
""
));
List
<
FireTeam
>
fullTimeFireBrigadeList
=
fireTeamService
.
list
(
new
QueryWrapper
<
FireTeam
>().
eq
(
"type_code"
,
FireBrigadeTypeEnum
.
专职消防队
.
getCode
()));
List
<
FireTeam
>
monitorFireBrigadeList
=
fireTeamService
.
list
(
new
QueryWrapper
<
FireTeam
>().
eq
(
"type_code"
,
FireBrigadeTypeEnum
.
监控大队
.
getCode
()));
// 3.组装专职消防队伍车辆
// List<FireTeamDto> fireTeamDtoList = Lists.newArrayList();
// if (!CollectionUtils.isEmpty(fullTimeFireBrigadeList)) {
// fullTimeFireBrigadeList.forEach(brigade -> {
// FireTeamDto teamDto = new FireTeamDto();
// BeanUtils.copyProperties(brigade, teamDto);
// teamDto.setType(FireBrigadeTypeEnum.专职消防队.getKey());
//
//// teamDto.setChildren();
// });
// }
fireCarDtoList
.
stream
().
collect
(
Collectors
.
groupingBy
(
FireCarDto:
:
getTeamId
));
try
{
TreeParser
.
getTree
(
null
,
monitorFireBrigadeList
,
FireTeam
.
class
.
getName
(),
"getSequenceNbr"
,
2
,
"getName"
,
"getParent"
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
}
private
List
<
PowerTransferCompanyResources
>
DtoEntityBatchConvert
(
List
<
PowerTransferCompanyResourcesDto
>
powerTransferCompanyResourcesDtoList
,
Long
powerTransferCompanySequenceNbr
)
{
private
List
<
PowerTransferCompanyResources
>
DtoEntityBatchConvert
(
List
<
PowerTransferCompanyResourcesDto
>
powerTransferCompanyResourcesDtoList
,
Long
powerTransferCompanySequenceNbr
)
{
...
@@ -207,6 +229,7 @@ public class PowerTransferServiceImpl extends BaseService<PowerTransferDto, Powe
...
@@ -207,6 +229,7 @@ public class PowerTransferServiceImpl extends BaseService<PowerTransferDto, Powe
}
}
}
}
@Override
public
List
<
PowerTransferCompanyVo
>
getLastPowerTransferCompany
(
Long
alertCalledId
)
{
public
List
<
PowerTransferCompanyVo
>
getLastPowerTransferCompany
(
Long
alertCalledId
)
{
return
this
.
baseMapper
.
getLastPowerTransferCompany
(
alertCalledId
);
return
this
.
baseMapper
.
getLastPowerTransferCompany
(
alertCalledId
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment