From ad31648c6f7a8bff1f7ccdf84b76006b9ffb78f8 Mon Sep 17 00:00:00 2001
From: jyy <jyy>
Date: Sat, 17 Jul 2021 15:59:10 +0800
Subject: [PATCH] 1.	新增套餐中有效和无效的操作 2.	会员修改门店功能 3.	套餐新增编辑次数功能 4.	计算是否为赠送的条件为,全部为赠送金额购买且支付金额大于0 5.	打印小票功能调整间距,和收银人 6.	PC端服务单新增划扣金额展示

---
 zq-erp/src/main/java/com/matrix/system/hive/action/ArticleTypeController.java |   23 +++++++++++++++++++++--
 1 files changed, 21 insertions(+), 2 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 30443b0..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
@@ -1,16 +1,22 @@
 package com.matrix.system.hive.action;
 
+import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.List;
 
 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;
 import com.matrix.core.tools.WebUtil;
 import com.matrix.system.common.bean.SysUsers;
 import com.matrix.system.constance.Dictionary;
 import com.matrix.system.hive.bean.ArticleType;
+import com.matrix.system.hive.plugin.message.StringUtil;
+import com.matrix.system.hive.plugin.util.CollectionUtils;
 import com.matrix.system.hive.service.ArticleTypeService;
 import org.springframework.stereotype.Controller;
 import org.springframework.web.bind.annotation.RequestMapping;
@@ -72,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);
 	}
 	
@@ -110,8 +116,21 @@
    		articleType.setType(Dictionary.ARTICEL_TYPE_NAME_MDXY);
 		SysUsers users = WebUtil.getSessionAttribute(MatrixConstance.LOGIN_KEY);
 		articleType.setShopId(users.getShopId());
-		if (articleType.getId() != null) {
+		articleType.setCompanyId(users.getCompanyId());
+		Long parentId = articleType.getParentId();
+		List<Long> ids = new ArrayList<>();
+		while (parentId != 0) {
+			ArticleType type = currentService.findById(parentId);
+			ids.add(type.getId());
+			parentId = type.getParentId();
+		}
 
+		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