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
e48447ff
Commit
e48447ff
authored
Jul 19, 2023
by
赵啸非
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改考勤汇总
parent
057a07b7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
113 additions
and
37 deletions
+113
-37
attendance-performance-manager/src/main/java/com/mortals/xhx/module/attendance/service/impl/AttendanceRecordHikServiceImpl.java
...tendance/service/impl/AttendanceRecordHikServiceImpl.java
+88
-13
attendance-performance-manager/src/main/java/com/mortals/xhx/module/attendance/web/AttendanceRecordHikController.java
.../module/attendance/web/AttendanceRecordHikController.java
+25
-24
No files found.
attendance-performance-manager/src/main/java/com/mortals/xhx/module/attendance/service/impl/AttendanceRecordHikServiceImpl.java
View file @
e48447ff
...
...
@@ -122,17 +122,17 @@ public class AttendanceRecordHikServiceImpl extends AbstractCRUDServiceImpl<Atte
attendanceRecordEntity
.
setAttendanceGroupId
(
attendanceGroupEntity
.
getId
());
attendanceRecordEntity
.
setAttendanceGroupName
(
attendanceGroupEntity
.
getGroupName
());
log
.
info
(
"attendanceGroupEntity.getId()=={}"
,
attendanceGroupEntity
.
getId
());
log
.
info
(
"attendanceGroupEntity.getId()=={}"
,
attendanceGroupEntity
.
getId
());
//查询考勤组详细信息获取班次
AttendanceGroupFixedworkEntity
attendanceGroupFixedworkEntity
=
attendanceGroupFixedworkService
.
selectOne
(
new
AttendanceGroupFixedworkQuery
()
.
groupId
(
attendanceGroupEntity
.
getId
()));
//判断当前考勤日期为周几
Date
attendanceDate1
=
attendanceDate
;
String
week
=
this
.
getWeek
(
attendanceDate1
);
log
.
info
(
"week:{}"
,
week
);
log
.
info
(
"week:{}"
,
week
);
//通过考勤日期的星期拿到班次id.
Long
weekClassId
=
this
.
getWeekClassId
(
attendanceGroupFixedworkEntity
,
week
);
log
.
info
(
"weekClassId:{}"
,
weekClassId
);
log
.
info
(
"weekClassId:{}"
,
weekClassId
);
//weekClassId为-1 则不在考勤
if
(
weekClassId
==
-
1L
)
{
//跳过本次循环
...
...
@@ -141,8 +141,8 @@ public class AttendanceRecordHikServiceImpl extends AbstractCRUDServiceImpl<Atte
//获取班次信息
//AttendanceClassEntity attendanceClassEntity = attendanceClassService.selectOne(new AttendanceClassQuery().id(weekClassId));
AttendanceClassEntity
attendanceClassEntity
=
attendanceClassService
.
get
(
weekClassId
);
if
(
ObjectUtils
.
isEmpty
(
attendanceClassEntity
))
{
log
.
info
(
"attendanceClassEntity is null ,weekClassId:{}"
,
weekClassId
);
if
(
ObjectUtils
.
isEmpty
(
attendanceClassEntity
))
{
log
.
info
(
"attendanceClassEntity is null ,weekClassId:{}"
,
weekClassId
);
continue
;
}
...
...
@@ -329,7 +329,7 @@ public class AttendanceRecordHikServiceImpl extends AbstractCRUDServiceImpl<Atte
Integer
goWorkResult
=
recordDetailEntity
.
getGoWorkResult
();
Integer
offWorkResult
=
recordDetailEntity
.
getOffWorkResult
();
if
(
GoWorkResultEnum
.
正常
.
getValue
()
!=
goWorkResult
)
{
if
(
GoWorkResultEnum
.
正常
.
getValue
()
!=
goWorkResult
)
{
AttendanceRecordErrorEntity
errorEntity
=
new
AttendanceRecordErrorEntity
();
errorEntity
.
setStaffId
(
attendanceRecordEntity
.
getStaffId
());
errorEntity
.
setStaffName
(
attendanceRecordEntity
.
getStaffName
());
...
...
@@ -350,12 +350,12 @@ public class AttendanceRecordHikServiceImpl extends AbstractCRUDServiceImpl<Atte
errorEntity
.
setErrorDateTime
(
sdf
.
parse
(
s1
));
errorEntity
.
setActualAttendanceDateTime
(
sdf
.
parse
(
s1
));
}
if
(
GoWorkResultEnum
.
缺卡
.
getValue
()==
recordDetailEntity
.
getGoWorkResult
())
{
if
(
GoWorkResultEnum
.
缺卡
.
getValue
()
==
recordDetailEntity
.
getGoWorkResult
())
{
errorEntity
.
setErrorStatus
(
ErrorStatusEnum
.
缺卡
.
getValue
());
errorEntity
.
setErrorStatus
(
ErrorStatusEnum
.
缺卡
.
getValue
());
}
if
(
GoWorkResultEnum
.
迟到
.
getValue
()
==
recordDetailEntity
.
getGoWorkResult
()
)
{
errorEntity
.
setErrorStatus
(
ErrorStatusEnum
.
迟到
.
getValue
());
if
(
GoWorkResultEnum
.
迟到
.
getValue
()
==
recordDetailEntity
.
getGoWorkResult
()
)
{
errorEntity
.
setErrorStatus
(
ErrorStatusEnum
.
迟到
.
getValue
());
}
errorEntity
.
setProcessStatus
(
0
);
errorEntity
.
setCreateTime
(
new
Date
());
...
...
@@ -411,11 +411,85 @@ public class AttendanceRecordHikServiceImpl extends AbstractCRUDServiceImpl<Atte
}
public
String
getWeek
(
Date
date
)
{
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"EEEE"
);
String
week
=
sdf
.
format
(
date
);
return
week
;
// Get the day of the week (1 = Sunday, 2 = Monday, ..., 7 = Saturday)
int
dayOfWeek
=
DateUtil
.
dayOfWeek
(
date
);
// Map the numeric day of the week to its corresponding Chinese name
String
[]
dayOfWeekNames
=
new
String
[]{
"星期日"
,
"星期一"
,
"星期二"
,
"星期三"
,
"星期四"
,
"星期五"
,
"星期六"
};
// Get the Chinese name of the day of the week
String
dayOfWeekName
=
dayOfWeekNames
[
dayOfWeek
-
1
];
return
dayOfWeekName
;
//
// SimpleDateFormat sdf = new SimpleDateFormat("EEEE");
// String week = sdf.format(date);
// return week;
}
/**
* 获取通过星期获取班次id 如果返参为-1 则不在考勤
*
* @return
*/
/* public Long getWeekClassId(AttendanceGroupFixedworkEntity attendanceGroupFixedworkEntity, String week) {
Long weekClassId = 0L;
switch (week) {
case "星期一":
if (attendanceGroupFixedworkEntity.getMonday() == 0) {
weekClassId = -1L;
return weekClassId;
}
weekClassId = attendanceGroupFixedworkEntity.getMondayClassId();
break;
case "星期二":
if (attendanceGroupFixedworkEntity.getTuesday() == 0) {
weekClassId = -1L;
return weekClassId;
}
weekClassId = attendanceGroupFixedworkEntity.getTuesdayClassId();
break;
case "星期三":
if (attendanceGroupFixedworkEntity.getWednesday() == 0) {
weekClassId = -1L;
return weekClassId;
}
weekClassId = attendanceGroupFixedworkEntity.getWednesdayClassId();
break;
case "星期四":
if (attendanceGroupFixedworkEntity.getThursday() == 0) {
weekClassId = -1L;
return weekClassId;
}
weekClassId = attendanceGroupFixedworkEntity.getThursdayClassId();
break;
case "星期五":
if (attendanceGroupFixedworkEntity.getFriday() == 0) {
weekClassId = -1L;
return weekClassId;
}
weekClassId = attendanceGroupFixedworkEntity.getFridayClassId();
break;
case "星期六":
if (attendanceGroupFixedworkEntity.getSaturday() == 0) {
weekClassId = -1L;
return weekClassId;
}
weekClassId = attendanceGroupFixedworkEntity.getSaturdayClassId();
break;
case "星期日":
if (attendanceGroupFixedworkEntity.getSunday() == 0) {
weekClassId = -1L;
return weekClassId;
}
weekClassId = attendanceGroupFixedworkEntity.getSundayClassId();
break;
}
return weekClassId;
}*/
/**
* 获取通过星期获取班次id 如果返参为-1 则不在考勤
*
...
...
@@ -477,6 +551,7 @@ public class AttendanceRecordHikServiceImpl extends AbstractCRUDServiceImpl<Atte
return
weekClassId
;
}
/**
* @param nowTime 当前时间
* @param startTime 开始时间
...
...
attendance-performance-manager/src/main/java/com/mortals/xhx/module/attendance/web/AttendanceRecordHikController.java
View file @
e48447ff
...
...
@@ -34,15 +34,14 @@ import java.io.InputStream;
import
java.util.*
;
/**
*
* 海康考勤打卡记录汇总信息
*
* @author zxfei
* @date 2023-04-08
*/
* 海康考勤打卡记录汇总信息
*
* @author zxfei
* @date 2023-04-08
*/
@RestController
@RequestMapping
(
"attendance/record/hik"
)
public
class
AttendanceRecordHikController
extends
BaseCRUDJsonBodyMappingController
<
AttendanceRecordHikService
,
AttendanceRecordHikEntity
,
Long
>
{
public
class
AttendanceRecordHikController
extends
BaseCRUDJsonBodyMappingController
<
AttendanceRecordHikService
,
AttendanceRecordHikEntity
,
Long
>
{
@Autowired
private
ParamService
paramService
;
...
...
@@ -57,8 +56,8 @@ public class AttendanceRecordHikController extends BaseCRUDJsonBodyMappingContro
@Autowired
private
AttendanceRecordHikService
hikService
;
public
AttendanceRecordHikController
(){
super
.
setModuleDesc
(
"海康考勤打卡记录汇总信息"
);
public
AttendanceRecordHikController
()
{
super
.
setModuleDesc
(
"海康考勤打卡记录汇总信息"
);
}
@Override
...
...
@@ -67,29 +66,26 @@ public class AttendanceRecordHikController extends BaseCRUDJsonBodyMappingContro
}
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
doImportDataBefore
(
List
<
AttendanceRecordHikEntity
>
list
,
boolean
updateSupport
,
Context
context
)
throws
AppException
{
list
.
forEach
(
item
->
{
list
.
forEach
(
item
->
{
String
orgName
=
item
.
getOrgName
();
//todo split orgName to deptId and deptName
String
[]
split
=
orgName
.
split
(
"/"
);
String
deptName
=
split
[
split
.
length
-
1
];
String
deptName
=
split
[
split
.
length
-
1
];
DeptQuery
deptQuery
=
new
DeptQuery
();
deptQuery
.
setDeptName
(
deptName
);
//通过分解的deptName去获取部门信息
List
<
DeptEntity
>
deptEntities
=
deptService
.
find
(
deptQuery
);
Long
deptId
=
0L
;
//判断查出来的部门信息是否为一个,是的话直接获取id,不是的话获取部门的父级id,通过父级id和deptName去查部门id
if
(
StringUtils
.
isNotNull
(
deptEntities
)
&&
deptEntities
.
size
()
==
1
)
{
if
(
StringUtils
.
isNotNull
(
deptEntities
)
&&
deptEntities
.
size
()
==
1
)
{
deptId
=
deptEntities
.
get
(
0
).
getId
();
}
else
{
}
else
{
String
parentDeptName
=
split
[
split
.
length
-
2
];
deptQuery
.
setDeptName
(
parentDeptName
);
...
...
@@ -128,6 +124,11 @@ public class AttendanceRecordHikController extends BaseCRUDJsonBodyMappingContro
String
busiDesc
=
"查询"
+
this
.
getModuleDesc
();
int
code
=
1
;
try
{
if
(
ObjectUtils
.
isEmpty
(
hikEntity
.
getAttendanceDateStart
()))
{
throw
new
AppException
(
"请选择开始日期"
);
}
hikService
.
addAttendanceRecord
(
hikEntity
,
getContext
());
model
.
put
(
"message_info"
,
busiDesc
+
"成功"
);
this
.
recordSysLog
(
this
.
request
,
busiDesc
+
" 【成功】"
);
...
...
@@ -146,7 +147,7 @@ public class AttendanceRecordHikController extends BaseCRUDJsonBodyMappingContro
@Override
protected
void
doListBefore
(
AttendanceRecordHikEntity
query
,
Map
<
String
,
Object
>
model
,
Context
context
)
throws
AppException
{
if
(
query
.
getStaffName
()
!=
null
&&
!
query
.
getStaffName
().
equals
(
""
))
{
if
(
query
.
getStaffName
()
!=
null
&&
!
query
.
getStaffName
().
equals
(
""
))
{
String
staffName
=
"%"
+
query
.
getStaffName
()
+
"%"
;
query
.
setStaffName
(
staffName
);
}
...
...
@@ -164,24 +165,24 @@ public class AttendanceRecordHikController extends BaseCRUDJsonBodyMappingContro
public
void
doExportFileAfter
(
byte
[]
data
,
AttendanceRecordHikEntity
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
);
String
filePath
=
uploadService
.
saveFileUpload
(
file
,
"file/fileupload"
,
null
);
AttendanceExportRecordEntity
attendanceExportRecordEntity
=
new
AttendanceExportRecordEntity
();
attendanceExportRecordEntity
.
initAttrValue
();
attendanceExportRecordEntity
.
setFilePath
(
filePath
);
if
(
query
.
getIdList
()
!=
null
)
{
if
(
query
.
getIdList
()
!=
null
)
{
List
<
Long
>
idList
=
query
.
getIdList
();
String
recordIdList
=
""
;
for
(
Long
aLong
:
idList
)
{
if
(
recordIdList
.
equals
(
""
)){
if
(
recordIdList
.
equals
(
""
))
{
recordIdList
=
recordIdList
+
aLong
;
}
else
{
recordIdList
=
recordIdList
+
"、"
+
aLong
;
}
else
{
recordIdList
=
recordIdList
+
"、"
+
aLong
;
}
}
attendanceExportRecordEntity
.
setRecordIdList
(
recordIdList
);
}
if
(
query
.
getAttendanceDateStart
()
!=
null
)
{
String
attendanceDate
=
query
.
getAttendanceDateStart
()
+
"~"
+
query
.
getAttendanceDateEnd
();
if
(
query
.
getAttendanceDateStart
()
!=
null
)
{
String
attendanceDate
=
query
.
getAttendanceDateStart
()
+
"~"
+
query
.
getAttendanceDateEnd
();
attendanceExportRecordEntity
.
setAttendanceDate
(
attendanceDate
);
}
attendanceExportRecordEntity
.
setCreateUserId
(
context
.
getUser
().
getId
());
...
...
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