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
32926db2
Commit
32926db2
authored
Dec 08, 2022
by
李灿灿
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:保单号对应起止保时间接口完善
parent
5bc7c1e3
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
117 additions
and
10 deletions
+117
-10
TInsurancePolicyDetailVO.java
.../plus/v1/yifu/insurances/vo/TInsurancePolicyDetailVO.java
+24
-0
TInsurancePolicyController.java
...ifu/insurances/controller/TInsurancePolicyController.java
+5
-6
TInsurancePolicyService.java
...insurances/service/insurance/TInsurancePolicyService.java
+19
-0
TInsurancePolicyServiceImpl.java
...s/service/insurance/impl/TInsurancePolicyServiceImpl.java
+69
-4
No files found.
yifu-insurances/yifu-insurances-api/src/main/java/com/yifu/cloud/plus/v1/yifu/insurances/vo/TInsurancePolicyDetailVO.java
0 → 100644
View file @
32926db2
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
insurances
.
vo
;
import
com.yifu.cloud.plus.v1.yifu.insurances.entity.TBusinessOperate
;
import
com.yifu.cloud.plus.v1.yifu.insurances.entity.TInsurancePolicy
;
import
io.swagger.v3.oas.annotations.media.Schema
;
import
lombok.Data
;
import
java.util.List
;
/**
* @author licancan
* @description 保单号对应起止时间详情vo
* @date 2022-12-08 11:11:35
*/
@Data
@Schema
(
description
=
"保单号对应起止时间详情vo"
)
public
class
TInsurancePolicyDetailVO
extends
TInsurancePolicy
{
/**
* 操作记录列表
*/
@Schema
(
description
=
"操作记录列表"
)
List
<
TBusinessOperate
>
operateList
;
}
yifu-insurances/yifu-insurances-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/insurances/controller/TInsurancePolicyController.java
View file @
32926db2
...
...
@@ -3,12 +3,11 @@ package com.yifu.cloud.plus.v1.yifu.insurances.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.R
;
import
com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog
;
import
com.yifu.cloud.plus.v1.yifu.insurances.entity.TInsuranceCompany
;
import
com.yifu.cloud.plus.v1.yifu.insurances.entity.TInsurancePolicy
;
import
com.yifu.cloud.plus.v1.yifu.insurances.service.insurance.TInsurancePolicyService
;
import
com.yifu.cloud.plus.v1.yifu.insurances.vo.InsurancePolicyListEditParam
;
import
com.yifu.cloud.plus.v1.yifu.insurances.vo.InsurancePolicyListParam
;
import
com.yifu.cloud.plus.v1.yifu.insurances.vo.TInsurancePolicyDetailVO
;
import
io.swagger.v3.oas.annotations.Operation
;
import
io.swagger.v3.oas.annotations.security.SecurityRequirement
;
import
io.swagger.v3.oas.annotations.tags.Tag
;
...
...
@@ -61,16 +60,16 @@ public class TInsurancePolicyController {
}
/**
* 通过id查询详情
todo 加操作日志,先给前端后续再补
* 通过id查询详情
*
* @author licancan
* @param id
* @return {@link R<TInsurancePolicy>}
* @return {@link R<TInsurancePolicy
DetailVO
>}
*/
@GetMapping
(
"/{id}"
)
@Operation
(
summary
=
"通过id查询详情"
,
description
=
"通过id查询详情"
)
public
R
<
TInsurancePolicy
>
get
ById
(
@PathVariable
(
"id"
)
String
id
)
{
return
R
.
ok
(
tInsurancePolicyService
.
getById
(
id
)
);
public
R
<
TInsurancePolicy
DetailVO
>
getDetail
ById
(
@PathVariable
(
"id"
)
String
id
)
{
return
tInsurancePolicyService
.
getDetailById
(
id
);
}
/**
...
...
yifu-insurances/yifu-insurances-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/insurances/service/insurance/TInsurancePolicyService.java
View file @
32926db2
...
...
@@ -7,6 +7,7 @@ import com.yifu.cloud.plus.v1.yifu.insurances.entity.TInsurancePolicy;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.yifu.cloud.plus.v1.yifu.insurances.vo.InsurancePolicyListEditParam
;
import
com.yifu.cloud.plus.v1.yifu.insurances.vo.InsurancePolicyListParam
;
import
com.yifu.cloud.plus.v1.yifu.insurances.vo.TInsurancePolicyDetailVO
;
import
java.util.List
;
...
...
@@ -36,6 +37,24 @@ public interface TInsurancePolicyService extends IService<TInsurancePolicy> {
*/
List
<
TInsurancePolicy
>
getInsurancePolicyList
(
InsurancePolicyListParam
param
);
/**
* 通过id查询详情
*
* @author licancan
* @param id
* @return {@link R<TInsurancePolicyDetailVO>}
*/
R
<
TInsurancePolicyDetailVO
>
getDetailById
(
String
id
);
/**
* 新增
*
* @author licancan
* @param policy
* @return {@link R}
*/
R
saveTInsurancePolicy
(
TInsurancePolicy
policy
);
/**
* 修改保单号对应起止保时间
*
...
...
yifu-insurances/yifu-insurances-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/insurances/service/insurance/impl/TInsurancePolicyServiceImpl.java
View file @
32926db2
...
...
@@ -2,22 +2,29 @@ package com.yifu.cloud.plus.v1.yifu.insurances.service.insurance.impl;
import
com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
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.R
;
import
com.yifu.cloud.plus.v1.yifu.insurances.entity.TBusinessOperate
;
import
com.yifu.cloud.plus.v1.yifu.insurances.entity.TInsuranceDetail
;
import
com.yifu.cloud.plus.v1.yifu.insurances.entity.TInsurancePolicy
;
import
com.yifu.cloud.plus.v1.yifu.insurances.entity.TInsuranceTypeRate
;
import
com.yifu.cloud.plus.v1.yifu.insurances.mapper.insurances.TInsurancePolicyMapper
;
import
com.yifu.cloud.plus.v1.yifu.insurances.service.insurance.TBusinessOperateService
;
import
com.yifu.cloud.plus.v1.yifu.insurances.service.insurance.TInsuranceDetailService
;
import
com.yifu.cloud.plus.v1.yifu.insurances.service.insurance.TInsurancePolicyService
;
import
com.yifu.cloud.plus.v1.yifu.insurances.util.BeanCopyUtils
;
import
com.yifu.cloud.plus.v1.yifu.insurances.vo.InsurancePolicyListEditParam
;
import
com.yifu.cloud.plus.v1.yifu.insurances.vo.InsurancePolicyListParam
;
import
com.yifu.cloud.plus.v1.yifu.insurances.vo.TInsurancePolicyDetailVO
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
java
.time.LocalDateTim
e
;
import
java
x.annotation.Resourc
e
;
import
java.util.List
;
import
java.util.Optional
;
...
...
@@ -29,6 +36,10 @@ import java.util.Optional;
*/
@Service
public
class
TInsurancePolicyServiceImpl
extends
ServiceImpl
<
TInsurancePolicyMapper
,
TInsurancePolicy
>
implements
TInsurancePolicyService
{
@Resource
private
TBusinessOperateService
tBusinessOperateService
;
@Resource
private
TInsuranceDetailService
tInsuranceDetailService
;
/**
* 保单号对应起止保时间分页查询
...
...
@@ -57,6 +68,52 @@ public class TInsurancePolicyServiceImpl extends ServiceImpl<TInsurancePolicyMap
return
list
;
}
/**
* 通过id查询详情
*
* @param id
* @return {@link R<TInsurancePolicyDetailVO>}
* @author licancan
*/
@Override
public
R
<
TInsurancePolicyDetailVO
>
getDetailById
(
String
id
)
{
if
(
Common
.
isEmpty
(
id
)){
return
R
.
failed
(
"id不能为空"
);
}
TInsurancePolicy
byId
=
getById
(
id
);
if
(!
Optional
.
ofNullable
(
byId
).
isPresent
()){
return
R
.
failed
(
"数据不存在"
);
}
TInsurancePolicyDetailVO
vo
=
new
TInsurancePolicyDetailVO
();
BeanCopyUtils
.
copyProperties
(
byId
,
vo
);
List
<
TBusinessOperate
>
list
=
tBusinessOperateService
.
getOperateListByBusinessId
(
id
);
if
(
CollectionUtils
.
isNotEmpty
(
list
)){
vo
.
setOperateList
(
list
);
}
return
R
.
ok
(
vo
);
}
/**
* 新增,内部调用的,保证调用方把该传的字段都传了(保单号、起止保时间、保险公司、险种)
*
* @param policy
* @return {@link R}
* @author licancan
*/
@Override
public
R
saveTInsurancePolicy
(
TInsurancePolicy
policy
)
{
if
(
StringUtils
.
isNotEmpty
(
policy
.
getPolicyNo
())){
TInsurancePolicy
one
=
this
.
getOne
(
Wrappers
.<
TInsurancePolicy
>
query
().
lambda
()
.
eq
(
TInsurancePolicy:
:
getPolicyNo
,
policy
.
getPolicyNo
())
.
eq
(
TInsurancePolicy:
:
getDeleteFlag
,
CommonConstants
.
ZERO_INT
)
.
last
(
CommonConstants
.
LAST_ONE_SQL
));
if
(!
Optional
.
ofNullable
(
one
).
isPresent
()){
this
.
save
(
policy
);
}
}
return
R
.
ok
();
}
/**
* 修改保单号对应起止保时间
*
...
...
@@ -73,7 +130,8 @@ public class TInsurancePolicyServiceImpl extends ServiceImpl<TInsurancePolicyMap
}
BeanCopyUtils
.
copyProperties
(
param
,
tInsurancePolicy
);
updateById
(
tInsurancePolicy
);
//todo 操作日志
//操作日志
tBusinessOperateService
.
saveModificationRecord
(
param
.
getId
(),
tInsurancePolicy
,
param
,
null
);
return
R
.
ok
();
}
...
...
@@ -93,7 +151,14 @@ public class TInsurancePolicyServiceImpl extends ServiceImpl<TInsurancePolicyMap
if
(!
Optional
.
ofNullable
(
byId
).
isPresent
()){
return
R
.
failed
(
"数据不存在"
);
}
//todo 检验保单号是否被使用,被使用不能删除
//检验保单号是否被使用,被使用不能删除
TInsuranceDetail
one
=
tInsuranceDetailService
.
getOne
(
Wrappers
.<
TInsuranceDetail
>
query
().
lambda
()
.
eq
(
TInsuranceDetail:
:
getPolicyNo
,
byId
.
getPolicyNo
())
.
eq
(
TInsuranceDetail:
:
getDeleteFlag
,
CommonConstants
.
ZERO_INT
)
.
last
(
CommonConstants
.
LAST_ONE_SQL
));
if
(
Optional
.
ofNullable
(
one
).
isPresent
()){
return
R
.
failed
(
"存在正常关联的承保信息,禁止删除!"
);
}
LambdaUpdateWrapper
<
TInsurancePolicy
>
updateWrapper
=
new
LambdaUpdateWrapper
<>();
updateWrapper
.
eq
(
TInsurancePolicy:
:
getId
,
id
)
.
set
(
TInsurancePolicy:
:
getDeleteFlag
,
CommonConstants
.
ONE_INT
);
...
...
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