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
61b03b67
Commit
61b03b67
authored
Sep 06, 2022
by
zhaji
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop' into feature-zhaji
parents
60324717
7214fabe
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
225 additions
and
156 deletions
+225
-156
TSalaryStandardServiceImpl.java
.../yifu/salary/service/impl/TSalaryStandardServiceImpl.java
+101
-114
TIncomeDetail.java
.../yifu/cloud/plus/v1/yifu/social/entity/TIncomeDetail.java
+5
-0
TIncomeServiceImpl.java
.../plus/v1/yifu/social/service/impl/TIncomeServiceImpl.java
+113
-42
TIncomeDetailMapper.xml
...ial-biz/src/main/resources/mapper/TIncomeDetailMapper.xml
+6
-0
No files found.
yifu-salary/yifu-salary-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/salary/service/impl/TSalaryStandardServiceImpl.java
View file @
61b03b67
...
...
@@ -248,94 +248,42 @@ public class TSalaryStandardServiceImpl extends ServiceImpl<TSalaryStandardMappe
}
else
{
return
R
.
failed
(
"获取项目信息失败,请联管理员!"
);
}
// 含有薪资,则计算收入
if
(
Common
.
isNotNull
(
dept
.
getManageServerItem
())
&&
dept
.
getManageServerItem
().
contains
(
CommonConstants
.
FOUR_STRING
))
{
List
<
TSalaryAccount
>
salaryAccountList
=
salaryAccountService
.
getListByIncome
(
id
);
if
(
salaryAccountList
!=
null
&&
!
salaryAccountList
.
isEmpty
())
{
List
<
String
>
idCardList
=
new
ArrayList
<>();
for
(
TSalaryAccount
account
:
salaryAccountList
)
{
idCardList
.
add
(
account
.
getEmpIdcard
());
}
Map
<
String
,
Integer
>
detailMap
=
new
HashMap
<>();
// 收入相关
R
<
String
>
failed1
=
getIncomeDetailMap
(
tSalaryStandard
,
dept
,
idCardList
,
detailMap
);
if
(
failed1
!=
null
)
return
failed1
;
// 含有薪资,则计算收入
// 管理费
if
(
CommonConstants
.
ZERO_STRING
.
equals
(
dept
.
getManagementTag
()))
{
if
(
Common
.
isNotNull
(
dept
.
getManageServerItem
())
&&
dept
.
getManageServerItem
().
contains
(
CommonConstants
.
FOUR_STRING
)
&&
CommonConstants
.
ZERO_STRING
.
equals
(
dept
.
getManagementTag
()))
{
// 金额-人数
if
(
CommonConstants
.
TWO_STRING
.
equals
(
dept
.
getManagementType
()))
{
// 收入相关
TIncomeDetail
detail
=
new
TIncomeDetail
();
detail
.
setPayMonth
(
tSalaryStandard
.
getSalaryMonth
());
R
<
TIncomeDetailReturnVo
>
detailR
=
HttpDaprUtil
.
invokeMethodPost
(
socialProperties
.
getAppUrl
(),
socialProperties
.
getAppId
()
,
"/tincomedetail/inner/getTIncomeDetailList"
,
detail
,
TIncomeDetailReturnVo
.
class
,
SecurityConstants
.
FROM_IN
);
Map
<
String
,
Integer
>
detailMap
=
new
HashMap
<>();
Integer
value
;
if
(
detailR
!=
null
)
{
if
(
detailR
.
getData
()
!=
null
&&
detailR
.
getData
().
getDetailList
()
!=
null
&&
!
detailR
.
getData
().
getDetailList
().
isEmpty
())
{
TIncomeDetailReturnVo
vo
=
detailR
.
getData
();
List
<
TIncomeDetail
>
detailList
=
vo
.
getDetailList
();
for
(
TIncomeDetail
incomeDetail
:
detailList
)
{
value
=
detailMap
.
get
(
incomeDetail
.
getEmpIdcard
()
+
CommonConstants
.
DOWN_LINE_STRING
+
incomeDetail
.
getFeeType
()
+
CommonConstants
.
DOWN_LINE_STRING
+
incomeDetail
.
getSourceType
());
if
(
Common
.
isEmpty
(
value
))
{
value
=
CommonConstants
.
ZERO_INT
;
}
if
(
CommonConstants
.
ZERO_STRING
.
equals
(
incomeDetail
.
getRedData
()))
{
value
++;
}
else
{
value
--;
}
detailMap
.
put
(
incomeDetail
.
getEmpIdcard
()
+
CommonConstants
.
DOWN_LINE_STRING
+
incomeDetail
.
getFeeType
()
+
CommonConstants
.
DOWN_LINE_STRING
+
incomeDetail
.
getSourceType
(),
value
);
}
}
}
else
{
return
R
.
failed
(
"获取收入明细的详情出错,请联系管理员!"
);
}
// 保存明细
R
<
String
>
failed
=
saveIncomeDetail
(
id
,
tSalaryStandard
,
dept
,
detailMap
,
dept
.
getManagementType
(),
CommonConstants
.
ONE_STRING
);
R
<
String
>
failed
=
saveIncomeDetail
(
salaryAccountList
,
tSalaryStandard
,
dept
,
detailMap
,
dept
.
getManagementType
(),
CommonConstants
.
ONE_STRING
);
if
(
failed
!=
null
)
return
failed
;
}
else
{
// 保存明细
R
<
String
>
failed
=
saveIncomeDetail
(
id
,
tSalaryStandard
,
dept
,
new
HashMap
<>(),
dept
.
getManagementType
(),
CommonConstants
.
ONE_STRING
);
R
<
String
>
failed
=
saveIncomeDetail
(
salaryAccountList
,
tSalaryStandard
,
dept
,
new
HashMap
<>(),
dept
.
getManagementType
(),
CommonConstants
.
ONE_STRING
);
if
(
failed
!=
null
)
return
failed
;
}
}
}
if
(
Common
.
isNotNull
(
dept
.
getRiskServerItem
())
&&
dept
.
getRiskServerItem
().
contains
(
CommonConstants
.
FOUR_STRING
))
{
// 风险金
if
(
CommonConstants
.
ZERO_STRING
.
equals
(
dept
.
getRiskFundTag
()))
{
if
(
Common
.
isNotNull
(
dept
.
getRiskServerItem
())
&&
dept
.
getRiskServerItem
().
contains
(
CommonConstants
.
FOUR_STRING
)
&&
CommonConstants
.
ZERO_STRING
.
equals
(
dept
.
getRiskFundTag
()))
{
// 金额-人数
if
(
CommonConstants
.
TWO_STRING
.
equals
(
dept
.
getRiskFundType
()))
{
// 收入相关
TIncomeDetail
detail
=
new
TIncomeDetail
();
detail
.
setPayMonth
(
tSalaryStandard
.
getSalaryMonth
());
R
<
TIncomeDetailReturnVo
>
detailR
=
HttpDaprUtil
.
invokeMethodPost
(
socialProperties
.
getAppUrl
(),
socialProperties
.
getAppId
()
,
"/tincomedetail/inner/getTIncomeDetailList"
,
detail
,
TIncomeDetailReturnVo
.
class
,
SecurityConstants
.
FROM_IN
);
Map
<
String
,
Integer
>
detailMap
=
new
HashMap
<>();
Integer
value
;
if
(
detailR
!=
null
)
{
if
(
detailR
.
getData
()
!=
null
&&
detailR
.
getData
().
getDetailList
()
!=
null
&&
!
detailR
.
getData
().
getDetailList
().
isEmpty
())
{
TIncomeDetailReturnVo
vo
=
detailR
.
getData
();
List
<
TIncomeDetail
>
detailList
=
vo
.
getDetailList
();
for
(
TIncomeDetail
incomeDetail
:
detailList
)
{
value
=
detailMap
.
get
(
incomeDetail
.
getEmpIdcard
()
+
CommonConstants
.
DOWN_LINE_STRING
+
incomeDetail
.
getDeptId
()
+
CommonConstants
.
DOWN_LINE_STRING
+
incomeDetail
.
getFeeType
());
if
(
Common
.
isEmpty
(
value
))
{
value
=
CommonConstants
.
ZERO_INT
;
}
if
(
CommonConstants
.
ZERO_STRING
.
equals
(
incomeDetail
.
getRedData
()))
{
value
++;
}
else
{
value
--;
}
detailMap
.
put
(
incomeDetail
.
getEmpIdcard
()
+
CommonConstants
.
DOWN_LINE_STRING
+
incomeDetail
.
getDeptId
()
+
CommonConstants
.
DOWN_LINE_STRING
+
incomeDetail
.
getFeeType
(),
value
);
}
}
}
else
{
return
R
.
failed
(
"获取收入明细的详情出错,请联系管理员!"
);
}
// 保存明细
R
<
String
>
failed
=
saveIncomeDetail
(
id
,
tSalaryStandard
,
dept
,
detailMap
,
dept
.
getRiskFundType
(),
CommonConstants
.
TWO_STRING
);
R
<
String
>
failed
=
saveIncomeDetail
(
salaryAccountList
,
tSalaryStandard
,
dept
,
detailMap
,
dept
.
getRiskFundType
(),
CommonConstants
.
TWO_STRING
);
if
(
failed
!=
null
)
return
failed
;
}
else
{
// 保存明细
R
<
String
>
failed
=
saveIncomeDetail
(
id
,
tSalaryStandard
,
dept
,
new
HashMap
<>(),
dept
.
getRiskFundType
(),
CommonConstants
.
TWO_STRING
);
R
<
String
>
failed
=
saveIncomeDetail
(
salaryAccountList
,
tSalaryStandard
,
dept
,
new
HashMap
<>(),
dept
.
getRiskFundType
(),
CommonConstants
.
TWO_STRING
);
if
(
failed
!=
null
)
return
failed
;
}
}
...
...
@@ -343,6 +291,47 @@ public class TSalaryStandardServiceImpl extends ServiceImpl<TSalaryStandardMappe
return
null
;
}
/**
* @Description: 获取收入信息
* @Author: hgw
* @Date: 2022/9/6 10:39
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.lang.String>
**/
private
R
<
String
>
getIncomeDetailMap
(
TSalaryStandard
tSalaryStandard
,
TSettleDomainSelectVo
dept
,
List
<
String
>
idCardList
,
Map
<
String
,
Integer
>
detailMap
)
{
TIncomeDetail
detail
=
new
TIncomeDetail
();
detail
.
setPayMonth
(
tSalaryStandard
.
getSalaryMonth
());
detail
.
setIdCardList
(
idCardList
);
detail
.
setDeptId
(
dept
.
getId
());
R
<
TIncomeDetailReturnVo
>
detailR
=
HttpDaprUtil
.
invokeMethodPost
(
socialProperties
.
getAppUrl
(),
socialProperties
.
getAppId
()
,
"/tincomedetail/inner/getTIncomeDetailList"
,
detail
,
TIncomeDetailReturnVo
.
class
,
SecurityConstants
.
FROM_IN
);
Integer
value
;
if
(
detailR
!=
null
)
{
if
(
detailR
.
getData
()
!=
null
&&
detailR
.
getData
().
getDetailList
()
!=
null
&&
!
detailR
.
getData
().
getDetailList
().
isEmpty
())
{
TIncomeDetailReturnVo
vo
=
detailR
.
getData
();
List
<
TIncomeDetail
>
detailList
=
vo
.
getDetailList
();
for
(
TIncomeDetail
incomeDetail
:
detailList
)
{
value
=
detailMap
.
get
(
incomeDetail
.
getEmpIdcard
()
+
CommonConstants
.
DOWN_LINE_STRING
+
incomeDetail
.
getFeeType
()
+
CommonConstants
.
DOWN_LINE_STRING
+
incomeDetail
.
getSourceType
());
if
(
Common
.
isEmpty
(
value
))
{
value
=
CommonConstants
.
ZERO_INT
;
}
if
(
CommonConstants
.
ZERO_STRING
.
equals
(
incomeDetail
.
getRedData
()))
{
value
++;
}
else
{
value
--;
}
detailMap
.
put
(
incomeDetail
.
getEmpIdcard
()
+
CommonConstants
.
DOWN_LINE_STRING
+
incomeDetail
.
getFeeType
()
+
CommonConstants
.
DOWN_LINE_STRING
+
incomeDetail
.
getSourceType
(),
value
);
}
}
}
else
{
return
R
.
failed
(
"获取收入明细的详情出错,请联系管理员!"
);
}
return
null
;
}
/**
* @param feeType 1按比例2金额-人数3金额-人次
* @param isManage 1 管理费2 风险金
...
...
@@ -351,51 +340,49 @@ public class TSalaryStandardServiceImpl extends ServiceImpl<TSalaryStandardMappe
* @Date: 2022/9/2 17:25
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.lang.String>
**/
private
R
<
String
>
saveIncomeDetail
(
String
id
,
TSalaryStandard
tSalaryStandard
,
TSettleDomainSelectVo
dept
,
Map
<
String
,
Integer
>
detailMap
,
String
feeType
,
String
isManage
)
{
private
R
<
String
>
saveIncomeDetail
(
List
<
TSalaryAccount
>
salaryAccountList
,
TSalaryStandard
tSalaryStandard
,
TSettleDomainSelectVo
dept
,
Map
<
String
,
Integer
>
detailMap
,
String
feeType
,
String
isManage
)
{
TIncomeDetail
detail
;
Integer
value
;
List
<
TSalaryAccount
>
salaryAccountList
=
salaryAccountService
.
getListByIncome
(
id
);
if
(
salaryAccountList
!=
null
&&
!
salaryAccountList
.
isEmpty
())
{
BigDecimal
money
;
for
(
TSalaryAccount
account
:
salaryAccountList
)
{
value
=
detailMap
.
get
(
account
.
getEmpIdcard
()
+
CommonConstants
.
DOWN_LINE_STRING
+
account
.
getDeptId
()
+
CommonConstants
.
DOWN_LINE_STRING
+
isManage
+
CommonConstants
.
DOWN_LINE_STRING
+
CommonConstants
.
FOUR_STRING
);
if
(
Common
.
isEmpty
(
value
)
||
value
==
0
)
{
detail
=
new
TIncomeDetail
();
detail
.
setPayMonth
(
account
.
getSalaryMonth
());
detail
.
setDeptId
(
account
.
getDeptId
());
detail
.
setDeptName
(
account
.
getDeptName
());
detail
.
setDeptNo
(
account
.
getDeptNo
());
detail
.
setUnitId
(
tSalaryStandard
.
getUnitId
());
detail
.
setUnitName
(
tSalaryStandard
.
getUnitName
());
detail
.
setUnitNo
(
tSalaryStandard
.
getUnitNo
());
detail
.
setCreateMonth
(
account
.
getSalaryMonth
());
detail
.
setEmpIdcard
(
account
.
getEmpIdcard
());
detail
.
setEmpName
(
account
.
getEmpName
());
detail
.
setFeeMode
(
dept
.
getManagementType
());
detail
.
setFeeType
(
isManage
);
detail
.
setCharges
(
String
.
valueOf
(
dept
.
getManagementFee
()));
money
=
dept
.
getManagementFee
();
if
(
CommonConstants
.
TWO_STRING
.
equals
(
isManage
))
{
money
=
dept
.
getRiskFundFee
();
detail
.
setCharges
(
String
.
valueOf
(
dept
.
getRiskFundFee
()));
}
if
(
CommonConstants
.
ONE_STRING
.
equals
(
feeType
))
{
money
=
BigDecimalUtils
.
safeMultiply
(
account
.
getRelaySalary
(),
money
,
CommonConstants
.
ONE_OF_PERCENT
);
}
detail
.
setMoney
(
money
);
detail
.
setMrSettleType
(
dept
.
getMrSettleType
());
detail
.
setRedData
(
CommonConstants
.
ZERO_STRING
);
detail
.
setSourceId
(
account
.
getId
());
detail
.
setSourceType
(
CommonConstants
.
FOUR_STRING
);
R
<
Boolean
>
saveR
=
HttpDaprUtil
.
invokeMethodPost
(
socialProperties
.
getAppUrl
(),
socialProperties
.
getAppId
()
,
"/tincome/inner/saveDetail"
,
detail
,
Boolean
.
class
,
SecurityConstants
.
FROM_IN
);
if
(
saveR
==
null
||
saveR
.
getCode
()
==
CommonConstants
.
ONE_INT
||
Boolean
.
FALSE
.
equals
(
saveR
.
getData
()))
{
return
R
.
failed
(
"保存收入明细以及统计出错!"
);
}
BigDecimal
money
;
for
(
TSalaryAccount
account
:
salaryAccountList
)
{
value
=
detailMap
.
get
(
account
.
getEmpIdcard
()
+
CommonConstants
.
DOWN_LINE_STRING
+
account
.
getDeptId
()
+
CommonConstants
.
DOWN_LINE_STRING
+
isManage
+
CommonConstants
.
DOWN_LINE_STRING
+
CommonConstants
.
FOUR_STRING
);
if
(
Common
.
isEmpty
(
value
)
||
value
==
0
)
{
detail
=
new
TIncomeDetail
();
detail
.
setPayMonth
(
account
.
getSalaryMonth
());
detail
.
setDeptId
(
account
.
getDeptId
());
detail
.
setDeptName
(
account
.
getDeptName
());
detail
.
setDeptNo
(
account
.
getDeptNo
());
detail
.
setUnitId
(
tSalaryStandard
.
getUnitId
());
detail
.
setUnitName
(
tSalaryStandard
.
getUnitName
());
detail
.
setUnitNo
(
tSalaryStandard
.
getUnitNo
());
detail
.
setCreateMonth
(
account
.
getSalaryMonth
());
detail
.
setEmpIdcard
(
account
.
getEmpIdcard
());
detail
.
setEmpName
(
account
.
getEmpName
());
detail
.
setFeeMode
(
dept
.
getManagementType
());
detail
.
setFeeType
(
isManage
);
detail
.
setCharges
(
String
.
valueOf
(
dept
.
getManagementFee
()));
money
=
dept
.
getManagementFee
();
if
(
CommonConstants
.
TWO_STRING
.
equals
(
isManage
))
{
money
=
dept
.
getRiskFundFee
();
detail
.
setCharges
(
String
.
valueOf
(
dept
.
getRiskFundFee
()));
detail
.
setFeeMode
(
dept
.
getRiskFundType
());
}
if
(
CommonConstants
.
ONE_STRING
.
equals
(
feeType
))
{
money
=
BigDecimalUtils
.
safeMultiply
(
account
.
getRelaySalary
(),
money
,
CommonConstants
.
ONE_OF_PERCENT
);
}
detail
.
setMoney
(
money
);
detail
.
setMrSettleType
(
dept
.
getMrSettleType
());
detail
.
setRedData
(
CommonConstants
.
ZERO_STRING
);
detail
.
setSourceId
(
account
.
getId
());
detail
.
setSourceType
(
CommonConstants
.
FOUR_STRING
);
R
<
Boolean
>
saveR
=
HttpDaprUtil
.
invokeMethodPost
(
socialProperties
.
getAppUrl
(),
socialProperties
.
getAppId
()
,
"/tincome/inner/saveDetail"
,
detail
,
Boolean
.
class
,
SecurityConstants
.
FROM_IN
);
if
(
saveR
==
null
||
saveR
.
getCode
()
==
CommonConstants
.
ONE_INT
||
Boolean
.
FALSE
.
equals
(
saveR
.
getData
()))
{
return
R
.
failed
(
"保存收入明细以及统计出错!"
);
}
}
}
...
...
yifu-social/yifu-social-api/src/main/java/com/yifu/cloud/plus/v1/yifu/social/entity/TIncomeDetail.java
View file @
61b03b67
...
...
@@ -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.fasterxml.jackson.annotation.JsonFormat
;
...
...
@@ -30,6 +31,7 @@ import org.hibernate.validator.constraints.Length;
import
javax.validation.constraints.NotBlank
;
import
java.math.BigDecimal
;
import
java.util.Date
;
import
java.util.List
;
/**
* 收入明细表-全部明细
...
...
@@ -194,4 +196,7 @@ public class TIncomeDetail {
@ExcelProperty
(
"管理费风险金的结算方式:1预估2实缴"
)
private
String
mrSettleType
;
// 查询时框定范围使用
@TableField
(
exist
=
false
)
private
List
<
String
>
idCardList
;
}
yifu-social/yifu-social-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/social/service/impl/TIncomeServiceImpl.java
View file @
61b03b67
...
...
@@ -17,7 +17,7 @@
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
social
.
service
.
impl
;
import
cn.hutool.core.bean.BeanUtil
;
import
com.alibaba.excel.EasyExcel
;
import
com.alibaba.excel.EasyExcel
Factory
;
import
com.alibaba.excel.ExcelWriter
;
import
com.alibaba.excel.context.AnalysisContext
;
import
com.alibaba.excel.read.listener.ReadListener
;
...
...
@@ -32,7 +32,6 @@ import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.*
;
import
com.yifu.cloud.plus.v1.yifu.ekp.util.EkpIncomeUtil
;
import
com.yifu.cloud.plus.v1.yifu.ekp.vo.EkpIncomeParam
;
import
com.yifu.cloud.plus.v1.yifu.social.entity.TAgentConfig
;
import
com.yifu.cloud.plus.v1.yifu.social.entity.TIncome
;
import
com.yifu.cloud.plus.v1.yifu.social.entity.TIncomeDetail
;
import
com.yifu.cloud.plus.v1.yifu.social.mapper.TIncomeMapper
;
...
...
@@ -97,10 +96,10 @@ public class TIncomeServiceImpl extends ServiceImpl<TIncomeMapper, TIncome> impl
response
.
setCharacterEncoding
(
CommonConstants
.
UTF8
);
response
.
setHeader
(
CommonConstants
.
CONTENT_DISPOSITION
,
CommonConstants
.
ATTACHMENT_FILENAME
+
URLEncoder
.
encode
(
fileName
,
CommonConstants
.
UTF8
));
// 这里 需要指定写用哪个class去写,然后写到第一个sheet,然后文件流会自动关闭
ExcelWriter
excelWriter
=
EasyExcel
.
write
(
out
,
IncomeExportVo
.
class
).
build
();
ExcelWriter
excelWriter
=
EasyExcel
Factory
.
write
(
out
,
IncomeExportVo
.
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
);
...
...
@@ -112,17 +111,16 @@ public class TIncomeServiceImpl extends ServiceImpl<TIncomeMapper, TIncome> impl
}
}
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
))
{
...
...
@@ -165,7 +163,7 @@ public class TIncomeServiceImpl extends ServiceImpl<TIncomeMapper, TIncome> impl
// 匿名内部类 不用额外写一个DemoDataListener
// 这里 需要指定读用哪个class去读,然后读取第一个sheet 文件流会自动关闭
try
{
EasyExcel
.
read
(
inputStream
,
TIncomeVo
.
class
,
new
ReadListener
<
TIncomeVo
>()
{
EasyExcel
Factory
.
read
(
inputStream
,
TIncomeVo
.
class
,
new
ReadListener
<
TIncomeVo
>()
{
/**
* 单次缓存的数据量
*/
...
...
@@ -219,8 +217,6 @@ public class TIncomeServiceImpl extends ServiceImpl<TIncomeMapper, TIncome> impl
// 执行数据插入操作 组装
for
(
int
i
=
0
;
i
<
excelVOList
.
size
();
i
++)
{
TIncomeVo
excel
=
excelVOList
.
get
(
i
);
// 数据合法情况 TODO
// 插入
insertExcel
(
excel
);
errorMessageList
.
add
(
new
ErrorMessage
(
excel
.
getRowIndex
(),
CommonConstants
.
SAVE_SUCCESS
));
...
...
@@ -249,10 +245,6 @@ public class TIncomeServiceImpl extends ServiceImpl<TIncomeMapper, TIncome> impl
||
Common
.
isEmpty
(
tIncomeDetail
.
getPayMonth
()))
{
return
false
;
}
tIncomeDetail
.
setCreateTime
(
new
Date
());
tIncomeDetail
.
setDataCreateMonth
(
DateUtil
.
addMonth
(
0
));
tIncomeDetailService
.
save
(
tIncomeDetail
);
// 获取对应信息的统计表,根据项目配置,判断是否可以加一条统计:
TIncome
income
=
new
TIncome
();
income
.
setEmpIdcard
(
tIncomeDetail
.
getEmpIdcard
());
...
...
@@ -263,6 +255,10 @@ public class TIncomeServiceImpl extends ServiceImpl<TIncomeMapper, TIncome> impl
detail
.
setEmpIdcard
(
tIncomeDetail
.
getEmpIdcard
());
detail
.
setDeptId
(
tIncomeDetail
.
getDeptId
());
List
<
TIncomeDetail
>
detailList
=
tIncomeDetailService
.
getTIncomeDetailList
(
detail
);
tIncomeDetail
.
setCreateTime
(
new
Date
());
tIncomeDetail
.
setDataCreateMonth
(
DateUtil
.
addMonth
(
0
));
tIncomeDetailService
.
save
(
tIncomeDetail
);
// 不存在,直接新增
if
(
incomeList
==
null
||
incomeList
.
isEmpty
())
{
return
this
.
saveIncome
(
tIncomeDetail
);
...
...
@@ -393,46 +389,94 @@ public class TIncomeServiceImpl extends ServiceImpl<TIncomeMapper, TIncome> impl
// 商险Map
Map
<
String
,
Integer
>
insureMap
=
new
HashMap
<>();
Integer
nums
;
Integer
insureNums
;
for
(
TIncomeDetail
detail
:
detailList
)
{
nums
=
numMap
.
get
(
detail
.
getPayMonth
()
+
CommonConstants
.
DOWN_LINE_STRING
+
detail
.
getSourceType
()
+
CommonConstants
.
DOWN_LINE_STRING
+
detail
.
getFeeType
()
+
CommonConstants
.
DOWN_LINE_STRING
+
detail
.
getRedData
());
+
CommonConstants
.
DOWN_LINE_STRING
+
detail
.
getFeeType
());
if
(
Common
.
isEmpty
(
nums
))
{
nums
=
CommonConstants
.
ONE_INT
;
nums
=
CommonConstants
.
ZERO_INT
;
}
if
(
CommonConstants
.
ONE_STRING
.
equals
(
detail
.
getRedData
()))
{
nums
--;
}
else
{
nums
++;
}
numMap
.
put
(
detail
.
getPayMonth
()
+
CommonConstants
.
DOWN_LINE_STRING
+
detail
.
getSourceType
()
+
CommonConstants
.
DOWN_LINE_STRING
+
detail
.
getFeeType
()
+
CommonConstants
.
DOWN_LINE_STRING
+
detail
.
getRedData
(),
nums
);
+
CommonConstants
.
DOWN_LINE_STRING
+
detail
.
getFeeType
(),
nums
);
}
for
(
TIncome
income
:
incomeList
)
{
nums
=
incomeMap
.
get
(
income
.
getPayMonth
()
+
CommonConstants
.
DOWN_LINE_STRING
+
income
.
getFeeType
()
+
CommonConstants
.
DOWN_LINE_STRING
+
income
.
getRedData
());
nums
=
incomeMap
.
get
(
income
.
getPayMonth
()
+
CommonConstants
.
DOWN_LINE_STRING
+
income
.
getFeeType
());
if
(
Common
.
isEmpty
(
nums
))
{
nums
=
CommonConstants
.
ONE_INT
;
nums
=
CommonConstants
.
ZERO_INT
;
}
if
(
CommonConstants
.
ONE_STRING
.
equals
(
income
.
getRedData
()))
{
nums
--;
}
else
{
nums
++;
}
incomeMap
.
put
(
income
.
getPayMonth
()
+
CommonConstants
.
DOWN_LINE_STRING
+
income
.
getFeeType
()
+
CommonConstants
.
DOWN_LINE_STRING
+
income
.
getRedData
(),
nums
);
insureMap
.
put
(
income
.
getDataCreateMonth
()
+
CommonConstants
.
DOWN_LINE_STRING
+
income
.
getFeeType
()
+
CommonConstants
.
DOWN_LINE_STRING
+
income
.
getRedData
(),
CommonConstants
.
ZERO_INT
);
incomeMap
.
put
(
income
.
getPayMonth
()
+
CommonConstants
.
DOWN_LINE_STRING
+
income
.
getFeeType
(),
nums
);
insureNums
=
insureMap
.
get
(
income
.
getDataCreateMonth
()
+
CommonConstants
.
DOWN_LINE_STRING
+
income
.
getFeeType
());
if
(
Common
.
isEmpty
(
insureNums
))
{
insureNums
=
CommonConstants
.
ZERO_INT
;
}
if
(
CommonConstants
.
ONE_STRING
.
equals
(
income
.
getRedData
()))
{
insureNums
--;
}
else
{
insureNums
++;
}
insureMap
.
put
(
income
.
getDataCreateMonth
()
+
CommonConstants
.
DOWN_LINE_STRING
+
income
.
getFeeType
(),
insureNums
);
}
// 金额人数、人次,需要判重
// 社保、公积金(收入来源:1社保2公积金3商险4薪资)
if
(
CommonConstants
.
ONE_STRING
.
equals
(
tIncomeDetail
.
getSourceType
())
||
CommonConstants
.
TWO_STRING
.
equals
(
tIncomeDetail
.
getSourceType
()))
{
if
(
incomeMap
.
get
(
tIncomeDetail
.
getPayMonth
()
+
CommonConstants
.
DOWN_LINE_STRING
+
tIncomeDetail
.
getFeeType
()
+
CommonConstants
.
DOWN_LINE_STRING
+
tIncomeDetail
.
getRedData
())
==
null
)
{
return
this
.
saveIncome
(
tIncomeDetail
);
if
(
CommonConstants
.
ZERO_STRING
.
equals
(
tIncomeDetail
.
getRedData
()))
{
if
(
incomeMap
.
get
(
tIncomeDetail
.
getPayMonth
()
+
CommonConstants
.
DOWN_LINE_STRING
+
tIncomeDetail
.
getFeeType
())
==
null
||
incomeMap
.
get
(
tIncomeDetail
.
getPayMonth
()
+
CommonConstants
.
DOWN_LINE_STRING
+
tIncomeDetail
.
getFeeType
())
<=
CommonConstants
.
ZERO_INT
)
{
return
this
.
saveIncome
(
tIncomeDetail
);
}
}
else
{
Integer
myNum
=
numMap
.
get
(
tIncomeDetail
.
getPayMonth
()
+
CommonConstants
.
DOWN_LINE_STRING
+
tIncomeDetail
.
getSourceType
()
+
CommonConstants
.
DOWN_LINE_STRING
+
tIncomeDetail
.
getFeeType
());
Integer
socialNum
=
numMap
.
get
(
tIncomeDetail
.
getPayMonth
()
+
CommonConstants
.
DOWN_LINE_STRING
+
CommonConstants
.
ONE_STRING
+
CommonConstants
.
DOWN_LINE_STRING
+
tIncomeDetail
.
getFeeType
());
Integer
fundNum
=
numMap
.
get
(
tIncomeDetail
.
getPayMonth
()
+
CommonConstants
.
DOWN_LINE_STRING
+
CommonConstants
.
TWO_STRING
+
CommonConstants
.
DOWN_LINE_STRING
+
tIncomeDetail
.
getFeeType
());
Integer
insureNum
=
numMap
.
get
(
tIncomeDetail
.
getPayMonth
()
+
CommonConstants
.
DOWN_LINE_STRING
+
CommonConstants
.
THREE_STRING
+
CommonConstants
.
DOWN_LINE_STRING
+
tIncomeDetail
.
getFeeType
());
Integer
salaryNum
=
numMap
.
get
(
tIncomeDetail
.
getPayMonth
()
+
CommonConstants
.
DOWN_LINE_STRING
+
CommonConstants
.
FOUR_STRING
+
CommonConstants
.
DOWN_LINE_STRING
+
tIncomeDetail
.
getFeeType
());
// 红冲判断:当本类型是最大值,才可以红冲
if
(
myNum
!=
null
&&
myNum
>
ifNullToZero
(
socialNum
)
&&
myNum
>
ifNullToZero
(
fundNum
)
&&
myNum
>
ifNullToZero
(
insureNum
)
&&
myNum
>
ifNullToZero
(
salaryNum
))
{
return
this
.
saveIncome
(
tIncomeDetail
);
}
}
}
else
if
(
CommonConstants
.
THREE_STRING
.
equals
(
tIncomeDetail
.
getSourceType
()))
{
// 商险。收费方式:2金额-人数
if
(
CommonConstants
.
TWO_STRING
.
equals
(
tIncomeDetail
.
getFeeMode
()))
{
if
(
insureMap
.
get
(
tIncomeDetail
.
getDataCreateMonth
()
+
CommonConstants
.
DOWN_LINE_STRING
+
tIncomeDetail
.
getFeeType
()
+
CommonConstants
.
DOWN_LINE_STRING
+
tIncomeDetail
.
getRedData
())
==
null
)
{
return
this
.
saveIncome
(
tIncomeDetail
);
if
(
CommonConstants
.
ZERO_STRING
.
equals
(
tIncomeDetail
.
getRedData
()))
{
if
(
insureMap
.
get
(
tIncomeDetail
.
getDataCreateMonth
()
+
CommonConstants
.
DOWN_LINE_STRING
+
tIncomeDetail
.
getFeeType
())
==
null
||
insureMap
.
get
(
tIncomeDetail
.
getDataCreateMonth
()
+
CommonConstants
.
DOWN_LINE_STRING
+
tIncomeDetail
.
getFeeType
())
<=
CommonConstants
.
ZERO_INT
)
{
return
this
.
saveIncome
(
tIncomeDetail
);
}
}
else
{
Integer
myNum
=
numMap
.
get
(
tIncomeDetail
.
getDataCreateMonth
()
+
CommonConstants
.
DOWN_LINE_STRING
+
tIncomeDetail
.
getSourceType
()
+
CommonConstants
.
DOWN_LINE_STRING
+
tIncomeDetail
.
getFeeType
());
Integer
socialNum
=
numMap
.
get
(
tIncomeDetail
.
getDataCreateMonth
()
+
CommonConstants
.
DOWN_LINE_STRING
+
CommonConstants
.
ONE_STRING
+
CommonConstants
.
DOWN_LINE_STRING
+
tIncomeDetail
.
getFeeType
());
Integer
fundNum
=
numMap
.
get
(
tIncomeDetail
.
getDataCreateMonth
()
+
CommonConstants
.
DOWN_LINE_STRING
+
CommonConstants
.
TWO_STRING
+
CommonConstants
.
DOWN_LINE_STRING
+
tIncomeDetail
.
getFeeType
());
Integer
insureNum
=
numMap
.
get
(
tIncomeDetail
.
getDataCreateMonth
()
+
CommonConstants
.
DOWN_LINE_STRING
+
CommonConstants
.
THREE_STRING
+
CommonConstants
.
DOWN_LINE_STRING
+
tIncomeDetail
.
getFeeType
());
Integer
salaryNum
=
numMap
.
get
(
tIncomeDetail
.
getDataCreateMonth
()
+
CommonConstants
.
DOWN_LINE_STRING
+
CommonConstants
.
FOUR_STRING
+
CommonConstants
.
DOWN_LINE_STRING
+
tIncomeDetail
.
getFeeType
());
// 红冲判断:当本类型是最大值,才可以红冲
if
(
myNum
!=
null
&&
myNum
>
ifNullToZero
(
socialNum
)
&&
myNum
>
ifNullToZero
(
fundNum
)
&&
myNum
>
ifNullToZero
(
insureNum
)
&&
myNum
>
ifNullToZero
(
salaryNum
))
{
return
this
.
saveIncome
(
tIncomeDetail
);
}
}
}
else
{
// 各个模式累加逻辑:
...
...
@@ -441,8 +485,8 @@ public class TIncomeServiceImpl extends ServiceImpl<TIncomeMapper, TIncome> impl
}
else
{
// 薪资。收费方式:2金额-人数
if
(
CommonConstants
.
TWO_STRING
.
equals
(
tIncomeDetail
.
getFeeMode
()))
{
if
(
incomeMap
.
get
(
tIncomeDetail
.
getPayMonth
()
+
CommonConstants
.
DOWN_LINE_STRING
+
tIncomeDetail
.
getFeeType
()
+
CommonConstants
.
DOWN_LINE_STRING
+
tIncomeDetail
.
getRedData
())
==
null
)
{
if
(
incomeMap
.
get
(
tIncomeDetail
.
getPayMonth
()
+
CommonConstants
.
DOWN_LINE_STRING
+
tIncomeDetail
.
getFeeType
()
)
==
null
||
incomeMap
.
get
(
tIncomeDetail
.
getPayMonth
()
+
CommonConstants
.
DOWN_LINE_STRING
+
tIncomeDetail
.
getFeeType
())
<=
CommonConstants
.
ZERO_INT
)
{
return
this
.
saveIncome
(
tIncomeDetail
);
}
}
else
{
...
...
@@ -455,6 +499,13 @@ public class TIncomeServiceImpl extends ServiceImpl<TIncomeMapper, TIncome> impl
return
true
;
}
private
int
ifNullToZero
(
Integer
num
)
{
if
(
num
==
null
)
{
return
CommonConstants
.
ZERO_INT
;
}
return
num
;
}
/**
* @Description: 人次:各个模式累加逻辑
* @Author: hgw
...
...
@@ -462,14 +513,34 @@ public class TIncomeServiceImpl extends ServiceImpl<TIncomeMapper, TIncome> impl
* @return: boolean
**/
private
boolean
judgeMixModel
(
TIncomeDetail
tIncomeDetail
,
Map
<
String
,
Integer
>
numMap
,
Map
<
String
,
Integer
>
incomeMap
)
{
Integer
nums
=
numMap
.
get
(
tIncomeDetail
.
getPayMonth
()
+
CommonConstants
.
DOWN_LINE_STRING
+
tIncomeDetail
.
getSourceType
()
+
CommonConstants
.
DOWN_LINE_STRING
+
tIncomeDetail
.
getFeeType
()
+
CommonConstants
.
DOWN_LINE_STRING
+
tIncomeDetail
.
getRedData
());
Integer
maxNum
=
incomeMap
.
get
(
tIncomeDetail
.
getPayMonth
()
+
CommonConstants
.
DOWN_LINE_STRING
+
tIncomeDetail
.
getFeeType
()
+
CommonConstants
.
DOWN_LINE_STRING
+
tIncomeDetail
.
getRedData
());
// 当明细的次数大于总次数,才可以新增统计
if
(
Common
.
isEmpty
(
maxNum
)
||
nums
>
maxNum
)
{
return
this
.
saveIncome
(
tIncomeDetail
);
String
month
=
tIncomeDetail
.
getPayMonth
();
if
(
CommonConstants
.
THREE_STRING
.
equals
(
tIncomeDetail
.
getSourceType
()))
{
month
=
tIncomeDetail
.
getDataCreateMonth
();
}
if
(
CommonConstants
.
ZERO_STRING
.
equals
(
tIncomeDetail
.
getRedData
()))
{
Integer
nums
=
numMap
.
get
(
month
+
CommonConstants
.
DOWN_LINE_STRING
+
tIncomeDetail
.
getSourceType
()
+
CommonConstants
.
DOWN_LINE_STRING
+
tIncomeDetail
.
getFeeType
());
Integer
maxNum
=
incomeMap
.
get
(
month
+
CommonConstants
.
DOWN_LINE_STRING
+
tIncomeDetail
.
getFeeType
());
// 当明细的次数大于总次数,才可以新增统计
if
(
Common
.
isEmpty
(
maxNum
)
||
nums
>=
maxNum
)
{
return
this
.
saveIncome
(
tIncomeDetail
);
}
}
else
{
Integer
myNum
=
numMap
.
get
(
month
+
CommonConstants
.
DOWN_LINE_STRING
+
tIncomeDetail
.
getSourceType
()
+
CommonConstants
.
DOWN_LINE_STRING
+
tIncomeDetail
.
getFeeType
());
Integer
socialNum
=
numMap
.
get
(
month
+
CommonConstants
.
DOWN_LINE_STRING
+
CommonConstants
.
ONE_STRING
+
CommonConstants
.
DOWN_LINE_STRING
+
tIncomeDetail
.
getFeeType
());
Integer
fundNum
=
numMap
.
get
(
month
+
CommonConstants
.
DOWN_LINE_STRING
+
CommonConstants
.
TWO_STRING
+
CommonConstants
.
DOWN_LINE_STRING
+
tIncomeDetail
.
getFeeType
());
Integer
insureNum
=
numMap
.
get
(
month
+
CommonConstants
.
DOWN_LINE_STRING
+
CommonConstants
.
THREE_STRING
+
CommonConstants
.
DOWN_LINE_STRING
+
tIncomeDetail
.
getFeeType
());
Integer
salaryNum
=
numMap
.
get
(
month
+
CommonConstants
.
DOWN_LINE_STRING
+
CommonConstants
.
FOUR_STRING
+
CommonConstants
.
DOWN_LINE_STRING
+
tIncomeDetail
.
getFeeType
());
// 红冲判断:当本类型是最大值,才可以红冲
if
(
myNum
!=
null
&&
myNum
>
ifNullToZero
(
socialNum
)
&&
myNum
>
ifNullToZero
(
fundNum
)
&&
myNum
>
ifNullToZero
(
insureNum
)
&&
myNum
>
ifNullToZero
(
salaryNum
))
{
return
this
.
saveIncome
(
tIncomeDetail
);
}
}
return
false
;
}
...
...
yifu-social/yifu-social-biz/src/main/resources/mapper/TIncomeDetailMapper.xml
View file @
61b03b67
...
...
@@ -131,6 +131,12 @@
<if
test=
"tIncomeDetail.redData != null and tIncomeDetail.redData.trim() != ''"
>
AND a.RED_DATA = #{tIncomeDetail.redData}
</if>
<if
test=
"tIncomeDetail.idCardList != null and tIncomeDetail.idCardList.size() > 0"
>
AND a.EMP_IDCARD in
<foreach
item=
"item"
index=
"index"
collection=
"tIncomeDetail.idCardList"
open=
"("
separator=
","
close=
")"
>
#{item}
</foreach>
</if>
</if>
</sql>
...
...
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