|
@@ -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();
|
|
|
+ }
|
|
|
}
|