Browse Source

采美百科V1.3.3版本功能开发

JiangChongBo 2 years ago
parent
commit
4db1c0b199

+ 194 - 0
src/main/java/com/caimei365/commodity/controller/ProductPageApi.java

@@ -1,5 +1,8 @@
 package com.caimei365.commodity.controller;
 
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
 import com.caimei365.commodity.annotation.IpSave;
 import com.caimei365.commodity.annotation.Statistics;
 import com.caimei365.commodity.model.ResponseJson;
@@ -14,8 +17,13 @@ import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiImplicitParams;
 import io.swagger.annotations.ApiOperation;
 import lombok.RequiredArgsConstructor;
+import org.apache.commons.lang.StringUtils;
 import org.springframework.web.bind.annotation.*;
 
+import java.sql.Timestamp;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
 import java.util.List;
 import java.util.Map;
 
@@ -474,6 +482,192 @@ public class ProductPageApi {
         }
         return pageService.getBaikeTypeData(typeId, pageNum, pageSize);
     }
+//-----------------------------------------------1.3.3采美百科词条----------------------------------------------------------------------------------------
 
+    /**
+     *
+     * @param id 词条id
+     * @param entryName 词条名称
+     * @param typeId 分类id
+     * @param auditStatus 审核状态
+     * @param onlineStatus 上线状态
+     * @param status 状态
+     * @param pageNum 页数
+     * @param pageSize 条数
+     * @return
+     */
+    @GetMapping("/get/authuser/list")
+    public  ResponseJson<PaginationVo<BaikeProductVo>> getAuthUserList(Integer id,String name,Integer typeId,Integer auditStatus,Integer onlineStatus,Integer status, @RequestParam(value = "pageNum", defaultValue = "1") int pageNum,
+                                                                           @RequestParam(value = "pageSize", defaultValue = "20") int pageSize){
+            BaikeProductVo baikeProductVo=new BaikeProductVo();
+            baikeProductVo.setProductId(id);
+            baikeProductVo.setName(name);
+            baikeProductVo.setTypeId(typeId);
+            baikeProductVo.setAuditStatus(auditStatus);
+            baikeProductVo.setOnlineStatus(onlineStatus);
+            baikeProductVo.setStatus(status);
+            return pageService.getAuthUserList(baikeProductVo,pageNum,pageSize);
+        }
+
+    /**
+     * 修改状态  0保存草稿箱  1已发布
+     * @param id
+     * @return
+     */
+    @GetMapping("/up/entry/status")
+    public  ResponseJson upEntryStatusById(Integer id,Integer status){
+        return pageService.upEntryStatusById(id,status);
+    }
+
+    /**
+     * 根据id删除词条
+     * @param id
+     * @return
+     */
+    @GetMapping("/del/entry")
+    public  ResponseJson delEntryStatusById(Integer id){
+        return pageService.delEntryStatusById(id);
+    }
+
+    /**
+     * 根据id查询详细信息
+     * @param id
+     * @return
+     */
+    @GetMapping("/get/entry/info/by/id")
+    public ResponseJson<BaikeProductVo> getEntryInfoById(Integer id){
+        return pageService.getEntryInfoById(id);
+    }
+    /**
+     * 根据id删除资料
+     * @param id
+     * @return
+     */
+    @GetMapping("/del/Reference")
+    public ResponseJson delReferenceById(Integer id){
+        return pageService.delReferenceById(id);
+    }
 
+    /**
+     * 根据id查询资料
+     * @param id
+     * @return
+     */
+    @GetMapping("/get/Reference")
+    public ResponseJson<CmBaikeReferenceInfo> getReferenceById(Integer id){
+        return pageService.getReferenceById(id);
+    }
+
+    /**
+     * 保存资料
+     * @param params
+     * @return
+     */
+    @PostMapping("/save/referenceInfo")
+    public ResponseJson saveReferenceInfoByid(@RequestBody String params){
+        JSONObject paramsMap = JSONObject.parseObject(params);
+        Integer id=paramsMap.getInteger("id");
+        Integer referenceType=paramsMap.getInteger("referenceType");
+        String website=paramsMap.getString("website");
+        String articleName=paramsMap.getString("articleName");
+        String publishTimeStr=paramsMap.getString("publishTimeStr");
+        String acitationTimeStr=paramsMap.getString("acitationTimeStr");
+        String author=paramsMap.getString("author");
+        String workName=paramsMap.getString("workName");
+        String publicationPlace=paramsMap.getString("publicationPlace");
+        String press=paramsMap.getString("press");
+        String publicationYearStr=paramsMap.getString("publicationYearStr");
+        String acitationWeb=paramsMap.getString("acitationWeb");
+        String referenceDescription=paramsMap.getString("referenceDescription");
+        String imageDescription=paramsMap.getString("imageDescription");
+        String imageUrl=paramsMap.getString("imageUrl");
+        Integer entryId=paramsMap.getInteger("entryId");
+        String entryType=paramsMap.getString("entryType");
+        String ctrlId=paramsMap.getString("ctrlId");
+        CmBaikeReferenceInfo cmBaikeReferenceInfo=new CmBaikeReferenceInfo();
+        cmBaikeReferenceInfo.setId(id);
+        cmBaikeReferenceInfo.setReferenceType(referenceType);
+        cmBaikeReferenceInfo.setWebsite(website);
+        cmBaikeReferenceInfo.setArticleName(articleName);
+        cmBaikeReferenceInfo.setPublishTimeStr(publishTimeStr);
+        cmBaikeReferenceInfo.setAcitationTimeStr(acitationTimeStr);
+        cmBaikeReferenceInfo.setAuthor(author);
+        cmBaikeReferenceInfo.setWorkName(workName);
+        cmBaikeReferenceInfo.setPublicationPlace(publicationPlace);
+        cmBaikeReferenceInfo.setPress(press);
+        cmBaikeReferenceInfo.setPublicationYearStr(publicationYearStr);
+        cmBaikeReferenceInfo.setAcitationWeb(acitationWeb);
+        cmBaikeReferenceInfo.setReferenceDescription(referenceDescription);
+        cmBaikeReferenceInfo.setImageDescription(imageDescription);
+        cmBaikeReferenceInfo.setImageUrl(imageUrl);
+        cmBaikeReferenceInfo.setEntryId(entryId);
+        cmBaikeReferenceInfo.setEntryType(entryType);
+        cmBaikeReferenceInfo.setCtrlId(ctrlId);
+        if(null!=cmBaikeReferenceInfo.getId()){
+            return pageService.upReferenceInfoByid(cmBaikeReferenceInfo);
+        }else{
+            return pageService.insertReferenceInfo(cmBaikeReferenceInfo);
+        }
+    }
+
+    /**
+     * 获取分类下来列表
+     * @return
+     */
+    @GetMapping("/get/type/list")
+    public ResponseJson<List<BaikeTypeVo>> geTypeList(){
+        return pageService.geTypeList();
+    }
+
+    /**
+     * 保存词条详细信息
+     * @return
+     */
+    @PostMapping("/save/entry/info")
+    public ResponseJson saveEntryInfo(BaikeProductVo baikeProductVo){
+//        BaikeProductVo baikeProductVo =new BaikeProductVo();
+//        baikeProductVo.setId(id);
+//        baikeProductVo.setName(name);
+//        baikeProductVo.setAlias(alias);
+//        baikeProductVo.setDiscription(discriotion);
+//        baikeProductVo.setImage(img);
+//        baikeProductVo.setTypeId(typeId);
+//        baikeProductVo.setSeoKeyword(seoKeyword);
+//        baikeProductVo.setStatus(status);
+//        baikeProductVo.setImageList(imageList);
+//        baikeProductVo.setInfoList(infoList);
+//        baikeProductVo.setReferenceList(referenceList);
+//        baikeProductVo.setVideoList(videoList);
+        //json转集合对象 概述图册
+        String imgListStr =baikeProductVo.getImageListStr();
+        List<BaikeImageVo> baikeImageVos = JSONArray.parseArray(imgListStr, BaikeImageVo.class);
+        baikeProductVo.setImageList(baikeImageVos);
+        //json转集合对象 信息栏
+        String infoListStr =baikeProductVo.getInfoListStr();
+        List<BaikeInfoVo> infoList = JSONArray.parseArray(infoListStr, BaikeInfoVo.class);
+        baikeProductVo.setInfoList(infoList);
+        //json转集合对象 正文
+        String textlistStr =baikeProductVo.getTextInfoListStr();
+        List<BaikeTextInfoVo> textlist = JSONArray.parseArray(textlistStr, BaikeTextInfoVo.class);
+        baikeProductVo.setTextInfoList(textlist);
+        //json转集合对象 参考资料
+        String referenceListStr =baikeProductVo.getReferenceListStr();
+        List<CmBaikeReferenceInfo> referenceList = JSONArray.parseArray(referenceListStr, CmBaikeReferenceInfo.class);
+        baikeProductVo.setReferenceList(referenceList);
+        //json转集合对象 视频
+        String videoListStr =baikeProductVo.getVideoListStr();
+        List<BaikeVideoVo> videoList = JSONArray.parseArray(videoListStr, BaikeVideoVo.class);
+        baikeProductVo.setVideoList(videoList);
+        if(null!=baikeProductVo&&null!=baikeProductVo.getId()){
+            baikeProductVo.setProductId(baikeProductVo.getId());
+        }
+        if(null!=baikeProductVo&&null!= baikeProductVo.getProductId()){
+            //编辑
+            return pageService.upEntryInfo(baikeProductVo);
+        }else{
+            //新增
+            return pageService.insertEntryInfo(baikeProductVo);
+
+        }
+    }
 }

+ 58 - 0
src/main/java/com/caimei365/commodity/mapper/PageMapper.java

@@ -414,4 +414,62 @@ public interface PageMapper {
     List<BrandVo> getNewFloorBrand();
 
     String findLink(Integer productId);
+
+    List<BaikeProductVo> getAuthUserList(BaikeProductVo baikeProductVo);
+
+    void upEntryStatusById(Integer id,Integer status,Date publishTime);
+
+    void delEntryStatusById(Integer id);
+
+    BaikeProductVo getEntryInfoById(Integer id);
+
+    List<BaikeImageVo> getImageListById(Integer id);
+
+    List<BaikeInfoVo> getInfoListById(Integer id);
+
+    List<BaikeTextInfoVo> getTextInfoListById(Integer id);
+
+
+    List<CmBaikeReferenceInfo> getReferenceListById(Integer id);
+
+    List<BaikeTypeVo> geTypeList();
+
+    List<BaikeVideoVo> getVideoListById(Integer id);
+
+    void delReferenceById(Integer id);
+
+    CmBaikeReferenceInfo getReferenceById(Integer id);
+
+    void upReferenceInfoByid(CmBaikeReferenceInfo cmBaikeReferenceInfo);
+
+    void insertReferenceInfo(CmBaikeReferenceInfo cmBaikeReferenceInfo);
+
+    void upEntryInfo(BaikeProductVo cmBaikeReferenceInfo);
+
+    void insertEntryInfo(BaikeProductVo cmBaikeReferenceInfo);
+
+    void delImageListByEntryId(Integer id);
+    void delVideoListByEntryId(Integer id);
+    void delInfoListByEntryId(Integer id);
+    void delTextListByEntryId(Integer id);
+    void delreferenceByEntryId(Integer id);
+
+
+    void insertImage(BaikeImageVo baikeImageVo);
+
+    void insertVideo(BaikeVideoVo baikeVideoVo);
+
+    void insertInfo(BaikeInfoVo baikeInfoVo);
+
+    void insertText(BaikeTextInfoVo baikeInfoVo);
+
+    void insertreference(CmBaikeReferenceInfo baikeInfoVo);
+
+
+
+    Integer getentryId();
+
+    Integer getShopid(Integer authUserId);
+
+
 }

+ 16 - 0
src/main/java/com/caimei365/commodity/model/vo/BaikeImageVo.java

@@ -0,0 +1,16 @@
+package com.caimei365.commodity.model.vo;
+
+import lombok.Data;
+
+@Data
+public class BaikeImageVo {
+    private Integer id;
+    /**
+     * 词条id
+     */
+    private Integer entryId;
+    /**
+     * 图片
+     */
+    private String image;
+}

+ 20 - 0
src/main/java/com/caimei365/commodity/model/vo/BaikeInfoVo.java

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

+ 103 - 1
src/main/java/com/caimei365/commodity/model/vo/BaikeProductVo.java

@@ -43,7 +43,7 @@ public class BaikeProductVo implements Serializable {
     /**
      * 发布时间
      */
-    @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
     private Date publishTime;
 
     /**
@@ -60,4 +60,106 @@ public class BaikeProductVo implements Serializable {
      * 跳转链接
      */
     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> textInfoList;
+    /**
+     * 参考资料集合
+     */
+    private List<CmBaikeReferenceInfo> ReferenceList;
+    /**
+     * 分类集合
+     */
+    private List<BaikeTypeVo> typeList;
+    /**
+     * 视频列表
+     */
+    private List<BaikeVideoVo> videoList;
+
+    /**
+     * 概述图册集合
+     */
+    private String imageListStr;
+    /**
+     * 信息栏集合
+     */
+    private String infoListStr;
+    /**
+     * 正文集合
+     */
+    private String textInfoListStr;
+    /**
+     * 参考资料集合
+     */
+    private String ReferenceListStr;
+    /**
+     * 分类集合
+     */
+    private String typeListStr;
+    /**
+     * 视频列表
+     */
+    private String videoListStr;
+
+    /**
+     * 词条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/caimei365/commodity/model/vo/BaikeTextInfoVo.java

@@ -0,0 +1,32 @@
+package com.caimei365.commodity.model.vo;
+
+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/caimei365/commodity/model/vo/BaikeVideoVo.java

@@ -0,0 +1,13 @@
+package com.caimei365.commodity.model.vo;
+
+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/caimei365/commodity/model/vo/CmBaikeReferenceInfo.java

@@ -0,0 +1,107 @@
+package com.caimei365.commodity.model.vo;
+
+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 String ctrlId;
+}

+ 77 - 0
src/main/java/com/caimei365/commodity/service/PageService.java

@@ -241,4 +241,81 @@ public interface PageService {
      * @param floorContent
      */
     void setFloorLinkType(FloorContentVo floorContent);
+ //--------------------------------- 1.3.3采美百科词条----------------------------------------------------------------------------------------
+    /**
+     * 获取供应商词条信息
+     * @param baikeProductVo
+     * @param pageNum
+     * @param pageSize
+     * @return
+     */
+   ResponseJson<PaginationVo<BaikeProductVo>> getAuthUserList(BaikeProductVo baikeProductVo,Integer pageNum,Integer pageSize);
+
+    /**
+     * 修改状态  0保存草稿箱  1已发布
+     * @param id
+     * @return
+     */
+   ResponseJson upEntryStatusById(Integer id,Integer status);
+    /**
+     * 根据id删除词条
+     * @param id
+     * @return
+     */
+    ResponseJson delEntryStatusById(Integer id);
+
+    /**
+     * 根据id查询详细信息
+     * @param id
+     * @return
+     */
+    ResponseJson<BaikeProductVo> getEntryInfoById(Integer id);
+
+    /**
+     * 根据id删除资料
+     * @param id
+     * @return
+     */
+    ResponseJson delReferenceById(Integer id);
+
+    /**
+     * 根据id查询资料
+     * @param id
+     * @return
+     */
+    ResponseJson<CmBaikeReferenceInfo> getReferenceById(Integer id);
+
+    /**
+     * 更新资料
+     * @param cmBaikeReferenceInfo
+     * @return
+     */
+    ResponseJson upReferenceInfoByid(CmBaikeReferenceInfo cmBaikeReferenceInfo);
+
+    /**
+     * 新增资料
+     * @param cmBaikeReferenceInfo
+     * @return
+     */
+    ResponseJson insertReferenceInfo(CmBaikeReferenceInfo cmBaikeReferenceInfo);
+
+    /**
+     * 获取分类下来列表
+     * @return
+     */
+    ResponseJson<List<BaikeTypeVo>> geTypeList();
+
+    /**
+     * 修改词条详细信息
+     * @param baikeProductVo
+     * @return
+     */
+    ResponseJson upEntryInfo(BaikeProductVo baikeProductVo);
+    /**
+     * 新增词条详细信息
+     * @param baikeProductVo
+     * @return
+     */
+    ResponseJson insertEntryInfo(BaikeProductVo baikeProductVo);
+
 }

+ 323 - 0
src/main/java/com/caimei365/commodity/service/impl/PageServiceImpl.java

@@ -18,7 +18,9 @@ import org.apache.commons.lang.StringUtils;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.cache.annotation.Cacheable;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.CollectionUtils;
+import org.springframework.web.bind.annotation.RequestBody;
 
 import javax.annotation.Resource;
 import java.text.ParseException;
@@ -1391,5 +1393,326 @@ public class PageServiceImpl implements PageService {
         PaginationVo<ProductItemVo> pageData = new PaginationVo(list);
         return ResponseJson.success(pageData);
     }
+//-----------------------------------------------1.3.3采美百科词条----------------------------------------------------------------------------------------
 
+    /**
+     * 获取供应商词条信息
+     * @param baikeProductVo
+     * @param pageNum
+     * @param pageSize
+     * @return
+     */
+    @Override
+    public ResponseJson<PaginationVo<BaikeProductVo>> getAuthUserList(BaikeProductVo baikeProductVo,Integer pageNum,Integer pageSize){
+        PageHelper.startPage(pageNum, pageSize);
+        List<BaikeProductVo> authUserList = pageMapper.getAuthUserList(baikeProductVo);
+        PaginationVo<BaikeProductVo> pageData = new PaginationVo(authUserList);
+        return ResponseJson.success(pageData);
+    }
+    /**
+     * 修改状态  0保存草稿箱  1已发布
+     * @param id
+     * @return
+     */
+    @Override
+    public  ResponseJson upEntryStatusById(Integer id,Integer status){
+        Date publishTime=null;
+        if(1==status){
+            publishTime=new Date();
+        }
+        pageMapper.upEntryStatusById(id,status,publishTime);
+        return ResponseJson.success();
+    }
+    /**
+     * 根据id删除词条
+     * @param id
+     * @return
+     */
+    @Override
+    public  ResponseJson delEntryStatusById(Integer id){
+        pageMapper.delEntryStatusById(id);
+        return ResponseJson.success();
+    }
+    /**
+     * 根据id查询详细信息
+     * @param id
+     * @return
+     */
+    public ResponseJson<BaikeProductVo> getEntryInfoById(Integer id){
+        //获取词条信息
+        BaikeProductVo entryInfo = pageMapper.getEntryInfoById(id);
+        //概述图册
+        List<BaikeImageVo>  imageListById = pageMapper.getImageListById(id);
+        entryInfo.setImageList(imageListById);
+        //视频列表
+        List<BaikeVideoVo> videoList = pageMapper.getVideoListById(id);
+        entryInfo.setVideoList(videoList);
+        //信息栏
+        List<BaikeInfoVo> infoList = pageMapper.getInfoListById(id);
+        entryInfo.setInfoList(infoList);
+        //正文
+        List<BaikeTextInfoVo> textInfoListList = pageMapper.getTextInfoListById(id);
+        entryInfo.setTextInfoList(textInfoListList);
+        //参考资料
+        List<CmBaikeReferenceInfo> referenceList = pageMapper.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);
+        //分类集合
+        List<BaikeTypeVo> TypeList = pageMapper.geTypeList();
+        entryInfo.setTypeList(TypeList);
+        return ResponseJson.success(entryInfo);
+    }
+    /**
+     * 根据id删除资料
+     * @param id
+     * @return
+     */
+    @Override
+    public ResponseJson delReferenceById(Integer id){
+        pageMapper.delReferenceById(id);
+        return ResponseJson.success();
+    }
+
+    /**
+     * 根据id查询资料
+     * @param id
+     * @return
+     */
+    @Override
+    public ResponseJson<CmBaikeReferenceInfo> getReferenceById(Integer id){
+        CmBaikeReferenceInfo reference = pageMapper.getReferenceById(id);
+        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);
+        }
+        return ResponseJson.success(reference);
+    }
+    /**
+     * 更新资料
+     * @param cmBaikeReferenceInfo
+     * @return
+     */
+    @Override
+    public ResponseJson upReferenceInfoByid(CmBaikeReferenceInfo cmBaikeReferenceInfo){
+        pageMapper.upReferenceInfoByid(cmBaikeReferenceInfo);
+        return ResponseJson.success();
+    }
+    /**
+     * 新增资料
+     * @param cmBaikeReferenceInfo
+     * @return
+     */
+    @Override
+    public ResponseJson insertReferenceInfo(CmBaikeReferenceInfo cmBaikeReferenceInfo){
+        pageMapper.insertReferenceInfo(cmBaikeReferenceInfo);
+        return ResponseJson.success();
+    }
+    /**
+     * 获取分类下来列表
+     * @return
+     */
+    @Override
+    public ResponseJson<List<BaikeTypeVo>> geTypeList(){
+        List<BaikeTypeVo> TypeList = pageMapper.geTypeList();
+      return ResponseJson.success(TypeList);
+    }
+    /**
+     * 修改词条详细信息
+     * @param baikeProductVo
+     * @return
+     */
+   @Override
+   @Transactional
+    public ResponseJson upEntryInfo(BaikeProductVo baikeProductVo){
+       //根据authUserId获取shopid
+       if(null!=baikeProductVo&&null!=baikeProductVo.getAuthUserId()){
+           Integer shopid = pageMapper.getShopid(baikeProductVo.getAuthUserId());
+           baikeProductVo.setShopId(shopid);
+           baikeProductVo.setPublishSource(2);
+       }
+
+       //保存词条信息
+       if(null!=baikeProductVo&&baikeProductVo.getStatus()==1){
+           Date date=new Date();
+           baikeProductVo.setPublishTime(date);
+       }
+       pageMapper.upEntryInfo(baikeProductVo);
+        //删除概述图片(视频)/信息栏/正文信息
+       pageMapper.delImageListByEntryId(baikeProductVo.getProductId());//图片
+       pageMapper.delVideoListByEntryId(baikeProductVo.getProductId());//视频
+       pageMapper.delInfoListByEntryId(baikeProductVo.getProductId());//信息栏
+       pageMapper.delTextListByEntryId(baikeProductVo.getProductId());//正文
+       pageMapper.delreferenceByEntryId(baikeProductVo.getProductId());//资料
+
+       //保存新的概述图册
+       List<BaikeImageVo> imageList = baikeProductVo.getImageList();
+       if(null!=imageList&&imageList.size()>0){
+           for (BaikeImageVo baikeImageVo:imageList) {
+               baikeImageVo.setEntryId(baikeProductVo.getProductId());
+               pageMapper.insertImage(baikeImageVo);
+           }
+       }
+       //保存视频
+       List<BaikeVideoVo> videoList = baikeProductVo.getVideoList();
+       if(null!=videoList&&videoList.size()>0){
+           for (BaikeVideoVo baikeVideoVo:videoList) {
+               baikeVideoVo.setEntryId(baikeProductVo.getProductId());
+               pageMapper.insertVideo(baikeVideoVo);
+           }
+       }
+       //保存信息栏
+       List<BaikeInfoVo> infoList = baikeProductVo.getInfoList();
+       if(null!=infoList&&infoList.size()>0){
+           for (BaikeInfoVo baikeInfoVo:infoList) {
+               baikeInfoVo.setEntryId(baikeProductVo.getProductId());
+               pageMapper.insertInfo(baikeInfoVo);
+           }
+       }
+       //保存正文
+       List<BaikeTextInfoVo> TextList = baikeProductVo.getTextInfoList();
+       if(null!=infoList&&infoList.size()>0){
+           for (BaikeTextInfoVo baikeInfoVo:TextList) {
+               baikeInfoVo.setEntryId(baikeProductVo.getProductId());
+               pageMapper.insertText(baikeInfoVo);
+           }
+       }
+         //保存资料
+       List<CmBaikeReferenceInfo> referenceList = baikeProductVo.getReferenceList();
+       if(null!=referenceList&&referenceList.size()>0){
+           for (CmBaikeReferenceInfo reference:referenceList) {
+               if(null!=reference){
+                        if(null==reference.getPublicationYear()){
+                           reference.setPublicationYear(null);
+                       }
+                       if(StringUtils.isEmpty(reference.getPublicationYearStr())){
+                           reference.setPublicationYearStr(null);
+                       }
+                       if(null==reference.getPublishTime()){
+                           reference.setPublishTime(null);
+                       }
+                       if(StringUtils.isEmpty(reference.getPublishTimeStr())){
+                           reference.setPublishTimeStr(null);
+                       }
+                       if(null==reference.getAcitationTime()){
+                           reference.setAcitationTime(null);
+                       }
+                       if(StringUtils.isEmpty(reference.getAcitationTimeStr())){
+                           reference.setAcitationTimeStr(null);
+                       }
+                   }
+                   reference.setEntryId(baikeProductVo.getProductId());
+                   pageMapper.insertreference(reference);
+               }
+       }
+       return ResponseJson.success();
+    }
+    /**
+     * 新增词条详细信息
+     * @param baikeProductVo
+     * @return
+     */
+    @Override
+    @Transactional
+    public ResponseJson insertEntryInfo(BaikeProductVo baikeProductVo){
+        //根据authUserId获取shopid
+        if(null!=baikeProductVo&&null!=baikeProductVo.getAuthUserId()){
+            Integer shopid = pageMapper.getShopid(baikeProductVo.getAuthUserId());
+            baikeProductVo.setShopId(shopid);
+            baikeProductVo.setPublishSource(2);
+        }
+        if(null!=baikeProductVo&&baikeProductVo.getStatus()==1){
+            Date date=new Date();
+            baikeProductVo.setPublishTime(date);
+        }
+        //新增词条信息
+        pageMapper.insertEntryInfo(baikeProductVo);
+        //查询新添加的词条id
+        Integer id=pageMapper.getentryId();
+        //保存新的概述图册
+        List<BaikeImageVo> imageList = baikeProductVo.getImageList();
+        if(null!=imageList&&imageList.size()>0){
+            for (BaikeImageVo baikeImageVo:imageList) {
+                baikeImageVo.setEntryId(id);
+                pageMapper.insertImage(baikeImageVo);
+            }
+        }
+        //保存视频
+        List<BaikeVideoVo> videoList = baikeProductVo.getVideoList();
+        if(null!=videoList&&videoList.size()>0){
+            for (BaikeVideoVo baikeVideoVo:videoList) {
+                baikeVideoVo.setEntryId(id);
+                pageMapper.insertVideo(baikeVideoVo);
+            }
+        }
+        //保存信息栏
+        List<BaikeInfoVo> infoList = baikeProductVo.getInfoList();
+        if(null!=infoList&&infoList.size()>0){
+            for (BaikeInfoVo baikeInfoVo:infoList) {
+                baikeInfoVo.setEntryId(id);
+                pageMapper.insertInfo(baikeInfoVo);
+            }
+        }
+        //保存正文
+        List<BaikeTextInfoVo> TextList = baikeProductVo.getTextInfoList();
+        if(null!=infoList&&infoList.size()>0){
+            for (BaikeTextInfoVo baikeInfoVo:TextList) {
+                baikeInfoVo.setEntryId(id);
+                pageMapper.insertText(baikeInfoVo);
+            }
+        }
+        //保存资料
+        List<CmBaikeReferenceInfo> referenceList = baikeProductVo.getReferenceList();
+        if(null!=referenceList&&referenceList.size()>0){
+            for (CmBaikeReferenceInfo reference:referenceList) {
+                if(null!=reference){
+                    if(null==reference.getPublicationYear()){
+                        reference.setPublicationYear(null);
+                    }
+                    if(StringUtils.isEmpty(reference.getPublicationYearStr())){
+                        reference.setPublicationYearStr(null);
+                    }
+                    if(null==reference.getPublishTime()){
+                        reference.setPublishTime(null);
+                    }
+                    if(StringUtils.isEmpty(reference.getPublishTimeStr())){
+                        reference.setPublishTimeStr(null);
+                    }
+                    if(null==reference.getAcitationTime()){
+                        reference.setAcitationTime(null);
+                    }
+                    if(StringUtils.isEmpty(reference.getAcitationTimeStr())){
+                        reference.setAcitationTimeStr(null);
+                    }
+                }
+                reference.setEntryId(baikeProductVo.getProductId());
+                pageMapper.insertreference(reference);
+            }
+        }
+        return ResponseJson.success();
+    }
 }

+ 245 - 2
src/main/resources/mapper/PageMapper.xml

@@ -841,7 +841,7 @@
         where productId = #{productId}
     </select>
     <select id="getSidebarBaike" resultType="com.caimei365.commodity.model.vo.BaikeProductVo">
-        select id as productId, commodityType, name, image, publishTime
+        select id as productId,id, commodityType, name, image, publishTime
         from cm_baike_product
         WHERE topPosition IN (1, 2, 3)
           and status = 1
@@ -856,7 +856,7 @@
         order by -sort desc, addTime desc
     </select>
     <select id="getBaikeProducts" resultType="com.caimei365.commodity.model.vo.BaikeProductVo">
-        select id as productId, commodityType, image, name, discription, publishTime, (basePv + actualPv) as pv
+        select id as productId, id,commodityType, image, name, discription, publishTime, (basePv + actualPv) as pv
         from cm_baike_product
         <where>
             status = 1 and NOW() > publishTime and delFlag = 0 and auditStatus = 2 and onlineStatus = 2
@@ -1066,4 +1066,247 @@
         where productId = #{productId}
         limit 1
     </select>
+
+    <select id="getAuthUserList" resultType="com.caimei365.commodity.model.vo.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.publishSource,
+        p.shopId,
+        t.name as typeName,
+        p.addTime
+        from cm_baike_product p
+        left join cm_baike_type t on p.typeId=t.id
+        where 1=1
+        <if test="null !=productId">
+            and p.id=#{productId}
+        </if>
+        <if test="null !=typeId">
+            and  p.typeId=#{typeId}
+        </if>
+        <if test="null !=auditStatus">
+            and  p.auditStatus=#{auditStatus}
+        </if>
+        <if test="null !=onlineStatus">
+            and p.onlineStatus=#{onlineStatus}
+        </if>
+        <if test="null !=status">
+            and  p.status=#{status}
+        </if>
+        <if test="null !=name and '' != name">
+            and  p.name like concat('%',#{name},'%')
+        </if>
+        order by p.addTime desc
+    </select>
+
+    <update id="upEntryStatusById">
+        update cm_baike_product set status=#{status},publishTime=#{publishTime} where id=#{id};
+    </update>
+    <delete id="delEntryStatusById">
+        delete from cm_baike_product where id=#{id};
+    </delete>
+
+    <select id="getEntryInfoById" resultType="com.caimei365.commodity.model.vo.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.caimei365.commodity.model.vo.BaikeImageVo">
+    select  id,productId as entryId,image from cm_baike_product_image
+        where productId=#{id}
+    </select>
+
+    <select id="getInfoListById"  resultType="com.caimei365.commodity.model.vo.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.caimei365.commodity.model.vo.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.caimei365.commodity.model.vo.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="geTypeList"  resultType="com.caimei365.commodity.model.vo.BaikeTypeVo">
+        select  id as typeId,name from cm_baike_type
+    </select>
+    <select id="getVideoListById" resultType="com.caimei365.commodity.model.vo.BaikeVideoVo">
+        select id, productId as entryId, fileTitle, fileName, ossName,ossUrl
+        from cm_baike_product_file
+        where productId = #{id}
+    </select>
+    <delete id="delReferenceById">
+        delete from cm_baike_reference_info where id=#{id}
+    </delete>
+    <select id="getReferenceById" resultType="com.caimei365.commodity.model.vo.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 id=#{id}
+    </select>
+
+    <update id="upReferenceInfoByid">
+        update cm_baike_reference_info
+        set
+            referenceType=#{referenceType},
+            website=#{website},
+            articleName=#{articleName},
+            websiteName=#{websiteName},
+            publishTime=#{publishTimeStr},
+            acitationTime=#{acitationTimeStr},
+            author=#{author},
+            workName=#{workName},
+            publicationPlace=#{publicationPlace},
+            press=#{press},
+            publicationYear=#{publicationYearStr},
+            acitationWeb=#{acitationWeb},
+            ctrlId=#{ctrlId},
+            referenceDescription=#{referenceDescription},
+            imageDescription=#{imageDescription},
+            imageUrl=#{imageUrl}
+        where id=#{id}
+    </update>
+    <insert id="insertReferenceInfo">
+        insert into
+            cm_baike_reference_info(referenceType, website, articleName,websiteName,publishTime,acitationTime,author,workName,publicationPlace,press,publicationYear,acitationWeb,referenceDescription,imageDescription,imageUrl,productId,productType,ctrlId)
+        values (#{referenceType}, #{website}, #{articleName},#{websiteName},#{publishTimeStr},#{acitationTimeStr},#{author},#{workName},#{publicationPlace},#{press},#{publicationYearStr},#{acitationWeb},#{referenceDescription},#{imageDescription},#{imageUrl},#{entryId},#{entryType},#{ctrlId})
+    </insert>
+
+    <update id="upEntryInfo">
+        update cm_baike_product
+            set
+            commodityType=#{commodityType},
+            name=#{name},
+            discription=#{discription},
+            typeId=#{typeId},
+            auditStatus =1,
+            onlineStatus=1,
+            status=#{status},
+            publishTime=#{publishTime},
+            addTime=NOW(),
+            alias=#{alias},
+            image=#{image},
+            publishSource=#{publishSource},
+            shopId=#{shopId},
+            seoKeyword=#{seoKeyword}
+        where id=#{id}
+    </update>
+
+    <insert id="insertEntryInfo">
+        insert into cm_baike_product
+            (commodityType, name, discription,typeId,actualPv,auditStatus,onlineStatus,status,publishTime,addTime,alias,image,seoKeyword,publishSource,shopId)
+        values (#{commodityType}, #{name}, #{discription},#{typeId},0,1,1,#{status},#{publishTime},NOW(),#{alias},#{image},#{seoKeyword},#{publishSource},#{shopId})
+    </insert>
+    <delete id="delImageListByEntryId">
+        delete from cm_baike_product_image where productId=#{id}
+    </delete>
+    <delete id="delVideoListByEntryId">
+        delete from cm_baike_product_file where productId=#{id}
+    </delete>
+    <delete id="delInfoListByEntryId">
+        delete from cm_baike_product_param where productId=#{id}
+    </delete>
+    <delete id="delTextListByEntryId">
+        delete from cm_baike_text_info where productId=#{id}
+    </delete>
+    <delete id="delreferenceByEntryId">
+        delete from cm_baike_reference_info where productId=#{id}
+    </delete>
+
+    <insert id="insertImage">
+        insert into cm_baike_product_image(productId,image)
+        values(#{entryId},#{image})
+    </insert>
+    <insert id="insertVideo">
+        insert into cm_baike_product_file(productId,fileTitle,fileName,ossName,ossUrl)
+        values(#{entryId},#{fileTitle},#{fileName},#{ossName},#{ossUrl})
+    </insert>
+    <insert id="insertInfo">
+        insert into cm_baike_product_param(productId,name,content)
+        values(#{entryId},#{infoName},#{infoContent})
+    </insert>
+    <insert id="insertText">
+        insert into cm_baike_text_info(textType,productId,dictionaryContent,referenceId,parentId,dictionaryType)
+        values(#{textType},#{entryId},#{dictionaryContent},#{referenceId},#{parentId},#{dictionaryType})
+    </insert>
+    <insert id="insertreference">
+        insert into
+            cm_baike_reference_info(referenceType, website, articleName,websiteName,publishTime,acitationTime,author,workName,publicationPlace,press,publicationYear,acitationWeb,referenceDescription,imageDescription,imageUrl,productId,productType,ctrlId)
+        values (#{referenceType}, #{website}, #{articleName},#{websiteName},#{publishTimeStr},#{acitationTimeStr},#{author},#{workName},#{publicationPlace},#{press},#{publicationYearStr},#{acitationWeb},#{referenceDescription},#{imageDescription},#{imageUrl},#{entryId},#{entryType},#{ctrlId})
+    </insert>
+    <select id="getentryId" resultType="java.lang.Integer">
+        select id from cm_baike_product order by id desc limit 1
+    </select>
+
+    <select id="getShopid" resultType="java.lang.Integer">
+        select cmShopId from cm_brand_auth_user where authUserId=#{authUserId}
+    </select>
 </mapper>