Browse Source

项目详情-标签分类查询-两端共用

master
sunyuchao 5 years ago
parent
commit
4840bf722f
  1. 4
      epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/IssueCategoryTagListFormDTO.java
  2. 6
      epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/result/IssueCategoryTagListResultDTO.java
  3. 2
      epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/result/IssueCategoryTagResultDTO.java
  4. 9
      epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/feign/GovIssueOpenFeignClient.java
  5. 11
      epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/feign/fallback/GovIssueOpenFeignClientFallBack.java
  6. 27
      epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/controller/IssueCategoryController.java
  7. 13
      epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueCategoryDao.java
  8. 4
      epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueTagsDao.java
  9. 14
      epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/IssueCategoryService.java
  10. 29
      epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueCategoryServiceImpl.java
  11. 19
      epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueCategoryDao.xml
  12. 14
      epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueTagsDao.xml
  13. 22
      epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/ProjectCategoryTagListFormDTO.java
  14. 27
      epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/ProjectCategoryTagListResultDTO.java
  15. 25
      epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/ProjectCategoryTagResultDTO.java
  16. 16
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/ProjectCategoryController.java
  17. 11
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/dao/ProjectCategoryDao.java
  18. 11
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/dao/ProjectTagsDao.java
  19. 10
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/ProjectCategoryService.java
  20. 42
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectCategoryServiceImpl.java
  21. 10
      epmet-module/gov-project/gov-project-server/src/main/resources/mapper/ProjectCategoryDao.xml
  22. 13
      epmet-module/gov-project/gov-project-server/src/main/resources/mapper/ProjectTagsDao.xml

4
epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/CategoryTagListFormDTO.java → epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/IssueCategoryTagListFormDTO.java

@ -10,10 +10,10 @@ import java.io.Serializable;
* @Author sun
*/
@Data
public class CategoryTagListFormDTO implements Serializable {
public class IssueCategoryTagListFormDTO implements Serializable {
private static final long serialVersionUID = 2599592072265715951L;
@NotBlank(message = "议题ID不能为空",groups = {CategoryTagListFormDTO.CategoryTag.class})
@NotBlank(message = "议题ID不能为空",groups = {ProjectCategoryTagListFormDTO.CategoryTag.class})
private String issueId;
public interface CategoryTag{}

6
epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/CategoryTagListResultDTO.java → epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/result/IssueCategoryTagListResultDTO.java

@ -11,17 +11,17 @@ import java.util.List;
* @Author sun
*/
@Data
public class CategoryTagListResultDTO implements Serializable {
public class IssueCategoryTagListResultDTO implements Serializable {
private static final long serialVersionUID = 5957826616179876849L;
/**
* 类别集合
*/
private List<CategoryTagResultDTO> categoryList = new ArrayList<>();
private List<IssueCategoryTagResultDTO> categoryList = new ArrayList<>();
/**
* 标签集合
*/
private List<CategoryTagResultDTO> tagList = new ArrayList<>();
private List<IssueCategoryTagResultDTO> tagList = new ArrayList<>();
}

2
epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/CategoryTagResultDTO.java → epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/result/IssueCategoryTagResultDTO.java

@ -9,7 +9,7 @@ import java.io.Serializable;
* @Author sun
*/
@Data
public class CategoryTagResultDTO implements Serializable {
public class IssueCategoryTagResultDTO implements Serializable {
private static final long serialVersionUID = 5957826616179876849L;

9
epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/feign/GovIssueOpenFeignClient.java

@ -2,8 +2,8 @@ package com.epmet.feign;
import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.IssueDTO;
import com.epmet.dto.IssueApplicationDTO;
import com.epmet.dto.IssueDTO;
import com.epmet.dto.IssueSuggestionDTO;
import com.epmet.dto.form.*;
import com.epmet.dto.result.*;
@ -209,4 +209,11 @@ public interface GovIssueOpenFeignClient {
**/
@PostMapping(value = "/gov/issue/issueapplication/queryuserpubauditingissues")
Result<List<UserPubAuditingIssueResDTO>> queryUserPubAuditingIssues(@RequestBody UserPubAuditingIssueFormDTO fomrDTO);
/**
* @description 调用issue库查询分类Id对应的分类名称按分类升序排列
* @author sun
**/
@PostMapping(value = "/gov/issue/issuecategory/projectcategorylist")
Result<List<ProjectCategoryTagResultDTO>> projectCategoryList(@RequestBody List<String> categoryIdList);
}

11
epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/feign/fallback/GovIssueOpenFeignClientFallBack.java

@ -3,8 +3,8 @@ package com.epmet.feign.fallback;
import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.utils.ModuleUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.IssueDTO;
import com.epmet.dto.IssueApplicationDTO;
import com.epmet.dto.IssueDTO;
import com.epmet.dto.IssueSuggestionDTO;
import com.epmet.dto.form.*;
import com.epmet.dto.result.*;
@ -193,4 +193,13 @@ public class GovIssueOpenFeignClientFallBack implements GovIssueOpenFeignClient
public Result<List<UserPubAuditingIssueResDTO>> queryUserPubAuditingIssues(UserPubAuditingIssueFormDTO fomrDTO) {
return ModuleUtils.feignConError(ServiceConstant.GOV_ISSUE_SERVER, "queryUserPubAuditingIssues", fomrDTO);
}
/**
* @description 调用issue库查询分类Id对应的分类名称按分类升序排列
* @author sun
**/
@Override
public Result<List<ProjectCategoryTagResultDTO>> projectCategoryList(List<String> categoryIdList) {
return ModuleUtils.feignConError(ServiceConstant.GOV_ISSUE_SERVER, "projectCategoryList", categoryIdList);
}
}

27
epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/controller/IssueCategoryController.java

@ -23,14 +23,12 @@ import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.AssertUtils;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.commons.tools.validator.group.AddGroup;
import com.epmet.commons.tools.validator.group.UpdateGroup;
import com.epmet.commons.tools.validator.group.DefaultGroup;
import com.epmet.commons.tools.validator.group.UpdateGroup;
import com.epmet.dto.IssueCategoryDTO;
import com.epmet.dto.form.CategoryTagListFormDTO;
import com.epmet.dto.form.ClosedProjectIssueListFormDTO;
import com.epmet.dto.form.MyShiftIssueTopicsFormDTO;
import com.epmet.dto.result.CategoryTagListResultDTO;
import com.epmet.dto.result.LatestListResultDTO;
import com.epmet.dto.form.IssueCategoryTagListFormDTO;
import com.epmet.dto.result.IssueCategoryTagListResultDTO;
import com.epmet.dto.result.ProjectCategoryTagResultDTO;
import com.epmet.excel.IssueCategoryExcel;
import com.epmet.service.IssueCategoryService;
import org.springframework.beans.factory.annotation.Autowired;
@ -103,9 +101,20 @@ public class IssueCategoryController {
* @Author sun
**/
@PostMapping("categorytaglist")
public Result<CategoryTagListResultDTO> categoryTagList(@RequestBody CategoryTagListFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, CategoryTagListFormDTO.CategoryTag.class);
return new Result<CategoryTagListResultDTO>().ok(issueCategoryService.categoryTagList(formDTO));
public Result<IssueCategoryTagListResultDTO> categoryTagList(@RequestBody IssueCategoryTagListFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, IssueCategoryTagListFormDTO.CategoryTag.class);
return new Result<IssueCategoryTagListResultDTO>().ok(issueCategoryService.categoryTagList(formDTO));
}
/**
* @param categoryIdList
* @return
* @Description 查询分类Id集合对应的分类名称按分类升序排列
* @Author sun
**/
@PostMapping("projectcategorylist")
public Result<List<ProjectCategoryTagResultDTO>> projectCategoryList(@RequestBody List<String> categoryIdList) {
return new Result<List<ProjectCategoryTagResultDTO>>().ok(issueCategoryService.projectCategoryList(categoryIdList));
}
}

13
epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueCategoryDao.java

@ -18,7 +18,8 @@
package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.result.CategoryTagResultDTO;
import com.epmet.dto.result.IssueCategoryTagResultDTO;
import com.epmet.dto.result.ProjectCategoryTagResultDTO;
import com.epmet.entity.IssueCategoryEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@ -38,5 +39,13 @@ public interface IssueCategoryDao extends BaseDao<IssueCategoryEntity> {
* @Description 查询议题绑定的分类名称按排序升序
* @Author sun
**/
List<CategoryTagResultDTO> selectIssueCategoryList(@Param("issueId") String issueId);
List<IssueCategoryTagResultDTO> selectIssueCategoryList(@Param("issueId") String issueId);
/**
* @param categoryIdList
* @return
* @Description 查询分类Id对应的分类名称按分类升序排列
* @Author sun
**/
List<ProjectCategoryTagResultDTO> selectProjectCategoryList(List<String> categoryIdList);
}

4
epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueTagsDao.java

@ -18,7 +18,7 @@
package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.result.CategoryTagResultDTO;
import com.epmet.dto.result.IssueCategoryTagResultDTO;
import com.epmet.entity.IssueTagsEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@ -38,5 +38,5 @@ public interface IssueTagsDao extends BaseDao<IssueTagsEntity> {
* @Description 查询议题绑定的标签按绑定时间升序
* @Author sun
**/
List<CategoryTagResultDTO> selectIssueTagList(@Param("issueId") String issueId);
List<IssueCategoryTagResultDTO> selectIssueTagList(@Param("issueId") String issueId);
}

14
epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/IssueCategoryService.java

@ -20,8 +20,9 @@ package com.epmet.service;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData;
import com.epmet.dto.IssueCategoryDTO;
import com.epmet.dto.form.CategoryTagListFormDTO;
import com.epmet.dto.result.CategoryTagListResultDTO;
import com.epmet.dto.form.IssueCategoryTagListFormDTO;
import com.epmet.dto.result.IssueCategoryTagListResultDTO;
import com.epmet.dto.result.ProjectCategoryTagResultDTO;
import com.epmet.entity.IssueCategoryEntity;
import java.util.List;
@ -101,6 +102,13 @@ public interface IssueCategoryService extends BaseService<IssueCategoryEntity> {
* @Description 获取议题的分类标签列表
* @Author sun
**/
CategoryTagListResultDTO categoryTagList(CategoryTagListFormDTO formDTO);
IssueCategoryTagListResultDTO categoryTagList(IssueCategoryTagListFormDTO formDTO);
/**
* @param categoryIdList
* @return
* @Description 查询分类Id集合对应的分类名称按分类升序排列
* @Author sun
**/
List<ProjectCategoryTagResultDTO> projectCategoryList(List<String> categoryIdList);
}

29
epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueCategoryServiceImpl.java

@ -20,16 +20,17 @@ package com.epmet.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.dao.IssueCategoryDao;
import com.epmet.dao.IssueTagsDao;
import com.epmet.dto.IssueCategoryDTO;
import com.epmet.dto.form.CategoryTagListFormDTO;
import com.epmet.dto.result.CategoryTagListResultDTO;
import com.epmet.dto.result.CategoryTagResultDTO;
import com.epmet.dto.form.IssueCategoryTagListFormDTO;
import com.epmet.dto.result.IssueCategoryTagListResultDTO;
import com.epmet.dto.result.IssueCategoryTagResultDTO;
import com.epmet.dto.result.ProjectCategoryTagResultDTO;
import com.epmet.entity.IssueCategoryEntity;
import com.epmet.redis.IssueCategoryRedis;
import com.epmet.service.IssueCategoryService;
@ -38,7 +39,6 @@ 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;
@ -116,19 +116,30 @@ public class IssueCategoryServiceImpl extends BaseServiceImpl<IssueCategoryDao,
* @Author sun
**/
@Override
public CategoryTagListResultDTO categoryTagList(CategoryTagListFormDTO formDTO) {
CategoryTagListResultDTO resultDTO = new CategoryTagListResultDTO();
public IssueCategoryTagListResultDTO categoryTagList(IssueCategoryTagListFormDTO formDTO) {
IssueCategoryTagListResultDTO resultDTO = new IssueCategoryTagListResultDTO();
//1.查询议题绑定的分类名称,按排序升序
List<CategoryTagResultDTO> categoryList = baseDao.selectIssueCategoryList(formDTO.getIssueId());
List<IssueCategoryTagResultDTO> categoryList = baseDao.selectIssueCategoryList(formDTO.getIssueId());
if (categoryList.size() > NumConstant.ZERO) {
resultDTO.setCategoryList(categoryList);
}
//2.查询议题绑定的标签,按绑定时间升序
List<CategoryTagResultDTO> tagList = issueTagsDao.selectIssueTagList(formDTO.getIssueId());
List<IssueCategoryTagResultDTO> tagList = issueTagsDao.selectIssueTagList(formDTO.getIssueId());
if (tagList.size() > NumConstant.ZERO) {
resultDTO.setTagList(tagList);
}
return resultDTO;
}
/**
* @param categoryIdList
* @return
* @Description 查询分类Id集合对应的分类名称按分类升序排列
* @Author sun
**/
@Override
public List<ProjectCategoryTagResultDTO> projectCategoryList(List<String> categoryIdList) {
return baseDao.selectProjectCategoryList(categoryIdList);
}
}

19
epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueCategoryDao.xml

@ -3,7 +3,7 @@
<mapper namespace="com.epmet.dao.IssueCategoryDao">
<select id="selectIssueCategoryList" resultType="com.epmet.dto.result.CategoryTagResultDTO">
<select id="selectIssueCategoryList" resultType="com.epmet.dto.result.IssueCategoryTagResultDTO">
SELECT
ic.category_id AS "id",
ip.category_name AS "name"
@ -18,4 +18,21 @@
ip.sort ASC
</select>
<select id="selectProjectCategoryList" resultType="com.epmet.dto.result.ProjectCategoryTagResultDTO">
SELECT
id AS "id",
category_name AS "name"
FROM
issue_project_category_dict
WHERE
del_flag = '0'
<if test="categoryIdList != null and categoryIdList!= ''">
<foreach collection="categoryIdList" item="id" open="AND( " separator=" OR " index="index" close=")">
id = #{id}
</foreach>
</if>
ORDER BY
ip.sort ASC
</select>
</mapper>

14
epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueTagsDao.xml

@ -3,17 +3,17 @@
<mapper namespace="com.epmet.dao.IssueTagsDao">
<select id="selectIssueTagList" resultType="com.epmet.dto.result.CategoryTagResultDTO">
<select id="selectIssueTagList" resultType="com.epmet.dto.result.IssueCategoryTagResultDTO">
SELECT
it.tag_id AS "id",
it.tag_name AS "name"
tag_id AS "id",
tag_name AS "name"
FROM
issue_tags it
issue_tags
WHERE
it.del_flag = '0'
AND it.issue_id = #{issueId}
del_flag = '0'
AND issue_id = #{issueId}
ORDER BY
it.created_time ASC
created_time ASC
</select>
</mapper>

22
epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/ProjectCategoryTagListFormDTO.java

@ -0,0 +1,22 @@
package com.epmet.dto.form;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* 获取议题的分类标签列表-接口入参
* @Author sun
*/
@Data
public class ProjectCategoryTagListFormDTO implements Serializable {
private static final long serialVersionUID = 2599592072265715951L;
@NotBlank(message = "议题ID不能为空",groups = {ProjectCategoryTagListFormDTO.CategoryTag.class})
private String projectId;
public interface CategoryTag{}
}

27
epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/ProjectCategoryTagListResultDTO.java

@ -0,0 +1,27 @@
package com.epmet.dto.result;
import lombok.Data;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
/**
* @Description 获取议题的分类标签列表-接口返参
* @Author sun
*/
@Data
public class ProjectCategoryTagListResultDTO implements Serializable {
private static final long serialVersionUID = 5957826616179876849L;
/**
* 类别集合
*/
private List<ProjectCategoryTagResultDTO> categoryList = new ArrayList<>();
/**
* 标签集合
*/
private List<ProjectCategoryTagResultDTO> tagList = new ArrayList<>();
}

25
epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/ProjectCategoryTagResultDTO.java

@ -0,0 +1,25 @@
package com.epmet.dto.result;
import lombok.Data;
import java.io.Serializable;
/**
* @Description 获取议题的分类标签列表-接口返参
* @Author sun
*/
@Data
public class ProjectCategoryTagResultDTO implements Serializable {
private static final long serialVersionUID = 5957826616179876849L;
/**
* 分类或标签Id
*/
private String id;
/**
* 分类或标签名称
*/
private String name;
}

16
epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/ProjectCategoryController.java

@ -23,9 +23,11 @@ import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.AssertUtils;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.commons.tools.validator.group.AddGroup;
import com.epmet.commons.tools.validator.group.UpdateGroup;
import com.epmet.commons.tools.validator.group.DefaultGroup;
import com.epmet.commons.tools.validator.group.UpdateGroup;
import com.epmet.dto.ProjectCategoryDTO;
import com.epmet.dto.form.ProjectCategoryTagListFormDTO;
import com.epmet.dto.result.ProjectCategoryTagListResultDTO;
import com.epmet.excel.ProjectCategoryExcel;
import com.epmet.service.ProjectCategoryService;
import org.springframework.beans.factory.annotation.Autowired;
@ -91,4 +93,16 @@ public class ProjectCategoryController {
ExcelUtils.exportExcelToTarget(response, null, list, ProjectCategoryExcel.class);
}
/**
* @param formDTO
* @return
* @Description 获取项目的分类标签列表
* @Author sun
**/
@PostMapping("categorytaglist")
public Result<ProjectCategoryTagListResultDTO> categoryTagList(@RequestBody ProjectCategoryTagListFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, ProjectCategoryTagListFormDTO.CategoryTag.class);
return new Result<ProjectCategoryTagListResultDTO>().ok(projectCategoryService.categoryTagList(formDTO));
}
}

11
epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/dao/ProjectCategoryDao.java

@ -20,6 +20,9 @@ package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.entity.ProjectCategoryEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 项目所属分类表
@ -29,5 +32,11 @@ import org.apache.ibatis.annotations.Mapper;
*/
@Mapper
public interface ProjectCategoryDao extends BaseDao<ProjectCategoryEntity> {
/**
* @Description 查询项目绑定的分类Id集合
* @Author sun
**/
List<String> selectProjectCategoryIdList(@Param("projectId") String projectId);
}

11
epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/dao/ProjectTagsDao.java

@ -18,8 +18,12 @@
package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.result.ProjectCategoryTagResultDTO;
import com.epmet.entity.ProjectTagsEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 项目关联标签表
@ -29,5 +33,10 @@ import org.apache.ibatis.annotations.Mapper;
*/
@Mapper
public interface ProjectTagsDao extends BaseDao<ProjectTagsEntity> {
/**
* @Description 查询项目绑定的标签按绑定时间升序
* @Author sun
**/
List<ProjectCategoryTagResultDTO> selectProjectTagList(@Param("projectId") String projectId);
}

10
epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/ProjectCategoryService.java

@ -20,6 +20,8 @@ package com.epmet.service;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData;
import com.epmet.dto.ProjectCategoryDTO;
import com.epmet.dto.form.ProjectCategoryTagListFormDTO;
import com.epmet.dto.result.ProjectCategoryTagListResultDTO;
import com.epmet.entity.ProjectCategoryEntity;
import java.util.List;
@ -92,4 +94,12 @@ public interface ProjectCategoryService extends BaseService<ProjectCategoryEntit
* @date 2020-12-08
*/
void delete(String[] ids);
/**
* @param formDTO
* @return
* @Description 获取项目的分类标签列表
* @Author sun
**/
ProjectCategoryTagListResultDTO categoryTagList(ProjectCategoryTagListFormDTO formDTO);
}

42
epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectCategoryServiceImpl.java

@ -20,12 +20,21 @@ package com.epmet.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dao.ProjectCategoryDao;
import com.epmet.dao.ProjectTagsDao;
import com.epmet.dto.ProjectCategoryDTO;
import com.epmet.dto.form.ProjectCategoryTagListFormDTO;
import com.epmet.dto.result.ProjectCategoryTagListResultDTO;
import com.epmet.dto.result.ProjectCategoryTagResultDTO;
import com.epmet.entity.ProjectCategoryEntity;
import com.epmet.feign.GovIssueOpenFeignClient;
import com.epmet.redis.ProjectCategoryRedis;
import com.epmet.service.ProjectCategoryService;
import org.apache.commons.lang3.StringUtils;
@ -48,6 +57,10 @@ public class ProjectCategoryServiceImpl extends BaseServiceImpl<ProjectCategoryD
@Autowired
private ProjectCategoryRedis projectCategoryRedis;
@Autowired
private ProjectTagsDao projectTagsDao;
@Autowired
private GovIssueOpenFeignClient govIssueOpenFeignClient;
@Override
public PageData<ProjectCategoryDTO> page(Map<String, Object> params) {
@ -101,4 +114,31 @@ public class ProjectCategoryServiceImpl extends BaseServiceImpl<ProjectCategoryD
baseDao.deleteBatchIds(Arrays.asList(ids));
}
/**
* @param formDTO
* @return
* @Description 获取项目的分类标签列表
* @Author sun
**/
@Override
public ProjectCategoryTagListResultDTO categoryTagList(ProjectCategoryTagListFormDTO formDTO) {
ProjectCategoryTagListResultDTO resultDTO = new ProjectCategoryTagListResultDTO();
//1.查询项目绑定的分类名称,按排序升序
List<String> categoryIdList = baseDao.selectProjectCategoryIdList(formDTO.getProjectId());
if (categoryIdList.size() > NumConstant.ZERO) {
//1-1.调用issue库,查询分类Id对应的分类名称,按分类升序排列
Result<List<ProjectCategoryTagResultDTO>> result = govIssueOpenFeignClient.projectCategoryList(categoryIdList);
if (!result.success()) {
throw new RenException(result.getInternalMsg());
}
resultDTO.setCategoryList(result.getData());
}
//2.查询项目绑定的标签,按绑定时间升序
List<ProjectCategoryTagResultDTO> tagList = projectTagsDao.selectProjectTagList(formDTO.getProjectId());
if (tagList.size() > NumConstant.ZERO) {
resultDTO.setTagList(tagList);
}
return resultDTO;
}
}

10
epmet-module/gov-project/gov-project-server/src/main/resources/mapper/ProjectCategoryDao.xml

@ -3,6 +3,14 @@
<mapper namespace="com.epmet.dao.ProjectCategoryDao">
<select id="selectProjectCategoryIdList" resultType="java.lang.String">
SELECT
CATEGORY_ID
FROM
project_category
WHERE
DEL_FLAG = '0'
AND PROJECT_ID = #{projectId}
</select>
</mapper>

13
epmet-module/gov-project/gov-project-server/src/main/resources/mapper/ProjectTagsDao.xml

@ -3,6 +3,17 @@
<mapper namespace="com.epmet.dao.ProjectTagsDao">
<select id="selectProjectTagList" resultType="com.epmet.dto.result.ProjectCategoryTagResultDTO">
SELECT
tag_id AS "id",
tag_name AS "name"
FROM
project_tags
WHERE
del_flag = '0'
AND project_id = #{projectId}
ORDER BY
created_time ASC
</select>
</mapper>
Loading…
Cancel
Save