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
d4146312
Commit
d4146312
authored
Aug 01, 2022
by
zhaji
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
"feature-zhaJi:新增保险公司,险种,费率,购买标准的操作记录"
parent
47d251fb
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
82 additions
and
16 deletions
+82
-16
TInsuranceCompanyServiceImpl.java
...insurances/service/impl/TInsuranceCompanyServiceImpl.java
+9
-3
TInsuranceTypeRateServiceImpl.java
...nsurances/service/impl/TInsuranceTypeRateServiceImpl.java
+40
-9
TInsuranceTypeServiceImpl.java
...fu/insurances/service/impl/TInsuranceTypeServiceImpl.java
+3
-0
TInsuranceTypeStandardServiceImpl.java
...ances/service/impl/TInsuranceTypeStandardServiceImpl.java
+30
-4
No files found.
yifu-insurances/yifu-insurances-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/insurances/service/impl/TInsuranceCompanyServiceImpl.java
View file @
d4146312
...
...
@@ -75,7 +75,10 @@ public class TInsuranceCompanyServiceImpl extends ServiceImpl<TInsuranceCompanyM
return
R
.
failed
(
"计费方式格式不正确"
);
}
if
(!
ValidityUtil
.
validate60
(
insuranceCompany
.
getCompanyName
())){
return
R
.
failed
(
"保险公司名称过长"
);
return
R
.
failed
(
"保险公司名称格式不正确"
);
}
if
(!
ValidityUtil
.
validate50
(
insuranceCompany
.
getCompanyAddress
())){
return
R
.
failed
(
"保险公司地址格式不正确"
);
}
boolean
b
=
companyIsExists
(
insuranceCompany
.
getCompanyName
());
if
(!
b
){
...
...
@@ -84,7 +87,7 @@ public class TInsuranceCompanyServiceImpl extends ServiceImpl<TInsuranceCompanyM
insuranceCompany
.
setCreateTime
(
LocalDateTime
.
now
());
insuranceCompany
.
setDeleteFlag
(
CommonConstants
.
ZERO_INT
);
save
(
insuranceCompany
);
addOperate
(
insuranceCompany
,
user
,
InsurancesConstants
.
DELETE
_INSURANCE_COMPANY
);
addOperate
(
insuranceCompany
,
user
,
InsurancesConstants
.
NEW
_INSURANCE_COMPANY
);
return
R
.
ok
(
"新增成功"
);
}
else
{
return
R
.
failed
(
"保险公司名称不能重复添加"
);
...
...
@@ -109,6 +112,9 @@ public class TInsuranceCompanyServiceImpl extends ServiceImpl<TInsuranceCompanyM
if
(!
CommonConstants
.
ZERO_STRING
.
equals
(
billingType
)
&&
!
CommonConstants
.
ONE_STRING
.
equals
(
billingType
)){
return
R
.
failed
(
"计费方式格式不正确"
);
}
if
(!
ValidityUtil
.
validate50
(
insuranceCompany
.
getCompanyAddress
())){
return
R
.
failed
(
"保险公司地址格式不正确"
);
}
LambdaQueryWrapper
<
TInsuranceCompany
>
queryWrapper
=
new
LambdaQueryWrapper
<>();
queryWrapper
.
eq
(
TInsuranceCompany:
:
getId
,
id
).
eq
(
TInsuranceCompany:
:
getDeleteFlag
,
CommonConstants
.
ZERO_INT
);
TInsuranceCompany
one
=
this
.
getOne
(
queryWrapper
);
...
...
@@ -117,7 +123,7 @@ public class TInsuranceCompanyServiceImpl extends ServiceImpl<TInsuranceCompanyM
}
String
companyName
=
one
.
getCompanyName
();
String
newCompanyName
=
insuranceCompany
.
getCompanyName
();
if
(
newCompanyName
.
length
()>
CommonConstants
.
SIXTY_INT
){
if
(
!
ValidityUtil
.
validate60
(
newCompanyName
)
){
return
R
.
failed
(
"要修改的保险公司名称过长"
);
}
//如果当前保险公司名称和修改后的名称不同
...
...
yifu-insurances/yifu-insurances-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/insurances/service/impl/TInsuranceTypeRateServiceImpl.java
View file @
d4146312
...
...
@@ -9,10 +9,13 @@ 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.core.vo.YifuUser
;
import
com.yifu.cloud.plus.v1.yifu.common.security.util.SecurityUtils
;
import
com.yifu.cloud.plus.v1.yifu.insurances.constants.InsurancesConstants
;
import
com.yifu.cloud.plus.v1.yifu.insurances.entity.TInsuranceCompany
;
import
com.yifu.cloud.plus.v1.yifu.insurances.entity.TInsuranceOperate
;
import
com.yifu.cloud.plus.v1.yifu.insurances.entity.TInsuranceType
;
import
com.yifu.cloud.plus.v1.yifu.insurances.entity.TInsuranceTypeRate
;
import
com.yifu.cloud.plus.v1.yifu.insurances.mapper.TInsuranceTypeRateMapper
;
import
com.yifu.cloud.plus.v1.yifu.insurances.service.TInsuranceOperateService
;
import
com.yifu.cloud.plus.v1.yifu.insurances.service.TInsuranceTypeRateService
;
import
com.yifu.cloud.plus.v1.yifu.insurances.service.TInsuranceTypeService
;
import
com.yifu.cloud.plus.v1.yifu.insurances.util.ValidityUtil
;
...
...
@@ -34,6 +37,9 @@ public class TInsuranceTypeRateServiceImpl extends ServiceImpl<TInsuranceTypeRat
@Resource
private
TInsuranceTypeService
insuranceTypeService
;
@Resource
private
TInsuranceOperateService
tInsuranceOperateService
;
/**
* 根据险种id查询费率列表
*
...
...
@@ -44,11 +50,11 @@ public class TInsuranceTypeRateServiceImpl extends ServiceImpl<TInsuranceTypeRat
@Override
public
R
getInsuranceTypeRateList
(
String
id
)
{
if
(
Common
.
isEmpty
(
id
)){
return
R
.
failed
(
"险种
id
为空"
);
return
R
.
failed
(
"险种为空"
);
}
TInsuranceType
byId
=
insuranceTypeService
.
getById
(
id
);
if
(
Common
.
isEmpty
(
byId
)
||
CommonConstants
.
ONE_INT
==
byId
.
getDeleteFlag
()){
return
R
.
failed
(
"
当前
险种信息不存在或已被删除"
);
return
R
.
failed
(
"
该
险种信息不存在或已被删除"
);
}
LambdaQueryWrapper
<
TInsuranceTypeRate
>
queryWrapper
=
new
LambdaQueryWrapper
<>();
queryWrapper
.
eq
(
TInsuranceTypeRate:
:
getDeleteFlag
,
CommonConstants
.
ZERO_INT
).
eq
(
TInsuranceTypeRate:
:
getInsuranceTypeId
,
id
);
...
...
@@ -78,7 +84,9 @@ public class TInsuranceTypeRateServiceImpl extends ServiceImpl<TInsuranceTypeRat
.
set
(
TInsuranceTypeRate:
:
getDeleteFlag
,
CommonConstants
.
ONE_INT
)
.
set
(
TInsuranceTypeRate
::
getUpdateBy
,
user
.
getId
())
.
set
(
TInsuranceTypeRate
::
getUpdateTime
,
LocalDateTime
.
now
());
return
R
.
ok
(
update
(
updateWrapper
),
"删除费率信息成功"
);
update
(
updateWrapper
);
addOperate
(
byId
,
user
,
InsurancesConstants
.
DELETE_INSURANCE_TYPE_RATE
);
return
R
.
ok
(
"删除费率信息成功"
);
}
/**
...
...
@@ -98,15 +106,15 @@ public class TInsuranceTypeRateServiceImpl extends ServiceImpl<TInsuranceTypeRat
String
insuranceTypeId
=
insuranceTypeRate
.
getInsuranceTypeId
();
TInsuranceType
byId
=
insuranceTypeService
.
getById
(
insuranceTypeId
);
if
(
Common
.
isEmpty
(
byId
)
||
CommonConstants
.
ONE_INT
==
byId
.
getDeleteFlag
()){
return
R
.
failed
(
"
当前
险种信息不存在或已被删除"
);
return
R
.
failed
(
"
该
险种信息不存在或已被删除"
);
}
String
month
=
insuranceTypeRate
.
getMonth
();
if
(!
ValidityUtil
.
validatePositiveInt
(
month
)){
return
R
.
failed
(
"
当前
月份格式不正确"
);
return
R
.
failed
(
"月份格式不正确"
);
}
String
rate
=
insuranceTypeRate
.
getRate
();
if
(!
ValidityUtil
.
validateMoney
(
rate
)){
return
R
.
failed
(
"
当前
费率格式不正确"
);
return
R
.
failed
(
"费率格式不正确"
);
}
LambdaQueryWrapper
<
TInsuranceTypeRate
>
queryWrapper
=
new
LambdaQueryWrapper
<>();
queryWrapper
.
eq
(
TInsuranceTypeRate:
:
getDeleteFlag
,
CommonConstants
.
ZERO_INT
).
eq
(
TInsuranceTypeRate:
:
getInsuranceTypeId
,
insuranceTypeId
)
...
...
@@ -117,11 +125,34 @@ public class TInsuranceTypeRateServiceImpl extends ServiceImpl<TInsuranceTypeRat
insuranceTypeRate
.
setCreateBy
(
user
.
getId
());
insuranceTypeRate
.
setCreateName
(
user
.
getNickname
());
insuranceTypeRate
.
setCreateTime
(
LocalDateTime
.
now
());
return
R
.
ok
(
this
.
baseMapper
.
insert
(
insuranceTypeRate
));
save
(
insuranceTypeRate
);
addOperate
(
insuranceTypeRate
,
user
,
InsurancesConstants
.
NEW_INSURANCE_TYPE_RATE
);
return
R
.
ok
(
"新增费率信息成功"
);
}
else
{
return
R
.
failed
(
"
当前险种已存在相同的费率
"
);
return
R
.
failed
(
"
该险种购买月份已存在
"
);
}
}
/**
* 操作记录
*
* @author zhaji
* @param insuranceTypeRate 费率信息
* @param user 登录用户
* @param operateDesc 操作描述
* @return void
*/
private
void
addOperate
(
TInsuranceTypeRate
insuranceTypeRate
,
YifuUser
user
,
String
operateDesc
){
try
{
TInsuranceOperate
operate
=
new
TInsuranceOperate
();
operate
.
setInsuranceDetailId
(
insuranceTypeRate
.
getId
());
operate
.
setOperateDesc
(
operateDesc
);
operate
.
setCreateBy
(
user
.
getId
());
operate
.
setCreateName
(
user
.
getNickname
());
operate
.
setCreateTime
(
LocalDateTime
.
now
());
tInsuranceOperateService
.
save
(
operate
);
}
catch
(
Exception
e
){
e
.
getStackTrace
();
}
}
}
yifu-insurances/yifu-insurances-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/insurances/service/impl/TInsuranceTypeServiceImpl.java
View file @
d4146312
...
...
@@ -20,6 +20,7 @@ import com.yifu.cloud.plus.v1.yifu.insurances.util.ValidityUtil;
import
com.yifu.cloud.plus.v1.yifu.insurances.vo.InsuranceTypeVo
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
javax.annotation.Resource
;
import
java.time.LocalDateTime
;
...
...
@@ -60,6 +61,7 @@ public class TInsuranceTypeServiceImpl extends ServiceImpl<TInsuranceTypeMapper,
* @return {@link R}
*/
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
R
saveInsuranceType
(
TInsuranceType
insuranceType
)
{
if
(
Common
.
isEmpty
(
insuranceType
)){
return
R
.
failed
(
"新增的险种信息为空"
);
...
...
@@ -134,6 +136,7 @@ public class TInsuranceTypeServiceImpl extends ServiceImpl<TInsuranceTypeMapper,
* @return {@link R}
*/
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
R
updateInsuranceType
(
TInsuranceType
insuranceType
)
{
YifuUser
user
=
SecurityUtils
.
getUser
();
if
(
Common
.
isEmpty
(
insuranceType
.
getId
())){
...
...
yifu-insurances/yifu-insurances-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/insurances/service/impl/TInsuranceTypeStandardServiceImpl.java
View file @
d4146312
...
...
@@ -8,6 +8,7 @@ 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.core.vo.YifuUser
;
import
com.yifu.cloud.plus.v1.yifu.common.security.util.SecurityUtils
;
import
com.yifu.cloud.plus.v1.yifu.insurances.constants.InsurancesConstants
;
import
com.yifu.cloud.plus.v1.yifu.insurances.entity.TInsuranceDetail
;
import
com.yifu.cloud.plus.v1.yifu.insurances.entity.TInsuranceOperate
;
import
com.yifu.cloud.plus.v1.yifu.insurances.entity.TInsuranceType
;
...
...
@@ -94,7 +95,9 @@ public class TInsuranceTypeStandardServiceImpl extends ServiceImpl<TInsuranceTyp
.
set
(
TInsuranceTypeStandard:
:
getDeleteFlag
,
CommonConstants
.
ONE_INT
)
.
set
(
TInsuranceTypeStandard
::
getUpdateBy
,
user
.
getId
())
.
set
(
TInsuranceTypeStandard
::
getUpdateTime
,
LocalDateTime
.
now
());
return
R
.
ok
(
update
(
updateWrapper
),
"删除购买标准成功"
);
update
(
updateWrapper
);
addOperate
(
byId
,
user
,
InsurancesConstants
.
DELETE_INSURANCE_TYPE_STANDARD
);
return
R
.
ok
(
"删除购买标准成功"
);
}
/**
* 新增购买标准
...
...
@@ -137,12 +140,35 @@ public class TInsuranceTypeStandardServiceImpl extends ServiceImpl<TInsuranceTyp
insuranceTypeStandard
.
setCreateBy
(
user
.
getId
());
insuranceTypeStandard
.
setCreateName
(
user
.
getNickname
());
insuranceTypeStandard
.
setCreateTime
(
LocalDateTime
.
now
());
return
R
.
ok
(
this
.
baseMapper
.
insert
(
insuranceTypeStandard
),
"新增购买标准成功"
);
save
(
insuranceTypeStandard
);
addOperate
(
insuranceTypeStandard
,
user
,
InsurancesConstants
.
NEW_INSURANCE_TYPE_STANDARD
);
return
R
.
ok
(
"新增购买标准成功"
);
}
else
{
return
R
.
failed
(
"
当前险种下的
购买标准已存在"
);
return
R
.
failed
(
"
该险种下
购买标准已存在"
);
}
}
/**
* 操作记录
*
* @author zhaji
* @param insuranceTypeStandard 购买标准信息
* @param user 登录用户
* @param operateDesc 操作描述
* @return void
*/
private
void
addOperate
(
TInsuranceTypeStandard
insuranceTypeStandard
,
YifuUser
user
,
String
operateDesc
){
try
{
TInsuranceOperate
operate
=
new
TInsuranceOperate
();
operate
.
setInsuranceDetailId
(
insuranceTypeStandard
.
getId
());
operate
.
setOperateDesc
(
operateDesc
);
operate
.
setCreateBy
(
user
.
getId
());
operate
.
setCreateName
(
user
.
getNickname
());
operate
.
setCreateTime
(
LocalDateTime
.
now
());
tInsuranceOperateService
.
save
(
operate
);
}
catch
(
Exception
e
){
e
.
getStackTrace
();
}
}
}
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