|
|
@@ -1,6 +1,7 @@
|
|
|
package com.izouma.nineth.web;
|
|
|
|
|
|
import com.izouma.nineth.TokenHistory;
|
|
|
+import com.izouma.nineth.config.GeneralProperties;
|
|
|
import com.izouma.nineth.domain.Asset;
|
|
|
import com.izouma.nineth.domain.GiftOrder;
|
|
|
import com.izouma.nineth.domain.User;
|
|
|
@@ -17,6 +18,7 @@ import com.izouma.nineth.utils.SecurityUtils;
|
|
|
import com.izouma.nineth.utils.excel.ExcelUtils;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import lombok.AllArgsConstructor;
|
|
|
+import org.apache.rocketmq.spring.core.RocketMQTemplate;
|
|
|
import org.springframework.data.domain.Page;
|
|
|
import org.springframework.data.domain.Pageable;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
@@ -32,11 +34,13 @@ import java.util.Map;
|
|
|
@RequestMapping("/asset")
|
|
|
@AllArgsConstructor
|
|
|
public class AssetController extends BaseController {
|
|
|
- private AssetService assetService;
|
|
|
- private AssetRepo assetRepo;
|
|
|
- private GiftOrderService giftOrderService;
|
|
|
- private TokenHistoryRepo tokenHistoryRepo;
|
|
|
- private AssetMintService assetMintService;
|
|
|
+ private AssetService assetService;
|
|
|
+ private AssetRepo assetRepo;
|
|
|
+ private GiftOrderService giftOrderService;
|
|
|
+ private TokenHistoryRepo tokenHistoryRepo;
|
|
|
+ private AssetMintService assetMintService;
|
|
|
+ private RocketMQTemplate rocketMQTemplate;
|
|
|
+ private GeneralProperties generalProperties;
|
|
|
|
|
|
//@PreAuthorize("hasRole('ADMIN')")
|
|
|
@PostMapping("/save")
|
|
|
@@ -133,9 +137,9 @@ public class AssetController extends BaseController {
|
|
|
}
|
|
|
|
|
|
@GetMapping("/mint")
|
|
|
- public String mint( ) {
|
|
|
+ public String mint() {
|
|
|
for (Asset asset : assetRepo.findByTxHashIsNullAndTokenIdNotNullAndCreatedAtBefore(LocalDateTime.now())) {
|
|
|
- assetMintService.mint(asset);
|
|
|
+ rocketMQTemplate.syncSend(generalProperties.getMintTopic(), asset.getId());
|
|
|
}
|
|
|
return "ok";
|
|
|
}
|