|
@@ -8,6 +8,7 @@ import com.caimei.www.service.page.ArticleService;
|
|
|
import com.caimei.www.service.page.CmBrandLandingService;
|
|
|
import com.caimei.www.service.page.ProductService;
|
|
|
import com.caimei.www.utils.PaginationVo;
|
|
|
+import com.caimei.www.utils.ResponseJson;
|
|
|
import com.github.pagehelper.PageHelper;
|
|
|
import com.github.pagehelper.PageInfo;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
@@ -58,39 +59,36 @@ public class ArticleController extends BaseController {
|
|
|
* 文章列表【旧center】
|
|
|
*/
|
|
|
@GetMapping("/info/center-{id}-{pageNum}.html")
|
|
|
- public String toArticleList(@PathVariable("id") Integer id, @PathVariable("pageNum") Integer pageNum,
|
|
|
- final Model model) {
|
|
|
+ public String toArticleList(@PathVariable("id") Integer id, @PathVariable("pageNum") Integer pageNum, final Model model) {
|
|
|
List<BaseLink> typeList = articleService.getArticleTypes();
|
|
|
List<CmBrandLandingVO> cmBrandLandingList = cmBrandLandingService.getCmBrandLandingList(new CmBrandLanding()
|
|
|
.setType("4").setAuthorId(id.toString()));
|
|
|
- List<ImageLink> infoSelected = articleService.getArticleSelected(0, 5);
|
|
|
+ List<Article> infoSelected = articleService.getArticleSelected(0, 5);
|
|
|
List<CmProductArchiveFile> archiveFiles = articleService.findArchiveFileAddTime(0, 3);
|
|
|
List<ProductList> productSellNumbers = productService.getProductSellNumbers();
|
|
|
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("articleImages", cmBrandLandingList);// 导航栏图片
|
|
|
- model.addAttribute("infoSelected", infoSelected);// 精选文章
|
|
|
- model.addAttribute("productSellNumbers", productSellNumbers);// 销量前三商品
|
|
|
- model.addAttribute("archiveFiles", archiveFiles);// 最新美业资料top3
|
|
|
+ model.addAttribute("articleType", typeList);//导航栏
|
|
|
+ model.addAttribute("articleImages", cmBrandLandingList);//导航栏图片
|
|
|
+ model.addAttribute("infoSelected", infoSelected);//精选文章
|
|
|
+ model.addAttribute("productSellNumbers", productSellNumbers);//销量前三商品
|
|
|
+ model.addAttribute("archiveFiles", archiveFiles);//最新美业资料top3
|
|
|
model.addAttribute("typeId", id);
|
|
|
model.addAttribute("labelId", 0);
|
|
|
model.addAttribute("pageNum", pageNum);
|
|
|
model.addAttribute("isSearch", true);
|
|
|
- // System.out.println("archiveFiles" + archiveFiles);
|
|
|
- // System.out.println("infoSelected" + infoSelected);
|
|
|
- // model.addAttribute("pagePath", String.format("/info/center-%s-1.html", id));
|
|
|
+ //model.addAttribute("pagePath", String.format("/info/center-%s-1.html", id));
|
|
|
return ARTICLE_LIST_PATH;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
/**
|
|
|
* 文章列表【旧label】
|
|
|
*/
|
|
|
@GetMapping("/info/label-{id}-{pageNum}.html")
|
|
|
- public String toArticleLabel(@PathVariable("id") Integer id, @PathVariable("pageNum") Integer pageNum,
|
|
|
- final Model model) {
|
|
|
+ public String toArticleLabel(@PathVariable("id") Integer id, @PathVariable("pageNum") Integer pageNum, final Model model) {
|
|
|
List<BaseLink> typeList = articleService.getArticleTypes();
|
|
|
List<BaseLink> data = articleService.getArticleLabels().getData();
|
|
|
List<ImageLink> Ads = articleService.getLastestInfoAds().getData();
|
|
@@ -101,7 +99,7 @@ public class ArticleController extends BaseController {
|
|
|
model.addAttribute("labelId", id);
|
|
|
model.addAttribute("pageNum", pageNum);
|
|
|
model.addAttribute("isSearch", false);
|
|
|
- // model.addAttribute("pagePath", String.format("/info/label-%s-1.html", id));
|
|
|
+ //model.addAttribute("pagePath", String.format("/info/label-%s-1.html", id));
|
|
|
return ARTICLE_LIST_PATH;
|
|
|
}
|
|
|
|
|
@@ -109,40 +107,43 @@ public class ArticleController extends BaseController {
|
|
|
* 精选文章和美业资料列表
|
|
|
*/
|
|
|
@GetMapping("/info/articlerecommendation-{id}-{pageNum}.html")
|
|
|
- public String selectedList(@PathVariable("id") Integer id, @PathVariable("pageNum") Integer pageNum,
|
|
|
- final Model model) {
|
|
|
- PageHelper.startPage(pageNum, 10);
|
|
|
+ public String selectedList(@PathVariable("id") Integer id, @PathVariable("pageNum") Integer pageNum, final Model model) {
|
|
|
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) {// 精选文章
|
|
|
+ if (id == 1) {//精选文章
|
|
|
List<CmProductArchiveFile> archiveFiles = articleService.findArchiveFileAddTime(0, 3);
|
|
|
List<ProductList> productSellNumbers = productService.getProductSellNumbers();
|
|
|
- model.addAttribute("productSellNumbers", productSellNumbers);// 销量前三商品
|
|
|
- model.addAttribute("archiveFiles", archiveFiles);// 最新美业资料top3
|
|
|
+ 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("articleType", typeList);//导航栏
|
|
|
model.addAttribute("labelId", 0);
|
|
|
model.addAttribute("pageNum", pageNum);
|
|
|
model.addAttribute("isSearch", true);
|
|
|
- System.out.println("pageData" + pageData);
|
|
|
return ARTICLE_RECOMMENDATION;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 文章搜索结果
|
|
|
+ * 精选文章和美业资料列表数据
|
|
|
*/
|
|
|
+ @ResponseBody
|
|
|
+ @GetMapping("/info/articlerecommendation/{id}/{pageNum}")
|
|
|
+ public ResponseJson<PaginationVo> toPagination(@PathVariable("id") Integer id,@PathVariable("pageNum") Integer pageNum) {
|
|
|
+ PageHelper.startPage(pageNum, 10);
|
|
|
+ PaginationVo pageData = null;
|
|
|
+ if (id == 1) {//精选文章
|
|
|
+ List<Article> infoSelected = articleService.getArticleSelected(null, null);
|
|
|
+ pageData = new PaginationVo<Article>(infoSelected);
|
|
|
+ } else {//美业资料
|
|
|
+ List<CmProductArchiveFile> archiveFiles = articleService.findArchiveFileAddTime(null, null);
|
|
|
+ pageData = new PaginationVo<CmProductArchiveFile>(archiveFiles);
|
|
|
+ }
|
|
|
+ return ResponseJson.success(pageData);
|
|
|
+ }
|
|
|
+
|
|
|
@GetMapping("/info/search-{pageNum}.html")
|
|
|
public String toArticleSearch(@PathVariable("pageNum") Integer pageNum, final Model model) {
|
|
|
List<BaseLink> typeList = articleService.getArticleTypes();
|
|
@@ -155,7 +156,7 @@ public class ArticleController extends BaseController {
|
|
|
model.addAttribute("labelId", 0);
|
|
|
model.addAttribute("pageNum", pageNum);
|
|
|
model.addAttribute("isSearch", false);
|
|
|
- // model.addAttribute("pagePath", "/info/search.html");
|
|
|
+ //model.addAttribute("pagePath", "/info/search.html");
|
|
|
return ARTICLE_LIST_PATH;
|
|
|
}
|
|
|
|
|
@@ -163,8 +164,7 @@ public class ArticleController extends BaseController {
|
|
|
* 文章详情【旧】
|
|
|
*/
|
|
|
@GetMapping("/info/detail-{id}-1.html")
|
|
|
- public String toArticleDetail(@PathVariable("id") Integer id, final Model model,
|
|
|
- ServerWebExchange serverWebExchange, ServerHttpResponse response) {
|
|
|
+ public String toArticleDetail(@PathVariable("id") Integer id, final Model model, ServerWebExchange serverWebExchange, ServerHttpResponse response) {
|
|
|
List<BaseLink> typeList = articleService.getArticleTypes();
|
|
|
Article article = articleService.getArticleInfo(id);
|
|
|
if (article == null) {
|
|
@@ -206,13 +206,13 @@ public class ArticleController extends BaseController {
|
|
|
articles = articleService.getArticleRelatedId(id.toString());
|
|
|
}
|
|
|
String relatedLabels = articleService.relatedLabel(id);
|
|
|
- List<ImageLink> infoSelected = articleService.getArticleSelected(0, 5);
|
|
|
+ List<Article> infoSelected = articleService.getArticleSelected(0, 5);
|
|
|
List<CmProductArchiveFile> archiveFiles = articleService.findArchiveFileAddTime(0, 3);
|
|
|
List<ProductList> productSellNumbers = productService.getProductSellNumbers();
|
|
|
- model.addAttribute("infoSelected", infoSelected);// 精选文章
|
|
|
- model.addAttribute("productSellNumbers", productSellNumbers);// 销量前三商品
|
|
|
- model.addAttribute("archiveFiles", archiveFiles);// 最新美业资料top3
|
|
|
- model.addAttribute("articles", articles);// 相关文章
|
|
|
+ model.addAttribute("infoSelected", infoSelected);//精选文章
|
|
|
+ model.addAttribute("productSellNumbers", productSellNumbers);//销量前三商品
|
|
|
+ model.addAttribute("archiveFiles", archiveFiles);//最新美业资料top3
|
|
|
+ model.addAttribute("articles", articles);//相关文章
|
|
|
model.addAttribute("ads", Ads);
|
|
|
model.addAttribute("labels", data);
|
|
|
model.addAttribute("article", article);
|
|
@@ -242,6 +242,22 @@ public class ArticleController extends BaseController {
|
|
|
return ERROR_PATH;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 文章推荐和文章
|
|
|
+ */
|
|
|
+ @GetMapping("/info/articlerecommendation.html")
|
|
|
+ public String toArticleRecommendation(final Model model) {
|
|
|
+ List<BaseLink> typeList = articleService.getArticleTypes();
|
|
|
+ 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("typeId", 0);
|
|
|
+ model.addAttribute("labelId", 0);
|
|
|
+ return ARTICLE_RECOMMENDATION;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 获取文章热门标签
|
|
|
*/
|
|
@@ -257,8 +273,8 @@ public class ArticleController extends BaseController {
|
|
|
@GetMapping("/article/recommend")
|
|
|
@ResponseBody
|
|
|
public JsonModel<PageInfo<ImageLink>> getArticleRecommended(Integer typeId,
|
|
|
- @RequestParam(value = "pageNum", defaultValue = "1") int pageNum,
|
|
|
- @RequestParam(value = "pageSize", defaultValue = "3") int pageSize) {
|
|
|
+ @RequestParam(value = "pageNum", defaultValue = "1") int pageNum,
|
|
|
+ @RequestParam(value = "pageSize", defaultValue = "3") int pageSize) {
|
|
|
return articleService.getArticleRecommended(typeId, pageNum, pageSize);
|
|
|
}
|
|
|
|
|
@@ -268,8 +284,8 @@ public class ArticleController extends BaseController {
|
|
|
@GetMapping("/article/related")
|
|
|
@ResponseBody
|
|
|
public JsonModel<PageInfo<Article>> getArticleRelated(Integer id, String labels,
|
|
|
- @RequestParam(value = "pageNum", defaultValue = "1") int pageNum,
|
|
|
- @RequestParam(value = "pageSize", defaultValue = "3") int pageSize) {
|
|
|
+ @RequestParam(value = "pageNum", defaultValue = "1") int pageNum,
|
|
|
+ @RequestParam(value = "pageSize", defaultValue = "3") int pageSize) {
|
|
|
return articleService.getArticleRelated(id, labels, pageNum, pageSize);
|
|
|
}
|
|
|
|