Browse Source

供应商百科part1

Aslee 3 năm trước cách đây
mục cha
commit
ccb22a1bdc

+ 36 - 0
src/main/java/com/caimei/modules/baike/entity/CmBaikeProduct.java

@@ -17,6 +17,8 @@ public class CmBaikeProduct extends DataEntity<CmBaikeProduct> {
 	
 	private static final long serialVersionUID = 1L;
 	private Integer commodityType;		// 分类:1产品,2仪器
+	private Integer publishSource;		// 百科发布来源:1采美,2供应商
+	private Integer shopId;		// 供应商id,publishSource为2时才有值
 	private String name;		// 名称
 	private String alias;		// 别名
 	private String discription;		// 描述
@@ -41,6 +43,8 @@ public class CmBaikeProduct extends DataEntity<CmBaikeProduct> {
 	private Integer typeId;		// 分类id
 	private Integer topPosition;		// 置顶位
 	private Integer status;		// 状态:0停用,1启用
+	private Integer auditStatus;	//百科审核状态:1待审核,2审核通过,3审核失败
+	private String failReason;	//审核失败理由
 	private Date addTime;		// 添加时间
 
 
@@ -330,4 +334,36 @@ public class CmBaikeProduct extends DataEntity<CmBaikeProduct> {
     public void setSeoKeyword(String seoKeyword) {
         this.seoKeyword = seoKeyword;
     }
+
+	public Integer getPublishSource() {
+		return publishSource;
+	}
+
+	public void setPublishSource(Integer publishSource) {
+		this.publishSource = publishSource;
+	}
+
+	public Integer getShopId() {
+		return shopId;
+	}
+
+	public void setShopId(Integer shopId) {
+		this.shopId = shopId;
+	}
+
+	public Integer getAuditStatus() {
+		return auditStatus;
+	}
+
+	public void setAuditStatus(Integer auditStatus) {
+		this.auditStatus = auditStatus;
+	}
+
+	public String getFailReason() {
+		return failReason;
+	}
+
+	public void setFailReason(String failReason) {
+		this.failReason = failReason;
+	}
 }

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

@@ -78,7 +78,11 @@ public class CmBaikeProductController extends BaseController {
 		model.addAttribute("typeList", typeList);
 		model.addAttribute("commodityType", commodityType);
 		model.addAttribute("topLength", null == topLength ? 0 : topLength);
-        return "modules/baike/cmBaikeProductList";
+		if (null != cmBaikeProduct.getPublishSource() && 2 == cmBaikeProduct.getPublishSource()) {
+			return "modules/baike/shopBaikeProductList";
+		} else {
+			return "modules/baike/cmBaikeProductList";
+		}
 	}
 
 	@RequestMapping(value = "form")

+ 1 - 1
src/main/java/com/caimei/modules/info/web/InfoController.java

@@ -172,7 +172,7 @@ public class InfoController extends BaseController {
 		if(StringUtils.equals("1", ltype)) {
 			return "redirect:"+Global.getAdminPath()+"/info/infoLabel/list";
 		}
-		return "redirect:"+Global.getAdminPath()+"/info/info/list?repage";
+		return "redirect:"+Global.getAdminPath()+"/info/info/list?repage&publishSource=1";
 	}
 
 	@RequiresPermissions("info:info:delete")

+ 7 - 0
src/main/resources/mappings/modules/baike/CmBaikeProductMapper.xml

@@ -5,6 +5,8 @@
 	<sql id="cmBaikeProductColumns">
 		a.id AS "id",
 		a.commodityType AS "commodityType",
+		a.publishSource,
+		a.shopId,
 		a.name AS "name",
 		a.alias AS "alias",
 		a.discription AS "discription",
@@ -29,6 +31,8 @@
 		a.typeId AS "typeId",
 		a.topPosition AS "topPosition",
 		a.status AS "status",
+		a.auditStatus,
+		a.failReason,
 		a.addTime AS "addTime",
 		cbt.name as "typeName"
 	</sql>
@@ -83,6 +87,9 @@
 			<if test="commodityType != null">
 				and a.commodityType = #{commodityType}
 			</if>
+			<if test="publishSource != null">
+				and a.publishSource = #{publishSource}
+			</if>
 		</where>
 		<choose>
 			<when test="page !=null and page.orderBy != null and page.orderBy != ''">

+ 222 - 0
src/main/webapp/WEB-INF/views/modules/baike/shopBaikeProductList.jsp

@@ -0,0 +1,222 @@
+<%@ page contentType="text/html;charset=UTF-8" %>
+<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
+<html>
+<head>
+	<title>产品管理</title>
+	<meta name="decorator" content="default"/>
+	<style type="text/css">
+		.table th{text-align: center;}
+		.table td{text-align: center;}
+		.topSelect{
+			width: 80px;
+			position: absolute;
+			right: 60px;
+			background-color: white;
+		}
+	</style>
+	<script type="text/javascript">
+		$(document).ready(function() {
+			
+		});
+		function page(n,s){
+			$("#pageNo").val(n);
+			$("#pageSize").val(s);
+			$("#searchForm").submit();
+        	return false;
+        }
+	</script>
+</head>
+<body>
+	<ul class="nav nav-tabs">
+		<li class=${cmBaikeProduct.commodityType eq 1?"active":""}><a href="${ctx}/baike/cmBaikeProduct/?commodityType=1">产品</a></li>
+		<li class=${cmBaikeProduct.commodityType eq 2?"active":""}><a href="${ctx}/baike/cmBaikeProduct/?commodityType=2">仪器</a></li>
+	</ul>
+	<form:form id="searchForm" modelAttribute="cmBaikeProduct" action="${ctx}/baike/cmBaikeProduct/" method="post" class="breadcrumb form-search">
+		<form:hidden path="commodityType"/>
+		<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
+		<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
+		<div class="ul-form">
+			 <label>ID:</label>
+				<form:input path="id" htmlEscape="false" class="input-medium"/>
+			 <label>${commodityType}名称:</label>
+				<form:input path="name" htmlEscape="false" maxlength="50" class="input-medium"/>
+			 <label>首页置顶:</label>
+			 <form:select path="topFlag" class="input-medium">
+				<form:option value="" label="全部"/>
+				<form:option value="1" label="是"/>
+				<form:option value="0" label="否"/>
+			 </form:select>
+			 <label>${commodityType}分类:</label>
+				<form:select path="typeId" class="input-medium">
+					<form:option value="" label="全部"/>
+					<form:options items="${typeList}" itemLabel="name" itemValue="id" htmlEscape="false"/>
+				</form:select>
+			 <label>状态:</label>
+				<form:select path="status" class="input-medium">
+					<form:option value="" label="全部"/>
+					<form:option value="1" label="启用"/>
+					<form:option value="0" label="停用"/>
+				</form:select>
+			&nbsp;&nbsp;<input id="btnSubmit" class="btn btn-primary" type="submit" value="查询"/>
+			&nbsp;&nbsp;<a class="btn btn-primary" style="width: 50px" href="${ctx}/baike/cmBaikeProduct/form?commodityType=${cmBaikeProduct.commodityType}">添加</a>
+			<div class="clearfix"></div>
+		</div>
+	</form:form>
+	<sys:message content="${message}"/>
+	<table id="contentTable" class="table table-striped table-bordered table-condensed">
+		<thead>
+			<tr>
+				<th>ID</th>
+				<th>${commodityType}名称</th>
+				<th>${commodityType}分类</th>
+				<th>基础浏览量</th>
+				<th>实际浏览量</th>
+				<th>首页置顶位</th>
+				<th>发布时间</th>
+				<th>添加时间</th>
+				<th>状态</th>
+				<th>操作</th>
+			</tr>
+		</thead>
+		<tbody>
+		<c:forEach items="${page.list}" var="cmBaikeProduct" varStatus="index">
+			<tr>
+				<td>
+					${cmBaikeProduct.id}
+				</td>
+				<td>
+					${cmBaikeProduct.name}
+				</td>
+				<td>
+					${cmBaikeProduct.typeName}
+				</td>
+				<td>
+					${cmBaikeProduct.basePv}
+				</td>
+				<td>
+					${cmBaikeProduct.actualPv}
+				</td>
+				<td>
+					${cmBaikeProduct.topPosition eq 1?'第一位':cmBaikeProduct.topPosition eq 2?'第二位':cmBaikeProduct.topPosition eq 3?'第三位':''}
+				</td>
+				<td>
+					<fmt:formatDate value="${cmBaikeProduct.publishTime}" pattern="yyyy-MM-dd HH:mm:ss"/>
+				</td>
+				<td>
+					<fmt:formatDate value="${cmBaikeProduct.addTime}" pattern="yyyy-MM-dd HH:mm:ss"/>
+				</td>
+				<td>
+					<c:if test="${cmBaikeProduct.status eq 1 }">
+						<font color="green">已启用</font>
+						<a href="javascript:void(0);" onclick="updateStatus(0,${cmBaikeProduct.id});" >
+							停用
+						</a>
+					</c:if>
+					<c:if test="${cmBaikeProduct.status ne 1 }">
+						<font color="red">已停用</font>
+						<a href="javascript:void(0)" onclick="updateStatus(1,${cmBaikeProduct.id});">
+							启用
+						</a>
+					</c:if>
+				</td>
+				<td>
+					<a target="_blank" href="${fns:getConfig('wwwServer')}encyclopedia/${cmBaikeProduct.commodityType eq 1?'product':'instrument'}-${cmBaikeProduct.id}.html">查看</a>
+    				<a href="${ctx}/baike/cmBaikeProduct/form?id=${cmBaikeProduct.id}">编辑</a>
+					<a href="${ctx}/baike/cmBaikeProduct/delete?id=${cmBaikeProduct.id}" onclick="return confirmx('确认要删除该产品吗?', this.href)">删除</a>
+					<a onclick="showTopSelect(${index.index},'open')" href="javascript:void(0)">首页置顶</a>
+					<c:if test="${cmBaikeProduct.topPosition ne null}">
+						<a onclick="updateTopPosition('','${cmBaikeProduct.id}','clearTopPosition')" href="javascript:void(0)">清除置顶</a>
+					</c:if>
+					<div style="display: none" class="topSelect" id="topSelect${index.index}" onmouseleave="showTopSelect(${index.index},'close')">
+						<table style="border: 2px solid #000000;" cellpadding="0" cellspacing="0">
+							<tbody>
+							<tr>
+								<td><a onclick="updateTopPosition('1',${cmBaikeProduct.id},'setTopPosition')" href="javascript:void(0)">置顶第一位</a></td>
+							</tr>
+							<tr>
+								<td><a onclick="updateTopPosition('2',${cmBaikeProduct.id},'setTopPosition')" href="javascript:void(0)">置顶第二位</a></td>
+							</tr>
+							<tr>
+								<td><a onclick="updateTopPosition('3',${cmBaikeProduct.id},'setTopPosition')" href="javascript:void(0)">置顶第三位</a></td>
+							</tr>
+							</tbody>
+						</table>
+					</div>
+				</td>
+			</tr>
+		</c:forEach>
+		</tbody>
+	</table>
+	<div class="pagination">${page}</div>
+<script type="text/javascript">
+	function updateStatus(status, productId) {
+		var commodityType = '${commodityType}'
+		var msg='确定启用该'+commodityType+'吗?';
+		if(0==status) {
+			msg = '确定停用该'+commodityType+'吗?';
+		}
+		top.$.jBox.confirm(msg,'系统提示',function(v,h,f){
+			if(v=='ok'){
+				$.post("${ctx}/baike/cmBaikeProduct/updateStatus",{'status':status,'productId':productId}, function(data) {
+					if(true==data.success){
+						$.jBox.tip(data.msg, 'cmBaikeProduct');
+					} else {
+						$.jBox.tip(data.msg,'error');
+					}
+					setTimeout(function () {
+						$("#searchForm").submit();
+					},1000)
+				},"JSON");//这里返回的类型有:json,html,xml,text
+			}
+			return;
+		},{buttonsFocus:1,persistent: true});
+	}
+
+	//展示置顶选项
+	function showTopSelect(index,status) {
+		if ('open' == status) {
+			document.getElementById("topSelect" + index).style.cssText = "display:block";
+		}else if ('close' == status) {
+			document.getElementById("topSelect" + index).style.cssText = "display:none";
+		}
+	}
+
+	//更新置顶
+	function updateTopPosition(topPosition,id,type) {
+		var msg = '';
+		if ('setTopPosition' == type) {
+			msg = '确认置顶该文章吗?';
+			//已有的置顶文章数量
+			var topLength = ${topLength};
+			if (topPosition - 1 > topLength) {
+				var emptyPosition = topLength == 0 ? '一' : '二' ;
+				msg = '由于当前没有第'+ emptyPosition +'位的置顶文章,将直接把该条文章置顶为第'+emptyPosition+'位';
+				topPosition = topLength == 0 ? 1 : topLength == 1 ? 2 : topLength == 2 ? 3 : topLength == 3 ? 4 : 5;
+			}
+		}
+		if ('clearTopPosition' == type) {
+			msg = '确认清除该条数据的置顶位吗?清除后这条数据将不会在商城首页展示';
+		}
+		top.$.jBox.confirm(msg, '系统提示', function (v, h, f) {
+			if (v == 'ok') {
+				$.post("${ctx}/baike/cmBaikeProduct/updateTopPosition", {
+					'topPosition': topPosition,
+					'id': id,
+					'type':type
+				}, function (data) {
+					if (true == data.success) {
+						$.jBox.tip(data.msg, 'info');
+					} else {
+						$.jBox.tip(data.msg, 'error');
+					}
+					setTimeout(function () {
+						$("#searchForm").submit();
+					},800)
+				}, "JSON");//这里返回的类型有:json,html,xml,text
+			}
+			return;
+		}, {buttonsFocus: 1, persistent: true});
+	}
+</script>
+</body>
+</html>