Browse Source

单据索引实时更新解析过程修改

sunyj 9 years ago
parent
commit
7efcb52c52

+ 18 - 16
search-console/src/main/java/com/uas/search/console/jms/QueueMessageParser.java

@@ -217,9 +217,9 @@ public class QueueMessageParser {
 					component = localComponent;
 				}
 			}
-			// 器件较为特殊,insert和update需分开对待
+			// insert和update需分开对待(update不进行下列判断,直接更新)
 			// update来源还可能来自属性值的变化,而equals是不比较属性值的
-			// (如果比较的话,对于insert器件,即使是同一个,属性值在之后变化了的话,也会视为两个器件,会添加重复的器件索引)
+			// (如果比较的话,对于insert器件,即使是同一个,属性值在之后变化了的话,也会视为两个器件,索引无法删除,之后会添加重复的器件索引)
 			else if (jsonObject.getString("method").equals("insert")) {
 				if (localComponent != null && localComponent.equals(component)) {
 					component = null;
@@ -245,12 +245,8 @@ public class QueueMessageParser {
 			Long id = Long.parseLong(ids[i].toString());
 			OrderSimpleInfo order = orderDao.findById(id);
 			OrderSimpleInfo localOrder = innerOrderSearchService.getOrder(id);
-			System.out.println(order);
-			System.out.println(localOrder);
 			// 删除操作
 			if (jsonObject.getString("method").equals("delete")) {
-				System.out.println("localOrder == null || localOrder.equals(order) " + localOrder == null
-						|| localOrder.equals(order));
 				if (order != null) {
 					// 删除之后,数据还存在,并且与本地索引数据一样,说明是进行了回退,或者重新插入了相同的数据,不对索引进行更新
 					if (localOrder == null || localOrder.equals(order)) {
@@ -260,10 +256,10 @@ public class QueueMessageParser {
 					order = localOrder;
 				}
 			}
-			// 更新或者插入操作
-			else {
-				System.out.println("localOrder != null && localOrder.equals(order) " + localOrder != null
-						&& localOrder.equals(order));
+			// insert和update需分开对待(update不进行下列判断,直接更新)
+			// update来源还可能来自明细的变化,而equals是不比较明细的
+			// (如果比较的话,对于insert,即使是同一个,明细在之后变化了的话,也会视为两个单据,索引无法删除,之后会添加重复的单据索引)
+			else if (jsonObject.getString("method").equals("insert")) {
 				// 本地有相同的数据,不更新索引
 				if (localOrder != null && localOrder.equals(order)) {
 					order = null;
@@ -300,8 +296,10 @@ public class QueueMessageParser {
 					orderInvoice = localOrderInvoice;
 				}
 			}
-			// 更新或者插入操作
-			else {
+			// insert和update需分开对待(update不进行下列判断,直接更新)
+			// update来源还可能来自明细的变化,而equals是不比较明细的
+			// (如果比较的话,对于insert,即使是同一个,明细在之后变化了的话,也会视为两个单据,索引无法删除,之后会添加重复的单据索引)
+			else if (jsonObject.getString("method").equals("insert")) {
 				// 本地有相同的数据,不更新索引
 				if (localOrderInvoice != null && localOrderInvoice.equals(orderInvoice)) {
 					orderInvoice = null;
@@ -338,8 +336,10 @@ public class QueueMessageParser {
 					purchase = localPurchase;
 				}
 			}
-			// 更新或者插入操作
-			else {
+			// insert和update需分开对待(update不进行下列判断,直接更新)
+			// update来源还可能来自明细的变化,而equals是不比较明细的
+			// (如果比较的话,对于insert,即使是同一个,明细在之后变化了的话,也会视为两个单据,索引无法删除,之后会添加重复的单据索引)
+			else if (jsonObject.getString("method").equals("insert")) {
 				// 本地有相同的数据,不更新索引
 				if (localPurchase != null && localPurchase.equals(purchase)) {
 					purchase = null;
@@ -376,8 +376,10 @@ public class QueueMessageParser {
 					purchaseInvoice = localPurchaseInvoice;
 				}
 			}
-			// 更新或者插入操作
-			else {
+			// insert和update需分开对待(update不进行下列判断,直接更新)
+			// update来源还可能来自明细的变化,而equals是不比较明细的
+			// (如果比较的话,对于insert,即使是同一个,明细在之后变化了的话,也会视为两个单据,索引无法删除,之后会添加重复的单据索引)
+			else if (jsonObject.getString("method").equals("insert")) {
 				// 本地有相同的数据,不更新索引
 				if (localPurchaseInvoice != null && localPurchaseInvoice.equals(purchaseInvoice)) {
 					purchaseInvoice = null;

+ 1 - 2
search-console/src/main/java/com/uas/search/console/model/OrderInvoiceSimpleInfo.java

@@ -159,8 +159,7 @@ public class OrderInvoiceSimpleInfo implements Serializable {
 		return Objects.equals(id, other.getId()) && Objects.equals(code, other.getCode())
 				&& Objects.equals(buyeruu, other.getBuyeruu()) && Objects.equals(buyername, other.getBuyername())
 				&& Objects.equals(buyerEnterprise, other.getBuyerEnterprise())
-				&& Objects.equals(createtime, other.getCreatetime()) && Objects.equals(status, other.getStatus())
-				&& Objects.equals(details, other.getDetails());
+				&& Objects.equals(createtime, other.getCreatetime()) && Objects.equals(status, other.getStatus());
 	}
 
 	@Override

+ 1 - 2
search-console/src/main/java/com/uas/search/console/model/OrderSimpleInfo.java

@@ -179,8 +179,7 @@ public class OrderSimpleInfo implements Serializable {
 				&& Objects.equals(buyeruu, other.getBuyeruu()) && Objects.equals(buyername, other.getBuyername())
 				&& Objects.equals(buyerEnterprise, other.getBuyerEnterprise())
 				&& Objects.equals(sellerEnterprise, other.getSellerEnterprise())
-				&& Objects.equals(createtime, other.getCreatetime()) && Objects.equals(status, other.getStatus())
-				&& Objects.equals(details, other.getDetails());
+				&& Objects.equals(createtime, other.getCreatetime()) && Objects.equals(status, other.getStatus());
 	}
 
 	@Override

+ 1 - 2
search-console/src/main/java/com/uas/search/console/model/PurchaseInvoiceSimpleInfo.java

@@ -143,8 +143,7 @@ public class PurchaseInvoiceSimpleInfo implements Serializable {
 		return Objects.equals(id, other.getId()) && Objects.equals(code, other.getCode())
 				&& Objects.equals(sellerenuu, other.getSellerenuu())
 				&& Objects.equals(sellerenname, other.getSellerenname())
-				&& Objects.equals(createtime, other.getCreatetime()) && Objects.equals(status, other.getStatus())
-				&& Objects.equals(details, other.getDetails());
+				&& Objects.equals(createtime, other.getCreatetime()) && Objects.equals(status, other.getStatus());
 	}
 
 	@Override

+ 1 - 2
search-console/src/main/java/com/uas/search/console/model/PurchaseSimpleInfo.java

@@ -141,8 +141,7 @@ public class PurchaseSimpleInfo implements Serializable {
 		return Objects.equals(id, other.getId()) && Objects.equals(code, other.getCode())
 				&& Objects.equals(sellerenuu, other.getSellerenuu())
 				&& Objects.equals(sellerenname, other.getSellerenname())
-				&& Objects.equals(createtime, other.getCreatetime()) && Objects.equals(status, other.getStatus())
-				&& Objects.equals(details, other.getDetails());
+				&& Objects.equals(createtime, other.getCreatetime()) && Objects.equals(status, other.getStatus());
 	}
 
 	@Override

+ 22 - 22
search-console/src/main/webapp/WEB-INF/views/index.html

@@ -9,7 +9,7 @@
 	<div id="mainContainer">
 		<div id="leftContainer">
 			<div id="searchContainer">
-				<h2>类目、品牌、器件搜索</h2>
+				<h2>1. 类目、品牌、器件搜索</h2>
 				<ol>
 					<strong><li class="title">搜索</li></strong>
 					<ol>
@@ -24,10 +24,10 @@
 
 					<strong><li class="title">统计类目、品牌</li></strong>
 					<ol>
-						<u><li class="href">search/kindsByComponent?keyword=aaa&brandId=12</li></u>
-						<u><li class="href">search/brandsByComponent?keyword=aaa&kindId=12</li></u>
-						<u><li class="href">search/kindIdsByComponent?keyword=aaa&brandId=12</li></u>
-						<u><li class="href">search/brandIdsByComponent?keyword=aaa&kindId=12</li></u>
+						<u><li class="href">search/kindsByComponent?keyword=aaa&brandId=56</li></u>
+						<u><li class="href">search/brandsByComponent?keyword=aaa&kindId=304</li></u>
+						<u><li class="href">search/kindIdsByComponent?keyword=aaa&brandId=56</li></u>
+						<u><li class="href">search/brandIdsByComponent?keyword=aaa&kindId=304</li></u>
 					</ol>
 
 					<strong><li class="title">联想词</li></strong>
@@ -52,23 +52,8 @@
 			</div>
 		</div>
 		<div id="rightContainer">
-			<div id="searchContainer">
-				<h2>文件上传</h2>
-				<ol>
-					<u><li class="href">fileUpload?userName=test</li></u>
-				</ol>
-			</div>
-			<div id="indexContainer">
-				<h2>索引修改</h2>
-				<ol>
-					<u><li class="href">index/create</li></u>
-					<u><li class="href">index/listen/start</li></u>
-					<u><li class="href">index/listen/stop</li></u>
-					<u><li class="href">index/maintain?tableName=product$kind&ids=12,328,343</li></u>
-				</ol>
-			</div>
-			<div id="indexContainer">
-				<h2>单据搜索</h2>
+			<div id="orderSearchContainer">
+				<h2>2. 单据搜索</h2>
 				<ol>
 					<strong><li class="title">搜索</li></strong>
 					<ol>
@@ -88,6 +73,21 @@
 					</ol>
 				</ol>
 			</div>
+			<div id="indexContainer">
+				<h2>3. 索引修改</h2>
+				<ol>
+					<u><li class="href">index/create</li></u>
+					<u><li class="href">index/listen/start</li></u>
+					<u><li class="href">index/listen/stop</li></u>
+					<u><li class="href">index/maintain?tableName=product$kind&ids=12,328,343</li></u>
+				</ol>
+			</div>
+			<div id="uploadContainer">
+				<h2>4. 文件上传</h2>
+				<ol>
+					<u><li class="href">fileUpload?userName=test</li></u>
+				</ol>
+			</div>
 		</div>
 	</div>
 </body>

+ 9 - 5
search-console/src/main/webapp/resources/css/index.css

@@ -1,23 +1,27 @@
 body {
-	margin: 30px;
 	font-family: courier;
 }
 
+h2 {
+	margin-top: 30px;
+}
+
 #leftContainer, #rightContainer {
-	width: 45%;
-	margin-left: 2.5%;
-	margin-right: 2.5%;
+	width: 42%;
 	word-wrap: break-world;
 	word-break: break-all;
-	word-wrap: break-world;
 }
 
 #leftContainer {
 	float: left;
+	margin-left: 3%;
+	margin-right: 5%;
 }
 
 #rightContainer {
 	float: right;
+	margin-left: 5%;
+	margin-right: 3%;
 }
 
 li.title {