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
c58405a9
Commit
c58405a9
authored
2 years ago
by
李灿灿
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
商险优化部分接口
parent
c60d496d
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
92 additions
and
0 deletions
+92
-0
CommonConstants.java
...ud.plus.v1/yifu/common/core/constant/CommonConstants.java
+10
-0
IdCardUtil.java
.../yifu/cloud/plus/v1/yifu/common/core/util/IdCardUtil.java
+37
-0
InsurancesConstants.java
...lus/v1/yifu/insurances/constants/InsurancesConstants.java
+12
-0
TInsuranceDetailServiceImpl.java
.../insurances/service/impl/TInsuranceDetailServiceImpl.java
+33
-0
No files found.
yifu-common/yifu-common-core/src/main/java/com/yifu.cloud.plus.v1/yifu/common/core/constant/CommonConstants.java
View file @
c58405a9
...
...
@@ -378,6 +378,16 @@ public interface CommonConstants {
// 日
String
DAY
=
"日"
;
/**
* 一年365天
*/
int
ONE_YEAR
=
365
;
/**
* 数字70
*/
int
SEVENTY
=
70
;
/**
* 省市
* @Author fxj
...
...
This diff is collapsed.
Click to expand it.
yifu-common/yifu-common-core/src/main/java/com/yifu/cloud/plus/v1/yifu/common/core/util/IdCardUtil.java
View file @
c58405a9
...
...
@@ -4,6 +4,7 @@ import lombok.extern.slf4j.Slf4j;
import
java.text.ParseException
;
import
java.text.SimpleDateFormat
;
import
java.util.Calendar
;
import
java.util.Date
;
import
java.util.regex.Matcher
;
import
java.util.regex.Pattern
;
...
...
@@ -30,6 +31,42 @@ public class IdCardUtil {
}
/**
* 根据身份证号计算周岁
* 例如:当前时间是2022-08-22,那么2007-08-22算15周岁,2007-08-23才算16周岁
*
* @author licancan
* @param idNO
* @return {@link int}
*/
public
static
int
getFullAge
(
String
idNO
){
Date
birthday
=
getBirthdate
(
idNO
);
// 从Calendar对象中获得一个Date对象
Calendar
cal
=
Calendar
.
getInstance
();
// 把出生日期放入Calendar类型的bir对象中,进行Calendar和Date类型进行转换
Calendar
bir
=
Calendar
.
getInstance
();
bir
.
setTime
(
birthday
);
// 如果生日大于当前日期,则抛出异常:出生日期不能大于当前日期
if
(
cal
.
before
(
birthday
))
{
throw
new
IllegalArgumentException
(
"The birthday is after Now,It's unbelievable"
);
}
// 取出当前年月日
int
yearNow
=
cal
.
get
(
Calendar
.
YEAR
);
int
monthNow
=
cal
.
get
(
Calendar
.
MONTH
);
int
dayNow
=
cal
.
get
(
Calendar
.
DAY_OF_MONTH
);
// 取出出生年月日
int
yearBirth
=
bir
.
get
(
Calendar
.
YEAR
);
int
monthBirth
=
bir
.
get
(
Calendar
.
MONTH
);
int
dayBirth
=
bir
.
get
(
Calendar
.
DAY_OF_MONTH
);
// 大概年龄是当前年减去出生年
int
age
=
yearNow
-
yearBirth
;
// 如果出当前月大于出生月,或者当前月等于出生月但是当前日大于出生日,那么年龄age就加一岁
if
(
monthNow
>
monthBirth
||
(
monthNow
==
monthBirth
&&
dayNow
>
dayBirth
))
{
age
++;
}
return
age
;
}
/**
* 提取身份证中的出生日期,身份证非法则返回空
* @param idNum
...
...
This diff is collapsed.
Click to expand it.
yifu-insurances/yifu-insurances-api/src/main/java/com/yifu/cloud/plus/v1/yifu/insurances/constants/InsurancesConstants.java
View file @
c58405a9
...
...
@@ -185,6 +185,14 @@ public class InsurancesConstants {
* 员工身份证号格式错误
*/
public
static
final
String
EMP_IDCARD_NO_NOT_LEGITIMATE
=
"员工身份证号格式错误"
;
/**
* 员工年龄不在16岁-70岁之间
*/
public
static
final
String
EMP_AGE_NOT_LEGITIMATE
=
"员工年龄不在16岁-70岁之间"
;
/**
* 替换员工年龄不在16岁-70岁之间
*/
public
static
final
String
REPLACE_EMP_AGE_NOT_LEGITIMATE
=
"替换员工年龄不在16岁-70岁之间"
;
/**
* 员工未通过实名认证
*/
...
...
@@ -245,6 +253,10 @@ public class InsurancesConstants {
* 保单结束时间需要大于保单开始时间
*/
public
static
final
String
POLICY_START_SHOULD_LESS_THAN_POLICY_END
=
"保单结束时间需要大于保单开始时间"
;
/**
* 保单起止时间不能超过365天
*/
public
static
final
String
POLICY_DATE_NOT_MORE_THAN_365
=
"保单起止时间不能超过365天"
;
/**
* 保单结束时间不能为空
*/
...
...
This diff is collapsed.
Click to expand it.
yifu-insurances/yifu-insurances-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/insurances/service/impl/TInsuranceDetailServiceImpl.java
View file @
c58405a9
...
...
@@ -15,6 +15,7 @@ import com.yifu.cloud.plus.v1.yifu.archives.vo.TSettleDomainSelectVo;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.CacheConstants
;
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.IdCardUtil
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.R
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.RedisUtil
;
import
com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser
;
...
...
@@ -555,6 +556,9 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
if
(!
LocalDateUtil
.
compareDate
(
param
.
getPolicyStart
(),
param
.
getPolicyEnd
())){
return
R
.
failed
(
InsurancesConstants
.
POLICY_START_SHOULD_LESS_THAN_POLICY_END
);
}
if
(
LocalDateUtil
.
betweenDay
(
param
.
getPolicyStart
(),
param
.
getPolicyEnd
())
>
CommonConstants
.
ONE_YEAR
){
return
R
.
failed
(
InsurancesConstants
.
POLICY_DATE_NOT_MORE_THAN_365
);
}
//如果不是补单的,需要校验:保单开始日期 > 当前派单日期
if
(
byId
.
getSignFlag
()
==
CommonConstants
.
ZERO_INT
){
...
...
@@ -1394,6 +1398,12 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
listResult
.
add
(
param
);
continue
;
}
//年龄是否在16-70之间
if
(
IdCardUtil
.
getFullAge
(
param
.
getEmpIdcardNo
())
<
CommonConstants
.
SIXTEEN_INT
||
IdCardUtil
.
getFullAge
(
param
.
getEmpIdcardNo
())
>
CommonConstants
.
SEVENTY
){
param
.
setErrorMessage
(
InsurancesConstants
.
EMP_AGE_NOT_LEGITIMATE
);
listResult
.
add
(
param
);
continue
;
}
// 保单开始日期 > 当前派单日期
if
(!
LocalDateUtil
.
isDate
(
param
.
getPolicyStart
(),
LocalDateUtil
.
NORM_DATE_PATTERN
)){
...
...
@@ -1416,6 +1426,11 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
listResult
.
add
(
param
);
continue
;
}
if
(
LocalDateUtil
.
betweenDay
(
param
.
getPolicyStart
(),
param
.
getPolicyEnd
())
>
CommonConstants
.
ONE_YEAR
){
param
.
setErrorMessage
(
InsurancesConstants
.
POLICY_DATE_NOT_MORE_THAN_365
);
listResult
.
add
(
param
);
continue
;
}
//表内数据重复 员工姓名、员工身份证号码、保险公司、险种、起止时间(有交叉)
for
(
int
j
=
0
;
j
<
distinctList
.
size
();
j
++)
{
...
...
@@ -1776,6 +1791,12 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
listResult
.
add
(
param
);
continue
;
}
//年龄是否在16-70之间
if
(
IdCardUtil
.
getFullAge
(
param
.
getEmpIdcardNo
())
<
CommonConstants
.
SIXTEEN_INT
||
IdCardUtil
.
getFullAge
(
param
.
getEmpIdcardNo
())
>
CommonConstants
.
SEVENTY
){
param
.
setErrorMessage
(
InsurancesConstants
.
EMP_AGE_NOT_LEGITIMATE
);
listResult
.
add
(
param
);
continue
;
}
//表内数据重复 员工姓名、员工身份证号码、保险公司、险种
for
(
int
j
=
0
;
j
<
distinctList
.
size
();
j
++)
{
InsuranceBatchParam
repeat
=
distinctList
.
get
(
j
);
...
...
@@ -2117,6 +2138,12 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
listResult
.
add
(
param
);
continue
;
}
//年龄是否在16-70之间
if
(
IdCardUtil
.
getFullAge
(
param
.
getReplaceEmpIdcardNo
())
<
CommonConstants
.
SIXTEEN_INT
||
IdCardUtil
.
getFullAge
(
param
.
getReplaceEmpIdcardNo
())
>
CommonConstants
.
SEVENTY
){
param
.
setErrorMessage
(
InsurancesConstants
.
REPLACE_EMP_AGE_NOT_LEGITIMATE
);
listResult
.
add
(
param
);
continue
;
}
if
(!
LocalDateUtil
.
isDate
(
param
.
getPolicyStart
(),
LocalDateUtil
.
NORM_DATE_PATTERN
)){
param
.
setErrorMessage
(
InsurancesConstants
.
POLICY_START_PARSE_ERROR
);
...
...
@@ -2133,6 +2160,12 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
listResult
.
add
(
param
);
continue
;
}
if
(
LocalDateUtil
.
betweenDay
(
param
.
getPolicyStart
(),
param
.
getPolicyEnd
())
>
CommonConstants
.
ONE_YEAR
){
param
.
setErrorMessage
(
InsurancesConstants
.
POLICY_DATE_NOT_MORE_THAN_365
);
listResult
.
add
(
param
);
continue
;
}
//表内数据重复 员工姓名、员工身份证号码、保险公司、险种、起止时间(有交叉)
for
(
int
j
=
0
;
j
<
distinctList
.
size
();
j
++)
{
InsuranceReplaceParam
repeat
=
distinctList
.
get
(
j
);
...
...
This diff is collapsed.
Click to expand it.
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