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
3b038f00
Commit
3b038f00
authored
Jul 30, 2023
by
赵啸非
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改员工导出
parent
2cc98dc2
Changes
20
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
478 additions
and
86 deletions
+478
-86
attendance-performance-manager-ui/admin/src/views/attendance/record/hik/list.vue
...manager-ui/admin/src/views/attendance/record/hik/list.vue
+1
-1
attendance-performance-manager-ui/admin/src/views/staff/list.vue
...nce-performance-manager-ui/admin/src/views/staff/list.vue
+9
-1
attendance-performance-manager/src/main/java/com/mortals/xhx/base/login/web/LoginController.java
.../java/com/mortals/xhx/base/login/web/LoginController.java
+61
-30
attendance-performance-manager/src/main/java/com/mortals/xhx/busiz/h5/web/ApiWebPerformController.java
...com/mortals/xhx/busiz/h5/web/ApiWebPerformController.java
+36
-4
attendance-performance-manager/src/main/java/com/mortals/xhx/busiz/h5/web/InspectApiController.java
...va/com/mortals/xhx/busiz/h5/web/InspectApiController.java
+96
-5
attendance-performance-manager/src/main/java/com/mortals/xhx/busiz/h5/web/PerformApiController.java
...va/com/mortals/xhx/busiz/h5/web/PerformApiController.java
+0
-1
attendance-performance-manager/src/main/java/com/mortals/xhx/common/code/AppealResultEnum.java
...in/java/com/mortals/xhx/common/code/AppealResultEnum.java
+1
-0
attendance-performance-manager/src/main/java/com/mortals/xhx/common/pdu/HomeStatInfo.java
...rc/main/java/com/mortals/xhx/common/pdu/HomeStatInfo.java
+6
-6
attendance-performance-manager/src/main/java/com/mortals/xhx/daemon/task/SyncUserTaskImpl.java
...in/java/com/mortals/xhx/daemon/task/SyncUserTaskImpl.java
+0
-2
attendance-performance-manager/src/main/java/com/mortals/xhx/module/attendance/model/AttendanceStatEntity.java
...als/xhx/module/attendance/model/AttendanceStatEntity.java
+2
-2
attendance-performance-manager/src/main/java/com/mortals/xhx/module/attendance/model/vo/AttendanceRecordVo.java
...ls/xhx/module/attendance/model/vo/AttendanceRecordVo.java
+3
-0
attendance-performance-manager/src/main/java/com/mortals/xhx/module/attendance/web/AttendanceExportRecordController.java
...dule/attendance/web/AttendanceExportRecordController.java
+0
-9
attendance-performance-manager/src/main/java/com/mortals/xhx/module/attendance/web/AttendanceRecordController.java
...xhx/module/attendance/web/AttendanceRecordController.java
+61
-9
attendance-performance-manager/src/main/java/com/mortals/xhx/module/attendance/web/AttendanceRecordHikController.java
.../module/attendance/web/AttendanceRecordHikController.java
+26
-9
attendance-performance-manager/src/main/java/com/mortals/xhx/module/perform/model/PerformAttendAppealEntity.java
...s/xhx/module/perform/model/PerformAttendAppealEntity.java
+1
-1
attendance-performance-manager/src/main/java/com/mortals/xhx/module/perform/service/impl/PerformAttendAppealServiceImpl.java
.../perform/service/impl/PerformAttendAppealServiceImpl.java
+15
-2
attendance-performance-manager/src/main/java/com/mortals/xhx/module/perform/service/impl/PerformOtherRecordServiceImpl.java
...e/perform/service/impl/PerformOtherRecordServiceImpl.java
+1
-0
attendance-performance-manager/src/main/java/com/mortals/xhx/module/staff/service/StaffService.java
...va/com/mortals/xhx/module/staff/service/StaffService.java
+9
-0
attendance-performance-manager/src/main/java/com/mortals/xhx/module/staff/service/impl/StaffServiceImpl.java
...rtals/xhx/module/staff/service/impl/StaffServiceImpl.java
+122
-4
attendance-performance-manager/src/main/java/com/mortals/xhx/module/staff/web/StaffController.java
...ava/com/mortals/xhx/module/staff/web/StaffController.java
+28
-0
No files found.
attendance-performance-manager-ui/admin/src/views/attendance/record/hik/list.vue
View file @
3b038f00
...
...
@@ -95,7 +95,7 @@
</div>
<div
class=
"mt10"
>
<el-link
:href=
"
baseUrl+
item.filePath"
target=
"_blank"
type=
"primary"
>
重新下载
</el-link>
<el-link
:href=
"item.filePath"
target=
"_blank"
type=
"primary"
>
重新下载
</el-link>
</div>
</div>
<div
class=
"times mt10"
>
...
...
attendance-performance-manager-ui/admin/src/views/staff/list.vue
View file @
3b038f00
...
...
@@ -78,7 +78,7 @@
</el-button>
<el-dropdown-menu
slot=
"dropdown"
>
<el-dropdown-item>
<el-button
type=
"text"
>
同步数据
</el-button>
<el-button
type=
"text"
@
click=
"syncPerson"
>
同步数据
</el-button>
</el-dropdown-item>
<el-dropdown-item>
<el-button
type=
"text"
@
click=
"handleImport"
...
...
@@ -219,6 +219,14 @@ export default {
);
this
.
isdialog
=
true
;
},
/** 同步 */
syncPerson
()
{
this
.
$post
(
"
/staff/syncPersons
"
,
{}).
then
((
res
)
=>
{
if
(
res
.
code
==
1
)
{
this
.
$message
.
success
(
res
.
msg
)
}
});
},
/** 导入 */
handleImport
()
{
this
.
upload
.
title
=
"
员工导入
"
;
...
...
attendance-performance-manager/src/main/java/com/mortals/xhx/base/login/web/LoginController.java
View file @
3b038f00
package
com.mortals.xhx.base.login.web
;
import
cn.hutool.core.date.DateUtil
;
import
cn.hutool.core.util.IdUtil
;
import
com.alibaba.fastjson.JSONObject
;
import
com.mortals.framework.ap.CookieService
;
...
...
@@ -20,8 +21,16 @@ import com.mortals.xhx.base.system.resource.service.ResourceService;
import
com.mortals.xhx.base.system.user.model.UserEntity
;
import
com.mortals.xhx.base.system.user.service.UserService
;
import
com.mortals.xhx.base.system.valid.service.ValidCodeService
;
import
com.mortals.xhx.common.code.GoWorkResultEnum
;
import
com.mortals.xhx.common.code.OffWorkResultEnum
;
import
com.mortals.xhx.common.key.RedisKey
;
import
com.mortals.xhx.common.pdu.HomeStatInfo
;
import
com.mortals.xhx.module.attendance.model.AttendanceRecordEntity
;
import
com.mortals.xhx.module.attendance.model.AttendanceRecordQuery
;
import
com.mortals.xhx.module.attendance.model.AttendanceVacationBalanceQuery
;
import
com.mortals.xhx.module.attendance.model.AttendanceVacationRecordQuery
;
import
com.mortals.xhx.module.attendance.service.AttendanceRecordService
;
import
com.mortals.xhx.module.attendance.service.AttendanceVacationRecordService
;
import
com.mortals.xhx.module.dept.model.DeptQuery
;
import
com.mortals.xhx.module.dept.service.DeptService
;
import
com.mortals.xhx.module.staff.model.StaffQuery
;
...
...
@@ -61,6 +70,10 @@ public class LoginController extends BaseCRUDJsonBodyMappingController<UserServi
private
ICacheService
cacheService
;
@Autowired
private
IAuthTokenService
authTokenService
;
@Autowired
private
AttendanceRecordService
recordService
;
@Autowired
private
AttendanceVacationRecordService
vacationRecordService
;
@Autowired
private
StaffService
staffService
;
...
...
@@ -157,13 +170,54 @@ public class LoginController extends BaseCRUDJsonBodyMappingController<UserServi
int
totalDeptNum
=
deptService
.
count
(
new
DeptQuery
(),
getContext
());
homeStatInfo
.
setTotalDeptNum
(
totalDeptNum
);
//todo
homeStatInfo
.
setAttendRadio
(
new
BigDecimal
(
98.00
));
homeStatInfo
.
setLevealPersonNum
(
6
);
homeStatInfo
.
setLatePersonNum
(
2
);
homeStatInfo
.
setLeftEarlyPersonNum
(
1
);
homeStatInfo
.
setMissCardPersonNum
(
23
);
homeStatInfo
.
setAttendPersonNum
(
426
);
AttendanceRecordQuery
attendanceRecordQuery
=
new
AttendanceRecordQuery
();
attendanceRecordQuery
.
setAttendanceDateStart
(
DateUtil
.
today
());
attendanceRecordQuery
.
setAttendanceDateEnd
(
DateUtil
.
today
());
List
<
AttendanceRecordEntity
>
attendanceRecordEntities
=
recordService
.
find
(
attendanceRecordQuery
);
//总打卡
long
total
=
attendanceRecordEntities
.
parallelStream
().
map
(
item
->
item
.
getStaffId
()).
distinct
().
count
();
//迟到次数
long
beLate
=
attendanceRecordEntities
.
parallelStream
()
.
flatMap
(
item
->
item
.
getAttendanceRecordDetailList
().
stream
())
.
filter
(
f
->
GoWorkResultEnum
.
迟到
.
getValue
()
==
f
.
getGoWorkResult
()
||
OffWorkResultEnum
.
迟到
.
getValue
()
==
f
.
getOffWorkResult
())
.
count
();
//早退次数
long
leaveEarly
=
attendanceRecordEntities
.
parallelStream
()
.
flatMap
(
item
->
item
.
getAttendanceRecordDetailList
().
stream
())
.
filter
(
f
->
GoWorkResultEnum
.
早退
.
getValue
()
==
f
.
getGoWorkResult
()
||
OffWorkResultEnum
.
早退
.
getValue
()
==
f
.
getOffWorkResult
())
.
count
();
//缺卡次数
long
lackOfCards
=
attendanceRecordEntities
.
parallelStream
()
.
flatMap
(
item
->
item
.
getAttendanceRecordDetailList
().
stream
())
.
filter
(
f
->
GoWorkResultEnum
.
缺卡
.
getValue
()
==
f
.
getGoWorkResult
()
||
OffWorkResultEnum
.
缺卡
.
getValue
()
==
f
.
getOffWorkResult
())
.
count
();
AttendanceVacationRecordQuery
vacationRecordQuery
=
new
AttendanceVacationRecordQuery
();
vacationRecordQuery
.
setCreateTimeStart
(
DateUtil
.
today
());
vacationRecordQuery
.
setCreateTimeEnd
(
DateUtil
.
today
());
int
levealPersonNum
=
vacationRecordService
.
count
(
vacationRecordQuery
,
getContext
());
//未考勤
long
noAtt
=
lackOfCards
;
long
att
=
total
-
noAtt
;
if
(
att
!=
0L
){
BigDecimal
bigDecimal
=
new
BigDecimal
(
att
).
divide
(
new
BigDecimal
(
total
)).
multiply
(
new
BigDecimal
(
100
)).
setScale
(
2
,
BigDecimal
.
ROUND_CEILING
);
homeStatInfo
.
setAttendRadio
(
bigDecimal
.
toString
()+
"%"
);
}
else
{
homeStatInfo
.
setAttendRadio
(
"0%"
);
}
homeStatInfo
.
setLevealPersonNum
(
levealPersonNum
);
homeStatInfo
.
setLatePersonNum
(
beLate
);
homeStatInfo
.
setLeftEarlyPersonNum
(
leaveEarly
);
homeStatInfo
.
setMissCardPersonNum
(
lackOfCards
);
homeStatInfo
.
setAttendPersonNum
(
total
);
data
.
put
(
"homeStat"
,
homeStatInfo
);
data
.
put
(
"token"
,
token
);
...
...
@@ -179,29 +233,6 @@ public class LoginController extends BaseCRUDJsonBodyMappingController<UserServi
return
ret
.
toJSONString
();
}
private
void
generateBlackCookie
(
HttpServletRequest
request
,
HttpServletResponse
response
,
String
loginName
,
Set
<
String
>
urls
)
{
try
{
String
cacheKey
=
RedisKey
.
KEY_MENU_CACHE
+
loginName
;
String
securityKey
=
GlobalSysInfo
.
getPropertyValue
(
SysConstains
.
PROP_COOKIE_SECURITY_KEY
);
//应为Cookie会超长,所以改为仅存储key将值放入redis
//CookieService.setCookieForAuth(request, response, securityKey, null);
StringBuilder
sb
=
new
StringBuilder
();
if
(
urls
!=
null
&&
urls
.
size
()
>
0
)
{
for
(
String
url
:
urls
)
{
int
index
=
url
.
hashCode
()
&
(
Integer
.
MAX_VALUE
-
1
);
sb
.
append
(
index
).
append
(
","
);
}
}
String
menuUrl
=
sb
.
toString
();
menuUrl
=
AESUtil
.
encrypt
(
menuUrl
,
securityKey
);
cacheService
.
set
(
cacheKey
,
menuUrl
,
604800
);
HttpUtil
.
setCookieValue
(
request
,
response
,
SysConstains
.
COOKIE_MENU
,
cacheKey
,
-
1
);
}
catch
(
Throwable
e
)
{
}
}
private
String
generateMenuUrlCode
(
Set
<
String
>
urls
)
{
try
{
...
...
attendance-performance-manager/src/main/java/com/mortals/xhx/busiz/h5/web/ApiWebPerformController.java
View file @
3b038f00
package
com.mortals.xhx.busiz.h5.web
;
import
cn.hutool.core.date.DateUtil
;
import
cn.hutool.core.util.StrUtil
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.mortals.framework.annotation.UnAuth
;
...
...
@@ -23,6 +24,9 @@ import org.springframework.web.bind.annotation.RequestMapping;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Set
;
import
java.util.stream.Collectors
;
@RestController
@Slf4j
...
...
@@ -47,6 +51,10 @@ public class ApiWebPerformController extends AbstractBaseController<PerformReq>
private
StaffService
staffService
;
@Autowired
private
PerformRulesCategoryService
categoryService
;
@Autowired
private
PerformStaffConfService
performStaffConfService
;
@Autowired
private
PerformStaffConfDetailService
performStaffConfDetailService
;
/**
...
...
@@ -206,7 +214,7 @@ public class ApiWebPerformController extends AbstractBaseController<PerformReq>
//通过手机号码查询员工属性
PerformRulesEntity
rule
=
getRule
(
req
.
getRuleCode
());
StaffEntity
staffEntity
=
getStaff
(
req
.
getPhone
());
checkStaffAutoConf
(
staffEntity
,
rule
);
PerformAttendRecordEntity
recordEntity
=
new
PerformAttendRecordEntity
();
recordEntity
.
initAttrValue
();
recordEntity
.
setSubMethod
(
SubMethodEnum
.
系统自动
.
getValue
());
...
...
@@ -242,9 +250,8 @@ public class ApiWebPerformController extends AbstractBaseController<PerformReq>
//评价保存
StaffEntity
staffEntity
=
getStaff
(
req
.
getPhone
());
PerformRulesEntity
rule
=
getRule
(
req
.
getRuleCode
());
checkStaffAutoConf
(
staffEntity
,
rule
);
PerformReviewRecordEntity
recordEntity
=
new
PerformReviewRecordEntity
();
recordEntity
.
initAttrValue
();
recordEntity
.
setSubMethod
(
SubMethodEnum
.
系统自动
.
getValue
());
BeanUtils
.
copyProperties
(
req
,
recordEntity
);
...
...
@@ -272,10 +279,33 @@ public class ApiWebPerformController extends AbstractBaseController<PerformReq>
}
private
void
checkStaffAutoConf
(
StaffEntity
staffEntity
,
PerformRulesEntity
rule
)
{
Boolean
rulePass
=
false
;
//校验当前员工是否存在自动规则中
List
<
PerformStaffConfEntity
>
performStaffConfEntities
=
performStaffConfService
.
find
(
new
PerformStaffConfQuery
());
for
(
PerformStaffConfEntity
performStaffConfEntity
:
performStaffConfEntities
)
{
String
staffIds
=
performStaffConfEntity
.
getStaffIds
();
Set
<
String
>
split
=
StrUtil
.
split
(
staffIds
,
","
).
stream
().
collect
(
Collectors
.
toSet
());
if
(
split
.
contains
(
staffEntity
.
getId
().
toString
()))
{
//查询当前规则
List
<
PerformStaffConfDetailEntity
>
staffConfDetailEntities
=
performStaffConfDetailService
.
find
(
new
PerformStaffConfDetailQuery
().
staffConfId
(
performStaffConfEntity
.
getId
()));
for
(
PerformStaffConfDetailEntity
staffConfDetailEntity
:
staffConfDetailEntities
)
{
if
(
staffConfDetailEntity
.
getRuleId
()
==
rule
.
getId
()){
rulePass
=
true
;
break
;
}
}
}
if
(
rulePass
)
break
;
}
if
(
rulePass
)
throw
new
AppException
(
"当前用户与绩效规则未配置自动核查,请在后台配置后再新增!"
);
}
private
boolean
complain
(
ComplainSaveReq
req
)
throws
AppException
{
//投诉保存
StaffEntity
staffEntity
=
getStaff
(
req
.
getPhone
());
PerformRulesEntity
rule
=
getRule
(
req
.
getRuleCode
());
checkStaffAutoConf
(
staffEntity
,
rule
);
PerformComplainRecordEntity
recordEntity
=
new
PerformComplainRecordEntity
();
recordEntity
.
initAttrValue
();
recordEntity
.
setSubMethod
(
SubMethodEnum
.
系统自动
.
getValue
());
...
...
@@ -307,6 +337,7 @@ public class ApiWebPerformController extends AbstractBaseController<PerformReq>
//办件保存
StaffEntity
staffEntity
=
getStaff
(
req
.
getPhone
());
PerformRulesEntity
rule
=
getRule
(
req
.
getRuleCode
());
checkStaffAutoConf
(
staffEntity
,
rule
);
PerformGoworkRecordEntity
recordEntity
=
new
PerformGoworkRecordEntity
();
recordEntity
.
initAttrValue
();
recordEntity
.
setSubMethod
(
SubMethodEnum
.
系统自动
.
getValue
());
...
...
@@ -339,7 +370,7 @@ public class ApiWebPerformController extends AbstractBaseController<PerformReq>
//效能保存
StaffEntity
staffEntity
=
getStaff
(
req
.
getPhone
());
PerformRulesEntity
rule
=
getRule
(
req
.
getRuleCode
());
checkStaffAutoConf
(
staffEntity
,
rule
);
PerformEffectRecordEntity
recordEntity
=
new
PerformEffectRecordEntity
();
recordEntity
.
initAttrValue
();
recordEntity
.
setSubMethod
(
SubMethodEnum
.
系统自动
.
getValue
());
...
...
@@ -372,6 +403,7 @@ public class ApiWebPerformController extends AbstractBaseController<PerformReq>
//其它保存
StaffEntity
staffEntity
=
getStaff
(
req
.
getPhone
());
PerformRulesEntity
rule
=
getRule
(
req
.
getRuleCode
());
checkStaffAutoConf
(
staffEntity
,
rule
);
PerformOtherRecordEntity
recordEntity
=
new
PerformOtherRecordEntity
();
recordEntity
.
initAttrValue
();
recordEntity
.
setSubMethod
(
SubMethodEnum
.
系统自动
.
getValue
());
...
...
attendance-performance-manager/src/main/java/com/mortals/xhx/busiz/h5/web/InspectApiController.java
View file @
3b038f00
...
...
@@ -16,6 +16,11 @@ import com.mortals.xhx.busiz.h5.rsp.PerformDetailInfo;
import
com.mortals.xhx.busiz.h5.rsp.PerformInfo
;
import
com.mortals.xhx.common.code.*
;
import
com.mortals.xhx.common.utils.BeanUtil
;
import
com.mortals.xhx.module.attendance.model.*
;
import
com.mortals.xhx.module.attendance.service.AttendanceClassDetailService
;
import
com.mortals.xhx.module.attendance.service.AttendanceClassService
;
import
com.mortals.xhx.module.attendance.service.AttendanceGroupFixedworkService
;
import
com.mortals.xhx.module.attendance.service.AttendanceGroupService
;
import
com.mortals.xhx.module.check.dao.CheckAllRecordDao
;
import
com.mortals.xhx.module.check.model.*
;
import
com.mortals.xhx.module.check.model.vo.CheckAllRecordVo
;
...
...
@@ -68,11 +73,8 @@ public class InspectApiController extends AbstractBaseController<PerformReq> {
private
PerformRulesService
rulesService
;
@Autowired
private
StaffService
staffService
;
@Autowired
private
CheckAllRecordService
checkAllRecordService
;
@Autowired
private
CheckAttendRecordService
checkAttendRecordService
;
@Autowired
...
...
@@ -85,10 +87,16 @@ public class InspectApiController extends AbstractBaseController<PerformReq> {
private
CheckGoworkRecordService
checkGoworkRecordService
;
@Autowired
private
CheckOtherRecordService
checkOtherRecordService
;
@Autowired
private
CheckAllRecordDao
checkAllRecordDao
;
@Autowired
private
AttendanceGroupService
groupService
;
@Autowired
private
AttendanceClassService
classService
;
@Autowired
private
AttendanceClassDetailService
classDetailService
;
@Autowired
private
AttendanceGroupFixedworkService
fixedworkService
;
protected
void
init
(
Map
<
String
,
Object
>
model
,
Context
context
)
{
this
.
addDict
(
model
,
"checkStatus"
,
CheckStatusEnum
.
getEnumMap
());
...
...
@@ -314,6 +322,9 @@ public class InspectApiController extends AbstractBaseController<PerformReq> {
recordEntity
.
setSubMethod
(
SubMethodEnum
.
大厅巡查
.
getValue
());
recordEntity
.
setErrorTime
(
new
Date
());
//根据考勤组查询 上下班
buildGoOffWork
(
req
,
context
,
recordEntity
);
recordEntity
.
setCreateUserId
(
context
.
getUser
().
getId
());
recordEntity
.
setCreateTime
(
new
Date
());
...
...
@@ -323,6 +334,86 @@ public class InspectApiController extends AbstractBaseController<PerformReq> {
}
private
void
buildGoOffWork
(
InspectSaveReq
req
,
Context
context
,
PerformAttendRecordEntity
recordEntity
)
{
if
(!
ObjectUtils
.
isEmpty
(
req
.
getAttendanceGroupId
())&&!
ObjectUtils
.
isEmpty
(
req
.
getAttendanceDate
())){
AttendanceGroupEntity
attendanceGroupEntity
=
groupService
.
get
(
req
.
getAttendanceGroupId
(),
context
);
if
(!
ObjectUtils
.
isEmpty
(
attendanceGroupEntity
))
{
//判断上下班时间
if
(
TypeEnum
.
固定班制
.
getValue
()
==
attendanceGroupEntity
.
getType
())
{
AttendanceGroupFixedworkEntity
fixedworkEntity
=
fixedworkService
.
selectOne
(
new
AttendanceGroupFixedworkQuery
().
groupId
(
attendanceGroupEntity
.
getId
()));
if
(!
ObjectUtils
.
isEmpty
(
fixedworkEntity
))
{
//查看当前时间是星期几
int
dayOfWeek
=
DateUtil
.
dayOfWeek
(
req
.
getAttendanceDate
());
switch
(
dayOfWeek
)
{
case
1
:
String
goOffWorkStr
=
getGoOffWorkStr
(
fixedworkEntity
.
getSundayClassId
());
recordEntity
.
setGoOffTimeStr
(
goOffWorkStr
);
break
;
case
2
:
goOffWorkStr
=
getGoOffWorkStr
(
fixedworkEntity
.
getMondayClassId
());
recordEntity
.
setGoOffTimeStr
(
goOffWorkStr
);
break
;
case
3
:
goOffWorkStr
=
getGoOffWorkStr
(
fixedworkEntity
.
getTuesdayClassId
());
recordEntity
.
setGoOffTimeStr
(
goOffWorkStr
);
break
;
case
4
:
goOffWorkStr
=
getGoOffWorkStr
(
fixedworkEntity
.
getWednesdayClassId
());
recordEntity
.
setGoOffTimeStr
(
goOffWorkStr
);
break
;
case
5
:
goOffWorkStr
=
getGoOffWorkStr
(
fixedworkEntity
.
getTuesdayClassId
());
recordEntity
.
setGoOffTimeStr
(
goOffWorkStr
);
break
;
case
6
:
goOffWorkStr
=
getGoOffWorkStr
(
fixedworkEntity
.
getFridayClassId
());
recordEntity
.
setGoOffTimeStr
(
goOffWorkStr
);
break
;
case
7
:
goOffWorkStr
=
getGoOffWorkStr
(
fixedworkEntity
.
getSundayClassId
());
recordEntity
.
setGoOffTimeStr
(
goOffWorkStr
);
break
;
default
:
recordEntity
.
setGoOffTimeStr
(
""
);
}
}
}
else
if
(
TypeEnum
.
自由工时
.
getValue
()
==
attendanceGroupEntity
.
getType
())
{
}
else
if
(
TypeEnum
.
排班制
.
getValue
()
==
attendanceGroupEntity
.
getType
())
{
}
else
{
}
}
}
}
private
String
getGoOffWorkStr
(
Long
sundayClassId
)
{
if
(
ObjectUtils
.
isEmpty
(
sundayClassId
))
return
""
;
StringBuilder
goOffWorkSb
=
new
StringBuilder
();
List
<
AttendanceClassDetailEntity
>
classDetailEntities
=
classDetailService
.
find
(
new
AttendanceClassDetailQuery
().
classId
(
sundayClassId
));
if
(!
ObjectUtils
.
isEmpty
(
classDetailEntities
))
{
for
(
AttendanceClassDetailEntity
classDetailEntity
:
classDetailEntities
)
{
String
goWorkStr
=
""
;
String
offWorkStr
=
""
;
if
(!
ObjectUtils
.
isEmpty
(
classDetailEntity
.
getGoWorkDate
()))
{
goWorkStr
=
DateUtil
.
format
(
classDetailEntity
.
getGoWorkDate
(),
"HH:mm"
);
}
if
(!
ObjectUtils
.
isEmpty
(
classDetailEntity
.
getOffWorkDate
()))
{
offWorkStr
=
DateUtil
.
format
(
classDetailEntity
.
getOffWorkDate
(),
"HH:mm"
);
}
goOffWorkSb
.
append
(
goWorkStr
);
goOffWorkSb
.
append
(
"~"
);
goOffWorkSb
.
append
(
offWorkStr
);
goOffWorkSb
.
append
(
" \n"
);
}
}
return
goOffWorkSb
.
toString
();
}
private
boolean
review
(
InspectSaveReq
req
,
Context
context
)
throws
AppException
{
//评价保存
...
...
attendance-performance-manager/src/main/java/com/mortals/xhx/busiz/h5/web/PerformApiController.java
View file @
3b038f00
...
...
@@ -401,7 +401,6 @@ public class PerformApiController extends AbstractBaseController<PerformReq> {
}
PerformAttendAppealEntity
entity
=
appealService
.
selectOne
(
new
PerformAttendAppealQuery
().
checkRecordId
(
performDetailInfo
.
getId
()).
performType
(
performReq
.
getPerformType
()));
log
.
info
(
"entity:{}"
,
JSONObject
.
toJSONString
(
entity
));
if
(!
ObjectUtils
.
isEmpty
(
entity
))
{
...
...
attendance-performance-manager/src/main/java/com/mortals/xhx/common/code/AppealResultEnum.java
View file @
3b038f00
...
...
@@ -9,6 +9,7 @@ import java.util.Map;
* @author zxfei
*/
public
enum
AppealResultEnum
{
申诉中
(
0
,
"申诉中"
),
通过
(
1
,
"通过"
),
不通过
(
2
,
"不通过"
);
private
Integer
value
;
...
...
attendance-performance-manager/src/main/java/com/mortals/xhx/common/pdu/HomeStatInfo.java
View file @
3b038f00
...
...
@@ -17,25 +17,25 @@ public class HomeStatInfo {
private
Integer
totalDeptNum
;
private
Integer
attendPersonNum
;
private
Long
attendPersonNum
=
0L
;
private
BigDecimal
attendRadio
;
private
String
attendRadio
;
/**
* 请假人数
*/
private
Integer
levealPersonNum
;
private
Integer
levealPersonNum
=
0
;
/**
* 迟到人数
*/
private
Integer
latePersonNum
;
private
Long
latePersonNum
=
0L
;
/**
* 早退人数
*/
private
Integer
leftEarlyPersonNum
;
private
Long
leftEarlyPersonNum
=
0L
;
/**
* 缺卡人数
*/
private
Integer
missCardPersonNum
;
private
Long
missCardPersonNum
=
0L
;
}
attendance-performance-manager/src/main/java/com/mortals/xhx/daemon/task/SyncUserTaskImpl.java
View file @
3b038f00
...
...
@@ -74,8 +74,6 @@ public class SyncUserTaskImpl implements ITaskExcuteService {
for
(
PersonInfo
personInfo
:
personInfoList
)
{
StaffEntity
staffEntity
=
staffService
.
getExtCache
(
StrUtil
.
padPre
(
personInfo
.
getJobNo
(),
8
,
"0"
));
DeptEntity
deptEntity
=
deptService
.
selectOne
(
new
DeptQuery
().
deptCode
(
personInfo
.
getOrgIndexCode
()));
// AttendanceVacationBalanceEntity balanceEntity = balanceService.selectOne(new AttendanceVacationBalanceQuery().staffId(staffEntity.getId()));
// AttendanceStatEntity statEntity = attendanceStatService.selectOne(new AttendanceStatQuery().staffId(staffEntity.getId()));
//判断本地数据是否为空
if
(
ObjectUtils
.
isEmpty
(
staffEntity
))
{
//新增员工信息
...
...
attendance-performance-manager/src/main/java/com/mortals/xhx/module/attendance/model/AttendanceStatEntity.java
View file @
3b038f00
...
...
@@ -255,11 +255,11 @@ public class AttendanceStatEntity extends AttendanceStatVo {
this
.
windowCategory
=
""
;
this
.
staffId
=
-
1L
;
this
.
staffId
=
null
;
this
.
staffName
=
""
;
this
.
deptId
=
-
1L
;
this
.
deptId
=
null
;
this
.
deptName
=
""
;
...
...
attendance-performance-manager/src/main/java/com/mortals/xhx/module/attendance/model/vo/AttendanceRecordVo.java
View file @
3b038f00
...
...
@@ -54,5 +54,8 @@ public class AttendanceRecordVo extends BaseEntityLong {
* 导出参数配置
*/
private
List
<
String
>
properties
;
private
List
<
Long
>
idList
;
}
attendance-performance-manager/src/main/java/com/mortals/xhx/module/attendance/web/AttendanceExportRecordController.java
View file @
3b038f00
...
...
@@ -50,13 +50,4 @@ public class AttendanceExportRecordController extends BaseCRUDJsonBodyMappingCon
super
.
init
(
model
,
context
);
}
@Override
protected
void
doListBefore
(
AttendanceExportRecordEntity
query
,
Map
<
String
,
Object
>
model
,
Context
context
)
throws
AppException
{
if
(
ObjectUtils
.
isEmpty
(
query
.
getOrderColList
()))
{
query
.
setOrderColList
(
Arrays
.
asList
(
new
OrderCol
(
"createTime"
,
OrderCol
.
DESCENDING
),
new
OrderCol
(
"staffName"
,
OrderCol
.
DESCENDING
)));
}
else
{
query
.
getOrderColList
().
add
(
new
OrderCol
(
"createTime"
,
OrderCol
.
DESCENDING
));
}
}
}
attendance-performance-manager/src/main/java/com/mortals/xhx/module/attendance/web/AttendanceRecordController.java
View file @
3b038f00
...
...
@@ -4,8 +4,10 @@ import com.alibaba.fastjson.JSONObject;
import
com.mortals.framework.common.Rest
;
import
com.mortals.framework.exception.AppException
;
import
com.mortals.framework.model.OrderCol
;
import
com.mortals.framework.utils.ServletUtils
;
import
com.mortals.framework.web.BaseCRUDJsonBodyMappingController
;
import
com.mortals.xhx.base.system.param.service.ParamService
;
import
com.mortals.xhx.base.system.upload.service.UploadService
;
import
com.mortals.xhx.common.code.GoWorkResultEnum
;
import
com.mortals.xhx.common.code.NormalEnum
;
import
com.mortals.xhx.common.code.OffWorkResultEnum
;
...
...
@@ -13,7 +15,9 @@ import com.mortals.xhx.common.code.YesNoEnum;
import
com.mortals.xhx.module.attendance.model.*
;
import
com.mortals.xhx.module.attendance.model.vo.AttendStatInfo
;
import
com.mortals.xhx.module.attendance.service.AttendanceClassService
;
import
com.mortals.xhx.module.attendance.service.AttendanceExportRecordService
;
import
com.mortals.xhx.module.attendance.service.AttendanceGroupService
;
import
com.mortals.xhx.module.dept.model.DeptEntity
;
import
com.mortals.xhx.module.dept.model.DeptQuery
;
import
com.mortals.xhx.module.dept.service.DeptService
;
import
com.mortals.xhx.module.perform.model.PerformAttendAppealEntity
;
...
...
@@ -30,7 +34,10 @@ import org.springframework.web.bind.annotation.RestController;
import
com.mortals.framework.model.Context
;
import
com.mortals.xhx.module.attendance.service.AttendanceRecordService
;
import
org.springframework.web.multipart.MultipartFile
;
import
java.io.ByteArrayInputStream
;
import
java.io.InputStream
;
import
java.util.*
;
import
java.util.stream.Collectors
;
...
...
@@ -46,6 +53,8 @@ public class AttendanceRecordController extends BaseCRUDJsonBodyMappingControlle
@Autowired
private
ParamService
paramService
;
@Autowired
private
UploadService
uploadService
;
@Autowired
private
AttendanceGroupService
attendanceGroupService
;
...
...
@@ -57,6 +66,12 @@ public class AttendanceRecordController extends BaseCRUDJsonBodyMappingControlle
private
AttendanceClassService
attendanceClassService
;
@Autowired
private
StaffService
staffService
;
@Autowired
private
AttendanceExportRecordService
attendanceExportRecordService
;
@Autowired
private
AttendanceGroupService
groupService
;
@Autowired
private
AttendanceClassService
classService
;
public
AttendanceRecordController
()
{
super
.
setModuleDesc
(
"考勤打卡记录信息"
);
...
...
@@ -82,40 +97,78 @@ public class AttendanceRecordController extends BaseCRUDJsonBodyMappingControlle
for
(
AttendanceRecordEntity
recordEntity
:
list
)
{
List
<
AttendanceRecordDetailEntity
>
attendanceRecordDetailList
=
recordEntity
.
getAttendanceRecordDetailList
();
if
(!
ObjectUtils
.
isEmpty
(
attendanceRecordDetailList
))
{
if
(!
ObjectUtils
.
isEmpty
(
attendanceRecordDetailList
))
{
for
(
AttendanceRecordDetailEntity
detailEntity
:
attendanceRecordDetailList
)
{
AttendanceRecordEntity
attendanceRecord
=
new
AttendanceRecordEntity
();
attendanceRecord
.
initAttrValue
();
BeanUtils
.
copyProperties
(
recordEntity
,
attendanceRecord
);
BeanUtils
.
copyProperties
(
recordEntity
,
attendanceRecord
);
attendanceRecord
.
setAttendanceRecordDetailEntity
(
detailEntity
);
attendanceRecordEntities
.
add
(
attendanceRecord
);
}
}
else
{
}
else
{
AttendanceRecordEntity
attendanceRecord
=
new
AttendanceRecordEntity
();
attendanceRecord
.
initAttrValue
();
BeanUtils
.
copyProperties
(
recordEntity
,
attendanceRecord
);
BeanUtils
.
copyProperties
(
recordEntity
,
attendanceRecord
);
attendanceRecordEntities
.
add
(
attendanceRecord
);
}
}
if
(!
ObjectUtils
.
isEmpty
(
attendanceRecordEntities
))
{
if
(!
ObjectUtils
.
isEmpty
(
attendanceRecordEntities
))
{
list
.
clear
();
list
.
addAll
(
attendanceRecordEntities
);
}
}
@Override
public
void
doExportFileAfter
(
byte
[]
data
,
AttendanceRecordEntity
query
,
Context
context
)
throws
AppException
{
InputStream
inputStream
=
new
ByteArrayInputStream
(
data
);
MultipartFile
file
=
ServletUtils
.
getMultipartFile
(
inputStream
,
"kaoqin.xlsx"
);
String
filePath
=
uploadService
.
saveFileUpload
(
file
,
"file/fileupload"
,
null
);
AttendanceExportRecordEntity
attendanceExportRecordEntity
=
new
AttendanceExportRecordEntity
();
attendanceExportRecordEntity
.
initAttrValue
();
attendanceExportRecordEntity
.
setFilePath
(
filePath
);
if
(
query
.
getIdList
()
!=
null
)
{
List
<
Long
>
idList
=
query
.
getIdList
();
attendanceExportRecordEntity
.
setRecordIdList
(
idList
.
stream
().
map
(
i
->
i
.
toString
()).
collect
(
Collectors
.
joining
(
","
)));
}
if
(
query
.
getAttendanceDateStart
()
!=
null
)
{
String
attendanceDate
=
query
.
getAttendanceDateStart
()
+
"~"
+
query
.
getAttendanceDateEnd
();
attendanceExportRecordEntity
.
setAttendanceDate
(
attendanceDate
);
}
if
(!
ObjectUtils
.
isEmpty
(
query
.
getAttendanceGroupId
())){
AttendanceGroupEntity
attendanceGroupEntity
=
groupService
.
get
(
query
.
getAttendanceGroupId
());
attendanceExportRecordEntity
.
setGroupName
(
attendanceGroupEntity
==
null
?
""
:
attendanceGroupEntity
.
getGroupName
());
}
if
(!
ObjectUtils
.
isEmpty
(
query
.
getDeptId
())){
DeptEntity
deptEntity
=
deptService
.
get
(
query
.
getDeptId
(),
context
);
attendanceExportRecordEntity
.
setDeptName
(
deptEntity
==
null
?
""
:
deptEntity
.
getDeptName
());
}
if
(!
ObjectUtils
.
isEmpty
(
query
.
getShiftsId
())){
AttendanceClassEntity
attendanceClassEntity
=
classService
.
get
(
query
.
getShiftsId
(),
context
);
attendanceExportRecordEntity
.
setClassName
(
attendanceClassEntity
==
null
?
""
:
attendanceClassEntity
.
getClassName
());
}
attendanceExportRecordEntity
.
setCreateUserId
(
context
.
getUser
().
getId
());
attendanceExportRecordEntity
.
setCreateTime
(
new
Date
());
attendanceExportRecordEntity
.
setType
(
2
);
attendanceExportRecordEntity
.
setExportOrImport
(
1
);
attendanceExportRecordService
.
save
(
attendanceExportRecordEntity
);
}
@Override
protected
void
doListBefore
(
AttendanceRecordEntity
query
,
Map
<
String
,
Object
>
model
,
Context
context
)
throws
AppException
{
if
(
query
.
getClassId
()
!=
null
)
{
if
(
query
.
getClassId
()
!=
null
)
{
query
.
setShiftsId
(
query
.
getClassId
());
}
if
(
query
.
getGroupId
()
!=
null
)
{
if
(
query
.
getGroupId
()
!=
null
)
{
query
.
setAttendanceGroupId
(
query
.
getGroupId
());
}
if
(
ObjectUtils
.
isEmpty
(
query
.
getOrderColList
()))
{
query
.
setOrderColList
(
Arrays
.
asList
(
new
OrderCol
(
"attendanceDate"
,
OrderCol
.
DESCENDING
),
new
OrderCol
(
"staffName"
,
OrderCol
.
DESCENDING
)));
query
.
setOrderColList
(
Arrays
.
asList
(
new
OrderCol
(
"attendanceDate"
,
OrderCol
.
DESCENDING
),
new
OrderCol
(
"staffName"
,
OrderCol
.
DESCENDING
)));
}
else
{
query
.
getOrderColList
().
add
(
new
OrderCol
(
"attendanceDate"
,
OrderCol
.
DESCENDING
));
query
.
getOrderColList
().
add
(
new
OrderCol
(
"staffName"
,
OrderCol
.
DESCENDING
));
...
...
@@ -240,7 +293,6 @@ public class AttendanceRecordController extends BaseCRUDJsonBodyMappingControlle
}
/**
* 每日统计
*/
...
...
attendance-performance-manager/src/main/java/com/mortals/xhx/module/attendance/web/AttendanceRecordHikController.java
View file @
3b038f00
...
...
@@ -10,9 +10,13 @@ import com.mortals.framework.utils.ServletUtils;
import
com.mortals.framework.web.BaseCRUDJsonBodyMappingController
;
import
com.mortals.xhx.base.system.param.service.ParamService
;
import
com.mortals.xhx.base.system.upload.service.UploadService
;
import
com.mortals.xhx.module.attendance.model.AttendanceClassEntity
;
import
com.mortals.xhx.module.attendance.model.AttendanceExportRecordEntity
;
import
com.mortals.xhx.module.attendance.model.AttendanceGroupEntity
;
import
com.mortals.xhx.module.attendance.model.AttendanceRecordHikEntity
;
import
com.mortals.xhx.module.attendance.service.AttendanceClassService
;
import
com.mortals.xhx.module.attendance.service.AttendanceExportRecordService
;
import
com.mortals.xhx.module.attendance.service.AttendanceGroupService
;
import
com.mortals.xhx.module.attendance.service.AttendanceRecordHikService
;
import
com.mortals.xhx.module.dept.model.DeptEntity
;
import
com.mortals.xhx.module.dept.model.DeptQuery
;
...
...
@@ -32,6 +36,7 @@ import org.springframework.web.multipart.MultipartFile;
import
java.io.ByteArrayInputStream
;
import
java.io.InputStream
;
import
java.util.*
;
import
java.util.stream.Collectors
;
/**
* 海康考勤打卡记录汇总信息
...
...
@@ -55,6 +60,10 @@ public class AttendanceRecordHikController extends BaseCRUDJsonBodyMappingContro
private
AttendanceExportRecordService
attendanceExportRecordService
;
@Autowired
private
AttendanceRecordHikService
hikService
;
@Autowired
private
AttendanceGroupService
groupService
;
@Autowired
private
AttendanceClassService
classService
;
public
AttendanceRecordHikController
()
{
super
.
setModuleDesc
(
"海康考勤打卡记录汇总信息"
);
...
...
@@ -170,20 +179,28 @@ public class AttendanceRecordHikController extends BaseCRUDJsonBodyMappingContro
attendanceExportRecordEntity
.
setFilePath
(
filePath
);
if
(
query
.
getIdList
()
!=
null
)
{
List
<
Long
>
idList
=
query
.
getIdList
();
String
recordIdList
=
""
;
for
(
Long
aLong
:
idList
)
{
if
(
recordIdList
.
equals
(
""
))
{
recordIdList
=
recordIdList
+
aLong
;
}
else
{
recordIdList
=
recordIdList
+
"、"
+
aLong
;
}
}
attendanceExportRecordEntity
.
setRecordIdList
(
recordIdList
);
attendanceExportRecordEntity
.
setRecordIdList
(
idList
.
stream
().
map
(
i
->
i
.
toString
()).
collect
(
Collectors
.
joining
(
","
)));
}
if
(
query
.
getAttendanceDateStart
()
!=
null
)
{
String
attendanceDate
=
query
.
getAttendanceDateStart
()
+
"~"
+
query
.
getAttendanceDateEnd
();
attendanceExportRecordEntity
.
setAttendanceDate
(
attendanceDate
);
}
if
(!
ObjectUtils
.
isEmpty
(
query
.
getAttendanceGroupId
())){
AttendanceGroupEntity
attendanceGroupEntity
=
groupService
.
get
(
query
.
getAttendanceGroupId
());
attendanceExportRecordEntity
.
setGroupName
(
attendanceGroupEntity
==
null
?
""
:
attendanceGroupEntity
.
getGroupName
());
}
if
(!
ObjectUtils
.
isEmpty
(
query
.
getDeptId
())){
DeptEntity
deptEntity
=
deptService
.
get
(
query
.
getDeptId
(),
context
);
attendanceExportRecordEntity
.
setDeptName
(
deptEntity
==
null
?
""
:
deptEntity
.
getDeptName
());
}
if
(!
ObjectUtils
.
isEmpty
(
query
.
getShiftsId
())){
AttendanceClassEntity
attendanceClassEntity
=
classService
.
get
(
query
.
getShiftsId
(),
context
);
attendanceExportRecordEntity
.
setClassName
(
attendanceClassEntity
==
null
?
""
:
attendanceClassEntity
.
getClassName
());
}
attendanceExportRecordEntity
.
setCreateUserId
(
context
.
getUser
().
getId
());
attendanceExportRecordEntity
.
setCreateTime
(
new
Date
());
attendanceExportRecordEntity
.
setType
(
1
);
...
...
attendance-performance-manager/src/main/java/com/mortals/xhx/module/perform/model/PerformAttendAppealEntity.java
View file @
3b038f00
...
...
@@ -323,7 +323,7 @@ public class PerformAttendAppealEntity extends PerformAttendAppealVo {
this
.
appealTime
=
null
;
this
.
appealResult
=
null
;
this
.
appealResult
=
0
;
this
.
remark
=
""
;
...
...
attendance-performance-manager/src/main/java/com/mortals/xhx/module/perform/service/impl/PerformAttendAppealServiceImpl.java
View file @
3b038f00
...
...
@@ -57,10 +57,8 @@ public class PerformAttendAppealServiceImpl extends AbstractCRUDServiceImpl<Perf
private
CheckGoworkRecordService
checkGoworkRecordService
;
@Autowired
private
CheckOtherRecordService
checkOtherRecordService
;
@Autowired
private
PerformAttendAppealFilesService
performAttendAppealFilesService
;
@Autowired
private
IDingPersonService
dingPersonService
;
@Autowired
...
...
@@ -248,6 +246,21 @@ public class PerformAttendAppealServiceImpl extends AbstractCRUDServiceImpl<Perf
}
@Override
protected
void
saveBefore
(
PerformAttendAppealEntity
entity
,
Context
context
)
throws
AppException
{
//校验是否存在已经通过的申诉
PerformAttendAppealQuery
appealQuery
=
new
PerformAttendAppealQuery
();
appealQuery
.
setCheckRecordId
(
entity
.
getCheckRecordId
());
appealQuery
.
setPerformType
(
entity
.
getPerformType
());
appealQuery
.
setAppealResult
(
AppealResultEnum
.
通过
.
getValue
());
int
count
=
this
.
count
(
appealQuery
,
context
);
if
(
count
>
0
){
throw
new
AppException
(
"已存在相同的通过申诉,不要重复申诉!"
);
}
}
@Override
protected
void
saveAfter
(
PerformAttendAppealEntity
entity
,
Context
context
)
throws
AppException
{
if
(!
ObjectUtils
.
isEmpty
(
entity
.
getPerformAttendAppealFilesList
()))
{
...
...
attendance-performance-manager/src/main/java/com/mortals/xhx/module/perform/service/impl/PerformOtherRecordServiceImpl.java
View file @
3b038f00
...
...
@@ -57,6 +57,7 @@ public class PerformOtherRecordServiceImpl extends AbstractCRUDServiceImpl<Perfo
if
(!
ObjectUtils
.
isEmpty
(
entity
.
getRuleId
()))
{
PerformRulesEntity
rulesEntity
=
rulesService
.
getCache
(
entity
.
getRuleId
().
toString
());
entity
.
setRuleName
(
rulesEntity
.
getName
());
entity
.
setRuleDesc
(
rulesEntity
.
getContent
());
entity
.
setSubAddType
(
rulesEntity
==
null
?
1
:
rulesEntity
.
getSubAddType
());
}
if
(!
ObjectUtils
.
isEmpty
(
entity
.
getStaffId
()))
{
...
...
attendance-performance-manager/src/main/java/com/mortals/xhx/module/staff/service/StaffService.java
View file @
3b038f00
package
com.mortals.xhx.module.staff.service
;
import
com.mortals.framework.common.Rest
;
import
com.mortals.framework.model.Context
;
import
com.mortals.framework.service.ICRUDCacheService
;
import
com.mortals.xhx.module.staff.model.StaffEntity
;
...
...
@@ -21,4 +22,12 @@ public interface StaffService extends ICRUDCacheService<StaffEntity,Long> {
StaffInfoVo
queryAll
(
Context
context
);
//统计所有在职员工
int
queryAllPerson
();
/**
* 同步人员信息
* @param context
* @return
*/
Rest
<
Void
>
syncPersons
(
Context
context
);
}
\ No newline at end of file
attendance-performance-manager/src/main/java/com/mortals/xhx/module/staff/service/impl/StaffServiceImpl.java
View file @
3b038f00
package
com.mortals.xhx.module.staff.service.impl
;
import
cn.hutool.core.date.DateUtil
;
import
cn.hutool.core.util.StrUtil
;
import
com.mortals.framework.common.Rest
;
import
com.mortals.framework.exception.AppException
;
import
com.mortals.framework.model.Context
;
import
com.mortals.framework.service.impl.AbstractCRUDCacheServiceImpl
;
...
...
@@ -10,7 +12,19 @@ import com.mortals.xhx.base.system.role.service.RoleUserService;
import
com.mortals.xhx.base.system.user.model.UserEntity
;
import
com.mortals.xhx.base.system.user.service.UserService
;
import
com.mortals.xhx.common.code.*
;
import
com.mortals.xhx.module.attendance.model.AttendanceStatEntity
;
import
com.mortals.xhx.module.attendance.model.AttendanceStatQuery
;
import
com.mortals.xhx.module.attendance.model.AttendanceVacationBalanceEntity
;
import
com.mortals.xhx.module.attendance.model.AttendanceVacationBalanceQuery
;
import
com.mortals.xhx.module.attendance.service.AttendanceStatService
;
import
com.mortals.xhx.module.attendance.service.AttendanceVacationBalanceService
;
import
com.mortals.xhx.module.dept.model.DeptEntity
;
import
com.mortals.xhx.module.dept.model.DeptQuery
;
import
com.mortals.xhx.module.dept.service.DeptService
;
import
com.mortals.xhx.module.hik.person.model.req.person.PersonReq
;
import
com.mortals.xhx.module.hik.person.model.rsp.person.PersonDataInfo
;
import
com.mortals.xhx.module.hik.person.model.rsp.person.PersonInfo
;
import
com.mortals.xhx.module.hik.person.service.IHikPersonService
;
import
com.mortals.xhx.module.staff.dao.StaffDao
;
import
com.mortals.xhx.module.staff.dao.ibatis.StaffDaoImpl
;
import
com.mortals.xhx.module.staff.dao.ibatis.StaffLeaveDaoImpl
;
...
...
@@ -18,6 +32,7 @@ import com.mortals.xhx.module.staff.model.StaffEntity;
import
com.mortals.xhx.module.staff.model.StaffQuery
;
import
com.mortals.xhx.module.staff.model.vo.StaffInfoVo
;
import
com.mortals.xhx.module.staff.service.StaffService
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.ObjectUtils
;
...
...
@@ -36,6 +51,7 @@ import java.util.stream.Collectors;
* @date 2023-04-07
*/
@Service
(
"staffService"
)
@Slf4j
public
class
StaffServiceImpl
extends
AbstractCRUDCacheServiceImpl
<
StaffDao
,
StaffEntity
,
Long
>
implements
StaffService
{
@Autowired
...
...
@@ -46,6 +62,15 @@ public class StaffServiceImpl extends AbstractCRUDCacheServiceImpl<StaffDao, Sta
@Autowired
private
RoleUserService
roleUserService
;
@Autowired
private
IHikPersonService
hikPersonService
;
@Autowired
private
AttendanceStatService
attendanceStatService
;
@Autowired
private
AttendanceVacationBalanceService
balanceService
;
@Override
protected
String
getExtKey
(
StaffEntity
data
)
{
//工号作为redis 扩展key
...
...
@@ -57,10 +82,13 @@ public class StaffServiceImpl extends AbstractCRUDCacheServiceImpl<StaffDao, Sta
protected
void
saveBefore
(
StaffEntity
entity
,
Context
context
)
throws
AppException
{
int
count
=
this
.
count
(
new
StaffQuery
().
workNum
(
entity
.
getWorkNum
()),
context
);
if
(
count
>
0
)
{
throw
new
AppException
(
"工号重复!
"
);
throw
new
AppException
(
"工号重复!
工号:"
+
entity
.
getWorkNum
()
);
}
}
@Override
public
StaffInfoVo
queryAll
(
Context
context
)
{
StaffInfoVo
staffInfoVo
=
new
StaffInfoVo
();
...
...
@@ -94,12 +122,102 @@ public class StaffServiceImpl extends AbstractCRUDCacheServiceImpl<StaffDao, Sta
return
staffEntities
.
size
();
}
@Override
public
Rest
<
Void
>
syncPersons
(
Context
context
)
{
log
.
info
(
"同步人员!"
);
PersonReq
personReq
=
new
PersonReq
();
personReq
.
setPageNo
(
1
);
personReq
.
setPageSize
(
1000
);
Rest
<
PersonDataInfo
>
personRest
=
hikPersonService
.
getPersonList
(
personReq
);
if
(
personRest
.
getCode
()
==
YesNoEnum
.
YES
.
getValue
())
{
List
<
PersonInfo
>
personInfoList
=
personRest
.
getData
().
getList
();
for
(
PersonInfo
personInfo
:
personInfoList
)
{
StaffEntity
staffEntity
=
this
.
getExtCache
(
StrUtil
.
padPre
(
personInfo
.
getJobNo
(),
8
,
"0"
));
DeptEntity
deptEntity
=
deptService
.
selectOne
(
new
DeptQuery
().
deptCode
(
personInfo
.
getOrgIndexCode
()));
//判断本地数据是否为空
if
(
ObjectUtils
.
isEmpty
(
staffEntity
))
{
//新增员工信息
staffEntity
=
new
StaffEntity
();
staffEntity
.
initAttrValue
();
if
(!
ObjectUtils
.
isEmpty
(
deptEntity
))
{
staffEntity
.
setDeptId
(
deptEntity
.
getId
());
}
staffEntity
.
setName
(
personInfo
.
getPersonName
());
staffEntity
.
setRemarkId
(
personInfo
.
getPersonId
());
staffEntity
.
setPicUri
(
personInfo
.
getPersonPhoto
().
getPicUri
());
staffEntity
.
setServerIndexCode
(
personInfo
.
getPersonPhoto
().
getServerIndexCode
());
staffEntity
.
setDeptName
(
personInfo
.
getOrgName
());
staffEntity
.
setGender
(
personInfo
.
getGender
());
staffEntity
.
setWorkNum
(
personInfo
.
getJobNo
());
staffEntity
.
setPhoneNumber
(
personInfo
.
getPhoneNo
());
staffEntity
.
setCreateUserId
(
1L
);
staffEntity
.
setCreateTime
(
new
Date
());
this
.
save
(
staffEntity
);
}
else
{
//更新
if
(!
ObjectUtils
.
isEmpty
(
deptEntity
))
{
staffEntity
.
setDeptId
(
deptEntity
.
getId
());
}
staffEntity
.
setName
(
personInfo
.
getPersonName
());
staffEntity
.
setRemarkId
(
personInfo
.
getPersonId
());
staffEntity
.
setPicUri
(
personInfo
.
getPersonPhoto
().
getPicUri
());
staffEntity
.
setServerIndexCode
(
personInfo
.
getPersonPhoto
().
getServerIndexCode
());
staffEntity
.
setDeptName
(
personInfo
.
getOrgName
());
staffEntity
.
setGender
(
personInfo
.
getGender
());
staffEntity
.
setWorkNum
(
personInfo
.
getJobNo
());
staffEntity
.
setPhoneNumber
(
personInfo
.
getPhoneNo
());
staffEntity
.
setUpdateUserId
(
1L
);
staffEntity
.
setUpdateTime
(
new
Date
());
this
.
update
(
staffEntity
);
}
}
}
return
Rest
.
ok
();
}
@Override
protected
void
saveAfter
(
StaffEntity
entity
,
Context
context
)
throws
AppException
{
super
.
saveAfter
(
entity
,
context
);
//初始化
int
count
=
balanceService
.
count
(
new
AttendanceVacationBalanceQuery
().
staffId
(
entity
.
getId
()),
context
);
if
(
count
==
0
){
AttendanceVacationBalanceEntity
balanceEntity
=
new
AttendanceVacationBalanceEntity
();
balanceEntity
.
initAttrValue
();
balanceEntity
.
setStaffId
(
entity
.
getId
());
balanceEntity
.
setStaffName
(
entity
.
getName
());
balanceEntity
.
setDeptId
(
entity
.
getDeptId
());
balanceEntity
.
setDeptName
(
entity
.
getDeptName
());
balanceEntity
.
setCreateUserId
(
1L
);
balanceEntity
.
setCreateTime
(
new
Date
());
balanceService
.
save
(
balanceEntity
);
}
AttendanceStatQuery
attendanceStatQuery
=
new
AttendanceStatQuery
();
attendanceStatQuery
.
setYear
(
DateUtil
.
year
(
new
Date
()));
attendanceStatQuery
.
setMonth
(
DateUtil
.
month
(
new
Date
())+
1
);
attendanceStatQuery
.
setDay
(
DateUtil
.
dayOfMonth
(
new
Date
()));
attendanceStatQuery
.
setStaffId
(
entity
.
getId
());
int
count1
=
attendanceStatService
.
count
(
attendanceStatQuery
,
context
);
if
(
count1
==
0
){
AttendanceStatEntity
attendanceStatEntity
=
new
AttendanceStatEntity
();
attendanceStatEntity
.
initAttrValue
();
attendanceStatEntity
.
setStaffId
(
entity
.
getId
());
attendanceStatEntity
.
setStaffName
(
entity
.
getName
());
attendanceStatEntity
.
setDeptId
(
entity
.
getDeptId
());
attendanceStatEntity
.
setDeptName
(
entity
.
getDeptName
());
attendanceStatEntity
.
setPhoneNumer
(
entity
.
getPhoneNumber
());
attendanceStatEntity
.
setYear
(
DateUtil
.
year
(
new
Date
()));
attendanceStatEntity
.
setMonth
(
DateUtil
.
month
(
new
Date
())+
1
);
attendanceStatEntity
.
setDay
(
DateUtil
.
dayOfMonth
(
new
Date
()));
attendanceStatEntity
.
setCreateUserId
(
1L
);
attendanceStatEntity
.
setCreateTime
(
new
Date
());
attendanceStatService
.
save
(
attendanceStatEntity
);
}
try
{
UserEntity
userEntity
=
new
UserEntity
();
if
(
ObjectUtils
.
isEmpty
(
entity
.
getLoginName
()))
{
//姓名加工号作为登录名
entity
.
setLoginName
(
entity
.
getName
()
+
entity
.
getWorkNum
());
...
...
@@ -130,9 +248,9 @@ public class StaffServiceImpl extends AbstractCRUDCacheServiceImpl<StaffDao, Sta
}
}
catch
(
Exception
e
)
{
throw
new
RuntimeException
(
e
);
log
.
error
(
"保存系统用户异常!"
,
e
);
}
super
.
saveAfter
(
entity
,
context
);
}
...
...
attendance-performance-manager/src/main/java/com/mortals/xhx/module/staff/web/StaffController.java
View file @
3b038f00
package
com.mortals.xhx.module.staff.web
;
import
com.alibaba.fastjson.JSONObject
;
import
com.mortals.framework.common.Rest
;
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.common.code.YesNoEnum
;
import
com.mortals.xhx.module.attendance.model.vo.AttendStatInfo
;
import
com.mortals.xhx.module.dept.model.DeptEntity
;
import
com.mortals.xhx.module.dept.model.DeptQuery
;
import
com.mortals.xhx.module.dept.model.DeptTreeSelect
;
...
...
@@ -16,6 +20,7 @@ import com.mortals.xhx.module.staff.model.vo.HolidayListVo;
import
com.mortals.xhx.module.staff.model.vo.StaffInfoVo
;
import
com.mortals.xhx.module.staff.service.StaffService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
...
...
@@ -109,6 +114,29 @@ public class StaffController extends BaseCRUDJsonBodyMappingController<StaffServ
return
super
.
saveAfter
(
entity
,
model
,
context
);
}
/**
* 同步更新人员
*/
@PostMapping
(
value
=
"syncPersons"
)
public
String
syncPersons
()
{
JSONObject
jsonObject
=
new
JSONObject
();
String
busiDesc
=
this
.
getModuleDesc
()
+
"同步"
;
try
{
Rest
<
Void
>
rest
=
this
.
service
.
syncPersons
(
getContext
());
if
(
rest
.
getCode
()
==
YesNoEnum
.
NO
.
getValue
())
{
throw
new
AppException
(
"同步异常!"
);
}
recordSysLog
(
request
,
busiDesc
+
" 【成功】"
);
jsonObject
.
put
(
KEY_RESULT_CODE
,
VALUE_RESULT_SUCCESS
);
jsonObject
.
put
(
KEY_RESULT_MSG
,
busiDesc
+
" 【成功】"
);
}
catch
(
Exception
e
)
{
log
.
error
(
"同步人员"
,
e
);
jsonObject
.
put
(
KEY_RESULT_CODE
,
VALUE_RESULT_FAILURE
);
jsonObject
.
put
(
KEY_RESULT_MSG
,
super
.
convertException
(
e
));
}
return
jsonObject
.
toJSONString
();
}
@Override
public
String
delete
(
Long
[]
id
)
{
return
super
.
delete
(
id
);
...
...
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