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
0cf71411
Commit
0cf71411
authored
Aug 17, 2022
by
huyuchen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
申报,稿酬,劳务费接口修改
parent
97d37ac5
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
506 additions
and
105 deletions
+506
-105
TStatisticsLabor.java
...fu/cloud/plus/v1/yifu/salary/entity/TStatisticsLabor.java
+0
-7
TStatisticsRemuneration.java
...d/plus/v1/yifu/salary/entity/TStatisticsRemuneration.java
+0
-7
TStatisticsLaborVo.java
...yifu/cloud/plus/v1/yifu/salary/vo/TStatisticsLaborVo.java
+0
-8
TStatisticsRemunerationVo.java
...oud/plus/v1/yifu/salary/vo/TStatisticsRemunerationVo.java
+0
-8
SalaryUploadController.java
...lus/v1/yifu/salary/controller/SalaryUploadController.java
+1
-2
TStatisticsLaborController.java
...v1/yifu/salary/controller/TStatisticsLaborController.java
+17
-2
TStatisticsLaborMapper.java
...ud/plus/v1/yifu/salary/mapper/TStatisticsLaborMapper.java
+10
-0
TStatisticsLaborService.java
.../plus/v1/yifu/salary/service/TStatisticsLaborService.java
+7
-1
SalaryUploadServiceImpl.java
.../v1/yifu/salary/service/impl/SalaryUploadServiceImpl.java
+432
-56
TStatisticsLaborServiceImpl.java
...yifu/salary/service/impl/TStatisticsLaborServiceImpl.java
+22
-0
SalaryAccountUtil.java
...ifu/cloud/plus/v1/yifu/salary/util/SalaryAccountUtil.java
+5
-3
TStatisticsLaborMapper.xml
...-biz/src/main/resources/mapper/TStatisticsLaborMapper.xml
+11
-5
TStatisticsRemunerationMapper.xml
...c/main/resources/mapper/TStatisticsRemunerationMapper.xml
+1
-6
No files found.
yifu-salary/yifu-salary-api/src/main/java/com/yifu/cloud/plus/v1/yifu/salary/entity/TStatisticsLabor.java
View file @
0cf71411
...
@@ -75,13 +75,6 @@ public class TStatisticsLabor {
...
@@ -75,13 +75,6 @@ public class TStatisticsLabor {
@Length
(
max
=
32
,
message
=
"身份证号不能超过32个字符"
)
@Length
(
max
=
32
,
message
=
"身份证号不能超过32个字符"
)
@ExcelProperty
(
"身份证号"
)
@ExcelProperty
(
"身份证号"
)
private
String
empIdcard
;
private
String
empIdcard
;
/**
* 工号
*/
@ExcelAttribute
(
name
=
"工号"
,
maxLength
=
32
)
@Length
(
max
=
32
,
message
=
"工号不能超过32个字符"
)
@ExcelProperty
(
"工号"
)
private
String
workNo
;
/**
/**
* 证件类型
* 证件类型
*/
*/
...
...
yifu-salary/yifu-salary-api/src/main/java/com/yifu/cloud/plus/v1/yifu/salary/entity/TStatisticsRemuneration.java
View file @
0cf71411
...
@@ -94,12 +94,5 @@ public class TStatisticsRemuneration {
...
@@ -94,12 +94,5 @@ public class TStatisticsRemuneration {
@ExcelAttribute
(
name
=
"个税"
)
@ExcelAttribute
(
name
=
"个税"
)
@ExcelProperty
(
"个税"
)
@ExcelProperty
(
"个税"
)
private
BigDecimal
personalTax
;
private
BigDecimal
personalTax
;
/**
* 工号
*/
@ExcelAttribute
(
name
=
"工号"
,
maxLength
=
32
)
@Length
(
max
=
32
,
message
=
"工号不能超过32个字符"
)
@ExcelProperty
(
"工号"
)
private
String
workNo
;
}
}
yifu-salary/yifu-salary-api/src/main/java/com/yifu/cloud/plus/v1/yifu/salary/vo/TStatisticsLaborVo.java
View file @
0cf71411
...
@@ -81,14 +81,6 @@ public class TStatisticsLaborVo extends RowIndex implements Serializable {
...
@@ -81,14 +81,6 @@ public class TStatisticsLaborVo extends RowIndex implements Serializable {
@Schema
(
description
=
"身份证号"
)
@Schema
(
description
=
"身份证号"
)
@ExcelProperty
(
"身份证号"
)
@ExcelProperty
(
"身份证号"
)
private
String
empIdcard
;
private
String
empIdcard
;
/**
* 工号
*/
@Length
(
max
=
32
,
message
=
"工号 不能超过32 个字符"
)
@ExcelAttribute
(
name
=
"工号"
,
maxLength
=
32
)
@Schema
(
description
=
"工号"
)
@ExcelProperty
(
"工号"
)
private
String
workNo
;
/**
/**
* 证件类型
* 证件类型
*/
*/
...
...
yifu-salary/yifu-salary-api/src/main/java/com/yifu/cloud/plus/v1/yifu/salary/vo/TStatisticsRemunerationVo.java
View file @
0cf71411
...
@@ -103,13 +103,5 @@ public class TStatisticsRemunerationVo extends RowIndex implements Serializable
...
@@ -103,13 +103,5 @@ public class TStatisticsRemunerationVo extends RowIndex implements Serializable
@Schema
(
description
=
"个税"
)
@Schema
(
description
=
"个税"
)
@ExcelProperty
(
"个税"
)
@ExcelProperty
(
"个税"
)
private
BigDecimal
personalTax
;
private
BigDecimal
personalTax
;
/**
* 工号
*/
@Length
(
max
=
32
,
message
=
"工号 不能超过32 个字符"
)
@ExcelAttribute
(
name
=
"工号"
,
maxLength
=
32
)
@Schema
(
description
=
"工号"
)
@ExcelProperty
(
"工号"
)
private
String
workNo
;
}
}
yifu-salary/yifu-salary-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/salary/controller/SalaryUploadController.java
View file @
0cf71411
...
@@ -32,7 +32,6 @@ public class SalaryUploadController {
...
@@ -32,7 +32,6 @@ public class SalaryUploadController {
* @param settleDepart 结算主体id
* @param settleDepart 结算主体id
* @param configId 配置方案id
* @param configId 配置方案id
* @param salaryType 报表类型id
* @param salaryType 报表类型id
* @param repeatFlag 默认 0:不允许重复导入已存在系统内的数据;1:允许重复导入
* @Description:
* @Description:
* @Author: hgw
* @Author: hgw
* @Date: 2019/9/11 15:21
* @Date: 2019/9/11 15:21
...
@@ -41,7 +40,7 @@ public class SalaryUploadController {
...
@@ -41,7 +40,7 @@ public class SalaryUploadController {
@Operation
(
description
=
"上传:jsonString:表格json;settleDepart:结算主体id;configId:工资配置结算月等信息的id;salaryType:工资类型"
)
@Operation
(
description
=
"上传:jsonString:表格json;settleDepart:结算主体id;configId:工资配置结算月等信息的id;salaryType:工资类型"
)
@SysLog
(
"上传薪资表"
)
@SysLog
(
"上传薪资表"
)
@PostMapping
(
"/upload"
)
@PostMapping
(
"/upload"
)
public
R
upload
(
@RequestBody
String
jsonString
,
@RequestParam
String
settleDepart
,
@RequestParam
String
configId
public
R
upload
(
@RequestBody
String
jsonString
,
@RequestParam
String
settleDepart
,
@RequestParam
(
required
=
false
)
String
configId
,
@RequestParam
String
salaryType
)
{
,
@RequestParam
String
salaryType
)
{
return
salaryUploadService
.
salaryUpload
(
jsonString
,
settleDepart
,
configId
,
salaryType
);
return
salaryUploadService
.
salaryUpload
(
jsonString
,
settleDepart
,
configId
,
salaryType
);
}
}
...
...
yifu-salary/yifu-salary-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/salary/controller/TStatisticsLaborController.java
View file @
0cf71411
...
@@ -21,6 +21,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
...
@@ -21,6 +21,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.R
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.R
;
import
com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog
;
import
com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog
;
import
com.yifu.cloud.plus.v1.yifu.common.security.annotation.Inner
;
import
com.yifu.cloud.plus.v1.yifu.salary.entity.TStatisticsLabor
;
import
com.yifu.cloud.plus.v1.yifu.salary.entity.TStatisticsLabor
;
import
com.yifu.cloud.plus.v1.yifu.salary.service.TStatisticsLaborService
;
import
com.yifu.cloud.plus.v1.yifu.salary.service.TStatisticsLaborService
;
import
com.yifu.cloud.plus.v1.yifu.salary.vo.TStatisticsLaborSearchVo
;
import
com.yifu.cloud.plus.v1.yifu.salary.vo.TStatisticsLaborSearchVo
;
...
@@ -36,7 +37,7 @@ import javax.servlet.http.HttpServletResponse;
...
@@ -36,7 +37,7 @@ import javax.servlet.http.HttpServletResponse;
/**
/**
* 本期劳务费申报表
* 本期劳务费申报表
*
*
* @author h
gw
* @author h
uyc
* @date 2022-08-05 11:40:14
* @date 2022-08-05 11:40:14
*/
*/
@RestController
@RestController
...
@@ -90,7 +91,7 @@ public class TStatisticsLaborController {
...
@@ -90,7 +91,7 @@ public class TStatisticsLaborController {
/**
/**
* 本期劳务费申报表 批量导出
* 本期劳务费申报表 批量导出
*
*
* @author h
gw
* @author h
uyc
* @date 2022-08-05 11:40:14
* @date 2022-08-05 11:40:14
**/
**/
@Operation
(
description
=
"导出本期劳务费申报表 hasPermission('salary_tstatisticslabor-export')"
)
@Operation
(
description
=
"导出本期劳务费申报表 hasPermission('salary_tstatisticslabor-export')"
)
...
@@ -113,4 +114,18 @@ public class TStatisticsLaborController {
...
@@ -113,4 +114,18 @@ public class TStatisticsLaborController {
public
R
batchDelete
(
@RequestParam
String
declareMonth
){
public
R
batchDelete
(
@RequestParam
String
declareMonth
){
return
tStatisticsLaborService
.
batchDelete
(
declareMonth
);
return
tStatisticsLaborService
.
batchDelete
(
declareMonth
);
}
}
/**
* @param
* @Description: 生成本期劳务费
* @Author: huyc
* @Date: 2022-08-17 18:17:48
* @return: com.yifu.cloud.v1.common.core.util.R
**/
@Inner
@Operation
(
description
=
"生成本期劳务费"
)
@PostMapping
(
"/inner/doStatisticsLabor"
)
public
R
doStatisticsLabor
()
{
return
tStatisticsLaborService
.
doStatisticsLabor
();
}
}
}
yifu-salary/yifu-salary-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/salary/mapper/TStatisticsLaborMapper.java
View file @
0cf71411
...
@@ -23,6 +23,9 @@ import org.apache.ibatis.annotations.Mapper;
...
@@ -23,6 +23,9 @@ import org.apache.ibatis.annotations.Mapper;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
org.apache.ibatis.annotations.Param
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
/**
/**
* 本期劳务费申报表
* 本期劳务费申报表
*
*
...
@@ -37,4 +40,11 @@ public interface TStatisticsLaborMapper extends BaseMapper<TStatisticsLabor> {
...
@@ -37,4 +40,11 @@ public interface TStatisticsLaborMapper extends BaseMapper<TStatisticsLabor> {
* @return
* @return
*/
*/
IPage
<
TStatisticsLabor
>
getTStatisticsLaborPage
(
Page
<
TStatisticsLabor
>
page
,
@Param
(
"tStatisticsLabor"
)
TStatisticsLabor
tStatisticsLabor
);
IPage
<
TStatisticsLabor
>
getTStatisticsLaborPage
(
Page
<
TStatisticsLabor
>
page
,
@Param
(
"tStatisticsLabor"
)
TStatisticsLabor
tStatisticsLabor
);
/**
* @param
* @Description: 统计
* @return:
**/
List
<
TStatisticsLabor
>
doStatisticsLabor
(
@Param
(
"nowMonth"
)
String
nowMonth
,
@Param
(
"lastYear"
)
String
lastYear
);
}
}
yifu-salary/yifu-salary-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/salary/service/TStatisticsLaborService.java
View file @
0cf71411
...
@@ -50,9 +50,15 @@ public interface TStatisticsLaborService extends IService<TStatisticsLabor> {
...
@@ -50,9 +50,15 @@ public interface TStatisticsLaborService extends IService<TStatisticsLabor> {
List
<
TStatisticsLabor
>
noPageDiy
(
TStatisticsLaborSearchVo
searchVo
);
List
<
TStatisticsLabor
>
noPageDiy
(
TStatisticsLaborSearchVo
searchVo
);
/**
/**
* 批量删除本期
稿酬
申报表
* 批量删除本期
劳务费
申报表
* @param declareMonth 申报月份
* @param declareMonth 申报月份
* @return
* @return
*/
*/
R
batchDelete
(
String
declareMonth
);
R
batchDelete
(
String
declareMonth
);
/** 生成本期劳务费
* @param
* @return
**/
R
doStatisticsLabor
();
}
}
yifu-salary/yifu-salary-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/salary/service/impl/SalaryUploadServiceImpl.java
View file @
0cf71411
...
@@ -94,7 +94,8 @@ public class SalaryUploadServiceImpl extends ServiceImpl<TSalaryStandardMapper,
...
@@ -94,7 +94,8 @@ public class SalaryUploadServiceImpl extends ServiceImpl<TSalaryStandardMapper,
**/
**/
@Override
@Override
public
R
salaryUpload
(
String
jsonString
,
String
settleDepart
,
String
configId
,
String
salaryType
)
{
public
R
salaryUpload
(
String
jsonString
,
String
settleDepart
,
String
configId
,
String
salaryType
)
{
if
(
Common
.
isNotNull
(
jsonString
)
&&
Common
.
isNotNull
(
settleDepart
)
&&
Common
.
isNotNull
(
configId
)
&&
Common
.
isNotNull
(
salaryType
))
{
if
(
Common
.
isNotNull
(
jsonString
)
&&
Common
.
isNotNull
(
settleDepart
)
&&
Common
.
isNotNull
(
salaryType
))
{
R
<
TSettleDomainSelectVo
>
sdr
=
HttpDaprUtil
.
invokeMethodPost
(
archivesProperties
.
getAppUrl
(),
archivesProperties
.
getAppId
()
R
<
TSettleDomainSelectVo
>
sdr
=
HttpDaprUtil
.
invokeMethodPost
(
archivesProperties
.
getAppUrl
(),
archivesProperties
.
getAppId
()
,
"/tsettledomain/inner/getSettleDomainVoById"
,
settleDepart
,
TSettleDomainSelectVo
.
class
,
SecurityConstants
.
FROM_IN
);
,
"/tsettledomain/inner/getSettleDomainVoById"
,
settleDepart
,
TSettleDomainSelectVo
.
class
,
SecurityConstants
.
FROM_IN
);
// 结算主体
// 结算主体
...
@@ -102,14 +103,7 @@ public class SalaryUploadServiceImpl extends ServiceImpl<TSalaryStandardMapper,
...
@@ -102,14 +103,7 @@ public class SalaryUploadServiceImpl extends ServiceImpl<TSalaryStandardMapper,
if
(
sdr
!=
null
&&
sdr
.
getData
()
!=
null
)
{
if
(
sdr
!=
null
&&
sdr
.
getData
()
!=
null
)
{
dept
=
sdr
.
getData
();
dept
=
sdr
.
getData
();
}
}
if
(
dept
==
null
||
dept
.
getId
()
==
null
)
{
return
R
.
failed
(
"新建工资主表失败-获取结算主体信息为空"
);
}
// 2020-3-29 11:24:14变更为结算主体的封面抬头
String
invoiceTitle
=
dept
.
getBusinessSubjectName
();
if
(
Common
.
isEmpty
(
invoiceTitle
))
{
return
R
.
failed
(
"上传失败-获取结算主体的-封面抬头-信息为空,请去<客户管理-结算主体>模块,编辑封面抬头后再导入"
);
}
// 薪资识别配置(原表-标准模板)
// 薪资识别配置(原表-标准模板)
List
<
TSalaryConfigStandard
>
salaryAccountList
=
tSalaryConfigStandardService
.
list
();
List
<
TSalaryConfigStandard
>
salaryAccountList
=
tSalaryConfigStandardService
.
list
();
Map
<
String
,
TSalaryConfigStandard
>
salaryConfigMap
=
new
HashMap
<>();
//存放所有字段
Map
<
String
,
TSalaryConfigStandard
>
salaryConfigMap
=
new
HashMap
<>();
//存放所有字段
...
@@ -120,65 +114,135 @@ public class SalaryUploadServiceImpl extends ServiceImpl<TSalaryStandardMapper,
...
@@ -120,65 +114,135 @@ public class SalaryUploadServiceImpl extends ServiceImpl<TSalaryStandardMapper,
isMustMap
.
put
(
sc
.
getDbFiedName
(),
true
);
isMustMap
.
put
(
sc
.
getDbFiedName
(),
true
);
}
}
}
}
// 薪资配置-结算月、社保月等信息
TConfigSalary
configSalary
=
configSalaryService
.
getById
(
configId
);
if
(
dept
==
null
||
dept
.
getId
()
==
null
)
{
return
R
.
failed
(
"新建工资主表失败-获取结算主体信息为空"
);
}
// 2020-3-29 11:24:14变更为结算主体的封面抬头
String
invoiceTitle
=
dept
.
getBusinessSubjectName
();
if
(
Common
.
isEmpty
(
invoiceTitle
))
{
return
R
.
failed
(
"上传失败-获取结算主体的-封面抬头-信息为空,请去<客户管理-结算主体>模块,编辑封面抬头后再导入"
);
}
YifuUser
user
=
SecurityUtils
.
getUser
();
YifuUser
user
=
SecurityUtils
.
getUser
();
if
(
null
==
user
||
null
==
user
.
getId
())
{
if
(
null
==
user
||
null
==
user
.
getId
())
{
return
R
.
failed
(
"获取登录用户信息失败!"
);
return
R
.
failed
(
"获取登录用户信息失败!"
);
}
}
try
{
//薪资导入
jsonString
=
URLDecoder
.
decode
(
jsonString
,
"UTF-8"
).
replace
(
"="
,
""
);
if
(
CommonConstants
.
ZERO_STRING
.
equals
(
salaryType
)
&&
Common
.
isNotNull
(
configId
))
{
SalaryAccountUtil
util1
=
new
SalaryAccountUtil
();
// 薪资配置-结算月、社保月等信息
TSalaryEmployee
empSearch
=
new
TSalaryEmployee
();
TConfigSalary
configSalary
=
configSalaryService
.
getById
(
configId
);
empSearch
.
setUnitId
(
dept
.
getCustomerId
());
try
{
List
<
TSalaryEmployee
>
empList
=
employeeService
.
list
(
Wrappers
.<
TSalaryEmployee
>
query
().
lambda
()
jsonString
=
URLDecoder
.
decode
(
jsonString
,
"UTF-8"
).
replace
(
"="
,
""
);
.
eq
(
TSalaryEmployee:
:
getUnitId
,
dept
.
getCustomerId
()));
SalaryAccountUtil
util1
=
new
SalaryAccountUtil
();
Map
<
String
,
TSalaryEmployee
>
empIdCardMap
=
new
HashMap
<>();
Map
<
String
,
TSalaryEmployee
>
empNameMap
=
new
HashMap
<>();
TSalaryEmployee
empSearch
=
new
TSalaryEmployee
();
boolean
isDuplicateName
=
false
;
empSearch
.
setUnitId
(
dept
.
getCustomerId
());
if
(
empList
!=
null
)
{
List
<
TSalaryEmployee
>
empList
=
employeeService
.
list
(
Wrappers
.<
TSalaryEmployee
>
query
().
lambda
()
TSalaryEmployee
es
;
//筛选人员,添加判断:非在职,或开户行为空,或 结算主体等于选择的结算主体且在职,都可以存入Map优先备用
.
eq
(
TSalaryEmployee:
:
getUnitId
,
dept
.
getCustomerId
()));
for
(
TSalaryEmployee
e
:
empList
)
{
Map
<
String
,
TSalaryEmployee
>
empIdCardMap
=
new
HashMap
<>();
es
=
empIdCardMap
.
get
(
e
.
getEmpIdcard
());
Map
<
String
,
TSalaryEmployee
>
empNameMap
=
new
HashMap
<>();
if
(
es
==
null
||
CommonConstants
.
ZERO_INT
!=
es
.
getFileStatus
()
||
Common
.
isEmpty
(
es
.
getBankName
())
boolean
isDuplicateName
=
false
;
||
(
e
.
getDeptId
().
equals
(
settleDepart
)
&&
CommonConstants
.
ZERO_INT
==
e
.
getFileStatus
()
if
(
empList
!=
null
)
{
&&
Common
.
isNotNull
(
e
.
getBankName
())))
{
TSalaryEmployee
es
;
//筛选人员,添加判断:非在职,或开户行为空,或 结算主体等于选择的结算主体且在职,都可以存入Map优先备用
empIdCardMap
.
put
(
e
.
getEmpIdcard
(),
e
);
for
(
TSalaryEmployee
e
:
empList
)
{
empNameMap
.
put
(
e
.
getEmpName
().
replace
(
" "
,
""
),
e
);
es
=
empIdCardMap
.
get
(
e
.
getEmpIdcard
());
if
(
es
==
null
||
CommonConstants
.
ZERO_INT
!=
es
.
getFileStatus
()
||
Common
.
isEmpty
(
es
.
getBankName
())
||
(
e
.
getDeptId
().
equals
(
settleDepart
)
&&
CommonConstants
.
ZERO_INT
==
e
.
getFileStatus
()
&&
Common
.
isNotNull
(
e
.
getBankName
())))
{
empIdCardMap
.
put
(
e
.
getEmpIdcard
(),
e
);
empNameMap
.
put
(
e
.
getEmpName
().
replace
(
" "
,
""
),
e
);
}
}
if
(
empNameMap
.
size
()
==
empIdCardMap
.
size
())
{
isDuplicateName
=
true
;
}
}
}
}
if
(
empNameMap
.
size
()
==
empIdCardMap
.
size
())
{
// 自有员工结算主体id,新员工使用
isDuplicateName
=
true
;
Map
<
String
,
Integer
>
ownDeptMap
=
tOwnDeptService
.
getOwnDeptMap
();
// 自有员工所在结算主体Map
Map
<
String
,
Integer
>
ownEmployeeMap
=
tOwnDeptService
.
getOwnEmpMap
();
// 2.6.6:校验导入数据重复的Map格式:#身份证号_工资月份_报表类型_应发金额
Map
<
String
,
Integer
>
checkMap
=
tSalaryAccountService
.
getAccountCheckMap
(
dept
.
getId
(),
DateUtil
.
addMonth
(
configSalary
.
getSalaryMonth
()));
util1
.
getJsonStringToList
(
user
,
jsonString
,
dept
,
configSalary
,
salaryConfigMap
,
isMustMap
,
empIdCardMap
,
empNameMap
,
isDuplicateName
,
salaryType
,
invoiceTitle
,
employeeService
,
checkMap
,
ownEmployeeMap
,
ownDeptMap
,
tSalaryAccountService
);
List
<
TSalaryAccountVo
>
saList
=
util1
.
getEntityList
();
if
((
null
!=
util1
.
getErrorInfo
()
&&
!
util1
.
getErrorInfo
().
isEmpty
()))
{
return
R
.
failed
(
util1
.
getErrorInfo
());
}
else
{
if
(
null
!=
saList
&&
!
saList
.
isEmpty
())
{
// return R.ok(saList)
return
this
.
saveAndSubmit
(
saList
);
}
else
{
return
R
.
failed
(
"导入数据不可为空"
);
}
}
}
}
catch
(
Exception
e
)
{
log
.
error
(
e
.
getMessage
());
return
R
.
failed
(
"数据导入解析失败!"
);
}
}
// 自有员工结算主体id,新员工使用
//劳务费导入
Map
<
String
,
Integer
>
ownDeptMap
=
tOwnDeptService
.
getOwnDeptMap
();
}
else
if
(
CommonConstants
.
THREE_STRING
.
equals
(
salaryType
))
{
// 自有员工所在结算主体Map
Map
<
String
,
Integer
>
ownEmployeeMap
=
tOwnDeptService
.
getOwnEmpMap
();
TConfigSalary
configSalary
=
new
TConfigSalary
();
// 薪资配置-结算月、社保月等信息
// 2.6.6:校验导入数据重复的Map格式:#身份证号_工资月份_报表类型_应发金额
configSalary
=
configSalaryService
.
getById
(
CommonConstants
.
ONE_STRING
);
Map
<
String
,
Integer
>
checkMap
=
tSalaryAccountService
.
getAccountCheckMap
(
dept
.
getId
(),
DateUtil
.
addMonth
(
configSalary
.
getSalaryMonth
()));
try
{
util1
.
getJsonStringToList
(
user
,
jsonString
,
jsonString
=
URLDecoder
.
decode
(
jsonString
,
"UTF-8"
).
replace
(
"="
,
""
);
dept
,
configSalary
,
salaryConfigMap
,
isMustMap
,
empIdCardMap
,
empNameMap
,
isDuplicateName
SalaryAccountUtil
util1
=
new
SalaryAccountUtil
();
,
salaryType
,
invoiceTitle
,
employeeService
,
checkMap
,
ownEmployeeMap
,
ownDeptMap
,
tSalaryAccountService
);
List
<
TSalaryAccountVo
>
saList
=
util1
.
getEntityList
();
List
<
TSalaryEmployee
>
empList
=
employeeService
.
list
(
Wrappers
.<
TSalaryEmployee
>
query
().
lambda
()
.
eq
(
TSalaryEmployee:
:
getUnitId
,
dept
.
getCustomerId
()));
if
((
null
!=
util1
.
getErrorInfo
()
&&
!
util1
.
getErrorInfo
().
isEmpty
()))
{
Map
<
String
,
TSalaryEmployee
>
empIdCardMap
=
new
HashMap
<>();
return
R
.
failed
(
util1
.
getErrorInfo
());
Map
<
String
,
TSalaryEmployee
>
empNameMap
=
new
HashMap
<>();
}
else
{
boolean
isDuplicateName
=
false
;
if
(
null
!=
saList
&&
!
saList
.
isEmpty
())
{
if
(
empList
!=
null
)
{
// return R.ok(saList)
TSalaryEmployee
es
;
//筛选人员,添加判断:非在职,或开户行为空,或 结算主体等于选择的结算主体且在职,都可以存入Map优先备用
return
this
.
saveAndSubmit
(
saList
);
for
(
TSalaryEmployee
e
:
empList
)
{
es
=
empIdCardMap
.
get
(
e
.
getEmpIdcard
());
if
(
es
==
null
||
CommonConstants
.
ZERO_INT
!=
es
.
getFileStatus
()
||
Common
.
isEmpty
(
es
.
getBankName
())
||
(
e
.
getDeptId
().
equals
(
settleDepart
)
&&
CommonConstants
.
ZERO_INT
==
e
.
getFileStatus
()
&&
Common
.
isNotNull
(
e
.
getBankName
())))
{
empIdCardMap
.
put
(
e
.
getEmpIdcard
(),
e
);
empNameMap
.
put
(
e
.
getEmpName
().
replace
(
" "
,
""
),
e
);
}
}
if
(
empNameMap
.
size
()
==
empIdCardMap
.
size
())
{
isDuplicateName
=
true
;
}
}
// 自有员工结算主体id,新员工使用
Map
<
String
,
Integer
>
ownDeptMap
=
tOwnDeptService
.
getOwnDeptMap
();
// 自有员工所在结算主体Map
Map
<
String
,
Integer
>
ownEmployeeMap
=
tOwnDeptService
.
getOwnEmpMap
();
// 2.6.6:校验导入数据重复的Map格式:#身份证号_工资月份_报表类型_应发金额
Map
<
String
,
Integer
>
checkMap
=
new
HashMap
<>();
if
(
Common
.
isNotNull
(
configSalary
))
{
checkMap
=
tSalaryAccountService
.
getAccountCheckMap
(
dept
.
getId
(),
DateUtil
.
addMonth
(
configSalary
.
getSalaryMonth
()));
}
util1
.
getJsonStringToList
(
user
,
jsonString
,
dept
,
!
Common
.
isNotNull
(
configSalary
)
?
null
:
configSalary
,
salaryConfigMap
,
isMustMap
,
empIdCardMap
,
empNameMap
,
isDuplicateName
,
salaryType
,
null
,
employeeService
,
checkMap
,
ownEmployeeMap
,
ownDeptMap
,
tSalaryAccountService
);
List
<
TSalaryAccountVo
>
saList
=
util1
.
getEntityList
();
if
((
null
!=
util1
.
getErrorInfo
()
&&
!
util1
.
getErrorInfo
().
isEmpty
()))
{
return
R
.
failed
(
util1
.
getErrorInfo
());
}
else
{
}
else
{
return
R
.
failed
(
"导入数据不可为空"
);
if
(
null
!=
saList
&&
!
saList
.
isEmpty
())
{
return
this
.
saveLaborSubmit
(
saList
,
dept
);
}
else
{
return
R
.
failed
(
"导入数据不可为空"
);
}
}
}
}
catch
(
Exception
e
)
{
log
.
error
(
e
.
getMessage
());
return
R
.
failed
(
"数据导入解析失败!"
);
}
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
log
.
error
(
e
.
getMessage
());
return
R
.
failed
(
"数据导入解析失败!"
);
}
}
}
}
return
R
.
failed
(
"导入数据不可为空"
);
return
R
.
failed
(
"导入数据不可为空"
);
...
@@ -1415,4 +1479,316 @@ public class SalaryUploadServiceImpl extends ServiceImpl<TSalaryStandardMapper,
...
@@ -1415,4 +1479,316 @@ public class SalaryUploadServiceImpl extends ServiceImpl<TSalaryStandardMapper,
return
new
R
<>(
salaryDetailVo
);
return
new
R
<>(
salaryDetailVo
);
}
}
/**
* @param savList 报账表Vo
* @Description: 保存并提交
* @Author: huyc
* @Date: 2022/8/16
* @return: com.yifu.cloud.v1.common.core.util.R
**/
public
R
saveLaborSubmit
(
List
<
TSalaryAccountVo
>
savList
,
TSettleDomainSelectVo
dept
)
{
if
(
Common
.
isNotNull
(
savList
)
&&
!
savList
.
isEmpty
())
{
TSalaryAccountVo
salaryAccountVo
=
savList
.
get
(
0
);
List
<
TSalaryAccountItem
>
saiList
=
null
;
//报账明细List
TSalaryAccountItem
sai
=
null
;
//报账明细
YifuUser
user
=
SecurityUtils
.
getUser
();
TSalaryStandard
salary
;
LocalDateTime
nowTime
=
LocalDateTime
.
now
();
//工资主表
R
<
TSalaryStandard
>
sr
=
this
.
saveNewTSalary
(
salaryAccountVo
,
dept
,
user
,
nowTime
);
String
invoiceTitle
=
dept
.
getBusinessSubjectName
();
if
(
sr
==
null
||
sr
.
getCode
()
==
CommonConstants
.
FAIL
)
{
return
sr
;
}
else
{
salary
=
sr
.
getData
();
}
boolean
isActual
=
false
;
//false:应发导入; true:实发 倒推导入
List
<
TSalaryAccountItemVo
>
itemList
=
salaryAccountVo
.
getSaiList
();
for
(
TSalaryAccountItemVo
item
:
itemList
)
{
if
(
SalaryConstants
.
ACTUAL_SALARY_SUM_JAVA
.
equals
(
item
.
getJavaFiedName
()))
{
isActual
=
true
;
break
;
}
}
if
(
salary
!=
null
)
{
// 薪资导入、删除前加锁:
TSalaryLock
lock
=
salaryLockService
.
lambdaQuery
()
.
eq
(
TSalaryLock:
:
getDeptId
,
dept
.
getId
())
.
eq
(
TSalaryLock:
:
getDeleteFlag
,
CommonConstants
.
ZERO_INT
)
.
last
(
"limit 1"
).
one
();
if
(
lock
!=
null
&&
Common
.
isNotNull
(
lock
.
getId
()))
{
return
R
.
failed
(
"当前结算主体已被用户锁定,请稍等!超过10分钟还没释放,请联系管理员!当前时间:"
+
nowTime
);
}
else
{
lock
=
new
TSalaryLock
();
lock
.
setCreateTime
(
nowTime
);
lock
.
setDeleteFlag
(
CommonConstants
.
ZERO_INT
);
lock
.
setDeptId
(
dept
.
getId
());
lock
.
setDeptName
(
dept
.
getDepartName
());
lock
.
setSettleMonth
(
salaryAccountVo
.
getSettlementMonth
());
lock
.
setType
(
CommonConstants
.
ZERO_INT
);
salaryLockService
.
save
(
lock
);
TSalaryLock
lockUpdate
;
try
{
// 薪资核心导入代码
return
this
.
doLaborCoreSalary
(
savList
,
salaryAccountVo
,
saiList
,
sai
,
dept
,
invoiceTitle
,
user
,
nowTime
,
salary
,
isActual
);
}
catch
(
Exception
e
)
{
lockUpdate
=
new
TSalaryLock
();
lockUpdate
.
setId
(
lock
.
getId
());
lockUpdate
.
setDeleteFlag
(
CommonConstants
.
ONE_INT
);
salaryLockService
.
updateById
(
lockUpdate
);
throw
new
RuntimeException
(
e
.
getMessage
()
==
null
?
"薪资导入失败!"
:
e
.
getMessage
());
}
finally
{
lockUpdate
=
new
TSalaryLock
();
lockUpdate
.
setId
(
lock
.
getId
());
lockUpdate
.
setDeleteFlag
(
CommonConstants
.
ONE_INT
);
if
(
Common
.
isNotNull
(
salary
.
getId
()))
{
lockUpdate
.
setSalaryId
(
salary
.
getId
());
lockUpdate
.
setSettleMoney
(
salary
.
getSettlementAmount
());
}
salaryLockService
.
updateById
(
lockUpdate
);
}
}
}
else
{
return
R
.
failed
(
"新建工资主表失败"
);
}
}
return
R
.
failed
(
"提交的数据不可为空"
);
}
/**
* @Description: 劳务费导入核心代码
* @Author: huyc
* @return: com.yifu.cloud.v1.common.core.util.R
**/
public
R
doLaborCoreSalary
(
List
<
TSalaryAccountVo
>
savList
,
TSalaryAccountVo
salaryAccountVo
,
List
<
TSalaryAccountItem
>
saiList
,
TSalaryAccountItem
sai
,
TSettleDomainSelectVo
dept
,
String
invoiceTitle
,
YifuUser
user
,
LocalDateTime
nowTime
,
TSalaryStandard
salary
,
boolean
isActual
)
{
List
<
TSalaryAccount
>
aList
=
new
ArrayList
<>();
TSalaryAccount
a
;
//定库:
BigDecimal
money
=
new
BigDecimal
(
CommonConstants
.
ZERO_STRING
);
//初始化金额备用
BigDecimal
relaySalarySum
=
BigDecimal
.
ZERO
;
//工资应发
List
<
TSalaryAccountItem
>
asList
;
//累计扣税
// 历史个税合计
BigDecimal
sumTax
=
BigDecimal
.
ZERO
;
int
size
=
savList
.
size
();
// 自有员工人数
int
ownNum
=
0
;
// 自有员工应发金额
BigDecimal
ownMoney
=
BigDecimal
.
ZERO
;
BigDecimal
relaySalary
;
//工资应发
// 劳务费、稿酬是否含有发薪false:否;true:是
boolean
haveSalaryFlag
=
false
;
// 是否含有特殊金额false:否;true:是
boolean
haveSpecialFlag
=
false
;
// 是否重复金额false:否;true:是
boolean
repeatFlag
=
false
;
List
<
String
>
idCardList
=
new
ArrayList
<>();
for
(
TSalaryAccountVo
vo
:
savList
)
{
if
(
Common
.
isNotNull
(
vo
.
getEmpIdcard
()))
{
idCardList
.
add
(
vo
.
getEmpIdcard
());
}
}
// 工资查询所需的全部list,组装Map来使用
Map
<
String
,
List
<
TSalaryAccountItem
>>
itemMap
=
tSalaryAccountItemService
.
getAllItemVoList
(
idCardList
,
invoiceTitle
);
for
(
int
i
=
CommonConstants
.
ZERO_INT
;
i
<
size
;
i
++)
{
relaySalary
=
BigDecimal
.
ZERO
;
a
=
new
TSalaryAccount
();
// 本次实发
BigDecimal
actualSalarySumNow
=
BigDecimal
.
ZERO
;
// 当月实发合计
BigDecimal
actualSalarySum
=
BigDecimal
.
ZERO
;
try
{
SalaryAccountUtil
.
reflectionAttr
(
savList
.
get
(
i
),
a
);
if
(!
haveSalaryFlag
&&
a
.
getHaveSalaryFlag
()
!=
null
&&
a
.
getHaveSalaryFlag
()
==
CommonConstants
.
ONE_INT
)
{
haveSalaryFlag
=
true
;
}
if
(!
haveSpecialFlag
&&
a
.
getHaveSpecialFlag
()
!=
null
&&
a
.
getHaveSpecialFlag
()
==
CommonConstants
.
ONE_INT
)
{
haveSpecialFlag
=
true
;
}
if
(!
repeatFlag
&&
a
.
getIsRepeat
()
!=
null
&&
a
.
getIsRepeat
()
==
CommonConstants
.
ONE_INT
)
{
repeatFlag
=
true
;
}
if
(
savList
.
get
(
i
).
getSaiList
()
!=
null
&&
!
savList
.
get
(
i
).
getSaiList
().
isEmpty
())
{
saiList
=
new
ArrayList
<>();
for
(
int
j
=
0
;
j
<
savList
.
get
(
i
).
getSaiList
().
size
();
j
++)
{
sai
=
new
TSalaryAccountItem
();
SalaryAccountUtil
.
reflectionAttr
(
savList
.
get
(
i
).
getSaiList
().
get
(
j
),
sai
);
//工资应发
if
(
SalaryConstants
.
RELAY_SALARY_JAVA
.
equals
(
sai
.
getJavaFiedName
()))
{
relaySalary
=
sai
.
getSalaryMoney
();
relaySalarySum
=
relaySalarySum
.
add
(
sai
.
getSalaryMoney
());
}
SalaryAccountUtil
.
reflectionAttr
(
savList
.
get
(
i
).
getSaiList
().
get
(
j
),
sai
);
//个人实发合计
if
(
SalaryConstants
.
ACTUAL_SALARY_SUM_JAVA
.
equals
(
sai
.
getJavaFiedName
()))
{
actualSalarySum
=
actualSalarySum
.
add
(
sai
.
getSalaryMoney
());
actualSalarySumNow
=
actualSalarySumNow
.
add
(
sai
.
getSalaryMoney
());
}
saiList
.
add
(
sai
);
}
}
// 自有员工以及自有员工应发金额
if
(
Common
.
isNotNull
(
a
.
getOwnFlag
())
&&
a
.
getOwnFlag
()
==
1
)
{
ownNum
++;
ownMoney
=
ownMoney
.
add
(
relaySalary
);
}
//累计扣税list
asList
=
this
.
getLaborAsList
(
itemMap
.
get
(
a
.
getEmpIdcard
()),
a
.
getSettlementMonth
());
// 实发劳务费,按月累计扣税
this
.
saveNewItems
(
sai
,
saiList
,
SalaryConstants
.
SALARY_TAX
,
SalaryConstants
.
SALARY_TAX_JAVA
,
calculationLabor
(
saiList
,
asList
,
saiList
,
a
),
CommonConstants
.
ZERO_INT
);
a
.
setSaiList
(
saiList
);
aList
.
add
(
a
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
salary
.
setOwnNums
(
ownNum
);
salary
.
setOwnMoney
(
ownMoney
);
TSalaryDetailVo
salaryDetailVo
=
new
TSalaryDetailVo
();
salaryDetailVo
.
setSalaryAccountList
(
aList
);
salary
.
setSettlementAmount
(
relaySalarySum
);
salary
.
setHaveSalaryFlag
(
CommonConstants
.
ZERO_INT
);
salary
.
setHaveSpecialFlag
(
CommonConstants
.
ZERO_INT
);
salary
.
setIsRepeat
(
CommonConstants
.
ZERO_INT
);
salary
.
setStatus
(
SalaryConstants
.
AUDIT_STATUS
[
0
]);
if
(
haveSalaryFlag
||
haveSpecialFlag
||
ownNum
>
0
||
repeatFlag
)
{
if
(
haveSalaryFlag
)
{
salary
.
setHaveSalaryFlag
(
CommonConstants
.
ONE_INT
);
}
if
(
haveSpecialFlag
)
{
salary
.
setHaveSpecialFlag
(
CommonConstants
.
ONE_INT
);
}
if
(
repeatFlag
)
{
salary
.
setIsRepeat
(
CommonConstants
.
ONE_INT
);
}
}
//保存工资表
tSalaryStandardService
.
save
(
salary
);
salaryDetailVo
.
setSalary
(
salary
);
for
(
TSalaryAccount
account
:
aList
)
{
saiList
=
account
.
getSaiList
();
account
.
setSaiList
(
null
);
account
.
setSalaryFormId
(
salary
.
getId
());
tSalaryAccountService
.
save
(
account
);
money
=
SalaryConstants
.
B_ZERO
;
for
(
TSalaryAccountItem
item
:
saiList
)
{
if
(
SalaryConstants
.
ACTUAL_SALARY_SUM_JAVA
.
equals
(
item
.
getJavaFiedName
()))
{
money
=
item
.
getSalaryMoney
();
}
item
.
setSalaryAccountId
(
account
.
getId
());
tSalaryAccountItemService
.
save
(
item
);
}
}
return
R
.
ok
(
salaryDetailVo
);
}
/**
* @param itemList
* @param itemHistoryList
* @param saiList
* @Description: 计算劳务费个税、应发
* @Author: hgw
* @Date: 2022/3/3 11:30
* @return: java.math.BigDecimal
**/
private
static
BigDecimal
calculationLabor
(
List
<
TSalaryAccountItem
>
itemList
,
List
<
TSalaryAccountItem
>
itemHistoryList
,
List
<
TSalaryAccountItem
>
saiList
,
TSalaryAccount
a
)
{
// B7 = 当月实发合计
// 税=ROUND(IF(B7<=800,0,IF(B7<=3360,(B7-800)/4,IF(B7<=21000,0.16*B7/0.84,IF(B7<=49500,(0.24*B7-2000)/0.76,(0.32*B7-7000)/0.68)))),2)
// 本次实发
BigDecimal
actualSalarySumNow
=
BigDecimal
.
ZERO
;
// 当月实发合计
BigDecimal
actualSalarySum
=
BigDecimal
.
ZERO
;
// 历史个税合计
BigDecimal
sumTax
=
BigDecimal
.
ZERO
;
// 本次实发
for
(
TSalaryAccountItem
item
:
itemList
)
{
if
(
SalaryConstants
.
ACTUAL_SALARY_SUM_JAVA
.
equals
(
item
.
getJavaFiedName
()))
{
actualSalarySum
=
actualSalarySum
.
add
(
item
.
getSalaryMoney
());
actualSalarySumNow
=
actualSalarySumNow
.
add
(
item
.
getSalaryMoney
());
}
}
// 历史实发、个税
for
(
TSalaryAccountItem
item
:
itemHistoryList
)
{
if
(
SalaryConstants
.
SALARY_TAX_JAVA
.
equals
(
item
.
getJavaFiedName
()))
{
sumTax
=
sumTax
.
add
(
item
.
getSalaryMoney
());
}
if
(
SalaryConstants
.
ACTUAL_SALARY_SUM_JAVA
.
equals
(
item
.
getJavaFiedName
()))
{
actualSalarySum
=
actualSalarySum
.
add
(
item
.
getSalaryMoney
());
}
}
//个人承担部分税费
BigDecimal
nowTaxT
=
BigDecimal
.
ZERO
;
//个人不承担部分税费
BigDecimal
nowTaxY
=
BigDecimal
.
ZERO
;
BigDecimal
relaySalary
;
if
(
CommonConstants
.
ONE_STRING
.
equals
(
a
.
getIsPersonTax
()))
{
nowTaxT
=
getNowTax
(
actualSalarySumNow
);
nowTaxY
=
getNowTax
(
actualSalarySum
);
relaySalary
=
BigDecimalUtils
.
safeAdd
(
actualSalarySumNow
,
nowTaxT
).
setScale
(
SalaryConstants
.
PLACES
,
BigDecimal
.
ROUND_HALF_UP
);
BigDecimal
salaryTax
=
BigDecimalUtils
.
safeSubtract
(
nowTaxY
,
BigDecimalUtils
.
safeAdd
(
nowTaxT
,
sumTax
));
a
.
setSalaryTax
(
salaryTax
);
a
.
setRelaySalaryUnit
(
relaySalary
);
a
.
setSalaryTaxUnit
(
nowTaxT
);
a
.
setActualSalary
(
BigDecimalUtils
.
safeSubtract
(
actualSalarySumNow
,
salaryTax
));
}
else
{
nowTaxY
=
getNowTax
(
actualSalarySum
);
if
(
sumTax
.
compareTo
(
BigDecimal
.
ZERO
)
!=
0
)
{
nowTaxY
=
BigDecimalUtils
.
safeSubtract
(
nowTaxY
,
sumTax
).
setScale
(
SalaryConstants
.
PLACES
,
BigDecimal
.
ROUND_HALF_UP
);
}
relaySalary
=
BigDecimalUtils
.
safeAdd
(
actualSalarySumNow
,
nowTaxY
).
setScale
(
SalaryConstants
.
PLACES
,
BigDecimal
.
ROUND_HALF_UP
);
}
// 本次个人应发合计
TSalaryAccountItem
sai
=
new
TSalaryAccountItem
();
sai
.
setCnName
(
SalaryConstants
.
RELAY_SALARY
);
sai
.
setJavaFiedName
(
SalaryConstants
.
RELAY_SALARY_JAVA
);
sai
.
setIsTax
(
CommonConstants
.
ZERO_INT
);
sai
.
setSalaryMoney
(
relaySalary
);
saiList
.
add
(
sai
);
return
nowTaxT
;
}
public
static
BigDecimal
getNowTax
(
BigDecimal
actualSalarySum
)
{
BigDecimal
nowTax
;
// 2022-3-3 11:24:20 运营中心郭华照提供的公式:
// ROUND(IF(B7<=800,0,IF(B7<=3360,(B7-800)/4,IF(B7<=21000,0.16*B7/0.84,IF(B7<=49500,(0.24*B7-2000)/0.76,(0.32*B7-7000)/0.68)))),2)
if
(
actualSalarySum
.
compareTo
(
new
BigDecimal
(
"800"
))
<=
0
)
{
nowTax
=
BigDecimal
.
ZERO
;
}
else
if
(
actualSalarySum
.
compareTo
(
new
BigDecimal
(
"3360"
))
<=
0
)
{
// (B7-800)/4
nowTax
=
BigDecimalUtils
.
safeDivide
(
BigDecimalUtils
.
safeSubtract
(
actualSalarySum
,
new
BigDecimal
(
"800"
))
,
new
BigDecimal
(
"4"
));
}
else
if
(
actualSalarySum
.
compareTo
(
new
BigDecimal
(
"21000"
))
<=
0
)
{
// 0.16*B7/0.84
nowTax
=
BigDecimalUtils
.
safeDivide
(
BigDecimalUtils
.
safeMultiply
(
actualSalarySum
,
new
BigDecimal
(
"0.16"
))
,
new
BigDecimal
(
"0.84"
));
}
else
if
(
actualSalarySum
.
compareTo
(
new
BigDecimal
(
"49500"
))
<=
0
)
{
// (0.24*B7-2000)/0.76
nowTax
=
BigDecimalUtils
.
safeDivide
(
BigDecimalUtils
.
safeSubtract
(
BigDecimalUtils
.
safeMultiply
(
actualSalarySum
,
new
BigDecimal
(
"0.24"
)),
new
BigDecimal
(
"2000"
))
,
new
BigDecimal
(
"0.76"
));
}
else
{
nowTax
=
BigDecimalUtils
.
safeDivide
(
BigDecimalUtils
.
safeSubtract
(
BigDecimalUtils
.
safeMultiply
(
actualSalarySum
,
new
BigDecimal
(
"0.32"
)),
new
BigDecimal
(
"7000"
))
,
new
BigDecimal
(
"0.68"
));
}
nowTax
=
nowTax
.
setScale
(
SalaryConstants
.
PLACES
,
BigDecimal
.
ROUND_HALF_UP
);
return
nowTax
;
}
}
}
yifu-salary/yifu-salary-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/salary/service/impl/TStatisticsLaborServiceImpl.java
View file @
0cf71411
...
@@ -25,6 +25,7 @@ import com.alibaba.excel.read.metadata.holder.ReadRowHolder;
...
@@ -25,6 +25,7 @@ import com.alibaba.excel.read.metadata.holder.ReadRowHolder;
import
com.alibaba.excel.util.ListUtils
;
import
com.alibaba.excel.util.ListUtils
;
import
com.alibaba.excel.write.metadata.WriteSheet
;
import
com.alibaba.excel.write.metadata.WriteSheet
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
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.metadata.IPage
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
...
@@ -241,6 +242,27 @@ public class TStatisticsLaborServiceImpl extends ServiceImpl<TStatisticsLaborMap
...
@@ -241,6 +242,27 @@ public class TStatisticsLaborServiceImpl extends ServiceImpl<TStatisticsLaborMap
return
null
;
return
null
;
}
}
@Override
public
R
doStatisticsLabor
()
{
String
nowMonth
=
DateUtil
.
addMonth
(
0
);
//本月
TStatisticsLabor
std
=
new
TStatisticsLabor
();
std
.
setDeclareMonth
(
nowMonth
);
QueryWrapper
<
TStatisticsLabor
>
queryWrapperSs
=
new
QueryWrapper
<>();
queryWrapperSs
.
setEntity
(
std
);
long
num
=
this
.
count
(
queryWrapperSs
);
if
(
num
>
0
)
{
return
R
.
failed
(
"上月数据已生成,不可重复生成!"
);
}
else
{
String
lastMonth
=
DateUtil
.
addMonth
(-
1
);
//上月
String
lastYear
=
lastMonth
.
substring
(
0
,
4
);
List
<
TStatisticsLabor
>
stdvoList
=
baseMapper
.
doStatisticsLabor
(
nowMonth
,
lastYear
);
for
(
TStatisticsLabor
declarer
:
stdvoList
)
{
this
.
save
(
declarer
);
}
return
R
.
ok
();
}
}
private
void
importTStatisticsLabor
(
List
<
TStatisticsLaborVo
>
excelVOList
,
List
<
ErrorMessage
>
errorMessageList
)
{
private
void
importTStatisticsLabor
(
List
<
TStatisticsLaborVo
>
excelVOList
,
List
<
ErrorMessage
>
errorMessageList
)
{
// 个性化校验逻辑
// 个性化校验逻辑
ErrorMessage
errorMsg
;
ErrorMessage
errorMsg
;
...
...
yifu-salary/yifu-salary-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/salary/util/SalaryAccountUtil.java
View file @
0cf71411
...
@@ -296,9 +296,11 @@ public class SalaryAccountUtil implements Serializable {
...
@@ -296,9 +296,11 @@ public class SalaryAccountUtil implements Serializable {
entity
.
setIsRepeat
(
CommonConstants
.
ZERO_INT
);
entity
.
setIsRepeat
(
CommonConstants
.
ZERO_INT
);
if
(
relaySalary
!=
null
)
{
if
(
relaySalary
!=
null
)
{
relaySalary
=
relaySalary
.
setScale
(
2
,
BigDecimal
.
ROUND_HALF_UP
);
relaySalary
=
relaySalary
.
setScale
(
2
,
BigDecimal
.
ROUND_HALF_UP
);
if
(
checkMap
.
get
(
entity
.
getEmpIdcard
()
+
CommonConstants
.
DOWN_LINE_STRING
+
DateUtil
.
addMonth
(
configSalary
.
getSalaryMonth
())
if
(
checkMap
.
size
()
>
CommonConstants
.
ZERO_INT
)
{
+
CommonConstants
.
DOWN_LINE_STRING
+
salaryType
+
CommonConstants
.
DOWN_LINE_STRING
+
relaySalary
)
!=
null
)
{
if
(
checkMap
.
get
(
entity
.
getEmpIdcard
()
+
CommonConstants
.
DOWN_LINE_STRING
+
DateUtil
.
addMonth
(
configSalary
.
getSalaryMonth
())
entity
.
setIsRepeat
(
CommonConstants
.
ONE_INT
);
+
CommonConstants
.
DOWN_LINE_STRING
+
salaryType
+
CommonConstants
.
DOWN_LINE_STRING
+
relaySalary
)
!=
null
)
{
entity
.
setIsRepeat
(
CommonConstants
.
ONE_INT
);
}
}
}
if
(
new
BigDecimal
(
"3500"
).
compareTo
(
relaySalary
)
==
CommonConstants
.
ZERO_INT
if
(
new
BigDecimal
(
"3500"
).
compareTo
(
relaySalary
)
==
CommonConstants
.
ZERO_INT
||
new
BigDecimal
(
"5000"
).
compareTo
(
relaySalary
)
==
CommonConstants
.
ZERO_INT
)
{
||
new
BigDecimal
(
"5000"
).
compareTo
(
relaySalary
)
==
CommonConstants
.
ZERO_INT
)
{
...
...
yifu-salary/yifu-salary-biz/src/main/resources/mapper/TStatisticsLaborMapper.xml
View file @
0cf71411
...
@@ -29,7 +29,6 @@
...
@@ -29,7 +29,6 @@
<result
property=
"declareMonth"
column=
"DECLARE_MONTH"
/>
<result
property=
"declareMonth"
column=
"DECLARE_MONTH"
/>
<result
property=
"empName"
column=
"EMP_NAME"
/>
<result
property=
"empName"
column=
"EMP_NAME"
/>
<result
property=
"empIdcard"
column=
"EMP_IDCARD"
/>
<result
property=
"empIdcard"
column=
"EMP_IDCARD"
/>
<result
property=
"workNo"
column=
"WORK_NO"
/>
<result
property=
"cardType"
column=
"CARD_TYPE"
/>
<result
property=
"cardType"
column=
"CARD_TYPE"
/>
<result
property=
"income"
column=
"INCOME"
/>
<result
property=
"income"
column=
"INCOME"
/>
<result
property=
"personalTax"
column=
"PERSONAL_TAX"
/>
<result
property=
"personalTax"
column=
"PERSONAL_TAX"
/>
...
@@ -41,7 +40,6 @@
...
@@ -41,7 +40,6 @@
a.DECLARE_MONTH,
a.DECLARE_MONTH,
a.EMP_NAME,
a.EMP_NAME,
a.EMP_IDCARD,
a.EMP_IDCARD,
a.WORK_NO,
a.CARD_TYPE,
a.CARD_TYPE,
a.INCOME,
a.INCOME,
a.PERSONAL_TAX,
a.PERSONAL_TAX,
...
@@ -64,9 +62,6 @@
...
@@ -64,9 +62,6 @@
<if
test=
"tStatisticsLabor.empIdcard != null and tStatisticsLabor.empIdcard.trim() != ''"
>
<if
test=
"tStatisticsLabor.empIdcard != null and tStatisticsLabor.empIdcard.trim() != ''"
>
AND a.EMP_IDCARD = #{tStatisticsLabor.empIdcard}
AND a.EMP_IDCARD = #{tStatisticsLabor.empIdcard}
</if>
</if>
<if
test=
"tStatisticsLabor.workNo != null and tStatisticsLabor.workNo.trim() != ''"
>
AND a.WORK_NO = #{tStatisticsLabor.workNo}
</if>
<if
test=
"tStatisticsLabor.cardType != null and tStatisticsLabor.cardType.trim() != ''"
>
<if
test=
"tStatisticsLabor.cardType != null and tStatisticsLabor.cardType.trim() != ''"
>
AND a.CARD_TYPE = #{tStatisticsLabor.cardType}
AND a.CARD_TYPE = #{tStatisticsLabor.cardType}
</if>
</if>
...
@@ -93,4 +88,15 @@
...
@@ -93,4 +88,15 @@
group by a.EMP_IDCARD,a.DECLARE_MONTH,a.EMP_NAME
group by a.EMP_IDCARD,a.DECLARE_MONTH,a.EMP_NAME
order by a.DECLARE_MONTH desc
order by a.DECLARE_MONTH desc
</select>
</select>
<!--统计-->
<select
id=
"doStatisticsLabor"
resultMap=
"tStatisticsLaborMap"
>
select
#{nowMonth} DECLARE_MONTH,a.EMP_NAME,a.EMP_IDCARD,a.SALARY_TAX PERSONAL_TAX,a.ACTUAL_SALARY INCOME,
b.UNIT_NAME DECLARE_UNIT,'一般劳务报酬所得' INCOME_ITEM,'居民身份证' CARD_TYPE
from t_salary_account a
left join t_salary_employee b on b.id = a.EMP_ID
where a.DELETE_FLAG = 0 and a.SETTLEMENT_MONTH like '${lastYear}%'
GROUP BY a.EMP_IDCARD
</select>
</mapper>
</mapper>
yifu-salary/yifu-salary-biz/src/main/resources/mapper/TStatisticsRemunerationMapper.xml
View file @
0cf71411
...
@@ -32,7 +32,6 @@
...
@@ -32,7 +32,6 @@
<result
property=
"cardType"
column=
"CARD_TYPE"
/>
<result
property=
"cardType"
column=
"CARD_TYPE"
/>
<result
property=
"income"
column=
"INCOME"
/>
<result
property=
"income"
column=
"INCOME"
/>
<result
property=
"personalTax"
column=
"PERSONAL_TAX"
/>
<result
property=
"personalTax"
column=
"PERSONAL_TAX"
/>
<result
property=
"workNo"
column=
"WORK_NO"
/>
</resultMap>
</resultMap>
<sql
id=
"Base_Column_List"
>
<sql
id=
"Base_Column_List"
>
a.ID,
a.ID,
...
@@ -42,8 +41,7 @@
...
@@ -42,8 +41,7 @@
a.EMP_IDCARD,
a.EMP_IDCARD,
a.CARD_TYPE,
a.CARD_TYPE,
a.INCOME,
a.INCOME,
a.PERSONAL_TAX,
a.PERSONAL_TAX
a.WORK_NO
</sql>
</sql>
<sql
id=
"tStatisticsRemuneration_where"
>
<sql
id=
"tStatisticsRemuneration_where"
>
<if
test=
"tStatisticsRemuneration != null"
>
<if
test=
"tStatisticsRemuneration != null"
>
...
@@ -71,9 +69,6 @@
...
@@ -71,9 +69,6 @@
<if
test=
"tStatisticsRemuneration.personalTax != null"
>
<if
test=
"tStatisticsRemuneration.personalTax != null"
>
AND a.PERSONAL_TAX = #{tStatisticsRemuneration.personalTax}
AND a.PERSONAL_TAX = #{tStatisticsRemuneration.personalTax}
</if>
</if>
<if
test=
"tStatisticsRemuneration.workNo != null and tStatisticsRemuneration.workNo.trim() != ''"
>
AND a.WORK_NO = #{tStatisticsRemuneration.workNo}
</if>
</if>
</if>
</sql>
</sql>
<!--tStatisticsRemuneration简单分页查询-->
<!--tStatisticsRemuneration简单分页查询-->
...
...
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