Explorar o código

1.3.3采美百科与词条详情功能开发

JiangChongBo %!s(int64=2) %!d(string=hai) anos
pai
achega
cf699c506e

+ 16 - 0
src/main/java/com/caimei/www/controller/unlimited/EncyclopediaController.java

@@ -1,12 +1,17 @@
 package com.caimei.www.controller.unlimited;
 
 import com.caimei.www.controller.BaseController;
+import com.caimei.www.pojo.baike.BaikeProductVo;
+import com.caimei.www.service.page.ProductService;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;
 import org.springframework.ui.Model;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.PathVariable;
 import org.springframework.web.bind.annotation.RequestMapping;
 
+import java.util.List;
+
 /**
  * 采美百科
  *
@@ -21,12 +26,21 @@ public class EncyclopediaController extends BaseController {
     private static final String ENCYCLOPEDIA_DETAIL = "encyclopedia/detail";
     private static final String ENCYCLOPEDIA_SEARCH = "encyclopedia/search";
     private static final String ENCYCLOPEDIA_ABOUT = "encyclopedia/about";
+    private ProductService productService;
+
+    @Autowired
+    public void setProductService(ProductService productService) {
+        this.productService = productService;
+    }
 
     /*
      * 百科首页
      * */
     @GetMapping("/list.html")
     public String getEncyclopediaList(final Model model) {
+        String entryName=null;
+        List<BaikeProductVo> authUserList = productService.getAuthUserList(entryName);
+        model.addAttribute("authUserList", authUserList);
         return ENCYCLOPEDIA_LIST;
     }
 
@@ -35,6 +49,8 @@ public class EncyclopediaController extends BaseController {
      * */
     @GetMapping("/detail-{id}.html")
     public String getEncyclopediaDetail(final Model model, @PathVariable("id") Integer id) {
+        BaikeProductVo baikeproduct = productService.getEncyclopediaDetail(id);
+        model.addAttribute("baikeproduct", baikeproduct);
         return ENCYCLOPEDIA_DETAIL;
     }
 

+ 17 - 0
src/main/java/com/caimei/www/mapper/BaikeDao.java

@@ -42,4 +42,21 @@ public interface BaikeDao {
 
     List<BaikeProduct> getAutoRecommendList(Integer publishSource, @Param("shopId") Integer shopId, @Param("typeId") Integer typeId, @Param("productId") Integer productId);
 
+
+    List<BaikeProductVo> getAuthUserList(String entryName);
+
+    BaikeProductVo getEntryInfoById(Integer id);
+
+    List<BaikeImageVo> getImageListById(Integer id);
+
+    List<BaikeVideoVo> getVideoListById(Integer id);
+
+    List<BaikeInfoVo> getInfoListById(Integer id);
+
+    List<BaikeTextInfoVo> getTextInfoListById(Integer id);
+
+
+    List<CmBaikeReferenceInfo> getReferenceListById(Integer id);
+
+
 }

+ 16 - 0
src/main/java/com/caimei/www/pojo/baike/BaikeImageVo.java

@@ -0,0 +1,16 @@
+package com.caimei.www.pojo.baike;
+
+import lombok.Data;
+
+@Data
+public class BaikeImageVo {
+    private Integer id;
+    /**
+     * 词条id
+     */
+    private Integer entryId;
+    /**
+     * 图片
+     */
+    private String image;
+}

+ 20 - 0
src/main/java/com/caimei/www/pojo/baike/BaikeInfoVo.java

@@ -0,0 +1,20 @@
+package com.caimei.www.pojo.baike;
+
+import lombok.Data;
+
+@Data
+public class BaikeInfoVo {
+    private Integer id;
+    /**
+     * 词条id
+     */
+    private Integer entryId;
+    /**
+     * 信息名称
+     */
+    private String infoName;
+    /**
+     * 信息内容
+     */
+    private String infoContent;
+}

+ 138 - 0
src/main/java/com/caimei/www/pojo/baike/BaikeProductVo.java

@@ -0,0 +1,138 @@
+package com.caimei.www.pojo.baike;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * Description
+ *
+ * @author : Aslee
+ * @date : 2021/11/25
+ */
+@Data
+public class BaikeProductVo implements Serializable {
+    private static final long serialVersionUID = 1L;
+
+    private Integer productId;
+
+    /**
+     * 商品类型:1产品,2仪器
+     */
+    private Integer commodityType;
+
+    /**
+     * 产品/仪器图片
+     */
+    private String image;
+
+    /**
+     * 产品/仪器名称
+     */
+    private String name;
+
+    /**
+     * 概述
+     */
+    private String discription;
+
+    /**
+     * 发布时间
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    private Date publishTime;
+
+    /**
+     * 浏览量
+     */
+    private Integer pv;
+
+    /**
+     * 问题列表
+     */
+    private List<String> questionList;
+
+    /**
+     * 跳转链接
+     */
+    private String link;
+//--------------------------------------------------1.3.3采美百科词条新加字段---------------------------------------------------
+    /**
+     * 分类id
+     */
+    private Integer typeId;
+    /**
+     *分类名称
+     */
+    private String typeName;
+
+    /**
+     * 百科审核状态:1待审核,2审核通过,3审核失败
+     */
+    private Integer auditStatus;
+
+    /**
+     * 百科上线状态:1待上线,2已上线,3已下线
+     */
+    private Integer onlineStatus;
+    /**
+     * 状态(0保存草稿箱 1已发布)
+     */
+    private Integer status;
+
+    /**
+     * 添加时间
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    private Date addTime;
+    /**
+     * 别名(义项名)
+     */
+    private String alias;
+    /**
+     * seo关键字
+     */
+    private String seoKeyword;
+
+    /**
+     * 概述图册集合
+     */
+    private List<BaikeImageVo> imageList;
+    /**
+     * 信息栏集合
+     */
+    private List<BaikeInfoVo> infoList;
+    /**
+     * 正文集合
+     */
+    private List<BaikeTextInfoVo> textInfoListList;
+    /**
+     * 参考资料集合
+     */
+    private List<CmBaikeReferenceInfo> ReferenceList;
+    /**
+     * 分类集合
+     */
+//    private List<BaikeTypeVo> typeList;
+    /**
+     * 视频列表
+     */
+    private List<BaikeVideoVo> videoList;
+    /**
+     * 词条id
+     */
+    private Integer id;
+    /**
+     * '百科发布来源:1采美365网,2供应商'
+     */
+    private Integer publishSource;
+    /**
+     * 供应商id,publishSource为2时才有值
+     */
+    private Integer shopId;
+
+    private Integer authUserId;
+}

+ 32 - 0
src/main/java/com/caimei/www/pojo/baike/BaikeTextInfoVo.java

@@ -0,0 +1,32 @@
+package com.caimei.www.pojo.baike;
+
+import lombok.Data;
+
+@Data
+public class BaikeTextInfoVo {
+    private Integer id;
+    /**
+     * 信息类型(1:定义;2:原理;3:特点;4:应用)
+     */
+    private Integer textType;
+    /**
+     * 目录内容
+     */
+    private String dictionaryContent;
+    /**
+     * 词条id
+     */
+    private Integer entryId;
+    /**
+     * 参考资料id
+     */
+    private Integer referenceId;
+    /**
+     * 父级id
+     */
+    private Integer parentId;
+    /**
+     * 目录类型(1:一级目录;2:二级目录;3:内容
+     */
+    private Integer dictionaryType;
+}

+ 13 - 0
src/main/java/com/caimei/www/pojo/baike/BaikeVideoVo.java

@@ -0,0 +1,13 @@
+package com.caimei.www.pojo.baike;
+
+import lombok.Data;
+
+@Data
+public class BaikeVideoVo {
+    private Integer id;
+    private Integer entryId;		// 产品/仪器id
+    private String fileTitle;			// 文件标题
+    private String fileName;			// 文件名称
+    private String ossName;			// oss名称
+    private String ossUrl;			// oss链接
+}

+ 107 - 0
src/main/java/com/caimei/www/pojo/baike/CmBaikeReferenceInfo.java

@@ -0,0 +1,107 @@
+package com.caimei.www.pojo.baike;
+
+import lombok.Data;
+
+import java.sql.Timestamp;
+
+@Data
+public class CmBaikeReferenceInfo {
+    private Integer id;
+    /**
+     * 参考类型资料(1.网络;2.著作;3.其他)
+     */
+    private Integer referenceType;
+    /**
+     * 网址
+     */
+    private String website;
+    /**
+     * 文章名字
+     */
+    private String articleName;
+    /**
+     * 网址名称
+     */
+    private String websiteName;
+    /**
+     * 发表时间
+     */
+    private Timestamp publishTime;
+
+    /**
+     * 发表时间
+     */
+    private String publishTimeStr;
+
+    /**
+     * 引文时间
+     */
+    private Timestamp acitationTime;
+
+    /**
+     * 引文时间
+     */
+    private String acitationTimeStr;
+    /**
+    /**
+     * 作者
+     */
+    private String author;
+    /**
+     * 著作名
+     */
+    private String workName;
+    /**
+     * 出版地
+     */
+    private String publicationPlace;
+    /**
+     * 出版社
+     */
+    private String press;
+    /**
+     * 出版年
+     */
+    private Timestamp publicationYear;
+
+    /**
+     * 出版年
+     */
+    private String publicationYearStr;
+    /**
+     * 引文页码
+     */
+    private String acitationWeb;
+    /**
+     * 参考资料说明
+     */
+    private String referenceDescription;
+    /**
+     * 图片描述
+     */
+    private String imageDescription;
+    /**
+     * 图片地址
+     */
+    private String imageUrl;
+    /**
+     * 词条id
+     */
+    private Integer entryId;
+    /**
+     * 词条内容(1:义项名;2:词条概述;3:信息栏;4:正文)
+     */
+    private String entryType;
+    /**
+     * 1:添加;2编辑
+     */
+    private String flagId;
+    /**
+     * 资料id用于前端传值修改
+     */
+    private String  zlId;
+    /**
+     * 关联id
+     */
+    private Integer ctrlId;
+}

+ 6 - 0
src/main/java/com/caimei/www/service/page/ProductService.java

@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.caimei.www.pojo.JsonModel;
 import com.caimei.www.pojo.baike.BaikeProduct;
+import com.caimei.www.pojo.baike.BaikeProductVo;
 import com.caimei.www.pojo.baike.BaikeType;
 import com.caimei.www.pojo.page.Parameter;
 import com.caimei.www.pojo.page.ProductDetail;
@@ -102,4 +103,9 @@ public interface ProductService {
     List<Parameter> getParams(Integer productId);
 
     List<ProductList> getProductLists(Integer productId);
+
+
+    List<BaikeProductVo> getAuthUserList(String entryName);
+
+    BaikeProductVo getEncyclopediaDetail(Integer id);
 }

+ 45 - 0
src/main/java/com/caimei/www/service/page/impl/ProductServiceImpl.java

@@ -22,6 +22,7 @@ import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
+import java.text.SimpleDateFormat;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
@@ -332,4 +333,48 @@ public class ProductServiceImpl implements ProductService {
         baikeDao.encyclopediaPv(id);
         return JsonModel.success();
     }
+    @Override
+    public List<BaikeProductVo> getAuthUserList(String entryName){
+        List<BaikeProductVo> authUserList = baikeDao.getAuthUserList(entryName);
+        return authUserList;
+    }
+
+    @Override
+    public BaikeProductVo getEncyclopediaDetail(Integer id){
+        //获取词条基本信息
+        BaikeProductVo entryInfo = baikeDao.getEntryInfoById(id);
+        //概述图册
+        List<BaikeImageVo>  imageListById = baikeDao.getImageListById(id);
+        entryInfo.setImageList(imageListById);
+        //视频列表
+        List<BaikeVideoVo> videoList = baikeDao.getVideoListById(id);
+        entryInfo.setVideoList(videoList);
+        //信息栏
+        List<BaikeInfoVo> infoList = baikeDao.getInfoListById(id);
+        entryInfo.setInfoList(infoList);
+        //正文
+        List<BaikeTextInfoVo> textInfoListList = baikeDao.getTextInfoListById(id);
+        entryInfo.setTextInfoListList(textInfoListList);
+        //参考资料
+        List<CmBaikeReferenceInfo> referenceList = baikeDao.getReferenceListById(id);
+        if(referenceList!=null&&referenceList.size()>0){
+            for(CmBaikeReferenceInfo reference : referenceList){
+                SimpleDateFormat dateFormat=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+                if(null!=reference.getPublishTime()){
+                    String publishTime= dateFormat.format(reference.getPublishTime());
+                    reference.setPublishTimeStr(publishTime);
+                }
+                if(null!=reference.getAcitationTime()){
+                    String acitationTime= dateFormat.format(reference.getAcitationTime());
+                    reference.setAcitationTimeStr(acitationTime);
+                }
+                if(null!=reference.getPublicationYear()){
+                    String publicationYear= dateFormat.format(reference.getPublicationYear());
+                    reference.setPublicationYearStr(publicationYear);
+                }
+            };
+        }
+        entryInfo.setReferenceList(referenceList);
+        return entryInfo;
+    }
 }

+ 86 - 0
src/main/resources/mapper/BaikeMapper.xml

@@ -100,4 +100,90 @@
 		order by p.addTime desc
 		limit 15
 	</select>
+
+	<select id="getAuthUserList" resultType="com.caimei.www.pojo.baike.BaikeProductVo">
+		select
+		p.id as productId,
+		p.id,
+		p.name,
+		p.discription,
+		p.actualPv as pv,
+		p.publishTime,
+		p.image
+		from cm_baike_product p
+		left join cm_baike_type t on p.typeId=t.id
+		where 1=1
+		<if test="null !=name and '' != name">
+			and  p.name like concat('%',#{entryName},'%')
+		</if>
+	</select>
+
+	<select id="getEntryInfoById" resultType="com.caimei.www.pojo.baike.BaikeProductVo">
+		select
+			p.id as productId,
+			p.id,
+			p.commodityType,
+			p.name,
+			p.discription,
+			p.typeId,
+			p.actualPv as pv,
+			p.auditStatus,
+			p.onlineStatus,
+			p.status,
+			p.publishTime,
+			p.addTime,
+			p.alias,
+			p.image,
+			t.name as typeName,
+			p.publishSource,
+			p.shopId,
+			p.seoKeyword
+		from cm_baike_product p
+				 left join cm_baike_type t on p.typeId=t.id
+		where p.id=#{id}
+	</select>
+
+	<select id="getImageListById"  resultType="com.caimei.www.pojo.baike.BaikeImageVo">
+		select  id,productId as entryId,image from cm_baike_product_image
+		where productId=#{id}
+	</select>
+
+	<select id="getInfoListById"  resultType="com.caimei.www.pojo.baike.BaikeInfoVo">
+		select  id,productId as entryId,name as infoName,content as infoContent from cm_baike_product_param
+		where productId=#{id}
+	</select>
+
+	<select id="getTextInfoListById"  resultType="com.caimei.www.pojo.baike.BaikeTextInfoVo">
+		select  id,productId as entryId,textType,dictionaryContent,referenceId,parentId,dictionaryType from cm_baike_text_info
+		where productId=#{id}
+	</select>
+	<select id="getReferenceListById"  resultType="com.caimei.www.pojo.baike.CmBaikeReferenceInfo">
+		select
+			id,
+			referenceType,
+			website,
+			articleName,
+			websiteName,
+			publishTime,
+			acitationTime,
+			author,
+			workName,
+			publicationPlace,
+			press,
+			publicationYear,
+			acitationWeb,
+			referenceDescription,
+			imageDescription,
+			imageUrl,
+			ctrlId,
+			productId as entryId,
+			productType as entryType
+		from cm_baike_reference_info
+		where productId=#{id}
+	</select>
+	<select id="getVideoListById" resultType="com.caimei.www.pojo.baike.BaikeVideoVo">
+		select id, productId as entryId, fileTitle, fileName, ossName,ossUrl
+		from cm_baike_product_file
+		where productId = #{id}
+	</select>
 </mapper>