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
6f32bee4
Commit
6f32bee4
authored
Jan 07, 2021
by
leialin
Committed by
chenzg
Jul 05, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复BUG
parent
f0f63b3e
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
60 additions
and
2243 deletions
+60
-2243
src/main/java/cn/timer/api/controller/kqgl/AttController.java
+3
-3
src/main/java/cn/timer/api/controller/kqgl/atttimer/AttendanceTaskTiming.java
+4
-4
src/main/java/cn/timer/api/controller/kqgl/atttimer/LastMonthtimingExport.java
+2
-2
src/main/java/cn/timer/api/controller/kqgl/atttimer/OnClickAttendanceTaskTiming.java
+0
-1094
src/main/java/cn/timer/api/controller/kqgl/atttimer/OnClickLastMonthtimingExport.java
+0
-1117
src/main/java/cn/timer/api/controller/kqgl/atttimer/RealTimeUpdate.java
+2
-4
src/main/java/cn/timer/api/controller/xcgl/SalaryManagementController.java
+31
-17
src/main/java/cn/timer/api/controller/xcgl/SalaryTool.java
+14
-0
src/main/java/cn/timer/api/dao/kqgl/PunchCardDetailsMapper.java
+1
-1
src/main/java/cn/timer/api/dao/kqmk/KqglAssoDkmxMapper.java
+1
-1
src/main/resources/mapping/kqgl/PunchCardDetailsMapper.xml
+1
-0
src/main/resources/mapping/kqmk/KqglAssoDkmxMapper.xml
+1
-0
No files found.
src/main/java/cn/timer/api/controller/kqgl/AttController.java
View file @
6f32bee4
...
...
@@ -1859,7 +1859,7 @@ public class AttController {
apr
.
setRestday
(
xiuxi
);
//休息天数
apr
.
setAnswerday
(
y
);
//应出勤
}
List
<
PunchCardDetails
>
attendance
=
punchcarddetailsservice
.
selectAttendanceDays
(
Integer
.
valueOf
(
kqry
.
getEmpNum
()),
startDate
,
endDate
);
//打卡记录
List
<
PunchCardDetails
>
attendance
=
punchcarddetailsservice
.
selectAttendanceDays
(
Integer
.
valueOf
(
kqry
.
getEmpNum
()),
startDate
,
endDate
,
qyid
);
//打卡记录
apr
.
setActualday
(
attendance
.
size
());
//已出勤
if
(
apr
.
getAnswerday
()
>
0
){
BigDecimal
g
=
new
BigDecimal
(
apr
.
getAnswerday
());
...
...
@@ -2233,7 +2233,7 @@ public class AttController {
attcal
.
setAttshouldmade
(
y
);
//应出勤
}
List
<
PunchCardDetails
>
attendance
=
punchcarddetailsservice
.
selectAttendanceDays
(
userid
,
startDate
,
endDate
);
//打卡记录
List
<
PunchCardDetails
>
attendance
=
punchcarddetailsservice
.
selectAttendanceDays
(
userid
,
startDate
,
endDate
,
qyid
);
//打卡记录
attcal
.
setAttendance
(
attendance
.
size
());
//已出勤
...
...
@@ -5118,7 +5118,7 @@ public class AttController {
apr
.
setRestday
(
xiuxi
);
//休息天数
apr
.
setAnswerday
(
y
);
//应出勤
}
List
<
PunchCardDetails
>
attendance
=
punchcarddetailsservice
.
selectAttendanceDays
(
Integer
.
valueOf
(
kqry
.
getEmpNum
()),
startDate
,
endDate
);
//打卡记录
List
<
PunchCardDetails
>
attendance
=
punchcarddetailsservice
.
selectAttendanceDays
(
Integer
.
valueOf
(
kqry
.
getEmpNum
()),
startDate
,
endDate
,
qyid
);
//打卡记录
apr
.
setActualday
(
attendance
.
size
());
//已出勤
if
(
apr
.
getAnswerday
()
>
0
){
BigDecimal
g
=
new
BigDecimal
(
apr
.
getAnswerday
());
...
...
src/main/java/cn/timer/api/controller/kqgl/atttimer/AttendanceTaskTiming.java
View file @
6f32bee4
...
...
@@ -92,8 +92,8 @@ public class AttendanceTaskTiming{
// @Scheduled(cron = "0 */2 * * * ?")
// @Scheduled(cron = "0 25 11 * * ?")
@Scheduled
(
cron
=
"0 0 8,12,16,20 * * ?"
)
//每天上午8、12点,下午16点,20点 执行
// @Scheduled(cron = "0 0 6,20 * * ?")
public
void
AttendanceTask
()
throws
ParseException
{
boolean
implement
=
true
;
...
...
@@ -117,7 +117,7 @@ public class AttendanceTaskTiming{
int
summaryid
=
0
;
//汇总id
List
<
QyzxEntInfoM
>
orgcodelist
=
qyzxentinfommapper
.
selectList
(
new
QueryWrapper
<
QyzxEntInfoM
>());
//系统中的所有公司 所有未到期的公司
// List<QyzxEntInfoM> orgcodelist = qyzxentinfommapper.selectList(new QueryWrapper<QyzxEntInfoM>().lambda().eq(QyzxEntInfoM::getId,
3
));
// List<QyzxEntInfoM> orgcodelist = qyzxentinfommapper.selectList(new QueryWrapper<QyzxEntInfoM>().lambda().eq(QyzxEntInfoM::getId,
1
));
for
(
int
t
=
0
;
t
<
orgcodelist
.
size
();
t
++){
int
org_code
=
orgcodelist
.
get
(
t
).
getId
();
//企业组织代码
...
...
@@ -148,7 +148,7 @@ public class AttendanceTaskTiming{
//考勤组信息
KqglMainKqz
attgro
=
kqglmainkqzmapper
.
getAttendanceGroupInformationByUserid
(
user
.
getEmpnum
(),
org_code
);
//目前为止打卡记录
List
<
PunchCardDetails
>
attendance
=
punchcarddetailsmapper
.
selectAttendanceDays
(
user
.
getEmpnum
(),
startDate
,
endDate
);
List
<
PunchCardDetails
>
attendance
=
punchcarddetailsmapper
.
selectAttendanceDays
(
user
.
getEmpnum
(),
startDate
,
endDate
,
org_code
);
int
fdjjrnum
=
0
;
if
(
attgro
!=
null
)
{
...
...
@@ -451,7 +451,7 @@ public class AttendanceTaskTiming{
}
}
}
AttSubsidiaryDto
subs
=
kqglassodkmxmapper
.
subsidiary
(
user
.
getEmpnum
(),
ttstr
);
AttSubsidiaryDto
subs
=
kqglassodkmxmapper
.
subsidiary
(
user
.
getEmpnum
(),
ttstr
,
org_code
);
// //工作时长(分钟)、严重迟到次数、严重迟到时长(分钟)、旷工迟到次数
// double workinghours = 0,seriouslatetimes = 0,seriouslatehours = 0,absenlatetimes = 0;
if
(
subs
!=
null
)
{
...
...
src/main/java/cn/timer/api/controller/kqgl/atttimer/LastMonthtimingExport.java
View file @
6f32bee4
...
...
@@ -157,7 +157,7 @@ public class LastMonthtimingExport {
//考勤组信息
KqglMainKqz
attgro
=
kqglmainkqzmapper
.
getAttendanceGroupInformationByUserid
(
user
.
getEmpnum
(),
org_code
);
//目前为止打卡记录
List
<
PunchCardDetails
>
attendance
=
punchcarddetailsmapper
.
selectAttendanceDays
(
user
.
getEmpnum
(),
startDate
,
endDate
);
List
<
PunchCardDetails
>
attendance
=
punchcarddetailsmapper
.
selectAttendanceDays
(
user
.
getEmpnum
(),
startDate
,
endDate
,
org_code
);
int
fdjjrnum
=
0
;
if
(
attgro
!=
null
)
{
...
...
@@ -498,7 +498,7 @@ public class LastMonthtimingExport {
}
}
}
AttSubsidiaryDto
subs
=
kqglassodkmxmapper
.
subsidiary
(
user
.
getEmpnum
(),
ttstr
);
AttSubsidiaryDto
subs
=
kqglassodkmxmapper
.
subsidiary
(
user
.
getEmpnum
(),
ttstr
,
org_code
);
// //工作时长(分钟)、严重迟到次数、严重迟到时长(分钟)、旷工迟到次数
// double workinghours = 0,seriouslatetimes = 0,seriouslatehours = 0,absenlatetimes = 0;
if
(
subs
!=
null
)
{
...
...
src/main/java/cn/timer/api/controller/kqgl/atttimer/OnClickAttendanceTaskTiming.java
deleted
100644 → 0
View file @
f0f63b3e
package
cn
.
timer
.
api
.
controller
.
kqgl
.
atttimer
;
import
java.text.DateFormat
;
import
java.text.ParseException
;
import
java.text.SimpleDateFormat
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.Calendar
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Locale
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
cn.timer.api.bean.kqgl.AttendanceWeeklySch
;
import
cn.timer.api.bean.kqgl.PunchCardDetails
;
import
cn.timer.api.bean.kqgl.PunchRecord
;
import
cn.timer.api.bean.kqgl.Schedule
;
import
cn.timer.api.bean.kqmk.KqglAssoBcsz
;
import
cn.timer.api.bean.kqmk.KqglAssoDkmx
;
import
cn.timer.api.bean.kqmk.KqglAssoLeaveRules
;
import
cn.timer.api.bean.kqmk.KqglAssoMonthPunchSummary
;
import
cn.timer.api.bean.kqmk.KqglAssoOvertimeBasics
;
import
cn.timer.api.bean.kqmk.KqglAssoPbmx
;
import
cn.timer.api.bean.kqmk.KqglAssoRelationSummary
;
import
cn.timer.api.bean.kqmk.KqglAssoTeshu
;
import
cn.timer.api.bean.kqmk.KqglAssoZhoupaiban
;
import
cn.timer.api.bean.kqmk.KqglMainKqz
;
import
cn.timer.api.bean.kqmk.KqmkRedletterDay
;
import
cn.timer.api.bean.qyzx.QyzxEntInfoM
;
import
cn.timer.api.bean.yggl.YgglMainLzb
;
import
cn.timer.api.controller.kqgl.ClockInTool
;
import
cn.timer.api.controller.kqgl.EmptyUtil
;
import
cn.timer.api.dao.kqgl.AttendanceWeeklySchMapper
;
import
cn.timer.api.dao.kqgl.PunchCardDetailsMapper
;
import
cn.timer.api.dao.kqgl.PunchRecordMapper
;
import
cn.timer.api.dao.kqgl.ScheduleMapper
;
import
cn.timer.api.dao.kqmk.KqglAssoDkmxMapper
;
import
cn.timer.api.dao.kqmk.KqglAssoLeaveBalanceMapper
;
import
cn.timer.api.dao.kqmk.KqglAssoPbmxMapper
;
import
cn.timer.api.dao.kqmk.KqglAssoRelationSummaryMapper
;
import
cn.timer.api.dao.kqmk.KqglAssoTeshuMapper
;
import
cn.timer.api.dao.kqmk.KqglMainKqzMapper
;
import
cn.timer.api.dao.qyzx.QyzxEntInfoMMapper
;
import
cn.timer.api.dto.kqmk.AdditionalDto
;
import
cn.timer.api.dto.kqmk.AttLateLate
;
import
cn.timer.api.dto.kqmk.AttSchedule
;
import
cn.timer.api.dto.kqmk.AttSubsidiaryDto
;
import
cn.timer.api.dto.kqmk.AttendanceCardListDto
;
import
cn.timer.api.dto.kqmk.KqglAssoPbmxDto
;
import
cn.timer.api.utils.DateUtil
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
/**
* @author 考勤报表汇总数据
*/
@Api
(
tags
=
"考勤汇总数据"
)
@RestController
@Transactional
@RequestMapping
(
value
=
"/kqhz"
,
produces
=
{
"application/json"
,
"multipart/form-data"
})
public
class
OnClickAttendanceTaskTiming
{
@Autowired
private
KqglMainKqzMapper
kqglmainkqzmapper
;
@Autowired
private
QyzxEntInfoMMapper
qyzxentinfommapper
;
@Autowired
private
KqglAssoLeaveBalanceMapper
kqglassoleavebalancemapper
;
@Autowired
private
KqglAssoTeshuMapper
kqglassoteshumapper
;
@Autowired
private
PunchCardDetailsMapper
punchcarddetailsmapper
;
@Autowired
private
AttendanceWeeklySchMapper
attendanceweeklyschmapper
;
@Autowired
private
ScheduleMapper
schedulemapper
;
static
SimpleDateFormat
sdf1
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
static
SimpleDateFormat
sdf2
=
new
SimpleDateFormat
(
"EEE"
);
@Autowired
private
KqglAssoRelationSummaryMapper
kqglassorelationsummarymapper
;
@Autowired
private
PunchRecordMapper
punchrecordmapper
;
@Autowired
private
KqglAssoDkmxMapper
kqglassodkmxmapper
;
@GetMapping
(
value
=
"/thatOnClickAtt"
)
@ApiOperation
(
value
=
"thatOnClickAtt"
,
httpMethod
=
"GET"
,
notes
=
"接口发布说明"
)
public
void
AttendanceTask
()
throws
ParseException
{
boolean
implement
=
true
;
//逻辑
if
(
implement
)
{
Calendar
c
=
Calendar
.
getInstance
();
c
.
add
(
Calendar
.
MONTH
,
0
);
c
.
set
(
Calendar
.
DAY_OF_MONTH
,
1
);
//设置为1号,当前日期既为本月第一天
Long
startDate
=
DateUtil
.
getStartTime
(
0
,
DateUtil
.
getStringTime
(
sdf1
.
format
(
c
.
getTime
()),
"yyyy-MM-dd"
)).
getTime
();
//获取当前月最后一天
Calendar
ca
=
Calendar
.
getInstance
();
ca
.
set
(
Calendar
.
DAY_OF_MONTH
,
ca
.
getActualMaximum
(
Calendar
.
DAY_OF_MONTH
));
Long
endDate
=
DateUtil
.
getnowEndTime
(
23
,
DateUtil
.
getStringTime
(
sdf1
.
format
(
ca
.
getTime
()),
"yyyy-MM-dd"
)).
getTime
();
String
str
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
).
format
(
new
Date
()).
toString
();
//
String
ttstr
=
new
SimpleDateFormat
(
"yyyy-MM"
).
format
(
new
Date
()).
toString
();
//
String
[]
rangeArray
=
ClockInTool
.
listToString
(
ClockInTool
.
getDays
(
sdf1
.
format
(
c
.
getTime
()),
str
)).
split
(
";"
);
//目前为止所有日期
String
[]
range
=
rangeArray
[
0
].
split
(
","
);
int
year
=
Calendar
.
getInstance
().
get
(
Calendar
.
YEAR
);
int
month
=
Calendar
.
getInstance
().
get
(
Calendar
.
MONTH
)
+
1
;
int
summaryid
=
0
;
//汇总id
// List<QyzxEntInfoM> orgcodelist = qyzxentinfommapper.selectList(new QueryWrapper<QyzxEntInfoM>());//系统中的所有公司 所有未到期的公司
List
<
QyzxEntInfoM
>
orgcodelist
=
qyzxentinfommapper
.
selectList
(
new
QueryWrapper
<
QyzxEntInfoM
>().
lambda
().
eq
(
QyzxEntInfoM:
:
getId
,
3
));
for
(
int
t
=
0
;
t
<
orgcodelist
.
size
();
t
++){
int
org_code
=
orgcodelist
.
get
(
t
).
getId
();
//企业组织代码
List
<
AdditionalDto
>
userlist
=
kqglassoleavebalancemapper
.
selectAdditionalList
(
org_code
);
for
(
AdditionalDto
user
:
userlist
)
{
YgglMainLzb
lzb
=
YgglMainLzb
.
builder
().
build
().
selectOne
(
new
QueryWrapper
<
YgglMainLzb
>().
lambda
().
eq
(
YgglMainLzb:
:
getOrgCode
,
org_code
).
eq
(
YgglMainLzb:
:
getJobStatus
,
3
)
.
eq
(
YgglMainLzb:
:
getEmpNum
,
user
.
getEmpnum
()));
if
(
lzb
==
null
)
{
//已离职 的人员不进入计算(已存在的不做任何处理)
KqglAssoMonthPunchSummary
sum
=
KqglAssoMonthPunchSummary
.
builder
().
build
().
selectOne
(
new
QueryWrapper
<
KqglAssoMonthPunchSummary
>().
lambda
().
eq
(
KqglAssoMonthPunchSummary:
:
getOrgCode
,
org_code
)
.
eq
(
KqglAssoMonthPunchSummary:
:
getBelongYear
,
year
).
eq
(
KqglAssoMonthPunchSummary:
:
getBelongMonth
,
month
).
eq
(
KqglAssoMonthPunchSummary:
:
getNum
,
user
.
getEmpnum
()));
if
(
sum
!=
null
)
{
summaryid
=
sum
.
getId
();
}
else
{
summaryid
=
0
;
}
double
traveltotal
=
0
,
egresstotal
=
0
,
overtimetotal
=
0
;
//出差总时长
KqglAssoRelationSummary
travel
=
kqglassorelationsummarymapper
.
SecondaryValue
(
user
.
getEmpnum
(),
3
,
ttstr
);
if
(
travel
!=
null
)
{
traveltotal
=
travel
.
getDuration
();
}
//外出总时长
KqglAssoRelationSummary
egress
=
kqglassorelationsummarymapper
.
SecondaryValue
(
user
.
getEmpnum
(),
4
,
ttstr
);
if
(
egress
!=
null
)
{
egresstotal
=
egress
.
getDuration
();
}
//加班总时长
KqglAssoRelationSummary
overtime
=
kqglassorelationsummarymapper
.
SecondaryValue
(
user
.
getEmpnum
(),
1
,
ttstr
);
if
(
overtime
!=
null
)
{
overtimetotal
=
overtime
.
getDuration
();
}
//考勤组信息
KqglMainKqz
attgro
=
kqglmainkqzmapper
.
getAttendanceGroupInformationByUserid
(
user
.
getEmpnum
(),
org_code
);
//目前为止打卡记录
List
<
PunchCardDetails
>
attendance
=
punchcarddetailsmapper
.
selectAttendanceDays
(
user
.
getEmpnum
(),
startDate
,
endDate
);
int
fdjjrnum
=
0
;
if
(
attgro
!=
null
)
{
//特殊日期中 为法定带薪休假的
List
<
KqglAssoTeshu
>
fdjjr
=
KqglAssoTeshu
.
builder
().
build
().
selectList
(
new
QueryWrapper
<
KqglAssoTeshu
>().
lambda
().
eq
(
KqglAssoTeshu:
:
getKqzid
,
attgro
.
getId
()).
eq
(
KqglAssoTeshu:
:
getLegalday
,
1
).
eq
(
KqglAssoTeshu:
:
getType
,
2
));
fdjjrnum
=
fdjjr
.
size
();
}
int
dkjl
=
0
;
//目前为止打卡次数
int
sbqkcs
=
0
,
xbqkcs
=
0
,
dk
=
0
;
String
[]
sblacks
=
new
String
[
31
];
//上班缺卡天数
String
[]
xblacks
=
new
String
[
31
];
//下班缺卡天数
String
[]
dkjtts
=
new
String
[
attendance
.
size
()];
//目前打卡日期明细
int
bccs
=
0
;
if
(
attendance
.
size
()
>
0
)
{
dkjl
=
attendance
.
size
()
+
fdjjrnum
;
for
(
PunchCardDetails
pcd:
attendance
){
AttendanceCardListDto
attdate
=
MethodCall
(
org_code
,
user
.
getEmpnum
(),
pcd
.
getData
());
List
<
AttSchedule
>
ashss
=
attdate
.
getAttsch
();
//获取今天应打卡时间
if
(
EmptyUtil
.
isNotEmpty
(
attdate
.
getAttsch
())
&&
ashss
.
get
(
0
).
getId
()
!=
0
)
{
//班次不为空
bccs
=
attdate
.
getAttsch
().
size
();
}
dkjtts
[
dk
]
=
pcd
.
getData
();
dk
++;
if
(
bccs
==
2
||
bccs
==
4
||
bccs
==
6
){
if
(
pcd
.
getSbdk1
()
==
null
){
sblacks
[
sbqkcs
]
=
pcd
.
getData
();
sbqkcs
++;
}
if
(
pcd
.
getXbdk1
()
==
null
){
xblacks
[
xbqkcs
]
=
pcd
.
getData
();
xbqkcs
++;
}
}
if
(
bccs
==
4
||
bccs
==
6
){
if
(
pcd
.
getSbdk2
()
==
null
){
sblacks
[
sbqkcs
]
=
pcd
.
getData
();
sbqkcs
++;
}
if
(
pcd
.
getXbdk2
()
==
null
){
xblacks
[
xbqkcs
]
=
pcd
.
getData
();
xbqkcs
++;
}
}
if
(
bccs
==
6
){
if
(
pcd
.
getSbdk3
()
==
null
){
sblacks
[
sbqkcs
]
=
pcd
.
getData
();
sbqkcs
++;
}
if
(
pcd
.
getXbdk3
()
==
null
){
xblacks
[
xbqkcs
]
=
pcd
.
getData
();
xbqkcs
++;
}
}
}
sblacks
=
ClockInTool
.
deleteArrayNull
(
sblacks
);
sbqkcs
=
sblacks
.
length
;
xblacks
=
ClockInTool
.
deleteArrayNull
(
xblacks
);
xbqkcs
=
xblacks
.
length
;
}
String
[]
ycqts
=
new
String
[
31
];
//应上班的具体天数(yyyy-MM-dd)
String
[]
xxts
=
new
String
[
31
];
//休息的具体天数(yyyy-MM-dd)
String
[]
fdxx
=
new
String
[
10
];
//法定休息的具体天数(yyyy-MM-dd)
List
<
String
>
rowData
=
new
ArrayList
<
String
>();
//休息天数,应出勤天数,实际出勤
double
daysOff
=
0
,
daysOnDuty
=
0
;
//,actualAttDays = 0;
int
zjgzts
=
0
;
//目前为止应该出勤的天数
//工作时长(分钟)、严重迟到次数、严重迟到时长(分钟)、旷工迟到次数
double
workinghours
=
0
,
seriouslatetimes
=
0
,
seriouslatehours
=
0
,
absenlatetimes
=
0
;
// 迟到次数 迟到时长 早退次数 早退时长
int
latenum
=
0
,
latehours
=
0
,
leanum
=
0
,
leahours
=
0
;
// 迟到次数
int
answer
=
0
;
//班次ID
//工作日(转调休)、休息日(转调休)、节假日(转调休)
double
workingturncompenleave
=
0
,
restturncompenleave
=
0
,
holidayturncompenleave
=
0
;
//工作日(转调休)
//工作日(转加班费)、休息日(转加班费)、节假日(转加班费)
double
workingtransferovertime
=
0
,
resttransferovertime
=
0
,
holidaytransferovertime
=
0
;
int
attgroid
=
0
;
if
(
attgro
!=
null
){
//该员工是否加入到考勤组 排班方式 1:固定排班;2:自由排班;3:自由工时 计算出应出勤,实际出勤,休息天数
attgroid
=
attgro
.
getId
();
if
(
attgro
.
getPbfs
()
==
1
){
//固定排班
List
<
KqglAssoTeshu
>
bxdklist
=
kqglassoteshumapper
.
ShouldSpecialDatessetByKqzid
(
attgro
.
getId
(),
ttstr
,
1
);
//当前月 必须打卡日期
int
bxdk
=
bxdklist
.
size
();
String
[]
bxdkss
=
new
String
[
bxdk
];
////特殊-必须打卡天数(工作日)
int
b
=
0
;
for
(
KqglAssoTeshu
bxd
:
bxdklist
)
{
bxdkss
[
b
]
=
bxd
.
getTsrq
();
b
++;
}
List
<
KqglAssoTeshu
>
wxdk
=
kqglassoteshumapper
.
ShouldSpecialDatessetByKqzid
(
attgro
.
getId
(),
ttstr
,
2
);
//当前月 无需打卡日期
String
[]
appmaps
=
new
String
[
wxdk
.
size
()];
//特殊-无需打卡天数(休息日)
int
d1
=
0
;
for
(
KqglAssoTeshu
spe:
wxdk
){
appmaps
[
d1
]
=
spe
.
getTsrq
();
d1
++;
}
//应打卡周期时间
List
<
AttendanceWeeklySch
>
atwek
=
attendanceweeklyschmapper
.
selectAttendanceMadeByUserid
(
user
.
getEmpnum
(),
org_code
);
String
[]
week
=
new
String
[
atwek
.
size
()];
String
[]
needfig
=
new
String
[
atwek
.
size
()];
//应打卡周期时间
int
e
=
0
;
for
(
AttendanceWeeklySch
awek
:
atwek
){
week
[
e
]
=
awek
.
getWekmc
();
needfig
[
e
]
=
String
.
valueOf
(
awek
.
getType
());
//获取设置的应打卡周几
e
++;
}
//法定節假日
List
<
KqmkRedletterDay
>
etter
=
KqmkRedletterDay
.
builder
().
build
().
selectList
(
new
QueryWrapper
<
KqmkRedletterDay
>().
lambda
().
eq
(
KqmkRedletterDay:
:
getHolidayStatus
,
1
).
eq
(
KqmkRedletterDay:
:
getBelongYearmonth
,
ttstr
));
String
[]
holidays
=
new
String
[
etter
.
size
()];
//法定节假日沦为休息日计算
int
h
=
0
;
for
(
KqmkRedletterDay
spe:
etter
){
holidays
[
h
]
=
spe
.
getHoliday
();
h
++;
}
String
yemo
=
year
+
"-"
+
month
;
sdf1
.
setLenient
(
false
);
int
y
=
0
,
q
=
0
,
jj
=
0
,
xx
=
0
;
//jj:节假日
String
[]
zdxx
=
new
String
[
31
];
//法定休息的具体天数(yyyy-MM-dd)
for
(
int
i
=
1
;
i
<=
ClockInTool
.
getDaysByYearMonth
(
year
,
month
);
i
++){
boolean
xixi
=
true
;
Date
date1
=
sdf1
.
parse
(
yemo
+
"-"
+
i
);
for
(
int
u
=
0
;
u
<
week
.
length
;
u
++){
if
(
sdf2
.
format
(
date1
).
equals
(
week
[
u
])){
q
++;
y
++;
if
(
Arrays
.
asList
(
appmaps
).
contains
(
String
.
valueOf
(
sdf1
.
format
(
date1
)))){
y
=
y
-
1
;
}
if
(
attgro
.
getIsFdjjr
().
equals
(
1111
))
{
if
(
Arrays
.
asList
(
holidays
).
contains
(
String
.
valueOf
(
sdf1
.
format
(
date1
)))){
y
=
y
-
1
;
jj
++;
}
}
xixi
=
false
;
}
}
if
(
xixi
)
{
zdxx
[
xx
]
=
yemo
+
"-"
+
i
;
xx
++;
}
}
if
(
appmaps
.
length
>
0
)
{
for
(
String
aa
:
ClockInTool
.
deleteArrayNull
(
zdxx
))
{
if
(
appmaps
.
length
>
0
)
{
appmaps
=
ClockInTool
.
doChinFilters
(
ClockInTool
.
deleteArrayNull
(
appmaps
),
aa
);
}
}
}
//全月时间 - 应打卡时间 - 必须打卡时间 + 无需打卡时间
int
xiuxi
=
ClockInTool
.
getDaysByYearMonth
(
year
,
month
)
-
q
-
bxdk
+
appmaps
.
length
+
jj
;
//ClockInTool.getDaysByYearMonth(year,month) - q - bxdk + wxdk.size()+jj;
daysOff
=
xiuxi
;
daysOnDuty
=
y
+
bxdk
;
int
w
=
0
,
x
=
0
;
int
zj
=
6
;
for
(
String
num
:
range
)
{
boolean
xxr
=
true
;
if
(
ClockInTool
.
useArrayUtils
(
needfig
,
String
.
valueOf
(
ClockInTool
.
dateToWeek
(
num
))))
{
//对比排班应打卡时间
String
[]
ycqtst
=
new
String
[
ycqts
.
length
+
zj
];
System
.
arraycopy
(
ycqts
,
0
,
ycqtst
,
0
,
ycqts
.
length
);
ycqtst
[
w
]
=
num
;
ycqts
=
ycqtst
;
w
++;
zjgzts
++;
}
else
{
String
[]
xxtst
=
new
String
[
xxts
.
length
+
zj
];
System
.
arraycopy
(
xxts
,
0
,
xxtst
,
0
,
xxts
.
length
);
xxtst
[
x
]
=
num
;
xxts
=
xxtst
;
x
++;
xxr
=
false
;
}
if
(
ClockInTool
.
useArrayUtils
(
bxdkss
,
num
))
{
//检查是否存在 必须打卡名单中
String
[]
ycqtst
=
new
String
[
ycqts
.
length
+
zj
];
System
.
arraycopy
(
ycqts
,
0
,
ycqtst
,
0
,
ycqts
.
length
);
ycqtst
[
w
]
=
num
;
ycqts
=
ycqtst
;
w
++;
zjgzts
++;
xxts
=
ClockInTool
.
doChinFilters
(
ClockInTool
.
deleteArrayNull
(
xxts
),
num
);
//为必须上班的话从休息日期中去除
}
if
(
ClockInTool
.
useArrayUtils
(
appmaps
,
num
))
{
//检查是否存在 无需打卡名单中
ycqts
=
ClockInTool
.
doChinFilters
(
ycqts
,
num
);
//为必须休息的话从上班日期中去除
//防止休息日重复减
if
(
xxr
)
{
zjgzts
=
zjgzts
-
1
;
}
String
[]
xxtst
=
new
String
[
xxts
.
length
+
zj
];
System
.
arraycopy
(
xxts
,
0
,
xxtst
,
0
,
xxts
.
length
);
xxtst
[
x
]
=
num
;
xxts
=
xxtst
;
x
++;
}
}
}
else
if
(
attgro
.
getPbfs
()
==
2
){
//自由排班
DateFormat
df
=
new
SimpleDateFormat
(
"EEE MMM dd HH:mm:ss zzz yyyy"
,
Locale
.
US
);
List
<
Schedule
>
ycqs
=
schedulemapper
.
getAttendanceShouldList
(
user
.
getEmpnum
(),
startDate
,
endDate
);
int
xiuxi
=
0
,
shangban
=
0
,
z
=
0
;
String
[]
ziyoupb
=
new
String
[
ycqs
.
size
()];
for
(
Schedule
sc
:
ycqs
){
String
data
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
).
format
(
df
.
parse
(
String
.
valueOf
(
sc
.
getData
())));
// 获得格式化后的日期字符串
ziyoupb
[
z
]
=
data
;
z
++;
if
(
sc
.
getBcid
().
equals
(
0
)){
xiuxi
++;
}
else
{
shangban
++;
}
}
daysOff
=
xiuxi
;
daysOnDuty
=
shangban
;
//目前为止应出勤天数
int
y
=
0
,
x
=
0
;
for
(
String
num
:
range
)
{
if
(
ClockInTool
.
useArrayUtils
(
ziyoupb
,
num
))
{
KqglAssoPbmx
pbx
=
KqglAssoPbmx
.
builder
().
build
().
selectOne
(
new
QueryWrapper
<
KqglAssoPbmx
>().
lambda
().
eq
(
KqglAssoPbmx:
:
getUserid
,
user
.
getEmpnum
()).
eq
(
KqglAssoPbmx:
:
getData
,
num
).
eq
(
KqglAssoPbmx:
:
getKqzid
,
attgro
.
getId
()));
if
(
pbx
!=
null
&&
pbx
.
getBcid
()!=
0
)
{
ycqts
[
y
]
=
num
;
y
++;
zjgzts
++;
}
else
{
xxts
[
x
]
=
num
;
x
++;
}
}
}
}
else
{
List
<
AttendanceWeeklySch
>
atwek
=
attendanceweeklyschmapper
.
selectAttendanceMadeByZhou
(
user
.
getEmpnum
(),
org_code
);
String
[]
week
=
new
String
[
atwek
.
size
()];
int
e
=
0
;
String
[]
ziyoupb
=
new
String
[
atwek
.
size
()];
for
(
AttendanceWeeklySch
awek
:
atwek
){
week
[
e
]
=
awek
.
getWekmc
();
ziyoupb
[
e
]
=
String
.
valueOf
(
awek
.
getType
());
e
++;
}
String
yemo
=
year
+
"-"
+
month
;
sdf1
.
setLenient
(
false
);
int
y
=
0
;
for
(
int
i
=
1
;
i
<=
ClockInTool
.
getDaysByYearMonth
(
year
,
month
);
i
++){
Date
date1
=
sdf1
.
parse
(
yemo
+
"-"
+
i
);
for
(
int
u
=
0
;
u
<
week
.
length
;
u
++){
if
(
sdf2
.
format
(
date1
).
equals
(
week
[
u
])){
y
++;
}
}
}
int
xiuxi
=
ClockInTool
.
getDaysByYearMonth
(
year
,
month
)
-
y
;
daysOff
=
xiuxi
;
daysOnDuty
=
y
;
//目前为止应出勤天数
int
g
=
0
,
x
=
0
;
for
(
String
num
:
range
)
{
if
(
ClockInTool
.
useArrayUtils
(
ziyoupb
,
String
.
valueOf
(
ClockInTool
.
dateToWeek
(
num
))))
{
//对比排班应打卡时间
ycqts
[
g
]
=
num
;
g
++;
zjgzts
++;
}
else
{
xxts
[
x
]
=
num
;
x
++;
}
}
}
List
<
PunchRecord
>
initial
=
punchrecordmapper
.
getMaintenancePunchCardList
(
startDate
,
endDate
,
user
.
getEmpnum
(),
org_code
);
// // 迟到次数 迟到时长 早退次数 早退时长
// int latenum = 0,latehours = 0,leanum = 0,leahours = 0;// 迟到次数
String
[]
cdts
=
new
String
[
31
];
//迟到的具体天数
String
[]
ztts
=
new
String
[
31
];
//早退的具体天数
if
(
initial
.
size
()
>
0
){
for
(
PunchRecord
prd
:
initial
){
if
(
prd
.
getType
()
==
1
&&
prd
.
getResults
()
>
0
){
cdts
[
latenum
]
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
).
format
(
prd
.
getDktime
());
latenum
++;
latehours
+=
prd
.
getResults
();
}
if
(
prd
.
getType
()
==
2
&&
prd
.
getResults
()
>
0
){
ztts
[
leanum
]
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
).
format
(
prd
.
getDktime
());
leanum
++;
leahours
+=
prd
.
getResults
();
}
}
}
AttSubsidiaryDto
subs
=
kqglassodkmxmapper
.
subsidiary
(
user
.
getEmpnum
(),
ttstr
);
// //工作时长(分钟)、严重迟到次数、严重迟到时长(分钟)、旷工迟到次数
// double workinghours = 0,seriouslatetimes = 0,seriouslatehours = 0,absenlatetimes = 0;
if
(
subs
!=
null
)
{
workinghours
=
subs
.
getGzsctotalgzsc
();
seriouslatetimes
=
subs
.
getYzcdcstotal
();
seriouslatehours
=
subs
.
getYzcdsctotal
();
absenlatetimes
=
subs
.
getKgcdfzstotal
();
}
//具体请假天数
List
<
KqglAssoRelationSummary
>
leavetotal
=
kqglassorelationsummarymapper
.
SpecificLeave
(
user
.
getEmpnum
(),
2
,
ttstr
,
org_code
);
String
[]
leaves
=
new
String
[
leavetotal
.
size
()];
int
l
=
0
;
if
(
leavetotal
.
size
()>
0
)
{
for
(
KqglAssoRelationSummary
lea
:
leavetotal
){
leaves
[
l
]
=
lea
.
getAppTime
();
l
++;
}
}
//具体加班天数
List
<
KqglAssoRelationSummary
>
overtitotal
=
kqglassorelationsummarymapper
.
SpecificLeave
(
user
.
getEmpnum
(),
1
,
ttstr
,
org_code
);
String
[]
overtimes
=
new
String
[
overtitotal
.
size
()];
int
o
=
0
;
if
(
overtitotal
.
size
()
>
0
)
{
for
(
KqglAssoRelationSummary
over
:
overtitotal
)
{
overtimes
[
o
]
=
over
.
getAppTime
();
o
++;
}
}
//具体出差天数
List
<
KqglAssoRelationSummary
>
trtotal
=
kqglassorelationsummarymapper
.
SpecificLeave
(
user
.
getEmpnum
(),
3
,
ttstr
,
org_code
);
String
[]
travels
=
new
String
[
trtotal
.
size
()];
int
cx
=
0
;
if
(
trtotal
.
size
()>
0
)
{
for
(
KqglAssoRelationSummary
trt
:
trtotal
)
{
travels
[
cx
]
=
trt
.
getAppTime
();
cx
++;
}
}
//具体外出天数
List
<
KqglAssoRelationSummary
>
goouttotal
=
kqglassorelationsummarymapper
.
SpecificLeave
(
user
.
getEmpnum
(),
4
,
ttstr
,
org_code
);
String
[]
goouts
=
new
String
[
goouttotal
.
size
()];
int
wc
=
0
;
if
(
goouttotal
.
size
()>
0
)
{
for
(
KqglAssoRelationSummary
go:
goouttotal
)
{
goouts
[
wc
]
=
go
.
getAppTime
();
wc
++;
}
}
//具体补卡天数
List
<
KqglAssoRelationSummary
>
cardtotal
=
kqglassorelationsummarymapper
.
SpecificLeave
(
user
.
getEmpnum
(),
5
,
ttstr
,
org_code
);
String
[]
cards
=
new
String
[
cardtotal
.
size
()];
int
bk
=
0
;
if
(
cardtotal
.
size
()>
0
)
{
for
(
KqglAssoRelationSummary
car
:
cardtotal
)
{
cards
[
bk
]
=
car
.
getAppTime
();
bk
++;
}
}
//排查请假是否在最后一次打卡范围内 查询当月的请假所有日期
List
<
KqglAssoRelationSummary
>
leainv
=
kqglassorelationsummarymapper
.
LeaveInvestigation
(
user
.
getEmpnum
(),
2
,
ttstr
,
org_code
);
String
beginTime
=
sdf1
.
format
(
new
Date
());
//1:加班 2:请假 3:出差 4:外出 5:补卡
int
u
=
0
;
int
p
=
1
;
for
(
String
num
:
range
)
{
try
{
String
sjs
=
""
,
qinjia
=
""
,
chuaca
=
""
,
waichu
=
""
,
buka
=
""
,
jiaban
=
""
;
if
(
ClockInTool
.
useArrayUtils
(
ClockInTool
.
deleteArrayNull
(
xxts
),
num
)
&&
ClockInTool
.
useArrayUtils
(
ClockInTool
.
deleteArrayNull
(
dkjtts
),
num
))
{
rowData
.
add
(
"休息并打卡"
);
}
else
if
(
ClockInTool
.
useArrayUtils
(
ClockInTool
.
deleteArrayNull
(
xxts
),
num
)
&&
!
ClockInTool
.
useArrayUtils
(
ClockInTool
.
deleteArrayNull
(
fdxx
),
num
)){
rowData
.
add
(
"休息"
);
}
else
if
(
ClockInTool
.
useArrayUtils
(
ClockInTool
.
deleteArrayNull
(
fdxx
),
num
)){
rowData
.
add
(
"法定节假日休息"
);
}
else
{
if
(
ClockInTool
.
useArrayUtils
(
ClockInTool
.
deleteArrayNull
(
ycqts
),
num
)
&&
!
ClockInTool
.
useArrayUtils
(
ClockInTool
.
deleteArrayNull
(
dkjtts
),
num
)
&&
!
ClockInTool
.
useArrayUtils
(
ClockInTool
.
deleteArrayNull
(
leaves
),
num
)
&&
!
ClockInTool
.
useArrayUtils
(
ClockInTool
.
deleteArrayNull
(
travels
),
num
)
&&
!
ClockInTool
.
useArrayUtils
(
ClockInTool
.
deleteArrayNull
(
goouts
),
num
)
&&
!
ClockInTool
.
useArrayUtils
(
ClockInTool
.
deleteArrayNull
(
cards
),
num
))
{
rowData
.
add
(
"旷工"
);
}
else
if
(!
ClockInTool
.
useArrayUtils
(
ClockInTool
.
deleteArrayNull
(
ycqts
),
num
)
&&
!
ClockInTool
.
useArrayUtils
(
ClockInTool
.
deleteArrayNull
(
xxts
),
num
))
{
//日期不在上班也不在休息里面即为未排班
rowData
.
add
(
"未排班"
);
}
else
if
(
sdf1
.
parse
(
beginTime
).
getTime
()
<
sdf1
.
parse
(
num
).
getTime
())
{
rowData
.
add
(
"未到班期"
);
}
else
{
if
(
ClockInTool
.
useArrayUtils
(
ClockInTool
.
deleteArrayNull
(
sblacks
),
num
))
{
rowData
.
add
(
"上班缺卡"
);
}
else
if
(
ClockInTool
.
useArrayUtils
(
ClockInTool
.
deleteArrayNull
(
sblacks
),
num
)
&&
ClockInTool
.
useArrayUtils
(
ClockInTool
.
deleteArrayNull
(
ztts
),
num
))
{
rowData
.
add
(
"上班缺卡,下班早退"
);
}
else
if
(
ClockInTool
.
useArrayUtils
(
ClockInTool
.
deleteArrayNull
(
cdts
),
num
))
{
KqglAssoDkmx
dkm
=
KqglAssoDkmx
.
builder
().
build
().
selectOne
(
new
QueryWrapper
<
KqglAssoDkmx
>().
lambda
().
eq
(
KqglAssoDkmx:
:
getUserid
,
user
.
getEmpnum
())
.
eq
(
KqglAssoDkmx:
:
getQyid
,
org_code
).
eq
(
KqglAssoDkmx:
:
getData
,
num
));
if
(
dkm
.
getYdkcs
()
==
2
||
dkm
.
getYdkcs
()
==
4
||
dkm
.
getYdkcs
()
==
6
)
{
if
(
dkm
.
getSbdk1jg
()
>
0
)
{
rowData
.
add
(
"上班1迟到,打卡时间:"
+
ClockInTool
.
stampToDate3
(
String
.
valueOf
(
dkm
.
getSbdk1
()))+
",迟到"
+
dkm
.
getSbdk1jg
()+
"分钟"
);
}
}
if
(
dkm
.
getYdkcs
()
==
4
||
dkm
.
getYdkcs
()
==
6
)
{
if
(
dkm
.
getSbdk2jg
()
>
0
)
{
rowData
.
add
(
"上班2迟到,打卡时间:"
+
ClockInTool
.
stampToDate3
(
String
.
valueOf
(
dkm
.
getSbdk2
()))+
",迟到"
+
dkm
.
getSbdk2jg
()+
"分钟"
);
}
}
if
(
dkm
.
getYdkcs
()
==
6
)
{
if
(
dkm
.
getSbdk3jg
()
>
0
)
{
rowData
.
add
(
"上班3迟到,打卡时间:"
+
ClockInTool
.
stampToDate3
(
String
.
valueOf
(
dkm
.
getSbdk3
()))+
",迟到"
+
dkm
.
getSbdk3jg
()+
"分钟"
);
}
}
}
else
if
(
ClockInTool
.
useArrayUtils
(
ClockInTool
.
deleteArrayNull
(
cdts
),
num
)
&&
ClockInTool
.
useArrayUtils
(
ClockInTool
.
deleteArrayNull
(
xblacks
),
num
))
{
rowData
.
add
(
"上班迟到,下班缺卡"
);
}
else
if
(
ClockInTool
.
useArrayUtils
(
ClockInTool
.
deleteArrayNull
(
cdts
),
num
)
&&
ClockInTool
.
useArrayUtils
(
ClockInTool
.
deleteArrayNull
(
ztts
),
num
))
{
rowData
.
add
(
"上班迟到,下班早退"
);
}
else
if
(
ClockInTool
.
useArrayUtils
(
ClockInTool
.
deleteArrayNull
(
xblacks
),
num
))
{
rowData
.
add
(
"下班缺卡"
);
}
else
if
(
ClockInTool
.
useArrayUtils
(
ClockInTool
.
deleteArrayNull
(
ztts
),
num
))
{
KqglAssoDkmx
dkm
=
KqglAssoDkmx
.
builder
().
build
().
selectOne
(
new
QueryWrapper
<
KqglAssoDkmx
>().
lambda
().
eq
(
KqglAssoDkmx:
:
getUserid
,
user
.
getEmpnum
())
.
eq
(
KqglAssoDkmx:
:
getQyid
,
org_code
).
eq
(
KqglAssoDkmx:
:
getData
,
num
));
if
(
dkm
.
getYdkcs
()
==
2
||
dkm
.
getYdkcs
()
==
4
||
dkm
.
getYdkcs
()
==
6
)
{
if
(
dkm
.
getXbdk1jg
()
>
0
)
{
rowData
.
add
(
"下班1早退,打卡时间:"
+
ClockInTool
.
stampToDate3
(
String
.
valueOf
(
dkm
.
getXbdk1
()))+
",早退"
+
dkm
.
getXbdk1jg
()+
"分钟"
);
}
}
if
(
dkm
.
getYdkcs
()
==
4
||
dkm
.
getYdkcs
()
==
6
)
{
if
(
dkm
.
getXbdk2jg
()
>
0
)
{
rowData
.
add
(
"下班2早退,打卡时间:"
+
ClockInTool
.
stampToDate3
(
String
.
valueOf
(
dkm
.
getXbdk2
()))+
",早退"
+
dkm
.
getXbdk2jg
()+
"分钟"
);
}
}
if
(
dkm
.
getYdkcs
()
==
6
)
{
if
(
dkm
.
getXbdk3jg
()
>
0
)
{
rowData
.
add
(
"下班3早退,打卡时间:"
+
ClockInTool
.
stampToDate3
(
String
.
valueOf
(
dkm
.
getXbdk3
()))+
",早退"
+
dkm
.
getXbdk3jg
()+
"分钟"
);
}
}
}
else
{
rowData
.
add
(
"正常"
);
}
}
}
/******/
if
(
ClockInTool
.
contains
(
ClockInTool
.
deleteArrayNull
(
leaves
),
num
))
{
KqglAssoRelationSummary
lea
=
KqglAssoRelationSummary
.
builder
().
build
().
selectOne
(
new
QueryWrapper
<
KqglAssoRelationSummary
>().
lambda
().
eq
(
KqglAssoRelationSummary:
:
getUserId
,
user
.
getEmpnum
()).
eq
(
KqglAssoRelationSummary:
:
getAppTime
,
num
).
eq
(
KqglAssoRelationSummary:
:
getApprovalType
,
2
).
eq
(
KqglAssoRelationSummary:
:
getOrgCode
,
org_code
));
String
leavetype
=
"未知"
;
//请假类型
String
company
=
"未知"
;
//请假单位
if
(
lea
!=
null
)
{
KqglAssoLeaveRules
rul
=
KqglAssoLeaveRules
.
builder
().
build
().
selectOne
(
new
QueryWrapper
<
KqglAssoLeaveRules
>().
lambda
().
eq
(
KqglAssoLeaveRules:
:
getId
,
lea
.
getLeaveTypeId
()));
if
(
rul
!=
null
)
{
leavetype
=
rul
.
getName
();
//1:按天请假;2:按半天;3:按小时
if
(
rul
.
getCompany
()
==
1
)
{
company
=
"天"
;
}
else
if
(
rul
.
getCompany
()
==
2
)
{
company
=
"半天"
;
}
else
{
company
=
"小时"
;
}
}
}
qinjia
=
"#"
+(
lea
.
getStartTime
()).
substring
(
5
,
16
)
+
"到"
+
(
lea
.
getEndTime
()).
substring
(
5
,
16
)+
"请"
+
leavetype
+
lea
.
getDuration
()+
company
;
}
if
(
ClockInTool
.
contains
(
ClockInTool
.
deleteArrayNull
(
travels
),
num
))
{
KqglAssoRelationSummary
lea
=
KqglAssoRelationSummary
.
builder
().
build
().
selectOne
(
new
QueryWrapper
<
KqglAssoRelationSummary
>().
lambda
().
eq
(
KqglAssoRelationSummary:
:
getUserId
,
user
.
getEmpnum
()).
eq
(
KqglAssoRelationSummary:
:
getAppTime
,
num
).
eq
(
KqglAssoRelationSummary:
:
getApprovalType
,
3
).
eq
(
KqglAssoRelationSummary:
:
getOrgCode
,
org_code
));
chuaca
=
"#"
+(
lea
.
getStartTime
()).
substring
(
5
,
16
)
+
"到"
+
(
lea
.
getEndTime
()).
substring
(
5
,
16
)+
"出差"
+
lea
.
getDuration
()+
"天"
;
}
if
(
ClockInTool
.
contains
(
ClockInTool
.
deleteArrayNull
(
goouts
),
num
))
{
KqglAssoRelationSummary
lea
=
KqglAssoRelationSummary
.
builder
().
build
().
selectOne
(
new
QueryWrapper
<
KqglAssoRelationSummary
>().
lambda
().
eq
(
KqglAssoRelationSummary:
:
getUserId
,
user
.
getEmpnum
()).
eq
(
KqglAssoRelationSummary:
:
getAppTime
,
num
).
eq
(
KqglAssoRelationSummary:
:
getApprovalType
,
4
).
eq
(
KqglAssoRelationSummary:
:
getOrgCode
,
org_code
));
waichu
=
"#"
+(
lea
.
getStartTime
()).
substring
(
5
,
16
)
+
"到"
+
(
lea
.
getEndTime
()).
substring
(
5
,
16
)+
"外出"
+
lea
.
getDuration
()+
"天"
;
}
if
(
ClockInTool
.
contains
(
ClockInTool
.
deleteArrayNull
(
cards
),
num
))
{
KqglAssoRelationSummary
lea
=
KqglAssoRelationSummary
.
builder
().
build
().
selectOne
(
new
QueryWrapper
<
KqglAssoRelationSummary
>().
lambda
().
eq
(
KqglAssoRelationSummary:
:
getUserId
,
user
.
getEmpnum
()).
eq
(
KqglAssoRelationSummary:
:
getAppTime
,
num
).
eq
(
KqglAssoRelationSummary:
:
getApprovalType
,
5
).
eq
(
KqglAssoRelationSummary:
:
getOrgCode
,
org_code
));
buka
=
"#"
+
"已补卡:"
+(
lea
.
getStartTime
()).
substring
(
5
,
16
);
}
if
(
ClockInTool
.
contains
(
ClockInTool
.
deleteArrayNull
(
overtimes
),
num
))
{
String
company
=
"未知"
,
method
=
"无"
;
//加班单位、加班补偿方式
List
<
KqglAssoRelationSummary
>
leas
=
KqglAssoRelationSummary
.
builder
().
build
().
selectList
(
new
QueryWrapper
<
KqglAssoRelationSummary
>().
lambda
().
eq
(
KqglAssoRelationSummary:
:
getUserId
,
user
.
getEmpnum
()).
eq
(
KqglAssoRelationSummary:
:
getAppTime
,
num
).
eq
(
KqglAssoRelationSummary:
:
getApprovalType
,
1
).
eq
(
KqglAssoRelationSummary:
:
getOrgCode
,
org_code
));
for
(
KqglAssoRelationSummary
lea
:
leas
)
{
//最小加班单位 1:按分钟加班、2:按半小时加班、3:按小时加班、4:按半天加班、5:按天加班
KqglAssoOvertimeBasics
basics
=
KqglAssoOvertimeBasics
.
builder
().
build
().
selectOne
(
new
QueryWrapper
<
KqglAssoOvertimeBasics
>().
lambda
().
eq
(
KqglAssoOvertimeBasics:
:
getOrgCode
,
org_code
));
if
(
basics
.
getMinimumUnit
()
==
1
)
{
company
=
"分钟"
;
}
else
if
(
basics
.
getMinimumUnit
()
==
2
)
{
company
=
"半小时"
;}
else
if
(
basics
.
getMinimumUnit
()
==
3
)
{
company
=
"小时"
;}
else
if
(
basics
.
getMinimumUnit
()
==
4
)
{
company
=
"半天"
;}
else
if
(
basics
.
getMinimumUnit
()
==
5
)
{
company
=
"天"
;}
//1:转调休;2:转加班费;3:转调休或加班费
if
(
lea
.
getCompensateId
()
==
1
)
{
method
=
"转调休"
;
}
else
if
(
lea
.
getCompensateId
()
==
2
)
{
method
=
"转加班费"
;
}
else
{
method
=
"转调休或加班费"
;}
jiaban
=
"#"
+(
lea
.
getStartTime
()).
substring
(
5
,
16
)
+
"到"
+
(
lea
.
getEndTime
()).
substring
(
5
,
16
)+
"加班"
+
lea
.
getDuration
()+
company
+
"["
+
method
+
"]"
;
//防止多运算
if
(
lea
.
getOrdernum
()
==
lea
.
getTotals
())
{
//加班补偿方式 1:转调休;2:转加班费;3:转调休或加班费
//工作日
if
(
ClockInTool
.
contains
(
ClockInTool
.
deleteArrayNull
(
ycqts
),
num
))
{
if
(
lea
.
getOvertimeTypeId
()
==
1
)
{
if
(
lea
.
getCompensateId
()
==
1
||
lea
.
getCompensateId
()
==
3
)
{
workingturncompenleave
=
workingturncompenleave
+
lea
.
getDuration
();
}
else
if
(
lea
.
getCompensateId
()
==
2
||
lea
.
getCompensateId
()
==
4
)
{
workingtransferovertime
=
workingtransferovertime
+
+
lea
.
getDuration
();
}
}
}
//休息日
if
(
ClockInTool
.
contains
(
ClockInTool
.
deleteArrayNull
(
xxts
),
num
))
{
if
(
lea
.
getOvertimeTypeId
()
==
2
)
{
if
(
lea
.
getCompensateId
()
==
1
||
lea
.
getCompensateId
()
==
3
)
{
restturncompenleave
=
restturncompenleave
+
lea
.
getDuration
();
}
else
if
(
lea
.
getCompensateId
()
==
2
||
lea
.
getCompensateId
()
==
4
)
{
resttransferovertime
=
resttransferovertime
+
lea
.
getDuration
();
}
}
}
if
(!
ClockInTool
.
contains
(
ClockInTool
.
deleteArrayNull
(
ycqts
),
num
)
&&
!
ClockInTool
.
contains
(
ClockInTool
.
deleteArrayNull
(
xxts
),
num
))
{
if
(
lea
.
getOvertimeTypeId
()
==
3
)
{
if
(
lea
.
getCompensateId
()
==
1
||
lea
.
getCompensateId
()
==
3
)
{
holidayturncompenleave
=
holidayturncompenleave
+
lea
.
getDuration
();
}
else
if
(
lea
.
getCompensateId
()
==
2
||
lea
.
getCompensateId
()
==
4
)
{
holidaytransferovertime
=
holidaytransferovertime
+
lea
.
getDuration
();
}
}
}
}
}
}
if
(
rowData
.
size
()
==
p
)
{
sjs
=
""
;
if
((
""
).
equals
(
qinjia
)
&&
(
""
).
equals
(
chuaca
)
&&
(
""
).
equals
(
waichu
)
&&
(
""
).
equals
(
buka
)
&&
(
""
).
equals
(
jiaban
))
{
sjs
=
rowData
.
get
(
u
);
}
else
{
sjs
=
rowData
.
get
(
u
)+
";"
;
}
}
rowData
.
remove
(
u
);
rowData
.
add
(
u
,
sjs
+
qinjia
+
chuaca
+
waichu
+
buka
+
jiaban
);
/****/
KqglAssoBcsz
shif
=
KqglAssoBcsz
.
builder
().
build
();
if
(
attgro
.
getPbfs
()
==
1
){
int
several
=
Integer
.
valueOf
(
ClockInTool
.
dateToWeek
(
num
));
//
KqglAssoTeshu
tesu
=
KqglAssoTeshu
.
builder
().
build
().
selectOne
(
new
QueryWrapper
<
KqglAssoTeshu
>().
lambda
().
eq
(
KqglAssoTeshu:
:
getKqzid
,
attgro
.
getId
()).
eq
(
KqglAssoTeshu:
:
getTsrq
,
num
));
if
(
tesu
==
null
)
{
//获取该员工最新班次
KqglAssoZhoupaiban
gudingpb
=
KqglAssoZhoupaiban
.
builder
().
build
().
selectOne
(
new
QueryWrapper
<
KqglAssoZhoupaiban
>().
lambda
().
eq
(
KqglAssoZhoupaiban:
:
getKqzid
,
attgro
.
getId
())
.
eq
(
KqglAssoZhoupaiban:
:
getType
,
several
));
if
(
gudingpb
!=
null
)
{
shif
=
shif
.
selectOne
(
new
QueryWrapper
<
KqglAssoBcsz
>().
lambda
().
eq
(
KqglAssoBcsz:
:
getId
,
gudingpb
.
getBcid
()));
}
}
else
{
if
(
tesu
.
getBcid
()
>
0
)
{
shif
=
shif
.
selectOne
(
new
QueryWrapper
<
KqglAssoBcsz
>().
lambda
().
eq
(
KqglAssoBcsz:
:
getId
,
tesu
.
getBcid
()));
}
}
//获取该员工最新班次
KqglAssoZhoupaiban
gudingpb
=
KqglAssoZhoupaiban
.
builder
().
build
().
selectOne
(
new
QueryWrapper
<
KqglAssoZhoupaiban
>().
lambda
().
eq
(
KqglAssoZhoupaiban:
:
getKqzid
,
attgro
.
getId
())
.
eq
(
KqglAssoZhoupaiban:
:
getType
,
several
));
if
(
gudingpb
!=
null
)
{
shif
=
KqglAssoBcsz
.
builder
().
build
();
shif
=
shif
.
selectOne
(
new
QueryWrapper
<
KqglAssoBcsz
>().
lambda
().
eq
(
KqglAssoBcsz:
:
getId
,
gudingpb
.
getBcid
()));
}
}
else
if
(
attgro
.
getPbfs
()
==
2
){
KqglAssoPbmx
pbmxx
=
KqglAssoPbmx
.
builder
().
build
().
selectOne
(
new
QueryWrapper
<
KqglAssoPbmx
>().
lambda
().
eq
(
KqglAssoPbmx:
:
getUserid
,
user
.
getEmpnum
()).
eq
(
KqglAssoPbmx:
:
getData
,
num
).
eq
(
KqglAssoPbmx:
:
getKqzid
,
attgro
.
getId
()));
if
(
pbmxx
!=
null
&&
pbmxx
.
getBcid
()
!=
0
)
{
shif
=
shif
.
selectOne
(
new
QueryWrapper
<
KqglAssoBcsz
>().
lambda
().
eq
(
KqglAssoBcsz:
:
getId
,
pbmxx
.
getBcid
()));
}
}
if
(
shif
!=
null
&&
shif
.
getSxbcs
()
!=
null
)
{
System
.
out
.
println
(
shif
.
getSxbcs
());
answer
=
shif
.
getSxbcs
();
//1=2次 2=4次 3=6次
//未打最后一次卡的时候 判断最后一次打卡时间是否在请假范围内 相对应减少下班缺卡次数
//最后一次应打卡时间
String
latimeclock
=
""
;
if
(
answer
==
1
)
{
latimeclock
=
num
+
" "
+
shif
.
getXbdk1
();
//ClockInTool.dealDateFormat(shif.getXbdk1(),3);
}
else
if
(
answer
==
2
)
{
latimeclock
=
num
+
" "
+
shif
.
getXbdk2
();
//ClockInTool.dealDateFormat(shif.getXbdk2(),3);
}
else
{
latimeclock
=
num
+
" "
+
shif
.
getXbdk3
();
//ClockInTool.dealDateFormat(shif.getXbdk3(),3);
}
for
(
KqglAssoRelationSummary
learel:
leainv
)
{
boolean
adopt
=
ClockInTool
.
hourMinuteBetween
(
latimeclock
,
learel
.
getStartTime
().
substring
(
0
,
16
),
learel
.
getEndTime
().
substring
(
0
,
16
),
"yyyy-MM-dd HH:mm"
);
if
(
adopt
)
{
xbqkcs
=
xbqkcs
-
1
;
}
}
}
u
++;
p
++;
}
catch
(
Exception
e
)
{
System
.
err
.
println
(
"出错"
);
}
}
}
else
{
for
(
String
num2
:
range
)
{
if
(
ClockInTool
.
useArrayUtils
(
dkjtts
,
num2
))
{
rowData
.
add
(
"未排班并打卡"
);
}
else
{
rowData
.
add
(
"未排班"
);
}
}
System
.
err
.
print
(
user
.
getEmpnum
()+
"该员工未加入考勤组"
);
}
String
[]
range1
=
ClockInTool
.
listToString
(
rowData
).
split
(
";"
);
String
[]
noticesArray
=
range1
[
0
].
split
(
","
);
noticesArray
=
ClockInTool
.
arrycopy
(
noticesArray
);
for
(
int
ct
=
noticesArray
.
length
-
1
;
ct
<
31
;
ct
++)
{
noticesArray
[
ct
]
=
""
;
if
(
ct
<
30
)
{
noticesArray
=
ClockInTool
.
arrycopy
(
noticesArray
);
}
}
String
department
=
""
,
position
=
""
;
if
(
user
.
getDepartment
()
!=
null
)
{
department
=
user
.
getDepartment
();
}
if
(
user
.
getPosition
()
!=
null
)
{
position
=
user
.
getPosition
();
}
KqglAssoMonthPunchSummary
summary
=
KqglAssoMonthPunchSummary
.
builder
().
name
(
user
.
getEmpname
()).
num
(
user
.
getEmpnum
()).
dept
(
department
)
.
post
(
position
).
attGroup
(
attgroid
).
shift
(
answer
).
build
();
summary
.
setDaysOnDuty
(
daysOnDuty
);
//应出勤天数
summary
.
setActualAttDays
(
Double
.
valueOf
(
dkjl
));
//实际出勤天数
summary
.
setDaysOff
(
daysOff
);
//休息天数
summary
.
setWorkingHours
(
workinghours
);
summary
.
setLateTimes
(
Double
.
valueOf
(
latenum
));
//迟到次数
summary
.
setLateHours
(
Double
.
valueOf
(
latehours
));
//迟到时长(分钟)
summary
.
setSeriousLateTimes
(
seriouslatetimes
);
//严重迟到次数
summary
.
setSeriousLateHours
(
seriouslatehours
);
//严重迟到时长(分钟)
summary
.
setAbsenLateTimes
(
absenlatetimes
);
//旷工迟到次数
summary
.
setEarlyLeaveTimes
(
Double
.
valueOf
(
leanum
));
//早退次数
summary
.
setLengthEarlyLeave
(
Double
.
valueOf
(
leahours
));
//早退时长(分钟)
summary
.
setNumberWorkCardShortage
(
Double
.
valueOf
(
sbqkcs
));
//上班缺卡次数
summary
.
setNumberDutyCardShortage
(
Double
.
valueOf
(
xbqkcs
<
0
?
0
:
xbqkcs
));
//下班缺卡次数
summary
.
setLengthBusinessTrip
(
traveltotal
);
//出差时长
summary
.
setTimeOut
(
egresstotal
);
//外出时长
summary
.
setTotalOvertimeHours
(
overtimetotal
);
//加班总时长
summary
.
setBelongYear
(
ca
.
get
(
Calendar
.
YEAR
));
summary
.
setBelongMonth
(
ca
.
get
(
Calendar
.
MONTH
)+
1
);
summary
.
setOrgCode
(
org_code
);
summary
.
setLastModified
(
new
Date
().
getTime
());
int
absenteeismdays
=
0
;
if
(
zjgzts
-
dkjl
>
0
)
{
absenteeismdays
=
zjgzts
-
dkjl
;
}
summary
.
setAbsenteeismDays
(
Double
.
valueOf
(
absenteeismdays
));
//旷工天数
summary
.
setWorkingTurnCompenLeave
(
workingturncompenleave
);
//工作日(转调休)
summary
.
setRestTurnCompenLeave
(
restturncompenleave
);
//休息日(转调休)
summary
.
setHolidayTurnCompenLeave
(
holidayturncompenleave
);
//节假日(转调休)
summary
.
setWorkingTransferOvertime
(
workingtransferovertime
);
//工作日(转加班费)
summary
.
setRestTransferOvertime
(
resttransferovertime
);
//休息日(转加班费)
summary
.
setHolidayTransferOvertime
(
holidaytransferovertime
);
//节假日(转加班费)
summary
.
setDay1
(
noticesArray
[
0
]);
summary
.
setDay2
(
noticesArray
[
1
]);
summary
.
setDay3
(
noticesArray
[
2
]);
summary
.
setDay4
(
noticesArray
[
3
]);
summary
.
setDay5
(
noticesArray
[
4
]);
summary
.
setDay6
(
noticesArray
[
5
]);
summary
.
setDay7
(
noticesArray
[
6
]);
summary
.
setDay8
(
noticesArray
[
7
]);
summary
.
setDay9
(
noticesArray
[
8
]);
summary
.
setDay10
(
noticesArray
[
9
]);
summary
.
setDay11
(
noticesArray
[
10
]);
summary
.
setDay12
(
noticesArray
[
11
]);
summary
.
setDay13
(
noticesArray
[
12
]);
summary
.
setDay14
(
noticesArray
[
13
]);
summary
.
setDay15
(
noticesArray
[
14
]);
summary
.
setDay16
(
noticesArray
[
15
]);
summary
.
setDay17
(
noticesArray
[
16
]);
summary
.
setDay18
(
noticesArray
[
17
]);
summary
.
setDay19
(
noticesArray
[
18
]);
summary
.
setDay20
(
noticesArray
[
19
]);
summary
.
setDay21
(
noticesArray
[
20
]);
summary
.
setDay22
(
noticesArray
[
21
]);
summary
.
setDay23
(
noticesArray
[
22
]);
summary
.
setDay24
(
noticesArray
[
23
]);
summary
.
setDay25
(
noticesArray
[
24
]);
summary
.
setDay26
(
noticesArray
[
25
]);
summary
.
setDay27
(
noticesArray
[
26
]);
summary
.
setDay28
(
noticesArray
[
27
]);
summary
.
setDay29
(
noticesArray
[
28
]);
summary
.
setDay30
(
noticesArray
[
29
]);
summary
.
setDay31
(
noticesArray
[
30
]);
summary
.
setId
(
summaryid
);
summary
.
insertOrUpdate
();
}
}
//循环对应公司所有员工
}
//循环所有公司
}
}
@Autowired
private
KqglAssoPbmxMapper
kqglassopbmxmapper
;
/**
* @param qyid
* @param userid
* @param date
* @return
* 获取当天打卡班次数据
*/
public
AttendanceCardListDto
MethodCall
(
int
qyid
,
int
userid
,
String
date
)
throws
ParseException
{
AttendanceCardListDto
attcar
=
new
AttendanceCardListDto
();
String
str
=
null
;
if
(!(
""
).
equals
(
date
)){
str
=
date
;
}
else
{
Date
d
=
new
Date
();
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
str
=
sdf
.
format
(
d
);
}
KqglMainKqz
attgro
=
kqglmainkqzmapper
.
getAttendanceGroupInformationByUserid
(
userid
,
qyid
);
//考勤组信息
//pbfs:排班方式 1:固定排班;2:自由排班;3:自由工时
if
(
attgro
!=
null
){
//判断当前用户是否加入到考勤组
//排班制
KqglAssoPbmxDto
jrpb
=
kqglassopbmxmapper
.
getScheduleSpecificAttendance
(
attgro
.
getId
(),
userid
,
str
);
//固定排班
int
week
=
Integer
.
valueOf
(
ClockInTool
.
dateToWeek
(
str
));
//4
KqglAssoZhoupaiban
atwek
=
KqglAssoZhoupaiban
.
builder
().
build
().
selectOne
(
new
QueryWrapper
<
KqglAssoZhoupaiban
>().
lambda
().
eq
(
KqglAssoZhoupaiban:
:
getKqzid
,
attgro
.
getId
())
.
eq
(
KqglAssoZhoupaiban:
:
getType
,
week
).
ne
(
KqglAssoZhoupaiban:
:
getBcid
,
0
));
if
(
attgro
.
getPbfs
()
==
1
){
//固定排班
if
(
atwek
!=
null
){
//有固定周排班
KqglAssoTeshu
rest
=
KqglAssoTeshu
.
builder
().
build
().
selectOne
(
new
QueryWrapper
<
KqglAssoTeshu
>().
lambda
().
eq
(
KqglAssoTeshu:
:
getKqzid
,
attgro
.
getId
())
.
eq
(
KqglAssoTeshu:
:
getTsrq
,
str
).
eq
(
KqglAssoTeshu:
:
getBcid
,
0
));
if
(
rest
!=
null
){
//今天休息 Sort返回0【特殊日期--休息】
List
<
AttSchedule
>
atts
=
new
ArrayList
<
AttSchedule
>();
AttSchedule
as
=
AttSchedule
.
builder
().
id
(
0
).
sort
(
0
).
time
(
0
l
).
starttime
(
0
l
).
endtime
(
0
l
).
build
();
atts
.
add
(
as
);
attcar
.
setAttsch
(
atts
);
}
else
{
//今天上班
KqglAssoBcsz
bcz
=
KqglAssoBcsz
.
builder
().
build
().
selectOne
(
new
QueryWrapper
<
KqglAssoBcsz
>().
lambda
().
eq
(
KqglAssoBcsz:
:
getId
,
atwek
.
getBcid
()));
if
(
bcz
!=
null
){
Getshiftinformationbatch
(
bcz
,
attcar
,
str
);
}
}
}
else
{
//必须打卡
KqglAssoTeshu
tsri
=
KqglAssoTeshu
.
builder
().
build
().
selectOne
(
new
QueryWrapper
<
KqglAssoTeshu
>().
lambda
().
eq
(
KqglAssoTeshu:
:
getKqzid
,
attgro
.
getId
())
.
eq
(
KqglAssoTeshu:
:
getTsrq
,
str
).
ne
(
KqglAssoTeshu:
:
getBcid
,
0
));
if
(
tsri
!=
null
){
KqglAssoBcsz
tsrq
=
KqglAssoBcsz
.
builder
().
build
().
selectOne
(
new
QueryWrapper
<
KqglAssoBcsz
>().
lambda
().
eq
(
KqglAssoBcsz:
:
getId
,
tsri
.
getBcid
()));
if
(
tsrq
!=
null
){
Getshiftinformationbatch
(
tsrq
,
attcar
,
str
);
}
}
else
{
//休息
List
<
AttSchedule
>
atts
=
new
ArrayList
<
AttSchedule
>();
AttSchedule
as
=
AttSchedule
.
builder
().
id
(
0
).
sort
(
0
).
time
(
0
l
).
starttime
(
0
l
).
endtime
(
0
l
).
build
();
atts
.
add
(
as
);
attcar
.
setAttsch
(
atts
);
}
}
}
else
if
(
attgro
.
getPbfs
()
==
2
){
//自由排班
if
(
jrpb
!=
null
){
if
(
jrpb
.
getBcid
()
!=
0
){
//有班次时("Bcid"不为0时)
KqglAssoBcsz
tsrq
=
KqglAssoBcsz
.
builder
().
build
().
selectOne
(
new
QueryWrapper
<
KqglAssoBcsz
>().
lambda
().
eq
(
KqglAssoBcsz:
:
getId
,
jrpb
.
getBcid
()));
/**已简化**/
Getshiftinformationbatch
(
tsrq
,
attcar
,
str
);
}
else
{
//当天排班为休息
List
<
AttSchedule
>
atts1
=
new
ArrayList
<
AttSchedule
>();
AttSchedule
as
=
AttSchedule
.
builder
().
id
(
0
).
sort
(
0
).
time
(
0
l
).
starttime
(
0
l
).
endtime
(
0
l
).
build
();
atts1
.
add
(
as
);
attcar
.
setAttsch
(
atts1
);
}
}
}
else
{
//自由工时
KqglAssoZhoupaiban
wekz
=
KqglAssoZhoupaiban
.
builder
().
build
().
selectOne
(
new
QueryWrapper
<
KqglAssoZhoupaiban
>().
lambda
().
eq
(
KqglAssoZhoupaiban:
:
getKqzid
,
attgro
.
getId
())
.
eq
(
KqglAssoZhoupaiban:
:
getBcid
,
0
).
eq
(
KqglAssoZhoupaiban:
:
getType
,
week
));
if
(
wekz
!=
null
){
//
String
dada
=
str
+
" "
+
attgro
.
getKqkssjTime
()+
":00"
;
attcar
.
setStapclotime
(
Long
.
valueOf
(
ClockInTool
.
dateToStamp
(
dada
)));
}
if
(!(
""
).
equals
(
attgro
.
getJbzdsc
())){
attcar
.
setCanpunchworkdate
(
Double
.
valueOf
(
attgro
.
getJbzdsc
()));
//上班打卡后多久大下班卡
}
}
if
(
jrpb
!=
null
||
atwek
!=
null
){
KqglAssoBcsz
shif
=
KqglAssoBcsz
.
builder
().
build
();
if
(
attgro
.
getPbfs
()
==
1
){
shif
=
shif
.
selectOne
(
new
QueryWrapper
<
KqglAssoBcsz
>().
lambda
().
eq
(
KqglAssoBcsz:
:
getId
,
atwek
.
getBcid
()));
}
else
if
(
attgro
.
getPbfs
()
==
2
){
shif
=
shif
.
selectOne
(
new
QueryWrapper
<
KqglAssoBcsz
>().
lambda
().
eq
(
KqglAssoBcsz:
:
getId
,
jrpb
.
getBcid
()));
}
if
(
shif
!=
null
){
if
(
shif
.
getIsXbdk
()
==
1
){
attcar
.
setNoclockout
(
true
);
// 下班不用打卡
}
else
{
attcar
.
setNoclockout
(
false
);
// 下班不用打卡
}
attcar
.
setAllowlate
(
shif
.
getYxcdfzs
());
// 允许迟到分钟数
attcar
.
setSeriouslate
(
shif
.
getYzcdfzs
());
// 严重迟到分钟数
attcar
.
setAbsenteeismlate
(
shif
.
getKgcdfzs
());
// 旷工迟到分钟数
if
(
shif
.
getIsWzwd
()
==
1
){
attcar
.
setIslatelate
(
true
);
// 晚走晚到
List
<
AttLateLate
>
atwzwd
=
new
ArrayList
<
AttLateLate
>();
int
p
=
0
;
if
(!(
""
).
equals
(
shif
.
getXbwz1
())
&&
!(
""
).
equals
(
shif
.
getSbwd1
())){
p
=
2
;}
if
(!(
""
).
equals
(
shif
.
getXbwz1
())
&&
!(
""
).
equals
(
shif
.
getSbwd1
())
&&
!(
""
).
equals
(
shif
.
getXbwz2
())
&&
!(
""
).
equals
(
shif
.
getSbwd2
())){
p
=
4
;}
if
(!(
""
).
equals
(
shif
.
getXbwz1
())
&&
!(
""
).
equals
(
shif
.
getSbwd1
())
&&
!(
""
).
equals
(
shif
.
getXbwz2
())
&&
!(
""
).
equals
(
shif
.
getSbwd2
())
&&
!(
""
).
equals
(
shif
.
getXbwz3
())
&&
!(
""
).
equals
(
shif
.
getSbwd3
())){
p
=
6
;}
AttLateLate
ala
=
AttLateLate
.
builder
().
build
();
ala
.
setLatewalk
(
shif
.
getXbwz1
());
ala
.
setArrivelate
(
shif
.
getSbwd1
());
atwzwd
.
add
(
ala
);
if
(
p
==
4
||
p
==
6
){
AttLateLate
alat
=
AttLateLate
.
builder
().
build
();
alat
.
setLatewalk
(
shif
.
getXbwz2
());
alat
.
setArrivelate
(
shif
.
getSbwd2
());
atwzwd
.
add
(
alat
);
}
if
(
p
==
6
){
AttLateLate
alas
=
AttLateLate
.
builder
().
build
();
alas
.
setLatewalk
(
shif
.
getXbwz3
());
alas
.
setArrivelate
(
shif
.
getSbwd3
());
atwzwd
.
add
(
alas
);
}
attcar
.
setAttlat
(
atwzwd
);
}
else
{
attcar
.
setIslatelate
(
false
);
// 晚走晚到
}
}
}
attcar
.
setAttgrouptype
(
attgro
.
getPbfs
());
//1:固定排班;2:自由排班;3:自由工时
}
else
{
attcar
.
setAttgrouptype
(
0
);
//1:固定排班;2:自由排班;3:自由工时
}
return
attcar
;
}
/**
* @param shiftm
* @param attcar
* @param str
*/
public
void
Getshiftinformationbatch
(
KqglAssoBcsz
shiftm
,
AttendanceCardListDto
attcar
,
String
str
){
int
isXbdk1Cr
=
shiftm
.
getIsXbdk1Cr
();
//下班1是否次日(0:否;1:是)
int
isSbdk2Cr
=
shiftm
.
getIsSbdk2Cr
();
//上班2是否次日(0:否;1:是)
int
isXbdk2Cr
=
shiftm
.
getIsXbdk2Cr
();
//下班2是否次日(0:否;1:是)
int
isSbdk3Cr
=
shiftm
.
getIsSbdk3Cr
();
//上班3是否次日(0:否;1:是)
int
isXbdk3Cr
=
shiftm
.
getIsXbdk3Cr
();
//下班3是否次日(0:否;1:是)
//次日专用
String
next_day
=
ClockInTool
.
requires_extra_times
(
str
,
1
,
2
,
1
);
List
<
AttSchedule
>
atts
=
new
ArrayList
<
AttSchedule
>();
if
(
shiftm
.
getSxbcs
()
==
1
||
shiftm
.
getSxbcs
()
==
2
||
shiftm
.
getSxbcs
()
==
3
){
//1次上下班
for
(
int
o
=
0
;
o
<
2
;
o
++){
if
(
o
==
0
){
AttSchedule
as
=
AttSchedule
.
builder
().
id
(
shiftm
.
getId
()).
sort
(
1
).
time
(
Long
.
valueOf
(
ClockInTool
.
dateToStamp
((
str
+
" "
+
shiftm
.
getSbdk1
()+
":00"
).
replaceAll
(
"\r|\n"
,
""
))))
.
starttime
((
""
).
equals
(
shiftm
.
getSbqjks1
())
||
shiftm
.
getSbqjks1
()
==
null
?
0
:
Long
.
valueOf
(
ClockInTool
.
dateToStamp
((
str
+
" "
+
shiftm
.
getSbqjks1
()+
":00"
).
replaceAll
(
"\r|\n"
,
""
))))
.
endtime
((
""
).
equals
(
shiftm
.
getSbqjjs1
())
||
shiftm
.
getSbqjjs1
()
==
null
?
0
:
Long
.
valueOf
(
ClockInTool
.
dateToStamp
((
str
+
" "
+
shiftm
.
getSbqjjs1
()+
":00"
).
replaceAll
(
"\r|\n"
,
""
))))
.
nextday
(
0
).
build
();
atts
.
add
(
as
);
}
else
{
//次日
if
(
isXbdk1Cr
>
0
)
{
AttSchedule
as
=
AttSchedule
.
builder
().
id
(
shiftm
.
getId
()).
sort
(
2
).
time
(
Long
.
valueOf
(
ClockInTool
.
dateToStamp
((
next_day
+
" "
+
shiftm
.
getXbdk1
()+
":00"
).
replaceAll
(
"\r|\n"
,
""
))))
.
starttime
((
""
).
equals
(
shiftm
.
getXbqjks1
())
||
shiftm
.
getXbqjks1
()
==
null
?
0
:
Long
.
valueOf
(
ClockInTool
.
dateToStamp
((
next_day
+
" "
+
shiftm
.
getXbqjks1
()+
":00"
).
replaceAll
(
"\r|\n"
,
""
))))
.
endtime
((
""
).
equals
(
shiftm
.
getXbqjjs1
())
||
shiftm
.
getXbqjjs1
()
==
null
?
0
:
Long
.
valueOf
(
ClockInTool
.
dateToStamp
((
next_day
+
" "
+
shiftm
.
getXbqjjs1
()+
":00"
).
replaceAll
(
"\r|\n"
,
""
))))
.
nextday
(
1
).
build
();
atts
.
add
(
as
);
}
else
{
AttSchedule
as
=
AttSchedule
.
builder
().
id
(
shiftm
.
getId
()).
sort
(
2
).
time
(
Long
.
valueOf
(
ClockInTool
.
dateToStamp
((
str
+
" "
+
shiftm
.
getXbdk1
()+
":00"
).
replaceAll
(
"\r|\n"
,
""
))))
.
starttime
((
""
).
equals
(
shiftm
.
getXbqjks1
())
||
shiftm
.
getXbqjks1
()
==
null
?
0
:
Long
.
valueOf
(
ClockInTool
.
dateToStamp
((
str
+
" "
+
shiftm
.
getXbqjks1
()+
":00"
).
replaceAll
(
"\r|\n"
,
""
))))
.
endtime
((
""
).
equals
(
shiftm
.
getXbqjjs1
())
||
shiftm
.
getXbqjjs1
()
==
null
?
0
:
Long
.
valueOf
(
ClockInTool
.
dateToStamp
((
str
+
" "
+
shiftm
.
getXbqjjs1
()+
":00"
).
replaceAll
(
"\r|\n"
,
""
))))
.
nextday
(
0
).
build
();
atts
.
add
(
as
);
}
}
}
attcar
.
setAttsch
(
atts
);
}
if
(
shiftm
.
getSxbcs
()
==
2
||
shiftm
.
getSxbcs
()
==
3
){
//2次上下班
for
(
int
o
=
0
;
o
<
2
;
o
++){
if
(
o
==
0
){
if
(
isSbdk2Cr
>
0
)
{
//次日
AttSchedule
as
=
AttSchedule
.
builder
().
id
(
shiftm
.
getId
()).
sort
(
3
).
time
(
Long
.
valueOf
(
ClockInTool
.
dateToStamp
((
next_day
+
" "
+
shiftm
.
getSbdk2
()+
":00"
).
replaceAll
(
"\r|\n"
,
""
))))
.
starttime
((
""
).
equals
(
shiftm
.
getSbqjks2
())||
shiftm
.
getSbqjks2
()==
null
?
0
:
Long
.
valueOf
(
ClockInTool
.
dateToStamp
((
next_day
+
" "
+
shiftm
.
getSbqjks2
()+
":00"
).
replaceAll
(
"\r|\n"
,
""
))))
.
endtime
((
""
).
equals
(
shiftm
.
getSbqjjs2
())
||
shiftm
.
getSbqjjs2
()==
null
?
0
:
Long
.
valueOf
(
ClockInTool
.
dateToStamp
((
next_day
+
" "
+
shiftm
.
getSbqjjs2
()+
":00"
).
replaceAll
(
"\r|\n"
,
""
))))
.
nextday
(
1
).
build
();
atts
.
add
(
as
);
}
else
{
AttSchedule
as
=
AttSchedule
.
builder
().
id
(
shiftm
.
getId
()).
sort
(
3
).
time
(
Long
.
valueOf
(
ClockInTool
.
dateToStamp
((
str
+
" "
+
shiftm
.
getSbdk2
()+
":00"
).
replaceAll
(
"\r|\n"
,
""
))))
.
starttime
((
""
).
equals
(
shiftm
.
getSbqjks2
())||
shiftm
.
getSbqjks2
()==
null
?
0
:
Long
.
valueOf
(
ClockInTool
.
dateToStamp
((
str
+
" "
+
shiftm
.
getSbqjks2
()+
":00"
).
replaceAll
(
"\r|\n"
,
""
))))
.
endtime
((
""
).
equals
(
shiftm
.
getSbqjjs2
())
||
shiftm
.
getSbqjjs2
()==
null
?
0
:
Long
.
valueOf
(
ClockInTool
.
dateToStamp
((
str
+
" "
+
shiftm
.
getSbqjjs2
()+
":00"
).
replaceAll
(
"\r|\n"
,
""
))))
.
nextday
(
0
).
build
();
atts
.
add
(
as
);
}
}
else
{
if
(
isXbdk2Cr
>
0
)
{
//次日
AttSchedule
as
=
AttSchedule
.
builder
().
id
(
shiftm
.
getId
()).
sort
(
4
).
time
(
Long
.
valueOf
(
ClockInTool
.
dateToStamp
((
next_day
+
" "
+
shiftm
.
getXbdk2
()+
":00"
).
replaceAll
(
"\r|\n"
,
""
))))
.
starttime
((
""
).
equals
(
shiftm
.
getXbqjks2
())
||
shiftm
.
getXbqjks2
()==
null
?
0
:
Long
.
valueOf
(
ClockInTool
.
dateToStamp
((
next_day
+
" "
+
shiftm
.
getXbqjks2
()+
":00"
).
replaceAll
(
"\r|\n"
,
""
))))
.
endtime
((
""
).
equals
(
shiftm
.
getXbqjjs2
())
||
shiftm
.
getXbqjjs2
()==
null
?
0
:
Long
.
valueOf
(
ClockInTool
.
dateToStamp
((
next_day
+
" "
+
shiftm
.
getXbqjjs2
()+
":00"
).
replaceAll
(
"\r|\n"
,
""
))))
.
nextday
(
1
).
build
();
atts
.
add
(
as
);
}
else
{
AttSchedule
as
=
AttSchedule
.
builder
().
id
(
shiftm
.
getId
()).
sort
(
4
).
time
(
Long
.
valueOf
(
ClockInTool
.
dateToStamp
((
str
+
" "
+
shiftm
.
getXbdk2
()+
":00"
).
replaceAll
(
"\r|\n"
,
""
))))
.
starttime
((
""
).
equals
(
shiftm
.
getXbqjks2
())
||
shiftm
.
getXbqjks2
()==
null
?
0
:
Long
.
valueOf
(
ClockInTool
.
dateToStamp
((
str
+
" "
+
shiftm
.
getXbqjks2
()+
":00"
).
replaceAll
(
"\r|\n"
,
""
))))
.
endtime
((
""
).
equals
(
shiftm
.
getXbqjjs2
())
||
shiftm
.
getXbqjjs2
()==
null
?
0
:
Long
.
valueOf
(
ClockInTool
.
dateToStamp
((
str
+
" "
+
shiftm
.
getXbqjjs2
()+
":00"
).
replaceAll
(
"\r|\n"
,
""
))))
.
nextday
(
0
).
build
();
atts
.
add
(
as
);
}
}
}
attcar
.
setAttsch
(
atts
);
}
if
(
shiftm
.
getSxbcs
()
==
3
){
//3次上下班
for
(
int
o
=
0
;
o
<
2
;
o
++){
if
(
o
==
0
){
if
(
isSbdk3Cr
>
0
)
{
//次日
AttSchedule
as
=
AttSchedule
.
builder
().
id
(
shiftm
.
getId
()).
sort
(
5
).
time
(
Long
.
valueOf
(
ClockInTool
.
dateToStamp
((
next_day
+
" "
+
shiftm
.
getSbdk3
()+
":00"
).
replaceAll
(
"\r|\n"
,
""
))))
.
starttime
((
""
).
equals
(
shiftm
.
getSbqjks3
())
||
shiftm
.
getSbqjks3
()
==
null
?
0
:
Long
.
valueOf
(
ClockInTool
.
dateToStamp
((
next_day
+
" "
+
shiftm
.
getSbqjks3
()+
":00"
).
replaceAll
(
"\r|\n"
,
""
))))
.
endtime
((
""
).
equals
(
shiftm
.
getSbqjjs3
())
||
shiftm
.
getSbqjjs3
()
==
null
?
0
:
Long
.
valueOf
(
ClockInTool
.
dateToStamp
((
next_day
+
" "
+
shiftm
.
getSbqjjs3
()+
":00"
).
replaceAll
(
"\r|\n"
,
""
))))
.
nextday
(
1
).
build
();
atts
.
add
(
as
);
}
else
{
AttSchedule
as
=
AttSchedule
.
builder
().
id
(
shiftm
.
getId
()).
sort
(
5
).
time
(
Long
.
valueOf
(
ClockInTool
.
dateToStamp
((
str
+
" "
+
shiftm
.
getSbdk3
()+
":00"
).
replaceAll
(
"\r|\n"
,
""
))))
.
starttime
((
""
).
equals
(
shiftm
.
getSbqjks3
())
||
shiftm
.
getSbqjks3
()
==
null
?
0
:
Long
.
valueOf
(
ClockInTool
.
dateToStamp
((
str
+
" "
+
shiftm
.
getSbqjks3
()+
":00"
).
replaceAll
(
"\r|\n"
,
""
))))
.
endtime
((
""
).
equals
(
shiftm
.
getSbqjjs3
())
||
shiftm
.
getSbqjjs3
()
==
null
?
0
:
Long
.
valueOf
(
ClockInTool
.
dateToStamp
((
str
+
" "
+
shiftm
.
getSbqjjs3
()+
":00"
).
replaceAll
(
"\r|\n"
,
""
))))
.
nextday
(
0
).
build
();
atts
.
add
(
as
);
}
}
else
{
if
(
isXbdk3Cr
>
0
)
{
//次日
AttSchedule
as
=
AttSchedule
.
builder
().
id
(
shiftm
.
getId
()).
sort
(
6
).
time
(
Long
.
valueOf
(
ClockInTool
.
dateToStamp
((
next_day
+
" "
+
shiftm
.
getXbdk3
()+
":00"
).
replaceAll
(
"\r|\n"
,
""
))))
.
starttime
((
""
).
equals
(
shiftm
.
getXbqjks3
())
||
shiftm
.
getXbqjks3
()==
null
?
0
:
Long
.
valueOf
(
ClockInTool
.
dateToStamp
((
next_day
+
" "
+
shiftm
.
getXbqjks3
()+
":00"
).
replaceAll
(
"\r|\n"
,
""
))))
.
endtime
((
""
).
equals
(
shiftm
.
getXbqjjs3
())
||
shiftm
.
getXbqjjs3
()
==
null
?
0
:
Long
.
valueOf
(
ClockInTool
.
dateToStamp
((
next_day
+
" "
+
shiftm
.
getXbqjjs3
()+
":00"
).
replaceAll
(
"\r|\n"
,
""
))))
.
nextday
(
1
).
build
();
atts
.
add
(
as
);
}
else
{
AttSchedule
as
=
AttSchedule
.
builder
().
id
(
shiftm
.
getId
()).
sort
(
6
).
time
(
Long
.
valueOf
(
ClockInTool
.
dateToStamp
((
str
+
" "
+
shiftm
.
getXbdk3
()+
":00"
).
replaceAll
(
"\r|\n"
,
""
))))
.
starttime
((
""
).
equals
(
shiftm
.
getXbqjks3
())
||
shiftm
.
getXbqjks3
()==
null
?
0
:
Long
.
valueOf
(
ClockInTool
.
dateToStamp
((
str
+
" "
+
shiftm
.
getXbqjks3
()+
":00"
).
replaceAll
(
"\r|\n"
,
""
))))
.
endtime
((
""
).
equals
(
shiftm
.
getXbqjjs3
())
||
shiftm
.
getXbqjjs3
()
==
null
?
0
:
Long
.
valueOf
(
ClockInTool
.
dateToStamp
((
str
+
" "
+
shiftm
.
getXbqjjs3
()+
":00"
).
replaceAll
(
"\r|\n"
,
""
))))
.
nextday
(
0
).
build
();
atts
.
add
(
as
);
}
}
}
attcar
.
setAttsch
(
atts
);
}
}
}
src/main/java/cn/timer/api/controller/kqgl/atttimer/OnClickLastMonthtimingExport.java
deleted
100644 → 0
View file @
f0f63b3e
package
cn
.
timer
.
api
.
controller
.
kqgl
.
atttimer
;
import
java.text.DateFormat
;
import
java.text.ParseException
;
import
java.text.SimpleDateFormat
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.Calendar
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Locale
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.scheduling.annotation.EnableScheduling
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
cn.timer.api.bean.kqgl.AttendanceWeeklySch
;
import
cn.timer.api.bean.kqgl.PunchCardDetails
;
import
cn.timer.api.bean.kqgl.PunchRecord
;
import
cn.timer.api.bean.kqgl.Schedule
;
import
cn.timer.api.bean.kqmk.KqglAssoBcsz
;
import
cn.timer.api.bean.kqmk.KqglAssoDkmx
;
import
cn.timer.api.bean.kqmk.KqglAssoLeaveRules
;
import
cn.timer.api.bean.kqmk.KqglAssoMonthPunchSummary
;
import
cn.timer.api.bean.kqmk.KqglAssoOvertimeBasics
;
import
cn.timer.api.bean.kqmk.KqglAssoPbmx
;
import
cn.timer.api.bean.kqmk.KqglAssoRelationSummary
;
import
cn.timer.api.bean.kqmk.KqglAssoTeshu
;
import
cn.timer.api.bean.kqmk.KqglAssoZhoupaiban
;
import
cn.timer.api.bean.kqmk.KqglMainKqz
;
import
cn.timer.api.bean.kqmk.KqmkRedletterDay
;
import
cn.timer.api.bean.qyzx.QyzxEntInfoM
;
import
cn.timer.api.bean.yggl.YgglMainLzb
;
import
cn.timer.api.controller.kqgl.ClockInTool
;
import
cn.timer.api.controller.kqgl.EmptyUtil
;
import
cn.timer.api.dao.kqgl.AttendanceWeeklySchMapper
;
import
cn.timer.api.dao.kqgl.PunchCardDetailsMapper
;
import
cn.timer.api.dao.kqgl.PunchRecordMapper
;
import
cn.timer.api.dao.kqgl.ScheduleMapper
;
import
cn.timer.api.dao.kqmk.KqglAssoDkmxMapper
;
import
cn.timer.api.dao.kqmk.KqglAssoLeaveBalanceMapper
;
import
cn.timer.api.dao.kqmk.KqglAssoPbmxMapper
;
import
cn.timer.api.dao.kqmk.KqglAssoRelationSummaryMapper
;
import
cn.timer.api.dao.kqmk.KqglAssoTeshuMapper
;
import
cn.timer.api.dao.kqmk.KqglMainKqzMapper
;
import
cn.timer.api.dao.qyzx.QyzxEntInfoMMapper
;
import
cn.timer.api.dto.kqmk.AdditionalDto
;
import
cn.timer.api.dto.kqmk.AttLateLate
;
import
cn.timer.api.dto.kqmk.AttSchedule
;
import
cn.timer.api.dto.kqmk.AttSubsidiaryDto
;
import
cn.timer.api.dto.kqmk.AttendanceCardListDto
;
import
cn.timer.api.dto.kqmk.KqglAssoPbmxDto
;
import
cn.timer.api.utils.DateUtil
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
/**
* @author 上月数据
*/
@Api
(
tags
=
"考勤汇总数据"
)
@RestController
@Transactional
@RequestMapping
(
value
=
"/kqhzsy"
,
produces
=
{
"application/json"
,
"multipart/form-data"
})
public
class
OnClickLastMonthtimingExport
{
@Autowired
private
KqglMainKqzMapper
kqglmainkqzmapper
;
@Autowired
private
QyzxEntInfoMMapper
qyzxentinfommapper
;
@Autowired
private
KqglAssoLeaveBalanceMapper
kqglassoleavebalancemapper
;
@Autowired
private
KqglAssoTeshuMapper
kqglassoteshumapper
;
@Autowired
private
PunchCardDetailsMapper
punchcarddetailsmapper
;
@Autowired
private
AttendanceWeeklySchMapper
attendanceweeklyschmapper
;
@Autowired
private
ScheduleMapper
schedulemapper
;
static
SimpleDateFormat
sdf1
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
static
SimpleDateFormat
sdf2
=
new
SimpleDateFormat
(
"EEE"
);
@Autowired
private
KqglAssoRelationSummaryMapper
kqglassorelationsummarymapper
;
@Autowired
private
PunchRecordMapper
punchrecordmapper
;
@Autowired
private
KqglAssoDkmxMapper
kqglassodkmxmapper
;
private
static
String
lastDay
;
SimpleDateFormat
format
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
@GetMapping
(
value
=
"/lastOnClickAtt"
)
@ApiOperation
(
value
=
"lastOnClickAtt"
,
httpMethod
=
"GET"
,
notes
=
"接口发布说明"
)
public
void
LastMonthtimingAttendanceTask
()
throws
ParseException
{
//获取前月的最后一天
Calendar
cale
=
Calendar
.
getInstance
();
cale
.
set
(
Calendar
.
DAY_OF_MONTH
,
0
);
//设置为1号,当前日期既为本月第一天
lastDay
=
format
.
format
(
cale
.
getTime
());
String
lastmonth
=
ClockInTool
.
getLastYearMonth
();
//2020-07
int
year
=
Integer
.
valueOf
(
lastmonth
.
substring
(
0
,
4
));
//获取前一个年份
int
month
=
Integer
.
valueOf
(
lastmonth
.
substring
(
5
,
7
));
//获取前一个月份
int
summaryid
=
0
;
//汇总id
//获取上月年月份
String
date
=
lastmonth
+
"-01"
;
String
sdaet
=
DateUtil
.
getMinMonthDate
(
date
);
Long
startDate
=
DateUtil
.
getStartTime
(
0
,
DateUtil
.
getStringTime
(
sdaet
,
"yyyy-MM-dd"
)).
getTime
();
String
edate
=
DateUtil
.
getMaxMonthDate
(
date
);
Long
endDate
=
DateUtil
.
getnowEndTime
(
23
,
DateUtil
.
getStringTime
(
edate
,
"yyyy-MM-dd"
)).
getTime
();
String
str
=
lastDay
;
String
ttstr
=
lastmonth
;
String
[]
rangeArray
=
ClockInTool
.
listToString
(
ClockInTool
.
getDays
(
date
,
str
)).
split
(
";"
);
//目前为止所有日期
String
[]
range
=
rangeArray
[
0
].
split
(
","
);
List
<
QyzxEntInfoM
>
orgcodelist
=
qyzxentinfommapper
.
selectList
(
new
QueryWrapper
<
QyzxEntInfoM
>());
//系统中的所有公司 所有未到期的公司
// List<QyzxEntInfoM> orgcodelist = qyzxentinfommapper.selectList(new QueryWrapper<QyzxEntInfoM>().lambda().eq(QyzxEntInfoM::getId, 3));
for
(
int
t
=
0
;
t
<
orgcodelist
.
size
();
t
++){
int
org_code
=
orgcodelist
.
get
(
t
).
getId
();
//企业组织代码
List
<
AdditionalDto
>
userlist
=
kqglassoleavebalancemapper
.
selectAdditionalList
(
org_code
);
for
(
AdditionalDto
user
:
userlist
)
{
YgglMainLzb
lzb
=
YgglMainLzb
.
builder
().
build
().
selectOne
(
new
QueryWrapper
<
YgglMainLzb
>().
lambda
().
eq
(
YgglMainLzb:
:
getOrgCode
,
org_code
).
eq
(
YgglMainLzb:
:
getJobStatus
,
3
)
.
eq
(
YgglMainLzb:
:
getEmpNum
,
user
.
getEmpnum
()));
if
(
lzb
==
null
)
{
//已离职 的人员不进入计算(已存在的不做任何处理)
KqglAssoMonthPunchSummary
sum
=
KqglAssoMonthPunchSummary
.
builder
().
build
().
selectOne
(
new
QueryWrapper
<
KqglAssoMonthPunchSummary
>().
lambda
().
eq
(
KqglAssoMonthPunchSummary:
:
getOrgCode
,
org_code
)
.
eq
(
KqglAssoMonthPunchSummary:
:
getBelongYear
,
year
).
eq
(
KqglAssoMonthPunchSummary:
:
getBelongMonth
,
month
).
eq
(
KqglAssoMonthPunchSummary:
:
getNum
,
user
.
getEmpnum
()));
if
(
sum
!=
null
)
{
summaryid
=
sum
.
getId
();
}
else
{
summaryid
=
0
;
}
double
traveltotal
=
0
,
egresstotal
=
0
,
overtimetotal
=
0
;
//出差总时长
KqglAssoRelationSummary
travel
=
kqglassorelationsummarymapper
.
SecondaryValue
(
user
.
getEmpnum
(),
3
,
ttstr
);
if
(
travel
!=
null
)
{
traveltotal
=
travel
.
getDuration
();
}
//外出总时长
KqglAssoRelationSummary
egress
=
kqglassorelationsummarymapper
.
SecondaryValue
(
user
.
getEmpnum
(),
4
,
ttstr
);
if
(
egress
!=
null
)
{
egresstotal
=
egress
.
getDuration
();
}
//加班总时长
KqglAssoRelationSummary
overtime
=
kqglassorelationsummarymapper
.
SecondaryValue
(
user
.
getEmpnum
(),
1
,
ttstr
);
if
(
overtime
!=
null
)
{
overtimetotal
=
overtime
.
getDuration
();
}
//考勤组信息
KqglMainKqz
attgro
=
kqglmainkqzmapper
.
getAttendanceGroupInformationByUserid
(
user
.
getEmpnum
(),
org_code
);
//目前为止打卡记录
List
<
PunchCardDetails
>
attendance
=
punchcarddetailsmapper
.
selectAttendanceDays
(
user
.
getEmpnum
(),
startDate
,
endDate
);
int
fdjjrnum
=
0
;
if
(
attgro
!=
null
)
{
//特殊日期中 为法定带薪休假的
List
<
KqglAssoTeshu
>
fdjjr
=
KqglAssoTeshu
.
builder
().
build
().
selectList
(
new
QueryWrapper
<
KqglAssoTeshu
>().
lambda
().
eq
(
KqglAssoTeshu:
:
getKqzid
,
attgro
.
getId
()).
eq
(
KqglAssoTeshu:
:
getLegalday
,
1
).
eq
(
KqglAssoTeshu:
:
getType
,
2
));
fdjjrnum
=
fdjjr
.
size
();
}
int
dkjl
=
0
;
//目前为止打卡次数
int
sbqkcs
=
0
,
xbqkcs
=
0
,
dk
=
0
;
String
[]
sblacks
=
new
String
[
31
];
//上班缺卡天数
String
[]
xblacks
=
new
String
[
31
];
//下班缺卡天数
String
[]
dkjtts
=
new
String
[
attendance
.
size
()];
//目前打卡日期明细
int
bccs
=
0
;
if
(
attendance
.
size
()
>
0
)
{
dkjl
=
attendance
.
size
()
+
fdjjrnum
;
for
(
PunchCardDetails
pcd:
attendance
){
AttendanceCardListDto
attdate
=
MethodCall
(
org_code
,
user
.
getEmpnum
(),
pcd
.
getData
());
List
<
AttSchedule
>
ashss
=
attdate
.
getAttsch
();
//获取今天应打卡时间
if
(
EmptyUtil
.
isNotEmpty
(
attdate
.
getAttsch
())
&&
ashss
.
get
(
0
).
getId
()
!=
0
)
{
//班次不为空
bccs
=
attdate
.
getAttsch
().
size
();
}
dkjtts
[
dk
]
=
pcd
.
getData
();
dk
++;
if
(
bccs
==
2
||
bccs
==
4
||
bccs
==
6
){
if
(
pcd
.
getSbdk1
()
==
null
){
sblacks
[
sbqkcs
]
=
pcd
.
getData
();
sbqkcs
++;
}
if
(
pcd
.
getXbdk1
()
==
null
){
xblacks
[
xbqkcs
]
=
pcd
.
getData
();
xbqkcs
++;
}
}
if
(
bccs
==
4
||
bccs
==
6
){
if
(
pcd
.
getSbdk2
()
==
null
){
sblacks
[
sbqkcs
]
=
pcd
.
getData
();
sbqkcs
++;
}
if
(
pcd
.
getXbdk2
()
==
null
){
xblacks
[
xbqkcs
]
=
pcd
.
getData
();
xbqkcs
++;
}
}
if
(
bccs
==
6
){
if
(
pcd
.
getSbdk3
()
==
null
){
sblacks
[
sbqkcs
]
=
pcd
.
getData
();
sbqkcs
++;
}
if
(
pcd
.
getXbdk3
()
==
null
){
xblacks
[
xbqkcs
]
=
pcd
.
getData
();
xbqkcs
++;
}
}
}
sblacks
=
ClockInTool
.
deleteArrayNull
(
sblacks
);
sbqkcs
=
sblacks
.
length
;
xblacks
=
ClockInTool
.
deleteArrayNull
(
xblacks
);
xbqkcs
=
xblacks
.
length
;
}
String
[]
ycqts
=
new
String
[
31
];
//应上班的具体天数(yyyy-MM-dd)
String
[]
xxts
=
new
String
[
31
];
//休息的具体天数(yyyy-MM-dd)
String
[]
fdxx
=
new
String
[
10
];
//法定休息的具体天数(yyyy-MM-dd)
List
<
String
>
rowData
=
new
ArrayList
<
String
>();
//休息天数,应出勤天数,实际出勤
double
daysOff
=
0
,
daysOnDuty
=
0
;
//,actualAttDays = 0;
int
zjgzts
=
0
;
//目前为止应该出勤的天数
//工作时长(分钟)、严重迟到次数、严重迟到时长(分钟)、旷工迟到次数
double
workinghours
=
0
,
seriouslatetimes
=
0
,
seriouslatehours
=
0
,
absenlatetimes
=
0
;
// 迟到次数 迟到时长 早退次数 早退时长
int
latenum
=
0
,
latehours
=
0
,
leanum
=
0
,
leahours
=
0
;
// 迟到次数
int
answer
=
0
;
//班次ID
//工作日(转调休)、休息日(转调休)、节假日(转调休)
double
workingturncompenleave
=
0
,
restturncompenleave
=
0
,
holidayturncompenleave
=
0
;
//工作日(转调休)
//工作日(转加班费)、休息日(转加班费)、节假日(转加班费)
double
workingtransferovertime
=
0
,
resttransferovertime
=
0
,
holidaytransferovertime
=
0
;
int
attgroid
=
0
;
if
(
attgro
!=
null
){
//该员工是否加入到考勤组 排班方式 1:固定排班;2:自由排班;3:自由工时 计算出应出勤,实际出勤,休息天数
attgroid
=
attgro
.
getId
();
if
(
attgro
.
getPbfs
()
==
1
){
//固定排班
List
<
KqglAssoTeshu
>
bxdklist
=
kqglassoteshumapper
.
ShouldSpecialDatessetByKqzid
(
attgro
.
getId
(),
ttstr
,
1
);
//当前月 必须打卡日期
int
bxdk
=
bxdklist
.
size
();
String
[]
bxdkss
=
new
String
[
bxdk
];
////特殊-必须打卡天数(工作日)
int
b
=
0
;
for
(
KqglAssoTeshu
bxd
:
bxdklist
)
{
bxdkss
[
b
]
=
bxd
.
getTsrq
();
b
++;
}
List
<
KqglAssoTeshu
>
wxdk
=
kqglassoteshumapper
.
ShouldSpecialDatessetByKqzid
(
attgro
.
getId
(),
ttstr
,
2
);
//当前月 无需打卡日期
String
[]
appmaps
=
new
String
[
wxdk
.
size
()];
//特殊-无需打卡天数(休息日)
int
d1
=
0
;
for
(
KqglAssoTeshu
spe:
wxdk
){
appmaps
[
d1
]
=
spe
.
getTsrq
();
d1
++;
}
//应打卡周期时间
List
<
AttendanceWeeklySch
>
atwek
=
attendanceweeklyschmapper
.
selectAttendanceMadeByUserid
(
user
.
getEmpnum
(),
org_code
);
String
[]
week
=
new
String
[
atwek
.
size
()];
String
[]
needfig
=
new
String
[
atwek
.
size
()];
//应打卡周期时间
int
e
=
0
;
for
(
AttendanceWeeklySch
awek
:
atwek
){
week
[
e
]
=
awek
.
getWekmc
();
needfig
[
e
]
=
String
.
valueOf
(
awek
.
getType
());
//获取设置的应打卡周几
e
++;
}
//法定節假日
List
<
KqmkRedletterDay
>
etter
=
KqmkRedletterDay
.
builder
().
build
().
selectList
(
new
QueryWrapper
<
KqmkRedletterDay
>().
lambda
().
eq
(
KqmkRedletterDay:
:
getHolidayStatus
,
1
).
eq
(
KqmkRedletterDay:
:
getBelongYearmonth
,
ttstr
));
String
[]
holidays
=
new
String
[
etter
.
size
()];
//法定节假日沦为休息日计算
int
h
=
0
;
for
(
KqmkRedletterDay
spe:
etter
){
holidays
[
h
]
=
spe
.
getHoliday
();
h
++;
}
String
yemo
=
year
+
"-"
+
month
;
sdf1
.
setLenient
(
false
);
int
y
=
0
,
q
=
0
,
jj
=
0
,
xx
=
0
;
//jj:节假日
String
[]
zdxx
=
new
String
[
31
];
//法定休息的具体天数(yyyy-MM-dd)
for
(
int
i
=
1
;
i
<=
ClockInTool
.
getDaysByYearMonth
(
year
,
month
);
i
++){
boolean
xixi
=
true
;
Date
date1
=
sdf1
.
parse
(
yemo
+
"-"
+
i
);
for
(
int
u
=
0
;
u
<
week
.
length
;
u
++){
if
(
sdf2
.
format
(
date1
).
equals
(
week
[
u
])){
q
++;
y
++;
//无需打卡天数
if
(
Arrays
.
asList
(
appmaps
).
contains
(
String
.
valueOf
(
sdf1
.
format
(
date1
)))){
y
=
y
-
1
;
}
if
(
attgro
.
getIsFdjjr
().
equals
(
111
))
{
if
(
Arrays
.
asList
(
holidays
).
contains
(
String
.
valueOf
(
sdf1
.
format
(
date1
)))){
y
=
y
-
1
;
jj
++;
}
}
xixi
=
false
;
}
}
if
(
xixi
)
{
zdxx
[
xx
]
=
yemo
+
"-"
+
i
;
xx
++;
}
}
if
(
appmaps
.
length
>
0
)
{
for
(
String
aa
:
ClockInTool
.
deleteArrayNull
(
zdxx
))
{
if
(
appmaps
.
length
>
0
)
{
appmaps
=
ClockInTool
.
doChinFilters
(
ClockInTool
.
deleteArrayNull
(
appmaps
),
aa
);
}
}
}
//全月时间 - 应打卡时间 - 必须打卡时间 + 无需打卡时间
int
xiuxi
=
ClockInTool
.
getDaysByYearMonth
(
year
,
month
)
-
q
-
bxdk
+
appmaps
.
length
+
jj
;
//ClockInTool.getDaysByYearMonth(year,month) - q - bxdk + wxdk.size()+jj;
daysOff
=
xiuxi
;
daysOnDuty
=
y
+
bxdk
;
int
w
=
0
,
x
=
0
;
int
zj
=
6
;
int
fd
=
0
;
for
(
String
num
:
range
)
{
boolean
xxr
=
true
;
if
(
ClockInTool
.
useArrayUtils
(
needfig
,
String
.
valueOf
(
ClockInTool
.
dateToWeek
(
num
))))
{
//对比排班应打卡时间
String
[]
ycqtst
=
new
String
[
ycqts
.
length
+
zj
];
System
.
arraycopy
(
ycqts
,
0
,
ycqtst
,
0
,
ycqts
.
length
);
ycqtst
[
w
]
=
num
;
ycqts
=
ycqtst
;
w
++;
zjgzts
++;
}
else
{
//休息日
String
[]
xxtst
=
new
String
[
xxts
.
length
+
zj
];
System
.
arraycopy
(
xxts
,
0
,
xxtst
,
0
,
xxts
.
length
);
xxtst
[
x
]
=
num
;
xxts
=
xxtst
;
x
++;
xxr
=
false
;
}
if
(
ClockInTool
.
useArrayUtils
(
bxdkss
,
num
))
{
//检查是否存在 必须打卡名单中
String
[]
ycqtst
=
new
String
[
ycqts
.
length
+
zj
];
System
.
arraycopy
(
ycqts
,
0
,
ycqtst
,
0
,
ycqts
.
length
);
ycqtst
[
w
]
=
num
;
ycqts
=
ycqtst
;
w
++;
zjgzts
++;
xxts
=
ClockInTool
.
doChinFilters
(
ClockInTool
.
deleteArrayNull
(
xxts
),
num
);
//为必须上班的话从休息日期中去除
}
if
(
ClockInTool
.
useArrayUtils
(
appmaps
,
num
))
{
//检查是否存在 无需打卡名单中
ycqts
=
ClockInTool
.
doChinFilters
(
ycqts
,
num
);
//为必须休息的话从上班日期中去除
//防止休息日重复减
if
(
xxr
)
{
zjgzts
=
zjgzts
-
1
;
}
String
[]
xxtst
=
new
String
[
xxts
.
length
+
zj
];
System
.
arraycopy
(
xxts
,
0
,
xxtst
,
0
,
xxts
.
length
);
xxtst
[
x
]
=
num
;
xxts
=
xxtst
;
x
++;
}
//当前考勤组开启法定节假日休息开关
if
(
attgro
.
getIsFdjjr
().
equals
(
11111
))
{
//法定节假日
if
(
ClockInTool
.
useArrayUtils
(
holidays
,
num
))
{
//法定节假日沦为休息日计算
if
(
ClockInTool
.
doChinFilters
(
ClockInTool
.
deleteArrayNull
(
ycqts
),
num
)
!=
null
)
{
ycqts
=
ClockInTool
.
doChinFilters
(
ClockInTool
.
deleteArrayNull
(
ycqts
),
num
);
//为必须休息的话从上班日期中去除
}
fdxx
[
fd
]
=
num
;
fd
++;
zjgzts
=
zjgzts
-
1
;
String
[]
xxtst
=
new
String
[
xxts
.
length
+
zj
];
System
.
arraycopy
(
xxts
,
0
,
xxtst
,
0
,
xxts
.
length
);
xxtst
[
x
]
=
num
;
xxts
=
xxtst
;
x
++;
}
}
}
}
else
if
(
attgro
.
getPbfs
()
==
2
){
//自由排班
DateFormat
df
=
new
SimpleDateFormat
(
"EEE MMM dd HH:mm:ss zzz yyyy"
,
Locale
.
US
);
List
<
Schedule
>
ycqs
=
schedulemapper
.
getAttendanceShouldList
(
user
.
getEmpnum
(),
startDate
,
endDate
);
int
xiuxi
=
0
,
shangban
=
0
,
z
=
0
;
String
[]
ziyoupb
=
new
String
[
ycqs
.
size
()];
for
(
Schedule
sc
:
ycqs
){
String
data
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
).
format
(
df
.
parse
(
String
.
valueOf
(
sc
.
getData
())));
// 获得格式化后的日期字符串
ziyoupb
[
z
]
=
data
;
z
++;
if
(
sc
.
getBcid
().
equals
(
0
)){
xiuxi
++;
}
else
{
shangban
++;
}
}
daysOff
=
xiuxi
;
daysOnDuty
=
shangban
;
//目前为止应出勤天数
int
y
=
0
,
x
=
0
;
for
(
String
num
:
range
)
{
if
(
ClockInTool
.
useArrayUtils
(
ziyoupb
,
num
))
{
KqglAssoPbmx
pbx
=
KqglAssoPbmx
.
builder
().
build
().
selectOne
(
new
QueryWrapper
<
KqglAssoPbmx
>().
lambda
().
eq
(
KqglAssoPbmx:
:
getUserid
,
user
.
getEmpnum
()).
eq
(
KqglAssoPbmx:
:
getData
,
num
).
eq
(
KqglAssoPbmx:
:
getKqzid
,
attgro
.
getId
()));
if
(
pbx
!=
null
&&
pbx
.
getBcid
()!=
0
)
{
ycqts
[
y
]
=
num
;
y
++;
zjgzts
++;
}
else
{
xxts
[
x
]
=
num
;
x
++;
}
}
}
}
else
{
List
<
AttendanceWeeklySch
>
atwek
=
attendanceweeklyschmapper
.
selectAttendanceMadeByZhou
(
user
.
getEmpnum
(),
org_code
);
String
[]
week
=
new
String
[
atwek
.
size
()];
int
e
=
0
;
String
[]
ziyoupb
=
new
String
[
atwek
.
size
()];
for
(
AttendanceWeeklySch
awek
:
atwek
){
week
[
e
]
=
awek
.
getWekmc
();
ziyoupb
[
e
]
=
String
.
valueOf
(
awek
.
getType
());
e
++;
}
String
yemo
=
year
+
"-"
+
month
;
sdf1
.
setLenient
(
false
);
int
y
=
0
;
for
(
int
i
=
1
;
i
<=
ClockInTool
.
getDaysByYearMonth
(
year
,
month
);
i
++){
Date
date1
=
sdf1
.
parse
(
yemo
+
"-"
+
i
);
for
(
int
u
=
0
;
u
<
week
.
length
;
u
++){
if
(
sdf2
.
format
(
date1
).
equals
(
week
[
u
])){
y
++;
}
}
}
int
xiuxi
=
ClockInTool
.
getDaysByYearMonth
(
year
,
month
)
-
y
;
daysOff
=
xiuxi
;
daysOnDuty
=
y
;
//目前为止应出勤天数
int
g
=
0
,
x
=
0
;
for
(
String
num
:
range
)
{
if
(
ClockInTool
.
useArrayUtils
(
ziyoupb
,
String
.
valueOf
(
ClockInTool
.
dateToWeek
(
num
))))
{
//对比排班应打卡时间
ycqts
[
g
]
=
num
;
g
++;
zjgzts
++;
}
else
{
xxts
[
x
]
=
num
;
x
++;
}
}
}
List
<
PunchRecord
>
initial
=
punchrecordmapper
.
getMaintenancePunchCardList
(
startDate
,
endDate
,
user
.
getEmpnum
(),
org_code
);
// // 迟到次数 迟到时长 早退次数 早退时长
String
[]
cdts
=
new
String
[
31
];
//迟到的具体天数
String
[]
ztts
=
new
String
[
31
];
//早退的具体天数
if
(
initial
.
size
()
>
0
){
for
(
PunchRecord
prd
:
initial
){
if
(
prd
.
getType
()
==
1
&&
prd
.
getResults
()
>
0
){
cdts
[
latenum
]
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
).
format
(
prd
.
getDktime
());
latenum
++;
latehours
+=
prd
.
getResults
();
}
if
(
prd
.
getType
()
==
2
&&
prd
.
getResults
()
>
0
){
ztts
[
leanum
]
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
).
format
(
prd
.
getDktime
());
leanum
++;
leahours
+=
prd
.
getResults
();
}
}
}
AttSubsidiaryDto
subs
=
kqglassodkmxmapper
.
subsidiary
(
user
.
getEmpnum
(),
ttstr
);
// //工作时长(分钟)、严重迟到次数、严重迟到时长(分钟)、旷工迟到次数
if
(
subs
!=
null
)
{
workinghours
=
subs
.
getGzsctotalgzsc
();
seriouslatetimes
=
subs
.
getYzcdcstotal
();
seriouslatehours
=
subs
.
getYzcdsctotal
();
absenlatetimes
=
subs
.
getKgcdfzstotal
();
}
//具体请假天数
List
<
KqglAssoRelationSummary
>
leavetotal
=
kqglassorelationsummarymapper
.
SpecificLeave
(
user
.
getEmpnum
(),
2
,
ttstr
,
org_code
);
String
[]
leaves
=
new
String
[
leavetotal
.
size
()];
int
l
=
0
;
if
(
leavetotal
.
size
()>
0
)
{
for
(
KqglAssoRelationSummary
lea
:
leavetotal
){
leaves
[
l
]
=
lea
.
getAppTime
();
l
++;
}
}
//具体加班天数
List
<
KqglAssoRelationSummary
>
overtitotal
=
kqglassorelationsummarymapper
.
SpecificLeave
(
user
.
getEmpnum
(),
1
,
ttstr
,
org_code
);
String
[]
overtimes
=
new
String
[
overtitotal
.
size
()];
int
o
=
0
;
if
(
overtitotal
.
size
()
>
0
)
{
for
(
KqglAssoRelationSummary
over
:
overtitotal
)
{
overtimes
[
o
]
=
over
.
getAppTime
();
o
++;
}
}
//具体出差天数
List
<
KqglAssoRelationSummary
>
trtotal
=
kqglassorelationsummarymapper
.
SpecificLeave
(
user
.
getEmpnum
(),
3
,
ttstr
,
org_code
);
String
[]
travels
=
new
String
[
trtotal
.
size
()];
int
cx
=
0
;
if
(
trtotal
.
size
()>
0
)
{
for
(
KqglAssoRelationSummary
trt
:
trtotal
)
{
travels
[
cx
]
=
trt
.
getAppTime
();
cx
++;
}
}
//具体外出天数
List
<
KqglAssoRelationSummary
>
goouttotal
=
kqglassorelationsummarymapper
.
SpecificLeave
(
user
.
getEmpnum
(),
4
,
ttstr
,
org_code
);
String
[]
goouts
=
new
String
[
goouttotal
.
size
()];
int
wc
=
0
;
if
(
goouttotal
.
size
()>
0
)
{
for
(
KqglAssoRelationSummary
go:
goouttotal
)
{
goouts
[
wc
]
=
go
.
getAppTime
();
wc
++;
}
}
//具体补卡天数
List
<
KqglAssoRelationSummary
>
cardtotal
=
kqglassorelationsummarymapper
.
SpecificLeave
(
user
.
getEmpnum
(),
5
,
ttstr
,
org_code
);
String
[]
cards
=
new
String
[
cardtotal
.
size
()];
int
bk
=
0
;
if
(
cardtotal
.
size
()>
0
)
{
for
(
KqglAssoRelationSummary
car
:
cardtotal
)
{
cards
[
bk
]
=
car
.
getAppTime
();
bk
++;
}
}
//排查请假是否在最后一次打卡范围内 查询当月的请假所有日期
List
<
KqglAssoRelationSummary
>
leainv
=
kqglassorelationsummarymapper
.
LeaveInvestigation
(
user
.
getEmpnum
(),
2
,
ttstr
,
org_code
);
String
beginTime
=
sdf1
.
format
(
new
Date
());
//1:加班 2:请假 3:出差 4:外出 5:补卡
int
u
=
0
,
p
=
1
;
for
(
String
num
:
range
)
{
try
{
String
sjs
=
""
,
qinjia
=
""
,
chuaca
=
""
,
waichu
=
""
,
buka
=
""
,
jiaban
=
""
;
if
(
ClockInTool
.
useArrayUtils
(
ClockInTool
.
deleteArrayNull
(
xxts
),
num
)
&&
ClockInTool
.
useArrayUtils
(
ClockInTool
.
deleteArrayNull
(
dkjtts
),
num
))
{
rowData
.
add
(
"休息并打卡"
);
}
else
if
(
ClockInTool
.
useArrayUtils
(
ClockInTool
.
deleteArrayNull
(
xxts
),
num
)
&&
!
ClockInTool
.
useArrayUtils
(
ClockInTool
.
deleteArrayNull
(
fdxx
),
num
)){
rowData
.
add
(
"休息"
);
}
else
if
(
ClockInTool
.
useArrayUtils
(
ClockInTool
.
deleteArrayNull
(
fdxx
),
num
)){
rowData
.
add
(
"法定节假日休息"
);
}
else
{
if
(
ClockInTool
.
useArrayUtils
(
ClockInTool
.
deleteArrayNull
(
ycqts
),
num
)
&&
!
ClockInTool
.
useArrayUtils
(
ClockInTool
.
deleteArrayNull
(
dkjtts
),
num
)
&&
!
ClockInTool
.
useArrayUtils
(
ClockInTool
.
deleteArrayNull
(
leaves
),
num
)
&&
!
ClockInTool
.
useArrayUtils
(
ClockInTool
.
deleteArrayNull
(
travels
),
num
)
&&
!
ClockInTool
.
useArrayUtils
(
ClockInTool
.
deleteArrayNull
(
goouts
),
num
)
&&
!
ClockInTool
.
useArrayUtils
(
ClockInTool
.
deleteArrayNull
(
cards
),
num
))
{
rowData
.
add
(
"旷工"
);
}
else
if
(!
ClockInTool
.
useArrayUtils
(
ClockInTool
.
deleteArrayNull
(
ycqts
),
num
)
&&
!
ClockInTool
.
useArrayUtils
(
ClockInTool
.
deleteArrayNull
(
xxts
),
num
))
{
//日期不在上班也不在休息里面即为未排班
rowData
.
add
(
"未排班"
);
}
else
if
(
sdf1
.
parse
(
beginTime
).
getTime
()
<
sdf1
.
parse
(
num
).
getTime
())
{
rowData
.
add
(
"未到班期"
);
}
else
{
if
(
ClockInTool
.
useArrayUtils
(
ClockInTool
.
deleteArrayNull
(
sblacks
),
num
))
{
rowData
.
add
(
"上班缺卡"
);
}
else
if
(
ClockInTool
.
useArrayUtils
(
ClockInTool
.
deleteArrayNull
(
sblacks
),
num
)
&&
ClockInTool
.
useArrayUtils
(
ClockInTool
.
deleteArrayNull
(
ztts
),
num
))
{
rowData
.
add
(
"上班缺卡,下班早退"
);
}
else
if
(
ClockInTool
.
useArrayUtils
(
ClockInTool
.
deleteArrayNull
(
cdts
),
num
))
{
KqglAssoDkmx
dkm
=
KqglAssoDkmx
.
builder
().
build
().
selectOne
(
new
QueryWrapper
<
KqglAssoDkmx
>().
lambda
().
eq
(
KqglAssoDkmx:
:
getUserid
,
user
.
getEmpnum
())
.
eq
(
KqglAssoDkmx:
:
getQyid
,
org_code
).
eq
(
KqglAssoDkmx:
:
getData
,
num
));
if
(
dkm
.
getYdkcs
()
==
2
||
dkm
.
getYdkcs
()
==
4
||
dkm
.
getYdkcs
()
==
6
)
{
if
(
dkm
.
getSbdk1jg
()
>
0
)
{
rowData
.
add
(
"上班1迟到,打卡时间:"
+
ClockInTool
.
stampToDate3
(
String
.
valueOf
(
dkm
.
getSbdk1
()))+
",迟到"
+
dkm
.
getSbdk1jg
()+
"分钟"
);
}
}
if
(
dkm
.
getYdkcs
()
==
4
||
dkm
.
getYdkcs
()
==
6
)
{
if
(
dkm
.
getSbdk2jg
()
>
0
)
{
rowData
.
add
(
"上班2迟到,打卡时间:"
+
ClockInTool
.
stampToDate3
(
String
.
valueOf
(
dkm
.
getSbdk2
()))+
",迟到"
+
dkm
.
getSbdk2jg
()+
"分钟"
);
}
}
if
(
dkm
.
getYdkcs
()
==
6
)
{
if
(
dkm
.
getSbdk3jg
()
>
0
)
{
rowData
.
add
(
"上班3迟到,打卡时间:"
+
ClockInTool
.
stampToDate3
(
String
.
valueOf
(
dkm
.
getSbdk3
()))+
",迟到"
+
dkm
.
getSbdk3jg
()+
"分钟"
);
}
}
}
else
if
(
ClockInTool
.
useArrayUtils
(
ClockInTool
.
deleteArrayNull
(
cdts
),
num
)
&&
ClockInTool
.
useArrayUtils
(
ClockInTool
.
deleteArrayNull
(
xblacks
),
num
))
{
rowData
.
add
(
"上班迟到,下班缺卡"
);
}
else
if
(
ClockInTool
.
useArrayUtils
(
ClockInTool
.
deleteArrayNull
(
cdts
),
num
)
&&
ClockInTool
.
useArrayUtils
(
ClockInTool
.
deleteArrayNull
(
ztts
),
num
))
{
rowData
.
add
(
"上班迟到,下班早退"
);
}
else
if
(
ClockInTool
.
useArrayUtils
(
ClockInTool
.
deleteArrayNull
(
xblacks
),
num
))
{
rowData
.
add
(
"下班缺卡"
);
}
else
if
(
ClockInTool
.
useArrayUtils
(
ClockInTool
.
deleteArrayNull
(
ztts
),
num
))
{
KqglAssoDkmx
dkm
=
KqglAssoDkmx
.
builder
().
build
().
selectOne
(
new
QueryWrapper
<
KqglAssoDkmx
>().
lambda
().
eq
(
KqglAssoDkmx:
:
getUserid
,
user
.
getEmpnum
())
.
eq
(
KqglAssoDkmx:
:
getQyid
,
org_code
).
eq
(
KqglAssoDkmx:
:
getData
,
num
));
if
(
dkm
.
getYdkcs
()
==
2
||
dkm
.
getYdkcs
()
==
4
||
dkm
.
getYdkcs
()
==
6
)
{
if
(
dkm
.
getXbdk1jg
()
>
0
)
{
rowData
.
add
(
"下班1早退,打卡时间:"
+
ClockInTool
.
stampToDate3
(
String
.
valueOf
(
dkm
.
getXbdk1
()))+
",早退"
+
dkm
.
getXbdk1jg
()+
"分钟"
);
}
}
if
(
dkm
.
getYdkcs
()
==
4
||
dkm
.
getYdkcs
()
==
6
)
{
if
(
dkm
.
getXbdk2jg
()
>
0
)
{
rowData
.
add
(
"下班2早退,打卡时间:"
+
ClockInTool
.
stampToDate3
(
String
.
valueOf
(
dkm
.
getXbdk2
()))+
",早退"
+
dkm
.
getXbdk2jg
()+
"分钟"
);
}
}
if
(
dkm
.
getYdkcs
()
==
6
)
{
if
(
dkm
.
getXbdk3jg
()
>
0
)
{
rowData
.
add
(
"下班3早退,打卡时间:"
+
ClockInTool
.
stampToDate3
(
String
.
valueOf
(
dkm
.
getXbdk3
()))+
",早退"
+
dkm
.
getXbdk3jg
()+
"分钟"
);
}
}
}
else
{
rowData
.
add
(
"正常"
);
}
}
}
/******/
if
(
ClockInTool
.
contains
(
ClockInTool
.
deleteArrayNull
(
leaves
),
num
))
{
KqglAssoRelationSummary
lea
=
KqglAssoRelationSummary
.
builder
().
build
().
selectOne
(
new
QueryWrapper
<
KqglAssoRelationSummary
>().
lambda
().
eq
(
KqglAssoRelationSummary:
:
getUserId
,
user
.
getEmpnum
()).
eq
(
KqglAssoRelationSummary:
:
getAppTime
,
num
).
eq
(
KqglAssoRelationSummary:
:
getApprovalType
,
2
).
eq
(
KqglAssoRelationSummary:
:
getOrgCode
,
org_code
));
String
leavetype
=
"未知"
;
//请假类型
String
company
=
"未知"
;
//请假单位
if
(
lea
!=
null
)
{
KqglAssoLeaveRules
rul
=
KqglAssoLeaveRules
.
builder
().
build
().
selectOne
(
new
QueryWrapper
<
KqglAssoLeaveRules
>().
lambda
().
eq
(
KqglAssoLeaveRules:
:
getId
,
lea
.
getLeaveTypeId
()));
if
(
rul
!=
null
)
{
leavetype
=
rul
.
getName
();
//1:按天请假;2:按半天;3:按小时
if
(
rul
.
getCompany
()
==
1
)
{
company
=
"天"
;
}
else
if
(
rul
.
getCompany
()
==
2
)
{
company
=
"半天"
;
}
else
{
company
=
"小时"
;
}
}
}
qinjia
=
"#"
+(
lea
.
getStartTime
()).
substring
(
5
,
16
)
+
"到"
+
(
lea
.
getEndTime
()).
substring
(
5
,
16
)+
"请"
+
leavetype
+
lea
.
getDuration
()+
company
;
}
if
(
ClockInTool
.
contains
(
ClockInTool
.
deleteArrayNull
(
travels
),
num
))
{
KqglAssoRelationSummary
lea
=
KqglAssoRelationSummary
.
builder
().
build
().
selectOne
(
new
QueryWrapper
<
KqglAssoRelationSummary
>().
lambda
().
eq
(
KqglAssoRelationSummary:
:
getUserId
,
user
.
getEmpnum
()).
eq
(
KqglAssoRelationSummary:
:
getAppTime
,
num
).
eq
(
KqglAssoRelationSummary:
:
getApprovalType
,
3
).
eq
(
KqglAssoRelationSummary:
:
getOrgCode
,
org_code
));
chuaca
=
"#"
+(
lea
.
getStartTime
()).
substring
(
5
,
16
)
+
"到"
+
(
lea
.
getEndTime
()).
substring
(
5
,
16
)+
"出差"
+
lea
.
getDuration
()+
"天"
;
}
if
(
ClockInTool
.
contains
(
ClockInTool
.
deleteArrayNull
(
goouts
),
num
))
{
KqglAssoRelationSummary
lea
=
KqglAssoRelationSummary
.
builder
().
build
().
selectOne
(
new
QueryWrapper
<
KqglAssoRelationSummary
>().
lambda
().
eq
(
KqglAssoRelationSummary:
:
getUserId
,
user
.
getEmpnum
()).
eq
(
KqglAssoRelationSummary:
:
getAppTime
,
num
).
eq
(
KqglAssoRelationSummary:
:
getApprovalType
,
4
).
eq
(
KqglAssoRelationSummary:
:
getOrgCode
,
org_code
));
waichu
=
"#"
+(
lea
.
getStartTime
()).
substring
(
5
,
16
)
+
"到"
+
(
lea
.
getEndTime
()).
substring
(
5
,
16
)+
"外出"
+
lea
.
getDuration
()+
"天"
;
}
if
(
ClockInTool
.
contains
(
ClockInTool
.
deleteArrayNull
(
cards
),
num
))
{
KqglAssoRelationSummary
lea
=
KqglAssoRelationSummary
.
builder
().
build
().
selectOne
(
new
QueryWrapper
<
KqglAssoRelationSummary
>().
lambda
().
eq
(
KqglAssoRelationSummary:
:
getUserId
,
user
.
getEmpnum
()).
eq
(
KqglAssoRelationSummary:
:
getAppTime
,
num
).
eq
(
KqglAssoRelationSummary:
:
getApprovalType
,
5
).
eq
(
KqglAssoRelationSummary:
:
getOrgCode
,
org_code
));
buka
=
"#"
+
"已补卡:"
+(
lea
.
getStartTime
()).
substring
(
5
,
16
);
}
if
(
ClockInTool
.
contains
(
ClockInTool
.
deleteArrayNull
(
overtimes
),
num
))
{
String
company
=
"未知"
,
method
=
"无"
;
//加班单位、加班补偿方式
List
<
KqglAssoRelationSummary
>
leas
=
KqglAssoRelationSummary
.
builder
().
build
().
selectList
(
new
QueryWrapper
<
KqglAssoRelationSummary
>().
lambda
().
eq
(
KqglAssoRelationSummary:
:
getUserId
,
user
.
getEmpnum
()).
eq
(
KqglAssoRelationSummary:
:
getAppTime
,
num
).
eq
(
KqglAssoRelationSummary:
:
getApprovalType
,
1
).
eq
(
KqglAssoRelationSummary:
:
getOrgCode
,
org_code
));
for
(
KqglAssoRelationSummary
lea
:
leas
)
{
//最小加班单位 1:按分钟加班、2:按半小时加班、3:按小时加班、4:按半天加班、5:按天加班
KqglAssoOvertimeBasics
basics
=
KqglAssoOvertimeBasics
.
builder
().
build
().
selectOne
(
new
QueryWrapper
<
KqglAssoOvertimeBasics
>().
lambda
().
eq
(
KqglAssoOvertimeBasics:
:
getOrgCode
,
org_code
));
if
(
basics
.
getMinimumUnit
()
==
1
)
{
company
=
"分钟"
;
}
else
if
(
basics
.
getMinimumUnit
()
==
2
)
{
company
=
"半小时"
;}
else
if
(
basics
.
getMinimumUnit
()
==
3
)
{
company
=
"小时"
;}
else
if
(
basics
.
getMinimumUnit
()
==
4
)
{
company
=
"半天"
;}
else
if
(
basics
.
getMinimumUnit
()
==
5
)
{
company
=
"天"
;}
//1:转调休;2:转加班费;3:转调休或加班费
if
(
lea
.
getCompensateId
()
==
1
)
{
method
=
"转调休"
;
}
else
if
(
lea
.
getCompensateId
()
==
2
)
{
method
=
"转加班费"
;
}
else
{
method
=
"转调休或加班费"
;}
jiaban
=
"#"
+(
lea
.
getStartTime
()).
substring
(
5
,
16
)
+
"到"
+
(
lea
.
getEndTime
()).
substring
(
5
,
16
)+
"加班"
+
lea
.
getDuration
()+
company
+
"["
+
method
+
"]"
;
//防止多运算
if
(
lea
.
getOrdernum
()
==
lea
.
getTotals
())
{
//加班补偿方式 1:转调休;2:转加班费;3:转调休或加班费
//工作日
if
(
ClockInTool
.
contains
(
ClockInTool
.
deleteArrayNull
(
ycqts
),
num
))
{
if
(
lea
.
getOvertimeTypeId
()
==
1
)
{
if
(
lea
.
getCompensateId
()
==
1
||
lea
.
getCompensateId
()
==
3
)
{
workingturncompenleave
=
workingturncompenleave
+
lea
.
getDuration
();
}
else
if
(
lea
.
getCompensateId
()
==
2
||
lea
.
getCompensateId
()
==
4
)
{
workingtransferovertime
=
workingtransferovertime
+
+
lea
.
getDuration
();
}
}
}
//休息日
if
(
ClockInTool
.
contains
(
ClockInTool
.
deleteArrayNull
(
xxts
),
num
))
{
if
(
lea
.
getOvertimeTypeId
()
==
2
)
{
if
(
lea
.
getCompensateId
()
==
1
||
lea
.
getCompensateId
()
==
3
)
{
restturncompenleave
=
restturncompenleave
+
lea
.
getDuration
();
}
else
if
(
lea
.
getCompensateId
()
==
2
||
lea
.
getCompensateId
()
==
4
)
{
resttransferovertime
=
resttransferovertime
+
lea
.
getDuration
();
}
}
}
if
(!
ClockInTool
.
contains
(
ClockInTool
.
deleteArrayNull
(
ycqts
),
num
)
&&
!
ClockInTool
.
contains
(
ClockInTool
.
deleteArrayNull
(
xxts
),
num
))
{
if
(
lea
.
getOvertimeTypeId
()
==
3
)
{
if
(
lea
.
getCompensateId
()
==
1
||
lea
.
getCompensateId
()
==
3
)
{
holidayturncompenleave
=
holidayturncompenleave
+
lea
.
getDuration
();
}
else
if
(
lea
.
getCompensateId
()
==
2
||
lea
.
getCompensateId
()
==
4
)
{
holidaytransferovertime
=
holidaytransferovertime
+
lea
.
getDuration
();
}
}
}
}
}
}
if
(
rowData
.
size
()
==
p
)
{
sjs
=
""
;
if
((
""
).
equals
(
qinjia
)
&&
(
""
).
equals
(
chuaca
)
&&
(
""
).
equals
(
waichu
)
&&
(
""
).
equals
(
buka
)
&&
(
""
).
equals
(
jiaban
))
{
sjs
=
rowData
.
get
(
u
);
}
else
{
sjs
=
rowData
.
get
(
u
)+
";"
;
}
}
rowData
.
remove
(
u
);
rowData
.
add
(
u
,
sjs
+
qinjia
+
chuaca
+
waichu
+
buka
+
jiaban
);
/****/
KqglAssoBcsz
shif
=
KqglAssoBcsz
.
builder
().
build
();
if
(
attgro
.
getPbfs
()
==
1
){
int
several
=
Integer
.
valueOf
(
ClockInTool
.
dateToWeek
(
num
));
//
KqglAssoTeshu
tesu
=
KqglAssoTeshu
.
builder
().
build
().
selectOne
(
new
QueryWrapper
<
KqglAssoTeshu
>().
lambda
().
eq
(
KqglAssoTeshu:
:
getKqzid
,
attgro
.
getId
()).
eq
(
KqglAssoTeshu:
:
getTsrq
,
num
));
if
(
tesu
==
null
)
{
//获取该员工最新班次
KqglAssoZhoupaiban
gudingpb
=
KqglAssoZhoupaiban
.
builder
().
build
().
selectOne
(
new
QueryWrapper
<
KqglAssoZhoupaiban
>().
lambda
().
eq
(
KqglAssoZhoupaiban:
:
getKqzid
,
attgro
.
getId
())
.
eq
(
KqglAssoZhoupaiban:
:
getType
,
several
));
if
(
gudingpb
!=
null
)
{
shif
=
shif
.
selectOne
(
new
QueryWrapper
<
KqglAssoBcsz
>().
lambda
().
eq
(
KqglAssoBcsz:
:
getId
,
gudingpb
.
getBcid
()));
}
}
else
{
if
(
tesu
.
getBcid
()
>
0
)
{
shif
=
shif
.
selectOne
(
new
QueryWrapper
<
KqglAssoBcsz
>().
lambda
().
eq
(
KqglAssoBcsz:
:
getId
,
tesu
.
getBcid
()));
}
}
//获取该员工最新班次
KqglAssoZhoupaiban
gudingpb
=
KqglAssoZhoupaiban
.
builder
().
build
().
selectOne
(
new
QueryWrapper
<
KqglAssoZhoupaiban
>().
lambda
().
eq
(
KqglAssoZhoupaiban:
:
getKqzid
,
attgro
.
getId
())
.
eq
(
KqglAssoZhoupaiban:
:
getType
,
several
));
if
(
gudingpb
!=
null
)
{
shif
=
KqglAssoBcsz
.
builder
().
build
();
shif
=
shif
.
selectOne
(
new
QueryWrapper
<
KqglAssoBcsz
>().
lambda
().
eq
(
KqglAssoBcsz:
:
getId
,
gudingpb
.
getBcid
()));
}
}
else
if
(
attgro
.
getPbfs
()
==
2
){
KqglAssoPbmx
pbmxx
=
KqglAssoPbmx
.
builder
().
build
().
selectOne
(
new
QueryWrapper
<
KqglAssoPbmx
>().
lambda
().
eq
(
KqglAssoPbmx:
:
getUserid
,
user
.
getEmpnum
()).
eq
(
KqglAssoPbmx:
:
getData
,
num
).
eq
(
KqglAssoPbmx:
:
getKqzid
,
attgro
.
getId
()));
if
(
pbmxx
!=
null
&&
pbmxx
.
getBcid
()
!=
0
)
{
shif
=
shif
.
selectOne
(
new
QueryWrapper
<
KqglAssoBcsz
>().
lambda
().
eq
(
KqglAssoBcsz:
:
getId
,
pbmxx
.
getBcid
()));
}
}
if
(
shif
!=
null
&&
shif
.
getSxbcs
()
!=
null
)
{
answer
=
shif
.
getSxbcs
();
//1=2次 2=4次 3=6次
//未打最后一次卡的时候 判断最后一次打卡时间是否在请假范围内 相对应减少下班缺卡次数
//最后一次应打卡时间
String
latimeclock
=
""
;
if
(
answer
==
1
)
{
latimeclock
=
num
+
" "
+
shif
.
getXbdk1
();
//ClockInTool.dealDateFormat(shif.getXbdk1(),3);
}
else
if
(
answer
==
2
)
{
latimeclock
=
num
+
" "
+
shif
.
getXbdk2
();
//ClockInTool.dealDateFormat(shif.getXbdk2(),3);
}
else
{
latimeclock
=
num
+
" "
+
shif
.
getXbdk3
();
//ClockInTool.dealDateFormat(shif.getXbdk3(),3);
}
for
(
KqglAssoRelationSummary
learel:
leainv
)
{
boolean
adopt
=
ClockInTool
.
hourMinuteBetween
(
latimeclock
,
learel
.
getStartTime
().
substring
(
0
,
16
),
learel
.
getEndTime
().
substring
(
0
,
16
),
"yyyy-MM-dd HH:mm"
);
if
(
adopt
)
{
xbqkcs
=
xbqkcs
-
1
;
}
}
}
u
++;
p
++;
}
catch
(
Exception
e
)
{
System
.
err
.
println
(
"出错"
);
}
}
}
else
{
for
(
String
num2
:
range
)
{
if
(
ClockInTool
.
useArrayUtils
(
dkjtts
,
num2
))
{
rowData
.
add
(
"未排班并打卡"
);
}
else
{
rowData
.
add
(
"未排班"
);
}
}
System
.
err
.
print
(
user
.
getEmpnum
()+
"该员工未加入考勤组"
);
}
String
[]
range1
=
ClockInTool
.
listToString
(
rowData
).
split
(
";"
);
String
[]
noticesArray
=
range1
[
0
].
split
(
","
);
noticesArray
=
ClockInTool
.
arrycopy
(
noticesArray
);
for
(
int
ct
=
noticesArray
.
length
-
1
;
ct
<
31
;
ct
++)
{
noticesArray
[
ct
]
=
""
;
if
(
ct
<
30
)
{
noticesArray
=
ClockInTool
.
arrycopy
(
noticesArray
);
}
}
String
department
=
""
,
position
=
""
;
if
(
user
.
getDepartment
()
!=
null
)
{
department
=
user
.
getDepartment
();
}
if
(
user
.
getPosition
()
!=
null
)
{
position
=
user
.
getPosition
();
}
KqglAssoMonthPunchSummary
summary
=
KqglAssoMonthPunchSummary
.
builder
().
name
(
user
.
getEmpname
()).
num
(
user
.
getEmpnum
()).
dept
(
department
)
.
post
(
position
).
attGroup
(
attgroid
).
shift
(
answer
).
build
();
summary
.
setDaysOnDuty
(
daysOnDuty
);
//应出勤天数
summary
.
setActualAttDays
(
Double
.
valueOf
(
dkjl
));
//实际出勤天数
summary
.
setDaysOff
(
daysOff
);
//休息天数
summary
.
setWorkingHours
(
workinghours
);
summary
.
setLateTimes
(
Double
.
valueOf
(
latenum
));
//迟到次数
summary
.
setLateHours
(
Double
.
valueOf
(
latehours
));
//迟到时长(分钟)
summary
.
setSeriousLateTimes
(
seriouslatetimes
);
//严重迟到次数
summary
.
setSeriousLateHours
(
seriouslatehours
);
//严重迟到时长(分钟)
summary
.
setAbsenLateTimes
(
absenlatetimes
);
//旷工迟到次数
summary
.
setEarlyLeaveTimes
(
Double
.
valueOf
(
leanum
));
//早退次数
summary
.
setLengthEarlyLeave
(
Double
.
valueOf
(
leahours
));
//早退时长(分钟)
summary
.
setNumberWorkCardShortage
(
Double
.
valueOf
(
sbqkcs
));
//上班缺卡次数
summary
.
setNumberDutyCardShortage
(
Double
.
valueOf
(
xbqkcs
<
0
?
0
:
xbqkcs
));
//下班缺卡次数
summary
.
setLengthBusinessTrip
(
traveltotal
);
//出差时长
summary
.
setTimeOut
(
egresstotal
);
//外出时长
summary
.
setTotalOvertimeHours
(
overtimetotal
);
//加班总时长
summary
.
setBelongYear
(
year
);
summary
.
setBelongMonth
(
month
);
summary
.
setOrgCode
(
org_code
);
summary
.
setLastModified
(
new
Date
().
getTime
());
int
absenteeismdays
=
0
;
if
(
zjgzts
-
dkjl
>
0
)
{
absenteeismdays
=
zjgzts
-
dkjl
;
}
summary
.
setAbsenteeismDays
(
Double
.
valueOf
(
absenteeismdays
));
//旷工天数
summary
.
setWorkingTurnCompenLeave
(
workingturncompenleave
);
//工作日(转调休)
summary
.
setRestTurnCompenLeave
(
restturncompenleave
);
//休息日(转调休)
summary
.
setHolidayTurnCompenLeave
(
holidayturncompenleave
);
//节假日(转调休)
summary
.
setWorkingTransferOvertime
(
workingtransferovertime
);
//工作日(转加班费)
summary
.
setRestTransferOvertime
(
resttransferovertime
);
//休息日(转加班费)
summary
.
setHolidayTransferOvertime
(
holidaytransferovertime
);
//节假日(转加班费)
summary
.
setDay1
(
noticesArray
[
0
]);
summary
.
setDay2
(
noticesArray
[
1
]);
summary
.
setDay3
(
noticesArray
[
2
]);
summary
.
setDay4
(
noticesArray
[
3
]);
summary
.
setDay5
(
noticesArray
[
4
]);
summary
.
setDay6
(
noticesArray
[
5
]);
summary
.
setDay7
(
noticesArray
[
6
]);
summary
.
setDay8
(
noticesArray
[
7
]);
summary
.
setDay9
(
noticesArray
[
8
]);
summary
.
setDay10
(
noticesArray
[
9
]);
summary
.
setDay11
(
noticesArray
[
10
]);
summary
.
setDay12
(
noticesArray
[
11
]);
summary
.
setDay13
(
noticesArray
[
12
]);
summary
.
setDay14
(
noticesArray
[
13
]);
summary
.
setDay15
(
noticesArray
[
14
]);
summary
.
setDay16
(
noticesArray
[
15
]);
summary
.
setDay17
(
noticesArray
[
16
]);
summary
.
setDay18
(
noticesArray
[
17
]);
summary
.
setDay19
(
noticesArray
[
18
]);
summary
.
setDay20
(
noticesArray
[
19
]);
summary
.
setDay21
(
noticesArray
[
20
]);
summary
.
setDay22
(
noticesArray
[
21
]);
summary
.
setDay23
(
noticesArray
[
22
]);
summary
.
setDay24
(
noticesArray
[
23
]);
summary
.
setDay25
(
noticesArray
[
24
]);
summary
.
setDay26
(
noticesArray
[
25
]);
summary
.
setDay27
(
noticesArray
[
26
]);
summary
.
setDay28
(
noticesArray
[
27
]);
summary
.
setDay29
(
noticesArray
[
28
]);
summary
.
setDay30
(
noticesArray
[
29
]);
summary
.
setDay31
(
noticesArray
[
30
]);
summary
.
setId
(
summaryid
);
summary
.
insertOrUpdate
();
}
}
//循环对应公司所有员工
}
//循环所有公司
}
@Autowired
private
KqglAssoPbmxMapper
kqglassopbmxmapper
;
/**
* @param qyid
* @param userid
* @param date
* @return
* 获取当天打卡班次数据
*/
public
AttendanceCardListDto
MethodCall
(
int
qyid
,
int
userid
,
String
date
)
throws
ParseException
{
AttendanceCardListDto
attcar
=
new
AttendanceCardListDto
();
String
str
=
null
;
if
(!(
""
).
equals
(
date
)){
str
=
date
;
}
else
{
Date
d
=
new
Date
();
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
str
=
sdf
.
format
(
d
);
}
KqglMainKqz
attgro
=
kqglmainkqzmapper
.
getAttendanceGroupInformationByUserid
(
userid
,
qyid
);
//考勤组信息
//pbfs:排班方式 1:固定排班;2:自由排班;3:自由工时
if
(
attgro
!=
null
){
//判断当前用户是否加入到考勤组
//排班制
KqglAssoPbmxDto
jrpb
=
kqglassopbmxmapper
.
getScheduleSpecificAttendance
(
attgro
.
getId
(),
userid
,
str
);
//固定排班
int
week
=
Integer
.
valueOf
(
ClockInTool
.
dateToWeek
(
str
));
//4
KqglAssoZhoupaiban
atwek
=
KqglAssoZhoupaiban
.
builder
().
build
().
selectOne
(
new
QueryWrapper
<
KqglAssoZhoupaiban
>().
lambda
().
eq
(
KqglAssoZhoupaiban:
:
getKqzid
,
attgro
.
getId
())
.
eq
(
KqglAssoZhoupaiban:
:
getType
,
week
).
ne
(
KqglAssoZhoupaiban:
:
getBcid
,
0
));
if
(
attgro
.
getPbfs
()
==
1
){
//固定排班
if
(
atwek
!=
null
){
//有固定周排班
KqglAssoTeshu
rest
=
KqglAssoTeshu
.
builder
().
build
().
selectOne
(
new
QueryWrapper
<
KqglAssoTeshu
>().
lambda
().
eq
(
KqglAssoTeshu:
:
getKqzid
,
attgro
.
getId
())
.
eq
(
KqglAssoTeshu:
:
getTsrq
,
str
).
eq
(
KqglAssoTeshu:
:
getBcid
,
0
));
if
(
rest
!=
null
){
//今天休息 Sort返回0【特殊日期--休息】
List
<
AttSchedule
>
atts
=
new
ArrayList
<
AttSchedule
>();
AttSchedule
as
=
AttSchedule
.
builder
().
id
(
0
).
sort
(
0
).
time
(
0
l
).
starttime
(
0
l
).
endtime
(
0
l
).
build
();
atts
.
add
(
as
);
attcar
.
setAttsch
(
atts
);
}
else
{
//今天上班
KqglAssoBcsz
bcz
=
KqglAssoBcsz
.
builder
().
build
().
selectOne
(
new
QueryWrapper
<
KqglAssoBcsz
>().
lambda
().
eq
(
KqglAssoBcsz:
:
getId
,
atwek
.
getBcid
()));
if
(
bcz
!=
null
){
Getshiftinformationbatch
(
bcz
,
attcar
,
str
);
}
}
}
else
{
//必须打卡
KqglAssoTeshu
tsri
=
KqglAssoTeshu
.
builder
().
build
().
selectOne
(
new
QueryWrapper
<
KqglAssoTeshu
>().
lambda
().
eq
(
KqglAssoTeshu:
:
getKqzid
,
attgro
.
getId
())
.
eq
(
KqglAssoTeshu:
:
getTsrq
,
str
).
ne
(
KqglAssoTeshu:
:
getBcid
,
0
));
if
(
tsri
!=
null
){
KqglAssoBcsz
tsrq
=
KqglAssoBcsz
.
builder
().
build
().
selectOne
(
new
QueryWrapper
<
KqglAssoBcsz
>().
lambda
().
eq
(
KqglAssoBcsz:
:
getId
,
tsri
.
getBcid
()));
if
(
tsrq
!=
null
){
Getshiftinformationbatch
(
tsrq
,
attcar
,
str
);
}
}
else
{
//休息
List
<
AttSchedule
>
atts
=
new
ArrayList
<
AttSchedule
>();
AttSchedule
as
=
AttSchedule
.
builder
().
id
(
0
).
sort
(
0
).
time
(
0
l
).
starttime
(
0
l
).
endtime
(
0
l
).
build
();
atts
.
add
(
as
);
attcar
.
setAttsch
(
atts
);
}
}
}
else
if
(
attgro
.
getPbfs
()
==
2
){
//自由排班
if
(
jrpb
!=
null
){
if
(
jrpb
.
getBcid
()
!=
0
){
//有班次时("Bcid"不为0时)
KqglAssoBcsz
tsrq
=
KqglAssoBcsz
.
builder
().
build
().
selectOne
(
new
QueryWrapper
<
KqglAssoBcsz
>().
lambda
().
eq
(
KqglAssoBcsz:
:
getId
,
jrpb
.
getBcid
()));
/**已简化**/
Getshiftinformationbatch
(
tsrq
,
attcar
,
str
);
}
else
{
//当天排班为休息
List
<
AttSchedule
>
atts1
=
new
ArrayList
<
AttSchedule
>();
AttSchedule
as
=
AttSchedule
.
builder
().
id
(
0
).
sort
(
0
).
time
(
0
l
).
starttime
(
0
l
).
endtime
(
0
l
).
build
();
atts1
.
add
(
as
);
attcar
.
setAttsch
(
atts1
);
}
}
}
else
{
//自由工时
KqglAssoZhoupaiban
wekz
=
KqglAssoZhoupaiban
.
builder
().
build
().
selectOne
(
new
QueryWrapper
<
KqglAssoZhoupaiban
>().
lambda
().
eq
(
KqglAssoZhoupaiban:
:
getKqzid
,
attgro
.
getId
())
.
eq
(
KqglAssoZhoupaiban:
:
getBcid
,
0
).
eq
(
KqglAssoZhoupaiban:
:
getType
,
week
));
if
(
wekz
!=
null
){
//
String
dada
=
str
+
" "
+
attgro
.
getKqkssjTime
()+
":00"
;
attcar
.
setStapclotime
(
Long
.
valueOf
(
ClockInTool
.
dateToStamp
(
dada
)));
}
if
(!(
""
).
equals
(
attgro
.
getJbzdsc
())){
attcar
.
setCanpunchworkdate
(
Double
.
valueOf
(
attgro
.
getJbzdsc
()));
//上班打卡后多久大下班卡
}
}
if
(
jrpb
!=
null
||
atwek
!=
null
){
KqglAssoBcsz
shif
=
KqglAssoBcsz
.
builder
().
build
();
if
(
attgro
.
getPbfs
()
==
1
){
shif
=
shif
.
selectOne
(
new
QueryWrapper
<
KqglAssoBcsz
>().
lambda
().
eq
(
KqglAssoBcsz:
:
getId
,
atwek
.
getBcid
()));
}
else
if
(
attgro
.
getPbfs
()
==
2
){
shif
=
shif
.
selectOne
(
new
QueryWrapper
<
KqglAssoBcsz
>().
lambda
().
eq
(
KqglAssoBcsz:
:
getId
,
jrpb
.
getBcid
()));
}
if
(
shif
!=
null
){
if
(
shif
.
getIsXbdk
()
==
1
){
attcar
.
setNoclockout
(
true
);
// 下班不用打卡
}
else
{
attcar
.
setNoclockout
(
false
);
// 下班不用打卡
}
attcar
.
setAllowlate
(
shif
.
getYxcdfzs
());
// 允许迟到分钟数
attcar
.
setSeriouslate
(
shif
.
getYzcdfzs
());
// 严重迟到分钟数
attcar
.
setAbsenteeismlate
(
shif
.
getKgcdfzs
());
// 旷工迟到分钟数
if
(
shif
.
getIsWzwd
()
==
1
){
attcar
.
setIslatelate
(
true
);
// 晚走晚到
List
<
AttLateLate
>
atwzwd
=
new
ArrayList
<
AttLateLate
>();
int
p
=
0
;
if
(!(
""
).
equals
(
shif
.
getXbwz1
())
&&
!(
""
).
equals
(
shif
.
getSbwd1
())){
p
=
2
;}
if
(!(
""
).
equals
(
shif
.
getXbwz1
())
&&
!(
""
).
equals
(
shif
.
getSbwd1
())
&&
!(
""
).
equals
(
shif
.
getXbwz2
())
&&
!(
""
).
equals
(
shif
.
getSbwd2
())){
p
=
4
;}
if
(!(
""
).
equals
(
shif
.
getXbwz1
())
&&
!(
""
).
equals
(
shif
.
getSbwd1
())
&&
!(
""
).
equals
(
shif
.
getXbwz2
())
&&
!(
""
).
equals
(
shif
.
getSbwd2
())
&&
!(
""
).
equals
(
shif
.
getXbwz3
())
&&
!(
""
).
equals
(
shif
.
getSbwd3
())){
p
=
6
;}
AttLateLate
ala
=
AttLateLate
.
builder
().
build
();
ala
.
setLatewalk
(
shif
.
getXbwz1
());
ala
.
setArrivelate
(
shif
.
getSbwd1
());
atwzwd
.
add
(
ala
);
if
(
p
==
4
||
p
==
6
){
AttLateLate
alat
=
AttLateLate
.
builder
().
build
();
alat
.
setLatewalk
(
shif
.
getXbwz2
());
alat
.
setArrivelate
(
shif
.
getSbwd2
());
atwzwd
.
add
(
alat
);
}
if
(
p
==
6
){
AttLateLate
alas
=
AttLateLate
.
builder
().
build
();
alas
.
setLatewalk
(
shif
.
getXbwz3
());
alas
.
setArrivelate
(
shif
.
getSbwd3
());
atwzwd
.
add
(
alas
);
}
attcar
.
setAttlat
(
atwzwd
);
}
else
{
attcar
.
setIslatelate
(
false
);
// 晚走晚到
}
}
}
attcar
.
setAttgrouptype
(
attgro
.
getPbfs
());
//1:固定排班;2:自由排班;3:自由工时
}
else
{
attcar
.
setAttgrouptype
(
0
);
//1:固定排班;2:自由排班;3:自由工时
}
return
attcar
;
}
/**
* @param shiftm
* @param attcar
* @param str
*/
public
void
Getshiftinformationbatch
(
KqglAssoBcsz
shiftm
,
AttendanceCardListDto
attcar
,
String
str
){
int
isXbdk1Cr
=
shiftm
.
getIsXbdk1Cr
();
//下班1是否次日(0:否;1:是)
int
isSbdk2Cr
=
shiftm
.
getIsSbdk2Cr
();
//上班2是否次日(0:否;1:是)
int
isXbdk2Cr
=
shiftm
.
getIsXbdk2Cr
();
//下班2是否次日(0:否;1:是)
int
isSbdk3Cr
=
shiftm
.
getIsSbdk3Cr
();
//上班3是否次日(0:否;1:是)
int
isXbdk3Cr
=
shiftm
.
getIsXbdk3Cr
();
//下班3是否次日(0:否;1:是)
//次日专用
String
next_day
=
ClockInTool
.
requires_extra_times
(
str
,
1
,
2
,
1
);
List
<
AttSchedule
>
atts
=
new
ArrayList
<
AttSchedule
>();
if
(
shiftm
.
getSxbcs
()
==
1
||
shiftm
.
getSxbcs
()
==
2
||
shiftm
.
getSxbcs
()
==
3
){
//1次上下班
for
(
int
o
=
0
;
o
<
2
;
o
++){
if
(
o
==
0
){
AttSchedule
as
=
AttSchedule
.
builder
().
id
(
shiftm
.
getId
()).
sort
(
1
).
time
(
Long
.
valueOf
(
ClockInTool
.
dateToStamp
((
str
+
" "
+
shiftm
.
getSbdk1
()+
":00"
).
replaceAll
(
"\r|\n"
,
""
))))
.
starttime
((
""
).
equals
(
shiftm
.
getSbqjks1
())
||
shiftm
.
getSbqjks1
()
==
null
?
0
:
Long
.
valueOf
(
ClockInTool
.
dateToStamp
((
str
+
" "
+
shiftm
.
getSbqjks1
()+
":00"
).
replaceAll
(
"\r|\n"
,
""
))))
.
endtime
((
""
).
equals
(
shiftm
.
getSbqjjs1
())
||
shiftm
.
getSbqjjs1
()
==
null
?
0
:
Long
.
valueOf
(
ClockInTool
.
dateToStamp
((
str
+
" "
+
shiftm
.
getSbqjjs1
()+
":00"
).
replaceAll
(
"\r|\n"
,
""
))))
.
nextday
(
0
).
build
();
atts
.
add
(
as
);
}
else
{
//次日
if
(
isXbdk1Cr
>
0
)
{
AttSchedule
as
=
AttSchedule
.
builder
().
id
(
shiftm
.
getId
()).
sort
(
2
).
time
(
Long
.
valueOf
(
ClockInTool
.
dateToStamp
((
next_day
+
" "
+
shiftm
.
getXbdk1
()+
":00"
).
replaceAll
(
"\r|\n"
,
""
))))
.
starttime
((
""
).
equals
(
shiftm
.
getXbqjks1
())
||
shiftm
.
getXbqjks1
()
==
null
?
0
:
Long
.
valueOf
(
ClockInTool
.
dateToStamp
((
next_day
+
" "
+
shiftm
.
getXbqjks1
()+
":00"
).
replaceAll
(
"\r|\n"
,
""
))))
.
endtime
((
""
).
equals
(
shiftm
.
getXbqjjs1
())
||
shiftm
.
getXbqjjs1
()
==
null
?
0
:
Long
.
valueOf
(
ClockInTool
.
dateToStamp
((
next_day
+
" "
+
shiftm
.
getXbqjjs1
()+
":00"
).
replaceAll
(
"\r|\n"
,
""
))))
.
nextday
(
1
).
build
();
atts
.
add
(
as
);
}
else
{
AttSchedule
as
=
AttSchedule
.
builder
().
id
(
shiftm
.
getId
()).
sort
(
2
).
time
(
Long
.
valueOf
(
ClockInTool
.
dateToStamp
((
str
+
" "
+
shiftm
.
getXbdk1
()+
":00"
).
replaceAll
(
"\r|\n"
,
""
))))
.
starttime
((
""
).
equals
(
shiftm
.
getXbqjks1
())
||
shiftm
.
getXbqjks1
()
==
null
?
0
:
Long
.
valueOf
(
ClockInTool
.
dateToStamp
((
str
+
" "
+
shiftm
.
getXbqjks1
()+
":00"
).
replaceAll
(
"\r|\n"
,
""
))))
.
endtime
((
""
).
equals
(
shiftm
.
getXbqjjs1
())
||
shiftm
.
getXbqjjs1
()
==
null
?
0
:
Long
.
valueOf
(
ClockInTool
.
dateToStamp
((
str
+
" "
+
shiftm
.
getXbqjjs1
()+
":00"
).
replaceAll
(
"\r|\n"
,
""
))))
.
nextday
(
0
).
build
();
atts
.
add
(
as
);
}
}
}
attcar
.
setAttsch
(
atts
);
}
if
(
shiftm
.
getSxbcs
()
==
2
||
shiftm
.
getSxbcs
()
==
3
){
//2次上下班
for
(
int
o
=
0
;
o
<
2
;
o
++){
if
(
o
==
0
){
if
(
isSbdk2Cr
>
0
)
{
//次日
AttSchedule
as
=
AttSchedule
.
builder
().
id
(
shiftm
.
getId
()).
sort
(
3
).
time
(
Long
.
valueOf
(
ClockInTool
.
dateToStamp
((
next_day
+
" "
+
shiftm
.
getSbdk2
()+
":00"
).
replaceAll
(
"\r|\n"
,
""
))))
.
starttime
((
""
).
equals
(
shiftm
.
getSbqjks2
())||
shiftm
.
getSbqjks2
()==
null
?
0
:
Long
.
valueOf
(
ClockInTool
.
dateToStamp
((
next_day
+
" "
+
shiftm
.
getSbqjks2
()+
":00"
).
replaceAll
(
"\r|\n"
,
""
))))
.
endtime
((
""
).
equals
(
shiftm
.
getSbqjjs2
())
||
shiftm
.
getSbqjjs2
()==
null
?
0
:
Long
.
valueOf
(
ClockInTool
.
dateToStamp
((
next_day
+
" "
+
shiftm
.
getSbqjjs2
()+
":00"
).
replaceAll
(
"\r|\n"
,
""
))))
.
nextday
(
1
).
build
();
atts
.
add
(
as
);
}
else
{
AttSchedule
as
=
AttSchedule
.
builder
().
id
(
shiftm
.
getId
()).
sort
(
3
).
time
(
Long
.
valueOf
(
ClockInTool
.
dateToStamp
((
str
+
" "
+
shiftm
.
getSbdk2
()+
":00"
).
replaceAll
(
"\r|\n"
,
""
))))
.
starttime
((
""
).
equals
(
shiftm
.
getSbqjks2
())||
shiftm
.
getSbqjks2
()==
null
?
0
:
Long
.
valueOf
(
ClockInTool
.
dateToStamp
((
str
+
" "
+
shiftm
.
getSbqjks2
()+
":00"
).
replaceAll
(
"\r|\n"
,
""
))))
.
endtime
((
""
).
equals
(
shiftm
.
getSbqjjs2
())
||
shiftm
.
getSbqjjs2
()==
null
?
0
:
Long
.
valueOf
(
ClockInTool
.
dateToStamp
((
str
+
" "
+
shiftm
.
getSbqjjs2
()+
":00"
).
replaceAll
(
"\r|\n"
,
""
))))
.
nextday
(
0
).
build
();
atts
.
add
(
as
);
}
}
else
{
if
(
isXbdk2Cr
>
0
)
{
//次日
AttSchedule
as
=
AttSchedule
.
builder
().
id
(
shiftm
.
getId
()).
sort
(
4
).
time
(
Long
.
valueOf
(
ClockInTool
.
dateToStamp
((
next_day
+
" "
+
shiftm
.
getXbdk2
()+
":00"
).
replaceAll
(
"\r|\n"
,
""
))))
.
starttime
((
""
).
equals
(
shiftm
.
getXbqjks2
())
||
shiftm
.
getXbqjks2
()==
null
?
0
:
Long
.
valueOf
(
ClockInTool
.
dateToStamp
((
next_day
+
" "
+
shiftm
.
getXbqjks2
()+
":00"
).
replaceAll
(
"\r|\n"
,
""
))))
.
endtime
((
""
).
equals
(
shiftm
.
getXbqjjs2
())
||
shiftm
.
getXbqjjs2
()==
null
?
0
:
Long
.
valueOf
(
ClockInTool
.
dateToStamp
((
next_day
+
" "
+
shiftm
.
getXbqjjs2
()+
":00"
).
replaceAll
(
"\r|\n"
,
""
))))
.
nextday
(
1
).
build
();
atts
.
add
(
as
);
}
else
{
AttSchedule
as
=
AttSchedule
.
builder
().
id
(
shiftm
.
getId
()).
sort
(
4
).
time
(
Long
.
valueOf
(
ClockInTool
.
dateToStamp
((
str
+
" "
+
shiftm
.
getXbdk2
()+
":00"
).
replaceAll
(
"\r|\n"
,
""
))))
.
starttime
((
""
).
equals
(
shiftm
.
getXbqjks2
())
||
shiftm
.
getXbqjks2
()==
null
?
0
:
Long
.
valueOf
(
ClockInTool
.
dateToStamp
((
str
+
" "
+
shiftm
.
getXbqjks2
()+
":00"
).
replaceAll
(
"\r|\n"
,
""
))))
.
endtime
((
""
).
equals
(
shiftm
.
getXbqjjs2
())
||
shiftm
.
getXbqjjs2
()==
null
?
0
:
Long
.
valueOf
(
ClockInTool
.
dateToStamp
((
str
+
" "
+
shiftm
.
getXbqjjs2
()+
":00"
).
replaceAll
(
"\r|\n"
,
""
))))
.
nextday
(
0
).
build
();
atts
.
add
(
as
);
}
}
}
attcar
.
setAttsch
(
atts
);
}
if
(
shiftm
.
getSxbcs
()
==
3
){
//3次上下班
for
(
int
o
=
0
;
o
<
2
;
o
++){
if
(
o
==
0
){
if
(
isSbdk3Cr
>
0
)
{
//次日
AttSchedule
as
=
AttSchedule
.
builder
().
id
(
shiftm
.
getId
()).
sort
(
5
).
time
(
Long
.
valueOf
(
ClockInTool
.
dateToStamp
((
next_day
+
" "
+
shiftm
.
getSbdk3
()+
":00"
).
replaceAll
(
"\r|\n"
,
""
))))
.
starttime
((
""
).
equals
(
shiftm
.
getSbqjks3
())
||
shiftm
.
getSbqjks3
()
==
null
?
0
:
Long
.
valueOf
(
ClockInTool
.
dateToStamp
((
next_day
+
" "
+
shiftm
.
getSbqjks3
()+
":00"
).
replaceAll
(
"\r|\n"
,
""
))))
.
endtime
((
""
).
equals
(
shiftm
.
getSbqjjs3
())
||
shiftm
.
getSbqjjs3
()
==
null
?
0
:
Long
.
valueOf
(
ClockInTool
.
dateToStamp
((
next_day
+
" "
+
shiftm
.
getSbqjjs3
()+
":00"
).
replaceAll
(
"\r|\n"
,
""
))))
.
nextday
(
1
).
build
();
atts
.
add
(
as
);
}
else
{
AttSchedule
as
=
AttSchedule
.
builder
().
id
(
shiftm
.
getId
()).
sort
(
5
).
time
(
Long
.
valueOf
(
ClockInTool
.
dateToStamp
((
str
+
" "
+
shiftm
.
getSbdk3
()+
":00"
).
replaceAll
(
"\r|\n"
,
""
))))
.
starttime
((
""
).
equals
(
shiftm
.
getSbqjks3
())
||
shiftm
.
getSbqjks3
()
==
null
?
0
:
Long
.
valueOf
(
ClockInTool
.
dateToStamp
((
str
+
" "
+
shiftm
.
getSbqjks3
()+
":00"
).
replaceAll
(
"\r|\n"
,
""
))))
.
endtime
((
""
).
equals
(
shiftm
.
getSbqjjs3
())
||
shiftm
.
getSbqjjs3
()
==
null
?
0
:
Long
.
valueOf
(
ClockInTool
.
dateToStamp
((
str
+
" "
+
shiftm
.
getSbqjjs3
()+
":00"
).
replaceAll
(
"\r|\n"
,
""
))))
.
nextday
(
0
).
build
();
atts
.
add
(
as
);
}
}
else
{
if
(
isXbdk3Cr
>
0
)
{
//次日
AttSchedule
as
=
AttSchedule
.
builder
().
id
(
shiftm
.
getId
()).
sort
(
6
).
time
(
Long
.
valueOf
(
ClockInTool
.
dateToStamp
((
next_day
+
" "
+
shiftm
.
getXbdk3
()+
":00"
).
replaceAll
(
"\r|\n"
,
""
))))
.
starttime
((
""
).
equals
(
shiftm
.
getXbqjks3
())
||
shiftm
.
getXbqjks3
()==
null
?
0
:
Long
.
valueOf
(
ClockInTool
.
dateToStamp
((
next_day
+
" "
+
shiftm
.
getXbqjks3
()+
":00"
).
replaceAll
(
"\r|\n"
,
""
))))
.
endtime
((
""
).
equals
(
shiftm
.
getXbqjjs3
())
||
shiftm
.
getXbqjjs3
()
==
null
?
0
:
Long
.
valueOf
(
ClockInTool
.
dateToStamp
((
next_day
+
" "
+
shiftm
.
getXbqjjs3
()+
":00"
).
replaceAll
(
"\r|\n"
,
""
))))
.
nextday
(
1
).
build
();
atts
.
add
(
as
);
}
else
{
AttSchedule
as
=
AttSchedule
.
builder
().
id
(
shiftm
.
getId
()).
sort
(
6
).
time
(
Long
.
valueOf
(
ClockInTool
.
dateToStamp
((
str
+
" "
+
shiftm
.
getXbdk3
()+
":00"
).
replaceAll
(
"\r|\n"
,
""
))))
.
starttime
((
""
).
equals
(
shiftm
.
getXbqjks3
())
||
shiftm
.
getXbqjks3
()==
null
?
0
:
Long
.
valueOf
(
ClockInTool
.
dateToStamp
((
str
+
" "
+
shiftm
.
getXbqjks3
()+
":00"
).
replaceAll
(
"\r|\n"
,
""
))))
.
endtime
((
""
).
equals
(
shiftm
.
getXbqjjs3
())
||
shiftm
.
getXbqjjs3
()
==
null
?
0
:
Long
.
valueOf
(
ClockInTool
.
dateToStamp
((
str
+
" "
+
shiftm
.
getXbqjjs3
()+
":00"
).
replaceAll
(
"\r|\n"
,
""
))))
.
nextday
(
0
).
build
();
atts
.
add
(
as
);
}
}
}
attcar
.
setAttsch
(
atts
);
}
}
}
src/main/java/cn/timer/api/controller/kqgl/atttimer/RealTimeUpdate.java
View file @
6f32bee4
...
...
@@ -84,8 +84,6 @@ public class RealTimeUpdate{
private
PunchRecordMapper
punchrecordmapper
;
@Autowired
private
KqglAssoDkmxMapper
kqglassodkmxmapper
;
@Autowired
private
ClockInController
clockincontroller
;
/**
...
...
@@ -150,7 +148,7 @@ public class RealTimeUpdate{
//考勤组信息
KqglMainKqz
attgro
=
kqglmainkqzmapper
.
getAttendanceGroupInformationByUserid
(
user
.
getEmpnum
(),
org_code
);
//目前为止打卡记录
List
<
PunchCardDetails
>
attendance
=
punchcarddetailsmapper
.
selectAttendanceDays
(
user
.
getEmpnum
(),
startDate
,
endDateyesterday
);
List
<
PunchCardDetails
>
attendance
=
punchcarddetailsmapper
.
selectAttendanceDays
(
user
.
getEmpnum
(),
startDate
,
endDateyesterday
,
org_code
);
int
fdjjrnum
=
0
;
...
...
@@ -489,7 +487,7 @@ public class RealTimeUpdate{
}
}
}
AttSubsidiaryDto
subs
=
kqglassodkmxmapper
.
subsidiary
(
user
.
getEmpnum
(),
ttstr
);
AttSubsidiaryDto
subs
=
kqglassodkmxmapper
.
subsidiary
(
user
.
getEmpnum
(),
ttstr
,
org_code
);
// //工作时长(分钟)、严重迟到次数、严重迟到时长(分钟)、旷工迟到次数
// double workinghours = 0,seriouslatetimes = 0,seriouslatehours = 0,absenlatetimes = 0;
if
(
subs
!=
null
)
{
...
...
src/main/java/cn/timer/api/controller/xcgl/SalaryManagementController.java
View file @
6f32bee4
...
...
@@ -1526,7 +1526,13 @@ public class SalaryManagementController {
if
(
file
.
getSfdx
()
==
0
)
{
XcglAssoXzdadx
xzdadx
=
XcglAssoXzdadx
.
builder
().
build
();
xzdadx
.
setUserid
(
emp
.
getEmpNum
());
//用户id
xzdadx
.
setSxrq
(
file
.
getSxrq
().
replace
(
"/"
,
"-"
));
//生效日期
String
sxrq
=
file
.
getSxrq
().
substring
(
0
,
5
)
+
"20"
+
file
.
getSxrq
().
substring
(
5
,
7
);
if
(
sxrq
.
contains
(
"/"
))
{
xzdadx
.
setSxrq
(
SalaryTool
.
SlashDate
(
sxrq
));
//生效日期
}
else
{
xzdadx
.
setSxrq
(
file
.
getSxrq
());
//生效日期
}
xzdadx
.
setAddtime
(
new
Date
().
getTime
());
xzdadx
.
setRemarks
(
""
);
xzdadx
.
setQyid
(
userBean
.
getOrgCode
());
...
...
@@ -1588,7 +1594,12 @@ public class SalaryManagementController {
}
XcglAssoXzdadx
xzdadx
=
XcglAssoXzdadx
.
builder
().
build
();
xzdadx
.
setUserid
(
emp
.
getEmpNum
());
//用户id
String
sxrq
=
file
.
getSxrq
().
substring
(
0
,
5
)
+
"20"
+
file
.
getSxrq
().
substring
(
5
,
7
);
if
(
sxrq
.
contains
(
"/"
))
{
xzdadx
.
setSxrq
(
SalaryTool
.
SlashDate
(
sxrq
));
//生效日期
}
else
{
xzdadx
.
setSxrq
(
file
.
getSxrq
());
//生效日期
}
xzdadx
.
setAddtime
(
new
Date
().
getTime
());
xzdadx
.
setXgyhid
(
userBean
.
getEmpNum
());
//修改用户id
xzdadx
.
setRemarks
(
""
);
...
...
@@ -2350,12 +2361,12 @@ public class SalaryManagementController {
double
continueedu_
=
0
;
//累计继续教育
double
totalmoney_
=
0
;
//累计专项附加扣除
if
(!
status
&&
sygs
!=
null
)
{
childrenedu_
=
sygs
.
getCumZljy
();
houseloans_
=
sygs
.
getCumZfdklx
();
houserents_
=
sygs
.
getCumZfzj
();
supportolder_
=
sygs
.
getCumSylr
();
continueedu_
=
sygs
.
getCumJxjy
();
totalmoney_
=
sygs
.
getCumZxfjkc
();
childrenedu_
=
sygs
.
getCumZljy
()
==
null
?
0
:
sygs
.
getCumZljy
()
;
houseloans_
=
sygs
.
getCumZfdklx
()
==
null
?
0
:
sygs
.
getCumZfdklx
()
;
houserents_
=
sygs
.
getCumZfzj
()
==
null
?
0
:
sygs
.
getCumZfzj
()
;
supportolder_
=
sygs
.
getCumSylr
()
==
null
?
0
:
sygs
.
getCumSylr
()
;
continueedu_
=
sygs
.
getCumJxjy
()
==
null
?
0
:
sygs
.
getCumJxjy
()
;
totalmoney_
=
sygs
.
getCumZxfjkc
()
==
null
?
0
:
sygs
.
getCumZxfjkc
()
;
}
YgglMainEmp
yh
=
YgglMainEmp
.
builder
().
build
().
selectOne
(
new
QueryWrapper
<
YgglMainEmp
>().
lambda
().
eq
(
YgglMainEmp:
:
getEmpNum
,
gsus
).
eq
(
YgglMainEmp:
:
getOrgCode
,
orgcode
));
//对应算薪月份的专项附加扣除
...
...
@@ -2414,8 +2425,8 @@ public class SalaryManagementController {
}
gsmx
.
setCumJcfy
(
cumjcfy
);
//累计减除费用 【5000*在职月份数】
gsmx
.
setCumZxkc
((
cuspde
==
null
?
0
:
Double
.
valueOf
(
cuspde
.
getGrjltotal
()))
+
(
sygs
==
null
?
0
:
sygs
.
getCumZxkc
(
)));
//累计专项扣除 【本期专项扣除+累计专项扣除(上月)】
gsmx
.
setCumQtkc
(
other_deductions
+(
sygs
==
null
?
0
:
sygs
.
getCumQtkc
(
)));
//累计其他扣除 【其他扣除+累计其他扣除(上月)】
gsmx
.
setCumZxkc
((
cuspde
==
null
?
0
:
Double
.
valueOf
(
cuspde
.
getGrjltotal
()))
+
(
sygs
==
null
?
0
:
(
sygs
.
getCumZxkc
()
==
null
?
0
:
sygs
.
getCumZxkc
()
)));
//累计专项扣除 【本期专项扣除+累计专项扣除(上月)】
gsmx
.
setCumQtkc
(
other_deductions
+(
sygs
==
null
?
0
:
(
sygs
.
getCumQtkc
()
==
null
?
0
:
sygs
.
getCumQtkc
()
)));
//累计其他扣除 【其他扣除+累计其他扣除(上月)】
double
cumynssde
=
0
;
cumynssde
=
gsmx
.
getCumSre
()
-
cumjcfy
-
gsmx
.
getCumZxkc
()
-
gsmx
.
getCumZxfjkc
()
-
gsmx
.
getCumQtkc
();
...
...
@@ -2427,7 +2438,7 @@ public class SalaryManagementController {
gsmx
.
setCumYnse
(
SalaryTool
.
formatDouble_
(
Double
.
valueOf
(
miscalculation
[
2
])));
//累计应纳税额 【累计应纳税所得额*税率-速算扣除数】
double
cumyyjse
=
0
;
cumyyjse
=
(
sygs
==
null
?
0
:
sygs
.
getCumYyjse
())
+
(
sygs
==
null
?
0
:
sygs
.
getCumYbtse
(
));
cumyyjse
=
(
sygs
==
null
?
0
:
(
sygs
.
getCumYyjse
()
==
null
?
0
:
sygs
.
getCumYyjse
()))
+
(
sygs
==
null
?
0
:
(
sygs
.
getCumYbtse
()
==
null
?
0
:
sygs
.
getCumYbtse
()
));
gsmx
.
setCumYyjse
(
cumyyjse
);
//累计已预缴纳税额 【累计已预缴税额(上月)+累计应补(退)税额(上月)】
double
cumybtse
=
0
;
...
...
@@ -2951,7 +2962,7 @@ public class SalaryManagementController {
attrep
.
setRestday
(
xiuxi
);
//休息天数
attrep
.
setAnswerday
(
y
);
//应出勤
}
List
<
PunchCardDetails
>
attendance
=
punchcarddetailsservice
.
selectAttendanceDays
(
userid
,
startDate
,
endDate
);
//打卡记录
List
<
PunchCardDetails
>
attendance
=
punchcarddetailsservice
.
selectAttendanceDays
(
userid
,
startDate
,
endDate
,
orgCode
);
//打卡记录
attrep
.
setActualday
(
attendance
.
size
());
//已出勤
if
(
attrep
.
getAnswerday
()
>
0
){
BigDecimal
g
=
new
BigDecimal
(
attrep
.
getAnswerday
());
...
...
@@ -3419,19 +3430,19 @@ public class SalaryManagementController {
fjkc
.
setSupportolder
(
Double
.
valueOf
(
spec
.
getSylr
()));
//赡养老人
fjkc
.
setContinueedu
(
Double
.
valueOf
(
spec
.
getJxjy
()));
//继续教育
BigDecimal
num1
=
new
BigDecimal
(
spec
.
getZljy
(
));
BigDecimal
num2
=
new
BigDecimal
(
spec
.
getZfdk
(
));
BigDecimal
num1
=
new
BigDecimal
(
Double
.
valueOf
(
spec
.
getZljy
()
));
BigDecimal
num2
=
new
BigDecimal
(
Double
.
valueOf
(
spec
.
getZfdk
()
));
double
result1
=
num1
.
add
(
num2
).
doubleValue
();
BigDecimal
num3
=
new
BigDecimal
(
result1
);
BigDecimal
num4
=
new
BigDecimal
(
spec
.
getZfzj
(
));
BigDecimal
num4
=
new
BigDecimal
(
Double
.
valueOf
(
spec
.
getZfzj
()
));
double
result2
=
num3
.
add
(
num4
).
doubleValue
();
BigDecimal
num5
=
new
BigDecimal
(
result2
);
BigDecimal
num6
=
new
BigDecimal
(
spec
.
getSylr
(
));
BigDecimal
num6
=
new
BigDecimal
(
Double
.
valueOf
(
spec
.
getSylr
()
));
double
result3
=
num5
.
add
(
num6
).
doubleValue
();
BigDecimal
num7
=
new
BigDecimal
(
result3
);
BigDecimal
num8
=
new
BigDecimal
(
spec
.
getJxjy
(
));
BigDecimal
num8
=
new
BigDecimal
(
Double
.
valueOf
(
spec
.
getJxjy
()
));
double
result
=
num7
.
add
(
num8
).
doubleValue
();
fjkc
.
setTotalmoney
(
Double
.
valueOf
(
result
));
//累计专项附加扣除
...
...
@@ -3439,13 +3450,16 @@ public class SalaryManagementController {
toupdate
++;
}
}
catch
(
Exception
e
)
{
// e.printStackTrace();
failure
++;
map
.
put
(
"name"
,
name
);
map
.
put
(
"msg"
,
StringUtils
.
isBlank
(
e
.
getMessage
())
?
"
必填数据出现空值
"
:
e
.
getMessage
());
map
.
put
(
"msg"
,
StringUtils
.
isBlank
(
e
.
getMessage
())
?
"
用户信息错误
"
:
e
.
getMessage
());
}
finally
{
if
(!
map
.
isEmpty
())
{
reasons
.
add
(
map
);
}
}
}
ImportDescriptionDto
imds
=
new
ImportDescriptionDto
();
imds
.
setSuccess
(
toinsert
+
toupdate
);
//成功
imds
.
setToinsert
(
toinsert
);
...
...
src/main/java/cn/timer/api/controller/xcgl/SalaryTool.java
View file @
6f32bee4
...
...
@@ -11,6 +11,20 @@ public class SalaryTool {
static
SimpleDateFormat
mat
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
static
SimpleDateFormat
matM
=
new
SimpleDateFormat
(
"yyyy-MM"
);
public
static
String
SlashDate
(
String
Slashdate
)
{
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"MM/dd/yyyy"
);
Date
d
=
null
;
try
{
d
=
sdf
.
parse
(
Slashdate
);
sdf
.
applyPattern
(
"yyyy-MM-dd"
);
// System.out.println(sdf.format(d));
}
catch
(
Exception
exe
){
exe
.
printStackTrace
();
}
return
sdf
.
format
(
d
);
}
/**
* 保留两位小数,四舍五入的一个老土的方法
* @param d
...
...
src/main/java/cn/timer/api/dao/kqgl/PunchCardDetailsMapper.java
View file @
6f32bee4
...
...
@@ -20,7 +20,7 @@ public interface PunchCardDetailsMapper {
int
updateByPrimaryKey
(
PunchCardDetails
record
);
int
ModifyPunchDetails
(
PunchCardDetails
record
);
List
<
PunchCardDetails
>
selectAttendanceDays
(
Integer
userid
,
Long
start
,
Long
end
);
List
<
PunchCardDetails
>
selectAttendanceDays
(
Integer
userid
,
Long
start
,
Long
end
,
Integer
qyid
);
PunchCardDetails
SingleAttendanceDays
(
Integer
userid
,
Long
start
,
Long
end
);
...
...
src/main/java/cn/timer/api/dao/kqmk/KqglAssoDkmxMapper.java
View file @
6f32bee4
...
...
@@ -15,7 +15,7 @@ import cn.timer.api.dto.kqmk.AttSubsidiaryDto;
@Repository
public
interface
KqglAssoDkmxMapper
extends
BaseMapper
<
KqglAssoDkmx
>
{
AttSubsidiaryDto
subsidiary
(
int
userid
,
String
data
);
AttSubsidiaryDto
subsidiary
(
int
userid
,
String
data
,
int
qyid
);
int
updateByPrimaryKeySelective
(
KqglAssoDkmx
kqglassodkmx
);
}
src/main/resources/mapping/kqgl/PunchCardDetailsMapper.xml
View file @
6f32bee4
...
...
@@ -290,6 +290,7 @@
where dkmx.userid = #{userid,jdbcType=INTEGER}
and dkmx.dksj
>
= #{start,jdbcType=BIGINT}
and dkmx.dksj
<
= #{end,jdbcType=BIGINT}
and dkmx.qyid = #{qyid,jdbcType=INTEGER}
</select>
<select
id=
"SingleAttendanceDays"
resultMap=
"BaseResultMap"
>
...
...
src/main/resources/mapping/kqmk/KqglAssoDkmxMapper.xml
View file @
6f32bee4
...
...
@@ -59,6 +59,7 @@
from kqgl_asso_dkmx dk
where dk.userid = #{userid}
and SUBSTR(dk.`data`,1,7) = #{data}
and dk.qyid = #{qyid}
GROUP BY dk.userid
</select>
...
...
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