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
adcd6742
Commit
adcd6742
authored
Mar 31, 2020
by
renjie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
推广码
parent
5959bee7
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
36 additions
and
2 deletions
+36
-2
AccountController.java
.../browserbackend/account/controller/AccountController.java
+1
-0
AccountDto.java
...a/com/edgec/browserbackend/account/domain/AccountDto.java
+11
-0
CompanyAuthorizeRepositoryCustomImpl.java
...ount/repository/CompanyAuthorizeRepositoryCustomImpl.java
+19
-1
AccountServiceImpl.java
...owserbackend/account/service/impl/AccountServiceImpl.java
+5
-1
No files found.
src/main/java/com/edgec/browserbackend/account/controller/AccountController.java
View file @
adcd6742
...
...
@@ -482,6 +482,7 @@ public class AccountController {
while
((
len
=
fis
.
read
(
bt
))
!=
-
1
)
{
os
.
write
(
bt
,
0
,
len
);
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
throw
new
ClientRequestException
(
BrowserErrorCode
.
UNKNOWN
);
...
...
src/main/java/com/edgec/browserbackend/account/domain/AccountDto.java
View file @
adcd6742
...
...
@@ -49,6 +49,8 @@ public class AccountDto {
private
Promotion
promotion
;
private
int
authorized
;
public
AccountDto
(){
}
...
...
@@ -67,6 +69,7 @@ public class AccountDto {
this
.
setQueryIpUrlList
(
account
.
getQueryIpUrlList
());
if
(
account
.
getPromotion
()
!=
null
)
this
.
setPromotion
(
account
.
getPromotion
());
this
.
authorized
=
account
.
getAuthorized
();
}
public
boolean
isPrePaid
()
{
...
...
@@ -229,4 +232,12 @@ public class AccountDto {
public
void
setPromotion
(
Promotion
promotion
)
{
this
.
promotion
=
promotion
;
}
public
int
getAuthorized
()
{
return
authorized
;
}
public
void
setAuthorized
(
int
authorized
)
{
this
.
authorized
=
authorized
;
}
}
src/main/java/com/edgec/browserbackend/account/repository/CompanyAuthorizeRepositoryCustomImpl.java
View file @
adcd6742
...
...
@@ -22,7 +22,9 @@ import org.springframework.data.mongodb.gridfs.GridFsResource;
import
org.springframework.data.mongodb.gridfs.GridFsTemplate
;
import
org.springframework.web.multipart.MultipartFile
;
import
java.io.ByteArrayOutputStream
;
import
java.io.File
;
import
java.io.FileOutputStream
;
import
java.io.InputStream
;
public
class
CompanyAuthorizeRepositoryCustomImpl
implements
CompanyAuthorizeRepositoryCustom
{
...
...
@@ -76,13 +78,29 @@ public class CompanyAuthorizeRepositoryCustomImpl implements CompanyAuthorizeRep
GridFSDownloadStream
gridFSDownloadStream
=
gridFSBucket
.
openDownloadStream
(
gridFSFile
.
getObjectId
());
GridFsResource
gridFsResource
=
new
GridFsResource
(
gridFSFile
,
gridFSDownloadStream
);
return
gridFsResource
.
getFile
();
InputStream
inputStream
=
gridFsResource
.
getInputStream
();
byte
[]
f
=
getBytes
(
inputStream
);
File
file
=
new
File
(
gridFSFile
.
getFilename
()
+
".png"
);
FileOutputStream
out
=
new
FileOutputStream
(
file
);
out
.
write
(
f
);
return
file
;
}
catch
(
Exception
e
)
{
logger
.
error
(
e
.
getMessage
());
throw
new
ClientRequestException
(
BrowserErrorCode
.
UNKNOWN
);
}
}
private
byte
[]
getBytes
(
InputStream
inputStream
)
throws
Exception
{
ByteArrayOutputStream
bos
=
new
ByteArrayOutputStream
();
byte
[]
b
=
new
byte
[
1024
];
int
i
=
0
;
while
(-
1
!=(
i
=
inputStream
.
read
(
b
))){
bos
.
write
(
b
,
0
,
i
);
}
return
bos
.
toByteArray
();
}
}
src/main/java/com/edgec/browserbackend/account/service/impl/AccountServiceImpl.java
View file @
adcd6742
...
...
@@ -1068,7 +1068,7 @@ public class AccountServiceImpl implements AccountService {
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
}
else
if
(!(
companyAuthorizeDto
.
getAgency_front
()
==
null
&&
companyAuthorizeDto
.
getAgency_back
()
==
null
))
throw
new
ClientRequestException
(
BrowserErrorCode
.
INFORMATIONNOTCOMPELETE
);
CompanyAuthorize
companyAuthorize
=
new
CompanyAuthorize
(
companyAuthorizeDto
);
companyAuthorize
.
setUsername
(
username
);
...
...
@@ -1091,6 +1091,7 @@ public class AccountServiceImpl implements AccountService {
companyAuthorizeRepository
.
deleteFile
(
coporationLicenseFront
);
if
(
companyLicenseId
!=
null
)
companyAuthorizeRepository
.
deleteFile
(
companyLicenseId
);
log
.
error
(
e
.
getMessage
());
throw
new
ClientRequestException
(
BrowserErrorCode
.
UNKNOWN
);
}
...
...
@@ -1128,6 +1129,9 @@ public class AccountServiceImpl implements AccountService {
if
(
agencyLicense_Back
!=
null
)
files
.
add
(
agencyLicense_Back
);
tempFile
=
FileUtil
.
putBatchFilesInZip
(
files
,
tempFile
);
companyLicense
.
delete
();
coporationLicense_Front
.
delete
();
coporationLicense_Back
.
delete
();
return
tempFile
;
}
catch
(
Exception
e
)
{
throw
new
ClientRequestException
(
BrowserErrorCode
.
UNKNOWN
);
...
...
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