|
@@ -7,6 +7,8 @@ import com.caimei.www.pojo.page.*;
|
|
import com.caimei.www.service.page.ArticleService;
|
|
import com.caimei.www.service.page.ArticleService;
|
|
import com.caimei.www.service.page.CmBrandLandingService;
|
|
import com.caimei.www.service.page.CmBrandLandingService;
|
|
import com.caimei.www.service.page.ProductService;
|
|
import com.caimei.www.service.page.ProductService;
|
|
|
|
+import com.caimei.www.utils.PaginationVo;
|
|
|
|
+import com.github.pagehelper.PageHelper;
|
|
import com.github.pagehelper.PageInfo;
|
|
import com.github.pagehelper.PageInfo;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -20,6 +22,7 @@ import org.springframework.web.server.ServerWebExchange;
|
|
import org.thymeleaf.util.StringUtils;
|
|
import org.thymeleaf.util.StringUtils;
|
|
|
|
|
|
import java.text.SimpleDateFormat;
|
|
import java.text.SimpleDateFormat;
|
|
|
|
+import java.util.ArrayList;
|
|
import java.util.Date;
|
|
import java.util.Date;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
|
|
@@ -59,8 +62,8 @@ public class ArticleController extends BaseController {
|
|
List<BaseLink> typeList = articleService.getArticleTypes();
|
|
List<BaseLink> typeList = articleService.getArticleTypes();
|
|
List<CmBrandLandingVO> cmBrandLandingList = cmBrandLandingService.getCmBrandLandingList(new CmBrandLanding()
|
|
List<CmBrandLandingVO> cmBrandLandingList = cmBrandLandingService.getCmBrandLandingList(new CmBrandLanding()
|
|
.setType("4").setAuthorId(id.toString()));
|
|
.setType("4").setAuthorId(id.toString()));
|
|
- List<ImageLink> infoSelected = articleService.getArticleSelected();
|
|
|
|
- List<CmProductArchiveFile> archiveFiles = articleService.findArchiveFileAddTime();
|
|
|
|
|
|
+ List<ImageLink> infoSelected = articleService.getArticleSelected(0, 5);
|
|
|
|
+ List<CmProductArchiveFile> archiveFiles = articleService.findArchiveFileAddTime(0, 3);
|
|
List<ProductList> productSellNumbers = productService.getProductSellNumbers();
|
|
List<ProductList> productSellNumbers = productService.getProductSellNumbers();
|
|
List<BaseLink> data = articleService.getArticleLabels().getData();
|
|
List<BaseLink> data = articleService.getArticleLabels().getData();
|
|
List<ImageLink> Ads = articleService.getLastestInfoAds().getData();
|
|
List<ImageLink> Ads = articleService.getLastestInfoAds().getData();
|
|
@@ -79,6 +82,7 @@ public class ArticleController extends BaseController {
|
|
return ARTICLE_LIST_PATH;
|
|
return ARTICLE_LIST_PATH;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 文章列表【旧label】
|
|
* 文章列表【旧label】
|
|
*/
|
|
*/
|
|
@@ -98,6 +102,38 @@ public class ArticleController extends BaseController {
|
|
return ARTICLE_LIST_PATH;
|
|
return ARTICLE_LIST_PATH;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 精选文章和美业资料列表
|
|
|
|
+ */
|
|
|
|
+ @GetMapping("/info/articlerecommendation-{id}-{pageNum}.html")
|
|
|
|
+ public String selectedList(@PathVariable("id") Integer id, @PathVariable("pageNum") Integer pageNum, final Model model) {
|
|
|
|
+ PageHelper.startPage(pageNum, 10);
|
|
|
|
+ List<BaseLink> typeList = articleService.getArticleTypes();
|
|
|
|
+ PaginationVo pageData = null;
|
|
|
|
+ if (id == 1) {//精选文章
|
|
|
|
+ List<ImageLink> infoSelected = articleService.getArticleSelected(null, null);
|
|
|
|
+ pageData = new PaginationVo<ImageLink>(infoSelected);
|
|
|
|
+ } else {//美业资料
|
|
|
|
+ List<CmProductArchiveFile> archiveFiles = articleService.findArchiveFileAddTime(null, null);
|
|
|
|
+ pageData = new PaginationVo<CmProductArchiveFile>(archiveFiles);
|
|
|
|
+ }
|
|
|
|
+ if (id == 1) {//精选文章
|
|
|
|
+ List<CmProductArchiveFile> archiveFiles = articleService.findArchiveFileAddTime(0, 3);
|
|
|
|
+ List<ProductList> productSellNumbers = productService.getProductSellNumbers();
|
|
|
|
+ model.addAttribute("productSellNumbers", productSellNumbers);//销量前三商品
|
|
|
|
+ model.addAttribute("archiveFiles", archiveFiles);//最新美业资料top3
|
|
|
|
+ }
|
|
|
|
+ List<BaseLink> data = articleService.getArticleLabels().getData();
|
|
|
|
+ List<ImageLink> Ads = articleService.getLastestInfoAds().getData();
|
|
|
|
+ model.addAttribute("ads", Ads);
|
|
|
|
+ model.addAttribute("labels", data);
|
|
|
|
+ model.addAttribute("articleType", typeList);//导航栏
|
|
|
|
+ model.addAttribute("pageData", pageData);
|
|
|
|
+ model.addAttribute("labelId", 0);
|
|
|
|
+ model.addAttribute("pageNum", pageNum);
|
|
|
|
+ model.addAttribute("isSearch", true);
|
|
|
|
+ return ARTICLE_LIST_PATH;
|
|
|
|
+ }
|
|
/**
|
|
/**
|
|
* 文章搜索结果
|
|
* 文章搜索结果
|
|
*/
|
|
*/
|
|
@@ -156,16 +192,20 @@ public class ArticleController extends BaseController {
|
|
log.info("文章详情访问来源记录完成========》" + source);
|
|
log.info("文章详情访问来源记录完成========》" + source);
|
|
List<BaseLink> data = articleService.getArticleLabels().getData();
|
|
List<BaseLink> data = articleService.getArticleLabels().getData();
|
|
List<ImageLink> Ads = articleService.getLastestInfoAds().getData();
|
|
List<ImageLink> Ads = articleService.getLastestInfoAds().getData();
|
|
-// List<Article> articles = articleService.getInfoById(id);
|
|
|
|
|
|
+ List<Article> articles = new ArrayList<>();
|
|
|
|
+ if (null != article && article.getAutoStatus() == 0) {
|
|
|
|
+ articles = articleService.getInfoById(id);
|
|
|
|
+ } else {
|
|
|
|
+ articles = articleService.getArticleRelatedId(id.toString());
|
|
|
|
+ }
|
|
String relatedLabels = articleService.relatedLabel(id);
|
|
String relatedLabels = articleService.relatedLabel(id);
|
|
- List<ImageLink> infoSelected = articleService.getArticleSelected();
|
|
|
|
- List<ImageLink> infoRelated = articleService.getArticleRelatedId(id.toString());
|
|
|
|
- List<CmProductArchiveFile> archiveFiles = articleService.findArchiveFileAddTime();
|
|
|
|
|
|
+ List<ImageLink> infoSelected = articleService.getArticleSelected(0, 5);
|
|
|
|
+ List<CmProductArchiveFile> archiveFiles = articleService.findArchiveFileAddTime(0, 3);
|
|
List<ProductList> productSellNumbers = productService.getProductSellNumbers();
|
|
List<ProductList> productSellNumbers = productService.getProductSellNumbers();
|
|
model.addAttribute("infoSelected", infoSelected);//精选文章
|
|
model.addAttribute("infoSelected", infoSelected);//精选文章
|
|
model.addAttribute("productSellNumbers", productSellNumbers);//销量前三商品
|
|
model.addAttribute("productSellNumbers", productSellNumbers);//销量前三商品
|
|
model.addAttribute("archiveFiles", archiveFiles);//最新美业资料top3
|
|
model.addAttribute("archiveFiles", archiveFiles);//最新美业资料top3
|
|
- model.addAttribute("articles", infoRelated);//相关文章
|
|
|
|
|
|
+ model.addAttribute("articles", articles);//相关文章
|
|
model.addAttribute("ads", Ads);
|
|
model.addAttribute("ads", Ads);
|
|
model.addAttribute("labels", data);
|
|
model.addAttribute("labels", data);
|
|
model.addAttribute("article", article);
|
|
model.addAttribute("article", article);
|