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
1769b9c9
Commit
1769b9c9
authored
Apr 08, 2022
by
翁国栋
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
运营后台--
增加可投多个方案
parent
f43f6e95
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
167 additions
and
28 deletions
+167
-28
src/main/java/cn/timer/api/bean/yggl/YgglMainEmp.java
+1
-1
src/main/java/cn/timer/api/controller/insure/CallBackContorll.java
+25
-7
src/main/java/cn/timer/api/controller/insure/InsureContorll.java
+0
-0
src/main/java/cn/timer/api/controller/insure/InsureUserController.java
+21
-0
src/main/java/cn/timer/api/controller/insure/enums/InsuranceEnum.java
+36
-15
src/main/java/cn/timer/api/dao/insure/InsureUserMapper.java
+4
-0
src/main/java/cn/timer/api/dto/insure/InsureDto.java
+8
-3
src/main/java/cn/timer/api/dto/insure/InsureUserDto.java
+19
-0
src/main/java/cn/timer/api/dto/insure/PlansDto.java
+18
-0
src/main/java/cn/timer/api/dto/insure/PolicyDto.java
+3
-0
src/main/resources/mapping/insure/InsureLogMapper.xml
+1
-1
src/main/resources/mapping/insure/InsurePolicyMapper.xml
+1
-0
src/main/resources/mapping/insure/InsureUserMapper.xml
+30
-1
No files found.
src/main/java/cn/timer/api/bean/yggl/YgglMainEmp.java
View file @
1769b9c9
...
...
@@ -224,7 +224,7 @@ public class YgglMainEmp extends Model<YgglMainEmp> {
@ApiModelProperty
(
value
=
"员工登陆账号(手机号)"
,
example
=
"员工登陆账号(手机号)"
)
private
String
empLoginPhone
;
@ApiModelProperty
(
value
=
"是否已投保:0否 1是"
,
example
=
""
)
@ApiModelProperty
(
value
=
"是否已投保:0否 1是
"
,
example
=
""
)
private
int
isInsure
;
}
src/main/java/cn/timer/api/controller/insure/CallBackContorll.java
View file @
1769b9c9
package
cn
.
timer
.
api
.
controller
.
insure
;
import
cn.timer.api.bean.insure.CallBack
;
import
cn.timer.api.bean.insure.InsureLog
;
import
cn.timer.api.bean.insure.InsurePolicy
;
import
cn.timer.api.bean.insure.InsureUser
;
import
cn.timer.api.bean.yggl.YgglMainEmp
;
...
...
@@ -14,6 +15,7 @@ import io.swagger.annotations.ApiOperation;
import
org.apache.commons.codec.digest.DigestUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.web.bind.annotation.*
;
...
...
@@ -36,9 +38,13 @@ import java.util.Map;
public
class
CallBackContorll
{
private
static
final
Logger
log
=
LoggerFactory
.
getLogger
(
CallBackContorll
.
class
);
/*保全测试用*/
private
static
String
appidq
=
"1000115041006006938"
;
/*保全测试用*/
private
static
String
secretq
=
"6ba1bf4aa0bd14368c95ff0b9934a17b"
;
@Value
(
"${insure.appidq}"
)
private
String
appidq
;
@Value
(
"${insure.secretq}"
)
private
String
secretq
;
@Value
(
"${BASE_API_URL}"
)
private
String
base_api_url
;
@PostMapping
(
value
=
"/insuredCallBack"
)
@ApiOperation
(
value
=
"6.投保申请回调"
,
httpMethod
=
"Post"
,
notes
=
"投保申请回调"
)
...
...
@@ -75,7 +81,9 @@ public class CallBackContorll {
@ApiOperationSupport
(
order
=
2
)
private
Map
callBack
(
HttpServletRequest
request
,
@RequestParam
String
pid
,
@RequestParam
String
sign
,
@RequestParam
String
timestamp
)
throws
IOException
{
Map
map
=
Maps
.
newHashMap
();
map
.
put
(
"status"
,
"error"
);
map
.
put
(
"status"
,
"error"
);
int
type
=
7
;
Integer
policyId
=
null
;
if
(
StringUtils
.
isNullOrEmpty
(
pid
)||
StringUtils
.
isNullOrEmpty
(
sign
)&&
StringUtils
.
isNullOrEmpty
(
timestamp
)){
return
map
;
}
...
...
@@ -94,25 +102,31 @@ public class CallBackContorll {
if
(!
value
.
equals
(
sign
)){
return
map
;
}
Map
paramsMap
=
Maps
.
newHashMap
();
paramsMap
.
put
(
"pid"
,
pid
);
paramsMap
.
put
(
"timestamp"
,
timestamp
);
paramsMap
.
put
(
"sign"
,
sign
);
CallBack
callBack
=
JSONObject
.
parseObject
(
sb
.
toString
(),
CallBack
.
class
);
if
(
callBack
.
getStatus
().
equals
(
"1"
))
{
log
.
info
(
"callBack"
+
JSONObject
.
toJSONString
(
callBack
));
List
<
InsureUser
>
list
=
InsureUser
.
builder
().
build
().
selectList
(
new
QueryWrapper
<
InsureUser
>().
lambda
().
eq
(
InsureUser:
:
getBatchNo
,
callBack
.
getOrder_import_info
().
getUuid
()));
List
<
InsureUser
>
list
=
InsureUser
.
builder
().
build
().
selectList
(
new
QueryWrapper
<
InsureUser
>().
lambda
().
eq
(
InsureUser:
:
getBatchNo
,
callBack
.
getOrder_import_info
().
getUuid
())
.
eq
(
InsureUser:
:
getInsureStatus
,
3
)
);
list
.
forEach
(
i
->
{
i
.
setInsureStatus
(
1
);
i
.
updateById
();
YgglMainEmp
.
builder
().
isInsure
(
1
).
build
().
update
(
new
QueryWrapper
<
YgglMainEmp
>().
lambda
().
eq
(
YgglMainEmp:
:
getId
,
i
.
getUserId
()));
});
List
<
InsureUser
>
oldlist
=
InsureUser
.
builder
().
build
().
selectList
(
new
QueryWrapper
<
InsureUser
>().
lambda
().
eq
(
InsureUser:
:
getReplaceTransId
,
callBack
.
getOrder_import_info
().
getUuid
()));
if
(
oldlist
!=
null
||
oldlist
.
size
()>
0
)
{
if
(
oldlist
!=
null
&&
oldlist
.
size
()>
0
)
{
oldlist
.
forEach
(
i
->
{
i
.
setInsureStatus
(
4
);
i
.
setStatus
(
"2"
);
i
.
updateById
();
YgglMainEmp
.
builder
().
isInsure
(
3
).
build
().
update
(
new
QueryWrapper
<
YgglMainEmp
>().
lambda
().
eq
(
YgglMainEmp:
:
getId
,
i
.
getUserId
()));
YgglMainEmp
.
builder
().
isInsure
(
0
).
build
().
update
(
new
QueryWrapper
<
YgglMainEmp
>().
lambda
().
eq
(
YgglMainEmp:
:
getId
,
i
.
getUserId
()));
});
type
=
8
;
}
InsurePolicy
insurePolicy
=
InsurePolicy
.
builder
().
build
().
selectOne
(
new
QueryWrapper
<
InsurePolicy
>().
lambda
().
eq
(
InsurePolicy:
:
getPolicyNo
,
list
.
get
(
0
).
getPolicyNo
()));
policyId
=
insurePolicy
.
getId
();
if
(
oldlist
==
null
||
oldlist
.
size
()==
0
)
{
insurePolicy
.
setTotalPremium
(
String
.
valueOf
(
Double
.
valueOf
(
insurePolicy
.
getTotalPremium
())
+
Double
.
valueOf
(
callBack
.
getOrder_import_info
().
getTotal_money
())));
}
...
...
@@ -121,9 +135,13 @@ public class CallBackContorll {
insurePolicy
.
updateById
();
}
else
{
//TODO 写入日志
}
Map
trueMap
=
Maps
.
newHashMap
();
trueMap
.
put
(
"status"
,
"1"
);
InsureLog
.
builder
().
requestParam
(
JSONObject
.
toJSONString
(
paramsMap
)).
type
(
type
)
.
requestData
(
sb
.
toString
()).
createTime
(
new
Date
()).
requestType
(
1
).
returnBody
(
JSONObject
.
toJSONString
(
callBack
)).
requestPath
(
base_api_url
+
"/callBack/policy/CallBack"
)
.
returnCode
(
callBack
.
getStatus
()).
returnMsg
(
callBack
.
getOrder_import_info
().
getErr_msg
()).
policyId
(
policyId
).
build
().
insert
();
return
trueMap
;
}
}
src/main/java/cn/timer/api/controller/insure/InsureContorll.java
View file @
1769b9c9
This diff is collapsed.
Click to expand it.
src/main/java/cn/timer/api/controller/insure/InsureUserController.java
View file @
1769b9c9
...
...
@@ -3,12 +3,15 @@ package cn.timer.api.controller.insure;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Optional
;
import
java.util.stream.Collectors
;
import
cn.timer.api.bean.insure.InsurePolicy
;
import
cn.timer.api.bean.insure.InsureUser
;
import
cn.timer.api.config.annotation.CurrentUser
;
import
cn.timer.api.config.annotation.UserBean
;
import
cn.timer.api.dao.insure.InsureUserMapper
;
import
cn.timer.api.dto.insure.InsureDto
;
import
cn.timer.api.dto.insure.InsureUserDto
;
import
cn.timer.api.dto.insure.PolicyDto
;
import
cn.timer.api.utils.Page
;
import
cn.timer.api.utils.Result
;
...
...
@@ -69,5 +72,23 @@ public class InsureUserController{
map
.
put
(
"total"
,
insureUserMapper
.
totalUser
(
policyDto
));
return
ResultUtil
.
data
(
map
);
}
@PostMapping
(
value
=
"/getPolicyUserList"
)
@ApiOperation
(
value
=
"获取选中用户方案信息"
,
httpMethod
=
"Post"
,
notes
=
"获取选中用户方案信息"
)
public
Result
<
Object
>
getPolicyUserList
(
@RequestBody
InsureDto
dto
){
List
<
InsureUserDto
>
userList
=
insureUserMapper
.
selectPlansListByIds
(
dto
.
getOldIds
());
if
(
userList
.
size
()<=
0
){
return
ResultUtil
.
error
(
"用户方案错误"
);
}
return
ResultUtil
.
data
(
userList
);
}
@GetMapping
(
value
=
"/getPolicyPlansList"
)
@ApiOperation
(
value
=
"获取方案列表"
,
httpMethod
=
"Get"
,
notes
=
"获取选中用户方案信息"
)
public
Result
<
Object
>
getPolicyUserList
(
@RequestParam
(
"policyId"
)
String
policyId
){
List
<
InsureUserDto
>
userList
=
insureUserMapper
.
selectPlansListById
(
policyId
);
if
(
userList
.
size
()<=
0
){
return
ResultUtil
.
error
(
"用户方案错误"
);
}
return
ResultUtil
.
data
(
userList
);
}
}
src/main/java/cn/timer/api/controller/insure/enums/InsuranceEnum.java
View file @
1769b9c9
...
...
@@ -9,26 +9,30 @@ import lombok.Data;
* @Date 2022/3/24 17:20
*/
public
enum
InsuranceEnum
{
A_30
(
12
,
"30万意外/3万医疗/扩展24小时(A类)"
,
"A类"
),
A_50
(
15
,
"50万意外/5万医疗/扩展24小时(A类)"
,
"A类"
),
A_80
(
18
,
"80万意外/10万医疗/扩展24小时(A类)"
,
"A类"
),
A_80_20
(
25
,
"80万意外/20万医疗/扩展24小时(A类)"
,
"A类"
),
A_100
(
28
,
"100万意外/10万医疗/扩展24小时(A类)"
,
"A类"
),
B_30
(
18
,
"30万意外/3万医疗/扩展24小时(B类)"
,
"B类"
),
B_50
(
20
,
"50万意外/5万医疗/扩展24小时(B类)"
,
"B类"
),
B_80
(
35
,
"80万意外/10万医疗/扩展24小时(B类)"
,
"B类"
),
B_80_20
(
38
,
"80万意外/20万医疗/扩展24小时(B类)"
,
"B类"
),
B_100
(
40
,
"100万意外/10万医疗/扩展24小时(B类)"
,
"B类"
),
C_50
(
60
,
"50万意外/5万医疗/扩展24小时(C类)"
,
"C类"
),
C_80
(
75
,
"80万意外/10万医疗/扩展24小时(C类)"
,
"C类"
);
A_30
(
12
,
"30万意外/3万医疗/扩展24小时(A类)"
,
"A类"
,
"36968"
,
"63119"
),
A_50
(
15
,
"50万意外/5万医疗/扩展24小时(A类)"
,
"A类"
,
"36969"
,
"63119"
),
A_80
(
18
,
"80万意外/10万医疗/扩展24小时(A类)"
,
"A类"
,
"36970"
,
"63119"
),
A_80_20
(
25
,
"80万意外/20万医疗/扩展24小时(A类)"
,
"A类"
,
"36971"
,
"63119"
),
A_100
(
28
,
"100万意外/10万医疗/扩展24小时(A类)"
,
"A类"
,
"36972"
,
"63119"
),
B_30
(
18
,
"30万意外/3万医疗/扩展24小时(B类)"
,
"B类"
,
"36968"
,
"63120"
),
B_50
(
20
,
"50万意外/5万医疗/扩展24小时(B类)"
,
"B类"
,
"36969"
,
"63120"
),
B_80
(
35
,
"80万意外/10万医疗/扩展24小时(B类)"
,
"B类"
,
"36970"
,
"63120"
),
B_80_20
(
38
,
"80万意外/20万医疗/扩展24小时(B类)"
,
"B类"
,
"36971"
,
"63120"
),
B_100
(
40
,
"100万意外/10万医疗/扩展24小时(B类)"
,
"B类"
,
"36972"
,
"63120"
),
C_50
(
60
,
"50万意外/5万医疗/扩展24小时(C类)"
,
"C类"
,
"36969"
,
"63121"
),
C_80
(
75
,
"80万意外/10万医疗/扩展24小时(C类)"
,
"C类"
,
"36970"
,
"63121"
);
private
Integer
price
;
private
String
name
;
private
String
type
;
private
String
plan
;
private
String
category
;
InsuranceEnum
(
Integer
price
,
String
name
,
String
type
)
{
InsuranceEnum
(
Integer
price
,
String
name
,
String
type
,
String
plan
,
String
category
)
{
this
.
price
=
price
;
this
.
name
=
name
;
this
.
type
=
type
;
this
.
plan
=
plan
;
this
.
category
=
category
;
}
public
Integer
getPrice
()
{
...
...
@@ -55,10 +59,27 @@ public enum InsuranceEnum {
this
.
type
=
type
;
}
public
static
InsuranceEnum
getEnum
(
Integer
value
)
{
public
String
getPlan
()
{
return
plan
;
}
public
void
setPlan
(
String
plan
)
{
this
.
plan
=
plan
;
}
public
String
getCategory
()
{
return
category
;
}
public
void
setCategory
(
String
category
)
{
this
.
category
=
category
;
}
public
static
InsuranceEnum
getEnum
(
String
plan
,
String
category
)
{
for
(
InsuranceEnum
v
:
values
())
if
(
v
.
price
==
value
)
return
v
;
if
(
v
.
getPlan
().
equals
(
plan
)&&
v
.
getCategory
().
equals
(
category
)
)
return
v
;
throw
new
IllegalArgumentException
();
}
}
src/main/java/cn/timer/api/dao/insure/InsureUserMapper.java
View file @
1769b9c9
...
...
@@ -2,6 +2,7 @@ package cn.timer.api.dao.insure;
import
cn.timer.api.bean.insure.InsureUser
;
import
cn.timer.api.bean.yggl.YgglMainEmp
;
import
cn.timer.api.dto.insure.InsureUserDto
;
import
cn.timer.api.dto.insure.PolicyDto
;
import
cn.timer.api.utils.Page
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
...
...
@@ -22,5 +23,8 @@ public interface InsureUserMapper extends BaseMapper<InsureUser> {
List
<
PolicyDto
>
selectPolicyList
(
@Param
(
"policyDto"
)
PolicyDto
policyDto
);
Integer
totalUser
(
@Param
(
"policyDto"
)
PolicyDto
policyDto
);
List
<
InsureUser
>
selectListByIds
(
@Param
(
"array"
)
String
[]
ids
);
List
<
InsureUserDto
>
selectPlansListByIds
(
@Param
(
"array"
)
String
[]
ids
);
List
<
InsureUserDto
>
selectPlansListById
(
@Param
(
"policyId"
)
String
id
);
}
src/main/java/cn/timer/api/dto/insure/InsureDto.java
View file @
1769b9c9
...
...
@@ -5,6 +5,8 @@ import lombok.Builder;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
java.util.List
;
/**
* @Description TODO
...
...
@@ -19,14 +21,17 @@ public class InsureDto {
private
String
id
;
private
String
orgCode
;
/*劳动合同*/
private
String
companyName
;
/*用工单位实际工作单位*/
private
String
[]
userIds
;
private
String
policyDateStart
;
private
String
policyDateEnd
;
private
Integer
type
;
/*类型 1是新增 3是替换*/
private
String
productId
;
private
List
<
PlansDto
>
plans
;
private
String
benefitBasicPlan
;
/*方案名称*/
private
String
benefitOccupationCategory
;
private
String
tricycleFrameNumber
;
private
Integer
type
;
/*类型 1是新增 3是替换*/
private
String
[]
oldIds
;
private
String
productId
;
private
String
[]
userIds
;
private
Double
totalPrice
;
// private String
}
src/main/java/cn/timer/api/dto/insure/InsureUserDto.java
0 → 100644
View file @
1769b9c9
package
cn
.
timer
.
api
.
dto
.
insure
;
import
lombok.Data
;
/**
* @Description TODO
* @Author wgd
* @Date 2022/4/7 17:13
*/
@Data
public
class
InsureUserDto
{
private
Integer
policyId
;
private
String
benefitBasicPlan
;
private
String
benefitOccupationCategory
;
private
Integer
totalUser
;
private
String
[]
oldIds
;
}
src/main/java/cn/timer/api/dto/insure/PlansDto.java
0 → 100644
View file @
1769b9c9
package
cn
.
timer
.
api
.
dto
.
insure
;
import
lombok.Data
;
/**
* @Description TODO
* @Author wgd
* @Date 2022/4/6 9:14
*/
@Data
public
class
PlansDto
{
private
int
index
;
private
String
[]
userIds
;
private
String
benefitBasicPlan
;
/*方案名称*/
private
String
benefitOccupationCategory
;
private
String
tricycleFrameNumber
;
private
Integer
price
;
}
src/main/java/cn/timer/api/dto/insure/PolicyDto.java
View file @
1769b9c9
...
...
@@ -37,4 +37,7 @@ public class PolicyDto {
private
String
benefitOccupationCategory
;
private
Integer
userId
;
private
Integer
insureStatus
;
private
String
planId
;
private
String
categoryId
;
}
src/main/resources/mapping/insure/InsureLogMapper.xml
View file @
1769b9c9
...
...
@@ -172,7 +172,7 @@
</delete>
<select
id=
"selectListById"
resultType=
"cn.timer.api.bean.insure.InsureLog"
>
select id,return_msg,`type`,create_time from insure_log
select id,return_msg,`type`,create_time
,file_url
from insure_log
where policy_id = #{policyId}
ORDER BY create_time DESC
</select>
...
...
src/main/resources/mapping/insure/InsurePolicyMapper.xml
View file @
1769b9c9
...
...
@@ -323,4 +323,5 @@
GROUP BY
ip.id
</select>
</mapper>
src/main/resources/mapping/insure/InsureUserMapper.xml
View file @
1769b9c9
...
...
@@ -279,12 +279,14 @@
<select
id=
"selectPolicyList"
resultType=
"cn.timer.api.dto.insure.PolicyDto"
>
select iu.id,yme.`name`,yme.zj_type,yme.zj_num,iu.policy_no,iu.`status`,ip.scheme_name,iu.policy_date_start,iu.insure_status,
iu.policy_date_end,ip.create_time,iu.insured_name,iu.benefit_basic_plan AS benefitBasicPlan,iu.price AS price,
iu.user_id as userId
iu.user_id as userId
,iu.batch_no as batchNo,iu.benefit_occupation_category as benefitOccupationCategory
from insure_user iu
LEFT JOIN yggl_main_emp yme on yme.id=iu.user_id
LEFT JOIN insure_policy ip on ip.id=iu.policy_id
<where>
ip.id=#{policyDto.id}
and iu.benefit_basic_plan = #{policyDto.planId}
and iu.benefit_occupation_category = #{policyDto.categoryId}
<if
test=
"policyDto.name !=null and policyDto.name !=''"
>
and iu.insured_e_contact like CONCAT('%',#{policyDto.name},'%')
</if>
...
...
@@ -314,6 +316,8 @@
<if
test=
"policyDto.policyDateStart !=null and policyDto.policyDateStart !=''"
>
and iu.policy_date_start
<![CDATA[>=]]>
#{policyDto.policyDateStart}
</if>
and iu.benefit_basic_plan = #{policyDto.planId}
and iu.benefit_occupation_category = #{policyDto.categoryId}
</where>
</select>
...
...
@@ -328,4 +332,29 @@
</foreach>
</select>
<!--根据id数组查询员工-->
<select
id=
"selectPlansListByIds"
resultType=
"cn.timer.api.dto.insure.InsureUserDto"
>
SELECT
policy_id as policyId,
benefit_basic_plan as benefitBasicPlan,
benefit_occupation_category as benefitOccupationCategory,
count(id) as totalUser
FROM insure_user
WHERE id IN
<foreach
item=
"id"
collection=
"array"
open=
"("
separator=
","
close=
")"
>
#{id}
</foreach>
group by benefit_basic_plan,benefit_occupation_category
</select>
<select
id=
"selectPlansListById"
resultType=
"cn.timer.api.dto.insure.InsureUserDto"
>
SELECT
policy_id as policyId,
benefit_basic_plan as benefitBasicPlan,
benefit_occupation_category as benefitOccupationCategory,
count(id) as totalUser
FROM insure_user
WHERE policy_id = #{policyId}
group by benefit_basic_plan,benefit_occupation_category
</select>
</mapper>
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