Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
H
haoban-manage3.0
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
haoban3.0
haoban-manage3.0
Commits
44bb1cb3
Commit
44bb1cb3
authored
Jul 14, 2022
by
guojx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
日志管理前端接口
parent
bcb8599c
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
271 additions
and
0 deletions
+271
-0
pom.xml
haoban-manage3-web/pom.xml
+6
-0
LogRecordController.java
.../manage/web/controller/logrecord/LogRecordController.java
+150
-0
LogRecordQo.java
...a/com/gic/haoban/manage/web/qo/logrecord/LogRecordQo.java
+85
-0
LogRecordTypeVO.java
...m/gic/haoban/manage/web/vo/logrecord/LogRecordTypeVO.java
+27
-0
dubbo-haoban-manage-web.xml
...3-web/src/main/webapp/WEB-INF/dubbo-haoban-manage-web.xml
+3
-0
No files found.
haoban-manage3-web/pom.xml
View file @
44bb1cb3
...
@@ -198,6 +198,12 @@
...
@@ -198,6 +198,12 @@
<artifactId>
gic-webapp-common
</artifactId>
<artifactId>
gic-webapp-common
</artifactId>
<version>
${gic-webapp-common}
</version>
<version>
${gic-webapp-common}
</version>
</dependency>
</dependency>
<dependency>
<groupId>
com.gic
</groupId>
<artifactId>
gic-ds-mongo-api
</artifactId>
<version>
${gic-ds-mongo-api}
</version>
</dependency>
</dependencies>
</dependencies>
<build>
<build>
...
...
haoban-manage3-web/src/main/java/com/gic/haoban/manage/web/controller/logrecord/LogRecordController.java
0 → 100644
View file @
44bb1cb3
package
com
.
gic
.
haoban
.
manage
.
web
.
controller
.
logrecord
;
import
com.alibaba.fastjson.JSON
;
import
com.gic.api.base.commons.Page
;
import
com.gic.dsmongo.api.dto.DocumentResultDTO
;
import
com.gic.dsmongo.api.dto.QueryDocDTO
;
import
com.gic.dsmongo.api.service.MongoOperationService
;
import
com.gic.haoban.base.api.common.pojo.dto.WebLoginDTO
;
import
com.gic.haoban.common.utils.AuthWebRequestUtil
;
import
com.gic.haoban.manage.web.qo.logrecord.LogRecordQo
;
import
com.gic.haoban.manage.web.vo.logrecord.LogRecordTypeVO
;
import
com.gic.log.record.bean.GicLogRecordBean
;
import
com.gic.log.record.util.GicLogRecordCategoryEnum
;
import
com.gic.log.record.util.GicLogRecordOptTypeEnum
;
import
com.gic.log.record.util.LogCommenUtil
;
import
com.gic.web.common.controller.DefaultController
;
import
com.gic.web.common.utils.Response
;
import
com.mongodb.BasicDBObject
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.time.DateUtils
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
import
org.bson.conversions.Bson
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
java.util.*
;
@Controller
@RequestMapping
(
"/log-record"
)
public
class
LogRecordController
extends
DefaultController
{
private
static
final
Logger
LOGGER
=
LogManager
.
getLogger
(
LogRecordController
.
class
);
@Autowired
MongoOperationService
mongoOperationService
;
/**
* 系统类型 0gic 1好办
*/
private
static
Integer
systemType
=
1
;
@RequestMapping
(
"/list"
)
@ResponseBody
public
Response
pageLog
(
LogRecordQo
qo
,
@RequestParam
(
defaultValue
=
"1"
)
int
pageNum
,
@RequestParam
(
defaultValue
=
"20"
)
int
pageSize
){
WebLoginDTO
loginUser
=
AuthWebRequestUtil
.
getLoginUser
();
String
eid
=
qo
.
getEnterpriseId
()
;
if
(
null
!=
loginUser
&&
StringUtils
.
isEmpty
(
eid
))
{
eid
=
loginUser
.
getEnterpriseId
()
;
}
QueryDocDTO
doc
=
new
QueryDocDTO
();
doc
.
setSkip
((
pageNum
-
1
)*
pageSize
);
doc
.
setLimit
(
pageSize
);
String
mongoName
=
LogCommenUtil
.
getMongoName
();
doc
.
setDatabaseName
(
mongoName
);
doc
.
setCountFlag
(
true
);
BasicDBObject
filter
=
new
BasicDBObject
().
append
(
"enterpriseId"
,
eid
);
filter
.
append
(
"statusFlag"
,
1
);
//
filter
.
append
(
"systemType"
,
systemType
);
filter
.
append
(
"wxEnterpriseId"
,
loginUser
.
getWxEnterpriseId
());
if
(
StringUtils
.
isNotBlank
(
qo
.
getBusinessType
()))
{
filter
.
append
(
"businessType"
,
qo
.
getBusinessType
());
}
if
(
StringUtils
.
isNotBlank
(
qo
.
getOptType
()))
{
filter
.
append
(
"optType"
,
qo
.
getOptType
());
}
if
(
StringUtils
.
isNoneBlank
(
qo
.
getStartDate
(),
qo
.
getEndDate
()))
{
String
endDate
=
qo
.
getEndDate
()
+
" 23:59:59"
;
String
startDate
=
qo
.
getStartDate
()
+
" 00:00:00"
;
try
{
Date
startDateD
=
DateUtils
.
parseDate
(
startDate
,
"yyyy-MM-dd HH:mm:ss"
);
Date
endDateD
=
DateUtils
.
parseDate
(
endDate
,
"yyyy-MM-dd HH:mm:ss"
);
filter
.
append
(
"createTime"
,
new
BasicDBObject
(
"$gte"
,
startDateD
).
append
(
"$lte"
,
endDateD
));
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
// if(null == loginUser || StringUtils.isBlank(loginUser.getOperationUserName())) {
// filter.append("ywFlag", new BasicDBObject("$ne",1)) ;
// }
LOGGER
.
info
(
JSON
.
toJSONString
(
filter
));
doc
.
setFilter
(
filter
);
Bson
sort
=
new
BasicDBObject
().
append
(
"createTime"
,
-
1
);
doc
.
setSort
(
sort
);
doc
.
setSingleObject
(
new
GicLogRecordBean
());
Map
<
String
,
String
>
map
=
new
HashMap
<
String
,
String
>();
if
(
StringUtils
.
isNotBlank
(
qo
.
getSearch
()))
{
filter
.
append
(
"content"
,
new
BasicDBObject
(
"$regex"
,
qo
.
getSearch
()));
}
if
(
StringUtils
.
isNotBlank
(
qo
.
getOptUser
()))
{
filter
.
append
(
"userId"
,
qo
.
getOptUser
());
}
DocumentResultDTO
documentResultDTO
=
mongoOperationService
.
queryManyDocumentForMongo
(
doc
);
Page
<
Object
>
retPage
=
new
Page
<>();
retPage
.
setResult
(
documentResultDTO
.
getDocList
());
retPage
.
setTotalCount
(
Long
.
valueOf
(
documentResultDTO
.
getTotalCount
()).
intValue
());
retPage
.
setPageSize
(
pageSize
);
retPage
.
setCurrentPage
(
pageNum
);
return
this
.
success
(
retPage
);
}
/**
* 获取 业务模块
* @return
*/
@RequestMapping
(
"business-types"
)
@ResponseBody
public
Response
businessTypes
(){
List
<
LogRecordTypeVO
>
ret
=
new
ArrayList
<>();
GicLogRecordCategoryEnum
[]
values
=
GicLogRecordCategoryEnum
.
values
();
for
(
GicLogRecordCategoryEnum
value
:
values
)
{
if
(
Objects
.
equals
(
value
.
getSystemType
(),
systemType
))
{
LogRecordTypeVO
mid
=
new
LogRecordTypeVO
();
mid
.
setKey
(
value
.
getType
());
mid
.
setValue
(
value
.
getName
());
ret
.
add
(
mid
);
}
}
return
this
.
success
(
ret
);
}
/**
* 获取 操作类型
* @return
*/
@RequestMapping
(
"opt-types"
)
@ResponseBody
public
Response
optTypes
(){
List
<
LogRecordTypeVO
>
ret
=
new
ArrayList
<>();
GicLogRecordOptTypeEnum
[]
values
=
GicLogRecordOptTypeEnum
.
values
();
for
(
GicLogRecordOptTypeEnum
value
:
values
)
{
if
(
Objects
.
equals
(
value
.
getSystemType
(),
systemType
))
{
LogRecordTypeVO
mid
=
new
LogRecordTypeVO
();
mid
.
setKey
(
value
.
getType
());
mid
.
setValue
(
value
.
getName
());
ret
.
add
(
mid
);
}
}
return
this
.
success
(
ret
);
}
}
haoban-manage3-web/src/main/java/com/gic/haoban/manage/web/qo/logrecord/LogRecordQo.java
0 → 100644
View file @
44bb1cb3
package
com
.
gic
.
haoban
.
manage
.
web
.
qo
.
logrecord
;
import
java.io.Serializable
;
/**
* 日志入参
*/
public
class
LogRecordQo
implements
Serializable
{
private
String
businessType
;
private
String
optType
;
private
String
optUser
;
private
String
search
;
private
String
startDate
;
private
String
endDate
;
private
String
enterpriseId
;
/**
* 好办字段
*/
private
String
wxEnterpriseId
;
public
String
getEnterpriseId
()
{
return
enterpriseId
;
}
public
void
setEnterpriseId
(
String
enterpriseId
)
{
this
.
enterpriseId
=
enterpriseId
;
}
public
String
getStartDate
()
{
return
startDate
;
}
public
void
setStartDate
(
String
startDate
)
{
this
.
startDate
=
startDate
;
}
public
String
getEndDate
()
{
return
endDate
;
}
public
void
setEndDate
(
String
endDate
)
{
this
.
endDate
=
endDate
;
}
public
String
getBusinessType
()
{
return
businessType
;
}
public
void
setBusinessType
(
String
businessType
)
{
this
.
businessType
=
businessType
;
}
public
String
getOptType
()
{
return
optType
;
}
public
void
setOptType
(
String
optType
)
{
this
.
optType
=
optType
;
}
public
String
getOptUser
()
{
return
optUser
;
}
public
void
setOptUser
(
String
optUser
)
{
this
.
optUser
=
optUser
;
}
public
String
getSearch
()
{
return
search
;
}
public
void
setSearch
(
String
search
)
{
this
.
search
=
search
;
}
public
String
getWxEnterpriseId
()
{
return
wxEnterpriseId
;
}
public
LogRecordQo
setWxEnterpriseId
(
String
wxEnterpriseId
)
{
this
.
wxEnterpriseId
=
wxEnterpriseId
;
return
this
;
}
}
haoban-manage3-web/src/main/java/com/gic/haoban/manage/web/vo/logrecord/LogRecordTypeVO.java
0 → 100644
View file @
44bb1cb3
package
com
.
gic
.
haoban
.
manage
.
web
.
vo
.
logrecord
;
import
java.io.Serializable
;
/**
* 日志出参
*/
public
class
LogRecordTypeVO
implements
Serializable
{
private
String
key
;
private
String
value
;
public
String
getKey
()
{
return
key
;
}
public
void
setKey
(
String
key
)
{
this
.
key
=
key
;
}
public
String
getValue
()
{
return
value
;
}
public
void
setValue
(
String
value
)
{
this
.
value
=
value
;
}
}
haoban-manage3-web/src/main/webapp/WEB-INF/dubbo-haoban-manage-web.xml
View file @
44bb1cb3
...
@@ -113,4 +113,7 @@
...
@@ -113,4 +113,7 @@
timeout=
"10000"
retries=
"0"
check=
"false"
/>
timeout=
"10000"
retries=
"0"
check=
"false"
/>
<dubbo:reference
id=
"hmQrcodeApiService"
interface=
"com.gic.haoban.manage.api.service.hm.HmQrcodeApiService"
<dubbo:reference
id=
"hmQrcodeApiService"
interface=
"com.gic.haoban.manage.api.service.hm.HmQrcodeApiService"
timeout=
"10000"
retries=
"0"
check=
"false"
/>
timeout=
"10000"
retries=
"0"
check=
"false"
/>
<dubbo:reference
id=
"mongoOperationService"
interface=
"com.gic.dsmongo.api.service.MongoOperationService"
timeout=
"10000"
retries=
"0"
check=
"false"
/>
</beans>
</beans>
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