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
3cbe5a56
Commit
3cbe5a56
authored
Mar 18, 2020
by
renjie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
批量添加文件bug
parent
3f870445
Pipeline
#29
failed with stages
Changes
8
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
114 additions
and
18 deletions
+114
-18
WebSecurityConfig.java
...m/edgec/browserbackend/auth/config/WebSecurityConfig.java
+1
-1
ShopController.java
...gec/browserbackend/browser/controller/ShopController.java
+4
-1
IpTransaction.java
...om/edgec/browserbackend/browser/domain/IpTransaction.java
+53
-0
IpTransactionDto.java
...om/edgec/browserbackend/browser/dto/IpTransactionDto.java
+36
-0
IpResourceServiceImpl.java
...erbackend/browser/service/Impl/IpResourceServiceImpl.java
+17
-12
IpResourceService.java
...gec/browserbackend/browser/service/IpResourceService.java
+3
-4
batchAdd.xlsx
src/main/resources/static/batchAdd.xlsx
+0
-0
~$batchAdd.xlsx
src/main/resources/static/~$batchAdd.xlsx
+0
-0
No files found.
src/main/java/com/edgec/browserbackend/auth/config/WebSecurityConfig.java
View file @
3cbe5a56
...
@@ -32,7 +32,7 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
...
@@ -32,7 +32,7 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
public
void
configure
(
WebSecurity
web
)
throws
Exception
{
public
void
configure
(
WebSecurity
web
)
throws
Exception
{
web
.
ignoring
()
web
.
ignoring
()
.
antMatchers
(
"/user/authCode"
,
"/user/signUp"
,
"/shop/multiadd"
,
.
antMatchers
(
"/user/authCode"
,
"/user/signUp"
,
"/user/reset*"
);
"/user/reset*"
);
}
}
...
...
src/main/java/com/edgec/browserbackend/browser/controller/ShopController.java
View file @
3cbe5a56
...
@@ -10,6 +10,8 @@ import com.edgec.browserbackend.browser.dto.ShopStringResultDto;
...
@@ -10,6 +10,8 @@ import com.edgec.browserbackend.browser.dto.ShopStringResultDto;
import
com.edgec.browserbackend.browser.service.ShopService
;
import
com.edgec.browserbackend.browser.service.ShopService
;
import
com.edgec.browserbackend.common.commons.error.ClientRequestException
;
import
com.edgec.browserbackend.common.commons.error.ClientRequestException
;
import
com.edgec.browserbackend.common.utils.FileUtil
;
import
com.edgec.browserbackend.common.utils.FileUtil
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.multipart.MultipartFile
;
import
org.springframework.web.multipart.MultipartFile
;
...
@@ -25,6 +27,8 @@ import java.util.Map;
...
@@ -25,6 +27,8 @@ import java.util.Map;
@RequestMapping
(
"/shop"
)
@RequestMapping
(
"/shop"
)
public
class
ShopController
{
public
class
ShopController
{
private
final
Logger
logger
=
LoggerFactory
.
getLogger
(
ShopController
.
class
);
@Autowired
@Autowired
private
ShopService
shopService
;
private
ShopService
shopService
;
...
@@ -47,7 +51,6 @@ public class ShopController {
...
@@ -47,7 +51,6 @@ public class ShopController {
}
}
@RequestMapping
(
value
=
"/multiadd"
,
method
=
RequestMethod
.
POST
)
@RequestMapping
(
value
=
"/multiadd"
,
method
=
RequestMethod
.
POST
)
@ResponseBody
public
List
<
String
>
addShops
(
Principal
principal
,
@RequestParam
(
"file"
)
MultipartFile
file
)
{
public
List
<
String
>
addShops
(
Principal
principal
,
@RequestParam
(
"file"
)
MultipartFile
file
)
{
ResultDto
resultDto
=
new
ResultDto
();
ResultDto
resultDto
=
new
ResultDto
();
String
name
=
file
.
getOriginalFilename
();
String
name
=
file
.
getOriginalFilename
();
...
...
src/main/java/com/edgec/browserbackend/browser/domain/IpTransaction.java
0 → 100644
View file @
3cbe5a56
package
com
.
edgec
.
browserbackend
.
browser
.
domain
;
import
org.springframework.data.annotation.Id
;
import
org.springframework.data.mongodb.core.mapping.Document
;
/**
* @Desc
* @Author jason
* @CreateTime 2020/3/18 9:42 上午
**/
@Document
(
"iptransaction"
)
public
class
IpTransaction
{
@Id
private
String
tid
;
private
int
username
;
private
long
createTime
;
private
int
status
;
public
int
getUsername
()
{
return
username
;
}
public
void
setUsername
(
int
username
)
{
this
.
username
=
username
;
}
public
int
getStatus
()
{
return
status
;
}
public
void
setStatus
(
int
status
)
{
this
.
status
=
status
;
}
public
String
getTid
()
{
return
tid
;
}
public
void
setCreateTime
(
long
createTime
)
{
this
.
createTime
=
createTime
;
}
public
long
getCreateTime
()
{
return
createTime
;
}
public
void
setTid
(
String
tid
)
{
this
.
tid
=
tid
;
}
}
src/main/java/com/edgec/browserbackend/browser/dto/IpTransactionDto.java
0 → 100644
View file @
3cbe5a56
package
com
.
edgec
.
browserbackend
.
browser
.
dto
;
/**
* @Desc
* @Author jason
* @CreateTime 2020/3/18 9:57 上午
**/
public
class
IpTransactionDto
{
private
String
tid
;
private
int
status
;
private
IpResourceDto
ipResourceDto
;
public
String
getTid
()
{
return
tid
;
}
public
void
setTid
(
String
tid
)
{
this
.
tid
=
tid
;
}
public
int
getStatus
()
{
return
status
;
}
public
void
setStatus
(
int
status
)
{
this
.
status
=
status
;
}
public
IpResourceDto
getIpResourceDto
()
{
return
ipResourceDto
;
}
public
void
setIpResourceDto
(
IpResourceDto
ipResourceDto
)
{
this
.
ipResourceDto
=
ipResourceDto
;
}
}
src/main/java/com/edgec/browserbackend/browser/service/Impl/IpResourceServiceImpl.java
View file @
3cbe5a56
...
@@ -215,20 +215,9 @@ public class IpResourceServiceImpl implements IpResourceService {
...
@@ -215,20 +215,9 @@ public class IpResourceServiceImpl implements IpResourceService {
try
{
try
{
if
(
ipBuyResultDto
!=
null
&&
ipBuyResultDto
.
getIplist
()
!=
null
&&
ipBuyResultDto
.
getIplist
().
size
()
>=
1
)
{
if
(
ipBuyResultDto
!=
null
&&
ipBuyResultDto
.
getIplist
()
!=
null
&&
ipBuyResultDto
.
getIplist
().
size
()
>=
1
)
{
ipBuyResultDto
.
getIplist
().
forEach
(
x
->
{
ipBuyResultDto
.
getIplist
().
forEach
(
x
->
{
// IpInfoResultDto ipInfoResultDto = new IpInfoResultDto();
// Map<String, String> params = new HashMap<String, String>();
// params.put("accountId", "browser");
// params.put("ip", x.getIp());
// HttpHeaders headers = buildGetHeader();
// HttpEntity<Map<String, String>> entity = new HttpEntity<>(params, headers);
// ResponseEntity<String> result = restTemplate.exchange(TESTURL + "/ecc/ipinfo?accountId={accountId}&ip={ip}", HttpMethod.GET, entity, String.class);
// JSONObject jsonObject = JSON.parseObject(result.getBody());
// if (ipInfoResultDto != null && StringUtils.isBlank(ipInfoResultDto.getErrorCode())) {
IpResource
ipResource
=
new
IpResource
();
IpResource
ipResource
=
new
IpResource
();
ipResource
.
setAddr
(
x
.
getIp
());
ipResource
.
setAddr
(
x
.
getIp
());
ipResource
.
setIpType
(
IpType
.
VENDOR
);
ipResource
.
setIpType
(
IpType
.
VENDOR
);
// ipResource.setPurchasedTime(Long.valueOf((String) jsonObject.get("createdWhen")));
// ipResource.setValidTime(Long.valueOf((String)jsonObject.get("validTill")));
ipResource
.
setPurchasedTime
(
Instant
.
now
().
toEpochMilli
());
ipResource
.
setPurchasedTime
(
Instant
.
now
().
toEpochMilli
());
ipResource
.
setValidTime
(
Instant
.
parse
(
x
.
getValidTill
()).
toEpochMilli
());
ipResource
.
setValidTime
(
Instant
.
parse
(
x
.
getValidTill
()).
toEpochMilli
());
ipResource
.
setPort
(
port
);
ipResource
.
setPort
(
port
);
...
@@ -244,7 +233,6 @@ public class IpResourceServiceImpl implements IpResourceService {
...
@@ -244,7 +233,6 @@ public class IpResourceServiceImpl implements IpResourceService {
ipResource
.
setOwner
(
username
);
ipResource
.
setOwner
(
username
);
ipResourceRepository
.
save
(
ipResource
);
ipResourceRepository
.
save
(
ipResource
);
ipResourceDtos
.
add
(
new
IpResourceDto
(
ipResource
,
null
));
ipResourceDtos
.
add
(
new
IpResourceDto
(
ipResource
,
null
));
// }
});
});
}
}
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
...
@@ -521,4 +509,21 @@ public class IpResourceServiceImpl implements IpResourceService {
...
@@ -521,4 +509,21 @@ public class IpResourceServiceImpl implements IpResourceService {
throw
new
ClientRequestException
(
BrowserErrorCode
.
UNKNOWN
);
throw
new
ClientRequestException
(
BrowserErrorCode
.
UNKNOWN
);
}
}
}
}
@Override
public
IpTransactionDto
queryTransaction
(
String
username
,
String
tid
)
{
// IpInfoResultDto ipInfoResultDto = new IpInfoResultDto();
// Map<String, String> params = new HashMap<String, String>();
// params.put("accountId", "browser");
// params.put("ip", x.getIp());
// HttpHeaders headers = buildGetHeader();
// HttpEntity<Map<String, String>> entity = new HttpEntity<>(params, headers);
// ResponseEntity<String> result = restTemplate.exchange(TESTURL + "/ecc/ipinfo?accountId={accountId}&ip={ip}", HttpMethod.GET, entity, String.class);
// JSONObject jsonObject = JSON.parseObject(result.getBody());
// if (ipInfoResultDto != null && StringUtils.isBlank(ipInfoResultDto.getErrorCode())) {
// ipResource.setPurchasedTime(Long.valueOf((String) jsonObject.get("createdWhen")));
// ipResource.setValidTime(Long.valueOf((String)jsonObject.get("validTill")));
// }
return
null
;
}
}
}
src/main/java/com/edgec/browserbackend/browser/service/IpResourceService.java
View file @
3cbe5a56
package
com
.
edgec
.
browserbackend
.
browser
.
service
;
package
com
.
edgec
.
browserbackend
.
browser
.
service
;
import
com.edgec.browserbackend.browser.domain.IpOptions
;
import
com.edgec.browserbackend.browser.domain.*
;
import
com.edgec.browserbackend.browser.domain.Platform
;
import
com.edgec.browserbackend.browser.domain.PlatformOptions
;
import
com.edgec.browserbackend.browser.domain.ShopSummary
;
import
com.edgec.browserbackend.browser.dto.*
;
import
com.edgec.browserbackend.browser.dto.*
;
import
java.util.List
;
import
java.util.List
;
...
@@ -23,4 +20,6 @@ public interface IpResourceService {
...
@@ -23,4 +20,6 @@ public interface IpResourceService {
IpOptions
getIpOptions
();
IpOptions
getIpOptions
();
List
<
PlatformOptions
>
getPlatformOptions
();
List
<
PlatformOptions
>
getPlatformOptions
();
IpTransactionDto
queryTransaction
(
String
username
,
String
transactionId
);
}
}
src/main/resources/batchAdd.xlsx
→
src/main/resources/
static/
batchAdd.xlsx
View file @
3cbe5a56
File moved
src/main/resources/static/~$batchAdd.xlsx
0 → 100644
View file @
3cbe5a56
File added
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