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
7e21b096
Commit
7e21b096
authored
May 20, 2020
by
lal
Committed by
chenzg
Jul 05, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
临时提交
parent
681369b6
Hide whitespace changes
Inline
Side-by-side
Showing
21 changed files
with
1142 additions
and
214 deletions
+1142
-214
src/main/java/cn/timer/api/bean/kqmk/AttendanceSocks.java
+47
-0
src/main/java/cn/timer/api/bean/kqmk/KqglAssoDkmx.java
+10
-0
src/main/java/cn/timer/api/bean/kqmk/KqglAssoMonthPunchSummary.java
+2
-1
src/main/java/cn/timer/api/bean/kqmk/KqglAssoRelationSummary.java
+64
-0
src/main/java/cn/timer/api/bean/kqmk/KqglTaskTiming.java
+52
-0
src/main/java/cn/timer/api/controller/kqgl/ClockInController.java
+25
-135
src/main/java/cn/timer/api/controller/kqgl/ClockInTool.java
+117
-67
src/main/java/cn/timer/api/controller/kqgl/atttimer/AttendanceTaskTiming.java
+374
-0
src/main/java/cn/timer/api/controller/kqgl/atttimer/AttendanceUtil.java
+20
-0
src/main/java/cn/timer/api/controller/kqgl/service/KqglServiceImpl.java
+75
-4
src/main/java/cn/timer/api/dao/kqmk/AttendanceSocksMapper.java
+16
-0
src/main/java/cn/timer/api/dao/kqmk/KqglAssoLeaveBalanceMapper.java
+2
-0
src/main/java/cn/timer/api/dao/kqmk/KqglAssoRelationSummaryMapper.java
+16
-0
src/main/java/cn/timer/api/dao/kqmk/KqglTaskTimingMapper.java
+17
-0
src/main/java/cn/timer/api/dto/kqmk/AttLeaveApprovalDto.java
+1
-1
src/main/java/cn/timer/api/dto/kqmk/AttOvertimeApprovalDto.java
+1
-1
src/main/resources/mapping/kqmk/AttendanceSocksMapper.xml
+25
-0
src/main/resources/mapping/kqmk/KqglAssoDkmxMapper.xml
+35
-5
src/main/resources/mapping/kqmk/KqglAssoLeaveBalanceMapper.xml
+11
-0
src/main/resources/mapping/kqmk/KqglAssoRelationSummaryMapper.xml
+141
-0
src/main/resources/mapping/kqmk/KqglTaskTimingMapper.xml
+91
-0
No files found.
src/main/java/cn/timer/api/bean/kqmk/AttendanceSocks.java
0 → 100644
View file @
7e21b096
package
cn
.
timer
.
api
.
bean
.
kqmk
;
import
javax.persistence.GeneratedValue
;
import
javax.persistence.Id
;
import
javax.persistence.Table
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.extension.activerecord.Model
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.AllArgsConstructor
;
import
lombok.Builder
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
/**
* @author lal 2020-05-19
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Table
(
name
=
"attendance_socks"
)
@ApiModel
(
"考勤定时"
)
public
class
AttendanceSocks
extends
Model
<
AttendanceSocks
>
{
/**
*
*/
private
static
final
long
serialVersionUID
=
1L
;
@Id
@GeneratedValue
@TableId
(
type
=
IdType
.
AUTO
)
@ApiModelProperty
(
value
=
"id id"
,
example
=
"101"
)
private
Integer
cronId
;
@ApiModelProperty
(
value
=
"cron_name "
,
example
=
"cron_name"
)
private
String
cronName
;
@ApiModelProperty
(
value
=
"cron "
,
example
=
"cron"
)
private
String
cron
;
}
\ No newline at end of file
src/main/java/cn/timer/api/bean/kqmk/KqglAssoDkmx.java
View file @
7e21b096
...
...
@@ -91,4 +91,13 @@ public class KqglAssoDkmx extends Model<KqglAssoDkmx> {
@ApiModelProperty
(
value
=
"打卡时间 打卡时间"
,
example
=
"101"
)
private
Long
dksj
;
@ApiModelProperty
(
value
=
"严重迟到次数 严重迟到次数"
,
example
=
"101"
)
private
Integer
yzcdcs
;
@ApiModelProperty
(
value
=
"严重迟到时长(分钟) "
,
example
=
"严重迟到时长(分钟)"
)
private
Double
yzcdsc
;
@ApiModelProperty
(
value
=
"旷工迟到次数 旷工迟到次数"
,
example
=
"101"
)
private
Integer
kgcdfzs
;
}
\ No newline at end of file
src/main/java/cn/timer/api/bean/kqmk/KqglAssoMonthPunchSummary.java
View file @
7e21b096
...
...
@@ -227,6 +227,6 @@ public class KqglAssoMonthPunchSummary extends Model<KqglAssoMonthPunchSummary>
private
Integer
orgCode
;
@ApiModelProperty
(
value
=
"最后修改时间 最后修改时间"
,
example
=
"101"
)
private
Integer
lastModified
;
private
Long
lastModified
;
}
\ No newline at end of file
src/main/java/cn/timer/api/bean/kqmk/KqglAssoRelationSummary.java
0 → 100644
View file @
7e21b096
package
cn
.
timer
.
api
.
bean
.
kqmk
;
import
javax.persistence.GeneratedValue
;
import
javax.persistence.Id
;
import
javax.persistence.Table
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.extension.activerecord.Model
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.AllArgsConstructor
;
import
lombok.Builder
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
/**
* @author lal 2020-05-19
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Table
(
name
=
"kqgl_asso_relation_summary"
)
@ApiModel
(
"打卡月汇总关联表"
)
public
class
KqglAssoRelationSummary
extends
Model
<
KqglAssoRelationSummary
>
{
/**
*
*/
private
static
final
long
serialVersionUID
=
1L
;
@Id
@GeneratedValue
@TableId
(
type
=
IdType
.
AUTO
)
@ApiModelProperty
(
value
=
"id id"
,
example
=
"101"
)
private
Integer
id
;
@ApiModelProperty
(
value
=
"用户id 用户id"
,
example
=
"101"
)
private
Integer
userId
;
@ApiModelProperty
(
value
=
"时间 "
,
example
=
"年月日"
)
private
String
appTime
;
@ApiModelProperty
(
value
=
"审批id 审批id"
,
example
=
"101"
)
private
Integer
approvalId
;
@ApiModelProperty
(
value
=
"审批类型 1:加班 2:请假 3:出差 4:外出 5:补卡"
,
example
=
"101"
)
private
Integer
approvalType
;
@ApiModelProperty
(
value
=
"时长 时长"
,
example
=
"101"
)
private
double
duration
;
@ApiModelProperty
(
value
=
"假期类型id"
,
example
=
"101"
)
private
Integer
leaveTypeId
;
@ApiModelProperty
(
value
=
"加班类型id"
,
example
=
"101"
)
private
Integer
overtimeTypeId
;
@ApiModelProperty
(
value
=
"加班补偿方式 1:转调休;2:转加班费;3:转调休或加班费"
,
example
=
"101"
)
private
Integer
compensateId
;
}
\ No newline at end of file
src/main/java/cn/timer/api/bean/kqmk/KqglTaskTiming.java
0 → 100644
View file @
7e21b096
package
cn
.
timer
.
api
.
bean
.
kqmk
;
import
javax.persistence.Entity
;
import
javax.persistence.GeneratedValue
;
import
javax.persistence.Id
;
import
javax.persistence.Table
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.extension.activerecord.Model
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.AllArgsConstructor
;
import
lombok.Builder
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
/**
* @author Tang 2020-05-19
*/
@Entity
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Table
(
name
=
"kqgl_task_timing"
)
@ApiModel
(
"考勤任务定时"
)
public
class
KqglTaskTiming
extends
Model
<
KqglTaskTiming
>
{
/**
*
*/
private
static
final
long
serialVersionUID
=
1L
;
@Id
@GeneratedValue
@TableId
(
type
=
IdType
.
AUTO
)
@ApiModelProperty
(
value
=
"id id"
,
example
=
"101"
)
private
Integer
id
;
@ApiModelProperty
(
value
=
"任务 "
,
example
=
"任务"
)
private
String
task
;
@ApiModelProperty
(
value
=
"任务执行状态 0:未执行;1:执行中"
,
example
=
"101"
)
private
Integer
executionStatus
;
@ApiModelProperty
(
value
=
"最后一次执行时间 最后一次执行时间"
,
example
=
"101"
)
private
Long
lastExecutionTime
;
}
\ No newline at end of file
src/main/java/cn/timer/api/controller/kqgl/ClockInController.java
View file @
7e21b096
...
...
@@ -4,8 +4,6 @@ import java.math.BigDecimal;
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
;
...
...
@@ -20,29 +18,18 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import
com.github.xiaoymin.knife4j.annotations.ApiOperationSupport
;
import
cn.hutool.json.JSONObject
;
import
cn.timer.api.bean.kqgl.AttendanceWeeklySch
;
import
cn.timer.api.bean.kqgl.PunchCardDetails
;
import
cn.timer.api.bean.kqgl.Schedule
;
import
cn.timer.api.bean.kqmk.KqglAssoBcsz
;
import
cn.timer.api.bean.kqmk.KqglAssoDkjl
;
import
cn.timer.api.bean.kqmk.KqglAssoDkmx
;
import
cn.timer.api.bean.kqmk.KqglAssoKqj
;
import
cn.timer.api.bean.kqmk.KqglAssoKqzdkfs
;
import
cn.timer.api.bean.kqmk.KqglAssoMonthPunchSummary
;
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.yggl.YgglMainEmp
;
import
cn.timer.api.config.exception.CustomException
;
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.KqglAssoLeaveBalanceMapper
;
import
cn.timer.api.dao.kqmk.KqglAssoPbmxMapper
;
import
cn.timer.api.dao.kqmk.KqglAssoTeshuMapper
;
import
cn.timer.api.dao.kqmk.KqglMainKqzMapper
;
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.AttendanceCardListDto
;
...
...
@@ -61,17 +48,7 @@ import io.swagger.annotations.ApiOperation;
public
class
ClockInController
{
@Autowired
private
KqglMainKqzMapper
kqglmainkqzmapper
;
@Autowired
private
KqglAssoLeaveBalanceMapper
kqglassoleavebalancemapper
;
@Autowired
private
KqglAssoTeshuMapper
kqglassoteshumapper
;
@Autowired
private
PunchCardDetailsMapper
punchcarddetailsmapper
;
@Autowired
private
AttendanceWeeklySchMapper
attendanceweeklyschservice
;
@Autowired
private
ScheduleMapper
scheduleservice
;
SimpleDateFormat
sdf1
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
SimpleDateFormat
sdf2
=
new
SimpleDateFormat
(
"EEE"
);
...
...
@@ -91,6 +68,7 @@ public class ClockInController {
String
asUserId
=
jsonArray
.
get
(
"user_id"
).
toString
();
//打卡用户id
String
asVerifyMode
=
jsonArray
.
get
(
"verify_mode"
).
toString
();
//考勤机打卡方式(1:指纹;20:人脸;40:掌纹;60:密码(猜的^v^))
String
sStdIoTime
=
jsonArray
.
get
(
"io_time"
).
toString
();
//打卡时间
KqglAssoKqj
kqjdev
=
KqglAssoKqj
.
builder
().
build
().
selectOne
(
new
QueryWrapper
<
KqglAssoKqj
>().
lambda
().
eq
(
KqglAssoKqj:
:
getCode
,
asDevId
));
if
(
kqjdev
==
null
)
return
ResultUtil
.
error
(
"考勤机不存在!"
);
...
...
@@ -182,15 +160,22 @@ public class ClockInController {
}
}
if
(
isRange
)
{
int
yzcd
=
shif
.
getYzcdfzs
();
//严重迟到分钟数
int
kgcdfzs
=
shif
.
getKgcdfzs
();
//旷工迟到分钟数
if
(
dkmc
==
null
)
{
//上班1 ****新增
int
sbdk1jg
=
0
;
int
sbdk1jg
=
0
,
yzcdsc
=
0
,
yzcdcs
=
0
,
kgcdcs
=
0
;
if
(
punchcardtime
!=
0
){
//有应打卡时间时
Long
time
=
(
time_
-
punchcardtime
)/
1000
/
60
;
if
(
time
>
0
){
sbdk1jg
=
Math
.
abs
(
Integer
.
valueOf
(
time
.
toString
()));}
//上班1打卡结果
}
int
ydkcs
=
0
;
if
(
shif
!=
null
){
ydkcs
=
shif
.
getSxbcs
()*
2
;}
//应打卡次数
KqglAssoDkmx
pcd
=
KqglAssoDkmx
.
builder
().
userid
(
userid
).
data
(
putime
).
sbdk1
(
time_
).
sbdk1jg
(
sbdk1jg
).
ydkcs
(
ydkcs
).
qyid
(
qyid
).
dksj
(
startDate
).
build
();
if
(
sbdk1jg
>
yzcd
)
{
yzcdcs
++;
yzcdsc
=
sbdk1jg
-
yzcd
;
}
if
(
sbdk1jg
>
kgcdfzs
)
{
kgcdcs
++;}
KqglAssoDkmx
pcd
=
KqglAssoDkmx
.
builder
().
userid
(
userid
).
data
(
putime
).
sbdk1
(
time_
).
sbdk1jg
(
sbdk1jg
).
ydkcs
(
ydkcs
).
qyid
(
qyid
).
dksj
(
startDate
).
yzcdcs
(
yzcdcs
).
yzcdsc
(
Double
.
valueOf
(
yzcdsc
)).
kgcdfzs
(
kgcdcs
).
build
();
if
(!
pcd
.
insert
())
{
throw
new
CustomException
(
"打卡明细-新增异常-1"
);
}
...
...
@@ -208,15 +193,21 @@ public class ClockInController {
Long
time
=
(
time_
-
dkmc
.
getSbdk1
())/
1000
/
60
;
gzsc
=
Math
.
abs
(
Double
.
valueOf
(
time
.
toString
()));
//只打一次卡时计算工作时长
}
KqglAssoDkmx
.
builder
().
id
(
dkmc
.
getId
()).
xbdk1
(
time_
).
xbdk1jg
(
xbdk1jg
).
gzsc
(
gzsc
).
build
().
updateById
();
}
else
if
((!(
""
).
equals
(
dkmc
.
getSbdk1
())
||
dkmc
.
getSbdk1
()
!=
null
)
&&
(!(
""
).
equals
(
dkmc
.
getXbdk1
())
||
dkmc
.
getXbdk1
()
!=
null
)
&&
((
""
).
equals
(
dkmc
.
getSbdk2
())
||
dkmc
.
getSbdk2
()
==
null
)){
//上班2
int
sbdk2jg
=
0
;
int
sbdk2jg
=
0
,
yzcdsc
=
0
,
yzcdcs
=
0
,
kgcdcs
=
0
;
if
(
punchcardtime
!=
0
){
//有应打卡时间时
Long
time
=
(
time_
-
punchcardtime
)/
1000
/
60
;
if
(
time
>
0
){
sbdk2jg
=
Math
.
abs
(
Integer
.
valueOf
(
time
.
toString
()));}
}
KqglAssoDkmx
.
builder
().
id
(
dkmc
.
getId
()).
sbdk2
(
time_
).
sbdk2jg
(
sbdk2jg
).
build
().
updateById
();
if
(
sbdk2jg
>
yzcd
)
{
yzcdcs
=
dkmc
.
getYzcdcs
()+
1
;
yzcdsc
=
sbdk2jg
-
yzcd
;
}
if
(
sbdk2jg
>
kgcdfzs
)
{
kgcdcs
++;}
KqglAssoDkmx
.
builder
().
id
(
dkmc
.
getId
()).
sbdk2
(
time_
).
sbdk2jg
(
sbdk2jg
).
yzcdcs
(
yzcdcs
).
yzcdsc
(
Double
.
valueOf
(
yzcdsc
)).
kgcdfzs
(
kgcdcs
).
build
().
updateById
();
}
else
if
((!(
""
).
equals
(
dkmc
.
getSbdk1
())
||
dkmc
.
getSbdk1
()
!=
null
)
&&
(!(
""
).
equals
(
dkmc
.
getXbdk1
())
||
dkmc
.
getXbdk1
()
!=
null
)
&&
(!(
""
).
equals
(
dkmc
.
getSbdk2
())
||
dkmc
.
getSbdk2
()
!=
null
)
&&
((
""
).
equals
(
dkmc
.
getXbdk2
())
||
dkmc
.
getXbdk2
()
==
null
)){
//下班2
int
xbdk2jg
=
0
;
...
...
@@ -236,12 +227,17 @@ public class ClockInController {
}
else
if
((!(
""
).
equals
(
dkmc
.
getSbdk1
())
||
dkmc
.
getSbdk1
()
!=
null
)
&&
(!(
""
).
equals
(
dkmc
.
getXbdk1
())
||
dkmc
.
getXbdk1
()
!=
null
)
&&
(!(
""
).
equals
(
dkmc
.
getSbdk2
())
||
dkmc
.
getSbdk2
()
!=
null
)
&&
(!(
""
).
equals
(
dkmc
.
getXbdk2
())
||
dkmc
.
getXbdk2
()
!=
null
)
&&
((
""
).
equals
(
dkmc
.
getSbdk3
())
||
dkmc
.
getSbdk3
()
==
null
)){
//上班3
int
sbdk3jg
=
0
;
int
sbdk3jg
=
0
,
yzcdsc
=
0
,
yzcdcs
=
0
,
kgcdcs
=
0
;
if
(
punchcardtime
!=
0
){
//有应打卡时间时
Long
time
=
(
time_
-
punchcardtime
)/
1000
/
60
;
if
(
time
>
0
){
sbdk3jg
=
Math
.
abs
(
Integer
.
valueOf
(
time
.
toString
()));}
}
KqglAssoDkmx
.
builder
().
id
(
dkmc
.
getId
()).
sbdk3
(
time_
).
sbdk3jg
(
sbdk3jg
).
build
().
updateById
();
if
(
sbdk3jg
>
yzcd
)
{
yzcdcs
=
dkmc
.
getYzcdcs
()+
1
;
yzcdsc
=
sbdk3jg
-
yzcd
;
}
if
(
sbdk3jg
>
kgcdfzs
)
{
kgcdcs
++;}
KqglAssoDkmx
.
builder
().
id
(
dkmc
.
getId
()).
sbdk3
(
time_
).
sbdk3jg
(
sbdk3jg
).
yzcdcs
(
yzcdcs
).
yzcdsc
(
Double
.
valueOf
(
yzcdsc
)).
kgcdfzs
(
kgcdcs
).
build
().
updateById
();
}
else
if
((!(
""
).
equals
(
dkmc
.
getSbdk1
())
||
dkmc
.
getSbdk1
()
!=
null
)
&&
(!(
""
).
equals
(
dkmc
.
getXbdk1
())
||
dkmc
.
getXbdk1
()
!=
null
)
&&
(!(
""
).
equals
(
dkmc
.
getSbdk2
())
||
dkmc
.
getSbdk2
()
!=
null
)
&&
(!(
""
).
equals
(
dkmc
.
getXbdk2
())
||
dkmc
.
getXbdk2
()
!=
null
)
&&
(!(
""
).
equals
(
dkmc
.
getSbdk3
())
||
dkmc
.
getSbdk3
()
!=
null
)
&&
((
""
).
equals
(
dkmc
.
getXbdk3
())
||
dkmc
.
getXbdk3
()
==
null
)){
//下班3
...
...
@@ -265,112 +261,6 @@ public class ClockInController {
}
}
//具体打卡时间入汇总表(打卡成功才会录入汇总表)
KqglAssoMonthPunchSummary
isyessum
=
KqglAssoMonthPunchSummary
.
builder
().
build
().
selectOne
(
new
QueryWrapper
<
KqglAssoMonthPunchSummary
>().
lambda
()
.
eq
(
KqglAssoMonthPunchSummary:
:
getNum
,
asUserId
).
eq
(
KqglAssoMonthPunchSummary:
:
getOrgCode
,
user
.
getOrgCode
()));
AdditionalDto
kqry
=
kqglassoleavebalancemapper
.
selectAdditional
(
user
.
getOrgCode
(),
user
.
getEmpNum
());
/*******************************************************/
int
year
=
Calendar
.
getInstance
().
get
(
Calendar
.
YEAR
);
int
month
=
Calendar
.
getInstance
().
get
(
Calendar
.
MONTH
)
+
1
;
if
(
attgro
!=
null
){
//该员工是否加入到考勤组 排班方式 1:固定排班;2:自由排班;3:自由工时 计算出应出勤,实际出勤,休息天数
//休息天数,应出勤天数,实际出勤
double
daysOff
=
0
,
daysOnDuty
=
0
,
actualAttDays
=
0
;
if
(
attgro
.
getPbfs
()
==
1
){
List
<
KqglAssoTeshu
>
bxdklist
=
kqglassoteshumapper
.
ShouldSpecialDatessetByKqzid
(
attgro
.
getId
(),
month
,
1
);
//当前月 必须打卡日期
int
bxdk
=
bxdklist
.
size
();
List
<
KqglAssoTeshu
>
wxdk
=
kqglassoteshumapper
.
ShouldSpecialDatessetByKqzid
(
attgro
.
getId
(),
month
,
2
);
//当前月 无需打卡日期
String
[]
appmaps
=
new
String
[
wxdk
.
size
()];
int
d1
=
0
;
for
(
KqglAssoTeshu
spe:
wxdk
){
appmaps
[
d1
]
=
spe
.
getTsrq
();
d1
++;
}
List
<
AttendanceWeeklySch
>
atwek
=
attendanceweeklyschservice
.
selectAttendanceMadeByUserid
(
Integer
.
valueOf
(
user
.
getEmpNum
()));
String
[]
week
=
new
String
[
atwek
.
size
()];
int
e
=
0
;
for
(
AttendanceWeeklySch
awek
:
atwek
){
week
[
e
]
=
awek
.
getWekmc
();
e
++;
}
String
yemo
=
year
+
"-"
+
month
;
sdf1
.
setLenient
(
false
);
int
y
=
0
,
q
=
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
])){
q
++;
y
++;
if
(
Arrays
.
asList
(
appmaps
).
contains
(
String
.
valueOf
(
sdf1
.
format
(
date1
)))){
y
=
y
-
1
;
}
}
}
}
int
xiuxi
=
ClockInTool
.
getDaysByYearMonth
(
year
,
month
)
-
q
-
bxdk
+
wxdk
.
size
();
daysOff
=
xiuxi
;
daysOnDuty
=
y
+
bxdk
;
}
else
if
(
attgro
.
getPbfs
()
==
2
){
List
<
Schedule
>
ycqs
=
scheduleservice
.
getAttendanceShouldList
(
Integer
.
valueOf
(
user
.
getEmpNum
()),
startDate
,
endDate
);
int
xiuxi
=
0
;
int
shangban
=
0
;
for
(
Schedule
sc
:
ycqs
){
if
(
sc
.
getBcid
().
equals
(
0
)){
xiuxi
++;
}
else
{
shangban
++;
}
}
daysOff
=
xiuxi
;
daysOnDuty
=
shangban
;
}
else
{
List
<
AttendanceWeeklySch
>
atwek
=
attendanceweeklyschservice
.
selectAttendanceMadeByUserid
(
Integer
.
valueOf
(
user
.
getEmpNum
()));
String
[]
week
=
new
String
[
atwek
.
size
()];
int
e
=
0
;
for
(
AttendanceWeeklySch
awek
:
atwek
){
week
[
e
]
=
awek
.
getWekmc
();
e
++;
}
String
yemo
=
year
+
"-"
+
month
;
sdf1
.
setLenient
(
false
);
int
y
=
0
;
for
(
int
i
=
1
;
i
<=
ClockInTool
.
getDaysByYearMonth
(
year
,
month
);
i
++){
try
{
Date
date1
=
sdf1
.
parse
(
yemo
+
"-"
+
i
);
for
(
int
u
=
0
;
u
<
week
.
length
;
u
++){
if
(
sdf2
.
format
(
date1
).
equals
(
week
[
u
])){
y
++;
}
}
}
catch
(
ParseException
c
)
{
c
.
printStackTrace
();
}
}
int
xiuxi
=
ClockInTool
.
getDaysByYearMonth
(
year
,
month
)
-
y
;
daysOff
=
xiuxi
;
daysOnDuty
=
y
;
}
List
<
PunchCardDetails
>
attendance
=
punchcarddetailsmapper
.
selectAttendanceDays
(
Integer
.
valueOf
(
user
.
getEmpNum
()),
startDate
,
endDate
);
//打卡记录
actualAttDays
=
attendance
.
size
();
}
else
{
System
.
out
.
println
(
"该员工未加入考勤组"
);
}
/****************************************************/
int
answer
=
shif
.
getSxbcs
();
//1=2次 2=4次 3=6次
if
(
isyessum
==
null
)
{
//无汇总记录
KqglAssoMonthPunchSummary
summary
=
KqglAssoMonthPunchSummary
.
builder
().
name
(
user
.
getName
()).
num
(
user
.
getEmpNum
()).
dept
(
kqry
.
getDepartment
())
.
post
(
kqry
.
getPosition
()).
attGroup
(
attgro
.
getId
()).
shift
(
shif
.
getId
()).
build
();
}
else
{
int
id
=
isyessum
.
getId
();
}
}
else
{
System
.
out
.
println
(
"当前打卡时间不在范围内"
);
}
...
...
src/main/java/cn/timer/api/controller/kqgl/ClockInTool.java
View file @
7e21b096
...
...
@@ -14,40 +14,92 @@ import java.util.Locale;
import
java.util.Set
;
/**
* @author
Yl123
2020-05-11
* @author
lal
2020-05-11
*
*/
public
class
ClockInTool
{
static
SimpleDateFormat
famt
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
/**
* 使用java正则表达式去掉多余的.与0
* @param s
* @return string
*/
public
static
String
replace
(
String
s
){
if
(
null
!=
s
&&
s
.
indexOf
(
"."
)
>
0
){
s
=
s
.
replaceAll
(
"0+?$"
,
""
);
//去掉多余的0
s
=
s
.
replaceAll
(
"[.]$"
,
""
);
//如最后一位是.则去掉
}
return
s
;
}
/**
* 获取两个日期之间的所有日期
*/
public
static
List
<
String
>
getDays
(
String
startTime
,
String
endTime
)
{
// 返回的日期集合
List
<
String
>
days
=
new
ArrayList
<
String
>();
DateFormat
dateFormat
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
try
{
Date
start
=
dateFormat
.
parse
(
startTime
);
Date
end
=
dateFormat
.
parse
(
endTime
);
Calendar
tempStart
=
Calendar
.
getInstance
();
tempStart
.
setTime
(
start
);
Calendar
tempEnd
=
Calendar
.
getInstance
();
tempEnd
.
setTime
(
end
);
tempEnd
.
add
(
Calendar
.
DATE
,
+
1
);
// 日期加1(包含结束)
while
(
tempStart
.
before
(
tempEnd
))
{
days
.
add
(
dateFormat
.
format
(
tempStart
.
getTime
()));
tempStart
.
add
(
Calendar
.
DAY_OF_YEAR
,
1
);
}
}
catch
(
ParseException
e
)
{
e
.
printStackTrace
();
}
return
days
;
}
/**
* 拼接字符串
*/
public
static
String
listToString
(
List
<
String
>
list
)
{
if
(
list
==
null
)
{
return
null
;
}
StringBuilder
result
=
new
StringBuilder
();
boolean
first
=
true
;
// 第一个前面不拼接","
for
(
String
string
:
list
)
{
if
(
first
)
{
first
=
false
;
}
else
{
result
.
append
(
","
);
}
result
.
append
(
string
);
}
return
result
.
toString
();
}
/**
* 使用java正则表达式去掉多余的.与0
*
* @param s
* @return string
*/
public
static
String
replace
(
String
s
)
{
if
(
null
!=
s
&&
s
.
indexOf
(
"."
)
>
0
)
{
s
=
s
.
replaceAll
(
"0+?$"
,
""
);
// 去掉多余的0
s
=
s
.
replaceAll
(
"[.]$"
,
""
);
// 如最后一位是.则去掉
}
return
s
;
}
/**
* 根据 年、月 获取对应的月份 的 天数
*/
public
static
int
getDaysByYearMonth
(
int
year
,
int
month
)
{
Calendar
a
=
Calendar
.
getInstance
();
a
.
set
(
Calendar
.
YEAR
,
year
);
a
.
set
(
Calendar
.
MONTH
,
month
-
1
);
a
.
set
(
Calendar
.
DATE
,
1
);
a
.
roll
(
Calendar
.
DATE
,
-
1
);
int
maxDate
=
a
.
get
(
Calendar
.
DATE
);
return
maxDate
;
}
*/
public
static
int
getDaysByYearMonth
(
int
year
,
int
month
)
{
Calendar
a
=
Calendar
.
getInstance
();
a
.
set
(
Calendar
.
YEAR
,
year
);
a
.
set
(
Calendar
.
MONTH
,
month
-
1
);
a
.
set
(
Calendar
.
DATE
,
1
);
a
.
roll
(
Calendar
.
DATE
,
-
1
);
int
maxDate
=
a
.
get
(
Calendar
.
DATE
);
return
maxDate
;
}
/**
* 获取月份起始日期
*
...
...
@@ -58,8 +110,7 @@ public class ClockInTool {
public
static
String
getMinMonthDate
(
String
date
)
throws
ParseException
{
Calendar
calendar
=
Calendar
.
getInstance
();
calendar
.
setTime
(
famt
.
parse
(
date
));
calendar
.
set
(
Calendar
.
DAY_OF_MONTH
,
calendar
.
getActualMinimum
(
Calendar
.
DAY_OF_MONTH
));
calendar
.
set
(
Calendar
.
DAY_OF_MONTH
,
calendar
.
getActualMinimum
(
Calendar
.
DAY_OF_MONTH
));
return
famt
.
format
(
calendar
.
getTime
());
}
...
...
@@ -73,72 +124,71 @@ public class ClockInTool {
public
static
String
getMaxMonthDate
(
String
date
)
throws
ParseException
{
Calendar
calendar
=
Calendar
.
getInstance
();
calendar
.
setTime
(
famt
.
parse
(
date
));
calendar
.
set
(
Calendar
.
DAY_OF_MONTH
,
calendar
.
getActualMaximum
(
Calendar
.
DAY_OF_MONTH
));
calendar
.
set
(
Calendar
.
DAY_OF_MONTH
,
calendar
.
getActualMaximum
(
Calendar
.
DAY_OF_MONTH
));
return
famt
.
format
(
calendar
.
getTime
());
}
/**
* 对比两个字符串数组
*
* @param t1
* @param t2
* @return
*/
public
static
<
T
>
List
<
T
>
compare
(
T
[]
t1
,
T
[]
t2
)
{
List
<
T
>
list1
=
Arrays
.
asList
(
t1
);
//将t1数组转成list数组
List
<
T
>
list2
=
new
ArrayList
<
T
>();
//用来存放2个数组中不相同的元素
for
(
T
t
:
t2
)
{
if
(!
list1
.
contains
(
t
))
{
list2
.
add
(
t
);
}
}
return
list2
;
}
public
static
<
T
>
List
<
T
>
compare
(
T
[]
t1
,
T
[]
t2
)
{
List
<
T
>
list1
=
Arrays
.
asList
(
t1
);
// 将t1数组转成list数组
List
<
T
>
list2
=
new
ArrayList
<
T
>();
// 用来存放2个数组中不相同的元素
for
(
T
t
:
t2
)
{
if
(!
list1
.
contains
(
t
))
{
list2
.
add
(
t
);
}
}
return
list2
;
}
public
static
String
[]
array_unique
(
String
[]
ss
)
{
Set
<
String
>
set
=
new
HashSet
<
String
>(
Arrays
.
asList
(
ss
));
Set
<
String
>
set
=
new
HashSet
<
String
>(
Arrays
.
asList
(
ss
));
return
set
.
toArray
(
new
String
[
set
.
size
()]);
//或者return new HashSet<String>(Arrays.asList(ss)).toArray(new String[0]);
//
或者return new HashSet<String>(Arrays.asList(ss)).toArray(new String[0]);
}
public
static
byte
[]
CreateBSCommBufferFromString
(
String
sCmdParam
,
byte
[]
bytCmd
)
{
try
{
if
(
sCmdParam
.
length
()
==
0
){
public
static
byte
[]
CreateBSCommBufferFromString
(
String
sCmdParam
,
byte
[]
bytCmd
)
{
try
{
if
(
sCmdParam
.
length
()
==
0
)
{
return
bytCmd
;
}
byte
[]
bytText
=
sCmdParam
.
getBytes
(
"UTF-8"
);
byte
[]
bytTextLen
=
int2byte
(
bytText
.
length
+
1
);
bytCmd
=
new
byte
[
4
+
bytText
.
length
+
1
];
System
.
arraycopy
(
bytTextLen
,
0
,
bytCmd
,
0
,
bytTextLen
.
length
);
System
.
arraycopy
(
bytText
,
0
,
bytCmd
,
4
,
bytText
.
length
);
bytCmd
=
new
byte
[
4
+
bytText
.
length
+
1
];
System
.
arraycopy
(
bytTextLen
,
0
,
bytCmd
,
0
,
bytTextLen
.
length
);
System
.
arraycopy
(
bytText
,
0
,
bytCmd
,
4
,
bytText
.
length
);
bytCmd
[
4
+
bytText
.
length
]
=
0
;
return
bytCmd
;
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
bytCmd
=
new
byte
[
0
];
bytCmd
=
new
byte
[
0
];
return
bytCmd
;
}
}
public
static
byte
[]
int2byte
(
int
res
)
{
byte
[]
targets
=
new
byte
[
4
];
public
static
byte
[]
int2byte
(
int
res
)
{
byte
[]
targets
=
new
byte
[
4
];
targets
[
0
]
=
(
byte
)
(
res
&
0xff
);
targets
[
1
]
=
(
byte
)
((
res
>>
8
)
&
0xff
);
targets
[
2
]
=
(
byte
)
((
res
>>
16
)
&
0xff
);
targets
[
3
]
=
(
byte
)
(
res
>>>
24
);
return
targets
;
return
targets
;
}
public
static
byte
[]
ConcateByteArray
(
byte
[]
abytDest
,
byte
[]
abytSrc
)
{
int
len_dest
=
abytDest
.
length
+
abytSrc
.
length
;
if
(
abytSrc
.
length
==
0
)
return
abytDest
;
byte
[]
bytTmp
=
new
byte
[
len_dest
];
System
.
arraycopy
(
abytDest
,
0
,
bytTmp
,
0
,
abytDest
.
length
);
System
.
arraycopy
(
abytSrc
,
0
,
bytTmp
,
abytDest
.
length
,
abytSrc
.
length
);
return
bytTmp
;
int
len_dest
=
abytDest
.
length
+
abytSrc
.
length
;
if
(
abytSrc
.
length
==
0
)
return
abytDest
;
byte
[]
bytTmp
=
new
byte
[
len_dest
];
System
.
arraycopy
(
abytDest
,
0
,
bytTmp
,
0
,
abytDest
.
length
);
System
.
arraycopy
(
abytSrc
,
0
,
bytTmp
,
abytDest
.
length
,
abytSrc
.
length
);
return
bytTmp
;
}
public
static
String
dateToWeek2
(
String
datetime
)
{
...
...
src/main/java/cn/timer/api/controller/kqgl/atttimer/AttendanceTaskTiming.java
0 → 100644
View file @
7e21b096
package
cn
.
timer
.
api
.
controller
.
kqgl
.
atttimer
;
import
java.text.ParseException
;
import
java.text.SimpleDateFormat
;
import
java.util.Arrays
;
import
java.util.Calendar
;
import
java.util.Date
;
import
java.util.List
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.context.annotation.Lazy
;
import
org.springframework.scheduling.annotation.SchedulingConfigurer
;
import
org.springframework.scheduling.config.ScheduledTaskRegistrar
;
import
org.springframework.scheduling.support.CronTrigger
;
import
org.springframework.stereotype.Component
;
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.Schedule
;
import
cn.timer.api.bean.kqmk.KqglAssoBcsz
;
import
cn.timer.api.bean.kqmk.KqglAssoDkjl
;
import
cn.timer.api.bean.kqmk.KqglAssoDkmx
;
import
cn.timer.api.bean.kqmk.KqglAssoMonthPunchSummary
;
import
cn.timer.api.bean.kqmk.KqglAssoPbmx
;
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.KqglTaskTiming
;
import
cn.timer.api.bean.qyzx.QyzxEntInfoM
;
import
cn.timer.api.controller.kqgl.ClockInTool
;
import
cn.timer.api.dao.kqgl.AttendanceWeeklySchMapper
;
import
cn.timer.api.dao.kqgl.PunchCardDetailsMapper
;
import
cn.timer.api.dao.kqgl.ScheduleMapper
;
import
cn.timer.api.dao.kqmk.KqglAssoDkjlMapper
;
import
cn.timer.api.dao.kqmk.KqglAssoLeaveBalanceMapper
;
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.utils.DateUtil
;
/**
* @author lal
*
*/
@Component
@Lazy
public
class
AttendanceTaskTiming
implements
SchedulingConfigurer
{
private
static
final
SimpleDateFormat
dateFormat
=
new
SimpleDateFormat
(
"HH:mm:ss"
);
static
String
tablename
=
null
;
@Autowired
private
KqglMainKqzMapper
kqglmainkqzmapper
;
@Autowired
private
QyzxEntInfoMMapper
qyzxentinfommapper
;
@Autowired
private
KqglAssoLeaveBalanceMapper
kqglassoleavebalancemapper
;
@Autowired
private
KqglAssoTeshuMapper
kqglassoteshumapper
;
@Autowired
private
KqglAssoDkjlMapper
kqglassodkjlmapper
;
@Autowired
private
PunchCardDetailsMapper
punchcarddetailsmapper
;
@Autowired
private
AttendanceWeeklySchMapper
attendanceweeklyschmapper
;
@Autowired
private
ScheduleMapper
schedulemapper
;
SimpleDateFormat
sdf1
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
SimpleDateFormat
sdf2
=
new
SimpleDateFormat
(
"EEE"
);
/**
* 数据库动态更改定时配置(attendance_socks)
*/
@Override
public
void
configureTasks
(
ScheduledTaskRegistrar
taskRegistrar
)
{
taskRegistrar
.
addTriggerTask
(()
->
{
// 任务逻辑
try
{
tablename
=
AttendanceTask
();
}
catch
(
ParseException
e
)
{
e
.
printStackTrace
();
}
},
triggerContext
->
{
CronTrigger
cron
=
new
CronTrigger
(
AttendanceUtil
.
getCron
(
tablename
));
// cron配置
return
cron
.
nextExecutionTime
(
triggerContext
);
// 下次执行任务的时间
});
}
/**
* @return
* @throws ParseException
*/
// @Scheduled(cron = "0/5 * * * * ?") // 测试:5秒执行一次
@SuppressWarnings
(
"unused"
)
public
String
AttendanceTask
()
throws
ParseException
{
boolean
implement
=
false
;
KqglTaskTiming
sock
=
KqglTaskTiming
.
builder
().
build
().
selectOne
(
new
QueryWrapper
<
KqglTaskTiming
>().
lambda
().
eq
(
KqglTaskTiming:
:
getTask
,
"AttendanceTask"
));
if
(
sock
==
null
)
{
KqglTaskTiming
.
builder
().
task
(
"AttendanceTask"
).
executionStatus
(
1
).
lastExecutionTime
(
new
Date
().
getTime
()).
build
().
insert
();
implement
=
true
;
}
else
{
if
(
sock
.
getExecutionStatus
()
==
0
)
{
KqglTaskTiming
.
builder
().
task
(
"AttendanceTask"
).
id
(
sock
.
getId
()).
executionStatus
(
1
).
lastExecutionTime
(
new
Date
().
getTime
()).
build
().
updateById
();
implement
=
true
;
}
}
//逻辑
if
(
false
)
{
System
.
err
.
println
(
"当前时间:"
+
dateFormat
.
format
(
new
Date
()));
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
();
List
<
QyzxEntInfoM
>
orgcodelist
=
qyzxentinfommapper
.
selectList
(
new
QueryWrapper
<
QyzxEntInfoM
>());
//系统中的所有公司 所有未到期的公司
String
str
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
).
format
(
new
Date
()).
toString
();
//
String
[]
range
=
ClockInTool
.
listToString
(
ClockInTool
.
getDays
(
sdf1
.
format
(
c
.
getTime
()),
str
)).
split
(
";"
);
//目前为止所有日期
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
)
{
/*****/
for
(
String
num
:
range
)
{
//遍历目前为止所有日期
Long
startDatestop
=
DateUtil
.
getStartTime
(
0
,
DateUtil
.
getStringTime
(
num
,
"yyyy-MM-dd"
)).
getTime
();
Long
endDatestop
=
DateUtil
.
getnowEndTime
(
23
,
DateUtil
.
getStringTime
(
num
,
"yyyy-MM-dd"
)).
getTime
();
//考勤组信息
KqglMainKqz
attgro
=
kqglmainkqzmapper
.
getAttendanceGroupInformationByUserid
(
user
.
getEmpnum
(),
org_code
);
//目前为止打卡记录
List
<
PunchCardDetails
>
attendance
=
punchcarddetailsmapper
.
selectAttendanceDays
(
Integer
.
valueOf
(
user
.
getEmpnum
()),
startDate
,
new
Date
().
getTime
());
int
dkjl
=
0
;
//目前为止打卡次数
if
(
attendance
.
size
()
>
0
)
{
dkjl
=
attendance
.
size
();
}
//具体打卡时间入汇总表(打卡成功才会录入汇总表)
KqglAssoMonthPunchSummary
isyessum
=
KqglAssoMonthPunchSummary
.
builder
().
build
().
selectOne
(
new
QueryWrapper
<
KqglAssoMonthPunchSummary
>().
lambda
()
.
eq
(
KqglAssoMonthPunchSummary:
:
getNum
,
user
.
getEmpnum
()).
eq
(
KqglAssoMonthPunchSummary:
:
getOrgCode
,
org_code
));
int
year
=
Calendar
.
getInstance
().
get
(
Calendar
.
YEAR
);
int
month
=
Calendar
.
getInstance
().
get
(
Calendar
.
MONTH
)
+
1
;
if
(
attgro
!=
null
){
//该员工是否加入到考勤组 排班方式 1:固定排班;2:自由排班;3:自由工时 计算出应出勤,实际出勤,休息天数
KqglAssoBcsz
shif
=
KqglAssoBcsz
.
builder
().
build
();
//休息天数,应出勤天数,实际出勤
double
daysOff
=
0
,
daysOnDuty
=
0
;
//,actualAttDays = 0;
int
zjgzts
=
0
;
//目前为止应该出勤的天数
if
(
attgro
.
getPbfs
()
==
1
){
//固定排班
int
several
=
Integer
.
valueOf
(
ClockInTool
.
dateToWeek
(
str
));
//
KqglAssoTeshu
tesu
=
KqglAssoTeshu
.
builder
().
build
().
selectOne
(
new
QueryWrapper
<
KqglAssoTeshu
>().
lambda
().
eq
(
KqglAssoTeshu:
:
getKqzid
,
attgro
.
getId
()).
eq
(
KqglAssoTeshu:
:
getTsrq
,
str
));
if
(
tesu
==
null
)
{
//获取该员工最新班次
KqglAssoZhoupaiban
gudingpb
=
KqglAssoZhoupaiban
.
builder
().
build
().
selectOne
(
new
QueryWrapper
<
KqglAssoZhoupaiban
>().
lambda
().
eq
(
KqglAssoZhoupaiban:
:
getKqzid
,
attgro
.
getId
())
.
eq
(
KqglAssoZhoupaiban:
:
getType
,
several
));
shif
=
shif
.
selectOne
(
new
QueryWrapper
<
KqglAssoBcsz
>().
lambda
().
eq
(
KqglAssoBcsz:
:
getId
,
gudingpb
.
getBcid
()));
}
else
{
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
));
shif
=
shif
.
selectOne
(
new
QueryWrapper
<
KqglAssoBcsz
>().
lambda
().
eq
(
KqglAssoBcsz:
:
getId
,
gudingpb
.
getBcid
()));
List
<
KqglAssoTeshu
>
bxdklist
=
kqglassoteshumapper
.
ShouldSpecialDatessetByKqzid
(
attgro
.
getId
(),
month
,
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
(),
month
,
2
);
//当前月 无需打卡日期
String
[]
appmaps
=
new
String
[
wxdk
.
size
()];
int
d1
=
0
;
for
(
KqglAssoTeshu
spe:
wxdk
){
appmaps
[
d1
]
=
spe
.
getTsrq
();
d1
++;
}
List
<
AttendanceWeeklySch
>
atwek
=
attendanceweeklyschmapper
.
selectAttendanceMadeByUserid
(
Integer
.
valueOf
(
user
.
getEmpnum
()));
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
++;
}
String
yemo
=
year
+
"-"
+
month
;
sdf1
.
setLenient
(
false
);
int
y
=
0
,
q
=
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
])){
q
++;
y
++;
if
(
Arrays
.
asList
(
appmaps
).
contains
(
String
.
valueOf
(
sdf1
.
format
(
date1
)))){
y
=
y
-
1
;
}
}
}
}
int
xiuxi
=
ClockInTool
.
getDaysByYearMonth
(
year
,
month
)
-
q
-
bxdk
+
wxdk
.
size
();
daysOff
=
xiuxi
;
daysOnDuty
=
y
+
bxdk
;
// String[] range=ClockInTool.listToString(ClockInTool.getDays(sdf1.format(c.getTime()),str)).split(";");//目前为止所有日期
// int zjgzts = 0;//目前为止应该出勤的天数
//目前为止应出勤天数
if
(
Arrays
.
binarySearch
(
needfig
,
Integer
.
valueOf
(
ClockInTool
.
dateToWeek
(
num
)))
>=
0
)
{
//对比排班应打卡时间
zjgzts
++;
}
if
(
Arrays
.
binarySearch
(
bxdkss
,
num
)
>=
0
)
{
//检查是否存在 必须打卡名单中
zjgzts
++;
}
if
(
Arrays
.
binarySearch
(
appmaps
,
num
)
>=
0
)
{
//检查是否存在 无需打卡名单中
zjgzts
=
zjgzts
-
1
;
}
}
else
if
(
attgro
.
getPbfs
()
==
2
){
//自由排班
KqglAssoPbmx
pbmxx
=
KqglAssoPbmx
.
builder
().
build
().
selectOne
(
new
QueryWrapper
<
KqglAssoPbmx
>().
lambda
().
eq
(
KqglAssoPbmx:
:
getUserid
,
user
.
getEmpnum
()).
eq
(
KqglAssoPbmx:
:
getData
,
str
).
eq
(
KqglAssoPbmx:
:
getKqzid
,
attgro
.
getId
()));
shif
=
shif
.
selectOne
(
new
QueryWrapper
<
KqglAssoBcsz
>().
lambda
().
eq
(
KqglAssoBcsz:
:
getId
,
pbmxx
.
getBcid
()));
List
<
Schedule
>
ycqs
=
schedulemapper
.
getAttendanceShouldList
(
Integer
.
valueOf
(
user
.
getEmpnum
()),
startDate
,
endDate
);
int
xiuxi
=
0
,
shangban
=
0
,
z
=
0
;
String
[]
ziyoupb
=
new
String
[
ycqs
.
size
()];
for
(
Schedule
sc
:
ycqs
){
ziyoupb
[
z
]
=
String
.
valueOf
(
sc
.
getData
());
z
++;
if
(
sc
.
getBcid
().
equals
(
0
)){
xiuxi
++;
}
else
{
shangban
++;
}
}
daysOff
=
xiuxi
;
daysOnDuty
=
shangban
;
//目前为止应出勤天数
if
(
Arrays
.
binarySearch
(
ziyoupb
,
num
)
>=
0
)
{
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
)
{
zjgzts
++;
}
}
}
else
{
List
<
AttendanceWeeklySch
>
atwek
=
attendanceweeklyschmapper
.
selectAttendanceMadeByUserid
(
Integer
.
valueOf
(
user
.
getEmpnum
()));
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
;
//目前为止应出勤天数
if
(
Arrays
.
binarySearch
(
ziyoupb
,
Integer
.
valueOf
(
ClockInTool
.
dateToWeek
(
num
)))
>=
0
)
{
//对比排班应打卡时间
zjgzts
++;
}
}
int
answer
=
shif
.
getSxbcs
();
//1=2次 2=4次 3=6次
//当天打卡是否是最后一次 --- 归档
List
<
KqglAssoDkjl
>
zdkcs
=
kqglassodkjlmapper
.
selectList
(
new
QueryWrapper
<
KqglAssoDkjl
>().
lambda
().
eq
(
KqglAssoDkjl:
:
getUserId
,
user
.
getEmpnum
())
.
ne
(
KqglAssoDkjl:
:
getStatus
,
0
).
gt
(
KqglAssoDkjl:
:
getDktime
,
startDatestop
).
lt
(
KqglAssoDkjl:
:
getDktime
,
endDatestop
));
KqglAssoDkmx
dkmc1
=
KqglAssoDkmx
.
builder
().
build
().
selectOne
(
new
QueryWrapper
<
KqglAssoDkmx
>().
lambda
().
eq
(
KqglAssoDkmx:
:
getUserid
,
user
.
getEmpnum
())
.
gt
(
KqglAssoDkmx:
:
getDksj
,
startDatestop
).
lt
(
KqglAssoDkmx:
:
getDksj
,
endDatestop
));
if
(
isyessum
==
null
)
{
//无汇总记录
KqglAssoMonthPunchSummary
summary
=
KqglAssoMonthPunchSummary
.
builder
().
name
(
user
.
getEmpname
()).
num
(
user
.
getEmpnum
()).
dept
(
user
.
getDepartment
())
.
post
(
user
.
getPosition
()).
attGroup
(
attgro
.
getId
()).
build
();
summary
.
setDaysOnDuty
(
daysOnDuty
);
//应出勤天数
summary
.
setActualAttDays
(
Double
.
valueOf
(
dkjl
));
//实际出勤天数
summary
.
setDaysOff
(
daysOff
);
//休息天数
summary
.
setWorkingHours
(
dkmc1
.
getGzsc
());
int
lateTimes
=
0
,
leavetimes
=
0
,
sbqkcs
=
0
,
xbqkcs
=
0
;
double
lateHours
=
0
,
earlyleave
=
0
;
if
(
answer
==
1
||
answer
==
2
||
answer
==
3
)
{
if
(
dkmc1
.
getSbdk1jg
()
>
0
)
{
lateTimes
++;}
if
(
dkmc1
.
getXbdk1jg
()
>
0
)
{
leavetimes
++;}
lateHours
=
dkmc1
.
getSbdk1jg
();
earlyleave
=
dkmc1
.
getXbdk1jg
();
if
(
dkmc1
.
getSbdk1
()
==
null
)
{
sbqkcs
++;}
if
(
dkmc1
.
getXbdk1
()
==
null
)
{
xbqkcs
++;}
}
if
(
answer
==
2
||
answer
==
3
)
{
if
(
dkmc1
.
getSbdk2jg
()
>
0
)
{
lateTimes
++;}
if
(
dkmc1
.
getXbdk2jg
()
>
0
)
{
leavetimes
++;}
lateHours
=
lateHours
+
dkmc1
.
getSbdk2jg
();
earlyleave
=
earlyleave
+
dkmc1
.
getXbdk2jg
();
if
(
dkmc1
.
getSbdk2
()
==
null
)
{
sbqkcs
++;}
if
(
dkmc1
.
getXbdk2
()
==
null
)
{
xbqkcs
++;}
}
if
(
answer
==
3
)
{
if
(
dkmc1
.
getSbdk3jg
()
>
0
)
{
lateTimes
++;}
if
(
dkmc1
.
getXbdk3jg
()
>
0
)
{
leavetimes
++;}
lateHours
=
lateHours
+
dkmc1
.
getSbdk3jg
();
earlyleave
=
earlyleave
+
dkmc1
.
getXbdk3jg
();
if
(
dkmc1
.
getSbdk3
()
==
null
)
{
sbqkcs
++;}
if
(
dkmc1
.
getXbdk3
()
==
null
)
{
xbqkcs
++;}
}
summary
.
setLateTimes
(
Double
.
valueOf
(
lateTimes
));
//迟到次数
summary
.
setLateHours
(
lateHours
);
//迟到时长(分钟)
summary
.
setSeriousLateTimes
(
Double
.
valueOf
(
dkmc1
.
getYzcdcs
()));
summary
.
setSeriousLateHours
(
dkmc1
.
getYzcdsc
());
summary
.
setAbsenLateTimes
(
Double
.
valueOf
(
dkmc1
.
getKgcdfzs
()));
summary
.
setEarlyLeaveTimes
(
Double
.
valueOf
(
leavetimes
));
//早退次数
summary
.
setLengthEarlyLeave
(
earlyleave
);
//早退时长(分钟)
summary
.
setNumberWorkCardShortage
(
Double
.
valueOf
(
sbqkcs
));
summary
.
setNumberDutyCardShortage
(
Double
.
valueOf
(
xbqkcs
));
int
absenteeismdays
=
0
;
if
(
zjgzts
-
dkjl
>
0
)
{
absenteeismdays
=
zjgzts
-
dkjl
;
}
summary
.
setAbsenteeismDays
(
Double
.
valueOf
(
absenteeismdays
));
//旷工天数
//出差时长
//外出时长
//加班总时长
//工作日(转调休)
//休息日(转调休)
//节假日(转调休)
//工作日(转加班费)
//休息日(转加班费)
//节假日(转加班费)
summary
.
setBelongYear
(
ca
.
get
(
Calendar
.
YEAR
));
summary
.
setBelongMonth
(
ca
.
get
(
Calendar
.
MONTH
)+
1
);
summary
.
setOrgCode
(
org_code
);
summary
.
setLastModified
(
new
Date
().
getTime
());
/******审批接口----对接*******/
}
else
{
int
id
=
isyessum
.
getId
();
}
}
else
{
System
.
out
.
println
(
"该员工未加入考勤组"
);
}
}
}
}
/****************************************************************/
KqglTaskTiming
.
builder
().
task
(
"AttendanceTask"
).
id
(
sock
.
getId
()).
executionStatus
(
0
).
lastExecutionTime
(
new
Date
().
getTime
()).
build
().
updateById
();
return
new
Exception
().
getStackTrace
()[
0
].
getMethodName
();
}
else
{
return
null
;
}
}
}
src/main/java/cn/timer/api/controller/kqgl/atttimer/AttendanceUtil.java
0 → 100644
View file @
7e21b096
package
cn
.
timer
.
api
.
controller
.
kqgl
.
atttimer
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
cn.timer.api.bean.kqmk.AttendanceSocks
;
public
class
AttendanceUtil
{
// 默认cron 5秒一次
private
static
String
cron
=
"0/5 * * * * ?"
;
// 数据库cron
public
static
String
getCron
(
String
tablename
)
{
AttendanceSocks
task
=
AttendanceSocks
.
builder
().
build
().
selectOne
(
new
LambdaQueryWrapper
<
AttendanceSocks
>().
eq
(
AttendanceSocks:
:
getCronName
,
tablename
));
// 数据库查询
if
(
task
!=
null
&&
task
.
getCron
()
!=
null
)
{
cron
=
task
.
getCron
();
}
return
cron
;
}
}
src/main/java/cn/timer/api/controller/kqgl/service/KqglServiceImpl.java
View file @
7e21b096
package
cn
.
timer
.
api
.
controller
.
kqgl
.
service
;
import
java.text.SimpleDateFormat
;
import
java.util.Date
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
cn.timer.api.bean.kqmk.KqglAssoLeaveBalance
;
import
cn.timer.api.bean.kqmk.KqglAssoRelationSummary
;
import
cn.timer.api.bean.yggl.YgglMainEmp
;
import
cn.timer.api.controller.kqgl.ClockInTool
;
import
cn.timer.api.dao.kqmk.KqglAssoLeaveBalanceMapper
;
import
cn.timer.api.dto.kqmk.AttEvectionApprovalDto
;
import
cn.timer.api.dto.kqmk.AttLeaveApprovalDto
;
import
cn.timer.api.dto.kqmk.AttOvertimeApprovalDto
;
import
cn.timer.api.dto.kqmk.AttRepairApprovalDto
;
/**
* @author lal
* 记录用户假期审批流程 对应减去剩余余额
*/
@Service
public
class
KqglServiceImpl
implements
KqglService
{
@Autowired
private
KqglAssoLeaveBalanceMapper
kqglassoleavebalancemapper
;
/**
* 考勤请假审批
*/
@Override
public
boolean
attleaveapproval
(
AttLeaveApprovalDto
leaveappr
)
{
String
startdate
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
).
format
(
leaveappr
.
getStarttime
());
String
enddate
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
).
format
(
leaveappr
.
getEndtime
());
String
[]
days
=
ClockInTool
.
listToString
(
ClockInTool
.
getDays
(
startdate
,
enddate
)).
split
(
";"
);
for
(
String
num
:
days
)
{
//记入打卡月汇总关联表
KqglAssoRelationSummary
.
builder
().
userId
(
leaveappr
.
getUserid
()).
appTime
(
num
).
approvalId
(
leaveappr
.
getLeaveid
()).
approvalType
(
2
).
duration
(
leaveappr
.
getDuration
())
.
leaveTypeId
(
leaveappr
.
getLeavetype
()).
build
().
insert
();
}
YgglMainEmp
emp
=
YgglMainEmp
.
builder
().
build
().
selectOne
(
new
QueryWrapper
<
YgglMainEmp
>().
lambda
().
eq
(
YgglMainEmp:
:
getEmpNum
,
leaveappr
.
getUserid
()));
int
modifynumber
=
1
;
KqglAssoLeaveBalance
balan
=
kqglassoleavebalancemapper
.
selectOne
(
new
QueryWrapper
<
KqglAssoLeaveBalance
>().
lambda
().
eq
(
KqglAssoLeaveBalance:
:
getUserid
,
leaveappr
.
getUserid
())
.
orderByDesc
(
KqglAssoLeaveBalance
::
getModifyNumber
).
last
(
"LIMIT 1"
));
if
(
balan
!=
null
)
{
modifynumber
=
balan
.
getModifyNumber
()+
1
;
}
KqglAssoLeaveBalance
.
builder
().
leaveRulesId
(
leaveappr
.
getLeavetype
()).
userid
(
leaveappr
.
getUserid
()).
modifyAction
(
2
).
balanceDays
(
"-"
+
leaveappr
.
getDuration
())
.
reason
(
"系统按照规则自动"
).
modifyUserid
(
emp
.
getEmpNum
()).
modifyTimer
(
new
Date
().
getTime
()).
orgCode
(
emp
.
getOrgCode
()).
isAutomatic
(
1
).
modifyNumber
(
modifynumber
).
build
().
insert
();
//员工假期余额
return
true
;
}
...
...
@@ -24,7 +62,19 @@ public class KqglServiceImpl implements KqglService {
*/
@Override
public
boolean
attovertimeapproval
(
AttOvertimeApprovalDto
overappr
)
{
String
startdate
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
).
format
(
overappr
.
getStarttime
());
String
enddate
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
).
format
(
overappr
.
getEndtime
());
String
[]
days
=
ClockInTool
.
listToString
(
ClockInTool
.
getDays
(
startdate
,
enddate
)).
split
(
";"
);
for
(
String
num
:
days
)
{
//记入打卡月汇总关联表
KqglAssoRelationSummary
.
builder
().
userId
(
overappr
.
getUserid
()).
appTime
(
num
).
approvalId
(
overappr
.
getOvertimeid
()).
approvalType
(
1
).
duration
(
overappr
.
getDuration
())
.
overtimeTypeId
(
overappr
.
getOvertimetype
()).
compensateId
(
overappr
.
getCompensate
()).
build
().
insert
();
}
return
true
;
}
...
...
@@ -33,7 +83,23 @@ public class KqglServiceImpl implements KqglService {
*/
@Override
public
boolean
attevectionapproval
(
AttEvectionApprovalDto
evecappr
)
{
if
(
evecappr
.
getEvectiontype
()
==
1
)
{
//出差
String
startdate
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
).
format
(
evecappr
.
getStarttime
());
String
enddate
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
).
format
(
evecappr
.
getEndtime
());
String
[]
days
=
ClockInTool
.
listToString
(
ClockInTool
.
getDays
(
startdate
,
enddate
)).
split
(
";"
);
for
(
String
num
:
days
)
{
//记入打卡月汇总关联表
KqglAssoRelationSummary
.
builder
().
userId
(
evecappr
.
getUserid
()).
appTime
(
num
).
approvalId
(
evecappr
.
getEvectionid
()).
approvalType
(
3
).
build
().
insert
();
}
}
else
{
//外出
String
startdate
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
).
format
(
evecappr
.
getStarttime
());
String
enddate
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
).
format
(
evecappr
.
getEndtime
());
String
[]
days
=
ClockInTool
.
listToString
(
ClockInTool
.
getDays
(
startdate
,
enddate
)).
split
(
";"
);
for
(
String
num
:
days
)
{
//记入打卡月汇总关联表
KqglAssoRelationSummary
.
builder
().
userId
(
evecappr
.
getUserid
()).
appTime
(
num
).
approvalId
(
evecappr
.
getEvectionid
()).
approvalType
(
4
).
build
().
insert
();
}
}
return
true
;
}
...
...
@@ -42,7 +108,12 @@ public class KqglServiceImpl implements KqglService {
*/
@Override
public
boolean
attrepairapproval
(
AttRepairApprovalDto
repaappr
)
{
String
cardrepltime
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
).
format
(
repaappr
.
getCardrepltime
());
//补卡时间
//记入打卡月汇总关联表
KqglAssoRelationSummary
.
builder
().
userId
(
repaappr
.
getUserid
()).
appTime
(
cardrepltime
).
approvalId
(
repaappr
.
getRepairid
()).
approvalType
(
5
).
build
().
insert
();
return
true
;
}
...
...
src/main/java/cn/timer/api/dao/kqmk/AttendanceSocksMapper.java
0 → 100644
View file @
7e21b096
package
cn
.
timer
.
api
.
dao
.
kqmk
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
org.springframework.stereotype.Repository
;
import
cn.timer.api.bean.kqmk.AttendanceSocks
;
/**
* 考勤定时
*
* @author Tang 2020-05-19
*/
@Repository
public
interface
AttendanceSocksMapper
extends
BaseMapper
<
AttendanceSocks
>
{
}
src/main/java/cn/timer/api/dao/kqmk/KqglAssoLeaveBalanceMapper.java
View file @
7e21b096
...
...
@@ -24,4 +24,6 @@ public interface KqglAssoLeaveBalanceMapper extends BaseMapper<KqglAssoLeaveBala
IPage
<
EmployeeLeaveBalanceDto
>
selectPageByQueryLeaveBalance
(
IPage
<
EmployeeLeaveBalanceDto
>
page
,
@Param
(
"param"
)
AttqueryCriteriaDto
attquerycriteriadto
);
AdditionalDto
selectAdditional
(
int
orgcode
,
int
empnum
);
List
<
AdditionalDto
>
selectAdditionalList
(
int
orgcode
);
}
src/main/java/cn/timer/api/dao/kqmk/KqglAssoRelationSummaryMapper.java
0 → 100644
View file @
7e21b096
package
cn
.
timer
.
api
.
dao
.
kqmk
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
org.springframework.stereotype.Repository
;
import
cn.timer.api.bean.kqmk.KqglAssoRelationSummary
;
/**
* 打卡月汇总关联表
*
* @author Tang 2020-05-19
*/
@Repository
public
interface
KqglAssoRelationSummaryMapper
extends
BaseMapper
<
KqglAssoRelationSummary
>
{
}
src/main/java/cn/timer/api/dao/kqmk/KqglTaskTimingMapper.java
0 → 100644
View file @
7e21b096
package
cn
.
timer
.
api
.
dao
.
kqmk
;
import
org.springframework.stereotype.Repository
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
cn.timer.api.bean.kqmk.KqglTaskTiming
;
/**
* 考勤任务定时
*
* @author Tang 2020-05-19
*/
@Repository
public
interface
KqglTaskTimingMapper
extends
BaseMapper
<
KqglTaskTiming
>
{
}
src/main/java/cn/timer/api/dto/kqmk/AttLeaveApprovalDto.java
View file @
7e21b096
...
...
@@ -30,6 +30,6 @@ public class AttLeaveApprovalDto {
@ApiModelProperty
(
value
=
"结束时间"
,
example
=
"时间戳"
)
private
long
endtime
;
@ApiModelProperty
(
value
=
"时长
(分钟)
"
,
example
=
""
)
@ApiModelProperty
(
value
=
"时长"
,
example
=
""
)
private
double
duration
;
}
src/main/java/cn/timer/api/dto/kqmk/AttOvertimeApprovalDto.java
View file @
7e21b096
...
...
@@ -30,7 +30,7 @@ public class AttOvertimeApprovalDto {
@ApiModelProperty
(
value
=
"结束时间"
,
example
=
"时间戳"
)
private
long
endtime
;
@ApiModelProperty
(
value
=
"时长
(分钟)
"
,
example
=
""
)
@ApiModelProperty
(
value
=
"时长"
,
example
=
""
)
private
double
duration
;
@ApiModelProperty
(
value
=
"加班补偿方式"
,
example
=
"1:转调休;2:转加班费;3:转调休或加班费"
)
...
...
src/main/resources/mapping/kqmk/AttendanceSocksMapper.xml
0 → 100644
View file @
7e21b096
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"cn.timer.api.dao.kqmk.AttendanceSocksMapper"
>
<resultMap
id=
"BaseResultMap"
type=
"cn.timer.api.bean.kqmk.AttendanceSocks"
>
<result
column=
"cron_id"
property=
"cronId"
/>
<result
column=
"cron_name"
property=
"cronName"
/>
<result
column=
"cron"
property=
"cron"
/>
</resultMap>
<sql
id=
"Base_Column_List"
>
cron_id,
cron_name,
cron
</sql>
<sql
id=
"Base_Column_List_Alias"
>
cron_id AttendanceSocks_cron_id,
cron_name AttendanceSocks_cron_name,
cron AttendanceSocks_cron
</sql>
</mapper>
\ No newline at end of file
src/main/resources/mapping/kqmk/KqglAssoDkmxMapper.xml
View file @
7e21b096
...
...
@@ -23,6 +23,9 @@
<result
column=
"gzsc"
property=
"gzsc"
/>
<result
column=
"qyid"
property=
"qyid"
/>
<result
column=
"dksj"
property=
"dksj"
/>
<result
column=
"yzcdcs"
property=
"yzcdcs"
/>
<result
column=
"yzcdsc"
property=
"yzcdsc"
/>
<result
column=
"kgcdfzs"
property=
"kgcdfzs"
/>
</resultMap>
<sql
id=
"Base_Column_List"
>
...
...
@@ -44,7 +47,10 @@
ydkcs,
gzsc,
qyid,
dksj
dksj,
yzcdcs,
yzcdsc,
kgcdfzs
</sql>
<sql
id=
"Base_Column_List_Alias"
>
...
...
@@ -66,7 +72,10 @@
ydkcs KqglAssoDkmx_ydkcs,
gzsc KqglAssoDkmx_gzsc,
qyid KqglAssoDkmx_qyid,
dksj KqglAssoDkmx_dksj
dksj KqglAssoDkmx_dksj,
yzcdcs KqglAssoDkmx_yzcdcs,
yzcdsc KqglAssoDkmx_yzcdsc,
kgcdfzs KqglAssoDkmx_kgcdfzs
</sql>
<!--
...
...
@@ -126,7 +135,16 @@
qyid,
</if>
<if test ='null != dksj'>
dksj
dksj,
</if>
<if test ='null != yzcdcs'>
yzcdcs,
</if>
<if test ='null != yzcdsc'>
yzcdsc,
</if>
<if test ='null != kgcdfzs'>
kgcdfzs
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
...
...
@@ -182,7 +200,16 @@
#{qyid},
</if>
<if test ='null != dksj'>
#{dksj}
#{dksj},
</if>
<if test ='null != yzcdcs'>
#{yzcdcs},
</if>
<if test ='null != yzcdsc'>
#{yzcdsc},
</if>
<if test ='null != kgcdfzs'>
#{kgcdfzs}
</if>
</trim>
</insert>
...
...
@@ -212,7 +239,10 @@
<if test ='null != ydkcs'>ydkcs = #{ydkcs},</if>
<if test ='null != gzsc'>gzsc = #{gzsc},</if>
<if test ='null != qyid'>qyid = #{qyid},</if>
<if test ='null != dksj'>dksj = #{dksj}</if>
<if test ='null != dksj'>dksj = #{dksj},</if>
<if test ='null != yzcdcs'>yzcdcs = #{yzcdcs},</if>
<if test ='null != yzcdsc'>yzcdsc = #{yzcdsc},</if>
<if test ='null != kgcdfzs'>kgcdfzs = #{kgcdfzs}</if>
</set>
WHERE id = #{id}
</update>
...
...
src/main/resources/mapping/kqmk/KqglAssoLeaveBalanceMapper.xml
View file @
7e21b096
...
...
@@ -98,6 +98,17 @@
where emp.org_code = #{orgcode}
and emp.emp_num = #{empnum}
</select>
<select
id=
"selectAdditionalList"
resultMap=
"AdditionalMap"
>
SELECT emp.emp_num as empnum,
emp.`name` as empname,
IFNULL(c.name,'') as department,
gw.`name` as position
from yggl_main_emp emp
LEFT JOIN zzgl_bmgw_m as gw on gw.id = emp.bmgw_id
LEFT JOIN zzgl_bmgw_m as c ON c.id = gw.up_id
where emp.org_code = #{orgcode}
</select>
<!--
...
...
src/main/resources/mapping/kqmk/KqglAssoRelationSummaryMapper.xml
0 → 100644
View file @
7e21b096
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"cn.timer.api.dao.kqmk.KqglAssoRelationSummaryMapper"
>
<resultMap
id=
"BaseResultMap"
type=
"cn.timer.api.bean.kqmk.KqglAssoRelationSummary"
>
<id
column=
"id"
property=
"id"
/>
<result
column=
"user_id"
property=
"userId"
/>
<result
column=
"app_time"
property=
"appTime"
/>
<result
column=
"approval_id"
property=
"approvalId"
/>
<result
column=
"approval_type"
property=
"approvalType"
/>
<result
column=
"duration"
property=
"duration"
/>
<result
column=
"leave_type_id"
property=
"leaveTypeId"
/>
<result
column=
"overtime_type_id"
property=
"overtimeTypeId"
/>
<result
column=
"compensate_id"
property=
"compensateId"
/>
</resultMap>
<sql
id=
"Base_Column_List"
>
id,
user_id,
app_time,
approval_id,
approval_type,
duration,
leave_type_id,
overtime_type_id,
compensate_id
</sql>
<sql
id=
"Base_Column_List_Alias"
>
id KqglAssoRelationSummary_id,
user_id KqglAssoRelationSummary_user_id,
app_time KqglAssoRelationSummary_app_time,
approval_id KqglAssoRelationSummary_approval_id,
approval_type KqglAssoRelationSummary_approval_type,
duration KqglAssoRelationSummary_duration,
leave_type_id KqglAssoRelationSummary_leave_type_id,
overtime_type_id KqglAssoRelationSummary_overtime_type_id,
compensate_id KqglAssoRelationSummary_compensate_id
</sql>
<!--
<insert id="insert" useGeneratedKeys="true" keyColumn="id" parameterType="cn.timer.api.bean.kqmk.KqglAssoRelationSummary">
INSERT INTO kqgl_asso_relation_summary
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test ='null != userId'>
user_id,
</if>
<if test ='null != appTime'>
app_time,
</if>
<if test ='null != approvalId'>
approval_id,
</if>
<if test ='null != approvalType'>
approval_type,
</if>
<if test ='null != duration'>
duration,
</if>
<if test ='null != leaveTypeId'>
leave_type_id,
</if>
<if test ='null != overtimeTypeId'>
overtime_type_id,
</if>
<if test ='null != compensateId'>
compensate_id
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test ='null != userId'>
#{userId},
</if>
<if test ='null != appTime'>
#{appTime},
</if>
<if test ='null != approvalId'>
#{approvalId},
</if>
<if test ='null != approvalType'>
#{approvalType},
</if>
<if test ='null != duration'>
#{duration},
</if>
<if test ='null != leaveTypeId'>
#{leaveTypeId},
</if>
<if test ='null != overtimeTypeId'>
#{overtimeTypeId},
</if>
<if test ='null != compensateId'>
#{compensateId}
</if>
</trim>
</insert>
<delete id="delete" >
DELETE FROM kqgl_asso_relation_summary
WHERE id = #{id}
</delete>
<update id="update" parameterType="cn.timer.api.bean.kqmk.KqglAssoRelationSummary">
UPDATE kqgl_asso_relation_summary
<set>
<if test ='null != userId'>user_id = #{userId},</if>
<if test ='null != appTime'>app_time = #{appTime},</if>
<if test ='null != approvalId'>approval_id = #{approvalId},</if>
<if test ='null != approvalType'>approval_type = #{approvalType},</if>
<if test ='null != duration'>duration = #{duration},</if>
<if test ='null != leaveTypeId'>leave_type_id = #{leaveTypeId},</if>
<if test ='null != overtimeTypeId'>overtime_type_id = #{overtimeTypeId},</if>
<if test ='null != compensateId'>compensate_id = #{compensateId}</if>
</set>
WHERE id = #{id}
</update>
<select id="load" resultMap="BaseResultMap">
SELECT <include refid="Base_Column_List" />
FROM kqgl_asso_relation_summary
WHERE id = #{id}
</select>
<select id="pageList" resultMap="BaseResultMap">
SELECT <include refid="Base_Column_List" />
FROM kqgl_asso_relation_summary
LIMIT #{offset}, #{pageSize}
</select>
<select id="pageListCount" resultType="java.lang.Integer">
SELECT count(1)
FROM kqgl_asso_relation_summary
</select>
-->
</mapper>
\ No newline at end of file
src/main/resources/mapping/kqmk/KqglTaskTimingMapper.xml
0 → 100644
View file @
7e21b096
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"cn.timer.api.dao.kqmk.KqglTaskTimingMapper"
>
<resultMap
id=
"BaseResultMap"
type=
"cn.timer.api.bean.kqmk.KqglTaskTiming"
>
<id
column=
"id"
property=
"id"
/>
<result
column=
"task"
property=
"task"
/>
<result
column=
"execution_status"
property=
"executionStatus"
/>
<result
column=
"last_execution_time"
property=
"lastExecutionTime"
/>
</resultMap>
<sql
id=
"Base_Column_List"
>
id,
task,
execution_status,
last_execution_time
</sql>
<sql
id=
"Base_Column_List_Alias"
>
id KqglTaskTiming_id,
task KqglTaskTiming_task,
execution_status KqglTaskTiming_execution_status,
last_execution_time KqglTaskTiming_last_execution_time
</sql>
<!--
<insert id="insert" useGeneratedKeys="true" keyColumn="id" parameterType="cn.timer.api.bean.kqmk.KqglTaskTiming">
INSERT INTO kqgl_task_timing
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test ='null != task'>
task,
</if>
<if test ='null != executionStatus'>
execution_status,
</if>
<if test ='null != lastExecutionTime'>
last_execution_time
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test ='null != task'>
#{task},
</if>
<if test ='null != executionStatus'>
#{executionStatus},
</if>
<if test ='null != lastExecutionTime'>
#{lastExecutionTime}
</if>
</trim>
</insert>
<delete id="delete" >
DELETE FROM kqgl_task_timing
WHERE id = #{id}
</delete>
<update id="update" parameterType="cn.timer.api.bean.kqmk.KqglTaskTiming">
UPDATE kqgl_task_timing
<set>
<if test ='null != task'>task = #{task},</if>
<if test ='null != executionStatus'>execution_status = #{executionStatus},</if>
<if test ='null != lastExecutionTime'>last_execution_time = #{lastExecutionTime}</if>
</set>
WHERE id = #{id}
</update>
<select id="load" resultMap="BaseResultMap">
SELECT <include refid="Base_Column_List" />
FROM kqgl_task_timing
WHERE id = #{id}
</select>
<select id="pageList" resultMap="BaseResultMap">
SELECT <include refid="Base_Column_List" />
FROM kqgl_task_timing
LIMIT #{offset}, #{pageSize}
</select>
<select id="pageListCount" resultType="java.lang.Integer">
SELECT count(1)
FROM kqgl_task_timing
</select>
-->
</mapper>
\ No newline at end of file
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