Commit 619e202d authored by renjie's avatar renjie

绑定记录

parent e5c28071
...@@ -169,8 +169,10 @@ public class PaymentServiceImpl implements PaymentService { ...@@ -169,8 +169,10 @@ public class PaymentServiceImpl implements PaymentService {
userPrePaidBillingRepository.save(bill); userPrePaidBillingRepository.save(bill);
if (more != 20 && more != 45 && more != 125 && more != 300) if (more != 20 && more != 45 && more != 125 && more != 300) {
more = 0; more = 0;
}
if ((more == 20 && byTradeNo.getAmount() != 100) || (more != 20 && byTradeNo.getAmount() == 100)) if ((more == 20 && byTradeNo.getAmount() != 100) || (more != 20 && byTradeNo.getAmount() == 100))
more = 0; more = 0;
if ((more == 45 && byTradeNo.getAmount() != 200) || (more != 45 && byTradeNo.getAmount() == 200)) if ((more == 45 && byTradeNo.getAmount() != 200) || (more != 45 && byTradeNo.getAmount() == 200))
......
package com.edgec.browserbackend.browser.domain;
public class BindHistory {
private String shopName;
private String ip;
private String platform;
private String unbindTime;
public String getShopName() {
return shopName;
}
public void setShopName(String shopName) {
this.shopName = shopName;
}
public String getIp() {
return ip;
}
public void setPlatform(String platform) {
this.platform = platform;
}
public String getPlatform() {
return platform;
}
public void setIp(String ip) {
this.ip = ip;
}
public String getUnbindTime() {
return unbindTime;
}
public void setUnbindTime(String unbindTime) {
this.unbindTime = unbindTime;
}
}
...@@ -25,7 +25,7 @@ public class IpResource { ...@@ -25,7 +25,7 @@ public class IpResource {
private long purchasedTime; private long purchasedTime;
private long validTime; private long validTime;
private String details; private String details;
List<String> bindHistory = new ArrayList<>(); List<BindHistory> bindHistory = new ArrayList<>();
private boolean isDeleted; private boolean isDeleted;
private String username; private String username;
private String owner; private String owner;
...@@ -83,11 +83,11 @@ public class IpResource { ...@@ -83,11 +83,11 @@ public class IpResource {
this.ipType = ipType; this.ipType = ipType;
} }
public List<String> getBindHistory() { public List<BindHistory> getBindHistory() {
return bindHistory; return bindHistory;
} }
public void setBindHistory(List<String> bindHistory) { public void setBindHistory(List<BindHistory> bindHistory) {
this.bindHistory = bindHistory; this.bindHistory = bindHistory;
} }
......
...@@ -299,7 +299,7 @@ public class IpResourceServiceImpl implements IpResourceService { ...@@ -299,7 +299,7 @@ public class IpResourceServiceImpl implements IpResourceService {
ipTransactionRepository.save(ipTransaction); ipTransactionRepository.save(ipTransaction);
} }
IpChargeRequestDto ipChargeRequestDto = buildIpChargeRequestDto(ipResourceRequestDto, 0); IpChargeRequestDto ipChargeRequestDto = buildIpChargeRequestDto(ipResourceRequestDto, 1);
accountService.chargeByMoney(username, newprice * ipChargeRequestDto.getAmount(), ipChargeRequestDto); accountService.chargeByMoney(username, newprice * ipChargeRequestDto.getAmount(), ipChargeRequestDto);
return ipTransactionDto; return ipTransactionDto;
} }
...@@ -360,7 +360,7 @@ public class IpResourceServiceImpl implements IpResourceService { ...@@ -360,7 +360,7 @@ public class IpResourceServiceImpl implements IpResourceService {
.map(vendorprice -> vendorprice.substring(vendorprice.lastIndexOf("-") + 1)).collect(Collectors.joining()); .map(vendorprice -> vendorprice.substring(vendorprice.lastIndexOf("-") + 1)).collect(Collectors.joining());
double newprice1 = ipResourceRequestDto.getUnit().equals("week") ? (Integer.valueOf(price)/3) : Integer.valueOf(price); double newprice1 = ipResourceRequestDto.getUnit().equals("week") ? (Integer.valueOf(price)/3) : Integer.valueOf(price);
IpChargeRequestDto ipChargeRequestDto = buildIpChargeRequestDto(ipResourceRequestDto, 1); IpChargeRequestDto ipChargeRequestDto = buildIpChargeRequestDto(ipResourceRequestDto, 2);
accountService.chargeByMoney(username, newprice1, ipChargeRequestDto); accountService.chargeByMoney(username, newprice1, ipChargeRequestDto);
ipResource.setValidTime(Instant.parse(x.getValidTill()).toEpochMilli()); ipResource.setValidTime(Instant.parse(x.getValidTill()).toEpochMilli());
......
...@@ -246,8 +246,6 @@ public class ShopServiceImpl implements ShopService { ...@@ -246,8 +246,6 @@ public class ShopServiceImpl implements ShopService {
shop.setIpId(ipResource.getId()); shop.setIpId(ipResource.getId());
shop.setIpRegion(ipResource.getRegion()); shop.setIpRegion(ipResource.getRegion());
shopRepository.save(shop); shopRepository.save(shop);
List<String> history = ipResource.getBindHistory();
history.add(shop.getShopId());
ipResource.setShopId(shopId); ipResource.setShopId(shopId);
if (shop.getShopName()!=null) if (shop.getShopName()!=null)
ipResource.setShopName(shop.getShopName()); ipResource.setShopName(shop.getShopName());
...@@ -287,6 +285,12 @@ public class ShopServiceImpl implements ShopService { ...@@ -287,6 +285,12 @@ public class ShopServiceImpl implements ShopService {
if (!ipResource.getId().equals(shop.getIpId())) if (!ipResource.getId().equals(shop.getIpId()))
throw new ClientRequestException(BrowserErrorCode.IPNOTBINDTOSHOP); throw new ClientRequestException(BrowserErrorCode.IPNOTBINDTOSHOP);
try { try {
List<BindHistory> history = ipResource.getBindHistory();
BindHistory bindHistory = new BindHistory();
bindHistory.setIp(ipResource.getAddr());
bindHistory.setPlatform(shop.getShopPlatform());
bindHistory.setShopName(shop.getShopName());
history.add(bindHistory);
shop.setIp(null); shop.setIp(null);
shop.setIpId(null); shop.setIpId(null);
shop.setIpRegion(null); shop.setIpRegion(null);
......
...@@ -4,8 +4,10 @@ package com.edgec.browserbackend.common.charge; ...@@ -4,8 +4,10 @@ package com.edgec.browserbackend.common.charge;
public interface ChargeType { public interface ChargeType {
int newip = 0; // 购买vps, ip //0 -- 充值, 1 -- newip, 2 --renew, 3 --ipkeptfee, 4 --deleteip,
int renew = 1; // 续费ip
int payment = 2; // 充值 int payment = 0; // 充值
int newip = 1; // 购买vps, ip
int renew = 2; // 续费ip
} }
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