|
|
@@ -1,5 +1,6 @@
|
|
|
package com.izouma.nineth.service;
|
|
|
|
|
|
+import com.alipay.api.domain.OrderInfoDTO;
|
|
|
import com.github.binarywang.wxpay.exception.WxPayException;
|
|
|
import com.huifu.adapay.core.exception.BaseAdaPayException;
|
|
|
import com.huifu.adapay.model.Payment;
|
|
|
@@ -11,6 +12,7 @@ import com.izouma.nineth.dto.UserBankCard;
|
|
|
import com.izouma.nineth.enums.AssetStatus;
|
|
|
import com.izouma.nineth.enums.AuthStatus;
|
|
|
import com.izouma.nineth.enums.OrderStatus;
|
|
|
+import com.izouma.nineth.exception.BusinessException;
|
|
|
import com.izouma.nineth.repo.*;
|
|
|
import com.izouma.nineth.utils.DateTimeUtils;
|
|
|
import com.izouma.nineth.utils.FileUtils;
|
|
|
@@ -20,6 +22,7 @@ import org.apache.commons.collections.MapUtils;
|
|
|
import org.apache.commons.lang3.RandomStringUtils;
|
|
|
import org.junit.Test;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.boot.autoconfigure.security.SecurityProperties;
|
|
|
|
|
|
import java.io.IOException;
|
|
|
import java.math.BigDecimal;
|
|
|
@@ -191,21 +194,21 @@ public class OrderServiceTest extends ApplicationTests {
|
|
|
orderRepo.findByCollectionId(8012L).stream()
|
|
|
.filter(o -> o.getStatus() == OrderStatus.FINISH || o.getStatus() == OrderStatus.PROCESSING)
|
|
|
.parallel().forEach(order -> {
|
|
|
- List<Asset> assets = assetRepo.findByOrderId(order.getId());
|
|
|
- if (assets.size() > 1) {
|
|
|
- assets.sort(Comparator.comparing(BaseEntity::getCreatedAt));
|
|
|
- for (int i = 1; i < assets.size(); i++) {
|
|
|
- assetRepo.delete(assets.get(i));
|
|
|
- tokenHistoryRepo.deleteByTokenId(assets.get(i).getTokenId());
|
|
|
- if (assets.get(i).getPublicCollectionId() != null) {
|
|
|
- collectionRepo.findById(assets.get(i).getPublicCollectionId()).ifPresent(c -> {
|
|
|
- collectionRepo.delete(c);
|
|
|
- });
|
|
|
- }
|
|
|
- }
|
|
|
- ids.add(order.getId());
|
|
|
+ List<Asset> assets = assetRepo.findByOrderId(order.getId());
|
|
|
+ if (assets.size() > 1) {
|
|
|
+ assets.sort(Comparator.comparing(Asset::getCreatedAt));
|
|
|
+ for (int i = 1; i < assets.size(); i++) {
|
|
|
+ assetRepo.delete(assets.get(i));
|
|
|
+ tokenHistoryRepo.deleteByTokenId(assets.get(i).getTokenId());
|
|
|
+ if (assets.get(i).getPublicCollectionId() != null) {
|
|
|
+ collectionRepo.findById(assets.get(i).getPublicCollectionId()).ifPresent(c -> {
|
|
|
+ collectionRepo.delete(c);
|
|
|
+ });
|
|
|
}
|
|
|
- });
|
|
|
+ }
|
|
|
+ ids.add(order.getId());
|
|
|
+ }
|
|
|
+ });
|
|
|
System.out.println(ids);
|
|
|
}
|
|
|
|
|
|
@@ -262,4 +265,14 @@ public class OrderServiceTest extends ApplicationTests {
|
|
|
@Test
|
|
|
public void calcSettle() {
|
|
|
}
|
|
|
+
|
|
|
+ @Test
|
|
|
+ public void transferAsset() {
|
|
|
+ Order order = orderRepo.findById(965645606968102912L).orElseThrow(new BusinessException("订单"));
|
|
|
+ Asset asset = assetRepo.findById(order.getAssetId()).orElseThrow(new BusinessException("无"));
|
|
|
+ User user = userRepo.findById(order.getUserId()).orElseThrow(new BusinessException("暂无"));
|
|
|
+ if (asset.getStatus() == AssetStatus.TRADING) {
|
|
|
+ assetService.transfer(asset, order.getPrice(), user, "订单恢复", order.getId());
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|