Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
8
8timerapiv200
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
8timerv2
8timerapiv200
Commits
b274f894
Commit
b274f894
authored
Jun 17, 2020
by
tangzhaoqian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
组织管理-部门树查询、ip获取所在地址、审批bug
parent
3ab28ba2
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
69 additions
and
7 deletions
+69
-7
src/main/java/cn/timer/api/aspect/LogAspect.java
+1
-2
src/main/java/cn/timer/api/controller/zzgl/ZzglController.java
+47
-2
src/main/java/cn/timer/api/utils/AddressUtils.java
+19
-2
src/main/java/cn/timer/api/utils/UserIp.java
+1
-0
src/main/java/cn/timer/api/utils/router/RouterUtils.java
+1
-1
No files found.
src/main/java/cn/timer/api/aspect/LogAspect.java
View file @
b274f894
...
...
@@ -94,7 +94,6 @@ public class LogAspect
// 获取当前的用户
// LoginUser loginUser = SpringUtils.getBean(TokenService.class).getLoginUser(ServletUtils.getRequest());
QyzxEmpLogin
eld
=
(
QyzxEmpLogin
)
session
.
getAttribute
(
"ui"
);
System
.
out
.
println
(
eld
);
// *========数据库日志=========*//
QyzxOperLog
operLog
=
new
QyzxOperLog
();
...
...
@@ -110,7 +109,7 @@ public class LogAspect
operLog
.
setOperUrl
(
ServletUtils
.
getRequest
().
getRequestURI
());
if
(
eld
!=
null
)
{
operLog
.
setOperName
(
eld
.
get
Usern
ame
());
operLog
.
setOperName
(
eld
.
get
YgglMainEmp
().
getN
ame
());
}
if
(
e
!=
null
)
...
...
src/main/java/cn/timer/api/controller/zzgl/ZzglController.java
View file @
b274f894
...
...
@@ -2,6 +2,7 @@ package cn.timer.api.controller.zzgl;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.stream.Collectors
;
import
javax.transaction.Transactional
;
...
...
@@ -24,6 +25,7 @@ import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapp
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.github.xiaoymin.knife4j.annotations.ApiOperationSupport
;
import
cn.hutool.core.collection.CollectionUtil
;
import
cn.hutool.core.convert.Convert
;
import
cn.hutool.core.lang.tree.Tree
;
import
cn.hutool.core.lang.tree.TreeNodeConfig
;
...
...
@@ -91,7 +93,7 @@ public class ZzglController {
}
/**
*
架构树/架构图/导出
*
获取部门岗位-升级版
*
* @param
* @return
...
...
@@ -99,7 +101,7 @@ public class ZzglController {
@GetMapping
(
value
=
"/deptlist_plus"
)
@ApiOperation
(
value
=
"1.获取部门岗位-升级版"
,
httpMethod
=
"GET"
,
notes
=
"接口发布说明"
)
@ApiOperationSupport
(
order
=
1
)
public
Result
<
List
<
Tree
<
String
>>>
selectlistdept2
(
@CurrentUser
UserBean
userBean
)
{
public
Result
<
List
<
Tree
<
String
>>>
deptlistPlus
(
@CurrentUser
UserBean
userBean
)
{
Integer
orgCode
=
userBean
.
getOrgCode
();
List
<
ZzglBmgwM
>
zzglBmgwMs
=
new
LambdaQueryChainWrapper
<
ZzglBmgwM
>(
zzglBmgwMMapper
)
.
eq
(
ZzglBmgwM:
:
getOrgCode
,
orgCode
).
list
();
...
...
@@ -134,6 +136,49 @@ public class ZzglController {
return
ResultUtil
.
data
(
treeNodes
);
}
/**
* 获取部门
*
* @param
* @return
*/
@GetMapping
(
value
=
"/depts_tree"
)
@ApiOperation
(
value
=
"2.获取部门"
,
httpMethod
=
"GET"
,
notes
=
"接口发布说明"
)
@ApiOperationSupport
(
order
=
1
)
public
Result
<
List
<
Tree
<
String
>>>
deptsOnlyone
(
@CurrentUser
UserBean
userBean
)
{
Integer
orgCode
=
userBean
.
getOrgCode
();
List
<
ZzglBmgwM
>
zzglBmgwMs
=
new
LambdaQueryChainWrapper
<
ZzglBmgwM
>(
zzglBmgwMMapper
)
.
eq
(
ZzglBmgwM:
:
getOrgCode
,
orgCode
).
list
();
if
(
CollectionUtil
.
isNotEmpty
(
zzglBmgwMs
))
{
zzglBmgwMs
=
zzglBmgwMs
.
stream
().
filter
(
z
->
z
.
getType
()
==
0
).
collect
(
Collectors
.
toList
());
if
(
CollectionUtil
.
isNotEmpty
(
zzglBmgwMs
))
{
//配置
TreeNodeConfig
treeNodeConfig
=
new
TreeNodeConfig
();
// 自定义属性名 都要默认值的
treeNodeConfig
.
setIdKey
(
"id"
);
treeNodeConfig
.
setParentIdKey
(
"upId"
);
//转换器
List
<
Tree
<
String
>>
treeNodes
=
TreeUtil
.
build
(
zzglBmgwMs
,
"0"
,
treeNodeConfig
,
(
treeNode
,
tree
)
->
{
tree
.
setId
(
Convert
.
toStr
(
treeNode
.
getId
()));
tree
.
setParentId
(
Convert
.
toStr
(
treeNode
.
getUpId
()));
tree
.
setName
(
treeNode
.
getName
());
// 扩展属性 ...
tree
.
putExtra
(
"leader"
,
treeNode
.
getLeader
());
tree
.
putExtra
(
"type"
,
treeNode
.
getType
());
});
return
ResultUtil
.
data
(
treeNodes
);
}
}
return
ResultUtil
.
success
();
}
@GetMapping
(
value
=
"/depts"
)
@ApiOperation
(
value
=
"2.获取部门"
,
httpMethod
=
"GET"
,
notes
=
"接口发布说明"
)
@ApiOperationSupport
(
order
=
2
)
...
...
src/main/java/cn/timer/api/utils/AddressUtils.java
View file @
b274f894
package
cn
.
timer
.
api
.
utils
;
import
java.util.HashMap
;
import
java.util.Map
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
com.alibaba.fastjson.JSONObject
;
import
cn.hutool.core.util.StrUtil
;
import
cn.hutool.http.Header
;
import
cn.hutool.http.HttpRequest
;
/**
* 获取地址类
...
...
@@ -15,17 +20,29 @@ public class AddressUtils
{
private
static
final
Logger
log
=
LoggerFactory
.
getLogger
(
AddressUtils
.
class
);
public
static
final
String
IP_URL
=
"http://ip.taobao.com/service/getIpInfo.php"
;
public
static
final
String
IP_URL
=
"http://ip.taobao.com/outGetIpInfo"
;
public
static
Map
<
String
,
Object
>
PARAM_MAP
=
new
HashMap
<
String
,
Object
>();
static
{
PARAM_MAP
.
put
(
"accessKey"
,
"alibaba-inc"
);
}
public
static
String
getRealAddressByIP
(
String
ip
)
{
PARAM_MAP
.
put
(
"ip"
,
ip
);
String
address
=
"XX XX"
;
// 内网不查询
if
(
UserIp
.
internalIp
(
ip
))
{
return
"内网IP"
;
}
String
rspStr
=
HttpUtils
.
sendPost
(
IP_URL
,
"ip="
+
ip
);
//链式构建请求
String
rspStr
=
HttpRequest
.
post
(
IP_URL
)
.
header
(
Header
.
USER_AGENT
,
"Hutool http"
)
//头信息,多个头信息多次调用此方法即可
.
form
(
PARAM_MAP
)
//表单内容
.
timeout
(
20000
)
//超时,毫秒
.
execute
().
body
();
if
(
StrUtil
.
isEmpty
(
rspStr
))
{
log
.
error
(
"获取地理位置异常 {}"
,
ip
);
...
...
src/main/java/cn/timer/api/utils/UserIp.java
View file @
b274f894
...
...
@@ -351,6 +351,7 @@ public class UserIp {
return
macAddress
;
}
}
src/main/java/cn/timer/api/utils/router/RouterUtils.java
View file @
b274f894
...
...
@@ -126,7 +126,7 @@ public class RouterUtils {
case
UNEXECUTED:
listUser
.
get
(
i
).
setExecute
(
EXECUTING
);
// 首次发起申请时,写入 审批人名称 至 obj 中
if
(
isFirse
&&
obj
.
getStr
(
"current_approver"
)
!
=
null
)
{
if
(
isFirse
&&
obj
.
getStr
(
"current_approver"
)
=
=
null
)
{
obj
.
set
(
"current_approver"
,
listUser
.
get
(
i
).
getName
());
}
...
...
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