Commit 3cbe5a56 authored by renjie's avatar renjie

批量添加文件bug

parent 3f870445
Pipeline #29 failed with stages
......@@ -32,7 +32,7 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
public void configure(WebSecurity web) throws Exception {
web.ignoring()
.antMatchers( "/user/authCode", "/user/signUp", "/shop/multiadd",
.antMatchers( "/user/authCode", "/user/signUp",
"/user/reset*");
}
......
......@@ -10,6 +10,8 @@ import com.edgec.browserbackend.browser.dto.ShopStringResultDto;
import com.edgec.browserbackend.browser.service.ShopService;
import com.edgec.browserbackend.common.commons.error.ClientRequestException;
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.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
......@@ -25,6 +27,8 @@ import java.util.Map;
@RequestMapping("/shop")
public class ShopController {
private final Logger logger = LoggerFactory.getLogger(ShopController.class);
@Autowired
private ShopService shopService;
......@@ -47,7 +51,6 @@ public class ShopController {
}
@RequestMapping(value = "/multiadd", method = RequestMethod.POST)
@ResponseBody
public List<String> addShops(Principal principal, @RequestParam("file") MultipartFile file) {
ResultDto resultDto = new ResultDto();
String name = file.getOriginalFilename();
......
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;
}
}
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;
}
}
......@@ -215,20 +215,9 @@ public class IpResourceServiceImpl implements IpResourceService {
try {
if (ipBuyResultDto != null && ipBuyResultDto.getIplist() != null && ipBuyResultDto.getIplist().size() >= 1) {
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.setAddr(x.getIp());
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.setValidTime(Instant.parse(x.getValidTill()).toEpochMilli());
ipResource.setPort(port);
......@@ -244,7 +233,6 @@ public class IpResourceServiceImpl implements IpResourceService {
ipResource.setOwner(username);
ipResourceRepository.save(ipResource);
ipResourceDtos.add(new IpResourceDto(ipResource, null));
// }
});
}
} catch (Exception e) {
......@@ -521,4 +509,21 @@ public class IpResourceServiceImpl implements IpResourceService {
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;
}
}
package com.edgec.browserbackend.browser.service;
import com.edgec.browserbackend.browser.domain.IpOptions;
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.domain.*;
import com.edgec.browserbackend.browser.dto.*;
import java.util.List;
......@@ -23,4 +20,6 @@ public interface IpResourceService {
IpOptions getIpOptions();
List<PlatformOptions> getPlatformOptions();
IpTransactionDto queryTransaction(String username, String transactionId);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment