From ccd33df10d20d97510a7048742afe3149115826d Mon Sep 17 00:00:00 2001 From: zxc <1272811460@qq.com> Date: Wed, 9 Dec 2020 17:50:47 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A0=87=E7=AD=BE=E6=B7=BB=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/epmet/dto/form/AddTagFormDTO.java | 24 +++++++++++ .../com/epmet/dto/result/AddTagResultDTO.java | 23 ++++++++++ .../epmet/controller/IssueTagsController.java | 19 +++++++- .../java/com/epmet/dao/IssueCategoryDao.java | 1 + .../main/java/com/epmet/dao/IssueTagsDao.java | 9 ++++ .../com/epmet/service/IssueTagsService.java | 11 +++++ .../service/impl/IssueTagsServiceImpl.java | 43 ++++++++++++++++++- .../main/resources/mapper/IssueTagsDao.xml | 10 +++++ 8 files changed, 138 insertions(+), 2 deletions(-) create mode 100644 epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/AddTagFormDTO.java create mode 100644 epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/result/AddTagResultDTO.java diff --git a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/AddTagFormDTO.java b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/AddTagFormDTO.java new file mode 100644 index 0000000000..889c042c5f --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/AddTagFormDTO.java @@ -0,0 +1,24 @@ +package com.epmet.dto.form; + +import com.google.gson.internal.$Gson$Types; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @Author zxc + * @DateTime 2020/12/9 下午3:25 + */ +@Data +public class AddTagFormDTO implements Serializable { + + private static final long serialVersionUID = -3245317956853388308L; + + public interface AddTag{} + + @NotBlank(message = "标签名称不能为空",groups = AddTag.class) + private String tagName; + + private String customerId; +} diff --git a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/result/AddTagResultDTO.java b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/result/AddTagResultDTO.java new file mode 100644 index 0000000000..f78f4154c9 --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/result/AddTagResultDTO.java @@ -0,0 +1,23 @@ +package com.epmet.dto.result; + +import lombok.AllArgsConstructor; +import lombok.Data; + +import java.io.Serializable; + +/** + * @Author zxc + * @DateTime 2020/12/9 下午5:09 + */ +@Data +@AllArgsConstructor +public class AddTagResultDTO implements Serializable { + + private static final long serialVersionUID = 4769136806332933579L; + + private String tagId; + + public AddTagResultDTO() { + this.tagId = ""; + } +} diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/controller/IssueTagsController.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/controller/IssueTagsController.java index 4be04baf85..6c6b768730 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/controller/IssueTagsController.java +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/controller/IssueTagsController.java @@ -17,15 +17,19 @@ package com.epmet.controller; +import com.epmet.commons.tools.annotation.LoginUser; import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.ExcelUtils; 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.IssueTagsDTO; +import com.epmet.dto.form.AddTagFormDTO; +import com.epmet.dto.result.AddTagResultDTO; import com.epmet.excel.IssueTagsExcel; import com.epmet.service.IssueTagsService; import org.springframework.beans.factory.annotation.Autowired; @@ -91,4 +95,17 @@ public class IssueTagsController { ExcelUtils.exportExcelToTarget(response, null, list, IssueTagsExcel.class); } + /** + * @Description 标签添加 + * @Param form + * @author zxc + * @date 2020/12/9 下午3:29 + */ + @PostMapping("add") + public Result addTag(@RequestBody AddTagFormDTO form, @LoginUser TokenDto tokenDto){ + ValidatorUtils.validateEntity(form, AddTagFormDTO.AddTag.class); + AddTagResultDTO addTagResultDTO = issueTagsService.addTag(form, tokenDto); + return new Result().ok(addTagResultDTO); + } + } \ No newline at end of file diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueCategoryDao.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueCategoryDao.java index 0e214708e0..0d88504d4c 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueCategoryDao.java +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueCategoryDao.java @@ -49,6 +49,7 @@ public interface IssueCategoryDao extends BaseDao { * @Author sun **/ List selectProjectCategoryList(@Param("categoryIdList") List categoryIdList); +// List selectProjectCategoryList(List categoryIdList); /** * 获取议题分类 diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueTagsDao.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueTagsDao.java index 547b840c17..ba73daf786 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueTagsDao.java +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueTagsDao.java @@ -19,6 +19,7 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.dto.IssueTagsDTO; +import com.epmet.dto.form.AddTagFormDTO; import com.epmet.dto.result.IssueCategoryTagResultDTO; import com.epmet.entity.IssueTagsEntity; import org.apache.ibatis.annotations.Mapper; @@ -49,4 +50,12 @@ public interface IssueTagsDao extends BaseDao { * @return java.util.List */ List selectTagsByIssue(@Param("issueId") String issueId); + + /** + * @Description 查询标签是否重名 + * @Param form + * @author zxc + * @date 2020/12/9 下午3:40 + */ + String selectTagNameCount(AddTagFormDTO form); } \ No newline at end of file diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/IssueTagsService.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/IssueTagsService.java index 5bc717fb3c..c95e8cc51e 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/IssueTagsService.java +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/IssueTagsService.java @@ -19,7 +19,10 @@ package com.epmet.service; import com.epmet.commons.mybatis.service.BaseService; import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.dto.IssueTagsDTO; +import com.epmet.dto.form.AddTagFormDTO; +import com.epmet.dto.result.AddTagResultDTO; import com.epmet.entity.IssueTagsEntity; import java.util.List; @@ -101,4 +104,12 @@ public interface IssueTagsService extends BaseService { * @return java.util.List */ List getTagsByIssue(String issueId); + + /** + * @Description 标签添加 + * @Param form + * @author zxc + * @date 2020/12/9 下午3:29 + */ + AddTagResultDTO addTag(AddTagFormDTO form, TokenDto tokenDto); } \ No newline at end of file diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueTagsServiceImpl.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueTagsServiceImpl.java index 7641a4bacb..6c2a1e6f2e 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueTagsServiceImpl.java +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueTagsServiceImpl.java @@ -20,14 +20,23 @@ 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.security.dto.TokenDto; import com.epmet.commons.tools.utils.ConvertUtils; -import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.dao.IssueProjectTagDictDao; import com.epmet.dao.IssueTagsDao; import com.epmet.dto.IssueTagsDTO; +import com.epmet.dto.form.AddTagFormDTO; +import com.epmet.dto.result.AddTagResultDTO; +import com.epmet.dto.result.IssueCategoryTagResultDTO; +import com.epmet.entity.IssueProjectTagDictEntity; import com.epmet.entity.IssueTagsEntity; +import com.epmet.redis.IssueProjectTagDictRedis; import com.epmet.redis.IssueTagsRedis; import com.epmet.service.IssueTagsService; +import com.epmet.utils.ModuleConstants; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -48,6 +57,10 @@ public class IssueTagsServiceImpl extends BaseServiceImpl page(Map params) { @@ -114,4 +127,32 @@ public class IssueTagsServiceImpl extends BaseServiceImpl + + + \ No newline at end of file