JiangChongBo 2 anos atrás
pai
commit
d22600a574

+ 7 - 5
src/main/java/com/caimei/modules/baike/service/CmBaikeProductService.java

@@ -177,11 +177,13 @@ public class CmBaikeProductService extends CrudService<CmBaikeProductDao, CmBaik
 		});
 		// 保存参数
 		List<CmBaikeProductParam> paramList = cmBaikeProduct.getParamList();
-		paramList.forEach(param->{
-			if (StringUtils.isNotEmpty(param.getName()) && StringUtils.isNotEmpty(param.getContent())) {
-				cmBaikeProductDao.insertProductParam(param.getName(), param.getContent(), productId);
-			}
-		});
+		if(null!=paramList&&paramList.size()>0){
+			paramList.forEach(param->{
+				if (StringUtils.isNotEmpty(param.getName()) && StringUtils.isNotEmpty(param.getContent())) {
+					cmBaikeProductDao.insertProductParam(param.getName(), param.getContent(), productId);
+				}
+			});
+		}
 		//保存资料
 		List<CmBaikeReferenceInfo> cmBaikeReferenceInfo = cmBaikeProduct.getMaterialInfo();
 		if(null!=cmBaikeReferenceInfo&&cmBaikeReferenceInfo.size()>0){

+ 28 - 1
src/main/java/com/caimei/modules/baike/web/CmBaikeProductController.java

@@ -22,6 +22,7 @@ import com.caimei.modules.user.entity.NewCmShop;
 import com.caimei.redis.RedisService;
 import com.caimei.utils.AppUtils;
 import com.google.common.collect.Maps;
+import com.google.gson.Gson;
 import org.apache.shiro.authz.annotation.RequiresPermissions;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;
@@ -147,7 +148,33 @@ public class CmBaikeProductController extends BaseController {
 		//参考资料
 		if(StringUtils.isNotEmpty(cmBaikeProduct.getId())){
 			List<CmBaikeReferenceInfo> materialInfo = cmBaikeProductDao.getMaterialInfo(Integer.valueOf(cmBaikeProduct.getId()));
-			cmBaikeProduct.setMaterialInfo(materialInfo);
+			if(null!=materialInfo&&materialInfo.size()>0){
+				materialInfo.forEach(material->{
+					SimpleDateFormat simpleDateFormat=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+					//时间格式转换(引文时间)
+					if(null!=material.getAcitationTime()){
+						String acitationTimeStr=simpleDateFormat.format(material.getAcitationTime());
+						material.setAcitationTimeStr(acitationTimeStr);
+						material.setAcitationTime(null);
+					}
+					//时间格式转换(发表时间)
+					if(null!=material.getPublishTime()){
+						String publishTimeStr=simpleDateFormat.format(material.getPublishTime());
+						material.setPublishTimeStr(publishTimeStr);
+						material.setPublishTime(null);
+					}
+					//时间格式转换(出版年)
+					if(null!=material.getPublicationYear()){
+						String publicationYearStr=simpleDateFormat.format(material.getPublicationYear());
+						material.setPublicationYearStr(publicationYearStr);
+						material.setPublicationYear(null);
+					}
+				});
+				cmBaikeProduct.setMaterialInfo(materialInfo);
+				Gson g=new Gson();
+				String refrence=g.toJson(materialInfo);
+				cmBaikeProduct.setReferenceList(refrence);
+			}
 		}
 		//先从reids中获取keyword值,不存在时在查询数据库
 		List<SearchFrequencyVo> searchFrequencyVos=new ArrayList<>();

+ 53 - 41
src/main/webapp/WEB-INF/views/modules/baikePage/cmBaikeProductForm.jsp

@@ -78,6 +78,7 @@
 		}
 		.content-edit .bk-literature li{
 			list-style-type: none;
+			margin-left: -190px;
 			padding: 8px 16px;
 			display: flex;
 			justify-content: space-between;
@@ -515,26 +516,27 @@
 					// })
 					var status = $("input[name='status']:checked").val();
 					// 计算空数据条数
+					debugger
 					var propertyArr = [];
 					var name = $("#name").val();
-					var alias = $("#alias").val();
-					var discription = $("#discription").val();
+					// var alias = $("#alias").val();
+					// var discription = $("#discription").val();
 					var shopId = $("#shopId").val();
-					var param0 = $('input[name="paramList[0].name"]').val();
+					// var param0 = $('input[name="paramList[0].name"]').val();
 					var seoKeyword = $("#seoKeyword").val();
 					var publishTime = $('input[name="publishTime"]').val();
 					var basePv = $("#basePv").val();
 					var typeId = $("#typeId").val();
 
 					propertyArr[0] = name;
-					propertyArr[1] = discription;
-					propertyArr[2] = param0;
-					propertyArr[3] = seoKeyword;
-					propertyArr[4] = shopId;
-					propertyArr[5] = publishTime;
-					propertyArr[6] = basePv;
-					propertyArr[7] = typeId;
-					 propertyArr[8] = alias;
+					// propertyArr[1] = discription;
+					// propertyArr[1] = param0;
+					propertyArr[1] = seoKeyword;
+					propertyArr[2] = shopId;
+					propertyArr[3] = publishTime;
+					propertyArr[4] = basePv;
+					propertyArr[5] = typeId;
+					 // propertyArr[8] = alias;
 					// propertyArr[9] = image;
 					// alert("1111111111111111");
 					var emptyNum = 0;
@@ -549,8 +551,8 @@
 					// 检测敏感词
 					var propertyMap = new Map();
 					propertyMap.set("name", name);
-					propertyMap.set("alias", alias);
-					propertyMap.set("discription", discription);
+					// propertyMap.set("alias", alias);
+					// propertyMap.set("discription", discription);
 					// propertyMap.set("productLink", productLink);
 					for (var i = 0; i <= 9; i++) {
 						var paramName = "\"paramList[" + i + "].name\"";
@@ -916,12 +918,12 @@
 					<div class="control-group" style="margin-left: 100px;margin-top: 30px">
 						<label class="red">*</label>
 						<label class="control-label keyClass">输入网址:</label>
-						<input id="website" style="margin-left: 45px" htmlEscape="false" class="input-xlarge " placeholder="请以http(s)开头"/>
+						<input id="website" required="true" style="margin-left: 45px" htmlEscape="false" class="input-xlarge " placeholder="请以http(s)开头"/>
 					</div>
 					<div class="control-group" style="margin-left: 100px;margin-top: 30px">
 						<label class="red">*</label>
 						<label class="control-label keyClass">文章名字:</label>
-						<input id="articleName" style="margin-left: 45px" htmlEscape="false" class="input-xlarge " placeholder="请输入文章名字"/>
+						<input id="articleName" required="true" style="margin-left: 45px" htmlEscape="false" class="input-xlarge " placeholder="请输入文章名字"/>
 					</div>
 					<div class="control-group" style="margin-left: 100px;margin-top: 30px">
 						<label class="red">*</label>
@@ -1537,18 +1539,44 @@
 	}
 
 	function createReferenceItem(referenceData){
+		var text=null
 		if(referenceData.referenceType == 1){
-			var text = `
-			`
+			   text = 	"<div class=\"controls applicationsan\">"+
+						<%--"<span class=\"del\">[${statusIndex.index}]</span>"+--%>
+						"<span class=\"del\"><a href=\""+referenceData.website+"\" target=\"_blank\">${videoFile.articleName}(文章名称)</a></span>"+
+						"<span class=\"del\">\""+referenceData.websiteName+"\"(网站名称)</span>"+
+						"<span class=\"del\">\""+referenceData.publishTimeStr+"\"(发表日期)</span>"+
+						"<span class=\"del\">\""+referenceData.acitationTimeStr+"\"(引文日期)</span>"+
+						<%--"<a onclick=\"saveMataInfo(${videoFile.id})\">引用资料</a>"+--%>
+						"</div>"
 		}
 		if(referenceData.referenceType == 2){
-
+				text=		"<div class=\"controls applicationsan\">"+
+							"<span class=\"del\">\""+referenceData.author+"\"(作者)</span>"+
+							"<span class=\"del\">\""+referenceData.workName+"\"(著作名)</span>"+
+							"<span class=\"del\">\""+referenceData.publicationPlace+"\"(出版地)</span>"+
+							"<span class=\"del\">\""+referenceData.press+"\"(出版社)</span>"+
+							"<span class=\"del\">\""+referenceData.publicationYearStr+"\"(出版年)</span>"+
+							"<span class=\"del\">\""+referenceData.acitationWeb+"\"(引文页码)</span>"+
+						"</div>"
 		}
 		if(referenceData.referenceType == 3){
-
-		}
+				text=		"<div class=\"controls applicationsan\">"+
+							"<span class=\"del\">\""+referenceData.referenceDescription+"\"(参考资料说明)</span>"+
+							"<span class=\"del\">\""+referenceData.imageDescription+"\"(图片描述)</span>"+
+							"<div class=\"conList\">"+
+								"<img id=\"imgaa\"  src=\""+referenceData.imageUrl+"\"height=\"50px\" width=\"50px\" >(图片)</input>"+
+							"</div>"+
+						"</div>"
+		}
+		return text;
 	}
 	$(function(){
+		var refren='${cmBaikeProduct.referenceList}'
+		if(''==refren|| null==refren){
+		}else{
+			referenceList=JSON.parse(refren)
+		}
 		//初始化 义项名,词条概述
 		createContentEdit('#bk-name','${cmBaikeProduct.alias}')
 		createContentEdit('#discription','${cmBaikeProduct.discription}')
@@ -1563,27 +1591,9 @@
 			if(referenceEditTyp === 'add'){
 				markCount++
 				var result = setRefrenceData({})
-				var con=null;
-				if(result.referenceType == 1){
-					    <%--  con="<div class=\"controls applicationsan\" style=\"margin-top: 5px\">"+--%>
-						<%--	"<span class=\"del\">[${statusIndex.index}]</span>"+--%>
-						<%--	"<span class="del"><a href="${videoFile.website}" target="_blank">${videoFile.articleName}(文章名称)</a></span>"+--%>
-						<%--	"<span class="del">${videoFile.websiteName}(网站名称)</span>"+--%>
-						<%--	"<span class="del">${videoFile.publishTime}(发表日期)</span>"+--%>
-						<%--	"<span class="del">${videoFile.acitationTime}(引文日期)</span>"+--%>
-						<%--	"“<a onclick="saveMataInfo(${videoFile.id})">引用资料</a>"+--%>
-						<%--"</div>"--%>
-				}
-				if(result.referenceType == 2){
-
-				}
-				if(result.referenceType == 3){
-
-				}
-				createReferenceItem(result)
+				var con=createReferenceItem(result)
 				result.ctrlId = currentContentEdit.confirm(con)
 				referenceList.push(result)
-				console.log(referenceList);
 				$(this).parents('#dig').hide()
 				initRefrenceFormData({})
 			}else{
@@ -1602,8 +1612,8 @@
 			$(this).parents('#dig').hide()
 			initRefrenceFormData({})
 		})
-		var referenceList = [{ctrlId: 'FDIEKABKKNJEEJAN'}] // referenceList[0].reyt = 1 // referenceList:'[{"type": 1}]'
-		console.log('${cmBaikeProduct.materialInfo}')
+		<%-- referenceList = [{ctrlId: 'FDIEKABKKNJEEJAN'}] // referenceList[0].reyt = 1 // referenceList:'[{"type": 1}]'--%>
+		<%--console.log('${cmBaikeProduct.materialInfo}')--%>
 		// 初始化编辑框引用资料列表
 		contentEditMap.forEach(function(item){
 			item.edit.ctridList.forEach(function(ctrlId){
@@ -1611,6 +1621,8 @@
 					return ref.ctrlId == ctrlId
 				})
 				if(!data) return
+<%--				<c:forEach items="${cmBaikeProduct.materialInfo}" var="videoFile" varStatus="statusIndex">--%>
+<%--				</c:forEach>--%>
 				var text = createReferenceItem(data)
 				item.addLiteratureItem(ctrlId, text)
 			})

+ 1 - 1
src/main/webapp/WEB-INF/views/modules/baikePage/shopBaikeProductList.jsp

@@ -118,7 +118,7 @@
 					<fmt:formatDate value="${cmBaikeProduct.addTime}" pattern="yyyy-MM-dd HH:mm:ss"/>
 				</td>
 				<td>
-					<a href="${ctx}/baike/cmBaikeProduct/toAuditPage?id=${cmBaikeProduct.id}&commodityType=${cmBaikeProduct.commodityType}&entryId=2"
+					<a href="${ctx}/baike/cmBaikeProduct/toAuditPage?id=${cmBaikeProduct.id}&commodityType=1&entryId=2"
 					   style="display: ${cmBaikeProduct.auditStatus eq 1 or cmBaikeProduct.auditStatus eq 3?'':'none'}">审核</a>
 					<a href="${ctx}/baike/cmBaikeProduct/check?id=${cmBaikeProduct.id}
 					&commodityType=1&publishSource=2">查看</a>