Commit ecb5489e authored by Administrator's avatar Administrator

Merge branch 'staging' into 'master'

Staging

See merge request !22
parents 91e57a94 264b55c5
...@@ -277,7 +277,7 @@ public class IpResourceServiceImpl implements IpResourceService { ...@@ -277,7 +277,7 @@ public class IpResourceServiceImpl implements IpResourceService {
} }); } });
double newprice = ipResourceRequestDto.getUnit().equals("week") ? (int) (totalprice.get()/3) : totalprice.get().intValue(); double newprice = ipResourceRequestDto.getUnit().equals("week") ? (int) (totalprice.get()/3) : totalprice.get().intValue();
IpChargeResultDto ipChargeResultDto = accountService.preChargeByMoney(username, newprice); IpChargeResultDto ipChargeResultDto = accountService.preChargeByMoney(username, newprice * ipResourceRequestDto.getPeriod() * ipResourceRequestDto.getAmount());
if (!ipChargeResultDto.isSuccess()) { if (!ipChargeResultDto.isSuccess()) {
throw new ClientRequestException(AccountErrorCode.NOTENOUGHBALANCE); throw new ClientRequestException(AccountErrorCode.NOTENOUGHBALANCE);
} }
...@@ -312,7 +312,7 @@ public class IpResourceServiceImpl implements IpResourceService { ...@@ -312,7 +312,7 @@ public class IpResourceServiceImpl implements IpResourceService {
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, 2, ipResourceRequestDto.getPayMethod()); IpChargeRequestDto ipChargeRequestDto = buildIpChargeRequestDto(ipResourceRequestDto, 2, ipResourceRequestDto.getPayMethod());
accountService.chargeByMoney(username, newprice1, ipChargeRequestDto); accountService.chargeByMoney(username, newprice1 * ipResourceRequestDto.getPeriod() * ipResourceRequestDto.getAmount(), ipChargeRequestDto);
ipResource.setValidTime(Instant.parse(x.getValidTill()).toEpochMilli()); ipResource.setValidTime(Instant.parse(x.getValidTill()).toEpochMilli());
ipResourceRepository.save(ipResource); ipResourceRepository.save(ipResource);
...@@ -333,7 +333,7 @@ public class IpResourceServiceImpl implements IpResourceService { ...@@ -333,7 +333,7 @@ public class IpResourceServiceImpl implements IpResourceService {
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, 2, ipResourceRequestDto.getPayMethod()); IpChargeRequestDto ipChargeRequestDto = buildIpChargeRequestDto(ipResourceRequestDto, 2, ipResourceRequestDto.getPayMethod());
accountService.chargeByMoney(username, newprice1, ipChargeRequestDto); accountService.chargeByMoney(username, newprice1 * ipResourceRequestDto.getPeriod() * ipResourceRequestDto.getAmount(), ipChargeRequestDto);
if (ipResourceRequestDto.getUnit().equals("week")) { if (ipResourceRequestDto.getUnit().equals("week")) {
ipResource.setValidTime(Instant.ofEpochMilli(ipResource.getValidTime()).atZone(ZoneOffset.UTC) ipResource.setValidTime(Instant.ofEpochMilli(ipResource.getValidTime()).atZone(ZoneOffset.UTC)
......
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