Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
W
wangxiaolu-sfa-module-operation
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
sfa
wangxiaolu-sfa-module-operation
Commits
cc589461
提交
cc589461
authored
11月 08, 2024
作者:
李秋林
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
集成Mybatis-plus;分页规范修改;完成考勤功能
上级
52968795
显示空白字符变更
内嵌
并排
正在显示
7 个修改的文件
包含
85 行增加
和
19 行删除
+85
-19
KqMxQueryController.java
...m/sfa/operation/controller/query/KqMxQueryController.java
+4
-2
ISfaKqmxDao.java
src/main/java/com/sfa/operation/domain/dao/ISfaKqmxDao.java
+2
-2
SfaKqmxDaoImpl.java
...ava/com/sfa/operation/domain/dao/impl/SfaKqmxDaoImpl.java
+5
-3
KqEnum.java
src/main/java/com/sfa/operation/enums/KqEnum.java
+23
-0
SfaKqMxDto.java
...main/java/com/sfa/operation/pojo/response/SfaKqMxDto.java
+3
-0
IKqMxQueryService.java
...ain/java/com/sfa/operation/service/IKqMxQueryService.java
+2
-3
KqMxQueryServiceImpl.java
.../com/sfa/operation/service/impl/KqMxQueryServiceImpl.java
+46
-9
没有找到文件。
src/main/java/com/sfa/operation/controller/query/KqMxQueryController.java
浏览文件 @
cc589461
...
...
@@ -2,6 +2,7 @@ package com.sfa.operation.controller.query;
import
cn.hutool.core.date.DateTime
;
import
cn.hutool.core.date.DateUtil
;
import
com.sfa.common.core.utils.DateUtils
;
import
com.sfa.common.security.utils.SecurityUtils
;
import
com.sfa.operation.service.IKqMxQueryService
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -9,6 +10,7 @@ import org.springframework.web.bind.annotation.GetMapping;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.Map
;
...
...
@@ -26,8 +28,8 @@ public class KqMxQueryController {
@GetMapping
(
"/roll"
)
public
Map
rollDateList
(){
Long
userId
=
SecurityUtils
.
getUserId
();
Date
Time
dateTime
=
DateUtil
.
offsetDay
(
new
DateTime
(),
-
7
);
Map
dataMap
=
kqMxQueryService
.
rollDateList
(
date
Time
,
userId
);
Date
dateStart
=
DateUtils
.
dateStart
(
DateUtil
.
offsetDay
(
new
DateTime
(),
-
7
)
);
Map
dataMap
=
kqMxQueryService
.
rollDateList
(
date
Start
,
userId
);
HashMap
<
String
,
Object
>
rMap
=
new
HashMap
<>();
rMap
.
put
(
"data"
,
dataMap
);
rMap
.
put
(
"current"
,
new
DateTime
());
...
...
src/main/java/com/sfa/operation/domain/dao/ISfaKqmxDao.java
浏览文件 @
cc589461
package
com
.
sfa
.
operation
.
domain
.
dao
;
import
cn.hutool.core.date.DateTime
;
import
com.sfa.operation.pojo.response.SfaKqMxDto
;
import
java.util.Date
;
import
java.util.List
;
/**
...
...
@@ -13,5 +13,5 @@ import java.util.List;
public
interface
ISfaKqmxDao
{
void
add
(
SfaKqMxDto
kqMxDto
);
List
<
SfaKqMxDto
>
betweentDate
(
Date
Time
dateTime
,
Long
userId
);
List
<
SfaKqMxDto
>
betweentDate
(
Date
dateStart
,
Long
userId
);
}
src/main/java/com/sfa/operation/domain/dao/impl/SfaKqmxDaoImpl.java
浏览文件 @
cc589461
package
com
.
sfa
.
operation
.
domain
.
dao
.
impl
;
import
cn.hutool.core.date.DateTime
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.sfa.common.core.enums.ECode
;
import
com.sfa.common.core.exception.WXLSQLException
;
...
...
@@ -12,6 +11,7 @@ import org.springframework.beans.BeanUtils;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.Date
;
import
java.util.List
;
/**
...
...
@@ -44,10 +44,12 @@ public class SfaKqmxDaoImpl implements ISfaKqmxDao {
}
@Override
public
List
<
SfaKqMxDto
>
betweentDate
(
Date
Time
dateTime
,
Long
userId
)
{
public
List
<
SfaKqMxDto
>
betweentDate
(
Date
dateStart
,
Long
userId
)
{
LambdaQueryWrapper
<
SfaKqmx
>
qw
=
new
LambdaQueryWrapper
<>();
qw
.
ge
(
SfaKqmx:
:
getCreateDate
,
date
Time
);
qw
.
ge
(
SfaKqmx:
:
getCreateDate
,
date
Start
);
qw
.
eq
(
SfaKqmx:
:
getCreateUserId
,
userId
);
qw
.
select
(
SfaKqmx:
:
getCreateDate
,
SfaKqmx:
:
getKqmxId
,
SfaKqmx:
:
getKqTime
,
SfaKqmx:
:
getKqAddress
,
SfaKqmx:
:
getKqPicurl
,
SfaKqmx:
:
getKqType
);
List
<
SfaKqmx
>
dos
=
sfaKqmxMapper
.
selectList
(
qw
);
List
<
SfaKqMxDto
>
dtos
=
com
.
sfa
.
common
.
core
.
utils
.
bean
.
BeanUtils
.
transitionDtos
(
dos
,
SfaKqMxDto
.
class
);
return
dtos
;
...
...
src/main/java/com/sfa/operation/enums/KqEnum.java
0 → 100644
浏览文件 @
cc589461
package
com
.
sfa
.
operation
.
enums
;
import
lombok.AllArgsConstructor
;
import
lombok.Getter
;
/**
* @author : liqiulin
* @date : 2024-11-08 11
* @describe :
*/
@AllArgsConstructor
@Getter
public
enum
KqEnum
{
FIR_CLOCK
(
1
,
"上班卡"
),
SEC_CLOCK
(
2
,
"午班卡"
),
THI_CLOCK
(
3
,
"下班卡"
)
;
private
Integer
kqType
;
private
String
kqTypeMsg
;
}
src/main/java/com/sfa/operation/pojo/response/SfaKqMxDto.java
浏览文件 @
cc589461
...
...
@@ -79,4 +79,7 @@ public class SfaKqMxDto {
*/
private
Long
createUserId
;
public
SfaKqMxDto
(
Integer
kqType
)
{
this
.
kqType
=
kqType
;
}
}
src/main/java/com/sfa/operation/service/IKqMxQueryService.java
浏览文件 @
cc589461
package
com
.
sfa
.
operation
.
service
;
import
cn.hutool.core.date.DateTime
;
import
java.util.Date
;
import
java.util.Map
;
/**
...
...
@@ -10,5 +9,5 @@ import java.util.Map;
* @describe :
*/
public
interface
IKqMxQueryService
{
Map
rollDateList
(
Date
Time
dateTime
,
Long
userId
);
Map
rollDateList
(
Date
dateStart
,
Long
userId
);
}
src/main/java/com/sfa/operation/service/impl/KqMxQueryServiceImpl.java
浏览文件 @
cc589461
package
com
.
sfa
.
operation
.
service
.
impl
;
import
cn.hutool.core.date.DateTime
;
import
cn.hutool.core.date.DateUtil
;
import
com.sfa.common.core.constant.SecurityConstants
;
import
com.sfa.common.core.utils.DateUtils
;
import
com.sfa.common.security.utils.SecurityUtils
;
import
com.sfa.operation.domain.dao.ISfaKqmxDao
;
import
com.sfa.operation.enums.KqEnum
;
import
com.sfa.operation.pojo.response.SfaKqMxDto
;
import
com.sfa.operation.service.IKqMxQueryService
;
import
com.sfa.system.api.RemoteKqRuleService
;
import
com.sfa.system.api.pojo.response.MdmKqRuleDto
;
import
org.apache.commons.collections4.MapUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.TreeMap
;
import
java.text.SimpleDateFormat
;
import
java.util.*
;
import
java.util.stream.Collectors
;
/**
...
...
@@ -22,11 +27,43 @@ import java.util.stream.Collectors;
public
class
KqMxQueryServiceImpl
implements
IKqMxQueryService
{
@Autowired
ISfaKqmxDao
sfaKqmxDao
;
@Autowired
RemoteKqRuleService
remoteKqRuleService
;
@Override
public
Map
rollDateList
(
DateTime
dateTime
,
Long
userId
)
{
List
<
SfaKqMxDto
>
dtos
=
sfaKqmxDao
.
betweentDate
(
dateTime
,
userId
);
TreeMap
<
Date
,
List
<
SfaKqMxDto
>>
collect
=
dtos
.
stream
().
collect
(
Collectors
.
groupingBy
(
SfaKqMxDto:
:
getCreateDate
,
TreeMap:
:
new
,
Collectors
.
toList
()));
return
collect
.
descendingMap
();
public
Map
rollDateList
(
Date
dateStart
,
Long
userId
)
{
Long
ruleId
=
SecurityUtils
.
getLoginUser
().
getRuleId
();
MdmKqRuleDto
kqruleDto
=
remoteKqRuleService
.
getInfo
(
ruleId
,
SecurityConstants
.
INNER
).
getData
();
List
<
SfaKqMxDto
>
dtos
=
sfaKqmxDao
.
betweentDate
(
dateStart
,
userId
);
TreeMap
<
String
,
List
<
SfaKqMxDto
>>
gm
=
dtos
.
stream
().
collect
(
Collectors
.
groupingBy
(
item
->
new
SimpleDateFormat
(
DateUtils
.
YYYY_MM_DD
).
format
(
item
.
getCreateDate
()),
TreeMap:
:
new
,
Collectors
.
toList
()));
// 判断无考勤,或下标0非今天时,创建今日数据
String
today
=
DateUtil
.
today
();
boolean
hasSec
=
Objects
.
nonNull
(
kqruleDto
.
getSecBegintime
());
int
clockNum
=
Objects
.
nonNull
(
kqruleDto
.
getSecBegintime
())
?
3
:
2
;
// 无需处理
if
(
gm
.
containsKey
(
today
)
&&
(
gm
.
get
(
today
).
size
()
==
clockNum
))
{
return
gm
.
descendingMap
();
}
// 无今日明细
if
(
MapUtils
.
isEmpty
(
gm
)
||
!
gm
.
containsKey
(
today
)){
List
<
SfaKqMxDto
>
mxDtos
=
new
ArrayList
<>();
mxDtos
.
add
(
new
SfaKqMxDto
(
KqEnum
.
FIR_CLOCK
.
getKqType
()));
if
(
hasSec
){
mxDtos
.
add
(
new
SfaKqMxDto
(
KqEnum
.
SEC_CLOCK
.
getKqType
()));
}
mxDtos
.
add
(
new
SfaKqMxDto
(
KqEnum
.
THI_CLOCK
.
getKqType
()));
gm
.
put
(
today
,
mxDtos
);
return
gm
.
descendingMap
();
}
List
<
SfaKqMxDto
>
mxDtos
=
gm
.
get
(
today
);
if
(
mxDtos
.
size
()
<
clockNum
-
1
)
{
mxDtos
.
add
(
new
SfaKqMxDto
(
KqEnum
.
SEC_CLOCK
.
getKqType
()));
}
mxDtos
.
add
(
new
SfaKqMxDto
(
KqEnum
.
THI_CLOCK
.
getKqType
()));
return
gm
.
descendingMap
();
}
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论