|
|
@@ -24,6 +24,7 @@ import org.bytedeco.javacv.Frame;
|
|
|
import org.bytedeco.javacv.Java2DFrameConverter;
|
|
|
import org.junit.jupiter.api.Test;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.boot.test.context.SpringBootTest;
|
|
|
|
|
|
import javax.imageio.ImageIO;
|
|
|
import java.awt.image.BufferedImage;
|
|
|
@@ -38,6 +39,7 @@ import java.util.regex.Matcher;
|
|
|
import java.util.regex.Pattern;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
+@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
|
|
|
class CollectionServiceTest extends ApplicationTests {
|
|
|
|
|
|
@Autowired
|
|
|
@@ -52,6 +54,8 @@ class CollectionServiceTest extends ApplicationTests {
|
|
|
private PrivilegeOptionRepo privilegeOptionRepo;
|
|
|
@Autowired
|
|
|
private SysConfigService sysConfigService;
|
|
|
+ @Autowired
|
|
|
+ private DomainOrderService domainOrderService;
|
|
|
|
|
|
@Test
|
|
|
void toDTO() {
|
|
|
@@ -67,41 +71,41 @@ class CollectionServiceTest extends ApplicationTests {
|
|
|
Arrays.stream(new File("/Users/qiufangchao/Desktop/mugen_mu").listFiles())
|
|
|
.filter(f -> !f.getName().contains(".DS_Store"))
|
|
|
.parallel().forEach(file -> {
|
|
|
- try {
|
|
|
+ try {
|
|
|
// String name = file.getName();
|
|
|
// Pattern p = Pattern.compile("(\\d+)");
|
|
|
// Matcher matcher = p.matcher(name);
|
|
|
// matcher.find();
|
|
|
// String findname = matcher.group();
|
|
|
|
|
|
- Collection collection = JSON.parseObject(jsonStr, Collection.class);
|
|
|
- collection.setId(null);
|
|
|
- collection.setName("MUGEN无限:未央宗#" + num.getAndIncrement());
|
|
|
- collection.setStock(1);
|
|
|
- collection.setTotal(1);
|
|
|
- collection.setSale(0);
|
|
|
- collection.setMinterId(5868950L);
|
|
|
- collection.setOnShelf(false);
|
|
|
- collection.setSalable(false);
|
|
|
+ Collection collection = JSON.parseObject(jsonStr, Collection.class);
|
|
|
+ collection.setId(null);
|
|
|
+ collection.setName("MUGEN无限:未央宗#" + num.getAndIncrement());
|
|
|
+ collection.setStock(1);
|
|
|
+ collection.setTotal(1);
|
|
|
+ collection.setSale(0);
|
|
|
+ collection.setMinterId(5868950L);
|
|
|
+ collection.setOnShelf(false);
|
|
|
+ collection.setSalable(false);
|
|
|
// String thumbPath = "https://cdn.raex.vip/thumb_image/mahjongman/" + file.getName()
|
|
|
// .substring(0, file.getName().lastIndexOf(".")) + ".jpg";
|
|
|
- collection.setPic(Collections
|
|
|
- .singletonList(new FileObject("", "https://cdn.raex.vip/nft/mugen_mu/" + file
|
|
|
- .getName(), null, "image/png")));
|
|
|
+ collection.setPic(Collections
|
|
|
+ .singletonList(new FileObject("", "https://cdn.raex.vip/nft/mugen_mu/" + file
|
|
|
+ .getName(), null, "image/png")));
|
|
|
|
|
|
- collectionRepo.save(collection);
|
|
|
- System.out.println("保存成功" + collection.getId());
|
|
|
+ collectionRepo.save(collection);
|
|
|
+ System.out.println("保存成功" + collection.getId());
|
|
|
|
|
|
- items.add(BlindBoxItem
|
|
|
- .builder()
|
|
|
- .collectionId(collection.getId())
|
|
|
- .total(1)
|
|
|
- .stock(1)
|
|
|
- .rare(false)
|
|
|
- .build());
|
|
|
- } catch (Exception e) {
|
|
|
- }
|
|
|
- });
|
|
|
+ items.add(BlindBoxItem
|
|
|
+ .builder()
|
|
|
+ .collectionId(collection.getId())
|
|
|
+ .total(1)
|
|
|
+ .stock(1)
|
|
|
+ .rare(false)
|
|
|
+ .build());
|
|
|
+ } catch (Exception e) {
|
|
|
+ }
|
|
|
+ });
|
|
|
|
|
|
|
|
|
}
|
|
|
@@ -112,7 +116,7 @@ class CollectionServiceTest extends ApplicationTests {
|
|
|
// 6863188L, 6863438L, 6863449L, 6863588L, 6863608L, 6863671L, 6863745L, 6863760L, 6863938L, 6863954L, 6864008L, 6864081L);
|
|
|
List<Collection> items = collectionRepo.findByNameLike("MUGEN无限:未央宗#%")
|
|
|
.stream()
|
|
|
- .filter(collection -> collection.getCreatedAt().isAfter(LocalDateTime.of(2022,6,28,0,0)))
|
|
|
+ .filter(collection -> collection.getCreatedAt().isAfter(LocalDateTime.of(2022, 6, 28, 0, 0)))
|
|
|
.limit(450L)
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
|
@@ -126,7 +130,8 @@ class CollectionServiceTest extends ApplicationTests {
|
|
|
blindBox.setNoSoldOut(true);
|
|
|
blindBox.setMaxCount(1);
|
|
|
blindBox.setName("MUGEN无限未央宗数字艺术品盲盒");
|
|
|
- blindBox.setPic(Arrays.asList(new FileObject(null, "https://cdn.raex.vip/nft/2022-04-16-19-24-54WTJLmsmR.jpg", null, "image/jpeg")));
|
|
|
+ blindBox.setPic(Arrays
|
|
|
+ .asList(new FileObject(null, "https://cdn.raex.vip/nft/2022-04-16-19-24-54WTJLmsmR.jpg", null, "image/jpeg")));
|
|
|
collectionService.createBlindBox(new CreateBlindBox(blindBox, items.stream().map(i -> {
|
|
|
BlindBoxItem item = new BlindBoxItem();
|
|
|
item.setCollectionId(i.getId());
|
|
|
@@ -249,7 +254,8 @@ class CollectionServiceTest extends ApplicationTests {
|
|
|
blindBox.setNoSoldOut(true);
|
|
|
blindBox.setMaxCount(1);
|
|
|
blindBox.setName("520盲盒");
|
|
|
- blindBox.setPic(Arrays.asList(new FileObject(null, "https://cdn.raex.vip/nft/2022-04-16-19-24-54WTJLmsmR.jpg", null, "image/jpeg")));
|
|
|
+ blindBox.setPic(Arrays
|
|
|
+ .asList(new FileObject(null, "https://cdn.raex.vip/nft/2022-04-16-19-24-54WTJLmsmR.jpg", null, "image/jpeg")));
|
|
|
collectionService.createBlindBox(new CreateBlindBox(blindBox, items.stream().map(i -> {
|
|
|
BlindBoxItem item = new BlindBoxItem();
|
|
|
item.setCollectionId(i.getId());
|
|
|
@@ -258,4 +264,18 @@ class CollectionServiceTest extends ApplicationTests {
|
|
|
}).collect(Collectors.toList()), 1L));
|
|
|
|
|
|
}
|
|
|
+
|
|
|
+ @Test
|
|
|
+ public void searchRTesty() {
|
|
|
+ List<Map<String, Object>> madin = domainOrderService.search("1");
|
|
|
+ System.out.print(madin);
|
|
|
+ }
|
|
|
+// @Test
|
|
|
+// public void clearOldCollection() {
|
|
|
+// List<String> bannedAssets = Arrays.asList(sysConfigService.getString("older_collections").split(",").clone());
|
|
|
+// bannedAssets.forEach(name -> {
|
|
|
+// List<Collection> collections = collectionRepo.findAllByNameLikeAndSalableAndOnShelf();
|
|
|
+// });
|
|
|
+//
|
|
|
+// }
|
|
|
}
|