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
79bebed7
Commit
79bebed7
authored
Aug 18, 2022
by
hongguangwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
回盘
parent
9ea9c330
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
237 additions
and
295 deletions
+237
-295
TStatisticsCurrentReportMarketSearchVo.java
...ifu/salary/vo/TStatisticsCurrentReportMarketSearchVo.java
+6
-0
TStatisticsCurrentReportMarketVo.java
...s/v1/yifu/salary/vo/TStatisticsCurrentReportMarketVo.java
+100
-174
TStatisticsCurrentReportMarketController.java
.../controller/TStatisticsCurrentReportMarketController.java
+23
-17
TStatisticsCurrentReportMarketMapper.java
...u/salary/mapper/TStatisticsCurrentReportMarketMapper.java
+21
-1
TStatisticsCurrentReportMarketService.java
...salary/service/TStatisticsCurrentReportMarketService.java
+10
-2
TStatisticsCurrentReportMarketServiceImpl.java
...rvice/impl/TStatisticsCurrentReportMarketServiceImpl.java
+63
-101
TStatisticsCurrentReportMarketMapper.xml
...resources/mapper/TStatisticsCurrentReportMarketMapper.xml
+14
-0
No files found.
yifu-salary/yifu-salary-api/src/main/java/com/yifu/cloud/plus/v1/yifu/salary/vo/TStatisticsCurrentReportMarketSearchVo.java
View file @
79bebed7
...
...
@@ -16,11 +16,13 @@
*/
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
salary
.
vo
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.yifu.cloud.plus.v1.yifu.salary.entity.TStatisticsCurrentReportMarket
;
import
io.swagger.v3.oas.annotations.media.Schema
;
import
lombok.Data
;
import
java.time.LocalDateTime
;
import
java.util.Set
;
/**
* 统计-本期申报-回盘数据
...
...
@@ -37,6 +39,10 @@ public class TStatisticsCurrentReportMarketSearchVo extends TStatisticsCurrentRe
@Schema
(
description
=
"选中ID,多个逗号分割"
)
private
String
ids
;
@TableField
(
exist
=
false
)
@Schema
(
description
=
"导出的表头的Set"
)
private
Set
<
String
>
exportFields
;
/**
* 创建时间区间 [开始时间,结束时间]
*/
...
...
yifu-salary/yifu-salary-api/src/main/java/com/yifu/cloud/plus/v1/yifu/salary/vo/TStatisticsCurrentReportMarketVo.java
View file @
79bebed7
This diff is collapsed.
Click to expand it.
yifu-salary/yifu-salary-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/salary/controller/TStatisticsCurrentReportMarketController.java
View file @
79bebed7
...
...
@@ -83,14 +83,32 @@ public class TStatisticsCurrentReportMarketController {
* @param id id
* @return R
*/
@Operation
(
summary
=
"通过id删除统计-本期申报-回盘数据"
,
description
=
"通过id删除统计-本期申报-回盘数据:hasPermission('salary_
tstatisticscurrentreport
market_del')"
)
@Operation
(
summary
=
"通过id删除统计-本期申报-回盘数据"
,
description
=
"通过id删除统计-本期申报-回盘数据:hasPermission('salary_
report_
market_del')"
)
@SysLog
(
"通过id删除统计-本期申报-回盘数据"
)
@DeleteMapping
(
"/{id}"
)
@PreAuthorize
(
"@pms.hasPermission('salary_
tstatisticscurrentreport
market_del')"
)
@PreAuthorize
(
"@pms.hasPermission('salary_
report_
market_del')"
)
public
R
<
Boolean
>
removeById
(
@PathVariable
String
id
)
{
return
R
.
ok
(
tStatisticsCurrentReportMarketService
.
removeById
(
id
));
}
/**
* @param yearMonth 年月
* @return R
*/
@Operation
(
summary
=
"删除-按申报月份"
,
description
=
"通过id删除统计-本期申报-回盘数据:hasPermission('salary_report_market_doDeleteByDeclareMonth')"
)
@SysLog
(
"删除-按申报月份"
)
@PostMapping
(
"/doDeleteByDeclareMonth"
)
@PreAuthorize
(
"@pms.hasPermission('salary_report_market_doDeleteByDeclareMonth')"
)
public
R
<
String
>
doDeleteByDeclareMonth
(
@RequestParam
String
yearMonth
)
{
int
num
=
tStatisticsCurrentReportMarketService
.
deleteByYearMonth
(
yearMonth
);
if
(
num
==
0
)
{
return
R
.
failed
(
"当前条件查询无数据,未删除"
);
}
else
{
return
R
.
ok
(
"已删除"
+
num
+
"条数据"
);
}
}
/**
* 统计-本期申报-回盘数据 批量导入
*
...
...
@@ -98,24 +116,12 @@ public class TStatisticsCurrentReportMarketController {
* @date 2022-08-05 11:40:14
**/
@SneakyThrows
@Operation
(
description
=
"批量
新增统计-本期申报-回盘数据 hasPermission('salary_tstatisticscurrentreport
market-batch-import')"
)
@SysLog
(
"批量
新增统计-本期申报
-回盘数据"
)
@Operation
(
description
=
"批量
导入-回盘数据 hasPermission('salary_report_
market-batch-import')"
)
@SysLog
(
"批量
导入
-回盘数据"
)
@PostMapping
(
"/importListAdd"
)
@PreAuthorize
(
"@pms.hasPermission('salary_
tstatisticscurrentreport
market-batch-import')"
)
@PreAuthorize
(
"@pms.hasPermission('salary_
report_
market-batch-import')"
)
public
R
<
List
<
ErrorMessage
>>
importListAdd
(
@RequestBody
MultipartFile
file
)
{
return
tStatisticsCurrentReportMarketService
.
importDiy
(
file
.
getInputStream
());
}
/**
* 统计-本期申报-回盘数据 批量导出
*
* @author hgw
* @date 2022-08-05 11:40:14
**/
@Operation
(
description
=
"导出统计-本期申报-回盘数据 hasPermission('salary_tstatisticscurrentreportmarket-export')"
)
@PostMapping
(
"/export"
)
@PreAuthorize
(
"@pms.hasPermission('salary_tstatisticscurrentreportmarket-export')"
)
public
void
export
(
HttpServletResponse
response
,
@RequestBody
TStatisticsCurrentReportMarketSearchVo
searchVo
)
{
tStatisticsCurrentReportMarketService
.
listExport
(
response
,
searchVo
);
}
}
yifu-salary/yifu-salary-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/salary/mapper/TStatisticsCurrentReportMarketMapper.java
View file @
79bebed7
...
...
@@ -36,5 +36,25 @@ public interface TStatisticsCurrentReportMarketMapper extends BaseMapper<TStatis
* @param tStatisticsCurrentReportMarket 统计-本期申报-回盘数据
* @return
*/
IPage
<
TStatisticsCurrentReportMarket
>
getTStatisticsCurrentReportMarketPage
(
Page
<
TStatisticsCurrentReportMarket
>
page
,
@Param
(
"tStatisticsCurrentReportMarket"
)
TStatisticsCurrentReportMarket
tStatisticsCurrentReportMarket
);
IPage
<
TStatisticsCurrentReportMarket
>
getTStatisticsCurrentReportMarketPage
(
Page
<
TStatisticsCurrentReportMarket
>
page
,
@Param
(
"tStatisticsCurrentReportMarket"
)
TStatisticsCurrentReportMarket
tStatisticsCurrentReportMarket
);
/**
* @param yearMonth
* @Description: 删除-按申报月份
* @Author: hgw
* @Date: 2020/6/16 15:19
* @return: int
**/
int
deleteByYearMonth
(
@Param
(
"yearMonth"
)
String
yearMonth
);
/**
* @param declareMonth
* @param declareTitle
* @Description: 查重
* @Author: hgw
* @Date: 2022/8/18 16:05
* @return: int
**/
int
getCountByMonthAndTitle
(
@Param
(
"declareMonth"
)
String
declareMonth
,
@Param
(
"declareTitle"
)
String
declareTitle
);
}
yifu-salary/yifu-salary-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/salary/service/TStatisticsCurrentReportMarketService.java
View file @
79bebed7
...
...
@@ -45,7 +45,15 @@ public interface TStatisticsCurrentReportMarketService extends IService<TStatist
R
<
List
<
ErrorMessage
>>
importDiy
(
InputStream
inputStream
);
void
listExport
(
HttpServletResponse
response
,
TStatisticsCurrentReportMarketSearchVo
searchVo
);
List
<
TStatisticsCurrentReportMarket
>
noPageDiy
(
TStatisticsCurrentReportMarketSearchVo
searchVo
);
/**
* @param yearMonth 申报月份
* @Description: 删除-按申报月份
* @Author: hgw
* @Date: 2020/6/16 15:17
* @return: int
**/
int
deleteByYearMonth
(
String
yearMonth
);
}
yifu-salary/yifu-salary-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/salary/service/impl/TStatisticsCurrentReportMarketServiceImpl.java
View file @
79bebed7
...
...
@@ -18,13 +18,12 @@ package com.yifu.cloud.plus.v1.yifu.salary.service.impl;
import
cn.hutool.core.bean.BeanUtil
;
import
com.alibaba.excel.EasyExcel
;
import
com.alibaba.excel.ExcelWriter
;
import
com.alibaba.excel.context.AnalysisContext
;
import
com.alibaba.excel.read.listener.ReadListener
;
import
com.alibaba.excel.read.metadata.holder.ReadRowHolder
;
import
com.alibaba.excel.util.ListUtils
;
import
com.alibaba.excel.write.metadata.WriteSheet
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
...
...
@@ -39,11 +38,7 @@ import com.yifu.cloud.plus.v1.yifu.salary.vo.TStatisticsCurrentReportMarketVo;
import
lombok.extern.log4j.Log4j2
;
import
org.springframework.stereotype.Service
;
import
javax.servlet.ServletOutputStream
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.net.URLEncoder
;
import
java.util.ArrayList
;
import
java.util.List
;
...
...
@@ -67,71 +62,6 @@ public class TStatisticsCurrentReportMarketServiceImpl extends ServiceImpl<TStat
return
baseMapper
.
getTStatisticsCurrentReportMarketPage
(
page
,
tStatisticsCurrentReportMarket
);
}
/**
* 统计-本期申报-回盘数据批量导出
*
* @return
*/
@Override
public
void
listExport
(
HttpServletResponse
response
,
TStatisticsCurrentReportMarketSearchVo
searchVo
)
{
String
fileName
=
"不良记录批量导出"
+
DateUtil
.
getThisTime
()
+
".xlsx"
;
//获取要导出的列表
List
<
TStatisticsCurrentReportMarket
>
list
=
new
ArrayList
<>();
long
count
=
noPageCountDiy
(
searchVo
);
ServletOutputStream
out
=
null
;
try
{
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"
));
// 这里 需要指定写用哪个class去写,然后写到第一个sheet,然后文件流会自动关闭
//EasyExcel.write(out, TEmpBadRecord.class).sheet("不良记录").doWrite(list);
ExcelWriter
excelWriter
=
EasyExcel
.
write
(
out
,
TStatisticsCurrentReportMarket
.
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
);
if
(
Common
.
isNotNull
(
list
))
{
ExcelUtil
<
TStatisticsCurrentReportMarket
>
util
=
new
ExcelUtil
<>(
TStatisticsCurrentReportMarket
.
class
);
for
(
TStatisticsCurrentReportMarket
vo
:
list
)
{
util
.
convertEntity
(
vo
,
null
,
null
,
null
);
}
}
if
(
Common
.
isNotNull
(
list
))
{
WriteSheet
writeSheet
=
EasyExcel
.
writerSheet
(
"统计-本期申报-回盘数据"
+
index
).
build
();
excelWriter
.
write
(
list
,
writeSheet
);
index
++;
}
i
=
i
+
CommonConstants
.
EXCEL_EXPORT_LIMIT
;
if
(
Common
.
isNotNull
(
list
))
{
list
.
clear
();
}
}
}
else
{
WriteSheet
writeSheet
=
EasyExcel
.
writerSheet
(
"统计-本期申报-回盘数据"
+
index
).
build
();
excelWriter
.
write
(
list
,
writeSheet
);
}
if
(
Common
.
isNotNull
(
list
))
{
list
.
clear
();
}
out
.
flush
();
excelWriter
.
finish
();
}
catch
(
Exception
e
)
{
log
.
error
(
"执行异常"
,
e
);
}
finally
{
try
{
if
(
null
!=
out
)
{
out
.
close
();
}
}
catch
(
IOException
e
)
{
log
.
error
(
"执行异常"
,
e
);
}
}
}
@Override
public
List
<
TStatisticsCurrentReportMarket
>
noPageDiy
(
TStatisticsCurrentReportMarketSearchVo
searchVo
)
{
LambdaQueryWrapper
<
TStatisticsCurrentReportMarket
>
wrapper
=
buildQueryWrapper
(
searchVo
);
...
...
@@ -145,15 +75,6 @@ public class TStatisticsCurrentReportMarketServiceImpl extends ServiceImpl<TStat
return
baseMapper
.
selectList
(
wrapper
);
}
private
Long
noPageCountDiy
(
TStatisticsCurrentReportMarketSearchVo
searchVo
)
{
LambdaQueryWrapper
<
TStatisticsCurrentReportMarket
>
wrapper
=
buildQueryWrapper
(
searchVo
);
List
<
String
>
idList
=
Common
.
getList
(
searchVo
.
getIds
());
if
(
Common
.
isNotNull
(
idList
))
{
wrapper
.
in
(
TStatisticsCurrentReportMarket:
:
getId
,
idList
);
}
return
baseMapper
.
selectCount
(
wrapper
);
}
private
LambdaQueryWrapper
buildQueryWrapper
(
TStatisticsCurrentReportMarketSearchVo
entity
)
{
LambdaQueryWrapper
<
TStatisticsCurrentReportMarket
>
wrapper
=
Wrappers
.
lambdaQuery
();
return
wrapper
;
...
...
@@ -163,7 +84,6 @@ public class TStatisticsCurrentReportMarketServiceImpl extends ServiceImpl<TStat
public
R
<
List
<
ErrorMessage
>>
importDiy
(
InputStream
inputStream
)
{
List
<
ErrorMessage
>
errorMessageList
=
new
ArrayList
<>();
ExcelUtil
<
TStatisticsCurrentReportMarketVo
>
util1
=
new
ExcelUtil
<>(
TStatisticsCurrentReportMarketVo
.
class
);
;
// 写法2:
// 匿名内部类 不用额外写一个DemoDataListener
// 这里 需要指定读用哪个class去读,然后读取第一个sheet 文件流会自动关闭
...
...
@@ -173,6 +93,9 @@ public class TStatisticsCurrentReportMarketServiceImpl extends ServiceImpl<TStat
* 单次缓存的数据量
*/
public
static
final
int
BATCH_COUNT
=
CommonConstants
.
BATCH_COUNT
;
// 申报月份
String
declareMonth
;
String
declareTitle
;
/**
*临时存储
*/
...
...
@@ -190,7 +113,36 @@ public class TStatisticsCurrentReportMarketServiceImpl extends ServiceImpl<TStat
cachedDataList
.
add
(
data
);
}
if
(
cachedDataList
.
size
()
>=
BATCH_COUNT
)
{
saveData
();
if
(
Common
.
isEmpty
(
declareMonth
))
{
if
(
Common
.
isNotNull
(
cachedDataList
.
get
(
0
).
getCreateStart
()))
{
declareMonth
=
DateUtil
.
getYearMonth
(
cachedDataList
.
get
(
0
).
getCreateStart
());
}
if
(
Common
.
isEmpty
(
declareMonth
))
{
errorMessageList
.
add
(
new
ErrorMessage
(
CommonConstants
.
ZERO_INT
,
"请检查‘税款所属期起’单元格格式是文本格式,且满足日期格式yyyy-MM-dd或yyyyMMdd:CreateStart="
+
cachedDataList
.
get
(
0
).
getCreateStart
()
+
"|| yearMonth="
+
declareMonth
));
}
declareTitle
=
cachedDataList
.
get
(
0
).
getInvoiceTitle
();
if
(
Common
.
isEmpty
(
declareTitle
))
{
errorMessageList
.
add
(
new
ErrorMessage
(
CommonConstants
.
ZERO_INT
,
"封面抬头全称-不能为空"
));
}
if
(
Common
.
isNotNull
(
declareMonth
)
&&
Common
.
isNotNull
(
declareTitle
))
{
TStatisticsCurrentReportMarket
sdsCheck
=
new
TStatisticsCurrentReportMarket
();
sdsCheck
.
setDeclareMonth
(
declareMonth
);
sdsCheck
.
setInvoiceTitle
(
declareTitle
);
QueryWrapper
<
TStatisticsCurrentReportMarket
>
queryWrapperSc
=
new
QueryWrapper
<>();
queryWrapperSc
.
setEntity
(
sdsCheck
);
int
count
=
baseMapper
.
getCountByMonthAndTitle
(
declareMonth
,
declareTitle
);
if
(
count
>
CommonConstants
.
ZERO_INT
)
{
errorMessageList
.
add
(
new
ErrorMessage
(
CommonConstants
.
ZERO_INT
,
"当前月同一-封面抬头全称-已存在数据。"
));
}
}
}
if
(
errorMessageList
.
isEmpty
())
{
saveData
(
declareMonth
);
}
// 存储完成清理 list
cachedDataList
=
ListUtils
.
newArrayListWithExpectedSize
(
BATCH_COUNT
);
}
...
...
@@ -198,15 +150,17 @@ public class TStatisticsCurrentReportMarketServiceImpl extends ServiceImpl<TStat
@Override
public
void
doAfterAllAnalysed
(
AnalysisContext
context
)
{
saveData
();
saveData
(
declareMonth
);
}
/**
* 加上存储数据库
*/
private
void
saveData
()
{
private
void
saveData
(
String
declareMonth
)
{
log
.
info
(
"{}条数据,开始存储数据库!"
,
cachedDataList
.
size
());
importTStatisticsCurrentReportMarket
(
cachedDataList
,
errorMessageList
);
if
(!
cachedDataList
.
isEmpty
())
{
importTStatisticsCurrentReportMarket
(
declareMonth
,
cachedDataList
);
}
log
.
info
(
"存储数据库成功!"
);
}
}).
sheet
().
doRead
();
...
...
@@ -214,29 +168,37 @@ public class TStatisticsCurrentReportMarketServiceImpl extends ServiceImpl<TStat
log
.
error
(
CommonConstants
.
IMPORT_DATA_ANALYSIS_ERROR
,
e
);
return
R
.
failed
(
CommonConstants
.
IMPORT_DATA_ANALYSIS_ERROR
);
}
return
R
.
ok
(
errorMessageList
);
boolean
isTrue
=
true
;
for
(
ErrorMessage
message
:
errorMessageList
)
{
if
(!
CommonConstants
.
SAVE_SUCCESS
.
equals
(
message
.
getMessage
()))
{
isTrue
=
false
;
break
;
}
}
if
(
isTrue
)
{
return
R
.
ok
();
}
else
{
return
R
.
failed
(
errorMessageList
);
}
}
private
void
importTStatisticsCurrentReportMarket
(
List
<
TStatisticsCurrentReportMarketVo
>
excelVOList
,
List
<
ErrorMessage
>
errorMessage
List
)
{
private
void
importTStatisticsCurrentReportMarket
(
String
declareMonth
,
List
<
TStatisticsCurrentReportMarketVo
>
excelVO
List
)
{
// 个性化校验逻辑
ErrorMessage
errorMsg
;
TStatisticsCurrentReportMarketVo
excel
;
TStatisticsCurrentReportMarket
insert
;
// 执行数据插入操作 组装
for
(
int
i
=
0
;
i
<
excelVOList
.
size
();
i
++)
{
TStatisticsCurrentReportMarketVo
excel
=
excelVOList
.
get
(
i
);
// 数据合法情况 TODO
// 插入
insertExcel
(
excel
);
errorMessageList
.
add
(
new
ErrorMessage
(
excel
.
getRowIndex
(),
CommonConstants
.
SAVE_SUCCESS
));
excel
=
excelVOList
.
get
(
i
);
insert
=
new
TStatisticsCurrentReportMarket
();
BeanUtil
.
copyProperties
(
excel
,
insert
);
insert
.
setDeclareMonth
(
declareMonth
);
this
.
save
(
insert
);
}
}
/**
* 插入excel bad record
*/
private
void
insertExcel
(
TStatisticsCurrentReportMarketVo
excel
)
{
TStatisticsCurrentReportMarket
insert
=
new
TStatisticsCurrentReportMarket
();
BeanUtil
.
copyProperties
(
excel
,
insert
);
this
.
save
(
insert
);
@Override
public
int
deleteByYearMonth
(
String
yearMonth
)
{
return
baseMapper
.
deleteByYearMonth
(
yearMonth
);
}
}
yifu-salary/yifu-salary-biz/src/main/resources/mapper/TStatisticsCurrentReportMarketMapper.xml
View file @
79bebed7
...
...
@@ -276,4 +276,18 @@
<include
refid=
"tStatisticsCurrentReportMarket_where"
/>
</where>
</select>
<!-- 删除-按申报月份 -->
<delete
id=
"deleteByYearMonth"
>
DELETE FROM t_statistics_current_report_market WHERE DECLARE_MONTH = #{yearMonth}
</delete>
<!-- 查重 -->
<select
id=
"getCountByMonthAndTitle"
resultType=
"java.lang.Integer"
>
SELECT
count(1)
FROM t_statistics_current_report_market a
where a.INVOICE_TITLE = #{declareTitle} and a.declare_MONTH = #{declareMonth}
</select>
</mapper>
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