Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
B
browser-backend
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
Administrator
browser-backend
Commits
5a4e4c3e
Commit
5a4e4c3e
authored
Mar 30, 2020
by
renjie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
企业认证照片正反面
parent
9ec882e0
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
269 additions
and
81 deletions
+269
-81
AccountController.java
.../browserbackend/account/controller/AccountController.java
+53
-10
CompanyAuthorize.java
...edgec/browserbackend/account/domain/CompanyAuthorize.java
+57
-27
CompanyAuthorizeDto.java
...edgec/browserbackend/account/dto/CompanyAuthorizeDto.java
+42
-15
AccountServiceImpl.java
...owserbackend/account/service/impl/AccountServiceImpl.java
+51
-29
AlipayConfig.java
...in/java/com/edgec/browserbackend/alipay/AlipayConfig.java
+2
-0
AlipaySubmit.java
...in/java/com/edgec/browserbackend/alipay/AlipaySubmit.java
+64
-0
No files found.
src/main/java/com/edgec/browserbackend/account/controller/AccountController.java
View file @
5a4e4c3e
...
@@ -2,6 +2,9 @@ package com.edgec.browserbackend.account.controller;
...
@@ -2,6 +2,9 @@ package com.edgec.browserbackend.account.controller;
import
com.edgec.browserbackend.account.domain.*
;
import
com.edgec.browserbackend.account.domain.*
;
import
com.edgec.browserbackend.account.dto.*
;
import
com.edgec.browserbackend.account.dto.*
;
import
com.edgec.browserbackend.alipay.AlipayConfig
;
import
com.edgec.browserbackend.alipay.AlipaySubmit
;
import
com.edgec.browserbackend.alipay.VpsAlipayConfig
;
import
com.edgec.browserbackend.browser.ErrorCode.BrowserErrorCode
;
import
com.edgec.browserbackend.browser.ErrorCode.BrowserErrorCode
;
import
com.edgec.browserbackend.common.auth.Securitys
;
import
com.edgec.browserbackend.common.auth.Securitys
;
import
com.edgec.browserbackend.common.commons.error.ClientRequestException
;
import
com.edgec.browserbackend.common.commons.error.ClientRequestException
;
...
@@ -405,12 +408,15 @@ public class AccountController {
...
@@ -405,12 +408,15 @@ public class AccountController {
@RequestParam
(
value
=
"type"
,
defaultValue
=
"0"
)
int
type
,
@RequestParam
(
value
=
"type"
,
defaultValue
=
"0"
)
int
type
,
@RequestParam
(
value
=
"companyName"
)
String
companyName
,
@RequestParam
(
value
=
"companyName"
)
String
companyName
,
@RequestParam
(
value
=
"registerNumber"
)
String
registerNumber
,
@RequestParam
(
value
=
"registerNumber"
)
String
registerNumber
,
@RequestParam
(
value
=
"companyLicense"
)
MultipartFile
companyLicense
,
@RequestParam
(
value
=
"companyLicense_front"
)
MultipartFile
companyLicense_front
,
@RequestParam
(
value
=
"companyLicense_back"
)
MultipartFile
companyLicense_back
,
@RequestParam
(
value
=
"coporationPlace"
)
String
coporationPlace
,
@RequestParam
(
value
=
"coporationPlace"
)
String
coporationPlace
,
@RequestParam
(
value
=
"coporationLicense"
)
MultipartFile
coporationLicense
,
@RequestParam
(
value
=
"coporationLicense_front"
)
MultipartFile
coporationLicense_front
,
@RequestParam
(
value
=
"coporationLicense_back"
)
MultipartFile
coporationLicense_back
,
@RequestParam
(
value
=
"realController"
,
defaultValue
=
"0"
)
int
realController
,
@RequestParam
(
value
=
"realController"
,
defaultValue
=
"0"
)
int
realController
,
@RequestParam
(
value
=
"writePerson"
,
defaultValue
=
"0"
)
int
writePerson
,
@RequestParam
(
value
=
"writePerson"
,
defaultValue
=
"0"
)
int
writePerson
,
@RequestParam
(
value
=
"agency"
,
required
=
false
)
MultipartFile
agency
)
{
@RequestParam
(
value
=
"agency_front"
,
required
=
false
)
MultipartFile
agency_front
,
@RequestParam
(
value
=
"agency_back"
,
required
=
false
)
MultipartFile
agency_back
)
{
ResultDto
resultDto
=
new
ResultDto
();
ResultDto
resultDto
=
new
ResultDto
();
try
{
try
{
CompanyAuthorizeDto
companyAuthorizeDto
=
new
CompanyAuthorizeDto
();
CompanyAuthorizeDto
companyAuthorizeDto
=
new
CompanyAuthorizeDto
();
...
@@ -418,19 +424,23 @@ public class AccountController {
...
@@ -418,19 +424,23 @@ public class AccountController {
companyAuthorizeDto
.
setType
(
type
);
companyAuthorizeDto
.
setType
(
type
);
companyAuthorizeDto
.
setCompanyName
(
companyName
);
companyAuthorizeDto
.
setCompanyName
(
companyName
);
companyAuthorizeDto
.
setRegisterNumber
(
registerNumber
);
companyAuthorizeDto
.
setRegisterNumber
(
registerNumber
);
if
(
companyLicense
==
null
)
if
(
companyLicense
_front
==
null
||
companyLicense_back
==
null
)
throw
new
ClientRequestException
(
BrowserErrorCode
.
INFORMATIONNOTCOMPELETE
);
throw
new
ClientRequestException
(
BrowserErrorCode
.
INFORMATIONNOTCOMPELETE
);
companyAuthorizeDto
.
setCompanyLicense
(
companyLicense
);
companyAuthorizeDto
.
setCompanyLicense_front
(
companyLicense_front
);
companyAuthorizeDto
.
setCompanyLicense_back
(
companyLicense_back
);
companyAuthorizeDto
.
setCoporationPlace
(
coporationPlace
);
companyAuthorizeDto
.
setCoporationPlace
(
coporationPlace
);
if
(
coporationLicense
==
null
)
if
(
coporationLicense
_front
==
null
||
coporationLicense_back
==
null
)
throw
new
ClientRequestException
(
BrowserErrorCode
.
INFORMATIONNOTCOMPELETE
);
throw
new
ClientRequestException
(
BrowserErrorCode
.
INFORMATIONNOTCOMPELETE
);
companyAuthorizeDto
.
setCoporationLicense
(
coporationLicense
);
companyAuthorizeDto
.
setCoporationLicense_front
(
coporationLicense_front
);
companyAuthorizeDto
.
setCoporationLicense_back
(
coporationLicense_back
);
companyAuthorizeDto
.
setRealController
(
realController
);
companyAuthorizeDto
.
setRealController
(
realController
);
companyAuthorizeDto
.
setWritePerson
(
writePerson
);
companyAuthorizeDto
.
setWritePerson
(
writePerson
);
if
(
agency
!=
null
)
if
(
writePerson
==
1
&&
(
agency_back
==
null
||
agency_back
==
null
))
companyAuthorizeDto
.
setAgency
(
agency
);
if
(
writePerson
==
1
&&
agency
==
null
)
throw
new
ClientRequestException
(
BrowserErrorCode
.
INFORMATIONNOTCOMPELETE
);
throw
new
ClientRequestException
(
BrowserErrorCode
.
INFORMATIONNOTCOMPELETE
);
if
(
agency_front
!=
null
&&
agency_back
!=
null
)
{
companyAuthorizeDto
.
setAgency_front
(
agency_front
);
companyAuthorizeDto
.
setAgency_back
(
agency_back
);
}
accountService
.
authorizeCompany
(
principal
.
getName
(),
companyAuthorizeDto
);
accountService
.
authorizeCompany
(
principal
.
getName
(),
companyAuthorizeDto
);
resultDto
.
setStatus
(
0
);
resultDto
.
setStatus
(
0
);
}
catch
(
ClientRequestException
e
)
{
}
catch
(
ClientRequestException
e
)
{
...
@@ -492,4 +502,37 @@ public class AccountController {
...
@@ -492,4 +502,37 @@ public class AccountController {
return
resultDto
;
return
resultDto
;
}
}
@RequestMapping
(
path
=
"/alipay/login"
)
public
String
save
(
HttpServletRequest
request
,
HttpServletResponse
response
)
{
Map
<
String
,
String
>
maps
=
new
HashMap
<
String
,
String
>();
//页面回调地址 必须与应用中的设置一样
String
return_url
=
"http://localhost/alipay/withdraw"
;
//回调地址必须经encode
return_url
=
java
.
net
.
URLEncoder
.
encode
(
return_url
);
//重定向到授权页面
AlipayConfig
alipayConfig
=
new
VpsAlipayConfig
();
return
"redirect:"
+
VpsAlipayConfig
.
ALIPAY_AUTH_URL
+
"?app_id="
+
alipayConfig
.
getAPPID
()
+
"&scope=auth_user&redirect_uri="
+
return_url
;
}
@RequestMapping
(
path
=
"/alipay/withdraw"
)
public
void
alipayWithdraw
(
HttpServletRequest
request
,
HttpServletResponse
response
)
{
//获取支付宝GET过来反馈信息
Map
<
String
,
String
>
params
=
new
HashMap
<
String
,
String
>();
Map
requestParams
=
request
.
getParameterMap
();
for
(
Iterator
iter
=
requestParams
.
keySet
().
iterator
();
iter
.
hasNext
();)
{
String
name
=
(
String
)
iter
.
next
();
String
[]
values
=
(
String
[])
requestParams
.
get
(
name
);
String
valueStr
=
""
;
for
(
int
i
=
0
;
i
<
values
.
length
;
i
++)
{
valueStr
=
(
i
==
(
values
.
length
-
1
))
?
valueStr
+
values
[
i
]:
valueStr
+
values
[
i
]
+
","
;
}
params
.
put
(
name
,
valueStr
);
}
String
accessToken
=
AlipaySubmit
.
buildRequest
(
params
);
if
(
accessToken
!=
null
&&
accessToken
!=
""
){
String
imf
=
AlipaySubmit
.
get
(
accessToken
);
System
.
out
.
println
(
imf
);
}
}
}
}
src/main/java/com/edgec/browserbackend/account/domain/CompanyAuthorize.java
View file @
5a4e4c3e
...
@@ -12,14 +12,17 @@ public class CompanyAuthorize {
...
@@ -12,14 +12,17 @@ public class CompanyAuthorize {
private
int
type
;
//0 -- 企业, 1 -- 个体工商户
private
int
type
;
//0 -- 企业, 1 -- 个体工商户
private
String
companyName
;
private
String
companyName
;
private
String
registerNumber
;
private
String
registerNumber
;
private
String
companyLicenseId
;
private
String
companyLicenseFront
;
private
String
companyLicenseBack
;
private
String
coporationPlace
;
private
String
coporationPlace
;
private
String
coporationLicenseId
;
private
String
coporationLicenseFront
;
private
String
coporationLicenseBack
;
private
int
realController
;
//0 -- 法定代表人, 1 -- 非法定代表人
private
int
realController
;
//0 -- 法定代表人, 1 -- 非法定代表人
private
int
writePerson
;
//0 -- 法定代表人, 1 -- 代理人
private
int
writePerson
;
//0 -- 法定代表人, 1 -- 代理人
private
String
agencyId
;
private
String
agencyFront
;
private
String
agencyBack
;
public
CompanyAuthorize
()
{
public
CompanyAuthorize
()
{
...
@@ -73,33 +76,15 @@ public class CompanyAuthorize {
...
@@ -73,33 +76,15 @@ public class CompanyAuthorize {
return
realController
;
return
realController
;
}
}
public
void
setAgencyId
(
String
agencyId
)
{
this
.
agencyId
=
agencyId
;
}
public
int
getWritePerson
()
{
public
int
getWritePerson
()
{
return
writePerson
;
return
writePerson
;
}
}
public
void
setCoporationLicenseId
(
String
coporationLicenseId
)
{
this
.
coporationLicenseId
=
coporationLicenseId
;
}
public
String
getAgencyId
()
{
return
agencyId
;
}
public
void
setCoporationPlace
(
String
coporationPlace
)
{
public
void
setCoporationPlace
(
String
coporationPlace
)
{
this
.
coporationPlace
=
coporationPlace
;
this
.
coporationPlace
=
coporationPlace
;
}
}
public
String
getCoporationLicenseId
()
{
return
coporationLicenseId
;
}
public
String
getCompanyLicenseId
()
{
return
companyLicenseId
;
}
public
String
getCoporationPlace
()
{
public
String
getCoporationPlace
()
{
return
coporationPlace
;
return
coporationPlace
;
...
@@ -109,19 +94,64 @@ public class CompanyAuthorize {
...
@@ -109,19 +94,64 @@ public class CompanyAuthorize {
this
.
realController
=
realController
;
this
.
realController
=
realController
;
}
}
public
void
setCompanyLicenseId
(
String
companyLicenseId
)
{
public
void
setRegisterNumber
(
String
registerNumber
)
{
this
.
companyLicenseId
=
companyLicenseId
;
this
.
registerNumber
=
registerNumber
;
}
public
void
setWritePerson
(
int
writePerson
)
{
this
.
writePerson
=
writePerson
;
}
}
public
String
getRegisterNumber
()
{
public
String
getRegisterNumber
()
{
return
registerNumber
;
return
registerNumber
;
}
}
public
void
setRegisterNumber
(
String
registerNumber
)
{
public
String
getAgencyBack
(
)
{
this
.
registerNumber
=
registerNumber
;
return
agencyBack
;
}
}
public
void
setWritePerson
(
int
writePerson
)
{
public
void
setAgencyBack
(
String
agencyBack
)
{
this
.
writePerson
=
writePerson
;
this
.
agencyBack
=
agencyBack
;
}
public
String
getAgencyFront
()
{
return
agencyFront
;
}
public
void
setAgencyFront
(
String
agencyFront
)
{
this
.
agencyFront
=
agencyFront
;
}
public
String
getCompanyLicenseBack
()
{
return
companyLicenseBack
;
}
public
void
setCompanyLicenseBack
(
String
companyLicenseBack
)
{
this
.
companyLicenseBack
=
companyLicenseBack
;
}
public
String
getCompanyLicenseFront
()
{
return
companyLicenseFront
;
}
public
void
setCompanyLicenseFront
(
String
companyLicenseFront
)
{
this
.
companyLicenseFront
=
companyLicenseFront
;
}
public
String
getCoporationLicenseBack
()
{
return
coporationLicenseBack
;
}
public
void
setCoporationLicenseBack
(
String
coporationLicenseBack
)
{
this
.
coporationLicenseBack
=
coporationLicenseBack
;
}
public
String
getCoporationLicenseFront
()
{
return
coporationLicenseFront
;
}
public
void
setCoporationLicenseFront
(
String
coporationLicenseFront
)
{
this
.
coporationLicenseFront
=
coporationLicenseFront
;
}
}
}
}
src/main/java/com/edgec/browserbackend/account/dto/CompanyAuthorizeDto.java
View file @
5a4e4c3e
...
@@ -11,14 +11,17 @@ public class CompanyAuthorizeDto {
...
@@ -11,14 +11,17 @@ public class CompanyAuthorizeDto {
private
int
type
;
//0 -- 企业, 1 -- 个体工商户
private
int
type
;
//0 -- 企业, 1 -- 个体工商户
private
String
companyName
;
private
String
companyName
;
private
String
registerNumber
;
private
String
registerNumber
;
private
MultipartFile
companyLicense
;
private
MultipartFile
companyLicense_front
;
private
MultipartFile
companyLicense_back
;
private
String
coporationPlace
;
private
String
coporationPlace
;
private
MultipartFile
coporationLicense
;
private
MultipartFile
coporationLicense_front
;
private
MultipartFile
coporationLicense_back
;
private
int
realController
;
//0 -- 法定代表人, 1 -- 非法定代表人
private
int
realController
;
//0 -- 法定代表人, 1 -- 非法定代表人
private
int
writePerson
;
//0 -- 法定代表人, 1 -- 代理人
private
int
writePerson
;
//0 -- 法定代表人, 1 -- 代理人
private
MultipartFile
agency
;
private
MultipartFile
agency_front
;
private
MultipartFile
agency_back
;
public
CompanyAuthorizeDto
()
{
public
CompanyAuthorizeDto
()
{
...
@@ -92,27 +95,51 @@ public class CompanyAuthorizeDto {
...
@@ -92,27 +95,51 @@ public class CompanyAuthorizeDto {
this
.
type
=
type
;
this
.
type
=
type
;
}
}
public
MultipartFile
getAgency
()
{
public
MultipartFile
getAgency
_back
()
{
return
agency
;
return
agency
_back
;
}
}
public
void
setAgency
(
MultipartFile
agency
)
{
public
void
setAgency
_back
(
MultipartFile
agency_back
)
{
this
.
agency
=
agency
;
this
.
agency
_back
=
agency_back
;
}
}
public
MultipartFile
get
CoporationLicense
()
{
public
MultipartFile
get
Agency_front
()
{
return
coporationLicense
;
return
agency_front
;
}
}
public
void
set
CoporationLicense
(
MultipartFile
coporationLicense
)
{
public
void
set
Agency_front
(
MultipartFile
agency_front
)
{
this
.
coporationLicense
=
coporationLicense
;
this
.
agency_front
=
agency_front
;
}
}
public
MultipartFile
getCompanyLicense
()
{
public
MultipartFile
getCompanyLicense
_back
()
{
return
companyLicense
;
return
companyLicense
_back
;
}
}
public
void
setCompanyLicense
(
MultipartFile
companyLicense
)
{
public
void
setCompanyLicense_back
(
MultipartFile
companyLicense_back
)
{
this
.
companyLicense
=
companyLicense
;
this
.
companyLicense_back
=
companyLicense_back
;
}
public
MultipartFile
getCompanyLicense_front
()
{
return
companyLicense_front
;
}
public
void
setCompanyLicense_front
(
MultipartFile
companyLicense_front
)
{
this
.
companyLicense_front
=
companyLicense_front
;
}
public
MultipartFile
getCoporationLicense_front
()
{
return
coporationLicense_front
;
}
public
void
setCoporationLicense_front
(
MultipartFile
coporationLicense_front
)
{
this
.
coporationLicense_front
=
coporationLicense_front
;
}
public
MultipartFile
getCoporationLicense_back
()
{
return
coporationLicense_back
;
}
public
void
setCoporationLicense_back
(
MultipartFile
coporationLicense_back
)
{
this
.
coporationLicense_back
=
coporationLicense_back
;
}
}
}
}
src/main/java/com/edgec/browserbackend/account/service/impl/AccountServiceImpl.java
View file @
5a4e4c3e
...
@@ -1047,9 +1047,12 @@ public class AccountServiceImpl implements AccountService {
...
@@ -1047,9 +1047,12 @@ public class AccountServiceImpl implements AccountService {
@Override
@Override
public
void
authorizeCompany
(
String
username
,
CompanyAuthorizeDto
companyAuthorizeDto
)
{
public
void
authorizeCompany
(
String
username
,
CompanyAuthorizeDto
companyAuthorizeDto
)
{
String
companyLicenseId
=
null
;
String
companyLicenseFront
=
null
;
String
coporationLicenseId
=
null
;
String
companyLicenseBack
=
null
;
String
agencyId
=
null
;
String
coporationLicenseFront
=
null
;
String
coporationLicenseBack
=
null
;
String
agencyFront
=
null
;
String
agencyBack
=
null
;
CompanyAuthorize
existing
=
companyAuthorizeRepository
.
findByUsername
(
username
);
CompanyAuthorize
existing
=
companyAuthorizeRepository
.
findByUsername
(
username
);
if
(
existing
!=
null
)
{
if
(
existing
!=
null
)
{
throw
new
ClientRequestException
(
BrowserErrorCode
.
COMPANYAUTHORIZEEXIST
);
throw
new
ClientRequestException
(
BrowserErrorCode
.
COMPANYAUTHORIZEEXIST
);
...
@@ -1058,29 +1061,41 @@ public class AccountServiceImpl implements AccountService {
...
@@ -1058,29 +1061,41 @@ public class AccountServiceImpl implements AccountService {
Account
account
=
repository
.
findByName
(
username
);
Account
account
=
repository
.
findByName
(
username
);
if
(
account
==
null
)
if
(
account
==
null
)
throw
new
ClientRequestException
(
AccountErrorCode
.
NAMENOTEXIST
);
throw
new
ClientRequestException
(
AccountErrorCode
.
NAMENOTEXIST
);
String
companyLicenseName
=
"companyLicense-"
+
username
;
companyLicenseFront
=
companyAuthorizeRepository
.
saveFile
(
companyAuthorizeDto
.
getCompanyLicense_front
(),
"companyLicense-front-"
+
username
);
companyLicenseId
=
companyAuthorizeRepository
.
saveFile
(
companyAuthorizeDto
.
getCompanyLicense
(),
companyLicenseName
);
companyLicenseBack
=
companyAuthorizeRepository
.
saveFile
(
companyAuthorizeDto
.
getCompanyLicense_back
(),
"companyLicense-back-"
+
username
);
String
coporationLicenseName
=
"coporationLicense-"
+
username
;
coporationLicenseId
=
companyAuthorizeRepository
.
saveFile
(
companyAuthorizeDto
.
getCoporationLicense
(),
coporationLicenseName
);
if
(
companyAuthorizeDto
.
getAgency
()
!=
null
)
{
companyLicenseFront
=
companyAuthorizeRepository
.
saveFile
(
companyAuthorizeDto
.
getCoporationLicense_front
(),
"coporationLicense-front-"
+
username
);
String
agencyName
=
"agencyLicense-"
+
username
;
companyLicenseBack
=
companyAuthorizeRepository
.
saveFile
(
companyAuthorizeDto
.
getCoporationLicense_back
(),
"coporationLicense-back-"
+
username
);
agencyId
=
companyAuthorizeRepository
.
saveFile
(
companyAuthorizeDto
.
getAgency
(),
agencyName
);
}
if
(
companyAuthorizeDto
.
getAgency_front
()
!=
null
&&
companyAuthorizeDto
.
getAgency_back
()
!=
null
)
{
agencyFront
=
companyAuthorizeRepository
.
saveFile
(
companyAuthorizeDto
.
getAgency_front
(),
"agency-front-"
+
username
);
agencyBack
=
companyAuthorizeRepository
.
saveFile
(
companyAuthorizeDto
.
getAgency_back
(),
"agency-back-"
+
username
);
}
else
throw
new
ClientRequestException
(
BrowserErrorCode
.
INFORMATIONNOTCOMPELETE
);
CompanyAuthorize
companyAuthorize
=
new
CompanyAuthorize
(
companyAuthorizeDto
);
CompanyAuthorize
companyAuthorize
=
new
CompanyAuthorize
(
companyAuthorizeDto
);
companyAuthorize
.
setUsername
(
username
);
companyAuthorize
.
setUsername
(
username
);
companyAuthorize
.
setCompanyLicenseId
(
companyLicenseId
);
companyAuthorize
.
setCompanyLicenseFront
(
companyLicenseFront
);
companyAuthorize
.
setCoporationLicenseId
(
coporationLicenseId
);
companyAuthorize
.
setCompanyLicenseBack
(
companyLicenseBack
);
if
(
agencyId
!=
null
)
companyAuthorize
.
setCoporationLicenseFront
(
coporationLicenseFront
);
companyAuthorize
.
setAgencyId
(
agencyId
);
companyAuthorize
.
setCoporationLicenseBack
(
coporationLicenseBack
);
if
(
agencyFront
!=
null
&&
agencyBack
!=
null
)
{
companyAuthorize
.
setAgencyFront
(
agencyFront
);
companyAuthorize
.
setAgencyBack
(
agencyBack
);
}
companyAuthorizeRepository
.
save
(
companyAuthorize
);
companyAuthorizeRepository
.
save
(
companyAuthorize
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
if
(
agencyId
!=
null
)
if
(
agencyBack
!=
null
)
companyAuthorizeRepository
.
deleteFile
(
agencyId
);
companyAuthorizeRepository
.
deleteFile
(
agencyBack
);
if
(
coporationLicenseId
!=
null
)
if
(
agencyFront
!=
null
)
companyAuthorizeRepository
.
deleteFile
(
coporationLicenseId
);
companyAuthorizeRepository
.
deleteFile
(
agencyFront
);
if
(
companyLicenseId
!=
null
)
if
(
coporationLicenseBack
!=
null
)
companyAuthorizeRepository
.
deleteFile
(
companyLicenseId
);
companyAuthorizeRepository
.
deleteFile
(
coporationLicenseBack
);
if
(
coporationLicenseFront
!=
null
)
companyAuthorizeRepository
.
deleteFile
(
coporationLicenseFront
);
if
(
companyLicenseBack
!=
null
)
companyAuthorizeRepository
.
deleteFile
(
companyLicenseBack
);
if
(
companyLicenseFront
!=
null
)
companyAuthorizeRepository
.
deleteFile
(
companyLicenseFront
);
throw
new
ClientRequestException
(
BrowserErrorCode
.
UNKNOWN
);
throw
new
ClientRequestException
(
BrowserErrorCode
.
UNKNOWN
);
}
}
...
@@ -1100,17 +1115,24 @@ public class AccountServiceImpl implements AccountService {
...
@@ -1100,17 +1115,24 @@ public class AccountServiceImpl implements AccountService {
CompanyAuthorize
companyAuthorize
=
companyAuthorizeRepository
.
findByUsername
(
username
);
CompanyAuthorize
companyAuthorize
=
companyAuthorizeRepository
.
findByUsername
(
username
);
if
(
companyAuthorize
==
null
)
if
(
companyAuthorize
==
null
)
return
null
;
return
null
;
File
companyLicense
=
companyAuthorizeRepository
.
getFile
(
companyAuthorize
.
getCompanyLicenseId
());
File
companyLicense_Front
=
companyAuthorizeRepository
.
getFile
(
companyAuthorize
.
getCompanyLicenseFront
());
File
companyLicense_Back
=
companyAuthorizeRepository
.
getFile
(
companyAuthorize
.
getCompanyLicenseBack
());
log
.
error
(
"3"
);
log
.
error
(
"3"
);
File
coporationLicense
=
companyAuthorizeRepository
.
getFile
(
companyAuthorize
.
getCoporationLicenseId
());
File
coporationLicense_Front
=
companyAuthorizeRepository
.
getFile
(
companyAuthorize
.
getCoporationLicenseFront
());
File
agencyLicense
=
null
;
File
coporationLicense_Back
=
companyAuthorizeRepository
.
getFile
(
companyAuthorize
.
getCoporationLicenseBack
());
if
(
companyAuthorize
.
getAgencyId
()
!=
null
)
File
agencyLicense_Front
=
null
;
agencyLicense
=
companyAuthorizeRepository
.
getFile
(
companyAuthorize
.
getAgencyId
());
File
agencyLicense_Back
=
null
;
if
(
companyAuthorize
.
getAgencyFront
()
!=
null
)
agencyLicense_Front
=
companyAuthorizeRepository
.
getFile
(
companyAuthorize
.
getAgencyFront
());
if
(
companyAuthorize
.
getAgencyBack
()
!=
null
)
agencyLicense_Back
=
companyAuthorizeRepository
.
getFile
(
companyAuthorize
.
getAgencyBack
());
try
{
try
{
File
tempFile
=
File
.
createTempFile
(
"tempFile"
,
"zip"
);
File
tempFile
=
File
.
createTempFile
(
"tempFile"
,
"zip"
);
List
<
File
>
files
=
Arrays
.
asList
(
companyLicense
,
coporationLicense
);
List
<
File
>
files
=
Arrays
.
asList
(
companyLicense_Front
,
companyLicense_Back
,
coporationLicense_Front
,
coporationLicense_Back
);
if
(
agencyLicense
!=
null
)
if
(
agencyLicense_Front
!=
null
)
files
.
add
(
agencyLicense
);
files
.
add
(
agencyLicense_Front
);
if
(
agencyLicense_Back
!=
null
)
files
.
add
(
agencyLicense_Back
);
tempFile
=
FileUtil
.
putBatchFilesInZip
(
files
,
tempFile
);
tempFile
=
FileUtil
.
putBatchFilesInZip
(
files
,
tempFile
);
return
tempFile
;
return
tempFile
;
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
...
...
src/main/java/com/edgec/browserbackend/alipay/AlipayConfig.java
View file @
5a4e4c3e
...
@@ -28,6 +28,8 @@ public abstract class AlipayConfig {
...
@@ -28,6 +28,8 @@ public abstract class AlipayConfig {
public
static
String
RETURN_URL_BROWSER
=
"https://www.fangguanlian.cn/home/paySuccess.html?alipayreturn="
;
public
static
String
RETURN_URL_BROWSER
=
"https://www.fangguanlian.cn/home/paySuccess.html?alipayreturn="
;
public
static
String
ALIPAY_AUTH_URL
=
"https://openauth.alipay.com/oauth2/publicAppAuthorize.htm"
;
public
abstract
String
getSIGN_TYPE
();
public
abstract
String
getSIGN_TYPE
();
...
...
src/main/java/com/edgec/browserbackend/alipay/AlipaySubmit.java
0 → 100644
View file @
5a4e4c3e
package
com
.
edgec
.
browserbackend
.
alipay
;
import
com.alipay.api.AlipayApiException
;
import
com.alipay.api.AlipayClient
;
import
com.alipay.api.DefaultAlipayClient
;
import
com.alipay.api.request.AlipaySystemOauthTokenRequest
;
import
com.alipay.api.request.AlipayUserInfoShareRequest
;
import
com.alipay.api.response.AlipaySystemOauthTokenResponse
;
import
com.alipay.api.response.AlipayUserInfoShareResponse
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
java.util.Map
;
public
class
AlipaySubmit
{
private
final
static
Logger
logger
=
LoggerFactory
.
getLogger
(
AlipaySubmit
.
class
);
/**
* 获取AccessToken
* @param sParaTemp
* @return
*/
public
static
String
buildRequest
(
Map
sParaTemp
){
AlipayConfig
alipayConfig
=
new
VpsAlipayConfig
();
AlipayClient
alipayClient
=
new
DefaultAlipayClient
(
"https://openapi.alipay.com/gateway.do"
,
alipayConfig
.
getAPPID
(),
alipayConfig
.
getAPP_PRIVATE_KEY
(),
"json"
,
alipayConfig
.
getCHARSET
(),
alipayConfig
.
getALIPAY_PUBLIC_KEY
(),
"RSA2"
);
AlipaySystemOauthTokenRequest
request
=
new
AlipaySystemOauthTokenRequest
();
request
.
setCode
((
String
)
sParaTemp
.
get
(
"auth_code"
));
request
.
setGrantType
(
"authorization_code"
);
try
{
AlipaySystemOauthTokenResponse
oauthTokenResponse
=
alipayClient
.
execute
(
request
);
logger
.
error
(
oauthTokenResponse
.
getAccessToken
());
return
oauthTokenResponse
.
getAccessToken
();
}
catch
(
AlipayApiException
e
)
{
//处理异常
e
.
printStackTrace
();
}
return
null
;
}
/**
* 获取用户信息
* @param accessToken
* @return
*/
public
static
String
get
(
String
accessToken
){
AlipayConfig
alipayConfig
=
new
VpsAlipayConfig
();
AlipayClient
alipayClient
=
new
DefaultAlipayClient
(
"https://openapi.alipay.com/gateway.do"
,
alipayConfig
.
getAPPID
(),
alipayConfig
.
getAPP_PRIVATE_KEY
(),
"json"
,
alipayConfig
.
getCHARSET
(),
alipayConfig
.
getALIPAY_PUBLIC_KEY
(),
"RSA2"
);
AlipayUserInfoShareRequest
request
=
new
AlipayUserInfoShareRequest
();
try
{
AlipayUserInfoShareResponse
userinfoShareResponse
=
alipayClient
.
execute
(
request
,
accessToken
);
return
userinfoShareResponse
.
getBody
();
}
catch
(
AlipayApiException
e
)
{
//处理异常
e
.
printStackTrace
();
}
return
null
;
}
}
\ No newline at end of file
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