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
d89b1d67
Commit
d89b1d67
authored
Sep 02, 2022
by
hongguangwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化sonar
parent
4223427c
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
25 additions
and
108 deletions
+25
-108
TSalaryStandardController.java
.../v1/yifu/salary/controller/TSalaryStandardController.java
+4
-4
TSalaryStandardService.java
...d/plus/v1/yifu/salary/service/TSalaryStandardService.java
+2
-6
TSalaryStandardServiceImpl.java
.../yifu/salary/service/impl/TSalaryStandardServiceImpl.java
+13
-98
TIncomeServiceImpl.java
.../plus/v1/yifu/social/service/impl/TIncomeServiceImpl.java
+6
-0
No files found.
yifu-salary/yifu-salary-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/salary/controller/TSalaryStandardController.java
View file @
d89b1d67
...
...
@@ -158,15 +158,15 @@ public class TSalaryStandardController {
* 审核
*
* @param auditFlag 是否通过 0 是 1 否
* @param
A
uditRemark 审核意见
* @param
a
uditRemark 审核意见
* @param id
* @return
*/
@Operation
(
description
=
"薪酬审核"
)
@PostMapping
(
"/salaryStandardAudit"
)
public
R
salaryStandardAudit
(
@RequestParam
String
auditFlag
,
@RequestParam
(
required
=
false
)
String
A
uditRemark
,
public
R
<
String
>
salaryStandardAudit
(
@RequestParam
String
auditFlag
,
@RequestParam
(
required
=
false
)
String
a
uditRemark
,
@RequestParam
String
id
)
{
return
tSalaryStandardService
.
salaryStandardAudit
(
auditFlag
,
A
uditRemark
,
id
);
return
tSalaryStandardService
.
salaryStandardAudit
(
auditFlag
,
a
uditRemark
,
id
);
}
/**
...
...
@@ -175,7 +175,7 @@ public class TSalaryStandardController {
*/
@Operation
(
description
=
"保存并提交"
)
@PostMapping
(
"/doSubmit"
)
public
R
salaryStandardAudit
(
@RequestBody
TSalaryStandard
tSalaryStandard
)
{
public
R
<
String
>
salaryStandardAudit
(
@RequestBody
TSalaryStandard
tSalaryStandard
)
{
if
(
tSalaryStandard
!=
null
&&
Common
.
isNotNull
(
tSalaryStandard
.
getId
()))
{
TSalaryStandard
s
=
tSalaryStandardService
.
getById
(
tSalaryStandard
.
getId
());
if
(
s
==
null
)
{
...
...
yifu-salary/yifu-salary-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/salary/service/TSalaryStandardService.java
View file @
d89b1d67
...
...
@@ -20,14 +20,12 @@ package com.yifu.cloud.plus.v1.yifu.salary.service;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.ErrorMessage
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.R
;
import
com.yifu.cloud.plus.v1.yifu.salary.entity.TSalaryStandard
;
import
com.yifu.cloud.plus.v1.yifu.salary.vo.TSalaryStandardExportVo
;
import
com.yifu.cloud.plus.v1.yifu.salary.vo.TSalaryStandardSearchVo
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.InputStream
;
import
java.util.List
;
/**
...
...
@@ -44,8 +42,6 @@ public interface TSalaryStandardService extends IService<TSalaryStandard> {
*/
IPage
<
TSalaryStandard
>
getTSalaryStandardPage
(
Page
<
TSalaryStandard
>
page
,
TSalaryStandardSearchVo
tSalaryStandard
);
R
<
List
<
ErrorMessage
>>
importDiy
(
InputStream
inputStream
);
void
listExport
(
HttpServletResponse
response
,
TSalaryStandardSearchVo
searchVo
);
List
<
TSalaryStandardExportVo
>
noPageDiy
(
TSalaryStandardSearchVo
searchVo
);
...
...
@@ -60,11 +56,11 @@ public interface TSalaryStandardService extends IService<TSalaryStandard> {
/**
* 标准薪酬工资表审核
* @param auditFlag 是否通过 0 是 1 否
* @param
A
uditRemark 审核意见
* @param
a
uditRemark 审核意见
* @param id
* @return
*/
R
salaryStandardAudit
(
String
auditFlag
,
String
A
uditRemark
,
String
id
);
R
<
String
>
salaryStandardAudit
(
String
auditFlag
,
String
a
uditRemark
,
String
id
);
/**
* @Description: 删除工资表
...
...
yifu-salary/yifu-salary-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/salary/service/impl/TSalaryStandardServiceImpl.java
View file @
d89b1d67
...
...
@@ -16,13 +16,8 @@
*/
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.EasyExcelFactory
;
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.QueryWrapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
...
...
@@ -31,7 +26,10 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import
com.yifu.cloud.plus.v1.yifu.archives.entity.TDepartSettlementInfo
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.SecurityConstants
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.*
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.Common
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.DateUtil
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.ExcelUtil
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.R
;
import
com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser
;
import
com.yifu.cloud.plus.v1.yifu.common.dapr.config.DaprSocialProperties
;
import
com.yifu.cloud.plus.v1.yifu.common.dapr.util.HttpDaprUtil
;
...
...
@@ -51,7 +49,6 @@ import com.yifu.cloud.plus.v1.yifu.salary.service.TSalaryStandardService;
import
com.yifu.cloud.plus.v1.yifu.salary.util.SalaryConstants
;
import
com.yifu.cloud.plus.v1.yifu.salary.vo.TSalaryStandardExportVo
;
import
com.yifu.cloud.plus.v1.yifu.salary.vo.TSalaryStandardSearchVo
;
import
com.yifu.cloud.plus.v1.yifu.salary.vo.TSalaryStandardVo
;
import
lombok.extern.log4j.Log4j2
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -61,7 +58,6 @@ 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.Date
;
...
...
@@ -103,6 +99,7 @@ public class TSalaryStandardServiceImpl extends ServiceImpl<TSalaryStandardMappe
public
IPage
<
TSalaryStandard
>
getTSalaryStandardPageApply
(
Page
<
TSalaryStandard
>
page
,
TSalaryStandardSearchVo
tSalaryStandard
)
{
return
baseMapper
.
getTSalaryStandardPageApply
(
page
,
tSalaryStandard
);
}
/**
* 标准薪酬工资表简单分页查询
*
...
...
@@ -132,10 +129,10 @@ public class TSalaryStandardServiceImpl extends ServiceImpl<TSalaryStandardMappe
response
.
setCharacterEncoding
(
"utf-8"
);
response
.
setHeader
(
CommonConstants
.
CONTENT_DISPOSITION
,
CommonConstants
.
ATTACHMENT_FILENAME
+
URLEncoder
.
encode
(
fileName
,
"UTF-8"
));
// 这里 需要指定写用哪个class去写,然后写到第一个sheet,然后文件流会自动关闭
ExcelWriter
excelWriter
=
EasyExcel
.
write
(
out
,
TSalaryStandardExportVo
.
class
).
build
();
ExcelWriter
excelWriter
=
EasyExcel
Factory
.
write
(
out
,
TSalaryStandardExportVo
.
class
).
build
();
int
index
=
0
;
if
(
count
>
CommonConstants
.
ZERO_INT
)
{
for
(
int
i
=
0
;
i
<=
count
;
)
{
for
(
int
i
=
0
;
i
<=
count
;
i
+=
CommonConstants
.
EXCEL_EXPORT_LIMIT
)
{
// 获取实际记录
searchVo
.
setLimitStart
(
i
);
searchVo
.
setLimitEnd
(
CommonConstants
.
EXCEL_EXPORT_LIMIT
);
...
...
@@ -147,17 +144,16 @@ public class TSalaryStandardServiceImpl extends ServiceImpl<TSalaryStandardMappe
}
}
if
(
Common
.
isNotNull
(
list
))
{
WriteSheet
writeSheet
=
EasyExcel
.
writerSheet
(
"项目薪酬表"
+
index
).
build
();
WriteSheet
writeSheet
=
EasyExcel
Factory
.
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
();
WriteSheet
writeSheet
=
EasyExcel
Factory
.
writerSheet
(
"项目薪酬表"
+
index
).
build
();
excelWriter
.
write
(
list
,
writeSheet
);
}
if
(
Common
.
isNotNull
(
list
))
{
...
...
@@ -180,91 +176,11 @@ public class TSalaryStandardServiceImpl extends ServiceImpl<TSalaryStandardMappe
@Override
public
List
<
TSalaryStandardExportVo
>
noPageDiy
(
TSalaryStandardSearchVo
searchVo
)
{
return
baseMapper
.
getSalaryStandardExport
(
searchVo
,
Common
.
getList
(
searchVo
.
getIds
()));
return
baseMapper
.
getSalaryStandardExport
(
searchVo
,
Common
.
getList
(
searchVo
.
getIds
()));
}
private
int
noPageCountDiy
(
TSalaryStandardSearchVo
searchVo
)
{
return
baseMapper
.
getSalaryStandardExportCount
(
searchVo
,
Common
.
getList
(
searchVo
.
getIds
()));
}
@Override
public
R
<
List
<
ErrorMessage
>>
importDiy
(
InputStream
inputStream
)
{
List
<
ErrorMessage
>
errorMessageList
=
new
ArrayList
<>();
ExcelUtil
<
TSalaryStandardVo
>
util1
=
new
ExcelUtil
<>(
TSalaryStandardVo
.
class
);
// 写法2:
// 匿名内部类 不用额外写一个DemoDataListener
// 这里 需要指定读用哪个class去读,然后读取第一个sheet 文件流会自动关闭
try
{
EasyExcel
.
read
(
inputStream
,
TSalaryStandardVo
.
class
,
new
ReadListener
<
TSalaryStandardVo
>()
{
/**
* 单次缓存的数据量
*/
public
static
final
int
BATCH_COUNT
=
CommonConstants
.
BATCH_COUNT
;
/**
*临时存储
*/
private
List
<
TSalaryStandardVo
>
cachedDataList
=
ListUtils
.
newArrayListWithExpectedSize
(
BATCH_COUNT
);
@Override
public
void
invoke
(
TSalaryStandardVo
data
,
AnalysisContext
context
)
{
ReadRowHolder
readRowHolder
=
context
.
readRowHolder
();
Integer
rowIndex
=
readRowHolder
.
getRowIndex
();
data
.
setRowIndex
(
rowIndex
+
1
);
ErrorMessage
errorMessage
=
util1
.
checkEntity
(
data
,
data
.
getRowIndex
());
if
(
Common
.
isNotNull
(
errorMessage
))
{
errorMessageList
.
add
(
errorMessage
);
}
else
{
cachedDataList
.
add
(
data
);
}
if
(
cachedDataList
.
size
()
>=
BATCH_COUNT
)
{
saveData
();
// 存储完成清理 list
cachedDataList
=
ListUtils
.
newArrayListWithExpectedSize
(
BATCH_COUNT
);
}
}
@Override
public
void
doAfterAllAnalysed
(
AnalysisContext
context
)
{
saveData
();
}
/**
* 加上存储数据库
*/
private
void
saveData
()
{
log
.
info
(
"{}条数据,开始存储数据库!"
,
cachedDataList
.
size
());
importTSalaryStandard
(
cachedDataList
,
errorMessageList
);
log
.
info
(
"存储数据库成功!"
);
}
}).
sheet
().
doRead
();
}
catch
(
Exception
e
)
{
log
.
error
(
CommonConstants
.
IMPORT_DATA_ANALYSIS_ERROR
,
e
);
return
R
.
failed
(
CommonConstants
.
IMPORT_DATA_ANALYSIS_ERROR
);
}
return
R
.
ok
(
errorMessageList
);
}
private
void
importTSalaryStandard
(
List
<
TSalaryStandardVo
>
excelVOList
,
List
<
ErrorMessage
>
errorMessageList
)
{
// 个性化校验逻辑
ErrorMessage
errorMsg
;
// 执行数据插入操作 组装
for
(
int
i
=
0
;
i
<
excelVOList
.
size
();
i
++)
{
TSalaryStandardVo
excel
=
excelVOList
.
get
(
i
);
// 数据合法情况 TODO
// 插入
insertExcel
(
excel
);
errorMessageList
.
add
(
new
ErrorMessage
(
excel
.
getRowIndex
(),
CommonConstants
.
SAVE_SUCCESS
));
}
}
/**
* 插入excel bad record
*/
private
void
insertExcel
(
TSalaryStandardVo
excel
)
{
TSalaryStandard
insert
=
new
TSalaryStandard
();
BeanUtil
.
copyProperties
(
excel
,
insert
);
this
.
save
(
insert
);
return
baseMapper
.
getSalaryStandardExportCount
(
searchVo
,
Common
.
getList
(
searchVo
.
getIds
()));
}
@Override
...
...
@@ -273,7 +189,7 @@ public class TSalaryStandardServiceImpl extends ServiceImpl<TSalaryStandardMappe
}
@Override
public
R
salaryStandardAudit
(
String
auditFlag
,
String
auditRemark
,
String
id
)
{
public
R
<
String
>
salaryStandardAudit
(
String
auditFlag
,
String
auditRemark
,
String
id
)
{
YifuUser
user
=
SecurityUtils
.
getUser
();
TSalaryStandard
tSalaryStandard
=
baseMapper
.
selectById
(
id
);
if
(
Common
.
isNotNull
(
tSalaryStandard
))
{
...
...
@@ -320,7 +236,6 @@ public class TSalaryStandardServiceImpl extends ServiceImpl<TSalaryStandardMappe
}
else
{
return
R
.
failed
(
"删除失败:未找到工资表!"
);
}
String
deptId
=
sf
.
getDeptId
();
YifuUser
user
=
SecurityUtils
.
getUser
();
if
(
null
==
user
||
null
==
user
.
getId
())
{
return
R
.
failed
(
"删除工资表失败-获取登录人信息为空"
);
...
...
yifu-social/yifu-social-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/social/service/impl/TIncomeServiceImpl.java
View file @
d89b1d67
...
...
@@ -274,6 +274,12 @@ public class TIncomeServiceImpl extends ServiceImpl<TIncomeMapper, TIncome> impl
return
this
.
save
(
income
);
}
/**
* @Description: 明细转统计核心逻辑
* @Author: hgw
* @Date: 2022/9/2 10:22
* @return: boolean
**/
private
boolean
copyCore
(
TIncomeDetail
tIncomeDetail
,
List
<
TIncome
>
incomeList
,
List
<
TIncomeDetail
>
detailList
)
{
// 判断,比例,直接加
if
(
CommonConstants
.
ONE_STRING
.
equals
(
tIncomeDetail
.
getFeeMode
()))
{
...
...
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