Browse Source

Merge branch 'dev_issue_category' into dev_temp

master
sunyuchao 5 years ago
parent
commit
8a0dc2d20c
  1. 22
      epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/CustomerCategoryListFormDTO.java
  2. 10
      epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/controller/IssueProjectCategoryDictController.java
  3. 3
      epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueProjectTagDictDao.java
  4. 247
      epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/redis/IssueProjectTagDictRedis.java
  5. 5
      epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/IssueProjectCategoryDictService.java
  6. 7
      epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueProjectCategoryDictServiceImpl.java
  7. 18
      epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueProjectTagDictDao.xml

22
epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/CustomerCategoryListFormDTO.java

@ -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{}
}

10
epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/controller/IssueProjectCategoryDictController.java

@ -17,7 +17,9 @@
package com.epmet.controller; package com.epmet.controller;
import com.epmet.commons.tools.annotation.LoginUser;
import com.epmet.commons.tools.page.PageData; 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.ExcelUtils;
import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.AssertUtils; 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.commons.tools.validator.group.UpdateGroup;
import com.epmet.dto.IssueProjectCategoryDictDTO; import com.epmet.dto.IssueProjectCategoryDictDTO;
import com.epmet.dto.form.CategoryTagInitFormDTO; import com.epmet.dto.form.CategoryTagInitFormDTO;
import com.epmet.dto.form.CustomerCategoryListFormDTO;
import com.epmet.dto.form.ProjectSaveCategoryFormDTO; import com.epmet.dto.form.ProjectSaveCategoryFormDTO;
import com.epmet.dto.result.CustomerCategoryListResultDTO; import com.epmet.dto.result.CustomerCategoryListResultDTO;
import com.epmet.dto.result.ProjectIssueCategoryResultDTO; import com.epmet.dto.result.ProjectIssueCategoryResultDTO;
@ -97,15 +98,14 @@ public class IssueProjectCategoryDictController {
} }
/** /**
* @param formDTO * @param tokenDto
* @return * @return
* @Description 客户分类列表查询按分类升序排列 * @Description 客户分类列表查询按分类升序排列
* @Author sun * @Author sun
**/ **/
@PostMapping("list") @PostMapping("list")
public Result<List<CustomerCategoryListResultDTO>> categoryList(@RequestBody CustomerCategoryListFormDTO formDTO) { public Result<List<CustomerCategoryListResultDTO>> categoryList(@LoginUser TokenDto tokenDto) {
ValidatorUtils.validateEntity(formDTO, CustomerCategoryListFormDTO.Category.class); return new Result<List<CustomerCategoryListResultDTO>>().ok(issueProjectCategoryDictService.categoryList(tokenDto.getCustomerId()));
return new Result<List<CustomerCategoryListResultDTO>>().ok(issueProjectCategoryDictService.categoryList(formDTO));
} }
/** /**

3
epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueProjectTagDictDao.java

@ -75,11 +75,10 @@ public interface IssueProjectTagDictDao extends BaseDao<IssueProjectTagDictEntit
/** /**
* @Description 根据类别查询客户下标签 * @Description 根据类别查询客户下标签
* @param categories * @param categories
* @param isDefault
* @param customerId * @param customerId
* @return java.util.List<com.epmet.entity.IssueProjectTagDictEntity> * @return java.util.List<com.epmet.entity.IssueProjectTagDictEntity>
* @author wangc * @author wangc
* @date 2020.12.10 10:07 * @date 2020.12.10 10:07
*/ */
List<IssueProjectTagDictEntity> selectTagByCategory(@Param("categories") List<String> categories,@Param("isDefault") String isDefault,@Param("customerId") String customerId); List<IssueProjectTagDictEntity> selectTagByCategory(@Param("categories") List<String> categories,@Param("customerId") String customerId,@Param("isDefault")String isDefault);
} }

247
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.constant.NumConstant;
import com.epmet.commons.tools.redis.RedisUtils; import com.epmet.commons.tools.redis.RedisUtils;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.constant.GovIssueRedisKeys; import com.epmet.constant.GovIssueRedisKeys;
import com.epmet.dao.IssueProjectCategoryDictDao; import com.epmet.dao.IssueProjectCategoryDictDao;
import com.epmet.dao.IssueProjectTagDictDao; import com.epmet.dao.IssueProjectTagDictDao;
@ -72,18 +73,21 @@ public class IssueProjectTagDictRedis {
return null; return null;
} }
/** /**
* @Description 传入category列表返回对应category下的标签按热度排序 * @Description
* category列表为空则查询客户下全部 *
* 如果想要自定义标签单独请求一次分类列表中只含"customize" * 排序规则
* 1默认标签按照分类排序
* 2自定义标签按照热度排序
* *
* @param customerId * @param customerId
* @param category * @param category
* @return java.util.List<com.epmet.dto.result.IssueCategoryTagResultDTO> * @return
* @author wangc * @author wangc
* @date 2020.12.09 11:16 * @date 2020.12.09 11:16
*/ */
public Map<String,List<IssueCategoryTagResultDTO>> getTagsOrderByRank(String customerId,List<String> category) { public Map<String,List<IssueCategoryTagResultDTO>> getDefaultTagsSortedByCategoryAndCustomizedTagsOrderByRank(String customerId,List<String> category) {
if (StringUtils.isBlank(customerId)) { if (StringUtils.isBlank(customerId)) {
log.error("customerId can not be null when obtain govern tags."); log.error("customerId can not be null when obtain govern tags.");
return null; return null;
@ -91,73 +95,140 @@ public class IssueProjectTagDictRedis {
IssueProjectCategoryDictEntity otherCategory = categoryDictDao.selectSingleByCustomerIdAndCategoryNameAndCategoryType(customerId, ModuleConstants.CATEGORY_NAME_OTHERS, null); 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); boolean ifOtherOnly = null == otherCategory ? false : (!CollectionUtils.isEmpty(category) && category.size() == NumConstant.ONE && category.contains(otherCategory.getId()) ? true : false);
Set<String> keys;
if (CollectionUtils.isEmpty(category) || ifOtherOnly) Map<String,List<IssueCategoryTagResultDTO>> result = new HashMap<>();
keys = redisUtils.keys(GovIssueRedisKeys.getGovernmentTagKey(customerId, null));
else keys = category.stream().map(key -> { List<IssueProjectTagDictEntity> _default = poolDao.selectTagByCategory(ifOtherOnly || CollectionUtils.isEmpty(category) ? null : category, customerId, NumConstant.ZERO_STR);//默认
return GovIssueRedisKeys.getGovernmentTagKey(customerId, key); if(!CollectionUtils.isEmpty(_default)){
}).collect(Collectors.toSet()); 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集合为空,说明缓存中没有当前客户的标签排行信息,直接进行补偿 //如果keys集合为空,说明缓存中没有当前客户的标签排行信息,直接进行补偿
if (!CollectionUtils.isEmpty(keys)){ Set<ZSetOperations.TypedTuple<Object>> customizedTuples = redisUtils.zReverseRangeWithScores(GovIssueRedisKeys.getGovernmentTagKey(customerId, null), NumConstant.ZERO_L, (long) (NumConstant.ONE_NEG));
keys.remove(GovIssueRedisKeys.getGovernmentTagKey(customerId,ModuleConstants.CUSTOMIZED_TAG_CATEGORY_NAME)); if(!CollectionUtils.isEmpty(customizedTuples)){
List<Set<ZSetOperations.TypedTuple<Object>>> heatTuple = redisTemplate.executePipelined(new RedisCallback<Set<ZSetOperations.TypedTuple<Object>>>() { Map<Double, List<IssueCategoryTagResultDTO>> customizedHeatMap = new HashMap<>();
@Nullable customizedTuples.forEach(tuple -> {
@Override List<IssueCategoryTagResultDTO> queue = customizedHeatMap.get(tuple.getValue());
public Set<ZSetOperations.TypedTuple<Object>> doInRedis(RedisConnection connection) throws DataAccessException { if((CollectionUtils.isEmpty(queue))) queue = new LinkedList<>();
connection.openPipeline(); queue.add(parseObject(tuple.getValue(), IssueCategoryTagResultDTO.class));
keys.forEach(key -> { customizedHeatMap.put((Double) tuple.getValue(),queue);
connection.zSetCommands().zRangeByScoreWithScores(redisTemplate.getKeySerializer().serialize(key), NumConstant.ZERO_L, (long) (NumConstant.ONE_NEG));
});
return null;
}
}, redisTemplate.getValueSerializer());
Map<String,List<IssueCategoryTagResultDTO>> result = new HashMap<>();
if (!CollectionUtils.isEmpty(heatTuple)) {
//热度Map 分数为key
Map<Double, List<IssueCategoryTagResultDTO>> heatMap = new HashMap<>();
heatTuple.forEach(tupleSet -> {
tupleSet.forEach(tuple -> {
Double heatScore = tuple.getScore();
List<IssueCategoryTagResultDTO> queue = heatMap.get(heatScore);
if (CollectionUtils.isEmpty(queue)) queue = new LinkedList<>();
queue.add(parseObject(tuple.getValue(), IssueCategoryTagResultDTO.class));
heatMap.put(heatScore, queue);
});
}); });
List<IssueCategoryTagResultDTO> defaultResult = new LinkedList<>(); List<IssueCategoryTagResultDTO> customizedResult = new LinkedList<>();
heatMap.keySet().stream().sorted(Comparator.reverseOrder()).collect(Collectors.toList()).forEach(count -> { customizedHeatMap.keySet().stream().sorted(Comparator.reverseOrder()).collect(Collectors.toList()).forEach(count -> {
defaultResult.addAll(heatMap.get(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<String,List<IssueCategoryTagResultDTO>> 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<String,List<IssueCategoryTagResultDTO>> getTagsOrderByRank(String customerId,List<String> category) {
if (StringUtils.isBlank(customerId)) {
log.error("customerId can not be null when obtain govern tags.");
return null;
} }
Set<ZSetOperations.TypedTuple<Object>> customizedTuples = redisUtils.zReverseRangeWithScores(GovIssueRedisKeys.getGovernmentTagKey(customerId, null), NumConstant.ZERO_L, (long) (NumConstant.ONE_NEG));
if(!CollectionUtils.isEmpty(customizedTuples)){ IssueProjectCategoryDictEntity otherCategory = categoryDictDao.selectSingleByCustomerIdAndCategoryNameAndCategoryType(customerId, ModuleConstants.CATEGORY_NAME_OTHERS, null);
Map<Double, List<IssueCategoryTagResultDTO>> customizedHeatMap = new HashMap<>(); boolean ifOtherOnly = null == otherCategory ? false : (!CollectionUtils.isEmpty(category) && category.size() == NumConstant.ONE && category.contains(otherCategory.getId()) ? true : false);
customizedTuples.forEach(tuple -> { Set<String> keys;
List<IssueCategoryTagResultDTO> queue = customizedHeatMap.get(tuple.getValue()); if (CollectionUtils.isEmpty(category) || ifOtherOnly)
if((CollectionUtils.isEmpty(queue))) queue = new LinkedList<>(); 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<Set<ZSetOperations.TypedTuple<Object>>> heatTuple = redisTemplate.executePipelined(new RedisCallback<Set<ZSetOperations.TypedTuple<Object>>>() {
@Nullable
@Override
public Set<ZSetOperations.TypedTuple<Object>> 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<String,List<IssueCategoryTagResultDTO>> result = new HashMap<>();
if (!CollectionUtils.isEmpty(heatTuple)) {
//热度Map 分数为key
Map<Double, List<IssueCategoryTagResultDTO>> heatMap = new HashMap<>();
heatTuple.forEach(tupleSet -> {
tupleSet.forEach(tuple -> {
Double heatScore = tuple.getScore();
List<IssueCategoryTagResultDTO> queue = heatMap.get(heatScore);
if (CollectionUtils.isEmpty(queue)) queue = new LinkedList<>();
queue.add(parseObject(tuple.getValue(), IssueCategoryTagResultDTO.class)); queue.add(parseObject(tuple.getValue(), IssueCategoryTagResultDTO.class));
customizedHeatMap.put((Double) tuple.getValue(),queue); heatMap.put(heatScore, queue);
});
}); });
List<IssueCategoryTagResultDTO> customizedResult = new LinkedList<>(); List<IssueCategoryTagResultDTO> defaultResult = new LinkedList<>();
customizedHeatMap.keySet().stream().sorted(Comparator.reverseOrder()).collect(Collectors.toList()).forEach(count -> { heatMap.keySet().stream().sorted(Comparator.reverseOrder()).collect(Collectors.toList()).forEach(count -> {
customizedResult.addAll(customizedHeatMap.get(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<ZSetOperations.TypedTuple<Object>> customizedTuples = redisUtils.zReverseRangeWithScores(GovIssueRedisKeys.getGovernmentTagKey(customerId, null), NumConstant.ZERO_L, (long) (NumConstant.ONE_NEG));
if(!CollectionUtils.isEmpty(customizedTuples)){
Map<Double, List<IssueCategoryTagResultDTO>> customizedHeatMap = new HashMap<>();
customizedTuples.forEach(tuple -> {
List<IssueCategoryTagResultDTO> 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<IssueCategoryTagResultDTO> 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); log.warn("fetch customer govern tag cache blankly,customerId:{},now begin compensation...", customerId);
Map<String,List<IssueCategoryTagResultDTO>> compensate = compensate(customerId, category, ifOtherOnly); Map<String,List<IssueCategoryTagResultDTO>> compensate = compensate(customerId, category, ifOtherOnly);
if (CollectionUtils.isEmpty(compensate)) { 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; return null;
} else { } else {
log.warn("compensation completed!!"); log.warn("compensation completed!!");
@ -165,26 +236,70 @@ public class IssueProjectTagDictRedis {
} }
} }
/** /**
* @Description category为空则补偿全部返回全部 * @Description category为空则补偿全部返回默认标签和自定义标签补偿全部
* category不为空则补偿集合中的类别标签以及自定义标签 * category仅包含"其他"这个分类的Id时返回同上补偿全部
* category为"customize"只补偿自定义标签 * category不为空且不只有"其他"这个分类的Id时则返回并补偿集合中的类别标签以及自定义标签
* 只需查询标签库(issue_project_tag_dict)中的issueUseCount和projectUseCount即可 * 默认标签不按照热度排序自定义标签按照热度排序
*
*
* @param customerId * @param customerId
* @param category * @param category
* @return java.util.List<com.epmet.dto.result.IssueCategoryTagResultDTO> * @return
* @author wangc * @author wangc
* @date 2020.12.10 09:34 * @date 2020.12.10 09:34
*/ */
public Map<String,List<IssueCategoryTagResultDTO>> compensate(String customerId,List<String> category,boolean ifOtherOnly){ public Map<String,List<IssueCategoryTagResultDTO>> compensate(String customerId,List<String> category,boolean ifOtherOnly){
List<IssueProjectTagDictEntity> _default = poolDao.selectTagByCategory(ifOtherOnly || CollectionUtils.isEmpty(category) ? null : category, NumConstant.ZERO_STR, customerId);//默认 List<IssueProjectTagDictEntity> db = poolDao.selectTagByCategory(ifOtherOnly || CollectionUtils.isEmpty(category) ? null : category, customerId, null);
List<IssueProjectTagDictEntity> _customized = poolDao.selectTagByCategory(null,NumConstant.ONE_STR,customerId);//自定义
// key -> redisKey
// value -> [key : score ; value : object]
Map<String,Map<Integer,List<IssueCategoryTagResultDTO>>> fulfilled = new HashMap<>(); Map<String,Map<Integer,List<IssueCategoryTagResultDTO>>> fulfilled = new HashMap<>();
Map<String,List<IssueCategoryTagResultDTO>> result = new HashMap<>(); if(!CollectionUtils.isEmpty(db)) {
Map<String, List<IssueProjectTagDictEntity>> categoryMap = db.stream().collect(Collectors.groupingBy(IssueProjectTagDictEntity::getCategoryId));
//key -> categoryId
categoryMap.forEach((k, v) -> {
Map<Integer, List<IssueCategoryTagResultDTO>> scoreMap = new HashMap<>();
String redisKey = GovIssueRedisKeys.getGovernmentTagKey(customerId, k);
v.forEach(tag -> {
List<IssueCategoryTagResultDTO> 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<String,List<IssueCategoryTagResultDTO>> 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; return result;
} }

5
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.commons.tools.page.PageData;
import com.epmet.dto.IssueProjectCategoryDictDTO; import com.epmet.dto.IssueProjectCategoryDictDTO;
import com.epmet.dto.form.CategoryTagInitFormDTO; import com.epmet.dto.form.CategoryTagInitFormDTO;
import com.epmet.dto.form.CustomerCategoryListFormDTO;
import com.epmet.dto.form.ProjectSaveCategoryFormDTO; import com.epmet.dto.form.ProjectSaveCategoryFormDTO;
import com.epmet.dto.result.CustomerCategoryListResultDTO; import com.epmet.dto.result.CustomerCategoryListResultDTO;
import com.epmet.dto.result.ProjectIssueCategoryResultDTO; import com.epmet.dto.result.ProjectIssueCategoryResultDTO;
@ -99,12 +98,12 @@ public interface IssueProjectCategoryDictService extends BaseService<IssueProjec
void delete(String[] ids); void delete(String[] ids);
/** /**
* @param formDTO * @param customerId
* @return * @return
* @Description 客户分类列表查询按分类升序排列 * @Description 客户分类列表查询按分类升序排列
* @Author sun * @Author sun
**/ **/
List<CustomerCategoryListResultDTO> categoryList(CustomerCategoryListFormDTO formDTO); List<CustomerCategoryListResultDTO> categoryList(String customerId);
/** /**
* 客户分类标签数据初始化 * 客户分类标签数据初始化

7
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.IssueDTO;
import com.epmet.dto.IssueProjectCategoryDictDTO; import com.epmet.dto.IssueProjectCategoryDictDTO;
import com.epmet.dto.form.CategoryTagInitFormDTO; import com.epmet.dto.form.CategoryTagInitFormDTO;
import com.epmet.dto.form.CustomerCategoryListFormDTO;
import com.epmet.dto.form.ProjectSaveCategoryFormDTO; import com.epmet.dto.form.ProjectSaveCategoryFormDTO;
import com.epmet.dto.form.SaveIssueCategoryFormDTO; import com.epmet.dto.form.SaveIssueCategoryFormDTO;
import com.epmet.dto.result.CustomerCategoryListResultDTO; import com.epmet.dto.result.CustomerCategoryListResultDTO;
@ -121,14 +120,14 @@ public class IssueProjectCategoryDictServiceImpl extends BaseServiceImpl<IssuePr
} }
/** /**
* @param formDTO * @param customerId
* @return * @return
* @Description 客户分类列表查询按分类升序排列 * @Description 客户分类列表查询按分类升序排列
* @Author sun * @Author sun
**/ **/
@Override @Override
public List<CustomerCategoryListResultDTO> categoryList(CustomerCategoryListFormDTO formDTO) { public List<CustomerCategoryListResultDTO> categoryList(String customerId) {
List<CustomerCategoryListResultDTO> resultList = baseDao.selectCustomerCategoryList(formDTO.getCustomerId()); List<CustomerCategoryListResultDTO> resultList = baseDao.selectCustomerCategoryList(customerId);
return resultList; return resultList;
} }

18
epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueProjectTagDictDao.xml

@ -73,7 +73,7 @@
SELECT SELECT
tag.ID, tag.ID,
tag.TAG_NAME, tag.TAG_NAME,
tag.CATEGORY_ID, IFNULL(tag.CATEGORY_ID,'customize') AS categoryId,
tag.IS_DEFAULT, tag.IS_DEFAULT,
(IFNULL(tag.ISSUE_USE_COUNT,0) + IFNULL(tag.PROJECT_USE_COUNT,0)) AS issueUseCount (IFNULL(tag.ISSUE_USE_COUNT,0) + IFNULL(tag.PROJECT_USE_COUNT,0)) AS issueUseCount
FROM FROM
@ -81,24 +81,26 @@
WHERE WHERE
tag.DEL_FLAG = '0' tag.DEL_FLAG = '0'
AND tag.CUSTOMER_ID = #{customerId} AND tag.CUSTOMER_ID = #{customerId}
AND tag.IS_DEFAULT = #{isDefault} <if test='null != isDefault and "" != isDefault'>
AND tag.IS_DEFAULT = #{isDefault}
</if>
<choose> <choose>
<when test="null != categories and categories.size > 0"> <when test="null != categories and categories.size > 0">
<foreach collection="categories" item="id" open="AND ( " separator=" OR " close=" )"> <foreach collection="categories" item="id" open="AND ( tag.CATEGORY_ID IS NULL OR tag.CATEGORY_ID = '' OR " separator=" OR " close=" )">
tag.CATEGORY_ID = #{id} tag.CATEGORY_ID = #{id}
</foreach> </foreach>
ORDER BY FIELD( ORDER BY FIELD(
tag.CATEGORY_ID, tag.CATEGORY_ID,
<foreach collection="categories" item="id" separator=" , "> <foreach collection="categories" item="id" separator=" , ">
#{id} #{id}
</foreach> </foreach>
) )
</when> </when>
<otherwise> <otherwise>
ORDER BY type.SORT ORDER BY type.SORT
</otherwise> </otherwise>
</choose> </choose>
, tag.TAG_NAME , CONVERT ( tag.TAG_NAME USING gbk )
</select> </select>
</mapper> </mapper>
Loading…
Cancel
Save