|
|
@@ -5,10 +5,10 @@ import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.alipay.api.domain.PriceInfo;
|
|
|
import com.github.kevinsawicki.http.HttpRequest;
|
|
|
-import com.izouma.nineth.domain.BalanceRecord;
|
|
|
-import com.izouma.nineth.domain.Order;
|
|
|
-import com.izouma.nineth.domain.RechargeOrder;
|
|
|
-import com.izouma.nineth.domain.User;
|
|
|
+import com.izouma.nineth.domain.*;
|
|
|
+import com.izouma.nineth.domain.Collection;
|
|
|
+import com.izouma.nineth.dto.PageQuery;
|
|
|
+import com.izouma.nineth.dto.excel.GlobalSearchDTO;
|
|
|
import com.izouma.nineth.enums.BalanceType;
|
|
|
import com.izouma.nineth.enums.CollectionSource;
|
|
|
import com.izouma.nineth.enums.OrderStatus;
|
|
|
@@ -18,6 +18,8 @@ import com.izouma.nineth.repo.*;
|
|
|
import com.izouma.nineth.utils.netease.CheckSumBuilder;
|
|
|
import lombok.AllArgsConstructor;
|
|
|
import org.apache.commons.lang.RandomStringUtils;
|
|
|
+import org.springframework.data.domain.Page;
|
|
|
+import org.springframework.data.domain.PageRequest;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import javax.xml.stream.events.EndDocument;
|
|
|
@@ -33,12 +35,17 @@ import java.util.stream.Collectors;
|
|
|
@AllArgsConstructor
|
|
|
public class StatisticService {
|
|
|
|
|
|
- private UserRepo userRepo;
|
|
|
- private OrderRepo orderRepo;
|
|
|
- private TokenHistoryRepo tokenHistoryRepo;
|
|
|
- private BalanceRecordRepo balanceRecordRepo;
|
|
|
- private PhotoAssetRepo photoAssetRepo;
|
|
|
- private DomainOrderRepo domainOrderRepo;
|
|
|
+ private UserRepo userRepo;
|
|
|
+ private OrderRepo orderRepo;
|
|
|
+ private TokenHistoryRepo tokenHistoryRepo;
|
|
|
+ private BalanceRecordRepo balanceRecordRepo;
|
|
|
+ private PhotoAssetRepo photoAssetRepo;
|
|
|
+ private DomainOrderRepo domainOrderRepo;
|
|
|
+ private CollectionService collectionService;
|
|
|
+ private NewsRepo newsRepo;
|
|
|
+ private MintActivityService mintActivityService;
|
|
|
+ private UserService userService;
|
|
|
+ private CollectionPrivilegeRepo collectionPrivilegeRepo;
|
|
|
|
|
|
public Map<String, Object> total(Long userId, Long companyId) {
|
|
|
User user1 = userRepo.findByIdAndDelFalse(userId).orElseThrow(new BusinessException("无用户"));
|
|
|
@@ -462,4 +469,56 @@ public class StatisticService {
|
|
|
today.put("saas", Optional.ofNullable(saas).orElse(BigDecimal.ZERO));
|
|
|
return today;
|
|
|
}
|
|
|
+
|
|
|
+ public GlobalSearchDTO globalSearch(String search) {
|
|
|
+ GlobalSearchDTO globalSearchDTO = new GlobalSearchDTO();
|
|
|
+ PageQuery pageQuery = new PageQuery();
|
|
|
+ pageQuery.setPage(0);
|
|
|
+ pageQuery.setSize(6);
|
|
|
+ pageQuery.setSort("createdAt,desc");
|
|
|
+ pageQuery.setSearch(search);
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
+ map.put("type", "DEFAULT,BLIND_BOX");
|
|
|
+ map.put("onShelf", true);
|
|
|
+ map.put("del", false);
|
|
|
+ map.put("notLike", "星星的孩子,测试");
|
|
|
+ pageQuery.setQuery(map);
|
|
|
+ Page<Collection> collections1 = collectionService.all(pageQuery).toPage();
|
|
|
+ globalSearchDTO.setCollections(collections1.getContent());
|
|
|
+ globalSearchDTO.setCollectionsAll(collections1.getTotalElements() <= 6);
|
|
|
+ map.put("type", "PICTURE");
|
|
|
+ Page<Collection> collections2 = collectionService.all(pageQuery).toPage();
|
|
|
+ globalSearchDTO.setPictures(collections2.getContent());
|
|
|
+ globalSearchDTO.setPicturesAll(collections2.getTotalElements() <= 6);
|
|
|
+ map.put("type", "DOMAIN");
|
|
|
+ Page<Collection> collections3 = collectionService.all(pageQuery).toPage();
|
|
|
+ globalSearchDTO.setDomains(collections3.getContent());
|
|
|
+ globalSearchDTO.setDomainsAll(collections3.getTotalElements() <= 6);
|
|
|
+ PageRequest pageRequest = PageRequest.of(0, 6);
|
|
|
+ Page<News> news = newsRepo.findByTitleLike("%" + search + "%", pageRequest);
|
|
|
+ globalSearchDTO.setNews(news.getContent());
|
|
|
+ globalSearchDTO.setNewsAll(news.getTotalElements() <= 6);
|
|
|
+ Map<String, Object> mintMap = new HashMap<>();
|
|
|
+ mintMap.put("companyId", 1);
|
|
|
+ mintMap.put("del", false);
|
|
|
+ pageQuery.setQuery(mintMap);
|
|
|
+ Page<MintActivity> mints = mintActivityService.all(pageQuery);
|
|
|
+ globalSearchDTO.setMintActivities(mints.getContent());
|
|
|
+ globalSearchDTO.setMintActivitiesAll(mints.getTotalElements() <= 6);
|
|
|
+ Map<String, Object> minterMap = new HashMap<>();
|
|
|
+ minterMap.put("companyId", 1);
|
|
|
+ minterMap.put("del", false);
|
|
|
+ minterMap.put("minter", true);
|
|
|
+ pageQuery.setQuery(minterMap);
|
|
|
+ Page<User> minters = userService.all(pageQuery).toPage();
|
|
|
+ globalSearchDTO.setMinters(minters.getContent());
|
|
|
+ globalSearchDTO.setMintersAll(minters.getTotalElements() <= 6);
|
|
|
+ Page<User> userPage = userRepo
|
|
|
+ .findByNicknameLikeOrIntroLike("%" + search + "%", "%" + search + "%", pageRequest);
|
|
|
+ globalSearchDTO.setMinters(userPage.getContent());
|
|
|
+ globalSearchDTO.setMintersAll(userPage.getTotalElements() <= 6);
|
|
|
+ return globalSearchDTO;
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
}
|