Browse Source

Merge branch 'dev_issue_category' into dev_temp

master
sunyuchao 4 years ago
parent
commit
59b0f7ebf1
  1. 3
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java
  2. 5
      epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueProjectCategoryDictDao.java
  3. 27
      epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueProjectCategoryDictServiceImpl.java
  4. 1
      epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueProjectCategoryDictDao.xml

3
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java

@ -146,7 +146,8 @@ public enum EpmetErrorCode {
TOPIC_IS_HIDDEN(9006,"该话题已被屏蔽,请先解除屏蔽"), TOPIC_IS_HIDDEN(9006,"该话题已被屏蔽,请先解除屏蔽"),
TOPIC_IS_CLOSED(9008,"该话题已关闭,无法转为议题"), TOPIC_IS_CLOSED(9008,"该话题已关闭,无法转为议题"),
CUSTOMER_CATEGORY(9101,"分类已使用,不允许删除"); CUSTOMER_CATEGORY(9101,"分类已使用,不允许删除"),
CATEGORY_NAME(9102,"分类名称已存在,不允许重复");
private int code; private int code;
private String msg; private String msg;

5
epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueProjectCategoryDictDao.java

@ -29,6 +29,7 @@ import com.epmet.project.dto.result.ProjectCategoryDictResultDTO;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.LinkedList;
import java.util.List; import java.util.List;
/** /**
@ -116,7 +117,7 @@ public interface IssueProjectCategoryDictDao extends BaseDao<IssueProjectCategor
int updateCustomerCategory(IsDisableCategoryFormDTO formDTO); int updateCustomerCategory(IsDisableCategoryFormDTO formDTO);
/** /**
* 获取客户下 最大的分类编码 * 获取客户下 最大的分类编码(包含已被删除的编码)
* *
* @param customerId * @param customerId
* @param parentCategoryCode * @param parentCategoryCode
@ -155,5 +156,5 @@ public interface IssueProjectCategoryDictDao extends BaseDao<IssueProjectCategor
* @Author zhangyong * @Author zhangyong
* @Date 14:10 2021-03-22 * @Date 14:10 2021-03-22
**/ **/
List<CustomerCategoryResultDTO> selectListAllCategoryDict(@Param("customerId") String customerId, @Param("pid") String pid); LinkedList<CustomerCategoryResultDTO> selectListAllCategoryDict(@Param("customerId") String customerId, @Param("pid") String pid);
} }

27
epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueProjectCategoryDictServiceImpl.java

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

1
epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueProjectCategoryDictDao.xml

@ -174,7 +174,6 @@
WHERE WHERE
PARENT_CATEGORY_CODE = #{parentCategoryCode} PARENT_CATEGORY_CODE = #{parentCategoryCode}
AND CUSTOMER_ID = #{customerId} AND CUSTOMER_ID = #{customerId}
AND DEL_FLAG = '0'
</select> </select>
<select id="isCategoryName" resultType="Integer"> <select id="isCategoryName" resultType="Integer">

Loading…
Cancel
Save