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
98a18d6b
Commit
98a18d6b
authored
May 13, 2025
by
huyuchen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
huych-实缴推送优化
parent
3c5d3ea4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
191 additions
and
3 deletions
+191
-3
application-prd.yml
yifu-ekp/yifu-ekp-biz/src/main/resources/application-prd.yml
+2
-2
TSalaryAccountMapper.java
...loud/plus/v1/yifu/salary/mapper/TSalaryAccountMapper.java
+8
-0
TSalaryAccountServiceImpl.java
...1/yifu/salary/service/impl/TSalaryAccountServiceImpl.java
+96
-1
TSalaryAccountMapper.xml
...ry-biz/src/main/resources/mapper/TSalaryAccountMapper.xml
+85
-0
No files found.
yifu-ekp/yifu-ekp-biz/src/main/resources/application-prd.yml
View file @
98a18d6b
...
...
@@ -23,9 +23,9 @@ spring:
activate
:
on-profile
:
prd
redis
:
host
:
192.168.
10.153
host
:
192.168.
0.222
port
:
22379
password
:
'
@yf_20
17
'
password
:
'
@yf_20
22
'
## spring security 配置
security
:
oauth2
:
...
...
yifu-salary/yifu-salary-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/salary/mapper/TSalaryAccountMapper.java
View file @
98a18d6b
...
...
@@ -135,6 +135,10 @@ public interface TSalaryAccountMapper extends BaseMapper<TSalaryAccount> {
List
<
SalaryAccountExportVo
>
noPageDiyLastByIds
(
@Param
(
"searchVo"
)
TSalaryAccountSearchVo
searchVo
,
@Param
(
"idList"
)
List
<
String
>
idList
);
List
<
SalaryAccountExportVo
>
noPageDiyLastNew
(
@Param
(
"searchVo"
)
TSalaryAccountSearchVo
searchVo
,
@Param
(
"idList"
)
List
<
String
>
idList
,
@Param
(
"deptNos"
)
List
<
String
>
deptNos
);
List
<
String
>
noPageDiyLastIds
(
@Param
(
"searchVo"
)
TSalaryAccountSearchVo
searchVo
,
@Param
(
"idList"
)
List
<
String
>
idList
,
@Param
(
"deptNos"
)
List
<
String
>
deptNos
);
...
...
@@ -185,6 +189,10 @@ public interface TSalaryAccountMapper extends BaseMapper<TSalaryAccount> {
@Param
(
"idList"
)
List
<
String
>
idList
,
@Param
(
"deptNos"
)
List
<
String
>
deptNos
);
int
noPageCountDiyLastNew
(
@Param
(
"searchVo"
)
TSalaryAccountSearchVo
searchVo
,
@Param
(
"idList"
)
List
<
String
>
idList
,
@Param
(
"deptNos"
)
List
<
String
>
deptNos
);
int
auditExportCount
(
@Param
(
"searchVo"
)
TSalaryAccountSearchVo
searchVo
,
@Param
(
"idList"
)
List
<
String
>
idList
);
...
...
yifu-salary/yifu-salary-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/salary/service/impl/TSalaryAccountServiceImpl.java
View file @
98a18d6b
...
...
@@ -16,9 +16,14 @@
*/
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
salary
.
service
.
impl
;
import
com.alibaba.excel.EasyExcel
;
import
com.alibaba.excel.EasyExcelFactory
;
import
com.alibaba.excel.ExcelWriter
;
import
com.alibaba.excel.write.builder.ExcelWriterBuilder
;
import
com.alibaba.excel.write.handler.SheetWriteHandler
;
import
com.alibaba.excel.write.metadata.WriteSheet
;
import
com.alibaba.excel.write.metadata.holder.WriteSheetHolder
;
import
com.alibaba.excel.write.metadata.holder.WriteWorkbookHolder
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
...
...
@@ -41,6 +46,7 @@ import com.yifu.cloud.plus.v1.yifu.salary.vo.*;
import
lombok.RequiredArgsConstructor
;
import
lombok.extern.log4j.Log4j2
;
import
org.apache.commons.compress.utils.Lists
;
import
org.apache.poi.xssf.streaming.SXSSFWorkbook
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
...
...
@@ -128,7 +134,7 @@ public class TSalaryAccountServiceImpl extends ServiceImpl<TSalaryAccountMapper,
if
(
atomicInteger
.
incrementAndGet
()
<=
maxLimit
){
try
{
if
(
CommonConstants
.
ZERO_INT
==
type
){
listExport
(
response
,
searchVo
);
listExport
New
(
response
,
searchVo
);
}
else
if
(
CommonConstants
.
ONE_INT
==
type
){
auditExport
(
response
,
searchVo
);
}
else
if
(
CommonConstants
.
TWO_INT
==
type
){
...
...
@@ -231,6 +237,95 @@ public class TSalaryAccountServiceImpl extends ServiceImpl<TSalaryAccountMapper,
}
}
/**
* 导出员工报账查询结果到Excel
*
* @param response HTTP响应对象,用于输出Excel文件
* @param searchVo 搜索条件对象,用于查询工资账户信息
*/
public
void
listExportNew
(
HttpServletResponse
response
,
TSalaryAccountSearchVo
searchVo
)
{
// 生成文件名,包含当前时间戳和文件扩展名
String
fileName
=
"员工报账查询批量导出"
+
DateUtil
.
getThisTime
()
+
CommonConstants
.
XLSX
;
// 不可查询项目合集
List
<
TDeptSee
>
depts
=
deptSeeMapper
.
selectList
(
Wrappers
.<
TDeptSee
>
query
().
lambda
()
.
eq
(
TDeptSee:
:
getCanSee
,
CommonConstants
.
ONE_INT
));
List
<
String
>
deptNos
=
null
;
if
(
Common
.
isNotNull
(
depts
))
{
deptNos
=
depts
.
stream
().
map
(
TDeptSee:
:
getDeptNo
).
collect
(
Collectors
.
toList
());
}
// 计算符合条件的记录总数
long
count
=
baseMapper
.
noPageCountDiyLastNew
(
searchVo
,
searchVo
.
getIdList
(),
deptNos
);
try
(
ServletOutputStream
out
=
response
.
getOutputStream
())
{
response
.
setContentType
(
CommonConstants
.
MULTIPART_FORM_DATA
);
response
.
setCharacterEncoding
(
"utf-8"
);
response
.
setHeader
(
CommonConstants
.
CONTENT_DISPOSITION
,
CommonConstants
.
ATTACHMENT_FILENAME
+
URLEncoder
.
encode
(
fileName
,
"UTF-8"
));
// 非管理员导出大于100W提示
if
(
count
>
1000000
)
{
out
.
write
(
CommonConstants
.
SOCIAL_EXPORT_LIMIT
.
getBytes
(
"GBK"
));
return
;
}
// 使用SXSSF模式,设置缓存行数为1000,减少内存占用
ExcelWriterBuilder
writerBuilder
=
EasyExcel
.
write
(
out
,
TSalaryAccount
.
class
)
.
registerWriteHandler
(
new
SheetWriteHandler
()
{
@Override
public
void
afterSheetCreate
(
WriteWorkbookHolder
writeWorkbookHolder
,
WriteSheetHolder
writeSheetHolder
)
{
// 启用SXSSF模式
if
(
writeWorkbookHolder
.
getWorkbook
()
instanceof
SXSSFWorkbook
)
{
((
SXSSFWorkbook
)
writeWorkbookHolder
.
getWorkbook
()).
setCompressTempFiles
(
true
);
}
}
})
.
autoCloseStream
(
true
)
.
inMemory
(
false
)
// 设置为false以启用磁盘缓存
.
includeColumnFiledNames
(
searchVo
.
getExportFields
());
ExcelWriter
excelWriter
=
writerBuilder
.
build
();
int
sheetIndex
=
0
;
WriteSheet
writeSheet
=
EasyExcel
.
writerSheet
(
"工资报账主表(工资条)"
+
sheetIndex
).
build
();
// 分批查询和写入
if
(
count
>
CommonConstants
.
ZERO_INT
)
{
int
batchSize
=
CommonConstants
.
EXCEL_EXPORT_LIMIT_1
;
int
totalPages
=
(
int
)
Math
.
ceil
((
double
)
count
/
batchSize
);
for
(
int
page
=
1
;
page
<=
totalPages
;
page
++)
{
// 每10万条数据切换一个新sheet,防止单个sheet过大
if
((
page
-
1
)
*
batchSize
%
100000
==
0
&&
(
page
-
1
)
*
batchSize
>
0
)
{
sheetIndex
++;
writeSheet
=
EasyExcel
.
writerSheet
(
"工资报账主表(工资条)"
+
sheetIndex
).
build
();
}
// 设置分页参数
searchVo
.
setLimitStart
((
page
-
1
)
*
batchSize
);
searchVo
.
setLimitEnd
(
batchSize
);
List
<
SalaryAccountExportVo
>
batchList
=
baseMapper
.
noPageDiyLastNew
(
searchVo
,
searchVo
.
getIdList
(),
deptNos
);
if
(
Common
.
isNotNull
(
batchList
))
{
excelWriter
.
write
(
batchList
,
writeSheet
);
// 及时清空批次数据
batchList
.
clear
();
}
}
}
else
{
excelWriter
.
write
(
new
ArrayList
<>(),
writeSheet
);
}
excelWriter
.
finish
();
out
.
flush
();
}
catch
(
Exception
e
)
{
log
.
error
(
"执行异常"
,
e
);
throw
new
RuntimeException
(
"导出失败"
,
e
);
}
}
/**
* 审核人导出
*
...
...
yifu-salary/yifu-salary-biz/src/main/resources/mapper/TSalaryAccountMapper.xml
View file @
98a18d6b
...
...
@@ -1737,6 +1737,90 @@
</if>
</where>
</select>
<!-- 员工报账导出数量查询 huych1.7.11-->
<select
id=
"noPageCountDiyLastNew"
resultType=
"java.lang.Integer"
>
SELECT
count(1)
FROM
<if
test=
"searchVo.salaryMonthStart == null or searchVo.salaryMonthStart.trim() >= '202201' "
>
t_salary_account a
</if>
<if
test=
"searchVo.salaryMonthStart != null and searchVo.salaryMonthStart.trim() < '202201' "
>
t_salary_account_hro_2021 a
</if>
<where>
a.DELETE_FLAG = 0
<include
refid=
"where_export"
/>
<if
test=
"deptNos != null and deptNos.size>0"
>
AND a.DEPT_NO not in
<foreach
item=
"no"
index=
"index"
collection=
"deptNos"
open=
"("
separator=
","
close=
")"
>
#{no}
</foreach>
</if>
<if
test=
"searchVo.authSql != null and searchVo.authSql.trim() != ''"
>
${searchVo.authSql}
</if>
</where>
</select>
<!-- 员工报账导出查询 huych1.7.11-->
<select
id=
"noPageDiyLastNew"
resultMap=
"tSalaryAccountMap"
parameterType=
"com.yifu.cloud.plus.v1.yifu.salary.vo.SalaryAccountExportVo"
>
SELECT
a.DEPT_NAME,
a.DEPT_NO,
a.EMP_NAME,
a.EMP_IDCARD,
a.EMP_PHONE,
a.BANK_NO,
a.BANK_NAME,
ap.AREA_NAME BANK_PROVINCE,
ac.AREA_NAME BANK_CITY,
a.BANK_SUB_NAME,
case a.FORM_TYPE when '0' then '薪资' when '1' then '绩效' when '3' then '劳务费' when '4' then '稿酬' else '其他' end as FORM_TYPE,
a.SALARY_MONTH,
if(a.RELAY_SALARY_UNIT is not null and a.RELAY_SALARY_UNIT != 0,a.RELAY_SALARY_UNIT,ifnull(a.RELAY_SALARY,0)) RELAY_SALARY,
a.ACTUAL_SALARY,a.SALARY_TAX
FROM
<if
test=
"searchVo.salaryMonthStart == null or searchVo.salaryMonthStart.trim() >= '202201'"
>
t_salary_account a
</if>
<if
test=
"searchVo.salaryMonthStart != null and searchVo.salaryMonthStart.trim() < '202201' "
>
t_salary_account_hro_2021 a
</if>
inner join (
SELECT
a.id
FROM
<if
test=
"searchVo.salaryMonthStart == null or searchVo.salaryMonthStart.trim() >= '202201'"
>
t_salary_account a
</if>
<if
test=
"searchVo.salaryMonthStart != null and searchVo.salaryMonthStart.trim() < '202201' "
>
t_salary_account_hro_2021 a
</if>
<where>
a.DELETE_FLAG = 0
<include
refid=
"where_export"
/>
<if
test=
"deptNos != null and deptNos.size>0"
>
AND a.DEPT_NO not in
<foreach
item=
"no"
index=
"index"
collection=
"deptNos"
open=
"("
separator=
","
close=
")"
>
#{no}
</foreach>
</if>
<if
test=
"searchVo.authSql != null and searchVo.authSql.trim() != ''"
>
${searchVo.authSql}
</if>
<if
test=
"searchVo != null"
>
<if
test=
"searchVo.limitStart != null"
>
limit #{searchVo.limitStart},#{searchVo.limitEnd}
</if>
</if>
</where>
) tmp ON a.id = tmp.id
left join sys_area ap on ap.id=a.BANK_PROVINCE
left join sys_area ac on ac.id=a.BANK_CITY
</select>
<!-- 员工报账导出查询 -->
<select
id=
"noPageDiyLast"
resultMap=
"tSalaryAccountMap"
parameterType=
"com.yifu.cloud.plus.v1.yifu.salary.vo.SalaryAccountExportVo"
>
SELECT
...
...
@@ -1784,6 +1868,7 @@
</if>
</where>
</select>
<select
id=
"noPageCountDiyLast"
resultType=
"java.lang.Integer"
>
SELECT
count(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