|
|
@@ -9,9 +9,7 @@ import com.izouma.nineth.exception.BusinessException;
|
|
|
import com.izouma.nineth.repo.CollectionPrivilegeRepo;
|
|
|
import com.izouma.nineth.repo.CollectionRepo;
|
|
|
import com.izouma.nineth.repo.NewsRepo;
|
|
|
-import com.izouma.nineth.service.CacheService;
|
|
|
-import com.izouma.nineth.service.CollectionService;
|
|
|
-import com.izouma.nineth.service.LikeService;
|
|
|
+import com.izouma.nineth.service.*;
|
|
|
import com.izouma.nineth.utils.SecurityUtils;
|
|
|
import com.izouma.nineth.utils.excel.ExcelUtils;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
@@ -29,6 +27,7 @@ import org.springframework.web.bind.annotation.*;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
import java.io.IOException;
|
|
|
import java.util.*;
|
|
|
+import java.util.concurrent.atomic.AtomicReference;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
@RestController
|
|
|
@@ -41,6 +40,7 @@ public class CollectionController extends BaseController {
|
|
|
private NewsRepo newsRepo;
|
|
|
private CacheService cacheService;
|
|
|
private CollectionPrivilegeRepo collectionPrivilegeRepo;
|
|
|
+ private SysConfigService sysConfigService;
|
|
|
|
|
|
@PreAuthorize("hasAnyRole('ADMIN','SAAS')")
|
|
|
@PostMapping("/save")
|
|
|
@@ -124,7 +124,8 @@ public class CollectionController extends BaseController {
|
|
|
@GetMapping("/myLikes")
|
|
|
@ApiOperation("我收藏的")
|
|
|
public List<CollectionDTO> myLikes(@RequestParam(defaultValue = "1") Long companyId) {
|
|
|
- return collectionService.toDTO(collectionRepo.userLikes(SecurityUtils.getAuthenticatedUser().getId(), companyId));
|
|
|
+ return collectionService
|
|
|
+ .toDTO(collectionRepo.userLikes(SecurityUtils.getAuthenticatedUser().getId(), companyId));
|
|
|
}
|
|
|
|
|
|
@PreAuthorize("hasAnyRole('ADMIN','SAAS')")
|
|
|
@@ -232,10 +233,24 @@ public class CollectionController extends BaseController {
|
|
|
pageQuery.getQuery().remove("salable");
|
|
|
pageQuery.getQuery().put("inPaying", true);
|
|
|
long transactingNum = collectionService.all(pageQuery).getTotal();
|
|
|
+ Long destroyedAssets = 0L;
|
|
|
+ AtomicReference<Long> total = new AtomicReference<>(0L);
|
|
|
+ destroyedAssets = collectionService.countDestroyAssets(search);
|
|
|
+ total.set(collectionRepo.sumAllByNameLike("%" + search + "%"));
|
|
|
+ List<String> configs = Arrays.asList(sysConfigService.getString("tag_total_config").split(";"));
|
|
|
+ configs.forEach(config -> {
|
|
|
+ List<String> conf = Arrays.asList(config.split(","));
|
|
|
+ if (StringUtils.equals(conf.get(0), search)) {
|
|
|
+ total.set(Long.valueOf(conf.get(1)));
|
|
|
+ }
|
|
|
+ });
|
|
|
+ Long tranferCount = total.get() - destroyedAssets;
|
|
|
Map<String, String> map = new HashMap<>();
|
|
|
map.put("onlyShowNum", String.valueOf(onlyShowNum));
|
|
|
map.put("consignmentNum", String.valueOf(consignmentNum));
|
|
|
map.put("transactingNum", String.valueOf(transactingNum));
|
|
|
+ map.put("totalNum", String.valueOf(total));
|
|
|
+ map.put("tranferingNum", String.valueOf(tranferCount));
|
|
|
return map;
|
|
|
}
|
|
|
}
|