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
53893bb7
Commit
53893bb7
authored
Aug 30, 2024
by
suhuiguang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.2970存量数据刷库
parent
930ddca1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
116 additions
and
0 deletions
+116
-0
HistoryDataDealController.java
.../module/tcm/biz/controller/HistoryDataDealController.java
+42
-0
HistoryDataDealServiceImpl.java
...dule/tcm/biz/service/impl/HistoryDataDealServiceImpl.java
+74
-0
No files found.
amos-boot-system-tzs/amos-boot-module-tcm/amos-boot-module-tcm-biz/src/main/java/com/yeejoin/amos/boot/module/tcm/biz/controller/HistoryDataDealController.java
0 → 100644
View file @
53893bb7
package
com
.
yeejoin
.
amos
.
boot
.
module
.
tcm
.
biz
.
controller
;
import
com.yeejoin.amos.boot.module.tcm.biz.service.impl.HistoryDataDealServiceImpl
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.web.bind.annotation.PutMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.typroject.tyboot.core.foundation.enumeration.UserType
;
import
org.typroject.tyboot.core.restful.doc.TycloudOperation
;
import
org.typroject.tyboot.core.restful.utils.ResponseHelper
;
import
org.typroject.tyboot.core.restful.utils.ResponseModel
;
/**
* @author Administrator
*/
@RestController
@RequestMapping
(
value
=
"/history-data"
)
@Api
(
tags
=
"历史数据处理控制器"
)
public
class
HistoryDataDealController
{
private
HistoryDataDealServiceImpl
historyDataDealService
;
public
HistoryDataDealController
(
HistoryDataDealServiceImpl
historyDataDealService
)
{
this
.
historyDataDealService
=
historyDataDealService
;
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@PutMapping
(
value
=
"/user-permission/update"
)
@ApiOperation
(
httpMethod
=
"PUT"
,
value
=
"人员需求2970新增资质后, 资质存量数据刷库"
)
public
ResponseModel
<
Integer
>
userPermissionUpdate
()
{
return
ResponseHelper
.
buildResponse
(
historyDataDealService
.
userPermissionUpdate
());
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@PutMapping
(
value
=
"/user-person-type/update"
)
@ApiOperation
(
httpMethod
=
"PUT"
,
value
=
"人员需求2970新增资质后, 人员类型去掉维保,归到作业人员"
)
public
ResponseModel
<
Integer
>
userPersonTypeUpdate
()
{
return
ResponseHelper
.
buildResponse
(
historyDataDealService
.
userPersonTypeUpdate
());
}
}
amos-boot-system-tzs/amos-boot-module-tcm/amos-boot-module-tcm-biz/src/main/java/com/yeejoin/amos/boot/module/tcm/biz/service/impl/HistoryDataDealServiceImpl.java
0 → 100644
View file @
53893bb7
package
com
.
yeejoin
.
amos
.
boot
.
module
.
tcm
.
biz
.
service
.
impl
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONArray
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.yeejoin.amos.boot.module.common.api.entity.TzsUserPermission
;
import
com.yeejoin.amos.boot.module.tcm.api.entity.TzsUserInfo
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.StopWatch
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
/**
* @author Administrator
*/
@Service
@Slf4j
public
class
HistoryDataDealServiceImpl
{
private
TzsUserInfoServiceImpl
userInfoService
;
private
TzsUserPermissionServiceImpl
userPermissionService
;
public
HistoryDataDealServiceImpl
(
TzsUserInfoServiceImpl
userInfoService
,
TzsUserPermissionServiceImpl
userPermissionService
)
{
this
.
userInfoService
=
userInfoService
;
this
.
userPermissionService
=
userPermissionService
;
}
public
int
userPermissionUpdate
()
{
log
.
info
(
"刷存量人员资质开始"
);
StopWatch
stopWatch
=
new
StopWatch
();
stopWatch
.
start
();
List
<
TzsUserInfo
>
usersOfHavingPermission
=
userInfoService
.
list
(
new
LambdaQueryWrapper
<
TzsUserInfo
>().
isNotNull
(
TzsUserInfo:
:
getPermissionData
));
List
<
TzsUserPermission
>
allWaitFlushData
=
new
ArrayList
<>();
usersOfHavingPermission
.
forEach
(
u
->
{
JSON
.
parseObject
(
u
.
getPermissionData
()).
forEach
((
k
,
v
)
->
{
List
<
TzsUserPermission
>
userPermissions
=
JSONArray
.
parseArray
(
v
.
toString
(),
TzsUserPermission
.
class
);
userPermissions
.
forEach
(
p
->
{
p
.
setUserSeq
(
u
.
getSequenceNbr
());
p
.
setPermissionPost
(
k
);
p
.
setRecDate
(
new
Date
());
p
.
setRecUserName
(
u
.
getRecUserName
());
p
.
setRecUserId
(
u
.
getRecUserId
());
p
.
setRemark
(
"存量数据刷入"
);
});
allWaitFlushData
.
addAll
(
userPermissions
);
});
});
if
(
allWaitFlushData
.
size
()
>
0
)
{
userPermissionService
.
saveBatch
(
allWaitFlushData
);
}
stopWatch
.
stop
();
log
.
info
(
"刷存量人员资质结束,有资质的人员数量:{}, 插入的资质条数:{},耗时:{}秒"
,
usersOfHavingPermission
.
size
(),
allWaitFlushData
.
size
(),
stopWatch
.
getTotalTimeSeconds
());
return
allWaitFlushData
.
size
();
}
public
Integer
userPersonTypeUpdate
()
{
log
.
info
(
"刷存量人员类型开始"
);
StopWatch
stopWatch
=
new
StopWatch
();
stopWatch
.
start
();
List
<
TzsUserInfo
>
users
=
userInfoService
.
list
();
users
.
forEach
(
u
->{
// 维保人员人员类型去掉,数据规避到作业人员
u
.
setNewPost
(
u
.
getPost
().
replace
(
"6618"
,
"6552"
));
});
userInfoService
.
saveOrUpdateBatch
(
users
);
stopWatch
.
stop
();
log
.
info
(
"刷存量人员类型结束,人员数量:{},耗时:{}秒"
,
users
.
size
(),
stopWatch
.
getTotalTimeSeconds
());
return
users
.
size
();
}
}
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