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
c6db9a1e
Commit
c6db9a1e
authored
Jul 20, 2022
by
hongguangwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
合同优化-待提交
parent
04526494
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
1283 additions
and
33 deletions
+1283
-33
TEmployeeInfo.java
...ifu/cloud/plus/v1/yifu/archives/entity/TEmployeeInfo.java
+2
-1
TEmployeeProject.java
.../cloud/plus/v1/yifu/archives/entity/TEmployeeProject.java
+3
-0
EmployeeContractUpdateVO.java
...ud/plus/v1/yifu/archives/vo/EmployeeContractUpdateVO.java
+0
-1
EmployeeContractConstants.java
...v1/yifu/archives/constants/EmployeeContractConstants.java
+1
-0
TEmployeeContractInfoServiceImpl.java
...chives/service/impl/TEmployeeContractInfoServiceImpl.java
+70
-21
CommonConstants.java
...ud.plus.v1/yifu/common/core/constant/CommonConstants.java
+1
-0
SocialConstants.java
.../cloud/plus/v1/yifu/social/constants/SocialConstants.java
+11
-0
TForecastLibraryController.java
...v1/yifu/social/controller/TForecastLibraryController.java
+24
-3
SysBaseSetInfoMapper.java
...loud/plus/v1/yifu/social/mapper/SysBaseSetInfoMapper.java
+10
-0
TSocialFundInfoMapper.java
...oud/plus/v1/yifu/social/mapper/TSocialFundInfoMapper.java
+20
-0
TForecastLibraryService.java
.../plus/v1/yifu/social/service/TForecastLibraryService.java
+25
-2
TForecastLibraryServiceImpl.java
...yifu/social/service/impl/TForecastLibraryServiceImpl.java
+1007
-5
ServiceUtil.java
.../com/yifu/cloud/plus/v1/yifu/social/util/ServiceUtil.java
+61
-0
SysBaseSetInfoMapper.xml
...al-biz/src/main/resources/mapper/SysBaseSetInfoMapper.xml
+11
-0
TSocialFundInfoMapper.xml
...l-biz/src/main/resources/mapper/TSocialFundInfoMapper.xml
+37
-0
No files found.
yifu-archives/yifu-archives-api/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/entity/TEmployeeInfo.java
View file @
c6db9a1e
...
...
@@ -275,7 +275,8 @@ public class TEmployeeInfo extends BaseEntity {
/**
* 员工合同状态(字典)
*/
@Schema
(
description
=
"员工合同状态(字典)0初始状态"
)
@Schema
(
description
=
"员工合同状态(字典)0初始状态 personnel_state"
)
@ExcelAttribute
(
name
=
"员工合同状态"
,
isDataId
=
true
,
dataType
=
ExcelAttributeConstants
.
PERSONNEL_STATE
)
private
Integer
contractStatus
;
/**
...
...
yifu-archives/yifu-archives-api/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/entity/TEmployeeProject.java
View file @
c6db9a1e
...
...
@@ -17,6 +17,8 @@
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
archives
.
entity
;
import
com.baomidou.mybatisplus.annotation.*
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttribute
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttributeConstants
;
import
com.yifu.cloud.plus.v1.yifu.common.mybatis.base.BaseEntity
;
import
io.swagger.v3.oas.annotations.media.Schema
;
import
lombok.Data
;
...
...
@@ -341,6 +343,7 @@ public class TEmployeeProject extends BaseEntity {
* 员工合同状态(字典)
*/
@Schema
(
description
=
"员工合同状态(字典)0初始状态"
)
@ExcelAttribute
(
name
=
"合同状态"
,
isDataId
=
true
,
dataType
=
ExcelAttributeConstants
.
PERSONNEL_STATE
)
private
Integer
contractStatus
;
}
yifu-archives/yifu-archives-api/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/vo/EmployeeContractUpdateVO.java
View file @
c6db9a1e
...
...
@@ -58,7 +58,6 @@ public class EmployeeContractUpdateVO extends RowIndex implements Serializable {
/**
* 合同编号
*/
@NotBlank
(
message
=
"合同编号不能为空"
)
@Length
(
max
=
50
,
message
=
"合同编号不能超过50个字符"
)
@ExcelAttribute
(
name
=
"合同编号"
,
maxLength
=
50
)
@Schema
(
description
=
"合同编号"
,
name
=
"contractNo"
)
...
...
yifu-archives/yifu-archives-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/constants/EmployeeContractConstants.java
View file @
c6db9a1e
...
...
@@ -2,6 +2,7 @@ package com.yifu.cloud.plus.v1.yifu.archives.constants;
public
class
EmployeeContractConstants
{
public
static
final
String
NO_CONTRACT_FILE_CABINET
=
"合同编号、档案柜号不可同时为空"
;
public
static
final
String
NO_INFO
=
"未找到记录"
;
public
static
final
String
NOT_CREATE_USER
=
"不是创建人,无法删除"
;
...
...
yifu-archives/yifu-archives-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/service/impl/TEmployeeContractInfoServiceImpl.java
View file @
c6db9a1e
...
...
@@ -223,30 +223,35 @@ public class TEmployeeContractInfoServiceImpl extends ServiceImpl<TEmployeeContr
tEmployeeContractInfo
.
setIsObsolete
(
CommonConstants
.
ZERO_STRING
);
tEmployeeContractInfo
.
setDeleteFlag
(
CommonConstants
.
ZERO_INT
);
if
(
Common
.
isEmpty
(
tEmployeeContractInfo
.
getApplyNo
()))
{
tEmployeeContractInfo
.
setApplyNo
(
this
.
getCode
());
tEmployeeContractInfo
.
setApplyNo
(
this
.
getCode
(
false
));
}
}
/**
* @param
* @param
isNew true:取数据库最新的
* @Description: 获取 申请编码
* @Author: hgw
* @Date: 2022/6/22 17:52
* @return: java.lang.String
**/
private
synchronized
String
getCode
()
{
private
synchronized
String
getCode
(
boolean
isNew
)
{
String
nowDay
=
DateUtil
.
getThisDay
();
int
nowNums
;
String
empCode
=
null
;
Cache
cache
=
cacheManager
.
getCache
(
CacheConstants
.
EVERYDAY_EMP_CONTRACT_CODE
);
Object
nowNumObj
=
cache
.
get
(
nowDay
);
int
nowNums
=
1
;
if
(
Common
.
isNotNull
(
nowNumObj
))
{
SimpleValueWrapper
value
=
(
SimpleValueWrapper
)
nowNumObj
;
nowNums
=
(
Integer
)
value
.
get
()
+
1
;
if
(
isNew
)
{
empCode
=
baseMapper
.
getMaxContractCode
();
nowNums
=
Integer
.
parseInt
(
empCode
)
+
1
;
}
else
{
String
empCode
=
null
;
try
{
empCode
=
baseMapper
.
getMaxContractCode
();
nowNums
=
Integer
.
parseInt
(
empCode
)
+
1
;
Object
nowNumObj
=
cache
.
get
(
nowDay
);
if
(
Common
.
isNotNull
(
nowNumObj
))
{
SimpleValueWrapper
value
=
(
SimpleValueWrapper
)
nowNumObj
;
nowNums
=
(
Integer
)
value
.
get
()
+
1
;
}
else
{
empCode
=
baseMapper
.
getMaxContractCode
();
nowNums
=
Integer
.
parseInt
(
empCode
)
+
1
;
}
}
catch
(
NumberFormatException
e
)
{
log
.
error
(
"获取人员合同当日最大编码时出错:"
+
empCode
);
nowNums
=
1
;
...
...
@@ -307,11 +312,7 @@ public class TEmployeeContractInfoServiceImpl extends ServiceImpl<TEmployeeContr
// 针对编码再做一次重复性校验
String
isCur
=
baseMapper
.
getContractByApplyNo
(
tEmployeeContractInfo
.
getApplyNo
());
if
(
Common
.
isNotNull
(
isCur
))
{
String
code
=
this
.
getCode
();
isCur
=
baseMapper
.
getContractByApplyNo
(
tEmployeeContractInfo
.
getApplyNo
());
if
(
Common
.
isNotNull
(
isCur
))
{
return
R
.
failed
(
"编码已被占用,请稍后再新增:"
+
code
);
}
String
code
=
this
.
getCode
(
true
);
tEmployeeContractInfo
.
setApplyNo
(
code
);
}
baseMapper
.
insert
(
tEmployeeContractInfo
);
...
...
@@ -414,17 +415,65 @@ public class TEmployeeContractInfoServiceImpl extends ServiceImpl<TEmployeeContr
return
R
.
failed
(
"不是待审核状态!"
);
}
if
(
tEmployeeContractInfo
.
getAuditStatus
()
==
CommonConstants
.
dingleDigitIntArray
[
2
])
{
//先停用项目内的其他的员工合同
baseMapper
.
updateInUseStatusById
(
contractInfo
.
getEmpId
(),
contractInfo
.
getSettleDomain
()
,
contractInfo
.
getId
(),
CommonConstants
.
ONE_STRING
);
// 作废、终止,不变为在用
if
(
Common
.
isEmpty
(
contractInfo
.
getSituation
())
||
(!
EmployeeConstants
.
SITUATION_SIX
.
equals
(
contractInfo
.
getSituation
())
&&
!
EmployeeConstants
.
SITUATION_SEVEN
.
equals
(
contractInfo
.
getSituation
())))
{
tEmployeeContractInfo
.
setInUse
(
CommonConstants
.
ZERO_STRING
);
// 更新档案、项目合同状态为(1可用)
TEmployeeProject
tEmployeeProject
=
tEmployeeProjectService
.
getOne
(
Wrappers
.<
TEmployeeProject
>
query
()
.
lambda
().
eq
(
TEmployeeProject:
:
getEmpId
,
contractInfo
.
getEmpId
())
.
eq
(
TEmployeeProject:
:
getDeptId
,
contractInfo
.
getSettleDomain
())
.
eq
(
TEmployeeProject:
:
getProjectStatus
,
CommonConstants
.
ZERO_INT
)
.
eq
(
TEmployeeProject:
:
getDeleteFlag
,
CommonConstants
.
STATUS_NORMAL
)
.
last
(
CommonConstants
.
LAST_ONE_SQL
));
if
(
tEmployeeProject
!=
null
)
{
tEmployeeProject
.
setContractStatus
(
CommonConstants
.
ONE_INT
);
tEmployeeProjectService
.
updateById
(
tEmployeeProject
);
}
// 更新档案、项目合同状态为(1在用)
TEmployeeInfo
tEmployeeInfo
=
tEmployeeInfoService
.
getById
(
tEmployeeContractInfo
.
getEmpId
());
if
(
tEmployeeInfo
!=
null
)
{
tEmployeeInfo
.
setContractStatus
(
CommonConstants
.
ONE_INT
);
tEmployeeInfoService
.
updateById
(
tEmployeeInfo
);
}
}
else
{
// 作废、终止审核通过:
// 更新项目合同状态为(2不在用),档案状态要判断
TEmployeeProject
tEmployeeProject
=
tEmployeeProjectService
.
getOne
(
Wrappers
.<
TEmployeeProject
>
query
()
.
lambda
().
eq
(
TEmployeeProject:
:
getEmpId
,
contractInfo
.
getEmpId
())
.
eq
(
TEmployeeProject:
:
getDeptId
,
contractInfo
.
getSettleDomain
())
.
eq
(
TEmployeeProject:
:
getProjectStatus
,
CommonConstants
.
ZERO_INT
)
.
eq
(
TEmployeeProject:
:
getDeleteFlag
,
CommonConstants
.
STATUS_NORMAL
)
.
last
(
CommonConstants
.
LAST_ONE_SQL
));
if
(
tEmployeeProject
!=
null
)
{
tEmployeeProject
.
setContractStatus
(
CommonConstants
.
TWO_INT
);
tEmployeeProjectService
.
updateById
(
tEmployeeProject
);
}
// 更新档案、项目合同状态为(0无合同 1在用 2不在用)
TEmployeeInfo
tEmployeeInfo
=
tEmployeeInfoService
.
getById
(
tEmployeeContractInfo
.
getEmpId
());
if
(
tEmployeeInfo
!=
null
)
{
// 判断人员有无审核通过的其他合同
TEmployeeContractInfo
contractInfoInUse
=
this
.
getOne
(
Wrappers
.<
TEmployeeContractInfo
>
query
()
.
lambda
().
eq
(
TEmployeeContractInfo:
:
getEmpId
,
contractInfo
.
getEmpId
())
.
eq
(
TEmployeeContractInfo:
:
getInUse
,
CommonConstants
.
ZERO_INT
)
.
eq
(
TEmployeeContractInfo:
:
getDeleteFlag
,
CommonConstants
.
ZERO_INT
)
.
last
(
CommonConstants
.
LAST_ONE_SQL
));
if
(
contractInfoInUse
!=
null
)
{
tEmployeeInfo
.
setContractStatus
(
CommonConstants
.
ONE_INT
);
}
else
{
tEmployeeInfo
.
setContractStatus
(
CommonConstants
.
TWO_INT
);
}
tEmployeeInfoService
.
updateById
(
tEmployeeInfo
);
}
}
tEmployeeContractInfo
.
setAuditTimeLast
(
LocalDateTime
.
now
());
//先停用项目内的其他的员工合同
baseMapper
.
updateInUseStatusById
(
contractInfo
.
getEmpId
(),
contractInfo
.
getSettleDomain
()
,
contractInfo
.
getId
(),
CommonConstants
.
ONE_STRING
);
}
// 不是待提交,记录审核记录
this
.
setAuditInfo
(
tEmployeeContractInfo
);
...
...
@@ -617,7 +666,7 @@ public class TEmployeeContractInfoServiceImpl extends ServiceImpl<TEmployeeContr
}
}
}
else
{
errorMessageList
.
add
(
new
ErrorMessage
(
excel
.
getRowIndex
(),
EmployeeContractConstants
.
NO_
INFO
));
errorMessageList
.
add
(
new
ErrorMessage
(
excel
.
getRowIndex
(),
EmployeeContractConstants
.
NO_
CONTRACT_FILE_CABINET
));
}
}
else
{
errorMessageList
.
add
(
new
ErrorMessage
(
CommonConstants
.
ZERO_INT
,
EmployeeContractConstants
.
NO_INFO
));
...
...
yifu-common/yifu-common-core/src/main/java/com/yifu.cloud.plus.v1/yifu/common/core/constant/CommonConstants.java
View file @
c6db9a1e
...
...
@@ -170,6 +170,7 @@ public interface CommonConstants {
* @author fxj
*/
int
ONE_INT
=
1
;
int
TWO_INT
=
2
;
/**
* 个位数字(阿里编码规约不允许直接使用‘魔法值’)
...
...
yifu-social/yifu-social-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/social/constants/SocialConstants.java
0 → 100644
View file @
c6db9a1e
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
social
.
constants
;
/**
* @author hgw2
* @description 社保固定文字
* @date 2022/7/19
*/
public
class
SocialConstants
{
// 社保补缴配置有误!
public
static
final
String
SOCIAL_SET_ERROR
=
"社保补缴配置有误!"
;
}
yifu-social/yifu-social-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/social/controller/TForecastLibraryController.java
View file @
c6db9a1e
...
...
@@ -19,7 +19,7 @@ package com.yifu.cloud.plus.v1.yifu.social.controller;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.
ErrorMessage
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.
Common
;
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.social.entity.TForecastLibrary
;
...
...
@@ -28,11 +28,9 @@ import io.swagger.v3.oas.annotations.Operation;
import
io.swagger.v3.oas.annotations.security.SecurityRequirement
;
import
io.swagger.v3.oas.annotations.tags.Tag
;
import
lombok.RequiredArgsConstructor
;
import
lombok.SneakyThrows
;
import
org.springframework.http.HttpHeaders
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.multipart.MultipartFile
;
import
javax.servlet.http.HttpServletResponse
;
import
java.util.List
;
...
...
@@ -147,4 +145,27 @@ public class TForecastLibraryController {
public
void
export
(
HttpServletResponse
response
,
@RequestBody
TForecastLibrary
searchVo
)
{
tForecastLibraryService
.
listExport
(
response
,
searchVo
);
}
/**
* @param payMonths 缴纳月
* @param empIdCard 身份证
* @param settleDomainIds 项目ids
* @Description: 按缴纳月重新生成
* @Author: hgw
* @Date: 2022/7/18 17:12
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.lang.Boolean>
**/
@Operation
(
summary
=
"按缴纳月重新生成"
,
description
=
"按缴纳月重新生成:hasPermission('social_tforecastlibrary_create')"
)
@SysLog
(
"按缴纳月重新生成"
)
@PostMapping
(
"/createForecastlibary"
)
@PreAuthorize
(
"@pms.hasPermission('social_tforecastlibrary_create')"
)
public
R
<
Boolean
>
createForecastlibary
(
@RequestParam
String
payMonths
,
@RequestParam
(
value
=
"empIdCard"
,
required
=
false
)
String
empIdCard
,
@RequestParam
(
value
=
"settleDomainIds"
,
required
=
false
)
String
settleDomainIds
)
{
if
(
Common
.
isEmpty
(
empIdCard
)
&&
Common
.
isEmpty
(
settleDomainIds
))
{
return
R
.
failed
(
"参数有误:身份证或项目ID不可为空!"
);
}
return
tForecastLibraryService
.
createForecastlibary
(
payMonths
,
empIdCard
,
settleDomainIds
);
}
}
yifu-social/yifu-social-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/social/mapper/SysBaseSetInfoMapper.java
View file @
c6db9a1e
...
...
@@ -44,6 +44,16 @@ public interface SysBaseSetInfoMapper extends BaseMapper<SysBaseSetInfo> {
List
<
SysBaseSetInfo
>
getAllByEntity
(
@Param
(
"sysBaseSetInfo"
)
SysBaseSetInfo
sysBaseSetInfo
);
/**
* 获取基数配置
* @Author fxj
* @Date 2019-10-08
* @param sysBaseSetInfo
* @return
**/
List
<
SysBaseSetInfo
>
getSysBaseSetInfoNoPage
(
@Param
(
"sysBaseSetInfo"
)
SysBaseSetInfo
sysBaseSetInfo
);
/**
* @Author fxj
* @Description 获取对应户名称的公积金基数信息
...
...
yifu-social/yifu-social-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/social/mapper/TSocialFundInfoMapper.java
View file @
c6db9a1e
...
...
@@ -23,6 +23,9 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import
com.yifu.cloud.plus.v1.yifu.social.entity.TSocialFundInfo
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
/**
* 社保公积金查询表
*
...
...
@@ -37,4 +40,21 @@ public interface TSocialFundInfoMapper extends BaseMapper<TSocialFundInfo> {
* @return
*/
IPage
<
TSocialFundInfo
>
getTSocialFundInfoPage
(
Page
<
TSocialFundInfo
>
page
,
@Param
(
"tSocialFundInfo"
)
TSocialFundInfo
tSocialFundInfo
);
/**
* @Description: 获取可生成预估的社保
* @Author: hgw
* @Date: 2022/7/19 19:09
* @return: java.util.List<com.yifu.cloud.plus.v1.yifu.social.entity.TSocialFundInfo>
**/
List
<
TSocialFundInfo
>
getSocialList
(
@Param
(
"empIdCard"
)
String
empIdCard
,
@Param
(
"settleDomainIds"
)
List
<
String
>
settleDomainIds
);
/**
* @Description: 获取可生成预估的公积金
* @Author: hgw
* @Date: 2022/7/19 19:09
* @return: java.util.List<com.yifu.cloud.plus.v1.yifu.social.entity.TSocialFundInfo>
**/
List
<
TSocialFundInfo
>
getFundList
(
@Param
(
"empIdCard"
)
String
empIdCard
,
@Param
(
"settleDomainIds"
)
List
<
String
>
settleDomainIds
);
}
yifu-social/yifu-social-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/social/service/TForecastLibraryService.java
View file @
c6db9a1e
...
...
@@ -20,12 +20,13 @@ package com.yifu.cloud.plus.v1.yifu.social.service;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.ErrorMessage
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.R
;
import
com.yifu.cloud.plus.v1.yifu.social.entity.TAgentConfig
;
import
com.yifu.cloud.plus.v1.yifu.social.entity.TForecastLibrary
;
import
com.yifu.cloud.plus.v1.yifu.social.entity.TSocialFundInfo
;
import
javax.servlet.http.HttpServletResponse
;
import
java.
io.InputStream
;
import
java.
util.HashMap
;
import
java.util.List
;
/**
...
...
@@ -46,4 +47,26 @@ public interface TForecastLibraryService extends IService<TForecastLibrary> {
void
listExport
(
HttpServletResponse
response
,
TForecastLibrary
searchVo
);
List
<
TForecastLibrary
>
noPageDiy
(
TForecastLibrary
searchVo
);
/**
* @param payMonths 缴纳月
* @param empIdCard 身份证
* @param settleDomainIds 项目id
* @Description: 按缴纳月重新生成
* @Author: hgw
* @Date: 2022/7/18 17:11
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.lang.Boolean>
**/
R
<
Boolean
>
createForecastlibary
(
String
payMonths
,
String
empIdCard
,
String
settleDomainIds
);
/**
* @Description: 填充预估实际金额
* @Author: hgw
* @Date: 2020/10/10 16:45
* @return: com.yifu.cloud.v1.hrms.api.entity.TForecastLibrary
**/
TForecastLibrary
initForecastLibrary
(
TForecastLibrary
library
,
TSocialFundInfo
socialInfo
,
TSocialFundInfo
fund
,
Integer
month
,
boolean
isReduceFund
,
boolean
isReduceSocial
,
HashMap
<
String
,
TAgentConfig
>
agentConfigMap
);
}
yifu-social/yifu-social-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/social/service/impl/TForecastLibraryServiceImpl.java
View file @
c6db9a1e
...
...
@@ -25,22 +25,30 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.Common
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.DateUtil
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.ExcelUtil
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.*
;
import
com.yifu.cloud.plus.v1.yifu.common.mybatis.base.BaseEntity
;
import
com.yifu.cloud.plus.v1.yifu.social.constants.SocialConstants
;
import
com.yifu.cloud.plus.v1.yifu.social.entity.SysBaseSetInfo
;
import
com.yifu.cloud.plus.v1.yifu.social.entity.TAgentConfig
;
import
com.yifu.cloud.plus.v1.yifu.social.entity.TForecastLibrary
;
import
com.yifu.cloud.plus.v1.yifu.social.entity.TSocialFundInfo
;
import
com.yifu.cloud.plus.v1.yifu.social.mapper.SysBaseSetInfoMapper
;
import
com.yifu.cloud.plus.v1.yifu.social.mapper.TAgentConfigMapper
;
import
com.yifu.cloud.plus.v1.yifu.social.mapper.TForecastLibraryMapper
;
import
com.yifu.cloud.plus.v1.yifu.social.mapper.TSocialFundInfoMapper
;
import
com.yifu.cloud.plus.v1.yifu.social.service.TForecastLibraryService
;
import
com.yifu.cloud.plus.v1.yifu.social.util.ServiceUtil
;
import
lombok.RequiredArgsConstructor
;
import
lombok.extern.log4j.Log4j2
;
import
org.springframework.stereotype.Service
;
import
javax.servlet.ServletOutputStream
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.IOException
;
import
java.math.BigDecimal
;
import
java.net.URLEncoder
;
import
java.
util.ArrayList
;
import
java.util.
List
;
import
java.
time.LocalDateTime
;
import
java.util.
*
;
/**
* 预估费用
...
...
@@ -50,7 +58,15 @@ import java.util.List;
*/
@Log4j2
@Service
@RequiredArgsConstructor
public
class
TForecastLibraryServiceImpl
extends
ServiceImpl
<
TForecastLibraryMapper
,
TForecastLibrary
>
implements
TForecastLibraryService
{
private
final
TAgentConfigMapper
agentConfigMapper
;
private
final
TSocialFundInfoMapper
socialFundInfoMapper
;
private
final
SysBaseSetInfoMapper
sysBaseSetInfoMapper
;
/**
* 预估费用简单分页查询
*
...
...
@@ -162,4 +178,990 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
}
return
wrapper
;
}
/**
* @param payMonths 缴纳月
* @param empIdCard 身份证
* @param settleDomainIds
* @Description: 按缴纳月生成
* @Author: hgw
* @Date: 2022/7/19 18:58
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.lang.Boolean>
**/
@Override
public
R
<
Boolean
>
createForecastlibary
(
String
payMonths
,
String
empIdCard
,
String
settleDomainIds
)
{
//定义未推送的按条件查询得到的预估数据
List
<
TForecastLibrary
>
libraryList
=
null
;
//定义已推送的按条件查询得到的预估数据
List
<
TForecastLibrary
>
libraryListTemp
=
null
;
List
<
String
>
settleDomainIdList
=
Common
.
initStrToList
(
settleDomainIds
,
CommonConstants
.
COMMA_STRING
);
List
<
String
>
payMonthList
=
Common
.
initStrToList
(
payMonths
,
CommonConstants
.
COMMA_STRING
);
if
(
Common
.
isEmpty
(
payMonths
)
||
payMonthList
==
null
)
{
return
R
.
failed
(
"月份必填!"
);
}
//查询出所有符合条件的社保数据
List
<
TSocialFundInfo
>
socialInfoList
=
null
;
List
<
TSocialFundInfo
>
fundList
=
null
;
// 查询当年所有的社保临时政策用于生成预估数据
List
<
TAgentConfig
>
configList
=
agentConfigMapper
.
selectList
(
Wrappers
.<
TAgentConfig
>
query
().
lambda
()
.
eq
(
TAgentConfig:
:
getOpenFlag
,
CommonConstants
.
ZERO_INT
));
HashMap
<
String
,
TAgentConfig
>
agentConfigHashMap
=
new
HashMap
<>();
if
(
Common
.
isNotNull
(
configList
)
&&
Common
.
isNotNull
(
payMonthList
))
{
initConfigByPayMonths
(
configList
,
payMonthList
,
agentConfigHashMap
);
}
//查询出所有对应条件的预估数、社保数据、公积金数据据用于重新生成
if
(
Common
.
isNotNull
(
empIdCard
))
{
libraryList
=
baseMapper
.
selectList
(
Wrappers
.<
TForecastLibrary
>
query
().
lambda
()
.
eq
(
TForecastLibrary:
:
getEmpIdcard
,
empIdCard
)
.
and
(
obj1
->
obj1
.
in
(
TForecastLibrary:
:
getSocialPayMonth
,
payMonthList
)
.
or
()
.
in
(
TForecastLibrary:
:
getProvidentPayMonth
,
payMonthList
))
.
eq
(
TForecastLibrary:
:
getDataPush
,
CommonConstants
.
ZERO_INT
));
libraryListTemp
=
baseMapper
.
selectList
(
Wrappers
.<
TForecastLibrary
>
query
().
lambda
()
.
eq
(
TForecastLibrary:
:
getEmpIdcard
,
empIdCard
)
.
and
(
obj1
->
obj1
.
in
(
TForecastLibrary:
:
getSocialPayMonth
,
payMonthList
).
or
().
in
(
TForecastLibrary:
:
getProvidentPayMonth
,
payMonthList
))
.
ne
(
TForecastLibrary:
:
getDataPush
,
CommonConstants
.
ZERO_INT
));
socialInfoList
=
socialFundInfoMapper
.
getSocialList
(
empIdCard
,
null
);
fundList
=
socialFundInfoMapper
.
getFundList
(
empIdCard
,
null
);
}
else
{
libraryList
=
baseMapper
.
selectList
(
Wrappers
.<
TForecastLibrary
>
query
().
lambda
()
.
in
(
TForecastLibrary:
:
getSettleDomainId
,
settleDomainIdList
)
.
and
(
obj1
->
obj1
.
in
(
TForecastLibrary:
:
getSocialPayMonth
,
payMonthList
)
.
or
()
.
in
(
TForecastLibrary:
:
getProvidentPayMonth
,
payMonthList
))
.
eq
(
TForecastLibrary:
:
getDataPush
,
CommonConstants
.
ZERO_INT
));
libraryListTemp
=
baseMapper
.
selectList
(
Wrappers
.<
TForecastLibrary
>
query
().
lambda
()
.
in
(
TForecastLibrary:
:
getSettleDomainId
,
settleDomainIdList
)
.
and
(
obj1
->
obj1
.
in
(
TForecastLibrary:
:
getSocialPayMonth
,
payMonthList
).
or
().
in
(
TForecastLibrary:
:
getProvidentPayMonth
,
payMonthList
))
.
ne
(
TForecastLibrary:
:
getDataPush
,
CommonConstants
.
ZERO_INT
));
socialInfoList
=
socialFundInfoMapper
.
getSocialList
(
null
,
settleDomainIdList
);
fundList
=
socialFundInfoMapper
.
getFundList
(
null
,
settleDomainIdList
);
}
if
(
Common
.
isEmpty
(
socialInfoList
)
&&
Common
.
isEmpty
(
fundList
))
{
return
R
.
failed
(
"无需要重新生成的数据(无数据或数据已结算不可重新生成!)"
);
}
//先删除然后重新生成
if
(
Common
.
isNotNull
(
libraryList
))
{
baseMapper
.
deleteBatchIds
(
libraryList
);
}
boolean
flag
;
// 已推送的预估明细Map
HashMap
<
String
,
TForecastLibrary
>
libraryHashMapTemp
=
new
HashMap
<>();
// Map的key
StringBuilder
sfMapKey
;
StringBuilder
initKey
;
if
(
Common
.
isNotNull
(
libraryListTemp
))
{
TForecastLibrary
libraryOld
;
for
(
TForecastLibrary
library
:
libraryListTemp
)
{
sfMapKey
=
new
StringBuilder
(
library
.
getEmpIdcard
());
// 获取key
if
(
Common
.
isNotNull
(
library
.
getSocialProvince
()))
{
this
.
getMapKey
(
sfMapKey
,
library
.
getSocialProvince
(),
library
.
getSocialCity
(),
library
.
getSocialTown
());
}
else
{
this
.
getMapKey
(
sfMapKey
,
library
.
getFundProvince
(),
library
.
getFundCity
(),
library
.
getFundTown
());
}
sfMapKey
.
append
(
CommonConstants
.
DOWN_LINE_STRING
).
append
(
library
.
getSocialPayMonth
());
sfMapKey
.
append
(
CommonConstants
.
DOWN_LINE_STRING
).
append
(
library
.
getSocialCreateMonth
());
libraryOld
=
libraryHashMapTemp
.
get
(
sfMapKey
.
toString
());
if
(
libraryOld
!=
null
)
{
this
.
getChangeAddData
(
libraryOld
,
library
);
}
libraryHashMapTemp
.
put
(
sfMapKey
.
toString
(),
library
);
}
}
HashMap
<
String
,
TForecastLibrary
>
libraryHashMap
=
new
HashMap
<>();
TForecastLibrary
tForecastLibrary
;
// Map的key转String
String
mapKeyStr
;
String
createMonth
;
boolean
isReduceSocial
=
false
;
boolean
isReduceFund
=
false
;
for
(
String
payMonth
:
payMonthList
)
{
//封装社保预估数据
if
(
Common
.
isNotNull
(
socialInfoList
))
{
for
(
TSocialFundInfo
tSocialInfo
:
socialInfoList
)
{
createMonth
=
ServiceUtil
.
initCreateMonth
(
tSocialInfo
.
getCreateTime
(),
payMonth
);
sfMapKey
=
new
StringBuilder
(
tSocialInfo
.
getEmpIdcard
());
// 获取key
this
.
getMapKey
(
sfMapKey
,
tSocialInfo
.
getSocialProvince
(),
tSocialInfo
.
getSocialCity
(),
tSocialInfo
.
getSocialTown
());
sfMapKey
.
append
(
CommonConstants
.
DOWN_LINE_STRING
).
append
(
payMonth
);
// 不可调换位置
initKey
=
new
StringBuilder
();
initKey
.
append
(
sfMapKey
);
sfMapKey
.
append
(
CommonConstants
.
DOWN_LINE_STRING
).
append
(
createMonth
);
mapKeyStr
=
sfMapKey
.
toString
();
// 变更:已推送的,计算变更值
tForecastLibrary
=
libraryHashMapTemp
.
get
(
mapKeyStr
);
if
(
null
!=
tForecastLibrary
)
{
this
.
getChangeReduceData
(
tSocialInfo
,
tForecastLibrary
);
libraryHashMap
.
put
(
sfMapKey
.
toString
(),
tForecastLibrary
);
}
//起缴月份在要生成的月份前不处理
if
(
Integer
.
parseInt
(
payMonth
)
<
DateUtil
.
formatDateInt
(
tSocialInfo
.
getSocialStartDate
()))
{
continue
;
}
flag
=
CommonConstants
.
ZERO_STRING
.
equals
(
tSocialInfo
.
getCanOverpay
())
&&
(
null
==
tSocialInfo
.
getOverpayNumber
()
||
null
==
tSocialInfo
.
getHaveThisMonth
()
||
null
==
tSocialInfo
.
getSocialStartDate
());
if
(
flag
)
{
return
R
.
failed
(
"员工"
+
tSocialInfo
.
getEmpName
()
+
":"
+
tSocialInfo
.
getEmpIdcard
()
+
SocialConstants
.
SOCIAL_SET_ERROR
);
}
// 初始化社保
initSocialLibary
(
payMonth
,
libraryHashMap
,
tSocialInfo
,
isReduceFund
,
agentConfigHashMap
,
initKey
);
}
}
//封装公积金预估数据
if
(
Common
.
isNotNull
(
fundList
))
{
for
(
TSocialFundInfo
providentFund
:
fundList
)
{
createMonth
=
ServiceUtil
.
initCreateMonth
(
providentFund
.
getCreateTime
(),
payMonth
);
sfMapKey
=
new
StringBuilder
(
providentFund
.
getEmpIdcard
());
// 获取key
this
.
getMapKey
(
sfMapKey
,
providentFund
.
getFundProvince
(),
providentFund
.
getFundCity
(),
providentFund
.
getFundTown
());
sfMapKey
.
append
(
CommonConstants
.
DOWN_LINE_STRING
).
append
(
payMonth
);
// 不可调换位置
initKey
=
new
StringBuilder
();
initKey
.
append
(
sfMapKey
);
sfMapKey
.
append
(
CommonConstants
.
DOWN_LINE_STRING
).
append
(
createMonth
);
mapKeyStr
=
sfMapKey
.
toString
();
// 变更:已推送的,计算变更值
tForecastLibrary
=
libraryHashMapTemp
.
get
(
mapKeyStr
);
if
(
null
!=
tForecastLibrary
)
{
this
.
getChangeReduceData
(
providentFund
,
tForecastLibrary
);
libraryHashMap
.
put
(
sfMapKey
.
toString
(),
tForecastLibrary
);
}
//起缴月份在要生成的月份后不处理
if
(
Integer
.
parseInt
(
payMonth
)
<
DateUtil
.
formatDateInt
(
providentFund
.
getProvidentStart
()))
{
continue
;
}
flag
=
CommonConstants
.
ZERO_STRING
.
equals
(
providentFund
.
getCanOverpay
())
&&
(
null
==
providentFund
.
getOverpayNumber
()
||
null
==
providentFund
.
getHaveThisMonth
()
||
null
==
providentFund
.
getProvidentStart
());
if
(
flag
)
{
return
R
.
failed
(
"员工"
+
providentFund
.
getEmpName
()
+
":"
+
providentFund
.
getEmpIdcard
()
+
SocialConstants
.
SOCIAL_SET_ERROR
);
}
// 初始化公积金
initFundLibary
(
payMonth
,
libraryHashMap
,
providentFund
,
isReduceSocial
,
initKey
);
}
}
}
boolean
isSaveAndUpdate
=
false
;
for
(
TForecastLibrary
library
:
libraryHashMap
.
values
())
{
if
(
Common
.
isEmpty
(
library
.
getSocialId
())
&&
Common
.
isEmpty
(
library
.
getProvidentId
()))
{
continue
;
}
if
(
Common
.
isNotNull
(
library
.
getId
()))
{
baseMapper
.
updateById
(
library
);
}
else
{
library
.
setCreateTime
(
LocalDateTime
.
now
());
baseMapper
.
insert
(
library
);
}
isSaveAndUpdate
=
true
;
}
if
(
isSaveAndUpdate
)
{
return
R
.
ok
(
null
,
"执行成功!"
);
}
else
{
return
R
.
failed
(
"执行失败!无需更新的数据!"
);
}
}
/**
* @param libraryOld
* @param library
* @Description: 已推送的数据,社保公积金金额累加
* @Author: hgw
* @Date: 2022/7/20 11:16
* @return: void
**/
private
void
getChangeAddData
(
TForecastLibrary
libraryOld
,
TForecastLibrary
library
)
{
//单位社保
library
.
setUnitPensionFee
(
BigDecimalUtils
.
safeAdd
(
libraryOld
.
getUnitPensionFee
(),
library
.
getUnitPensionFee
()));
library
.
setUnitMedicalFee
(
BigDecimalUtils
.
safeAdd
(
libraryOld
.
getUnitMedicalFee
(),
library
.
getUnitMedicalFee
()));
library
.
setUnitBirthFee
(
BigDecimalUtils
.
safeAdd
(
libraryOld
.
getUnitBirthFee
(),
library
.
getUnitBirthFee
()));
library
.
setUnitWorkInjuryFee
(
BigDecimalUtils
.
safeAdd
(
libraryOld
.
getUnitWorkInjuryFee
(),
library
.
getUnitWorkInjuryFee
()));
library
.
setUnitUnemploymentFee
(
BigDecimalUtils
.
safeAdd
(
libraryOld
.
getUnitUnemploymentFee
(),
library
.
getUnitUnemploymentFee
()));
library
.
setUnitBitailmentFee
(
BigDecimalUtils
.
safeAdd
(
libraryOld
.
getUnitBitailmentFee
(),
library
.
getUnitBitailmentFee
()));
library
.
setUnitInterestFee
(
BigDecimalUtils
.
safeAdd
(
libraryOld
.
getUnitInterestFee
(),
library
.
getUnitInterestFee
()));
library
.
setUnitSocialSum
(
BigDecimalUtils
.
safeAdd
(
libraryOld
.
getUnitSocialSum
(),
library
.
getUnitSocialSum
()));
// 个人社保
library
.
setPersonalPensionFee
(
BigDecimalUtils
.
safeAdd
(
libraryOld
.
getPersonalPensionFee
(),
library
.
getPersonalPensionFee
()));
library
.
setPersonalMedicalFee
(
BigDecimalUtils
.
safeAdd
(
libraryOld
.
getPersonalMedicalFee
(),
library
.
getPersonalMedicalFee
()));
library
.
setPersonalUnemploymentFee
(
BigDecimalUtils
.
safeAdd
(
libraryOld
.
getPersonalUnemploymentFee
(),
library
.
getPersonalUnemploymentFee
()));
library
.
setPersonalInterestFee
(
BigDecimalUtils
.
safeAdd
(
libraryOld
.
getPersonalUnemploymentFee
(),
library
.
getPersonalUnemploymentFee
()));
library
.
setPersonalBigailmentFee
(
BigDecimalUtils
.
safeAdd
(
libraryOld
.
getPersonalBigailmentFee
(),
library
.
getPersonalBigailmentFee
()));
library
.
setPersonalSocialSum
(
BigDecimalUtils
.
safeAdd
(
libraryOld
.
getPersonalSocialSum
(),
library
.
getPersonalSocialSum
()));
// 单位公积金
library
.
setUnitFundSum
(
BigDecimalUtils
.
safeAdd
(
libraryOld
.
getUnitFundSum
(),
library
.
getUnitFundSum
()));
// 个人公积金
library
.
setPersonalFundSum
(
BigDecimalUtils
.
safeAdd
(
libraryOld
.
getPersonalFundSum
(),
library
.
getPersonalFundSum
()));
}
/**
* @param socialFund
* @param libraryOld
* @Description: 获取变更的部分
* @Author: hgw
* @Date: 2022/7/20 11:29
* @return: void
**/
private
void
getChangeReduceData
(
TSocialFundInfo
socialFund
,
TForecastLibrary
libraryOld
)
{
//单位社保
libraryOld
.
setUnitPensionFee
(
BigDecimalUtils
.
safeSubtract
(
libraryOld
.
getUnitPensionFee
(),
socialFund
.
getUnitPersionMoney
()));
libraryOld
.
setUnitMedicalFee
(
BigDecimalUtils
.
safeSubtract
(
libraryOld
.
getUnitMedicalFee
(),
socialFund
.
getUnitMedicalMoney
()));
libraryOld
.
setUnitBirthFee
(
BigDecimalUtils
.
safeSubtract
(
libraryOld
.
getUnitBirthFee
(),
socialFund
.
getUnitBirthMoney
()));
libraryOld
.
setUnitWorkInjuryFee
(
BigDecimalUtils
.
safeSubtract
(
libraryOld
.
getUnitWorkInjuryFee
(),
socialFund
.
getUnitInjuryMoney
()));
libraryOld
.
setUnitUnemploymentFee
(
BigDecimalUtils
.
safeSubtract
(
libraryOld
.
getUnitUnemploymentFee
(),
socialFund
.
getUnitUnemploymentMoney
()));
libraryOld
.
setUnitBitailmentFee
(
BigDecimalUtils
.
safeSubtract
(
libraryOld
.
getUnitBitailmentFee
(),
socialFund
.
getUnitBigailmentMoney
()));
libraryOld
.
setUnitInterestFee
(
BigDecimalUtils
.
safeSubtract
(
libraryOld
.
getUnitInterestFee
(),
socialFund
.
getUnitInterestFee
()));
libraryOld
.
setUnitSocialSum
(
BigDecimalUtils
.
safeSubtract
(
libraryOld
.
getUnitSocialSum
(),
socialFund
.
getUnitSocialSum
()));
// 个人社保
libraryOld
.
setPersonalPensionFee
(
BigDecimalUtils
.
safeSubtract
(
libraryOld
.
getPersonalPensionFee
(),
socialFund
.
getPersonalPersionMoney
()));
libraryOld
.
setPersonalMedicalFee
(
BigDecimalUtils
.
safeSubtract
(
libraryOld
.
getPersonalMedicalFee
(),
socialFund
.
getPersonalMedicalMoney
()));
libraryOld
.
setPersonalUnemploymentFee
(
BigDecimalUtils
.
safeSubtract
(
libraryOld
.
getPersonalUnemploymentFee
(),
socialFund
.
getPersonalUnemploymentMoney
()));
libraryOld
.
setPersonalInterestFee
(
BigDecimalUtils
.
safeSubtract
(
libraryOld
.
getPersonalUnemploymentFee
(),
socialFund
.
getPersonalUnemploymentMoney
()));
libraryOld
.
setPersonalBigailmentFee
(
BigDecimalUtils
.
safeSubtract
(
libraryOld
.
getPersonalBigailmentFee
(),
socialFund
.
getPersonalBigailmentMoney
()));
libraryOld
.
setPersonalSocialSum
(
BigDecimalUtils
.
safeSubtract
(
libraryOld
.
getPersonalSocialSum
(),
socialFund
.
getPersonalSocialSum
()));
// 单位公积金
libraryOld
.
setUnitFundSum
(
BigDecimalUtils
.
safeSubtract
(
libraryOld
.
getUnitFundSum
(),
socialFund
.
getUnitFundSum
()));
// 个人公积金
libraryOld
.
setPersonalFundSum
(
BigDecimalUtils
.
safeSubtract
(
libraryOld
.
getPersonalFundSum
(),
socialFund
.
getPersonalFundSum
()));
}
private
void
initConfigByPayMonths
(
List
<
TAgentConfig
>
configList
,
Collection
<
String
>
payMonths
,
HashMap
<
String
,
TAgentConfig
>
agentConfigHashMap
)
{
for
(
TAgentConfig
config
:
configList
)
{
for
(
String
payMonth
:
payMonths
)
{
if
(
ServiceUtil
.
convertStringToInt
(
config
.
getStartMonth
())
<=
ServiceUtil
.
convertStringToInt
(
payMonth
)
&&
ServiceUtil
.
convertStringToInt
(
config
.
getEndMonth
())
>=
ServiceUtil
.
convertStringToInt
(
payMonth
))
{
if
(
Common
.
isNotNull
(
config
.
getCity
()))
{
agentConfigHashMap
.
put
(
config
.
getProvince
()
+
CommonConstants
.
DOWN_LINE_STRING
+
config
.
getCity
()
+
CommonConstants
.
DOWN_LINE_STRING
+
payMonth
+
CommonConstants
.
DOWN_LINE_STRING
+
config
.
getTarget
(),
config
);
}
else
{
agentConfigHashMap
.
put
(
config
.
getProvince
()
+
CommonConstants
.
DOWN_LINE_STRING
+
"null"
+
CommonConstants
.
DOWN_LINE_STRING
+
payMonth
+
CommonConstants
.
DOWN_LINE_STRING
+
config
.
getTarget
(),
config
);
}
}
}
}
}
/**
* @Description: 填充key的基本信息
* @Author: hgw
* @Date: 2022-7-19 15:30:45
* @return: void
**/
private
void
getMapKey
(
StringBuilder
mapKeyBuilder
,
String
socialProvince
,
String
socialCity
,
String
socialTown
)
{
if
(
Common
.
isNotNull
(
socialProvince
))
{
mapKeyBuilder
.
append
(
CommonConstants
.
DOWN_LINE_STRING
).
append
(
socialProvince
);
}
if
(
Common
.
isNotNull
(
socialCity
))
{
mapKeyBuilder
.
append
(
CommonConstants
.
DOWN_LINE_STRING
).
append
(
socialCity
);
}
else
if
(
Common
.
isNotNull
(
socialProvince
)
&&
"12"
.
equals
(
socialProvince
))
{
mapKeyBuilder
.
append
(
CommonConstants
.
DOWN_LINE_STRING
).
append
(
"135"
);
}
if
(
Common
.
isNotNull
(
socialTown
))
{
mapKeyBuilder
.
append
(
CommonConstants
.
DOWN_LINE_STRING
).
append
(
socialTown
);
}
}
private
void
initSocialLibary
(
String
payMonth
,
HashMap
<
String
,
TForecastLibrary
>
libraryHashMap
,
TSocialFundInfo
tSocialInfo
,
boolean
isReduceFund
,
HashMap
<
String
,
TAgentConfig
>
agentConfigMap
,
StringBuilder
mapKeyStr
)
{
mapKeyStr
.
append
(
CommonConstants
.
DOWN_LINE_STRING
).
append
(
ServiceUtil
.
initCreateMonth
(
tSocialInfo
.
getCreateTime
(),
payMonth
));
TForecastLibrary
lib
=
libraryHashMap
.
get
(
mapKeyStr
.
toString
());
if
(
null
==
lib
)
{
lib
=
new
TForecastLibrary
();
lib
.
setEmpId
(
tSocialInfo
.
getEmpId
());
lib
.
setEmpIdcard
(
tSocialInfo
.
getEmpIdcard
());
lib
.
setEmpName
(
tSocialInfo
.
getEmpName
());
lib
.
setEmpNo
(
tSocialInfo
.
getEmpNo
());
lib
.
setSocialCreateMonth
(
ServiceUtil
.
initCreateMonth
(
tSocialInfo
.
getCreateTime
(),
payMonth
));
lib
.
setProvidentCreateMonth
(
lib
.
getSocialCreateMonth
());
}
lib
.
setSocialPayMonth
(
payMonth
);
//同时处理公积金日期
lib
.
setProvidentPayMonth
(
payMonth
);
lib
.
setSocialProvince
(
tSocialInfo
.
getSocialProvince
());
lib
.
setSocialCity
(
tSocialInfo
.
getSocialCity
());
lib
.
setSocialTown
(
tSocialInfo
.
getSocialTown
());
lib
.
setSocialId
(
tSocialInfo
.
getId
());
lib
.
setUnitId
(
tSocialInfo
.
getUnitId
());
lib
.
setSettleDomainId
(
tSocialInfo
.
getSettleDomain
());
//判断是否允许补缴 是否可补缴 0:是
Integer
monthT
=
this
.
getOverpayMonth
(
tSocialInfo
);
//初始化社保派减状态 按派减时间派单对应缴纳月是否已派减社保
boolean
isReduceSocial
;
if
(
null
!=
tSocialInfo
.
getSocialReduceDate
())
{
isReduceSocial
=
Integer
.
parseInt
(
payMonth
)
>=
DateUtil
.
formatDateInt
(
tSocialInfo
.
getSocialReduceDate
());
}
else
{
isReduceSocial
=
false
;
}
lib
=
initForecastLibrary
(
lib
,
tSocialInfo
,
null
,
monthT
,
isReduceFund
,
isReduceSocial
,
agentConfigMap
);
libraryHashMap
.
put
(
mapKeyStr
.
toString
(),
lib
);
}
/**
* @Description: 获取可补缴的最大月份
* @Author: hgw
* @Date: 2020/10/10 15:26
* @return: java.lang.Integer
**/
private
Integer
getOverpayMonth
(
TSocialFundInfo
tSocialInfo
)
{
Integer
overpayMonth
=
null
;
if
(
CommonConstants
.
ZERO_STRING
.
equals
(
tSocialInfo
.
getCanOverpay
()))
{
//补缴是否含当月: 含当月
if
(
CommonConstants
.
ZERO_STRING
.
equals
(
tSocialInfo
.
getHaveThisMonth
()))
{
overpayMonth
=
Integer
.
parseInt
(
DateUtil
.
getYearAndMonth
(
tSocialInfo
.
getCreateTime
(),
0
));
//补缴是否含当月: 不含含当月
}
else
{
overpayMonth
=
Integer
.
parseInt
(
DateUtil
.
getYearAndMonth
(
tSocialInfo
.
getCreateTime
(),
CommonConstants
.
ONE_INT_NEGATE
));
}
}
return
overpayMonth
;
}
@Override
public
TForecastLibrary
initForecastLibrary
(
TForecastLibrary
library
,
TSocialFundInfo
socialInfo
,
TSocialFundInfo
fund
,
Integer
month
,
boolean
isReduceFund
,
boolean
isReduceSocial
,
HashMap
<
String
,
TAgentConfig
>
agentConfigMap
)
{
if
(
null
!=
socialInfo
&&
!
isReduceSocial
)
{
library
.
setSocialId
(
socialInfo
.
getId
());
library
.
setUnitBitailmentFee
(
BigDecimal
.
ZERO
);
library
.
setPersonalBigailmentFee
(
BigDecimal
.
ZERO
);
// 处理大病以外的金额 临时政策影响生成的预估数据(2020-08-03新增逻辑)
// 获取省市临时政策 0 单位 1 个人 2 全部
TAgentConfig
configAll
=
getAgentConfig
(
agentConfigMap
,
socialInfo
,
library
.
getSocialPayMonth
(),
CommonConstants
.
TWO_STRING
);
TAgentConfig
configUnit
=
getAgentConfig
(
agentConfigMap
,
socialInfo
,
library
.
getSocialPayMonth
(),
CommonConstants
.
ZERO_STRING
);
TAgentConfig
configPersonal
=
getAgentConfig
(
agentConfigMap
,
socialInfo
,
library
.
getSocialPayMonth
(),
CommonConstants
.
ONE_STRING
);
// 基数配置
SysBaseSetInfo
sysBaseSetInfo
=
this
.
getSysBaseSetInfo
(
CommonConstants
.
ZERO_STRING
,
socialInfo
.
getSocialHousehold
()
,
library
.
getSocialPayMonth
(),
socialInfo
.
getSocialProvince
(),
socialInfo
.
getSocialCity
(),
socialInfo
.
getSocialTown
());
// 初始化大病:
this
.
initLibraryBigMoneyBySocial
(
library
,
socialInfo
,
sysBaseSetInfo
);
initUnitAndPersonalLibrary
(
library
,
socialInfo
,
sysBaseSetInfo
);
if
(
null
!=
configAll
||
null
!=
configUnit
||
null
!=
configPersonal
)
{
if
(
null
!=
configPersonal
)
{
initPersonalLibByConfig
(
library
,
configPersonal
);
}
else
if
(
null
!=
configAll
)
{
initPersonalLibByConfig
(
library
,
configAll
);
}
if
(
null
!=
configUnit
)
{
initUnitLibByConfig
(
library
,
configUnit
);
}
else
if
(
null
!=
configAll
)
{
initUnitLibByConfig
(
library
,
configAll
);
}
}
// 补缴处理 不需要补缴的险种置为零
if
(
null
!=
month
&&
Integer
.
parseInt
(
library
.
getSocialPayMonth
())
<=
month
)
{
// 是否补缴大病:0是 1否
if
(
CommonConstants
.
ONE_STRING
.
equals
(
socialInfo
.
getInsuranceBigailment
()))
{
library
.
setUnitBitailmentFee
(
BigDecimal
.
ZERO
);
library
.
setPersonalBigailmentFee
(
BigDecimal
.
ZERO
);
}
// 是否补缴养老:0是1 否
if
(
CommonConstants
.
ONE_STRING
.
equals
(
socialInfo
.
getInsurancePension
()))
{
library
.
setUnitPensionFee
(
BigDecimal
.
ZERO
);
library
.
setPersonalPensionFee
(
BigDecimal
.
ZERO
);
}
// 是否补缴医疗:0是1否
if
(
CommonConstants
.
ONE_STRING
.
equals
(
socialInfo
.
getInsuranceMedical
()))
{
library
.
setUnitMedicalFee
(
BigDecimal
.
ZERO
);
library
.
setPersonalMedicalFee
(
BigDecimal
.
ZERO
);
}
// 是否补缴生育
if
(
CommonConstants
.
ONE_STRING
.
equals
(
socialInfo
.
getInsuranceBirth
()))
{
library
.
setUnitBirthFee
(
BigDecimal
.
ZERO
);
}
// 是否补缴工伤
if
(
CommonConstants
.
ONE_STRING
.
equals
(
socialInfo
.
getInsuranceInjury
()))
{
library
.
setUnitWorkInjuryFee
(
BigDecimal
.
ZERO
);
}
// 是否补缴失业
if
(
CommonConstants
.
ONE_STRING
.
equals
(
socialInfo
.
getInsuranceUnemployment
()))
{
library
.
setUnitUnemploymentFee
(
BigDecimal
.
ZERO
);
library
.
setPersonalUnemploymentFee
(
BigDecimal
.
ZERO
);
}
}
library
.
setPersonalSocialSum
(
BigDecimalUtils
.
safeAdd
(
library
.
getPersonalBigailmentFee
(),
library
.
getPersonalPensionFee
(),
library
.
getPersonalMedicalFee
(),
library
.
getPersonalInterestFee
(),
library
.
getPersonalUnemploymentFee
()));
library
.
setUnitSocialSum
(
BigDecimalUtils
.
safeAdd
(
library
.
getUnitPensionFee
(),
library
.
getUnitMedicalFee
(),
library
.
getUnitBirthFee
(),
library
.
getUnitWorkInjuryFee
(),
library
.
getUnitUnemploymentFee
(),
library
.
getUnitInterestFee
(),
library
.
getUnitBitailmentFee
()));
}
else
if
(
isReduceSocial
)
{
library
.
setUnitSocialSum
(
BigDecimal
.
ZERO
);
library
.
setPersonalSocialSum
(
BigDecimal
.
ZERO
);
library
.
setUnitPensionFee
(
BigDecimal
.
ZERO
);
library
.
setUnitMedicalFee
(
BigDecimal
.
ZERO
);
library
.
setUnitBirthFee
(
BigDecimal
.
ZERO
);
library
.
setUnitWorkInjuryFee
(
BigDecimal
.
ZERO
);
library
.
setUnitUnemploymentFee
(
BigDecimal
.
ZERO
);
library
.
setUnitBitailmentFee
(
BigDecimal
.
ZERO
);
library
.
setPersonalPensionFee
(
BigDecimal
.
ZERO
);
library
.
setPersonalMedicalFee
(
BigDecimal
.
ZERO
);
library
.
setPersonalUnemploymentFee
(
BigDecimal
.
ZERO
);
library
.
setPersonalBigailmentFee
(
BigDecimal
.
ZERO
);
library
.
setSocialId
(
null
);
library
.
setSocialProvince
(
null
);
library
.
setSocialCity
(
null
);
library
.
setSocialTown
(
null
);
}
if
(
null
!=
fund
&&
!
isReduceFund
)
{
library
.
setProvidentId
(
fund
.
getId
());
library
.
setUnitFundBase
(
fund
.
getUnitProvidengCardinal
());
library
.
setPersonalFundBase
(
fund
.
getPersonalProvidentCardinal
());
library
.
setUnitFundProp
(
fund
.
getUnitProvidentPer
());
library
.
setPersonalFundProp
(
fund
.
getPersonalProvidentPer
());
library
.
setPersonalFundSum
(
fund
.
getPersonalFundSum
());
library
.
setUnitFundSum
(
fund
.
getUnitFundSum
());
}
else
if
(
isReduceFund
)
{
library
.
setProvidentId
(
null
);
library
.
setUnitFundSum
(
BigDecimal
.
ZERO
);
library
.
setPersonalFundSum
(
BigDecimal
.
ZERO
);
library
.
setFundProvince
(
null
);
library
.
setFundCity
(
null
);
library
.
setFundTown
(
null
);
}
return
library
;
}
/**
* 获取社保临时政策 优先地市政策 无地市政策 按省政策,即无省也无市的政策 正常生成
*
* @param agentConfigList
* @param tSocialInfo
* @return
* @Author fxj
* @Date 2020-08-03
**/
private
TAgentConfig
getAgentConfig
(
HashMap
<
String
,
TAgentConfig
>
agentConfigList
,
TSocialFundInfo
tSocialInfo
,
String
payMonth
,
String
target
)
{
if
(
Common
.
isNotNull
(
agentConfigList
)
&&
null
!=
tSocialInfo
&&
Common
.
isNotNull
(
payMonth
))
{
TAgentConfig
temp
=
agentConfigList
.
get
(
tSocialInfo
.
getSocialProvince
()
+
CommonConstants
.
DOWN_LINE_STRING
+
tSocialInfo
.
getSocialCity
()
+
CommonConstants
.
DOWN_LINE_STRING
+
payMonth
+
CommonConstants
.
DOWN_LINE_STRING
+
target
);
if
(
null
!=
temp
)
{
return
temp
;
}
else
{
return
agentConfigList
.
get
(
tSocialInfo
.
getSocialProvince
()
+
CommonConstants
.
DOWN_LINE_STRING
+
"null"
+
CommonConstants
.
DOWN_LINE_STRING
+
payMonth
+
CommonConstants
.
DOWN_LINE_STRING
+
target
);
}
}
return
null
;
}
/**
* @param baseType 0.社保 1.公积金
* @param household (社保、公积金)户
* @param payMonth
* @param province
* @param city
* @param town
* @Description: 查找基数配置
* @Author: hgw
* @Date: 2021/1/4 15:58
* @return: com.yifu.cloud.v1.hrms.api.entity.SysBaseSetInfo
**/
private
SysBaseSetInfo
getSysBaseSetInfo
(
String
baseType
,
String
household
,
String
payMonth
,
String
province
,
String
city
,
String
town
)
{
// 基数配置
SysBaseSetInfo
sysBaseSetInfo
=
new
SysBaseSetInfo
();
sysBaseSetInfo
.
setBaseType
(
baseType
);
sysBaseSetInfo
.
setDeleteFlag
(
CommonConstants
.
ZERO_STRING
);
sysBaseSetInfo
.
setStatus
(
CommonConstants
.
ZERO_INT
);
sysBaseSetInfo
.
setDepartId
(
household
);
if
(
Common
.
isNotNull
(
payMonth
)
&&
payMonth
.
length
()
>
5
)
{
// 社保缴纳月
String
payMonthStr
=
payMonth
.
substring
(
0
,
4
).
concat
(
"-"
).
concat
(
payMonth
.
substring
(
4
,
6
)).
concat
(
"-01 00:00:00"
);
sysBaseSetInfo
.
setApplyStartDate
(
DateUtil
.
stringToDateByPatten
(
payMonthStr
,
DateUtil
.
DATETIME_PATTERN_SECOND
));
}
else
{
sysBaseSetInfo
.
setApplyStartDate
(
new
Date
());
}
sysBaseSetInfo
.
setProvince
(
Integer
.
parseInt
(
province
));
if
(
city
!=
null
)
{
sysBaseSetInfo
.
setCity
(
Integer
.
parseInt
(
city
));
}
else
{
sysBaseSetInfo
.
setCity
(-
1
);
}
if
(
town
!=
null
)
{
sysBaseSetInfo
.
setTown
(
Integer
.
parseInt
(
town
));
}
else
{
sysBaseSetInfo
.
setTown
(-
1
);
}
// 查询符合条件的基数列表
List
<
SysBaseSetInfo
>
sysBaseSetInfoList
=
sysBaseSetInfoMapper
.
getSysBaseSetInfoNoPage
(
sysBaseSetInfo
);
if
(
sysBaseSetInfoList
!=
null
&&
!
sysBaseSetInfoList
.
isEmpty
())
{
sysBaseSetInfo
=
sysBaseSetInfoList
.
get
(
0
);
}
else
{
// 如果没找到配置,取最新的一条:
sysBaseSetInfo
.
setApplyStartDate
(
null
);
sysBaseSetInfoList
=
sysBaseSetInfoMapper
.
getSysBaseSetInfoNoPage
(
sysBaseSetInfo
);
if
(
sysBaseSetInfoList
!=
null
&&
!
sysBaseSetInfoList
.
isEmpty
())
{
sysBaseSetInfo
=
sysBaseSetInfoList
.
get
(
0
);
}
}
return
sysBaseSetInfo
;
}
/**
* @param library 预估库
* @param socialInfo 社保
* @param sysBaseSetInfo 基数配置
* @Description: 从社保获取大病
* @Author: hgw
* @Date: 2020/11/25 15:51
* @return: void
**/
private
void
initLibraryBigMoneyBySocial
(
TForecastLibrary
library
,
TSocialFundInfo
socialInfo
,
SysBaseSetInfo
sysBaseSetInfo
)
{
if
(
CommonConstants
.
ONE_STRING
.
equals
(
socialInfo
.
getPaymentType
()))
{
// 自定义类型大病随基数配置变化:0不随配置 1随配置 2.单位大病随配置 3个人大病随配置
// 2022-7-20 11:46:32 与房工沟通,派单没这个逻辑,所以都是随配置直接计算
// 直接计算单位大病
this
.
setBigMoneyBySelfForUnit
(
library
,
socialInfo
,
sysBaseSetInfo
);
// 直接计算个人大病
this
.
setBigMoneyBySelfForPerson
(
library
,
socialInfo
,
sysBaseSetInfo
);
// 非自定义,从社保基数配置取信息
}
else
{
// 大病处理: 0 收取 按派单的社保里的基数和比例来
if
(
CommonConstants
.
ZERO_STRING
.
equals
(
sysBaseSetInfo
.
getIsIllness
()))
{
// 大病收取方式 0.按年 判断当前月份是否收取大病 按年收大病起缴月份收取一次,非当年的 大病 按实际收取月份收取大病金额
this
.
setBigMoney
(
library
,
socialInfo
,
sysBaseSetInfo
,
socialInfo
.
getPaymentType
());
// 大病处理: 1 不收取
}
else
{
library
.
setUnitBitailmentFee
(
BigDecimal
.
ZERO
);
library
.
setPersonalBigailmentFee
(
BigDecimal
.
ZERO
);
}
}
}
/**
* 初始化单位和个人的预估数据
*
* @param library
* @param socialInfo
* @return
* @Author fxj
* @Date 2020-08-03
**/
private
void
initUnitAndPersonalLibrary
(
TForecastLibrary
library
,
TSocialFundInfo
socialInfo
,
SysBaseSetInfo
sysBaseSetInfo
)
{
initLibrayOfPersonal
(
library
,
socialInfo
,
sysBaseSetInfo
);
initLibraryOfUnit
(
library
,
socialInfo
,
sysBaseSetInfo
);
}
private
void
initLibrayOfPersonal
(
TForecastLibrary
library
,
TSocialFundInfo
socialInfo
,
SysBaseSetInfo
sysBaseSetInfo
)
{
// 个人养老基数
BigDecimal
personalPersionBase
=
BigDecimal
.
ZERO
;
// 个人医疗基数
BigDecimal
personalMedicalBase
=
BigDecimal
.
ZERO
;
// 个人失业基数
BigDecimal
personalUnemploymentBase
=
BigDecimal
.
ZERO
;
// 个人养老比例
BigDecimal
personalPersionPro
=
BigDecimal
.
ZERO
;
// 个人医疗比例
BigDecimal
personalMedicalPro
=
BigDecimal
.
ZERO
;
// 个人失业比例
BigDecimal
personalUnemploymentPro
=
BigDecimal
.
ZERO
;
// 个人养老金额
BigDecimal
personalPersionMoney
;
// 个人医疗金额
BigDecimal
personalMedicalMoney
;
// 个人失业金额
BigDecimal
personalUnemploymentMoney
;
// 存储基数(最低或最高)
BigDecimal
baseLimit
;
if
(
socialInfo
!=
null
)
{
if
(
Common
.
isNotNull
(
socialInfo
.
getPaymentType
())
&&
!
CommonConstants
.
ONE_STRING
.
equals
(
socialInfo
.
getPaymentType
()))
{
if
(
CommonConstants
.
ZERO_STRING
.
equals
(
socialInfo
.
getPaymentType
()))
{
baseLimit
=
sysBaseSetInfo
.
getLowerLimit
();
}
else
{
baseLimit
=
sysBaseSetInfo
.
getUpperLimit
();
}
personalPersionBase
=
baseLimit
;
personalMedicalBase
=
baseLimit
;
personalUnemploymentBase
=
baseLimit
;
personalPersionPro
=
sysBaseSetInfo
.
getPersonalPersionPro
();
personalMedicalPro
=
sysBaseSetInfo
.
getPersonalMedicalPro
();
personalUnemploymentPro
=
sysBaseSetInfo
.
getPersonalUnemploymentPro
();
}
else
{
personalPersionBase
=
socialInfo
.
getPersonalPensionCardinal
();
personalMedicalBase
=
socialInfo
.
getPersonalMedicalCardinal
();
personalUnemploymentBase
=
socialInfo
.
getPersonalUnemploymentCardinal
();
personalPersionPro
=
socialInfo
.
getPersonalPensionPer
();
personalMedicalPro
=
socialInfo
.
getPersonalMedicalPer
();
personalUnemploymentPro
=
socialInfo
.
getPersonalUnemploymentPer
();
}
}
personalPersionMoney
=
BigDecimalUtils
.
safeMultiply
(
personalPersionBase
,
personalPersionPro
,
CommonConstants
.
ONE_OF_PERCENT
);
personalMedicalMoney
=
BigDecimalUtils
.
safeMultiply
(
personalMedicalBase
,
personalMedicalPro
,
CommonConstants
.
ONE_OF_PERCENT
);
personalUnemploymentMoney
=
BigDecimalUtils
.
safeMultiply
(
personalUnemploymentBase
,
personalUnemploymentPro
,
CommonConstants
.
ONE_OF_PERCENT
);
library
.
setPersonalPensionBase
(
personalPersionBase
);
library
.
setPersonalMedicalBase
(
personalMedicalBase
);
library
.
setPersonalUnemploymentBase
(
personalUnemploymentBase
);
library
.
setPersonalPersionPro
(
personalPersionPro
);
library
.
setPersonalMedicalPro
(
personalMedicalPro
);
library
.
setPersonalUnemploymentPro
(
personalUnemploymentPro
);
library
.
setPersonalMedicalFee
(
personalMedicalMoney
);
library
.
setPersonalPensionFee
(
personalPersionMoney
);
library
.
setPersonalUnemploymentFee
(
personalUnemploymentMoney
);
}
private
void
initLibraryOfUnit
(
TForecastLibrary
library
,
TSocialFundInfo
socialInfo
,
SysBaseSetInfo
sysBaseSetInfo
)
{
// 单位养老基数
BigDecimal
unitPersionBase
=
BigDecimal
.
ZERO
;
// 单位医疗基数
BigDecimal
unitMedicalBase
=
BigDecimal
.
ZERO
;
// 单位失业基数
BigDecimal
unitUnemploymentBase
=
BigDecimal
.
ZERO
;
// 单位工伤基数
BigDecimal
unitInjuryBase
=
BigDecimal
.
ZERO
;
// 单位生育基数
BigDecimal
unitBirthBase
=
BigDecimal
.
ZERO
;
// 单位养老比例
BigDecimal
unitPersionPro
=
BigDecimal
.
ZERO
;
// 单位医疗比例
BigDecimal
unitMedicalPro
=
BigDecimal
.
ZERO
;
// 单位失业比例
BigDecimal
unitUnemploymentPro
=
BigDecimal
.
ZERO
;
// 单位工伤比例
BigDecimal
unitInjuryPro
=
BigDecimal
.
ZERO
;
// 单位生育比例
BigDecimal
unitBirthPro
=
BigDecimal
.
ZERO
;
// 单位养老金额
BigDecimal
unitPersionMoney
;
// 单位医疗金额
BigDecimal
unitMedicalMoney
;
// 单位失业金额
BigDecimal
unitUnemploymentMoney
;
// 单位工伤金额
BigDecimal
unitInjuryMoney
;
// 单位生育金额
BigDecimal
unitBirthMoney
;
// 存储基数(最低或最高)
BigDecimal
baseLimit
;
if
(
socialInfo
!=
null
)
{
// 需要从基数配置取数据:
if
(
Common
.
isNotNull
(
socialInfo
.
getPaymentType
())
&&
!
CommonConstants
.
ONE_STRING
.
equals
(
socialInfo
.
getPaymentType
()))
{
if
(
CommonConstants
.
ZERO_STRING
.
equals
(
socialInfo
.
getPaymentType
()))
{
baseLimit
=
sysBaseSetInfo
.
getLowerLimit
();
}
else
{
baseLimit
=
sysBaseSetInfo
.
getUpperLimit
();
}
unitPersionBase
=
baseLimit
;
unitMedicalBase
=
baseLimit
;
unitUnemploymentBase
=
baseLimit
;
unitInjuryBase
=
baseLimit
;
unitBirthBase
=
baseLimit
;
unitPersionPro
=
sysBaseSetInfo
.
getUnitPersionPro
();
unitMedicalPro
=
sysBaseSetInfo
.
getUnitMedicalPro
();
unitUnemploymentPro
=
sysBaseSetInfo
.
getUnitUnemploymentPro
();
unitInjuryPro
=
sysBaseSetInfo
.
getUnitInjuryPro
();
unitBirthPro
=
sysBaseSetInfo
.
getUnitBirthPro
();
}
else
{
unitPersionBase
=
socialInfo
.
getUnitPensionCardinal
();
unitMedicalBase
=
socialInfo
.
getUnitMedicalCardinal
();
unitUnemploymentBase
=
socialInfo
.
getUnitUnemploymentCardinal
();
unitInjuryBase
=
socialInfo
.
getUnitWorkInjuryCardinal
();
unitBirthBase
=
socialInfo
.
getUnitBirthCardinal
();
unitPersionPro
=
socialInfo
.
getUnitPensionPer
();
unitMedicalPro
=
socialInfo
.
getUnitMedicalPer
();
unitUnemploymentPro
=
socialInfo
.
getUnitUnemploymentPer
();
unitInjuryPro
=
socialInfo
.
getUnitWorkUnjuryPer
();
unitBirthPro
=
socialInfo
.
getUnitBirthPer
();
}
}
unitPersionMoney
=
BigDecimalUtils
.
safeMultiply
(
unitPersionBase
,
unitPersionPro
,
CommonConstants
.
ONE_OF_PERCENT
);
unitMedicalMoney
=
BigDecimalUtils
.
safeMultiply
(
unitMedicalBase
,
unitMedicalPro
,
CommonConstants
.
ONE_OF_PERCENT
);
unitUnemploymentMoney
=
BigDecimalUtils
.
safeMultiply
(
unitUnemploymentBase
,
unitUnemploymentPro
,
CommonConstants
.
ONE_OF_PERCENT
);
unitInjuryMoney
=
BigDecimalUtils
.
safeMultiply
(
unitInjuryBase
,
unitInjuryPro
,
CommonConstants
.
ONE_OF_PERCENT
);
unitBirthMoney
=
BigDecimalUtils
.
safeMultiply
(
unitBirthBase
,
unitBirthPro
,
CommonConstants
.
ONE_OF_PERCENT
);
library
.
setUnitPensionBase
(
unitPersionBase
);
library
.
setUnitMedicalBase
(
unitMedicalBase
);
library
.
setUnitUnemploymentBase
(
unitUnemploymentBase
);
library
.
setUnitInjuryBase
(
unitInjuryBase
);
library
.
setUnitBirthBase
(
unitBirthBase
);
library
.
setUnitPersionPro
(
unitPersionPro
);
library
.
setUnitMedicalPro
(
unitMedicalPro
);
library
.
setUnitUnemploymentPro
(
unitUnemploymentPro
);
library
.
setUnitInjuryPro
(
unitInjuryPro
);
library
.
setUnitBirthPro
(
unitBirthPro
);
library
.
setUnitPensionFee
(
unitPersionMoney
);
library
.
setUnitMedicalFee
(
unitMedicalMoney
);
library
.
setUnitUnemploymentFee
(
unitUnemploymentMoney
);
library
.
setUnitBirthFee
(
unitBirthMoney
);
library
.
setUnitWorkInjuryFee
(
unitInjuryMoney
);
}
/**
* 按临时政策初始化个人预估数据
*
* @param library
* @param agentConfig
* @return
* @Author fxj
* @Date 2020-08-03
**/
private
void
initPersonalLibByConfig
(
TForecastLibrary
library
,
TAgentConfig
agentConfig
)
{
// 0 全额 1 减半 2 不收
if
(
CommonConstants
.
ONE_STRING
.
equals
(
agentConfig
.
getMedical
()))
{
library
.
setPersonalMedicalFee
(
BigDecimalUtils
.
safeMultiply
(
library
.
getPersonalMedicalFee
()
,
CommonConstants
.
HALF_OF_ONE
,
CommonConstants
.
TWO_BIG
));
}
else
if
(
CommonConstants
.
TWO_STRING
.
equals
(
agentConfig
.
getMedical
()))
{
library
.
setPersonalMedicalFee
(
BigDecimal
.
ZERO
);
}
// 0 全额 1 减半 2 不收
if
(
CommonConstants
.
ONE_STRING
.
equals
(
agentConfig
.
getUnemployed
()))
{
library
.
setPersonalUnemploymentFee
(
BigDecimalUtils
.
safeMultiply
(
library
.
getPersonalUnemploymentFee
()
,
CommonConstants
.
HALF_OF_ONE
,
CommonConstants
.
TWO_BIG
));
}
else
if
(
CommonConstants
.
TWO_STRING
.
equals
(
agentConfig
.
getUnemployed
()))
{
library
.
setPersonalUnemploymentFee
(
BigDecimal
.
ZERO
);
}
// 0 全额 1 减半 2 不收
if
(
CommonConstants
.
ONE_STRING
.
equals
(
agentConfig
.
getPension
()))
{
library
.
setPersonalPensionFee
(
BigDecimalUtils
.
safeMultiply
(
library
.
getPersonalPensionFee
()
,
CommonConstants
.
HALF_OF_ONE
,
CommonConstants
.
TWO_BIG
));
}
else
if
(
CommonConstants
.
TWO_STRING
.
equals
(
agentConfig
.
getPension
()))
{
library
.
setPersonalPensionFee
(
BigDecimal
.
ZERO
);
}
}
/**
* 按临时政策初始化单位社保预估数据
*
* @param library
* @param agentConfig
* @return
* @Author fxj
* @Date 2020-08-03
**/
private
void
initUnitLibByConfig
(
TForecastLibrary
library
,
TAgentConfig
agentConfig
)
{
// 0 全额 1 减半 2 不收
if
(
CommonConstants
.
ONE_STRING
.
equals
(
agentConfig
.
getPension
()))
{
library
.
setUnitPensionFee
(
BigDecimalUtils
.
safeMultiply
(
library
.
getUnitPensionFee
()
,
CommonConstants
.
HALF_OF_ONE
,
CommonConstants
.
TWO_BIG
));
}
else
if
(
CommonConstants
.
TWO_STRING
.
equals
(
agentConfig
.
getPension
()))
{
library
.
setUnitPensionFee
(
BigDecimal
.
ZERO
);
}
// 0 全额 1 减半 2 不收
if
(
CommonConstants
.
ONE_STRING
.
equals
(
agentConfig
.
getMedical
()))
{
library
.
setUnitMedicalFee
(
BigDecimalUtils
.
safeMultiply
(
library
.
getUnitMedicalFee
()
,
CommonConstants
.
HALF_OF_ONE
,
CommonConstants
.
TWO_BIG
));
}
else
if
(
CommonConstants
.
TWO_STRING
.
equals
(
agentConfig
.
getMedical
()))
{
library
.
setUnitMedicalFee
(
BigDecimal
.
ZERO
);
}
// 0 全额 1 减半 2 不收
if
(
CommonConstants
.
ONE_STRING
.
equals
(
agentConfig
.
getBear
()))
{
library
.
setUnitBirthFee
(
BigDecimalUtils
.
safeMultiply
(
library
.
getUnitBirthFee
()
,
CommonConstants
.
HALF_OF_ONE
,
CommonConstants
.
TWO_BIG
));
}
else
if
(
CommonConstants
.
TWO_STRING
.
equals
(
agentConfig
.
getBear
()))
{
library
.
setUnitBirthFee
(
BigDecimal
.
ZERO
);
}
// 0 全额 1 减半 2 不收
if
(
CommonConstants
.
ONE_STRING
.
equals
(
agentConfig
.
getInjury
()))
{
library
.
setUnitWorkInjuryFee
(
BigDecimalUtils
.
safeMultiply
(
library
.
getUnitWorkInjuryFee
()
,
CommonConstants
.
HALF_OF_ONE
,
CommonConstants
.
TWO_BIG
));
}
else
if
(
CommonConstants
.
TWO_STRING
.
equals
(
agentConfig
.
getInjury
()))
{
library
.
setUnitWorkInjuryFee
(
BigDecimal
.
ZERO
);
}
// 0 全额 1 减半 2 不收
if
(
CommonConstants
.
ONE_STRING
.
equals
(
agentConfig
.
getUnemployed
()))
{
library
.
setUnitUnemploymentFee
(
BigDecimalUtils
.
safeMultiply
(
library
.
getUnitUnemploymentFee
()
,
CommonConstants
.
HALF_OF_ONE
,
CommonConstants
.
TWO_BIG
));
}
else
if
(
CommonConstants
.
TWO_STRING
.
equals
(
agentConfig
.
getUnemployed
()))
{
library
.
setUnitUnemploymentFee
(
BigDecimal
.
ZERO
);
}
}
/**
* @param library 预估主表
* @param socialInfo 社保
* @param sysBaseSetInfo 基数配置
* @Description: 直接计算单位大病
* @Author: hgw
* @Date: 2020/12/2 14:31
* @return: void
**/
private
void
setBigMoneyBySelfForUnit
(
TForecastLibrary
library
,
TSocialFundInfo
socialInfo
,
SysBaseSetInfo
sysBaseSetInfo
)
{
if
(
socialInfo
.
getUnitBigailmentMoney
()
!=
null
)
{
library
.
setUnitBitailmentFee
(
socialInfo
.
getUnitBigailmentMoney
());
}
else
if
(
socialInfo
.
getUnitBigailmentCardinal
()
!=
null
&&
sysBaseSetInfo
.
getPayCompanyPro
()
!=
null
)
{
library
.
setUnitBitailmentFee
(
BigDecimalUtils
.
safeMultiply
(
socialInfo
.
getUnitBigailmentCardinal
(),
sysBaseSetInfo
.
getPayCompanyPro
(),
CommonConstants
.
ONE_OF_PERCENT
));
}
}
/**
* @param library 预估主表
* @param socialInfo 社保
* @param sysBaseSetInfo 基数配置
* @Description: 直接计算个人大病
* @Author: hgw
* @Date: 2020/12/2 14:31
* @return: void
**/
private
void
setBigMoneyBySelfForPerson
(
TForecastLibrary
library
,
TSocialFundInfo
socialInfo
,
SysBaseSetInfo
sysBaseSetInfo
)
{
if
(
socialInfo
.
getPersonalBigailmentMoney
()
!=
null
)
{
library
.
setPersonalBigailmentFee
(
socialInfo
.
getPersonalBigailmentMoney
());
}
else
if
(
socialInfo
.
getPersonalBigailmentCardinal
()
!=
null
&&
sysBaseSetInfo
.
getPayPersonalPro
()
!=
null
)
{
library
.
setPersonalBigailmentFee
(
BigDecimalUtils
.
safeMultiply
(
socialInfo
.
getPersonalBigailmentCardinal
(),
sysBaseSetInfo
.
getPayPersonalPro
(),
CommonConstants
.
ONE_OF_PERCENT
));
}
}
/**
* @param library 预估库
* @param socialInfo 社保
* @param sysBaseSetInfo 基数配置
* @param paymentType 0最低缴纳、1自定义缴纳、2最高缴纳
* @Description: 塞大病金额
* @Author: hgw
* @Date: 2020/11/25 15:51
* @return: void
**/
private
void
setBigMoney
(
TForecastLibrary
library
,
TSocialFundInfo
socialInfo
,
SysBaseSetInfo
sysBaseSetInfo
,
String
paymentType
)
{
if
(
CommonConstants
.
ZERO_STRING
.
equals
(
sysBaseSetInfo
.
getCollectType
()))
{
if
((
null
!=
sysBaseSetInfo
.
getCollectMoth
()
&&
Integer
.
parseInt
(
library
.
getSocialPayMonth
().
substring
(
4
,
6
))
==
sysBaseSetInfo
.
getCollectMoth
()
&&
Integer
.
parseInt
(
library
.
getSocialPayMonth
().
substring
(
0
,
4
))
!=
socialInfo
.
getSocialStartDate
().
getYear
())
||
library
.
getSocialPayMonth
().
equals
(
DateUtil
.
formatDatePatten
(
socialInfo
.
getSocialStartDate
(),
null
)))
{
// 大病取值方式:0按定值
library
.
setUnitBitailmentFee
(
BigDecimalUtils
.
isNullToZero
(
sysBaseSetInfo
.
getPayCompany
()));
library
.
setPersonalBigailmentFee
(
BigDecimalUtils
.
isNullToZero
(
sysBaseSetInfo
.
getPayPersonal
()));
//第一次收取费用逻辑:新员工入职是否收费处理逻辑:先按第一次不收取费用 (只针对按年收)
if
(
library
.
getSocialPayMonth
().
equals
(
DateUtil
.
formatDatePatten
(
socialInfo
.
getSocialStartDate
(),
null
))
&&
CommonConstants
.
ONE_STRING
.
equals
(
socialInfo
.
getIsChargePersonal
()))
{
library
.
setPersonalBigailmentFee
(
BigDecimal
.
ZERO
);
}
}
//大病收取方式 : 1.按月
}
else
if
(
CommonConstants
.
ONE_STRING
.
equals
(
sysBaseSetInfo
.
getCollectType
()))
{
// 存储基数(最低或最高)
BigDecimal
baseLimit
=
sysBaseSetInfo
.
getLowerLimit
();
if
(
CommonConstants
.
TWO_STRING
.
equals
(
paymentType
))
{
baseLimit
=
sysBaseSetInfo
.
getUpperLimit
();
}
// 大病取值方式:1 按比例 按派单的基数和比例来
if
(
CommonConstants
.
ONE_STRING
.
equals
(
sysBaseSetInfo
.
getValueType
()))
{
library
.
setPersonalBigailmentFee
(
BigDecimalUtils
.
safeMultiply
(
baseLimit
,
sysBaseSetInfo
.
getPayPersonalPro
(),
CommonConstants
.
ONE_OF_PERCENT
));
library
.
setUnitBitailmentFee
(
BigDecimalUtils
.
safeMultiply
(
baseLimit
,
sysBaseSetInfo
.
getPayCompanyPro
(),
CommonConstants
.
ONE_OF_PERCENT
));
}
else
{
// 大病取值方式:0按定值
library
.
setUnitBitailmentFee
(
BigDecimalUtils
.
isNullToZero
(
sysBaseSetInfo
.
getPayCompany
()));
library
.
setPersonalBigailmentFee
(
BigDecimalUtils
.
isNullToZero
(
sysBaseSetInfo
.
getPayPersonal
()));
}
}
}
/**
* 初始化公积金预估信息
*
* @param payMonth
* @param libraryHashMap
* @param providentFund
* @param isReduceSocial
* @return
* @Author fxj
* @Date 2020-07-21
**/
private
void
initFundLibary
(
String
payMonth
,
HashMap
<
String
,
TForecastLibrary
>
libraryHashMap
,
TSocialFundInfo
providentFund
,
boolean
isReduceSocial
,
StringBuilder
mapKeyStr
)
{
mapKeyStr
.
append
(
CommonConstants
.
DOWN_LINE_STRING
).
append
(
ServiceUtil
.
initCreateMonth
(
providentFund
.
getCreateTime
(),
payMonth
));
TForecastLibrary
lib
=
libraryHashMap
.
get
(
mapKeyStr
.
toString
());
if
(
null
==
lib
)
{
lib
=
new
TForecastLibrary
();
lib
.
setEmpId
(
providentFund
.
getEmpId
());
lib
.
setEmpIdcard
(
providentFund
.
getEmpIdcard
());
lib
.
setEmpName
(
providentFund
.
getEmpName
());
lib
.
setEmpNo
(
providentFund
.
getEmpNo
());
lib
.
setProvidentCreateMonth
(
ServiceUtil
.
initCreateMonth
(
providentFund
.
getCreateTime
(),
payMonth
));
lib
.
setSocialCreateMonth
(
lib
.
getProvidentCreateMonth
());
}
//同时处理社保日期
lib
.
setSocialPayMonth
(
payMonth
);
lib
.
setProvidentPayMonth
(
payMonth
);
lib
.
setFundProvince
(
providentFund
.
getFundProvince
());
lib
.
setFundCity
(
providentFund
.
getFundCity
());
lib
.
setFundTown
(
providentFund
.
getFundTown
());
lib
.
setProvidentId
(
providentFund
.
getId
());
lib
.
setUnitId
(
providentFund
.
getUnitId
());
lib
.
setSettleDomainId
(
providentFund
.
getSettleDomain
());
//判断是否允许补缴 是否可补缴 0:是
Integer
monthT
=
null
;
if
(
CommonConstants
.
ZERO_STRING
.
equals
(
providentFund
.
getCanOverpay
()))
{
//补缴是否含当月: 含当月
if
(
CommonConstants
.
ZERO_STRING
.
equals
(
providentFund
.
getHaveThisMonth
()))
{
monthT
=
Integer
.
parseInt
(
DateUtil
.
getYearAndMonth
(
LocalDateTimeUtils
.
formatTime
(
providentFund
.
getCreateTime
(),
DateUtil
.
DATETIME_YYYYMM
),
0
));
//补缴是否含当月: 不含含当月
}
else
{
monthT
=
Integer
.
parseInt
(
DateUtil
.
getYearAndMonth
(
LocalDateTimeUtils
.
formatTime
(
providentFund
.
getCreateTime
(),
DateUtil
.
DATETIME_YYYYMM
),
-
CommonConstants
.
ONE_INT
));
}
}
// 判断公积金对应缴纳月份是否派减了
boolean
isReduceFund
;
if
(
null
!=
providentFund
.
getFundReduceDate
())
{
isReduceFund
=
Integer
.
parseInt
(
payMonth
)
>=
DateUtil
.
formatDateInt
(
providentFund
.
getFundReduceDate
());
}
else
{
isReduceFund
=
false
;
}
lib
=
initForecastLibrary
(
lib
,
null
,
providentFund
,
monthT
,
isReduceFund
,
isReduceSocial
,
null
);
libraryHashMap
.
put
(
mapKeyStr
.
toString
(),
lib
);
}
}
yifu-social/yifu-social-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/social/util/ServiceUtil.java
0 → 100644
View file @
c6db9a1e
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
social
.
util
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.Common
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.DateUtil
;
import
lombok.extern.slf4j.Slf4j
;
import
java.time.LocalDateTime
;
/**
* 公用方法提取
*
* @author fxj
* @date 2019-09-29
**/
@Slf4j
public
class
ServiceUtil
{
private
ServiceUtil
()
{
throw
new
IllegalStateException
(
"ServiceUtil class"
);
}
/**
* @Description: 返回字符串对应的int值
* @Author: hgw
* @Date: 2022/7/18 17:29
* @return: int
**/
public
static
int
convertStringToInt
(
String
num1
)
{
if
(
Common
.
isEmpty
(
num1
)
||
!
Common
.
isNumber
(
num1
))
{
return
-
1
;
}
return
Integer
.
parseInt
(
num1
);
}
/**
* 按派单日期生成生成月份
* @Author fxj
* @Date 2020-03-25
* @param createDate
* @return
**/
public
static
String
initCreateMonth
(
LocalDateTime
createDate
,
String
payMonth
){
if
(
null
==
createDate
||
Common
.
isEmpty
(
payMonth
)
||
payMonth
.
length
()
!=
6
){
return
DateUtil
.
getYearAndMonth
(
LocalDateTime
.
now
(),
1
);
}
if
(
createDate
.
getYear
()
<
Integer
.
parseInt
(
payMonth
.
substring
(
0
,
4
))){
return
payMonth
;
}
if
(
createDate
.
getYear
()
>
Integer
.
parseInt
(
payMonth
.
substring
(
0
,
4
))){
return
DateUtil
.
getYearAndMonth
(
createDate
,
1
);
}
if
(
createDate
.
getYear
()
==
Integer
.
parseInt
(
payMonth
.
substring
(
0
,
4
))){
if
(
createDate
.
getMonthValue
()
<
Integer
.
parseInt
(
payMonth
.
substring
(
4
,
6
))){
return
payMonth
;
}
if
(
createDate
.
getMonthValue
()
>=
Integer
.
parseInt
(
payMonth
.
substring
(
4
,
6
))){
return
DateUtil
.
getYearAndMonth
(
createDate
,
1
);
}
}
return
null
;
}
}
yifu-social/yifu-social-biz/src/main/resources/mapper/SysBaseSetInfoMapper.xml
View file @
c6db9a1e
...
...
@@ -368,4 +368,15 @@
and a.BASE_TYPE = '1'
</where>
</select>
<!--sysBaseSetInfo不分页查询-->
<select
id=
"getSysBaseSetInfoNoPage"
resultMap=
"sysBaseSetInfoMap"
>
<include
refid=
"base_column_list"
/>
FROM sys_base_set_info a
<where>
1=1
<include
refid=
"sysBaseSetInfo_where"
/>
</where>
ORDER BY a.apply_start_date desc
</select>
</mapper>
yifu-social/yifu-social-biz/src/main/resources/mapper/TSocialFundInfoMapper.xml
View file @
c6db9a1e
...
...
@@ -621,4 +621,41 @@
<include
refid=
"tSocialFundInfo_where"
/>
</where>
</select>
<!--获取在用社保-->
<select
id=
"getSocialList"
resultMap=
"tSocialFundInfoMap"
>
SELECT
<include
refid=
"Base_Column_List"
/>
FROM t_social_fund_info a
<where>
a.SOCIAL_ADD_STATUS != '4' and a.SOCIAL_REDUCE_STATUS != '2'
<if
test=
"empIdCard != null"
>
and a.EMP_IDCARD = #{empIdCard}
</if>
<if
test=
"settleDomainIds != null"
>
AND a.SETTLE_DOMAIN in
<foreach
item=
"item"
index=
"index"
collection=
"settleDomainIds"
open=
"("
separator=
","
close=
")"
>
#{item}
</foreach>
</if>
</where>
</select>
<!--获取在用公积金-->
<select
id=
"getFundList"
resultMap=
"tSocialFundInfoMap"
>
SELECT
<include
refid=
"Base_Column_List"
/>
FROM t_social_fund_info a
<where>
a.FUND_ADD_STATUS != '4' and a.FUND_REDUCE_STATUS != '2'
<if
test=
"empIdCard != null"
>
and a.EMP_IDCARD = #{empIdCard}
</if>
<if
test=
"settleDomainIds != null"
>
AND a.SETTLE_DOMAIN in
<foreach
item=
"item"
index=
"index"
collection=
"settleDomainIds"
open=
"("
separator=
","
close=
")"
>
#{item}
</foreach>
</if>
</where>
</select>
</mapper>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment