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
ea40aebb
Commit
ea40aebb
authored
Aug 11, 2022
by
hongguangwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
薪资导入初次提交,待优化
parent
b90a9263
Hide whitespace changes
Inline
Side-by-side
Showing
25 changed files
with
3886 additions
and
453 deletions
+3886
-453
TSalaryAccount.java
...yifu/cloud/plus/v1/yifu/salary/entity/TSalaryAccount.java
+8
-2
AccountCheckVo.java
...com/yifu/cloud/plus/v1/yifu/salary/vo/AccountCheckVo.java
+24
-0
SalaryUploadReturnVo.java
...fu/cloud/plus/v1/yifu/salary/vo/SalaryUploadReturnVo.java
+29
-0
TPaymentBySalaryVo.java
...yifu/cloud/plus/v1/yifu/salary/vo/TPaymentBySalaryVo.java
+97
-0
TPaymentVo.java
...ava/com/yifu/cloud/plus/v1/yifu/salary/vo/TPaymentVo.java
+15
-0
TSalaryAccountItemVo.java
...fu/cloud/plus/v1/yifu/salary/vo/TSalaryAccountItemVo.java
+20
-67
TSalaryAccountVo.java
...m/yifu/cloud/plus/v1/yifu/salary/vo/TSalaryAccountVo.java
+143
-259
TSalaryDetailVo.java
...om/yifu/cloud/plus/v1/yifu/salary/vo/TSalaryDetailVo.java
+38
-0
SalaryUploadController.java
...lus/v1/yifu/salary/controller/SalaryUploadController.java
+62
-0
TSalaryAccountController.java
...s/v1/yifu/salary/controller/TSalaryAccountController.java
+0
-15
TSalaryAccountItemMapper.java
.../plus/v1/yifu/salary/mapper/TSalaryAccountItemMapper.java
+10
-7
TSalaryAccountMapper.java
...loud/plus/v1/yifu/salary/mapper/TSalaryAccountMapper.java
+28
-0
SalaryUploadService.java
...loud/plus/v1/yifu/salary/service/SalaryUploadService.java
+38
-0
TSalaryAccountItemService.java
...lus/v1/yifu/salary/service/TSalaryAccountItemService.java
+27
-23
TSalaryAccountService.java
...ud/plus/v1/yifu/salary/service/TSalaryAccountService.java
+23
-2
SalaryUploadServiceImpl.java
.../v1/yifu/salary/service/impl/SalaryUploadServiceImpl.java
+1424
-0
TSalaryAccountItemServiceImpl.java
...fu/salary/service/impl/TSalaryAccountItemServiceImpl.java
+5
-0
TSalaryAccountServiceImpl.java
...1/yifu/salary/service/impl/TSalaryAccountServiceImpl.java
+22
-74
SalaryAccountUtil.java
...ifu/cloud/plus/v1/yifu/salary/util/SalaryAccountUtil.java
+897
-0
SalaryCommonUtil.java
...yifu/cloud/plus/v1/yifu/salary/util/SalaryCommonUtil.java
+542
-0
SalaryConstants.java
.../yifu/cloud/plus/v1/yifu/salary/util/SalaryConstants.java
+271
-0
TSalaryAccountItemMapper.xml
...iz/src/main/resources/mapper/TSalaryAccountItemMapper.xml
+139
-1
TSalaryAccountMapper.xml
...ry-biz/src/main/resources/mapper/TSalaryAccountMapper.xml
+19
-0
SysBaseSetInfoServiceImpl.java
...1/yifu/social/service/impl/SysBaseSetInfoServiceImpl.java
+2
-2
TForecastLibraryServiceImpl.java
...yifu/social/service/impl/TForecastLibraryServiceImpl.java
+3
-1
No files found.
yifu-salary/yifu-salary-api/src/main/java/com/yifu/cloud/plus/v1/yifu/salary/entity/TSalaryAccount.java
View file @
ea40aebb
...
...
@@ -19,6 +19,7 @@ package com.yifu.cloud.plus.v1.yifu.salary.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.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttribute
;
...
...
@@ -30,6 +31,8 @@ import org.hibernate.validator.constraints.Length;
import
javax.validation.constraints.NotBlank
;
import
java.math.BigDecimal
;
import
java.util.ArrayList
;
import
java.util.List
;
/**
* 工资报账主表(工资条)
...
...
@@ -285,13 +288,13 @@ public class TSalaryAccount extends BaseEntity {
*/
@ExcelAttribute
(
name
=
"开户行省"
)
@ExcelProperty
(
"开户行省"
)
private
Integer
bankProvince
;
private
String
bankProvince
;
/**
* 开户行市
*/
@ExcelAttribute
(
name
=
"开户行市"
)
@ExcelProperty
(
"开户行市"
)
private
Integer
bankCity
;
private
String
bankCity
;
/**
* 是否个人承担部分税费:0否1是
*/
...
...
@@ -330,4 +333,7 @@ public class TSalaryAccount extends BaseEntity {
@ExcelProperty
(
"个税-单位承担"
)
private
BigDecimal
salaryTaxUnit
;
@TableField
(
exist
=
false
)
private
List
<
TSalaryAccountItem
>
saiList
=
new
ArrayList
<>();
//工资组成部分明细
}
yifu-salary/yifu-salary-api/src/main/java/com/yifu/cloud/plus/v1/yifu/salary/vo/AccountCheckVo.java
0 → 100644
View file @
ea40aebb
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
salary
.
vo
;
import
lombok.Data
;
import
java.io.Serializable
;
import
java.math.BigDecimal
;
/**
* 报账检测vo
*
* @author hgw
* @date 2021-9-22 16:22:36
*/
@Data
public
class
AccountCheckVo
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
// 键值
private
String
title
;
// 应发
private
BigDecimal
relaySalary
;
}
yifu-salary/yifu-salary-api/src/main/java/com/yifu/cloud/plus/v1/yifu/salary/vo/SalaryUploadReturnVo.java
0 → 100644
View file @
ea40aebb
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
salary
.
vo
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.ErrorMessage
;
import
lombok.Getter
;
import
lombok.Setter
;
import
lombok.ToString
;
import
java.io.Serializable
;
import
java.util.List
;
/**
* @Description: 工资导入的返回vo
* @Author: hgw
* @Date: 2021/11/2 15:22
* @return:
**/
@Getter
@Setter
@ToString
public
class
SalaryUploadReturnVo
implements
Serializable
{
/**
* 用于返回错误信息
*/
private
List
<
ErrorMessage
>
errorInfo
;
// 重复数据
private
List
<
ErrorMessage
>
repeatInfo
;
}
yifu-salary/yifu-salary-api/src/main/java/com/yifu/cloud/plus/v1/yifu/salary/vo/TPaymentBySalaryVo.java
0 → 100644
View file @
ea40aebb
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
salary
.
vo
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttribute
;
import
lombok.Data
;
import
org.hibernate.validator.constraints.Length
;
import
java.io.Serializable
;
import
java.math.BigDecimal
;
@Data
public
class
TPaymentBySalaryVo
implements
Serializable
{
private
String
id
;
/**
* 员工身份证
*/
@Length
(
max
=
100
,
message
=
"不能超过100个字符"
)
@ExcelAttribute
(
name
=
"身份证号"
,
isNotEmpty
=
true
,
maxLength
=
100
)
private
String
empIdcard
;
/**
* 单位大病金额
*/
@ExcelAttribute
(
name
=
"单位大病金额"
)
private
BigDecimal
unitBitmailmentFee
;
/**
* 单位社保合计
*/
@ExcelAttribute
(
name
=
"单位社保合计"
)
private
BigDecimal
unitSocialSum
;
/**
* 个人社保合计
*/
@ExcelAttribute
(
name
=
"个人社保合计"
)
private
BigDecimal
personalSocialSum
;
/**
* 单位公积金费用
*/
@ExcelAttribute
(
name
=
"单位公积金费用"
)
private
BigDecimal
unitFundSum
;
/**
* 个人公积金费用
*/
@ExcelAttribute
(
name
=
"个人公积金费用"
)
private
BigDecimal
personalFundSum
;
/**
* 工资社保结算状态 0: 未结算 1: 待结算 2: 已结算
*/
@Length
(
max
=
1
,
message
=
"工资社保结算状态 0: 未结算 1: 待结算 2: 已结算不能超过1个字符"
)
@ExcelAttribute
(
name
=
"工资社保结算状态"
,
maxLength
=
1
,
isDataId
=
true
,
dataType
=
"settlement_flag"
)
private
String
salarySocialFlag
;
/**
* 工资公积金结算状态 0: 未结算 1: 待结算 2: 已结算
*/
@Length
(
max
=
1
,
message
=
"工资公积金结算状态 0: 未结算 1: 待结算 2: 已结算不能超过1个字符"
)
@ExcelAttribute
(
name
=
"工资公积金结算状态"
,
maxLength
=
1
,
isDataId
=
true
,
dataType
=
"settlement_flag"
)
private
String
salaryFundFlag
;
/**
* 社保缴纳月份
*/
@Length
(
max
=
6
,
message
=
"社保缴纳月份不能超过6个字符"
)
@ExcelAttribute
(
name
=
"社保缴纳月份"
,
maxLength
=
6
,
isInteger
=
true
)
private
String
socialPayMonth
;
/**
* 社保生成月份
*/
@Length
(
max
=
6
,
message
=
"社保生成月份不能超过6个字符"
)
@ExcelAttribute
(
name
=
"社保生成月份"
,
maxLength
=
6
,
isInteger
=
true
)
private
String
socialCreateMonth
;
/**
* 公积金缴纳月份
*/
@Length
(
max
=
6
,
message
=
"公积金缴纳月份不能超过6个字符"
)
@ExcelAttribute
(
name
=
"公积金缴纳月份"
,
maxLength
=
6
,
isInteger
=
true
)
private
String
providentPayMonth
;
/**
* 公积金生成月份
*/
@Length
(
max
=
6
,
message
=
"公积金生成月份不能超过6个字符"
)
@ExcelAttribute
(
name
=
"公积金生成月份"
,
maxLength
=
6
,
isInteger
=
true
)
private
String
providentCreateMonth
;
/**
* 部门名称
*/
@Length
(
max
=
50
,
message
=
"部门名称不能超过50个字符"
)
@ExcelAttribute
(
name
=
"部门名称"
,
isNotEmpty
=
true
,
maxLength
=
50
,
isDataId
=
true
)
private
String
settleDomainId
;
}
yifu-salary/yifu-salary-api/src/main/java/com/yifu/cloud/plus/v1/yifu/salary/vo/TPaymentVo.java
0 → 100644
View file @
ea40aebb
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
salary
.
vo
;
import
lombok.Data
;
import
java.util.List
;
/**
* @author hgw2
* @description 预估
* @date 2022/8/10
*/
@Data
public
class
TPaymentVo
{
List
<
TPaymentBySalaryVo
>
paymentList
;
}
yifu-salary/yifu-salary-api/src/main/java/com/yifu/cloud/plus/v1/yifu/salary/vo/TSalaryAccountItemVo.java
View file @
ea40aebb
/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the yifu4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
salary
.
vo
;
import
com.alibaba.excel.annotation.ExcelProperty
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.extension.activerecord.Model
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttribute
;
import
com.yifu.cloud.plus.v1.yifu.common.core.vo.RowIndex
;
import
io.swagger.v3.oas.annotations.media.Schema
;
import
lombok.Data
;
import
org.hibernate.validator.constraints.Length
;
import
javax.validation.constraints.NotBlank
;
import
java.io.Serializable
;
import
java.math.BigDecimal
;
/**
* 工资报账表附加-工资明细
*
* @author hgw
* @date 20
22-08-05 11:40:1
5
* @date 20
19-07-30 15:00:0
5
*/
@Data
public
class
TSalaryAccountItemVo
extends
RowIndex
implements
Serializable
{
public
class
TSalaryAccountItemVo
extends
Model
<
TSalaryAccountItemVo
>
{
private
static
final
long
serialVersionUID
=
1L
;
/**
* 主键
*/
@TableId
(
type
=
IdType
.
ASSIGN_ID
)
@NotBlank
(
message
=
"主键 不能为空"
)
@Length
(
max
=
32
,
message
=
"主键 不能超过32 个字符"
)
@ExcelAttribute
(
name
=
"主键"
,
isNotEmpty
=
true
,
errorInfo
=
"主键 不能为空"
,
maxLength
=
32
)
@Schema
(
description
=
"主键"
)
@ExcelProperty
(
"主键"
)
private
String
id
;
/**
* 工资报账表ID
*/
@NotBlank
(
message
=
"工资报账表ID 不能为空"
)
@Length
(
max
=
32
,
message
=
"工资报账表ID 不能超过32 个字符"
)
@ExcelAttribute
(
name
=
"工资报账表ID"
,
isNotEmpty
=
true
,
errorInfo
=
"工资报账表ID 不能为空"
,
maxLength
=
32
)
@Schema
(
description
=
"工资报账表ID"
)
@ExcelProperty
(
"工资报账表ID"
)
private
String
salaryAccountId
;
/**
* 表头名称
*/
@NotBlank
(
message
=
"表头名称 不能为空"
)
@Length
(
max
=
50
,
message
=
"表头名称 不能超过50 个字符"
)
@ExcelAttribute
(
name
=
"表头名称"
,
isNotEmpty
=
true
,
errorInfo
=
"表头名称 不能为空"
,
maxLength
=
50
)
@Schema
(
description
=
"表头名称"
)
@ExcelProperty
(
"表头名称"
)
@Length
(
max
=
50
,
message
=
"表头名称不能超过50个字符"
)
@NotBlank
(
message
=
"表头名称不能为空"
)
@ExcelAttribute
(
name
=
"表头名称"
,
isNotEmpty
=
true
,
errorInfo
=
"表头名称不能为空"
,
maxLength
=
50
)
private
String
cnName
;
/**
* JAVA属性名称
*/
@NotBlank
(
message
=
"JAVA属性名称 不能为空"
)
@Length
(
max
=
32
,
message
=
"JAVA属性名称 不能超过32 个字符"
)
@ExcelAttribute
(
name
=
"JAVA属性名称"
,
isNotEmpty
=
true
,
errorInfo
=
"JAVA属性名称 不能为空"
,
maxLength
=
32
)
@Schema
(
description
=
"JAVA属性名称"
)
@ExcelProperty
(
"JAVA属性名称"
)
@Length
(
max
=
32
,
message
=
"JAVA属性名称不能超过32个字符"
)
@NotBlank
(
message
=
"JAVA属性名称不能为空"
)
@ExcelAttribute
(
name
=
"JAVA属性名称"
,
isNotEmpty
=
true
,
errorInfo
=
"JAVA属性名称不能为空"
,
maxLength
=
32
)
private
String
javaFiedName
;
/**
* 属性值
*/
@ExcelAttribute
(
name
=
"属性值"
)
@Schema
(
description
=
"属性值"
)
@ExcelProperty
(
"属性值"
)
private
BigDecimal
salaryMoney
;
/**
* 是否进行计算扣税:1:计算;0:不计算
*/
@NotBlank
(
message
=
"是否进行计算扣税:1:计算;0:不计算 不能为空"
)
@ExcelAttribute
(
name
=
"是否进行计算扣税:1:计算;0:不计算"
,
isNotEmpty
=
true
,
errorInfo
=
"是否进行计算扣税:1:计算;0:不计算 不能为空"
)
@Schema
(
description
=
"是否进行计算扣税:1:计算;0:不计算"
)
@ExcelProperty
(
"是否进行计算扣税:1:计算;0:不计算"
)
private
Integer
isTax
;
/**
* 文本值
*/
@Length
(
max
=
500
,
message
=
"文本值 不能超过500 个字符"
)
@ExcelAttribute
(
name
=
"文本值"
,
maxLength
=
500
)
@Schema
(
description
=
"文本值"
)
@ExcelProperty
(
"文本值"
)
@Length
(
max
=
100
,
message
=
"文本值不能超过100个字符"
)
@ExcelAttribute
(
name
=
"文本值"
,
maxLength
=
100
)
private
String
textValue
;
/**
* 是否进行计算扣税:1:计算;0:不计算
*/
@NotBlank
(
message
=
"是否进行计算扣税不能为空"
)
@ExcelAttribute
(
name
=
"是否进行计算扣税"
,
isNotEmpty
=
true
,
errorInfo
=
"是否进行计算扣税不能为空"
)
private
Integer
isTax
;
}
yifu-salary/yifu-salary-api/src/main/java/com/yifu/cloud/plus/v1/yifu/salary/vo/TSalaryAccountVo.java
View file @
ea40aebb
/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the yifu4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
salary
.
vo
;
import
com.alibaba.excel.annotation.ExcelProperty
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttribute
;
import
com.yifu.cloud.plus.v1.yifu.common.core.vo.RowIndex
;
import
io.swagger.v3.oas.annotations.media.Schema
;
import
lombok.Data
;
import
org.hibernate.validator.constraints.Length
;
import
javax.validation.constraints.NotBlank
;
import
java.io.Serializable
;
import
java.math.BigDecimal
;
import
java.util.ArrayList
;
import
java.util.List
;
/**
* 工资报账主表(工资条)
* 工资报账主表(工资条)
VO
*
* @author hgw
* @date 20
22-08-05 11:40:14
* @date 20
19-07-30 15:00:05
*/
@Data
public
class
TSalaryAccountVo
extends
RowIndex
implements
Serializable
{
public
class
TSalaryAccountVo
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
/**
*
主键
*
计税月份
*/
@TableId
(
type
=
IdType
.
ASSIGN_ID
)
@NotBlank
(
message
=
"主键 不能为空"
)
@Length
(
max
=
32
,
message
=
"主键 不能超过32 个字符"
)
@ExcelAttribute
(
name
=
"主键"
,
isNotEmpty
=
true
,
errorInfo
=
"主键 不能为空"
,
maxLength
=
32
)
@Schema
(
description
=
"主键"
)
@ExcelProperty
(
"主键"
)
private
String
id
;
@Length
(
max
=
32
,
message
=
"计税月份不能超过6个字符"
)
@ExcelAttribute
(
name
=
"计税月份"
,
maxLength
=
6
)
private
String
taxMonth
;
/**
* 封面抬头
*/
@Length
(
max
=
50
,
message
=
"封面抬头
不能超过50
个字符"
)
@Length
(
max
=
50
,
message
=
"封面抬头
不能超过50
个字符"
)
@ExcelAttribute
(
name
=
"封面抬头"
,
maxLength
=
50
)
@Schema
(
description
=
"封面抬头"
)
@ExcelProperty
(
"封面抬头"
)
private
String
invoiceTitle
;
/**
* 工资表ID
*/
@NotBlank
(
message
=
"工资表ID 不能为空"
)
@Length
(
max
=
32
,
message
=
"工资表ID 不能超过32 个字符"
)
@ExcelAttribute
(
name
=
"工资表ID"
,
isNotEmpty
=
true
,
errorInfo
=
"工资表ID 不能为空"
,
maxLength
=
32
)
@Schema
(
description
=
"工资表ID"
)
@ExcelProperty
(
"工资表ID"
)
@Length
(
max
=
32
,
message
=
"工资表ID不能超过32个字符"
)
@NotBlank
(
message
=
"工资表ID不能为空"
)
@ExcelAttribute
(
name
=
"工资表ID"
,
maxLength
=
32
)
private
String
salaryFormId
;
/**
* 工资月
* 工资月
份000
*/
@NotBlank
(
message
=
"工资月 不能为空"
)
@Length
(
max
=
6
,
message
=
"工资月 不能超过6 个字符"
)
@ExcelAttribute
(
name
=
"工资月"
,
isNotEmpty
=
true
,
errorInfo
=
"工资月 不能为空"
,
maxLength
=
6
)
@Schema
(
description
=
"工资月"
)
@ExcelProperty
(
"工资月"
)
private
String
salaryMonth
;
@Length
(
max
=
6
,
message
=
"工资月份不能超过6个字符"
)
@NotBlank
(
message
=
"工资月份不能为空"
)
@ExcelAttribute
(
name
=
"工资月份"
,
isNotEmpty
=
true
,
errorInfo
=
"工资月份不能为空"
,
maxLength
=
6
)
private
String
salaryDate
;
/**
* 员工 ID
*/
@Length
(
max
=
32
,
message
=
"员工 ID 不能超过32 个字符"
)
@ExcelAttribute
(
name
=
"员工 ID"
,
maxLength
=
32
)
@Schema
(
description
=
"员工 ID"
)
@ExcelProperty
(
"员工 ID"
)
@Length
(
max
=
32
,
message
=
"员工 ID不能超过32个字符"
)
@NotBlank
(
message
=
"员工 ID不能为空"
)
@ExcelAttribute
(
name
=
"员工 ID"
,
isNotEmpty
=
true
,
errorInfo
=
"员工 ID不能为空"
,
maxLength
=
32
)
private
String
empId
;
/**
* 员工姓名
*/
@Length
(
max
=
50
,
message
=
"员工姓名 不能超过50 个字符"
)
@Length
(
max
=
50
,
message
=
"员工姓名不能超过50个字符"
)
@NotBlank
(
message
=
"员工姓名不能为空"
)
@ExcelAttribute
(
name
=
"员工姓名"
,
maxLength
=
50
)
@Schema
(
description
=
"员工姓名"
)
@ExcelProperty
(
"员工姓名"
)
private
String
empName
;
/**
* 员工编码
*/
@Length
(
max
=
32
,
message
=
"员工编码不能超过32个字符"
)
@NotBlank
(
message
=
"员工编码不能为空"
)
@ExcelAttribute
(
name
=
"员工编码"
,
maxLength
=
32
)
private
String
empNo
;
/**
* 结算部门id
*/
@Length
(
max
=
32
,
message
=
"结算部门id不能超过32个字符"
)
@NotBlank
(
message
=
"结算部门id不能为空"
)
@ExcelAttribute
(
name
=
"结算部门id"
,
isNotEmpty
=
true
,
errorInfo
=
"结算部门id不能为空"
,
maxLength
=
32
)
private
String
settleDepartId
;
/**
* 结算部门no
*/
@Length
(
max
=
50
,
message
=
"结算部门No不能超过50个字符"
)
@NotBlank
(
message
=
"结算部门No不能为空"
)
@ExcelAttribute
(
name
=
"结算部门No"
,
isNotEmpty
=
true
,
errorInfo
=
"结算部门No不能为空"
,
maxLength
=
50
)
private
String
settleDepartNo
;
/**
* 结算部门name
*/
@Length
(
max
=
50
,
message
=
"结算部门Name不能超过50个字符"
)
@NotBlank
(
message
=
"结算部门No不能为空"
)
@ExcelAttribute
(
name
=
"结算部门No"
,
isNotEmpty
=
true
,
errorInfo
=
"结算部门Name不能为空"
,
maxLength
=
50
)
private
String
settleDepartName
;
/**
* 员工身份证号
*/
@Length
(
max
=
25
,
message
=
"员工身份证号 不能超过25 个字符"
)
@ExcelAttribute
(
name
=
"员工身份证号"
,
maxLength
=
25
)
@Schema
(
description
=
"员工身份证号"
)
@ExcelProperty
(
"员工身份证号"
)
@Length
(
max
=
18
,
message
=
"员工身份证号不能超过18个字符"
)
@NotBlank
(
message
=
"员工身份证号不能为空"
)
@ExcelAttribute
(
name
=
"员工身份证号"
,
maxLength
=
18
)
private
String
empIdcard
;
/**
* 银行卡号
* 银行卡号
000
*/
@Length
(
max
=
30
,
message
=
"银行卡号
不能超过30
个字符"
)
@Length
(
max
=
30
,
message
=
"银行卡号
不能超过30
个字符"
)
@ExcelAttribute
(
name
=
"银行卡号"
,
maxLength
=
30
)
@Schema
(
description
=
"银行卡号"
)
@ExcelProperty
(
"银行卡号"
)
private
String
bankNo
;
/**
* 开户行
* 开户行
000
*/
@Length
(
max
=
50
,
message
=
"开户行
不能超过50
个字符"
)
@Length
(
max
=
50
,
message
=
"开户行
不能超过50
个字符"
)
@ExcelAttribute
(
name
=
"开户行"
,
maxLength
=
50
)
@Schema
(
description
=
"开户行"
)
@ExcelProperty
(
"开户行"
)
private
String
bankName
;
/**
* 结算部门id
* 发工资次数-
* 弃用
*/
@NotBlank
(
message
=
"结算部门id 不能为空"
)
@Length
(
max
=
32
,
message
=
"结算部门id 不能超过32 个字符"
)
@ExcelAttribute
(
name
=
"结算部门id"
,
isNotEmpty
=
true
,
errorInfo
=
"结算部门id 不能为空"
,
maxLength
=
32
)
@Schema
(
description
=
"结算部门id"
)
@ExcelProperty
(
"结算部门id"
)
private
String
deptId
;
//@NotBlank(message = "发工资次数不能为空")
@ExcelAttribute
(
name
=
"发工资次数"
)
private
Integer
salaryCount
;
/**
*
结算部门no
*
工资发放方式(0现金/1银行)/2线下000
*/
@NotBlank
(
message
=
"结算部门no 不能为空"
)
@Length
(
max
=
50
,
message
=
"结算部门no 不能超过50 个字符"
)
@ExcelAttribute
(
name
=
"结算部门no"
,
isNotEmpty
=
true
,
errorInfo
=
"结算部门no 不能为空"
,
maxLength
=
50
)
@Schema
(
description
=
"结算部门no"
)
@ExcelProperty
(
"结算部门no"
)
private
String
deptNo
;
/**
* 结算部门name
*/
@NotBlank
(
message
=
"结算部门name 不能为空"
)
@Length
(
max
=
50
,
message
=
"结算部门name 不能超过50 个字符"
)
@ExcelAttribute
(
name
=
"结算部门name"
,
isNotEmpty
=
true
,
errorInfo
=
"结算部门name 不能为空"
,
maxLength
=
50
)
@Schema
(
description
=
"结算部门name"
)
@ExcelProperty
(
"结算部门name"
)
private
String
deptName
;
/**
* 工资发放方式(0现金/1银行)/2线下
*/
@NotBlank
(
message
=
"工资发放方式(0现金/1银行)/2线下 不能为空"
)
@Length
(
max
=
1
,
message
=
"工资发放方式(0现金/1银行)/2线下 不能超过1 个字符"
)
@ExcelAttribute
(
name
=
"工资发放方式(0现金/1银行)/2线下"
,
isNotEmpty
=
true
,
errorInfo
=
"工资发放方式(0现金/1银行)/2线下 不能为空"
,
maxLength
=
1
)
@Schema
(
description
=
"工资发放方式(0现金/1银行)/2线下"
)
@ExcelProperty
(
"工资发放方式(0现金/1银行)/2线下"
)
@NotBlank
(
message
=
"工资发放方式(0现金/1银行)/2线下不能为空"
)
@ExcelAttribute
(
name
=
"工资发放方式(0现金/1银行)/2线下"
,
isNotEmpty
=
true
,
errorInfo
=
"工资发放方式(0现金/1银行)/2线下不能为空"
)
private
String
salaryStyle
;
/**
* 工资发放时间(0立即发、1暂停发)
* 工资发放时间(0立即发、1暂停发)
000
*/
@NotBlank
(
message
=
"工资发放时间(0立即发、1暂停发) 不能为空"
)
@Length
(
max
=
1
,
message
=
"工资发放时间(0立即发、1暂停发) 不能超过1 个字符"
)
@ExcelAttribute
(
name
=
"工资发放时间(0立即发、1暂停发)"
,
isNotEmpty
=
true
,
errorInfo
=
"工资发放时间(0立即发、1暂停发) 不能为空"
,
maxLength
=
1
)
@Schema
(
description
=
"工资发放时间(0立即发、1暂停发)"
)
@ExcelProperty
(
"工资发放时间(0立即发、1暂停发)"
)
@NotBlank
(
message
=
"工资发放时间(0立即发、1暂停发)不能为空"
)
@ExcelAttribute
(
name
=
"工资发放时间(0立即发、1暂停发)"
,
isNotEmpty
=
true
,
errorInfo
=
"工资发放时间(0立即发、1暂停发)不能为空"
)
private
String
salaryGiveTime
;
/**
* 发放状态 0: 未发放 1: 发放成功 2:发放失败
*/
@Length
(
max
=
1
,
message
=
"发放状态 0: 未发放 1: 发放成功 2:发放失败 不能超过1 个字符"
)
@ExcelAttribute
(
name
=
"发放状态 0: 未发放 1: 发放成功 2:发放失败"
,
maxLength
=
1
)
@Schema
(
description
=
"发放状态 0: 未发放 1: 发放成功 2:发放失败"
)
@ExcelProperty
(
"发放状态 0: 未发放 1: 发放成功 2:发放失败"
)
@NotBlank
(
message
=
"发放状态 0: 未发放 1: 发放成功 2:发放失败不能为空"
)
@ExcelAttribute
(
name
=
"发放状态 0: 未发放 1: 发放成功 2:发放失败"
,
isNotEmpty
=
true
,
errorInfo
=
"发放状态 0: 未发放 1: 发放成功 2:发放失败不能为空"
)
private
String
distributionFlag
;
/**
* 社保扣缴月份
* 社保扣缴月份
000
*/
@Length
(
max
=
20
,
message
=
"社保扣缴月份 不能超过20 个字符"
)
@ExcelAttribute
(
name
=
"社保扣缴月份"
,
maxLength
=
20
)
@Schema
(
description
=
"社保扣缴月份"
)
@ExcelProperty
(
"社保扣缴月份"
)
@Length
(
max
=
6
,
message
=
"社保扣缴月份不能超过6个字符"
)
@ExcelAttribute
(
name
=
"社保扣缴月份"
,
maxLength
=
6
)
private
String
deduSocialMonth
;
/**
* 公积金扣缴月份
* 公积金扣缴月份
000
*/
@Length
(
max
=
20
,
message
=
"公积金扣缴月份 不能超过20 个字符"
)
@ExcelAttribute
(
name
=
"公积金扣缴月份"
,
maxLength
=
20
)
@Schema
(
description
=
"公积金扣缴月份"
)
@ExcelProperty
(
"公积金扣缴月份"
)
@Length
(
max
=
6
,
message
=
"公积金扣缴月份不能超过6个字符"
)
@ExcelAttribute
(
name
=
"公积金扣缴月份"
,
maxLength
=
6
)
private
String
deduProvidentMonth
;
/**
* 表单类型0:工资;1:绩效;2:其他;3:劳务费;4:稿酬
* 财务类型(数据字典)
*/
@Length
(
max
=
1
,
message
=
"财务类型不能超过1个字符"
)
@NotBlank
(
message
=
"财务类型不能为空"
)
@ExcelAttribute
(
name
=
"财务类型"
,
isNotEmpty
=
true
,
errorInfo
=
"财务类型(数据字典)不能为空"
,
maxLength
=
1
)
private
String
salaryType
;
/**
* 是否薪资扣税:0否 1是000
*/
@NotBlank
(
message
=
"表单类型0:工资;1:绩效;2:其他;3:劳务费;4:稿酬 不能为空"
)
@Length
(
max
=
32
,
message
=
"表单类型0:工资;1:绩效;2:其他;3:劳务费;4:稿酬 不能超过32 个字符"
)
@ExcelAttribute
(
name
=
"表单类型0:工资;1:绩效;2:其他;3:劳务费;4:稿酬"
,
isNotEmpty
=
true
,
errorInfo
=
"表单类型0:工资;1:绩效;2:其他;3:劳务费;4:稿酬 不能为空"
,
maxLength
=
32
)
@Schema
(
description
=
"表单类型0:工资;1:绩效;2:其他;3:劳务费;4:稿酬"
)
@ExcelProperty
(
"表单类型0:工资;1:绩效;2:其他;3:劳务费;4:稿酬"
)
private
String
formType
;
@Length
(
max
=
1
,
message
=
"是否薪资扣税不能超过1个字符"
)
@NotBlank
(
message
=
"是否薪资扣税:0否 1是不能为空"
)
@ExcelAttribute
(
name
=
"是否薪资扣税:0否 1是"
,
isNotEmpty
=
true
,
errorInfo
=
"是否薪资扣税:0否 1是不能为空"
)
private
String
salaryTaxFlag
;
/**
* 结算月
*/
@NotBlank
(
message
=
"结算月 不能为空"
)
@Length
(
max
=
20
,
message
=
"结算月 不能超过20 个字符"
)
@ExcelAttribute
(
name
=
"结算月"
,
isNotEmpty
=
true
,
errorInfo
=
"结算月 不能为空"
,
maxLength
=
20
)
@Schema
(
description
=
"结算月"
)
@ExcelProperty
(
"结算月"
)
@Length
(
max
=
6
,
message
=
"结算月份不能超过6个字符"
)
@NotBlank
(
message
=
"结算月份不能为空"
)
@ExcelAttribute
(
name
=
"结算月份"
,
isNotEmpty
=
true
,
errorInfo
=
"结算月份不能为空"
,
maxLength
=
6
)
private
String
settlementMonth
;
/**
* 是否删除0:正常;1:已删除
*/
@NotBlank
(
message
=
"是否删除0:正常;1:已删除 不能为空"
)
@ExcelAttribute
(
name
=
"是否删除0:正常;1:已删除"
,
isNotEmpty
=
true
,
errorInfo
=
"是否删除0:正常;1:已删除 不能为空"
)
@Schema
(
description
=
"是否删除0:正常;1:已删除"
)
@ExcelProperty
(
"是否删除0:正常;1:已删除"
)
private
Integer
deleteFlag
;
* @Description: 是否删除0:未删除;1:已删除
* @Author: hgw
* @Date: 2019/8/30 18:20
* @return:
**/
@Length
(
max
=
1
,
message
=
"是否删除不能超过1个字符"
)
@NotBlank
(
message
=
"是否删除不能为空"
)
@ExcelAttribute
(
name
=
"是否删除"
,
isNotEmpty
=
true
,
errorInfo
=
"是否删除不能为空"
,
maxLength
=
1
)
private
Integer
deleteFlag
;
//0:未删除; 1:已删除
/**
* 社保优先级0:生成月;1:缴纳月
* 社保优先级0:生成月;1:缴纳月
000
*/
@NotBlank
(
message
=
"社保优先级0:生成月;1:缴纳月 不能为空"
)
@Length
(
max
=
1
,
message
=
"社保优先级0:生成月;1:缴纳月 不能超过1 个字符"
)
@ExcelAttribute
(
name
=
"社保优先级0:生成月;1:缴纳月"
,
isNotEmpty
=
true
,
errorInfo
=
"社保优先级0:生成月;1:缴纳月 不能为空"
,
maxLength
=
1
)
@Schema
(
description
=
"社保优先级0:生成月;1:缴纳月"
)
@ExcelProperty
(
"社保优先级0:生成月;1:缴纳月"
)
@NotBlank
(
message
=
"社保优先级0:生成月;1:缴纳月不能为空"
)
@Length
(
max
=
1
,
message
=
"社保优先级0:生成月;1:缴纳月不能超过1个字符"
)
@ExcelAttribute
(
name
=
"社保优先级0:生成月;1:缴纳月"
,
isNotEmpty
=
true
,
errorInfo
=
"社保优先级0:生成月;1:缴纳月不能为空"
,
maxLength
=
1
)
private
String
socialPriority
;
/**
* 公积金优先级0:生成月;1:缴纳月
* 公积金优先级0:生成月;1:缴纳月
000
*/
@NotBlank
(
message
=
"公积金优先级0:生成月;1:缴纳月 不能为空"
)
@Length
(
max
=
1
,
message
=
"公积金优先级0:生成月;1:缴纳月 不能超过1 个字符"
)
@ExcelAttribute
(
name
=
"公积金优先级0:生成月;1:缴纳月"
,
isNotEmpty
=
true
,
errorInfo
=
"公积金优先级0:生成月;1:缴纳月 不能为空"
,
maxLength
=
1
)
@Schema
(
description
=
"公积金优先级0:生成月;1:缴纳月"
)
@ExcelProperty
(
"公积金优先级0:生成月;1:缴纳月"
)
@NotBlank
(
message
=
"公积金优先级0:生成月;1:缴纳月不能为空"
)
@Length
(
max
=
1
,
message
=
"公积金优先级0:生成月;1:缴纳月不能超过1个字符"
)
@ExcelAttribute
(
name
=
"公积金优先级0:生成月;1:缴纳月"
,
isNotEmpty
=
true
,
errorInfo
=
"公积金优先级0:生成月;1:缴纳月不能为空"
,
maxLength
=
1
)
private
String
fundPriority
;
/**
* 年终奖扣税方案0:合并;1:单独
* 年终奖扣税方案0:合并;1:单独
000
*/
@NotBlank
(
message
=
"年终奖扣税方案0:合并;1:单独 不能为空"
)
@Length
(
max
=
1
,
message
=
"年终奖扣税方案0:合并;1:单独 不能超过1 个字符"
)
@ExcelAttribute
(
name
=
"年终奖扣税方案0:合并;1:单独"
,
isNotEmpty
=
true
,
errorInfo
=
"年终奖扣税方案0:合并;1:单独 不能为空"
,
maxLength
=
1
)
@Schema
(
description
=
"年终奖扣税方案0:合并;1:单独"
)
@ExcelProperty
(
"年终奖扣税方案0:合并;1:单独"
)
@NotBlank
(
message
=
"年终奖扣税方案0:合并;1:单独不能为空"
)
@Length
(
max
=
1
,
message
=
"年终奖扣税方案0:合并;1:单独不能超过1个字符"
)
@ExcelAttribute
(
name
=
"年终奖扣税方案0:合并;1:单独"
,
isNotEmpty
=
true
,
errorInfo
=
"年终奖扣税方案0:合并;1:单独不能为空"
,
maxLength
=
1
)
private
String
annualBonusType
;
/**
* 计税月份
*/
@Length
(
max
=
6
,
message
=
"计税月份 不能超过6 个字符"
)
@ExcelAttribute
(
name
=
"计税月份"
,
maxLength
=
6
)
@Schema
(
description
=
"计税月份"
)
@ExcelProperty
(
"计税月份"
)
private
String
taxMonth
;
/**
* 是否扣除社保 0:否,1:是
*/
@Length
(
max
=
1
,
message
=
"是否扣除社保 0:否,1:是 不能超过1 个字符"
)
//000
@ExcelAttribute
(
name
=
"是否扣除社保 0:否,1:是"
,
maxLength
=
1
)
@Schema
(
description
=
"是否扣除社保 0:否,1:是"
)
@ExcelProperty
(
"是否扣除社保 0:否,1:是"
)
private
String
isDeductSocial
;
/**
* 是否扣除公积金 0:否,1:是
*/
@Length
(
max
=
1
,
message
=
"是否扣除公积金 0:否,1:是 不能超过1 个字符"
)
//000
@ExcelAttribute
(
name
=
"是否扣除公积金 0:否,1:是"
,
maxLength
=
1
)
@Schema
(
description
=
"是否扣除公积金 0:否,1:是"
)
@ExcelProperty
(
"是否扣除公积金 0:否,1:是"
)
private
String
isDeductFund
;
/**
* 省
*/
@ExcelAttribute
(
name
=
"省"
)
@Schema
(
description
=
"省"
)
@ExcelProperty
(
"省"
)
@Length
(
max
=
32
,
message
=
"省不能超过32个字符"
)
@ExcelAttribute
(
name
=
"省"
,
maxLength
=
32
,
isDataId
=
true
,
isArea
=
true
,
parentField
=
""
)
private
Integer
province
;
/**
* 市
*/
@ExcelAttribute
(
name
=
"市"
)
@Schema
(
description
=
"市"
)
@ExcelProperty
(
"市"
)
@Length
(
max
=
32
,
message
=
"市不能超过32个字符"
)
@ExcelAttribute
(
name
=
"市"
,
maxLength
=
32
,
isDataId
=
true
,
isArea
=
true
,
parentField
=
"province"
)
private
Integer
city
;
/**
* 县
*/
@ExcelAttribute
(
name
=
"县"
)
@Schema
(
description
=
"县"
)
@ExcelProperty
(
"县"
)
@Length
(
max
=
32
,
message
=
"县不能超过32个字符"
)
@ExcelAttribute
(
name
=
"县"
,
maxLength
=
32
,
isDataId
=
true
,
isArea
=
true
,
parentField
=
"city"
)
private
Integer
town
;
/**
* 手机号
*/
@Length
(
max
=
11
,
message
=
"手机号 不能超过11 个字符"
)
@ExcelAttribute
(
name
=
"手机号"
,
maxLength
=
11
)
@Schema
(
description
=
"手机号"
)
@ExcelProperty
(
"手机号"
)
private
String
empPhone
;
/**
* 是否自有员工
0:否;1:
是自有员工
* 是否自有员工
:默认0:否;1:
是自有员工
*/
@ExcelAttribute
(
name
=
"是否自有员工0:否;1:是自有员工"
)
@Schema
(
description
=
"是否自有员工0:否;1:是自有员工"
)
@ExcelProperty
(
"是否自有员工0:否;1:是自有员工"
)
@Length
(
max
=
1
,
message
=
"是否自有员工不能超过1个字符"
)
@ExcelAttribute
(
name
=
"是否自有员工"
,
maxLength
=
1
)
private
Integer
ownFlag
;
/**
* 本月是否重复金额0:否;1:是重复导入的
*/
@ExcelAttribute
(
name
=
"本月是否重复金额0:否;1:是重复导入的"
)
@Schema
(
description
=
"本月是否重复金额0:否;1:是重复导入的"
)
@ExcelProperty
(
"本月是否重复金额0:否;1:是重复导入的"
)
@Length
(
max
=
1
,
message
=
"本月是否重复金额不能超过1个字符"
)
@ExcelAttribute
(
name
=
"本月是否重复金额"
,
maxLength
=
1
)
private
Integer
isRepeat
;
/**
* 开户行支行
*/
@Length
(
max
=
50
,
message
=
"开户行支行 不能超过50 个字符"
)
@ExcelAttribute
(
name
=
"开户行支行"
,
maxLength
=
50
)
@Schema
(
description
=
"开户行支行"
)
@ExcelProperty
(
"开户行支行"
)
private
String
bankSubName
;
/**
* 开户行省
*/
@ExcelAttribute
(
name
=
"开户行省"
)
@Schema
(
description
=
"开户行省"
)
@ExcelProperty
(
"开户行省"
)
private
Integer
bankProvince
;
/**
* 开户行市
*/
@ExcelAttribute
(
name
=
"开户行市"
)
@Schema
(
description
=
"开户行市"
)
@ExcelProperty
(
"开户行市"
)
private
Integer
bankCity
;
/**
* 是否个人承担部分税费:0否1是
*/
@Length
(
max
=
1
,
message
=
"是否个人承担部分税费:0否1是 不能超过1 个字符"
)
@ExcelAttribute
(
name
=
"是否个人承担部分税费:0否1是"
,
maxLength
=
1
)
@Schema
(
description
=
"是否个人承担部分税费:0否1是"
)
@ExcelProperty
(
"是否个人承担部分税费:0否1是"
)
private
String
isPersonTax
;
/**
* 应发(劳务费、稿酬)
*/
@ExcelAttribute
(
name
=
"应发(劳务费、稿酬)"
)
@Schema
(
description
=
"应发(劳务费、稿酬)"
)
@ExcelProperty
(
"应发(劳务费、稿酬)"
)
private
BigDecimal
relaySalary
;
/**
* 实发(个人实收)
*/
@ExcelAttribute
(
name
=
"实发(个人实收)"
)
@Schema
(
description
=
"实发(个人实收)"
)
@ExcelProperty
(
"实发(个人实收)"
)
private
BigDecimal
actualSalary
;
/**
* 个税(个人承担)
*/
@ExcelAttribute
(
name
=
"个税(个人承担)"
)
@Schema
(
description
=
"个税(个人承担)"
)
@ExcelProperty
(
"个税(个人承担)"
)
private
BigDecimal
salaryTax
;
/**
* 公司应发
*/
@ExcelAttribute
(
name
=
"公司应发"
)
@Schema
(
description
=
"公司应发"
)
@ExcelProperty
(
"公司应发"
)
private
BigDecimal
relaySalaryUnit
;
/**
* 个税-单位承担
*/
@ExcelAttribute
(
name
=
"个税-单位承担"
)
@Schema
(
description
=
"个税-单位承担"
)
@ExcelProperty
(
"个税-单位承担"
)
private
BigDecimal
salaryTaxUnit
;
private
List
<
TSalaryAccountItemVo
>
saiList
=
new
ArrayList
<>();
//工资组成部分明细
}
yifu-salary/yifu-salary-api/src/main/java/com/yifu/cloud/plus/v1/yifu/salary/vo/TSalaryDetailVo.java
0 → 100644
View file @
ea40aebb
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
salary
.
vo
;
import
com.yifu.cloud.plus.v1.yifu.salary.entity.TApprovalRecord
;
import
com.yifu.cloud.plus.v1.yifu.salary.entity.TSalaryAccount
;
import
com.yifu.cloud.plus.v1.yifu.salary.entity.TSalaryStandard
;
import
io.swagger.v3.oas.annotations.media.Schema
;
import
lombok.Data
;
import
java.io.Serializable
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
/**
* 工资报账主表(工资条)VO
*
* @author hgw
* @date 2019-07-30 15:00:05
*/
@Data
@Schema
(
description
=
"工资详情VO"
)
public
class
TSalaryDetailVo
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
private
TSalaryStandard
salary
=
new
TSalaryStandard
();
//工资主表
private
List
<
TSalaryAccount
>
salaryAccountList
=
new
ArrayList
<>();
//工资报账
//以下-导出需要:
private
Map
<
String
,
String
>
accountTitle
=
new
HashMap
<>();
//报账表浮动表头Map
private
List
<
String
>
titleSortList
=
new
ArrayList
<>();
//报账表浮动表头排序List
//非扣税项附件
/**
* 薪资类审核记录 fxj 2021-11-15
*/
private
List
<
TApprovalRecord
>
auditLogList
=
new
ArrayList
<>();
}
yifu-salary/yifu-salary-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/salary/controller/SalaryUploadController.java
0 → 100644
View file @
ea40aebb
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
salary
.
controller
;
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.salary.service.SalaryUploadService
;
import
com.yifu.cloud.plus.v1.yifu.salary.vo.TSalaryAccountVo
;
import
io.swagger.v3.oas.annotations.Operation
;
import
io.swagger.v3.oas.annotations.tags.Tag
;
import
lombok.RequiredArgsConstructor
;
import
org.springframework.web.bind.annotation.*
;
import
java.util.List
;
/**
* 标准薪酬上传
*
* @author hgw
* @date 2019-9-4 11:59:33
*/
@RestController
@RequiredArgsConstructor
@RequestMapping
(
"/salary"
)
@Tag
(
name
=
"标准薪酬上传"
)
public
class
SalaryUploadController
{
private
final
SalaryUploadService
salaryUploadService
;
/**
* @param jsonString Excel表-JsonString
* @param settleDepart 结算主体id
* @param configId 配置方案id
* @param salaryType 报表类型id
* @param repeatFlag 默认 0:不允许重复导入已存在系统内的数据;1:允许重复导入
* @Description:
* @Author: hgw
* @Date: 2019/9/11 15:21
* @return: com.yifu.cloud.v1.common.core.util.R
**/
@Operation
(
description
=
"上传:jsonString:表格json;settleDepart:结算主体id;configId:工资配置结算月等信息的id;salaryType:工资类型"
)
@SysLog
(
"上传薪资表"
)
@PostMapping
(
"/upload"
)
public
R
upload
(
@RequestBody
String
jsonString
,
@RequestParam
String
settleDepart
,
@RequestParam
String
configId
,
@RequestParam
String
salaryType
,
@RequestParam
int
repeatFlag
)
{
return
salaryUploadService
.
salaryUpload
(
jsonString
,
settleDepart
,
configId
,
salaryType
,
repeatFlag
);
}
/**
* @param savList 工资表volist
* @Description: 保存并提交报账表
* @Author: hgw
* @Date: 2019/9/18 18:17
* @return: com.yifu.cloud.v1.common.core.util.R
**/
@Operation
(
description
=
"保存并提交"
)
@SysLog
(
"保存并提交薪资表"
)
@PostMapping
(
"/saveAndSubmit"
)
public
R
saveAndSubmit
(
@RequestBody
List
<
TSalaryAccountVo
>
savList
)
{
return
salaryUploadService
.
saveAndSubmit
(
savList
);
}
}
yifu-salary/yifu-salary-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/salary/controller/TSalaryAccountController.java
View file @
ea40aebb
...
...
@@ -132,21 +132,6 @@ public class TSalaryAccountController {
return
R
.
ok
(
tSalaryAccountService
.
removeById
(
id
));
}
/**
* 工资报账主表(工资条) 批量导入
*
* @author hgw
* @date 2022-08-05 11:40:14
**/
@SneakyThrows
@Operation
(
description
=
"批量新增工资报账主表(工资条) hasPermission('salary_tsalaryaccount-batch-import')"
)
@SysLog
(
"批量新增工资报账主表(工资条)"
)
@PostMapping
(
"/importListAdd"
)
@PreAuthorize
(
"@pms.hasPermission('salary_tsalaryaccount-batch-import')"
)
public
R
<
List
<
ErrorMessage
>>
importListAdd
(
@RequestBody
MultipartFile
file
)
{
return
tSalaryAccountService
.
importDiy
(
file
.
getInputStream
());
}
/**
* 工资报账主表(工资条) 批量导出
*
...
...
yifu-salary/yifu-salary-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/salary/mapper/TSalaryAccountItemMapper.java
View file @
ea40aebb
...
...
@@ -13,6 +13,9 @@ import java.util.List;
import
java.util.Map
;
import
java.util.Set
;
import
java.util.List
;
/**
* 工资报账表附加-工资明细
*
...
...
@@ -21,13 +24,6 @@ import java.util.Set;
*/
@Mapper
public
interface
TSalaryAccountItemMapper
extends
BaseMapper
<
TSalaryAccountItem
>
{
/**
* 工资报账表附加-工资明细简单分页查询
*
* @param tSalaryAccountItem 工资报账表附加-工资明细
* @return
*/
IPage
<
TSalaryAccountItem
>
getTSalaryAccountItemPage
(
Page
page
,
@Param
(
"tSalaryAccountItem"
)
TSalaryAccountItem
tSalaryAccountItem
);
List
<
TSalaryAccountItem
>
getTSalaryAccountItemPage
(
@Param
(
"tSalaryAccountItem"
)
TSalaryAccountItem
tSalaryAccountItem
);
/**
...
...
@@ -158,4 +154,11 @@ public interface TSalaryAccountItemMapper extends BaseMapper<TSalaryAccountItem>
**/
Set
<
String
>
getItemSet
(
@Param
(
"salaryId"
)
String
salaryId
);
/**
* 工资报账表附加-工资明细简单分页查询
* @param tSalaryAccountItem 工资报账表附加-工资明细
* @return
*/
IPage
<
TSalaryAccountItem
>
getTSalaryAccountItemPage
(
Page
<
TSalaryAccountItem
>
page
,
@Param
(
"tSalaryAccountItem"
)
TSalaryAccountItem
tSalaryAccountItem
);
}
yifu-salary/yifu-salary-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/salary/mapper/TSalaryAccountMapper.java
View file @
ea40aebb
...
...
@@ -19,10 +19,14 @@ package com.yifu.cloud.plus.v1.yifu.salary.mapper;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.yifu.cloud.plus.v1.yifu.salary.entity.TSalaryAccount
;
import
com.yifu.cloud.plus.v1.yifu.salary.vo.AccountCheckVo
;
import
org.apache.ibatis.annotations.Mapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
/**
* 工资报账主表(工资条)
*
...
...
@@ -37,4 +41,28 @@ public interface TSalaryAccountMapper extends BaseMapper<TSalaryAccount> {
* @return
*/
IPage
<
TSalaryAccount
>
getTSalaryAccountPage
(
Page
<
TSalaryAccount
>
page
,
@Param
(
"tSalaryAccount"
)
TSalaryAccount
tSalaryAccount
);
/**
* @param settleId
* @param settleMonth
* @Description: 版本2.6.6判重:对同一“结算主体”、同一“结算月份”、同一“报表类型”、同一“工资月份”、同一“身份证号”、同一“应发金额”进行校验
*
* 校验导入数据重复的Map格式:# 身份证号_工资月份_报表类型_应发金额
*
* @Author: hgw
* @Date: 2021/9/17 18:06
* @return: java.util.List<java.lang.String>
**/
List
<
AccountCheckVo
>
getAccountCheckList
(
@Param
(
"settleId"
)
String
settleId
,
@Param
(
"settleMonth"
)
String
settleMonth
);
/**
* @param empIdCard
* @param nowYear
* @Description: 获取当前年最小计税月
* @Author: hgw
* @Date: 2022/1/19 17:56
* @return: java.lang.String
**/
String
getMinTaxMonthByNowYear
(
@Param
(
"empIdCard"
)
String
empIdCard
,
@Param
(
"nowYear"
)
int
nowYear
);
}
yifu-salary/yifu-salary-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/salary/service/SalaryUploadService.java
0 → 100644
View file @
ea40aebb
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
salary
.
service
;
import
com.baomidou.mybatisplus.extension.service.IService
;
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.TSalaryAccountVo
;
import
java.util.List
;
/**
* 标准薪酬上传
*
* @author hgw
* @date 2019-9-4 15:54:12
*/
public
interface
SalaryUploadService
extends
IService
<
TSalaryStandard
>
{
/**
* @param jsonString
* @param repeatFlag 默认 0:不允许重复导入已存在系统内的数据;1:允许重复导入
* @Description: 普通工资上传
* @Author: hgw
* @Date: 2019/9/4 15:58
* @return: com.yifu.cloud.v1.common.core.util.R
**/
R
salaryUpload
(
String
jsonString
,
String
settleDepart
,
String
configId
,
String
formType
,
int
repeatFlag
);
/**
* @param savList
* @Description: 保存并提交报账表
* @Author: hgw
* @Date: 2019/9/18 18:42
* @return: com.yifu.cloud.v1.common.core.util.R
**/
R
<
String
>
saveAndSubmit
(
List
<
TSalaryAccountVo
>
savList
);
}
yifu-salary/yifu-salary-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/salary/service/TSalaryAccountItemService.java
View file @
ea40aebb
...
...
@@ -6,6 +6,9 @@ import com.baomidou.mybatisplus.extension.service.IService;
import
com.yifu.cloud.plus.v1.yifu.salary.entity.TSalaryAccount
;
import
com.yifu.cloud.plus.v1.yifu.salary.entity.TSalaryAccountItem
;
import
java.util.List
;
import
java.util.Map
;
import
java.math.BigDecimal
;
import
java.util.List
;
import
java.util.Map
;
...
...
@@ -18,6 +21,29 @@ import java.util.Set;
* @date 2019-07-30 15:00:05
*/
public
interface
TSalaryAccountItemService
extends
IService
<
TSalaryAccountItem
>
{
/**
* @param settleDepartId
* @param settleMonth
* @param javaFiedName
* @param finallyYear 年终奖所在的结算年
* @Description: 获取报账详情信息
* @Author: hgw
* @Date: 2019/9/29 18:26
* @return: java.util.List<com.yifu.cloud.v1.hrms.api.entity.TSalaryAccountItem>
**/
List
<
TSalaryAccountItem
>
getAllTSalaryAccountItem
(
String
settleDepartId
,
String
settleMonth
,
String
javaFiedName
,
String
finallyYear
,
String
empIdcard
,
String
accountId
);
/**
* @param idCardList
* @param invoiceTitle
* @Description: 获取所有报账,组装map,工资导入使用
* @Author: hgw
* @Date: 2022/1/27 17:25
* @return: java.util.Map<java.lang.String, java.util.List < com.yifu.cloud.v1.hrms.api.entity.TSalaryAccountItem>>
**/
Map
<
String
,
List
<
TSalaryAccountItem
>>
getAllItemVoList
(
List
<
String
>
idCardList
,
String
invoiceTitle
);
/**
* 工资报账表附加-工资明细简单分页查询
...
...
@@ -29,19 +55,6 @@ public interface TSalaryAccountItemService extends IService<TSalaryAccountItem>
List
<
TSalaryAccountItem
>
getTSalaryAccountItemNoPage
(
TSalaryAccountItem
tSalaryAccountItem
);
/**
* @param settleDepartId
* @param settleMonth
* @param javaFiedName
* @param finallyYear 年终奖所在的结算年
* @Description: 获取报账详情信息
* @Author: hgw
* @Date: 2019/9/29 18:26
* @return: java.util.List<com.yifu.cloud.v1.hrms.api.entity.TSalaryAccountItem>
**/
List
<
TSalaryAccountItem
>
getAllTSalaryAccountItem
(
String
settleDepartId
,
String
settleMonth
,
String
javaFiedName
,
String
finallyYear
,
String
empIdcard
,
String
accountId
);
/**
* @param idCard
* @param maxYearMonth
...
...
@@ -53,15 +66,6 @@ public interface TSalaryAccountItemService extends IService<TSalaryAccountItem>
**/
List
<
TSalaryAccountItem
>
getEmpAllSalaryAccountItem
(
String
idCard
,
String
maxYearMonth
,
String
invoiceTitle
);
/**
* @param idCardList
* @param invoiceTitle
* @Description: 获取所有报账,组装map,工资导入使用
* @Author: hgw
* @Date: 2022/1/27 17:25
* @return: java.util.Map<java.lang.String, java.util.List < com.yifu.cloud.v1.hrms.api.entity.TSalaryAccountItem>>
**/
Map
<
String
,
List
<
TSalaryAccountItem
>>
getAllItemVoList
(
List
<
String
>
idCardList
,
String
invoiceTitle
);
/**
* @param settleDepartId 结算主体id
...
...
@@ -109,4 +113,4 @@ public interface TSalaryAccountItemService extends IService<TSalaryAccountItem>
**/
Set
<
String
>
getItemSet
(
String
salaryId
);
}
}
\ No newline at end of file
yifu-salary/yifu-salary-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/salary/service/TSalaryAccountService.java
View file @
ea40aebb
...
...
@@ -27,6 +27,7 @@ import com.yifu.cloud.plus.v1.yifu.salary.vo.TSalaryAccountSearchVo;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.InputStream
;
import
java.util.List
;
import
java.util.Map
;
/**
* 工资报账主表(工资条)
...
...
@@ -42,9 +43,29 @@ public interface TSalaryAccountService extends IService<TSalaryAccount> {
*/
IPage
<
TSalaryAccount
>
getTSalaryAccountPage
(
Page
<
TSalaryAccount
>
page
,
TSalaryAccountSearchVo
tSalaryAccount
);
R
<
List
<
ErrorMessage
>>
importDiy
(
InputStream
inputStream
);
void
listExport
(
HttpServletResponse
response
,
TSalaryAccountSearchVo
searchVo
);
List
<
TSalaryAccount
>
noPageDiy
(
TSalaryAccountSearchVo
searchVo
);
/**
* @param settleId
* @param settleMonth
* @Description: 版本2.6.6判重:对同一“结算主体”、同一“结算月份”、同一“报表类型”、同一“工资月份”、同一“身份证号”、同一“应发金额”进行校验
* 校验导入数据重复的Map格式:#身份证号_工资月份_报表类型_应发金额
* @Author: hgw
* @Date: 2021/9/17 18:06
* @return: java.util.Map<java.lang.String, java.lang.Integer>
**/
Map
<
String
,
Integer
>
getAccountCheckMap
(
String
settleId
,
String
settleMonth
);
/**
* @param empIdCard
* @param nowYear
* @Description: 获取当前年最小计税月
* @Author: hgw
* @Date: 2022/1/19 17:57
* @return: java.lang.String
**/
String
getMinTaxMonthByNowYear
(
String
empIdCard
,
int
nowYear
);
}
yifu-salary/yifu-salary-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/salary/service/impl/SalaryUploadServiceImpl.java
0 → 100644
View file @
ea40aebb
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
salary
.
service
.
impl
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
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.archives.vo.TSettleDomainSelectVo
;
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.BigDecimalUtils
;
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.R
;
import
com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser
;
import
com.yifu.cloud.plus.v1.yifu.common.dapr.config.*
;
import
com.yifu.cloud.plus.v1.yifu.common.dapr.util.HttpDaprUtil
;
import
com.yifu.cloud.plus.v1.yifu.common.security.util.SecurityUtils
;
import
com.yifu.cloud.plus.v1.yifu.salary.constants.SalaryConstants
;
import
com.yifu.cloud.plus.v1.yifu.salary.entity.*
;
import
com.yifu.cloud.plus.v1.yifu.salary.mapper.TSalaryStandardMapper
;
import
com.yifu.cloud.plus.v1.yifu.salary.service.*
;
import
com.yifu.cloud.plus.v1.yifu.salary.util.SalaryAccountUtil
;
import
com.yifu.cloud.plus.v1.yifu.salary.vo.*
;
import
lombok.AllArgsConstructor
;
import
lombok.extern.log4j.Log4j2
;
import
org.springframework.boot.context.properties.EnableConfigurationProperties
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.math.BigDecimal
;
import
java.net.URLDecoder
;
import
java.time.LocalDateTime
;
import
java.util.*
;
import
java.util.regex.Matcher
;
import
java.util.regex.Pattern
;
/**
* 标准薪酬工资表
*
* @author hgw
* @date 2019-07-30 15:00:05
*/
@Log4j2
@AllArgsConstructor
@Service
(
"salaryUploadService"
)
@EnableConfigurationProperties
({
DaprUpmsProperties
.
class
,
DaprCheckProperties
.
class
,
DaprArchivesProperties
.
class
,
DaprSocialProperties
.
class
,
DaprInsurancesProperties
.
class
})
public
class
SalaryUploadServiceImpl
extends
ServiceImpl
<
TSalaryStandardMapper
,
TSalaryStandard
>
implements
SalaryUploadService
{
private
final
DaprUpmsProperties
daprUpmsProperties
;
private
final
DaprArchivesProperties
archivesProperties
;
private
final
DaprCheckProperties
daprCheckProperties
;
private
final
DaprSocialProperties
socialProperties
;
private
final
DaprInsurancesProperties
insurancesProperties
;
private
final
TSalaryStandardService
tSalaryStandardService
;
private
final
MSalaryEstimateService
mSalaryEstimateService
;
private
final
TSalaryAccountService
tSalaryAccountService
;
private
final
TSalaryAccountItemService
tSalaryAccountItemService
;
private
final
TSalaryConfigStandardService
tSalaryConfigStandardService
;
//配置-工资
private
final
TConfigSalaryService
configSalaryService
;
private
final
TSpecialDeducationSumService
tSpecialDeducationSumService
;
private
final
TSalaryTaxConfigService
tSalaryTaxConfigService
;
private
final
TPauseSalaryService
tPauseSalaryService
;
private
final
TSalaryEmployeeService
employeeService
;
private
final
TSalaryStandardSetService
tSalaryStandardSetService
;
private
final
TOwnDeptService
tOwnDeptService
;
private
final
TSalaryLockService
salaryLockService
;
private
final
MSalaryPaymentResService
salaryPaymentResService
;
/**
* @param jsonString 客户原表数据
* @param repeatFlag 默认 0:不允许重复导入已存在系统内的数据;1:允许重复导入
* @Description: 普通工资上传
* @Author: hgw
* @Date: 2019/9/4 15:58
* @return: com.yifu.cloud.v1.common.core.util.R
**/
@Override
public
R
salaryUpload
(
String
jsonString
,
String
settleDepart
,
String
configId
,
String
salaryType
,
int
repeatFlag
)
{
if
(
Common
.
isNotNull
(
jsonString
)
&&
Common
.
isNotNull
(
settleDepart
)
&&
Common
.
isNotNull
(
configId
)
&&
Common
.
isNotNull
(
salaryType
))
{
R
<
TSettleDomainSelectVo
>
sdr
=
HttpDaprUtil
.
invokeMethodPost
(
archivesProperties
.
getAppUrl
(),
archivesProperties
.
getAppId
()
,
"/tsettledomain/inner/getSettleDomainVoById"
,
settleDepart
,
TSettleDomainSelectVo
.
class
,
SecurityConstants
.
FROM_IN
);
// 结算主体
TSettleDomainSelectVo
dept
=
null
;
if
(
sdr
!=
null
&&
sdr
.
getData
()
!=
null
)
{
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
();
Map
<
String
,
TSalaryConfigStandard
>
salaryConfigMap
=
new
HashMap
<>();
//存放所有字段
Map
<
String
,
Boolean
>
isMustMap
=
new
HashMap
<>();
//存放必填字段
for
(
TSalaryConfigStandard
sc
:
salaryAccountList
)
{
salaryConfigMap
.
put
(
sc
.
getCnName
(),
sc
);
if
(
Common
.
isNotNull
(
sc
.
getIsMustNeed
())
&&
SalaryConstants
.
IS_MUST
.
equals
(
sc
.
getIsMustNeed
()))
{
isMustMap
.
put
(
sc
.
getDbFiedName
(),
true
);
}
}
// 薪资配置-结算月、社保月等信息
TConfigSalary
configSalary
=
configSalaryService
.
getById
(
configId
);
YifuUser
user
=
SecurityUtils
.
getUser
();
if
(
null
==
user
||
null
==
user
.
getId
())
{
return
R
.
failed
(
"获取登录用户信息失败!"
);
}
try
{
jsonString
=
URLDecoder
.
decode
(
jsonString
,
"UTF-8"
).
replace
(
"="
,
""
);
SalaryAccountUtil
util1
=
new
SalaryAccountUtil
();
TSalaryEmployee
empSearch
=
new
TSalaryEmployee
();
empSearch
.
setUnitId
(
dept
.
getCustomerId
());
List
<
TSalaryEmployee
>
empList
=
employeeService
.
list
(
Wrappers
.<
TSalaryEmployee
>
query
().
lambda
()
.
eq
(
TSalaryEmployee:
:
getUnitId
,
dept
.
getCustomerId
()));
if
(
empList
==
null
)
{
return
R
.
failed
(
"该结算主体下无档案人员,请去档案添加!"
);
}
Map
<
String
,
TSalaryEmployee
>
empIdCardMap
=
new
HashMap
<>();
Map
<
String
,
TSalaryEmployee
>
empNameMap
=
new
HashMap
<>();
boolean
isDuplicateName
=
true
;
// 自有员工结算主体id,新员工使用
Map
<
String
,
Integer
>
ownDeptMap
=
tOwnDeptService
.
getOwnDeptMap
();
// 自有员工所在结算主体Map
Map
<
String
,
Integer
>
ownEmployeeMap
=
tOwnDeptService
.
getOwnEmpMap
();
TSalaryEmployee
es
;
//筛选人员,添加判断:非在职,或开户行为空,或 结算主体等于选择的结算主体且在职,都可以存入Map优先备用
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
=
false
;
}
// 2.6.6:校验导入数据重复的Map格式:#身份证号_工资月份_报表类型_应发金额
Map
<
String
,
Integer
>
checkMap
=
tSalaryAccountService
.
getAccountCheckMap
(
dept
.
getId
(),
DateUtil
.
addMonth
(
configSalary
.
getSettleMonth
()));
util1
.
getJsonStringToList
(
user
,
jsonString
,
dept
,
configSalary
,
salaryConfigMap
,
isMustMap
,
empIdCardMap
,
empNameMap
,
isDuplicateName
,
salaryType
,
invoiceTitle
,
employeeService
,
checkMap
,
repeatFlag
,
ownEmployeeMap
,
ownDeptMap
,
tSalaryAccountService
);
List
<
TSalaryAccountVo
>
saList
=
util1
.
getEntityList
();
SalaryUploadReturnVo
returnVo
=
new
SalaryUploadReturnVo
();
if
((
null
!=
util1
.
getErrorInfo
()
&&
!
util1
.
getErrorInfo
().
isEmpty
())
||
(
null
!=
util1
.
getRepeatInfo
()
&&
!
util1
.
getRepeatInfo
().
isEmpty
()))
{
returnVo
.
setErrorInfo
(
util1
.
getErrorInfo
());
returnVo
.
setRepeatInfo
(
util1
.
getRepeatInfo
());
return
R
.
failed
(
returnVo
);
}
else
{
if
(
null
!=
saList
&&
!
saList
.
isEmpty
())
{
return
R
.
ok
(
saList
);
}
else
{
return
R
.
failed
(
"导入数据不可为空"
);
}
}
}
catch
(
Exception
e
)
{
log
.
error
(
e
.
getMessage
());
return
R
.
failed
(
"数据导入解析失败!"
);
}
}
return
R
.
failed
(
"导入数据不可为空"
);
}
/**
* @param strList list
* @Description: 返回idStr
* @Author: hgw
* @Date: 2019/10/17 14:50
* @return: java.lang.String
**/
public
static
String
salaryEstimateListToStr
(
List
<
MSalaryEstimate
>
strList
)
{
StringBuilder
result
=
new
StringBuilder
();
for
(
int
i
=
0
;
i
<
strList
.
size
();
i
++)
{
if
(
i
==
0
)
{
result
.
append
(
"'"
).
append
(
strList
.
get
(
0
).
getEstimateId
()).
append
(
"'"
);
}
else
{
result
.
append
(
",'"
).
append
(
strList
.
get
(
i
).
getEstimateId
()).
append
(
"'"
);
}
}
return
result
.
toString
();
}
// 判断一个字符串是否含有数字
public
static
boolean
HasNumber
(
String
content
)
{
boolean
flag
=
false
;
Pattern
p
=
Pattern
.
compile
(
".*\\d+.*"
);
Matcher
m
=
p
.
matcher
(
content
);
if
(
m
.
matches
())
{
flag
=
true
;
}
return
flag
;
}
/**
* @param sav 报账表vo
* @param dept 结算主体
* @param user 登录人
* @Description: 新建工资主表
* @Author: hgw
* @Date: 2019/9/26 9:44
* @return: com.yifu.cloud.v1.hrms.api.entity.TSalaryStandard
**/
public
R
<
TSalaryStandard
>
saveNewTSalary
(
TSalaryAccountVo
sav
,
TSettleDomainSelectVo
dept
,
YifuUser
user
,
LocalDateTime
nowTime
)
{
TSalaryStandard
s
=
null
;
if
(
sav
!=
null
)
{
if
(
null
==
user
||
null
==
user
.
getId
())
{
return
null
;
}
s
=
new
TSalaryStandard
();
s
.
setType
(
CommonConstants
.
ZERO_INT
);
s
.
setBelongDeptId
(
String
.
valueOf
(
user
.
getDeptId
()));
if
(
Common
.
isNotNull
(
user
.
getDeptName
()))
{
s
.
setBelongDeptCode
(
user
.
getDeptName
());
}
else
{
s
.
setBelongDeptCode
(
"未获取到员工的departCode"
);
}
s
.
setCreateTime
(
nowTime
);
s
.
setDeleteFlag
(
SalaryConstants
.
NOT_DELETE
);
s
.
setDeptId
(
dept
.
getId
());
s
.
setDeptName
(
dept
.
getDepartName
());
s
.
setDeptNo
(
dept
.
getDepartNo
());
if
(
dept
.
getProvince
()
!=
null
)
{
s
.
setProvince
(
dept
.
getProvince
());
}
if
(
dept
.
getCity
()
!=
null
)
{
s
.
setCity
(
dept
.
getCity
());
}
if
(
dept
.
getTown
()
!=
null
)
{
s
.
setTown
(
dept
.
getTown
());
}
s
.
setFormType
(
sav
.
getSalaryType
());
s
.
setMoneyFrom
(
CommonConstants
.
ZERO_INT
);
s
.
setSalaryMonth
(
sav
.
getSalaryDate
());
s
.
setSettlementMonth
(
sav
.
getSettlementMonth
());
//s.setSettlementAmount()
s
.
setStatus
(
SalaryConstants
.
AUDIT_STATUS
[
0
]);
}
return
new
R
<>(
s
);
}
/**
* @param savList 报账表Vo
* @Description: 保存并提交
* @Author: hgw
* @Date: 2019/9/20 17:05
* @return: com.yifu.cloud.v1.common.core.util.R
**/
@Override
public
R
saveAndSubmit
(
List
<
TSalaryAccountVo
>
savList
)
{
if
(
Common
.
isNotNull
(
savList
)
&&
!
savList
.
isEmpty
())
{
TSalaryAccountVo
salaryAccountVo
=
savList
.
get
(
0
);
List
<
TSalaryAccountItem
>
saiList
=
null
;
//报账明细List
TSalaryAccountItem
sai
=
null
;
//报账明细
R
<
TSettleDomainSelectVo
>
sdr
=
HttpDaprUtil
.
invokeMethodPost
(
archivesProperties
.
getAppUrl
(),
archivesProperties
.
getAppId
()
,
"/tsettledomain/inner/getSettleDomainVoById"
,
salaryAccountVo
.
getSettleDepartId
(),
TSettleDomainSelectVo
.
class
,
SecurityConstants
.
FROM_IN
);
//结算主体
TSettleDomainSelectVo
dept
=
null
;
if
(
sdr
!=
null
&&
sdr
.
getData
()
!=
null
)
{
dept
=
sdr
.
getData
();
}
if
(
dept
==
null
||
dept
.
getId
()
==
null
)
{
return
R
.
failed
(
"新建工资主表失败-获取结算主体信息为空"
);
}
String
invoiceTitle
=
dept
.
getBusinessSubjectName
();
if
(
Common
.
isEmpty
(
invoiceTitle
))
{
return
R
.
failed
(
"新建工资主表失败-获取结算主体的-封面抬头-信息为空,请去<客户管理-结算主体>模块,编辑封面抬头后再导入"
);
}
YifuUser
user
=
SecurityUtils
.
getUser
();
if
(
null
==
user
||
null
==
user
.
getId
())
{
return
R
.
failed
(
"新建工资主表失败-获取登录人信息为空"
);
}
LocalDateTime
nowTime
=
LocalDateTime
.
now
();
TSalaryStandard
salary
;
R
<
TSalaryStandard
>
sr
=
this
.
saveNewTSalary
(
salaryAccountVo
,
dept
,
user
,
nowTime
);
//工资主表
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
.
doCoreSalary
(
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: hgw
* @return: com.yifu.cloud.v1.common.core.util.R<java.lang.String>
**/
@Transactional
public
R
doCoreSalary
(
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
;
TSalaryAccount
a
;
//定库:
List
<
TPaymentBySalaryVo
>
socialEstmateList
=
null
;
//社保预估库
List
<
TPaymentBySalaryVo
>
fundEstmateList
=
null
;
//公积金预估库
List
<
MSalaryPaymentRes
>
salaryPaymentList
=
salaryPaymentResService
.
list
(
Wrappers
.<
MSalaryPaymentRes
>
query
().
lambda
()
.
eq
(
MSalaryPaymentRes:
:
getDeptId
,
dept
.
getId
()));
//薪资缴费库同步表list
Map
<
String
,
MSalaryPaymentRes
>
salaryPaymentMap
=
new
HashMap
<>();
//薪资缴费库同步表Map
List
<
TPaymentBySalaryVo
>
noSalarySocialEstmateList
=
null
;
//无工资人员-社保预估库
List
<
TPaymentBySalaryVo
>
noSalaryFundEstmateList
=
null
;
//无工资人员-公积金预估库
List
<
TPaymentBySalaryVo
>
noSalarySocialEstmateListCopy
;
//无工资人员-社保预估库-循环
List
<
TPaymentBySalaryVo
>
noSalaryFundEstmateListCopy
;
//无工资人员-公积金预估库-循环
TPaymentBySalaryVo
forecast
=
new
TPaymentBySalaryVo
();
if
(
salaryPaymentList
!=
null
&&
!
salaryPaymentList
.
isEmpty
())
{
for
(
MSalaryPaymentRes
res
:
salaryPaymentList
)
{
salaryPaymentMap
.
put
(
res
.
getId
(),
res
);
}
}
//不扣社保
if
(
salaryAccountVo
!=
null
&&
!
CommonConstants
.
ZERO_STRING
.
equals
(
salaryAccountVo
.
getIsDeductSocial
()))
{
forecast
.
setSettleDomainId
(
dept
.
getId
());
if
(
SalaryConstants
.
PRIORITY_ZERO
.
equals
(
salaryAccountVo
.
getSocialPriority
()))
{
forecast
.
setSocialCreateMonth
(
salaryAccountVo
.
getDeduSocialMonth
());
}
else
if
(
SalaryConstants
.
PRIORITY_ONE
.
equals
(
salaryAccountVo
.
getSocialPriority
()))
{
forecast
.
setSocialPayMonth
(
salaryAccountVo
.
getDeduSocialMonth
());
}
else
{
forecast
.
setSocialPayMonth
(
SalaryConstants
.
PRIORITY_ZERO
);
//没优先级,则限制住
}
R
<
TPaymentVo
>
tPaymentVoR
=
HttpDaprUtil
.
invokeMethodPost
(
socialProperties
.
getAppUrl
(),
socialProperties
.
getAppId
()
,
"/tpaymentinfo/inner/selectTPaymentBySalaryVo"
,
forecast
,
TPaymentVo
.
class
,
SecurityConstants
.
FROM_IN
);
if
(
tPaymentVoR
!=
null
&&
tPaymentVoR
.
getData
()
!=
null
&&
tPaymentVoR
.
getData
().
getPaymentList
()
!=
null
)
{
socialEstmateList
=
tPaymentVoR
.
getData
().
getPaymentList
();
// 新增一步:根据同步表里的数据更新获取到的社保缴费库数据
if
(
salaryPaymentMap
!=
null
&&
!
salaryPaymentMap
.
isEmpty
())
{
MSalaryPaymentRes
res
;
for
(
TPaymentBySalaryVo
vo
:
socialEstmateList
)
{
res
=
salaryPaymentMap
.
get
(
vo
.
getId
());
if
(
res
!=
null
)
{
vo
.
setSalarySocialFlag
(
res
.
getSalarySocialFlag
());
vo
.
setSalaryFundFlag
(
res
.
getSalaryFundFlag
());
}
}
}
noSalarySocialEstmateList
=
new
ArrayList
<>();
noSalarySocialEstmateList
.
addAll
(
socialEstmateList
);
}
else
{
// TODO - 预估数据
}
}
if
(
salaryAccountVo
!=
null
&&
!
CommonConstants
.
ZERO_STRING
.
equals
(
salaryAccountVo
.
getIsDeductFund
()))
{
forecast
=
new
TPaymentBySalaryVo
();
forecast
.
setSettleDomainId
(
dept
.
getId
());
if
(
SalaryConstants
.
PRIORITY_ZERO
.
equals
(
salaryAccountVo
.
getFundPriority
()))
{
forecast
.
setProvidentCreateMonth
(
salaryAccountVo
.
getDeduProvidentMonth
());
}
else
if
(
SalaryConstants
.
PRIORITY_ONE
.
equals
(
salaryAccountVo
.
getFundPriority
()))
{
forecast
.
setProvidentPayMonth
(
salaryAccountVo
.
getDeduProvidentMonth
());
}
else
{
forecast
.
setProvidentPayMonth
(
SalaryConstants
.
PRIORITY_ZERO
);
//没优先级,则限制住
}
R
<
TPaymentVo
>
tPaymentVoR
=
HttpDaprUtil
.
invokeMethodPost
(
socialProperties
.
getAppUrl
(),
socialProperties
.
getAppId
()
,
"/tpaymentinfo/inner/selectTPaymentBySalaryVo"
,
forecast
,
TPaymentVo
.
class
,
SecurityConstants
.
FROM_IN
);
if
(
tPaymentVoR
!=
null
&&
tPaymentVoR
.
getData
()
!=
null
&&
tPaymentVoR
.
getData
().
getPaymentList
()
!=
null
)
{
fundEstmateList
=
tPaymentVoR
.
getData
().
getPaymentList
();
// 新增一步:根据同步表里的数据更新获取到的社保缴费库数据
if
(
salaryPaymentMap
!=
null
&&
!
salaryPaymentMap
.
isEmpty
())
{
MSalaryPaymentRes
res
;
for
(
TPaymentBySalaryVo
vo
:
fundEstmateList
)
{
res
=
salaryPaymentMap
.
get
(
vo
.
getId
());
if
(
res
!=
null
)
{
vo
.
setSalarySocialFlag
(
res
.
getSalarySocialFlag
());
vo
.
setSalaryFundFlag
(
res
.
getSalaryFundFlag
());
}
}
}
noSalaryFundEstmateList
=
new
ArrayList
<>();
noSalaryFundEstmateList
.
addAll
(
fundEstmateList
);
}
else
{
// TODO - 预估数据
}
}
aList
=
new
ArrayList
<>();
//true:从缴费库等扣社保标识;false:走代扣
boolean
modelPersonSocialFlag
;
boolean
modelPersonFundFlag
;
boolean
modelUnitSocialFlag
;
boolean
modelUnitFundFlag
;
BigDecimal
money
=
new
BigDecimal
(
CommonConstants
.
ZERO_STRING
);
//初始化金额备用
Set
<
String
>
socialList
=
new
HashSet
<>();
//社保需要存储的id
Set
<
String
>
fundList
=
new
HashSet
<>();
//公积金需要存储的id
Set
<
String
>
noSalarySocialList
=
new
HashSet
<>();
//无工资-社保需要存储的id
Set
<
String
>
noSalaryFundList
=
new
HashSet
<>();
//无工资-公积金需要存储的id
BigDecimal
relaySalary
;
//工资应发
BigDecimal
personalDebt
;
//个人社保、公积金欠款
//前次个人待补足
String
preMonth
=
DateUtil
.
addMonth
(-
1
);
List
<
TSalaryAccountItem
>
preSupplyList
=
tSalaryAccountItemService
.
getAllTSalaryAccountItem
(
dept
.
getId
(),
preMonth
,
SalaryConstants
.
PRE_CURRENT_SUPPLY_JAVA
,
null
,
null
,
null
);
BigDecimal
preSupply
;
//前次个人待补足
//年终奖list-验证年终奖次数
List
<
TSalaryAccountItem
>
annualBonusList
;
BigDecimal
annualBonus
;
TSpecialDeducationSum
sds
;
String
nowYearMonth
=
DateUtil
.
getCurrentDateString
(
"yyyyMM"
);
BigDecimal
sdSum
;
// 专项扣除汇总金额
BigDecimal
costReduction
;
//减除费用
String
maxYearMonth
=
null
;
//起始计税月(例如:计税月是今年之前的,则取值今年1月,否则=计税月)
List
<
TSalaryAccountItem
>
asList
;
//累计扣税
String
checkYearFinalStyle
;
//薪资和年终奖扣税方案(0:合并;1:单独)
List
<
TSalaryTaxConfig
>
personTax
=
tSalaryTaxConfigService
.
getTaxConfigByPersonList
(
new
TSalaryTaxConfig
());
List
<
TSalaryTaxConfig
>
annousTax
=
tSalaryTaxConfigService
.
getTaxConfigByAnnualBonusList
(
new
TSalaryTaxConfig
());
//结算主体-薪资配置
TDepartSettlementInfo
deptSet
=
null
;
R
<
TDepartSettlementInfo
>
deptSetR
=
HttpDaprUtil
.
invokeMethodPost
(
archivesProperties
.
getAppUrl
(),
archivesProperties
.
getAppId
()
,
"/tsettledomain/inner/getInnerBySettlementId"
,
dept
.
getId
(),
TDepartSettlementInfo
.
class
,
SecurityConstants
.
FROM_IN
);
if
(
deptSetR
==
null
||
deptSetR
.
getData
()
==
null
||
Common
.
isEmpty
(
deptSetR
.
getData
().
getId
()))
{
return
R
.
failed
(
"请去客户管理模块编辑结算主体 "
+
dept
.
getDepartName
()
+
"("
+
dept
.
getDepartNo
()
+
")的结算配置!"
);
}
else
{
deptSet
=
deptSetR
.
getData
();
}
Map
<
String
,
String
>
bankNameMap
=
new
HashMap
<>();
String
bankName
,
bankNameAll
=
""
;
int
size
=
savList
.
size
();
TSalaryAccountItem
annousSai
;
// 自有员工人数
int
ownNum
=
0
;
// 自有员工应发金额
BigDecimal
ownMoney
=
BigDecimal
.
ZERO
;
// 年终奖是否已存在 (true:已存在,不可导入)
boolean
yearEndError
=
false
;
// 年终奖错误信息合计:
StringBuilder
yearEndInfo
=
new
StringBuilder
();
List
<
String
>
idCardList
=
new
ArrayList
<>();
for
(
TSalaryAccountVo
vo
:
savList
)
{
if
(
Common
.
isNotNull
(
vo
.
getEmpIdcard
()))
{
idCardList
.
add
(
vo
.
getEmpIdcard
());
}
}
// 工资查询所需的全部list,组装Map来使用
Map
<
String
,
TSpecialDeducationSum
>
sdsMap
=
tSpecialDeducationSumService
.
getTSpecialDeducationSumMap
(
nowYearMonth
,
idCardList
);
Map
<
String
,
List
<
TSalaryAccountItem
>>
itemMap
=
tSalaryAccountItemService
.
getAllItemVoList
(
idCardList
,
invoiceTitle
);
// 是否劳务费,true:是
boolean
isLabor
=
false
;
if
(
"3"
.
equals
(
salaryAccountVo
.
getSalaryType
()))
{
isLabor
=
true
;
}
for
(
int
i
=
CommonConstants
.
ZERO_INT
;
i
<
size
;
i
++)
{
modelPersonSocialFlag
=
true
;
modelPersonFundFlag
=
true
;
modelUnitSocialFlag
=
true
;
modelUnitFundFlag
=
true
;
relaySalary
=
BigDecimal
.
ZERO
;
personalDebt
=
BigDecimal
.
ZERO
;
preSupply
=
BigDecimal
.
ZERO
;
annualBonus
=
null
;
sdSum
=
BigDecimal
.
ZERO
;
a
=
new
TSalaryAccount
();
costReduction
=
BigDecimal
.
ZERO
;
annousSai
=
null
;
try
{
SalaryAccountUtil
.
reflectionAttr
(
savList
.
get
(
i
),
a
);
if
(
SalaryConstants
.
SALARY_STYLE_BANK
.
equals
(
a
.
getSalaryStyle
())
&&
Common
.
isNotNull
(
a
.
getBankName
()))
{
bankName
=
a
.
getBankName
();
if
(
bankName
.
contains
(
"行"
))
{
bankName
=
bankName
.
substring
(
0
,
bankName
.
indexOf
(
"行"
))
+
"行"
;
}
if
(
Common
.
isEmpty
(
bankNameMap
.
get
(
bankName
)))
{
bankNameMap
.
put
(
bankName
,
"1"
);
bankNameAll
+=
bankName
+
";"
;
}
}
checkYearFinalStyle
=
a
.
getAnnualBonusType
();
if
(
Common
.
isNotNull
(
a
.
getTaxMonth
()))
{
maxYearMonth
=
DateUtil
.
getMaxYearMonth
(
a
.
getTaxMonth
());
}
else
if
(!
isLabor
)
{
return
R
.
failed
(
"获取计税月错误"
);
}
if
(
noSalarySocialEstmateList
!=
null
&&
noSalarySocialEstmateList
.
size
()
>
CommonConstants
.
ZERO_INT
)
{
noSalarySocialEstmateListCopy
=
new
ArrayList
<>();
noSalarySocialEstmateListCopy
.
addAll
(
noSalarySocialEstmateList
);
for
(
int
j
=
CommonConstants
.
ZERO_INT
;
j
<
noSalarySocialEstmateListCopy
.
size
();
j
++)
{
if
(
a
.
getEmpIdcard
().
equals
(
noSalarySocialEstmateListCopy
.
get
(
j
).
getEmpIdcard
()))
{
noSalarySocialEstmateList
.
remove
(
noSalarySocialEstmateListCopy
.
get
(
j
));
}
}
}
if
(
noSalaryFundEstmateList
!=
null
&&
noSalaryFundEstmateList
.
size
()
>
CommonConstants
.
ZERO_INT
)
{
noSalaryFundEstmateListCopy
=
new
ArrayList
<>();
noSalaryFundEstmateListCopy
.
addAll
(
noSalaryFundEstmateList
);
for
(
int
j
=
CommonConstants
.
ZERO_INT
;
j
<
noSalaryFundEstmateListCopy
.
size
();
j
++)
{
if
(
a
.
getEmpIdcard
().
equals
(
noSalaryFundEstmateListCopy
.
get
(
j
).
getEmpIdcard
()))
{
noSalaryFundEstmateList
.
remove
(
noSalaryFundEstmateListCopy
.
get
(
j
));
}
}
}
if
(
savList
.
get
(
i
).
getSaiList
()
!=
null
&&
!
savList
.
get
(
i
).
getSaiList
().
isEmpty
())
{
saiList
=
new
ArrayList
<>();
annousSai
=
null
;
for
(
int
j
=
0
;
j
<
savList
.
get
(
i
).
getSaiList
().
size
();
j
++)
{
sai
=
new
TSalaryAccountItem
();
SalaryAccountUtil
.
reflectionAttr
(
savList
.
get
(
i
).
getSaiList
().
get
(
j
),
sai
);
if
(
sai
.
getIsTax
()
==
null
)
{
sai
.
setIsTax
(
CommonConstants
.
ZERO_INT
);
}
//代扣个人社保
if
(
SalaryConstants
.
WITHHOLIDING_PERSON_SOCIAL
.
equals
(
sai
.
getJavaFiedName
()))
{
modelPersonSocialFlag
=
false
;
personalDebt
=
personalDebt
.
add
(
sai
.
getSalaryMoney
());
sai
.
setIsTax
(
CommonConstants
.
ONE_INT
);
}
if
(
SalaryConstants
.
WITHHOLIDING_PERSON_FUND
.
equals
(
sai
.
getJavaFiedName
()))
{
modelPersonFundFlag
=
false
;
personalDebt
=
personalDebt
.
add
(
sai
.
getSalaryMoney
());
sai
.
setIsTax
(
CommonConstants
.
ONE_INT
);
}
//个人代扣:李靖2020-6-16 18:16:09提的需求:
if
(
SalaryConstants
.
PDEDUCTION_JAVA
.
equals
(
sai
.
getJavaFiedName
()))
{
personalDebt
=
personalDebt
.
add
(
sai
.
getSalaryMoney
());
}
if
(
SalaryConstants
.
WITHHOLIDING_UNIT_SOCIAL
.
equals
(
sai
.
getJavaFiedName
()))
{
modelUnitSocialFlag
=
false
;
}
if
(
SalaryConstants
.
WITHHOLIDING_UNIT_FUND
.
equals
(
sai
.
getJavaFiedName
()))
{
modelUnitFundFlag
=
false
;
}
saiList
.
add
(
sai
);
//工资应发
if
(
SalaryConstants
.
RELAY_SALARY_JAVA
.
equals
(
sai
.
getJavaFiedName
()))
{
relaySalary
=
sai
.
getSalaryMoney
();
}
//减除费用
if
(
SalaryConstants
.
COST_REDUCTION_JAVA
.
equals
(
sai
.
getJavaFiedName
()))
{
costReduction
=
sai
.
getSalaryMoney
();
}
//年终奖
if
(
SalaryConstants
.
ANNUAL_BONUS_JAVA
.
equals
(
sai
.
getJavaFiedName
()))
{
annualBonus
=
sai
.
getSalaryMoney
();
annousSai
=
sai
;
}
}
if
(
Common
.
isEmpty
(
a
.
getIsDeductSocial
())
||
SalaryConstants
.
IS_DEDUCT_ONE
.
equals
(
a
.
getIsDeductSocial
()))
{
a
.
setIsDeductSocial
(
SalaryConstants
.
IS_DEDUCT_ONE
);
//社保公积金金额扣缴: true : 从库里扣除社保等;false : 走代扣
if
(
modelPersonSocialFlag
)
{
personalDebt
=
personalDebt
.
add
(
this
.
saveNewItems
(
sai
,
saiList
,
SalaryConstants
.
PERSONAL_SOCIAL
,
SalaryConstants
.
PERSONAL_SOCIAL_JAVA
,
this
.
getSocialOrFundMoneyForForecast
(
deptSet
,
a
.
getEmpIdcard
(),
socialEstmateList
,
money
,
true
,
true
,
socialList
,
fundList
),
CommonConstants
.
ONE_INT
));
}
if
(
modelUnitSocialFlag
)
{
this
.
saveNewItems
(
sai
,
saiList
,
SalaryConstants
.
UNIT_SOCIAL
,
SalaryConstants
.
UNIT_SOCIAL_JAVA
,
this
.
getSocialOrFundMoneyForForecast
(
deptSet
,
a
.
getEmpIdcard
(),
socialEstmateList
,
money
,
true
,
false
,
socialList
,
fundList
),
CommonConstants
.
ZERO_INT
);
}
}
if
(
Common
.
isEmpty
(
a
.
getIsDeductFund
())
||
SalaryConstants
.
IS_DEDUCT_ONE
.
equals
(
a
.
getIsDeductFund
()))
{
a
.
setIsDeductFund
(
SalaryConstants
.
IS_DEDUCT_ONE
);
if
(
modelPersonFundFlag
)
{
personalDebt
=
personalDebt
.
add
(
this
.
saveNewItems
(
sai
,
saiList
,
SalaryConstants
.
PERSONAL_FUND
,
SalaryConstants
.
PERSONAL_FUND_JAVA
,
this
.
getSocialOrFundMoneyForForecast
(
deptSet
,
a
.
getEmpIdcard
(),
fundEstmateList
,
money
,
false
,
true
,
socialList
,
fundList
),
CommonConstants
.
ONE_INT
));
}
if
(
modelUnitFundFlag
)
{
this
.
saveNewItems
(
sai
,
saiList
,
SalaryConstants
.
UNIT_FUND
,
SalaryConstants
.
UNIT_FUND_JAVA
,
this
.
getSocialOrFundMoneyForForecast
(
deptSet
,
a
.
getEmpIdcard
(),
fundEstmateList
,
money
,
false
,
false
,
socialList
,
fundList
),
CommonConstants
.
ZERO_INT
);
}
}
}
// 自有员工以及自有员工应发金额
if
(
Common
.
isNotNull
(
a
.
getOwnFlag
())
&&
a
.
getOwnFlag
()
==
1
)
{
ownNum
++;
ownMoney
=
ownMoney
.
add
(
relaySalary
);
}
//2019-9-29 17:56:10:与主管确认取消这一项_个人社保卡费
//account.setPsocialCardMoney(calculationPSocialCardMoney(account))// 个人社保卡费
//前次个人待补足
for
(
TSalaryAccountItem
saips
:
preSupplyList
)
{
preSupply
=
preSupply
.
add
(
saips
.
getSalaryMoney
());
}
if
(
preSupply
.
compareTo
(
SalaryConstants
.
B_ZERO
)
!=
SalaryConstants
.
EQUAL
)
{
this
.
saveNewItems
(
sai
,
saiList
,
SalaryConstants
.
PRE_CURRENT_SUPPLY
,
SalaryConstants
.
PRE_CURRENT_SUPPLY_JAVA
,
preSupply
,
CommonConstants
.
ZERO_INT
);
}
//验证应发工资的准确性
/*if (checSalaryDataAccuracy(relaySalary, saiList)) {
return R.failed("第" + (i+1) + "行:" + a.getEmpIdcard() + " -应发工资的合计总数与工资详细合计总数不匹配");
}*/
//专项信息
sds
=
sdsMap
.
get
(
a
.
getEmpIdcard
()
+
CommonConstants
.
DOWN_LINE_STRING
+
invoiceTitle
);
if
(
sds
!=
null
&&
Common
.
isNotNull
(
sds
.
getId
()))
{
//累计子女教育
sdSum
=
sdSum
.
add
(
this
.
saveNewItems
(
sai
,
saiList
,
SalaryConstants
.
SUM_CHILD_EDU_MONEY
,
SalaryConstants
.
SUM_CHILD_EDU_MONEY_JAVA
,
sds
.
getSumChildEduMoney
(),
CommonConstants
.
ZERO_INT
));
//累计住房贷款利息
sdSum
=
sdSum
.
add
(
this
.
saveNewItems
(
sai
,
saiList
,
SalaryConstants
.
SUM_HOUSING_LOAN_MONEY
,
SalaryConstants
.
SUM_HOUSING_LOAN_MONEY_JAVA
,
sds
.
getSumHousingLoanMoney
(),
CommonConstants
.
ZERO_INT
));
//累计住房租金
sdSum
=
sdSum
.
add
(
this
.
saveNewItems
(
sai
,
saiList
,
SalaryConstants
.
SUM_HOUSING_RENT_MONEY
,
SalaryConstants
.
SUM_HOUSING_RENT_MONEY_JAVA
,
sds
.
getSumHousingRentMoney
(),
CommonConstants
.
ZERO_INT
));
//累计赡养老人
sdSum
=
sdSum
.
add
(
this
.
saveNewItems
(
sai
,
saiList
,
SalaryConstants
.
SUM_SUPPORT_ELDERLY_MONEY
,
SalaryConstants
.
SUM_SUPPORT_ELDERLY_MONEY_JAVA
,
sds
.
getSumSupportElderlyMoney
(),
CommonConstants
.
ZERO_INT
));
//累计继续教育
sdSum
=
sdSum
.
add
(
this
.
saveNewItems
(
sai
,
saiList
,
SalaryConstants
.
SUM_CONTINUING_EDUCATION_MONEY
,
SalaryConstants
.
SUM_CONTINUING_EDUCATION_MONEY_JAVA
,
sds
.
getSumContinuingEducationMoney
(),
CommonConstants
.
ZERO_INT
));
//累计婴幼儿照护费用
sdSum
=
sdSum
.
add
(
this
.
saveNewItems
(
sai
,
saiList
,
SalaryConstants
.
SUM_BABY_MONEY
,
SalaryConstants
.
SUM_BABY_MONEY_JAVA
,
sds
.
getSumBabyMoney
(),
CommonConstants
.
ZERO_INT
));
//累计专项扣除总额
this
.
saveNewItems
(
sai
,
saiList
,
SalaryConstants
.
SPECIAL_DEDU_MONEY_SUM
,
SalaryConstants
.
SPECIAL_DEDU_MONEY_SUM_JAVA
,
sdSum
,
CommonConstants
.
ZERO_INT
);
}
//累计扣税list
// 2022-1-19 18:01:31 根据樊青青、王成,修改为去除姓名校验
// asList = tSalaryAccountItemService.getEmpAllSalaryAccountItem(a.getEmpIdcard(), maxYearMonth, invoiceTitle)
if
(!
isLabor
)
{
asList
=
this
.
getAsList
(
itemMap
.
get
(
a
.
getEmpIdcard
()),
Integer
.
parseInt
(
maxYearMonth
));
}
else
{
asList
=
this
.
getLaborAsList
(
itemMap
.
get
(
a
.
getEmpIdcard
()),
a
.
getSettlementMonth
());
}
//单位社保卡费-暂不加
//个人其他费用-累计tf.getOtherMoney-One\Two\Three()
//验证年终奖计算
// 2021-12-30 17:09:29王成说年终奖按结算月的年来计算
if
(
annualBonus
!=
null
&&
annualBonus
.
compareTo
(
SalaryConstants
.
B_ZERO
)
!=
SalaryConstants
.
EQUAL
)
{
annualBonusList
=
tSalaryAccountItemService
.
getAllTSalaryAccountItem
(
null
,
null
,
SalaryConstants
.
ANNUAL_BONUS_JAVA
,
a
.
getSettlementMonth
().
substring
(
0
,
4
),
a
.
getEmpIdcard
(),
null
);
if
(
annualBonusList
!=
null
&&
annualBonusList
.
size
()
>
CommonConstants
.
ZERO_INT
)
{
if
(!
yearEndError
)
{
yearEndError
=
true
;
yearEndInfo
.
append
(
"以下人员,年终奖重复发放(一个结算年只能发一次): ||"
);
}
yearEndInfo
.
append
(
"第"
+
(
i
+
2
)
+
"行:【"
+
a
.
getEmpIdcard
()
+
"】 ||"
);
}
else
{
//年终奖优化方案 2:自动计算
if
(
CommonConstants
.
TWO_STRING
.
equals
(
checkYearFinalStyle
))
{
checkYearFinalStyle
=
checkYearFinalStyle
(
isActual
,
saiList
,
checkYearFinalStyle
,
asList
,
sdSum
,
costReduction
,
personTax
,
sai
,
saiList
,
relaySalary
,
annualBonus
,
annousTax
);
}
//年终奖单独扣税
if
(
CommonConstants
.
ONE_STRING
.
equals
(
checkYearFinalStyle
))
{
if
(!
isActual
)
{
personalDebt
=
personalDebt
.
add
(
this
.
saveNewItems
(
sai
,
saiList
,
SalaryConstants
.
ANNUAL_BONUS_TAX
,
SalaryConstants
.
ANNUAL_BONUS_TAX_JAVA
,
calculation2FinalSalary
(
annualBonus
,
annousTax
),
CommonConstants
.
ZERO_INT
));
}
else
{
this
.
saveNewItems
(
sai
,
saiList
,
SalaryConstants
.
ANNUAL_BONUS_TAX
,
SalaryConstants
.
ANNUAL_BONUS_TAX_JAVA
,
calculation2FinalSalary
(
annualBonus
,
annousTax
),
CommonConstants
.
ZERO_INT
);
}
if
(
annousSai
!=
null
)
{
annousSai
.
setIsTax
(
CommonConstants
.
ONE_INT
);
}
}
}
}
// 薪资扣税 1:扣税
//if (Common.isNotNull(a.getSalaryTaxFlag()) && CommonConstants.ONE.equals(a.getSalaryTaxFlag())) {
// 应发顺推个税
if
(!
isActual
)
{
personalDebt
=
personalDebt
.
add
(
this
.
saveNewItems
(
sai
,
saiList
,
SalaryConstants
.
SALARY_TAX
,
SalaryConstants
.
SALARY_TAX_JAVA
,
calculation2PersonSalary
(
isActual
,
saiList
,
checkYearFinalStyle
,
asList
,
sdSum
,
costReduction
,
personTax
,
sai
,
saiList
,
relaySalary
),
CommonConstants
.
ZERO_INT
));
}
else
{
// 实发倒推个税应发
if
(!
isLabor
)
{
this
.
saveNewItems
(
sai
,
saiList
,
SalaryConstants
.
SALARY_TAX
,
SalaryConstants
.
SALARY_TAX_JAVA
,
calculation2PersonSalary
(
isActual
,
saiList
,
checkYearFinalStyle
,
asList
,
sdSum
,
costReduction
,
personTax
,
sai
,
saiList
,
relaySalary
),
CommonConstants
.
ZERO_INT
);
}
else
{
// 实发劳务费,按月累计扣税 2022-3-2 17:32:40 樊青青提的需求
this
.
saveNewItems
(
sai
,
saiList
,
SalaryConstants
.
SALARY_TAX
,
SalaryConstants
.
SALARY_TAX_JAVA
,
calculation2Labor
(
saiList
,
asList
,
saiList
),
CommonConstants
.
ZERO_INT
);
}
}
//}
if
(!
isActual
)
{
//导入应发,顺推实发
// 个人实发合计
this
.
saveNewItems
(
sai
,
saiList
,
SalaryConstants
.
ACTUAL_SALARY_SUM
,
SalaryConstants
.
ACTUAL_SALARY_SUM_JAVA
,
calculation
(
relaySalary
,
saiList
),
CommonConstants
.
ZERO_INT
);
}
//计算个人社保、公积金欠款————工资不够扣缴社保的
if
(
relaySalary
.
compareTo
(
personalDebt
)
==
SalaryConstants
.
LESS_THAN
)
{
this
.
saveNewItems
(
sai
,
saiList
,
SalaryConstants
.
PERSONAL_DEBT
,
SalaryConstants
.
PERSONAL_DEBT_JAVA
,
relaySalary
.
subtract
(
personalDebt
),
CommonConstants
.
ZERO_INT
);
}
a
.
setSaiList
(
saiList
);
aList
.
add
(
a
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
if
(
yearEndError
)
{
return
new
R
<>(
CommonConstants
.
TWO_INT
,
"年终奖重复"
,
yearEndInfo
.
toString
());
}
salary
.
setOwnNums
(
ownNum
);
salary
.
setOwnMoney
(
ownMoney
);
/*if (Common.isNotNull(bankNameAll) && bankNameAll.length() > 1000) {
return R.failed("请检查档案的开户行与卡号是否反了,封面的开户行已超长!");
}*/
// 无工资人员社保公积金计算:
BigDecimal
noSalaryPersonSocial
=
this
.
getNoSalarySocialOrFundMoneyForForecast
(
noSalarySocialEstmateList
,
money
,
true
,
true
,
noSalarySocialList
,
noSalaryFundList
);
BigDecimal
noSalaryUnitSocial
=
this
.
getNoSalarySocialOrFundMoneyForForecast
(
noSalarySocialEstmateList
,
money
,
true
,
false
,
noSalarySocialList
,
noSalaryFundList
);
BigDecimal
noSalaryPersonFund
=
this
.
getNoSalarySocialOrFundMoneyForForecast
(
noSalaryFundEstmateList
,
money
,
false
,
true
,
noSalarySocialList
,
noSalaryFundList
);
BigDecimal
noSalaryUnitFund
=
this
.
getNoSalarySocialOrFundMoneyForForecast
(
noSalaryFundEstmateList
,
money
,
false
,
false
,
noSalarySocialList
,
noSalaryFundList
);
TSalaryDetailVo
salaryDetailVo
=
new
TSalaryDetailVo
();
salaryDetailVo
.
setSalaryAccountList
(
aList
);
BigDecimal
buyTakingRisksPay
=
SalaryConstants
.
B_ZERO
;
String
takingBalanceIds
=
""
;
//组件结算单:
// 版本2.6.9:2021-11-4 11:11:20樊青青要求去除总校验,改为每个人提示重复导入,hgw变更
// 版本2.7.3.3 2022-1-13 20:54:34 洪光武变更:不同步缴费库,改为存放在同步表,定时任务更新(或社保服务变更缴费库时更新)
/*String str = SalaryCommonUtil.setToStrEasy(socialList);
if (Common.isNotNull(str)) {
//更新社保状态为-待结算
R<String> socialR = archivesProperties.updatePaymentSocialStatusByIdStr(str, CommonConstants.ONE, SecurityConstants.FROM_IN);
if (socialR == null || socialR.getCode() != CommonConstants.SUCCESS) {
throw new RuntimeException((null == socialR ? "调用社保同步结算中状态服务异常,请重试!" : socialR.getMsg()));
}
}
str = SalaryCommonUtil.setToStrEasy(fundList);
if (Common.isNotNull(str)) {
//更新公积金状态为-待结算
R<String> fundR = archivesProperties.updatePaymentFundStatusByIdStr(str, CommonConstants.ONE, SecurityConstants.FROM_IN);
if (fundR == null || fundR.getCode() != CommonConstants.SUCCESS) {
throw new RuntimeException((null == fundR ? "调用公积金同步结算中状态服务异常,请重试!" : fundR.getMsg()));
}
}*/
//salary.setSettlementAmount();
//保存工资表
tSalaryStandardService
.
save
(
salary
);
// 获取上一个工资条顺序,复制:
tSalaryStandardSetService
.
copyLastSetByDeptId
(
salary
.
getId
(),
dept
.
getId
(),
String
.
valueOf
(
user
.
getId
()));
// 保存后,修改结算预警统计中的结算状态
List
<
String
>
deptIdList
=
new
ArrayList
<>();
deptIdList
.
add
(
dept
.
getId
());
salaryDetailVo
.
setSalary
(
salary
);
MSalaryEstimate
se
;
// 新增一步:增加同步表
MSalaryPaymentRes
res
;
Map
<
String
,
MSalaryPaymentRes
>
saveResMap
=
new
HashMap
<>();
if
(
socialList
!=
null
&&
!
socialList
.
isEmpty
())
{
for
(
String
estId
:
socialList
)
{
se
=
new
MSalaryEstimate
();
se
.
setSalaryId
(
salary
.
getId
());
se
.
setEstimateId
(
estId
);
se
.
setIsSocial
(
SalaryConstants
.
IS_SOCIAL_ZERO
);
se
.
setIsNoSalary
(
SalaryConstants
.
NOT_IS_NO_SALARY_ZERO
);
mSalaryEstimateService
.
save
(
se
);
res
=
salaryPaymentMap
.
get
(
estId
);
if
(
res
==
null
)
{
res
=
new
MSalaryPaymentRes
();
res
.
setId
(
estId
);
res
.
setDeptId
(
dept
.
getId
());
}
res
.
setSalarySocialFlag
(
CommonConstants
.
ONE_STRING
);
saveResMap
.
put
(
estId
,
res
);
}
}
if
(
fundList
!=
null
&&
!
fundList
.
isEmpty
())
{
for
(
String
estId
:
fundList
)
{
se
=
new
MSalaryEstimate
();
se
.
setSalaryId
(
salary
.
getId
());
se
.
setEstimateId
(
estId
);
se
.
setIsSocial
(
SalaryConstants
.
IS_FUND_ONE
);
se
.
setIsNoSalary
(
SalaryConstants
.
NOT_IS_NO_SALARY_ZERO
);
mSalaryEstimateService
.
save
(
se
);
res
=
saveResMap
.
get
(
estId
);
if
(
res
==
null
)
{
res
=
salaryPaymentMap
.
get
(
estId
);
}
if
(
res
==
null
)
{
res
=
new
MSalaryPaymentRes
();
res
.
setId
(
estId
);
res
.
setDeptId
(
dept
.
getId
());
}
res
.
setSalaryFundFlag
(
CommonConstants
.
ONE_STRING
);
saveResMap
.
put
(
estId
,
res
);
}
}
// 开始更新res
if
(
saveResMap
!=
null
&&
!
saveResMap
.
isEmpty
())
{
Iterator
<
MSalaryPaymentRes
>
iter
=
saveResMap
.
values
().
iterator
();
while
(
iter
.
hasNext
())
{
res
=
iter
.
next
();
salaryPaymentResService
.
saveOrUpdate
(
res
);
}
}
if
(
noSalarySocialList
!=
null
&&
!
noSalarySocialList
.
isEmpty
())
{
for
(
String
estId
:
noSalarySocialList
)
{
se
=
new
MSalaryEstimate
();
se
.
setSalaryId
(
salary
.
getId
());
se
.
setEstimateId
(
estId
);
se
.
setIsSocial
(
SalaryConstants
.
IS_SOCIAL_ZERO
);
se
.
setIsNoSalary
(
SalaryConstants
.
IS_NO_SALARY_ONE
);
mSalaryEstimateService
.
save
(
se
);
}
}
if
(
noSalaryFundList
!=
null
&&
!
noSalaryFundList
.
isEmpty
())
{
for
(
String
estId
:
noSalaryFundList
)
{
se
=
new
MSalaryEstimate
();
se
.
setSalaryId
(
salary
.
getId
());
se
.
setEstimateId
(
estId
);
se
.
setIsSocial
(
SalaryConstants
.
IS_FUND_ONE
);
se
.
setIsNoSalary
(
SalaryConstants
.
IS_NO_SALARY_ONE
);
mSalaryEstimateService
.
save
(
se
);
}
}
TPauseSalary
ps
;
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
);
}
//暂停发
if
(
SalaryConstants
.
SALARY_GIVE_TIME_VALUE
.
equals
(
account
.
getSalaryGiveTime
()))
{
ps
=
new
TPauseSalary
();
ps
.
setBalance
(
money
);
ps
.
setName
(
account
.
getEmpName
());
ps
.
setIdCard
(
account
.
getEmpIdcard
());
ps
.
setBankName
(
account
.
getBankName
());
ps
.
setBankNo
(
account
.
getBankNo
());
ps
.
setCreateTime
(
nowTime
);
ps
.
setCreateBy
(
user
.
getId
());
ps
.
setSettleDepartId
(
dept
.
getId
());
ps
.
setSettleDepartNo
(
dept
.
getDepartNo
());
ps
.
setSettleDepartName
(
dept
.
getDepartName
());
ps
.
setSalaryFormId
(
salary
.
getId
());
ps
.
setSalaryAccountId
(
account
.
getId
());
ps
.
setSalaryDate
(
account
.
getSalaryMonth
());
ps
.
setSettleDate
(
account
.
getSettlementMonth
());
ps
.
setType
(
SalaryConstants
.
PAUSE_TYPE
[
0
]);
tPauseSalaryService
.
save
(
ps
);
}
}
//批量更新商险
//批量更新商险预估单
return
R
.
ok
(
salaryDetailVo
);
}
/**
* @param itemList
* @param maxYearMonth
* @Description: 循环获取符合条件的报账
* @Author: hgw
* @Date: 2022/1/27 17:32
* @return: java.util.List<com.yifu.cloud.v1.hrms.api.entity.TSalaryAccountItem>
**/
private
List
<
TSalaryAccountItem
>
getAsList
(
List
<
TSalaryAccountItem
>
itemList
,
int
maxYearMonth
)
{
List
<
TSalaryAccountItem
>
backList
=
new
ArrayList
<>();
if
(
itemList
!=
null
&&
!
itemList
.
isEmpty
())
{
for
(
TSalaryAccountItem
item
:
itemList
)
{
if
(!
"3"
.
equals
(
item
.
getSalaryType
())
&&
Integer
.
parseInt
(
item
.
getSettlementMonth
())
>=
maxYearMonth
)
{
backList
.
add
(
item
);
}
}
}
return
backList
;
}
/**
* @param itemList
* @param settleMonth
* @Description: 循环获取符合条件的报账
* @Author: hgw
* @Date: 2022/1/27 17:32
* @return: java.util.List<com.yifu.cloud.v1.hrms.api.entity.TSalaryAccountItem>
**/
private
List
<
TSalaryAccountItem
>
getLaborAsList
(
List
<
TSalaryAccountItem
>
itemList
,
String
settleMonth
)
{
List
<
TSalaryAccountItem
>
backList
=
new
ArrayList
<>();
if
(
itemList
!=
null
&&
!
itemList
.
isEmpty
())
{
for
(
TSalaryAccountItem
item
:
itemList
)
{
if
(
"3"
.
equals
(
item
.
getSalaryType
())
&&
settleMonth
.
equals
(
item
.
getSettlementMonth
()))
{
backList
.
add
(
item
);
}
}
}
return
backList
;
}
/**
* @param realSalary 应发工资
* @param saiList 报账详情表list
* @Description: 计算个人实发合计
* @Author: hgw
* @Date: 2019/10/9 15:14
* @return: java.math.BigDecimal
**/
private
static
BigDecimal
calculation
(
BigDecimal
realSalary
,
List
<
TSalaryAccountItem
>
saiList
)
{
// 实际发放工资 = 应发工资合计-
// 个人社保扣缴 -个人公积金扣缴-薪资扣税-年终奖扣税-代扣风险抵押金
// -个人其他费用(就是工资表中的其他费用1+其他费用2+其他费用3) -前次个人待补足 -单位补足扣返
// -个人代扣-免个税个人代扣 - 企业(职业)年金 - 代扣个人社保 - 代扣个人公积金
// -个人社保卡费(暂无)
BigDecimal
sum
=
SalaryConstants
.
B_ZERO
;
for
(
TSalaryAccountItem
item
:
saiList
)
{
if
(
SalaryConstants
.
PERSONAL_SOCIAL_JAVA
.
equals
(
item
.
getJavaFiedName
())
||
SalaryConstants
.
PERSONAL_FUND_JAVA
.
equals
(
item
.
getJavaFiedName
())
||
SalaryConstants
.
SALARY_TAX_JAVA
.
equals
(
item
.
getJavaFiedName
())
||
SalaryConstants
.
ANNUAL_BONUS_TAX_JAVA
.
equals
(
item
.
getJavaFiedName
())
||
SalaryConstants
.
RISK_MORTGAGE_MONEY_JAVA
.
equals
(
item
.
getJavaFiedName
())
||
SalaryConstants
.
OTHER_MONEY_ONE_JAVA
.
equals
(
item
.
getJavaFiedName
())
||
SalaryConstants
.
OTHER_MONEY_TWO_JAVA
.
equals
(
item
.
getJavaFiedName
())
||
SalaryConstants
.
OTHER_MONEY_THREE_JAVA
.
equals
(
item
.
getJavaFiedName
())
||
SalaryConstants
.
PRE_CURRENT_SUPPLY_JAVA
.
equals
(
item
.
getJavaFiedName
())
||
SalaryConstants
.
UNIT_SUPPLY_JAVA
.
equals
(
item
.
getJavaFiedName
())
||
SalaryConstants
.
PDEDUCTION_JAVA
.
equals
(
item
.
getJavaFiedName
())
||
SalaryConstants
.
EXEMPTION_PERSION_TAX_JAVA
.
equals
(
item
.
getJavaFiedName
())
||
SalaryConstants
.
ENTERPRISE_ANNUITY_JAVA
.
equals
(
item
.
getJavaFiedName
())
||
SalaryConstants
.
WITHHOLIDING_PERSON_SOCIAL
.
equals
(
item
.
getJavaFiedName
())
||
SalaryConstants
.
WITHHOLIDING_PERSON_FUND
.
equals
(
item
.
getJavaFiedName
()))
{
sum
=
sum
.
add
(
item
.
getSalaryMoney
()).
setScale
(
SalaryConstants
.
PLACES
,
BigDecimal
.
ROUND_HALF_UP
);
}
}
sum
=
realSalary
.
subtract
(
sum
).
setScale
(
SalaryConstants
.
PLACES
,
BigDecimal
.
ROUND_HALF_UP
);
if
(
sum
.
compareTo
(
SalaryConstants
.
B_ZERO
)
==
SalaryConstants
.
LESS_THAN
)
{
return
SalaryConstants
.
B_ZERO
;
}
else
{
return
sum
;
}
}
/**
* @param yearFinal 年终奖
* @param annousTax 税率
* @Description: 计算年终奖个税
* @Author: hgw
* @Date: 2019/10/8 15:11
* @return: java.math.BigDecimal
**/
private
static
BigDecimal
calculation2FinalSalary
(
BigDecimal
yearFinal
,
List
<
TSalaryTaxConfig
>
annousTax
)
{
//年终奖
if
(
yearFinal
!=
null
&&
yearFinal
.
compareTo
(
SalaryConstants
.
B_ZERO
)
==
SalaryConstants
.
MORE_THAN
&&
annousTax
!=
null
&&
annousTax
.
size
()
>
CommonConstants
.
ZERO_INT
)
{
BigDecimal
month
=
yearFinal
.
divide
(
SalaryConstants
.
B_TWELVE
,
SalaryConstants
.
TAX_FEE_PLACES
,
BigDecimal
.
ROUND_HALF_UP
);
// 应纳税额
for
(
TSalaryTaxConfig
sub
:
annousTax
)
{
if
(
month
.
compareTo
(
sub
.
getMinIncome
())
==
SalaryConstants
.
MORE_THAN
&&
month
.
compareTo
(
sub
.
getMaxIncome
())
!=
SalaryConstants
.
MORE_THAN
)
{
return
yearFinal
.
multiply
(
new
BigDecimal
(
sub
.
getWithholdingRate
()).
divide
(
SalaryConstants
.
B_ONEHUNDRED
,
SalaryConstants
.
TAX_FEE_PLACES
,
BigDecimal
.
ROUND_HALF_UP
))
.
subtract
(
sub
.
getQuickDeducation
());
}
}
}
return
SalaryConstants
.
B_ZERO
;
}
/**
* @param sai 报账明细
* @param saiList 报账明细list
* @param cnName 中文名-表头名
* @param javaName 属性
* @param money 金额
* @param isTax 是否进行计算扣税:1:计算;0:不计算
* @Description: 保存报账明细
* @Author: hgw
* @Date: 2019/9/30 17:02
* @return: java.math.BigDecimal - 报账明细金额
**/
private
BigDecimal
saveNewItems
(
TSalaryAccountItem
sai
,
List
<
TSalaryAccountItem
>
saiList
,
String
cnName
,
String
javaName
,
BigDecimal
money
,
Integer
isTax
)
{
sai
=
new
TSalaryAccountItem
();
sai
.
setCnName
(
cnName
);
sai
.
setJavaFiedName
(
javaName
);
if
(
money
==
null
)
{
money
=
new
BigDecimal
(
"0"
);
}
sai
.
setSalaryMoney
(
money
);
if
(
isTax
!=
null
)
{
sai
.
setIsTax
(
isTax
);
}
else
{
sai
.
setIsTax
(
CommonConstants
.
ZERO_INT
);
}
saiList
.
add
(
sai
);
return
money
;
}
/**
* @param estmateList 预估库数据列表
* @param idNumber 身份证
* @param money 金额
* @param isSocial true:社保 false:公积金
* @param isPerson true:个人 false:单位
* @param socialList 预估库id,社保list
* @param fundList 预估库id,公积金list
* @Description: 获取预估库-金额
* @Author: hgw
* @Date: 2019/9/26 15:38
* @return: java.math.BigDecimal
**/
public
BigDecimal
getSocialOrFundMoneyForForecast
(
TDepartSettlementInfo
deptSet
,
String
idNumber
,
List
<
TPaymentBySalaryVo
>
estmateList
,
BigDecimal
money
,
boolean
isSocial
,
boolean
isPerson
,
Set
<
String
>
socialList
,
Set
<
String
>
fundList
)
{
money
=
SalaryConstants
.
B_ZERO
;
BigDecimal
sub
=
SalaryConstants
.
B_ZERO
;
if
(
isSocial
)
{
if
(
deptSet
.
getUnitSeriousIllnessProp
()
!=
null
&&
deptSet
.
getUnitSeriousIllnessProp
().
compareTo
(
SalaryConstants
.
B_ONEHUNDRED
)
==
SalaryConstants
.
LESS_THAN
)
{
sub
=
(
new
BigDecimal
(
"100"
).
subtract
(
deptSet
.
getUnitSeriousIllnessProp
()))
.
divide
(
SalaryConstants
.
B_ONEHUNDRED
,
SalaryConstants
.
PLACES
,
BigDecimal
.
ROUND_HALF_UP
);
}
//sub = sub.divide(SalaryConstants.B_ONEHUNDRED, SalaryConstants.PLACES, BigDecimal.ROUND_HALF_UP)
}
if
(
estmateList
!=
null
&&
estmateList
.
size
()
>
CommonConstants
.
ZERO_INT
)
{
money
=
money
.
setScale
(
SalaryConstants
.
PLACES
,
BigDecimal
.
ROUND_HALF_UP
);
for
(
TPaymentBySalaryVo
m
:
estmateList
)
{
if
(
Common
.
isNotNull
(
idNumber
)
&&
idNumber
.
equals
(
m
.
getEmpIdcard
()))
{
//社保
if
(
isSocial
&&
(!
Common
.
isNotNull
(
m
.
getSalarySocialFlag
())
||
CommonConstants
.
ZERO_STRING
.
equals
(
m
.
getSalarySocialFlag
()))
&&
(
m
.
getPersonalSocialSum
()
!=
null
||
m
.
getUnitSocialSum
()
!=
null
))
{
if
(
isPerson
&&
m
.
getPersonalSocialSum
()
!=
null
)
{
money
=
money
.
add
(
m
.
getPersonalSocialSum
());
if
(
sub
.
compareTo
(
SalaryConstants
.
B_ZERO
)
!=
SalaryConstants
.
EQUAL
&&
m
.
getUnitBitmailmentFee
()
!=
null
)
{
money
=
money
.
add
(
m
.
getUnitBitmailmentFee
().
multiply
(
sub
));
}
}
if
(!
isPerson
&&
m
.
getUnitSocialSum
()
!=
null
)
{
money
=
money
.
add
(
m
.
getUnitSocialSum
());
if
(
sub
.
compareTo
(
SalaryConstants
.
B_ZERO
)
!=
SalaryConstants
.
EQUAL
&&
m
.
getUnitBitmailmentFee
()
!=
null
)
{
money
=
money
.
subtract
(
m
.
getUnitBitmailmentFee
().
multiply
(
sub
));
}
}
socialList
.
add
(
m
.
getId
());
}
//公积金
if
(!
isSocial
&&
(!
Common
.
isNotNull
(
m
.
getSalaryFundFlag
())
||
CommonConstants
.
ZERO_STRING
.
equals
(
m
.
getSalaryFundFlag
()))
&&
(
m
.
getPersonalFundSum
()
!=
null
||
m
.
getUnitFundSum
()
!=
null
))
{
if
(
isPerson
&&
m
.
getPersonalFundSum
()
!=
null
)
{
money
=
money
.
add
(
m
.
getPersonalFundSum
());
}
if
(!
isPerson
&&
m
.
getUnitFundSum
()
!=
null
)
{
money
=
money
.
add
(
m
.
getUnitFundSum
());
}
fundList
.
add
(
m
.
getId
());
}
}
}
}
return
money
;
}
/**
* @param noSalaryEstmateList 无工资人员-预估库数据列表
* @param money 金额
* @param isSocial true:社保 false:公积金
* @param isPerson true:个人 false:单位
* @param noSalarySocialList 预估库id,社保list
* @param noSalaryFundList 预估库id,公积金list
* @Description: 无工资人员社保、公积金信息
* @Author: hgw
* @Date: 2019/9/26 16:39
* @return: java.math.BigDecimal
**/
public
BigDecimal
getNoSalarySocialOrFundMoneyForForecast
(
List
<
TPaymentBySalaryVo
>
noSalaryEstmateList
,
BigDecimal
money
,
boolean
isSocial
,
boolean
isPerson
,
Set
<
String
>
noSalarySocialList
,
Set
<
String
>
noSalaryFundList
)
{
money
=
SalaryConstants
.
B_ZERO
;
if
(
noSalaryEstmateList
!=
null
&&
noSalaryEstmateList
.
size
()
>
CommonConstants
.
ZERO_INT
)
{
money
=
money
.
setScale
(
2
,
BigDecimal
.
ROUND_HALF_UP
);
for
(
TPaymentBySalaryVo
m
:
noSalaryEstmateList
)
{
//社保
if
(
isSocial
&&
(!
Common
.
isNotNull
(
m
.
getSalarySocialFlag
())
||
CommonConstants
.
ZERO_STRING
.
equals
(
m
.
getSalarySocialFlag
())))
{
if
(
isPerson
&&
m
.
getPersonalSocialSum
()
!=
null
)
{
money
=
money
.
add
(
m
.
getPersonalSocialSum
());
}
if
(!
isPerson
&&
m
.
getUnitSocialSum
()
!=
null
)
{
money
=
money
.
add
(
m
.
getUnitSocialSum
());
}
noSalarySocialList
.
add
(
m
.
getId
());
}
//公积金
if
(!
isSocial
&&
(!
Common
.
isNotNull
(
m
.
getSalaryFundFlag
())
||
CommonConstants
.
ZERO_STRING
.
equals
(
m
.
getSalaryFundFlag
())))
{
if
(
isPerson
&&
m
.
getPersonalFundSum
()
!=
null
)
{
money
=
money
.
add
(
m
.
getPersonalFundSum
());
}
if
(!
isPerson
&&
m
.
getUnitFundSum
()
!=
null
)
{
money
=
money
.
add
(
m
.
getUnitFundSum
());
}
noSalaryFundList
.
add
(
m
.
getId
());
}
}
}
return
money
;
}
/**
* @param isActual false:有应发顺推;true:有实发,倒推应发
* @param itemList 本次报账金额
* @param checkYearFinalStyle //薪资和年终奖扣税方案(0:合并(默认);1:单独)
* @param itemHistoryList 历史报账金额
* @param specialDeductionSum 专项信息
* @param costReduction 减除费用
* @param subs 薪资扣税阶梯表list
* @Description: 计算薪资扣税-个税
* @Author: hgw
* @Date: 2019/10/8 18:34
* @return: java.math.BigDecimal
**/
private
static
BigDecimal
calculation2PersonSalary
(
boolean
isActual
,
List
<
TSalaryAccountItem
>
itemList
,
String
checkYearFinalStyle
,
List
<
TSalaryAccountItem
>
itemHistoryList
,
BigDecimal
specialDeductionSum
,
BigDecimal
costReduction
,
List
<
TSalaryTaxConfig
>
subs
,
TSalaryAccountItem
sai
,
List
<
TSalaryAccountItem
>
saiList
,
BigDecimal
relaySalary
)
{
//本次纳税额
BigDecimal
res
=
SalaryConstants
.
B_ZERO
;
BigDecimal
annualBonus
=
SalaryConstants
.
B_ZERO
;
BigDecimal
sumTax
=
SalaryConstants
.
B_ZERO
;
BigDecimal
realDeduSalary
=
SalaryConstants
.
B_ZERO
;
BigDecimal
addRelaySalary
=
SalaryConstants
.
B_ZERO
;
// 实发倒推应发后需要加上其余金额,成为应发。
BigDecimal
actualSalarySumNow
=
SalaryConstants
.
B_ZERO
;
// 本次实发。
//本次
for
(
TSalaryAccountItem
item
:
itemList
)
{
if
(
SalaryConstants
.
ANNUAL_BONUS_JAVA
.
equals
(
item
.
getJavaFiedName
()))
{
annualBonus
=
item
.
getSalaryMoney
();
}
if
(
SalaryConstants
.
RELAY_SALARY_JAVA
.
equals
(
item
.
getJavaFiedName
()))
{
res
=
res
.
add
(
item
.
getSalaryMoney
());
}
if
(
SalaryConstants
.
ACTUAL_SALARY_SUM_JAVA
.
equals
(
item
.
getJavaFiedName
()))
{
realDeduSalary
=
realDeduSalary
.
add
(
item
.
getSalaryMoney
());
actualSalarySumNow
=
actualSalarySumNow
.
add
(
item
.
getSalaryMoney
());
}
/*if (SalaryConstants.ANNUAL_BONUS_TAX_JAVA.equals(item.getJavaFiedName())) {
sumTax = sumTax.add(item.getSalaryMoney());
}*/
if
(
CommonConstants
.
ONE_INT
==
item
.
getIsTax
())
{
res
=
res
.
subtract
(
item
.
getSalaryMoney
());
realDeduSalary
=
realDeduSalary
.
subtract
(
item
.
getSalaryMoney
());
addRelaySalary
=
addRelaySalary
.
add
(
item
.
getSalaryMoney
());
}
}
BigDecimal
realSalaryHistory
=
SalaryConstants
.
B_ZERO
;
//历史累计
for
(
TSalaryAccountItem
item
:
itemHistoryList
)
{
if
(
SalaryConstants
.
ANNUAL_BONUS_JAVA
.
equals
(
item
.
getJavaFiedName
()))
{
annualBonus
=
annualBonus
.
add
(
item
.
getSalaryMoney
());
}
if
(
SalaryConstants
.
SALARY_TAX_JAVA
.
equals
(
item
.
getJavaFiedName
()))
{
sumTax
=
sumTax
.
add
(
item
.
getSalaryMoney
());
}
/*if (SalaryConstants.ANNUAL_BONUS_TAX_JAVA.equals(item.getJavaFiedName())) {
sumTax = sumTax.add(item.getSalaryMoney());
}*/
if
(
SalaryConstants
.
RELAY_SALARY_JAVA
.
equals
(
item
.
getJavaFiedName
()))
{
res
=
res
.
add
(
item
.
getSalaryMoney
());
realSalaryHistory
=
realSalaryHistory
.
add
(
item
.
getSalaryMoney
());
}
if
(
SalaryConstants
.
ACTUAL_SALARY_SUM_JAVA
.
equals
(
item
.
getJavaFiedName
()))
{
realDeduSalary
=
realDeduSalary
.
add
(
item
.
getSalaryMoney
());
}
if
(
CommonConstants
.
ONE_INT
==
item
.
getIsTax
())
{
res
=
res
.
subtract
(
item
.
getSalaryMoney
());
addRelaySalary
=
addRelaySalary
.
add
(
item
.
getSalaryMoney
());
}
}
if
(
specialDeductionSum
!=
null
)
{
res
=
res
.
subtract
(
specialDeductionSum
);
realDeduSalary
=
realDeduSalary
.
subtract
(
specialDeductionSum
);
//addRelaySalary = addRelaySalary.add(specialDeductionSum);
}
if
(
costReduction
!=
null
)
{
res
=
res
.
subtract
(
costReduction
);
realDeduSalary
=
realDeduSalary
.
subtract
(
costReduction
);
addRelaySalary
=
addRelaySalary
.
add
(
costReduction
);
}
//不合并年终奖扣税
/*if (CommonConstants.ONE.equals(checkYearFinalStyle)) {
res = res.subtract(annualBonus);
addRelaySalary = addRelaySalary.add(annualBonus);
}*/
if
(!
isActual
)
{
for
(
TSalaryTaxConfig
sub
:
subs
)
{
if
(
res
.
compareTo
(
sub
.
getMinIncome
())
==
SalaryConstants
.
MORE_THAN
&&
res
.
compareTo
(
sub
.
getMaxIncome
())
!=
SalaryConstants
.
MORE_THAN
)
{
//res = realDeduSalary * ((double) ((sub.getTaxRate() * 1.0) / 100)) - sumTax - sub.getQuick();
res
=
res
.
multiply
(
new
BigDecimal
(
sub
.
getWithholdingRate
()).
divide
(
SalaryConstants
.
B_ONEHUNDRED
,
SalaryConstants
.
PLACES
,
BigDecimal
.
ROUND_HALF_UP
))
.
subtract
(
sumTax
).
subtract
(
sub
.
getQuickDeducation
());
// 应纳税额
break
;
}
}
}
else
{
BigDecimal
testArea
;
// 应发-起征点,判断计算金额范围;
//倒推公式(原先):
//((实发合计-减除费用)/ (1-税率) - (速算/(1-税率)) + 减除费用)
// -
// (历史应发)
// =
// 本次应发
for
(
TSalaryTaxConfig
sub
:
subs
)
{
//res = realDeduSalary / (1- (double) ((sub.getTaxRate() * 1.0) / 100))
// - (sub.getQuick()/ (1- (double) ((sub.getTaxRate() * 1.0) / 100)))
// + addRelaySalary;
res
=
realDeduSalary
.
divide
(
new
BigDecimal
(
"1"
).
subtract
(
new
BigDecimal
(
sub
.
getWithholdingRate
()).
divide
(
SalaryConstants
.
B_ONEHUNDRED
,
SalaryConstants
.
PLACES
,
BigDecimal
.
ROUND_HALF_UP
)),
SalaryConstants
.
PLACES
,
BigDecimal
.
ROUND_HALF_UP
)
.
subtract
(
sub
.
getQuickDeducation
().
divide
(
new
BigDecimal
(
"1"
).
subtract
(
new
BigDecimal
(
sub
.
getWithholdingRate
()).
divide
(
SalaryConstants
.
B_ONEHUNDRED
,
SalaryConstants
.
PLACES
,
BigDecimal
.
ROUND_HALF_UP
)),
SalaryConstants
.
PLACES
,
BigDecimal
.
ROUND_HALF_UP
))
.
add
(
addRelaySalary
);
testArea
=
res
.
subtract
(
costReduction
);
if
(
testArea
.
compareTo
(
SalaryConstants
.
B_ZERO
)
==
SalaryConstants
.
LESS_THAN
)
{
testArea
=
SalaryConstants
.
B_ZERO
;
}
if
(
testArea
.
compareTo
(
sub
.
getMinIncome
())
==
SalaryConstants
.
MORE_THAN
&&
testArea
.
compareTo
(
sub
.
getMaxIncome
())
!=
SalaryConstants
.
MORE_THAN
)
{
//res = res - realSalary - tf.getActualSalarySum(); //应发-历史应发=本次应发;本次应发-本次实发=税
relaySalary
=
res
.
subtract
(
realSalaryHistory
);
res
=
relaySalary
.
subtract
(
actualSalarySumNow
);
// 本次个人应发合计
sai
=
new
TSalaryAccountItem
();
sai
.
setCnName
(
SalaryConstants
.
RELAY_SALARY
);
sai
.
setJavaFiedName
(
SalaryConstants
.
RELAY_SALARY_JAVA
);
sai
.
setIsTax
(
CommonConstants
.
ZERO_INT
);
if
(
res
.
compareTo
(
SalaryConstants
.
B_ZERO
)
!=
SalaryConstants
.
MORE_THAN
)
{
sai
.
setSalaryMoney
(
actualSalarySumNow
);
}
else
{
sai
.
setSalaryMoney
(
relaySalary
);
}
saiList
.
add
(
sai
);
break
;
}
}
}
if
(
res
.
compareTo
(
SalaryConstants
.
B_ZERO
)
==
SalaryConstants
.
LESS_THAN
)
{
return
SalaryConstants
.
B_ZERO
;
}
return
res
.
setScale
(
SalaryConstants
.
PLACES
,
BigDecimal
.
ROUND_HALF_UP
);
}
/**
* @param itemList
* @param itemHistoryList
* @param saiList
* @Description: 计算劳务费个税、应发
* @Author: hgw
* @Date: 2022/3/3 11:30
* @return: java.math.BigDecimal
**/
private
static
BigDecimal
calculation2Labor
(
List
<
TSalaryAccountItem
>
itemList
,
List
<
TSalaryAccountItem
>
itemHistoryList
,
List
<
TSalaryAccountItem
>
saiList
)
{
// 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
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
);
if
(
sumTax
.
compareTo
(
BigDecimal
.
ZERO
)
!=
0
)
{
nowTax
=
BigDecimalUtils
.
safeSubtract
(
nowTax
,
sumTax
).
setScale
(
SalaryConstants
.
PLACES
,
BigDecimal
.
ROUND_HALF_UP
);
}
BigDecimal
relaySalary
=
BigDecimalUtils
.
safeAdd
(
actualSalarySumNow
,
nowTax
).
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
nowTax
;
}
/**
* 比较与薪资合并扣税和单独扣税的结果
*
* @return 1: 单独 0: 合并
* @createDate 2020-4-22 18:59:02
* @author hgw
*/
public
static
String
checkYearFinalStyle
(
boolean
isActual
,
List
<
TSalaryAccountItem
>
itemList
,
String
checkYearFinalStyle
,
List
<
TSalaryAccountItem
>
asList
,
BigDecimal
sdSum
,
BigDecimal
costReduction
,
List
<
TSalaryTaxConfig
>
personTax
,
TSalaryAccountItem
sai
,
List
<
TSalaryAccountItem
>
saiList
,
BigDecimal
relaySalary
,
BigDecimal
annualBonus
,
List
<
TSalaryTaxConfig
>
annousTax
)
{
BigDecimal
finalSalaryWithSalary
=
calculation2PersonSalary
(
isActual
,
saiList
,
checkYearFinalStyle
,
asList
,
sdSum
,
costReduction
,
personTax
,
sai
,
saiList
,
relaySalary
);
BigDecimal
finalSalaryNoSalary
=
calculation2FinalSalary
(
annualBonus
,
annousTax
);
if
(
finalSalaryWithSalary
.
compareTo
(
finalSalaryNoSalary
)
==
SalaryConstants
.
MORE_THAN
)
{
return
"1"
;
}
return
"0"
;
}
}
yifu-salary/yifu-salary-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/salary/service/impl/TSalaryAccountItemServiceImpl.java
View file @
ea40aebb
...
...
@@ -11,6 +11,11 @@ import com.yifu.cloud.plus.v1.yifu.salary.mapper.TSalaryAccountItemMapper;
import
com.yifu.cloud.plus.v1.yifu.salary.service.TSalaryAccountItemService
;
import
org.springframework.stereotype.Service
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.math.BigDecimal
;
import
java.util.*
;
...
...
yifu-salary/yifu-salary-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/salary/service/impl/TSalaryAccountServiceImpl.java
View file @
ea40aebb
...
...
@@ -36,6 +36,7 @@ import com.yifu.cloud.plus.v1.yifu.common.mybatis.base.BaseEntity;
import
com.yifu.cloud.plus.v1.yifu.salary.entity.TSalaryAccount
;
import
com.yifu.cloud.plus.v1.yifu.salary.mapper.TSalaryAccountMapper
;
import
com.yifu.cloud.plus.v1.yifu.salary.service.TSalaryAccountService
;
import
com.yifu.cloud.plus.v1.yifu.salary.vo.AccountCheckVo
;
import
com.yifu.cloud.plus.v1.yifu.salary.vo.TSalaryAccountSearchVo
;
import
com.yifu.cloud.plus.v1.yifu.salary.vo.TSalaryAccountVo
;
import
lombok.extern.log4j.Log4j2
;
...
...
@@ -45,9 +46,12 @@ import javax.servlet.ServletOutputStream;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.math.BigDecimal
;
import
java.net.URLEncoder
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
/**
* 工资报账主表(工资条)
...
...
@@ -171,83 +175,27 @@ public class TSalaryAccountServiceImpl extends ServiceImpl<TSalaryAccountMapper,
}
@Override
public
R
<
List
<
ErrorMessage
>>
importDiy
(
InputStream
inputStream
)
{
List
<
ErrorMessage
>
errorMessageList
=
new
ArrayList
<>();
ExcelUtil
<
TSalaryAccountVo
>
util1
=
new
ExcelUtil
<>(
TSalaryAccountVo
.
class
);
;
// 写法2:
// 匿名内部类 不用额外写一个DemoDataListener
// 这里 需要指定读用哪个class去读,然后读取第一个sheet 文件流会自动关闭
try
{
EasyExcel
.
read
(
inputStream
,
TSalaryAccountVo
.
class
,
new
ReadListener
<
TSalaryAccountVo
>()
{
/**
* 单次缓存的数据量
*/
public
static
final
int
BATCH_COUNT
=
CommonConstants
.
BATCH_COUNT
;
/**
*临时存储
*/
private
List
<
TSalaryAccountVo
>
cachedDataList
=
ListUtils
.
newArrayListWithExpectedSize
(
BATCH_COUNT
);
@Override
public
void
invoke
(
TSalaryAccountVo
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
());
importTSalaryAccount
(
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
importTSalaryAccount
(
List
<
TSalaryAccountVo
>
excelVOList
,
List
<
ErrorMessage
>
errorMessageList
)
{
// 个性化校验逻辑
ErrorMessage
errorMsg
;
// 执行数据插入操作 组装
for
(
int
i
=
0
;
i
<
excelVOList
.
size
();
i
++)
{
TSalaryAccountVo
excel
=
excelVOList
.
get
(
i
);
// 数据合法情况 TODO
// 插入
insertExcel
(
excel
);
errorMessageList
.
add
(
new
ErrorMessage
(
excel
.
getRowIndex
(),
CommonConstants
.
SAVE_SUCCESS
));
public
Map
<
String
,
Integer
>
getAccountCheckMap
(
String
settleId
,
String
settleMonth
)
{
List
<
AccountCheckVo
>
list
=
baseMapper
.
getAccountCheckList
(
settleId
,
settleMonth
);
Map
<
String
,
Integer
>
map
=
new
HashMap
<>();
if
(
list
!=
null
&&
!
list
.
isEmpty
())
{
for
(
AccountCheckVo
str
:
list
)
{
map
.
put
(
str
.
getTitle
()
+
CommonConstants
.
DOWN_LINE_STRING
+
str
.
getRelaySalary
().
setScale
(
2
,
BigDecimal
.
ROUND_HALF_UP
),
1
);
}
}
return
map
;
}
/**
* 插入excel bad record
*/
private
void
insertExcel
(
TSalaryAccountVo
excel
)
{
TSalaryAccount
insert
=
new
TSalaryAccount
();
BeanUtil
.
copyProperties
(
excel
,
insert
);
this
.
save
(
insert
);
* @param empIdCard
* @param nowYear
* @Description: 获取当前年最小计税月
* @Author: hgw
* @Date: 2022/1/19 17:57
* @return: java.lang.String
**/
@Override
public
String
getMinTaxMonthByNowYear
(
String
empIdCard
,
int
nowYear
)
{
return
baseMapper
.
getMinTaxMonthByNowYear
(
empIdCard
,
nowYear
);
}
}
yifu-salary/yifu-salary-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/salary/util/SalaryAccountUtil.java
0 → 100644
View file @
ea40aebb
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
salary
.
util
;
import
com.alibaba.fastjson.JSONObject
;
import
com.yifu.cloud.plus.v1.yifu.archives.vo.TSettleDomainSelectVo
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttribute
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.ValidityConstants
;
import
com.yifu.cloud.plus.v1.yifu.common.core.exception.ExcelException
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.*
;
import
com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser
;
import
com.yifu.cloud.plus.v1.yifu.insurances.util.ValidityUtil
;
import
com.yifu.cloud.plus.v1.yifu.salary.entity.TConfigSalary
;
import
com.yifu.cloud.plus.v1.yifu.salary.entity.TSalaryConfigStandard
;
import
com.yifu.cloud.plus.v1.yifu.salary.entity.TSalaryEmployee
;
import
com.yifu.cloud.plus.v1.yifu.salary.service.TSalaryAccountService
;
import
com.yifu.cloud.plus.v1.yifu.salary.service.TSalaryEmployeeService
;
import
com.yifu.cloud.plus.v1.yifu.salary.vo.TSalaryAccountItemVo
;
import
com.yifu.cloud.plus.v1.yifu.salary.vo.TSalaryAccountVo
;
import
lombok.Data
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang.StringUtils
;
import
java.io.Serializable
;
import
java.lang.reflect.Field
;
import
java.lang.reflect.Method
;
import
java.math.BigDecimal
;
import
java.time.LocalDateTime
;
import
java.util.*
;
import
static
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
salary
.
util
.
SalaryCommonUtil
.
setFields
;
/**
* @author hgw
* @Description: EXCEL内容转化为TSalaryAccount
*/
@Data
@Slf4j
public
class
SalaryAccountUtil
implements
Serializable
{
/**
* 用于返回实体
*/
private
List
<
TSalaryAccountVo
>
entityList
;
/**
* 用于返回错误信息
*/
private
List
<
ErrorMessage
>
errorInfo
;
// 重复数据
private
List
<
ErrorMessage
>
repeatInfo
;
/**
* @param jsonStr 客户原表json内容
* @param dicMap 字典Map
* @param dept 项目
* @param configSalary 当前项目下的配置(结算月等
* @param salaryConfigMap 客户原表-工资模板配置Map
* @param empIdCardMap 当前项目下的员工Map
* @param empNameMap 当前项目下的员工Map
* @param isDuplicateName false:有重名(当前项目下的员工),则不可用姓名查找,必须含有身份证号列
* @param repeatFlag 默认 0:不允许重复导入已存在系统内的数据;1:允许重复导入
* @param ownEmployeeMap 自有员工所在项目Map
* @Description: 将jsonStr数据源的数据导入到 List<TSalaryAccount>
* @Author: hgw
* @Date: 2019/9/16 17:26
* @return: void
**/
public
void
getJsonStringToList
(
YifuUser
user
,
String
jsonStr
,
TSettleDomainSelectVo
dept
,
TConfigSalary
configSalary
,
Map
<
String
,
TSalaryConfigStandard
>
salaryConfigMap
,
Map
<
String
,
Boolean
>
isMustMap
,
Map
<
String
,
TSalaryEmployee
>
empIdCardMap
,
Map
<
String
,
TSalaryEmployee
>
empNameMap
,
boolean
isDuplicateName
,
String
salaryType
,
String
invoiceTitle
,
TSalaryEmployeeService
tSalaryEmployeeService
,
Map
<
String
,
Integer
>
checkMap
,
int
repeatFlag
,
Map
<
String
,
Integer
>
ownEmployeeMap
,
Map
<
String
,
Integer
>
ownDeptMap
,
TSalaryAccountService
tSalaryAccountService
)
{
List
<
TSalaryAccountVo
>
tList
=
new
ArrayList
<>();
List
<
HashMap
>
list
=
JSONObject
.
parseArray
(
jsonStr
,
HashMap
.
class
);
List
<
ErrorMessage
>
errorList
=
new
ArrayList
<>();
List
<
ErrorMessage
>
repeatList
=
new
ArrayList
<>();
try
{
// 得到数据的条数
int
rows
=
list
.
size
();
// 有数据时才处理
if
(
rows
>
0
)
{
// 得到类的所有field
Field
[]
allFields
=
TSalaryAccountVo
.
class
.
getDeclaredFields
();
// 从map中得到对应列的field
Field
field
;
// 将有注解的field存放到fieldsMap中
Map
<
String
,
Field
>
fieldsMap
=
new
HashMap
<>();
for
(
int
i
=
0
;
i
<
allFields
.
length
;
i
++)
{
field
=
allFields
[
i
];
if
(
field
.
isAnnotationPresent
(
ExcelAttribute
.
class
))
{
// 设置类的私有字段属性可访问
field
.
setAccessible
(
true
);
fieldsMap
.
put
(
field
.
getName
(),
field
);
}
}
String
error
;
//校验字段是否符合要求 返回错误信息
String
tempStr
;
//临时存储单元格数据
TSalaryAccountVo
entity
;
// 从第1行开始取数据
HashMap
temp
;
// 得到一行中的所有单元格对象.
ExcelAttribute
attr
;
//获取属性对应的注解属性
Object
cellValueObj
;
//单元格值
String
cellValueStr
;
//单元格字符串值
String
dbFiedName
;
//单元格值,对应的数据库中文名
Class
<?>
fieldType
;
// 取得类型,并根据对象类型设置值.
TSalaryConfigStandard
scs
;
TSalaryEmployee
emp
;
TSalaryEmployee
newEmp
;
//新员工
List
<
TSalaryAccountItemVo
>
saiList
;
TSalaryAccountItemVo
sai
;
BigDecimal
cellValueBig
;
Map
<
String
,
Integer
>
checkIdNumberMap
=
new
HashMap
<>();
//验证身份证重复性的Map
boolean
salaryGiveTimeFlag
;
//salaryGiveTime == true :立即发;false:暂停发:则不考虑开户行等
boolean
isNewEmployee
;
//是否新员工:是:true;否:false;
R
<
TSalaryEmployee
>
empR
;
String
empName
;
String
salaryStyle
;
//工资发放方式(0现金/1银行)/2线下
BigDecimal
relaySalary
;
//应发工资
BigDecimal
actualSalarySum
;
//实发工资
// 当前年月
String
nowMonth
=
DateUtil
.
addMonth
(
CommonConstants
.
ZERO_INT
);
String
must
;
// 当前年(用来获取已有薪资的计税月份,覆盖填写的计税月份2022-1-19 17:11:24hgw根据郭华照等人提出的需求
int
nowYear
=
Integer
.
parseInt
(
nowMonth
.
substring
(
0
,
4
));
// 当前结算年,已有工资的最小计税月
String
minTaxMonth
;
for
(
int
i
=
0
;
i
<
rows
;
i
++)
{
error
=
""
;
temp
=
list
.
get
(
i
);
entity
=
new
TSalaryAccountVo
();
emp
=
null
;
newEmp
=
new
TSalaryEmployee
();
salaryGiveTimeFlag
=
true
;
empName
=
null
;
isNewEmployee
=
false
;
saiList
=
new
ArrayList
<>();
salaryStyle
=
SalaryConstants
.
SALARY_STYLE_BANK
;
relaySalary
=
null
;
actualSalarySum
=
null
;
for
(
Map
.
Entry
<
String
,
TSalaryConfigStandard
>
entry
:
salaryConfigMap
.
entrySet
())
{
cellValueObj
=
getFieldValueByName
(
entry
.
getKey
(),
temp
);
scs
=
entry
.
getValue
();
if
(
cellValueObj
!=
null
&&
scs
!=
null
)
{
cellValueStr
=
getStringValByObject
(
cellValueObj
);
if
(!
StringUtils
.
isNotBlank
(
cellValueStr
))
{
error
=
"第"
+
(
i
+
2
)
+
"行:"
+
entry
.
getKey
()
+
"列_不识别对象类型"
;
errorList
.
add
(
new
ErrorMessage
((
i
+
2
),
error
));
continue
;
}
dbFiedName
=
scs
.
getDbFiedName
();
if
(
isMustMap
.
get
(
dbFiedName
)
!=
null
&&
Boolean
.
TRUE
.
equals
(
isMustMap
.
get
(
dbFiedName
)))
{
isMustMap
.
put
(
dbFiedName
,
false
);
}
if
(
SalaryConstants
.
RELAY_SALARY_JAVA
.
equals
(
scs
.
getJavaFiedName
()))
{
try
{
relaySalary
=
new
BigDecimal
(
cellValueStr
);
}
catch
(
Exception
e
)
{
error
=
"第"
+
(
i
+
2
)
+
"行:应发工资:'"
+
cellValueStr
+
"'错误,请检查数据"
;
errorList
.
add
(
new
ErrorMessage
((
i
+
2
),
error
));
continue
;
}
}
if
(
SalaryConstants
.
ACTUAL_SALARY_SUM_JAVA
.
equals
(
scs
.
getJavaFiedName
()))
{
try
{
actualSalarySum
=
new
BigDecimal
(
cellValueStr
);
}
catch
(
Exception
e
)
{
error
=
"第"
+
(
i
+
2
)
+
"行:实发工资:'"
+
cellValueStr
+
"'错误,请检查数据"
;
errorList
.
add
(
new
ErrorMessage
((
i
+
2
),
error
));
continue
;
}
}
if
(
SalaryConstants
.
PDEDUCTION_JAVA
.
equals
(
scs
.
getJavaFiedName
())
||
SalaryConstants
.
UDEDUCTION_JAVA
.
equals
(
scs
.
getJavaFiedName
()))
{
try
{
new
BigDecimal
(
cellValueStr
);
}
catch
(
Exception
ex
)
{
error
=
"第"
+
(
i
+
2
)
+
"行:个人、单位代扣,只能是金额!"
;
errorList
.
add
(
new
ErrorMessage
((
i
+
2
),
error
));
continue
;
}
}
if
(
SalaryConstants
.
EMP_NAME
.
equals
(
dbFiedName
))
{
empName
=
cellValueStr
=
cellValueStr
.
replaceAll
(
" "
,
""
);
if
(
isDuplicateName
)
{
emp
=
empNameMap
.
get
(
empName
);
}
newEmp
.
setEmpName
(
empName
);
}
if
(
SalaryConstants
.
IF_NEW_EMPLOYEE
.
equals
(
dbFiedName
)
&&
SalaryConstants
.
IS_NEW
.
equals
(
cellValueStr
))
{
isNewEmployee
=
true
;
}
if
(
SalaryConstants
.
ID_NUMBER
.
equals
(
dbFiedName
))
{
if
(
checkIdNumberMap
.
get
(
cellValueStr
)
==
null
)
{
checkIdNumberMap
.
put
(
cellValueStr
,
(
i
+
2
));
}
else
{
error
=
"第"
+
(
i
+
2
)
+
"行与第:"
+
checkIdNumberMap
.
get
(
cellValueStr
)
+
"行身份证重复:"
+
cellValueStr
;
errorList
.
add
(
new
ErrorMessage
((
i
+
2
),
error
));
break
;
}
if
(
cellValueStr
.
indexOf
(
"x"
)
>=
0
)
{
cellValueStr
=
cellValueStr
.
toUpperCase
();
}
emp
=
empIdCardMap
.
get
(
cellValueStr
);
newEmp
.
setEmpIdcard
(
cellValueStr
);
}
if
(
SalaryConstants
.
SALARY_GIVE_TIME
.
equals
(
cellValueStr
))
{
salaryGiveTimeFlag
=
false
;
entity
.
setSalaryGiveTime
(
CommonConstants
.
ONE_STRING
);
}
field
=
fieldsMap
.
get
(
scs
.
getJavaFiedName
());
if
(
field
==
null
)
{
try
{
cellValueBig
=
new
BigDecimal
(
cellValueStr
);
cellValueBig
=
cellValueBig
.
setScale
(
2
,
BigDecimal
.
ROUND_HALF_UP
);
//四舍五入
if
(
cellValueBig
.
toString
().
length
()
>
11
)
{
error
=
"第"
+
(
i
+
2
)
+
"行金额太大了,请检查一下:"
+
cellValueBig
;
errorList
.
add
(
new
ErrorMessage
((
i
+
2
),
error
));
break
;
}
sai
=
new
TSalaryAccountItemVo
();
sai
.
setCnName
(
dbFiedName
);
sai
.
setJavaFiedName
(
scs
.
getJavaFiedName
());
sai
.
setSalaryMoney
(
cellValueBig
);
if
(
scs
.
getIsTax
()
!=
null
)
{
sai
.
setIsTax
(
scs
.
getIsTax
());
}
else
{
sai
.
setIsTax
(
CommonConstants
.
ZERO_INT
);
}
saiList
.
add
(
sai
);
}
catch
(
NumberFormatException
e
)
{
//非数字,不保存
}
}
else
{
attr
=
field
.
getAnnotation
(
ExcelAttribute
.
class
);
error
=
validateUtil
(
cellValueStr
,
attr
,
(
i
+
2
));
if
(
null
!=
error
)
{
errorList
.
add
(
new
ErrorMessage
((
i
+
2
),
error
));
continue
;
}
fieldType
=
field
.
getType
();
if
(
fieldType
==
null
)
{
continue
;
}
setFields
(
field
,
cellValueStr
,
attr
,
fieldType
,
entity
);
}
}
}
must
=
null
;
for
(
Map
.
Entry
<
String
,
Boolean
>
entry
:
isMustMap
.
entrySet
())
{
if
(
Boolean
.
TRUE
.
equals
(
entry
.
getValue
()))
{
if
(
Common
.
isEmpty
(
must
))
{
must
=
entry
.
getKey
();
}
else
{
must
=
must
.
concat
(
"、"
).
concat
(
entry
.
getKey
());
}
}
}
if
(
Common
.
isNotNull
(
must
))
{
error
=
"第"
+
(
i
+
2
)
+
"行:"
+
must
+
"列_不可缺少"
;
errorList
.
add
(
new
ErrorMessage
((
i
+
2
),
error
));
continue
;
}
if
(
"3"
.
equals
(
salaryType
)
&&
actualSalarySum
==
null
)
{
error
=
"第"
+
(
i
+
2
)
+
"行:【实发劳务费】列_不可缺少"
;
errorList
.
add
(
new
ErrorMessage
((
i
+
2
),
error
));
continue
;
}
// 应发、实发、实发劳务费不可都为空
if
(
relaySalary
==
null
&&
actualSalarySum
==
null
)
{
error
=
"第"
+
(
i
+
2
)
+
"行:【应发工资】列_不可缺少"
;
errorList
.
add
(
new
ErrorMessage
((
i
+
2
),
error
));
continue
;
}
// 版本2.6.6判重:对同一“项目”、同一“结算月份”、同一“报表类型”、同一“工资月份”、同一“身份证号”、同一“应发金额”进行校验
// 2.6.6:校验导入数据重复的Map格式:#身份证号_工资月份_报表类型_应发金额
entity
.
setIsRepeat
(
CommonConstants
.
ZERO_INT
);
if
(
relaySalary
!=
null
)
{
relaySalary
=
relaySalary
.
setScale
(
2
,
BigDecimal
.
ROUND_HALF_UP
);
if
(
checkMap
.
get
(
entity
.
getEmpIdcard
()
+
CommonConstants
.
DOWN_LINE_STRING
+
DateUtil
.
addMonth
(
configSalary
.
getSalaryMonth
())
+
CommonConstants
.
DOWN_LINE_STRING
+
salaryType
+
CommonConstants
.
DOWN_LINE_STRING
+
relaySalary
)
!=
null
)
{
entity
.
setIsRepeat
(
CommonConstants
.
ONE_INT
);
if
(
repeatFlag
==
0
)
{
repeatList
.
add
(
new
ErrorMessage
((
i
+
2
),
"第"
+
(
i
+
2
)
+
"行:同一项目、结算月份、报表类型、工资月份、身份证号、应发金额,存在相同数据"
));
continue
;
}
}
}
if
(
null
==
error
)
{
if
(
Common
.
isNotNull
(
entity
.
getSalaryTaxFlag
())
&&
entity
.
getSalaryTaxFlag
().
length
()
>
1
)
{
error
=
"第"
+
(
i
+
2
)
+
"行:请检查‘薪资扣税(默认是)’列,允许值:(否/是/不填写),您的值:"
+
entity
.
getSalaryTaxFlag
();
errorList
.
add
(
new
ErrorMessage
((
i
+
2
),
error
));
continue
;
}
if
(
Common
.
isNotNull
(
entity
.
getSalaryStyle
()))
{
salaryStyle
=
entity
.
getSalaryStyle
();
}
else
if
(
configSalary
.
getGrantType
()
!=
null
)
{
salaryStyle
=
String
.
valueOf
(
configSalary
.
getGrantType
());
}
// 2021-8-31 hgw2.6.5新增手机号校验
if
(
newEmp
!=
null
&&
Common
.
isNotNull
(
entity
.
getEmpPhone
())
&&
Common
.
isEmpty
(
newEmp
.
getEmpPhone
()))
{
newEmp
.
setEmpPhone
(
entity
.
getEmpPhone
());
}
if
(
emp
==
null
)
{
if
(
isNewEmployee
)
{
//增加工资人员档案:(临时使用)
if
(
newEmp
!=
null
)
{
if
(
Common
.
isEmpty
(
newEmp
.
getEmpName
()))
{
error
=
"第"
+
(
i
+
2
)
+
"行:新员工-姓名-不可为空!"
;
errorList
.
add
(
new
ErrorMessage
((
i
+
2
),
error
));
continue
;
}
if
(
Common
.
isEmpty
(
newEmp
.
getEmpIdcard
()))
{
error
=
"第"
+
(
i
+
2
)
+
"行:新员工-身份证号-不可为空!"
;
errorList
.
add
(
new
ErrorMessage
((
i
+
2
),
error
));
continue
;
}
// 2021-8-31 hgw2.6.5新增手机号校验
if
(
Common
.
isEmpty
(
newEmp
.
getEmpPhone
()))
{
error
=
"第"
+
(
i
+
2
)
+
"行:新员工-手机号码-不可为空!"
;
errorList
.
add
(
new
ErrorMessage
((
i
+
2
),
error
));
continue
;
}
else
if
(!
ValidityUtil
.
validateEmpPhone
(
newEmp
.
getEmpPhone
()))
{
error
=
"第"
+
(
i
+
2
)
+
"行:新员工-手机号码格式错误:"
+
newEmp
.
getEmpPhone
();
errorList
.
add
(
new
ErrorMessage
((
i
+
2
),
error
));
continue
;
}
}
if
(
entity
!=
null
)
{
if
(!
"3"
.
equals
(
salaryType
))
{
if
(
Common
.
isEmpty
(
entity
.
getTaxMonth
()))
{
error
=
"第"
+
(
i
+
2
)
+
"行:新员工-计税月份-不可为空!"
;
errorList
.
add
(
new
ErrorMessage
((
i
+
2
),
error
));
continue
;
}
else
if
(
entity
.
getTaxMonth
().
length
()
<
CommonConstants
.
dingleDigitIntArray
[
6
])
{
error
=
"第"
+
(
i
+
2
)
+
"行:新员工-计税月份-长度小于6:"
+
entity
.
getTaxMonth
();
errorList
.
add
(
new
ErrorMessage
((
i
+
2
),
error
));
continue
;
}
else
if
(
DateUtil
.
compareYearMonth
(
entity
.
getTaxMonth
(),
nowMonth
))
{
error
=
"第"
+
(
i
+
2
)
+
"行:新员工-计税月份-大于当前年月或错误,请调整:"
+
entity
.
getTaxMonth
();
errorList
.
add
(
new
ErrorMessage
((
i
+
2
),
error
));
continue
;
}
else
{
newEmp
.
setTaxMonth
(
entity
.
getTaxMonth
());
}
}
//工资发放方式(0现金/1银行)/2线下 && salaryGiveTime == true :立即发;false:暂停发:则不考虑开户行等
//银行+立即发,则考虑和开户行卡号
if
(
SalaryConstants
.
SALARY_STYLE_BANK
.
equals
(
salaryStyle
)
&&
salaryGiveTimeFlag
)
{
if
(
Common
.
isEmpty
(
entity
.
getBankName
()))
{
error
=
"第"
+
(
i
+
2
)
+
"行:新员工-开户行-不可为空!"
;
errorList
.
add
(
new
ErrorMessage
((
i
+
2
),
error
));
continue
;
}
else
{
newEmp
.
setBankName
(
entity
.
getBankName
());
}
if
(
Common
.
isEmpty
(
entity
.
getBankNo
()))
{
error
=
"第"
+
(
i
+
2
)
+
"行:新员工-卡号-不可为空!"
;
errorList
.
add
(
new
ErrorMessage
((
i
+
2
),
error
));
continue
;
}
else
{
newEmp
.
setBankNo
(
entity
.
getBankNo
());
}
}
else
{
if
(
Common
.
isNotNull
(
entity
.
getBankName
()))
{
newEmp
.
setBankName
(
entity
.
getBankName
());
}
if
(
Common
.
isNotNull
(
entity
.
getBankNo
()))
{
newEmp
.
setBankNo
(
entity
.
getBankNo
());
}
}
}
newEmp
.
setFileStatus
(
CommonConstants
.
ZERO_INT
);
//临时
newEmp
.
setDeptId
(
dept
.
getId
());
newEmp
.
setDeptName
(
dept
.
getDepartName
());
newEmp
.
setDeptNo
(
dept
.
getDepartNo
());
newEmp
.
setUnitId
(
dept
.
getCustomerId
());
newEmp
.
setUnitName
(
dept
.
getCustomerName
());
newEmp
.
setUnitNo
(
dept
.
getCustomerCode
());
newEmp
.
setCreateBy
(
String
.
valueOf
(
user
.
getId
()));
newEmp
.
setCreateName
(
user
.
getNickname
());
if
(!
"3"
.
equals
(
salaryType
))
{
minTaxMonth
=
tSalaryAccountService
.
getMinTaxMonthByNowYear
(
newEmp
.
getEmpIdcard
(),
nowYear
);
if
(
Common
.
isNotNull
(
minTaxMonth
)
&&
!
minTaxMonth
.
equals
(
entity
.
getTaxMonth
()))
{
error
=
"第"
+
(
i
+
2
)
+
"行:该员工已有发薪记录,计税月份请填写:【"
+
minTaxMonth
+
"】"
+
",你填写了计税月:【"
+
entity
.
getTaxMonth
()
+
"】"
;
errorList
.
add
(
new
ErrorMessage
((
i
+
2
),
error
));
continue
;
}
}
tSalaryEmployeeService
.
save
(
newEmp
);
emp
=
newEmp
;
}
else
{
error
=
"第"
+
(
i
+
2
)
+
"行:该项目下无此员工,请添加<是否新员工(默认否)>列,并录入身份证号、开户行总行、卡号、计税月份、手机号码!!"
;
errorList
.
add
(
new
ErrorMessage
((
i
+
2
),
error
));
continue
;
}
}
if
(
emp
!=
null
)
{
if
(
Common
.
isEmpty
(
emp
.
getEmpName
()))
{
error
=
"第"
+
(
i
+
2
)
+
"行:档案员工-姓名-为空,请去档案更新!"
;
errorList
.
add
(
new
ErrorMessage
((
i
+
2
),
error
));
continue
;
}
else
if
(
Common
.
isEmpty
(
empName
))
{
error
=
"第"
+
(
i
+
2
)
+
"行:模板-员工姓名-为空,请添加姓名列!"
;
errorList
.
add
(
new
ErrorMessage
((
i
+
2
),
error
));
continue
;
}
else
if
(!
empName
.
equals
(
emp
.
getEmpName
()))
{
error
=
"第"
+
(
i
+
2
)
+
"行:员工-姓名与身份证-不匹配,请确认员工信息!"
;
errorList
.
add
(
new
ErrorMessage
((
i
+
2
),
error
));
continue
;
}
if
(
Common
.
isEmpty
(
emp
.
getEmpPhone
()))
{
error
=
"第"
+
(
i
+
2
)
+
"行:档案员工-手机号码-为空,请去档案更新!"
;
errorList
.
add
(
new
ErrorMessage
((
i
+
2
),
error
));
continue
;
}
else
if
(!
ValidityUtil
.
validateEmpPhone
(
emp
.
getEmpPhone
()))
{
error
=
"第"
+
(
i
+
2
)
+
"行:档案员工-手机号码格式错误,请去档案更新:"
+
emp
.
getEmpPhone
();
errorList
.
add
(
new
ErrorMessage
((
i
+
2
),
error
));
continue
;
}
if
(
Common
.
isEmpty
(
emp
.
getTaxMonth
())
&&
!
"3"
.
equals
(
salaryType
))
{
if
(
Common
.
isNotNull
(
entity
.
getTaxMonth
()))
{
if
(
entity
.
getTaxMonth
().
length
()
>
CommonConstants
.
dingleDigitIntArray
[
6
])
{
entity
.
setTaxMonth
(
emp
.
getTaxMonth
().
substring
(
0
,
6
));
}
else
if
(
entity
.
getTaxMonth
().
length
()
<
CommonConstants
.
dingleDigitIntArray
[
6
])
{
error
=
"第"
+
(
i
+
2
)
+
"行:工资模板里-计税月份-长度小于6:"
+
entity
.
getTaxMonth
()
+
",请在工资模板修改!"
;
errorList
.
add
(
new
ErrorMessage
((
i
+
2
),
error
));
continue
;
}
if
(
DateUtil
.
compareYearMonth
(
entity
.
getTaxMonth
(),
nowMonth
))
{
error
=
"第"
+
(
i
+
2
)
+
"行:工资模板里-计税月份-大于当前年月或错误,请调整:"
+
entity
.
getTaxMonth
();
errorList
.
add
(
new
ErrorMessage
((
i
+
2
),
error
));
continue
;
}
emp
.
setTaxMonth
(
entity
.
getTaxMonth
());
tSalaryEmployeeService
.
updateById
(
emp
);
}
else
{
error
=
"第"
+
(
i
+
2
)
+
"行:档案员工-计税月份-为空,请在工资模板填写-计税月份-列的内容!"
;
errorList
.
add
(
new
ErrorMessage
((
i
+
2
),
error
));
continue
;
}
}
if
(
ownEmployeeMap
.
get
(
emp
.
getEmpIdcard
())
!=
null
||
(
isNewEmployee
&&
ownDeptMap
.
get
(
dept
.
getId
())
!=
null
))
{
// 自有员工
entity
.
setOwnFlag
(
CommonConstants
.
ONE_INT
);
}
else
{
// 普通员工
entity
.
setOwnFlag
(
CommonConstants
.
ZERO_INT
);
}
entity
.
setProvince
(
dept
.
getProvince
());
entity
.
setCity
(
dept
.
getCity
());
entity
.
setTown
(
dept
.
getTown
());
entity
.
setEmpId
(
emp
.
getId
());
entity
.
setEmpIdcard
(
emp
.
getEmpIdcard
());
entity
.
setEmpName
(
emp
.
getEmpName
());
entity
.
setEmpPhone
(
emp
.
getEmpPhone
());
if
(
SalaryConstants
.
SALARY_STYLE_BANK
.
equals
(
salaryStyle
)
&&
salaryGiveTimeFlag
)
{
if
(
Common
.
isEmpty
(
emp
.
getBankName
()))
{
error
=
"第"
+
(
i
+
2
)
+
"行:员工:"
+
emp
.
getEmpIdcard
()
+
"-发放方式为银行发放,但是-开户行-为空,请去档案更新!"
;
errorList
.
add
(
new
ErrorMessage
((
i
+
2
),
error
));
continue
;
}
if
(
Common
.
isEmpty
(
emp
.
getBankNo
()))
{
error
=
"第"
+
(
i
+
2
)
+
"行:员工:"
+
emp
.
getEmpIdcard
()
+
"-发放方式为银行发放,但是-银行卡号-为空,请去档案更新!"
;
errorList
.
add
(
new
ErrorMessage
((
i
+
2
),
error
));
continue
;
}
entity
.
setBankName
(
emp
.
getBankName
());
entity
.
setBankNo
(
emp
.
getBankNo
());
}
else
{
if
(
Common
.
isNotNull
(
emp
.
getBankName
()))
{
entity
.
setBankName
(
emp
.
getBankName
());
}
else
{
entity
.
setBankName
(
null
);
}
if
(
Common
.
isNotNull
(
emp
.
getBankNo
()))
{
entity
.
setBankNo
(
emp
.
getBankNo
());
}
else
{
entity
.
setBankNo
(
null
);
}
}
if
(!
"3"
.
equals
(
salaryType
))
{
if
(
emp
.
getTaxMonth
().
length
()
>
CommonConstants
.
dingleDigitIntArray
[
6
])
{
entity
.
setTaxMonth
(
emp
.
getTaxMonth
().
substring
(
0
,
6
));
}
else
if
(
emp
.
getTaxMonth
().
length
()
<
CommonConstants
.
dingleDigitIntArray
[
6
])
{
error
=
"第"
+
(
i
+
2
)
+
"行:档案员工-计税月份-长度小于6:"
+
entity
.
getTaxMonth
()
+
",请去档案更新!在工资模板修改无效!"
;
errorList
.
add
(
new
ErrorMessage
((
i
+
2
),
error
));
continue
;
}
else
{
entity
.
setTaxMonth
(
emp
.
getTaxMonth
());
}
if
(
DateUtil
.
compareYearMonth
(
entity
.
getTaxMonth
(),
nowMonth
))
{
error
=
"第"
+
(
i
+
2
)
+
"行:档案员工-计税月份-大于当前年月或错误,请调整:"
+
entity
.
getTaxMonth
();
errorList
.
add
(
new
ErrorMessage
((
i
+
2
),
error
));
continue
;
}
sai
=
new
TSalaryAccountItemVo
();
sai
.
setCnName
(
SalaryConstants
.
COST_REDUCTION
);
sai
.
setJavaFiedName
(
SalaryConstants
.
COST_REDUCTION_JAVA
);
sai
.
setSalaryMoney
(
DateUtil
.
getTaxMonthMoney
(
entity
.
getTaxMonth
()));
sai
.
setIsTax
(
CommonConstants
.
ZERO_INT
);
saiList
.
add
(
sai
);
}
}
else
{
error
=
"第"
+
(
i
+
2
)
+
"行:该项目下无此员工,请去档案添加,或添加<是否新员工(默认否)>列,并录入身份证、开户行、卡号、计税月份、手机号码!"
;
errorList
.
add
(
new
ErrorMessage
((
i
+
2
),
error
));
continue
;
}
if
(
saiList
!=
null
&&
!
saiList
.
isEmpty
())
{
entity
.
setSaiList
(
saiList
);
}
if
(
Common
.
isEmpty
(
entity
.
getSalaryStyle
()))
{
entity
.
setSalaryStyle
(
salaryStyle
);
}
SalaryCommonUtil
.
setConfigSalary
(
configSalary
,
entity
);
// 填充基本数据
SalaryCommonUtil
.
setAccountBaseInfo
(
salaryType
,
dept
,
entity
,
salaryGiveTimeFlag
);
if
(
"3"
.
equals
(
salaryType
))
{
if
(
CommonConstants
.
dingleDigitStrArray
[
1
].
equals
(
entity
.
getIsDeductSocial
())
||
CommonConstants
.
dingleDigitStrArray
[
1
].
equals
(
entity
.
getIsDeductFund
()))
{
error
=
"第"
+
(
i
+
2
)
+
"行:劳务费不可扣社保、公积金,请去除【是否扣除社保】列,或写【否】"
;
errorList
.
add
(
new
ErrorMessage
((
i
+
2
),
error
));
continue
;
}
else
{
entity
.
setIsDeductSocial
(
"0"
);
entity
.
setIsDeductFund
(
"0"
);
}
}
//验证扣社保以及扣公积金时的关联关系
if
(
CommonConstants
.
dingleDigitStrArray
[
1
].
equals
(
entity
.
getIsDeductSocial
())
&&
Common
.
isEmpty
(
entity
.
getDeduSocialMonth
()))
{
error
=
"第"
+
(
i
+
2
)
+
"行:扣社保无社保扣缴月份"
;
errorList
.
add
(
new
ErrorMessage
((
i
+
2
),
error
));
continue
;
}
if
(
CommonConstants
.
dingleDigitStrArray
[
1
].
equals
(
entity
.
getIsDeductFund
())
&&
Common
.
isEmpty
(
entity
.
getDeduProvidentMonth
()))
{
error
=
"第"
+
(
i
+
2
)
+
"行:扣公积金无公积金扣缴月份"
;
errorList
.
add
(
new
ErrorMessage
((
i
+
2
),
error
));
continue
;
}
entity
.
setInvoiceTitle
(
invoiceTitle
);
// 2022-4-29 19:31:52 hgw五一前,运营中心先发公告,紧急更新:
entity
.
setSalaryTaxFlag
(
"1"
);
if
(
entity
!=
null
)
{
tList
.
add
(
entity
);
}
}
}
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
log
.
error
(
"将jsonString数据源的数据导入到list异常!"
);
throw
new
ExcelException
(
"工资导入-将jsonString数据源的数据导入到list异常!"
,
e
);
}
this
.
setEntityList
(
tList
);
this
.
setErrorInfo
(
errorList
);
this
.
setRepeatInfo
(
repeatList
);
}
/**
* 按类型统一返回String内容
*
* @param param
* @return
*/
private
static
String
getStringValByObject
(
Object
param
)
{
if
(
null
==
param
)
{
return
null
;
}
else
if
(
param
instanceof
Integer
)
{
return
Integer
.
toString
(((
Integer
)
param
).
intValue
());
}
else
if
(
param
instanceof
String
)
{
return
(
String
)
param
;
}
else
if
(
param
instanceof
Double
)
{
return
Double
.
toString
(((
Double
)
param
).
doubleValue
());
}
else
if
(
param
instanceof
Float
)
{
return
Float
.
toString
(((
Float
)
param
).
floatValue
());
}
else
if
(
param
instanceof
Long
)
{
return
Long
.
toString
(((
Long
)
param
).
longValue
());
}
else
if
(
param
instanceof
Boolean
)
{
return
Boolean
.
toString
(((
Boolean
)
param
).
booleanValue
());
}
else
if
(
param
instanceof
Date
)
{
return
DateUtil
.
dateToString
((
Date
)
param
);
}
else
if
(
param
instanceof
LocalDateTime
)
{
return
LocalDateTimeUtils
.
formatTime
((
LocalDateTime
)
param
,
DateUtil
.
DATETIME_PATTERN_SECOND
);
}
else
{
return
param
.
toString
();
}
}
/**
* 根据属性名获取属性值
*
* @param fieldName
* @param hashMap
* @return
*/
private
static
Object
getFieldValueByName
(
String
fieldName
,
HashMap
hashMap
)
{
try
{
return
hashMap
.
get
(
fieldName
);
}
catch
(
Exception
e
)
{
return
null
;
}
}
/**
* @param fieldName 字段名
* @param o 对象
* @return 字段值
* @MethodName : getFieldValueByName
* @Description : 根据字段名获取字段值
*/
public
static
Object
getFieldValueByName
(
String
fieldName
,
Object
o
,
String
dateFormat
)
{
Object
value
=
null
;
Field
field
=
null
;
if
(
o
==
null
)
{
return
""
;
}
field
=
getFieldByName
(
fieldName
,
o
.
getClass
());
String
type
=
getFieldType
(
fieldName
,
o
.
getClass
());
if
(
field
!=
null
)
{
field
.
setAccessible
(
true
);
try
{
if
(
null
!=
type
&&
type
.
equals
(
"Date"
))
{
Date
date
=
(
Date
)
field
.
get
(
o
);
return
DateUtil
.
dateToString
(
date
,
dateFormat
==
null
?
"yyyy-MM-dd"
:
dateFormat
);
}
else
{
value
=
field
.
get
(
o
);
}
}
catch
(
IllegalAccessException
e
)
{
log
.
error
(
"根据字段名获取字段值异常:"
,
e
);
e
.
printStackTrace
();
}
}
else
{
log
.
info
(
o
.
getClass
().
getSimpleName
()
+
"类不存在字段名 "
+
fieldName
);
}
return
value
;
}
/**
* @param fieldName 字段名
* @param clazz 包含该字段的类
* @return 字段
* @MethodName : getFieldByName
* @Description : 根据字段名获取字段
*/
private
static
Field
getFieldByName
(
String
fieldName
,
Class
<?>
clazz
)
{
// 拿到本类的所有字段
Field
[]
selfFields
=
clazz
.
getDeclaredFields
();
// 如果本类中存在该字段,则返回
for
(
Field
field
:
selfFields
)
{
if
(
field
.
getName
().
equals
(
fieldName
))
{
return
field
;
}
}
// 否则,查看父类中是否存在此字段,如果有则返回
Class
<?>
superClazz
=
clazz
.
getSuperclass
();
if
(
superClazz
!=
null
&&
superClazz
!=
Object
.
class
)
{
return
getFieldByName
(
fieldName
,
superClazz
);
}
// 如果本类和父类都没有,则返回空
return
null
;
}
/**
* @param fieldName 字段名
* @param clazz 包含该字段的类
* @return 字段
* @MethodName : getFieldType
* @Description : 根据字段名获取字段类型
*/
private
static
String
getFieldType
(
String
fieldName
,
Class
<?>
clazz
)
{
// 拿到本类的所有字段
Field
[]
selfFields
=
clazz
.
getDeclaredFields
();
// 如果本类中存在该字段,则返回
for
(
Field
field
:
selfFields
)
{
if
(
field
.
getName
().
equals
(
fieldName
))
{
//如果type是类类型,则前面包含"class ",后面跟类名
String
type
=
field
.
getGenericType
().
toString
();
if
(
type
.
equals
(
"class java.lang.String"
))
{
return
"String"
;
}
else
if
(
type
.
equals
(
"class java.lang.Integer"
))
{
return
"Integer"
;
}
else
if
(
type
.
equals
(
"class java.lang.Short"
))
{
return
"Short"
;
}
else
if
(
type
.
equals
(
"class java.lang.Double"
))
{
return
"Double"
;
}
else
if
(
type
.
equals
(
"class java.lang.Boolean"
))
{
return
"Boolean"
;
}
else
if
(
type
.
equals
(
"class java.util.Date"
))
{
return
"Date"
;
}
else
{
return
null
;
}
}
}
// 否则,查看父类中是否存在此字段,如果有则返回
Class
<?>
superClazz
=
clazz
.
getSuperclass
();
if
(
superClazz
!=
null
&&
superClazz
!=
Object
.
class
)
{
return
getFieldType
(
fieldName
,
superClazz
);
}
// 如果本类和父类都没有,则返回空
return
null
;
}
/**
* 输出错误数据
*
* @param attr
* @param msg
* @param i
* @return
*/
private
String
errorInfo
(
ExcelAttribute
attr
,
String
msg
,
Integer
i
)
{
if
(
Common
.
isNotNull
(
msg
))
{
return
"第"
+
i
+
"行:"
+
attr
.
name
()
+
msg
;
}
else
if
(
Common
.
isNotNull
(
attr
.
errorInfo
()))
{
return
"第"
+
i
+
"行:"
+
attr
.
errorInfo
();
}
return
""
;
}
/**
* 实现各种校验方式的错误返回新
*
* @param c
* @param attr
* @param i
* @return
*/
public
String
validateUtil
(
String
c
,
ExcelAttribute
attr
,
int
i
)
{
//非空校验
if
(
attr
.
isNotEmpty
()
&&
Common
.
isEmpty
(
c
))
{
return
errorInfo
(
attr
,
"_字段不可为空"
,
i
);
}
if
(
Common
.
isNotNull
(
c
))
{
//日期格式校验
if
(
attr
.
isDate
())
{
DateUtil
.
stringToDate
(
c
.
trim
(),
attr
.
dateFormat
());
}
//手机号码校验
if
(
attr
.
isPhone
()
&&
getMatchRes
(
c
,
attr
,
ValidityConstants
.
MOBILE_PATTERN
))
{
return
errorInfo
(
attr
,
"_手机号码有误"
,
i
);
}
//身份证校验
if
(
attr
.
isIdCard
()
&&
getMatchRes
(
c
,
attr
,
ValidityConstants
.
IDCARD_PATTERN
))
{
return
errorInfo
(
attr
,
"_身份证格式有误"
,
i
);
}
//邮箱验证
if
(
attr
.
isEmail
()
&&
getMatchRes
(
c
,
attr
,
ValidityConstants
.
EMAIL_PATTERN
))
{
return
errorInfo
(
attr
,
"_邮箱格式有误"
,
i
);
}
//integer 验证
if
(
attr
.
isInteger
()
&&
getMatchRes
(
c
,
attr
,
ValidityConstants
.
INTEGER_PATTERN
))
{
return
errorInfo
(
attr
,
"_整数格式有误"
,
i
);
}
//float、double 验证
if
(
attr
.
isFloat
()
&&
getMatchRes
(
c
,
attr
,
ValidityConstants
.
FLOAT_PATTERN
))
{
return
errorInfo
(
attr
,
"_数字格式有误"
,
i
);
}
//最大长度校验
if
(
attr
.
maxLength
()
>
0
&&
c
.
length
()
>
attr
.
maxLength
())
{
return
errorInfo
(
attr
,
"_超出最大长度"
,
i
);
}
//最大值校验
if
(
Integer
.
parseInt
(
attr
.
max
())
>
0
)
{
if
(
Common
.
isNumber
(
c
))
{
if
(
Integer
.
parseInt
(
c
)
>
attr
.
maxLength
())
{
return
errorInfo
(
attr
,
"_超出最大值"
,
i
);
}
}
else
{
return
"第"
+
i
+
"行:"
+
"_必须为数字"
;
}
}
//最小值校验
if
(
attr
.
min
()
>
0
)
{
if
(
Common
.
isNumber
(
c
))
{
if
(
Integer
.
valueOf
(
c
).
intValue
()
>
attr
.
maxLength
())
{
return
errorInfo
(
attr
,
"_小于最小值"
,
i
);
}
}
else
{
return
"第"
+
(
i
+
2
)
+
"行:"
+
"_必须为数字"
;
}
}
}
return
null
;
}
/**
* 正则匹配返回
*
* @param c
* @param attr
* @param pattern
* @return
* @Author fxj
* @Date 2019-08-06
**/
private
boolean
getMatchRes
(
String
c
,
ExcelAttribute
attr
,
String
pattern
)
{
return
!
c
.
matches
(
Common
.
isEmpty
(
attr
.
pattern
())
?
pattern
:
attr
.
pattern
());
}
/**
* @param from 源
* @param to 反射后的目标
* @Description: 反射实体类
* @Author: hgw
* @Date: 2019/11/1 16:38
* @return: void
**/
public
static
void
reflectionAttr
(
Object
from
,
Object
to
)
{
try
{
Class
clazz1
=
Class
.
forName
(
from
.
getClass
().
getName
());
Class
clazz2
=
Class
.
forName
(
to
.
getClass
().
getName
());
// 获取两个实体类的所有属性
Field
[]
fields1
=
clazz1
.
getDeclaredFields
();
Field
[]
fields2
=
clazz2
.
getDeclaredFields
();
SalaryAccountUtil
cr
=
new
SalaryAccountUtil
();
// 遍历class1Bean,获取逐个属性值,然后遍历class2Bean查找是否有相同的属性,如有相同则赋值
for
(
Field
f1
:
fields1
)
{
if
(
f1
.
getName
().
equals
(
"id"
))
continue
;
Object
value
=
cr
.
invokeGetMethod
(
from
,
f1
.
getName
(),
null
);
for
(
Field
f2
:
fields2
)
{
if
(
f1
.
getName
().
equals
(
f2
.
getName
())
&&
!
f2
.
getName
().
equals
(
"serialVersionUID"
)
&&
!
f2
.
getName
().
equals
(
"saiList"
))
{
Object
[]
obj
=
new
Object
[
1
];
obj
[
0
]
=
value
;
cr
.
invokeSetMethod
(
to
,
f2
.
getName
(),
obj
);
}
}
}
}
catch
(
Exception
e
)
{
log
.
error
(
"反射失败"
,
e
);
e
.
printStackTrace
();
}
}
/**
* 执行某个Field的getField方法
*
* @param clazz 类
* @param fieldName 类的属性名称
* @param args 参数,默认为null
* @return
*/
public
Object
invokeGetMethod
(
Object
clazz
,
String
fieldName
,
Object
[]
args
)
{
String
methodName
=
fieldName
.
substring
(
0
,
1
).
toUpperCase
()
+
fieldName
.
substring
(
1
);
Method
method
=
null
;
try
{
if
(
methodName
.
equals
(
"SerialVersionUID"
))
{
return
""
;
}
method
=
Class
.
forName
(
clazz
.
getClass
().
getName
()).
getDeclaredMethod
(
"get"
+
methodName
);
return
method
.
invoke
(
clazz
);
}
catch
(
Exception
e
)
{
log
.
error
(
"执行某个Field的getField方法异常!"
,
e
);
return
""
;
}
}
/**
* 执行某个Field的setField方法
*
* @param clazz 类
* @param fieldName 类的属性名称
* @param args 参数,默认为null
* @return
*/
@SuppressWarnings
({
"unchecked"
,
"rawtypes"
})
private
Object
invokeSetMethod
(
Object
clazz
,
String
fieldName
,
Object
[]
args
)
{
String
methodName
=
fieldName
.
substring
(
0
,
1
).
toUpperCase
()
+
fieldName
.
substring
(
1
);
Method
method
=
null
;
try
{
Class
[]
parameterTypes
=
new
Class
[
1
];
Class
c
=
Class
.
forName
(
clazz
.
getClass
().
getName
());
Field
field
=
c
.
getDeclaredField
(
fieldName
);
parameterTypes
[
0
]
=
field
.
getType
();
method
=
c
.
getDeclaredMethod
(
"set"
+
methodName
,
parameterTypes
);
return
method
.
invoke
(
clazz
,
args
);
}
catch
(
Exception
e
)
{
log
.
error
(
"执行某个Field的setField方法异常!"
,
e
);
return
""
;
}
}
}
yifu-salary/yifu-salary-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/salary/util/SalaryCommonUtil.java
0 → 100644
View file @
ea40aebb
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
salary
.
util
;
import
com.yifu.cloud.plus.v1.yifu.archives.vo.TSettleDomainSelectVo
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttribute
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.ValidityConstants
;
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.LocalDateTimeUtils
;
import
com.yifu.cloud.plus.v1.yifu.salary.entity.TConfigSalary
;
import
com.yifu.cloud.plus.v1.yifu.salary.vo.TSalaryAccountVo
;
import
lombok.Data
;
import
lombok.extern.slf4j.Slf4j
;
import
java.io.Serializable
;
import
java.lang.reflect.Field
;
import
java.math.BigDecimal
;
import
java.time.LocalDate
;
import
java.time.LocalDateTime
;
import
java.time.format.DateTimeFormatter
;
import
java.util.Date
;
import
java.util.Map
;
import
java.util.Set
;
import
java.util.regex.Matcher
;
import
java.util.regex.Pattern
;
/**
* @author hgw
* @Description: 工资表上传公共类
*/
@Data
@Slf4j
public
class
SalaryCommonUtil
implements
Serializable
{
/**
* 按类型统一返回String内容
*
* @param param
* @return
*/
public
static
String
getStringValByObject
(
Object
param
)
{
if
(
null
==
param
)
{
return
null
;
}
else
if
(
param
instanceof
Integer
)
{
return
Integer
.
toString
(((
Integer
)
param
).
intValue
());
}
else
if
(
param
instanceof
String
)
{
return
(
String
)
param
;
}
else
if
(
param
instanceof
Double
)
{
return
Double
.
toString
(((
Double
)
param
).
doubleValue
());
}
else
if
(
param
instanceof
Float
)
{
return
Float
.
toString
(((
Float
)
param
).
floatValue
());
}
else
if
(
param
instanceof
Long
)
{
return
Long
.
toString
(((
Long
)
param
).
longValue
());
}
else
if
(
param
instanceof
Boolean
)
{
return
Boolean
.
toString
(((
Boolean
)
param
).
booleanValue
());
}
else
if
(
param
instanceof
Date
)
{
return
DateUtil
.
dateToString
((
Date
)
param
);
}
else
if
(
param
instanceof
LocalDateTime
)
{
return
LocalDateTimeUtils
.
formatTime
((
LocalDateTime
)
param
,
DateUtil
.
DATETIME_PATTERN_SECOND
);
}
else
{
return
param
.
toString
();
}
}
/**
* 根据属性名获取属性值
*
* @param fieldName
* @param hashMap
* @return
*/
public
static
Object
getFieldValueByName
(
String
fieldName
,
Map
hashMap
)
{
try
{
return
hashMap
.
get
(
fieldName
);
}
catch
(
Exception
e
)
{
return
null
;
}
}
/**
* @param fieldName 字段名
* @param o 对象
* @return 字段值
* @MethodName : getFieldValueByName
* @Description : 根据字段名获取字段值
*/
public
static
Object
getFieldValueByName
(
String
fieldName
,
Object
o
,
String
dateFormat
)
{
Object
value
=
null
;
Field
field
=
null
;
if
(
o
==
null
)
{
return
""
;
}
field
=
getFieldByName
(
fieldName
,
o
.
getClass
());
String
type
=
getFieldType
(
fieldName
,
o
.
getClass
());
if
(
field
!=
null
)
{
field
.
setAccessible
(
true
);
try
{
if
(
null
!=
type
&&
type
.
equals
(
"Date"
))
{
Date
date
=
(
Date
)
field
.
get
(
o
);
return
DateUtil
.
dateToString
(
date
,
dateFormat
==
null
?
"yyyy-MM-dd"
:
dateFormat
);
}
else
{
value
=
field
.
get
(
o
);
}
}
catch
(
IllegalAccessException
e
)
{
e
.
printStackTrace
();
log
.
error
(
"getFieldValueByName错误:"
,
e
);
}
}
else
{
log
.
info
(
o
.
getClass
().
getSimpleName
()
+
"类不存在字段名 "
+
fieldName
);
}
return
value
;
}
/**
* @param fieldName 字段名
* @param clazz 包含该字段的类
* @return 字段
* @MethodName : getFieldByName
* @Description : 根据字段名获取字段
*/
public
static
Field
getFieldByName
(
String
fieldName
,
Class
<?>
clazz
)
{
// 拿到本类的所有字段
Field
[]
selfFields
=
clazz
.
getDeclaredFields
();
// 如果本类中存在该字段,则返回
for
(
Field
field
:
selfFields
)
{
if
(
field
.
getName
().
equals
(
fieldName
))
{
return
field
;
}
}
// 否则,查看父类中是否存在此字段,如果有则返回
Class
<?>
superClazz
=
clazz
.
getSuperclass
();
if
(
superClazz
!=
null
&&
superClazz
!=
Object
.
class
)
{
return
getFieldByName
(
fieldName
,
superClazz
);
}
// 如果本类和父类都没有,则返回空
return
null
;
}
/**
* @param fieldName 字段名
* @param clazz 包含该字段的类
* @return 字段
* @MethodName : getFieldType
* @Description : 根据字段名获取字段类型
*/
public
static
String
getFieldType
(
String
fieldName
,
Class
<?>
clazz
)
{
// 拿到本类的所有字段
Field
[]
selfFields
=
clazz
.
getDeclaredFields
();
// 如果本类中存在该字段,则返回
for
(
Field
field
:
selfFields
)
{
if
(
field
.
getName
().
equals
(
fieldName
))
{
//如果type是类类型,则前面包含"class ",后面跟类名
String
type
=
field
.
getGenericType
().
toString
();
if
(
type
.
equals
(
"class java.lang.String"
))
{
return
"String"
;
}
else
if
(
type
.
equals
(
"class java.lang.Integer"
))
{
return
"Integer"
;
}
else
if
(
type
.
equals
(
"class java.lang.Short"
))
{
return
"Short"
;
}
else
if
(
type
.
equals
(
"class java.lang.Double"
))
{
return
"Double"
;
}
else
if
(
type
.
equals
(
"class java.lang.Boolean"
))
{
return
"Boolean"
;
}
else
if
(
type
.
equals
(
"class java.util.Date"
))
{
return
"Date"
;
}
else
{
return
null
;
}
}
}
// 否则,查看父类中是否存在此字段,如果有则返回
Class
<?>
superClazz
=
clazz
.
getSuperclass
();
if
(
superClazz
!=
null
&&
superClazz
!=
Object
.
class
)
{
return
getFieldType
(
fieldName
,
superClazz
);
}
// 如果本类和父类都没有,则返回空
return
null
;
}
/**
* 输出错误数据
*
* @param attr
* @param msg
* @param i
* @return
*/
public
static
String
errorInfo
(
ExcelAttribute
attr
,
String
msg
,
Integer
i
)
{
if
(
Common
.
isNotNull
(
msg
))
{
return
"第"
+
i
+
"行:"
+
attr
.
name
()
+
msg
;
}
else
if
(
Common
.
isNotNull
(
attr
.
errorInfo
()))
{
return
"第"
+
i
+
"行:"
+
attr
.
errorInfo
();
}
return
""
;
}
/**
* 实现各种校验方式的错误返回新
*
* @param c
* @param attr
* @param i
* @return
*/
public
static
String
validateUtil
(
String
c
,
ExcelAttribute
attr
,
int
i
)
{
//非空校验
if
(
attr
.
isNotEmpty
()
&&
Common
.
isEmpty
(
c
))
{
return
SalaryCommonUtil
.
errorInfo
(
attr
,
"_字段不可为空"
,
i
);
}
if
(
Common
.
isNotNull
(
c
))
{
//日期格式校验
if
(
attr
.
isDate
())
{
DateUtil
.
stringToDate
(
c
.
trim
(),
attr
.
dateFormat
());
}
//手机号码校验
if
(
attr
.
isPhone
()
&&
getMatchRes
(
c
,
attr
,
ValidityConstants
.
MOBILE_PATTERN
))
{
return
errorInfo
(
attr
,
"_手机号码有误"
,
i
);
}
//身份证校验
if
(
attr
.
isIdCard
()
&&
getMatchRes
(
c
,
attr
,
ValidityConstants
.
IDCARD_PATTERN
))
{
return
errorInfo
(
attr
,
"_身份证格式有误"
,
i
);
}
//邮箱验证
if
(
attr
.
isEmail
()
&&
getMatchRes
(
c
,
attr
,
ValidityConstants
.
EMAIL_PATTERN
))
{
return
errorInfo
(
attr
,
"_邮箱格式有误"
,
i
);
}
//integer 验证
if
(
attr
.
isInteger
()
&&
getMatchRes
(
c
,
attr
,
ValidityConstants
.
INTEGER_PATTERN
))
{
return
errorInfo
(
attr
,
"_整数格式有误"
,
i
);
}
//float、double 验证
if
(
attr
.
isFloat
()
&&
getMatchRes
(
c
,
attr
,
ValidityConstants
.
FLOAT_PATTERN
))
{
return
errorInfo
(
attr
,
"_数字格式有误"
,
i
);
}
//最大长度校验
if
(
attr
.
maxLength
()
>
0
&&
c
.
length
()
>
attr
.
maxLength
())
{
return
errorInfo
(
attr
,
"_超出最大长度"
,
i
);
}
//最大值校验
if
(
Integer
.
parseInt
(
attr
.
max
())
>
0
)
{
if
(
Common
.
isNumber
(
c
))
{
if
(
Integer
.
parseInt
(
c
)
>
attr
.
maxLength
())
{
return
errorInfo
(
attr
,
"_超出最大值"
,
i
);
}
}
else
{
return
"第"
+
i
+
"行:"
+
"_必须为数字"
;
}
}
//最小值校验
if
(
attr
.
min
()
>
0
)
{
if
(
Common
.
isNumber
(
c
))
{
if
(
Integer
.
parseInt
(
c
)
>
attr
.
maxLength
())
{
return
errorInfo
(
attr
,
"_小于最小值"
,
i
);
}
}
else
{
return
"第"
+
i
+
"行:"
+
"_必须为数字"
;
}
}
}
return
null
;
}
/**
* 正则匹配返回
*
* @param c
* @param attr
* @param pattern
* @return
* @Author fxj
* @Date 2019-08-06
**/
public
static
boolean
getMatchRes
(
String
c
,
ExcelAttribute
attr
,
String
pattern
)
{
return
!
c
.
matches
(
Common
.
isEmpty
(
attr
.
pattern
())
?
pattern
:
attr
.
pattern
());
}
// 判断一个字符串是否含有数字
public
static
boolean
HasNumber
(
String
content
)
{
boolean
flag
=
false
;
Pattern
p
=
Pattern
.
compile
(
".*\\d+.*"
);
Matcher
m
=
p
.
matcher
(
content
);
if
(
m
.
matches
())
{
flag
=
true
;
}
return
flag
;
}
/**
* @param field
* @param cellValueStr
* @param attr
* @param fieldType
* @param entity
* @Description: 总入口:塞属性
* @Author: hgw
* @Date: 2021/1/11 11:18
* @return: void
**/
public
static
<
T
>
void
setFields
(
Field
field
,
String
cellValueStr
,
ExcelAttribute
attr
,
Class
<?>
fieldType
,
T
entity
)
throws
IllegalAccessException
{
if
(
String
.
class
==
fieldType
)
{
setStringField
(
field
,
cellValueStr
,
entity
);
}
else
if
(
BigDecimal
.
class
==
fieldType
)
{
setBigDecimalField
(
field
,
cellValueStr
,
entity
);
}
else
if
(
Date
.
class
==
fieldType
&&
Common
.
isNotNull
(
cellValueStr
.
trim
()))
{
setDateField
(
field
,
cellValueStr
,
attr
,
entity
);
}
else
if
((
Integer
.
TYPE
==
fieldType
)
||
(
Integer
.
class
==
fieldType
))
{
setIntegerField
(
field
,
cellValueStr
,
entity
);
}
else
if
((
Long
.
TYPE
==
fieldType
)
||
(
Long
.
class
==
fieldType
))
{
field
.
set
(
entity
,
Long
.
valueOf
(
cellValueStr
));
}
setOtherField
(
field
,
cellValueStr
,
attr
,
fieldType
,
entity
);
}
/**
* @param field
* @param cellValueStr
* @param attr
* @param fieldType
* @param entity
* @Description: 判断其他值
* @Author: hgw
* @Date: 2021/1/11 11:49
* @return: void
**/
private
static
<
T
>
void
setOtherField
(
Field
field
,
String
cellValueStr
,
ExcelAttribute
attr
,
Class
<?>
fieldType
,
T
entity
)
throws
IllegalAccessException
{
if
((
Float
.
TYPE
==
fieldType
)
||
(
Float
.
class
==
fieldType
))
{
field
.
set
(
entity
,
Float
.
valueOf
(
cellValueStr
));
}
else
if
((
Short
.
TYPE
==
fieldType
)
||
(
Short
.
class
==
fieldType
))
{
field
.
set
(
entity
,
Short
.
valueOf
(
cellValueStr
));
}
else
if
((
Double
.
TYPE
==
fieldType
)
||
(
Double
.
class
==
fieldType
))
{
field
.
set
(
entity
,
Double
.
valueOf
(
cellValueStr
));
}
else
if
(
Character
.
TYPE
==
fieldType
)
{
setCharField
(
field
,
cellValueStr
,
entity
);
}
else
if
(
LocalDateTime
.
class
==
fieldType
&&
Common
.
isNotNull
(
cellValueStr
.
trim
()))
{
setLocalDateTimeField
(
field
,
cellValueStr
,
attr
,
entity
);
}
else
if
(
LocalDate
.
class
==
fieldType
&&
Common
.
isNotNull
(
cellValueStr
.
trim
()))
{
setLocalDateTileField
(
field
,
cellValueStr
,
attr
,
entity
);
}
}
/**
* @param field
* @param cellValueStr
* @param attr
* @param entity
* @Description: 判断LocalDate
* @Author: hgw
* @Date: 2021/1/11 11:49
* @return: void
**/
private
static
<
T
>
void
setLocalDateTileField
(
Field
field
,
String
cellValueStr
,
ExcelAttribute
attr
,
T
entity
)
throws
IllegalAccessException
{
field
.
set
(
entity
,
LocalDate
.
parse
(
cellValueStr
.
trim
(),
Common
.
isEmpty
(
attr
.
dateFormat
())
?
DateTimeFormatter
.
ofPattern
(
DateUtil
.
DATETIME_YYYYMM
)
:
DateTimeFormatter
.
ofPattern
(
attr
.
dateFormat
())));
}
/**
* @param field
* @param cellValueStr
* @param attr
* @param entity
* @Description: 判断LocalDateTime
* @Author: hgw
* @Date: 2021/1/11 11:49
* @return: void
**/
private
static
<
T
>
void
setLocalDateTimeField
(
Field
field
,
String
cellValueStr
,
ExcelAttribute
attr
,
T
entity
)
throws
IllegalAccessException
{
field
.
set
(
entity
,
LocalDateTimeUtils
.
convertDateToLDT
(
DateUtil
.
stringToDate
(
cellValueStr
.
trim
(),
Common
.
isEmpty
(
attr
.
dateFormat
())
?
DateUtil
.
DATETIME_PATTERN_SECOND
:
attr
.
dateFormat
())));
}
/**
* @param field
* @param cellValueStr
* @param entity
* @Description: 判断Char
* @Author: hgw
* @Date: 2021/1/11 11:48
* @return: void
**/
private
static
<
T
>
void
setCharField
(
Field
field
,
String
cellValueStr
,
T
entity
)
throws
IllegalAccessException
{
if
(
cellValueStr
!=
null
&&
cellValueStr
.
length
()
>
0
)
{
field
.
set
(
entity
,
cellValueStr
.
charAt
(
0
));
}
}
/**
* @param field
* @param cellValueStr
* @param entity
* @Description: 判断整型
* @Author: hgw
* @Date: 2021/1/11 11:48
* @return: void
**/
private
static
<
T
>
void
setIntegerField
(
Field
field
,
String
cellValueStr
,
T
entity
)
throws
IllegalAccessException
{
if
(
"否"
.
equals
(
cellValueStr
))
{
field
.
set
(
entity
,
0
);
}
else
if
(
"是"
.
equals
(
cellValueStr
))
{
field
.
set
(
entity
,
1
);
}
else
{
field
.
set
(
entity
,
Integer
.
parseInt
(
cellValueStr
));
}
}
/**
* @param field
* @param cellValueStr
* @param attr
* @param entity
* @Description: 判断日期
* @Author: hgw
* @Date: 2021/1/11 11:48
* @return: void
**/
private
static
<
T
>
void
setDateField
(
Field
field
,
String
cellValueStr
,
ExcelAttribute
attr
,
T
entity
)
throws
IllegalAccessException
{
field
.
set
(
entity
,
DateUtil
.
stringToDate
(
cellValueStr
.
trim
(),
Common
.
isEmpty
(
attr
.
dateFormat
())
?
DateUtil
.
ISO_EXPANDED_DATE_FORMAT
:
attr
.
dateFormat
()));
}
/**
* @param field
* @param cellValueStr
* @param entity
* @Description: 判断金额
* @Author: hgw
* @Date: 2021/1/11 11:48
* @return: void
**/
private
static
<
T
>
void
setBigDecimalField
(
Field
field
,
String
cellValueStr
,
T
entity
)
throws
IllegalAccessException
{
if
(
cellValueStr
.
indexOf
(
'%'
)
!=
-
1
)
{
cellValueStr
=
cellValueStr
.
replace
(
"%"
,
""
);
}
field
.
set
(
entity
,
BigDecimal
.
valueOf
(
Double
.
valueOf
(
cellValueStr
)));
}
/**
* @param field
* @param cellValueStr
* @param entity
* @Description: 判断固定字符串,塞值
* @Author: hgw
* @Date: 2021/1/11 11:47
* @return: void
**/
private
static
<
T
>
void
setStringField
(
Field
field
,
String
cellValueStr
,
T
entity
)
throws
IllegalAccessException
{
if
(
"否"
.
equals
(
cellValueStr
))
{
field
.
set
(
entity
,
"0"
);
}
else
if
(
"是"
.
equals
(
cellValueStr
))
{
field
.
set
(
entity
,
"1"
);
}
else
if
(
"暂停发"
.
equals
(
cellValueStr
))
{
field
.
set
(
entity
,
"1"
);
}
else
if
(
"立即发"
.
equals
(
cellValueStr
))
{
field
.
set
(
entity
,
"0"
);
}
else
if
(
"现金"
.
equals
(
cellValueStr
))
{
field
.
set
(
entity
,
"0"
);
}
else
if
(
"银行"
.
equals
(
cellValueStr
))
{
field
.
set
(
entity
,
"1"
);
}
else
if
(
"线下"
.
equals
(
cellValueStr
))
{
field
.
set
(
entity
,
"2"
);
}
else
if
(
"合并"
.
equals
(
cellValueStr
))
{
field
.
set
(
entity
,
"0"
);
}
else
if
(
"单独"
.
equals
(
cellValueStr
))
{
field
.
set
(
entity
,
"1"
);
}
else
{
field
.
set
(
entity
,
cellValueStr
);
}
}
/**
* @param configSalary
* @param entity
* @Description: 填充配置项属性
* @Author: hgw
* @Date: 2021/1/11 17:09
* @return: void
**/
public
static
void
setConfigSalary
(
TConfigSalary
configSalary
,
TSalaryAccountVo
entity
)
{
if
(
configSalary
!=
null
&&
configSalary
.
getId
()
!=
null
)
{
entity
.
setSalaryDate
(
DateUtil
.
addMonth
(
configSalary
.
getSalaryMonth
()));
entity
.
setSettlementMonth
(
DateUtil
.
addMonth
(
configSalary
.
getSettleMonth
()));
entity
.
setDeduSocialMonth
(
DateUtil
.
addMonth
(
configSalary
.
getSocialMonth
()));
entity
.
setDeduProvidentMonth
(
DateUtil
.
addMonth
(
configSalary
.
getFundMonth
()));
entity
.
setSocialPriority
(
String
.
valueOf
(
configSalary
.
getSocialPriority
()));
entity
.
setFundPriority
(
String
.
valueOf
(
configSalary
.
getFundPriority
()));
entity
.
setAnnualBonusType
(
String
.
valueOf
(
configSalary
.
getAnnualBonusType
()));
}
}
/**
* @param salaryType
* @param dept
* @param entity
* @param salaryGiveTimeFlag
* @Description:
* @Author: hgw
* @Date: 2021/1/11 17:19
* @return: void
**/
public
static
void
setAccountBaseInfo
(
String
salaryType
,
TSettleDomainSelectVo
dept
,
TSalaryAccountVo
entity
,
boolean
salaryGiveTimeFlag
)
{
if
(
Common
.
isEmpty
(
entity
.
getSalaryTaxFlag
()))
{
entity
.
setSalaryTaxFlag
(
CommonConstants
.
ONE_STRING
);
//默认扣税
}
entity
.
setDistributionFlag
(
CommonConstants
.
ZERO_STRING
);
if
(
Common
.
isEmpty
(
entity
.
getSalaryGiveTime
()))
{
if
(
salaryGiveTimeFlag
)
{
entity
.
setSalaryGiveTime
(
CommonConstants
.
ZERO_STRING
);
}
else
{
entity
.
setSalaryGiveTime
(
CommonConstants
.
ONE_STRING
);
}
}
entity
.
setDeleteFlag
(
SalaryConstants
.
NOT_DELETE
);
entity
.
setSettleDepartId
(
dept
.
getId
());
entity
.
setSettleDepartNo
(
dept
.
getDepartNo
());
entity
.
setSettleDepartName
(
dept
.
getDepartName
());
entity
.
setSalaryType
(
salaryType
);
}
/**
* @Description: 简单的Set转化为String
* @Author: hgw
* @Date: 2022-1-11 11:16:50
* @return: java.lang.String
**/
public
static
String
setToStrEasy
(
Set
<
String
>
strSet
)
{
String
result
=
""
;
if
(
strSet
!=
null
&&
!
strSet
.
isEmpty
())
{
int
i
=
0
;
for
(
String
str
:
strSet
)
{
if
(
i
==
0
)
{
result
=
str
;
}
else
{
result
=
result
.
concat
(
","
).
concat
(
str
);
}
i
++;
}
}
return
result
;
}
}
yifu-salary/yifu-salary-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/salary/util/SalaryConstants.java
0 → 100644
View file @
ea40aebb
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
salary
.
util
;
import
java.math.BigDecimal
;
public
class
SalaryConstants
{
//cellValueBig.setScale(2, BigDecimal.ROUND_HALF_UP); //四舍五入
//在使用BigDecmial进行比较的时候不能使用equals与==比较了,需要使用compareTo()进行比较
//if ( temp1.compareTo(temp2)==0)
//结果是true比较大小可以用 temp2.compareTo(temp2) 返回值 -1 小于 0 等于 1 大于
//例子:if (yearFinal != null && yearFinal.compareTo(SalaryConstants.B_ZERO) == SalaryConstants.MORE_THAN )
//加法 + bigDecimal1.add(bigDecimal2)
//减法 - bigDecimal1.subtract(bigDecimal2)
//乘法 x bigDecimal1.multiply(bigDecimal2)
//除法 / bigDecimal1.divide(bigDecimal2)
// 项目报销的 数据来源:0企业微信;1固资划转
public
static
final
Integer
[]
DATA_SOURCE
=
{
0
,
1
};
// 保存类型:0:保存;1不保存
public
static
final
Integer
[]
SAVE_TYPE
=
{
0
,
1
};
//应发工资、年终奖、薪资扣税、年终奖扣税、个人社保扣缴、代扣个人社保、个人公积金扣缴、代扣个人公积金、年个税个人代扣、企业年金、专项扣除、减除费用、实发工资
public
static
final
String
[]
ACCOUNT_SORT
=
{
"应发工资"
,
"年终奖"
,
"个税"
,
"年终奖单独扣税"
,
"个人社保"
,
"代扣个人社保"
,
"个人公积金"
,
"代扣个人公积金"
,
"免个税个人代扣"
,
"企业(职业)年金"
,
"累计专项扣除总额"
,
"减除费用"
,
"实发工资"
,
"个人实发合计"
};
//通用身份证号长度
public
static
final
int
idCardLength
=
18
;
public
static
final
String
NON_TAX
=
"非扣税项"
;
/*
* @Description: 0待提交1待审核 3待发放4已发放5审核不通过6确认不通过7财务退回8:结算单调整待审核 9: 结算单调整待打印
* @Author: hgw
* @Date: 2019/10/10 14:55
* @return:
**/
public
static
final
Integer
[]
AUDIT_STATUS
=
{
0
,
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
9
};
public
static
final
String
[]
AUDIT_STATUS_STRING
=
{
"待提交"
,
"待审核"
,
"-"
,
"待发放"
,
"已发放"
,
"审核不通过"
,
"确认不通过"
,
"财务退回"
,
"结算单调整待审核"
,
"结算单调整待打印"
};
//发放失败-认领状态 0待认领1待出账2已发放3再次失败待认领
public
static
final
Integer
[]
LOST_STATUS
=
{
0
,
1
,
2
,
3
};
//申请垫付流程状态( 0:未申请 1已申请 2申请不通过 3申请已通过)
public
static
final
Integer
[]
ADVANCE_STATUS
=
{
0
,
1
,
2
,
3
};
//收入表(TIncomeTable)//来源类型(fromType):(1工资结算单/2代理预估单/3商险结算单/4一次性业务结算单/5其他收入)/6工程工资结算单/7纯收入
public
static
final
Integer
[]
INCOME_TABLE_FROM_TYPE
=
{
0
,
1
,
2
,
3
,
4
,
5
,
6
,
7
};
//发放失败关联报账类型:0工资;1工程工资 2:非扣税项3暂停发 4自定义暂停发
public
static
final
Integer
[]
ACCOUNT_TYPE
=
{
0
,
1
,
2
,
3
,
4
};
//开票关联结算单类型:0普通工资/1工程工资/2商险/3预估结算单/4一次性业务结算单
public
static
final
String
[]
INVOICE_TYPE
=
{
"0"
,
"1"
,
"2"
,
"3"
,
"4"
};
//开票审核状态(0待提交/1待审核/2审核通过/3审核不通过)
public
static
final
String
[]
INVOICE_AUDITFLAG
=
{
"0"
,
"1"
,
"2"
,
"3"
};
//开票状态(0待开票/1已开票)
public
static
final
String
[]
INVOICE_STATUS
=
{
"0"
,
"1"
};
//附件类型:0工资;1工程工资;2暂停发;3自定义项暂停发;4薪资打印记录;5核准表打印记录;6:非扣税项 7发放失败 8自有员工附件 10换人换卡附件
public
static
final
Integer
[]
LINK_TYPE
=
{
0
,
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
10
};
//打印来源:0:工资结算单;1:工程结算单;2:暂停发发放记录;
public
static
final
Integer
[]
PRINT_FROM_TYPE
=
{
0
,
1
,
2
};
//暂停发发放记录类型:0:工资暂停发;1:工程工资暂停发;2:普通自定义项暂停发 5:工程自定义项暂停发
public
static
final
Integer
[]
TYPE_OF_CHARGE
=
{
0
,
1
,
2
,
3
,
4
,
5
};
//工程文件类型:0三方协议;1委托付款函;2劳务费;3其他
public
static
final
Integer
[]
ENGINEER_TYPE
=
{
0
,
1
,
2
,
3
};
//发放状态 0: 未发放 1: 发放成功 2:发放失败
public
static
final
String
[]
DISTRIBUTION_FLAG
=
{
"0"
,
"1"
,
"2"
};
//暂停发-发放状态 0: 待发放 1: 发放成功 2:发放失败;3:待审核4:审核退回 5失败待认领 6失败待发放 7失败已发放 8再次失败待认领9不发放
public
static
final
Integer
[]
CHARGE_STATUS
=
{
0
,
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
9
};
public
static
final
String
[]
SALARY_FORM_TYPE
=
{
"工资"
,
"绩效"
,
"其他"
,
"劳务费"
,
""
,
""
,
""
,
"非扣税项"
};
//款项来源(0客户到款/1垫付)
public
static
final
Integer
[]
MONEY_FROM
=
{
0
,
1
};
//暂停发类型 0: 工资 1: 工程
public
static
final
Integer
[]
PAUSE_TYPE
=
{
0
,
1
};
//付款方式 0: 现金 1: 银行
public
static
final
Integer
[]
SALARY_PAY_TYPE
=
{
0
,
1
};
//所得税类型:0:工资;1:年终奖
public
static
final
Integer
[]
SALARY_TAX_TYPE
=
{
0
,
1
};
//小数位
public
static
final
int
PLACES
=
2
;
public
static
final
int
TAX_FEE_PLACES
=
6
;
public
static
final
BigDecimal
B_ZERO
=
new
BigDecimal
(
"0"
);
public
static
final
BigDecimal
B_ONE
=
new
BigDecimal
(
"1"
);
public
static
final
BigDecimal
B_TWELVE
=
new
BigDecimal
(
"12"
);
public
static
final
BigDecimal
B_ONEHUNDRED
=
new
BigDecimal
(
"100"
);
//小于
public
static
final
int
LESS_THAN
=
-
1
;
//等于
public
static
final
int
EQUAL
=
0
;
//大于
public
static
final
int
MORE_THAN
=
1
;
//模板列必填
public
static
final
String
IS_MUST
=
"1"
;
public
static
final
String
EMP_NAME
=
"姓名"
;
public
static
final
String
IF_NEW_EMPLOYEE
=
"是否新员工(默认否)"
;
public
static
final
String
IS_NEW
=
"是"
;
public
static
final
String
ID_NUMBER
=
"身份证号"
;
public
static
final
String
CHECK_ID_NUMBER
=
"身份证号码"
;
public
static
final
String
SALARY_GIVE_TIME
=
"暂停发"
;
public
static
final
String
SOCIAL_CRATE_MONTH
=
"社保生成月份"
;
public
static
final
String
SOCIAL_MONTH
=
"社保缴纳月份"
;
public
static
final
String
FUND_CRATE_MONTH
=
"公积金生成月份"
;
public
static
final
String
FUND_MONTH
=
"公积金缴纳月份"
;
//结算主体-管理费项目
public
static
final
String
MANAGE_SERVER_ITEM
=
"MANAGE_SERVER_ITEM"
;
//结算主体-风险金项目
public
static
final
String
RISK_SERVER_ITEM
=
"RISK_SERVER_ITEM"
;
//暂停发
public
static
final
String
SALARY_GIVE_TIME_VALUE
=
"1"
;
//0:生成月;
public
static
final
String
PRIORITY_ZERO
=
"0"
;
//1:缴纳月
public
static
final
String
PRIORITY_ONE
=
"1"
;
//deleteFlag; //0:未删除; 1:已删除
public
static
final
Integer
NOT_DELETE
=
0
;
//deleteFlag; //0:未删除; 1:已删除
public
static
final
Integer
DELETED
=
1
;
//扣缴(社保、公积金)
public
static
final
String
IS_DEDUCT_ONE
=
"1"
;
//扣缴(社保、公积金)int
public
static
final
Integer
IS_DEDUCT_ONE_INT
=
1
;
//社保
public
static
final
Integer
IS_SOCIAL_ZERO
=
0
;
//公积金
public
static
final
Integer
IS_FUND_ONE
=
1
;
//正常扣缴社保
public
static
final
Integer
NOT_IS_NO_SALARY_ZERO
=
0
;
//无工资人员扣缴社保
public
static
final
Integer
IS_NO_SALARY_ONE
=
1
;
public
static
final
String
CASH
=
"现金"
;
//工资发放方式-现金
public
static
final
String
SALARY_STYLE_CASH
=
"0"
;
//工资发放方式-银行
public
static
final
String
SALARY_STYLE_BANK
=
"1"
;
//工资发放方式-线下
public
static
final
Integer
SALARY_STYLE_OFFLINE
=
2
;
//发放方式 1: 银付 0.现金 2:线下
public
static
final
Integer
[]
CHARGE_TYPE
=
{
0
,
1
,
2
};
public
static
final
String
COST_REDUCTION
=
"减除费用"
;
//减除费用
public
static
final
String
COST_REDUCTION_JAVA
=
"costReduction"
;
//代扣个人社保
public
static
final
String
WITHHOLIDING_PERSON_SOCIAL
=
"withholidingPersonSocial"
;
//代扣个人公积金
public
static
final
String
WITHHOLIDING_PERSON_FUND
=
"withholidingPersonFund"
;
//代扣单位社保"
public
static
final
String
WITHHOLIDING_UNIT_SOCIAL
=
"withholidingUnitSocial"
;
//代扣单位公积金
public
static
final
String
WITHHOLIDING_UNIT_FUND
=
"withholidingUnitFund"
;
public
static
final
String
PERSONAL_SOCIAL
=
"个人社保"
;
public
static
final
String
PERSONAL_FUND
=
"个人公积金"
;
public
static
final
String
UNIT_SOCIAL
=
"单位社保"
;
public
static
final
String
UNIT_FUND
=
"单位公积金"
;
public
static
final
String
PERSONAL_DEBT
=
"个人社保、公积金欠款"
;
public
static
final
String
PERSONAL_DEBT_JAVA
=
"personalDebt"
;
// 工程工资的叫法
public
static
final
String
ENG_SALARY_RELAY
=
"工资应发"
;
public
static
final
String
RELAY_SALARY
=
"应发工资"
;
//工资应发
public
static
final
String
RELAY_SALARY_JAVA
=
"relaySalary"
;
//个人社保
public
static
final
String
PERSONAL_SOCIAL_JAVA
=
"personalSocial"
;
//个人公积金
public
static
final
String
PERSONAL_FUND_JAVA
=
"personalFund"
;
//单位社保
public
static
final
String
UNIT_SOCIAL_JAVA
=
"unitSocial"
;
//单位公积金
public
static
final
String
UNIT_FUND_JAVA
=
"unitFund"
;
//商险
public
static
final
String
TAKING_RISKS_JAVA
=
"takingRisks"
;
//单位待补足——报账表,计算的是个人社保、公积金欠款——PERSONAL_DEBT_JAVA
public
static
final
String
UNIT_SUPPLEMENT_JAVA
=
"unitSupplement"
;
//个人待补足
public
static
final
String
CURRENT_SUPPLY_JAVA
=
"currentSupply"
;
//年终奖
public
static
final
String
ANNUAL_BONUS_JAVA
=
"annualBonus"
;
public
static
final
String
PRE_CURRENT_SUPPLY
=
"前次个人待补足"
;
//前次个人待补足
public
static
final
String
PRE_CURRENT_SUPPLY_JAVA
=
"preCurrentSupply"
;
//专项扣除-专区
public
static
final
String
SPECIAL_DEDU_MONEY_SUM
=
"累计专项扣除总额"
;
//累计专项扣除总额
public
static
final
String
SPECIAL_DEDU_MONEY_SUM_JAVA
=
"specialDeduMoney"
;
public
static
final
String
SUM_CHILD_EDU_MONEY
=
"累计子女教育"
;
//累计子女教育
public
static
final
String
SUM_CHILD_EDU_MONEY_JAVA
=
"sumChildEduMoney"
;
public
static
final
String
SUM_HOUSING_LOAN_MONEY
=
"累计住房贷款利息"
;
//累计住房贷款利息
public
static
final
String
SUM_HOUSING_LOAN_MONEY_JAVA
=
"sumHousingLoanMoney"
;
public
static
final
String
SUM_HOUSING_RENT_MONEY
=
"累计住房租金"
;
//累计住房租金
public
static
final
String
SUM_HOUSING_RENT_MONEY_JAVA
=
"sumHousingRentMoney"
;
public
static
final
String
SUM_SUPPORT_ELDERLY_MONEY
=
"累计赡养老人"
;
//累计赡养老人
public
static
final
String
SUM_SUPPORT_ELDERLY_MONEY_JAVA
=
"sumSupportElderlyMoney"
;
public
static
final
String
SUM_CONTINUING_EDUCATION_MONEY
=
"累计继续教育"
;
//累计继续教育
public
static
final
String
SUM_CONTINUING_EDUCATION_MONEY_JAVA
=
"sumContinuingEducationMoney"
;
//累计婴幼儿照护费用
public
static
final
String
SUM_BABY_MONEY
=
"累计婴幼儿照护费用"
;
public
static
final
String
SUM_BABY_MONEY_JAVA
=
"sumBabyMoney"
;
public
static
final
String
ANNUAL_BONUS_TAX
=
"年终奖单独扣税"
;
//年终奖扣税
public
static
final
String
ANNUAL_BONUS_TAX_JAVA
=
"annualBonusTax"
;
//薪资扣税
public
static
final
String
SALARY_TAX
=
"个税"
;
//薪资扣税
public
static
final
String
SALARY_TAX_JAVA
=
"salaryTax"
;
public
static
final
String
ACTUAL_SALARY_SUM
=
"个人实发合计"
;
//个人实发合计
public
static
final
String
ACTUAL_SALARY_SUM_JAVA
=
"actualSalarySum"
;
//个人代扣
public
static
final
String
PDEDUCTION_JAVA
=
"pdeduction"
;
//单位代扣
public
static
final
String
UDEDUCTION_JAVA
=
"udeduction"
;
//免个税个人代扣
public
static
final
String
EXEMPTION_PERSION_TAX_JAVA
=
"exemptionPersionTax"
;
//企业(职业)年金
public
static
final
String
ENTERPRISE_ANNUITY_JAVA
=
"enterpriseAnnuity"
;
//独保费
public
static
final
String
ONLY_CHILD_JAVA
=
"onlyChild"
;
//风险抵押金
public
static
final
String
RISK_MORTGAGE_MONEY_JAVA
=
"riskMortgageMoney"
;
//单位补足扣返
public
static
final
String
UNIT_SUPPLY_JAVA
=
"unitSupply"
;
//其他费用1
public
static
final
String
OTHER_MONEY_ONE_JAVA
=
"otherMoneyOne"
;
//其他费用2
public
static
final
String
OTHER_MONEY_TWO_JAVA
=
"otherMoneyTwo"
;
//其他费用3
public
static
final
String
OTHER_MONEY_THREE_JAVA
=
"otherMoneyThree"
;
//个人社保卡费
public
static
final
String
PERSONAL_SOCIAL_CARD_JAVA
=
"personalSocialCard"
;
//单位社保卡费
public
static
final
String
UNIT_SOCIAL_CARD_JAVA
=
"unitSocialCard"
;
//工程类设置:
//应发工资
public
static
final
String
SALARY_SUM_JAVA
=
"relaySalary"
;
/**
* 未找到工资表
**/
public
static
final
String
NO_SALARY
=
"未找到工资表"
;
/**
* 未找到工程工资表
**/
public
static
final
String
NO_ENGINEER_SALARY
=
"未找到工程工资表"
;
//标记发放失败
public
static
final
String
FAILUE_MARK
=
"标记“发放失败”"
;
//发放失败重新发放
public
static
final
String
FAILUE_RESENDER
=
"重新发放"
;
//发放失败出账
public
static
final
String
FAILUE_SENDER
=
"“发放失败”出账"
;
//发放失败出账退回
public
static
final
String
FAILUE_SENDER_BACK
=
"“发放失败”出账退回"
;
//员工姓名/收款单位
public
static
final
String
FILE_EMPNAME_ORGNAME
=
"员工姓名/收款单位"
;
//银行账号
public
static
final
String
FILE_BANK_NO
=
"银行账号"
;
//派单限制统计表更新类型(0认领更新/1撤销认领更新/2匹配更新/3取消匹配更新)
public
static
final
Integer
[]
DISPATCH_UPDTYPE
=
{
0
,
1
,
2
,
3
};
}
yifu-salary/yifu-salary-biz/src/main/resources/mapper/TSalaryAccountItemMapper.xml
View file @
ea40aebb
...
...
@@ -357,7 +357,67 @@
</where>
order by a.SETTLEMENT_MONTH,a.id desc
</select>
<select
id=
"getSumByAccountId"
resultType=
"java.util.Map"
>
<resultMap
id=
"tSalaryAccountItemMap"
type=
"com.yifu.cloud.plus.v1.yifu.salary.entity.TSalaryAccountItem"
>
<id
property=
"id"
column=
"ID"
/>
<result
property=
"salaryAccountId"
column=
"SALARY_ACCOUNT_ID"
/>
<result
property=
"cnName"
column=
"CN_NAME"
/>
<result
property=
"javaFiedName"
column=
"JAVA_FIED_NAME"
/>
<result
property=
"salaryMoney"
column=
"SALARY_MONEY"
/>
<result
property=
"isTax"
column=
"IS_TAX"
/>
<result
property=
"textValue"
column=
"TEXT_VALUE"
/>
</resultMap>
<!-- 工资导入优化使用的vo -->
<resultMap
id=
"itemVoMap"
type=
"com.yifu.cloud.plus.v1.yifu.salary.entity.TSalaryAccountItem"
>
<id
property=
"id"
column=
"ID"
/>
<result
property=
"salaryAccountId"
column=
"SALARY_ACCOUNT_ID"
/>
<result
property=
"cnName"
column=
"CN_NAME"
/>
<result
property=
"javaFiedName"
column=
"JAVA_FIED_NAME"
/>
<result
property=
"salaryMoney"
column=
"SALARY_MONEY"
/>
<result
property=
"textValue"
column=
"TEXT_VALUE"
/>
<result
property=
"isTax"
column=
"IS_TAX"
/>
<result
property=
"empIdcard"
column=
"EMP_IDCARD"
/>
<result
property=
"settlementMonth"
column=
"SETTLEMENT_MONTH"
/>
<result
property=
"salaryType"
column=
"SALARY_TYPE"
/>
</resultMap>
<sql
id=
"Base_Column_List"
>
a.ID,
a.SALARY_ACCOUNT_ID,
a.CN_NAME,
a.JAVA_FIED_NAME,
a.SALARY_MONEY,
a.IS_TAX,
a.TEXT_VALUE
</sql>
<sql
id=
"tSalaryAccountItem_where"
>
<if
test=
"tSalaryAccountItem != null"
>
<if
test=
"tSalaryAccountItem.id != null and tSalaryAccountItem.id.trim() != ''"
>
AND a.ID = #{tSalaryAccountItem.id}
</if>
<if
test=
"tSalaryAccountItem.salaryAccountId != null and tSalaryAccountItem.salaryAccountId.trim() != ''"
>
AND a.SALARY_ACCOUNT_ID = #{tSalaryAccountItem.salaryAccountId}
</if>
<if
test=
"tSalaryAccountItem.cnName != null and tSalaryAccountItem.cnName.trim() != ''"
>
AND a.CN_NAME = #{tSalaryAccountItem.cnName}
</if>
<if
test=
"tSalaryAccountItem.javaFiedName != null and tSalaryAccountItem.javaFiedName.trim() != ''"
>
AND a.JAVA_FIED_NAME = #{tSalaryAccountItem.javaFiedName}
</if>
<if
test=
"tSalaryAccountItem.salaryMoney != null"
>
AND a.SALARY_MONEY = #{tSalaryAccountItem.salaryMoney}
</if>
<if
test=
"tSalaryAccountItem.isTax != null"
>
AND a.IS_TAX = #{tSalaryAccountItem.isTax}
</if>
<if
test=
"tSalaryAccountItem.textValue != null and tSalaryAccountItem.textValue.trim() != ''"
>
AND a.TEXT_VALUE = #{tSalaryAccountItem.textValue}
</if>
</if>
</sql>
<!--tSalaryAccountItem简单分页查询-->
<select
id=
"getTSalaryAccountItemPage"
resultMap=
"tSalaryAccountItemMap"
>
SELECT
a.SALARY_ACCOUNT_ID as 'key',
a.SALARY_MONEY as 'value'
...
...
@@ -415,4 +475,82 @@
</where>
</select>
<select
id=
"getAllTSalaryAccountItem"
resultMap=
"tSalaryAccountItemMap"
>
SELECT
i.ID,
i.SALARY_ACCOUNT_ID,
i.CN_NAME,
i.JAVA_FIED_NAME,
i.SALARY_MONEY,
i.TEXT_VALUE,
i.IS_TAX
FROM
t_salary_account_item i left join t_salary_account a on i.SALARY_ACCOUNT_ID = a.ID
<where>
a.DELETE_FLAG = 0
<if
test=
"settleDepartId != null and settleDepartId.trim() != ''"
>
AND a.SETTLE_DEPART_ID = #{settleDepartId}
</if>
<if
test=
"settleMonth != null and settleMonth.trim() != ''"
>
AND a.SETTLEMENT_MONTH = #{settleMonth}
</if>
<if
test=
"javaFiedName != null and javaFiedName.trim() != ''"
>
AND i.JAVA_FIED_NAME = #{javaFiedName}
</if>
<if
test=
"finallyYear != null and finallyYear.trim() != ''"
>
AND a.SETTLEMENT_MONTH like concat(#{finallyYear}, '%')
</if>
<if
test=
"empIdcard != null and empIdcard.trim() != ''"
>
AND a.EMP_IDCARD = #{empIdcard}
</if>
<if
test=
"accountId != null and accountId.trim() != ''"
>
AND a.id != #{accountId}
</if>
</where>
</select>
<!-- 获取所有数据,组装map,工资导入使用 -->
<select
id=
"getAllItemVoList"
resultMap=
"itemVoMap"
>
SELECT
i.ID,
i.SALARY_ACCOUNT_ID,
i.CN_NAME,
i.JAVA_FIED_NAME,
i.SALARY_MONEY,
i.TEXT_VALUE,
i.IS_TAX,
a.EMP_IDCARD,
a.SETTLEMENT_MONTH,
a.SALARY_TYPE
FROM
t_salary_account_item i left join t_salary_account a on i.SALARY_ACCOUNT_ID = a.ID
<where>
a.SETTLEMENT_MONTH like DATE_FORMAT(now(),"%Y%")
<if
test=
"idCardList != null"
>
AND a.EMP_IDCARD in
<foreach
item=
"item"
index=
"index"
collection=
"idCardList"
open=
"("
separator=
","
close=
")"
>
#{item}
</foreach>
</if>
<if
test=
"invoiceTitle != null and invoiceTitle.trim() != ''"
>
AND a.INVOICE_TITLE = #{invoiceTitle}
</if>
AND a.DELETE_FLAG = 0 and a.SALARY_TYPE != 7
</where>
</select>
<select
id=
"getSumByAccountId"
resultType=
"java.util.Map"
>
SELECT
a.SALARY_ACCOUNT_ID as 'key',
a.SALARY_MONEY as 'value'
FROM
t_salary_account_item a
WHERE
a.SALARY_ACCOUNT_ID IN
<foreach
item=
"item"
index=
"index"
collection=
"account"
open=
"("
separator=
","
close=
")"
>
#{item.id}
</foreach>
and
a.JAVA_FIED_NAME='actualSalarySum'
</select>
</mapper>
yifu-salary/yifu-salary-biz/src/main/resources/mapper/TSalaryAccountMapper.xml
View file @
ea40aebb
...
...
@@ -246,4 +246,23 @@
<include
refid=
"tSalaryAccount_where"
/>
</where>
</select>
<!-- 获取校验的报账明细 ### 格式:身份证号_工资月份_报表类型_应发金额 -->
<select
id=
"getAccountCheckList"
resultType=
"com.yifu.cloud.plus.v1.yifu.salary.vo.AccountCheckVo"
>
select
CONCAT(a.EMP_IDCARD,"_",a.SALARY_DATE,"_",a.FORM_TYPE) title,ifnull(ifnull(relaySalary.SALARY_MONEY,actSalary.SALARY_MONEY),0) relaySalary
from t_salary_account a
left join t_salary_account_item relaySalary on relaySalary.SALARY_ACCOUNT_ID = a.id and relaySalary.JAVA_FIED_NAME='relaySalary'
left join t_salary_account_item actSalary on actSalary.SALARY_ACCOUNT_ID = a.id and actSalary.JAVA_FIED_NAME='actualSalarySum'
where a.DELETE_FLAG = 0 and a.SETTLE_DEPART_ID = #{settleId} and a.SETTLEMENT_MONTH = #{settleMonth}
</select>
<!-- 获取当前年最小计税月 -->
<select
id=
"getMinTaxMonthByNowYear"
resultType=
"java.lang.String"
>
select
min(a.TAX_MONTH - 0)
from t_salary_account a
where a.EMP_IDCARD = #{empIdCard} and a.DELETE_FLAG = 0 and a.SETTLEMENT_MONTH like concat(#{nowYear},"%")
and a.FORM_TYPE != '3'
</select>
</mapper>
yifu-social/yifu-social-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/social/service/impl/SysBaseSetInfoServiceImpl.java
View file @
ea40aebb
...
...
@@ -225,8 +225,8 @@ public class SysBaseSetInfoServiceImpl extends ServiceImpl<SysBaseSetInfoMapper,
sysBaseSetInfo
.
setDeleteFlag
(
CommonConstants
.
ZERO_STRING
);
sysBaseSetInfo
.
setIsNew
(
CommonConstants
.
ONE_STRING
);
baseMapper
.
insert
(
sysBaseSetInfo
);
//
TODO-
测试用(同步社保公积金查询、预估库),后面可删除
tForecastLibraryService
.
updateForecastLibaryBySysBase
(
sysBaseSetInfo
);
// 测试用(同步社保公积金查询、预估库),后面可删除
//tForecastLibraryService.updateForecastLibaryBySysBase(sysBaseSetInfo)
}
List
<
SysPayProportion
>
payProportionList
=
sysBaseSetInfo
.
getFundProList
();
if
(
Common
.
isNotNull
(
payProportionList
))
{
...
...
yifu-social/yifu-social-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/social/service/impl/TForecastLibraryServiceImpl.java
View file @
ea40aebb
...
...
@@ -1423,7 +1423,7 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
if
(
newSysBaseSetInfo
==
null
)
{
sysBaseSetInfoList
=
sysBaseSetInfoMapper
.
selectList
(
Wrappers
.<
SysBaseSetInfo
>
query
().
lambda
()
.
eq
(
SysBaseSetInfo:
:
getIsNew
,
CommonConstants
.
ONE_
INT
));
.
eq
(
SysBaseSetInfo:
:
getIsNew
,
CommonConstants
.
ONE_
STRING
));
}
else
{
sysBaseSetInfoList
.
add
(
newSysBaseSetInfo
);
}
...
...
@@ -1463,6 +1463,8 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
socialFundInfoMap
.
put
(
socialFundInfo
.
getId
(),
socialFundInfo
);
}
}
sysBaseSetInfo
.
setIsNew
(
CommonConstants
.
ZERO_STRING
);
sysBaseSetInfoMapper
.
updateById
(
sysBaseSetInfo
);
}
for
(
TSocialFundInfo
socialFundInfo
:
socialFundInfoMap
.
values
())
{
this
.
updateForecastLibaryCore
(
socialFundInfo
,
socialFundInfo
.
getDoMonth
(),
true
);
...
...
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