|
|
@ -54,10 +54,7 @@ import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.Arrays; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
import java.util.*; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
/** |
|
|
@ -256,11 +253,8 @@ public class IssueProjectCategoryDictServiceImpl extends BaseServiceImpl<IssuePr |
|
|
|
logger.error(String.format("修改分类信息状态失败,客户Id->%s,分类Id->%s", formDTO.getCustomerId(), formDTO.getCategoryId())); |
|
|
|
throw new RuntimeException("分类信息修改失败!"); |
|
|
|
} |
|
|
|
//修改吧二级分类下默认的标签数据
|
|
|
|
if (issueProjectTagDictDao.updateCustomerTag(formDTO) < NumConstant.ONE) { |
|
|
|
logger.error(String.format("修改标签信息状态失败,客户Id->%s,分类Id->%s", formDTO.getCustomerId(), formDTO.getCategoryId())); |
|
|
|
throw new RuntimeException("分类、标签信息修改失败!"); |
|
|
|
} |
|
|
|
//修改把二级分类下默认的标签数据
|
|
|
|
issueProjectTagDictDao.updateCustomerTag(formDTO); |
|
|
|
//4.修改缓存中标签状态
|
|
|
|
dictRedis.updateTagAvailabilityBySecondCategoryIds(formDTO.getCustomerId(),formDTO.getSecondCategorylist(),formDTO.getType()); |
|
|
|
} |
|
|
@ -313,7 +307,7 @@ public class IssueProjectCategoryDictServiceImpl extends BaseServiceImpl<IssuePr |
|
|
|
// 分类名称在同一个客户下有效数据中不允许重复
|
|
|
|
Integer numCategoryName = baseDao.isCategoryName(formDTO.getCustomerId(), formDTO.getCategoryName(), null,null); |
|
|
|
if (NumConstant.ZERO < numCategoryName) { |
|
|
|
throw new RenException("现添加的一级分类名称 重复"); |
|
|
|
throw new RenException(EpmetErrorCode.CATEGORY_NAME.getCode(), EpmetErrorCode.CATEGORY_NAME.getMsg()); |
|
|
|
} |
|
|
|
IssueProjectCategoryDictEntity entity = this.packageFirstCategoryDictEntity(formDTO); |
|
|
|
baseDao.insert(entity); |
|
|
@ -358,7 +352,7 @@ public class IssueProjectCategoryDictServiceImpl extends BaseServiceImpl<IssuePr |
|
|
|
// 分类名称在同一个客户下有效数据中不允许重复
|
|
|
|
Integer numCategoryName = baseDao.isCategoryName(formDTO.getCustomerId(), formDTO.getCategoryName(), null, formDTO.getCategoryId()); |
|
|
|
if (NumConstant.ZERO < numCategoryName) { |
|
|
|
throw new RenException("现添加的一级分类名称 重复"); |
|
|
|
throw new RenException(EpmetErrorCode.CATEGORY_NAME.getCode(), EpmetErrorCode.CATEGORY_NAME.getMsg()); |
|
|
|
} |
|
|
|
IssueProjectCategoryDictEntity entity = new IssueProjectCategoryDictEntity(); |
|
|
|
entity.setCategoryName(formDTO.getCategoryName()); |
|
|
@ -373,7 +367,7 @@ public class IssueProjectCategoryDictServiceImpl extends BaseServiceImpl<IssuePr |
|
|
|
// 分类名称在同一个客户下同一 一级分类下有效数据中不允许重复
|
|
|
|
Integer numCategoryName = baseDao.isCategoryName(formDTO.getCustomerId(), formDTO.getCategoryName(), formDTO.getParentCategoryId(), null); |
|
|
|
if (NumConstant.ZERO < numCategoryName) { |
|
|
|
throw new RenException("现添加的二级分类名称 重复"); |
|
|
|
throw new RenException(EpmetErrorCode.CATEGORY_NAME.getCode(), EpmetErrorCode.CATEGORY_NAME.getMsg()); |
|
|
|
} |
|
|
|
IssueProjectCategoryDictEntity entity = this.packageSecondCategoryDictEntity(formDTO); |
|
|
|
baseDao.insert(entity); |
|
|
@ -394,6 +388,9 @@ public class IssueProjectCategoryDictServiceImpl extends BaseServiceImpl<IssuePr |
|
|
|
entity.setPid(formDTO.getParentCategoryId()); |
|
|
|
entity.setPids(formDTO.getParentCategoryId()); |
|
|
|
IssueProjectCategoryDictDTO parentCategoryCode = baseDao.selectByCustomerId(formDTO.getCustomerId(),formDTO.getParentCategoryId()); |
|
|
|
if (null == parentCategoryCode) { |
|
|
|
throw new RenException(String.format("获取一级分类信息失败,入参[客户id: %s, 一级分类Id: %s]",formDTO.getCustomerId(),formDTO.getParentCategoryId())); |
|
|
|
} |
|
|
|
entity.setParentCategoryCode(parentCategoryCode.getCategoryCode()); |
|
|
|
// 查询 当前客户下最大的一级分类数。
|
|
|
|
Integer maxCategoryCode = baseDao.getMaxCategoryCode(formDTO.getCustomerId(), parentCategoryCode.getCategoryCode()); |
|
|
@ -419,7 +416,7 @@ public class IssueProjectCategoryDictServiceImpl extends BaseServiceImpl<IssuePr |
|
|
|
// 分类名称在同一个客户下同一 一级分类下有效数据中不允许重复
|
|
|
|
Integer numCategoryName = baseDao.isCategoryName(formDTO.getCustomerId(), formDTO.getCategoryName(), formDTO.getParentCategoryId(), formDTO.getCategoryId()); |
|
|
|
if (NumConstant.ZERO < numCategoryName) { |
|
|
|
throw new RenException("现添加的二级分类名称 重复"); |
|
|
|
throw new RenException(EpmetErrorCode.CATEGORY_NAME.getCode(), EpmetErrorCode.CATEGORY_NAME.getMsg()); |
|
|
|
} |
|
|
|
IssueProjectCategoryDictEntity entity = new IssueProjectCategoryDictEntity(); |
|
|
|
entity.setCategoryName(formDTO.getCategoryName()); |
|
|
@ -431,8 +428,8 @@ public class IssueProjectCategoryDictServiceImpl extends BaseServiceImpl<IssuePr |
|
|
|
|
|
|
|
@Override |
|
|
|
public List<CustomerCategoryResultDTO> customerCategoryList(String customerId) { |
|
|
|
List<CustomerCategoryResultDTO> parentCategoryDict = baseDao.selectListAllCategoryDict(customerId, NumConstant.ZERO_STR); |
|
|
|
List<CustomerCategoryResultDTO> childrenCategoryDict = baseDao.selectListAllCategoryDict(customerId, NumConstant.ONE_STR); |
|
|
|
LinkedList<CustomerCategoryResultDTO> parentCategoryDict = baseDao.selectListAllCategoryDict(customerId, NumConstant.ZERO_STR); |
|
|
|
LinkedList<CustomerCategoryResultDTO> childrenCategoryDict = baseDao.selectListAllCategoryDict(customerId, NumConstant.ONE_STR); |
|
|
|
|
|
|
|
for (CustomerCategoryResultDTO p : parentCategoryDict) { |
|
|
|
List<CustomerCategoryResultDTO> children = new ArrayList<>(); |
|
|
|