Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
attendance-performance-platform
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
赵啸非
attendance-performance-platform
Commits
e8957d26
Commit
e8957d26
authored
Apr 13, 2023
by
daijunxiong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改定时任务 修改人员统计 删除其他无用方法
parent
6aa5c7c8
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
80 additions
and
87 deletions
+80
-87
attendance-performance-manager/src/main/java/com/mortals/xhx/daemon/task/SyncUserTaskImpl.java
...in/java/com/mortals/xhx/daemon/task/SyncUserTaskImpl.java
+74
-44
attendance-performance-manager/src/main/java/com/mortals/xhx/module/dept/service/DeptService.java
...java/com/mortals/xhx/module/dept/service/DeptService.java
+0
-6
attendance-performance-manager/src/main/java/com/mortals/xhx/module/dept/service/impl/DeptServiceImpl.java
...mortals/xhx/module/dept/service/impl/DeptServiceImpl.java
+0
-8
attendance-performance-manager/src/main/java/com/mortals/xhx/module/staff/web/StaffController.java
...ava/com/mortals/xhx/module/staff/web/StaffController.java
+0
-20
attendance-performance-manager/src/test/java/com/mortals/httpclient/dept/DeptController.http
...test/java/com/mortals/httpclient/dept/DeptController.http
+6
-6
attendance-performance-manager/src/test/java/com/mortals/httpclient/job/JobController.http
...c/test/java/com/mortals/httpclient/job/JobController.http
+0
-3
No files found.
attendance-performance-manager/src/main/java/com/mortals/xhx/daemon/task/SyncUserTaskImpl.java
View file @
e8957d26
...
...
@@ -12,6 +12,7 @@ import com.mortals.xhx.busiz.rsp.ListItem;
import
com.mortals.xhx.busiz.rsp.PersonHikData
;
import
com.mortals.xhx.module.dept.dao.ibatis.DeptDaoImpl
;
import
com.mortals.xhx.module.dept.model.DeptEntity
;
import
com.mortals.xhx.module.dept.service.DeptService
;
import
com.mortals.xhx.module.staff.dao.ibatis.StaffDaoImpl
;
import
com.mortals.xhx.module.staff.model.StaffEntity
;
import
lombok.extern.slf4j.Slf4j
;
...
...
@@ -35,10 +36,52 @@ public class SyncUserTaskImpl implements ITaskExcuteService {
@Autowired
private
DeptDaoImpl
deptDao
;
@Autowired
private
DeptService
deptService
;
@Override
public
void
excuteTask
(
ITask
task
)
throws
AppException
{
log
.
info
(
"同步用户--部门"
);
try
{
String
resultDept
=
ArtemisPostTest
.
callPostApiGetDeptList
();
JSONObject
jsonObjectDept
=
JSON
.
parseObject
(
resultDept
);
JSONObject
jsonObjectDept1
=
jsonObjectDept
.
getJSONObject
(
"data"
);
DeptHikData
deptHikData
=
JSONObject
.
parseObject
(
jsonObjectDept1
.
toJSONString
(),
DeptHikData
.
class
);
if
(
Objects
.
nonNull
(
deptHikData
))
{
for
(
ListDept
listDept
:
deptHikData
.
getList
())
{
//查询数据库信息
DeptEntity
deptEntity
=
deptDao
.
queryDept
(
listDept
.
getOrgIndexCode
());
DeptEntity
deptEntityParent
=
deptDao
.
queryDeptParient
(
listDept
.
getParentOrgIndexCode
());
DeptEntity
deptEntity1
=
new
DeptEntity
();
if
(
Objects
.
isNull
(
deptEntity
))
{
if
(
Objects
.
nonNull
(
deptEntityParent
))
{
deptEntity1
.
setParentId
(
deptEntityParent
.
getId
());
}
deptEntity1
.
setDeptName
(
listDept
.
getOrgName
());
deptEntity1
.
setDeptCode
(
listDept
.
getOrgIndexCode
());
deptEntity1
.
setAncestors
(
listDept
.
getOrgPath
());
deptEntity1
.
setDeptStatus
(
1
);
deptEntity1
.
setOrderNum
(
0
);
deptEntity1
.
setRemark
(
listDept
.
getParentOrgIndexCode
());
deptEntity1
.
setCreateTime
(
new
Date
());
deptEntity1
.
setCreateUserId
(
Long
.
valueOf
(
1
));
deptEntity1
.
setUpdateTime
(
new
Date
());
deptEntity1
.
setUpdateUserId
(
Long
.
valueOf
(
1
));
deptService
.
save
(
deptEntity1
);
}
else
{
if
(
Objects
.
nonNull
(
deptEntityParent
))
{
deptEntity
.
setParentId
(
deptEntityParent
.
getId
());
}
deptEntity
.
setDeptName
(
listDept
.
getOrgName
());
deptEntity
.
setDeptCode
(
listDept
.
getOrgIndexCode
());
deptEntity
.
setAncestors
(
listDept
.
getOrgPath
());
deptEntity
.
setCreateTime
(
new
Date
());
deptEntity
.
setCreateUserId
(
Long
.
valueOf
(
1
));
deptService
.
update
(
deptEntity
);
}
}
}
//同步员工
String
resultPerson
=
ArtemisPostTest
.
callPostApiGetPersonList
();
JSONObject
jsonObject
=
JSON
.
parseObject
(
resultPerson
);
JSONObject
jsonObject1
=
jsonObject
.
getJSONObject
(
"data"
);
...
...
@@ -72,6 +115,22 @@ public class SyncUserTaskImpl implements ITaskExcuteService {
staffEntity
.
setPhoneNumber
(
String
.
valueOf
(
list
.
getPhoneNo
()));
}
staffDao
.
insert
(
staffEntity
);
DeptEntity
deptEntity1
=
deptService
.
get
(
staffEntity1
.
getDeptId
());
String
ancestor
=
deptEntity1
.
getAncestors
().
split
(
","
,
2
)[
1
];
String
[]
ancestors
=
ancestor
.
split
(
","
);
for
(
String
newAncestor
:
ancestors
)
{
DeptEntity
deptEntity2
=
deptService
.
get
(
Long
.
valueOf
(
newAncestor
));
if
(
Objects
.
nonNull
(
deptEntity2
))
{
int
personNumcount
=
staffDao
.
queryPersonNum
(
staffEntity1
.
getDeptId
());
if
(
Objects
.
nonNull
(
personNumcount
)
&&
Objects
.
nonNull
(
deptEntity2
))
{
deptEntity2
.
setPersonNum
(
personNumcount
);
deptService
.
update
(
deptEntity2
);
}
}
}
}
//本地数据不为空
else
{
...
...
@@ -96,59 +155,30 @@ public class SyncUserTaskImpl implements ITaskExcuteService {
staffEntity1
.
setPhoneNumber
(
String
.
valueOf
(
list
.
getPhoneNo
()));
}
staffDao
.
update
(
staffEntity1
);
}
}
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
DeptEntity
deptEntity1
=
deptService
.
get
(
staffEntity1
.
getDeptId
());
String
ancestor
=
deptEntity1
.
getAncestors
().
split
(
","
,
2
)[
1
];
String
[]
ancestors
=
ancestor
.
split
(
","
);
for
(
String
newAncestor
:
ancestors
)
{
DeptEntity
deptEntity2
=
deptService
.
get
(
Long
.
valueOf
(
newAncestor
));
if
(
Objects
.
nonNull
(
deptEntity2
))
{
int
personNumcount
=
staffDao
.
queryPersonNum
(
staffEntity1
.
getDeptId
());
if
(
Objects
.
nonNull
(
personNumcount
)
&&
Objects
.
nonNull
(
deptEntity2
))
{
deptEntity2
.
setPersonNum
(
personNumcount
);
deptService
.
update
(
deptEntity2
);
}
}
try
{
String
resultDept
=
ArtemisPostTest
.
callPostApiGetDeptList
();
JSONObject
jsonObjectDept
=
JSON
.
parseObject
(
resultDept
);
JSONObject
jsonObjectDept1
=
jsonObjectDept
.
getJSONObject
(
"data"
);
DeptHikData
deptHikData
=
JSONObject
.
parseObject
(
jsonObjectDept1
.
toJSONString
(),
DeptHikData
.
class
);
System
.
out
.
println
(
resultDept
);
if
(
Objects
.
nonNull
(
deptHikData
))
{
for
(
ListDept
listDept
:
deptHikData
.
getList
())
{
//查询数据库信息
DeptEntity
deptEntity
=
deptDao
.
queryDept
(
listDept
.
getOrgIndexCode
());
DeptEntity
deptEntityParent
=
deptDao
.
queryDeptParient
(
listDept
.
getParentOrgIndexCode
());
DeptEntity
deptEntity1
=
new
DeptEntity
();
if
(
Objects
.
isNull
(
deptEntity
))
{
if
(
Objects
.
nonNull
(
deptEntityParent
))
{
deptEntity1
.
setParentId
(
deptEntityParent
.
getId
());
}
deptEntity1
.
setDeptName
(
listDept
.
getOrgName
());
deptEntity1
.
setDeptCode
(
listDept
.
getOrgIndexCode
());
deptEntity1
.
setAncestors
(
listDept
.
getOrgPath
());
deptEntity1
.
setDeptStatus
(
1
);
deptEntity1
.
setOrderNum
(
0
);
deptEntity1
.
setRemark
(
listDept
.
getParentOrgIndexCode
());
deptEntity1
.
setCreateTime
(
new
Date
());
deptEntity1
.
setCreateUserId
(
Long
.
valueOf
(
1
));
System
.
out
.
println
(
deptEntity1
);
deptDao
.
insert
(
deptEntity1
);
}
else
{
if
(
Objects
.
nonNull
(
deptEntityParent
))
{
deptEntity
.
setParentId
(
deptEntityParent
.
getId
());
}
deptEntity
.
setDeptName
(
listDept
.
getOrgName
());
deptEntity
.
setDeptCode
(
listDept
.
getOrgIndexCode
());
deptEntity
.
setAncestors
(
listDept
.
getOrgPath
());
deptEntity
.
setCreateTime
(
new
Date
());
deptEntity
.
setCreateUserId
(
Long
.
valueOf
(
1
));
deptDao
.
update
(
deptEntity
);
}
}
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
...
...
attendance-performance-manager/src/main/java/com/mortals/xhx/module/dept/service/DeptService.java
View file @
e8957d26
...
...
@@ -49,13 +49,7 @@ public interface DeptService extends ICRUDService<DeptEntity,Long>{
*/
List
<
DeptTreeSelect
>
getListByParentId
(
Long
parentId
,
Context
context
);
/**
* 查询部门人数
* */
DeptEntity
queryDept
(
String
deptCode
);
DeptEntity
queryParent
(
String
parentCode
);
int
queryParentId
(
Long
deptId
);
...
...
attendance-performance-manager/src/main/java/com/mortals/xhx/module/dept/service/impl/DeptServiceImpl.java
View file @
e8957d26
...
...
@@ -191,15 +191,7 @@ public class DeptServiceImpl extends AbstractCRUDServiceImpl<DeptDao, DeptEntity
return
collect
;
}
@Override
public
DeptEntity
queryDept
(
String
deptCode
)
{
return
dao
.
queryDept
(
deptCode
);
}
@Override
public
DeptEntity
queryParent
(
String
parentCode
)
{
return
dao
.
queryDeptParient
(
parentCode
);
}
@Override
public
int
queryParentId
(
Long
deptId
)
{
...
...
attendance-performance-manager/src/main/java/com/mortals/xhx/module/staff/web/StaffController.java
View file @
e8957d26
...
...
@@ -4,7 +4,6 @@ import com.mortals.framework.exception.AppException;
import
com.mortals.framework.model.Context
;
import
com.mortals.framework.web.BaseCRUDJsonBodyMappingController
;
import
com.mortals.xhx.base.system.param.service.ParamService
;
import
com.mortals.xhx.module.dept.model.DeptEntity
;
import
com.mortals.xhx.module.dept.service.DeptService
;
import
com.mortals.xhx.module.job.model.JobQuery
;
import
com.mortals.xhx.module.job.service.JobService
;
...
...
@@ -102,23 +101,4 @@ public class StaffController extends BaseCRUDJsonBodyMappingController<StaffServ
}
@Override
protected
int
saveAfter
(
StaffEntity
entity
,
Map
<
String
,
Object
>
model
,
Context
context
)
throws
AppException
{
//统计当前部门
DeptEntity
deptEntity
=
deptService
.
get
(
entity
.
getDeptId
());
int
personNumcount
=
service
.
queryDeptNum
(
entity
.
getDeptId
());
deptEntity
.
setPersonNum
(
personNumcount
);
deptService
.
update
(
deptEntity
);
//统计上级部门
int
personNumId
=
deptService
.
queryParentId
(
entity
.
getDeptId
());
if
(
personNumId
!=
0
){
DeptEntity
deptEntity1
=
deptService
.
get
(
entity
.
getDeptId
());
int
personParentNumcount
=
service
.
queryDeptNum
(
deptEntity1
.
getParentId
());
deptEntity1
.
setPersonNum
(
personParentNumcount
);
deptService
.
update
(
deptEntity1
);
}
return
super
.
saveAfter
(
entity
,
model
,
context
);
}
}
\ No newline at end of file
attendance-performance-manager/src/test/java/com/mortals/httpclient/dept/DeptController.http
View file @
e8957d26
...
...
@@ -13,18 +13,18 @@ client.global.set("SmsSet_id", JSON.parse(response.body).data.id);
client.global.set("authToken", JSON.parse(response.body).data.token);
%}
###
职位
信息列表
###
部门
信息列表
POST {{baseUrl}}/dept/list
Authorization: {{authToken}}
Content-Type: application/json
{
"page":1,
"size":
1
0
"size":
3
0
}
###
职位
信息更新与保存
###
部门
信息更新与保存
POST {{baseUrl}}/dept/save
Authorization: {{authToken}}
Content-Type: application/json
...
...
@@ -41,18 +41,18 @@ Content-Type: application/json
client.global.set("Dept_id", JSON.parse(response.body).data.id);
%}
###
职位
信息查看
###
部门
信息查看
GET {{baseUrl}}/dept/info?id=1
Authorization: {{authToken}}
Accept: application/json
###
职位
信息编辑
###
部门
信息编辑
GET {{baseUrl}}/dept/edit?id={{Job_id}}
Authorization: {{authToken}}
Accept: application/json
###
职位
信息删除
###
部门
信息删除
GET {{baseUrl}}/dept/delete?id={{Job_id}}
Authorization: {{authToken}}
Accept: application/json
...
...
attendance-performance-manager/src/test/java/com/mortals/httpclient/job/JobController.http
View file @
e8957d26
...
...
@@ -19,9 +19,6 @@ Authorization: {{authToken}}
Content-Type: application/json
{
"groupName":"7knq8z",
"jobCode":"mmnj82",
"jobName":"z8f2k5",
"page":1,
"size":10
}
...
...
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