Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
8
8timerapiv200
Overview
Overview
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
8timerv2
8timerapiv200
Commits
142a1283
Commit
142a1283
authored
2 years ago
by
翁国栋
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
更新保险方案为
parent
4ec7235a
Show whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
524 additions
and
105 deletions
+524
-105
src/main/java/cn/timer/api/bean/insure/InsurePlan.java
+72
-0
src/main/java/cn/timer/api/bean/insure/InsureProductPlan.java
+73
-0
src/main/java/cn/timer/api/bean/insure/InsureUser.java
+15
-2
src/main/java/cn/timer/api/controller/insure/InsureContorll.java
+119
-85
src/main/java/cn/timer/api/controller/insure/InsurePlanController.java
+70
-0
src/main/java/cn/timer/api/controller/insure/InsureProductController.java
+15
-4
src/main/java/cn/timer/api/controller/insure/InsureUserController.java
+4
-0
src/main/java/cn/timer/api/controller/insure/enums/PlanEnum.java
+2
-1
src/main/java/cn/timer/api/dao/insure/InsurePlanMapper.java
+22
-0
src/main/java/cn/timer/api/dao/insure/InsureProductPlanMapper.java
+24
-0
src/main/java/cn/timer/api/dto/insure/InsureDto.java
+3
-1
src/main/java/cn/timer/api/dto/insure/PlansDto.java
+5
-2
src/main/java/cn/timer/api/dto/insure/PolicyDto.java
+1
-0
src/main/java/cn/timer/api/dto/insure/ProductDto.java
+25
-0
src/main/resources/mapping/insure/InsurePlanMapper.xml
+26
-0
src/main/resources/mapping/insure/InsurePolicyMapper.xml
+8
-3
src/main/resources/mapping/insure/InsureProductPlanMapper.xml
+28
-0
src/main/resources/mapping/insure/InsureUserMapper.xml
+12
-7
No files found.
src/main/java/cn/timer/api/bean/insure/InsurePlan.java
0 → 100644
View file @
142a1283
package
cn
.
timer
.
api
.
bean
.
insure
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.extension.activerecord.Model
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.AllArgsConstructor
;
import
lombok.Builder
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
javax.persistence.Entity
;
import
javax.persistence.GeneratedValue
;
import
javax.persistence.Id
;
import
javax.persistence.Table
;
import
java.io.Serializable
;
import
java.util.Date
;
/**
* 投保方案
*
* @author wgd
* @email 862422848@qq.com
* @date 2022-09-23 11:53:23
*/
@Entity
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
@Table
(
name
=
"insure_plan"
)
@ApiModel
(
"投保方案"
)
public
class
InsurePlan
extends
Model
<
InsurePlan
>
{
private
static
final
long
serialVersionUID
=
1L
;
/**
* id
*/
@Id
@GeneratedValue
@TableId
(
type
=
IdType
.
AUTO
)
@ApiModelProperty
(
value
=
"编号"
)
private
Integer
id
;
/**
* 名称
*/
private
String
name
;
/**
* id,由保司提供
*/
private
String
planId
;
/**
* 类型
*/
private
String
type
;
/**
* 创建时间
*/
private
Date
createTime
;
/**
* 逻辑删除标记0.未删除 1.删除
*/
private
Integer
deleteFlag
;
/**
* 类型名称
*/
private
String
typeName
;
}
This diff is collapsed.
Click to expand it.
src/main/java/cn/timer/api/bean/insure/InsureProductPlan.java
0 → 100644
View file @
142a1283
package
cn
.
timer
.
api
.
bean
.
insure
;
import
cn.timer.api.bean.insure.InsureProduct
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.extension.activerecord.Model
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.AllArgsConstructor
;
import
lombok.Builder
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
javax.persistence.Entity
;
import
javax.persistence.GeneratedValue
;
import
javax.persistence.Id
;
import
javax.persistence.Table
;
import
java.io.Serializable
;
import
java.util.Date
;
/**
* 投保方案中间表
*
* @author wgd
* @email 862422848@qq.com
* @date 2022-09-26 10:06:39
*/
@Entity
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
@Table
(
name
=
"insure_product_plan"
)
@ApiModel
(
"保险方案"
)
public
class
InsureProductPlan
extends
Model
<
InsureProductPlan
>
{
private
static
final
long
serialVersionUID
=
1L
;
/**
* id
*/
@Id
@GeneratedValue
@TableId
(
type
=
IdType
.
AUTO
)
@ApiModelProperty
(
value
=
"编号"
)
private
Integer
id
;
/**
* 方案json
*/
private
String
planJson
;
/**
* 单价
*/
private
Double
price
;
/**
* insure_product的id
*/
private
Integer
productId
;
/**
* 创建时间
*/
private
Date
createTime
;
/**
* 是否删除 1已删除 0未删除
*/
private
Integer
deleteFlag
;
/**
* 方案组合后的名字
*/
private
String
name
;
}
This diff is collapsed.
Click to expand it.
src/main/java/cn/timer/api/bean/insure/InsureUser.java
View file @
142a1283
...
@@ -56,7 +56,7 @@ public class InsureUser extends Model<InsureUser> {
...
@@ -56,7 +56,7 @@ public class InsureUser extends Model<InsureUser> {
* 批次核算保费
* 批次核算保费
*/
*/
@ApiModelProperty
(
value
=
"批次核算保费"
)
@ApiModelProperty
(
value
=
"批次核算保费"
)
private
String
price
;
private
Double
price
;
/**
/**
* 姓名
* 姓名
*/
*/
...
@@ -71,7 +71,7 @@ public class InsureUser extends Model<InsureUser> {
...
@@ -71,7 +71,7 @@ public class InsureUser extends Model<InsureUser> {
* 保单批次保费
* 保单批次保费
*/
*/
@ApiModelProperty
(
value
=
"保单批次保费"
)
@ApiModelProperty
(
value
=
"保单批次保费"
)
private
String
premium
;
private
Double
premium
;
/**
/**
* 被保险人联系电话
* 被保险人联系电话
*/
*/
...
@@ -172,4 +172,17 @@ public class InsureUser extends Model<InsureUser> {
...
@@ -172,4 +172,17 @@ public class InsureUser extends Model<InsureUser> {
@TableField
(
exist
=
false
)
@TableField
(
exist
=
false
)
@ApiModelProperty
(
value
=
"原被保人"
,
example
=
"原被保人"
)
@ApiModelProperty
(
value
=
"原被保人"
,
example
=
"原被保人"
)
private
InsureUser
originaUser
;
private
InsureUser
originaUser
;
@ApiModelProperty
(
value
=
"insure_product_plan表的Id"
)
private
Integer
productPlanId
;
@Transient
@TableField
(
exist
=
false
)
@ApiModelProperty
(
value
=
"方案集合"
,
example
=
"方案集合"
)
private
List
planIds
;
@Transient
@TableField
(
exist
=
false
)
@ApiModelProperty
(
value
=
"产品名称"
,
example
=
"产品名称"
)
private
String
productName
;
}
}
This diff is collapsed.
Click to expand it.
src/main/java/cn/timer/api/controller/insure/InsureContorll.java
View file @
142a1283
...
@@ -11,9 +11,7 @@ import cn.timer.api.config.enums.CommonEnum;
...
@@ -11,9 +11,7 @@ import cn.timer.api.config.enums.CommonEnum;
import
cn.timer.api.config.enums.Regular
;
import
cn.timer.api.config.enums.Regular
;
import
cn.timer.api.config.exception.CustomException
;
import
cn.timer.api.config.exception.CustomException
;
import
cn.timer.api.controller.insure.enums.PlanEnum
;
import
cn.timer.api.controller.insure.enums.PlanEnum
;
import
cn.timer.api.dao.insure.InsureLogMapper
;
import
cn.timer.api.dao.insure.*
;
import
cn.timer.api.dao.insure.InsurePolicyMapper
;
import
cn.timer.api.dao.insure.InsureUserMapper
;
import
cn.timer.api.dao.yggl.YgglMainEmpMapper
;
import
cn.timer.api.dao.yggl.YgglMainEmpMapper
;
import
cn.timer.api.dto.insure.InsureDto
;
import
cn.timer.api.dto.insure.InsureDto
;
import
cn.timer.api.dto.insure.InsureUserDto
;
import
cn.timer.api.dto.insure.InsureUserDto
;
...
@@ -23,6 +21,7 @@ import cn.timer.api.dto.spmk.User;
...
@@ -23,6 +21,7 @@ import cn.timer.api.dto.spmk.User;
import
cn.timer.api.service.OSSService
;
import
cn.timer.api.service.OSSService
;
import
cn.timer.api.utils.*
;
import
cn.timer.api.utils.*
;
import
com.alibaba.druid.util.Base64
;
import
com.alibaba.druid.util.Base64
;
import
com.alibaba.fastjson.JSON
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.beust.jcommander.internal.Lists
;
import
com.beust.jcommander.internal.Lists
;
import
com.github.xiaoymin.knife4j.annotations.ApiOperationSupport
;
import
com.github.xiaoymin.knife4j.annotations.ApiOperationSupport
;
...
@@ -137,6 +136,9 @@ public class InsureContorll {
...
@@ -137,6 +136,9 @@ public class InsureContorll {
@Autowired
@Autowired
private
InsurePolicyMapper
insurePolicyMapper
;
private
InsurePolicyMapper
insurePolicyMapper
;
@Autowired
private
InsurePlanMapper
insurePlanMapper
;
/**
/**
* 设置请求参数
* 设置请求参数
...
@@ -165,11 +167,25 @@ public class InsureContorll {
...
@@ -165,11 +167,25 @@ public class InsureContorll {
return
paramsMap
;
return
paramsMap
;
}
}
private
static
String
getPlanType
(
String
category
){
switch
(
category
){
case
"63119"
:
return
"A类"
;
case
"63120"
:
return
"B类"
;
case
"63121"
:
return
"C类"
;
}
return
null
;
}
@PostMapping
(
value
=
"/insured_add"
)
@PostMapping
(
value
=
"/insured_add"
)
@ApiOperation
(
value
=
"1.投保申请"
,
httpMethod
=
"POST"
,
notes
=
"投保申请"
)
@ApiOperation
(
value
=
"1.投保申请"
,
httpMethod
=
"POST"
,
notes
=
"投保申请"
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
Result
<
Object
>
insured_add
(
@RequestBody
InsureDto
insureDto
)
{
public
Result
<
Object
>
insured_add
(
@RequestBody
InsureDto
insureDto
)
{
InsureProduct
insureProduct
=
InsureProduct
.
builder
().
id
(
Integer
.
parseInt
(
insureDto
.
getProductId
())).
build
().
selectById
();
InsureProduct
insureProduct
=
InsureProduct
.
builder
().
id
(
Integer
.
parseInt
(
insureDto
.
getProductId
())).
build
().
selectById
();
List
<
InsureProductPlan
>
priceList
=
InsureProductPlan
.
builder
().
build
().
selectList
(
new
QueryWrapper
<
InsureProductPlan
>().
lambda
()
.
eq
(
InsureProductPlan:
:
getProductId
,
insureProduct
.
getId
()).
eq
(
InsureProductPlan:
:
getDeleteFlag
,
0
));
if
(
insureProduct
==
null
)
{
if
(
insureProduct
==
null
)
{
return
ResultUtil
.
error
(
"产品不存在"
);
return
ResultUtil
.
error
(
"产品不存在"
);
}
}
...
@@ -203,7 +219,7 @@ public class InsureContorll {
...
@@ -203,7 +219,7 @@ public class InsureContorll {
return
ResultUtil
.
error
(
"请选择计划和职业类别"
);
return
ResultUtil
.
error
(
"请选择计划和职业类别"
);
}
}
insureDto
.
getPlans
().
forEach
(
i
->
{
insureDto
.
getPlans
().
forEach
(
i
->
{
i
.
setPrice
(
getPrice
(
i
.
getBenefitBasicPlan
(),
i
.
getBenefitOccupationCategory
()
));
i
.
setPrice
(
priceList
.
stream
().
filter
(
v
->
v
.
getId
()==
i
.
getBenefitBasicPlan
()).
collect
(
Collectors
.
toList
()).
get
(
0
).
getPrice
(
));
insureDto
.
setTotalPrice
(
i
.
getPrice
()
*
i
.
getUserIds
().
length
+
(
insureDto
.
getTotalPrice
()
==
null
?
0
:
insureDto
.
getTotalPrice
()));
insureDto
.
setTotalPrice
(
i
.
getPrice
()
*
i
.
getUserIds
().
length
+
(
insureDto
.
getTotalPrice
()
==
null
?
0
:
insureDto
.
getTotalPrice
()));
});
});
quotations
.
put
(
"trans_id"
,
"MB_"
+
dtf2
.
format
(
now
));
/*报价请求流水号*/
quotations
.
put
(
"trans_id"
,
"MB_"
+
dtf2
.
format
(
now
));
/*报价请求流水号*/
...
@@ -217,6 +233,7 @@ public class InsureContorll {
...
@@ -217,6 +233,7 @@ public class InsureContorll {
quotations
.
put
(
"last_serial_number"
,
""
);
//*币种:5人民币*//*
quotations
.
put
(
"last_serial_number"
,
""
);
//*币种:5人民币*//*
quotations
.
put
(
"from_source"
,
""
);
//*币种:5人民币*//*
quotations
.
put
(
"from_source"
,
""
);
//*币种:5人民币*//*
quotations
.
put
(
"operator_name"
,
""
);
//*币种:5人民币
quotations
.
put
(
"operator_name"
,
""
);
//*币种:5人民币
if
(
insureProduct
.
getPayType
()
==
1
)
{
if
(
insureProduct
.
getPayType
()
==
1
)
{
quotations
.
put
(
"required_pay"
,
1
);
quotations
.
put
(
"required_pay"
,
1
);
quotations
.
put
(
"callback_policy"
,
base_api_url
+
"/callBack/policy/issueCallback"
);
quotations
.
put
(
"callback_policy"
,
base_api_url
+
"/callBack/policy/issueCallback"
);
...
@@ -251,7 +268,7 @@ public class InsureContorll {
...
@@ -251,7 +268,7 @@ public class InsureContorll {
/*人员清单填被保人员*/
/*人员清单填被保人员*/
String
url
=
creaXSSFWorkbook
(
insureDto
.
getPlans
(),
insureDto
.
getPolicyDateStart
());
String
url
=
creaXSSFWorkbook
(
insureDto
.
getPlans
(),
insureDto
.
getPolicyDateStart
()
,
priceList
);
if
(!
StringUtil
.
isNotBlank
(
url
))
{
if
(!
StringUtil
.
isNotBlank
(
url
))
{
return
ResultUtil
.
error
(
"文件错误"
);
return
ResultUtil
.
error
(
"文件错误"
);
}
}
...
@@ -282,6 +299,8 @@ public class InsureContorll {
...
@@ -282,6 +299,8 @@ public class InsureContorll {
/*被保人员 填被保企业信息*/
/*被保人员 填被保企业信息*/
ArrayList
<
Map
>
insuredArray
=
new
ArrayList
<>();
ArrayList
<
Map
>
insuredArray
=
new
ArrayList
<>();
insureDto
.
getPlans
().
forEach
(
p
->
{
insureDto
.
getPlans
().
forEach
(
p
->
{
InsureProductPlan
plan
=
priceList
.
stream
().
filter
(
v
->
v
.
getId
()==
p
.
getBenefitBasicPlan
()).
collect
(
Collectors
.
toList
()).
get
(
0
);
List
<
InsurePlan
>
insurePlansList
=
insurePlanMapper
.
findPlanByIds
(
JSON
.
parseArray
(
plan
.
getPlanJson
(),
String
.
class
));
Map
insured
=
Maps
.
newHashMap
();
Map
insured
=
Maps
.
newHashMap
();
insured
.
put
(
"trans_id"
,
"PI_"
+
qyzxEntInfoM
.
getId
()
+
"_"
+
dtf2
.
format
(
now
)
+
"_"
+
UUID
.
randomUUID
().
toString
().
replace
(
"-"
,
""
));
insured
.
put
(
"trans_id"
,
"PI_"
+
qyzxEntInfoM
.
getId
()
+
"_"
+
dtf2
.
format
(
now
)
+
"_"
+
UUID
.
randomUUID
().
toString
().
replace
(
"-"
,
""
));
insured
.
put
(
"price"
,
p
.
getUserIds
().
length
*
p
.
getPrice
());
/*根据基础计划生成*/
insured
.
put
(
"price"
,
p
.
getUserIds
().
length
*
p
.
getPrice
());
/*根据基础计划生成*/
...
@@ -292,16 +311,22 @@ public class InsureContorll {
...
@@ -292,16 +311,22 @@ public class InsureContorll {
insured
.
put
(
"insured_no_type"
,
"3306"
);
insured
.
put
(
"insured_no_type"
,
"3306"
);
insured
.
put
(
"insured_no"
,
StringUtils
.
isNullOrEmpty
(
qyzxEntInfoM
.
getCreditCode
())
?
insureApplicant
.
getApplicantENo
()
:
qyzxEntInfoM
.
getCreditCode
());
insured
.
put
(
"insured_no"
,
StringUtils
.
isNullOrEmpty
(
qyzxEntInfoM
.
getCreditCode
())
?
insureApplicant
.
getApplicantENo
()
:
qyzxEntInfoM
.
getCreditCode
());
insured
.
put
(
"insured_zm_openid"
,
""
);
insured
.
put
(
"insured_zm_openid"
,
""
);
insured
.
put
(
"benefit_basic_plan"
,
p
.
getBenefitBasicPlan
());
insured
.
put
(
"benefit_occupation_category"
,
p
.
getBenefitOccupationCategory
());
insured
.
put
(
"benefit_EL_employee_number_t"
,
p
.
getUserIds
().
length
);
insured
.
put
(
"benefit_EL_employee_number_t"
,
p
.
getUserIds
().
length
);
insured
.
put
(
"insured_province_city_thr"
,
insureApplicant
.
getApplicantProvinceCity
());
/*省市区*/
insured
.
put
(
"insured_province_city_thr"
,
insureApplicant
.
getApplicantProvinceCity
());
/*省市区*/
/*新增项目*/
insured
.
put
(
"benefit_basic_plan"
,
insurePlansList
.
stream
().
filter
(
v
->
v
.
getType
().
equals
(
"BENEFIT_BASIC_PLAN"
)).
collect
(
Collectors
.
toList
()).
get
(
0
).
getPlanId
());
insured
.
put
(
"benefit_occupation_category"
,
p
.
getBenefitOccupationCategory
());
insured
.
put
(
"benefit_3rd_party_lib"
,
insurePlansList
.
stream
().
filter
(
v
->
v
.
getType
().
equals
(
"BENEFIT_3RD_PARTY_LIB"
)).
collect
(
Collectors
.
toList
()).
get
(
0
).
getPlanId
());
insured
.
put
(
"benefit_24hours"
,
insurePlansList
.
stream
().
filter
(
v
->
v
.
getType
().
equals
(
"BENEFIT_24HOURS"
)).
collect
(
Collectors
.
toList
()).
get
(
0
).
getPlanId
());
insuredArray
.
add
(
insured
);
insuredArray
.
add
(
insured
);
});
});
quotations
.
put
(
"insured"
,
insuredArray
);
quotations
.
put
(
"insured"
,
insuredArray
);
quotations
.
put
(
"file"
,
Lists
.
newArrayList
());
quotations
.
put
(
"file"
,
Lists
.
newArrayList
());
quotations
.
put
(
"specifically_agreed_file"
,
Lists
.
newArrayList
());
quotations
.
put
(
"specifically_agreed_file"
,
Lists
.
newArrayList
());
quotations
.
put
(
"policy_no"
,
""
);
// quotations.put("policy_no", "");
quotationsArry
.
add
(
quotations
);
quotationsArry
.
add
(
quotations
);
bodyMap
.
put
(
"quotations"
,
quotationsArry
);
bodyMap
.
put
(
"quotations"
,
quotationsArry
);
log
.
info
(
JSONObject
.
toJSONString
(
bodyMap
));
log
.
info
(
JSONObject
.
toJSONString
(
bodyMap
));
...
@@ -350,9 +375,9 @@ public class InsureContorll {
...
@@ -350,9 +375,9 @@ public class InsureContorll {
insureUser
=
InsureUser
.
builder
().
build
();
insureUser
=
InsureUser
.
builder
().
build
();
insureUser
.
setUserId
(
y
.
getId
());
insureUser
.
setUserId
(
y
.
getId
());
insureUser
.
setInsuredName
(
qyzxEntInfoM
.
getName
());
insureUser
.
setInsuredName
(
qyzxEntInfoM
.
getName
());
insureUser
.
setPrice
(
String
.
valueOf
(
p
.
getPrice
()
));
/*前端获取的保费*/
insureUser
.
setPrice
(
p
.
getPrice
(
));
/*前端获取的保费*/
insureUser
.
setTransId
(
"P_"
+
qyzxEntInfoM
.
getId
()
+
"_"
+
dtf2
.
format
(
now
));
insureUser
.
setTransId
(
"P_"
+
qyzxEntInfoM
.
getId
()
+
"_"
+
dtf2
.
format
(
now
));
insureUser
.
setPremium
(
String
.
valueOf
(
insureDto
.
getTotalPrice
()
));
insureUser
.
setPremium
(
insureDto
.
getTotalPrice
(
));
if
(
dataMap
.
get
(
"errcode"
).
toString
().
equals
(
"suc"
))
{
if
(
dataMap
.
get
(
"errcode"
).
toString
().
equals
(
"suc"
))
{
if
(
insureProduct
.
getPayType
()
!=
1
)
{
if
(
insureProduct
.
getPayType
()
!=
1
)
{
insureUser
.
setBatchNo
(
batchMap
.
get
(
0
).
get
(
"batch_no"
).
toString
());
insureUser
.
setBatchNo
(
batchMap
.
get
(
0
).
get
(
"batch_no"
).
toString
());
...
@@ -367,7 +392,8 @@ public class InsureContorll {
...
@@ -367,7 +392,8 @@ public class InsureContorll {
insureUser
.
setInsureStatus
(
3
);
insureUser
.
setInsureStatus
(
3
);
insureUser
.
setStatus
(
"2"
);
insureUser
.
setStatus
(
"2"
);
}
}
insureUser
.
setBenefitBasicPlan
(
p
.
getBenefitBasicPlan
());
// insureUser.setBenefitBasicPlan(p.getBenefitBasicPlan());
insureUser
.
setProductPlanId
(
p
.
getBenefitBasicPlan
());
insureUser
.
setUserId
(
y
.
getId
());
insureUser
.
setUserId
(
y
.
getId
());
insureUser
.
setOrgCode
(
y
.
getOrgCode
());
insureUser
.
setOrgCode
(
y
.
getOrgCode
());
insureUser
.
setBenefitOccupationCategory
(
p
.
getBenefitOccupationCategory
());
insureUser
.
setBenefitOccupationCategory
(
p
.
getBenefitOccupationCategory
());
...
@@ -433,15 +459,16 @@ public class InsureContorll {
...
@@ -433,15 +459,16 @@ public class InsureContorll {
@ApiOperation
(
value
=
"2.增员"
,
httpMethod
=
"POST"
,
notes
=
"增员"
)
@ApiOperation
(
value
=
"2.增员"
,
httpMethod
=
"POST"
,
notes
=
"增员"
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
Result
<
Object
>
joinUser
(
@RequestBody
InsureDto
insureDto
)
{
public
Result
<
Object
>
joinUser
(
@RequestBody
InsureDto
insureDto
)
{
InsurePolicy
insurePolicy
=
InsurePolicy
.
builder
().
id
(
Integer
.
parseInt
(
insureDto
.
getId
())).
build
().
selectById
();
InsurePolicy
insurePolicy
=
InsurePolicy
.
builder
().
id
(
Integer
.
parseInt
(
insureDto
.
getId
())).
build
().
selectById
();
InsureProduct
insureProduct
=
InsureProduct
.
builder
().
id
(
insurePolicy
.
getProductId
()).
build
().
selectById
();
InsureProduct
insureProduct
=
InsureProduct
.
builder
().
id
(
insurePolicy
.
getProductId
()).
build
().
selectById
();
List
<
InsureProductPlan
>
priceList
=
InsureProductPlan
.
builder
().
build
().
selectList
(
new
QueryWrapper
<
InsureProductPlan
>().
lambda
()
.
eq
(
InsureProductPlan:
:
getProductId
,
insureProduct
.
getId
()).
eq
(
InsureProductPlan:
:
getDeleteFlag
,
0
));
if
(
insurePolicy
==
null
)
{
if
(
insurePolicy
==
null
)
{
return
ResultUtil
.
error
(
"保单不存在"
);
return
ResultUtil
.
error
(
"保单不存在"
);
}
}
try
{
try
{
LocalDateTime
now
=
LocalDateTime
.
now
();
LocalDateTime
now
=
LocalDateTime
.
now
();
String
url
=
creaXSSFWorkbook1
(
insureDto
);
String
url
=
creaXSSFWorkbook1
(
insureDto
,
priceList
);
log
.
info
(
"保全增员文件地址"
,
url
);
log
.
info
(
"保全增员文件地址"
,
url
);
DateTimeFormatter
dtf2
=
DateTimeFormatter
.
ofPattern
(
"yyyyMMddHHmmss"
);
DateTimeFormatter
dtf2
=
DateTimeFormatter
.
ofPattern
(
"yyyyMMddHHmmss"
);
Map
bodyMap
=
Maps
.
newHashMap
();
Map
bodyMap
=
Maps
.
newHashMap
();
...
@@ -463,10 +490,11 @@ public class InsureContorll {
...
@@ -463,10 +490,11 @@ public class InsureContorll {
InsureUser
.
builder
()
InsureUser
.
builder
()
.
transId
(
bodyMap
.
get
(
"third_uuid"
).
toString
())
.
transId
(
bodyMap
.
get
(
"third_uuid"
).
toString
())
.
insuredName
(
qyzxEntInfoM
.
getName
())
.
insuredName
(
qyzxEntInfoM
.
getName
())
.
price
(
String
.
valueOf
(
PlanEnum
.
getEnum
(
insureDto
.
getBenefitBasicPlan
(),
insureDto
.
getBenefitOccupationCategory
()).
getPrice
()
))
/*前端获取的保费*/
.
price
(
priceList
.
stream
().
filter
(
v
->
v
.
getId
()==
insureDto
.
getBenefitBasicPlan
()).
collect
(
Collectors
.
toList
()).
get
(
0
).
getPrice
(
))
/*前端获取的保费*/
.
premium
(
String
.
valueOf
(
PlanEnum
.
getEnum
(
insureDto
.
getBenefitBasicPlan
(),
insureDto
.
getBenefitOccupationCategory
()).
getPrice
()
*
insureDto
.
getUserIds
().
length
)
)
.
premium
(
priceList
.
stream
().
filter
(
v
->
v
.
getId
()==
insureDto
.
getBenefitBasicPlan
()).
collect
(
Collectors
.
toList
()).
get
(
0
).
getPrice
()
*
insureDto
.
getUserIds
().
length
)
// .batchNo(data.get("import_uuid").toString())
// .batchNo(data.get("import_uuid").toString())
.
benefitBasicPlan
(
insureDto
.
getBenefitBasicPlan
())
// .benefitBasicPlan(insureDto.getBenefitBasicPlan())
.
productPlanId
(
insureDto
.
getBenefitBasicPlan
())
.
policyNo
(
insurePolicy
.
getPolicyNo
())
.
policyNo
(
insurePolicy
.
getPolicyNo
())
.
userId
(
y
.
getId
())
.
userId
(
y
.
getId
())
.
orgCode
(
y
.
getOrgCode
())
.
orgCode
(
y
.
getOrgCode
())
...
@@ -563,6 +591,7 @@ public class InsureContorll {
...
@@ -563,6 +591,7 @@ public class InsureContorll {
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
Result
<
Object
>
replaceUser
(
@RequestBody
InsureDto
insureDto
)
{
public
Result
<
Object
>
replaceUser
(
@RequestBody
InsureDto
insureDto
)
{
InsurePolicy
insurePolicy
=
InsurePolicy
.
builder
().
id
(
Integer
.
parseInt
(
insureDto
.
getId
())).
build
().
selectById
();
InsurePolicy
insurePolicy
=
InsurePolicy
.
builder
().
id
(
Integer
.
parseInt
(
insureDto
.
getId
())).
build
().
selectById
();
InsureProductPlan
insureProductPlan
=
InsureProductPlan
.
builder
().
id
(
insureDto
.
getBenefitBasicPlan
()).
build
().
selectById
();
if
(
insurePolicy
==
null
)
{
if
(
insurePolicy
==
null
)
{
return
ResultUtil
.
error
(
"保单不存在"
);
return
ResultUtil
.
error
(
"保单不存在"
);
}
}
...
@@ -591,7 +620,7 @@ public class InsureContorll {
...
@@ -591,7 +620,7 @@ public class InsureContorll {
for
(
int
i
=
0
;
i
<
oldInsureUserList
.
size
();
i
++)
{
for
(
int
i
=
0
;
i
<
oldInsureUserList
.
size
();
i
++)
{
oldUser
[
i
]
=
oldInsureUserList
.
get
(
i
).
getUserId
().
toString
();
oldUser
[
i
]
=
oldInsureUserList
.
get
(
i
).
getUserId
().
toString
();
}
}
Integer
price
=
getPrice
(
insureDto
.
getBenefitBasicPlan
(),
insureDto
.
getBenefitOccupationCategory
()
);
Double
price
=
insureProductPlan
.
getPrice
(
);
LocalDateTime
now
=
LocalDateTime
.
now
();
LocalDateTime
now
=
LocalDateTime
.
now
();
String
url
=
creaXSSFWorkbook2
(
insureDto
.
getUserIds
(),
insureDto
.
getPolicyDateStart
(),
oldUser
,
insureDto
.
getBenefitOccupationCategory
(),
insureDto
.
getTricycleFrameNumber
());
String
url
=
creaXSSFWorkbook2
(
insureDto
.
getUserIds
(),
insureDto
.
getPolicyDateStart
(),
oldUser
,
insureDto
.
getBenefitOccupationCategory
(),
insureDto
.
getTricycleFrameNumber
());
log
.
info
(
"保全替换文件地址"
,
url
);
log
.
info
(
"保全替换文件地址"
,
url
);
...
@@ -628,10 +657,11 @@ public class InsureContorll {
...
@@ -628,10 +657,11 @@ public class InsureContorll {
InsureUser
.
builder
()
InsureUser
.
builder
()
.
transId
(
"RP_"
+
insurePolicy
.
getOrgCode
()
+
"_"
+
dtf2
.
format
(
now
))
.
transId
(
"RP_"
+
insurePolicy
.
getOrgCode
()
+
"_"
+
dtf2
.
format
(
now
))
.
insuredName
(
qyzxEntInfoM
.
getName
())
.
insuredName
(
qyzxEntInfoM
.
getName
())
.
price
(
price
.
toString
()
)
/*前端获取的保费*/
.
price
(
price
)
/*前端获取的保费*/
.
premium
(
String
.
valueOf
(
price
*
ygglMainEmpList
.
size
()
))
.
premium
(
price
*
ygglMainEmpList
.
size
(
))
.
batchNo
(
data
.
get
(
"import_uuid"
).
toString
())
.
batchNo
(
data
.
get
(
"import_uuid"
).
toString
())
.
benefitBasicPlan
(
insureDto
.
getBenefitBasicPlan
())
// .benefitBasicPlan(insureDto.getBenefitBasicPlan())
.
productPlanId
(
insureDto
.
getBenefitBasicPlan
())
.
policyNo
(
orderImportInfo
.
get
(
"contract_no"
).
toString
())
.
policyNo
(
orderImportInfo
.
get
(
"contract_no"
).
toString
())
.
userId
(
y
.
getId
())
.
userId
(
y
.
getId
())
.
orgCode
(
y
.
getOrgCode
())
.
orgCode
(
y
.
getOrgCode
())
...
@@ -1184,7 +1214,7 @@ public class InsureContorll {
...
@@ -1184,7 +1214,7 @@ public class InsureContorll {
policy
.
setOrgCode
(
company
.
getId
());
policy
.
setOrgCode
(
company
.
getId
());
break
;
break
;
case
"总保费"
:
case
"总保费"
:
user
.
setPrice
(
ExcelUtils
.
getString
(
cell
));
user
.
setPrice
(
Double
.
parseDouble
(
ExcelUtils
.
getString
(
cell
)
));
break
;
break
;
case
"备注"
:
case
"备注"
:
if
(!
StringUtils
.
isNullOrEmpty
(
ExcelUtils
.
getString
(
cell
))){
if
(!
StringUtils
.
isNullOrEmpty
(
ExcelUtils
.
getString
(
cell
))){
...
@@ -1563,7 +1593,8 @@ public class InsureContorll {
...
@@ -1563,7 +1593,8 @@ public class InsureContorll {
*
*
* @return
* @return
*/
*/
public
String
creaXSSFWorkbook
(
List
<
PlansDto
>
plansList
,
String
createDate
)
throws
Exception
{
public
String
creaXSSFWorkbook
(
List
<
PlansDto
>
plansList
,
String
createDate
,
List
<
InsureProductPlan
>
priceList
)
throws
Exception
{
if
(
plansList
.
size
()
<=
0
)
{
if
(
plansList
.
size
()
<=
0
)
{
return
"error"
;
return
"error"
;
}
}
...
@@ -1573,7 +1604,7 @@ public class InsureContorll {
...
@@ -1573,7 +1604,7 @@ public class InsureContorll {
plansList
.
forEach
(
p
->
{
plansList
.
forEach
(
p
->
{
List
<
YgglMainEmp
>
ygglMainEmpList
=
ygglMainEmpMapper
.
selectListByIds
(
p
.
getUserIds
());
List
<
YgglMainEmp
>
ygglMainEmpList
=
ygglMainEmpMapper
.
selectListByIds
(
p
.
getUserIds
());
for
(
YgglMainEmp
y
:
ygglMainEmpList
)
{
for
(
YgglMainEmp
y
:
ygglMainEmpList
)
{
String
[]
arr
=
new
String
[]{
String
.
valueOf
(
y
.
getId
()),
y
.
getName
(),
"身份证"
,
y
.
getZjNum
(),
PlanEnum
.
getEnum
(
p
.
getBenefitBasicPlan
(),
p
.
getBenefitOccupationCategory
()).
getName
(),
createDate
,
""
,
StringUtils
.
isNullOrEmpty
(
p
.
getTricycleFrameNumber
())
?
"无"
:
p
.
getTricycleFrameNumber
(),
PlanEnum
.
getEnum
(
p
.
getBenefitBasicPlan
(),
p
.
getBenefitOccupationCategory
()).
getType
(
)};
String
[]
arr
=
new
String
[]{
String
.
valueOf
(
y
.
getId
()),
y
.
getName
(),
"身份证"
,
y
.
getZjNum
(),
priceList
.
stream
().
filter
(
v
->
v
.
getId
()==
p
.
getBenefitBasicPlan
()).
collect
(
Collectors
.
toList
()).
get
(
0
).
getName
(),
createDate
,
""
,
StringUtils
.
isNullOrEmpty
(
p
.
getTricycleFrameNumber
())
?
"无"
:
p
.
getTricycleFrameNumber
(),
getPlanType
(
p
.
getBenefitOccupationCategory
()
)};
list
.
add
(
arr
);
list
.
add
(
arr
);
}
}
});
});
...
@@ -1618,7 +1649,7 @@ public class InsureContorll {
...
@@ -1618,7 +1649,7 @@ public class InsureContorll {
* @param ids
* @param ids
* @return
* @return
*/
*/
public
String
creaXSSFWorkbook1
(
InsureDto
insureDto
)
throws
Exception
{
public
String
creaXSSFWorkbook1
(
InsureDto
insureDto
,
List
<
InsureProductPlan
>
priceList
)
throws
Exception
{
if
(
insureDto
.
getUserIds
().
length
<=
0
)
{
if
(
insureDto
.
getUserIds
().
length
<=
0
)
{
return
"error"
;
return
"error"
;
}
}
...
@@ -1626,7 +1657,7 @@ public class InsureContorll {
...
@@ -1626,7 +1657,7 @@ public class InsureContorll {
List
<
YgglMainEmp
>
ygglMainEmpList
=
ygglMainEmpMapper
.
selectListByIds
(
insureDto
.
getUserIds
());
List
<
YgglMainEmp
>
ygglMainEmpList
=
ygglMainEmpMapper
.
selectListByIds
(
insureDto
.
getUserIds
());
List
list
=
Lists
.
newArrayList
();
List
list
=
Lists
.
newArrayList
();
for
(
YgglMainEmp
y
:
ygglMainEmpList
)
{
for
(
YgglMainEmp
y
:
ygglMainEmpList
)
{
String
[]
arr
=
new
String
[]{
String
.
valueOf
(
y
.
getId
()),
y
.
getName
(),
"身份证"
,
y
.
getZjNum
(),
PlanEnum
.
getEnum
(
insureDto
.
getBenefitBasicPlan
(),
insureDto
.
getBenefitOccupationCategory
()).
getName
(),
insureDto
.
getPolicyDateStart
(),
""
,
StringUtils
.
isNullOrEmpty
(
insureDto
.
getTricycleFrameNumber
())
?
"无"
:
insureDto
.
getTricycleFrameNumber
(),
PlanEnum
.
getEnum
(
insureDto
.
getBenefitBasicPlan
(),
insureDto
.
getBenefitOccupationCategory
()).
getType
(
)};
String
[]
arr
=
new
String
[]{
String
.
valueOf
(
y
.
getId
()),
y
.
getName
(),
"身份证"
,
y
.
getZjNum
(),
priceList
.
stream
().
filter
(
v
->
v
.
getId
()==
insureDto
.
getBenefitBasicPlan
()).
collect
(
Collectors
.
toList
()).
get
(
0
).
getName
(),
insureDto
.
getPolicyDateStart
(),
""
,
StringUtils
.
isNullOrEmpty
(
insureDto
.
getTricycleFrameNumber
())
?
"无"
:
insureDto
.
getTricycleFrameNumber
(),
getPlanType
(
insureDto
.
getBenefitOccupationCategory
()
)};
list
.
add
(
arr
);
list
.
add
(
arr
);
}
}
String
[]
rowName
=
new
String
[]{
"ID"
,
"name"
,
"ID_type"
,
"ID_number"
,
"Scheme_name"
,
"Date_start"
,
"Branch"
,
"Tricycle_frame_number"
,
"benefit_occupation_category"
};
String
[]
rowName
=
new
String
[]{
"ID"
,
"name"
,
"ID_type"
,
"ID_number"
,
"Scheme_name"
,
"Date_start"
,
"Branch"
,
"Tricycle_frame_number"
,
"benefit_occupation_category"
};
...
@@ -1724,63 +1755,63 @@ public class InsureContorll {
...
@@ -1724,63 +1755,63 @@ public class InsureContorll {
}
}
/*获取基础计划的价格*/
/*获取基础计划的价格*/
private
Integer
getPrice
(
String
plan
,
String
type
)
{
//
private Integer getPrice(String plan, String type) {
/*
//
/*
基础计划
//
基础计划
30万雇主/3万医疗 36968,
//
30万雇主/3万医疗 36968,
50万雇主/5万医疗 36969,
//
50万雇主/5万医疗 36969,
80万雇主/10万医疗 36970,
//
80万雇主/10万医疗 36970,
80万雇主/20万医疗 36971,
//
80万雇主/20万医疗 36971,
100万雇主/10万医疗 36972
//
100万雇主/10万医疗 36972
*/
//
*/
/*行业类型
//
/*行业类型
* A类 63119
//
* A类 63119
* B类 63120
//
* B类 63120
* C类 63121\
//
* C类 63121\
* */
//
* */
switch
(
plan
)
{
//
switch (plan) {
case
"36968"
:
//
case "36968":
if
(
type
.
equals
(
"63119"
))
{
//
if (type.equals("63119")) {
return
PlanEnum
.
A_30
.
getPrice
();
//
return PlanEnum.A_30.getPrice();
}
else
if
(
type
.
equals
(
"63120"
))
{
//
} else if (type.equals("63120")) {
return
PlanEnum
.
B_30
.
getPrice
();
//
return PlanEnum.B_30.getPrice();
}
//
}
break
;
//
break;
case
"36969"
:
//
case "36969":
if
(
type
.
equals
(
"63119"
))
{
//
if (type.equals("63119")) {
return
PlanEnum
.
A_50
.
getPrice
();
//
return PlanEnum.A_50.getPrice();
}
else
if
(
type
.
equals
(
"63120"
))
{
//
} else if (type.equals("63120")) {
return
PlanEnum
.
B_50
.
getPrice
();
//
return PlanEnum.B_50.getPrice();
}
else
if
(
type
.
equals
(
"63121"
))
{
//
} else if (type.equals("63121")) {
return
PlanEnum
.
C_50
.
getPrice
();
//
return PlanEnum.C_50.getPrice();
}
//
}
break
;
//
break;
case
"36970"
:
//
case "36970":
if
(
type
.
equals
(
"63119"
))
{
//
if (type.equals("63119")) {
return
PlanEnum
.
A_80
.
getPrice
();
//
return PlanEnum.A_80.getPrice();
}
else
if
(
type
.
equals
(
"63120"
))
{
//
} else if (type.equals("63120")) {
return
PlanEnum
.
B_80
.
getPrice
();
//
return PlanEnum.B_80.getPrice();
}
else
if
(
type
.
equals
(
"63121"
))
{
//
} else if (type.equals("63121")) {
return
PlanEnum
.
C_80
.
getPrice
();
//
return PlanEnum.C_80.getPrice();
}
//
}
break
;
//
break;
case
"36971"
:
//
case "36971":
if
(
type
.
equals
(
"63119"
))
{
//
if (type.equals("63119")) {
return
PlanEnum
.
A_80_20
.
getPrice
();
//
return PlanEnum.A_80_20.getPrice();
}
else
if
(
type
.
equals
(
"63120"
))
{
//
} else if (type.equals("63120")) {
return
PlanEnum
.
B_80_20
.
getPrice
();
//
return PlanEnum.B_80_20.getPrice();
}
//
}
break
;
//
break;
case
"36972"
:
//
case "36972":
if
(
type
.
equals
(
"63119"
))
{
//
if (type.equals("63119")) {
return
PlanEnum
.
A_100
.
getPrice
();
//
return PlanEnum.A_100.getPrice();
}
else
if
(
type
.
equals
(
"63120"
))
{
//
} else if (type.equals("63120")) {
return
PlanEnum
.
B_100
.
getPrice
();
//
return PlanEnum.B_100.getPrice();
}
//
}
break
;
//
break;
}
//
}
return
0
;
//
return 0;
}
//
}
@PostMapping
(
value
=
"/replaceUserPolicy"
)
@PostMapping
(
value
=
"/replaceUserPolicy"
)
...
@@ -1788,6 +1819,9 @@ public class InsureContorll {
...
@@ -1788,6 +1819,9 @@ public class InsureContorll {
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
Result
<
Object
>
replaceUserPolicy
(
@RequestParam
(
"file"
)
MultipartFile
file
,
@RequestParam
(
"policyId"
)
Integer
policyId
){
public
Result
<
Object
>
replaceUserPolicy
(
@RequestParam
(
"file"
)
MultipartFile
file
,
@RequestParam
(
"policyId"
)
Integer
policyId
){
InsurePolicy
insurePolicy
=
InsurePolicy
.
builder
().
id
(
policyId
).
build
().
selectById
();
InsurePolicy
insurePolicy
=
InsurePolicy
.
builder
().
id
(
policyId
).
build
().
selectById
();
InsureProduct
insureProduct
=
InsureProduct
.
builder
().
id
(
insurePolicy
.
getProductId
()).
build
().
selectById
();
List
<
InsureProductPlan
>
priceList
=
InsureProductPlan
.
builder
().
build
().
selectList
(
new
QueryWrapper
<
InsureProductPlan
>().
lambda
()
.
eq
(
InsureProductPlan:
:
getProductId
,
insureProduct
.
getId
()).
eq
(
InsureProductPlan:
:
getDeleteFlag
,
0
));
ByteArrayOutputStream
bos
=
new
ByteArrayOutputStream
();
ByteArrayOutputStream
bos
=
new
ByteArrayOutputStream
();
XSSFWorkbook
xw
=
null
;
XSSFWorkbook
xw
=
null
;
try
{
try
{
...
@@ -1971,12 +2005,12 @@ public class InsureContorll {
...
@@ -1971,12 +2005,12 @@ public class InsureContorll {
}
else
{
}
else
{
QyzxEntInfoM
qyzxEntInfoM
=
QyzxEntInfoM
.
builder
().
id
(
insurePolicy
.
getOrgCode
()).
build
().
selectById
();
QyzxEntInfoM
qyzxEntInfoM
=
QyzxEntInfoM
.
builder
().
id
(
insurePolicy
.
getOrgCode
()).
build
().
selectById
();
replaceList
.
forEach
(
y
->
{
replaceList
.
forEach
(
y
->
{
Integer
price
=
getPrice
(
y
.
getBenefitBasicPlan
(),
y
.
getBenefitOccupationCategory
()
);
Double
price
=
priceList
.
stream
().
filter
(
v
->
v
.
getId
()==
y
.
getProductPlanId
()).
collect
(
Collectors
.
toList
()).
get
(
0
).
getPrice
(
);
InsureUser
.
builder
()
InsureUser
.
builder
()
.
transId
(
"RP_"
+
insurePolicy
.
getOrgCode
()
+
"_"
+
dtf2
.
format
(
now
))
.
transId
(
"RP_"
+
insurePolicy
.
getOrgCode
()
+
"_"
+
dtf2
.
format
(
now
))
.
insuredName
(
qyzxEntInfoM
.
getName
())
.
insuredName
(
qyzxEntInfoM
.
getName
())
.
price
(
price
.
toString
()
)
/*前端获取的保费*/
.
price
(
price
)
/*前端获取的保费*/
.
premium
(
String
.
valueOf
(
price
*
replaceList
.
size
())
)
.
premium
(
price
)
.
batchNo
(
batchData
.
get
(
"import_uuid"
).
toString
())
.
batchNo
(
batchData
.
get
(
"import_uuid"
).
toString
())
.
benefitBasicPlan
(
y
.
getBenefitBasicPlan
())
.
benefitBasicPlan
(
y
.
getBenefitBasicPlan
())
.
policyNo
(
orderImportInfo
.
get
(
"contract_no"
).
toString
())
.
policyNo
(
orderImportInfo
.
get
(
"contract_no"
).
toString
())
...
...
This diff is collapsed.
Click to expand it.
src/main/java/cn/timer/api/controller/insure/InsurePlanController.java
0 → 100644
View file @
142a1283
package
cn
.
timer
.
api
.
controller
.
insure
;
import
cn.timer.api.bean.insure.InsurePlan
;
import
cn.timer.api.bean.insure.InsureProduct
;
import
cn.timer.api.bean.insure.InsureProductPlan
;
import
cn.timer.api.dao.insure.InsurePlanMapper
;
import
cn.timer.api.dao.insure.InsureProductPlanMapper
;
import
cn.timer.api.dto.insure.ProductDto
;
import
cn.timer.api.utils.Result
;
import
cn.timer.api.utils.ResultUtil
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
net.sf.json.JSONObject
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.web.bind.annotation.*
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
/**
* 投保方案
*
* @author wgd
* @email 862422848@qq.com
* @date 2022-09-23 11:53:23
*/
@Api
(
tags
=
"8.0保险列表"
)
@RestController
@Transactional
@RequestMapping
(
value
=
"/insurePlan"
,
produces
=
{
"application/json"
})
public
class
InsurePlanController
{
@Autowired
private
InsurePlanMapper
insurePlanMapper
;
@Autowired
private
InsureProductPlanMapper
insureProductPlanMapper
;
@GetMapping
(
value
=
"/planList"
)
@ApiOperation
(
value
=
"方案列表"
,
httpMethod
=
"GET"
,
notes
=
"方案列表"
)
public
Result
<
Object
>
planList
()
{
List
<
InsurePlan
>
list
=
insurePlanMapper
.
getList
();
Map
<
String
,
List
<
InsurePlan
>>
map
=
list
.
stream
().
collect
(
Collectors
.
groupingBy
(
InsurePlan:
:
getType
));
return
ResultUtil
.
data
(
map
);
}
@GetMapping
(
value
=
"/getPlanListbyProduct"
)
@ApiOperation
(
value
=
"产品方案列表"
,
httpMethod
=
"GET"
,
notes
=
"产品方案列表"
)
public
Result
<
Object
>
getPlanListbyProduct
(
@RequestParam
(
"productId"
)
Integer
productId
)
{
List
<
ProductDto
>
list
=
insureProductPlanMapper
.
getListByProductId
(
productId
);
return
ResultUtil
.
data
(
list
);
}
@PostMapping
(
value
=
"/savePlan"
)
@ApiOperation
(
value
=
"保存方案"
,
httpMethod
=
"POST"
,
notes
=
"保存方案"
)
public
Result
<
Object
>
savePlan
(
@RequestBody
ProductDto
productDto
)
{
InsureProduct
insureProduct
=
InsureProduct
.
builder
().
id
(
productDto
.
getProductId
()).
build
().
selectById
();
InsureProductPlan
insureProductPlan
=
InsureProductPlan
.
builder
().
productId
(
insureProduct
.
getId
())
.
createTime
(
new
Date
()).
name
(
productDto
.
getPlanName
()).
price
(
productDto
.
getPrice
()).
planJson
(
productDto
.
getPlanJson
().
toString
()).
build
();
if
(
insureProductPlan
.
insert
())
{
return
ResultUtil
.
data
(
"保存成功"
);
}
return
ResultUtil
.
error
(
"保存失败"
);
}
;
}
This diff is collapsed.
Click to expand it.
src/main/java/cn/timer/api/controller/insure/InsureProductController.java
View file @
142a1283
package
cn
.
timer
.
api
.
controller
.
insure
;
package
cn
.
timer
.
api
.
controller
.
insure
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
cn.timer.api.bean.insure.InsureProduct
;
import
cn.timer.api.bean.insure.InsureProduct
;
import
cn.timer.api.dao.insure.InsureProductMapper
;
import
cn.timer.api.dao.insure.InsureProductMapper
;
import
cn.timer.api.dto.insure.PolicyDto
;
import
cn.timer.api.dto.insure.PolicyDto
;
import
cn.timer.api.dto.insure.ProductDto
;
import
cn.timer.api.utils.Result
;
import
cn.timer.api.utils.Result
;
import
cn.timer.api.utils.ResultUtil
;
import
cn.timer.api.utils.ResultUtil
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
...
@@ -29,17 +31,26 @@ import org.springframework.web.bind.annotation.*;
...
@@ -29,17 +31,26 @@ import org.springframework.web.bind.annotation.*;
@RestController
@RestController
@Transactional
@Transactional
@RequestMapping
(
value
=
"/insureProduct"
,
produces
=
{
"application/json"
})
@RequestMapping
(
value
=
"/insureProduct"
,
produces
=
{
"application/json"
})
public
class
InsureProductController
{
public
class
InsureProductController
{
@Autowired
@Autowired
private
InsureProductMapper
insureProductMapper
;
private
InsureProductMapper
insureProductMapper
;
@GetMapping
(
value
=
"/productList"
)
@GetMapping
(
value
=
"/productList"
)
@ApiOperation
(
value
=
"12.产品列表"
,
httpMethod
=
"GET"
,
notes
=
"产品列表"
)
@ApiOperation
(
value
=
"12.产品列表"
,
httpMethod
=
"GET"
,
notes
=
"产品列表"
)
public
Result
<
Object
>
productList
()
{
public
Result
<
Object
>
productList
()
{
List
<
InsureProduct
>
productList
=
InsureProduct
.
builder
().
build
().
selectList
(
new
QueryWrapper
<
InsureProduct
>().
lambda
().
eq
(
InsureProduct:
:
getIsDel
,
0
));
List
<
InsureProduct
>
productList
=
InsureProduct
.
builder
().
build
().
selectList
(
new
QueryWrapper
<
InsureProduct
>().
lambda
().
eq
(
InsureProduct:
:
getIsDel
,
0
));
if
(
productList
.
size
()>
0
)
{
return
ResultUtil
.
data
(
productList
);
return
ResultUtil
.
data
(
productList
);
}
}
return
ResultUtil
.
error
(
"暂无产品"
);
@PostMapping
(
value
=
"/saveProduct"
)
@ApiOperation
(
value
=
"保存产品"
,
httpMethod
=
"POST"
,
notes
=
"保存产品"
)
public
Result
<
Object
>
saveProduct
(
@RequestBody
InsureProduct
insureProduct
)
{
insureProduct
.
setCreateTime
(
new
Date
());
if
(
insureProduct
.
insert
())
{
return
ResultUtil
.
data
(
"添加产品成功"
);
}
return
ResultUtil
.
error
(
"添加产品失败"
);
}
}
;
}
}
This diff is collapsed.
Click to expand it.
src/main/java/cn/timer/api/controller/insure/InsureUserController.java
View file @
142a1283
...
@@ -12,6 +12,7 @@ import java.util.Optional;
...
@@ -12,6 +12,7 @@ import java.util.Optional;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
import
cn.timer.api.bean.insure.InsurePolicy
;
import
cn.timer.api.bean.insure.InsurePolicy
;
import
cn.timer.api.bean.insure.InsureProductPlan
;
import
cn.timer.api.bean.insure.InsureUser
;
import
cn.timer.api.bean.insure.InsureUser
;
import
cn.timer.api.config.annotation.CurrentUser
;
import
cn.timer.api.config.annotation.CurrentUser
;
import
cn.timer.api.config.annotation.UserBean
;
import
cn.timer.api.config.annotation.UserBean
;
...
@@ -69,6 +70,9 @@ public class InsureUserController{
...
@@ -69,6 +70,9 @@ public class InsureUserController{
@ApiOperation
(
value
=
"被保人详情"
,
httpMethod
=
"POST"
,
notes
=
"保单列表"
)
@ApiOperation
(
value
=
"被保人详情"
,
httpMethod
=
"POST"
,
notes
=
"保单列表"
)
public
Result
<
Object
>
userDetial
(
@RequestParam
(
"userId"
)
String
userId
)
{
public
Result
<
Object
>
userDetial
(
@RequestParam
(
"userId"
)
String
userId
)
{
InsureUser
user
=
InsureUser
.
builder
().
id
(
Integer
.
parseInt
(
userId
)).
build
().
selectById
();
InsureUser
user
=
InsureUser
.
builder
().
id
(
Integer
.
parseInt
(
userId
)).
build
().
selectById
();
InsureProductPlan
insureProductPlan
=
InsureProductPlan
.
builder
().
id
(
user
.
getProductPlanId
()).
build
().
selectById
();
user
.
setPlanIds
(
JSON
.
parseArray
(
insureProductPlan
.
getPlanJson
(),
String
.
class
));
user
.
setProductName
(
insureProductPlan
.
getName
());
return
ResultUtil
.
data
(
user
);
return
ResultUtil
.
data
(
user
);
}
}
...
...
This diff is collapsed.
Click to expand it.
src/main/java/cn/timer/api/controller/insure/enums/PlanEnum.java
View file @
142a1283
...
@@ -4,7 +4,7 @@ import cn.timer.api.utils.ExcelUtils;
...
@@ -4,7 +4,7 @@ import cn.timer.api.utils.ExcelUtils;
/**
/**
* @Description TODO
* @Description TODO
* @Author wgd
* @Author wgd
2022/09/26 废弃枚举类
* @Date 2022/3/24 17:20
* @Date 2022/3/24 17:20
*/
*/
public
enum
PlanEnum
{
public
enum
PlanEnum
{
...
@@ -20,6 +20,7 @@ public enum PlanEnum {
...
@@ -20,6 +20,7 @@ public enum PlanEnum {
B_100
(
40
,
"100万意外/10万医疗/扩展24小时(B类)"
,
"B类"
,
"36972"
,
"63120"
),
B_100
(
40
,
"100万意外/10万医疗/扩展24小时(B类)"
,
"B类"
,
"36972"
,
"63120"
),
C_50
(
60
,
"50万意外/5万医疗/扩展24小时(C类)"
,
"C类"
,
"36969"
,
"63121"
),
C_50
(
60
,
"50万意外/5万医疗/扩展24小时(C类)"
,
"C类"
,
"36969"
,
"63121"
),
C_80
(
75
,
"80万意外/10万医疗/扩展24小时(C类)"
,
"C类"
,
"36970"
,
"63121"
);
C_80
(
75
,
"80万意外/10万医疗/扩展24小时(C类)"
,
"C类"
,
"36970"
,
"63121"
);
private
Integer
price
;
private
Integer
price
;
private
String
name
;
private
String
name
;
private
String
type
;
private
String
type
;
...
...
This diff is collapsed.
Click to expand it.
src/main/java/cn/timer/api/dao/insure/InsurePlanMapper.java
0 → 100644
View file @
142a1283
package
cn
.
timer
.
api
.
dao
.
insure
;
import
cn.timer.api.bean.insure.InsurePlan
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
org.apache.ibatis.annotations.Param
;
import
org.springframework.stereotype.Repository
;
import
java.util.List
;
/**
* 投保方案
*
* @author wgd
* @email 862422848@qq.com
* @date 2022-09-23 11:53:23
*/
@Repository
public
interface
InsurePlanMapper
extends
BaseMapper
<
InsurePlan
>
{
List
<
InsurePlan
>
getList
();
List
<
InsurePlan
>
findPlanByIds
(
@Param
(
"list"
)
List
ids
);
}
This diff is collapsed.
Click to expand it.
src/main/java/cn/timer/api/dao/insure/InsureProductPlanMapper.java
0 → 100644
View file @
142a1283
package
cn
.
timer
.
api
.
dao
.
insure
;
import
cn.timer.api.bean.insure.InsurePlan
;
import
cn.timer.api.bean.insure.InsureProduct
;
import
cn.timer.api.bean.insure.InsureProductPlan
;
import
cn.timer.api.dto.insure.ProductDto
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
org.apache.ibatis.annotations.Param
;
import
org.springframework.stereotype.Repository
;
import
java.util.List
;
/**
* 投保方案中间表
*
* @author wgd
* @email 862422848@qq.com
* @date 2022-09-26 10:06:39
*/
@Repository
public
interface
InsureProductPlanMapper
extends
BaseMapper
<
InsureProductPlan
>
{
List
<
ProductDto
>
getListByProductId
(
@Param
(
"productId"
)
Integer
productId
);
}
This diff is collapsed.
Click to expand it.
src/main/java/cn/timer/api/dto/insure/InsureDto.java
View file @
142a1283
...
@@ -27,7 +27,9 @@ public class InsureDto {
...
@@ -27,7 +27,9 @@ public class InsureDto {
private
Integer
type
;
/*类型 1是新增 3是替换*/
private
Integer
type
;
/*类型 1是新增 3是替换*/
private
String
productId
;
private
String
productId
;
private
List
<
PlansDto
>
plans
;
private
List
<
PlansDto
>
plans
;
private
String
benefitBasicPlan
;
/*方案名称*/
// private String benefitBasicPlan;/*方案名称*/
/*原为方案名称,2022/09/26改为使用insure_product_plan表的id*/
private
Integer
benefitBasicPlan
;
private
String
benefitOccupationCategory
;
private
String
benefitOccupationCategory
;
private
String
tricycleFrameNumber
;
private
String
tricycleFrameNumber
;
private
String
[]
oldIds
;
private
String
[]
oldIds
;
...
...
This diff is collapsed.
Click to expand it.
src/main/java/cn/timer/api/dto/insure/PlansDto.java
View file @
142a1283
...
@@ -11,8 +11,11 @@ import lombok.Data;
...
@@ -11,8 +11,11 @@ import lombok.Data;
public
class
PlansDto
{
public
class
PlansDto
{
private
int
index
;
private
int
index
;
private
String
[]
userIds
;
private
String
[]
userIds
;
private
String
benefitBasicPlan
;
/*方案名称*/
/*方案名称*/
// private String benefitBasicPlan;
/*原为方案名称,2022/09/26改为使用insure_product_plan表的id*/
private
Integer
benefitBasicPlan
;
private
String
benefitOccupationCategory
;
private
String
benefitOccupationCategory
;
private
String
tricycleFrameNumber
;
private
String
tricycleFrameNumber
;
private
Integer
price
;
private
Double
price
;
}
}
This diff is collapsed.
Click to expand it.
src/main/java/cn/timer/api/dto/insure/PolicyDto.java
View file @
142a1283
...
@@ -48,4 +48,5 @@ public class PolicyDto {
...
@@ -48,4 +48,5 @@ public class PolicyDto {
private
String
userName
;
private
String
userName
;
private
String
companyName
;
private
String
companyName
;
private
boolean
isAll
=
false
;
private
boolean
isAll
=
false
;
private
Integer
productPlanId
;
}
}
This diff is collapsed.
Click to expand it.
src/main/java/cn/timer/api/dto/insure/ProductDto.java
0 → 100644
View file @
142a1283
package
cn
.
timer
.
api
.
dto
.
insure
;
import
com.fasterxml.jackson.databind.JsonNode
;
import
lombok.Data
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Map
;
/**
* @Description TODO
* @Author wgd
* @Date 2022/9/26 9:45
*/
@Data
public
class
ProductDto
{
private
Integer
id
;
private
Integer
productId
;
private
String
planName
;
private
String
planJson
;
private
double
price
;
private
Date
createTime
;
private
List
plans
;
}
This diff is collapsed.
Click to expand it.
src/main/resources/mapping/insure/InsurePlanMapper.xml
0 → 100644
View file @
142a1283
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"cn.timer.api.dao.insure.InsurePlanMapper"
>
<!-- 可根据自己的需求,是否要使用 -->
<resultMap
type=
"cn.timer.api.bean.insure.InsurePlan"
id=
"insurePlanMap"
>
<result
property=
"id"
column=
"id"
/>
<result
property=
"name"
column=
"name"
/>
<result
property=
"planId"
column=
"plan_id"
/>
<result
property=
"type"
column=
"type"
/>
<result
property=
"createTime"
column=
"create_time"
/>
<result
property=
"deleteFlag"
column=
"delete_flag"
/>
<result
property=
"typeName"
column=
"type_name"
/>
</resultMap>
<select
id=
"getList"
resultType=
"cn.timer.api.bean.insure.InsurePlan"
>
select * from insure_plan where delete_flag = 0
</select>
<select
id=
"findPlanByIds"
resultType=
"cn.timer.api.bean.insure.InsurePlan"
>
select * from insure_plan WHERE id in
<foreach
item=
"item"
index=
"index"
collection=
"list"
open=
"("
separator=
","
close=
")"
>
#{item}
</foreach>
</select>
</mapper>
This diff is collapsed.
Click to expand it.
src/main/resources/mapping/insure/InsurePolicyMapper.xml
View file @
142a1283
...
@@ -238,7 +238,7 @@
...
@@ -238,7 +238,7 @@
ip.id AS id,
ip.id AS id,
ip.policy_no AS policyNo,
ip.policy_no AS policyNo,
ip.create_time as createTime,
ip.create_time as createTime,
ip
.scheme_
name AS schemeName,
ip
p.
name AS schemeName,
qy.`name` as `name`,
qy.`name` as `name`,
count( iu.id ) AS totalUser,
count( iu.id ) AS totalUser,
ip.policy_date_start as policyDateStart,
ip.policy_date_start as policyDateStart,
...
@@ -252,6 +252,7 @@
...
@@ -252,6 +252,7 @@
insure_policy ip
insure_policy ip
LEFT JOIN insure_user iu ON iu.policy_id = ip.id
LEFT JOIN insure_user iu ON iu.policy_id = ip.id
LEFT JOIN qyzx_ent_info_m qy on qy.id=ip.org_code
LEFT JOIN qyzx_ent_info_m qy on qy.id=ip.org_code
LEFT JOIN insure_product_plan ipp ON iu.product_plan_id = ipp.id
<where>
<where>
<if
test=
"policy.productId!=null and policy.productId!=''"
>
<if
test=
"policy.productId!=null and policy.productId!=''"
>
and ip.product_id = #{policy.productId}
and ip.product_id = #{policy.productId}
...
@@ -263,7 +264,7 @@
...
@@ -263,7 +264,7 @@
and ip.org_code = #{policy.orgCode}
and ip.org_code = #{policy.orgCode}
</if>
</if>
<if
test=
"policy.benefitBasicPlan!=null and policy.benefitBasicPlan!=''"
>
<if
test=
"policy.benefitBasicPlan!=null and policy.benefitBasicPlan!=''"
>
and iu.
benefit_basic_plan
= #{policy.benefitBasicPlan}
and iu.
product_plan_id
= #{policy.benefitBasicPlan}
</if>
</if>
<if
test=
"policy.policyDateStart!=null and policy.policyDateStart!=''"
>
<if
test=
"policy.policyDateStart!=null and policy.policyDateStart!=''"
>
and ip.policy_date_start
<![CDATA[ >= ]]>
#{policy.policyDateStart}
and ip.policy_date_start
<![CDATA[ >= ]]>
#{policy.policyDateStart}
...
@@ -319,11 +320,15 @@
...
@@ -319,11 +320,15 @@
iu.insured_name as insuredName,
iu.insured_name as insuredName,
iu.benefit_basic_plan as benefitBasicPlan,
iu.benefit_basic_plan as benefitBasicPlan,
iu.benefit_occupation_category as benefitOccupationCategory,
iu.benefit_occupation_category as benefitOccupationCategory,
iu.product_plan_id as productPlanId,
ip.policy_pay_type as policyPayType,
ip.policy_pay_type as policyPayType,
ip.product_id as productId
ip.product_id as productId,
iu.product_plan_id as productPlanId,
ipp.name as name
FROM
FROM
insure_policy ip
insure_policy ip
LEFT JOIN insure_user iu ON iu.policy_id = ip.id
LEFT JOIN insure_user iu ON iu.policy_id = ip.id
left join insure_product_plan ipp on ipp.id=iu.product_plan_id
WHERE
WHERE
ip.id = #{id}
ip.id = #{id}
LIMIT 1
LIMIT 1
...
...
This diff is collapsed.
Click to expand it.
src/main/resources/mapping/insure/InsureProductPlanMapper.xml
0 → 100644
View file @
142a1283
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"cn.timer.api.dao.insure.InsureProductPlanMapper"
>
<!-- 可根据自己的需求,是否要使用 -->
<resultMap
type=
"cn.timer.api.bean.insure.InsureProductPlan"
id=
"insureProductPlanMap"
>
<result
property=
"id"
column=
"id"
/>
<result
property=
"planJson"
column=
"plan_json"
/>
<result
property=
"price"
column=
"price"
/>
<result
property=
"productId"
column=
"product_id"
/>
<result
property=
"createTime"
column=
"create_time"
/>
<result
property=
"deleteFlag"
column=
"delete_flag"
/>
<result
property=
"name"
column=
"name"
/>
</resultMap>
<select
id=
"getListByProductId"
resultType=
"cn.timer.api.dto.insure.ProductDto"
>
select ipp.id as id,
ipp.price as price,
ipp.plan_json as planJson,
ipp.`name` as planName,
ipp.create_time as createTime
from insure_product_plan ipp
LEFT JOIN insure_product ip on ip.id = ipp.product_id
WHERE ip.id = #{productId}
</select>
</mapper>
This diff is collapsed.
Click to expand it.
src/main/resources/mapping/insure/InsureUserMapper.xml
View file @
142a1283
...
@@ -32,6 +32,8 @@
...
@@ -32,6 +32,8 @@
<result
property=
"applyType"
column=
"apply_type"
/>
<result
property=
"applyType"
column=
"apply_type"
/>
<result
property=
"reason"
column=
"reason"
/>
<result
property=
"reason"
column=
"reason"
/>
<result
property=
"createTime"
column=
"create_time"
/>
<result
property=
"createTime"
column=
"create_time"
/>
<result
property=
"productPlanId"
column=
"product_plan_id"
/>
</resultMap>
</resultMap>
<select
id=
"queryObject"
resultType=
"cn.timer.api.bean.insure.InsureUser"
>
<select
id=
"queryObject"
resultType=
"cn.timer.api.bean.insure.InsureUser"
>
...
@@ -303,7 +305,7 @@
...
@@ -303,7 +305,7 @@
and ip.id=#{policyDto.id}
and ip.id=#{policyDto.id}
</if>
</if>
<if
test=
"policyDto.planId !=null and policyDto.planId !=''"
>
<if
test=
"policyDto.planId !=null and policyDto.planId !=''"
>
and iu.
benefit_basic_plan
= #{policyDto.planId}
and iu.
product_plan_id
= #{policyDto.planId}
</if>
</if>
<if
test=
"policyDto.categoryId !=null and policyDto.categoryId !=''"
>
<if
test=
"policyDto.categoryId !=null and policyDto.categoryId !=''"
>
and iu.benefit_occupation_category = #{policyDto.categoryId}
and iu.benefit_occupation_category = #{policyDto.categoryId}
...
@@ -429,13 +431,16 @@
...
@@ -429,13 +431,16 @@
</select>
</select>
<select
id=
"selectPlansListById"
resultType=
"cn.timer.api.dto.insure.InsureUserDto"
>
<select
id=
"selectPlansListById"
resultType=
"cn.timer.api.dto.insure.InsureUserDto"
>
SELECT policy_id as policyId,
SELECT iu.policy_id as policyId,
benefit_basic_plan as benefitBasicPlan,
iu.benefit_basic_plan as benefitBasicPlan,
benefit_occupation_category as benefitOccupationCategory,
iu.benefit_occupation_category as benefitOccupationCategory,/*废弃*/
count(id) as totalUser
count(iu.id) as totalUser,
FROM insure_user
iu.product_plan_id as productPlanId,
ipp.name as name
FROM insure_user iu
left join insure_product_plan ipp on ipp.id=iu.product_plan_id
WHERE policy_id = #{policyId}
WHERE policy_id = #{policyId}
group by
benefit_basic_plan,
benefit_occupation_category
group by benefit_occupation_category
</select>
</select>
<update
id=
"updateInsure"
>
<update
id=
"updateInsure"
>
...
...
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