From 756e16e090b15c7fd8648f55f5451367face6abc Mon Sep 17 00:00:00 2001
From: jyy <jyy>
Date: Sat, 19 Jun 2021 14:44:58 +0800
Subject: [PATCH] 修复业绩bug

---
 zq-erp/src/main/java/com/matrix/system/hive/action/ArticleTypeController.java |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/zq-erp/src/main/java/com/matrix/system/hive/action/ArticleTypeController.java b/zq-erp/src/main/java/com/matrix/system/hive/action/ArticleTypeController.java
index 2857afc..716ebb0 100644
--- a/zq-erp/src/main/java/com/matrix/system/hive/action/ArticleTypeController.java
+++ b/zq-erp/src/main/java/com/matrix/system/hive/action/ArticleTypeController.java
@@ -7,6 +7,7 @@
 import javax.annotation.Resource;
 
 import com.matrix.core.constance.MatrixConstance;
+import com.matrix.core.exception.GlobleException;
 import com.matrix.core.pojo.AjaxResult;
 import com.matrix.core.pojo.PaginationVO;
 import com.matrix.core.tools.StringUtils;
@@ -77,7 +78,7 @@
 	public @ResponseBody AjaxResult queryAll(ArticleType articleType) {
 		SysUsers users = WebUtil.getSessionAttribute(MatrixConstance.LOGIN_KEY);
 		articleType.setType(Dictionary.ARTICEL_TYPE_NAME_MDXY);
-		articleType.setShopId(users.getShopId());
+		articleType.setCompanyId(users.getCompanyId());
 		return new AjaxResult(AjaxResult.STATUS_SUCCESS,	currentService.findByModel(articleType), 0);
 	}
 	
@@ -115,7 +116,7 @@
    		articleType.setType(Dictionary.ARTICEL_TYPE_NAME_MDXY);
 		SysUsers users = WebUtil.getSessionAttribute(MatrixConstance.LOGIN_KEY);
 		articleType.setShopId(users.getShopId());
-
+		articleType.setCompanyId(users.getCompanyId());
 		Long parentId = articleType.getParentId();
 		List<Long> ids = new ArrayList<>();
 		while (parentId != 0) {
@@ -126,7 +127,10 @@
 
 		articleType.setParentIds(CollectionUtils.isNotEmpty(ids) ? StringUtils.collToStr(ids, ",") : null);
 		if (articleType.getId() != null) {
-
+			// 自己不能是自己的父节点
+			if (articleType.getParentId() != null && articleType.getParentId().equals(articleType.getId())) {
+				throw new GlobleException("父级不能是自己");
+			}
 			return modify(currentService, articleType, "文章类型");
 		} else {
 

--
Gitblit v1.9.1