Commit 032ff3c5 authored by renjie's avatar renjie

admin bug

http请求超时时间
parent aa2969e1
...@@ -35,15 +35,15 @@ public interface UserPrePaidBillingRepository extends MongoRepository<UserPrePai ...@@ -35,15 +35,15 @@ public interface UserPrePaidBillingRepository extends MongoRepository<UserPrePai
List<UserPrePaidBilling> findByStatus(BillStatus status); List<UserPrePaidBilling> findByStatus(BillStatus status);
Page<UserPrePaidBilling> findByUsernameAndTimestampGreaterThanOrderByTimestamp(String username, long time, Pageable pageable); Page<UserPrePaidBilling> findByUsernameAndTimestampGreaterThanOrderByTimestampDesc(String username, long time, Pageable pageable);
Page<UserPrePaidBilling> findByAdministratorAndTimestampGreaterThanOrderByTimestamp(String administrator, long time, Pageable pageable); Page<UserPrePaidBilling> findByAdministratorAndTimestampGreaterThanOrderByTimestampDesc(String administrator, long time, Pageable pageable);
Page<UserPrePaidBilling> findByUsernameAndTimestampGreaterThanAndChargeTypeOrderByTimestamp(String username, long time, int chargeType, Pageable pageable); Page<UserPrePaidBilling> findByUsernameAndTimestampGreaterThanAndChargeTypeOrderByTimestampDesc(String username, long time, int chargeType, Pageable pageable);
Page<UserPrePaidBilling> findByAdministratorAndTimestampGreaterThanAndChargeTypeOrderByTimestamp(String administrator, long time, int chargeType, Pageable pageable); Page<UserPrePaidBilling> findByAdministratorAndTimestampGreaterThanAndChargeTypeOrderByTimestampDesc(String administrator, long time, int chargeType, Pageable pageable);
Page<UserPrePaidBilling> findByUsernameAndTimestampGreaterThanAndChargeTypeIsNotAndPayMethodOrderByTimestamp(String username, long time, int chargeType, int payMethod, Pageable pageable); Page<UserPrePaidBilling> findByUsernameAndTimestampGreaterThanAndChargeTypeIsNotAndPayMethodOrderByTimestampDesc(String username, long time, int chargeType, int payMethod, Pageable pageable);
Page<UserPrePaidBilling> findByAdministratorAndTimestampGreaterThanAndChargeTypeIsNotAndPayMethodOrderByTimestamp(String administrator, long time, int chargeType, int payMethod, Pageable pageable); Page<UserPrePaidBilling> findByAdministratorAndTimestampGreaterThanAndChargeTypeIsNotAndPayMethodOrderByTimestampDesc(String administrator, long time, int chargeType, int payMethod, Pageable pageable);
} }
...@@ -187,19 +187,19 @@ public class AccountServiceImpl implements AccountService { ...@@ -187,19 +187,19 @@ public class AccountServiceImpl implements AccountService {
Page<UserPrePaidBilling> userPrePaidBillings; Page<UserPrePaidBilling> userPrePaidBillings;
if (userPrePaidBillingRequestDto.getTradeType() == 1) { if (userPrePaidBillingRequestDto.getTradeType() == 1) {
if (account.getParent() != null) if (account.getParent() != null)
userPrePaidBillings = prePaidBillingRepository.findByUsernameAndTimestampGreaterThanAndChargeTypeOrderByTimestamp(name, time, 0, pageable); userPrePaidBillings = prePaidBillingRepository.findByUsernameAndTimestampGreaterThanAndChargeTypeOrderByTimestampDesc(name, time, 0, pageable);
else else
userPrePaidBillings = prePaidBillingRepository.findByAdministratorAndTimestampGreaterThanAndChargeTypeOrderByTimestamp(name, time, 0, pageable); userPrePaidBillings = prePaidBillingRepository.findByAdministratorAndTimestampGreaterThanAndChargeTypeOrderByTimestampDesc(name, time, 0, pageable);
} else if (userPrePaidBillingRequestDto.getTradeType() == 2 || userPrePaidBillingRequestDto.getTradeType() == 3 || userPrePaidBillingRequestDto.getTradeType() == 4) { } else if (userPrePaidBillingRequestDto.getTradeType() == 2 || userPrePaidBillingRequestDto.getTradeType() == 3 || userPrePaidBillingRequestDto.getTradeType() == 4) {
if (account.getParent() != null) if (account.getParent() != null)
userPrePaidBillings = prePaidBillingRepository.findByUsernameAndTimestampGreaterThanAndChargeTypeIsNotAndPayMethodOrderByTimestamp(name, time, 0, userPrePaidBillingRequestDto.getTradeType() - 2, pageable); userPrePaidBillings = prePaidBillingRepository.findByUsernameAndTimestampGreaterThanAndChargeTypeIsNotAndPayMethodOrderByTimestampDesc(name, time, 0, userPrePaidBillingRequestDto.getTradeType() - 2, pageable);
else else
userPrePaidBillings = prePaidBillingRepository.findByAdministratorAndTimestampGreaterThanAndChargeTypeIsNotAndPayMethodOrderByTimestamp(name, time, 0, userPrePaidBillingRequestDto.getTradeType() - 2, pageable); userPrePaidBillings = prePaidBillingRepository.findByAdministratorAndTimestampGreaterThanAndChargeTypeIsNotAndPayMethodOrderByTimestampDesc(name, time, 0, userPrePaidBillingRequestDto.getTradeType() - 2, pageable);
} else { } else {
if (account.getParent() != null) if (account.getParent() != null)
userPrePaidBillings = prePaidBillingRepository.findByUsernameAndTimestampGreaterThanOrderByTimestamp(name, time, pageable); userPrePaidBillings = prePaidBillingRepository.findByUsernameAndTimestampGreaterThanOrderByTimestampDesc(name, time, pageable);
else else
userPrePaidBillings = prePaidBillingRepository.findByAdministratorAndTimestampGreaterThanOrderByTimestamp(name, time, pageable); userPrePaidBillings = prePaidBillingRepository.findByAdministratorAndTimestampGreaterThanOrderByTimestampDesc(name, time, pageable);
} }
PrePaidBillingPageResultDto prePaidBillingPageResultDto = new PrePaidBillingPageResultDto(); PrePaidBillingPageResultDto prePaidBillingPageResultDto = new PrePaidBillingPageResultDto();
......
...@@ -144,7 +144,7 @@ public class AdministratorServiceImpl implements AdministratorService { ...@@ -144,7 +144,7 @@ public class AdministratorServiceImpl implements AdministratorService {
UserBalance userBalance_child = userBalanceRepository.findById(child.getName()).orElse(null); UserBalance userBalance_child = userBalanceRepository.findById(child.getName()).orElse(null);
if (userBalance_child != null) if (userBalance_child != null)
childbalanced += userBalance_child.getBalanced(); childbalanced += userBalance_child.getBalanced();
List<UserPrePaidBilling> userPrePaidBillings1_child = userPrePaidBillingRepository.findByUsernameAndPayMethod(name, 3); List<UserPrePaidBilling> userPrePaidBillings1_child = userPrePaidBillingRepository.findByUsernameAndPayMethod(child.getName(), 3);
if (userPrePaidBillings1_child != null) if (userPrePaidBillings1_child != null)
childbanktransfer += userPrePaidBillings1_child.stream().mapToDouble(UserPrePaidBilling::getTotal).sum(); childbanktransfer += userPrePaidBillings1_child.stream().mapToDouble(UserPrePaidBilling::getTotal).sum();
} }
......
...@@ -13,6 +13,7 @@ import org.slf4j.LoggerFactory; ...@@ -13,6 +13,7 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.*; import org.springframework.http.*;
import org.springframework.http.client.SimpleClientHttpRequestFactory;
import org.springframework.scheduling.annotation.Scheduled; import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.web.client.RestTemplate; import org.springframework.web.client.RestTemplate;
...@@ -169,7 +170,10 @@ public class BrowserTask { ...@@ -169,7 +170,10 @@ public class BrowserTask {
CompletableFuture.runAsync(() -> { CompletableFuture.runAsync(() -> {
if (ipResourceRepository.lockTask(ipResource)) { if (ipResourceRepository.lockTask(ipResource)) {
try { try {
RestTemplate restTemplate = new RestTemplate(); SimpleClientHttpRequestFactory requestFactory = new SimpleClientHttpRequestFactory();
requestFactory.setConnectTimeout(10000);// 设置超时
requestFactory.setReadTimeout(10000);
RestTemplate restTemplate = new RestTemplate(requestFactory);
Map<String, Object> params = new HashMap<>(); Map<String, Object> params = new HashMap<>();
HttpHeaders headers = buildGetHeader(); HttpHeaders headers = buildGetHeader();
HttpEntity<Map<String, Object>> entity = new HttpEntity<>(params, headers); HttpEntity<Map<String, Object>> entity = new HttpEntity<>(params, headers);
......
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