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
5564258a
Commit
5564258a
authored
Jul 27, 2022
by
zhaji
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
"feature-zhaJi:优化导入时间格式,新增减员办理异常返回类"
parent
ee3ae9e1
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
687 additions
and
436 deletions
+687
-436
ValidityConstants.java
....plus.v1/yifu/common/core/constant/ValidityConstants.java
+2
-0
ValidityUtil.java
...yifu/cloud/plus/v1/yifu/insurances/util/ValidityUtil.java
+14
-0
RefundErrorVo.java
.../yifu/cloud/plus/v1/yifu/insurances/vo/RefundErrorVo.java
+191
-0
RefundExportListVo.java
.../cloud/plus/v1/yifu/insurances/vo/RefundExportListVo.java
+6
-0
TInsuranceCompanyServiceImpl.java
...insurances/service/impl/TInsuranceCompanyServiceImpl.java
+2
-2
TInsuranceDetailServiceImpl.java
.../insurances/service/impl/TInsuranceDetailServiceImpl.java
+469
-434
TInsuranceTypeServiceImpl.java
...fu/insurances/service/impl/TInsuranceTypeServiceImpl.java
+3
-0
No files found.
yifu-common/yifu-common-core/src/main/java/com/yifu.cloud.plus.v1/yifu/common/core/constant/ValidityConstants.java
View file @
5564258a
...
...
@@ -61,4 +61,6 @@ public class ValidityConstants {
public
static
final
String
PATTERN_32
=
"^.{1,32}$"
;
/** 最多50位 规则 */
public
static
final
String
PATTERN_50
=
"^.{1,50}$"
;
/** 最多60位 规则 */
public
static
final
String
PATTERN_60
=
"^.{1,60}$"
;
}
yifu-insurances/yifu-insurances-api/src/main/java/com/yifu/cloud/plus/v1/yifu/insurances/util/ValidityUtil.java
View file @
5564258a
...
...
@@ -258,6 +258,20 @@ public class ValidityUtil {
return
str
.
matches
(
ValidityConstants
.
PATTERN_50
)
;
}
/**
* 验证字符串 最多50位
*
* @author licancan
* @param str
* @return {@link boolean}
*/
public
static
boolean
validate60
(
final
String
str
){
if
(
Common
.
isEmpty
(
str
)){
return
Boolean
.
FALSE
;
}
return
str
.
matches
(
ValidityConstants
.
PATTERN_60
)
;
}
/**
* 校验用户姓名是否是初始化的值
*
...
...
yifu-insurances/yifu-insurances-api/src/main/java/com/yifu/cloud/plus/v1/yifu/insurances/vo/RefundErrorVo.java
0 → 100644
View file @
5564258a
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
insurances
.
vo
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
io.swagger.v3.oas.annotations.media.Schema
;
import
io.swagger.v3.oas.annotations.tags.Tag
;
import
lombok.Data
;
import
java.io.Serializable
;
import
java.time.LocalDate
;
/**
* @author zhaji
* @description 减员办理错误返回类
* @date 2022-07-27 10:29:55
*/
@Data
@Tag
(
name
=
"减员办理错误返回类"
)
public
class
RefundErrorVo
implements
Serializable
{
private
static
final
long
serialVersionUID
=
-
2689686777914935788L
;
/**
* 主键
*/
private
String
id
;
/**
* 项目名称
*/
@Schema
(
description
=
"项目名称"
)
private
String
projectName
;
/**
* 项目编码
*/
@Schema
(
description
=
"项目编码"
)
private
String
deptNo
;
/**
* 员工姓名
*/
@Schema
(
description
=
"员工姓名"
)
private
String
empName
;
/**
* 员工身份证号
*/
@Schema
(
description
=
"员工身份证号"
)
private
String
empIdcardNo
;
/**
* 投保类型, 1新增、3批增、4替换
*/
@Schema
(
description
=
" 投保类型, 1新增、3批增、4替换"
)
private
Integer
buyType
;
/**
* 减员状态 1待减员 2减员中3减员退回
*/
@Schema
(
description
=
"减员状态 1待减员 2减员中3减员退回"
)
private
Integer
reduceHandleStatus
;
/**
* 投保岗位
*/
@Schema
(
description
=
"投保岗位"
)
private
String
post
;
/**
* 商险购买地省code
*/
@Schema
(
description
=
"商险购买地省code"
)
private
Integer
insuranceProvince
;
/**
* 商险购买地省
*/
@Schema
(
description
=
"商险购买地省"
)
private
String
insuranceProvinceName
;
/**
* 商险购买地市code
*/
@Schema
(
description
=
"商险购买地市code"
)
private
Integer
insuranceCity
;
/**
* 商险购买地市
*/
@Schema
(
description
=
"商险购买地市"
)
private
String
insuranceCityName
;
/**
* 商险办理省code
*/
@Schema
(
description
=
"商险办理省code"
)
private
Integer
insuranceHandleProvince
;
/**
* 商险办理省
*/
@Schema
(
description
=
"商险办理省"
)
private
String
insuranceHandleProvinceName
;
/**
* 商险办理城市code
*/
@Schema
(
description
=
"商险办理城市code"
)
private
Integer
insuranceHandleCity
;
/**
* 商险办理城市
*/
@Schema
(
description
=
"商险办理城市"
)
private
String
insuranceHandleCityName
;
/**
* 保单开始时间
*/
@JsonFormat
(
shape
=
JsonFormat
.
Shape
.
STRING
,
pattern
=
"yyyy-MM-dd"
)
@Schema
(
description
=
"保单开始时间"
)
private
LocalDate
policyStart
;
/**
* 保单结束时间
*/
@JsonFormat
(
shape
=
JsonFormat
.
Shape
.
STRING
,
pattern
=
"yyyy-MM-dd"
)
@Schema
(
description
=
"保单结束时间"
)
private
LocalDate
policyEnd
;
/**
* 保险公司名称(冗余字段)
*/
@Schema
(
description
=
"保险公司名称"
)
private
String
insuranceCompanyName
;
/**
* 险种名称
*/
@Schema
(
description
=
"险种名称"
)
private
String
insuranceTypeName
;
/**
* 购买标准
*/
@Schema
(
description
=
"购买标准"
)
private
String
buyStandard
;
/**
* 医疗额度
*/
@Schema
(
description
=
"医疗额度"
)
private
String
medicalQuota
;
/**
* 身故或残疾额度
*/
@Schema
(
description
=
"身故或残疾额度"
)
private
String
dieDisableQuota
;
/**
* 结算月
*/
@Schema
(
description
=
"结算月"
)
private
String
settleMonth
;
/**
* 结算类型 (0、与薪资合并结算 1、单独结算)
*/
@Schema
(
description
=
"结算类型 (0、预估 1、实缴)"
)
private
Integer
settleType
;
/**
* 创建人姓名
*/
@Schema
(
description
=
"创建人(派单人)"
)
private
String
createName
;
/**
* 备注
*/
@Schema
(
description
=
"备注"
)
private
String
remark
;
/**
* 错误原因
*/
@Schema
(
description
=
"错误原因"
)
private
String
errorMessage
;
}
yifu-insurances/yifu-insurances-api/src/main/java/com/yifu/cloud/plus/v1/yifu/insurances/vo/RefundExportListVo.java
View file @
5564258a
...
...
@@ -54,6 +54,12 @@ public class RefundExportListVo implements Serializable {
@Schema
(
description
=
" 投保类型, 1新增、3批增、4替换"
)
private
Integer
buyType
;
/**
* 减员状态 1待减员 2减员中3减员退回
*/
@Schema
(
description
=
"减员状态 1待减员 2减员中3减员退回"
)
private
Integer
reduceHandleStatus
;
/**
* 投保岗位
*/
...
...
yifu-insurances/yifu-insurances-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/insurances/service/impl/TInsuranceCompanyServiceImpl.java
View file @
5564258a
...
...
@@ -16,6 +16,7 @@ import com.yifu.cloud.plus.v1.yifu.insurances.entity.TInsuranceDetail;
import
com.yifu.cloud.plus.v1.yifu.insurances.mapper.TInsuranceCompanyMapper
;
import
com.yifu.cloud.plus.v1.yifu.insurances.service.TInsuranceCompanyService
;
import
com.yifu.cloud.plus.v1.yifu.insurances.service.TInsuranceDetailService
;
import
com.yifu.cloud.plus.v1.yifu.insurances.util.ValidityUtil
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.stereotype.Service
;
...
...
@@ -53,8 +54,7 @@ public class TInsuranceCompanyServiceImpl extends ServiceImpl<TInsuranceCompanyM
if
(!
CommonConstants
.
ZERO_STRING
.
equals
(
billingType
)
&&
!
CommonConstants
.
ONE_STRING
.
equals
(
billingType
)){
return
R
.
failed
(
"计费方式格式不正确"
);
}
String
companyName
=
insuranceCompany
.
getCompanyName
();
if
(
companyName
.
length
()>
CommonConstants
.
SIXTY_INT
){
if
(!
ValidityUtil
.
validate60
(
insuranceCompany
.
getCompanyName
())){
return
R
.
failed
(
"保险公司名称过长"
);
}
boolean
b
=
companyIsExists
(
insuranceCompany
.
getCompanyName
());
...
...
yifu-insurances/yifu-insurances-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/insurances/service/impl/TInsuranceDetailServiceImpl.java
View file @
5564258a
...
...
@@ -1617,136 +1617,6 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
/***********************减员办理********************************/
/**
* 减员导入校验
*
* @author zhaji
* @param insuranceRefundCheckList 减员表
* @return {@link R}
*/
public
Map
<
String
,
List
<
InsuranceRefundCheck
>>
checkInsuranceRefundList
(
List
<
InsuranceRefundCheck
>
insuranceRefundCheckList
){
List
<
InsuranceRefundCheck
>
errorList
=
new
ArrayList
<>(
128
);
List
<
InsuranceRefundCheck
>
successList
=
new
ArrayList
<>();
Map
<
String
,
List
<
InsuranceRefundCheck
>>
map
=
new
HashMap
<>();
for
(
InsuranceRefundCheck
param
:
insuranceRefundCheckList
)
{
//员工姓名
String
empName
=
param
.
getEmpName
();
if
(
StringUtils
.
isBlank
(
empName
)){
param
.
setErrorMessage
(
InsurancesConstants
.
EMP_NAME_NOT_EMPTY
);
errorList
.
add
(
param
);
continue
;
}
//员工身份证
String
empIdCardNo
=
param
.
getEmpIdcardNo
();
if
(
StringUtils
.
isBlank
(
empIdCardNo
)){
param
.
setErrorMessage
(
InsurancesConstants
.
EMP_IDCARD_NO_NOT_EMPTY
);
errorList
.
add
(
param
);
continue
;
}
//保险公司名称
String
insuranceCompanyName
=
param
.
getInsuranceCompanyName
();
if
(
StringUtils
.
isBlank
(
insuranceCompanyName
)){
param
.
setErrorMessage
(
InsurancesConstants
.
INSURANCE_COMPANY_NAME_NOT_EMPTY
);
errorList
.
add
(
param
);
continue
;
}
//险种名称
String
insuranceTypeName
=
param
.
getInsuranceTypeName
();
if
(
StringUtils
.
isBlank
(
insuranceTypeName
)){
param
.
setErrorMessage
(
InsurancesConstants
.
INSURANCE_TYPE_NAME_NOT_EMPTY
);
errorList
.
add
(
param
);
continue
;
}
//保单开始日期
String
policyStart
=
param
.
getPolicyStart
();
if
(
StringUtils
.
isBlank
(
policyStart
)){
param
.
setErrorMessage
(
InsurancesConstants
.
POLICY_START_NOT_EMPTY
);
errorList
.
add
(
param
);
continue
;
}
//保单结束日期
String
policyEnd
=
param
.
getPolicyEnd
();
if
(
StringUtils
.
isBlank
(
policyEnd
)){
param
.
setErrorMessage
(
InsurancesConstants
.
POLICY_END_NOT_EMPTY
);
errorList
.
add
(
param
);
continue
;
}
// 身份证号位数校验(18 位合法)
if
(
ValidityUtil
.
validateIDCard
(
param
.
getEmpIdcardNo
())){
param
.
setErrorMessage
(
InsurancesConstants
.
EMP_IDCARD_NO_NOT_LEGITIMATE
);
errorList
.
add
(
param
);
continue
;
}
// 保单开始日期格式校验
if
(!
LocalDateUtil
.
isDate
(
policyStart
,
LocalDateUtil
.
NORM_DATE_PATTERN
)){
param
.
setErrorMessage
(
InsurancesConstants
.
POLICY_START_PARSE_ERROR
);
errorList
.
add
(
param
);
continue
;
}
// 保单结束日期格式校验
if
(!
LocalDateUtil
.
isDate
(
policyEnd
,
LocalDateUtil
.
NORM_DATE_PATTERN
)){
param
.
setErrorMessage
(
InsurancesConstants
.
POLICY_END_PARSE_ERROR
);
errorList
.
add
(
param
);
continue
;
}
LambdaQueryWrapper
<
TInsuranceDetail
>
queryWrapper
=
new
LambdaQueryWrapper
<>();
queryWrapper
.
eq
(
TInsuranceDetail
::
getDeleteFlag
,
CommonConstants
.
ZERO_INT
).
eq
(
TInsuranceDetail
::
getEmpName
,
empName
)
.
eq
(
TInsuranceDetail
::
getEmpIdcardNo
,
empIdCardNo
).
eq
(
TInsuranceDetail
::
getInsuranceTypeName
,
insuranceCompanyName
)
.
eq
(
TInsuranceDetail
::
getPolicyStart
,
policyStart
).
eq
(
TInsuranceDetail
::
getPolicyEnd
,
policyEnd
);
TInsuranceDetail
one
=
getOne
(
queryWrapper
);
if
(
Common
.
isEmpty
(
one
)){
param
.
setErrorMessage
(
InsurancesConstants
.
DATA_IS_NOT_EXIST
);
errorList
.
add
(
param
);
continue
;
}
//当前保单信息的不是已投保状态不能导入
Integer
buyHandleStatus
=
one
.
getBuyHandleStatus
();
if
(
CommonConstants
.
THREE_INT
!=
buyHandleStatus
){
param
.
setErrorMessage
(
InsurancesConstants
.
REFUND_ERROR
);
errorList
.
add
(
param
);
continue
;
}
Integer
reduceHandleStatus
=
one
.
getReduceHandleStatus
();
//当前保单信息的减员状态不为空时不能进行导入
if
(
reduceHandleStatus
!=
null
&&
CommonConstants
.
THREE_INT
!=
reduceHandleStatus
){
param
.
setErrorMessage
(
InsurancesConstants
.
REFUND_ERROR
);
errorList
.
add
(
param
);
continue
;
}
//出险状态
if
(
CommonConstants
.
ZERO_INT
!=
one
.
getIsUse
()){
param
.
setErrorMessage
(
InsurancesConstants
.
IS_USE_ERROR
);
errorList
.
add
(
param
);
continue
;
}
//有效状态
if
(
CommonConstants
.
ZERO_INT
!=
one
.
getIsEffect
()){
param
.
setErrorMessage
(
InsurancesConstants
.
IS_EFFECT_ERROR
);
errorList
.
add
(
param
);
continue
;
}
//过期状态
if
(
CommonConstants
.
ZERO_INT
!=
one
.
getIsOverdue
()){
param
.
setErrorMessage
(
InsurancesConstants
.
IS_OVERDUE_ERROR
);
errorList
.
add
(
param
);
continue
;
}
param
.
setId
(
one
.
getId
());
param
.
setReduceHandleStatus
(
one
.
getReduceHandleStatus
());
successList
.
add
(
param
);
}
map
.
put
(
"successList"
,
successList
);
map
.
put
(
"errorList"
,
errorList
);
return
map
;
};
/**
* 减员导入
*
...
...
@@ -1763,7 +1633,6 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
Map
<
String
,
List
<
InsuranceRefundCheck
>>
refundMap
=
checkInsuranceRefundList
(
insuranceRefundCheckList
);
List
<
InsuranceRefundCheck
>
successList
=
refundMap
.
get
(
"successList"
);
if
(
CollectionUtils
.
isNotEmpty
(
successList
)){
List
<
TInsuranceRefund
>
refundList
=
new
ArrayList
<>();
LambdaUpdateWrapper
<
TInsuranceDetail
>
updateWrapper
=
new
LambdaUpdateWrapper
<>();
updateWrapper
.
set
(
TInsuranceDetail
::
getUpdateBy
,
user
.
getId
())
.
set
(
TInsuranceDetail
::
getUpdateTime
,
LocalDateTime
.
now
())
...
...
@@ -1776,8 +1645,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
insuranceRefund
.
setCreateName
(
user
.
getNickname
());
insuranceRefund
.
setCreateTime
(
LocalDateTime
.
now
());
insuranceRefund
.
setRemark
(
refund
.
getRemark
());
if
(
CommonConstants
.
THREE_INT
==
refund
.
getReduceHandleStatus
()){
if
(
null
==
refund
.
getReduceHandleStatus
()
||
CommonConstants
.
THREE_INT
==
refund
.
getReduceHandleStatus
()){
tInsuranceRefundService
.
updateByInsDetailId
(
insuranceRefund
);
}
else
{
tInsuranceRefundService
.
save
(
insuranceRefund
);
...
...
@@ -1785,10 +1653,9 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
updateWrapper
.
eq
(
TInsuranceDetail
::
getId
,
refund
.
getId
());
update
(
updateWrapper
);
}
}
List
<
InsuranceRefundCheck
>
errorList
=
refundMap
.
get
(
"errorList"
);
return
R
.
ok
(
errorList
,
"校验完成
,成功:"
+
successList
.
size
()+
"条,失败:"
+
errorList
.
size
()+
"条
"
);
return
R
.
ok
(
errorList
,
"校验完成"
);
}
/**
...
...
@@ -2007,69 +1874,486 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
R
updateInsuranceRefund
(
InsuranceRefundListParam
insuranceDetail
)
{
InsuranceRefundListParam
param
=
new
InsuranceRefundListParam
();
Integer
refundType
=
insuranceDetail
.
getRefundType
();
if
(
CommonConstants
.
THREE_INT
!=
refundType
&&
CommonConstants
.
FOUR_INT
!=
refundType
){
return
R
.
failed
(
"当前的操作类型不正确"
);
}
YifuUser
user
=
SecurityUtils
.
getUser
();
List
<
String
>
insuranceDetailList
=
insuranceDetail
.
getInsuranceDetailList
();
List
<
RefundErrorVo
>
errorList
=
new
ArrayList
<>();
List
<
TInsuranceDetail
>
successList
=
new
ArrayList
<>();
List
<
TInsuranceDetail
>
tInsuranceDetails
=
this
.
listByIds
(
insuranceDetailList
);
List
<
TInsuranceRefund
>
refundList
=
new
ArrayList
<>();
for
(
TInsuranceDetail
tInsuranceDetail
:
tInsuranceDetails
)
{
TInsuranceRefund
refund
=
new
TInsuranceRefund
();
RefundErrorVo
refundErrorVo
=
new
RefundErrorVo
();
BeanCopyUtils
.
copyProperties
(
tInsuranceDetail
,
refundErrorVo
);
Integer
deleteFlag
=
tInsuranceDetail
.
getDeleteFlag
();
if
(
CommonConstants
.
ONE_INT
==
deleteFlag
){
tInsuranceDetail
.
setUpdateTime
(
LocalDateTime
.
now
());
tInsuranceDetail
.
setUpdateBy
(
user
.
getId
());
tInsuranceDetail
.
setReduceHandleStatus
(
refundType
);
if
(
refundType
.
equals
(
tInsuranceDetail
.
getReduceHandleStatus
())){
if
(
CommonConstants
.
THREE_INT
==
refundType
){
refundErrorVo
.
setErrorMessage
(
"该保单信息已被更新为减员退回"
);
errorList
.
add
(
refundErrorVo
);
}
else
{
refundErrorVo
.
setErrorMessage
(
"该保单信息已被更新为减员成功"
);
errorList
.
add
(
refundErrorVo
);
}
}
else
{
if
(
CommonConstants
.
ZERO_INT
==
deleteFlag
){
tInsuranceDetail
.
setUpdateTime
(
LocalDateTime
.
now
());
tInsuranceDetail
.
setUpdateBy
(
user
.
getId
());
tInsuranceDetail
.
setReduceHandleStatus
(
refundType
);
successList
.
add
(
tInsuranceDetail
);
refund
.
setInsDetailId
(
tInsuranceDetail
.
getId
());
refund
.
setCreateBy
(
user
.
getId
());
refund
.
setCreateTime
(
LocalDateTime
.
now
());
refund
.
setReduceHandleStatus
(
refundType
);
refundList
.
add
(
refund
);
}
else
{
refundErrorVo
.
setErrorMessage
(
"该保单信息已被删除"
);
errorList
.
add
(
refundErrorVo
);
}
}
}
return
R
.
ok
(
updateBatchById
(
tInsuranceDetails
),
"办理成功"
);
for
(
TInsuranceRefund
refund
:
refundList
)
{
tInsuranceRefundService
.
updateByInsDetailId
(
refund
);
}
updateBatchById
(
successList
);
return
R
.
ok
(
errorList
,
"操作成功"
);
}
/**
*
结算月份校验
*
变更结算月份
*
* @author zhaji
* @param
settleMonthCheckList 变更列表
* @return
{@link R}
* @param
* @return
void
*/
private
Map
<
String
,
List
<
SettleMonthChangeCheckParam
>>
settleMonthChangeCheck
(
List
<
SettleMonthChangeCheckParam
>
settleMonthCheckList
)
{
Map
<
String
,
List
<
SettleMonthChangeCheckParam
>>
map
=
new
HashMap
<>(
16
);
List
<
SettleMonthChangeCheckParam
>
errorList
=
new
ArrayList
();
List
<
SettleMonthChangeCheckParam
>
successList
=
new
ArrayList
<>();
for
(
SettleMonthChangeCheckParam
param
:
settleMonthCheckList
)
{
//结算月
String
settleMonth
=
param
.
getSettleMonth
();
if
(
StringUtils
.
isBlank
(
settleMonth
)){
param
.
setErrorMessage
(
InsurancesConstants
.
SETTLE_MONTH_NOT_EMPTY
);
errorList
.
add
(
param
);
continue
;
}
//员工姓名
String
empName
=
param
.
getEmpName
();
if
(
StringUtils
.
isBlank
(
empName
)){
param
.
setErrorMessage
(
InsurancesConstants
.
EMP_NAME_NOT_EMPTY
);
errorList
.
add
(
param
);
continue
;
}
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Override
public
R
settleMonthChange
(
List
<
SettleMonthChangeCheckParam
>
settleMonthCheckList
)
{
YifuUser
user
=
SecurityUtils
.
getUser
();
if
(!
Common
.
isNotEmpty
(
settleMonthCheckList
)){
return
R
.
failed
(
InsurancesConstants
.
SETTLE_MONTH_CHANGE_LIST_IS_EMPTY
);
}
Map
<
String
,
List
<
SettleMonthChangeCheckParam
>>
map
=
settleMonthChangeCheck
(
settleMonthCheckList
);
//todo 生成EKP通知,通知ekp变更结算月份
List
<
SettleMonthChangeCheckParam
>
successList
=
map
.
get
(
"successList"
);
for
(
SettleMonthChangeCheckParam
success
:
successList
)
{
LambdaUpdateWrapper
<
TInsuranceDetail
>
updateWrapper
=
new
LambdaUpdateWrapper
<>();
updateWrapper
.
eq
(
TInsuranceDetail
::
getDeleteFlag
,
CommonConstants
.
ZERO_INT
).
eq
(
TInsuranceDetail
::
getEmpName
,
success
.
getEmpName
())
.
eq
(
TInsuranceDetail
::
getEmpIdcardNo
,
success
.
getEmpIdCardNo
()).
eq
(
TInsuranceDetail
::
getInsuranceTypeName
,
success
.
getInsuranceTypeName
()
)
.
eq
(
TInsuranceDetail
::
getDeptNo
,
success
.
getDeptNo
()).
eq
(
TInsuranceDetail
::
getBuyStandard
,
success
.
getBuyStandard
())
.
eq
(
TInsuranceDetail
::
getInsuranceCompanyName
,
success
.
getInsuranceCompanyName
())
.
eq
(
TInsuranceDetail
::
getPolicyStart
,
success
.
getPolicyStart
()
).
eq
(
TInsuranceDetail
::
getPolicyEnd
,
success
.
getPolicyEnd
())
.
set
(
TInsuranceDetail
::
getSettleMonth
,
success
.
getSettleMonth
())
.
set
(
TInsuranceDetail
::
getUpdateBy
,
user
.
getId
())
.
set
(
TInsuranceDetail
::
getUpdateTime
,
LocalDateTime
.
now
());
update
(
updateWrapper
);
}
List
<
SettleMonthChangeCheckParam
>
errorList
=
map
.
get
(
"errorList"
);
//判断当前变更是否全部成功
return
R
.
ok
(
errorList
);
//员工身份证
String
empIdCardNo
=
param
.
getEmpIdCardNo
();
if
(
StringUtils
.
isBlank
(
empIdCardNo
)){
param
.
setErrorMessage
(
InsurancesConstants
.
EMP_IDCARD_NO_NOT_EMPTY
);
errorList
.
add
(
param
);
continue
;
}
}
//保险公司名称
String
insuranceCompanyName
=
param
.
getInsuranceCompanyName
();
if
(
StringUtils
.
isBlank
(
insuranceCompanyName
)){
param
.
setErrorMessage
(
InsurancesConstants
.
INSURANCE_COMPANY_NAME_NOT_EMPTY
);
errorList
.
add
(
param
);
continue
;
}
/**
* 变更所属项目
*
* @author zhaji
* @param deptChangeCheckList 变更列表
* @return {@link R}
*/
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
R
deptChange
(
List
<
DeptChangeCheckParam
>
deptChangeCheckList
)
{
YifuUser
user
=
SecurityUtils
.
getUser
();
if
(!
Common
.
isNotEmpty
(
deptChangeCheckList
)){
return
R
.
failed
(
"当前变更所属项目列表为空"
);
}
Map
<
String
,
List
<
DeptChangeCheckParam
>>
stringListMap
=
deptChangeCheck
(
deptChangeCheckList
);
//todo 生成EKP通知,通知ekp变更结算所属项目
List
<
DeptChangeCheckParam
>
successList
=
stringListMap
.
get
(
"successList"
);
for
(
DeptChangeCheckParam
success
:
successList
)
{
LambdaUpdateWrapper
<
TInsuranceDetail
>
updateWrapper
=
new
LambdaUpdateWrapper
<>();
updateWrapper
.
eq
(
TInsuranceDetail
::
getDeleteFlag
,
CommonConstants
.
ZERO_INT
).
eq
(
TInsuranceDetail
::
getEmpName
,
success
.
getEmpName
())
.
eq
(
TInsuranceDetail
::
getEmpIdcardNo
,
success
.
getEmpIdCardNo
()).
eq
(
TInsuranceDetail
::
getInsuranceTypeName
,
success
.
getInsuranceTypeName
()
)
.
eq
(
TInsuranceDetail
::
getDeptNo
,
success
.
getOldDeptNo
()).
eq
(
TInsuranceDetail
::
getBuyStandard
,
success
.
getBuyStandard
())
.
eq
(
TInsuranceDetail
::
getInsuranceCompanyName
,
success
.
getInsuranceCompanyName
())
.
eq
(
TInsuranceDetail
::
getPolicyStart
,
success
.
getPolicyStart
()
).
eq
(
TInsuranceDetail
::
getPolicyEnd
,
success
.
getPolicyEnd
())
.
set
(
TInsuranceDetail
::
getDeptNo
,
success
.
getNewDeptNo
())
.
set
(
TInsuranceDetail
::
getSettleType
,
success
.
getSettleType
())
.
set
(
TInsuranceDetail
::
getUpdateBy
,
user
.
getId
())
.
set
(
TInsuranceDetail
::
getUpdateTime
,
LocalDateTime
.
now
());
update
(
updateWrapper
);
}
List
<
DeptChangeCheckParam
>
errorList
=
stringListMap
.
get
(
"errorList"
);
return
R
.
ok
(
errorList
);
}
/**
* 根据保险公司名称查询保单明细
*
* @author zhaji
* @param companyName 保险公司名称
* @return {@link R}
*/
@Override
public
R
selectByCompanyName
(
String
companyName
)
{
LambdaQueryWrapper
<
TInsuranceDetail
>
typeWrapper
=
new
LambdaQueryWrapper
<>();
typeWrapper
.
eq
(
TInsuranceDetail
::
getInsuranceCompanyName
,
companyName
).
eq
(
TInsuranceDetail:
:
getDeleteFlag
,
CommonConstants
.
ZERO_INT
);
return
R
.
ok
(
list
(
typeWrapper
));
}
//险种名称
String
insuranceTypeName
=
param
.
getInsuranceTypeName
();
if
(
StringUtils
.
isBlank
(
insuranceTypeName
)){
param
.
setErrorMessage
(
InsurancesConstants
.
INSURANCE_TYPE_NAME_NOT_EMPTY
);
/**
* 根据险种id查询保单明细
*
* @author zhaji
* @param id
* @return {@link R}
*/
@Override
public
R
selectByTypeId
(
String
id
)
{
LambdaQueryWrapper
<
TInsuranceDetail
>
typeWrapper
=
new
LambdaQueryWrapper
<>();
typeWrapper
.
eq
(
TInsuranceDetail
::
getInsuranceTypeId
,
id
).
eq
(
TInsuranceDetail:
:
getDeleteFlag
,
CommonConstants
.
ZERO_INT
);
return
R
.
ok
(
list
(
typeWrapper
));
}
/**
* 出险
*
* @author zhaji
* @param id
* @return {@link R}
*/
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
R
updateIsUse
(
String
id
)
{
YifuUser
user
=
SecurityUtils
.
getUser
();
TInsuranceDetail
insuranceDetail
=
getById
(
id
);
if
(
Common
.
isEmpty
(
insuranceDetail
)
||
CommonConstants
.
ONE_INT
==
insuranceDetail
.
getDeleteFlag
()){
return
R
.
failed
(
"保单信息不存在或已被删除"
);
}
Integer
reduceHandleStatus
=
insuranceDetail
.
getReduceHandleStatus
();
Integer
buyHandleStatus
=
insuranceDetail
.
getBuyHandleStatus
();
if
(!(
CommonConstants
.
THREE_INT
==
buyHandleStatus
&&
(
null
==
reduceHandleStatus
||
CommonConstants
.
THREE_INT
==
reduceHandleStatus
))){
return
R
.
failed
(
"当前保单信息非已投保且未减员状态,不能进行出险操作"
);
}
Integer
isEffect
=
insuranceDetail
.
getIsEffect
();
if
(
CommonConstants
.
ZERO_INT
!=
isEffect
){
return
R
.
failed
(
"保单信息已被替换,不能进行出险操作"
);
}
Integer
isUse
=
insuranceDetail
.
getIsUse
();
if
(
CommonConstants
.
ZERO_INT
!=
isUse
){
return
R
.
failed
(
"保单信息已出险,不能进行出险操作"
);
}
Integer
isOverdue
=
insuranceDetail
.
getIsOverdue
();
if
(
CommonConstants
.
ZERO_INT
!=
isOverdue
){
return
R
.
failed
(
"保单信息已过期,不能进行出险操作"
);
}
insuranceDetail
.
setIsUse
(
CommonConstants
.
ONE_INT
);
insuranceDetail
.
setUpdateBy
(
user
.
getId
());
insuranceDetail
.
setUpdateTime
(
LocalDateTime
.
now
());
return
R
.
ok
(
updateById
(
insuranceDetail
),
"出险成功"
);
}
/**
* 更新减员退费
*
* @author zhaji
* @param paramList
* @return {@link R}
*/
@Override
public
R
updateRefundMoney
(
List
<
RefundMoneyParam
>
paramList
)
{
YifuUser
user
=
SecurityUtils
.
getUser
();
List
<
TInsuranceRefund
>
insuranceRefundList
=
new
ArrayList
<>();
Map
<
String
,
List
<
RefundMoneyParam
>>
map
=
refundMoneyCheck
(
paramList
);
List
<
RefundMoneyParam
>
successList
=
map
.
get
(
"successList"
);
if
(
CollectionUtils
.
isNotEmpty
(
successList
)){
for
(
RefundMoneyParam
param
:
successList
)
{
TInsuranceRefund
insuranceRefund
=
new
TInsuranceRefund
();
insuranceRefund
.
setInsDetailId
(
param
.
getId
());
insuranceRefund
.
setRefundMoney
(
new
BigDecimal
(
param
.
getRefundMoney
()));
insuranceRefund
.
setReduceHandleStatus
(
CommonConstants
.
FOUR_INT
);
insuranceRefund
.
setCreateBy
(
user
.
getId
());
insuranceRefund
.
setCreateName
(
user
.
getNickname
());
insuranceRefund
.
setCreateTime
(
LocalDateTime
.
now
());
insuranceRefundList
.
add
(
insuranceRefund
);
}
tInsuranceRefundService
.
saveBatch
(
insuranceRefundList
);
}
return
R
.
ok
(
map
.
get
(
"errorList"
));
}
/**
* 减员导入校验
*
* @author zhaji
* @param insuranceRefundCheckList 减员表
* @return {@link R}
*/
public
Map
<
String
,
List
<
InsuranceRefundCheck
>>
checkInsuranceRefundList
(
List
<
InsuranceRefundCheck
>
insuranceRefundCheckList
){
List
<
InsuranceRefundCheck
>
errorList
=
new
ArrayList
<>(
128
);
List
<
InsuranceRefundCheck
>
successList
=
new
ArrayList
<>();
Map
<
String
,
List
<
InsuranceRefundCheck
>>
map
=
new
HashMap
<>();
for
(
InsuranceRefundCheck
param
:
insuranceRefundCheckList
)
{
//员工姓名
String
empName
=
param
.
getEmpName
();
if
(
StringUtils
.
isBlank
(
empName
)){
param
.
setErrorMessage
(
InsurancesConstants
.
EMP_NAME_NOT_EMPTY
);
errorList
.
add
(
param
);
continue
;
}
//员工身份证
String
empIdCardNo
=
param
.
getEmpIdcardNo
();
if
(
StringUtils
.
isBlank
(
empIdCardNo
)){
param
.
setErrorMessage
(
InsurancesConstants
.
EMP_IDCARD_NO_NOT_EMPTY
);
errorList
.
add
(
param
);
continue
;
}
//保险公司名称
String
insuranceCompanyName
=
param
.
getInsuranceCompanyName
();
if
(
StringUtils
.
isBlank
(
insuranceCompanyName
)){
param
.
setErrorMessage
(
InsurancesConstants
.
INSURANCE_COMPANY_NAME_NOT_EMPTY
);
errorList
.
add
(
param
);
continue
;
}
//险种名称
String
insuranceTypeName
=
param
.
getInsuranceTypeName
();
if
(
StringUtils
.
isBlank
(
insuranceTypeName
)){
param
.
setErrorMessage
(
InsurancesConstants
.
INSURANCE_TYPE_NAME_NOT_EMPTY
);
errorList
.
add
(
param
);
continue
;
}
//保单开始日期
String
policyStart
=
param
.
getPolicyStart
();
if
(
StringUtils
.
isBlank
(
policyStart
)){
param
.
setErrorMessage
(
InsurancesConstants
.
POLICY_START_NOT_EMPTY
);
errorList
.
add
(
param
);
continue
;
}
//保单结束日期
String
policyEnd
=
param
.
getPolicyEnd
();
if
(
StringUtils
.
isBlank
(
policyEnd
)){
param
.
setErrorMessage
(
InsurancesConstants
.
POLICY_END_NOT_EMPTY
);
errorList
.
add
(
param
);
continue
;
}
// 身份证号位数校验(18 位合法)
if
(!
ValidityUtil
.
validateIDCard
(
param
.
getEmpIdcardNo
())){
param
.
setErrorMessage
(
InsurancesConstants
.
EMP_IDCARD_NO_NOT_LEGITIMATE
);
errorList
.
add
(
param
);
continue
;
}
// 保单开始日期格式校验
if
(!
LocalDateUtil
.
isDate
(
policyStart
,
LocalDateUtil
.
NORM_DATE_PATTERN
)){
param
.
setErrorMessage
(
InsurancesConstants
.
POLICY_START_PARSE_ERROR
);
errorList
.
add
(
param
);
continue
;
}
// 保单结束日期格式校验
if
(!
LocalDateUtil
.
isDate
(
policyEnd
,
LocalDateUtil
.
NORM_DATE_PATTERN
)){
param
.
setErrorMessage
(
InsurancesConstants
.
POLICY_END_PARSE_ERROR
);
errorList
.
add
(
param
);
continue
;
}
LambdaQueryWrapper
<
TInsuranceDetail
>
queryWrapper
=
new
LambdaQueryWrapper
<>();
queryWrapper
.
eq
(
TInsuranceDetail
::
getDeleteFlag
,
CommonConstants
.
ZERO_INT
).
eq
(
TInsuranceDetail
::
getEmpName
,
empName
)
.
eq
(
TInsuranceDetail
::
getEmpIdcardNo
,
empIdCardNo
).
eq
(
TInsuranceDetail
::
getInsuranceCompanyName
,
insuranceCompanyName
)
.
eq
(
TInsuranceDetail
::
getInsuranceTypeName
,
insuranceTypeName
)
.
eq
(
TInsuranceDetail
::
getPolicyStart
,
LocalDateUtil
.
parseLocalDate
(
policyStart
)).
eq
(
TInsuranceDetail
::
getPolicyEnd
,
LocalDateUtil
.
parseLocalDate
(
policyEnd
));
TInsuranceDetail
one
=
getOne
(
queryWrapper
);
if
(
Common
.
isEmpty
(
one
)){
param
.
setErrorMessage
(
InsurancesConstants
.
DATA_IS_NOT_EXIST
);
errorList
.
add
(
param
);
continue
;
}
//当前保单信息的不是已投保状态不能导入
Integer
buyHandleStatus
=
one
.
getBuyHandleStatus
();
if
(
CommonConstants
.
THREE_INT
!=
buyHandleStatus
){
param
.
setErrorMessage
(
InsurancesConstants
.
REFUND_ERROR
);
errorList
.
add
(
param
);
continue
;
}
Integer
reduceHandleStatus
=
one
.
getReduceHandleStatus
();
//当前保单信息的减员状态不为空时不能进行导入
if
(
reduceHandleStatus
!=
null
&&
CommonConstants
.
THREE_INT
!=
reduceHandleStatus
){
param
.
setErrorMessage
(
InsurancesConstants
.
REFUND_ERROR
);
errorList
.
add
(
param
);
continue
;
}
//出险状态
if
(
CommonConstants
.
ZERO_INT
!=
one
.
getIsUse
()){
param
.
setErrorMessage
(
InsurancesConstants
.
IS_USE_ERROR
);
errorList
.
add
(
param
);
continue
;
}
//有效状态
if
(
CommonConstants
.
ZERO_INT
!=
one
.
getIsEffect
()){
param
.
setErrorMessage
(
InsurancesConstants
.
IS_EFFECT_ERROR
);
errorList
.
add
(
param
);
continue
;
}
//过期状态
if
(
CommonConstants
.
ZERO_INT
!=
one
.
getIsOverdue
()){
param
.
setErrorMessage
(
InsurancesConstants
.
IS_OVERDUE_ERROR
);
errorList
.
add
(
param
);
continue
;
}
param
.
setId
(
one
.
getId
());
param
.
setReduceHandleStatus
(
one
.
getReduceHandleStatus
());
successList
.
add
(
param
);
}
map
.
put
(
"successList"
,
successList
);
map
.
put
(
"errorList"
,
errorList
);
return
map
;
};
/**
* 校验保单退费
*
* @author zhaji
* @param paramList 变更列表
* @return {@link R}
*/
public
Map
<
String
,
List
<
RefundMoneyParam
>>
refundMoneyCheck
(
List
<
RefundMoneyParam
>
paramList
){
Map
<
String
,
List
<
RefundMoneyParam
>>
map
=
new
HashMap
<>(
16
);
List
<
RefundMoneyParam
>
errorList
=
new
ArrayList
<>();
List
<
RefundMoneyParam
>
successList
=
new
ArrayList
<>();
for
(
RefundMoneyParam
param
:
paramList
)
{
String
refundMoney
=
param
.
getRefundMoney
();
String
policyNo
=
param
.
getPolicyNo
();
String
empName
=
param
.
getEmpName
();
String
empIdcardNo
=
param
.
getEmpIdcardNo
();
//退费金额
if
(
StringUtils
.
isBlank
(
refundMoney
)){
param
.
setErrorMessage
(
InsurancesConstants
.
REFUND_MONEY_NOT_EMPTY
);
errorList
.
add
(
param
);
continue
;
}
//保单号
if
(
StringUtils
.
isBlank
(
policyNo
)){
param
.
setErrorMessage
(
InsurancesConstants
.
POLICY_NO_EMPTY
);
errorList
.
add
(
param
);
continue
;
}
//姓名
if
(
StringUtils
.
isBlank
(
empName
)){
param
.
setErrorMessage
(
InsurancesConstants
.
EMP_NAME_NOT_EMPTY
);
errorList
.
add
(
param
);
continue
;
}
//身份证号
if
(
StringUtils
.
isBlank
(
empIdcardNo
)){
param
.
setErrorMessage
(
InsurancesConstants
.
EMP_IDCARD_NO_NOT_EMPTY
);
errorList
.
add
(
param
);
continue
;
}
if
(
empName
.
length
()>
CommonConstants
.
TWENTY_INT
){
param
.
setErrorMessage
(
InsurancesConstants
.
EMP_NAME_MAX_LENGTH_ERROR
);
errorList
.
add
(
param
);
continue
;
}
// 身份证号位数校验(18 位合法)
if
(!
ValidityUtil
.
validateIDCard
(
empIdcardNo
)){
param
.
setErrorMessage
(
InsurancesConstants
.
EMP_IDCARD_NO_NOT_LEGITIMATE
);
errorList
.
add
(
param
);
continue
;
}
if
(
BigDecimalUtils
.
isBigDecimal
(
refundMoney
)){
param
.
setErrorMessage
(
InsurancesConstants
.
REFUND_MONEY_PARSE_ERROR
);
errorList
.
add
(
param
);
continue
;
}
boolean
max
=
refundMoney
.
compareTo
(
CommonConstants
.
MONEY_MAX
)
<
0
;
boolean
min
=
refundMoney
.
compareTo
(
CommonConstants
.
MONEY_MIN
)
>
0
;
if
(
max
){
param
.
setErrorMessage
(
InsurancesConstants
.
REFUND_MONEY_MAX_ERROR
);
errorList
.
add
(
param
);
continue
;
}
if
(
min
){
param
.
setErrorMessage
(
InsurancesConstants
.
REFUND_MONEY_MIN_ERROR
);
errorList
.
add
(
param
);
continue
;
}
//必填格式校通过后查询对应的保单信息
TInsuranceRefundDetail
refundDetail
=
new
TInsuranceRefundDetail
();
refundDetail
.
setEmpName
(
empName
);
refundDetail
.
setEmpIdcardNo
(
empIdcardNo
);
refundDetail
.
setPolicyNo
(
policyNo
);
TInsuranceRefundDetail
tInsuranceRefundDetail
=
this
.
baseMapper
.
selectRefundDetail
(
refundDetail
);
if
(
Common
.
isEmpty
(
tInsuranceRefundDetail
)){
param
.
setErrorMessage
(
InsurancesConstants
.
REFUND_IS_NULL
);
errorList
.
add
(
param
);
continue
;
}
if
(
null
!=
tInsuranceRefundDetail
.
getRefundMoney
()){
param
.
setErrorMessage
(
InsurancesConstants
.
REFUND_MONEY_IS_NOT_NULL
);
errorList
.
add
(
param
);
continue
;
}
param
.
setId
(
tInsuranceRefundDetail
.
getInsDetailId
());
successList
.
add
(
param
);
}
map
.
put
(
"errorList"
,
errorList
);
map
.
put
(
"successList"
,
successList
);
return
map
;
}
/**
* 结算月份校验
*
* @author zhaji
* @param settleMonthCheckList 变更列表
* @return {@link R}
*/
private
Map
<
String
,
List
<
SettleMonthChangeCheckParam
>>
settleMonthChangeCheck
(
List
<
SettleMonthChangeCheckParam
>
settleMonthCheckList
)
{
Map
<
String
,
List
<
SettleMonthChangeCheckParam
>>
map
=
new
HashMap
<>(
16
);
List
<
SettleMonthChangeCheckParam
>
errorList
=
new
ArrayList
();
List
<
SettleMonthChangeCheckParam
>
successList
=
new
ArrayList
<>();
for
(
SettleMonthChangeCheckParam
param
:
settleMonthCheckList
)
{
//结算月
String
settleMonth
=
param
.
getSettleMonth
();
if
(
StringUtils
.
isBlank
(
settleMonth
)){
param
.
setErrorMessage
(
InsurancesConstants
.
SETTLE_MONTH_NOT_EMPTY
);
errorList
.
add
(
param
);
continue
;
}
//员工姓名
String
empName
=
param
.
getEmpName
();
if
(
StringUtils
.
isBlank
(
empName
)){
param
.
setErrorMessage
(
InsurancesConstants
.
EMP_NAME_NOT_EMPTY
);
errorList
.
add
(
param
);
continue
;
}
//员工身份证
String
empIdCardNo
=
param
.
getEmpIdCardNo
();
if
(
StringUtils
.
isBlank
(
empIdCardNo
)){
param
.
setErrorMessage
(
InsurancesConstants
.
EMP_IDCARD_NO_NOT_EMPTY
);
errorList
.
add
(
param
);
continue
;
}
//保险公司名称
String
insuranceCompanyName
=
param
.
getInsuranceCompanyName
();
if
(
StringUtils
.
isBlank
(
insuranceCompanyName
)){
param
.
setErrorMessage
(
InsurancesConstants
.
INSURANCE_COMPANY_NAME_NOT_EMPTY
);
errorList
.
add
(
param
);
continue
;
}
//险种名称
String
insuranceTypeName
=
param
.
getInsuranceTypeName
();
if
(
StringUtils
.
isBlank
(
insuranceTypeName
)){
param
.
setErrorMessage
(
InsurancesConstants
.
INSURANCE_TYPE_NAME_NOT_EMPTY
);
errorList
.
add
(
param
);
continue
;
}
...
...
@@ -2104,7 +2388,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
continue
;
}
// 身份证号位数校验(18 位合法)
if
(
ValidityUtil
.
validateIDCard
(
param
.
getEmpIdCardNo
())){
if
(
!
ValidityUtil
.
validateIDCard
(
param
.
getEmpIdCardNo
())){
param
.
setErrorMessage
(
InsurancesConstants
.
EMP_IDCARD_NO_NOT_LEGITIMATE
);
errorList
.
add
(
param
);
continue
;
...
...
@@ -2139,7 +2423,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
.
eq
(
TInsuranceDetail
::
getEmpIdcardNo
,
empIdCardNo
).
eq
(
TInsuranceDetail
::
getInsuranceTypeName
,
insuranceCompanyName
)
.
eq
(
TInsuranceDetail
::
getDeptNo
,
deptNo
).
eq
(
TInsuranceDetail
::
getBuyStandard
,
buyStandard
)
.
eq
(
TInsuranceDetail
::
getInsuranceCompanyName
,
insuranceCompanyName
)
.
eq
(
TInsuranceDetail
::
getPolicyStart
,
policyStart
).
eq
(
TInsuranceDetail
::
getPolicyEnd
,
policyEnd
);
.
eq
(
TInsuranceDetail
::
getPolicyStart
,
LocalDateUtil
.
parseLocalDate
(
policyStart
)
).
eq
(
TInsuranceDetail
::
getPolicyEnd
,
LocalDateUtil
.
parseLocalDate
(
policyEnd
)
);
TInsuranceDetail
insuranceDetail
=
getOne
(
queryWrapper
);
//如果保单信息为空
if
(
Common
.
isEmpty
(
insuranceDetail
)){
...
...
@@ -2206,255 +2490,6 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
map
.
put
(
"successList"
,
successList
);
return
map
;
}
/**
* 变更结算月份
*
* @author zhaji
* @param
* @return void
*/
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Override
public
R
settleMonthChange
(
List
<
SettleMonthChangeCheckParam
>
settleMonthCheckList
)
{
YifuUser
user
=
SecurityUtils
.
getUser
();
if
(!
Common
.
isNotEmpty
(
settleMonthCheckList
)){
return
R
.
failed
(
InsurancesConstants
.
SETTLE_MONTH_CHANGE_LIST_IS_EMPTY
);
}
Map
<
String
,
List
<
SettleMonthChangeCheckParam
>>
map
=
settleMonthChangeCheck
(
settleMonthCheckList
);
//todo 生成EKP通知,通知ekp变更结算月份
List
<
SettleMonthChangeCheckParam
>
successList
=
map
.
get
(
"successList"
);
for
(
SettleMonthChangeCheckParam
success
:
successList
)
{
LambdaUpdateWrapper
<
TInsuranceDetail
>
updateWrapper
=
new
LambdaUpdateWrapper
<>();
updateWrapper
.
eq
(
TInsuranceDetail
::
getDeleteFlag
,
CommonConstants
.
ZERO_INT
).
eq
(
TInsuranceDetail
::
getEmpName
,
success
.
getEmpName
())
.
eq
(
TInsuranceDetail
::
getEmpIdcardNo
,
success
.
getEmpIdCardNo
()).
eq
(
TInsuranceDetail
::
getInsuranceTypeName
,
success
.
getInsuranceTypeName
()
)
.
eq
(
TInsuranceDetail
::
getDeptNo
,
success
.
getDeptNo
()).
eq
(
TInsuranceDetail
::
getBuyStandard
,
success
.
getBuyStandard
())
.
eq
(
TInsuranceDetail
::
getInsuranceCompanyName
,
success
.
getInsuranceCompanyName
())
.
eq
(
TInsuranceDetail
::
getPolicyStart
,
success
.
getPolicyStart
()
).
eq
(
TInsuranceDetail
::
getPolicyEnd
,
success
.
getPolicyEnd
())
.
set
(
TInsuranceDetail
::
getSettleMonth
,
success
.
getSettleMonth
())
.
set
(
TInsuranceDetail
::
getUpdateBy
,
user
.
getId
())
.
set
(
TInsuranceDetail
::
getUpdateTime
,
LocalDateTime
.
now
());
update
(
updateWrapper
);
}
List
<
SettleMonthChangeCheckParam
>
errorList
=
map
.
get
(
"errorList"
);
//判断当前变更是否全部成功
return
R
.
ok
(
errorList
);
}
/**
* 变更所属项目
*
* @author zhaji
* @param deptChangeCheckList 变更列表
* @return {@link R}
*/
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
R
deptChange
(
List
<
DeptChangeCheckParam
>
deptChangeCheckList
)
{
YifuUser
user
=
SecurityUtils
.
getUser
();
if
(!
Common
.
isNotEmpty
(
deptChangeCheckList
)){
return
R
.
failed
(
"当前变更所属项目列表为空"
);
}
Map
<
String
,
List
<
DeptChangeCheckParam
>>
stringListMap
=
deptChangeCheck
(
deptChangeCheckList
);
//todo 生成EKP通知,通知ekp变更结算所属项目
List
<
DeptChangeCheckParam
>
successList
=
stringListMap
.
get
(
"successList"
);
for
(
DeptChangeCheckParam
success
:
successList
)
{
LambdaUpdateWrapper
<
TInsuranceDetail
>
updateWrapper
=
new
LambdaUpdateWrapper
<>();
updateWrapper
.
eq
(
TInsuranceDetail
::
getDeleteFlag
,
CommonConstants
.
ZERO_INT
).
eq
(
TInsuranceDetail
::
getEmpName
,
success
.
getEmpName
())
.
eq
(
TInsuranceDetail
::
getEmpIdcardNo
,
success
.
getEmpIdCardNo
()).
eq
(
TInsuranceDetail
::
getInsuranceTypeName
,
success
.
getInsuranceTypeName
()
)
.
eq
(
TInsuranceDetail
::
getDeptNo
,
success
.
getOldDeptNo
()).
eq
(
TInsuranceDetail
::
getBuyStandard
,
success
.
getBuyStandard
())
.
eq
(
TInsuranceDetail
::
getInsuranceCompanyName
,
success
.
getInsuranceCompanyName
())
.
eq
(
TInsuranceDetail
::
getPolicyStart
,
success
.
getPolicyStart
()
).
eq
(
TInsuranceDetail
::
getPolicyEnd
,
success
.
getPolicyEnd
())
.
set
(
TInsuranceDetail
::
getDeptNo
,
success
.
getNewDeptNo
())
.
set
(
TInsuranceDetail
::
getSettleType
,
success
.
getSettleType
())
.
set
(
TInsuranceDetail
::
getUpdateBy
,
user
.
getId
())
.
set
(
TInsuranceDetail
::
getUpdateTime
,
LocalDateTime
.
now
());
update
(
updateWrapper
);
}
List
<
DeptChangeCheckParam
>
errorList
=
stringListMap
.
get
(
"errorList"
);
return
R
.
ok
(
errorList
);
}
/**
* 根据保险公司名称查询保单明细
*
* @author zhaji
* @param companyName 保险公司名称
* @return {@link R}
*/
@Override
public
R
selectByCompanyName
(
String
companyName
)
{
LambdaQueryWrapper
<
TInsuranceDetail
>
typeWrapper
=
new
LambdaQueryWrapper
<>();
typeWrapper
.
eq
(
TInsuranceDetail
::
getInsuranceCompanyName
,
companyName
).
eq
(
TInsuranceDetail:
:
getDeleteFlag
,
CommonConstants
.
ZERO_INT
);
return
R
.
ok
(
list
(
typeWrapper
));
}
/**
* 根据险种id查询保单明细
*
* @author zhaji
* @param id
* @return {@link R}
*/
@Override
public
R
selectByTypeId
(
String
id
)
{
LambdaQueryWrapper
<
TInsuranceDetail
>
typeWrapper
=
new
LambdaQueryWrapper
<>();
typeWrapper
.
eq
(
TInsuranceDetail
::
getInsuranceTypeId
,
id
).
eq
(
TInsuranceDetail:
:
getDeleteFlag
,
CommonConstants
.
ZERO_INT
);
return
R
.
ok
(
list
(
typeWrapper
));
}
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
R
updateIsUse
(
String
id
)
{
YifuUser
user
=
SecurityUtils
.
getUser
();
TInsuranceDetail
insuranceDetail
=
getById
(
id
);
if
(
Common
.
isEmpty
(
insuranceDetail
)
||
CommonConstants
.
ONE_INT
==
insuranceDetail
.
getDeleteFlag
()){
return
R
.
failed
(
"保单信息不存在或已被删除"
);
}
Integer
reduceHandleStatus
=
insuranceDetail
.
getReduceHandleStatus
();
Integer
buyHandleStatus
=
insuranceDetail
.
getBuyHandleStatus
();
if
(!(
CommonConstants
.
THREE_INT
==
buyHandleStatus
&&
(
null
==
reduceHandleStatus
||
CommonConstants
.
THREE_INT
==
reduceHandleStatus
))){
return
R
.
failed
(
"当前保单信息非已投保且未减员状态,不能进行出险操作"
);
}
Integer
isEffect
=
insuranceDetail
.
getIsEffect
();
if
(
CommonConstants
.
ZERO_INT
!=
isEffect
){
return
R
.
failed
(
"保单信息已被替换,不能进行出险操作"
);
}
Integer
isUse
=
insuranceDetail
.
getIsUse
();
if
(
CommonConstants
.
ZERO_INT
!=
isUse
){
return
R
.
failed
(
"保单信息已出险,不能进行出险操作"
);
}
Integer
isOverdue
=
insuranceDetail
.
getIsOverdue
();
if
(
CommonConstants
.
ZERO_INT
!=
isOverdue
){
return
R
.
failed
(
"保单信息已过期,不能进行出险操作"
);
}
insuranceDetail
.
setIsUse
(
CommonConstants
.
ONE_INT
);
insuranceDetail
.
setUpdateBy
(
user
.
getId
());
insuranceDetail
.
setUpdateTime
(
LocalDateTime
.
now
());
return
R
.
ok
(
updateById
(
insuranceDetail
),
"出险成功"
);
}
/**
* 更新减员退费
*
* @author zhaji
* @param paramList
* @return {@link R}
*/
@Override
public
R
updateRefundMoney
(
List
<
RefundMoneyParam
>
paramList
)
{
YifuUser
user
=
SecurityUtils
.
getUser
();
List
<
TInsuranceRefund
>
insuranceRefundList
=
new
ArrayList
<>();
Map
<
String
,
List
<
RefundMoneyParam
>>
map
=
refundMoneyCheck
(
paramList
);
List
<
RefundMoneyParam
>
successList
=
map
.
get
(
"successList"
);
if
(
CollectionUtils
.
isNotEmpty
(
successList
)){
for
(
RefundMoneyParam
param
:
successList
)
{
TInsuranceRefund
insuranceRefund
=
new
TInsuranceRefund
();
insuranceRefund
.
setInsDetailId
(
param
.
getId
());
insuranceRefund
.
setRefundMoney
(
new
BigDecimal
(
param
.
getRefundMoney
()));
insuranceRefund
.
setReduceHandleStatus
(
CommonConstants
.
FOUR_INT
);
insuranceRefund
.
setCreateBy
(
user
.
getId
());
insuranceRefund
.
setCreateName
(
user
.
getNickname
());
insuranceRefund
.
setCreateTime
(
LocalDateTime
.
now
());
insuranceRefundList
.
add
(
insuranceRefund
);
}
tInsuranceRefundService
.
saveBatch
(
insuranceRefundList
);
}
return
R
.
ok
(
map
.
get
(
"errorList"
));
}
/**
* 校验保单退费
*
* @author zhaji
* @param paramList 变更列表
* @return {@link R}
*/
public
Map
<
String
,
List
<
RefundMoneyParam
>>
refundMoneyCheck
(
List
<
RefundMoneyParam
>
paramList
){
Map
<
String
,
List
<
RefundMoneyParam
>>
map
=
new
HashMap
<>(
16
);
List
<
RefundMoneyParam
>
errorList
=
new
ArrayList
<>();
List
<
RefundMoneyParam
>
successList
=
new
ArrayList
<>();
for
(
RefundMoneyParam
param
:
paramList
)
{
String
refundMoney
=
param
.
getRefundMoney
();
String
policyNo
=
param
.
getPolicyNo
();
String
empName
=
param
.
getEmpName
();
String
empIdcardNo
=
param
.
getEmpIdcardNo
();
//退费金额
if
(
StringUtils
.
isBlank
(
refundMoney
)){
param
.
setErrorMessage
(
InsurancesConstants
.
REFUND_MONEY_NOT_EMPTY
);
errorList
.
add
(
param
);
continue
;
}
//保单号
if
(
StringUtils
.
isBlank
(
policyNo
)){
param
.
setErrorMessage
(
InsurancesConstants
.
POLICY_NO_EMPTY
);
errorList
.
add
(
param
);
continue
;
}
//姓名
if
(
StringUtils
.
isBlank
(
empName
)){
param
.
setErrorMessage
(
InsurancesConstants
.
EMP_NAME_NOT_EMPTY
);
errorList
.
add
(
param
);
continue
;
}
//身份证号
if
(
StringUtils
.
isBlank
(
empIdcardNo
)){
param
.
setErrorMessage
(
InsurancesConstants
.
EMP_IDCARD_NO_NOT_EMPTY
);
errorList
.
add
(
param
);
continue
;
}
if
(
empName
.
length
()>
CommonConstants
.
TWENTY_INT
){
param
.
setErrorMessage
(
InsurancesConstants
.
EMP_NAME_MAX_LENGTH_ERROR
);
errorList
.
add
(
param
);
continue
;
}
// 身份证号位数校验(18 位合法)
if
(!
ValidityUtil
.
validateIDCard
(
empIdcardNo
)){
param
.
setErrorMessage
(
InsurancesConstants
.
EMP_IDCARD_NO_NOT_LEGITIMATE
);
errorList
.
add
(
param
);
continue
;
}
if
(
BigDecimalUtils
.
isBigDecimal
(
refundMoney
)){
param
.
setErrorMessage
(
InsurancesConstants
.
REFUND_MONEY_PARSE_ERROR
);
errorList
.
add
(
param
);
continue
;
}
boolean
max
=
refundMoney
.
compareTo
(
CommonConstants
.
MONEY_MAX
)
<
0
;
boolean
min
=
refundMoney
.
compareTo
(
CommonConstants
.
MONEY_MIN
)
>
0
;
if
(
max
){
param
.
setErrorMessage
(
InsurancesConstants
.
REFUND_MONEY_MAX_ERROR
);
errorList
.
add
(
param
);
continue
;
}
if
(
min
){
param
.
setErrorMessage
(
InsurancesConstants
.
REFUND_MONEY_MIN_ERROR
);
errorList
.
add
(
param
);
continue
;
}
//必填格式校通过后查询对应的保单信息
TInsuranceRefundDetail
refundDetail
=
new
TInsuranceRefundDetail
();
refundDetail
.
setEmpName
(
empName
);
refundDetail
.
setEmpIdcardNo
(
empIdcardNo
);
refundDetail
.
setPolicyNo
(
policyNo
);
TInsuranceRefundDetail
tInsuranceRefundDetail
=
this
.
baseMapper
.
selectRefundDetail
(
refundDetail
);
if
(
Common
.
isEmpty
(
tInsuranceRefundDetail
)){
param
.
setErrorMessage
(
InsurancesConstants
.
REFUND_IS_NULL
);
errorList
.
add
(
param
);
continue
;
}
if
(
null
!=
tInsuranceRefundDetail
.
getRefundMoney
()){
param
.
setErrorMessage
(
InsurancesConstants
.
REFUND_MONEY_IS_NOT_NULL
);
errorList
.
add
(
param
);
continue
;
}
param
.
setId
(
tInsuranceRefundDetail
.
getInsDetailId
());
successList
.
add
(
param
);
}
map
.
put
(
"errorList"
,
errorList
);
map
.
put
(
"successList"
,
successList
);
return
map
;
}
/**
* 校验所属项目
*
...
...
@@ -2537,7 +2572,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
continue
;
}
// 身份证号位数校验(18 位合法)
if
(
ValidityUtil
.
validateIDCard
(
param
.
getEmpIdCardNo
())){
if
(
!
ValidityUtil
.
validateIDCard
(
param
.
getEmpIdCardNo
())){
param
.
setErrorMessage
(
InsurancesConstants
.
EMP_IDCARD_NO_NOT_LEGITIMATE
);
errorList
.
add
(
param
);
continue
;
...
...
@@ -2587,7 +2622,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
.
eq
(
TInsuranceDetail
::
getEmpIdcardNo
,
empIdCardNo
).
eq
(
TInsuranceDetail
::
getInsuranceTypeName
,
insuranceCompanyName
)
.
eq
(
TInsuranceDetail
::
getBuyStandard
,
buyStandard
)
.
eq
(
TInsuranceDetail
::
getInsuranceCompanyName
,
insuranceCompanyName
)
.
eq
(
TInsuranceDetail
::
getPolicyStart
,
policyStart
).
eq
(
TInsuranceDetail
::
getPolicyEnd
,
policyEnd
);
.
eq
(
TInsuranceDetail
::
getPolicyStart
,
LocalDateUtil
.
parseLocalDate
(
policyStart
)).
eq
(
TInsuranceDetail
::
getPolicyEnd
,
LocalDateUtil
.
parseLocalDate
(
policyEnd
)
);
TInsuranceDetail
insuranceDetail
=
getOne
(
queryWrapper
);
//替换类型的保单不能变更所属项目
Integer
buyType
=
insuranceDetail
.
getBuyType
();
...
...
yifu-insurances/yifu-insurances-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/insurances/service/impl/TInsuranceTypeServiceImpl.java
View file @
5564258a
...
...
@@ -75,6 +75,9 @@ public class TInsuranceTypeServiceImpl extends ServiceImpl<TInsuranceTypeMapper,
if
(
Common
.
isEmpty
(
insuranceCompany
)){
return
R
.
failed
(
"所属保险公司不存在或已被删除"
);
}
if
(!
ValidityUtil
.
validate50
(
insuranceType
.
getName
())){
return
R
.
failed
(
"险种名称过长"
);
}
LambdaQueryWrapper
<
TInsuranceType
>
typeWrapper
=
new
LambdaQueryWrapper
<>();
typeWrapper
.
eq
(
TInsuranceType
::
getInsuranceCompanyId
,
companyId
).
eq
(
TInsuranceType:
:
getName
,
insuranceType
.
getName
()).
eq
(
TInsuranceType:
:
getDeleteFlag
,
CommonConstants
.
ZERO_INT
);
TInsuranceType
type
=
getOne
(
typeWrapper
);
...
...
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