Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
Y
yifu-mvp
Project
Project
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
fangxinjiang
yifu-mvp
Commits
e7e73f80
You need to sign in or sign up before continuing.
Commit
e7e73f80
authored
Dec 11, 2025
by
hongguangwu
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/MVP1.7.18' into MVP1.7.18
parents
89e46fcc
ca736415
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
197 additions
and
18 deletions
+197
-18
HolidayCrawler.java
...u/cloud/plus/v1/yifu/common/core/util/HolidayCrawler.java
+17
-5
THolidayInfo.java
...m/yifu/cloud/plus/v1/yifu/social/entity/THolidayInfo.java
+4
-0
THolidayExportVo.java
...m/yifu/cloud/plus/v1/yifu/social/vo/THolidayExportVo.java
+83
-0
THolidayInfoController.java
...lus/v1/yifu/social/controller/THolidayInfoController.java
+12
-1
THolidayInfoMapper.java
.../cloud/plus/v1/yifu/social/mapper/THolidayInfoMapper.java
+4
-0
THolidayInfoService.java
...loud/plus/v1/yifu/social/service/THolidayInfoService.java
+5
-2
THolidayInfoServiceImpl.java
.../v1/yifu/social/service/impl/THolidayInfoServiceImpl.java
+48
-6
THolidayInfoMapper.xml
...cial-biz/src/main/resources/mapper/THolidayInfoMapper.xml
+24
-4
No files found.
yifu-common/yifu-common-core/src/main/java/com/yifu/cloud/plus/v1/yifu/common/core/util/HolidayCrawler.java
View file @
e7e73f80
...
...
@@ -44,7 +44,23 @@ public class HolidayCrawler {
}
return
null
;
}
public
static
List
<
Map
<
String
,
Object
>>
initHolidaysByYear
(
String
year
){
long
ts
=
System
.
currentTimeMillis
();
String
YEAR_HOLIDAY_URL
=
"https://api.apihubs.cn/holiday/get?field=date,weekend&year="
+
year
+
"&workday=2&order_by=1&cn=1&page=1&size=500"
;
Map
<
String
,
Object
>
result
=
REST_TEMPLATE
.
getForObject
(
String
.
format
(
YEAR_HOLIDAY_URL
,
ts
,
ts
),
Map
.
class
);
if
(
null
!=
result
){
String
code
=
String
.
valueOf
(
result
.
get
(
"code"
));
String
msg
=
String
.
valueOf
(
result
.
get
(
"msg"
));
if
(
code
.
equals
(
"0"
)
&&
msg
.
equals
(
"ok"
)){
Map
data
=
(
Map
)
result
.
get
(
"data"
);
if
(
null
!=
data
){
List
<
Map
<
String
,
Object
>>
list
=
(
List
<
Map
<
String
,
Object
>>)
data
.
get
(
"list"
);
return
list
;
}
}
}
return
null
;
}
public
static
List
<
Map
<
String
,
Object
>>
initNextYearHolidays
(){
long
ts
=
System
.
currentTimeMillis
();
Map
<
String
,
Object
>
result
=
REST_TEMPLATE
.
getForObject
(
String
.
format
(
NEXT_YEAR_HOLIDAY_URL
,
ts
,
ts
),
Map
.
class
);
...
...
@@ -56,10 +72,6 @@ public class HolidayCrawler {
if
(
null
!=
data
){
List
<
Map
<
String
,
Object
>>
list
=
(
List
<
Map
<
String
,
Object
>>)
data
.
get
(
"list"
);
return
list
;
/*int i=0;
for(Map<String,Object> d:list){
System.out.println("i="+(++i)+" 日期="+d.get("date")+" 类型="+d.get("weekend")+" weekend_cn="+d.get("weekend_cn"));
}*/
}
}
}
...
...
yifu-social/yifu-social-api/src/main/java/com/yifu/cloud/plus/v1/yifu/social/entity/THolidayInfo.java
View file @
e7e73f80
...
...
@@ -19,6 +19,7 @@ package com.yifu.cloud.plus.v1.yifu.social.entity;
import
com.alibaba.excel.annotation.ExcelProperty
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttribute
;
...
...
@@ -78,4 +79,7 @@ public class THolidayInfo extends BaseEntity {
@ExcelProperty
(
"day"
)
@Schema
(
description
=
"day"
)
private
String
day
;
@TableField
(
exist
=
false
)
private
String
isHoliday
;
}
yifu-social/yifu-social-api/src/main/java/com/yifu/cloud/plus/v1/yifu/social/vo/THolidayExportVo.java
0 → 100644
View file @
e7e73f80
/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the yifu4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
social
.
vo
;
import
com.alibaba.excel.annotation.ExcelProperty
;
import
com.alibaba.excel.annotation.write.style.ColumnWidth
;
import
com.alibaba.excel.annotation.write.style.HeadFontStyle
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttribute
;
import
com.yifu.cloud.plus.v1.yifu.common.mybatis.base.BaseEntity
;
import
io.swagger.v3.oas.annotations.media.Schema
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
org.hibernate.validator.constraints.Length
;
import
java.util.Date
;
/**
* @author fxj
* @date 2024-05-08 11:52:08
*/
@Data
@Schema
(
description
=
"节假日信息表"
)
public
class
THolidayExportVo
{
/**
* year 例:2024
*/
@ExcelAttribute
(
name
=
"年"
,
maxLength
=
6
)
@ExcelProperty
(
"年"
)
@HeadFontStyle
(
fontHeightInPoints
=
11
)
@ColumnWidth
(
10
)
@Schema
(
description
=
"年"
)
private
String
year
;
/**
* month 例:05
*/
@ExcelAttribute
(
name
=
"月"
,
maxLength
=
6
)
@ExcelProperty
(
"月"
)
@HeadFontStyle
(
fontHeightInPoints
=
11
)
@ColumnWidth
(
10
)
@Schema
(
description
=
"月"
)
private
String
month
;
/**
* day 例:08
*/
@ExcelAttribute
(
name
=
"日"
,
maxLength
=
2
)
@ExcelProperty
(
"日"
)
@HeadFontStyle
(
fontHeightInPoints
=
11
)
@ColumnWidth
(
10
)
@Schema
(
description
=
"日"
)
private
String
day
;
/**
* @Author fxj
* @Description 是否节假日
* @Date 17:40 2025/12/10
**/
@ExcelAttribute
(
name
=
"是否节假日"
,
maxLength
=
2
)
@ExcelProperty
(
"是否节假日"
)
@HeadFontStyle
(
fontHeightInPoints
=
11
)
@ColumnWidth
(
20
)
@Schema
(
description
=
"是否节假日"
)
private
String
isHoliday
;
}
yifu-social/yifu-social-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/social/controller/THolidayInfoController.java
View file @
e7e73f80
...
...
@@ -157,7 +157,6 @@ public class THolidayInfoController {
**/
@Operation
(
description
=
"导出 hasPermission('demo_tholidayinfo-export')"
)
@PostMapping
(
"/export"
)
@PreAuthorize
(
"@pms.hasPermission('demo_tholidayinfo-export')"
)
public
void
export
(
HttpServletResponse
response
,
@RequestBody
THolidayInfoSearchVo
searchVo
)
{
tHolidayInfoService
.
listExport
(
response
,
searchVo
);
}
...
...
@@ -187,6 +186,18 @@ public class THolidayInfoController {
tHolidayInfoService
.
createHolidayInfo
();;
}
/**
* @Description: 手动生对应年份的节假日信息
* @Author: fxj
* @Date: 2024/5/8
**/
@Operation
(
summary
=
"手动生对应年份的节假日信息 "
,
description
=
"手动生对应年份的节假日信息 "
)
@SysLog
(
"手动生对应年份的节假日信息 "
)
@PostMapping
(
"/createHolidayInfoByYear"
)
public
R
createHolidayInfoByYear
(
@RequestParam
String
year
)
{
return
tHolidayInfoService
.
createHolidayInfoByYear
(
year
);
}
/**
* @Author huyc
* @Description 查询日期的前一个/后一个工作日
...
...
yifu-social/yifu-social-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/social/mapper/THolidayInfoMapper.java
View file @
e7e73f80
...
...
@@ -21,6 +21,8 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yifu.cloud.plus.v1.yifu.social.entity.THolidayInfo
;
import
com.yifu.cloud.plus.v1.yifu.social.vo.THolidayExportVo
;
import
com.yifu.cloud.plus.v1.yifu.social.vo.THolidayInfoSearchVo
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
...
...
@@ -47,4 +49,6 @@ public interface THolidayInfoMapper extends BaseMapper<THolidayInfo> {
* @return: java.util.List<com.yifu.cloud.plus.v1.yifu.social.entity.THolidayInfo>
**/
List
<
String
>
getOneMonthDay
();
List
<
THolidayExportVo
>
exportSearch
(
@Param
(
"tHolidayInfo"
)
THolidayInfoSearchVo
searchVo
);
}
yifu-social/yifu-social-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/social/service/THolidayInfoService.java
View file @
e7e73f80
...
...
@@ -48,8 +48,6 @@ public interface THolidayInfoService extends IService<THolidayInfo> {
void
listExport
(
HttpServletResponse
response
,
THolidayInfoSearchVo
searchVo
);
List
<
THolidayInfo
>
noPageDiy
(
THolidayInfoSearchVo
searchVo
);
void
createHolidayInfo
();
TEmployeeInsuranceWorkDayVo
getInitBeforeOrAfterWorkDay
(
TEmployeeInsuranceWorkDayVo
vo
);
...
...
@@ -77,4 +75,9 @@ public interface THolidayInfoService extends IService<THolidayInfo> {
* @return: com.yifu.cloud.plus.v1.yifu.insurances.vo.HolidayListVO
**/
HolidayListVO
getOneMonthDay
();
R
createHolidayInfoByYear
(
String
year
);
List
<
THolidayInfo
>
noPageDiy
(
THolidayInfoSearchVo
searchVo
);
}
yifu-social/yifu-social-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/social/service/impl/THolidayInfoServiceImpl.java
View file @
e7e73f80
...
...
@@ -38,6 +38,7 @@ import com.yifu.cloud.plus.v1.yifu.social.entity.THolidayInfo;
import
com.yifu.cloud.plus.v1.yifu.social.mapper.THolidayInfoMapper
;
import
com.yifu.cloud.plus.v1.yifu.social.service.THolidayInfoService
;
import
com.yifu.cloud.plus.v1.yifu.social.vo.TEmployeeInsuranceWorkDayVo
;
import
com.yifu.cloud.plus.v1.yifu.social.vo.THolidayExportVo
;
import
com.yifu.cloud.plus.v1.yifu.social.vo.THolidayInfoSearchVo
;
import
com.yifu.cloud.plus.v1.yifu.social.vo.THolidayInfoVo
;
import
lombok.extern.log4j.Log4j2
;
...
...
@@ -80,9 +81,9 @@ public class THolidayInfoServiceImpl extends ServiceImpl<THolidayInfoMapper, THo
*/
@Override
public
void
listExport
(
HttpServletResponse
response
,
THolidayInfoSearchVo
searchVo
)
{
String
fileName
=
"
批量导出
"
+
DateUtil
.
getThisTime
()
+
".xlsx"
;
String
fileName
=
"
节假日信息表
"
+
DateUtil
.
getThisTime
()
+
".xlsx"
;
//获取要导出的列表
List
<
THoliday
Inf
o
>
list
=
new
ArrayList
<>();
List
<
THoliday
ExportV
o
>
list
=
new
ArrayList
<>();
long
count
=
noPageCountDiy
(
searchVo
);
ServletOutputStream
out
=
null
;
try
{
...
...
@@ -92,17 +93,17 @@ public class THolidayInfoServiceImpl extends ServiceImpl<THolidayInfoMapper, THo
response
.
setHeader
(
CommonConstants
.
CONTENT_DISPOSITION
,
CommonConstants
.
ATTACHMENT_FILENAME
+
URLEncoder
.
encode
(
fileName
,
CommonConstants
.
UTF8
));
// 这里 需要指定写用哪个class去写,然后写到第一个sheet,然后文件流会自动关闭
//EasyExcel.write(out, TEmpBadRecord.class).sheet("不良记录").doWrite(list);
ExcelWriter
excelWriter
=
EasyExcel
.
write
(
out
,
THoliday
Inf
o
.
class
).
build
();
ExcelWriter
excelWriter
=
EasyExcel
.
write
(
out
,
THoliday
ExportV
o
.
class
).
build
();
int
index
=
0
;
if
(
count
>
CommonConstants
.
ZERO_INT
)
{
for
(
int
i
=
0
;
i
<=
count
;
)
{
// 获取实际记录
searchVo
.
setLimitStart
(
i
);
searchVo
.
setLimitEnd
(
CommonConstants
.
EXCEL_EXPORT_LIMIT
);
list
=
noPageDiy
(
searchVo
);
list
=
exportSearch
(
searchVo
);
if
(
Common
.
isNotNull
(
list
))
{
ExcelUtil
<
THoliday
Info
>
util
=
new
ExcelUtil
<>(
THolidayInf
o
.
class
);
for
(
THoliday
Inf
o
vo
:
list
)
{
ExcelUtil
<
THoliday
ExportVo
>
util
=
new
ExcelUtil
<>(
THolidayExportV
o
.
class
);
for
(
THoliday
ExportV
o
vo
:
list
)
{
util
.
convertEntity
(
vo
,
null
,
null
,
null
);
}
}
...
...
@@ -152,6 +153,10 @@ public class THolidayInfoServiceImpl extends ServiceImpl<THolidayInfoMapper, THo
return
baseMapper
.
selectList
(
wrapper
);
}
public
List
<
THolidayExportVo
>
exportSearch
(
THolidayInfoSearchVo
searchVo
)
{
return
baseMapper
.
exportSearch
(
searchVo
);
}
private
Long
noPageCountDiy
(
THolidayInfoSearchVo
searchVo
)
{
LambdaQueryWrapper
<
THolidayInfo
>
wrapper
=
buildQueryWrapper
(
searchVo
);
List
<
String
>
idList
=
Common
.
getList
(
searchVo
.
getIds
());
...
...
@@ -514,4 +519,41 @@ public class THolidayInfoServiceImpl extends ServiceImpl<THolidayInfoMapper, THo
return
vo
;
}
@Override
public
R
createHolidayInfoByYear
(
String
year
)
{
if
(
Common
.
isEmpty
(
year
)
||
year
.
length
()
!=
4
){
return
R
.
failed
(
"请输入正确的年份"
);
}
List
<
Map
<
String
,
Object
>>
json
=
HolidayCrawler
.
initHolidaysByYear
(
year
);
List
<
THolidayInfo
>
saveList
=
new
ArrayList
<>();
THolidayInfo
save
;
if
(
null
!=
json
&&
json
.
size
()
>
0
){
//查到数据再删除
baseMapper
.
delete
(
Wrappers
.<
THolidayInfo
>
query
().
lambda
().
eq
(
THolidayInfo:
:
getYear
,
year
));
for
(
Map
<
String
,
Object
>
d:
json
){
save
=
new
THolidayInfo
();
try
{
save
.
setDate
(
DateUtil
.
stringToDate
((
String
)
d
.
get
(
"date"
).
toString
(),
DateUtil
.
ISO_DATE_FORMAT
));
}
catch
(
Exception
e
){
log
.
error
(
"假期表初始化异常:"
+
d
.
get
(
"date"
),
e
);
continue
;
}
save
.
setDay
(
DateUtil
.
getDay
(
save
.
getDate
()));
save
.
setMonth
(
DateUtil
.
getMonth
(
save
.
getDate
()));
save
.
setYear
(
DateUtil
.
getYear
(
save
.
getDate
()));
save
.
setCreateBy
(
"1"
);
save
.
setCreateName
(
"admin"
);
save
.
setCreateTime
(
LocalDateTime
.
now
());
save
.
setUpdateBy
(
"1"
);
saveList
.
add
(
save
);
}
}
else
{
return
R
.
failed
(
"暂无假日数据"
);
}
if
(
Common
.
isNotNull
(
saveList
)){
this
.
saveBatch
(
saveList
);
}
return
R
.
ok
(
"success"
);
}
}
yifu-social/yifu-social-biz/src/main/resources/mapper/THolidayInfoMapper.xml
View file @
e7e73f80
...
...
@@ -34,6 +34,14 @@
<result
property=
"createTime"
column=
"CREATE_TIME"
/>
<result
property=
"updateBy"
column=
"UPDATE_BY"
/>
<result
property=
"updateTime"
column=
"UPDATE_TIME"
/>
<result
property=
"isHoliday"
column=
"isHoliday"
/>
</resultMap>
<resultMap
id=
"noPageMap"
type=
"com.yifu.cloud.plus.v1.yifu.social.vo.THolidayExportVo"
>
<result
property=
"year"
column=
"YEAR"
/>
<result
property=
"month"
column=
"MONTH"
/>
<result
property=
"day"
column=
"DAY"
/>
<result
property=
"isHoliday"
column=
"isHoliday"
/>
</resultMap>
<sql
id=
"Base_Column_List"
>
a.ID,
...
...
@@ -56,13 +64,13 @@
AND a.DATE = #{tHolidayInfo.date}
</if>
<if
test=
"tHolidayInfo.year != null and tHolidayInfo.year.trim() != ''"
>
AND a.YEAR
= #{tHolidayInfo.year}
AND a.YEAR
like concat('%', #{tHolidayInfo.year}, '%')
</if>
<if
test=
"tHolidayInfo.month != null and tHolidayInfo.month.trim() != ''"
>
AND a.MONTH
= #{tHolidayInfo.month}
AND a.MONTH
like concat('%', #{tHolidayInfo.month}, '%')
</if>
<if
test=
"tHolidayInfo.day != null and tHolidayInfo.day.trim() != ''"
>
AND a.DAY
= #{tHolidayInfo.day}
AND a.DAY
like concat('%', #{tHolidayInfo.day}, '%')
</if>
<if
test=
"tHolidayInfo.createBy != null and tHolidayInfo.createBy.trim() != ''"
>
AND a.CREATE_BY = #{tHolidayInfo.createBy}
...
...
@@ -84,7 +92,19 @@
<!--tHolidayInfo简单分页查询-->
<select
id=
"getTHolidayInfoPage"
resultMap=
"tHolidayInfoMap"
>
SELECT
<include
refid=
"Base_Column_List"
/>
<include
refid=
"Base_Column_List"
/>
,'是' as 'isHoliday'
FROM t_holiday_info a
<where>
1=1
<include
refid=
"tHolidayInfo_where"
/>
</where>
</select>
<!-- 导出 -->
<select
id=
"exportSearch"
resultMap=
"noPageMap"
>
SELECT
a.YEAR,
a.MONTH,
a.DAY,'是' as 'isHoliday'
FROM t_holiday_info a
<where>
1=1
...
...
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