Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
map-parent
Overview
Overview
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
常超
map-parent
Commits
a2a92f90
Commit
a2a92f90
authored
Mar 09, 2021
by
cc150520900118
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
调整返回参数
parent
93e10307
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
59 additions
and
61 deletions
+59
-61
common/common_utils/src/main/java/com/founder/commonutils/publicEntity/MapRestResult.java
+17
-20
common/service_base/src/main/java/com/founder/servicebase/exceptionhandler/GlobalExceptionHandler.java
+7
-7
service/asj/src/main/java/com/founder/asj/controller/TbStAsjController.java
+14
-14
service/es/src/main/java/com/founder/eszy/controller/EsExtractController.java
+3
-3
service/es/src/main/java/com/founder/eszy/controller/EsQueryController.java
+8
-7
service/es/src/main/java/com/founder/eszy/esExtract/EsTbZyJzxxTranslation.java
+2
-2
service/publicapi/src/main/java/com/founder/publicapi/controller/RyController.java
+8
-8
No files found.
common/common_utils/src/main/java/com/founder/commonutils/publicEntity/
R
.java
→
common/common_utils/src/main/java/com/founder/commonutils/publicEntity/
MapRestResult
.java
View file @
a2a92f90
package
com
.
founder
.
commonutils
.
publicEntity
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.util.HashMap
;
import
java.util.Map
;
//统一返回结果的类
@Data
public
class
R
{
public
class
MapRestResult
<
T
>
{
@ApiModelProperty
(
value
=
"是否成功"
)
private
Boolean
success
;
...
...
@@ -21,15 +17,18 @@ public class R {
@ApiModelProperty
(
value
=
"返回消息"
)
private
String
message
;
@ApiModelProperty
(
value
=
"数据总数(分页总数时使用)"
)
private
Object
count
;
@ApiModelProperty
(
value
=
"返回数据"
)
private
Map
<
String
,
Object
>
data
=
new
HashMap
<
String
,
Object
>()
;
private
T
data
;
//把构造方法私有
private
R
()
{}
private
MapRestResult
()
{}
//成功静态方法
public
static
R
ok
()
{
R
r
=
new
R
();
public
static
MapRestResult
ok
()
{
MapRestResult
r
=
new
MapRestResult
();
r
.
setSuccess
(
true
);
r
.
setCode
(
ResultCode
.
SUCCESS
);
r
.
setMessage
(
"成功"
);
...
...
@@ -37,36 +36,34 @@ public class R {
}
//失败静态方法
public
static
R
error
()
{
R
r
=
new
R
();
public
static
MapRestResult
error
()
{
MapRestResult
r
=
new
MapRestResult
();
r
.
setSuccess
(
false
);
r
.
setCode
(
ResultCode
.
ERROR
);
r
.
setMessage
(
"失败"
);
return
r
;
}
public
R
success
(
Boolean
success
){
public
MapRestResult
success
(
Boolean
success
){
this
.
setSuccess
(
success
);
return
this
;
}
public
R
message
(
String
message
){
public
MapRestResult
message
(
String
message
){
this
.
setMessage
(
message
);
return
this
;
}
public
R
code
(
Integer
code
){
public
MapRestResult
code
(
Integer
code
){
this
.
setCode
(
code
);
return
this
;
}
public
R
data
(
String
key
,
Object
value
){
this
.
data
.
put
(
key
,
value
);
public
MapRestResult
count
(
Object
count
){
this
.
setCount
(
count
);
return
this
;
}
public
R
data
(
Map
<
String
,
Object
>
map
){
this
.
setData
(
map
);
public
MapRestResult
data
(
T
data
){
this
.
data
=
data
;
return
this
;
}
}
common/service_base/src/main/java/com/founder/servicebase/exceptionhandler/GlobalExceptionHandler.java
View file @
a2a92f90
package
com
.
founder
.
servicebase
.
exceptionhandler
;
import
com.founder.commonutils.publicEntity.
R
;
import
com.founder.commonutils.publicEntity.
MapRestResult
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.web.bind.annotation.ControllerAdvice
;
import
org.springframework.web.bind.annotation.ExceptionHandler
;
...
...
@@ -14,27 +14,27 @@ public class GlobalExceptionHandler {
//指定出现什么异常执行这个方法
@ExceptionHandler
(
Exception
.
class
)
@ResponseBody
//为了返回数据
public
R
error
(
Exception
e
)
{
public
MapRestResult
error
(
Exception
e
)
{
e
.
printStackTrace
();
return
R
.
error
().
message
(
"执行了全局异常处理.."
);
return
MapRestResult
.
error
().
message
(
"执行了全局异常处理.."
);
}
//特定异常
@ExceptionHandler
(
ArithmeticException
.
class
)
@ResponseBody
//为了返回数据
public
R
error
(
ArithmeticException
e
)
{
public
MapRestResult
error
(
ArithmeticException
e
)
{
e
.
printStackTrace
();
return
R
.
error
().
message
(
"执行了ArithmeticException异常处理.."
);
return
MapRestResult
.
error
().
message
(
"执行了ArithmeticException异常处理.."
);
}
//自定义异常
@ExceptionHandler
(
GuliException
.
class
)
@ResponseBody
//为了返回数据
public
R
error
(
GuliException
e
)
{
public
MapRestResult
error
(
GuliException
e
)
{
log
.
error
(
e
.
getMessage
());
e
.
printStackTrace
();
return
R
.
error
().
code
(
e
.
getCode
()).
message
(
e
.
getMsg
());
return
MapRestResult
.
error
().
code
(
e
.
getCode
()).
message
(
e
.
getMsg
());
}
}
service/asj/src/main/java/com/founder/asj/controller/TbStAsjController.java
View file @
a2a92f90
...
...
@@ -9,7 +9,7 @@ import com.founder.asj.service.TbStAsjService;
import
com.founder.commonutils.asjEntity.AsjQuery
;
import
com.founder.commonutils.asjEntity.CbxszAndXlaj
;
import
com.founder.commonutils.asjEntity.TbStAsj
;
import
com.founder.commonutils.publicEntity.
R
;
import
com.founder.commonutils.publicEntity.
MapRestResult
;
import
com.founder.commonutils.publicEntity.Receiving
;
import
com.founder.servicebase.logs.OperLog
;
import
com.founder.servicebase.logs.OperationType
;
...
...
@@ -48,17 +48,17 @@ public class TbStAsjController {
@OperLog
(
message
=
"获取同类案件信息//案件查询"
,
operation
=
OperationType
.
QUERY
)
@ApiOperation
(
value
=
"获取同类案件信息//案件查询(存储reids)"
)
@PostMapping
(
"/ajxx"
)
public
R
selectAsjxx
(
@RequestBody
Receiving
receiving
)
{
public
MapRestResult
selectAsjxx
(
@RequestBody
Receiving
receiving
)
{
receiving
.
setSsdw
(
ssdw
);
//设置所属单位,用于案件类别代码转译
//return tbStAsjService.selectAsjxxList(receiving);
List
<
TbStAsj
>
asjList
=
tbStAsjService
.
selectAsjxxList
(
receiving
);
return
R
.
ok
().
data
(
"data"
,
asjList
);
return
MapRestResult
.
ok
().
data
(
asjList
);
}
@OperLog
(
message
=
"按条件查询案件"
,
operation
=
OperationType
.
QUERY
)
@ApiOperation
(
value
=
"按条件查询案件"
)
@PostMapping
(
"getAsj"
)
public
R
getAsj
(
@RequestBody
AsjQuery
asjQuery
)
{
public
MapRestResult
getAsj
(
@RequestBody
AsjQuery
asjQuery
)
{
QueryWrapper
<
TbStAsj
>
wrapper
=
new
QueryWrapper
<>();
String
asjbh
=
asjQuery
.
getAsjbh
();
String
ajmc
=
asjQuery
.
getAjmc
();
...
...
@@ -82,26 +82,26 @@ public class TbStAsjController {
wrapper
.
le
(
"ASJFSSJ_ASJFSJSSJ"
,
end
);
}
List
<
TbStAsj
>
list
=
tbStAsjService
.
list
(
wrapper
);
return
R
.
ok
().
data
(
"asj"
,
list
);
return
MapRestResult
.
ok
().
data
(
list
);
}
@OperLog
(
message
=
"获取所有案件(带分页)"
,
operation
=
OperationType
.
QUERY
)
@ApiOperation
(
value
=
"获取所有案件(带分页)"
)
@GetMapping
(
"getPageAsj/{current}/{limit}"
)
public
R
getPageAsj
(
@PathVariable
long
current
,
public
MapRestResult
getPageAsj
(
@PathVariable
long
current
,
@PathVariable
long
limit
)
{
//创建page对象
Page
<
TbStAsj
>
pageAsj
=
new
Page
<>(
current
,
limit
);
tbStAsjService
.
page
(
pageAsj
,
null
);
long
total
=
pageAsj
.
getTotal
();
//总记录数
List
<
TbStAsj
>
records
=
pageAsj
.
getRecords
();
//数据list集合
return
R
.
ok
().
data
(
"total"
,
total
).
data
(
"rows"
,
records
);
return
MapRestResult
.
ok
().
count
(
total
).
data
(
records
);
}
@OperLog
(
message
=
"带条件查询所有案件(带分页)"
,
operation
=
OperationType
.
QUERY
)
@ApiOperation
(
value
=
"带条件查询所有案件(带分页)"
)
@PostMapping
(
"getPageAsjCondition/{current}/{limit}"
)
public
R
getPageAsjCondition
(
@PathVariable
long
current
,
@PathVariable
long
limit
,
public
MapRestResult
getPageAsjCondition
(
@PathVariable
long
current
,
@PathVariable
long
limit
,
@RequestBody
(
required
=
false
)
AsjQuery
asjQuery
)
{
//创建page对象
Page
<
TbStAsj
>
pageAsj
=
new
Page
<>(
current
,
limit
);
...
...
@@ -132,18 +132,18 @@ public class TbStAsjController {
tbStAsjService
.
page
(
pageAsj
,
wrapper
);
long
total
=
pageAsj
.
getTotal
();
//总记录数
List
<
TbStAsj
>
records
=
pageAsj
.
getRecords
();
//数据list集合
return
R
.
ok
().
data
(
"total"
,
total
).
data
(
"rows"
,
records
);
return
MapRestResult
.
ok
().
count
(
total
).
data
(
records
);
}
@OperLog
(
message
=
"修改案件"
,
operation
=
OperationType
.
QUERY
)
@ApiOperation
(
value
=
"修改案件"
)
@PutMapping
(
"updateAsj"
)
public
R
updateAsj
(
@RequestBody
TbStAsj
tbStAsj
)
{
public
MapRestResult
updateAsj
(
@RequestBody
TbStAsj
tbStAsj
)
{
boolean
flag
=
tbStAsjService
.
updateById
(
tbStAsj
);
if
(
flag
)
{
return
R
.
ok
();
return
MapRestResult
.
ok
();
}
else
{
return
R
.
error
();
return
MapRestResult
.
error
();
}
}
...
...
@@ -191,7 +191,7 @@ public class TbStAsjController {
@OperLog
(
message
=
"获取串并线索组信息"
,
operation
=
OperationType
.
QUERY
)
@ApiOperation
(
value
=
"获取串并线索组信息"
)
@PostMapping
(
"/getAsjxxCbzAndXlaj"
)
public
R
getAsjxxCbzAndXlaj
(
@ApiParam
(
name
=
"asjbh"
,
value
=
"案事件编号"
)
public
MapRestResult
getAsjxxCbzAndXlaj
(
@ApiParam
(
name
=
"asjbh"
,
value
=
"案事件编号"
)
@RequestParam
(
required
=
true
)
String
asjbh
)
{
JSONObject
acb
=
new
JSONObject
();
JSONObject
a
=
new
JSONObject
();
...
...
@@ -432,7 +432,7 @@ public class TbStAsjController {
}
System
.
out
.
println
(
"线索组和串并组返回的Alllist="
+
acb
.
toString
());
return
R
.
ok
().
data
(
acb
);
return
MapRestResult
.
ok
().
data
(
acb
);
}
}
service/es/src/main/java/com/founder/eszy/controller/EsExtractController.java
View file @
a2a92f90
package
com
.
founder
.
eszy
.
controller
;
import
com.founder.commonutils.publicEntity.
R
;
import
com.founder.commonutils.publicEntity.
MapRestResult
;
import
com.founder.eszy.esExtract.EsTbZyJzxxTranslation
;
import
com.founder.eszy.esSearch.esSearch
;
import
io.swagger.annotations.ApiOperation
;
...
...
@@ -23,7 +23,7 @@ public class EsExtractController {
//基站
@ApiOperation
(
value
=
"基站es全量抽取"
)
@GetMapping
(
"/jzxx"
)
public
R
syss
()
{
public
MapRestResult
syss
()
{
System
.
out
.
println
(
"jzxxES开始========================="
);
try
{
esTbZyJzxxTranslation
.
SyssEsSave
();
...
...
@@ -31,6 +31,6 @@ public class EsExtractController {
e
.
printStackTrace
();
}
int
count
=
(
int
)
esSearch
.
EScount
(
jz_index
);
return
R
.
ok
().
message
(
"基站数据抽取完成"
+
count
);
return
MapRestResult
.
ok
().
message
(
"基站数据抽取完成"
+
count
);
}
}
service/es/src/main/java/com/founder/eszy/controller/EsQueryController.java
View file @
a2a92f90
...
...
@@ -6,7 +6,10 @@ import com.founder.eszy.esSearch.EsTbZyJzxxTranslationQuery;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.util.StringUtils
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.ArrayList
;
import
java.util.List
;
...
...
@@ -20,7 +23,7 @@ public class EsQueryController {
//基站搜索
@ApiOperation
(
value
=
"基站查询"
)
@RequestMapping
(
value
=
"/getTbZyJzxxList"
,
method
=
RequestMethod
.
POST
)
public
R
getTbZyJzxxList
(
@RequestBody
RequestBean
bean
)
throws
Exception
{
public
MapRestResult
getTbZyJzxxList
(
@RequestBody
RequestBean
bean
)
throws
Exception
{
List
<
Map
<
String
,
Object
>>
result
=
new
ArrayList
<>();
//按区域范围查询es数据
if
(
bean
.
getGeographicInfo
()!=
null
&&!
StringUtils
.
isEmpty
(
bean
.
getGeographicInfo
())){
...
...
@@ -37,7 +40,7 @@ public class EsQueryController {
}
catch
(
Exception
e
){
e
.
printStackTrace
();
}
return
null
;
return
MapRestResult
.
ok
().
count
(
result
.
size
()).
data
(
result
)
;
//XzxtRestResult.build(200,result.size()+"",result);
}
else
{
try
{
...
...
@@ -45,15 +48,13 @@ public class EsQueryController {
}
catch
(
Exception
e
){
e
.
printStackTrace
();
}
return
null
;
//XzxtRestResult.build(200,result.size()+"",result);
return
MapRestResult
.
ok
().
count
(
result
.
size
()).
data
(
result
);
}
}
//不带区域信息查询es数据
else
{
result
=
esTbZyJzxxTranslationQuery
.
searchQuery
(
bean
.
getIndex
(),
bean
.
getType
(),
null
,
null
);
return
null
;
//XzxtRestResult.build(200,result.size()+"",result);
return
MapRestResult
.
ok
().
count
(
result
.
size
()).
data
(
result
);
}
}
}
service/es/src/main/java/com/founder/eszy/esExtract/EsTbZyJzxxTranslation.java
View file @
a2a92f90
...
...
@@ -2,7 +2,7 @@ package com.founder.eszy.esExtract;
import
com.founder.commonutils.esEntity.TbZyJzxx
;
import
com.founder.commonutils.publicEntity.
R
;
import
com.founder.commonutils.publicEntity.
MapRestResult
;
import
com.founder.commonutils.publicEntity.Receiving
;
import
com.founder.eszy.mapper.TbZyJzxxMapper
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -31,7 +31,7 @@ public class EsTbZyJzxxTranslation {
@Value
(
"${jz_index}"
)
private
String
jz_index
;
//批量导入es--------------------------------------------------------------------
public
R
SyssEsSave
()
throws
Exception
{
public
MapRestResult
SyssEsSave
()
throws
Exception
{
long
start
=
System
.
currentTimeMillis
();
ExecutorService
executorService
=
Executors
.
newCachedThreadPool
();
//按需分配线程池
Receiving
receiving
=
new
Receiving
();
...
...
service/publicapi/src/main/java/com/founder/publicapi/controller/RyController.java
View file @
a2a92f90
package
com
.
founder
.
publicapi
.
controller
;
import
com.founder.commonutils.peopleEntity.TbStRy
;
import
com.founder.commonutils.publicEntity.R
;
import
com.founder.commonutils.publicEntity.RyReceiving
;
import
com.founder.commonutils.carEntity.CarReceiving
;
import
com.founder.commonutils.carEntity.CarRy
;
import
com.founder.commonutils.carEntity.QgjdcModel
;
import
com.founder.commonutils.peopleEntity.TbStRy
;
import
com.founder.commonutils.publicEntity.MapRestResult
;
import
com.founder.commonutils.publicEntity.RyReceiving
;
import
com.founder.commonutils.util.HttpUtil
;
import
com.founder.publicapi.service.SysDictitemService
;
import
com.founder.servicebase.logs.OperLog
;
...
...
@@ -39,7 +39,7 @@ public class RyController {
@ApiOperation
(
value
=
"获取全国常住人口信息"
)
@OperLog
(
message
=
"获取全国常住人口信息"
,
operation
=
OperationType
.
QUERY
)
@PostMapping
(
"/ryxxQg"
)
public
R
getQgckAllxxXml
(
@RequestBody
RyReceiving
receiving
){
public
MapRestResult
getQgckAllxxXml
(
@RequestBody
RyReceiving
receiving
){
TbStRy
ryxx
=
new
TbStRy
();
String
esbServiceReturn
=
""
;
//String url="http://10.100.17.115:8080/NmgEsbQueryService/QueryLocalPersonForOther?conditions=sfzh="+"'"+zjhm+"'";
...
...
@@ -51,7 +51,7 @@ public class RyController {
// TODO: handle exception
}
ryxx
=
getryJbxxxmls
(
esbServiceReturn
);
return
R
.
ok
().
code
(
200
).
message
(
"成功获取全国常口人员信息"
).
data
(
"ryxx"
,
ryxx
);
return
MapRestResult
.
ok
().
code
(
200
).
message
(
"成功获取全国常口人员信息"
).
data
(
ryxx
);
}
public
TbStRy
getryJbxxxmls
(
String
esb_result
){
...
...
@@ -205,7 +205,7 @@ public class RyController {
@OperLog
(
message
=
"查询车辆基本信息-公安部机动车数据查询服务返回"
,
operation
=
OperationType
.
QUERY
)
//查询车辆基本信息-公安部机动车数据查询服务返回
@PostMapping
(
"/getCarxx"
)
public
R
getVehicleTrackCarxx
(
@RequestBody
CarReceiving
carReceiving
){
public
MapRestResult
getVehicleTrackCarxx
(
@RequestBody
CarReceiving
carReceiving
){
String
carNum
=
carReceiving
.
getObjectValue
();
//车牌号
HashMap
<
String
,
String
>
codeMap
=
new
HashMap
<
String
,
String
>();
try
{
...
...
@@ -242,9 +242,9 @@ public class RyController {
carRy
.
setCarType
(
qgjdc
.
getClpp1
());
// 车辆_品牌型号
carRy
.
setHjdqhdz
(
ry
.
getHjdqhdz
());
// 户籍地地址
carRy
.
setCsrq
(
ry
.
getCsrq
());
// 出生日期
return
R
.
ok
().
code
(
200
).
message
(
"成功获取全国车辆人员信息"
).
data
(
"carRy"
,
carRy
);
return
MapRestResult
.
ok
().
code
(
200
).
message
(
"成功获取全国车辆人员信息"
).
data
(
carRy
);
}
catch
(
Exception
e
){
return
R
.
error
().
code
(
500
).
message
(
"请求失败"
).
data
(
null
);
return
MapRestResult
.
error
().
code
(
500
).
message
(
"请求失败"
).
data
(
null
);
}
}
...
...
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