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
b1255a14
Commit
b1255a14
authored
May 14, 2020
by
Administrator
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'lal' into 'develop'
Lal See merge request 8timerv2/8timerapiv200!91
parents
834c5689
4ad4f63f
Hide whitespace changes
Inline
Side-by-side
Showing
26 changed files
with
1642 additions
and
1706 deletions
+1642
-1706
src/main/java/cn/timer/api/bean/kqmk/KqglAssoLeaveBalance.java
+7
-3
src/main/java/cn/timer/api/bean/kqmk/KqglAssoTeshu.java
+1
-1
src/main/java/cn/timer/api/controller/kqgl/AttController.java
+66
-1652
src/main/java/cn/timer/api/controller/kqgl/ClockInController.java
+1
-1
src/main/java/cn/timer/api/controller/kqgl/ClockInTool.java
+113
-0
src/main/java/cn/timer/api/controller/kqgl/TimeCardController.java
+1068
-36
src/main/java/cn/timer/api/dao/kqmk/KqglAssoBcszMapper.java
+5
-1
src/main/java/cn/timer/api/dao/kqmk/KqglAssoKqzdkfsMapper.java
+5
-0
src/main/java/cn/timer/api/dao/kqmk/KqglAssoLeaveBalanceMapper.java
+8
-2
src/main/java/cn/timer/api/dao/kqmk/KqglAssoPbmxMapper.java
+7
-0
src/main/java/cn/timer/api/dao/kqmk/KqglAssoTeshuMapper.java
+6
-1
src/main/java/cn/timer/api/dao/kqmk/KqglAssoYhkqzMapper.java
+6
-2
src/main/java/cn/timer/api/dao/kqmk/KqglAssoZhoupaibanMapper.java
+6
-2
src/main/java/cn/timer/api/dto/kqmk/AttSchedulingDto.java
+21
-0
src/main/java/cn/timer/api/dto/kqmk/AttendanceAssistantDto.java
+57
-0
src/main/java/cn/timer/api/dto/kqmk/BalanceSheetDataDto.java
+20
-0
src/main/java/cn/timer/api/dto/kqmk/EmployeeLeaveBalanceDto.java
+31
-0
src/main/java/cn/timer/api/dto/kqmk/KqzAttendanceGroupSearchDto.java
+21
-0
src/main/java/cn/timer/api/dto/kqmk/SetConditionsDto.java
+17
-0
src/main/resources/mapping/kqmk/KqglAssoBcszMapper.xml
+11
-0
src/main/resources/mapping/kqmk/KqglAssoKqzdkfsMapper.xml
+23
-0
src/main/resources/mapping/kqmk/KqglAssoLeaveBalanceMapper.xml
+49
-5
src/main/resources/mapping/kqmk/KqglAssoPbmxMapper.xml
+35
-0
src/main/resources/mapping/kqmk/KqglAssoTeshuMapper.xml
+25
-0
src/main/resources/mapping/kqmk/KqglAssoYhkqzMapper.xml
+16
-0
src/main/resources/mapping/kqmk/KqglAssoZhoupaibanMapper.xml
+17
-0
No files found.
src/main/java/cn/timer/api/bean/kqmk/KqglAssoLeaveBalance.java
View file @
b1255a14
...
...
@@ -60,8 +60,11 @@ public class KqglAssoLeaveBalance extends Model<KqglAssoLeaveBalance> {
@ApiModelProperty
(
value
=
"修改序号 修改序号"
,
example
=
"101"
)
private
Integer
modifyNumber
;
@ApiModelProperty
(
value
=
"企业组织代码 企业组织代码"
,
example
=
"101"
)
private
Integer
orgCode
;
@ApiModelProperty
(
value
=
"企业组织代码 企业组织代码"
,
example
=
"101"
)
private
Integer
orgCode
;
@ApiModelProperty
(
value
=
"是否为系统自动 0:否;1:是"
,
example
=
"101"
)
private
Integer
isAutomatic
;
}
\ No newline at end of file
src/main/java/cn/timer/api/bean/kqmk/KqglAssoTeshu.java
View file @
b1255a14
...
...
@@ -47,7 +47,7 @@ public class KqglAssoTeshu extends Model<KqglAssoTeshu> {
private
Integer
bcid
;
@ApiModelProperty
(
value
=
"录入时间 录入时间"
,
example
=
"101"
)
private
Integer
lusjTime
;
private
Long
lusjTime
;
@ApiModelProperty
(
value
=
"录入人员 录入人员"
,
example
=
"101"
)
private
Integer
luryid
;
...
...
src/main/java/cn/timer/api/controller/kqgl/AttController.java
View file @
b1255a14
...
...
@@ -19,8 +19,10 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.http.HttpEntity
;
import
org.springframework.http.HttpHeaders
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.util.LinkedMultiValueMap
;
import
org.springframework.util.MultiValueMap
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.DeleteMapping
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PathVariable
;
...
...
@@ -35,6 +37,8 @@ import org.springframework.web.client.RestTemplate;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.service.additional.query.impl.LambdaQueryChainWrapper
;
import
com.github.pagehelper.PageHelper
;
import
com.github.pagehelper.PageInfo
;
...
...
@@ -95,9 +99,12 @@ import cn.timer.api.dao.kqgl.SpecialDateMapper;
import
cn.timer.api.dao.kqgl.UserAttendanceRelMapper
;
import
cn.timer.api.dao.kqgl.UserEquiRelationMapper
;
import
cn.timer.api.dao.kqjg.KqjgRealtimeEnrollDataMapper
;
import
cn.timer.api.dao.kqmk.KqglMainKqzMapper
;
import
cn.timer.api.dao.yggl.YgglMainEmpMapper
;
import
cn.timer.api.dto.kqgl.AttemacDto
;
import
cn.timer.api.dto.kqgl.MachinememberDto
;
import
cn.timer.api.dto.kqmk.AttqueryCriteriaDto
;
import
cn.timer.api.dto.kqmk.KqglMainKqzDto
;
import
cn.timer.api.utils.DateUtil
;
import
cn.timer.api.utils.ResponseResult
;
import
cn.timer.api.utils.Result
;
...
...
@@ -110,10 +117,10 @@ import io.swagger.annotations.ApiParam;
* @author lalqq
* 考勤
*/
@SuppressWarnings
(
"all"
)
@Api
(
tags
=
"AttsApi"
)
@Api
(
tags
=
"3.0[2]考勤模块"
)
@RestController
@RequestMapping
(
value
=
"/kqz"
,
produces
=
{
"application/json"
})
@Transactional
@RequestMapping
(
value
=
"/kqz"
,
produces
=
{
"application/json"
,
"multipart/form-data"
})
public
class
AttController
{
//班次
...
...
@@ -160,16 +167,6 @@ public class AttController {
private
YgglMainEmpMapper
ygglmainempmapper
;
@Autowired
private
KqglAssoKqjglyMapper
kqglassokqjglymapper
;
@Autowired
private
KqjgRealtimeEnrollDataMapper
kqjgrealtimeenrolldatamapper
;
//员工
// @Autowired
// private YgglEmpInfoMapper ygglEmpInfoService;//员工信息
@Autowired
private
SpecialDateMapper
specialdateservice
;
//日历提醒
@Autowired
...
...
@@ -192,7 +189,6 @@ public class AttController {
@ApiParam
(
"每页条数"
)
@RequestParam
(
value
=
"pageSize"
,
required
=
false
,
defaultValue
=
"9999"
)
Integer
pageSize
)
{
int
qyid
=
userBean
.
getOrgCode
();
//坏小孩【企业id】
int
userid
=
userBean
.
getEmpNum
();
//用户id
PageHelper
.
startPage
(
pageNum
,
pageSize
);
List
<
ShiftManagement
>
shiftList
=
shiftmanagementservice
.
selectByPrimaryByQyid
(
qyid
);
...
...
@@ -253,7 +249,6 @@ public class AttController {
@ApiOperation
(
value
=
"修改班次信息"
,
httpMethod
=
"PUT"
,
notes
=
"接口发布说明"
)
@ApiOperationSupport
(
order
=
5
)
public
Result
<
ShiftManagement
>
updateShiftInformation
(
@CurrentUser
UserBean
userBean
,
@RequestBody
ShiftManagement
shif
)
{
int
id
=
0
;
//修改数据id
int
qyid
=
userBean
.
getOrgCode
();
//坏小孩【企业id】
int
userid
=
userBean
.
getEmpNum
();
//用户id
...
...
@@ -265,70 +260,10 @@ public class AttController {
}
return
ResultUtil
.
error
(
"修改班次信息失败"
);
}
/*******班次管理--结束*********/
/****************************************************/
/*******班次管理 结束*********/
/****************************************************/
/*******打卡设置--结束*********/
/*********考勤机***********/
/**
* 获取考勤机数据
*/
@GetMapping
(
value
=
"/AttMachine"
)
@ApiOperation
(
value
=
"获取考勤机数据-根据 组织机构代码"
,
httpMethod
=
"GET"
,
notes
=
"接口发布说明"
)
@ApiOperationSupport
(
order
=
6
)
public
Result
<
List
<
AttendanceMachine
>>
getAttMachineEquipment
(
@CurrentUser
UserBean
userBean
)
{
// int qyid = 2000021;//坏小孩【企业id】
int
qyid
=
userBean
.
getOrgCode
();
//坏小孩【企业id】
int
userid
=
userBean
.
getEmpNum
();
//用户id
List
<
AttendanceMachine
>
attendanList
=
attendancemachineservice
.
selectByPrimaryByQyid
(
qyid
);
return
ResultUtil
.
data
(
attendanList
);
}
/**
* 修改考勤机信息
*/
/*
* @PutMapping(value = "/AttMachine/{name}/{id}")
*
* @ApiOperation(value = "修改考勤机信息", httpMethod = "PUT", notes = "接口发布说明") public
* Result<Void> updateAttMachineEquipment(@PathVariable("name") String
* name,@PathVariable("id") Integer id) { if
* (attendancemachineservice.updateByPrimaryByid(name,id) > 0) { return
* ResultUtil.data("修改考勤机信息成功",""); } return ResultUtil.error("修改考勤机信息失败"); }
*/
/**
* 获取考勤机所在考勤组数据
*/
@GetMapping
(
value
=
"/AttMachineGroup/{id}"
)
@ApiOperation
(
value
=
"获取考勤机所在考勤组数据"
,
httpMethod
=
"GET"
,
notes
=
"接口发布说明"
)
@ApiOperationSupport
(
order
=
7
)
public
Result
<
List
<
AttendanceGroup
>>
getAttMachineGroup
(
@CurrentUser
UserBean
userBean
,
@PathVariable
(
"id"
)
Integer
id
)
{
int
qyid
=
userBean
.
getOrgCode
();
//坏小孩【企业id】
int
userid
=
userBean
.
getEmpNum
();
//用户id
List
<
AttendanceGroup
>
attownlist
=
attendancegroupservice
.
selectByPrimaryAttOwn
(
qyid
,
id
);
return
ResultUtil
.
data
(
attownlist
);
}
/**
* 获取考勤机数据-根据 组织机构代码
*/
@GetMapping
(
value
=
"/AttGroupMachine"
)
@ApiOperation
(
value
=
"获取考勤机数据-根据 组织机构代码"
,
httpMethod
=
"GET"
,
notes
=
"接口发布说明"
)
@ApiOperationSupport
(
order
=
8
)
public
Result
<
List
<
AttendanceGroup
>>
getAttGroupMachineList
(
@CurrentUser
UserBean
userBean
)
{
int
qyid
=
userBean
.
getOrgCode
();
//坏小孩【企业id】
int
userid
=
userBean
.
getEmpNum
();
//用户id
List
<
AttendanceGroup
>
attmacList
=
attendancegroupservice
.
selectAttGroupMachineByQyid
(
qyid
);
return
ResultUtil
.
data
(
attmacList
);
}
/*********打卡地址***********/
/**
* 获取打卡地址数据
...
...
@@ -339,98 +274,12 @@ public class AttController {
public
Result
<
PageInfo
<
PunchCardAddress
>>
getPunchCardAddress
(
@CurrentUser
UserBean
userBean
,
@ApiParam
(
"当前页"
)
@RequestParam
(
value
=
"pageNum"
,
required
=
false
,
defaultValue
=
"1"
)
Integer
pageNum
,
@ApiParam
(
"每页条数"
)
@RequestParam
(
value
=
"pageSize"
,
required
=
false
,
defaultValue
=
"10"
)
Integer
pageSize
)
{
int
qyid
=
userBean
.
getOrgCode
();
//坏小孩【企业id】
int
userid
=
userBean
.
getEmpNum
();
//用户id
PageHelper
.
startPage
(
pageNum
,
pageSize
);
List
<
PunchCardAddress
>
shiftList
=
punchcardaddressservice
.
selectByPrimaryByQyid
(
qyid
);
PageInfo
<
PunchCardAddress
>
pageInfo
=
new
PageInfo
<>(
shiftList
);
return
ResultUtil
.
data
(
pageInfo
);
}
/**
* 根据打卡地址id获取打卡地址信息
*/
@GetMapping
(
value
=
"/PuAddress/{id}"
)
@ApiOperation
(
value
=
"获取打卡地址信息-根据打卡地址id"
,
httpMethod
=
"GET"
,
notes
=
"接口发布说明"
)
@ApiOperationSupport
(
order
=
10
)
public
Result
<
PunchCardAddress
>
getPunchAddressByid
(
@PathVariable
(
"id"
)
Integer
id
)
{
PunchCardAddress
adres
=
punchcardaddressservice
.
selectByPrimaryKey
(
id
);
return
ResultUtil
.
data
(
adres
);
}
/**
* 新增打卡地址信息
*/
@PostMapping
(
value
=
"/PunchAddress"
)
@ApiOperation
(
value
=
"新增打卡地址信息"
,
httpMethod
=
"POST"
,
notes
=
"接口发布说明"
)
@ApiOperationSupport
(
order
=
11
)
public
Result
<
PunchCardAddress
>
PunchCardAddress
(
@CurrentUser
UserBean
userBean
,
@RequestBody
PunchCardAddress
punchades
)
{
int
qyid
=
userBean
.
getOrgCode
();
//坏小孩【企业id】
int
userid
=
userBean
.
getEmpNum
();
//用户id
punchades
.
setQyid
(
qyid
);
//企业id
punchades
.
setLusjTime
(
new
Date
().
getTime
());
//录入时间
punchades
.
setLuryid
(
userid
);
//录入人员
if
(
punchcardaddressservice
.
insertSelective
(
punchades
)>
0
){
return
ResultUtil
.
data
(
punchades
,
"新增打卡地址成功"
);
}
else
{
return
ResultUtil
.
error
(
"新增打卡地址失败"
);
}
}
/**
* 删除打卡地址信息
*/
@DeleteMapping
(
value
=
"/PunchAddress/{id}"
)
@ApiOperation
(
value
=
"删除打卡地址信息"
,
httpMethod
=
"DELETE"
,
notes
=
"接口发布说明"
)
@ApiOperationSupport
(
order
=
12
)
public
Result
<
Integer
>
deletePunchCardAddress
(
@PathVariable
(
"id"
)
Integer
id
)
{
if
(
punchcardaddressservice
.
deleteByPrimaryKey
(
id
)
>
0
)
{
return
ResultUtil
.
data
(
id
,
"删除成功"
);
}
return
ResultUtil
.
error
(
"删除失败"
);
}
/**
* 修改打卡地址信息
*/
@PutMapping
(
value
=
"/PunchAddress"
)
@ApiOperation
(
value
=
"修改打卡地址信息"
,
httpMethod
=
"PUT"
,
notes
=
"接口发布说明"
)
@ApiOperationSupport
(
order
=
13
)
public
Result
<
PunchCardAddress
>
updatePunchCardAddress
(
@CurrentUser
UserBean
userBean
,
@RequestBody
PunchCardAddress
punchades
)
{
int
id
=
0
;
//修改数据id
int
qyid
=
userBean
.
getOrgCode
();
//坏小孩【企业id】
int
userid
=
userBean
.
getEmpNum
();
//用户id
punchades
.
setQyid
(
qyid
);
punchades
.
setLusjTime
(
new
Date
().
getTime
());
punchades
.
setLuryid
(
userid
);
if
(
punchcardaddressservice
.
updateByPrimaryKeySelective
(
punchades
)
>
0
)
{
return
ResultUtil
.
data
(
punchades
,
"修改打卡地址信息成功"
);
}
return
ResultUtil
.
error
(
"修改打卡地址信息失败"
);
}
/**
* 获取打卡地址所在考勤组数据
*/
@GetMapping
(
value
=
"/PunchAddressGroup/{id}"
)
@ApiOperation
(
value
=
"获取打卡地址所在考勤组数据"
,
httpMethod
=
"GET"
,
notes
=
"接口发布说明"
)
@ApiOperationSupport
(
order
=
14
)
public
Result
<
List
<
AttendanceGroup
>>
getPunchAddressGroup
(
@CurrentUser
UserBean
userBean
,
@PathVariable
(
"id"
)
Integer
id
)
{
int
qyid
=
userBean
.
getOrgCode
();
//坏小孩【企业id】
int
userid
=
userBean
.
getEmpNum
();
//用户id
List
<
AttendanceGroup
>
attaddressownlist
=
attendancegroupservice
.
selectByPrimaryAttAddressOwn
(
qyid
,
id
);
return
ResultUtil
.
data
(
attaddressownlist
);
}
/*********打卡WIFI***********/
/**
* 获取打卡WIFI数据
...
...
@@ -441,102 +290,36 @@ public class AttController {
public
Result
<
PageInfo
<
PunchCardWiFi
>>
getPunchCardWIFI
(
@CurrentUser
UserBean
userBean
,
@ApiParam
(
"当前页"
)
@RequestParam
(
value
=
"pageNum"
,
required
=
false
,
defaultValue
=
"1"
)
Integer
pageNum
,
@ApiParam
(
"每页条数"
)
@RequestParam
(
value
=
"pageSize"
,
required
=
false
,
defaultValue
=
"10"
)
Integer
pageSize
)
{
int
qyid
=
userBean
.
getOrgCode
();
//坏小孩【企业id】
int
userid
=
userBean
.
getEmpNum
();
//用户id
PageHelper
.
startPage
(
pageNum
,
pageSize
);
List
<
PunchCardWiFi
>
shiftList
=
punchcardwifiservice
.
selectByPrimaryByQyid
(
qyid
);
PageInfo
<
PunchCardWiFi
>
pageInfo
=
new
PageInfo
<>(
shiftList
);
return
ResultUtil
.
data
(
pageInfo
);
}
/**************************************************************考勤组********************************************************************/
/**
* 根据打卡WIFIid获取打卡WIFI信息
*/
@GetMapping
(
value
=
"/PuWIFI/{id}"
)
@ApiOperation
(
value
=
"获取打卡WIFI信息-根据打卡WIFIid"
,
httpMethod
=
"GET"
,
notes
=
"接口发布说明"
)
@ApiOperationSupport
(
order
=
16
)
public
Result
<
PunchCardWiFi
>
getPunchWIFIByid
(
@PathVariable
(
"id"
)
Integer
id
)
{
PunchCardWiFi
puwifi
=
punchcardwifiservice
.
selectByPrimaryKey
(
id
);
return
ResultUtil
.
data
(
puwifi
);
}
/**
* 新增打卡WIFI信息
*/
@PostMapping
(
value
=
"/PunchWIFI"
)
@ApiOperation
(
value
=
"新增打卡WIFI信息"
,
httpMethod
=
"POST"
,
notes
=
"接口发布说明"
)
@ApiOperationSupport
(
order
=
17
)
public
Result
<
PunchCardWiFi
>
PunchCardWIFI
(
@CurrentUser
UserBean
userBean
,
@RequestBody
PunchCardWiFi
punchwifi
)
{
int
qyid
=
userBean
.
getOrgCode
();
//坏小孩【企业id】
int
userid
=
userBean
.
getEmpNum
();
//用户id
punchwifi
.
setQyid
(
qyid
);
//企业id
punchwifi
.
setLusjTime
(
new
Date
().
getTime
());
//录入时间
punchwifi
.
setLuryid
(
userid
);
//录入人员
if
(
punchcardwifiservice
.
insertSelective
(
punchwifi
)>
0
){
return
ResultUtil
.
data
(
punchwifi
,
"新增打卡WIFI成功"
);
}
else
{
return
ResultUtil
.
error
(
"新增打卡WIFI失败"
);
}
}
/**
* 删除打卡WIFI信息
*/
@DeleteMapping
(
value
=
"/PunchWIFI/{id}"
)
@ApiOperation
(
value
=
"删除打卡WIFI信息"
,
httpMethod
=
"DELETE"
,
notes
=
"接口发布说明"
)
@ApiOperationSupport
(
order
=
18
)
public
Result
<
Integer
>
deletePunchCardWIFI
(
@PathVariable
(
"id"
)
Integer
id
)
{
if
(
punchcardwifiservice
.
deleteByPrimaryKey
(
id
)
>
0
)
{
return
ResultUtil
.
data
(
id
,
"删除成功"
);
}
return
ResultUtil
.
error
(
"删除失败"
);
}
/**
* 修改打卡地址信息
*/
@PutMapping
(
value
=
"/PunchWIFI"
)
@ApiOperation
(
value
=
"修改打卡地址信息"
,
httpMethod
=
"PUT"
,
notes
=
"接口发布说明"
)
@ApiOperationSupport
(
order
=
19
)
public
Result
<
PunchCardWiFi
>
updatePunchCardWIFI
(
@CurrentUser
UserBean
userBean
,
@RequestBody
PunchCardWiFi
punchwifi
)
{
int
id
=
0
;
//修改数据id
int
qyid
=
userBean
.
getOrgCode
();
//坏小孩【企业id】
int
userid
=
userBean
.
getEmpNum
();
//用户id
punchwifi
.
setQyid
(
qyid
);
punchwifi
.
setLusjTime
(
new
Date
().
getTime
());
punchwifi
.
setLuryid
(
userid
);
if
(
punchcardwifiservice
.
updateByPrimaryKeySelective
(
punchwifi
)
>
0
)
{
return
ResultUtil
.
data
(
punchwifi
,
"修改打卡WIFI信息成功"
);
}
return
ResultUtil
.
error
(
"修改打卡WIFI信息失败"
);
}
@Autowired
private
KqglMainKqzMapper
kqglmainkqzmapper
;
/**
*
获取打卡WIFI所在考勤组数据
*
查询列表-考勤组-分页【新】
*/
@GetMapping
(
value
=
"/PunchWIFIGroup/{id}"
)
@ApiOperation
(
value
=
"获取打卡WIFI所在考勤组数据"
,
httpMethod
=
"GET"
,
notes
=
"接口发布说明"
)
@ApiOperationSupport
(
order
=
20
)
public
Result
<
List
<
AttendanceGroup
>>
getPunchWIFIGroup
(
@CurrentUser
UserBean
userBean
,
@PathVariable
(
"id"
)
Integer
id
)
{
int
qyid
=
userBean
.
getOrgCode
();
//坏小孩【企业id】
List
<
AttendanceGroup
>
attwifiownlist
=
attendancegroupservice
.
selectByPrimaryAttWIFIOwn
(
qyid
,
id
);
return
ResultUtil
.
data
(
attwifiownlist
);
@PostMapping
(
value
=
"/attendance_group"
)
@ApiOperation
(
value
=
"34:查询列表-我审批的/抄送我的-分页"
,
httpMethod
=
"POST"
,
notes
=
"查询列表-我审批的-关键字、审批状态、发起时间-分页"
)
@ApiOperationSupport
(
order
=
34
)
public
Result
<
Object
>
AttendanceGroup
(
@CurrentUser
UserBean
userBean
,
@Validated
@RequestBody
AttqueryCriteriaDto
attquerycriteriadto
){
IPage
<
KqglMainKqzDto
>
page
=
new
Page
<
KqglMainKqzDto
>(
attquerycriteriadto
.
getCurrentPage
()
==
null
?
1
:
attquerycriteriadto
.
getCurrentPage
(),
attquerycriteriadto
.
getTotalPage
()
==
null
?
10
:
attquerycriteriadto
.
getTotalPage
());
attquerycriteriadto
.
setOrgCode
(
userBean
.
getOrgCode
());
attquerycriteriadto
.
setEmpNum
(
userBean
.
getEmpNum
());
// 缺-部门id 搜索
IPage
<
KqglMainKqzDto
>
pageAs
=
kqglmainkqzmapper
.
selectPageByQueryKqglMain
(
page
,
attquerycriteriadto
);
List
<
KqglMainKqzDto
>
listAs
=
pageAs
.
getRecords
();
return
ResultUtil
.
data
(
pageAs
,
listAs
,
"操作成功!"
);
}
/*******打卡设置--结束*********/
/****************************************************/
/****************************************************/
/*******考勤组--开始*********/
/**
* 获取考勤组数据
*/
...
...
@@ -553,7 +336,6 @@ public class AttController {
PageInfo
<
AttendanceGroup
>
pageInfo
=
new
PageInfo
<>(
attgrlist
);
return
ResultUtil
.
data
(
pageInfo
);
}
/**
* 获取考勤组数据-根据 模糊 + 高級查詢
*/
...
...
@@ -570,556 +352,63 @@ public class AttController {
return
ResultUtil
.
data
(
attgrlist
);
}
/**
* 获取打卡地址数据
*/
@GetMapping
(
value
=
"/InGroupPunchAddress"
)
@ApiOperation
(
value
=
"获取打卡地址数据"
,
httpMethod
=
"GET"
,
notes
=
"接口发布说明"
)
@ApiOperationSupport
(
order
=
23
)
public
Result
<
List
<
PunchCardAddress
>>
getInGroupPunchAddress
(
@CurrentUser
UserBean
userBean
)
{
int
qyid
=
userBean
.
getOrgCode
();
//坏小孩【企业id】
List
<
PunchCardAddress
>
shiftList
=
punchcardaddressservice
.
selectByPrimaryByQyid
(
qyid
);
return
ResultUtil
.
data
(
shiftList
);
}
/**
* 获取
打卡WIFI数据
* 获取
修改的排班明细--【修改考勤组】--------------------------------------------------------------------------------------
*/
@
GetMapping
(
value
=
"/InGroupPunchWIFI
"
)
@ApiOperation
(
value
=
"获取
打卡WIFI数据"
,
httpMethod
=
"GE
T"
,
notes
=
"接口发布说明"
)
@ApiOperationSupport
(
order
=
2
4
)
public
Result
<
List
<
PunchCardWiFi
>>
getInGroupPunchWIFI
(
@CurrentUser
UserBean
userBean
)
{
@
PostMapping
(
value
=
"/AttGroupSchedulingList
"
)
@ApiOperation
(
value
=
"获取
修改的排班明细"
,
httpMethod
=
"POS
T"
,
notes
=
"接口发布说明"
)
@ApiOperationSupport
(
order
=
2
9
)
public
Result
<
List
<
Schedule
>>
getAttGroupSchedulingList
(
@CurrentUser
UserBean
userBean
,
@RequestBody
AttScheduling
attscheduling
)
{
int
qyid
=
userBean
.
getOrgCode
();
//坏小孩【企业id】
int
userid
=
userBean
.
getEmpNum
();
//用户id
List
<
PunchCardWiFi
>
shiftList
=
punchcardwifiservice
.
selectByPrimaryByQyid
(
qyid
);
return
ResultUtil
.
data
(
shiftList
);
}
/**
* 获取班次
*/
@GetMapping
(
value
=
"/AttShift"
)
@ApiOperation
(
value
=
"获取班次-根据 组织机构代码"
,
httpMethod
=
"GET"
,
notes
=
"接口发布说明"
)
@ApiOperationSupport
(
order
=
25
)
public
Result
<
List
<
ShiftManagement
>>
getAttShiftList
(
@CurrentUser
UserBean
userBean
)
{
int
qyid
=
userBean
.
getOrgCode
();
//坏小孩【企业id】
List
<
ShiftManagement
>
attshiftList
=
shiftmanagementservice
.
selectByPrimaryByQyid
(
qyid
);
return
ResultUtil
.
data
(
attshiftList
);
}
/**
* 获取员工数据
*/
@GetMapping
(
value
=
"/Employee"
)
@ApiOperation
(
value
=
"获取员工数据-根据 组织机构代码"
,
httpMethod
=
"GET"
,
notes
=
"接口发布说明"
)
@ApiOperationSupport
(
order
=
26
)
public
Result
<
List
<
YgglMainEmp
>>
getEmployeeData
(
@CurrentUser
UserBean
userBean
)
{
int
qyid
=
userBean
.
getOrgCode
();
//坏小孩【企业id】
Date
d
=
new
Date
();
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy-MM"
);
String
str
=
sdf
.
format
(
d
);
List
<
YgglMainEmp
>
yggl
=
attendancegroupservice
.
EmployeeListByorgCode
(
String
.
valueOf
(
qyid
));
String
date
=
attscheduling
.
getDate
();
if
((
""
).
equals
(
date
)
||
date
==
null
){
attscheduling
.
setDate
(
str
);
}
return
ResultUtil
.
data
(
yggl
);
attscheduling
.
setQyid
(
qyid
);
List
<
Schedule
>
schlist
=
scheduleservice
.
selectAttGroupScheduling
(
attscheduling
);
return
ResultUtil
.
data
(
schlist
);
}
/**
*
删除考勤组
*
根据考勤组id获取班次信息--【修改考勤组】
*/
@DeleteMapping
(
value
=
"/AttendanceGroup/{id}"
)
@ApiOperation
(
value
=
"删除考勤组"
,
httpMethod
=
"DELETE"
,
notes
=
"接口发布说明"
)
@ApiOperationSupport
(
order
=
27
)
public
Result
<
Integer
>
DelAttendanceGroup
(
@PathVariable
(
"id"
)
Integer
id
)
{
//删除组
if
(
attendancegroupservice
.
deleteByPrimaryKey
(
id
)
>
0
)
{
/**********************************************************/
//删除考勤机里的人员
// List<UserAttendanceRel> attusers = userattendancerelservice.selectAttendanceOfficerByKqzid(id);//该考勤组人数
//
// List<AttGroupBinPunchMode> kqjs = attgroupbinpunchmodeservice.selectMachineByKqzId(id);//该考勤组所绑定的考勤机
//
// String DevId = "";
// for(AttGroupBinPunchMode abp:kqjs) {
// AttendanceMachine kqj = attendancemachineservice.selectByPrimaryKey(abp.getDkfsid());//查询考勤机“序列号”
//
// DevId = kqj.getCode();
//
// for(UserAttendanceRel user:attusers) {
// String user_id = user.getEmpnum();//"1692";//要删除的考勤组里面用户ID
//
// byte[] bytCmd=new byte[0];
// byte[] cmdbytCmd=new byte[0];
// JSONObject vResultJson = new JSONObject();
// vResultJson.put("user_id", user_id);
// String sFinal = vResultJson.toString();
//
// String url = StaticVariable.mac_command;
// HttpHeaders headers = new HttpHeaders();
// MultiValueMap<String, Object> params = new LinkedMultiValueMap<>();
// params.add("cmd", "DELETE_USER");
// params.add("devid", DevId);
// params.add("json", sFinal);
// RestTemplate restTemplate = new RestTemplate();
// HttpEntity httpEntity = new HttpEntity(params, headers);
// ResponseEntity<String> request = restTemplate.postForEntity(url, httpEntity, String.class);
//
// System.out.println("=============考勤机删除===============");
// }
// }
/**********************************************************/
// userequirelationmapper.deleteBykqzid(id);
//删除考勤组绑定的打卡方式
attgroupbinpunchmodeservice
.
deleteByPrimaryBykqzid
(
id
);
//删除用户和考勤组关系表
userattendancerelservice
.
deleteByPrimaryBykqzid
(
id
);
//删除特殊日期表
specialdateservice
.
deleteByPrimaryBykqzid
(
id
);
//删除排班明细表(自由排班)
scheduleservice
.
deleteByPrimaryBykqzid
(
id
);
//删除考勤周排班
attendanceweeklyschservice
.
deleteByPrimaryBykqzid
(
id
);
return
ResultUtil
.
data
(
id
,
"删除成功"
);
}
@GetMapping
(
value
=
"/roster/{id}/{date}"
)
@ApiOperation
(
value
=
"根据考勤组id获取班次信息"
,
httpMethod
=
"GET"
,
notes
=
"接口发布说明"
)
@ApiOperationSupport
(
order
=
30
)
public
Result
<
List
<
ShiftManagement
>>
getRosterList
(
@PathVariable
(
"id"
)
Integer
id
,
@PathVariable
(
"date"
)
String
date
)
{
KqzAttendanceGroupSearch
jycx
=
new
KqzAttendanceGroupSearch
();
jycx
.
setOverall
(
date
);
jycx
.
setQyid
(
id
);
return
ResultUtil
.
error
(
"删除失败"
);
List
<
ShiftManagement
>
shifs
=
shiftmanagementservice
.
selectRosterByKqzid
(
jycx
);
return
ResultUtil
.
data
(
shifs
);
}
/**
*
新建考勤组
*
修改考勤组排班(修改排班后,需判断是否有打卡记录,有则匹配当天修改后的班次,无则不需要修改)
*/
@
PostMapping
(
value
=
"/AttendanceGroup"
)
@
ApiOperation
(
value
=
"新增考勤组数据"
,
httpMethod
=
"POST"
,
notes
=
"接口发布说明
"
)
@ApiOperationSupport
(
order
=
28
)
public
Result
<
Void
>
AttendanceGroupList
(
@CurrentUser
UserBean
userBean
,
@RequestBody
AttendanceAssistant
attass
)
{
int
qyid
=
userBean
.
getOrgCode
();
//坏小孩【企业id】
int
userid
=
userBean
.
getEmpNum
();
//用户id
@
SuppressWarnings
({
"unused"
,
"deprecation"
}
)
@
PutMapping
(
value
=
"/attscheduling
"
)
@ApiOperationSupport
(
order
=
31
)
@ApiOperation
(
value
=
"修改班次信息"
,
httpMethod
=
"PUT"
,
notes
=
"接口发布说明"
)
public
Result
<
List
<
Schedule
>>
updateAttscheduling
(
@CurrentUser
UserBean
userBean
,
@RequestBody
AttendanceAssistant
attass
)
{
int
id
=
Integer
.
valueOf
(
attass
.
getAttgroupid
());
//修改数据id
AttendanceGroup
attgro
=
new
AttendanceGroup
();
attgro
.
setName
(
attass
.
getName
());
//名称
attgro
.
setKqbz
(
attass
.
getRemarks
());
//考勤备注
attgro
.
setPbfs
(
attass
.
getAtttype
());
//排班方式 // 考勤类型:1-固定排班、2-排班制、3-自由工时 *
attgro
.
setQyid
(
qyid
);
//企业id
attgro
.
setIsWq
(
attass
.
getFieldpersonnel
());
//外勤:0-关 1-开
int
qyid
=
userBean
.
getOrgCode
();
//坏小孩【企业id】
int
userid
=
userBean
.
getEmpNum
();
//用户id
if
(
attass
.
getAtttype
()
==
1
){
attgro
.
setIsFdjjr
(
attass
.
getLegalholidays
());
//是否开启法定节假日休息(固定排班)
}
if
(
attass
.
getAtttype
()
==
2
){
attgro
.
setIsXzbcdk
(
attass
.
getOptscheduling
());
//未排班时,员工可选择班次打卡
String
[]
attShifts
=
attass
.
getAttShifts
();
String
sybc
=
String
.
join
(
","
,
attShifts
);
attgro
.
setSybc
(
sybc
);
attgro
.
setIsDqtx
(
attass
.
getAttRemind
());
//是否开启到期提醒([排班制专用]0:否;1:是)
String
[]
coge
=
attass
.
getAttRemindUserids
();
String
str
=
String
.
join
(
","
,
coge
);
attgro
.
setTxry
(
str
);
//提醒人员([排班制专用]员工id以[“,”]连接 json数组)
attgro
.
setTxfs
(
attass
.
getAdvanceDays
());
//提醒方式([排班制专用]提前15天、7天、3天、1天)
attgro
.
setTxxhts
(
attass
.
getRemCycleDays
());
//提醒循环天数([排班制专用])
attgro
.
setTxsjTime
(
attass
.
getReminderTime
());
//提醒时间([排班制专用])
String
[]
rem
=
attass
.
getPromptingMode
();
String
strrem
=
String
.
join
(
","
,
rem
);
attgro
.
setTsfs
(
strrem
);
//提示方式([排班制专用]PC端、APP客户端、短信、邮件 以[“,”]连接 json数组)
attgro
.
setIsWpbsdk
(
attass
.
getAttRemind
());
//是否开启未排班时打卡([排班制专用]0:否;1:是;未排班时,员工可以选择班次打卡)
}
if
(
attass
.
getAtttype
()
==
3
){
attgro
.
setKqkssjTime
(
attass
.
getNewAttTime
());
//考勤开始时间(自由工时专用)
attgro
.
setZsgzsc
(
attass
.
getLeastworkTime
());
//至少工作时长(自由工时专用)
attgro
.
setZcgzsc
(
attass
.
getNormalWorkTime
());
//正常工作时长(自由工时专用)
attgro
.
setJbzdsc
(
attass
.
getMaxOvertimeTime
());
//加班最大时长(自由工时专用)
}
attendancegroupservice
.
insertSelective
(
attgro
);
int
attid
=
attgro
.
getId
();
//考勤组ID
//System.out.println(attid);
List
<
AttGroupBinPunchMode
>
kqzdkfslist
=
new
ArrayList
<
AttGroupBinPunchMode
>();
//考勤机 ***************************人员加入考勤机
String
[]
attmac
=
attass
.
getAttmachines
();
if
(
attmac
.
length
>
0
){
for
(
int
i
=
0
;
i
<
attmac
.
length
;
i
++)
{
//考勤机个数
AttGroupBinPunchMode
attgbpmac
=
new
AttGroupBinPunchMode
();
attgbpmac
.
setDkfsid
(
Integer
.
valueOf
(
attmac
[
i
]));
// 考勤机、地址、WIFI的id
attgbpmac
.
setKqzId
(
attid
);
// 考勤组ID
attgbpmac
.
setType
(
1
);
// 1:考勤机;2:地址;3:WIFI
attgbpmac
.
setQyid
(
qyid
);
// 企业id
attgbpmac
.
setState
(
1
);
// 0:停用;1:启用
kqzdkfslist
.
add
(
attgbpmac
);
}
}
//考勤地址
String
[]
atad
=
attass
.
getAttadds
();
if
(
atad
.
length
>
0
){
for
(
int
a
=
0
;
a
<
atad
.
length
;
a
++){
AttGroupBinPunchMode
attgbpadd
=
new
AttGroupBinPunchMode
();
attgbpadd
.
setDkfsid
(
Integer
.
valueOf
(
atad
[
a
]));
// 考勤机、地址、WIFI的id
attgbpadd
.
setKqzId
(
attid
);
// 考勤组ID
attgbpadd
.
setType
(
2
);
// 1:考勤机;2:地址;3:WIFI
attgbpadd
.
setQyid
(
qyid
);
// 企业id
attgbpadd
.
setState
(
1
);
// 0:停用;1:启用
kqzdkfslist
.
add
(
attgbpadd
);
}
}
//考勤WIFI
String
[]
atwf
=
attass
.
getAttwifis
();
if
(
atwf
.
length
>
0
){
for
(
int
f
=
0
;
f
<
atwf
.
length
;
f
++){
AttGroupBinPunchMode
attgbpwf
=
new
AttGroupBinPunchMode
();
attgbpwf
.
setDkfsid
(
Integer
.
valueOf
(
atwf
[
f
]));
// 考勤机、地址、WIFI的id
attgbpwf
.
setKqzId
(
attid
);
// 考勤组ID
attgbpwf
.
setType
(
3
);
// 1:考勤机;2:地址;3:WIFI
attgbpwf
.
setQyid
(
qyid
);
// 企业id
attgbpwf
.
setState
(
1
);
// 0:停用;1:启用
kqzdkfslist
.
add
(
attgbpwf
);
}
}
if
(
kqzdkfslist
.
size
()>
0
){
attgroupbinpunchmodeservice
.
insertKqglAssokqzdKfsList
(
kqzdkfslist
);
}
//用户和考勤组关系****************************************************************
List
<
UserAttendanceRel
>
yhkqzlist
=
new
ArrayList
<
UserAttendanceRel
>();
String
[]
attser
=
attass
.
getAttuserids
();
if
(
attser
.
length
>
0
){
String
user_id
=
""
;
String
user_name
=
""
;
String
DevId
=
""
;
byte
[]
bytCmd
=
new
byte
[
0
];
byte
[]
cmdbytCmd
=
new
byte
[
0
];
for
(
int
u
=
0
;
u
<
attser
.
length
;
u
++){
if
(
attass
.
getAtttype
()
==
2
){
//排班制 考勤组与用户、用户排班
scheduleservice
.
deleteByPrimaryByUserid
(
Integer
.
valueOf
(
attser
[
u
]));
}
userattendancerelservice
.
deleteByPrimaryByUserid
(
Integer
.
valueOf
(
attser
[
u
]));
UserAttendanceRel
kquser
=
new
UserAttendanceRel
();
kquser
.
setKqzid
(
attid
);
kquser
.
setUserid
(
Integer
.
valueOf
(
attser
[
u
]));
kquser
.
setQyid
(
qyid
);
yhkqzlist
.
add
(
kquser
);
/***********************************录入相应的考勤机**************************************************************/
List
<
AttGroupBinPunchMode
>
kqjs
=
attgroupbinpunchmodeservice
.
selectMachineByKqzId
(
attid
);
//该考勤组所绑定的考勤机
for
(
AttGroupBinPunchMode
abp:
kqjs
)
{
AttendanceMachine
kqj
=
attendancemachineservice
.
selectByPrimaryKey
(
abp
.
getDkfsid
());
//查询考勤机“序列号”
// userequirelationmapper.delAttmacrelpers(Integer.valueOf(attser[u]), kqj.getId());
UserEquiRelation
kqjry
=
userequirelationmapper
.
selectByuserIdkqjid
(
Integer
.
valueOf
(
attser
[
u
]),
kqj
.
getId
());
if
(
kqjry
==
null
)
{
//用户与设备关系(考勤机id-->用户id)
UserEquiRelation
uskqj
=
new
UserEquiRelation
();
uskqj
.
setUserId
(
Integer
.
valueOf
(
attser
[
u
]));
//用户id
uskqj
.
setKqjid
(
kqj
.
getId
());
//设备id
uskqj
.
setType
(
1
);
//类型(类型 1:考勤机)
UserEquiRelation
isgly
=
userequirelationmapper
.
selectByuserId
(
Integer
.
valueOf
(
attser
[
u
]));
if
(
isgly
!=
null
)
{
uskqj
.
setIsGly
(
isgly
.
getIsGly
());
}
else
{
uskqj
.
setIsGly
(
0
);
}
userequirelationmapper
.
insert
(
uskqj
);
}
Integer
orgCode
=
userBean
.
getOrgCode
();
QueryWrapper
<
YgglMainEmp
>
queryWrapper
=
new
QueryWrapper
<>();
queryWrapper
.
eq
(
"org_code"
,
orgCode
).
eq
(
"emp_num"
,
attser
[
u
]);
YgglMainEmp
yggluser
=
YgglMainEmp
.
builder
().
build
().
selectOne
(
queryWrapper
);
user_id
=
attser
[
u
];
//
user_name
=
yggluser
.
getName
();
//
DevId
=
kqj
.
getCode
();
//考勤机--设备编码
if
(
user_id
==
null
||
DevId
==
null
){
try
{
throw
new
Exception
(
"User_ID or DevId is null"
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
if
(
user_name
==
null
){
user_name
=
""
;
}
JSONObject
vResultJson
=
new
JSONObject
();
vResultJson
.
put
(
"user_id"
,
user_id
);
vResultJson
.
put
(
"user_name"
,
user_name
);
vResultJson
.
put
(
"user_privilege"
,
"USER"
);
String
sFinal
=
vResultJson
.
toString
();
String
url
=
StaticVariable
.
mac_command
;
HttpHeaders
headers
=
new
HttpHeaders
();
MultiValueMap
<
String
,
Object
>
params
=
new
LinkedMultiValueMap
<>();
params
.
add
(
"cmd"
,
"SET_USER_INFO"
);
params
.
add
(
"devid"
,
DevId
);
params
.
add
(
"json"
,
sFinal
);
RestTemplate
restTemplate
=
new
RestTemplate
();
HttpEntity
httpEntity
=
new
HttpEntity
(
params
,
headers
);
ResponseEntity
<
String
>
request
=
restTemplate
.
postForEntity
(
url
,
httpEntity
,
String
.
class
);
System
.
out
.
println
(
"============新增==============="
);
}
/*****************************************************************************/
}
}
if
(
yhkqzlist
.
size
()>
0
){
userattendancerelservice
.
insertKqglAssoKqzdkfsList
(
yhkqzlist
);
}
//固定排版周记录 attendanceweeklyschservice
List
<
AttendanceWeeklySch
>
attweeklist
=
new
ArrayList
<
AttendanceWeeklySch
>();
String
[]
weektime
=
attass
.
getAttWeekdays
();
//周工作日【固定排班】
String
[]
weekshif
=
attass
.
getAttWeekdaysShifts
();
//周工作日班次【固定排班】
if
(
weektime
.
length
>
0
&&
weekshif
.
length
>
0
&&
attass
.
getAtttype
()
==
1
){
for
(
int
h
=
0
;
h
<
weektime
.
length
;
h
++){
AttendanceWeeklySch
attweek
=
new
AttendanceWeeklySch
();
attweek
.
setKqzid
(
attid
);
attweek
.
setType
(
Integer
.
valueOf
(
weektime
[
h
]));
attweek
.
setBcid
(
Integer
.
valueOf
(
weekshif
[
h
]));
attweeklist
.
add
(
attweek
);
}
}
//自由工时 周排班
String
[]
attFrWorkdays
=
attass
.
getAttFreeWorkdays
();
// 周工作日【自由工时】
if
(
attFrWorkdays
.
length
>
0
&&
attass
.
getAtttype
()
==
3
){
for
(
int
w
=
0
;
w
<
attFrWorkdays
.
length
;
w
++){
AttendanceWeeklySch
attfrwor
=
new
AttendanceWeeklySch
();
attfrwor
.
setKqzid
(
attid
);
attfrwor
.
setType
(
Integer
.
valueOf
(
attFrWorkdays
[
w
]));
attfrwor
.
setBcid
(
0
);
attweeklist
.
add
(
attfrwor
);
}
}
if
(
attweeklist
.
size
()>
0
){
attendanceweeklyschservice
.
insertKqglAssoZhoupaibanList
(
attweeklist
);
}
//特殊日期--必须打卡、不用打卡日期
List
<
SpecialDate
>
speclist
=
new
ArrayList
<
SpecialDate
>();
String
[]
attmuspudata
=
attass
.
getAttMustPunchData
();
// 必须打卡的日期【固定排班】
String
[]
attmuspushifid
=
attass
.
getAttMustPunchShifid
();
// 必须打卡的班次id【固定排班】
String
[]
attnonpudata
=
attass
.
getAttNonPunchData
();
// 不用打卡的日期【固定排班】
if
(
attmuspudata
.
length
>
0
&&
attmuspushifid
.
length
>
0
&&
attass
.
getAtttype
()
==
1
){
for
(
int
m
=
0
;
m
<
attmuspudata
.
length
;
m
++){
SpecialDate
mut
=
new
SpecialDate
();
mut
.
setKqzid
(
attid
);
//考勤组id
mut
.
setTsrq
(
attmuspudata
[
m
]);
//日期
mut
.
setBcid
(
Integer
.
valueOf
(
attmuspushifid
[
m
]));
//班次id
long
date
=
new
Date
().
getTime
();
mut
.
setLusjTime
(
date
);
//录入时间
mut
.
setLuryid
(
180658
);
// 录入人员***********
mut
.
setType
(
1
);
// 类型 1:必须打卡日期;2:不用打卡日期(扩展字段)
speclist
.
add
(
mut
);
}
}
if
(
attnonpudata
.
length
>
0
&&
attass
.
getAtttype
()
==
1
){
for
(
int
n
=
0
;
n
<
attnonpudata
.
length
;
n
++){
SpecialDate
non
=
new
SpecialDate
();
non
.
setKqzid
(
attid
);
//考勤组id
non
.
setTsrq
(
attnonpudata
[
n
]);
//日期
non
.
setBcid
(
0
);
//班次id
long
date
=
new
Date
().
getTime
();
non
.
setLusjTime
(
date
);
//录入时间
non
.
setLuryid
(
180658
);
// 录入人员***********
non
.
setType
(
2
);
// 类型 1:必须打卡日期;2:不用打卡日期(扩展字段)
speclist
.
add
(
non
);
}
}
if
(
speclist
.
size
()>
0
){
specialdateservice
.
insertKqglAssoTeshuList
(
speclist
);
}
//记录排班(排班制)
List
<
Schedule
>
schlist
=
new
ArrayList
<
Schedule
>();
Schedule
[]
schedules
=
attass
.
getSchedules
();
// 排班日期【排班制】--班次id、日期
if
(
schedules
.
length
>
0
&&
attass
.
getAtttype
()
==
2
){
for
(
int
p
=
0
;
p
<
schedules
.
length
;
p
++){
Schedule
sch
=
new
Schedule
();
sch
.
setUserid
(
schedules
[
p
].
getUserid
());
sch
.
setData
(
schedules
[
p
].
getData
());
sch
.
setBcid
(
schedules
[
p
].
getBcid
());
sch
.
setKqzid
(
attid
);
schlist
.
add
(
sch
);
}
}
if
(
schlist
.
size
()>
0
){
scheduleservice
.
insertKqglAssoPbmxList
(
schlist
);
}
return
ResultUtil
.
data
(
null
,
"新增打卡WIFI成功"
);
//return ResultUtil.error("新增考勤组失败");
}
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
[
4
+
bytText
.
length
]
=
0
;
return
bytCmd
;
}
catch
(
Exception
e
){
e
.
printStackTrace
();
bytCmd
=
new
byte
[
0
];
return
bytCmd
;
}
}
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
;
}
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
;
}
public
String
MakeCmd
(
String
Cmd
,
String
mDevId
,
byte
[]
mParam
)
throws
Exception
{
String
mTransID
;
mTransID
=
GetNewTransId
();
if
(
mDevId
==
null
)
throw
new
Exception
(
"DevId is null!"
);
switch
(
Cmd
){
case
"GET_USER_ID_LIST"
:
break
;
}
try
{
attendancegroupservice
.
deleteTBlFkcmdTransCmdParamByTransId
(
mTransID
);
attendancegroupservice
.
deleteTBlFkcmdTransCmdResultByTransId
(
mTransID
);
if
(
mParam
!=
null
&&
mParam
.
length
>
0
){
TBlFkcmdTransCmdParam
param
=
new
TBlFkcmdTransCmdParam
();
param
.
setTransId
(
mTransID
);
param
.
setCmdParam
(
mParam
);
param
.
setDeviceId
(
mDevId
);
attendancegroupservice
.
insertTBlFkcmdTransCmdParam
(
param
);
}
TBlFkcmdTrans
fkcmdTrans
=
new
TBlFkcmdTrans
();
fkcmdTrans
.
setTransId
(
mTransID
);
fkcmdTrans
.
setDeviceId
(
mDevId
);
fkcmdTrans
.
setCmdCode
(
Cmd
);
fkcmdTrans
.
setStatus
(
"WAIT"
);
fkcmdTrans
.
setUpdateTime
(
TimeToString
(
new
Date
()));
attendancegroupservice
.
insertTBlFkcmdTrans
(
fkcmdTrans
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
// log.error(e.getMessage(),e);
}
return
mTransID
;
}
public
String
GetNewTransId
(){
int
nTransId
;
String
sTransId
=
attendancegroupservice
.
selectTBlFkcmdTransNum
();
if
(
sTransId
==
""
||
sTransId
==
null
){
sTransId
=
"200"
;
}
nTransId
=
Integer
.
parseInt
(
sTransId
)
+
1
;
return
String
.
valueOf
(
nTransId
);
}
public
static
String
TimeToString
(
Date
date
)
{
String
strRet
;
try
{
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
strRet
=
sdf
.
format
(
date
);
return
strRet
;
}
catch
(
Exception
e
)
{
return
"1970-1-1 1:0:0"
;
}
}
/**
* 获取修改的排班明细--【修改考勤组】--------------------------------------------------------------------------------------
*/
@PostMapping
(
value
=
"/AttGroupSchedulingList"
)
@ApiOperation
(
value
=
"获取修改的排班明细"
,
httpMethod
=
"POST"
,
notes
=
"接口发布说明"
)
@ApiOperationSupport
(
order
=
29
)
public
Result
<
List
<
Schedule
>>
getAttGroupSchedulingList
(
@CurrentUser
UserBean
userBean
,
@RequestBody
AttScheduling
attscheduling
)
{
int
qyid
=
userBean
.
getOrgCode
();
//坏小孩【企业id】
int
userid
=
userBean
.
getEmpNum
();
//用户id
Date
d
=
new
Date
();
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy-MM"
);
String
str
=
sdf
.
format
(
d
);
String
date
=
attscheduling
.
getDate
();
if
((
""
).
equals
(
date
)
||
date
==
null
){
attscheduling
.
setDate
(
str
);
}
attscheduling
.
setQyid
(
qyid
);
List
<
Schedule
>
schlist
=
scheduleservice
.
selectAttGroupScheduling
(
attscheduling
);
return
ResultUtil
.
data
(
schlist
);
}
/**
* 根据考勤组id获取班次信息--【修改考勤组】
*/
@GetMapping
(
value
=
"/roster/{id}/{date}"
)
@ApiOperation
(
value
=
"根据考勤组id获取班次信息"
,
httpMethod
=
"GET"
,
notes
=
"接口发布说明"
)
@ApiOperationSupport
(
order
=
30
)
public
Result
<
List
<
ShiftManagement
>>
getRosterList
(
@PathVariable
(
"id"
)
Integer
id
,
@PathVariable
(
"date"
)
String
date
)
{
KqzAttendanceGroupSearch
jycx
=
new
KqzAttendanceGroupSearch
();
jycx
.
setOverall
(
date
);
jycx
.
setQyid
(
id
);
List
<
ShiftManagement
>
shifs
=
shiftmanagementservice
.
selectRosterByKqzid
(
jycx
);
return
ResultUtil
.
data
(
shifs
);
}
/**
* 修改考勤组排班(修改排班后,需判断是否有打卡记录,有则匹配当天修改后的班次,无则不需要修改)
*/
@SuppressWarnings
({
"unused"
,
"deprecation"
})
@PutMapping
(
value
=
"/attscheduling"
)
@ApiOperationSupport
(
order
=
31
)
@ApiOperation
(
value
=
"修改班次信息"
,
httpMethod
=
"PUT"
,
notes
=
"接口发布说明"
)
public
Result
<
List
<
Schedule
>>
updateAttscheduling
(
@CurrentUser
UserBean
userBean
,
@RequestBody
AttendanceAssistant
attass
)
{
int
id
=
Integer
.
valueOf
(
attass
.
getAttgroupid
());
//修改数据id
int
qyid
=
userBean
.
getOrgCode
();
//坏小孩【企业id】
int
userid
=
userBean
.
getEmpNum
();
//用户id
AttendanceGroup
qttgrop
=
attendancegroupservice
.
selectByPrimaryKey
(
Integer
.
valueOf
(
attass
.
getAttgroupid
()));
AttendanceGroup
qttgrop
=
attendancegroupservice
.
selectByPrimaryKey
(
Integer
.
valueOf
(
attass
.
getAttgroupid
()));
//记录排班(排班制)
List
<
Schedule
>
schlist
=
new
ArrayList
<
Schedule
>();
...
...
@@ -5779,881 +5068,6 @@ public class AttController {
return
ResultUtil
.
success
(
"成功"
);
}
@GetMapping
(
value
=
"/synchrotime/{code}"
)
@ApiOperation
(
value
=
"考勤机一键同步"
,
httpMethod
=
"GET"
,
notes
=
"接口发布说明"
)
@ApiOperationSupport
(
order
=
54
)
public
Result
<
AttemacDto
>
SynchronizationTime
(
@CurrentUser
UserBean
userBean
,
@PathVariable
(
"code"
)
String
code
)
{
String
sNowTxt
=
DateUtil
.
getStringFormat
(
System
.
currentTimeMillis
(),
"yyyyMMddHHmmss"
);
JSONObject
vResultJson
=
new
JSONObject
();
vResultJson
.
put
(
"time"
,
sNowTxt
);
String
sFinal
=
vResultJson
.
toString
();
String
url
=
StaticVariable
.
mac_command
;
HttpHeaders
headers
=
new
HttpHeaders
();
MultiValueMap
<
String
,
Object
>
params
=
new
LinkedMultiValueMap
<>();
params
.
add
(
"cmd"
,
"SET_TIME"
);
params
.
add
(
"devid"
,
code
);
params
.
add
(
"json"
,
sFinal
);
RestTemplate
restTemplate
=
new
RestTemplate
();
HttpEntity
httpEntity
=
new
HttpEntity
(
params
,
headers
);
try
{
ResponseEntity
<
String
>
request
=
restTemplate
.
postForEntity
(
url
,
httpEntity
,
String
.
class
);
}
catch
(
RestClientException
e
)
{
// e.printStackTrace();
System
.
err
.
println
(
"提示:考勤机服务出错"
);
return
ResultUtil
.
success
(
"失败"
);
}
return
ResultUtil
.
success
(
"成功"
);
}
/**
* 移除考勤机管理员
*/
@PostMapping
(
value
=
"/removeadministrator/{kqjid}/{id}"
)
@ApiOperation
(
value
=
"移除考勤机管理员"
,
httpMethod
=
"POST"
,
notes
=
"接口发布说明"
)
@ApiOperationSupport
(
order
=
55
)
public
Result
<
Void
>
RemoveAdministrator
(
@PathVariable
int
kqjid
,
@PathVariable
int
id
,
@RequestBody
Map
<
String
,
String
>
mmd
)
{
String
[]
xgyh
=
mmd
.
get
(
"a"
).
split
(
","
);
if
(
xgyh
.
length
>
0
){
for
(
int
a
=
0
;
a
<
xgyh
.
length
;
a
++){
AttendanceMachine
kqj
=
attendancemachineservice
.
selectByPrimaryKey
(
kqjid
);
//查询考勤机“序列号”
JSONObject
vResultJson
=
new
JSONObject
();
vResultJson
.
put
(
"user_id"
,
xgyh
[
a
]);
vResultJson
.
put
(
"user_privilege"
,
"USER"
);
String
sFinal
=
vResultJson
.
toString
();
String
url
=
StaticVariable
.
mac_command
;
HttpHeaders
headers
=
new
HttpHeaders
();
MultiValueMap
<
String
,
Object
>
params
=
new
LinkedMultiValueMap
<>();
params
.
add
(
"cmd"
,
"SET_USER_INFO"
);
params
.
add
(
"devid"
,
kqj
.
getCode
());
params
.
add
(
"json"
,
sFinal
);
RestTemplate
restTemplate
=
new
RestTemplate
();
HttpEntity
httpEntity
=
new
HttpEntity
(
params
,
headers
);
ResponseEntity
<
String
>
request
=
restTemplate
.
postForEntity
(
url
,
httpEntity
,
String
.
class
);
UserEquiRelation
kqjry
=
new
UserEquiRelation
();
kqjry
.
setId
(
id
);
kqjry
.
setIsGly
(
0
);
userequirelationmapper
.
updateByPrimaryKeySelective
(
kqjry
);
}
}
return
ResultUtil
.
success
(
"成功"
);
}
@GetMapping
(
value
=
"/aircraftmembers/{id}"
)
@ApiOperation
(
value
=
"考勤机成员"
,
httpMethod
=
"GET"
,
notes
=
"接口发布说明"
)
@ApiOperationSupport
(
order
=
56
)
public
ResponseResult
selectAircraftMembers
(
@CurrentUser
UserBean
userBean
,
@PathVariable
(
"id"
)
Integer
id
)
{
Integer
orgCode
=
userBean
.
getOrgCode
();
List
<
MachinememberDto
>
kqjcys
=
userequirelationmapper
.
selectAircraftMembers
(
id
,
orgCode
);
return
new
ResponseResult
().
success
(
"考勤机成员"
,
kqjcys
);
}
// asDevId //考勤机编号
// asUserId //打卡用户id
// asVerifyMode //打卡方式 1:指纹 20:人脸
// asIOMode
// sStdIoTime //打卡时间
@PostMapping
(
value
=
"/punchclock"
)
@ApiOperation
(
value
=
"考勤机打卡"
,
httpMethod
=
"POST"
,
notes
=
"接口发布说明"
)
public
ResponseResult
punchclock
(
@RequestParam
String
json
)
{
JSONObject
jsonArray
=
new
JSONObject
(
json
);
String
asDevId
=
jsonArray
.
get
(
"asDevId"
).
toString
();
String
asUserId
=
jsonArray
.
get
(
"asUserId"
).
toString
();
String
asVerifyMode
=
jsonArray
.
get
(
"asVerifyMode"
).
toString
();
String
asIOMode
=
"0"
;
String
sStdIoTime
=
jsonArray
.
get
(
"sStdIoTime"
).
toString
();
AttendanceMachine
kqjdev
=
attendancemachineservice
.
selectByQyidDev
(
asDevId
);
/***********************************************************考勤机打卡(开始)********************************************************************************************/
YgglMainEmp
user
=
new
LambdaQueryChainWrapper
<
YgglMainEmp
>(
ygglmainempmapper
).
eq
(
YgglMainEmp:
:
getEmpNum
,
asUserId
).
eq
(
YgglMainEmp:
:
getOrgCode
,
kqjdev
.
getQyid
()).
one
();
if
(
user
!=
null
)
{
int
qyid
=
user
.
getOrgCode
();
//坏小孩【企业id】
int
userid
=
user
.
getEmpNum
();
//用户id
AttendanceGroup
attgro
=
attendancegroupservice
.
getAttendanceGroupInformationByUserid
(
userid
,
qyid
);
//考勤组信息
//pbfs;// 排班方式 1:固定排班;2:自由排班;3:自由工时
if
(
attgro
!=
null
)
{
List
<
AttGroupBinPunchMode
>
kqjs
=
attgroupbinpunchmodeservice
.
selectMachineByKqzId
(
attgro
.
getId
());
//该考勤组所绑定的考勤机
if
(
kqjs
.
size
()
>
0
)
{
long
time_
=
0
;
try
{
time_
=
DateUtil
.
getStringTime
(
sStdIoTime
,
"yyyy-MM-dd HH:mm:ss"
);
}
catch
(
ParseException
e1
)
{
e1
.
printStackTrace
();
}
//打卡时间戳
String
putime
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
).
format
(
time_
);
//转换打卡时间格式
Long
startDate
=
0
l
;
//打卡当天开始时间
Long
endDate
=
0
l
;
//打卡当天结束时间
try
{
startDate
=
DateUtil
.
getStartTime
(
0
,
DateUtil
.
getStringTime
(
putime
,
"yyyy-MM-dd"
)).
getTime
();
endDate
=
DateUtil
.
getnowEndTime
(
23
,
DateUtil
.
getStringTime
(
putime
,
"yyyy-MM-dd"
)).
getTime
();
}
catch
(
ParseException
e
)
{
e
.
printStackTrace
();
}
int
dkmx
=
0
;
PunchCardDetails
dkmc
=
punchcarddetailsservice
.
SingleAttendanceDays
(
userid
,
startDate
,
endDate
);
//查询打卡当天是否有记录
AttendanceCardList
attdate
=
MethodCall
(
qyid
,
userid
,
putime
);
ClockCollectData
clockt
=
new
ClockCollectData
();
long
starttime1
=
0
;
long
starttime1ks
=
0
;
long
starttime1js
=
0
;
long
endtime1
=
0
;
long
endtime1ks
=
0
;
long
endtime1js
=
0
;
long
starttime2
=
0
;
long
starttime2ks
=
0
;
long
starttime2js
=
0
;
long
endtime2
=
0
;
long
endtime2ks
=
0
;
long
endtime2js
=
0
;
long
starttime3
=
0
;
long
starttime3ks
=
0
;
long
starttime3js
=
0
;
long
endtime3
=
0
;
long
endtime3ks
=
0
;
long
endtime3js
=
0
;
if
(
attdate
.
getAttsch
().
size
()
>
0
)
{
List
<
AttSchedule
>
ash
=
attdate
.
getAttsch
();
int
y
=
0
;
clockt
.
setShifid
(
ash
.
get
(
y
).
getId
());
if
(
attdate
.
getAttsch
().
size
()
==
2
||
attdate
.
getAttsch
().
size
()
==
4
||
attdate
.
getAttsch
().
size
()
==
6
)
{
starttime1
=
ash
.
get
(
0
).
getTime
();
starttime1ks
=
ash
.
get
(
0
).
getStarttime
();
starttime1js
=
ash
.
get
(
0
).
getEndtime
();
endtime1
=
ash
.
get
(
1
).
getTime
();
endtime1ks
=
ash
.
get
(
1
).
getStarttime
();
endtime1js
=
ash
.
get
(
1
).
getEndtime
();
}
if
(
attdate
.
getAttsch
().
size
()
==
4
||
attdate
.
getAttsch
().
size
()
==
6
)
{
starttime2
=
ash
.
get
(
2
).
getTime
();
starttime2ks
=
ash
.
get
(
2
).
getStarttime
();
starttime2js
=
ash
.
get
(
2
).
getEndtime
();
endtime2
=
ash
.
get
(
3
).
getTime
();
endtime2ks
=
ash
.
get
(
3
).
getStarttime
();
endtime2js
=
ash
.
get
(
3
).
getEndtime
();
}
if
(
attdate
.
getAttsch
().
size
()
==
6
)
{
starttime3
=
ash
.
get
(
4
).
getTime
();
starttime3ks
=
ash
.
get
(
4
).
getStarttime
();
starttime3js
=
ash
.
get
(
4
).
getEndtime
();
endtime3
=
ash
.
get
(
5
).
getTime
();
endtime3ks
=
ash
.
get
(
5
).
getStarttime
();
endtime3js
=
ash
.
get
(
5
).
getEndtime
();
}
}
long
punchcardtime
=
0
;
//应打卡时间
long
punchstart
=
0
;
//应打卡开始时间
long
punchend
=
0
;
//应打卡结束时间
int
atttype
=
0
;
if
(
dkmc
==
null
)
{
//上班1 ****新增
punchcardtime
=
starttime1
;
punchstart
=
starttime1ks
;
punchend
=
starttime1js
;
atttype
=
1
;
}
else
{
if
((!(
""
).
equals
(
dkmc
.
getSbdk1
())
||
dkmc
.
getSbdk1
()
!=
null
)
&&
((
""
).
equals
(
dkmc
.
getXbdk1
())
||
dkmc
.
getXbdk1
()
==
null
)){
//下班1
punchcardtime
=
endtime1
;
punchstart
=
endtime1ks
;
punchend
=
endtime1js
;
atttype
=
2
;
}
else
if
((!(
""
).
equals
(
dkmc
.
getSbdk1
())
||
dkmc
.
getSbdk1
()
!=
null
)
&&
(!(
""
).
equals
(
dkmc
.
getXbdk1
())
||
dkmc
.
getXbdk1
()
!=
null
)
&&
((
""
).
equals
(
dkmc
.
getSbdk2
())
||
dkmc
.
getSbdk2
()
==
null
)){
//上班2
punchcardtime
=
starttime2
;
punchstart
=
starttime2ks
;
punchend
=
starttime2js
;
atttype
=
3
;
}
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
punchcardtime
=
endtime2
;
punchstart
=
endtime2ks
;
punchend
=
endtime2js
;
atttype
=
4
;
}
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
punchcardtime
=
starttime3
;
punchstart
=
starttime3ks
;
punchend
=
starttime3js
;
atttype
=
5
;
}
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
punchcardtime
=
endtime3
;
punchstart
=
endtime3ks
;
punchend
=
endtime3js
;
atttype
=
6
;
}
else
{
punchcardtime
=
0
;
punchstart
=
0
;
punchend
=
0
;
atttype
=
7
;
}
}
ShiftManagement
shif
=
null
;
if
(
attdate
.
getAttsch
().
size
()
>
0
&&
clockt
.
getShifid
()
>
0
){
//有无班次
shif
=
shiftmanagementservice
.
selectByPrimaryKey
(
clockt
.
getShifid
());
}
//打卡记录录入*****************************************************************************************************************************
//打卡是否有时间范围限制
boolean
isRange
=
true
;
if
(
punchstart
>
0
&&
punchend
>
0
)
{
String
staputime
=
new
SimpleDateFormat
(
"HH:mm"
).
format
(
punchstart
);
//应打卡开始时间
String
entputime
=
new
SimpleDateFormat
(
"HH:mm"
).
format
(
punchend
);
//应打卡结束时间
String
DKputime
=
new
SimpleDateFormat
(
"HH:mm"
).
format
(
time_
);
//打卡时间
System
.
out
.
println
(
staputime
);
System
.
out
.
println
(
entputime
);
System
.
out
.
println
(
DKputime
);
boolean
effectiveDate
=
false
;
try
{
effectiveDate
=
hourMinuteBetween
(
DKputime
,
staputime
,
entputime
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
if
(
effectiveDate
)
{
System
.
out
.
println
(
"当前时间在范围内"
);
}
else
{
System
.
out
.
println
(
"当前时间在不在范围内"
);
isRange
=
false
;
}
}
if
(
isRange
)
{
if
(
dkmc
==
null
)
{
//上班1 ****新增
PunchCardDetails
pcd
=
new
PunchCardDetails
();
pcd
.
setUserid
(
userid
);
pcd
.
setData
(
putime
);
//打卡日期(yyyy-MM-dd)
pcd
.
setSbdk1
(
time_
);
//上班1打卡时间
if
(
punchcardtime
!=
0
){
//有应打卡时间时
Long
time
=
(
time_
-
punchcardtime
)/
1000
/
60
;
if
(
time
>
0
){
pcd
.
setSbdk1jg
(
Math
.
abs
(
Integer
.
valueOf
(
time
.
toString
())));
//上班1打卡结果
}
else
{
pcd
.
setSbdk1jg
(
0
);
// 打卡结果
}
}
if
(
shif
!=
null
){
pcd
.
setYdkcs
(
shif
.
getSxbcs
()*
2
);
//应打卡次数
}
pcd
.
setQyid
(
qyid
);
//企业id
pcd
.
setDksj
(
startDate
);
//打卡时间
punchcarddetailsservice
.
insertSelective
(
pcd
);
dkmx
=
pcd
.
getId
();
}
else
{
//*****修改
dkmx
=
dkmc
.
getId
();
PunchCardDetails
pcd
=
new
PunchCardDetails
();
if
((!(
""
).
equals
(
dkmc
.
getSbdk1
())
||
dkmc
.
getSbdk1
()
!=
null
)
&&
((
""
).
equals
(
dkmc
.
getXbdk1
())
||
dkmc
.
getXbdk1
()
==
null
)){
//下班1
pcd
.
setId
(
dkmc
.
getId
());
pcd
.
setXbdk1
(
time_
);
//下班1打卡时间
if
(
punchcardtime
!=
0
){
//有应打卡时间时
Long
time
=
(
time_
-
punchcardtime
)/
1000
/
60
;
if
(
time
>
0
){
pcd
.
setXbdk1jg
(
0
);
// 打卡结果
}
else
{
pcd
.
setXbdk1jg
(
Math
.
abs
(
Integer
.
valueOf
(
time
.
toString
())));
//上班1打卡结果
}
}
if
(
dkmc
.
getSbdk1
()
!=
null
){
Long
time
=
(
time_
-
dkmc
.
getSbdk1
())/
1000
/
60
;
pcd
.
setGzsc
(
Math
.
abs
(
Double
.
valueOf
(
time
.
toString
())));
//只打一次卡时计算工作时长
}
punchcarddetailsservice
.
updateByPrimaryKeySelective
(
pcd
);
//修改打卡记录
}
else
if
((!(
""
).
equals
(
dkmc
.
getSbdk1
())
||
dkmc
.
getSbdk1
()
!=
null
)
&&
(!(
""
).
equals
(
dkmc
.
getXbdk1
())
||
dkmc
.
getXbdk1
()
!=
null
)
&&
((
""
).
equals
(
dkmc
.
getSbdk2
())
||
dkmc
.
getSbdk2
()
==
null
)){
//上班2
pcd
.
setId
(
dkmc
.
getId
());
pcd
.
setSbdk2
(
time_
);
//上班1打卡时间
if
(
punchcardtime
!=
0
){
//有应打卡时间时
Long
time
=
(
time_
-
punchcardtime
)/
1000
/
60
;
if
(
time
>
0
){
pcd
.
setSbdk2jg
(
Math
.
abs
(
Integer
.
valueOf
(
time
.
toString
())));
}
else
{
pcd
.
setSbdk2jg
(
0
);
// 打卡结果
}
}
punchcarddetailsservice
.
updateByPrimaryKeySelective
(
pcd
);
//修改打卡记录
}
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
pcd
.
setId
(
dkmc
.
getId
());
pcd
.
setXbdk2
(
time_
);
//下班1打卡时间
if
(
punchcardtime
!=
0
){
//有应打卡时间时
Long
time
=
(
time_
-
punchcardtime
)/
1000
/
60
;
if
(
time
>
0
){
pcd
.
setXbdk2jg
(
0
);
// 打卡结果
}
else
{
pcd
.
setXbdk2jg
(
Math
.
abs
(
Integer
.
valueOf
(
time
.
toString
())));
}
}
//班次为4次时,计算工作时长
if
(
dkmc
.
getSbdk2
()
!=
null
){
Long
time
=
(
time_
-
dkmc
.
getSbdk2
())/
1000
/
60
;
BigDecimal
om
=
new
BigDecimal
(
dkmc
.
getGzsc
());
BigDecimal
on
=
new
BigDecimal
(
time
);
double
worktime
=
Math
.
abs
(
om
.
add
(
on
).
doubleValue
());
pcd
.
setGzsc
(
worktime
);
}
punchcarddetailsservice
.
updateByPrimaryKeySelective
(
pcd
);
//修改打卡记录
}
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
pcd
.
setId
(
dkmc
.
getId
());
pcd
.
setSbdk3
(
time_
);
//上班1打卡时间
if
(
punchcardtime
!=
0
){
//有应打卡时间时
Long
time
=
(
time_
-
punchcardtime
)/
1000
/
60
;
if
(
time
>
0
){
pcd
.
setSbdk3jg
(
Math
.
abs
(
Integer
.
valueOf
(
time
.
toString
())));
}
else
{
pcd
.
setSbdk3jg
(
0
);
// 打卡结果
}
}
punchcarddetailsservice
.
updateByPrimaryKeySelective
(
pcd
);
//修改打卡记录
}
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
pcd
.
setId
(
dkmc
.
getId
());
pcd
.
setXbdk3
(
time_
);
//下班1打卡时间
if
(
punchcardtime
!=
0
){
//有应打卡时间时
Long
time
=
(
time_
-
punchcardtime
)/
1000
/
60
;
if
(
time
>
0
){
pcd
.
setXbdk3jg
(
0
);
// 打卡结果
}
else
{
pcd
.
setXbdk3jg
(
Math
.
abs
(
Integer
.
valueOf
(
time
.
toString
())));
}
}
//班次为6次时,计算工作时长
if
(
dkmc
.
getSbdk3
()
!=
null
){
Long
time
=
(
time_
-
dkmc
.
getSbdk3
())/
1000
/
60
;
BigDecimal
om
=
new
BigDecimal
(
dkmc
.
getGzsc
());
//第二次
BigDecimal
on
=
new
BigDecimal
(
time
);
double
worktime
=
Math
.
abs
(
om
.
add
(
on
).
doubleValue
());
pcd
.
setGzsc
(
worktime
);
}
}
pcd
.
setId
(
dkmc
.
getId
());
if
(
atttype
<=
6
){
int
update
=
punchcarddetailsservice
.
updateByPrimaryKeySelective
(
pcd
);
//修改打卡记录
}
}
}
//原始打卡记录数据录入**************************************************************************************************************************************
PunchRecord
pre
=
new
PunchRecord
();
pre
.
setDktime
(
time_
);
// 打卡时间
Long
time
=
(
time_
-
punchcardtime
)/
1000
/
60
;
if
(
punchcardtime
==
0
){
pre
.
setResults
(
0
);
// 打卡结果
}
else
{
if
(
isRange
)
{
if
((
atttype
)%
2
>
0
){
//上班
if
(
time
>
0
){
pre
.
setResults
(
Integer
.
valueOf
(
time
.
toString
()));
// 打卡结果
}
else
{
pre
.
setResults
(
0
);
// 打卡结果
}
}
else
{
//下班
if
(
time
>
0
){
pre
.
setResults
(
0
);
// 打卡结果
}
else
{
pre
.
setResults
(
Math
.
abs
(
Integer
.
valueOf
(
time
.
toString
())));
// 打卡结果
}
}
}
else
{
pre
.
setResults
(
0
);
// 打卡结果
}
}
pre
.
setUserId
(
userid
);
// 用户id
if
((
atttype
)%
2
>
0
){
pre
.
setType
(
1
);
// 类型(类型 0:无排班打卡 1:上班 2:下班)
if
(
punchcardtime
==
0
){
//无班次打卡
pre
.
setStatus
(
1
);
}
else
{
if
(
isRange
)
{
//打卡
if
(
time
>
0
){
pre
.
setStatus
(
3
);
// 状态(0:打卡无效:此记录已被更新 1:正常 2:异常 3:迟到 4:早退 5:补卡 6:请假 7:加班 8:调休)
}
else
if
(
pre
.
getResults
()
==
0
){
pre
.
setStatus
(
1
);
// 状态(0:打卡无效:此记录已被更新 1:正常 2:异常 3:迟到 4:早退 5:补卡 6:请假 7:加班 8:调休)
}
}
else
{
pre
.
setStatus
(
2
);
// 状态(0:打卡无效:此记录已被更新 1:正常 2:异常 3:迟到 4:早退 5:补卡 6:请假 7:加班 8:调休)
}
}
}
else
{
pre
.
setType
(
2
);
// 类型(类型 0:无排班打卡 1:上班 2:下班)
if
(
punchcardtime
==
0
){
//无班次打卡
pre
.
setStatus
(
1
);
}
else
{
if
(
isRange
)
{
//打卡
if
(
time
<
0
){
pre
.
setStatus
(
4
);
// 状态(0:打卡无效:此记录已被更新 1:正常 2:异常 3:迟到 4:早退 5:补卡 6:请假 7:加班 8:调休)
}
else
if
(
pre
.
getResults
()
==
0
){
pre
.
setStatus
(
1
);
// 状态(0:打卡无效:此记录已被更新 1:正常 2:异常 3:迟到 4:早退 5:补卡 6:请假 7:加班 8:调休)
}
}
else
{
pre
.
setStatus
(
2
);
// 状态(0:打卡无效:此记录已被更新 1:正常 2:异常 3:迟到 4:早退 5:补卡 6:请假 7:加班 8:调休)
}
}
}
pre
.
setSort
(
atttype
);
// 序号
pre
.
setCardType
(
3
);
// 打卡类型(1:GPS,2:WIFI,3:考勤机)
pre
.
setQyid
(
qyid
);
// 企业id
String
attdate_
=
new
SimpleDateFormat
(
"yy-MM-dd"
).
format
(
Double
.
valueOf
(
startDate
));
//转换打卡时间格式
pre
.
setAttdate
(
attdate_
+
" "
+
dateToWeek2
(
putime
));
// 考勤日期
long
date
=
new
Date
().
getTime
();
if
(
punchcardtime
==
0
&&
!
isRange
){
pre
.
setAttime
(
date
);
// 考勤时间(应打卡时间)
}
else
{
pre
.
setAttime
(
punchcardtime
);
// 考勤时间(应打卡时间)
}
pre
.
setDkmxid
(
dkmx
);
// 打卡明细id
pre
.
setBcid
(
clockt
.
getShifid
());
// 班次id
if
((
"1"
).
equals
(
asVerifyMode
))
{
pre
.
setRemarks
(
"考勤机指纹打卡"
);
}
else
if
((
"20"
).
equals
(
asVerifyMode
))
{
pre
.
setRemarks
(
"考勤机人脸打卡"
);
}
pre
.
setPunchmode
(
Integer
.
valueOf
(
asVerifyMode
));
pre
.
setPunchequipment
(
asDevId
);
//
punchrecordservice
.
insertSelective
(
pre
);
//新增打卡记录
}
}
}
/***********************************************************考勤机打卡(结束)********************************************************************************************/
return
new
ResponseResult
().
success
(
"考勤机打卡成功"
,
null
);
}
/**
*
* @param nowDate 要比较的时间
* @param startDate 开始时间
* @param endDate 结束时间
* @return true在时间段内,false不在时间段内
* @throws Exception
*/
public
static
boolean
hourMinuteBetween
(
String
nowDate
,
String
startDate
,
String
endDate
)
throws
Exception
{
SimpleDateFormat
format
=
new
SimpleDateFormat
(
"HH:mm"
);
Date
now
=
format
.
parse
(
nowDate
);
Date
start
=
format
.
parse
(
startDate
);
Date
end
=
format
.
parse
(
endDate
);
long
nowTime
=
now
.
getTime
();
long
startTime
=
start
.
getTime
();
long
endTime
=
end
.
getTime
();
return
nowTime
>=
startTime
&&
nowTime
<=
endTime
;
}
@PostMapping
(
value
=
"/removeuser/{kqjid}"
)
@ApiOperation
(
value
=
"批量移除用户"
,
httpMethod
=
"POST"
,
notes
=
"接口发布说明"
)
@ApiOperationSupport
(
order
=
56
)
public
Result
<
Void
>
RemoveUser
(
@PathVariable
int
kqjid
,
@RequestBody
Map
<
String
,
String
>
mmd
)
{
String
[]
xgyh
=
mmd
.
get
(
"a"
).
split
(
","
);
if
(
xgyh
.
length
>
0
){
for
(
int
a
=
0
;
a
<
xgyh
.
length
;
a
++){
UserEquiRelation
scyhkqj
=
userequirelationmapper
.
selectByuserIdkqjid
(
Integer
.
valueOf
(
xgyh
[
a
]),
kqjid
);
AttendanceMachine
kqj
=
attendancemachineservice
.
selectByPrimaryKey
(
scyhkqj
.
getKqjid
());
//查询考勤机“序列号”
JSONObject
vResultJson
=
new
JSONObject
();
vResultJson
.
put
(
"user_id"
,
scyhkqj
.
getUserId
());
String
sFinal
=
vResultJson
.
toString
();
String
url
=
StaticVariable
.
mac_command
;
HttpHeaders
headers
=
new
HttpHeaders
();
MultiValueMap
<
String
,
Object
>
params
=
new
LinkedMultiValueMap
<>();
params
.
add
(
"cmd"
,
"DELETE_USER"
);
params
.
add
(
"devid"
,
kqj
.
getCode
());
params
.
add
(
"json"
,
sFinal
);
RestTemplate
restTemplate
=
new
RestTemplate
();
HttpEntity
httpEntity
=
new
HttpEntity
(
params
,
headers
);
try
{
ResponseEntity
<
String
>
request
=
restTemplate
.
postForEntity
(
url
,
httpEntity
,
String
.
class
);
}
catch
(
RestClientException
e
)
{
// e.printStackTrace();
System
.
err
.
println
(
"提示:考勤机服务出错"
);
return
ResultUtil
.
success
(
"失败"
);
}
userequirelationmapper
.
deleteByPrimaryKey
(
scyhkqj
.
getId
());
//该用户是否为管理员 否则一同删除
// KqglAssoKqjgly gly = new LambdaQueryChainWrapper<KqglAssoKqjgly>(kqglassokqjglymapper).eq(KqglAssoKqjgly::getKqjid, kqjid)
// .eq(KqglAssoKqjgly::getUserid, xgyh[a]).one();
//
// if(gly != null){
// KqglAssoKqjgly.builder().build().deleteById(gly.getId());
// }
}
}
return
ResultUtil
.
success
(
"成功"
);
}
@PostMapping
(
value
=
"/modifyauthority/{kqjid}/{id}"
)
@ApiOperation
(
value
=
"添加考勤机管理员"
,
httpMethod
=
"POST"
,
notes
=
"接口发布说明"
)
@ApiOperationSupport
(
order
=
55
)
public
Result
<
Void
>
ModifyAuthority
(
@CurrentUser
UserBean
userBean
,
@PathVariable
int
kqjid
,
@PathVariable
int
id
,
@RequestBody
Map
<
String
,
String
>
mmd
)
{
Integer
empNum
=
userBean
.
getEmpNum
();
Integer
orgCode
=
userBean
.
getOrgCode
();
String
[]
xgyh
=
mmd
.
get
(
"a"
).
split
(
","
);
if
(
xgyh
.
length
>
0
){
AttendanceMachine
kqj
=
attendancemachineservice
.
selectByPrimaryKey
(
kqjid
);
for
(
int
a
=
0
;
a
<
xgyh
.
length
;
a
++){
YgglMainEmp
use
=
new
LambdaQueryChainWrapper
<
YgglMainEmp
>(
ygglmainempmapper
).
eq
(
YgglMainEmp:
:
getEmpNum
,
xgyh
[
a
]).
one
();
JSONObject
vResultJson
=
new
JSONObject
();
vResultJson
.
put
(
"user_id"
,
xgyh
[
a
]);
// vResultJson.put("user_name", "管-"+use.getName()+"-"+a);
vResultJson
.
put
(
"user_privilege"
,
"MANAGER"
);
String
sFinal
=
vResultJson
.
toString
();
String
url
=
StaticVariable
.
mac_command
;
HttpHeaders
headers
=
new
HttpHeaders
();
MultiValueMap
<
String
,
Object
>
params
=
new
LinkedMultiValueMap
<>();
params
.
add
(
"cmd"
,
"SET_USER_INFO"
);
params
.
add
(
"devid"
,
kqj
.
getCode
());
params
.
add
(
"json"
,
sFinal
);
RestTemplate
restTemplate
=
new
RestTemplate
();
HttpEntity
httpEntity
=
new
HttpEntity
(
params
,
headers
);
try
{
ResponseEntity
<
String
>
request
=
restTemplate
.
postForEntity
(
url
,
httpEntity
,
String
.
class
);
}
catch
(
RestClientException
e
)
{
// e.printStackTrace();
System
.
err
.
println
(
"提示:考勤机服务出错"
);
return
ResultUtil
.
success
(
"失败"
);
}
UserEquiRelation
kqjry
=
new
UserEquiRelation
();
kqjry
.
setId
(
id
);
kqjry
.
setIsGly
(
1
);
userequirelationmapper
.
updateByPrimaryKeySelective
(
kqjry
);
//考勤机管理员
// KqglAssoKqjgly gly = KqglAssoKqjgly.builder().build();
// gly.setKqjid(kqjid);//考勤机id
// gly.setGlybh(Integer.valueOf(xgyh[a]));//管理员编号
// gly.setGluxm("管-"+use.getName());//管理员姓名
// gly.setUserid(use.getEmpNum());//原用户id
// gly.setTjry(empNum);//添加人员
// gly.setQyid(orgCode);//企业id
// gly.insertOrUpdate();
}
}
return
ResultUtil
.
success
(
"成功"
);
}
public
AttendanceCardList
MethodCall
(
int
qyid
,
int
userid
,
String
date
)
{
AttendanceCardList
attcar
=
new
AttendanceCardList
();
String
str
=
null
;
if
(!(
""
).
equals
(
date
)){
str
=
date
;
}
else
{
Date
d
=
new
Date
();
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
str
=
sdf
.
format
(
d
);
}
Long
startDate
=
0
l
;
Long
endDate
=
0
l
;
try
{
startDate
=
DateUtil
.
getStartTime
(
0
,
DateUtil
.
getStringTime
(
str
,
"yyyy-MM-dd"
)).
getTime
();
endDate
=
DateUtil
.
getnowEndTime
(
23
,
DateUtil
.
getStringTime
(
str
,
"yyyy-MM-dd"
)).
getTime
();
}
catch
(
ParseException
e
)
{
e
.
printStackTrace
();
}
AttendanceGroup
attgro
=
attendancegroupservice
.
getAttendanceGroupInformationByUserid
(
userid
,
qyid
);
//考勤组信息
//pbfs:排班方式 1:固定排班;2:自由排班;3:自由工时
if
(
attgro
!=
null
){
//判断当前用户是否加入到考勤组
//排班制
Schedule
jrpb
=
scheduleservice
.
getScheduleSpecificAttendance
(
attgro
.
getId
(),
userid
,
str
);
//固定排班
int
week
=
Integer
.
valueOf
(
dateToWeek
(
str
));
//4
AttendanceWeeklySch
atwek
=
attendanceweeklyschservice
.
selectZhouDetail
(
attgro
.
getId
(),
week
);
//固定周排班
if
(
attgro
.
getPbfs
()
==
1
){
//固定排班
if
(
atwek
!=
null
){
//有固定周排班
SpecialDate
rest
=
specialdateservice
.
SpecialDateSpecialDayOff
(
attgro
.
getId
(),
str
);
//查询打卡当天是否在特殊休息日期里面存在
if
(
rest
!=
null
){
//今天休息 Sort返回0【特殊日期--休息】
List
<
AttSchedule
>
atts
=
new
ArrayList
<
AttSchedule
>();
AttSchedule
as
=
new
AttSchedule
();
as
.
setId
(
0
);
as
.
setSort
(
0
);
//0:表示今天为休息日
as
.
setTime
(
0
l
);
as
.
setStarttime
(
0
l
);
as
.
setEndtime
(
0
l
);
atts
.
add
(
as
);
attcar
.
setAttsch
(
atts
);
}
else
{
//今天上班
ShiftManagement
bcz
=
shiftmanagementservice
.
selectByPrimaryKey
(
atwek
.
getBcid
());
if
(
bcz
!=
null
){
Getshiftinformationbatch
(
bcz
,
attcar
,
str
);
}
}
}
else
{
//必须打卡
SpecialDate
tsri
=
specialdateservice
.
SpecialDateTroubleshooting
(
attgro
.
getId
(),
str
);
//判断特殊日期
if
(
tsri
!=
null
){
ShiftManagement
tsrq
=
shiftmanagementservice
.
selectByPrimaryKey
(
tsri
.
getBcid
());
if
(
tsrq
!=
null
){
Getshiftinformationbatch
(
tsrq
,
attcar
,
str
);
}
}
else
{
//休息
List
<
AttSchedule
>
atts
=
new
ArrayList
<
AttSchedule
>();
AttSchedule
as
=
new
AttSchedule
();
as
.
setId
(
0
);
as
.
setSort
(
0
);
//0:表示今天为休息日
as
.
setTime
(
0
l
);
as
.
setStarttime
(
0
l
);
as
.
setEndtime
(
0
l
);
atts
.
add
(
as
);
attcar
.
setAttsch
(
atts
);
}
}
}
else
if
(
attgro
.
getPbfs
()
==
2
){
//自由排班
//未排班时,员工可选择班次打卡
if
(
attgro
.
getIsXzbcdk
()
==
1
){
attcar
.
setOptscheduling
(
true
);
}
else
{
attcar
.
setOptscheduling
(
false
);
}
// Schedule jrpb = scheduleservice.getScheduleSpecificAttendance(attgro.getId(),userid,str);
if
(
jrpb
!=
null
){
List
<
AttSchedule
>
atts
=
new
ArrayList
<
AttSchedule
>();
if
(
jrpb
.
getBcid
()
!=
0
){
//有班次时("Bcid"不为0时)
if
(
jrpb
.
getSxbcs
()
==
1
||
jrpb
.
getSxbcs
()
==
2
||
jrpb
.
getSxbcs
()
==
3
){
//1次上下班
for
(
int
o
=
0
;
o
<
2
;
o
++){
if
(
o
==
0
){
AttSchedule
as
=
new
AttSchedule
();
as
.
setId
(
jrpb
.
getBcid
());
as
.
setSort
(
1
);
as
.
setTime
(
Long
.
valueOf
(
dateToStamp
(
str
+
" "
+
dealDateFormat
(
jrpb
.
getSbdk1
(),
2
)+
":00"
)));
as
.
setStarttime
((
""
).
equals
(
jrpb
.
getSbqjks1
())?
0
:
Long
.
valueOf
(
dateToStamp
(
str
+
" "
+
dealDateFormat
(
jrpb
.
getSbqjks1
(),
2
)+
":00"
)));
as
.
setEndtime
((
""
).
equals
(
jrpb
.
getSbqjjs1
())
?
0
:
Long
.
valueOf
(
dateToStamp
(
str
+
" "
+
dealDateFormat
(
jrpb
.
getSbqjjs1
(),
2
)+
":00"
)));
atts
.
add
(
as
);
}
else
{
AttSchedule
as
=
new
AttSchedule
();
as
.
setId
(
jrpb
.
getBcid
());
as
.
setSort
(
2
);
as
.
setTime
(
Long
.
valueOf
(
dateToStamp
(
str
+
" "
+
dealDateFormat
(
jrpb
.
getXbdk1
(),
2
)+
":00"
)));
as
.
setStarttime
((
""
).
equals
(
jrpb
.
getXbqjks1
())
?
0
:
Long
.
valueOf
(
dateToStamp
(
str
+
" "
+
dealDateFormat
(
jrpb
.
getXbqjks1
(),
2
)+
":00"
)));
as
.
setEndtime
((
""
).
equals
(
jrpb
.
getXbqjjs1
())
?
0
:
Long
.
valueOf
(
dateToStamp
(
str
+
" "
+
dealDateFormat
(
jrpb
.
getXbqjjs1
(),
2
)+
":00"
)));
atts
.
add
(
as
);
}
}
attcar
.
setAttsch
(
atts
);
}
if
(
jrpb
.
getSxbcs
()
==
2
||
jrpb
.
getSxbcs
()
==
3
){
//2次上下班
for
(
int
o
=
0
;
o
<
2
;
o
++){
if
(
o
==
0
){
AttSchedule
as
=
new
AttSchedule
();
as
.
setId
(
jrpb
.
getBcid
());
as
.
setSort
(
3
);
as
.
setTime
(
Long
.
valueOf
(
dateToStamp
(
str
+
" "
+
dealDateFormat
(
jrpb
.
getSbdk2
(),
2
)+
":00"
)));
as
.
setStarttime
((
""
).
equals
(
jrpb
.
getSbqjks2
())
?
0
:
Long
.
valueOf
(
dateToStamp
(
str
+
" "
+
dealDateFormat
(
jrpb
.
getSbqjks2
(),
2
)+
":00"
)));
as
.
setEndtime
((
""
).
equals
(
jrpb
.
getSbqjjs2
())
?
0
:
Long
.
valueOf
(
dateToStamp
(
str
+
" "
+
dealDateFormat
(
jrpb
.
getSbqjjs2
(),
2
)+
":00"
)));
atts
.
add
(
as
);
}
else
{
AttSchedule
as
=
new
AttSchedule
();
as
.
setId
(
jrpb
.
getBcid
());
as
.
setSort
(
4
);
as
.
setTime
(
Long
.
valueOf
(
dateToStamp
(
str
+
" "
+
dealDateFormat
(
jrpb
.
getXbdk2
(),
2
)+
":00"
)));
as
.
setStarttime
((
""
).
equals
(
jrpb
.
getXbqjks2
())
?
0
:
Long
.
valueOf
(
dateToStamp
(
str
+
" "
+
dealDateFormat
(
jrpb
.
getXbqjks2
(),
2
)+
":00"
)));
as
.
setEndtime
((
""
).
equals
(
jrpb
.
getXbqjjs2
())
?
0
:
Long
.
valueOf
(
dateToStamp
(
str
+
" "
+
dealDateFormat
(
jrpb
.
getXbqjjs2
(),
2
)+
":00"
)));
atts
.
add
(
as
);
}
}
attcar
.
setAttsch
(
atts
);
}
if
(
jrpb
.
getSxbcs
()
==
3
){
//3次上下班
for
(
int
o
=
0
;
o
<
2
;
o
++){
if
(
o
==
0
){
AttSchedule
as
=
new
AttSchedule
();
as
.
setId
(
jrpb
.
getBcid
());
as
.
setSort
(
5
);
as
.
setTime
(
Long
.
valueOf
(
dateToStamp
(
str
+
" "
+
dealDateFormat
(
jrpb
.
getSbdk3
(),
2
)+
":00"
)));
as
.
setStarttime
((
""
).
equals
(
jrpb
.
getSbqjks3
())
?
0
:
Long
.
valueOf
(
dateToStamp
(
str
+
" "
+
dealDateFormat
(
jrpb
.
getSbqjks3
(),
2
)+
":00"
)));
as
.
setEndtime
((
""
).
equals
(
jrpb
.
getSbqjjs3
())
?
0
:
Long
.
valueOf
(
dateToStamp
(
str
+
" "
+
dealDateFormat
(
jrpb
.
getSbqjjs3
(),
2
)+
":00"
)));
atts
.
add
(
as
);
}
else
{
AttSchedule
as
=
new
AttSchedule
();
as
.
setId
(
jrpb
.
getBcid
());
as
.
setSort
(
6
);
as
.
setTime
(
Long
.
valueOf
(
dateToStamp
(
str
+
" "
+
dealDateFormat
(
jrpb
.
getXbdk3
(),
2
)+
":00"
)));
as
.
setStarttime
((
""
).
equals
(
jrpb
.
getXbqjks3
())
?
0
:
Long
.
valueOf
(
dateToStamp
(
str
+
" "
+
dealDateFormat
(
jrpb
.
getXbqjks3
(),
2
)+
":00"
)));
as
.
setEndtime
((
""
).
equals
(
jrpb
.
getXbqjjs3
())
?
0
:
Long
.
valueOf
(
dateToStamp
(
str
+
" "
+
dealDateFormat
(
jrpb
.
getXbqjjs3
(),
2
)+
":00"
)));
atts
.
add
(
as
);
}
}
attcar
.
setAttsch
(
atts
);
}
}
else
{
//当天排班为休息
List
<
AttSchedule
>
atts1
=
new
ArrayList
<
AttSchedule
>();
AttSchedule
as
=
new
AttSchedule
();
as
.
setId
(
0
);
as
.
setSort
(
0
);
//0:表示今天为休息日
as
.
setTime
(
0
l
);
as
.
setStarttime
(
0
l
);
as
.
setEndtime
(
0
l
);
atts1
.
add
(
as
);
attcar
.
setAttsch
(
atts1
);
}
}
}
else
{
//自由工时
//int week = Integer.valueOf(dateToWeek(str));//4
AttendanceWeeklySch
wekz
=
attendanceweeklyschservice
.
WeeklyFreeRoster
(
attgro
.
getId
(),
week
);
if
(
wekz
!=
null
){
//
String
dada
=
str
+
" "
+
attgro
.
getKqkssjTime
()+
":00"
;
attcar
.
setStapclotime
(
Long
.
valueOf
(
dateToStamp
(
dada
)));
}
if
(!(
""
).
equals
(
attgro
.
getJbzdsc
())){
attcar
.
setCanpunchworkdate
(
Double
.
valueOf
(
attgro
.
getJbzdsc
()));
//上班打卡后多久大下班卡
}
}
if
(
jrpb
!=
null
||
atwek
!=
null
){
ShiftManagement
shif
=
null
;
if
(
attgro
.
getPbfs
()
==
1
){
shif
=
shiftmanagementservice
.
selectByPrimaryKey
(
atwek
.
getBcid
());
}
else
if
(
attgro
.
getPbfs
()
==
2
){
shif
=
shiftmanagementservice
.
selectByPrimaryKey
(
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
=
new
AttLateLate
();
ala
.
setLatewalk
(
shif
.
getXbwz1
());
ala
.
setArrivelate
(
shif
.
getSbwd1
());
atwzwd
.
add
(
ala
);
if
(
p
==
4
||
p
==
6
){
AttLateLate
alat
=
new
AttLateLate
();
alat
.
setLatewalk
(
shif
.
getXbwz2
());
alat
.
setArrivelate
(
shif
.
getSbwd2
());
atwzwd
.
add
(
alat
);
}
if
(
p
==
6
){
AttLateLate
alas
=
new
AttLateLate
();
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
;
}
/**********************/
/**********************/
/**
* 获取报表汇总
*/
...
...
src/main/java/cn/timer/api/controller/kqgl/ClockInController.java
View file @
b1255a14
...
...
@@ -44,7 +44,7 @@ import cn.timer.api.utils.ResultUtil;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
@Api
(
tags
=
"3.0考勤打卡"
)
@Api
(
tags
=
"3.0
[3]
考勤打卡"
)
@RestController
@Transactional
@RequestMapping
(
value
=
"/kqdk"
,
produces
=
{
"application/json"
,
"multipart/form-data"
})
...
...
src/main/java/cn/timer/api/controller/kqgl/ClockInTool.java
View file @
b1255a14
...
...
@@ -4,15 +4,128 @@ 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.HashSet
;
import
java.util.List
;
import
java.util.Locale
;
import
java.util.Set
;
/**
* @author Yl123 2020-05-11
*
*/
public
class
ClockInTool
{
static
SimpleDateFormat
famt
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
/**
* 根据 年、月 获取对应的月份 的 天数
*/
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
;
}
/**
* 获取月份起始日期
*
* @param date
* @return
* @throws ParseException
*/
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
));
return
famt
.
format
(
calendar
.
getTime
());
}
/**
* 获取月份最后日期
*
* @param date
* @return
* @throws ParseException
*/
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
));
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
String
[]
array_unique
(
String
[]
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]);
}
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
[
4
+
bytText
.
length
]
=
0
;
return
bytCmd
;
}
catch
(
Exception
e
){
e
.
printStackTrace
();
bytCmd
=
new
byte
[
0
];
return
bytCmd
;
}
}
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
;
}
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
;
}
public
static
String
dateToWeek2
(
String
datetime
)
{
...
...
src/main/java/cn/timer/api/controller/kqgl/TimeCardController.java
View file @
b1255a14
package
cn
.
timer
.
api
.
controller
.
kqgl
;
import
java.lang.reflect.InvocationTargetException
;
import
java.text.ParseException
;
import
java.text.SimpleDateFormat
;
import
java.util.ArrayList
;
import
java.util.Comparator
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Map
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.HttpEntity
;
import
org.springframework.http.HttpHeaders
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.util.LinkedMultiValueMap
;
import
org.springframework.util.MultiValueMap
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.DeleteMapping
;
import
org.springframework.web.bind.annotation.GetMapping
;
...
...
@@ -16,6 +25,8 @@ import org.springframework.web.bind.annotation.PutMapping;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.client.RestClientException
;
import
org.springframework.web.client.RestTemplate
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
...
...
@@ -25,9 +36,17 @@ import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import
cn.hutool.core.bean.BeanUtil
;
import
cn.hutool.core.lang.Console
;
import
cn.timer.api.bean.kqgl.AttGroupBinPunchMode
;
import
cn.timer.api.bean.kqgl.AttendanceMachine
;
import
cn.timer.api.bean.kqgl.PunchCardDetails
;
import
cn.timer.api.bean.kqgl.PunchRecord
;
import
cn.timer.api.bean.kqgl.UserAttendanceRel
;
import
cn.timer.api.bean.kqgl.UserEquiRelation
;
import
cn.timer.api.bean.kqmk.KqglAssOvertimeVice
;
import
cn.timer.api.bean.kqmk.KqglAssoBcsz
;
import
cn.timer.api.bean.kqmk.KqglAssoDkdz
;
import
cn.timer.api.bean.kqmk.KqglAssoDkjl
;
import
cn.timer.api.bean.kqmk.KqglAssoDkmx
;
import
cn.timer.api.bean.kqmk.KqglAssoDkwx
;
import
cn.timer.api.bean.kqmk.KqglAssoKqj
;
import
cn.timer.api.bean.kqmk.KqglAssoKqzdkfs
;
...
...
@@ -40,40 +59,61 @@ import cn.timer.api.bean.kqmk.KqglAssoPbmx;
import
cn.timer.api.bean.kqmk.KqglAssoRulesVice
;
import
cn.timer.api.bean.kqmk.KqglAssoTeshu
;
import
cn.timer.api.bean.kqmk.KqglAssoYhkqz
;
import
cn.timer.api.bean.kqmk.KqglAssoYhsb
;
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.Initialization.StaticVariable
;
import
cn.timer.api.config.annotation.CurrentUser
;
import
cn.timer.api.config.annotation.UserBean
;
import
cn.timer.api.dao.kqgl.PunchCardDetailsMapper
;
import
cn.timer.api.dao.kqgl.PunchRecordMapper
;
import
cn.timer.api.dao.kqgl.UserAttendanceRelMapper
;
import
cn.timer.api.dao.kqgl.UserEquiRelationMapper
;
import
cn.timer.api.dao.kqmk.KqglAssOvertimeViceMapper
;
import
cn.timer.api.dao.kqmk.KqglAssoBcszMapper
;
import
cn.timer.api.dao.kqmk.KqglAssoDkdzMapper
;
import
cn.timer.api.dao.kqmk.KqglAssoDkjlMapper
;
import
cn.timer.api.dao.kqmk.KqglAssoDkwxMapper
;
import
cn.timer.api.dao.kqmk.KqglAssoKqjMapper
;
import
cn.timer.api.dao.kqmk.KqglAssoKqzdkfsMapper
;
import
cn.timer.api.dao.kqmk.KqglAssoLeaveBalanceMapper
;
import
cn.timer.api.dao.kqmk.KqglAssoLeaveRulesMapper
;
import
cn.timer.api.dao.kqmk.KqglAssoOvertimeRangeMapper
;
import
cn.timer.api.dao.kqmk.KqglAssoOvertimeRulesMapper
;
import
cn.timer.api.dao.kqmk.KqglAssoPbmxMapper
;
import
cn.timer.api.dao.kqmk.KqglAssoRulesViceMapper
;
import
cn.timer.api.dao.kqmk.KqglAssoTeshuMapper
;
import
cn.timer.api.dao.kqmk.KqglAssoYhkqzMapper
;
import
cn.timer.api.dao.kqmk.KqglAssoYhsbMapper
;
import
cn.timer.api.dao.kqmk.KqglAssoZhoupaibanMapper
;
import
cn.timer.api.dao.kqmk.KqglMainKqzMapper
;
import
cn.timer.api.dto.kqgl.AttemacDto
;
import
cn.timer.api.dto.kqmk.AttSchedulingDto
;
import
cn.timer.api.dto.kqmk.AttendanceAssistantDto
;
import
cn.timer.api.dto.kqmk.AttqueryCriteriaDto
;
import
cn.timer.api.dto.kqmk.CompensateDto
;
import
cn.timer.api.dto.kqmk.EmployeeLeaveBalanceDto
;
import
cn.timer.api.dto.kqmk.IndividualOvertimeRuleDto
;
import
cn.timer.api.dto.kqmk.KqglAssoLeaveRulesDto
;
import
cn.timer.api.dto.kqmk.KqglAssoOvertimeRulesDto
;
import
cn.timer.api.dto.kqmk.KqglAssoPbmxDto
;
import
cn.timer.api.dto.kqmk.KqglMainKqzDto
;
import
cn.timer.api.dto.kqmk.KqzAttendanceGroupSearchDto
;
import
cn.timer.api.dto.kqmk.LeaveTypeDto
;
import
cn.timer.api.dto.kqmk.MachinememberDto
;
import
cn.timer.api.dto.kqmk.SetConditionsDto
;
import
cn.timer.api.dto.kqmk.StartTimeRestDto
;
import
cn.timer.api.dto.kqmk.VacationInformationDto
;
import
cn.timer.api.utils.DateUtil
;
import
cn.timer.api.utils.ResponseResult
;
import
cn.timer.api.utils.Result
;
import
cn.timer.api.utils.ResultUtil
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
net.sf.json.JSONObject
;
@Api
(
tags
=
"3.0考勤模块"
)
@Api
(
tags
=
"3.0
[1]
考勤模块"
)
@RestController
@Transactional
@RequestMapping
(
value
=
"/kqmk"
,
produces
=
{
"application/json"
,
"multipart/form-data"
})
...
...
@@ -88,7 +128,7 @@ public class TimeCardController {
/**
* 查询列表-获取班次数据-分页
*/
@PostMapping
(
value
=
"/
select_shifts
"
)
@PostMapping
(
value
=
"/
ShiftDataList
"
)
@ApiOperation
(
value
=
"1.获取班次数据-根据 组织机构代码-分页"
,
httpMethod
=
"POST"
,
notes
=
"接口发布说明"
)
@ApiOperationSupport
(
order
=
1
)
public
Result
<
Object
>
selectShifts
(
@CurrentUser
UserBean
userBean
,
@RequestBody
AttqueryCriteriaDto
attquerycriteriadto
)
{
...
...
@@ -349,9 +389,16 @@ public class TimeCardController {
return
ResultUtil
.
error
(
"操作失败"
);
Integer
id
=
learul
.
getId
();
Console
.
log
(
"新增/修改--假期规则id: "
+
id
);
if
(
leaverules
.
getLeaveBalance
()
==
0
)
{
//假期余额 0:关(该项余额为“不限余额”);1:开(该项余额为“0”)
KqglAssoLeaveBalance
.
builder
().
build
().
delete
(
new
QueryWrapper
<
KqglAssoLeaveBalance
>().
lambda
().
eq
(
KqglAssoLeaveBalance:
:
getLeaveRulesId
,
id
)
.
eq
(
KqglAssoLeaveBalance
::
getOrgCode
,
userBean
.
getOrgCode
()));
KqglAssoLeaveBalance
.
builder
().
build
().
delete
(
new
QueryWrapper
<
KqglAssoLeaveBalance
>().
lambda
().
eq
(
KqglAssoLeaveBalance:
:
getLeaveRulesId
,
id
)
.
eq
(
KqglAssoLeaveBalance
::
getOrgCode
,
userBean
.
getOrgCode
()));
if
(
leaverules
.
getLeaveBalance
()
==
1
)
{
//假期余额 0:关(该项余额为“不限余额”);1:开(该项余额为“0”)
//该项公司员工余额为“0”
List
<
YgglMainEmp
>
yggl
=
YgglMainEmp
.
builder
().
build
().
selectList
(
new
QueryWrapper
<
YgglMainEmp
>().
lambda
().
eq
(
YgglMainEmp:
:
getOrgCode
,
userBean
.
getOrgCode
()));
for
(
YgglMainEmp
ye:
yggl
)
{
KqglAssoLeaveBalance
.
builder
().
leaveRulesId
(
id
).
userid
(
ye
.
getEmpNum
()).
modifyAction
(
1
).
balanceDays
(
"+0"
)
.
reason
(
"系统按照规则自动"
).
modifyUserid
(
userBean
.
getEmpNum
()).
modifyTimer
(
new
Date
().
getTime
()).
orgCode
(
userBean
.
getOrgCode
()).
isAutomatic
(
1
).
modifyNumber
(
1
).
build
().
insert
();
//员工假期余额
}
}
List
<
KqglAssoRulesVice
>
vices
=
new
ArrayList
<
KqglAssoRulesVice
>();
String
[]
rest
=
leaverules
.
getRange
();
...
...
@@ -421,6 +468,103 @@ public class TimeCardController {
return
ResultUtil
.
data
(
attendanList
,
"操作成功!"
);
}
@GetMapping
(
value
=
"/synchrotime/{code}"
)
@ApiOperation
(
value
=
"考勤机一键同步"
,
httpMethod
=
"GET"
,
notes
=
"接口发布说明"
)
public
Result
<
Object
>
SynchronizationTime
(
@CurrentUser
UserBean
userBean
,
@PathVariable
(
"code"
)
String
code
)
{
JSONObject
vResultJson
=
new
JSONObject
();
vResultJson
.
put
(
"devId"
,
code
);
String
sFinal
=
vResultJson
.
toString
();
String
url
=
StaticVariable
.
mac_command
+
"/setTime"
;
HttpHeaders
headers
=
new
HttpHeaders
();
MultiValueMap
<
String
,
Object
>
params
=
new
LinkedMultiValueMap
<>();
params
.
add
(
"json"
,
sFinal
);
RestTemplate
restTemplate
=
new
RestTemplate
();
HttpEntity
httpEntity
=
new
HttpEntity
(
params
,
headers
);
try
{
ResponseEntity
<
String
>
request
=
restTemplate
.
postForEntity
(
url
,
httpEntity
,
String
.
class
);
}
catch
(
RestClientException
e
)
{
System
.
err
.
println
(
"提示:考勤机服务出错"
);
return
ResultUtil
.
success
(
"失败"
);
}
return
ResultUtil
.
success
(
"成功"
);
}
/**
* 移除考勤机管理员
*/
@PostMapping
(
value
=
"/removeadministrator/{kqjid}/{id}"
)
@ApiOperation
(
value
=
"移除考勤机管理员"
,
httpMethod
=
"POST"
,
notes
=
"接口发布说明"
)
public
Result
<
Object
>
RemoveAdministrator
(
@PathVariable
int
kqjid
,
@PathVariable
int
id
,
@RequestBody
Map
<
String
,
String
>
mmd
)
{
String
[]
xgyh
=
mmd
.
get
(
"a"
).
split
(
","
);
if
(
xgyh
.
length
>
0
){
KqglAssoKqj
kqj
=
KqglAssoKqj
.
builder
().
id
(
kqjid
).
build
().
selectById
();
//查询考勤机“序列号”
for
(
int
a
=
0
;
a
<
xgyh
.
length
;
a
++){
JSONObject
vResultJson
=
new
JSONObject
();
vResultJson
.
put
(
"devId"
,
kqj
.
getCode
());
vResultJson
.
put
(
"userId"
,
xgyh
[
a
]);
vResultJson
.
put
(
"privilege"
,
1
);
String
sFinal
=
vResultJson
.
toString
();
String
url
=
StaticVariable
.
mac_command
+
"/addUserPrivilege"
;
HttpHeaders
headers
=
new
HttpHeaders
();
MultiValueMap
<
String
,
Object
>
params
=
new
LinkedMultiValueMap
<>();
params
.
add
(
"json"
,
sFinal
);
RestTemplate
restTemplate
=
new
RestTemplate
();
HttpEntity
httpEntity
=
new
HttpEntity
(
params
,
headers
);
try
{
ResponseEntity
<
String
>
request
=
restTemplate
.
postForEntity
(
url
,
httpEntity
,
String
.
class
);
}
catch
(
RestClientException
e
)
{
System
.
err
.
println
(
"提示:考勤机服务出错"
);
return
ResultUtil
.
success
(
"失败"
);
}
KqglAssoYhsb
.
builder
().
id
(
id
).
isGly
(
0
).
build
().
updateById
();
}
}
return
ResultUtil
.
success
(
"成功"
);
}
@PostMapping
(
value
=
"/modifyauthority/{kqjid}/{id}"
)
@ApiOperation
(
value
=
"添加考勤机管理员"
,
httpMethod
=
"POST"
,
notes
=
"接口发布说明"
)
public
Result
<
Object
>
ModifyAuthority
(
@CurrentUser
UserBean
userBean
,
@PathVariable
int
kqjid
,
@PathVariable
int
id
,
@RequestBody
Map
<
String
,
String
>
mmd
)
{
String
[]
xgyh
=
mmd
.
get
(
"a"
).
split
(
","
);
if
(
xgyh
.
length
>
0
){
KqglAssoKqj
kqj
=
KqglAssoKqj
.
builder
().
id
(
kqjid
).
build
().
selectById
();
//查询考勤机“序列号”
for
(
int
a
=
0
;
a
<
xgyh
.
length
;
a
++){
JSONObject
vResultJson
=
new
JSONObject
();
vResultJson
.
put
(
"devId"
,
kqj
.
getCode
());
vResultJson
.
put
(
"userId"
,
xgyh
[
a
]);
vResultJson
.
put
(
"privilege"
,
2
);
String
sFinal
=
vResultJson
.
toString
();
String
url
=
StaticVariable
.
mac_command
+
"/addUserPrivilege"
;
HttpHeaders
headers
=
new
HttpHeaders
();
MultiValueMap
<
String
,
Object
>
params
=
new
LinkedMultiValueMap
<>();
params
.
add
(
"json"
,
sFinal
);
RestTemplate
restTemplate
=
new
RestTemplate
();
HttpEntity
httpEntity
=
new
HttpEntity
(
params
,
headers
);
try
{
ResponseEntity
<
String
>
request
=
restTemplate
.
postForEntity
(
url
,
httpEntity
,
String
.
class
);
}
catch
(
RestClientException
e
)
{
System
.
err
.
println
(
"提示:考勤机服务出错"
);
return
ResultUtil
.
success
(
"失败"
);
}
UserEquiRelation
kqjry
=
new
UserEquiRelation
();
kqjry
.
setId
(
id
);
kqjry
.
setIsGly
(
1
);
userequirelationmapper
.
updateByPrimaryKeySelective
(
kqjry
);
}
}
return
ResultUtil
.
success
(
"成功"
);
}
/**
* 新增考勤机
*/
...
...
@@ -431,7 +575,29 @@ public class TimeCardController {
kqglassokqj
.
setLuryid
(
userBean
.
getEmpNum
());
kqglassokqj
.
setLusjTime
(
new
Date
().
getTime
());
kqglassokqj
.
setQyid
(
userBean
.
getOrgCode
());
return
kqglassokqj
.
insert
()
?
ResultUtil
.
success
(
"操作成功!"
)
:
ResultUtil
.
error
(
"操作失败!"
);
if
(!
kqglassokqj
.
insert
())
return
ResultUtil
.
error
(
"操作失败--新增考勤机"
);
JSONObject
vResultJson
=
new
JSONObject
();
vResultJson
.
put
(
"devId"
,
kqglassokqj
.
getCode
());
vResultJson
.
put
(
"orgCode"
,
userBean
.
getOrgCode
());
String
sFinal
=
vResultJson
.
toString
();
String
url
=
StaticVariable
.
mac_command
+
"/addDev"
;
HttpHeaders
headers
=
new
HttpHeaders
();
MultiValueMap
<
String
,
Object
>
params
=
new
LinkedMultiValueMap
<>();
params
.
add
(
"json"
,
sFinal
);
RestTemplate
restTemplate
=
new
RestTemplate
();
HttpEntity
httpEntity
=
new
HttpEntity
(
params
,
headers
);
try
{
ResponseEntity
<
String
>
request
=
restTemplate
.
postForEntity
(
url
,
httpEntity
,
String
.
class
);
}
catch
(
RestClientException
e
)
{
System
.
err
.
println
(
"提示:考勤机服务出错"
);
return
ResultUtil
.
success
(
"失败"
);
}
return
ResultUtil
.
success
(
"操作成功!"
);
}
/**
...
...
@@ -523,21 +689,6 @@ public class TimeCardController {
return
KqglAssoDkdz
.
builder
().
id
(
id
).
build
().
deleteById
()
?
ResultUtil
.
success
(
"删除成功!"
)
:
ResultUtil
.
error
(
"没有找到该对象"
);
}
/**
* 获取打卡地址所在考勤组数据*********
*/
// @GetMapping(value="/PunchAddressGroup/{id}")
// @ApiOperation(value = "获取打卡地址所在考勤组数据", httpMethod = "GET", notes = "接口发布说明")
// @ApiOperationSupport(order = 14)
// public Result<List<AttendanceGroup>> getPunchAddressGroup(@CurrentUser UserBean userBean,@PathVariable("id") Integer id) {
//
// int qyid = userBean.getOrgCode();//坏小孩【企业id】
// int userid = userBean.getEmpNum();//用户id
//
// List<AttendanceGroup> attaddressownlist = attendancegroupservice.selectByPrimaryAttAddressOwn(qyid,id);
// return ResultUtil.data(attaddressownlist);
// }
/*********打卡WIFI***********/
/**
* 获取打卡WIFI数据
...
...
@@ -596,19 +747,6 @@ public class TimeCardController {
return
KqglAssoDkwx
.
builder
().
id
(
id
).
build
().
deleteById
()
?
ResultUtil
.
success
(
"删除成功!"
)
:
ResultUtil
.
error
(
"没有找到该对象"
);
}
/**
* 获取打卡WIFI所在考勤组数据*****
*/
// @GetMapping(value="/PunchWIFIGroup/{id}")
// @ApiOperation(value = "获取打卡WIFI所在考勤组数据", httpMethod = "GET", notes = "接口发布说明")
// @ApiOperationSupport(order = 20)
// public Result<List<AttendanceGroup>> getPunchWIFIGroup(@CurrentUser UserBean userBean,@PathVariable("id") Integer id) {
// int qyid = userBean.getOrgCode();//坏小孩【企业id】
//
// List<AttendanceGroup> attwifiownlist = attendancegroupservice.selectByPrimaryAttWIFIOwn(qyid,id);
// return ResultUtil.data(attwifiownlist);
// }
@Autowired
private
KqglAssoLeaveBalanceMapper
kqglassoleavebalancemapper
;
/**
...
...
@@ -727,7 +865,7 @@ public class TimeCardController {
return
ResultUtil
.
data
(
pageAs
,
leadto
,
"操作成功!"
);
}
/*****************考勤组***********************/
/**
* 查询列表-考勤组-分页
*/
...
...
@@ -790,14 +928,44 @@ public class TimeCardController {
return
ResultUtil
.
data
(
yggl
);
}
//用户和考勤组关系
@Autowired
private
UserAttendanceRelMapper
userattendancerelservice
;
//用户与设备关系表
@Autowired
private
UserEquiRelationMapper
userequirelationmapper
;
/**
* 删除考勤组
*/
@DeleteMapping
(
value
=
"/AttendanceGroup/{id}"
)
@ApiOperation
(
value
=
"39:删除考勤组"
,
httpMethod
=
"DELETE"
,
notes
=
"接口发布说明"
)
@ApiOperationSupport
(
order
=
39
)
public
Result
<
Integer
>
DelAttendanceGroup
(
@PathVariable
(
"id"
)
Integer
id
)
{
public
Result
<
Integer
>
DelAttendanceGroup
(
@
CurrentUser
UserBean
userBean
,
@
PathVariable
(
"id"
)
Integer
id
)
{
if
(
KqglMainKqz
.
builder
().
id
(
id
).
build
().
deleteById
())
{
// List<UserAttendanceRel> attusers = userattendancerelservice.selectAttendanceOfficerByKqzid(id, userBean.getOrgCode());//该考勤组人数
// //该考勤组所绑定的考勤机
// List<KqglAssoKqzdkfs> kqjs = kqglassokqzdkfsmapper.selectList(new QueryWrapper<KqglAssoKqzdkfs>().lambda().eq(KqglAssoKqzdkfs::getKqzId, id).eq(KqglAssoKqzdkfs::getType, 1));
// String DevId = "";
// for(KqglAssoKqzdkfs abp:kqjs) {
// KqglAssoKqj kqj = KqglAssoKqj.builder().id(abp.getDkfsid()).build().selectById();//查询考勤机“序列号”
// DevId = kqj.getCode();
// for(UserAttendanceRel user:attusers) {
// String user_id = user.getEmpnum();//"1692";//要删除的考勤组里面用户ID
// JSONObject vResultJson = new JSONObject();
// vResultJson.put("devId", DevId);
// vResultJson.put("userId", user_id);
// String sFinal = vResultJson.toString();
// String url = StaticVariable.mac_command+"/deleteUser";
// HttpHeaders headers = new HttpHeaders();
// MultiValueMap<String, Object> params = new LinkedMultiValueMap<>();
// params.add("json", sFinal);
// RestTemplate restTemplate = new RestTemplate();
// HttpEntity httpEntity = new HttpEntity(params, headers);
// ResponseEntity<String> request = restTemplate.postForEntity(url, httpEntity, String.class);
// }
// }
// userequirelationmapper.deleteBykqzid(id);
//删除考勤组绑定的打卡方式
KqglAssoKqzdkfs
.
builder
().
build
().
delete
(
new
QueryWrapper
<
KqglAssoKqzdkfs
>().
lambda
().
eq
(
KqglAssoKqzdkfs:
:
getKqzId
,
id
));
//删除用户和考勤组关系表
...
...
@@ -820,6 +988,870 @@ public class TimeCardController {
return
ResultUtil
.
error
(
"删除失败"
);
}
@Autowired
private
KqglAssoKqzdkfsMapper
kqglassokqzdkfsmapper
;
@Autowired
private
KqglAssoYhkqzMapper
kqglassoyhkqzmapper
;
@Autowired
private
KqglAssoZhoupaibanMapper
kqglassozhoupaibanmapper
;
@Autowired
private
KqglAssoTeshuMapper
kqglassoteshumapper
;
@Autowired
private
KqglAssoPbmxMapper
kqglassopbmxmapper
;
/**
* 新建考勤组
*/
@PostMapping
(
value
=
"/AttendanceGroup"
)
@ApiOperation
(
value
=
"40:新增考勤组数据"
,
httpMethod
=
"POST"
,
notes
=
"接口发布说明"
)
@ApiOperationSupport
(
order
=
40
)
public
Result
<
Object
>
AttendanceGroupList
(
@CurrentUser
UserBean
userBean
,
@RequestBody
AttendanceAssistantDto
attass
)
{
KqglMainKqz
attgro
=
KqglMainKqz
.
builder
().
name
(
attass
.
getName
()).
kqbz
(
attass
.
getRemarks
()).
pbfs
(
attass
.
getAtttype
()).
qyid
(
userBean
.
getOrgCode
())
.
isWq
(
attass
.
getFieldpersonnel
()).
isFdjjr
(
attass
.
getLegalholidays
()).
isXzbcdk
(
attass
.
getOptscheduling
()).
sybc
(
String
.
join
(
","
,
attass
.
getAttShifts
()))
.
isDqtx
(
attass
.
getAttRemind
()).
txry
(
String
.
join
(
","
,
attass
.
getAttRemindUserids
())).
txfs
(
attass
.
getAdvanceDays
()).
txxhts
(
attass
.
getRemCycleDays
())
.
txsjTime
(
attass
.
getReminderTime
()).
tsfs
(
String
.
join
(
","
,
attass
.
getPromptingMode
())).
isWpbsdk
(
attass
.
getAttRemind
()).
kqkssjTime
(
attass
.
getNewAttTime
())
.
zsgzsc
(
attass
.
getLeastworkTime
()).
zcgzsc
(
attass
.
getNormalWorkTime
()).
jbzdsc
(
attass
.
getMaxOvertimeTime
()).
overtimeRulesId
(
attass
.
getOvertimeRulesId
()).
build
();
// if (!attgro.insertOrUpdate())
if
(!
attgro
.
insert
())
return
ResultUtil
.
error
(
"操作失败--新增考勤组"
);
Integer
attid
=
attgro
.
getId
();
Console
.
log
(
"新增--考勤组id: "
+
attid
);
List
<
KqglAssoKqzdkfs
>
kqzdkfslist
=
new
ArrayList
<
KqglAssoKqzdkfs
>();
String
[]
attmac
=
attass
.
getAttmachines
();
//考勤机
if
(
attmac
.
length
>
0
){
for
(
int
i
=
0
;
i
<
attmac
.
length
;
i
++)
{
KqglAssoKqzdkfs
attgbpmac
=
KqglAssoKqzdkfs
.
builder
().
dkfsid
(
Integer
.
valueOf
(
attmac
[
i
])).
kqzId
(
attid
).
type
(
1
).
qyid
(
userBean
.
getOrgCode
()).
state
(
1
).
build
();
kqzdkfslist
.
add
(
attgbpmac
);
}
}
String
[]
atad
=
attass
.
getAttadds
();
//考勤地址
if
(
atad
.
length
>
0
){
for
(
int
a
=
0
;
a
<
atad
.
length
;
a
++){
KqglAssoKqzdkfs
attgbpadd
=
KqglAssoKqzdkfs
.
builder
().
dkfsid
(
Integer
.
valueOf
(
atad
[
a
])).
kqzId
(
attid
).
type
(
2
).
qyid
(
userBean
.
getOrgCode
()).
state
(
1
).
build
();
kqzdkfslist
.
add
(
attgbpadd
);
}
}
String
[]
atwf
=
attass
.
getAttwifis
();
//考勤WIFI
if
(
atwf
.
length
>
0
){
for
(
int
f
=
0
;
f
<
atwf
.
length
;
f
++){
KqglAssoKqzdkfs
attgbpwf
=
KqglAssoKqzdkfs
.
builder
().
dkfsid
(
Integer
.
valueOf
(
atwf
[
f
])).
kqzId
(
attid
).
type
(
3
).
qyid
(
userBean
.
getOrgCode
()).
state
(
1
).
build
();
kqzdkfslist
.
add
(
attgbpwf
);
}
}
if
(
kqzdkfslist
.
size
()>
0
){
kqglassokqzdkfsmapper
.
insertKqglAssokqzdKfsList
(
kqzdkfslist
);
}
//用户和考勤组关系
List
<
KqglAssoYhkqz
>
yhkqzlist
=
new
ArrayList
<
KqglAssoYhkqz
>();
String
[]
attser
=
attass
.
getAttuserids
();
if
(
attser
.
length
>
0
){
for
(
int
u
=
0
;
u
<
attser
.
length
;
u
++){
if
(
attass
.
getAtttype
()
==
2
){
KqglAssoPbmx
.
builder
().
build
().
delete
(
new
QueryWrapper
<
KqglAssoPbmx
>().
lambda
().
eq
(
KqglAssoPbmx:
:
getUserid
,
Integer
.
valueOf
(
attser
[
u
])));}
KqglAssoYhkqz
.
builder
().
build
().
delete
(
new
QueryWrapper
<
KqglAssoYhkqz
>().
lambda
().
eq
(
KqglAssoYhkqz:
:
getUserid
,
Integer
.
valueOf
(
attser
[
u
])));
KqglAssoYhkqz
kquser
=
KqglAssoYhkqz
.
builder
().
kqzid
(
attid
).
userid
(
Integer
.
valueOf
(
attser
[
u
])).
qyid
(
userBean
.
getOrgCode
()).
build
();
yhkqzlist
.
add
(
kquser
);
List
<
KqglAssoKqzdkfs
>
kqjs
=
kqglassokqzdkfsmapper
.
selectList
(
new
QueryWrapper
<
KqglAssoKqzdkfs
>().
lambda
().
eq
(
KqglAssoKqzdkfs:
:
getKqzId
,
attid
).
eq
(
KqglAssoKqzdkfs:
:
getType
,
1
));
for
(
KqglAssoKqzdkfs
abp:
kqjs
)
{
KqglAssoKqj
kqj
=
KqglAssoKqj
.
builder
().
id
(
abp
.
getDkfsid
()).
build
().
selectById
();
KqglAssoYhsb
kqjry
=
KqglAssoYhsb
.
builder
().
build
().
selectOne
(
new
QueryWrapper
<
KqglAssoYhsb
>().
lambda
().
eq
(
KqglAssoYhsb:
:
getUserId
,
Integer
.
valueOf
(
attser
[
u
])).
eq
(
KqglAssoYhsb:
:
getKqjid
,
kqj
.
getId
()));
if
(
kqjry
==
null
)
{
KqglAssoYhsb
uskqj
=
KqglAssoYhsb
.
builder
().
userId
(
Integer
.
valueOf
(
attser
[
u
])).
kqjid
(
kqj
.
getId
()).
type
(
1
).
isGly
(
kqjry
.
getIsGly
()).
build
();
if
(!
uskqj
.
insert
())
return
ResultUtil
.
error
(
"操作失败--新增用户与设备关系"
);
YgglMainEmp
yggluser
=
YgglMainEmp
.
builder
().
build
().
selectOne
(
new
QueryWrapper
<
YgglMainEmp
>().
lambda
().
eq
(
YgglMainEmp:
:
getOrgCode
,
userBean
.
getOrgCode
()).
eq
(
YgglMainEmp:
:
getEmpNum
,
attser
[
u
]));
JSONObject
vResultJson
=
new
JSONObject
();
vResultJson
.
put
(
"devId"
,
kqj
.
getCode
());
vResultJson
.
put
(
"userId"
,
attser
[
u
]);
vResultJson
.
put
(
"userName"
,
yggluser
.
getName
());
String
sFinal
=
vResultJson
.
toString
();
String
url
=
StaticVariable
.
mac_command
+
"/addUserName"
;
HttpHeaders
headers
=
new
HttpHeaders
();
MultiValueMap
<
String
,
Object
>
params
=
new
LinkedMultiValueMap
<>();
params
.
add
(
"json"
,
sFinal
);
RestTemplate
restTemplate
=
new
RestTemplate
();
HttpEntity
httpEntity
=
new
HttpEntity
(
params
,
headers
);
ResponseEntity
<
String
>
request
=
restTemplate
.
postForEntity
(
url
,
httpEntity
,
String
.
class
);
}
}
}
}
if
(
yhkqzlist
.
size
()>
0
){
kqglassoyhkqzmapper
.
insertKqglAssoKqzdkfsList
(
yhkqzlist
);
}
List
<
KqglAssoZhoupaiban
>
attweeklist
=
new
ArrayList
<
KqglAssoZhoupaiban
>();
//固定排版周记录
String
[]
weektime
=
attass
.
getAttWeekdays
();
//周工作日【固定排班】
String
[]
weekshif
=
attass
.
getAttWeekdaysShifts
();
//周工作日班次【固定排班】
if
(
weektime
.
length
>
0
&&
weekshif
.
length
>
0
&&
attass
.
getAtttype
()
==
1
){
for
(
int
h
=
0
;
h
<
weektime
.
length
;
h
++){
KqglAssoZhoupaiban
attweek
=
KqglAssoZhoupaiban
.
builder
().
kqzid
(
attid
).
type
(
Integer
.
valueOf
(
weektime
[
h
])).
bcid
(
Integer
.
valueOf
(
weekshif
[
h
])).
build
();
attweeklist
.
add
(
attweek
);
}
}
String
[]
attFrWorkdays
=
attass
.
getAttFreeWorkdays
();
// 周工作日【自由工时】
if
(
attFrWorkdays
.
length
>
0
&&
attass
.
getAtttype
()
==
3
){
for
(
int
w
=
0
;
w
<
attFrWorkdays
.
length
;
w
++){
KqglAssoZhoupaiban
attfrwor
=
KqglAssoZhoupaiban
.
builder
().
kqzid
(
attid
).
type
(
Integer
.
valueOf
(
attFrWorkdays
[
w
])).
bcid
(
0
).
build
();
attweeklist
.
add
(
attfrwor
);
}
}
if
(
attweeklist
.
size
()>
0
){
kqglassozhoupaibanmapper
.
insertKqglAssoZhoupaibanList
(
attweeklist
);
}
List
<
KqglAssoTeshu
>
speclist
=
new
ArrayList
<
KqglAssoTeshu
>();
String
[]
attmuspudata
=
attass
.
getAttMustPunchData
();
// 必须打卡的日期【固定排班】
String
[]
attmuspushifid
=
attass
.
getAttMustPunchShifid
();
// 必须打卡的班次id【固定排班】
String
[]
attnonpudata
=
attass
.
getAttNonPunchData
();
// 不用打卡的日期【固定排班】
if
(
attmuspudata
.
length
>
0
&&
attmuspushifid
.
length
>
0
&&
attass
.
getAtttype
()
==
1
){
for
(
int
m
=
0
;
m
<
attmuspudata
.
length
;
m
++){
KqglAssoTeshu
mut
=
KqglAssoTeshu
.
builder
().
kqzid
(
attid
).
tsrq
(
attmuspudata
[
m
]).
bcid
(
Integer
.
valueOf
(
attmuspushifid
[
m
])).
lusjTime
(
new
Date
().
getTime
()).
luryid
(
userBean
.
getEmpNum
()).
type
(
1
).
build
();
speclist
.
add
(
mut
);
}
}
if
(
attnonpudata
.
length
>
0
&&
attass
.
getAtttype
()
==
1
){
for
(
int
n
=
0
;
n
<
attnonpudata
.
length
;
n
++){
KqglAssoTeshu
non
=
KqglAssoTeshu
.
builder
().
kqzid
(
attid
).
tsrq
(
attnonpudata
[
n
]).
bcid
(
0
).
lusjTime
(
new
Date
().
getTime
()).
luryid
(
userBean
.
getEmpNum
()).
type
(
2
).
build
();
speclist
.
add
(
non
);
}
}
if
(
speclist
.
size
()>
0
){
kqglassoteshumapper
.
insertKqglAssoTeshuList
(
speclist
);
}
//记录排班(排班制)
List
<
KqglAssoPbmxDto
>
schlist
=
new
ArrayList
<
KqglAssoPbmxDto
>();
KqglAssoPbmxDto
[]
schedules
=
attass
.
getSchedules
();
// 排班日期【排班制】--班次id、日期
if
(
schedules
.
length
>
0
&&
attass
.
getAtttype
()
==
2
){
for
(
int
p
=
0
;
p
<
schedules
.
length
;
p
++){
KqglAssoPbmxDto
sch
=
KqglAssoPbmxDto
.
builder
().
userid
(
schedules
[
p
].
getUserid
()).
data
(
schedules
[
p
].
getData
()).
bcid
(
schedules
[
p
].
getBcid
()).
kqzid
(
attid
).
build
();
schlist
.
add
(
sch
);
}
}
if
(
schlist
.
size
()>
0
){
kqglassopbmxmapper
.
insertKqglAssoPbmxList
(
schlist
);
}
return
ResultUtil
.
data
(
attgro
,
"操作成功!"
);
}
@PutMapping
(
value
=
"/switch"
)
@ApiOperation
(
value
=
"41:设置假期规则开关"
,
httpMethod
=
"PUT"
,
notes
=
"接口发布说明"
)
@ApiOperationSupport
(
order
=
41
)
public
Result
<
Object
>
setswitch
(
@CurrentUser
UserBean
userBean
,
@RequestBody
SetConditionsDto
setconditionsdto
)
{
return
KqglAssoLeaveRules
.
builder
().
id
(
setconditionsdto
.
getId
()).
isOpen
(
setconditionsdto
.
getParameters
()).
build
().
updateById
()
?
ResultUtil
.
success
(
"操作成功!"
)
:
ResultUtil
.
error
(
"操作失败!"
);
}
/**
* 获取修改的排班明细--【修改考勤组】--------------------------------------------------------------------------------------
*/
@PostMapping
(
value
=
"/AttGroupSchedulingList"
)
@ApiOperation
(
value
=
"42:获取修改的排班明细"
,
httpMethod
=
"POST"
,
notes
=
"接口发布说明"
)
@ApiOperationSupport
(
order
=
42
)
public
Result
<
Object
>
getAttGroupSchedulingList
(
@CurrentUser
UserBean
userBean
,
@RequestBody
AttSchedulingDto
attscheduling
)
{
String
str
=
new
SimpleDateFormat
(
"yyyy-MM"
).
format
(
new
Date
());
if
((
""
).
equals
(
attscheduling
.
getDate
())
||
attscheduling
.
getDate
()
==
null
){
attscheduling
.
setDate
(
str
);
}
attscheduling
.
setQyid
(
userBean
.
getOrgCode
());
List
<
KqglAssoPbmxDto
>
schlist
=
kqglassopbmxmapper
.
selectAttGroupScheduling
(
attscheduling
);
return
ResultUtil
.
data
(
schlist
);
}
/**
* 根据考勤组id获取班次信息--【修改考勤组】
*/
@GetMapping
(
value
=
"/roster/{id}/{date}"
)
@ApiOperation
(
value
=
"43:根据考勤组id获取班次信息"
,
httpMethod
=
"GET"
,
notes
=
"接口发布说明"
)
@ApiOperationSupport
(
order
=
43
)
public
Result
<
Object
>
getRosterList
(
@PathVariable
(
"id"
)
Integer
id
,
@PathVariable
(
"date"
)
String
date
)
{
KqzAttendanceGroupSearchDto
jycx
=
KqzAttendanceGroupSearchDto
.
builder
().
overall
(
date
).
qyid
(
id
).
build
();
List
<
KqglAssoBcsz
>
shifs
=
kqglassobcszmapper
.
selectRosterByKqzid
(
jycx
);
return
ResultUtil
.
data
(
shifs
);
}
private
SimpleDateFormat
mat
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
@Autowired
private
KqglAssoDkjlMapper
kqglassodkjlmapper
;
//打卡记录
@Autowired
private
PunchRecordMapper
punchrecordservice
;
//打卡明细表
@Autowired
private
PunchCardDetailsMapper
punchcarddetailsservice
;
/**
* 修改考勤组排班(修改排班后,需判断是否有打卡记录,有则匹配当天修改后的班次,无则不需要修改)
* @throws ParseException
*/
@PutMapping
(
value
=
"/attscheduling"
)
@ApiOperation
(
value
=
"44:修改考勤组排班"
,
httpMethod
=
"PUT"
,
notes
=
"接口发布说明"
)
@ApiOperationSupport
(
order
=
44
)
public
Result
<
Object
>
updateAttscheduling
(
@CurrentUser
UserBean
userBean
,
@RequestBody
AttendanceAssistantDto
attass
)
throws
ParseException
{
int
id
=
Integer
.
valueOf
(
attass
.
getAttgroupid
());
//修改数据id
List
<
KqglAssoPbmxDto
>
schlist
=
new
ArrayList
<
KqglAssoPbmxDto
>();
KqglAssoPbmxDto
[]
schedules
=
attass
.
getSchedules
();
// 排班日期【排班制】--班次id、日期
if
(
schedules
.
length
>
0
&&
attass
.
getAtttype
()
==
2
){
for
(
int
p
=
0
;
p
<
schedules
.
length
;
p
++){
KqglAssoPbmxDto
sch
=
KqglAssoPbmxDto
.
builder
().
userid
(
schedules
[
p
].
getUserid
()).
data
(
schedules
[
p
].
getData
()).
bcid
(
schedules
[
p
].
getBcid
()).
kqzid
(
Integer
.
valueOf
(
attass
.
getAttgroupid
())).
build
();
schlist
.
add
(
sch
);
String
data
=
mat
.
format
(
new
Date
(
schedules
[
p
].
getData
().
toString
()));
Long
startDate
=
DateUtil
.
getStartTime
(
0
,
DateUtil
.
getStringTime
(
data
,
"yyyy-MM-dd"
)).
getTime
();
Long
endDate
=
DateUtil
.
getnowEndTime
(
23
,
DateUtil
.
getStringTime
(
data
,
"yyyy-MM-dd"
)).
getTime
();
KqglAssoBcsz
banci
=
KqglAssoBcsz
.
builder
().
build
().
selectOne
(
new
QueryWrapper
<
KqglAssoBcsz
>().
lambda
().
eq
(
KqglAssoBcsz:
:
getId
,
schedules
[
p
].
getBcid
()));
Long
sbdk1
=
0
l
,
xbdk1
=
0
l
,
sbdk2
=
0
l
,
xbdk2
=
0
l
,
sbdk3
=
0
l
,
xbdk3
=
0
l
;
if
(
banci
!=
null
){
if
(
banci
.
getSxbcs
()==
1
||
banci
.
getSxbcs
()==
2
||
banci
.
getSxbcs
()==
3
){
sbdk1
=
Long
.
valueOf
(
ClockInTool
.
dateToStamp
(
data
+
" "
+
ClockInTool
.
dealDateFormat
(
banci
.
getSbdk1
(),
2
)+
":00"
));
xbdk1
=
Long
.
valueOf
(
ClockInTool
.
dateToStamp
(
data
+
" "
+
ClockInTool
.
dealDateFormat
(
banci
.
getXbdk1
(),
2
)+
":00"
));
}
if
(
banci
.
getSxbcs
()==
2
||
banci
.
getSxbcs
()==
3
){
sbdk2
=
Long
.
valueOf
(
ClockInTool
.
dateToStamp
(
data
+
" "
+
ClockInTool
.
dealDateFormat
(
banci
.
getSbdk2
(),
2
)+
":00"
));
xbdk2
=
Long
.
valueOf
(
ClockInTool
.
dateToStamp
(
data
+
" "
+
ClockInTool
.
dealDateFormat
(
banci
.
getXbdk2
(),
2
)+
":00"
));
}
if
(
banci
.
getSxbcs
()==
3
){
sbdk3
=
Long
.
valueOf
(
ClockInTool
.
dateToStamp
(
data
+
" "
+
ClockInTool
.
dealDateFormat
(
banci
.
getSbdk3
(),
2
)+
":00"
));
xbdk3
=
Long
.
valueOf
(
ClockInTool
.
dateToStamp
(
data
+
" "
+
ClockInTool
.
dealDateFormat
(
banci
.
getXbdk3
(),
2
)+
":00"
));
}
}
KqglAssoDkjl
mapuca
=
KqglAssoDkjl
.
builder
().
build
().
selectOne
(
new
QueryWrapper
<
KqglAssoDkjl
>().
lambda
().
gt
(
KqglAssoDkjl:
:
getAttime
,
startDate
).
lt
(
KqglAssoDkjl:
:
getAttime
,
endDate
).
eq
(
KqglAssoDkjl:
:
getUserId
,
schedules
[
p
].
getUserid
()).
last
(
"LIMIT 1"
));
List
<
KqglAssoDkjl
>
mapucalist
=
kqglassodkjlmapper
.
selectList
(
new
QueryWrapper
<
KqglAssoDkjl
>().
lambda
().
gt
(
KqglAssoDkjl:
:
getAttime
,
startDate
).
lt
(
KqglAssoDkjl:
:
getAttime
,
endDate
).
eq
(
KqglAssoDkjl:
:
getUserId
,
schedules
[
p
].
getUserid
()).
orderByAsc
(
KqglAssoDkjl:
:
getId
));
if
(
mapuca
!=
null
&&
!(
schedules
[
p
].
getBcid
()).
equals
(
mapuca
.
getBcid
())){
// List<KqglAssoDkjl> initial = kqglassodkjlmapper.selectList(new QueryWrapper<KqglAssoDkjl>().lambda().gt(KqglAssoDkjl::getAttime, startDate).lt(KqglAssoDkjl::getAttime, endDate).eq(KqglAssoDkjl::getUserId, schedules[p].getUserid()).orderByAsc(KqglAssoDkjl::getId));
if
(
mapucalist
.
size
()
>
0
){
RestMethod
(
mapucalist
,
mapucalist
.
get
(
0
).
getDkmxid
());
}
}
KqglAssoDkjl
minAttid
=
null
,
maxAttid
=
null
;
int
dkmxid
=
0
;
if
(
mapucalist
.
size
()
>
0
){
//最小值
minAttid
=
mapucalist
.
stream
().
min
(
Comparator
.
comparing
(
KqglAssoDkjl:
:
getId
)).
get
();
//最大值
maxAttid
=
mapucalist
.
stream
().
max
(
Comparator
.
comparing
(
KqglAssoDkjl:
:
getId
)).
get
();
//对应打卡明细表id
dkmxid
=
maxAttid
.
getDkmxid
();
}
//当天有打卡记录且当天打卡班次和当前修改后的班次不匹配再进行重新维护
if
(
mapuca
!=
null
&&
!(
schedules
[
p
].
getBcid
()).
equals
(
mapuca
.
getBcid
())){
if
(
banci
!=
null
){
//修改后有班次打卡
if
(
banci
.
getSxbcs
()
==
1
){
//修改后一天打两次
if
(
mapucalist
.
size
()
>
2
){
/////当天打卡多条的话 取最开始打的卡和最后打的卡 作为新一轮的上下班考勤
for
(
KqglAssoDkjl
pre
:
mapucalist
){
if
(
pre
.
getId
()
!=
minAttid
.
getId
()
&&
pre
.
getId
()
!=
maxAttid
.
getId
()){
//去除最大和最小 其他均改为“打卡无效:此记录已被更新”
int
results
=
0
;
long
attime
;
if
((
pre
.
getSort
())%
2
>
0
){
Long
time
=
(
pre
.
getDktime
()
-
sbdk1
)/
1000
/
60
;
if
(
time
>
0
){
results
=
Integer
.
valueOf
(
time
.
toString
());}
attime
=
sbdk1
;
//上班应打卡时间
}
else
{
Long
time
=
(
pre
.
getDktime
()
-
xbdk1
)/
1000
/
60
;
if
(
time
>
0
){}
else
{
results
=
Math
.
abs
(
Integer
.
valueOf
(
time
.
toString
()));}
attime
=
xbdk1
;
//下班应打卡时间
}
KqglAssoDkjl
.
builder
().
id
(
pre
.
getId
()).
status
(
0
).
sort
(
0
).
results
(
results
).
attime
(
attime
).
bcid
(
banci
.
getId
()).
build
().
updateById
();
}
else
{
if
(
pre
.
getId
()
==
minAttid
.
getId
()){
//上班
Long
time
=
(
pre
.
getDktime
()
-
sbdk1
)/
1000
/
60
;
int
status
=
0
,
results
=
0
;
//状态(0:打卡无效:此记录已被更新 1:正常 2:异常 3:迟到 4:早退 5:补卡 6:请假 7:加班 8:调休)
if
(
time
>
0
){
status
=
3
;
results
=
Integer
.
valueOf
(
time
.
toString
());}
else
{
status
=
1
;
results
=
0
;}
KqglAssoDkjl
.
builder
().
id
(
pre
.
getId
()).
type
(
1
).
status
(
status
).
results
(
results
).
attime
(
sbdk1
).
bcid
(
banci
.
getId
()).
build
().
updateById
();
}
else
if
(
pre
.
getId
()
==
maxAttid
.
getId
()){
//下班
Long
time
=
(
pre
.
getDktime
()
-
xbdk1
)/
1000
/
60
;
int
status
=
0
,
results
=
0
;
if
(
time
>
0
){
status
=
1
;
results
=
0
;}
else
{
status
=
4
;
results
=
Math
.
abs
(
Integer
.
valueOf
(
time
.
toString
()));}
KqglAssoDkjl
.
builder
().
id
(
pre
.
getId
()).
type
(
2
).
status
(
status
).
results
(
results
).
attime
(
xbdk1
).
bcid
(
banci
.
getId
()).
sort
(
2
).
build
().
updateById
();
}
}
}
KqglAssoDkjl
mindata
=
KqglAssoDkjl
.
builder
().
id
(
minAttid
.
getId
()).
build
().
selectById
();
KqglAssoDkmx
.
builder
().
id
(
dkmxid
).
sbdk1
(
mindata
.
getDktime
()).
sbdk1jg
(
mindata
.
getResults
()).
xbdk1
(
null
).
xbdk1jg
(
0
).
sbdk2
(
null
).
sbdk2jg
(
0
).
xbdk2
(
null
)
.
xbdk2jg
(
0
).
sbdk3
(
null
).
sbdk3jg
(
0
).
ydkcs
(
banci
.
getSxbcs
()*
2
).
gzsc
(
Double
.
valueOf
(
"0"
)).
build
().
updateById
();
KqglAssoDkjl
maxdata
=
KqglAssoDkjl
.
builder
().
id
(
maxAttid
.
getId
()).
build
().
selectById
();
Long
woktimes
=
(
maxdata
.
getDktime
()
-
mindata
.
getDktime
())/
1000
/
60
;
KqglAssoDkmx
.
builder
().
id
(
dkmxid
).
xbdk1
(
maxdata
.
getDktime
()).
xbdk1jg
(
maxdata
.
getResults
()).
gzsc
(
Double
.
valueOf
(
woktimes
)).
build
().
updateById
();
}
else
{
KqglAssoDkjl
mindataone
=
null
;
if
(
minAttid
!=
null
||
maxAttid
!=
null
){
int
status
=
0
,
results
=
0
;
Long
time
=
(
mapucalist
.
get
(
0
).
getDktime
()
-
sbdk1
)/
1000
/
60
;
if
(
time
>
0
){
status
=
3
;
results
=
Integer
.
valueOf
(
time
.
toString
());
}
else
{
status
=
1
;
results
=
0
;
}
KqglAssoDkjl
.
builder
().
id
(
mapucalist
.
get
(
0
).
getId
()).
type
(
1
).
status
(
status
).
results
(
results
).
attime
(
sbdk1
).
bcid
(
banci
.
getId
()).
build
().
updateById
();
mindataone
=
KqglAssoDkjl
.
builder
().
id
(
minAttid
.
getId
()).
build
().
selectById
();
KqglAssoDkmx
.
builder
().
id
(
dkmxid
).
sbdk1
(
mindataone
.
getDktime
()).
sbdk1jg
(
mindataone
.
getResults
()).
ydkcs
(
banci
.
getSxbcs
()*
2
).
gzsc
(
Double
.
valueOf
(
"0"
)).
build
().
updateById
();
}
if
(
maxAttid
!=
null
&&
minAttid
.
getId
()
!=
maxAttid
.
getId
()){
int
status
=
0
,
results
=
0
;
Long
time
=
(
mapucalist
.
get
(
1
).
getDktime
()
-
xbdk1
)/
1000
/
60
;
if
(
time
>
0
){
status
=
1
;
results
=
0
;
}
else
{
status
=
4
;
results
=
Math
.
abs
(
Integer
.
valueOf
(
time
.
toString
()));
}
KqglAssoDkjl
.
builder
().
id
(
mapucalist
.
get
(
1
).
getId
()).
type
(
2
).
status
(
status
).
results
(
results
).
attime
(
xbdk1
).
bcid
(
banci
.
getId
()).
sort
(
2
).
build
().
updateById
();
KqglAssoDkjl
maxdata
=
KqglAssoDkjl
.
builder
().
id
(
maxAttid
.
getId
()).
build
().
selectById
();
Long
woktimes
=
(
maxdata
.
getDktime
()
-
mindataone
.
getDktime
())/
1000
/
60
;
KqglAssoDkmx
.
builder
().
id
(
dkmxid
).
xbdk1
(
maxdata
.
getDktime
()).
xbdk1jg
(
maxdata
.
getResults
()).
gzsc
(
Double
.
valueOf
(
woktimes
)).
build
().
updateById
();
}
}
}
else
if
(
banci
.
getSxbcs
()
==
2
){
//修改后一天打四次
if
(
mapucalist
.
size
()
>
4
){
//当天打卡多次
String
[]
str
=
new
String
[
3
];
for
(
int
y
=
0
;
y
<
mapucalist
.
size
();
y
++){
if
(
y
==
0
){
//上班
PunchRecord
mindata
=
punchrecordservice
.
selectByPrimaryKey
(
minAttid
.
getId
());
//上班
PunchRecord
record
=
new
PunchRecord
();
record
.
setId
(
mapucalist
.
get
(
y
).
getId
());
Long
time
=
(
mindata
.
getDktime
()
-
sbdk1
)/
1000
/
60
;
if
(
time
>
0
){
record
.
setStatus
(
3
);
//状态(0:打卡无效:此记录已被更新 1:正常 2:异常 3:迟到 4:早退 5:补卡 6:请假 7:加班 8:调休)
record
.
setResults
(
Integer
.
valueOf
(
time
.
toString
()));
// 打卡结果
}
else
{
record
.
setStatus
(
1
);
record
.
setResults
(
0
);
// 打卡结果
}
record
.
setAttime
(
sbdk1
);
record
.
setBcid
(
banci
.
getId
());
//班次id
punchrecordservice
.
updateByPrimaryKeySelective
(
record
);
}
if
(
y
==
1
||
y
==
2
){
PunchRecord
record
=
new
PunchRecord
();
record
.
setId
(
mapucalist
.
get
(
y
).
getId
());
if
((
mapucalist
.
get
(
y
).
getSort
())%
2
==
0
){
//下班
Long
time
=
(
mapucalist
.
get
(
y
).
getDktime
()
-
xbdk1
)/
1000
/
60
;
if
(
time
>
0
){
record
.
setStatus
(
1
);
record
.
setResults
(
0
);
// 打卡结果
}
else
{
record
.
setStatus
(
4
);
record
.
setResults
(
Math
.
abs
(
Integer
.
valueOf
(
time
.
toString
())));
// 打卡结果
}
record
.
setAttime
(
xbdk1
);
//下班应打卡时间
str
[
0
]
=
String
.
valueOf
(
mapucalist
.
get
(
y
).
getId
());
}
else
{
//上班
Long
time
=
(
mapucalist
.
get
(
y
).
getDktime
()
-
sbdk2
)/
1000
/
60
;
if
(
time
>
0
){
record
.
setStatus
(
3
);
record
.
setResults
(
Integer
.
valueOf
(
time
.
toString
()));
// 打卡结果
}
else
{
record
.
setStatus
(
1
);
record
.
setResults
(
0
);
// 打卡结果
}
record
.
setAttime
(
sbdk2
);
//上班应打卡时间
str
[
1
]
=
String
.
valueOf
(
mapucalist
.
get
(
y
).
getId
());
}
record
.
setBcid
(
banci
.
getId
());
//班次id
punchrecordservice
.
updateByPrimaryKeySelective
(
record
);
}
PunchRecord
maxdata
=
punchrecordservice
.
selectByPrimaryKey
(
maxAttid
.
getId
());
//下班
if
(
mapucalist
.
get
(
y
).
getId
()
==
maxdata
.
getId
()){
//下班
PunchRecord
record
=
new
PunchRecord
();
record
.
setId
(
maxdata
.
getId
());
record
.
setType
(
2
);
//下班
Long
time
=
(
maxdata
.
getDktime
()
-
xbdk2
)/
1000
/
60
;
if
(
time
>
0
){
record
.
setStatus
(
1
);
record
.
setResults
(
0
);
// 打卡结果
}
else
{
record
.
setStatus
(
4
);
record
.
setResults
(
Math
.
abs
(
Integer
.
valueOf
(
time
.
toString
())));
// 打卡结果
}
record
.
setSort
(
4
);
record
.
setAttime
(
xbdk2
);
record
.
setBcid
(
banci
.
getId
());
//班次id
punchrecordservice
.
updateByPrimaryKeySelective
(
record
);
str
[
2
]
=
String
.
valueOf
(
maxdata
.
getId
());
}
if
(
y
==
3
||
y
>
3
&&
mapucalist
.
get
(
y
).
getId
()
!=
maxdata
.
getId
()){
PunchRecord
record
=
new
PunchRecord
();
record
.
setId
(
mapucalist
.
get
(
y
).
getId
());
record
.
setStatus
(
0
);
//状态(0:打卡无效:此记录已被更新 1:正常 2:异常 3:迟到 4:早退 5:补卡 6:请假 7:加班 8:调休)
record
.
setSort
(
0
);
//序号(0:打卡无效:此记录已被更新)
record
.
setResults
(
0
);
// 打卡结果
record
.
setAttime
(
mapucalist
.
get
(
y
).
getDktime
());
//上班应打卡时间
record
.
setBcid
(
banci
.
getId
());
//班次id
punchrecordservice
.
updateByPrimaryKeySelective
(
record
);
}
}
//修改打卡明细
PunchRecord
mindata
=
punchrecordservice
.
selectByPrimaryKey
(
minAttid
.
getId
());
//上班
PunchCardDetails
record
=
new
PunchCardDetails
();
record
.
setId
(
dkmxid
);
//需修改的明细id
record
.
setSbdk1
(
mindata
.
getDktime
());
record
.
setSbdk1jg
(
mindata
.
getResults
());
// 上班1打卡结果
record
.
setXbdk1
(
null
);
record
.
setXbdk1jg
(
0
);
// 下班1打卡结果
record
.
setSbdk2
(
null
);
record
.
setSbdk2jg
(
0
);
// 上班2打卡结果
record
.
setXbdk2
(
null
);
record
.
setXbdk2jg
(
0
);
// 下班2打卡结果
record
.
setSbdk3
(
null
);
record
.
setSbdk3jg
(
0
);
// 上班3打卡结果
record
.
setXbdk3
(
null
);
record
.
setXbdk3jg
(
0
);
// 下班3打卡结果
record
.
setYdkcs
(
banci
.
getSxbcs
()*
2
);
//应打卡次数
record
.
setGzsc
(
Double
.
valueOf
(
"0"
));
punchcarddetailsservice
.
ModifyPunchDetails
(
record
);
for
(
int
t
=
0
;
t
<
str
.
length
;
t
++){
PunchRecord
dtdkmx
=
punchrecordservice
.
selectByPrimaryKey
(
Integer
.
valueOf
(
str
[
t
]));
//单条打卡明细
PunchCardDetails
dkmx
=
new
PunchCardDetails
();
dkmx
.
setId
(
dkmxid
);
//需修改的明细id
if
(
t
==
0
){
dkmx
.
setXbdk1
(
dtdkmx
.
getDktime
());
dkmx
.
setXbdk1jg
(
dtdkmx
.
getResults
());
// 下班1打卡结果
}
else
if
(
t
==
1
){
dkmx
.
setSbdk2
(
dtdkmx
.
getDktime
());
dkmx
.
setSbdk2jg
(
dtdkmx
.
getResults
());
// 上班2打卡结果
}
else
{
dkmx
.
setXbdk2
(
dtdkmx
.
getDktime
());
dkmx
.
setXbdk2jg
(
dtdkmx
.
getResults
());
// 下班2打卡结果
}
Long
woktimes
=
(
dtdkmx
.
getDktime
()
-
mindata
.
getDktime
())/
1000
/
60
;
dkmx
.
setGzsc
(
Double
.
valueOf
(
woktimes
));
punchcarddetailsservice
.
updateByPrimaryKeySelective
(
dkmx
);
}
}
else
{
//打卡小于4次
PunchRecord
mindataone
=
null
;
if
(
minAttid
!=
null
||
maxAttid
!=
null
){
PunchRecord
record
=
new
PunchRecord
();
record
.
setId
(
mapucalist
.
get
(
0
).
getId
());
//当天一条记录的id
record
.
setType
(
1
);
//上班
Long
time
=
(
mapucalist
.
get
(
0
).
getDktime
()
-
sbdk1
)/
1000
/
60
;
if
(
time
>
0
){
record
.
setStatus
(
3
);
//状态(0:打卡无效:此记录已被更新 1:正常 2:异常 3:迟到 4:早退 5:补卡 6:请假 7:加班 8:调休)
record
.
setResults
(
Integer
.
valueOf
(
time
.
toString
()));
// 打卡结果
}
else
{
record
.
setStatus
(
1
);
record
.
setResults
(
0
);
// 打卡结果
}
record
.
setAttime
(
sbdk1
);
//当天应打卡时间
record
.
setBcid
(
banci
.
getId
());
//班次id
punchrecordservice
.
updateByPrimaryKeySelective
(
record
);
mindataone
=
punchrecordservice
.
selectByPrimaryKey
(
minAttid
.
getId
());
//上班
PunchCardDetails
dan
=
new
PunchCardDetails
();
dan
.
setId
(
dkmxid
);
//需修改的明细id
dan
.
setSbdk1
(
mindataone
.
getDktime
());
dan
.
setSbdk1jg
(
mindataone
.
getResults
());
// 上班1打卡结果
dan
.
setYdkcs
(
banci
.
getSxbcs
()*
2
);
//应打卡次数
dan
.
setGzsc
(
Double
.
valueOf
(
"0"
));
punchcarddetailsservice
.
updateByPrimaryKeySelective
(
dan
);
}
PunchCardDetails
pcd
=
new
PunchCardDetails
();
if
(
mapucalist
.
size
()
>=
2
){
PunchRecord
record
=
new
PunchRecord
();
record
.
setId
(
mapucalist
.
get
(
1
).
getId
());
//当天一条记录的id
record
.
setType
(
2
);
Long
time
=
(
mapucalist
.
get
(
1
).
getDktime
()
-
xbdk1
)/
1000
/
60
;
if
(
time
>
0
){
record
.
setStatus
(
1
);
record
.
setResults
(
0
);
// 打卡结果
}
else
{
record
.
setStatus
(
4
);
record
.
setResults
(
Math
.
abs
(
Integer
.
valueOf
(
time
.
toString
())));
// 打卡结果
}
record
.
setAttime
(
xbdk1
);
//当天应打卡时间
record
.
setBcid
(
banci
.
getId
());
//班次id
punchrecordservice
.
updateByPrimaryKeySelective
(
record
);
PunchRecord
dtdkmx
=
punchrecordservice
.
selectByPrimaryKey
(
mapucalist
.
get
(
1
).
getId
());
//单条打卡明细
pcd
.
setXbdk1
(
dtdkmx
.
getDktime
());
pcd
.
setXbdk1jg
(
dtdkmx
.
getResults
());
}
if
(
mapucalist
.
size
()
>=
3
){
PunchRecord
record
=
new
PunchRecord
();
record
.
setId
(
mapucalist
.
get
(
2
).
getId
());
//当天一条记录的id
record
.
setType
(
1
);
Long
time
=
(
mapucalist
.
get
(
2
).
getDktime
()
-
sbdk2
)/
1000
/
60
;
if
(
time
>
0
){
record
.
setStatus
(
3
);
//状态(0:打卡无效:此记录已被更新 1:正常 2:异常 3:迟到 4:早退 5:补卡 6:请假 7:加班 8:调休)
record
.
setResults
(
Integer
.
valueOf
(
time
.
toString
()));
// 打卡结果
}
else
{
record
.
setStatus
(
1
);
record
.
setResults
(
0
);
// 打卡结果
}
record
.
setAttime
(
sbdk2
);
//当天应打卡时间
record
.
setBcid
(
banci
.
getId
());
//班次id
punchrecordservice
.
updateByPrimaryKeySelective
(
record
);
PunchRecord
dtdkmx
=
punchrecordservice
.
selectByPrimaryKey
(
mapucalist
.
get
(
2
).
getId
());
//单条打卡明细
pcd
.
setSbdk2
(
dtdkmx
.
getDktime
());
pcd
.
setSbdk2jg
(
dtdkmx
.
getResults
());
}
if
(
mapucalist
.
size
()
>=
4
){
PunchRecord
record
=
new
PunchRecord
();
record
.
setId
(
maxAttid
.
getId
());
//当天一条记录的id
record
.
setType
(
2
);
Long
time
=
(
maxAttid
.
getDktime
()
-
xbdk2
)/
1000
/
60
;
if
(
time
>
0
){
record
.
setStatus
(
1
);
record
.
setResults
(
0
);
// 打卡结果
}
else
{
record
.
setStatus
(
4
);
record
.
setResults
(
Math
.
abs
(
Integer
.
valueOf
(
time
.
toString
())));
// 打卡结果
}
record
.
setAttime
(
xbdk2
);
//当天应打卡时间
record
.
setBcid
(
banci
.
getId
());
//班次id
punchrecordservice
.
updateByPrimaryKeySelective
(
record
);
PunchRecord
dtdkmx
=
punchrecordservice
.
selectByPrimaryKey
(
maxAttid
.
getId
());
//单条打卡明细
pcd
.
setXbdk2
(
dtdkmx
.
getDktime
());
pcd
.
setXbdk2jg
(
dtdkmx
.
getResults
());
}
pcd
.
setId
(
dkmxid
);
punchcarddetailsservice
.
updateByPrimaryKeySelective
(
pcd
);
}
}
else
if
(
banci
.
getSxbcs
()
==
3
){
//修改后一天打六次
if
(
mapucalist
.
size
()
>
6
){
//当天打卡多次
String
[]
str
=
new
String
[
5
];
for
(
int
y
=
0
;
y
<
mapucalist
.
size
();
y
++){
if
(
y
==
0
){
//上班
PunchRecord
mindata
=
punchrecordservice
.
selectByPrimaryKey
(
minAttid
.
getId
());
//上班
PunchRecord
record
=
new
PunchRecord
();
record
.
setId
(
mapucalist
.
get
(
y
).
getId
());
Long
time
=
(
mindata
.
getDktime
()
-
sbdk1
)/
1000
/
60
;
if
(
time
>
0
){
record
.
setStatus
(
3
);
//状态(0:打卡无效:此记录已被更新 1:正常 2:异常 3:迟到 4:早退 5:补卡 6:请假 7:加班 8:调休)
record
.
setResults
(
Integer
.
valueOf
(
time
.
toString
()));
// 打卡结果
}
else
{
record
.
setStatus
(
1
);
record
.
setResults
(
0
);
// 打卡结果
}
record
.
setAttime
(
sbdk1
);
record
.
setBcid
(
banci
.
getId
());
//班次id
punchrecordservice
.
updateByPrimaryKeySelective
(
record
);
}
if
(
y
==
1
||
y
==
2
||
y
==
3
||
y
==
4
){
PunchRecord
record
=
new
PunchRecord
();
record
.
setId
(
mapucalist
.
get
(
y
).
getId
());
if
((
mapucalist
.
get
(
y
).
getSort
())%
2
==
0
){
//下班
if
(
y
==
1
){
Long
time
=
(
mapucalist
.
get
(
y
).
getDktime
()
-
xbdk1
)/
1000
/
60
;
if
(
time
>
0
){
record
.
setStatus
(
1
);
record
.
setResults
(
0
);
// 打卡结果
}
else
{
record
.
setStatus
(
4
);
record
.
setResults
(
Math
.
abs
(
Integer
.
valueOf
(
time
.
toString
())));
// 打卡结果
}
record
.
setAttime
(
xbdk1
);
//下班应打卡时间
str
[
0
]
=
String
.
valueOf
(
mapucalist
.
get
(
y
).
getId
());
}
if
(
y
==
3
){
Long
time
=
(
mapucalist
.
get
(
y
).
getDktime
()
-
xbdk2
)/
1000
/
60
;
if
(
time
>
0
){
record
.
setStatus
(
1
);
record
.
setResults
(
0
);
// 打卡结果
}
else
{
record
.
setStatus
(
4
);
record
.
setResults
(
Math
.
abs
(
Integer
.
valueOf
(
time
.
toString
())));
// 打卡结果
}
record
.
setAttime
(
xbdk2
);
//下班应打卡时间
str
[
2
]
=
String
.
valueOf
(
mapucalist
.
get
(
y
).
getId
());
}
}
else
{
//上班
if
(
y
==
2
){
Long
time
=
(
mapucalist
.
get
(
y
).
getDktime
()
-
sbdk2
)/
1000
/
60
;
if
(
time
>
0
){
record
.
setStatus
(
3
);
record
.
setResults
(
Integer
.
valueOf
(
time
.
toString
()));
// 打卡结果
}
else
{
record
.
setStatus
(
1
);
record
.
setResults
(
0
);
// 打卡结果
}
record
.
setAttime
(
sbdk2
);
//上班应打卡时间
str
[
1
]
=
String
.
valueOf
(
mapucalist
.
get
(
y
).
getId
());
}
if
(
y
==
4
){
Long
time
=
(
mapucalist
.
get
(
y
).
getDktime
()
-
sbdk3
)/
1000
/
60
;
if
(
time
>
0
){
record
.
setStatus
(
3
);
record
.
setResults
(
Integer
.
valueOf
(
time
.
toString
()));
// 打卡结果
}
else
{
record
.
setStatus
(
1
);
record
.
setResults
(
0
);
// 打卡结果
}
record
.
setAttime
(
sbdk3
);
//上班应打卡时间
str
[
3
]
=
String
.
valueOf
(
mapucalist
.
get
(
y
).
getId
());
}
}
record
.
setBcid
(
banci
.
getId
());
//班次id
punchrecordservice
.
updateByPrimaryKeySelective
(
record
);
}
PunchRecord
maxdata
=
punchrecordservice
.
selectByPrimaryKey
(
maxAttid
.
getId
());
//下班
if
(
mapucalist
.
get
(
y
).
getId
()
==
maxdata
.
getId
()){
//下班
PunchRecord
record
=
new
PunchRecord
();
record
.
setId
(
maxdata
.
getId
());
record
.
setType
(
2
);
//下班
Long
time
=
(
maxdata
.
getDktime
()
-
xbdk3
)/
1000
/
60
;
if
(
time
>
0
){
record
.
setStatus
(
1
);
record
.
setResults
(
0
);
// 打卡结果
}
else
{
record
.
setStatus
(
4
);
record
.
setResults
(
Math
.
abs
(
Integer
.
valueOf
(
time
.
toString
())));
// 打卡结果
}
record
.
setSort
(
6
);
record
.
setAttime
(
xbdk3
);
record
.
setBcid
(
banci
.
getId
());
//班次id
punchrecordservice
.
updateByPrimaryKeySelective
(
record
);
str
[
4
]
=
String
.
valueOf
(
maxdata
.
getId
());
}
if
(
y
==
5
||
y
>
5
&&
mapucalist
.
get
(
y
).
getId
()
!=
maxdata
.
getId
()){
PunchRecord
record
=
new
PunchRecord
();
record
.
setId
(
mapucalist
.
get
(
y
).
getId
());
record
.
setStatus
(
0
);
//状态(0:打卡无效:此记录已被更新 1:正常 2:异常 3:迟到 4:早退 5:补卡 6:请假 7:加班 8:调休)
record
.
setSort
(
0
);
//序号(0:打卡无效:此记录已被更新)
record
.
setResults
(
0
);
// 打卡结果
record
.
setAttime
(
mapucalist
.
get
(
y
).
getDktime
());
//上班应打卡时间
record
.
setBcid
(
banci
.
getId
());
//班次id
punchrecordservice
.
updateByPrimaryKeySelective
(
record
);
}
}
//修改打卡明细
PunchRecord
mindata
=
punchrecordservice
.
selectByPrimaryKey
(
minAttid
.
getId
());
//上班
PunchCardDetails
record
=
new
PunchCardDetails
();
record
.
setId
(
dkmxid
);
//需修改的明细id
record
.
setSbdk1
(
mindata
.
getDktime
());
record
.
setSbdk1jg
(
mindata
.
getResults
());
// 上班1打卡结果
record
.
setXbdk1
(
null
);
record
.
setXbdk1jg
(
0
);
// 下班1打卡结果
record
.
setSbdk2
(
null
);
record
.
setSbdk2jg
(
0
);
// 上班2打卡结果
record
.
setXbdk2
(
null
);
record
.
setXbdk2jg
(
0
);
// 下班2打卡结果
record
.
setSbdk3
(
null
);
record
.
setSbdk3jg
(
0
);
// 上班3打卡结果
record
.
setXbdk3
(
null
);
record
.
setXbdk3jg
(
0
);
// 下班3打卡结果
record
.
setYdkcs
(
banci
.
getSxbcs
()*
2
);
//应打卡次数
record
.
setGzsc
(
Double
.
valueOf
(
"0"
));
punchcarddetailsservice
.
ModifyPunchDetails
(
record
);
for
(
int
t
=
0
;
t
<
str
.
length
;
t
++){
PunchRecord
dtdkmx
=
punchrecordservice
.
selectByPrimaryKey
(
Integer
.
valueOf
(
str
[
t
]));
//单条打卡明细
PunchCardDetails
dkmx
=
new
PunchCardDetails
();
dkmx
.
setId
(
dkmxid
);
//需修改的明细id
if
(
t
==
0
){
dkmx
.
setXbdk1
(
dtdkmx
.
getDktime
());
dkmx
.
setXbdk1jg
(
dtdkmx
.
getResults
());
// 下班1打卡结果
}
else
if
(
t
==
1
){
dkmx
.
setSbdk2
(
dtdkmx
.
getDktime
());
dkmx
.
setSbdk2jg
(
dtdkmx
.
getResults
());
// 上班2打卡结果
}
else
if
(
t
==
2
){
dkmx
.
setXbdk2
(
dtdkmx
.
getDktime
());
dkmx
.
setXbdk2jg
(
dtdkmx
.
getResults
());
// 下班2打卡结果
}
else
if
(
t
==
3
){
dkmx
.
setSbdk3
(
dtdkmx
.
getDktime
());
dkmx
.
setSbdk3jg
(
dtdkmx
.
getResults
());
// 上班3打卡结果
}
else
{
dkmx
.
setXbdk3
(
dtdkmx
.
getDktime
());
dkmx
.
setXbdk3jg
(
dtdkmx
.
getResults
());
// 下班3打卡结果
}
Long
woktimes
=
(
dtdkmx
.
getDktime
()
-
mindata
.
getDktime
())/
1000
/
60
;
dkmx
.
setGzsc
(
Double
.
valueOf
(
woktimes
));
punchcarddetailsservice
.
updateByPrimaryKeySelective
(
dkmx
);
}
}
else
{
PunchRecord
mindataone
=
null
;
if
(
minAttid
!=
null
||
maxAttid
!=
null
){
PunchRecord
record
=
new
PunchRecord
();
record
.
setId
(
mapucalist
.
get
(
0
).
getId
());
//当天一条记录的id
record
.
setType
(
1
);
//上班
Long
time
=
(
mapucalist
.
get
(
0
).
getDktime
()
-
sbdk1
)/
1000
/
60
;
if
(
time
>
0
){
record
.
setStatus
(
3
);
//状态(0:打卡无效:此记录已被更新 1:正常 2:异常 3:迟到 4:早退 5:补卡 6:请假 7:加班 8:调休)
record
.
setResults
(
Integer
.
valueOf
(
time
.
toString
()));
// 打卡结果
}
else
{
record
.
setStatus
(
1
);
record
.
setResults
(
0
);
// 打卡结果
}
record
.
setAttime
(
sbdk1
);
//当天应打卡时间
record
.
setBcid
(
banci
.
getId
());
//班次id
punchrecordservice
.
updateByPrimaryKeySelective
(
record
);
mindataone
=
punchrecordservice
.
selectByPrimaryKey
(
minAttid
.
getId
());
//上班
PunchCardDetails
dan
=
new
PunchCardDetails
();
dan
.
setId
(
dkmxid
);
//需修改的明细id
dan
.
setSbdk1
(
mindataone
.
getDktime
());
dan
.
setSbdk1jg
(
mindataone
.
getResults
());
// 上班1打卡结果
dan
.
setYdkcs
(
banci
.
getSxbcs
()*
2
);
//应打卡次数
dan
.
setGzsc
(
Double
.
valueOf
(
"0"
));
punchcarddetailsservice
.
updateByPrimaryKeySelective
(
dan
);
}
PunchCardDetails
pcd
=
new
PunchCardDetails
();
if
(
mapucalist
.
size
()
>=
2
){
PunchRecord
record
=
new
PunchRecord
();
record
.
setId
(
mapucalist
.
get
(
1
).
getId
());
//当天一条记录的id
record
.
setType
(
2
);
Long
time
=
(
mapucalist
.
get
(
1
).
getDktime
()
-
xbdk1
)/
1000
/
60
;
if
(
time
>
0
){
record
.
setStatus
(
1
);
record
.
setResults
(
0
);
// 打卡结果
}
else
{
record
.
setStatus
(
4
);
record
.
setResults
(
Math
.
abs
(
Integer
.
valueOf
(
time
.
toString
())));
// 打卡结果
}
record
.
setAttime
(
xbdk1
);
//当天应打卡时间
record
.
setBcid
(
banci
.
getId
());
//班次id
punchrecordservice
.
updateByPrimaryKeySelective
(
record
);
PunchRecord
dtdkmx
=
punchrecordservice
.
selectByPrimaryKey
(
mapucalist
.
get
(
1
).
getId
());
//单条打卡明细
pcd
.
setXbdk1
(
dtdkmx
.
getDktime
());
pcd
.
setXbdk1jg
(
dtdkmx
.
getResults
());
}
if
(
mapucalist
.
size
()
>=
3
){
PunchRecord
record
=
new
PunchRecord
();
record
.
setId
(
mapucalist
.
get
(
2
).
getId
());
//当天一条记录的id
record
.
setType
(
1
);
Long
time
=
(
mapucalist
.
get
(
2
).
getDktime
()
-
sbdk2
)/
1000
/
60
;
if
(
time
>
0
){
record
.
setStatus
(
3
);
//状态(0:打卡无效:此记录已被更新 1:正常 2:异常 3:迟到 4:早退 5:补卡 6:请假 7:加班 8:调休)
record
.
setResults
(
Integer
.
valueOf
(
time
.
toString
()));
// 打卡结果
}
else
{
record
.
setStatus
(
1
);
record
.
setResults
(
0
);
// 打卡结果
}
record
.
setAttime
(
sbdk2
);
//当天应打卡时间
record
.
setBcid
(
banci
.
getId
());
//班次id
punchrecordservice
.
updateByPrimaryKeySelective
(
record
);
PunchRecord
dtdkmx
=
punchrecordservice
.
selectByPrimaryKey
(
mapucalist
.
get
(
2
).
getId
());
//单条打卡明细
pcd
.
setSbdk2
(
dtdkmx
.
getDktime
());
pcd
.
setSbdk2jg
(
dtdkmx
.
getResults
());
}
if
(
mapucalist
.
size
()
>=
4
){
PunchRecord
record
=
new
PunchRecord
();
record
.
setId
(
mapucalist
.
get
(
3
).
getId
());
//当天一条记录的id
record
.
setType
(
1
);
Long
time
=
(
mapucalist
.
get
(
3
).
getDktime
()
-
xbdk2
)/
1000
/
60
;
if
(
time
>
0
){
record
.
setStatus
(
3
);
//状态(0:打卡无效:此记录已被更新 1:正常 2:异常 3:迟到 4:早退 5:补卡 6:请假 7:加班 8:调休)
record
.
setResults
(
Integer
.
valueOf
(
time
.
toString
()));
// 打卡结果
}
else
{
record
.
setStatus
(
1
);
record
.
setResults
(
0
);
// 打卡结果
}
record
.
setAttime
(
xbdk2
);
//当天应打卡时间
record
.
setBcid
(
banci
.
getId
());
//班次id
punchrecordservice
.
updateByPrimaryKeySelective
(
record
);
PunchRecord
dtdkmx
=
punchrecordservice
.
selectByPrimaryKey
(
mapucalist
.
get
(
3
).
getId
());
//单条打卡明细
pcd
.
setXbdk2
(
dtdkmx
.
getDktime
());
pcd
.
setXbdk2jg
(
dtdkmx
.
getResults
());
}
if
(
mapucalist
.
size
()
>=
5
){
PunchRecord
record
=
new
PunchRecord
();
record
.
setId
(
mapucalist
.
get
(
4
).
getId
());
//当天一条记录的id
record
.
setType
(
1
);
Long
time
=
(
mapucalist
.
get
(
4
).
getDktime
()
-
sbdk3
)/
1000
/
60
;
if
(
time
>
0
){
record
.
setStatus
(
3
);
//状态(0:打卡无效:此记录已被更新 1:正常 2:异常 3:迟到 4:早退 5:补卡 6:请假 7:加班 8:调休)
record
.
setResults
(
Integer
.
valueOf
(
time
.
toString
()));
// 打卡结果
}
else
{
record
.
setStatus
(
1
);
record
.
setResults
(
0
);
// 打卡结果
}
record
.
setAttime
(
sbdk3
);
//当天应打卡时间
record
.
setBcid
(
banci
.
getId
());
//班次id
punchrecordservice
.
updateByPrimaryKeySelective
(
record
);
PunchRecord
dtdkmx
=
punchrecordservice
.
selectByPrimaryKey
(
mapucalist
.
get
(
4
).
getId
());
//单条打卡明细
pcd
.
setSbdk3
(
dtdkmx
.
getDktime
());
pcd
.
setSbdk3jg
(
dtdkmx
.
getResults
());
}
if
(
mapucalist
.
size
()
>=
6
){
PunchRecord
record
=
new
PunchRecord
();
record
.
setId
(
maxAttid
.
getId
());
//当天一条记录的id
record
.
setType
(
2
);
Long
time
=
(
maxAttid
.
getDktime
()
-
xbdk3
)/
1000
/
60
;
if
(
time
>
0
){
record
.
setStatus
(
1
);
record
.
setResults
(
0
);
// 打卡结果
}
else
{
record
.
setStatus
(
4
);
record
.
setResults
(
Math
.
abs
(
Integer
.
valueOf
(
time
.
toString
())));
// 打卡结果
}
record
.
setAttime
(
xbdk3
);
//当天应打卡时间
record
.
setBcid
(
banci
.
getId
());
//班次id
punchrecordservice
.
updateByPrimaryKeySelective
(
record
);
PunchRecord
dtdkmx
=
punchrecordservice
.
selectByPrimaryKey
(
maxAttid
.
getId
());
//单条打卡明细
pcd
.
setXbdk3
(
dtdkmx
.
getDktime
());
pcd
.
setXbdk3jg
(
dtdkmx
.
getResults
());
}
pcd
.
setId
(
dkmxid
);
punchcarddetailsservice
.
updateByPrimaryKeySelective
(
pcd
);
}
}
}
else
{
////修改后班次为休息的
RestMethod
(
mapucalist
,
dkmxid
);
}
}
}
}
if
(
schlist
.
size
()>
0
){
//删除排班明细表(自由排班)
KqglAssoPbmx
.
builder
().
build
().
delete
(
new
QueryWrapper
<
KqglAssoPbmx
>().
lambda
().
eq
(
KqglAssoPbmx:
:
getKqzid
,
id
));
kqglassopbmxmapper
.
insertKqglAssoPbmxList
(
schlist
);
return
ResultUtil
.
data
(
schlist
,
"修改考勤组排班成功"
);
}
return
ResultUtil
.
error
(
"修改考勤组排班失败"
);
}
/**
* 班次修改调用方法
*/
public
void
RestMethod
(
List
<
KqglAssoDkjl
>
mapucalist
,
int
dkmxid
){
int
q
=
1
;
for
(
KqglAssoDkjl
pres
:
mapucalist
){
int
type
=
0
;
if
(
q
%
2
>
0
){
type
=
1
;}
else
{
type
=
2
;}
KqglAssoDkjl
.
builder
().
id
(
pres
.
getId
()).
results
(
0
).
type
(
type
).
status
(
1
).
sort
(
q
).
attime
(
pres
.
getDktime
()).
bcid
(
0
).
build
().
updateById
();
q
++;
}
if
(
mapucalist
.
size
()
>
0
){
/*******修改打卡明细数据****/
KqglAssoDkmx
pcd
=
KqglAssoDkmx
.
builder
().
build
();
if
(
mapucalist
.
size
()
>=
1
){
pcd
.
setSbdk1
(
mapucalist
.
get
(
0
).
getDktime
());
pcd
.
setSbdk1jg
(
0
);}
if
(
mapucalist
.
size
()
>=
2
){
pcd
.
setXbdk1
(
mapucalist
.
get
(
1
).
getDktime
());
pcd
.
setXbdk1jg
(
0
);}
if
(
mapucalist
.
size
()
>=
3
){
pcd
.
setSbdk2
(
mapucalist
.
get
(
2
).
getDktime
());
pcd
.
setSbdk2jg
(
0
);}
if
(
mapucalist
.
size
()
>=
4
){
pcd
.
setXbdk2
(
mapucalist
.
get
(
3
).
getDktime
());
pcd
.
setXbdk2jg
(
0
);}
if
(
mapucalist
.
size
()
>=
5
){
pcd
.
setSbdk3
(
mapucalist
.
get
(
4
).
getDktime
());
pcd
.
setSbdk3jg
(
0
);}
if
(
mapucalist
.
size
()
>=
6
){
pcd
.
setXbdk3
(
mapucalist
.
get
(
5
).
getDktime
());
pcd
.
setXbdk3jg
(
0
);}
pcd
.
setId
(
dkmxid
);
pcd
.
updateById
();
}
}
@PostMapping
(
value
=
"/leave_balance_list"
)
@ApiOperation
(
value
=
"45:获取修改的排班明细"
,
httpMethod
=
"POST"
,
notes
=
"接口发布说明"
)
@ApiOperationSupport
(
order
=
45
)
public
Result
<
Object
>
LeaveBalanceList
(
@CurrentUser
UserBean
userBean
,
@Validated
@RequestBody
AttqueryCriteriaDto
attquerycriteriadto
)
{
IPage
<
EmployeeLeaveBalanceDto
>
page
=
new
Page
<
EmployeeLeaveBalanceDto
>(
attquerycriteriadto
.
getCurrentPage
()
==
null
?
1
:
attquerycriteriadto
.
getCurrentPage
(),
attquerycriteriadto
.
getTotalPage
()
==
null
?
10
:
attquerycriteriadto
.
getTotalPage
());
attquerycriteriadto
.
setOrgCode
(
userBean
.
getOrgCode
());
attquerycriteriadto
.
setEmpNum
(
userBean
.
getEmpNum
());
// 缺-部门id 搜索
IPage
<
EmployeeLeaveBalanceDto
>
pageAs
=
kqglassoleavebalancemapper
.
selectPageByQueryLeaveBalance
(
page
,
attquerycriteriadto
);
List
<
EmployeeLeaveBalanceDto
>
listAs
=
pageAs
.
getRecords
();
return
ResultUtil
.
data
(
pageAs
,
listAs
,
"操作成功!"
);
}
/**************************/
/**
* 查询列表-加班补偿方式
...
...
src/main/java/cn/timer/api/dao/kqmk/KqglAssoBcszMapper.java
View file @
b1255a14
package
cn
.
timer
.
api
.
dao
.
kqmk
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
java.util.List
;
import
org.springframework.stereotype.Repository
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
cn.timer.api.bean.kqmk.KqglAssoBcsz
;
import
cn.timer.api.dto.kqmk.KqzAttendanceGroupSearchDto
;
/**
...
...
@@ -17,4 +19,6 @@ public interface KqglAssoBcszMapper extends BaseMapper<KqglAssoBcsz> {
int
insert
(
KqglAssoBcsz
kqglassobcsz
);
int
update
(
KqglAssoBcsz
kqglassobcsz
);
List
<
KqglAssoBcsz
>
selectRosterByKqzid
(
KqzAttendanceGroupSearchDto
kqzattendancegroupsearchdto
);
}
src/main/java/cn/timer/api/dao/kqmk/KqglAssoKqzdkfsMapper.java
View file @
b1255a14
package
cn
.
timer
.
api
.
dao
.
kqmk
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
java.util.List
;
import
org.springframework.stereotype.Repository
;
import
cn.timer.api.bean.kqmk.KqglAssoKqzdkfs
;
...
...
@@ -12,5 +15,7 @@ import cn.timer.api.bean.kqmk.KqglAssoKqzdkfs;
*/
@Repository
public
interface
KqglAssoKqzdkfsMapper
extends
BaseMapper
<
KqglAssoKqzdkfs
>
{
int
insertKqglAssokqzdKfsList
(
List
<
KqglAssoKqzdkfs
>
kqglassokqzdkfs
);
}
src/main/java/cn/timer/api/dao/kqmk/KqglAssoLeaveBalanceMapper.java
View file @
b1255a14
package
cn
.
timer
.
api
.
dao
.
kqmk
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
org.apache.ibatis.annotations.Param
;
import
org.springframework.stereotype.Repository
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
cn.timer.api.bean.kqmk.KqglAssoLeaveBalance
;
import
cn.timer.api.dto.kqmk.AttqueryCriteriaDto
;
import
cn.timer.api.dto.kqmk.EmployeeLeaveBalanceDto
;
/**
* 员工假期余额
...
...
@@ -12,5 +17,6 @@ import cn.timer.api.bean.kqmk.KqglAssoLeaveBalance;
*/
@Repository
public
interface
KqglAssoLeaveBalanceMapper
extends
BaseMapper
<
KqglAssoLeaveBalance
>
{
IPage
<
EmployeeLeaveBalanceDto
>
selectPageByQueryLeaveBalance
(
IPage
<
EmployeeLeaveBalanceDto
>
page
,
@Param
(
"param"
)
AttqueryCriteriaDto
attquerycriteriadto
);
}
src/main/java/cn/timer/api/dao/kqmk/KqglAssoPbmxMapper.java
View file @
b1255a14
package
cn
.
timer
.
api
.
dao
.
kqmk
;
import
java.util.List
;
import
org.springframework.stereotype.Repository
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
cn.timer.api.bean.kqmk.KqglAssoPbmx
;
import
cn.timer.api.dto.kqmk.AttSchedulingDto
;
import
cn.timer.api.dto.kqmk.KqglAssoPbmxDto
;
/**
...
...
@@ -16,4 +19,8 @@ import cn.timer.api.dto.kqmk.KqglAssoPbmxDto;
public
interface
KqglAssoPbmxMapper
extends
BaseMapper
<
KqglAssoPbmx
>
{
KqglAssoPbmxDto
getScheduleSpecificAttendance
(
Integer
kqzid
,
Integer
userid
,
String
date
);
int
insertKqglAssoPbmxList
(
List
<
KqglAssoPbmxDto
>
kqglassopbmxdto
);
List
<
KqglAssoPbmxDto
>
selectAttGroupScheduling
(
AttSchedulingDto
attschedulingdto
);
}
src/main/java/cn/timer/api/dao/kqmk/KqglAssoTeshuMapper.java
View file @
b1255a14
package
cn
.
timer
.
api
.
dao
.
kqmk
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
java.util.List
;
import
org.springframework.stereotype.Repository
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
cn.timer.api.bean.kqmk.KqglAssoTeshu
;
/**
...
...
@@ -12,5 +15,7 @@ import cn.timer.api.bean.kqmk.KqglAssoTeshu;
*/
@Repository
public
interface
KqglAssoTeshuMapper
extends
BaseMapper
<
KqglAssoTeshu
>
{
int
insertKqglAssoTeshuList
(
List
<
KqglAssoTeshu
>
kqglassoteshu
);
}
src/main/java/cn/timer/api/dao/kqmk/KqglAssoYhkqzMapper.java
View file @
b1255a14
package
cn
.
timer
.
api
.
dao
.
kqmk
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
java.util.List
;
import
org.springframework.stereotype.Repository
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
cn.timer.api.bean.kqmk.KqglAssoYhkqz
;
/**
...
...
@@ -12,5 +15,6 @@ import cn.timer.api.bean.kqmk.KqglAssoYhkqz;
*/
@Repository
public
interface
KqglAssoYhkqzMapper
extends
BaseMapper
<
KqglAssoYhkqz
>
{
int
insertKqglAssoKqzdkfsList
(
List
<
KqglAssoYhkqz
>
kqglassoyhkqz
);
}
src/main/java/cn/timer/api/dao/kqmk/KqglAssoZhoupaibanMapper.java
View file @
b1255a14
package
cn
.
timer
.
api
.
dao
.
kqmk
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
java.util.List
;
import
org.springframework.stereotype.Repository
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
cn.timer.api.bean.kqmk.KqglAssoZhoupaiban
;
/**
...
...
@@ -12,5 +15,6 @@ import cn.timer.api.bean.kqmk.KqglAssoZhoupaiban;
*/
@Repository
public
interface
KqglAssoZhoupaibanMapper
extends
BaseMapper
<
KqglAssoZhoupaiban
>
{
int
insertKqglAssoZhoupaibanList
(
List
<
KqglAssoZhoupaiban
>
kqglassozhoupaiban
);
}
src/main/java/cn/timer/api/dto/kqmk/AttSchedulingDto.java
0 → 100644
View file @
b1255a14
package
cn
.
timer
.
api
.
dto
.
kqmk
;
import
java.io.Serializable
;
import
lombok.AllArgsConstructor
;
import
lombok.Builder
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public
class
AttSchedulingDto
implements
Serializable
{
private
static
final
long
serialVersionUID
=
5519260557957197035L
;
private
Integer
qyid
;
private
String
date
;
private
Integer
kqzid
;
}
src/main/java/cn/timer/api/dto/kqmk/AttendanceAssistantDto.java
0 → 100644
View file @
b1255a14
package
cn
.
timer
.
api
.
dto
.
kqmk
;
import
java.io.Serializable
;
import
lombok.AllArgsConstructor
;
import
lombok.Builder
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public
class
AttendanceAssistantDto
implements
Serializable
{
private
static
final
long
serialVersionUID
=
-
3561517817976805144L
;
String
name
;
// 考勤组名称 *
String
remarks
;
// 备注 *
String
[]
attmachines
;
// 考勤机
String
[]
attadds
;
// 办公地点考勤
String
[]
attwifis
;
// WiFi考勤
String
[]
attuserids
;
// 考勤成员
int
atttype
;
// 考勤类型:1-固定排班、2-排班制、3-自由工时 *
int
legalholidays
;
// 是否开启法定节假日:0-否、1-是 *
String
[]
attWeekdays
;
// 周工作日【固定排班】
String
[]
attWeekdaysShifts
;
// 周工作日班次【固定排班】
String
[]
attMustPunchData
;
// 必须打卡的日期【固定排班】
String
[]
attMustPunchShifid
;
// 必须打卡的班次id【固定排班】
String
[]
attNonPunchData
;
// 不用打卡的日期【固定排班】
String
[]
attShifts
;
// 排班制 选择的班次【排班制】
int
attRemind
;
// 是否开启提醒:0-否、1-是【排班制】
String
[]
attRemindUserids
;
// 提醒人员【排班制】
int
advanceDays
;
// 提前多少天数提醒【排班制】
int
remCycleDays
;
// 提醒循环天数【排班制】
String
reminderTime
;
// 提醒时间【排班制】
String
[]
promptingMode
;
// 提醒方式:PC端、APP客户端、短信、邮件【排班制】
KqglAssoPbmxDto
[]
schedules
;
// 排班日期【排班制】--班次id、日期
// SchedulesUserids[] schedulesUserids;// 排班【排班制】----用户id
int
optscheduling
;
// 未排班时,员工可选择班次打卡
String
newAttTime
;
// 每天几点开始新的考勤【自由工时】
String
[]
attFreeWorkdays
;
// 周工作日【自由工时】
String
leastworkTime
;
// 至少需工作时间【自由工时】
String
normalWorkTime
;
// 正常工作时长【自由工时】
String
maxOvertimeTime
;
// 加班最大时长【自由工时】
String
attgroupid
;
int
overtimeRulesId
;
//加班id
int
fieldpersonnel
;
//外勤
}
src/main/java/cn/timer/api/dto/kqmk/BalanceSheetDataDto.java
0 → 100644
View file @
b1255a14
package
cn
.
timer
.
api
.
dto
.
kqmk
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.AllArgsConstructor
;
import
lombok.Builder
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public
class
BalanceSheetDataDto
{
@ApiModelProperty
(
value
=
"假期规则id"
,
example
=
"字段说明"
)
private
Integer
leaverulesid
;
@ApiModelProperty
(
value
=
"余额天数 "
,
example
=
"字段说明"
)
private
Integer
balancedays
;
}
src/main/java/cn/timer/api/dto/kqmk/EmployeeLeaveBalanceDto.java
0 → 100644
View file @
b1255a14
package
cn
.
timer
.
api
.
dto
.
kqmk
;
import
java.util.List
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.AllArgsConstructor
;
import
lombok.Builder
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public
class
EmployeeLeaveBalanceDto
{
@ApiModelProperty
(
value
=
"员工工号 "
,
example
=
"字段说明"
)
private
Integer
empnum
;
@ApiModelProperty
(
value
=
"员工名称 "
,
example
=
"字段说明"
)
private
String
empname
;
@ApiModelProperty
(
value
=
"部门 "
,
example
=
"字段说明"
)
private
String
department
;
@ApiModelProperty
(
value
=
"入职日期 "
,
example
=
"字段说明"
)
private
String
rztime
;
@ApiModelProperty
(
value
=
"表数据"
,
example
=
"字段说明"
)
List
<
BalanceSheetDataDto
>
balanceTo
;
}
src/main/java/cn/timer/api/dto/kqmk/KqzAttendanceGroupSearchDto.java
0 → 100644
View file @
b1255a14
package
cn
.
timer
.
api
.
dto
.
kqmk
;
import
java.io.Serializable
;
import
lombok.AllArgsConstructor
;
import
lombok.Builder
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public
class
KqzAttendanceGroupSearchDto
implements
Serializable
{
private
static
final
long
serialVersionUID
=
4927912739465404926L
;
private
String
overall
;
private
Integer
qyid
;
}
src/main/java/cn/timer/api/dto/kqmk/SetConditionsDto.java
0 → 100644
View file @
b1255a14
package
cn
.
timer
.
api
.
dto
.
kqmk
;
import
lombok.AllArgsConstructor
;
import
lombok.Builder
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public
class
SetConditionsDto
{
private
Integer
id
;
private
Integer
parameters
;
}
src/main/resources/mapping/kqmk/KqglAssoBcszMapper.xml
View file @
b1255a14
...
...
@@ -147,6 +147,17 @@
luryid KqglAssoBcsz_luryid
</sql>
<select
id=
"selectRosterByKqzid"
resultMap=
"BaseResultMap"
>
select bcsz.* from kqgl_asso_bcsz bcsz
where bcsz.id in (
select pbmx.bcid from kqgl_asso_pbmx pbmx
where pbmx.kqzid = #{qyid,jdbcType=INTEGER}
<if
test=
"overall != null"
>
and SUBSTR(pbmx.`data`,1,7) = #{overall,jdbcType=VARCHAR}
</if>
GROUP BY pbmx.bcid
)
</select>
<insert
id=
"insert"
useGeneratedKeys=
"true"
keyProperty=
"id"
parameterType=
"cn.timer.api.bean.kqmk.KqglAssoBcsz"
>
...
...
src/main/resources/mapping/kqmk/KqglAssoKqzdkfsMapper.xml
View file @
b1255a14
...
...
@@ -29,6 +29,29 @@
qyid KqglAssoKqzdkfs_qyid,
state KqglAssoKqzdkfs_state
</sql>
<insert
id=
"insertKqglAssokqzdKfsList"
parameterType=
"java.util.List"
>
insert into kqgl_asso_kqzdkfs (dkfsid, kqz_id, type, qyid, state)
<foreach
collection=
"list"
item=
"item"
index=
"index"
open=
"values "
close=
""
separator=
","
>
(
<if
test=
"item.dkfsid != null"
>
#{item.dkfsid,jdbcType=INTEGER},
</if>
<if
test=
"item.kqzId != null"
>
#{item.kqzId,jdbcType=INTEGER},
</if>
<if
test=
"item.type != null"
>
#{item.type,jdbcType=INTEGER},
</if>
<if
test=
"item.qyid != null"
>
#{item.qyid,jdbcType=INTEGER},
</if>
<if
test=
"item.state != null"
>
#{item.state,jdbcType=INTEGER}
</if>
)
</foreach>
</insert>
<!--
...
...
src/main/resources/mapping/kqmk/KqglAssoLeaveBalanceMapper.xml
View file @
b1255a14
...
...
@@ -14,6 +14,18 @@
<result
column=
"modify_timer"
property=
"modifyTimer"
/>
<result
column=
"modify_number"
property=
"modifyNumber"
/>
<result
column=
"org_code"
property=
"orgCode"
/>
<result
column=
"is_automatic"
property=
"isAutomatic"
/>
</resultMap>
<resultMap
id=
"LeaveBalanceMap"
type=
"cn.timer.api.dto.kqmk.EmployeeLeaveBalanceDto"
>
<result
column=
"empnum"
property=
"empnum"
/>
<result
column=
"empname"
property=
"empname"
/>
<result
column=
"department"
property=
"department"
/>
<result
column=
"rztime"
property=
"rztime"
/>
<collection
property=
"balanceTo"
ofType=
"cn.timer.api.dto.kqmk.BalanceSheetDataDto"
>
<result
column=
"leaverulesid"
property=
"leaverulesid"
/>
<result
column=
"balancedays"
property=
"balancedays"
/>
</collection>
</resultMap>
<sql
id=
"Base_Column_List"
>
...
...
@@ -26,7 +38,8 @@
modify_userid,
modify_timer,
modify_number,
org_code
org_code,
is_automatic
</sql>
<sql
id=
"Base_Column_List_Alias"
>
...
...
@@ -39,8 +52,32 @@
modify_userid KqglAssoLeaveBalance_modify_userid,
modify_timer KqglAssoLeaveBalance_modify_timer,
modify_number KqglAssoLeaveBalance_modify_number,
org_code KqglAssoLeaveBalance_org_code
org_code KqglAssoLeaveBalance_org_code,
is_automatic KqglAssoLeaveBalance_is_automatic
</sql>
<select
id=
"selectPageByQueryLeaveBalance"
resultMap=
"LeaveBalanceMap"
>
SELECT emp.emp_num as empnum,
emp.`name` as empname,
IFNULL(c.name,'') as department,
IFNULL(emp.rz_time,'') as rztime,
yz.leave_rules_id as leaverulesid,
yz.balancedays
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
LEFT JOIN (select bal.leave_rules_id,bal.userid,SUM(bal.balance_days) as balancedays
from kqgl_asso_leave_balance bal
where bal.org_code = #{param.orgCode}
GROUP BY bal.userid,bal.leave_rules_id) as yz on yz.userid = emp.emp_num
where emp.org_code = #{param.orgCode}
<if
test=
"param.query != null and param.query != ''"
>
and ( emp.`name` like CONCAT('%',#{param.query},'%') or
emp.emp_num like CONCAT('%',#{param.query},'%') or
c.name like CONCAT('%',#{param.query},'%'))
</if>
ORDER BY emp.emp_num DESC
</select>
<!--
...
...
@@ -72,7 +109,10 @@
modify_number,
</if>
<if test ='null != orgCode'>
org_code
org_code,
</if>
<if test ='null != isAutomatic'>
is_automatic
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
...
...
@@ -101,7 +141,10 @@
#{modifyNumber},
</if>
<if test ='null != orgCode'>
#{orgCode}
#{orgCode},
</if>
<if test ='null != isAutomatic'>
#{isAutomatic}
</if>
</trim>
</insert>
...
...
@@ -122,7 +165,8 @@
<if test ='null != modifyUserid'>modify_userid = #{modifyUserid},</if>
<if test ='null != modifyTimer'>modify_timer = #{modifyTimer},</if>
<if test ='null != modifyNumber'>modify_number = #{modifyNumber},</if>
<if test ='null != orgCode'>org_code = #{orgCode}</if>
<if test ='null != orgCode'>org_code = #{orgCode},</if>
<if test ='null != isAutomatic'>is_automatic = #{isAutomatic}</if>
</set>
WHERE id = #{id}
</update>
...
...
src/main/resources/mapping/kqmk/KqglAssoPbmxMapper.xml
View file @
b1255a14
...
...
@@ -93,7 +93,42 @@
and pbmx.userid = #{userid}
and pbmx.`data` = #{date}
</select>
<insert
id=
"insertKqglAssoPbmxList"
parameterType=
"java.util.List"
>
insert into kqgl_asso_pbmx (userid, data, bcid, kqzid)
<foreach
collection=
"list"
item=
"item"
index=
"index"
open=
"values "
close=
""
separator=
","
>
(
<if
test=
"item.userid != null"
>
#{item.userid,jdbcType=INTEGER},
</if>
<if
test=
"item.data != null"
>
#{item.data,jdbcType=DATE},
</if>
<if
test=
"item.bcid != null"
>
#{item.bcid,jdbcType=INTEGER},
</if>
<if
test=
"item.kqzid != null"
>
#{item.kqzid,jdbcType=INTEGER}
</if>
)
</foreach>
</insert>
<select
id=
"selectAttGroupScheduling"
resultMap=
"AssoPbmxMap"
>
select pbmx.*,
info.`name` as username,
bcsz.`name` bcname,
SUBSTR(pbmx.`data`,1,7) as yemo,
SUBSTR(pbmx.`data`,9,10) as xsrq
from kqgl_asso_pbmx pbmx
LEFT JOIN yggl_main_emp as info on info.emp_num = pbmx.userid
LEFT JOIN kqgl_asso_bcsz as bcsz on bcsz.id = pbmx.bcid
where info.org_code = #{qyid,jdbcType=INTEGER}
<if
test=
"date != null"
>
and SUBSTR(pbmx.`data`,1,7) = #{date,jdbcType=VARCHAR}
</if>
and pbmx.kqzid = #{kqzid,jdbcType=INTEGER}
</select>
<!--
<insert id="insert" useGeneratedKeys="true" keyColumn="id" parameterType="cn.timer.api.bean.kqmk.KqglAssoPbmx">
...
...
src/main/resources/mapping/kqmk/KqglAssoTeshuMapper.xml
View file @
b1255a14
...
...
@@ -33,6 +33,31 @@
type KqglAssoTeshu_type
</sql>
<insert
id=
"insertKqglAssoTeshuList"
parameterType=
"java.util.List"
>
insert into kqgl_asso_teshu (kqzid, tsrq, bcid, lusj_time, luryid, type)
<foreach
collection=
"list"
item=
"item"
index=
"index"
open=
"values "
close=
""
separator=
","
>
(
<if
test=
"item.kqzid != null"
>
#{item.kqzid,jdbcType=INTEGER},
</if>
<if
test=
"item.tsrq != null"
>
#{item.tsrq,jdbcType=VARCHAR},
</if>
<if
test=
"item.bcid != null"
>
#{item.bcid,jdbcType=INTEGER},
</if>
<if
test=
"item.lusjTime != null"
>
#{item.lusjTime,jdbcType=BIGINT},
</if>
<if
test=
"item.luryid != null"
>
#{item.luryid,jdbcType=INTEGER},
</if>
<if
test=
"item.type != null"
>
#{item.type,jdbcType=INTEGER}
</if>
)
</foreach>
</insert>
<!--
<insert id="insert" useGeneratedKeys="true" keyColumn="id" parameterType="cn.timer.api.bean.kqmk.KqglAssoTeshu">
...
...
src/main/resources/mapping/kqmk/KqglAssoYhkqzMapper.xml
View file @
b1255a14
...
...
@@ -24,6 +24,22 @@
qyid KqglAssoYhkqz_qyid
</sql>
<insert
id=
"insertKqglAssoKqzdkfsList"
parameterType=
"java.util.List"
>
insert into kqgl_asso_yhkqz (kqzid, userid, qyid)
<foreach
collection=
"list"
item=
"item"
index=
"index"
open=
"values "
close=
""
separator=
","
>
(
<if
test=
"item.kqzid != null"
>
#{item.kqzid,jdbcType=INTEGER},
</if>
<if
test=
"item.userid != null"
>
#{item.userid,jdbcType=INTEGER},
</if>
<if
test=
"item.qyid != null"
>
#{item.qyid,jdbcType=INTEGER}
</if>
)
</foreach>
</insert>
<!--
<insert id="insert" useGeneratedKeys="true" keyColumn="id" parameterType="cn.timer.api.bean.kqmk.KqglAssoYhkqz">
...
...
src/main/resources/mapping/kqmk/KqglAssoZhoupaibanMapper.xml
View file @
b1255a14
...
...
@@ -23,6 +23,23 @@
type KqglAssoZhoupaiban_type,
bcid KqglAssoZhoupaiban_bcid
</sql>
<insert
id=
"insertKqglAssoZhoupaibanList"
parameterType=
"java.util.List"
>
insert into kqgl_asso_zhoupaiban (kqzid, type, bcid)
<foreach
collection=
"list"
item=
"item"
index=
"index"
open=
"values "
close=
""
separator=
","
>
(
<if
test=
"item.kqzid != null"
>
#{item.kqzid,jdbcType=INTEGER},
</if>
<if
test=
"item.type != null"
>
#{item.type,jdbcType=INTEGER},
</if>
<if
test=
"item.bcid != null"
>
#{item.bcid,jdbcType=INTEGER}
</if>
)
</foreach>
</insert>
<!--
...
...
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