Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
entrance_api
Project
Project
Details
Activity
Releases
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
王琮
entrance_api
Commits
68847d41
Commit
68847d41
authored
Jan 03, 2023
by
王琮
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改通行管理列表业务
parent
db466436
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
34 additions
and
16 deletions
+34
-16
TimeUtils.java
src/main/java/org/rcisoft/sys/attendance/util/TimeUtils.java
+1
-3
DoorRecord.java
src/main/java/org/rcisoft/sys/sysuser/entity/DoorRecord.java
+15
-0
DoorRecordServiceImpl.java
...isoft/sys/sysuser/service/impl/DoorRecordServiceImpl.java
+12
-6
DoorRecordMapper.xml
src/main/resources/mapper/DoorRecordMapper.xml
+6
-7
No files found.
src/main/java/org/rcisoft/sys/attendance/util/TimeUtils.java
View file @
68847d41
...
...
@@ -61,9 +61,7 @@ public class TimeUtils {
*/
public
static
Date
getCurrentYear
()
{
Calendar
calendar
=
Calendar
.
getInstance
();
// 获取当前日期
// TODO: 2023/1/1 获取去年的时间 2022
// calendar.add(Calendar.YEAR, 0);
calendar
.
add
(
Calendar
.
YEAR
,
-
1
);
calendar
.
add
(
Calendar
.
YEAR
,
0
);
calendar
.
add
(
Calendar
.
DATE
,
0
);
calendar
.
add
(
Calendar
.
MONTH
,
0
);
calendar
.
set
(
Calendar
.
DAY_OF_YEAR
,
1
);
...
...
src/main/java/org/rcisoft/sys/sysuser/entity/DoorRecord.java
View file @
68847d41
...
...
@@ -16,6 +16,7 @@ import java.util.List;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
org.springframework.data.annotation.Transient
;
import
org.springframework.format.annotation.DateTimeFormat
;
/**
* Created with cy on 2022年11月24日 下午12:47:46.
...
...
@@ -45,6 +46,20 @@ public class DoorRecord extends CyIdEntity<DoorRecord> {
@JsonFormat
(
pattern
=
"yyyy-MM-dd"
,
timezone
=
"GMT+8"
)
private
String
endTime
;
/**
* 开始时间
*/
@Transient
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
@DateTimeFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
private
Date
startTime
;
//结束时间
@Transient
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
@DateTimeFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
private
Date
closeTime
;
//登记方式
@Transient
private
String
deviceIoType
;
...
...
src/main/java/org/rcisoft/sys/sysuser/service/impl/DoorRecordServiceImpl.java
View file @
68847d41
...
...
@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
org.apache.commons.lang.StringUtils
;
import
org.rcisoft.core.exception.CyServiceException
;
import
org.rcisoft.core.util.CyUserUtil
;
import
org.rcisoft.core.aop.CyPageUtilAsp
;
import
org.rcisoft.core.model.CyPersistModel
;
...
...
@@ -145,14 +146,12 @@ public class DoorRecordServiceImpl extends ServiceImpl<DoorRecordRepository, Doo
*/
@Override
public
IPage
<
DoorRecord
>
findAllByPagination
(
CyPageInfo
<
DoorRecord
>
paginationUtility
,
DoorRecord
doorRecord
)
{
//TODO 需要重写
//条件加上年份,默认查询当年的,因此代码里面需要判断是否传递有年代的逻辑
Date
nowYear
=
TimeUtils
.
getCurrentYear
();
Date
nowYearEnd
=
TimeUtils
.
getCurrentYearEnd
();
List
<
Date
>
crossTimeRange
=
new
ArrayList
<>();
crossTimeRange
.
add
(
0
,
nowYear
);
crossTimeRange
.
add
(
1
,
nowYearEnd
);
// 处理设备id
if
(!
doorRecord
.
getDeviceId
().
equals
(
""
))
{
String
[]
deviceIdArr
=
doorRecord
.
getDeviceId
().
split
(
","
);
...
...
@@ -163,8 +162,17 @@ public class DoorRecordServiceImpl extends ServiceImpl<DoorRecordRepository, Doo
String
deviceIdArrStr
=
StringUtils
.
join
(
deviceIdArrTemp
,
","
);
doorRecord
.
setDeviceId
(
deviceIdArrStr
);
}
IPage
<
DoorRecord
>
doorRecordIPage
=
baseMapper
.
queryDoorRecordsPagedWithCrossTimeRange
(
paginationUtility
,
doorRecord
,
crossTimeRange
);
if
(
StringUtils
.
isNotEmpty
(
doorRecord
.
getBeginTime
())
&&
StringUtils
.
isNotEmpty
(
doorRecord
.
getEndTime
()))
{
try
{
SimpleDateFormat
simpleDate
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
doorRecord
.
setStartTime
(
simpleDate
.
parse
(
doorRecord
.
getBeginTime
()+
" 00:00:00"
));
doorRecord
.
setCloseTime
(
simpleDate
.
parse
(
doorRecord
.
getEndTime
()+
" 23:59:59"
));
}
catch
(
Exception
e
)
{
throw
new
CyServiceException
(
"时间转换失败"
);
}
}
IPage
<
DoorRecord
>
doorRecordIPage
=
baseMapper
.
queryDoorRecordsPagedWithCrossTimeRange
(
paginationUtility
,
doorRecord
,
crossTimeRange
);
for
(
int
i
=
0
;
i
<
doorRecordIPage
.
getRecords
().
size
();
i
++)
{
//获取登记时间
Date
crossTime
=
doorRecordIPage
.
getRecords
().
get
(
i
).
getCrossTime
();
...
...
@@ -181,10 +189,8 @@ public class DoorRecordServiceImpl extends ServiceImpl<DoorRecordRepository, Doo
if
(
sysDictData
!=
null
)
{
doorRecordIPage
.
getRecords
().
get
(
i
).
setCardTypeLabel
(
sysDictData
.
getDictLabel
());
}
}
return
doorRecordIPage
;
}
/**
...
...
src/main/resources/mapper/DoorRecordMapper.xml
View file @
68847d41
...
...
@@ -28,7 +28,7 @@
<result
column=
"position_label"
jdbcType=
"VARCHAR"
property=
"positionName"
/>
<result
column=
"dept_name"
jdbcType=
"VARCHAR"
property=
"deptName"
/>
</resultMap>
<insert
id=
"saveRecordData"
parameterType=
"org.rcisoft.sys.sysuser.entity.DoorRecord"
useGeneratedKeys=
"false"
>
insert into door_record
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
...
...
@@ -183,17 +183,16 @@
SELECT
dr.record_id,su.name,su.business_id,dr.tenement_type,dr.cross_time,dr.create_date,dr.device_id,dr.device_type,dr.device_name,dr.card_type,dr.record_type,dr.card_type_label,dr.abnormal
FROM door_record dr
-- LEFT JOIN sys_user su ON dr.user_id = su.business_id
LEFT JOIN sys_user su ON dr.person_id = su.person_id
WHERE dr.del_flag = 0
and dr.cross_time between #{crossTimeRange[0]} and #{crossTimeRange[1]}
WHERE dr.del_flag = 0
<if
test=
"entity.deviceType !=null and entity.deviceType != '' "
>
and dr.device_type = #{entity.deviceType}
</if>
<if
test=
"entity.beginTime !=
null and entity.beginTime !='' "
>
<!-- 开始时间检索 --
>
and d
ate_format(dr.create_date,'%Y-%m-%d')
>
= date_format(#{entity.beginTime},'%Y-%m-%d')
<if
test=
"entity.beginTime !=
'' and entity.endTime !='' "
>
and d
r.cross_time between #{entity.startTime} and #{entity.closeTime}
</if>
<if
test=
"entity.endTime
!= null and entity.endTime !='' "
>
<!-- 结束时间检索 --
>
and d
ate_format(dr.create_date,'%Y-%m-%d')
<
= date_format(#{entity.endTime},'%Y-%m-%d')
<if
test=
"entity.endTime
== '' and entity.beginTime == ''"
>
and d
r.cross_time between #{crossTimeRange[0]} and #{crossTimeRange[1]}
</if>
<if
test=
"entity.deviceId !=null and entity.deviceId != '' "
>
and dr.device_id in(${entity.deviceId})
...
...
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