From ea574c055c3cf2891636b6bd061be585e14469d1 Mon Sep 17 00:00:00 2001 From: wangchao Date: Fri, 11 Dec 2020 10:20:21 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=96=B9=E6=B3=95?= =?UTF-8?q?=EF=BC=9A=E8=8E=B7=E5=8F=96=E9=BB=98=E8=AE=A4=E6=A0=87=E7=AD=BE?= =?UTF-8?q?(=E6=8C=89=E7=85=A7=E7=B1=BB=E5=88=AB=E6=8E=92=E5=BA=8F)?= =?UTF-8?q?=E5=92=8C=E8=87=AA=E5=AE=9A=E4=B9=89=E6=A0=87=E7=AD=BE(?= =?UTF-8?q?=E6=8C=89=E7=85=A7=E7=83=AD=E5=BA=A6=E6=8E=92=E5=BA=8F)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/epmet/dao/IssueProjectTagDictDao.java | 3 +- .../epmet/redis/IssueProjectTagDictRedis.java | 246 +++++++++++++----- .../mapper/IssueProjectTagDictDao.xml | 18 +- 3 files changed, 191 insertions(+), 76 deletions(-) diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueProjectTagDictDao.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueProjectTagDictDao.java index 2b61958883..3da76c1ca6 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueProjectTagDictDao.java +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueProjectTagDictDao.java @@ -75,11 +75,10 @@ public interface IssueProjectTagDictDao extends BaseDao * @author wangc * @date 2020.12.10 10:07 */ - List selectTagByCategory(@Param("categories") List categories,@Param("isDefault") String isDefault,@Param("customerId") String customerId); + List selectTagByCategory(@Param("categories") List categories,@Param("customerId") String customerId,@Param("isDefault")String isDefault); } \ No newline at end of file diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/redis/IssueProjectTagDictRedis.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/redis/IssueProjectTagDictRedis.java index 9e0cd829cb..1e4a4ec6f7 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/redis/IssueProjectTagDictRedis.java +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/redis/IssueProjectTagDictRedis.java @@ -19,6 +19,7 @@ package com.epmet.redis; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.redis.RedisUtils; +import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.constant.GovIssueRedisKeys; import com.epmet.dao.IssueProjectCategoryDictDao; import com.epmet.dao.IssueProjectTagDictDao; @@ -72,18 +73,20 @@ public class IssueProjectTagDictRedis { return null; } + /** - * @Description 传入category列表,返回对应category下的标签,按热度排序 - * category列表为空则查询客户下全部 - * 如果想要自定义标签,单独请求一次,分类列表中只含"customize" + * @Description category为空,则补偿全部,返回默认标签和自定义标签 + * category仅包含"其他"这个分类的Id时,同上 + * category不为空且不只有"其他"这个分类的Id时,则返回集合中的类别标签以及自定义标签 + * 默认标签不按照热度排序,自定义标签按照热度排序 * * @param customerId * @param category - * @return java.util.List + * @return * @author wangc * @date 2020.12.09 11:16 - */ - public Map> getTagsOrderByRank(String customerId,List category) { + */ + public Map> getDefaultTagsSortedByCategoryAndCustomizedTagsOrderByRank(String customerId,List category) { if (StringUtils.isBlank(customerId)) { log.error("customerId can not be null when obtain govern tags."); return null; @@ -91,73 +94,140 @@ public class IssueProjectTagDictRedis { IssueProjectCategoryDictEntity otherCategory = categoryDictDao.selectSingleByCustomerIdAndCategoryNameAndCategoryType(customerId, ModuleConstants.CATEGORY_NAME_OTHERS, null); boolean ifOtherOnly = null == otherCategory ? false : (!CollectionUtils.isEmpty(category) && category.size() == NumConstant.ONE && category.contains(otherCategory.getId()) ? true : false); - Set keys; - if (CollectionUtils.isEmpty(category) || ifOtherOnly) - keys = redisUtils.keys(GovIssueRedisKeys.getGovernmentTagKey(customerId, null)); - else keys = category.stream().map(key -> { - return GovIssueRedisKeys.getGovernmentTagKey(customerId, key); - }).collect(Collectors.toSet()); + + Map> result = new HashMap<>(); + + List _default = poolDao.selectTagByCategory(ifOtherOnly || CollectionUtils.isEmpty(category) ? null : category, customerId, NumConstant.ZERO_STR);//默认 + if(!CollectionUtils.isEmpty(_default)){ + result.put(ModuleConstants.DEFAULT_TAG_CATEGORY_NAME,_default.stream().map(o -> { + IssueCategoryTagResultDTO tag = ConvertUtils.sourceToTarget(o,IssueCategoryTagResultDTO.class); + tag.setName(o.getTagName()); return tag;}).collect(Collectors.toList())); + }else log.error("there is no default tag data in database , customerId : {}",customerId); + + //如果keys集合为空,说明缓存中没有当前客户的标签排行信息,直接进行补偿 - if (!CollectionUtils.isEmpty(keys)){ - keys.remove(GovIssueRedisKeys.getGovernmentTagKey(customerId,ModuleConstants.CUSTOMIZED_TAG_CATEGORY_NAME)); - List>> heatTuple = redisTemplate.executePipelined(new RedisCallback>>() { - @Nullable - @Override - public Set> doInRedis(RedisConnection connection) throws DataAccessException { - connection.openPipeline(); - keys.forEach(key -> { - connection.zSetCommands().zRangeByScoreWithScores(redisTemplate.getKeySerializer().serialize(key), NumConstant.ZERO_L, (long) (NumConstant.ONE_NEG)); - }); - return null; - } - }, redisTemplate.getValueSerializer()); - - Map> result = new HashMap<>(); - if (!CollectionUtils.isEmpty(heatTuple)) { - //热度Map 分数为key - Map> heatMap = new HashMap<>(); - heatTuple.forEach(tupleSet -> { - tupleSet.forEach(tuple -> { - Double heatScore = tuple.getScore(); - List queue = heatMap.get(heatScore); - if (CollectionUtils.isEmpty(queue)) queue = new LinkedList<>(); - queue.add(parseObject(tuple.getValue(), IssueCategoryTagResultDTO.class)); - heatMap.put(heatScore, queue); - }); + Set> customizedTuples = redisUtils.zReverseRangeWithScores(GovIssueRedisKeys.getGovernmentTagKey(customerId, null), NumConstant.ZERO_L, (long) (NumConstant.ONE_NEG)); + if(!CollectionUtils.isEmpty(customizedTuples)){ + Map> customizedHeatMap = new HashMap<>(); + customizedTuples.forEach(tuple -> { + List queue = customizedHeatMap.get(tuple.getValue()); + if((CollectionUtils.isEmpty(queue))) queue = new LinkedList<>(); + queue.add(parseObject(tuple.getValue(), IssueCategoryTagResultDTO.class)); + customizedHeatMap.put((Double) tuple.getValue(),queue); }); - List defaultResult = new LinkedList<>(); - heatMap.keySet().stream().sorted(Comparator.reverseOrder()).collect(Collectors.toList()).forEach(count -> { - defaultResult.addAll(heatMap.get(count)); + List customizedResult = new LinkedList<>(); + customizedHeatMap.keySet().stream().sorted(Comparator.reverseOrder()).collect(Collectors.toList()).forEach(count -> { + customizedResult.addAll(customizedHeatMap.get(count)); }); + result.put(ModuleConstants.CUSTOMIZED_TAG_CATEGORY_NAME,customizedResult); + } - result.put(ModuleConstants.DEFAULT_TAG_CATEGORY_NAME, defaultResult); + if(!CollectionUtils.isEmpty(result)) + return result; + + + log.warn("fetch customer govern tag cache blankly,customerId:{},now begin compensation...", customerId); + + Map> compensate = compensate(customerId, category, ifOtherOnly); + + if (CollectionUtils.isEmpty(compensate)) { + log.error("compensation failure or there is no tag data in database!!"); + return null; + } else { + log.warn("compensation completed!!"); + return compensate; + } + } + + + + + /** + * @Description category为空,则补偿全部,返回默认标签和自定义标签 + * category仅包含"其他"这个分类的Id时,同上 + * category不为空且不只有"其他"这个分类的Id时,则返回集合中的类别标签以及自定义标签 + * 默认标签不按照热度排序,自定义标签按照热度排序 + * + * @param customerId + * @param category + * @return + * @author wangc + * @date 2020.12.09 11:16 + */ + public Map> getTagsOrderByRank(String customerId,List category) { + if (StringUtils.isBlank(customerId)) { + log.error("customerId can not be null when obtain govern tags."); + return null; } - Set> customizedTuples = redisUtils.zReverseRangeWithScores(GovIssueRedisKeys.getGovernmentTagKey(customerId, null), NumConstant.ZERO_L, (long) (NumConstant.ONE_NEG)); - if(!CollectionUtils.isEmpty(customizedTuples)){ - Map> customizedHeatMap = new HashMap<>(); - customizedTuples.forEach(tuple -> { - List queue = customizedHeatMap.get(tuple.getValue()); - if((CollectionUtils.isEmpty(queue))) queue = new LinkedList<>(); + + IssueProjectCategoryDictEntity otherCategory = categoryDictDao.selectSingleByCustomerIdAndCategoryNameAndCategoryType(customerId, ModuleConstants.CATEGORY_NAME_OTHERS, null); + boolean ifOtherOnly = null == otherCategory ? false : (!CollectionUtils.isEmpty(category) && category.size() == NumConstant.ONE && category.contains(otherCategory.getId()) ? true : false); + Set keys; + if (CollectionUtils.isEmpty(category) || ifOtherOnly) + keys = redisUtils.keys(GovIssueRedisKeys.getGovernmentTagKey(customerId, null)); + else keys = category.stream().map(key -> { + return GovIssueRedisKeys.getGovernmentTagKey(customerId, key); + }).collect(Collectors.toSet()); + //如果keys集合为空,说明缓存中没有当前客户的标签排行信息,直接进行补偿 + if (!CollectionUtils.isEmpty(keys)){ + keys.remove(GovIssueRedisKeys.getGovernmentTagKey(customerId,ModuleConstants.CUSTOMIZED_TAG_CATEGORY_NAME)); + List>> heatTuple = redisTemplate.executePipelined(new RedisCallback>>() { + @Nullable + @Override + public Set> doInRedis(RedisConnection connection) throws DataAccessException { + connection.openPipeline(); + keys.forEach(key -> { + connection.zSetCommands().zRangeByScoreWithScores(redisTemplate.getKeySerializer().serialize(key), NumConstant.ZERO_L, (long) (NumConstant.ONE_NEG)); + }); + return null; + } + }, redisTemplate.getValueSerializer()); + + Map> result = new HashMap<>(); + if (!CollectionUtils.isEmpty(heatTuple)) { + //热度Map 分数为key + Map> heatMap = new HashMap<>(); + heatTuple.forEach(tupleSet -> { + tupleSet.forEach(tuple -> { + Double heatScore = tuple.getScore(); + List queue = heatMap.get(heatScore); + if (CollectionUtils.isEmpty(queue)) queue = new LinkedList<>(); queue.add(parseObject(tuple.getValue(), IssueCategoryTagResultDTO.class)); - customizedHeatMap.put((Double) tuple.getValue(),queue); + heatMap.put(heatScore, queue); + }); }); - List customizedResult = new LinkedList<>(); - customizedHeatMap.keySet().stream().sorted(Comparator.reverseOrder()).collect(Collectors.toList()).forEach(count -> { - customizedResult.addAll(customizedHeatMap.get(count)); + List defaultResult = new LinkedList<>(); + heatMap.keySet().stream().sorted(Comparator.reverseOrder()).collect(Collectors.toList()).forEach(count -> { + defaultResult.addAll(heatMap.get(count)); }); - result.put(ModuleConstants.CUSTOMIZED_TAG_CATEGORY_NAME,customizedResult); - } - return result; - } + result.put(ModuleConstants.DEFAULT_TAG_CATEGORY_NAME, defaultResult); + } + Set> customizedTuples = redisUtils.zReverseRangeWithScores(GovIssueRedisKeys.getGovernmentTagKey(customerId, null), NumConstant.ZERO_L, (long) (NumConstant.ONE_NEG)); + if(!CollectionUtils.isEmpty(customizedTuples)){ + Map> customizedHeatMap = new HashMap<>(); + customizedTuples.forEach(tuple -> { + List queue = customizedHeatMap.get(tuple.getValue()); + if((CollectionUtils.isEmpty(queue))) queue = new LinkedList<>(); + queue.add(parseObject(tuple.getValue(), IssueCategoryTagResultDTO.class)); + customizedHeatMap.put((Double) tuple.getValue(),queue); + }); + List customizedResult = new LinkedList<>(); + customizedHeatMap.keySet().stream().sorted(Comparator.reverseOrder()).collect(Collectors.toList()).forEach(count -> { + customizedResult.addAll(customizedHeatMap.get(count)); + }); + result.put(ModuleConstants.CUSTOMIZED_TAG_CATEGORY_NAME,customizedResult); + } + return result; + } log.warn("fetch customer govern tag cache blankly,customerId:{},now begin compensation...", customerId); - Map> compensate = compensate(customerId, category, ifOtherOnly); + Map> compensate = compensate(customerId, category, ifOtherOnly); if (CollectionUtils.isEmpty(compensate)) { - log.error("compensation failure or there is no default tag data in database!!"); + log.error("compensation failure or there is no tag data in database!!"); return null; } else { log.warn("compensation completed!!"); @@ -165,26 +235,70 @@ public class IssueProjectTagDictRedis { } } + + /** - * @Description category为空,则补偿全部,返回全部 - * category不为空,则补偿集合中的类别标签以及自定义标签 - * category为"customize",只补偿自定义标签 - * 只需查询标签库(issue_project_tag_dict)中的issueUseCount和projectUseCount即可 + * @Description category为空,则补偿全部,返回默认标签和自定义标签,补偿全部 + * category仅包含"其他"这个分类的Id时,返回同上,补偿全部 + * category不为空且不只有"其他"这个分类的Id时,则返回并补偿集合中的类别标签以及自定义标签 + * 默认标签不按照热度排序,自定义标签按照热度排序 + * + * * @param customerId * @param category - * @return java.util.List + * @return * @author wangc * @date 2020.12.10 09:34 */ public Map> compensate(String customerId,List category,boolean ifOtherOnly){ - List _default = poolDao.selectTagByCategory(ifOtherOnly || CollectionUtils.isEmpty(category) ? null : category, NumConstant.ZERO_STR, customerId);//默认 - List _customized = poolDao.selectTagByCategory(null,NumConstant.ONE_STR,customerId);//自定义 + List db = poolDao.selectTagByCategory(ifOtherOnly || CollectionUtils.isEmpty(category) ? null : category, customerId, null); + + // key -> redisKey + // value -> [key : score ; value : object] Map>> fulfilled = new HashMap<>(); - Map> result = new HashMap<>(); + if(!CollectionUtils.isEmpty(db)) { + Map> categoryMap = db.stream().collect(Collectors.groupingBy(IssueProjectTagDictEntity::getCategoryId)); + //key -> categoryId + categoryMap.forEach((k, v) -> { + Map> scoreMap = new HashMap<>(); + String redisKey = GovIssueRedisKeys.getGovernmentTagKey(customerId, k); + v.forEach(tag -> { + List unit = scoreMap.get(tag.getIssueUseCount()); + if (CollectionUtils.isEmpty(unit)) unit = new LinkedList<>(); + IssueCategoryTagResultDTO object = ConvertUtils.sourceToTarget(tag, IssueCategoryTagResultDTO.class); + object.setName(tag.getTagName()); + unit.add(object); + scoreMap.put(tag.getIssueUseCount(), unit); + }); + fulfilled.put(redisKey, scoreMap); + }); + + redisTemplate.executePipelined((RedisCallback) connection -> { + fulfilled.forEach((redisKey, map) -> { + map.forEach((score,list) -> { + list.forEach(factor -> { + connection.zSetCommands().zAdd(redisTemplate.getValueSerializer().serialize(redisKey), + score.doubleValue(), + redisTemplate.getValueSerializer().serialize(factor)); + }); + }); + + }); + return null; + }); + } + + Map> result = new HashMap<>(); + result.put(ModuleConstants.DEFAULT_TAG_CATEGORY_NAME,CollectionUtils.isEmpty(db) ? null : db.stream().filter(o -> !StringUtils.equals(ModuleConstants.CUSTOMIZED_TAG_CATEGORY_NAME,o.getCategoryId())).map(entity -> { + IssueCategoryTagResultDTO tag = ConvertUtils.sourceToTarget(entity,IssueCategoryTagResultDTO.class); + tag.setName(entity.getTagName()); return tag;}).collect(Collectors.toList())); + result.put(ModuleConstants.CUSTOMIZED_TAG_CATEGORY_NAME,CollectionUtils.isEmpty(db) ? null : db.stream().filter(o -> !StringUtils.equals(ModuleConstants.CUSTOMIZED_TAG_CATEGORY_NAME,o.getCategoryId())).sorted(Comparator.comparing(IssueProjectTagDictEntity :: getIssueUseCount).reversed()).map(entity -> { + IssueCategoryTagResultDTO tag = ConvertUtils.sourceToTarget(entity,IssueCategoryTagResultDTO.class); + tag.setName(entity.getTagName());return tag;}).collect(Collectors.toList())); return result; } diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueProjectTagDictDao.xml b/epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueProjectTagDictDao.xml index 60beccaa6e..2c5f2aab17 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueProjectTagDictDao.xml +++ b/epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueProjectTagDictDao.xml @@ -73,7 +73,7 @@ SELECT tag.ID, tag.TAG_NAME, - tag.CATEGORY_ID, + IFNULL(tag.CATEGORY_ID,'customize') AS categoryId, tag.IS_DEFAULT, (IFNULL(tag.ISSUE_USE_COUNT,0) + IFNULL(tag.PROJECT_USE_COUNT,0)) AS issueUseCount FROM @@ -81,24 +81,26 @@ WHERE tag.DEL_FLAG = '0' AND tag.CUSTOMER_ID = #{customerId} - AND tag.IS_DEFAULT = #{isDefault} + + AND tag.IS_DEFAULT = #{isDefault} + - + tag.CATEGORY_ID = #{id} ORDER BY FIELD( - tag.CATEGORY_ID, - - #{id} - + tag.CATEGORY_ID, + + #{id} + ) ORDER BY type.SORT - , tag.TAG_NAME + , CONVERT ( tag.TAG_NAME USING gbk ) \ No newline at end of file From eb21708f4b499126e3d2fe200d014d87b43d1de3 Mon Sep 17 00:00:00 2001 From: wangchao Date: Fri, 11 Dec 2020 10:23:53 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=A4=87=E6=B3=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/epmet/redis/IssueProjectTagDictRedis.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/redis/IssueProjectTagDictRedis.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/redis/IssueProjectTagDictRedis.java index 1e4a4ec6f7..c19eeee7de 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/redis/IssueProjectTagDictRedis.java +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/redis/IssueProjectTagDictRedis.java @@ -75,10 +75,11 @@ public class IssueProjectTagDictRedis { /** - * @Description category为空,则补偿全部,返回默认标签和自定义标签 - * category仅包含"其他"这个分类的Id时,同上 - * category不为空且不只有"其他"这个分类的Id时,则返回集合中的类别标签以及自定义标签 - * 默认标签不按照热度排序,自定义标签按照热度排序 + * @Description + * + * 排序规则: + * 1、默认标签,按照分类排序 + * 2、自定义标签,按照热度排序 * * @param customerId * @param category From f0b1db90f79a292be107411e03d11d3ee55ec1da Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Fri, 11 Dec 2020 10:35:27 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E8=8E=B7=E5=8F=96=E5=88=86=E7=B1=BB?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E5=85=A5=E5=8F=82=E5=8E=BB=E6=8E=89=E5=AE=A2?= =?UTF-8?q?=E6=88=B7Id=EF=BC=8C=E6=94=B9=E4=B8=BA=E5=9C=A8token=E4=B8=AD?= =?UTF-8?q?=E8=8E=B7=E5=8F=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dto/form/CustomerCategoryListFormDTO.java | 22 ------------------- .../IssueProjectCategoryDictController.java | 10 ++++----- .../IssueProjectCategoryDictService.java | 5 ++--- .../IssueProjectCategoryDictServiceImpl.java | 7 +++--- 4 files changed, 10 insertions(+), 34 deletions(-) delete mode 100644 epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/CustomerCategoryListFormDTO.java diff --git a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/CustomerCategoryListFormDTO.java b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/CustomerCategoryListFormDTO.java deleted file mode 100644 index 39ae42441e..0000000000 --- a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/CustomerCategoryListFormDTO.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.epmet.dto.form; - -import lombok.Data; - -import javax.validation.constraints.NotBlank; -import java.io.Serializable; - -/** - * 分类列表查询-接口入参 - * @Author sun - */ -@Data -public class CustomerCategoryListFormDTO implements Serializable { - - private static final long serialVersionUID = 2599592072265715951L; - @NotBlank(message = "客户ID不能为空",groups = {CustomerCategoryListFormDTO.Category.class}) - private String customerId; - - public interface Category{} - - -} diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/controller/IssueProjectCategoryDictController.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/controller/IssueProjectCategoryDictController.java index cd7948cf91..16fb700639 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/controller/IssueProjectCategoryDictController.java +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/controller/IssueProjectCategoryDictController.java @@ -17,7 +17,9 @@ 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; @@ -27,7 +29,6 @@ import com.epmet.commons.tools.validator.group.DefaultGroup; import com.epmet.commons.tools.validator.group.UpdateGroup; import com.epmet.dto.IssueProjectCategoryDictDTO; import com.epmet.dto.form.CategoryTagInitFormDTO; -import com.epmet.dto.form.CustomerCategoryListFormDTO; import com.epmet.dto.form.ProjectSaveCategoryFormDTO; import com.epmet.dto.result.CustomerCategoryListResultDTO; import com.epmet.dto.result.ProjectIssueCategoryResultDTO; @@ -97,15 +98,14 @@ public class IssueProjectCategoryDictController { } /** - * @param formDTO + * @param tokenDto * @return * @Description 客户分类列表查询,按分类升序排列 * @Author sun **/ @PostMapping("list") - public Result> categoryList(@RequestBody CustomerCategoryListFormDTO formDTO) { - ValidatorUtils.validateEntity(formDTO, CustomerCategoryListFormDTO.Category.class); - return new Result>().ok(issueProjectCategoryDictService.categoryList(formDTO)); + public Result> categoryList(@LoginUser TokenDto tokenDto) { + return new Result>().ok(issueProjectCategoryDictService.categoryList(tokenDto.getCustomerId())); } /** diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/IssueProjectCategoryDictService.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/IssueProjectCategoryDictService.java index 1e89188eff..c283895c9f 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/IssueProjectCategoryDictService.java +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/IssueProjectCategoryDictService.java @@ -21,7 +21,6 @@ import com.epmet.commons.mybatis.service.BaseService; import com.epmet.commons.tools.page.PageData; import com.epmet.dto.IssueProjectCategoryDictDTO; import com.epmet.dto.form.CategoryTagInitFormDTO; -import com.epmet.dto.form.CustomerCategoryListFormDTO; import com.epmet.dto.form.ProjectSaveCategoryFormDTO; import com.epmet.dto.result.CustomerCategoryListResultDTO; import com.epmet.dto.result.ProjectIssueCategoryResultDTO; @@ -99,12 +98,12 @@ public interface IssueProjectCategoryDictService extends BaseService categoryList(CustomerCategoryListFormDTO formDTO); + List categoryList(String customerId); /** * 客户分类标签数据初始化 diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueProjectCategoryDictServiceImpl.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueProjectCategoryDictServiceImpl.java index 3030b696fd..e767bc8113 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueProjectCategoryDictServiceImpl.java +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueProjectCategoryDictServiceImpl.java @@ -29,7 +29,6 @@ import com.epmet.dao.IssueProjectRelationDao; import com.epmet.dto.IssueDTO; import com.epmet.dto.IssueProjectCategoryDictDTO; import com.epmet.dto.form.CategoryTagInitFormDTO; -import com.epmet.dto.form.CustomerCategoryListFormDTO; import com.epmet.dto.form.ProjectSaveCategoryFormDTO; import com.epmet.dto.form.SaveIssueCategoryFormDTO; import com.epmet.dto.result.CustomerCategoryListResultDTO; @@ -121,14 +120,14 @@ public class IssueProjectCategoryDictServiceImpl extends BaseServiceImpl categoryList(CustomerCategoryListFormDTO formDTO) { - List resultList = baseDao.selectCustomerCategoryList(formDTO.getCustomerId()); + public List categoryList(String customerId) { + List resultList = baseDao.selectCustomerCategoryList(customerId); return resultList; }