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
dc0adaec
Commit
dc0adaec
authored
3 years ago
by
翁国栋
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
运营后台--
一键校验
parent
363ec83e
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
68 additions
and
35 deletions
+68
-35
src/main/java/cn/timer/api/controller/insure/InsureContorll.java
+59
-35
src/main/java/cn/timer/api/dao/insure/InsureLogMapper.java
+1
-0
src/main/resources/mapping/insure/InsureLogMapper.xml
+8
-0
No files found.
src/main/java/cn/timer/api/controller/insure/InsureContorll.java
View file @
dc0adaec
...
@@ -7,6 +7,7 @@ import cn.timer.api.config.annotation.CurrentUser;
...
@@ -7,6 +7,7 @@ import cn.timer.api.config.annotation.CurrentUser;
import
cn.timer.api.config.annotation.UserBean
;
import
cn.timer.api.config.annotation.UserBean
;
import
cn.timer.api.controller.insure.bean.ExcelBean
;
import
cn.timer.api.controller.insure.bean.ExcelBean
;
import
cn.timer.api.controller.insure.enums.InsuranceEnum
;
import
cn.timer.api.controller.insure.enums.InsuranceEnum
;
import
cn.timer.api.dao.insure.InsureLogMapper
;
import
cn.timer.api.dao.insure.InsurePolicyMapper
;
import
cn.timer.api.dao.insure.InsurePolicyMapper
;
import
cn.timer.api.dao.insure.InsureUserMapper
;
import
cn.timer.api.dao.insure.InsureUserMapper
;
import
cn.timer.api.dao.yggl.YgglMainEmpMapper
;
import
cn.timer.api.dao.yggl.YgglMainEmpMapper
;
...
@@ -97,6 +98,9 @@ public class InsureContorll {
...
@@ -97,6 +98,9 @@ public class InsureContorll {
@Autowired
@Autowired
private
InsurePolicyMapper
insurePolicyMapper
;
private
InsurePolicyMapper
insurePolicyMapper
;
@Autowired
private
InsureLogMapper
insureLogMapper
;
/**
/**
* 设置请求参数
* 设置请求参数
...
@@ -223,11 +227,13 @@ public class InsureContorll {
...
@@ -223,11 +227,13 @@ public class InsureContorll {
quotationsArry
.
add
(
quotations
);
quotationsArry
.
add
(
quotations
);
bodyMap
.
put
(
"quotations"
,
quotationsArry
);
bodyMap
.
put
(
"quotations"
,
quotationsArry
);
log
.
info
(
JSONObject
.
toJSONString
(
bodyMap
));
log
.
info
(
JSONObject
.
toJSONString
(
bodyMap
));
Map
dataMap
=
requestAgent
(
bodyMap
);
String
data
=
HttpUtils
.
sendPost
(
insuredUrl
,
setParams
(
JSONObject
.
toJSONString
(
bodyMap
),
appid
,
secret
),
bodyMap
);
Map
policyMap
=
Maps
.
newHashMap
();
Map
dataMap
=
JSONObject
.
parseObject
(
data
,
Map
.
class
);
List
<
Map
>
batchMap
=
Lists
.
newArrayList
();
if
(
dataMap
!=
null
)
{
if
(
dataMap
!=
null
)
{
if
(
dataMap
.
get
(
"errcode"
).
toString
().
equals
(
"suc"
)){
if
((
dataMap
.
get
(
"errcode"
).
toString
().
equals
(
"suc"
))
||
(
dataMap
.
get
(
"errcode"
).
toString
().
equals
(
"e25"
)))
{
Map
policyMap
=
Maps
.
newHashMap
();
List
<
Map
>
batchMap
=
Lists
.
newArrayList
();
if
(
dataMap
.
get
(
"errcode"
).
toString
().
equals
(
"suc"
))
{
Object
o
=
dataMap
.
get
(
"data"
);
Object
o
=
dataMap
.
get
(
"data"
);
Map
<
String
,
Object
>
map
=
JSONObject
.
parseObject
(
JSONObject
.
toJSONString
(
o
));
Map
<
String
,
Object
>
map
=
JSONObject
.
parseObject
(
JSONObject
.
toJSONString
(
o
));
policyMap
=
JSONObject
.
parseObject
(
JSONObject
.
toJSONString
(
map
.
get
(
"policy"
)),
Map
.
class
);
policyMap
=
JSONObject
.
parseObject
(
JSONObject
.
toJSONString
(
map
.
get
(
"policy"
)),
Map
.
class
);
...
@@ -237,16 +243,16 @@ public class InsureContorll {
...
@@ -237,16 +243,16 @@ public class InsureContorll {
insurePolicy
=
InsurePolicy
.
builder
().
build
();
insurePolicy
=
InsurePolicy
.
builder
().
build
();
insurePolicy
.
setPolicyDateStart
(
dtf3
.
parse
(
insureDto
.
getPolicyDateStart
()));
insurePolicy
.
setPolicyDateStart
(
dtf3
.
parse
(
insureDto
.
getPolicyDateStart
()));
insurePolicy
.
setPolicyDateEnd
(
dtf3
.
parse
(
insureDto
.
getPolicyDateEnd
()));
insurePolicy
.
setPolicyDateEnd
(
dtf3
.
parse
(
insureDto
.
getPolicyDateEnd
()));
if
(
dataMap
.
get
(
"errcode"
).
toString
().
equals
(
"suc"
))
{
if
(
dataMap
.
get
(
"errcode"
).
toString
().
equals
(
"suc"
))
{
insurePolicy
.
setPolicyNo
(
policyMap
.
get
(
"policy_no"
).
toString
());
insurePolicy
.
setPolicyNo
(
policyMap
.
get
(
"policy_no"
).
toString
());
insurePolicy
.
setPolicyFile
(
policyMap
.
get
(
"policy_file"
).
toString
());
insurePolicy
.
setPolicyFile
(
policyMap
.
get
(
"policy_file"
).
toString
());
insurePolicy
.
setKitUrl
(
policyMap
.
get
(
"kit_url"
).
toString
());
insurePolicy
.
setKitUrl
(
policyMap
.
get
(
"kit_url"
).
toString
());
}
}
insurePolicy
.
setType
(
2
);
/*年单或者月单*/
insurePolicy
.
setType
(
2
);
/*年单或者月单*/
insurePolicy
.
setCurrency
(
"5"
);
insurePolicy
.
setCurrency
(
"5"
);
if
(
dataMap
.
get
(
"errcode"
).
toString
().
equals
(
"suc"
))
{
if
(
dataMap
.
get
(
"errcode"
).
toString
().
equals
(
"suc"
))
{
insurePolicy
.
setStatus
(
"1"
);
insurePolicy
.
setStatus
(
"1"
);
}
else
{
}
else
{
insurePolicy
.
setStatus
(
"2"
);
insurePolicy
.
setStatus
(
"2"
);
}
}
insurePolicy
.
setOrgCode
(
qyzxEntInfoM
.
getId
());
insurePolicy
.
setOrgCode
(
qyzxEntInfoM
.
getId
());
...
@@ -267,7 +273,7 @@ public class InsureContorll {
...
@@ -267,7 +273,7 @@ public class InsureContorll {
insureUser
.
setPrice
(
price
.
toString
());
/*前端获取的保费*/
insureUser
.
setPrice
(
price
.
toString
());
/*前端获取的保费*/
insureUser
.
setTransId
(
"P_"
+
qyzxEntInfoM
.
getId
()
+
"_"
+
dtf2
.
format
(
now
));
insureUser
.
setTransId
(
"P_"
+
qyzxEntInfoM
.
getId
()
+
"_"
+
dtf2
.
format
(
now
));
insureUser
.
setPremium
(
String
.
valueOf
(
ygglMainEmpList
.
size
()
*
price
));
insureUser
.
setPremium
(
String
.
valueOf
(
ygglMainEmpList
.
size
()
*
price
));
if
(
dataMap
.
get
(
"errcode"
).
toString
().
equals
(
"suc"
))
{
if
(
dataMap
.
get
(
"errcode"
).
toString
().
equals
(
"suc"
))
{
insureUser
.
setBatchNo
(
batchMap
.
get
(
0
).
get
(
"batch_no"
).
toString
());
insureUser
.
setBatchNo
(
batchMap
.
get
(
0
).
get
(
"batch_no"
).
toString
());
insureUser
.
setPolicyNo
(
policyMap
.
get
(
"policy_no"
).
toString
());
insureUser
.
setPolicyNo
(
policyMap
.
get
(
"policy_no"
).
toString
());
}
}
...
@@ -279,50 +285,30 @@ public class InsureContorll {
...
@@ -279,50 +285,30 @@ public class InsureContorll {
insureUser
.
setInsuredNo
(
y
.
getZjNum
());
insureUser
.
setInsuredNo
(
y
.
getZjNum
());
insureUser
.
setInsuredEContact
(
y
.
getName
());
insureUser
.
setInsuredEContact
(
y
.
getName
());
insureUser
.
setApplicantEmployeeList
(
url
);
insureUser
.
setApplicantEmployeeList
(
url
);
if
(
dataMap
.
get
(
"errcode"
).
toString
().
equals
(
"suc"
))
{
if
(
dataMap
.
get
(
"errcode"
).
toString
().
equals
(
"suc"
))
{
insureUser
.
setInsureStatus
(
1
);
insureUser
.
setInsureStatus
(
1
);
insureUser
.
setStatus
(
"1"
);
insureUser
.
setStatus
(
"1"
);
}
else
{
}
else
{
insureUser
.
setInsureStatus
(
2
);
insureUser
.
setInsureStatus
(
3
);
insureUser
.
setStatus
(
"2"
);
insureUser
.
setStatus
(
"2"
);
}
}
insureUser
.
setPolicyDateStart
(
dtf3
.
parse
(
insureDto
.
getPolicyDateStart
()));
insureUser
.
setPolicyDateStart
(
dtf3
.
parse
(
insureDto
.
getPolicyDateStart
()));
insureUser
.
setPolicyDateEnd
(
dtf3
.
parse
(
insureDto
.
getPolicyDateEnd
()));
insureUser
.
setPolicyDateEnd
(
dtf3
.
parse
(
insureDto
.
getPolicyDateEnd
()));
insureUser
.
setPolicyId
(
insurePolicy
.
getId
());
insureUser
.
setPolicyId
(
insurePolicy
.
getId
());
insureUser
.
setApplyType
(
1
);
insureUser
.
setApplyType
(
2
);
//投保类型
insureUser
.
insert
();
insureUser
.
insert
();
if
(
dataMap
.
get
(
"errcode"
).
toString
().
equals
(
"suc"
))
{
if
(
dataMap
.
get
(
"errcode"
).
toString
().
equals
(
"suc"
))
{
y
.
setIsInsure
(
1
);
y
.
setIsInsure
(
1
);
y
.
insertOrUpdate
();
y
.
insertOrUpdate
();
}
}
}
}
return
ResultUtil
.
error
(
"投保成功"
);
}
}
return
ResultUtil
.
error
(
dataMap
.
get
(
"errmsg"
).
toString
());
return
ResultUtil
.
success
(
dataMap
.
get
(
"errmsg"
).
toString
());
}
/*测试用生产环境不需要*/
synchronized
private
Map
requestAgent
(
Map
bodyMap
)
{
String
data
=
HttpUtils
.
sendPost
(
insuredUrl
,
setParams
(
JSONObject
.
toJSONString
(
bodyMap
),
appid
,
secret
),
bodyMap
);
Map
dataMap
=
JSONObject
.
parseObject
(
data
,
Map
.
class
);
if
(
dataMap
.
get
(
"errcode"
).
toString
().
equals
(
"suc"
))
{
return
dataMap
;
}
else
{
if
(
dataMap
.
get
(
"errcode"
).
toString
().
equals
(
"e25"
)
&&
(
dataMap
.
get
(
"errmsg"
).
toString
().
equals
(
"出单中"
)))
{
try
{
Thread
.
sleep
(
30000
);
return
requestAgent
(
bodyMap
);
}
catch
(
InterruptedException
e
)
{
e
.
printStackTrace
();
}
}
return
ResultUtil
.
error
(
"网络异常"
);
}
}
return
dataMap
;
}
}
/**
/**
* 生成投保问文件
* 生成投保问文件
...
@@ -801,4 +787,42 @@ public class InsureContorll {
...
@@ -801,4 +787,42 @@ public class InsureContorll {
}
}
return
ResultUtil
.
success
();
return
ResultUtil
.
success
();
}
}
@GetMapping
(
value
=
"/verification"
)
@ApiOperation
(
value
=
"一键校验"
,
httpMethod
=
"Post"
,
notes
=
"一键校验"
)
public
Result
<
Object
>
verification
()
{
List
<
InsurePolicy
>
insurePolicies
=
InsurePolicy
.
builder
().
build
().
selectList
(
new
QueryWrapper
<
InsurePolicy
>().
lambda
().
eq
(
InsurePolicy:
:
getStatus
,
2
));
insurePolicies
.
forEach
(
i
->{
InsureLog
insureLog
=
InsureLog
.
builder
().
build
().
selectOne
(
new
QueryWrapper
<
InsureLog
>().
lambda
().
eq
(
InsureLog:
:
getPolicyId
,
i
.
getId
()).
eq
(
InsureLog:
:
getType
,
1
));
Map
bodyMap
=
JSONObject
.
parseObject
(
insureLog
.
getRequestData
(),
Map
.
class
);
String
data
=
HttpUtils
.
sendPost
(
insuredUrl
,
setParams
(
JSONObject
.
toJSONString
(
bodyMap
),
appid
,
secret
),
bodyMap
);
log
.
info
(
"校验结果:{}"
,
data
);
Map
dataMap
=
JSONObject
.
parseObject
(
data
,
Map
.
class
);
if
(
dataMap
!=
null
)
{
if
((
dataMap
.
get
(
"errcode"
).
toString
().
equals
(
"suc"
)))
{
Object
o
=
dataMap
.
get
(
"data"
);
Map
<
String
,
Object
>
map
=
JSONObject
.
parseObject
(
JSONObject
.
toJSONString
(
o
));
Map
policyMap
=
JSONObject
.
parseObject
(
JSONObject
.
toJSONString
(
map
.
get
(
"policy"
)),
Map
.
class
);
i
.
setPolicyNo
(
policyMap
.
get
(
"policy_no"
).
toString
());
i
.
setPolicyFile
(
policyMap
.
get
(
"policy_file"
).
toString
());
i
.
setKitUrl
(
policyMap
.
get
(
"kit_url"
).
toString
());
i
.
setStatus
(
"1"
);
i
.
updateById
();
/*批次信息*/
List
<
Map
>
batchMap
=
JSONObject
.
parseObject
(
JSONObject
.
toJSONString
(
policyMap
.
get
(
"batch"
)),
List
.
class
);
List
<
InsureUser
>
insureUserList
=
InsureUser
.
builder
().
build
().
selectList
(
new
QueryWrapper
<
InsureUser
>().
lambda
().
eq
(
InsureUser:
:
getPolicyId
,
i
.
getId
())
.
eq
(
InsureUser:
:
getType
,
2
));
insureUserList
.
forEach
(
user
->{
user
.
setBatchNo
(
batchMap
.
get
(
0
).
get
(
"batch_no"
).
toString
());
user
.
setPolicyNo
(
policyMap
.
get
(
"policy_no"
).
toString
());
user
.
setInsureStatus
(
1
);
user
.
setStatus
(
"1"
);
user
.
updateById
();
YgglMainEmp
.
builder
().
isInsure
(
1
).
build
().
update
(
new
QueryWrapper
<
YgglMainEmp
>().
lambda
().
eq
(
YgglMainEmp:
:
getId
,
user
.
getUserId
()));
});
}
}
});
return
ResultUtil
.
success
();
};
}
}
This diff is collapsed.
Click to expand it.
src/main/java/cn/timer/api/dao/insure/InsureLogMapper.java
View file @
dc0adaec
...
@@ -18,5 +18,6 @@ import java.util.List;
...
@@ -18,5 +18,6 @@ import java.util.List;
@Repository
@Repository
public
interface
InsureLogMapper
extends
BaseMapper
<
InsureLog
>
{
public
interface
InsureLogMapper
extends
BaseMapper
<
InsureLog
>
{
List
<
InsureLog
>
selectListById
(
@Param
(
"policyId"
)
String
policyId
);
List
<
InsureLog
>
selectListById
(
@Param
(
"policyId"
)
String
policyId
);
List
<
InsureLog
>
selectListByIds
(
@Param
(
"array"
)
Integer
[]
ids
);
}
}
This diff is collapsed.
Click to expand it.
src/main/resources/mapping/insure/InsureLogMapper.xml
View file @
dc0adaec
...
@@ -176,4 +176,12 @@
...
@@ -176,4 +176,12 @@
where policy_id = #{policyId}
where policy_id = #{policyId}
ORDER BY create_time DESC
ORDER BY create_time DESC
</select>
</select>
<select
id=
"selectListByIds"
resultType=
"cn.timer.api.bean.insure.InsureLog"
>
select * from insure_log
where type = 1 and policy_id in
<foreach
item=
"id"
collection=
"array"
open=
"("
separator=
","
close=
")"
>
#{id}
</foreach>
</select>
</mapper>
</mapper>
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