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
fd7a88f6
Commit
fd7a88f6
authored
Mar 30, 2022
by
翁国栋
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
运营后台--
更改为匹配跨域下载
parent
56fad829
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
22 deletions
+33
-22
src/main/java/cn/timer/api/controller/insure/InsureContorll.java
+33
-22
No files found.
src/main/java/cn/timer/api/controller/insure/InsureContorll.java
View file @
fd7a88f6
...
...
@@ -130,6 +130,10 @@ public class InsureContorll {
@ApiOperation
(
value
=
"1.投保申请"
,
httpMethod
=
"Post"
,
notes
=
"投保申请"
)
@ApiOperationSupport
(
order
=
2
)
public
Result
<
Object
>
insured_add
(
@RequestBody
InsureDto
insureDto
)
throws
ParseException
{
InsurePolicy
insurePolicy
=
InsurePolicy
.
builder
().
build
().
selectOne
(
new
QueryWrapper
<
InsurePolicy
>().
lambda
().
eq
(
InsurePolicy:
:
getOrgCode
,
insureDto
.
getOrgCode
()));
if
(
insurePolicy
!=
null
){
return
ResultUtil
.
error
(
"企业已存在"
);
}
QyzxEntInfoM
qyzxEntInfoM
=
QyzxEntInfoM
.
builder
().
id
(
Integer
.
parseInt
(
insureDto
.
getOrgCode
())).
build
().
selectById
();
// 企业信息
DateTimeFormatter
dtf2
=
DateTimeFormatter
.
ofPattern
(
"yyyyMMddHHmmss"
);
LocalDateTime
now
=
LocalDateTime
.
now
();
...
...
@@ -211,13 +215,16 @@ public class InsureContorll {
Map
dataMap
=
requestAgent
(
bodyMap
);
if
(
dataMap
!=
null
)
{
if
(!
dataMap
.
get
(
"errcode"
).
toString
().
equals
(
"suc"
)){
return
ResultUtil
.
error
(
dataMap
.
get
(
"errmsg"
).
toString
());
}
Object
o
=
dataMap
.
get
(
"data"
);
Map
<
String
,
Object
>
map
=
JSONObject
.
parseObject
(
JSONObject
.
toJSONString
(
o
));
List
<
YgglMainEmp
>
ygglMainEmpList
=
ygglMainEmpMapper
.
selectListByIds
(
insureDto
.
getUserIds
());
Map
policyMap
=
JSONObject
.
parseObject
(
JSONObject
.
toJSONString
(
map
.
get
(
"policy"
)),
Map
.
class
);
Map
batchMap
=
JSONObject
.
parseObject
(
JSONObject
.
toJSONString
(
policyMap
.
get
(
"batch"
)),
Map
.
class
);
ArrayList
<
Map
>
batchMap
=
JSONObject
.
parseObject
(
JSONObject
.
toJSONString
(
policyMap
.
get
(
"batch"
)),
ArrayList
.
class
);
InsureUser
insureUser
;
InsurePolicy
insurePolicy
=
InsurePolicy
.
builder
().
build
();
insurePolicy
=
InsurePolicy
.
builder
().
build
();
insurePolicy
.
setPolicyDateStart
(
dtf3
.
parse
(
insureDto
.
getPolicyDateStart
()));
insurePolicy
.
setPolicyDateEnd
(
dtf3
.
parse
(
insureDto
.
getPolicyDateEnd
()));
insurePolicy
.
setPolicyNo
(
policyMap
.
get
(
"policy_no"
).
toString
());
...
...
@@ -239,7 +246,7 @@ public class InsureContorll {
insureUser
.
setPrice
(
price
.
toString
());
/*前端获取的保费*/
insureUser
.
setTransId
(
"P_"
+
qyzxEntInfoM
.
getId
()
+
"_"
+
dtf2
.
format
(
now
));
insureUser
.
setPremium
(
String
.
valueOf
(
ygglMainEmpList
.
size
()
*
price
));
insureUser
.
setBatchNo
(
batchMap
.
get
(
"batch_no"
).
toString
());
insureUser
.
setBatchNo
(
batchMap
.
get
(
0
).
get
(
"batch_no"
).
toString
());
insureUser
.
setBenefitBasicPlan
(
insureDto
.
getBenefitBasicPlan
());
insureUser
.
setPolicyNo
(
policyMap
.
get
(
"policy_no"
).
toString
());
insureUser
.
setUserId
(
y
.
getId
());
...
...
@@ -254,6 +261,7 @@ public class InsureContorll {
insureUser
.
setPolicyDateEnd
(
dtf3
.
parse
(
insureDto
.
getPolicyDateEnd
()));
insureUser
.
setStatus
(
"1"
);
insureUser
.
setPolicyId
(
insurePolicy
.
getId
());
insureUser
.
setApplyType
(
1
);
y
.
setIsInsure
(
1
);
y
.
insertOrUpdate
();
insureUser
.
insert
();
...
...
@@ -283,7 +291,7 @@ public class InsureContorll {
}
}
return
null
;
return
dataMap
;
}
}
...
...
@@ -507,34 +515,36 @@ public class InsureContorll {
if
(
insurePolicy
==
null
||
StringUtils
.
isNullOrEmpty
(
insurePolicy
.
getPolicyFile
())){
return
;
}
BufferedInputStream
in
=
null
;
OutputStream
o
s
=
null
;
OutputStream
sos
=
null
;
BufferedInputStream
bi
s
=
null
;
try
{
response
.
setContentType
(
"application/octet-stream"
);
response
.
setHeader
(
"content-disposition"
,
"attachment; filename="
+
new
String
((
insurePolicy
.
getPolicyNo
()+
".pdf"
).
getBytes
(
"UTF8"
),
"ISO-8859-1"
));
response
.
setCharacterEncoding
(
"UTF-8"
);
URL
url
=
new
URL
(
insurePolicy
.
getPolicyFile
());
in
=
new
BufferedInputStream
(
url
.
openStream
());
os
=
response
.
getOutputStream
();
int
i
;
while
((
i
=
in
.
read
())
!=
-
1
)
{
os
.
write
(
i
);
sos
=
response
.
getOutputStream
();
String
destUrl
=
insurePolicy
.
getPolicyFile
();
URL
url
=
new
URL
(
destUrl
);
HttpURLConnection
httpUrl
=
(
HttpURLConnection
)
url
.
openConnection
();
//连接指定的网络资源
httpUrl
.
connect
();
//获取网络输入流
bis
=
new
BufferedInputStream
(
httpUrl
.
getInputStream
());
int
b
;
while
((
b
=
bis
.
read
())
!=
-
1
)
{
sos
.
write
(
b
);
}
os
.
flush
();
in
.
close
();
response
.
getOutputStream
();
}
catch
(
MalformedURLException
e
)
{
e
.
printStackTrace
();
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
finally
{
try
{
if
(
in
!=
null
)
{
in
.
close
();
}
if
(
os
!=
null
)
{
os
.
close
();
}
sos
.
close
();
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
try
{
bis
.
close
();
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
...
...
@@ -603,6 +613,7 @@ public class InsureContorll {
.
applicantEmployeeList
(
data
.
get
(
"file_url"
).
toString
())
.
policyDateStart
(
dtf3
.
parse
(
insureDto
.
getPolicyDateStart
()))
.
policyDateEnd
(
dtf3
.
parse
(
insureDto
.
getPolicyDateEnd
()))
.
applyType
(
3
)
.
status
(
"1"
).
insureStatus
(
3
).
policyId
(
insurePolicy
.
getId
()).
build
().
insert
();
}
catch
(
ParseException
e
)
{
e
.
printStackTrace
();
...
...
@@ -755,7 +766,7 @@ public class InsureContorll {
}
@GetMapping
(
value
=
"/isInsured"
)
@ApiOperation
(
value
=
"10.
保单统计列表"
,
httpMethod
=
"Post"
,
notes
=
"保单统计列表
"
)
@ApiOperation
(
value
=
"10.
企业是否已投保"
,
httpMethod
=
"Post"
,
notes
=
"企业是否已投保
"
)
@ApiOperationSupport
(
order
=
2
)
public
Result
<
Object
>
isInsured
(
@RequestParam
(
"orgCode"
)
String
orgCode
)
{
InsurePolicy
insurePolicy
=
InsurePolicy
.
builder
().
build
().
selectOne
(
new
QueryWrapper
<
InsurePolicy
>().
lambda
().
eq
(
InsurePolicy:
:
getOrgCode
,
orgCode
));
...
...
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