diff --git a/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/constants/ConsomerGroupConstants.java b/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/constants/ConsomerGroupConstants.java index 9c332a6626..ded5a9aa8d 100644 --- a/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/constants/ConsomerGroupConstants.java +++ b/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/constants/ConsomerGroupConstants.java @@ -17,5 +17,9 @@ public interface ConsomerGroupConstants { * 初始化客户组织机构信息分组 */ String INIT_CUSTOMER_ORG_ROLES_GROUP = "init_customer_org_roles_group"; + /** + * 客户初始化议题、项目分类、标签数据 + */ + String ISSUE_PROJECT_CATEGORY_TAG = "issue_project_category_tag"; } diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java index fb12799b4b..210f2d3443 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java @@ -131,6 +131,7 @@ public enum EpmetErrorCode { CUSTOMER_VALIDATE_ERROR(8805, "内部数据校验异常"), CATEGORY_IS_NULL(8806, "请设置分类"), + //公众号 865..开头的码 PUBLIC_NOT_EXISTS(8651,"手机号未注册,请先完成信息注册"), SELECT_CUSTOMER_ERROR(8652,"未查询到注册客户信息"), @@ -145,7 +146,10 @@ public enum EpmetErrorCode { TOPIC_SHIFTED_TO_ISSUE_UNDER_AUDITING(9004,"当前话题正在转议题审核"), TOPIC_ALREADY_SHIFTED_TO_ISSUE(9005,"该话题已被转为议题,请勿重复操作"), TOPIC_IS_HIDDEN(9006,"该话题已被屏蔽,请先解除屏蔽"), - TOPIC_IS_CLOSED(9008,"该话题已关闭,无法转为议题"); + TOPIC_IS_CLOSED(9008,"该话题已关闭,无法转为议题"), + + CUSTOMER_CATEGORY(9101,"分类已使用,不允许删除"), + CATEGORY_NAME(9102,"分类名称已存在,不允许重复"); private int code; private String msg; diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisUtils.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisUtils.java index 72a6db9b10..309cb9192e 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisUtils.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisUtils.java @@ -357,6 +357,18 @@ public class RedisUtils { return typedTuples; } + public Set zReverseRange(String key, long start, long end, Class clazz) { + Set objects = redisTemplate.opsForZSet().reverseRange(key, start, end); + if(CollectionUtils.isEmpty(objects)) return null; + return objects.stream().map(o->{ + try { + T target = clazz.newInstance(); + BeanUtils.copyProperties(o, target); + return target; + }catch (Exception e){throw new RenException("convert error");} + }).collect(Collectors.toSet()); + } + /** * @Description 标签使用数量缓存更新 * @param key @@ -368,6 +380,28 @@ public class RedisUtils { return redisTemplate.opsForZSet().incrementScore(key, value, delta); } + /** + * @Description 获取某个Zset的score + * @Param key + * @Param o + * @author zxc + * @date 2020/12/9 下午3:07 + */ + public Double getScore(String key, Object o){ + return redisTemplate.opsForZSet().score(key,o); + } + + /** + * @Description zset添加 + * @Param key + * @Param o + * @author zxc + * @date 2020/12/9 下午3:18 + */ + public void zSetAdd(String key, Object o){ + redisTemplate.opsForZSet().add(key,o,NumConstant.ZERO); + } + /** * @Description 判断key是否存在 * @param key diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govproject/ProjectCategoryDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govproject/ProjectCategoryDTO.java index cbda7d52f6..752262827e 100644 --- a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govproject/ProjectCategoryDTO.java +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govproject/ProjectCategoryDTO.java @@ -64,6 +64,11 @@ public class ProjectCategoryDTO implements Serializable { */ private String categoryPids; + /** + * 分类编码,分类编码+customer_id唯一 + */ + private String categoryCode; + /** * 删除标识 0未删除、1已删除 */ diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/ScreenProjectCategoryGridDailyDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/ScreenProjectCategoryGridDailyDTO.java index b9cd6657b6..0a015c6762 100644 --- a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/ScreenProjectCategoryGridDailyDTO.java +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/ScreenProjectCategoryGridDailyDTO.java @@ -17,11 +17,10 @@ package com.epmet.dto; -import java.io.Serializable; -import java.util.Date; import lombok.Data; -import java.math.BigDecimal; +import java.io.Serializable; +import java.util.Date; /** * 项目(事件)分类按网格_按天统计 @@ -67,7 +66,7 @@ public class ScreenProjectCategoryGridDailyDTO implements Serializable { /** * e世通中的项目类别编码 */ - private String epmetCategoryCode; + private String categoryCode; /** * 该分类下所有项目总数 @@ -75,39 +74,9 @@ public class ScreenProjectCategoryGridDailyDTO implements Serializable { private Integer projectTotal; /** - * 该分类下,正在处理中的项目总数 - */ - private Integer pendingTotal; - - /** - * 该分类下已结案的项目总数 - */ - private Integer closedTotal; - - /** - * 该分类下已结案无需解决的项目总数 - */ - private Integer unResolvedTotal; - - /** - * 该分类下已结案已解决的项目总数 - */ - private Integer resolvedTotal; - - /** - * 该分类下项目结案率 - */ - private BigDecimal closedRatio; - - /** - * 该分类下已结案项目解决率 - */ - private BigDecimal resolvedRatio; - - /** - * 该分类下已结案项目未解决率 + * 分类等级1、2.... */ - private BigDecimal unResolvedRatio; + private Integer level; /** * 删除标识 diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/ScreenProjectCategoryOrgDailyDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/ScreenProjectCategoryOrgDailyDTO.java index 1507a1f88a..95d65184a8 100644 --- a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/ScreenProjectCategoryOrgDailyDTO.java +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/ScreenProjectCategoryOrgDailyDTO.java @@ -17,11 +17,10 @@ package com.epmet.dto; -import java.io.Serializable; -import java.util.Date; import lombok.Data; -import java.math.BigDecimal; +import java.io.Serializable; +import java.util.Date; /** * 项目(事件)分类按组织_按天统计 @@ -72,7 +71,7 @@ public class ScreenProjectCategoryOrgDailyDTO implements Serializable { /** * e世通中的项目类别编码 */ - private String epmetCategoryCode; + private String categoryCode; /** * 该分类下所有项目总数 @@ -80,39 +79,9 @@ public class ScreenProjectCategoryOrgDailyDTO implements Serializable { private Integer projectTotal; /** - * 该分类下,正在处理中的项目总数 - */ - private Integer pendingTotal; - - /** - * 该分类下已结案的项目总数 - */ - private Integer closedTotal; - - /** - * 该分类下已结案无需解决的项目总数 - */ - private Integer unResolvedTotal; - - /** - * 该分类下已结案已解决的项目总数 - */ - private Integer resolvedTotal; - - /** - * 该分类下项目结案率 - */ - private BigDecimal closedRatio; - - /** - * 该分类下已结案项目解决率 - */ - private BigDecimal resolvedRatio; - - /** - * 该分类下已结案项目未解决率 + * 分类等级1、2.... */ - private BigDecimal unResolvedRatio; + private Integer level; /** * 删除标识 diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/project/dto/CustomerCategoryDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/project/dto/CustomerCategoryDTO.java new file mode 100644 index 0000000000..d351ae7346 --- /dev/null +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/project/dto/CustomerCategoryDTO.java @@ -0,0 +1,43 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.project.dto; + +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; + +@Data +public class CustomerCategoryDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 父id + * pid = 0 查询一级分类 + * pid != 0 查询二级分类 + */ + private String pid; + + /** + * 客户Id + */ + private String customerId; + +} diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/project/dto/result/ProjectCategoryDictResultDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/project/dto/result/ProjectCategoryDictResultDTO.java new file mode 100644 index 0000000000..ca534db2a9 --- /dev/null +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/project/dto/result/ProjectCategoryDictResultDTO.java @@ -0,0 +1,41 @@ +package com.epmet.project.dto.result; + +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + * @Author zhangyong + * @Description 002、项目分类字典查询 + **/ +@Data +public class ProjectCategoryDictResultDTO implements Serializable { + + private static final long serialVersionUID = 8529179932504931368L; + + /** + * 一级分类编码 + */ + private String categoryCode; + + /** + * 一级分类名称 + */ + private String categoryName; + + /** + * 二级分类列表 + */ + private List children; + + /** + * 主键 + **/ + private String id; + + /** + * 上级分类ID 顶级此列存储0 + **/ + private String pid; +} diff --git a/epmet-module/data-report/data-report-server/pom.xml b/epmet-module/data-report/data-report-server/pom.xml index 8cb39e2c6b..4480ac88e7 100644 --- a/epmet-module/data-report/data-report-server/pom.xml +++ b/epmet-module/data-report/data-report-server/pom.xml @@ -94,6 +94,12 @@ 2.0.0 compile + + com.epmet + gov-issue-client + 2.0.0 + compile + diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/project/ProjectController.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/project/ProjectController.java index ed31aef27a..2f704b6b16 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/project/ProjectController.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/project/ProjectController.java @@ -16,10 +16,7 @@ import com.epmet.project.dto.form.DifficultyRankFormDTO; import com.epmet.project.dto.form.ProjectIncrTrendFormDTO; import com.epmet.project.dto.result.*; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; import java.util.List; @@ -129,4 +126,18 @@ public class ProjectController { public Result> myNextAgency(@LoginUser TokenDto tokenDto){ return new Result>().ok(projectService.getMyNextAgency(tokenDto)); } + + /** + * 002、项目分类字典查询 + * 查询当前客户的父客户下,项目分类字典 + * + * @param customerId + * @return com.epmet.commons.tools.utils.Result> + * @Author zhangyong + * @Date 10:41 2021-03-22 + **/ + @PostMapping("categorydict") + public Result> categoryDict(@RequestHeader("CustomerId") String customerId) { + return new Result>().ok(projectService.getCategoryDict(customerId)); + } } diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/project/ProjectService.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/project/ProjectService.java index 18246addc6..917113fe12 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/project/ProjectService.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/project/ProjectService.java @@ -70,4 +70,14 @@ public interface ProjectService { * @date 2020.10.19 16:38 **/ List getMyNextAgency(TokenDto tokenDto); + + /** + * 002、项目分类字典查询 + * + * @param customerId + * @return java.util.List + * @Author zhangyong + * @Date 14:26 2021-03-22 + **/ + List getCategoryDict(String customerId); } diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/project/impl/ProjectServiceImpl.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/project/impl/ProjectServiceImpl.java index f095fb0666..4d2df70470 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/project/impl/ProjectServiceImpl.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/project/impl/ProjectServiceImpl.java @@ -3,6 +3,7 @@ package com.epmet.datareport.service.project.impl; import com.alibaba.fastjson.JSON; import com.epmet.commons.dynamic.datasource.annotation.DataSource; import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.constant.ServiceConstant; import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.ConvertUtils; @@ -18,20 +19,21 @@ import com.epmet.dto.form.ProcessListFormDTO; import com.epmet.dto.form.SubAgencyFormDTO; import com.epmet.dto.result.*; import com.epmet.evaluationindex.screen.dto.result.DepartmentNameListResultDTO; -import com.epmet.feign.EpmetUserOpenFeignClient; -import com.epmet.feign.GovOrgOpenFeignClient; -import com.epmet.feign.GovProjectOpenFeignClient; +import com.epmet.feign.*; import com.epmet.project.constant.ProjectConstant; +import com.epmet.project.dto.CustomerCategoryDTO; import com.epmet.project.dto.FactAgencyProjectDailyDTO; import com.epmet.project.dto.form.DifficultyRankFormDTO; import com.epmet.project.dto.form.ProjectIncrTrendFormDTO; -import com.epmet.project.dto.result.ProjectDetailResultDTO; import com.epmet.project.dto.result.*; +import com.epmet.project.dto.result.ProjectDetailResultDTO; import com.epmet.resi.group.dto.topic.ResiTopicDTO; import com.epmet.resi.group.feign.ResiGroupOpenFeignClient; import com.github.pagehelper.PageHelper; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -50,7 +52,7 @@ import java.util.List; @Slf4j @Service public class ProjectServiceImpl implements ProjectService { - + private Logger logger = LogManager.getLogger(getClass()); @Autowired private ProjectDao projectDao; @Autowired @@ -64,6 +66,11 @@ public class ProjectServiceImpl implements ProjectService { private GovOrgOpenFeignClient govOrgOpenFeignClient; @Autowired private ResiGroupOpenFeignClient resiGroupOpenFeignClient; + @Autowired + private GovIssueOpenFeignClient govIssueOpenFeignClient; + @Autowired + private OperCrmOpenFeignClient operCrmOpenFeignClient; + /** * @Author sun * @Description 数据-项目-获取汇总数据 @@ -350,4 +357,41 @@ public class ProjectServiceImpl implements ProjectService { return result; } + @Override + public List getCategoryDict(String customerId) { + List result = new ArrayList<>(); + Result parentCustomerId = operCrmOpenFeignClient.getExternalAndParentCustomerId(customerId); + if (!parentCustomerId.success() && null == parentCustomerId.getData()) { + logger.warn(String.format("调用%s服务查询外部客户的 父级客户ID 失败,入参%s", ServiceConstant.OPER_CRM_SERVER, + JSON.toJSONString(customerId))); + return result; + } + CustomerCategoryDTO argDto = new CustomerCategoryDTO(); + argDto.setCustomerId(parentCustomerId.getData()); + argDto.setPid(NumConstant.ZERO_STR); + // 获取客户一级分类 + Result> parentCategoryDict = govIssueOpenFeignClient.getCustomerCategoryDict(argDto); + if (!parentCategoryDict.success()) { + logger.warn(String.format("调用%s服务查询当前客户的父客户下,项目分类字典失败,入参%s", ServiceConstant.GOV_ISSUE_SERVER, + JSON.toJSONString(customerId))); + } else { + result = parentCategoryDict.getData(); + // 获取客户二级分类 + argDto.setPid(NumConstant.TWO_STR); + Result> childrenCategoryDict = govIssueOpenFeignClient.getCustomerCategoryDict(argDto); + for (ProjectCategoryDictResultDTO p : result) { + List children = new ArrayList<>(); + for (ProjectCategoryDictResultDTO c : childrenCategoryDict.getData()) { + if (p.getId().equals(c.getPid())) { + ProjectCategoryDictResultDTO dto = new ProjectCategoryDictResultDTO(); + dto.setCategoryCode(c.getCategoryCode()); + dto.setCategoryName(c.getCategoryName()); + children.add(dto); + } + } + p.setChildren(children); + } + } + return result; + } } diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenProjectCategoryOrgDailyDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenProjectCategoryOrgDailyDao.xml index 5816def044..d2ac38a7f7 100644 --- a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenProjectCategoryOrgDailyDao.xml +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenProjectCategoryOrgDailyDao.xml @@ -5,24 +5,26 @@ \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/issue/IssueProjectCategoryDictDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/issue/IssueProjectCategoryDictDTO.java index 1955847edd..c07037ee92 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/issue/IssueProjectCategoryDictDTO.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/issue/IssueProjectCategoryDictDTO.java @@ -53,6 +53,11 @@ public class IssueProjectCategoryDictDTO implements Serializable { */ private String pids; + /** + * 上级分类编码 + */ + private String parentCategoryCode; + /** * 分类编码,分类编码+customer_id唯一 */ @@ -73,6 +78,11 @@ public class IssueProjectCategoryDictDTO implements Serializable { */ private Integer sort; + /** + * 是否禁用(enable:启用 disable:禁用) + */ + private String isDisable; + /** * 删除标识 0未删除、1已删除 */ diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/project/ProjectCategoryDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/project/ProjectCategoryDTO.java index 3ca8dc43fc..8977da4ee3 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/project/ProjectCategoryDTO.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/project/ProjectCategoryDTO.java @@ -64,6 +64,11 @@ public class ProjectCategoryDTO implements Serializable { */ private String categoryPids; + /** + * 分类编码,分类编码+customer_id唯一 + */ + private String categoryCode; + /** * 删除标识 0未删除、1已删除 */ diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/CategoryDictDataFormDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/CategoryDictDataFormDTO.java new file mode 100644 index 0000000000..bd88161f54 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/CategoryDictDataFormDTO.java @@ -0,0 +1,27 @@ +package com.epmet.dto.screen; + +import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; +import com.epmet.dto.screen.form.CategoryDictFormDTO; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; +import java.util.List; + +/** + * 项目分类字典上报 + * @Auther: zhangyong + * @Date: 2021-03-22 + */ +@Data +public class CategoryDictDataFormDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 当isFirst=true时,直接根据 customerId 删除原有数据,再批量insert。 + */ + private Boolean isFirst; + + private List dataList; +} diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/ScreenCustomerGridDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/ScreenCustomerGridDTO.java index ee7863d40b..65e98b940b 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/ScreenCustomerGridDTO.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/ScreenCustomerGridDTO.java @@ -112,5 +112,7 @@ public class ScreenCustomerGridDTO implements Serializable { * 所有上级ID,用英文逗号分开 */ private String allParentIds; + private String pid; + private String pids; } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/ScreenProjectCategoryGridDailyDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/ScreenProjectCategoryGridDailyDTO.java index 50afc350ef..0406fb26f2 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/ScreenProjectCategoryGridDailyDTO.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/ScreenProjectCategoryGridDailyDTO.java @@ -17,11 +17,10 @@ package com.epmet.dto.screen; -import java.io.Serializable; -import java.util.Date; import lombok.Data; -import java.math.BigDecimal; +import java.io.Serializable; +import java.util.Date; /** * 项目(事件)分类按网格_按天统计 @@ -67,9 +66,7 @@ public class ScreenProjectCategoryGridDailyDTO implements Serializable { /** * e世通中的项目类别编码 */ - private String epmetCategoryCode; - - private String epmetCategoryName; + private String categoryCode; /** * 该分类下所有项目总数 @@ -77,39 +74,9 @@ public class ScreenProjectCategoryGridDailyDTO implements Serializable { private Integer projectTotal; /** - * 该分类下,正在处理中的项目总数 - */ - private Integer pendingTotal; - - /** - * 该分类下已结案的项目总数 - */ - private Integer closedTotal; - - /** - * 该分类下已结案无需解决的项目总数 - */ - private Integer unResolvedTotal; - - /** - * 该分类下已结案已解决的项目总数 - */ - private Integer resolvedTotal; - - /** - * 该分类下项目结案率 - */ - private BigDecimal closedRatio; - - /** - * 该分类下已结案项目解决率 - */ - private BigDecimal resolvedRatio; - - /** - * 该分类下已结案项目未解决率 + * 分类等级1、2.... */ - private BigDecimal unResolvedRatio; + private Integer level; /** * 删除标识 diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/ScreenProjectCategoryOrgDailyDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/ScreenProjectCategoryOrgDailyDTO.java index 49c85be67e..117db2716c 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/ScreenProjectCategoryOrgDailyDTO.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/ScreenProjectCategoryOrgDailyDTO.java @@ -17,11 +17,10 @@ package com.epmet.dto.screen; -import java.io.Serializable; -import java.util.Date; import lombok.Data; -import java.math.BigDecimal; +import java.io.Serializable; +import java.util.Date; /** * 项目(事件)分类按组织_按天统计 @@ -72,9 +71,7 @@ public class ScreenProjectCategoryOrgDailyDTO implements Serializable { /** * e世通中的项目类别编码 */ - private String epmetCategoryCode; - - private String epmetCategoryName; + private String categoryCode; /** * 该分类下所有项目总数 @@ -82,39 +79,9 @@ public class ScreenProjectCategoryOrgDailyDTO implements Serializable { private Integer projectTotal; /** - * 该分类下,正在处理中的项目总数 - */ - private Integer pendingTotal; - - /** - * 该分类下已结案的项目总数 - */ - private Integer closedTotal; - - /** - * 该分类下已结案无需解决的项目总数 - */ - private Integer unResolvedTotal; - - /** - * 该分类下已结案已解决的项目总数 - */ - private Integer resolvedTotal; - - /** - * 该分类下项目结案率 - */ - private BigDecimal closedRatio; - - /** - * 该分类下已结案项目解决率 - */ - private BigDecimal resolvedRatio; - - /** - * 该分类下已结案项目未解决率 + * 分类等级1、2.... */ - private BigDecimal unResolvedRatio; + private Integer level; /** * 删除标识 diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/form/CategoryDictFormDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/form/CategoryDictFormDTO.java new file mode 100644 index 0000000000..364c497eb1 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/form/CategoryDictFormDTO.java @@ -0,0 +1,61 @@ +package com.epmet.dto.screen.form; + +import lombok.Data; + +import java.io.Serializable; + +/** + * 项目分类字典上报 + * @Auther: zhangyong + * @Date: 2021-03-22 + */ +@Data +public class CategoryDictFormDTO implements Serializable { + + + private static final long serialVersionUID = 1245827825857891963L; + /** + * 客户内自己的分类编码 + */ + private String categoryCode; + + /** + * 客户内自己的分类名称 + */ + private String categoryName; + + /** + * 父类分类编码,如果是一级分类,此列赋值为0 + */ + private String parentCategoryCode; + + /** + * 分类等级:1、2....; + */ + private Integer level; + + /** + * 排序 + */ + private Integer sort; + + /** + * 当前分类对应产品内的分类编码,如果对应不上,此列传空 + */ + private String epmetCategoryCode; + + /** + * 原始创建时间yyyy-MM-dd HH:mm:ss + */ + private String originCreatedTime; + + /** + * 原始更新时间yyyy-MM-dd HH:mm:ss + */ + private String orginUpdatedTime; + + /** + * 分类字典表主键 + */ + private String categoryId; +} diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/result/CategoryProjectResultDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/result/CategoryProjectResultDTO.java new file mode 100644 index 0000000000..2ed95c1a35 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/result/CategoryProjectResultDTO.java @@ -0,0 +1,56 @@ +package com.epmet.dto.screen.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Author zxc + * @DateTime 2021/3/23 下午2:38 + * @DESC + */ +@Data +public class CategoryProjectResultDTO implements Serializable { + + private static final long serialVersionUID = -5774330825880917524L; + + private String pid; + private String pids; + + /** + * 组织ID + */ + private String orgId; + + /** + * 客户ID + */ + private String customerId; + + /** + * 分类码 + */ + private String categoryCode; + + /** + * 项目总数 + */ + private Integer projectTotal; + + /** + * 分类级别 + */ + private Integer level; + + /** + * 日期ID + */ + private String dateId; + + /** + * 组织级别 + */ + private String orgType; + + private Boolean status = false; +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java index 4bb409b6eb..9259e12463 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java @@ -2,6 +2,7 @@ package com.epmet.controller; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.epmet.commons.dynamic.datasource.annotation.DataSource; +import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.utils.DateUtils; import com.epmet.commons.tools.utils.Result; @@ -34,13 +35,11 @@ import com.epmet.entity.stats.DimDateEntity; import com.epmet.entity.stats.DimMonthEntity; import com.epmet.service.StatsDemoService; import com.epmet.service.evaluationindex.extract.dataToIndex.*; +import com.epmet.service.evaluationindex.extract.todata.FactOriginProjectCategoryDailyService; import com.epmet.service.evaluationindex.extract.todata.FactOriginTopicMainDailyService; import com.epmet.service.evaluationindex.extract.toscreen.*; import com.epmet.service.evaluationindex.indexcal.*; -import com.epmet.service.evaluationindex.screen.ScreenProjectGridDailyService; -import com.epmet.service.evaluationindex.screen.ScreenProjectOrgDailyService; -import com.epmet.service.evaluationindex.screen.ScreenProjectQuantityGridMonthlyService; -import com.epmet.service.evaluationindex.screen.ScreenProjectQuantityOrgMonthlyService; +import com.epmet.service.evaluationindex.screen.*; import com.epmet.service.stats.DimAgencyService; import com.epmet.service.stats.DimCustomerPartymemberService; import lombok.extern.slf4j.Slf4j; @@ -49,6 +48,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import java.math.BigDecimal; +import java.time.LocalDate; import java.time.LocalDateTime; import java.util.List; import java.util.concurrent.ExecutionException; @@ -103,6 +103,13 @@ public class DemoController { private GovernRankDataExtractService governRankDataExtractService; @Autowired private OrgRankExtractService orgRankExtractService; + @Autowired + private ScreenProjectSettleService screenProjectSettleService; + @Autowired + private ScreenProjectCategoryGridDailyService projectCategoryGridDailyService; + @Autowired + private FactOriginProjectCategoryDailyService originProjectCategoryDailyService; + @GetMapping("testAlarm") public void testAlarm() { //for (int i = 0; i < 20; i++) { @@ -815,8 +822,6 @@ public class DemoController { return new Result(); }*/ - @Autowired - private ScreenProjectSettleService screenProjectSettleService; @PostMapping("project-test") public Result project(@RequestBody ScreenCentralZoneDataFormDTO param){ screenProjectSettleService.extractScreenData(param); @@ -828,4 +833,40 @@ public class DemoController { System.out.println(monthId); } } + + /** + * @return com.epmet.commons.tools.utils.Result + * @param customerId + * @author yinzuomei + * @description 产品内部计算:网格内按分类统计项目数量 + * @Date 2021/3/23 10:52 + **/ + @PostMapping("extractProjectCategoryData") + public Result extractProjectCategoryData(@RequestParam("customerId") String customerId){ + String dateId = LocalDate.now().minusDays(NumConstant.ONE).toString().replace("-", ""); + projectCategoryGridDailyService.extractProjectCategoryData(customerId,dateId); + return new Result(); + } + + /** + * @return com.epmet.commons.tools.utils.Result + * @author yinzuomei + * @description 将epmet_gov_project库中的项目分类信息(project_category)同步到统计库epmet_data_statistical + * @Date 2021/3/23 10:52 + **/ + @PostMapping("extractProjectCategory") + public Result extractProjectCategory(@RequestBody ExtractOriginFormDTO formDTO){ + originProjectCategoryDailyService.extractProjectCategory(formDTO); + return new Result(); + } + + @Autowired + private ScreenProjectCategoryOrgDailyService screenProjectCategoryOrgDailyService; + + @PostMapping("orgdaily") + public Result orgDaily(@RequestParam("customerId")String customerId,@RequestParam("dateId")String dateId){ + screenProjectCategoryOrgDailyService.extractProjectCategoryOrgData(customerId,dateId); + return new Result(); + } + } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DimController.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DimController.java index 3e2a78b716..68dedbd4a0 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DimController.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DimController.java @@ -1,7 +1,6 @@ package com.epmet.controller; import com.epmet.commons.tools.utils.Result; -import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.dto.AgencySubDeptTreeDto; import com.epmet.dto.AgencySubTreeDto; import com.epmet.dto.stats.form.CustomerIdAndDateIdFormDTO; @@ -105,6 +104,13 @@ public class DimController { } catch (Exception e) { logger.error("初始化按周维度失败:", e); } + //项目分类字典维度 初始化 每天晚上凌晨10分执行 + try { + statsDimService.customerInitProjectCategory(); + logger.info("初始化项目分类成功"); + } catch (Exception e) { + logger.error("初始化项目分类失败:", e); + } return new Result(); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/ScreenProjectDataCollController.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/ScreenProjectDataCollController.java index 0af70355e9..db45cca198 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/ScreenProjectDataCollController.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/ScreenProjectDataCollController.java @@ -3,16 +3,15 @@ package com.epmet.controller; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.dto.screen.*; +import com.epmet.dto.screen.form.CategoryDictFormDTO; import com.epmet.dto.screen.form.ScreenProjectDataInfoFormDTO; import com.epmet.dto.screen.form.ScreenProjectProcessFormDTO; import com.epmet.dto.screencoll.ScreenCollFormDTO; import com.epmet.service.evaluationindex.screen.*; +import com.epmet.service.stats.CustomerProjectCategoryDictService; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestHeader; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; /** * @Description 事件/项目采集接口入口 @@ -41,7 +40,8 @@ public class ScreenProjectDataCollController { private ScreenProjectDataService projectDataService; @Autowired private ScreenProjectProcessService projectProcessService; - + @Autowired + private CustomerProjectCategoryDictService customerProjectCategoryDictService; /** * @author wangc * @description 【事件/项目分析】网格内月度数量统计 @@ -152,4 +152,21 @@ public class ScreenProjectDataCollController { return new Result(); } + /** + * 项目分类字典上报 + * 目标表:epmet_evaluation_index库的customer_project_category_dict + * + * @param customerId + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + * @Author zhangyong + * @Date 16:03 2021-03-22 + **/ + @PostMapping("uploadcategorydict") + public Result uploadcategorydict(@RequestHeader("CustomerId") String customerId, @RequestBody ScreenCollFormDTO formDTO) { + formDTO.setCustomerId(customerId); + ValidatorUtils.validateEntity(formDTO, ScreenCollFormDTO.CustomerIdShowGroup.class, ScreenCollFormDTO.DataListShowGroup.class); + customerProjectCategoryDictService.uploadCategoryDict(formDTO); + return new Result(); + } } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/crm/CustomerRelationDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/crm/CustomerRelationDao.java index fabee946e7..11ec9c119c 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/crm/CustomerRelationDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/crm/CustomerRelationDao.java @@ -43,4 +43,12 @@ public interface CustomerRelationDao extends BaseDao { CustomerSubInfoDTO selectCustomerSubInfo(@Param("customerId")String customerId); List selectListByPids(String customerId); + + /** + * @Description 查询子级客户 + * @Param customerId + * @author zxc + * @date 2021/3/23 上午10:21 + */ + List selectSubCustomer(@Param("customerId") String customerId); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginProjectCategoryDailyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginProjectCategoryDailyDao.java new file mode 100644 index 0000000000..010004d7ba --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginProjectCategoryDailyDao.java @@ -0,0 +1,46 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dao.evaluationindex.extract; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.screen.ScreenProjectCategoryGridDailyDTO; +import com.epmet.entity.evaluationindex.extract.FactOriginProjectCategoryDailyEntity; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 项目所属分类表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-03-19 + */ +@Mapper +public interface FactOriginProjectCategoryDailyDao extends BaseDao { + + void deleteOldData(@Param("customerId") String customerId,@Param("dateId") String dateId); + + /** + * @param customerId + * @author yinzuomei + * @description 计算当前客户下,各个网格内,各项目分类下项目数量 + * @Date 2021/3/23 9:58 + **/ + List selectListProjectCategoryGridDailyDTO(@Param("customerId") String customerId); +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerGridDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerGridDao.java index c06e189d7c..1d5099bc67 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerGridDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerGridDao.java @@ -194,4 +194,13 @@ public interface ScreenCustomerGridDao extends BaseDao * @date 2021/1/28 下午3:18 */ List selectGridInfoByCustomerId(@Param("customerId") String customerId); + + /** + * @Description 查询直属网格信息 + * @Param customerId + * @Param level + * @author zxc + * @date 2021/3/23 下午4:03 + */ + List selectBelongGridInfo(@Param("customerId") String customerId,@Param("level") String level); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenProjectCategoryGridDailyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenProjectCategoryGridDailyDao.java index 5b96c10067..bad0a291bf 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenProjectCategoryGridDailyDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenProjectCategoryGridDailyDao.java @@ -18,10 +18,13 @@ package com.epmet.dao.evaluationindex.screen; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.screen.result.CategoryProjectResultDTO; import com.epmet.entity.evaluationindex.screen.ScreenProjectCategoryGridDailyEntity; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; +import java.util.List; + /** * 项目(事件)分类按网格_按天统计 * @@ -39,4 +42,13 @@ public interface ScreenProjectCategoryGridDailyDao extends BaseDao selectCategoryInfo(@Param("customerId") String customerId,@Param("dateId") String dateId,@Param("level")String level,@Param("gridIds")List gridIds); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenProjectCategoryOrgDailyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenProjectCategoryOrgDailyDao.java index c87d8bec0f..9f55340594 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenProjectCategoryOrgDailyDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenProjectCategoryOrgDailyDao.java @@ -18,10 +18,14 @@ package com.epmet.dao.evaluationindex.screen; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.screen.result.CategoryProjectResultDTO; import com.epmet.entity.evaluationindex.screen.ScreenProjectCategoryOrgDailyEntity; +import com.sun.org.apache.xpath.internal.operations.Bool; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; +import java.util.List; + /** * 项目(事件)分类按组织_按天统计 * @@ -39,4 +43,26 @@ public interface ScreenProjectCategoryOrgDailyDao extends BaseDao selectOrgCategoryInfo(@Param("customerId") String customerId, @Param("dateId") String dateId,@Param("level")String level); + + /** + * @Description 查询组织分类信息【多客户】 + * @Param customerId + * @Param dateId + * @Param level + * @Param existsStatus 父客户是否存在 + * @author zxc + * @date 2021/3/24 下午2:48 + */ + List selectOrgCategoryMoreCustomerInfo(@Param("customerIds")List customerIds, @Param("dateId") String dateId, + @Param("level")String level, @Param("customerId")String customerId, @Param("existsStatus")Boolean existsStatus); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/issue/IssueProjectCategoryDictDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/issue/IssueProjectCategoryDictDao.java new file mode 100644 index 0000000000..371cda3cf2 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/issue/IssueProjectCategoryDictDao.java @@ -0,0 +1,41 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dao.issue; + +import com.epmet.entity.issue.IssueProjectCategoryDictEntity; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.Date; +import java.util.List; + +/** + * 议题项目分类字典 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-12-08 + */ +@Mapper +public interface IssueProjectCategoryDictDao { + + List listInsertCategoies(@Param("start") Date start, @Param("end") Date end); + + List listByUpdatedTime(@Param("start") Date start, @Param("end") Date end); + + IssueProjectCategoryDictEntity getById(@Param("customerId")String customerId, @Param("id")String id);; +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/project/ProjectDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/project/ProjectDao.java index 9d64b829da..2d3318c262 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/project/ProjectDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/project/ProjectDao.java @@ -133,4 +133,6 @@ public interface ProjectDao extends BaseDao { * @date 2021.03.08 23:44 */ List selectProjectCategory(@Param("list")List list); -} \ No newline at end of file + + List getProjectCategoryData(@Param("customerId") String customerId, @Param("dateId") String dateId); +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/CustomerProjectCategoryDictDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/CustomerProjectCategoryDictDao.java new file mode 100644 index 0000000000..3489fc5917 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/CustomerProjectCategoryDictDao.java @@ -0,0 +1,63 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dao.stats; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.screen.form.CategoryDictFormDTO; +import com.epmet.entity.stats.CustomerProjectCategoryDictEntity; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 客户项目分类字典表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-03-19 + */ +@Mapper +public interface CustomerProjectCategoryDictDao extends BaseDao { + + CustomerProjectCategoryDictEntity getLatestProjectCategory(); + + CustomerProjectCategoryDictEntity getLatestUpdatedEntity(); + + CustomerProjectCategoryDictEntity selectByCustomerIdAndId(@Param("customerId") String customerId, @Param("categoryId") String categoryId); + + /** + * 当isFirst=true时,直接根据 customerId 删除原有数据,再批量insert。 + * + * @param customerId + * @return java.lang.Integer + * @Author zhangyong + * @Date 16:12 2021-03-22 + **/ + Integer deleteCustomerProjectCategoryDict(@Param("customerId") String customerId); + + /** + * 批量insert。 + * + * @param list + * @param customerId + * @return void + * @Author zhangyong + * @Date 16:13 2021-03-22 + **/ + void batchInsertCustomerProjectCategoryDict(@Param("list") List list, @Param("customerId")String customerId); +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/extract/FactOriginProjectCategoryDailyEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/extract/FactOriginProjectCategoryDailyEntity.java new file mode 100644 index 0000000000..4587577a2d --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/extract/FactOriginProjectCategoryDailyEntity.java @@ -0,0 +1,63 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.entity.evaluationindex.extract; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 项目所属分类表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-03-19 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("fact_origin_project_category_daily") +public class FactOriginProjectCategoryDailyEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户id + */ + private String customerId; + + /** + * 项目id + */ + private String projectId; + + /** + * 分类编码 + */ + private String categoryCode; + + /** + * 所属父类分类编码 + */ + private String parentCategoryCode; + + /** + * 分类等级:1、2....;产品目前只有2级分类 + */ + private Integer level; + +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenProjectCategoryGridDailyEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenProjectCategoryGridDailyEntity.java index ef91f696c2..82b03555ac 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenProjectCategoryGridDailyEntity.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenProjectCategoryGridDailyEntity.java @@ -18,14 +18,10 @@ package com.epmet.entity.evaluationindex.screen; import com.baomidou.mybatisplus.annotation.TableName; - import com.epmet.commons.mybatis.entity.BaseEpmetEntity; import lombok.Data; import lombok.EqualsAndHashCode; -import java.math.BigDecimal; -import java.util.Date; - /** * 项目(事件)分类按网格_按天统计 * @@ -65,50 +61,17 @@ public class ScreenProjectCategoryGridDailyEntity extends BaseEpmetEntity { private String pids; /** - * e世通中的项目类别编码 + * 项目类别编码 */ - private String epmetCategoryCode; - - private String epmetCategoryName; + private String categoryCode; /** * 该分类下所有项目总数 */ private Integer projectTotal; - /** - * 该分类下,正在处理中的项目总数 - */ - private Integer pendingTotal; - - /** - * 该分类下已结案的项目总数 - */ - private Integer closedTotal; - - /** - * 该分类下已结案无需解决的项目总数 - */ - private Integer unResolvedTotal; - - /** - * 该分类下已结案已解决的项目总数 - */ - private Integer resolvedTotal; - - /** - * 该分类下项目结案率 - */ - private BigDecimal closedRatio; - - /** - * 该分类下已结案项目解决率 - */ - private BigDecimal resolvedRatio; - - /** - * 该分类下已结案项目未解决率 - */ - private BigDecimal unResolvedRatio; - + /** + * 分类等级1、2.... + */ + private Integer level; } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenProjectCategoryOrgDailyEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenProjectCategoryOrgDailyEntity.java index 1ac6c76145..5c097997a6 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenProjectCategoryOrgDailyEntity.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenProjectCategoryOrgDailyEntity.java @@ -18,14 +18,10 @@ package com.epmet.entity.evaluationindex.screen; import com.baomidou.mybatisplus.annotation.TableName; - import com.epmet.commons.mybatis.entity.BaseEpmetEntity; import lombok.Data; import lombok.EqualsAndHashCode; -import java.math.BigDecimal; -import java.util.Date; - /** * 项目(事件)分类按组织_按天统计 * @@ -72,48 +68,15 @@ public class ScreenProjectCategoryOrgDailyEntity extends BaseEpmetEntity { /** * e世通中的项目类别编码 */ - private String epmetCategoryCode; - - private String epmetCategoryName; + private String categoryCode; /** * 该分类下所有项目总数 */ private Integer projectTotal; - /** - * 该分类下,正在处理中的项目总数 - */ - private Integer pendingTotal; - - /** - * 该分类下已结案的项目总数 - */ - private Integer closedTotal; - - /** - * 该分类下已结案无需解决的项目总数 - */ - private Integer unResolvedTotal; - - /** - * 该分类下已结案已解决的项目总数 - */ - private Integer resolvedTotal; - - /** - * 该分类下项目结案率 - */ - private BigDecimal closedRatio; - - /** - * 该分类下已结案项目解决率 - */ - private BigDecimal resolvedRatio; - - /** - * 该分类下已结案项目未解决率 - */ - private BigDecimal unResolvedRatio; - + /** + * 分类等级1、2.... + */ + private Integer level; } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/issue/IssueProjectCategoryDictEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/issue/IssueProjectCategoryDictEntity.java new file mode 100644 index 0000000000..67c82fee00 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/issue/IssueProjectCategoryDictEntity.java @@ -0,0 +1,83 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.entity.issue; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 议题项目分类字典 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-12-08 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("issue_project_category_dict") +public class IssueProjectCategoryDictEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户id, 产品默认default + */ + private String customerId; + + /** + * 上级分类ID 顶级此列存储0 + */ + private String pid; + + /** + * 所有上级分类ID,用逗号分开 + */ + private String pids; + + /** + * 上级分类编码 + */ + private String parentCategoryCode; + + /** + * 分类编码,分类编码+customer_id唯一 + */ + private String categoryCode; + + /** + * 分类名称 + */ + private String categoryName; + + /** + * 分类类别1,2,3,4.... + */ + private String categoryType; + + /** + * 排序 + */ + private Integer sort; + + /** + * 是否禁用(enable:启用 disable:禁用) + */ + private String isDisable; + +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/stats/CustomerProjectCategoryDictEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/stats/CustomerProjectCategoryDictEntity.java new file mode 100644 index 0000000000..82afefb88c --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/stats/CustomerProjectCategoryDictEntity.java @@ -0,0 +1,95 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.entity.stats; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; + +/** + * 客户项目分类字典表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-03-19 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("customer_project_category_dict") +public class CustomerProjectCategoryDictEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户id + */ + private String customerId; + + /** + * 外部客户:external;内部客户:internal + */ + private String customerType; + + /** + * 客户自己的分类编码 + */ + private String categoryCode; + + /** + * 客户自己的分类名称 + */ + private String categoryName; + + /** + * 父类分类编码,如果是一级分类,此列赋值为0 + */ + private String parentCategoryCode; + + /** + * 分类等级:1、2....;产品只有2级分类 + */ + private Integer level; + + /** + * 排序 + */ + private Integer sort; + + /** + * 是否禁用(enable:启用 disable:禁用) + */ + private String isDisable; + + /** + * 对应e世通中的分类编码,没有此列为空 + */ + private String epmetCategoryCode; + + /** + * 创建时间 + */ + private Date originCreatedTime; + /** + * 修改时间 + */ + private Date originUpdatedTime; + + private String categoryId; +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/Issue/IssueProjectCategoryDictService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/Issue/IssueProjectCategoryDictService.java new file mode 100644 index 0000000000..4d2a96f7be --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/Issue/IssueProjectCategoryDictService.java @@ -0,0 +1,39 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service.Issue; + +import com.epmet.entity.issue.IssueProjectCategoryDictEntity; + +import java.util.Date; +import java.util.List; + +/** + * 议题项目分类字典 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-12-08 + */ + +public interface IssueProjectCategoryDictService{ + + List listInsertCategoies(Date start, Date end); + + List listByUpdatedTime(Date start, Date end); + + IssueProjectCategoryDictEntity getById(String customerId,String id); +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/Issue/IssueService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/Issue/IssueService.java index 22201f81ab..b920c0e29a 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/Issue/IssueService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/Issue/IssueService.java @@ -176,7 +176,7 @@ public interface IssueService { List selectIssueVoteStatis(String customerId, String monthId); /** - * @Description 查找项目的分类名称 以-相连 + * @Description 查找项目的分类名称 以-相连,以,分隔, * @param param * @return java.util.Map * @author wangc diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/Issue/impl/IssueProjectCategoryDictServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/Issue/impl/IssueProjectCategoryDictServiceImpl.java new file mode 100644 index 0000000000..982030799f --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/Issue/impl/IssueProjectCategoryDictServiceImpl.java @@ -0,0 +1,42 @@ +package com.epmet.service.Issue.impl; + +import com.epmet.commons.dynamic.datasource.annotation.DataSource; +import com.epmet.constant.DataSourceConstant; +import com.epmet.dao.issue.IssueProjectCategoryDictDao; +import com.epmet.entity.issue.IssueProjectCategoryDictEntity; +import com.epmet.service.Issue.IssueProjectCategoryDictService; +import org.apache.ibatis.annotations.Param; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.Date; +import java.util.List; + +/** + * 描述一下 + * + * @author yinzuomei@elink-cn.com + * @date 2021/3/19 15:29 + */ +@Service +@DataSource(DataSourceConstant.GOV_ISSUE) +public class IssueProjectCategoryDictServiceImpl implements IssueProjectCategoryDictService { + @Autowired + private IssueProjectCategoryDictDao issueProjectCategoryDictDao; + + @Override + public List listInsertCategoies(Date start, Date end) { + return issueProjectCategoryDictDao.listInsertCategoies(start, end); + } + + @Override + public List listByUpdatedTime(Date start, Date end) { + return issueProjectCategoryDictDao.listByUpdatedTime(start, end); + } + + @Override + public IssueProjectCategoryDictEntity getById(String customerId, String id) { + return issueProjectCategoryDictDao.getById(customerId,id); + } + +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/Issue/impl/IssueServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/Issue/impl/IssueServiceImpl.java index 4ad4e58488..44578a426a 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/Issue/impl/IssueServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/Issue/impl/IssueServiceImpl.java @@ -2,6 +2,7 @@ package com.epmet.service.Issue.impl; import com.epmet.commons.dynamic.datasource.annotation.DataSource; import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.constant.StrConstant; import com.epmet.constant.DataSourceConstant; import com.epmet.dao.issue.StatsIssueDao; import com.epmet.dto.extract.result.IssueInfoResultDTO; @@ -146,14 +147,22 @@ public class IssueServiceImpl implements IssueService { return statsIssueDao.selectIssueVoteStatis(customerId, dateId); } + /** + * @Description 查找项目的分类名称 以-相连,以,分隔, + * @param param + * @return java.util.Map + * @author wangc + * @date 2021.03.09 00:23 + */ @Override public Map getIntegratedProjectCategory(Map> param,String customerId) { Map map = new HashMap<>(); param.forEach((projectId,categoryIds) -> { + //以下查询只适用于二级分类,如果分类层级变多了要修改此查询 List categories = statsIssueDao.selectCategory(customerId, categoryIds); if(!CollectionUtils.isEmpty(categories)){ StringBuilder str = new StringBuilder(); - categories.forEach(category -> {str.append(category.getCategoryName()).append("-");}); + categories.forEach(category -> {str.append(category.getCategoryName()).append(StrConstant.COMMA);}); map.put(projectId,str.substring(NumConstant.ZERO,str.length() - NumConstant.TWO)); } }); diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/StatsDimService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/StatsDimService.java index 1e2f05991b..0bdac4cb04 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/StatsDimService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/StatsDimService.java @@ -10,4 +10,6 @@ public interface StatsDimService { void initCustomerDim(); void initDepartmentDim(); + + void customerInitProjectCategory(); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/crm/CustomerRelationService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/crm/CustomerRelationService.java index f139c49bab..4c2a37620f 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/crm/CustomerRelationService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/crm/CustomerRelationService.java @@ -22,6 +22,8 @@ import com.epmet.commons.mybatis.service.BaseService; import com.epmet.dto.indexcal.CustomerSubInfoDTO; import com.epmet.entity.crm.CustomerRelationEntity; +import java.util.List; + /** * 客户关系表(01.14 add) * @@ -40,4 +42,12 @@ public interface CustomerRelationService extends BaseService selectSubCustomer(String customerId); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/crm/impl/CustomerRelationServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/crm/impl/CustomerRelationServiceImpl.java index cab6ed0adc..06d2b580fc 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/crm/impl/CustomerRelationServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/crm/impl/CustomerRelationServiceImpl.java @@ -27,9 +27,11 @@ import com.epmet.entity.crm.CustomerRelationEntity; import com.epmet.service.crm.CustomerRelationService; import com.epmet.service.stats.DimCustomerService; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import java.util.ArrayList; import java.util.List; /** @@ -70,4 +72,18 @@ public class CustomerRelationServiceImpl extends BaseServiceImpl selectSubCustomer(String customerId) { + if (StringUtils.isEmpty(customerId)){ + return new ArrayList<>(); + } + return baseDao.selectSubCustomer(customerId); + } } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginProjectCategoryDailyService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginProjectCategoryDailyService.java new file mode 100644 index 0000000000..1a0a27eda9 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginProjectCategoryDailyService.java @@ -0,0 +1,50 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service.evaluationindex.extract.todata; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.dto.extract.form.ExtractOriginFormDTO; +import com.epmet.dto.screen.ScreenProjectCategoryGridDailyDTO; +import com.epmet.entity.evaluationindex.extract.FactOriginProjectCategoryDailyEntity; + +import java.util.List; + +/** + * 项目所属分类表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-03-19 + */ +public interface FactOriginProjectCategoryDailyService extends BaseService { + /** + * @Description 将epmet_gov_project库中的项目分类信息(project_category)同步到统计库epmet_data_statistical + * @param paramNew + * @return void + * @Author liushaowen + * @Date 2021/3/22 15:28 + */ + void extractProjectCategory(ExtractOriginFormDTO paramNew); + + /** + * @param customerId + * @author yinzuomei + * @description 计算当前客户下,各个网格内,各项目分类下项目数量 + * @Date 2021/3/23 9:56 + **/ + List selectListProjectCategoryGridDailyDTO(String customerId); +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginExtractServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginExtractServiceImpl.java index 089be0c513..1d6e4dc9fd 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginExtractServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginExtractServiceImpl.java @@ -46,7 +46,8 @@ public class FactOriginExtractServiceImpl implements FactOriginExtractService { private GroupExtractService groupExtractService; @Autowired private DimCustomerPartymemberService dimCustomerPartymemberService; - + @Autowired + private FactOriginProjectCategoryDailyService originProjectCategoryDailyService; @Override public void extractAll(ExtractOriginFormDTO extractOriginFormDTO) { @@ -200,6 +201,11 @@ public class FactOriginExtractServiceImpl implements FactOriginExtractService { } catch (Exception e) { log.error("抽取【项目耗时数据】发生异常,参数:" + JSON.toJSONString(paramNew), e); } + try { + originProjectCategoryDailyService.extractProjectCategory(paramNew); + } catch (Exception e) { + log.error("抽取【项目分类数据】发生异常,参数:" + JSON.toJSONString(paramNew), e); + } } else { try { for (int i = 0; i < finalDaysBetween.size(); i++) { @@ -219,6 +225,16 @@ public class FactOriginExtractServiceImpl implements FactOriginExtractService { } catch (Exception e) { log.error("抽取【项目数据】发生异常,参数:" + JSON.toJSONString(paramNew), e); } + try { + for (int i = 0; i < finalDaysBetween.size(); i++) { + String dateDimId = finalDaysBetween.get(i); + paramNew.setDateId(dateDimId); + originProjectCategoryDailyService.extractProjectCategory(paramNew); + } + } catch (Exception e) { + log.error("抽取【项目分类数据】发生异常,参数:" + JSON.toJSONString(paramNew), e); + } + } }); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginProjectCategoryDailyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginProjectCategoryDailyServiceImpl.java new file mode 100644 index 0000000000..c97322b4b4 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginProjectCategoryDailyServiceImpl.java @@ -0,0 +1,122 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service.evaluationindex.extract.todata.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.epmet.commons.dynamic.datasource.annotation.DataSource; +import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.constant.DataSourceConstant; +import com.epmet.dao.evaluationindex.extract.FactOriginProjectCategoryDailyDao; +import com.epmet.dto.ProjectCategoryDTO; +import com.epmet.dto.extract.form.ExtractOriginFormDTO; +import com.epmet.dto.screen.ScreenProjectCategoryGridDailyDTO; +import com.epmet.entity.evaluationindex.extract.FactOriginProjectCategoryDailyEntity; +import com.epmet.entity.issue.IssueProjectCategoryDictEntity; +import com.epmet.service.Issue.IssueProjectCategoryDictService; +import com.epmet.service.evaluationindex.extract.todata.FactOriginProjectCategoryDailyService; +import com.epmet.service.project.ProjectService; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.CollectionUtils; + +import java.util.ArrayList; +import java.util.List; + +/** + * 项目所属分类表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-03-19 + */ +@Service +@DataSource(DataSourceConstant.STATS) +@Slf4j +public class FactOriginProjectCategoryDailyServiceImpl extends BaseServiceImpl implements FactOriginProjectCategoryDailyService { + @Autowired + private ProjectService projectService; + @Autowired + private IssueProjectCategoryDictService issueProjectCategoryDictService; + /** + * @param extractOriginFormDTO + * @return void + * @Description 将epmet_gov_project库中的项目分类信息(project_category)同步到统计库epmet_data_statistical + * @Author liushaowen + * @Date 2021/3/22 15:28 + */ + @Override + public void extractProjectCategory(ExtractOriginFormDTO extractOriginFormDTO) { + String dateString = extractOriginFormDTO.getDateId(); + String customerId = extractOriginFormDTO.getCustomerId(); + List entities = new ArrayList<>(); + Integer count = baseDao.selectCount(new QueryWrapper().eq("customer_id",customerId)); + //如果count = 0 初始化该customer所有数据 + if (NumConstant.ZERO == count){ + dateString = null; + } + List projectCategoryData = projectService.getProjectCategoryData(customerId, dateString); + if (!CollectionUtils.isEmpty(projectCategoryData)){ + projectCategoryData.forEach(data->{ + FactOriginProjectCategoryDailyEntity insertEntity = new FactOriginProjectCategoryDailyEntity(); + IssueProjectCategoryDictEntity categoryDictEntity = issueProjectCategoryDictService.getById(customerId, data.getCategoryId()); + if (categoryDictEntity == null){ + log.warn("categoryDict not found : customerId:{},categoryId:{}",customerId,data.getCategoryId()); + } + insertEntity.setProjectId(data.getProjectId()); + insertEntity.setCategoryCode(categoryDictEntity.getCategoryCode()); + insertEntity.setParentCategoryCode(categoryDictEntity.getParentCategoryCode()); + insertEntity.setCustomerId(customerId); + insertEntity.setLevel(Integer.valueOf(categoryDictEntity.getCategoryType())); + insertEntity.setCreatedTime(data.getCreatedTime()); + entities.add(insertEntity); + }); + if (!CollectionUtils.isEmpty(entities)){ + delAndInsert(customerId,dateString,entities); + } + } + } + /** + * @Description category表删除插入 + * @param customerId + * @param dateId + * @param result + * @return void + * @Author liushaowen + * @Date 2021/3/22 17:01 + */ + @Transactional(rollbackFor = Exception.class) + public void delAndInsert(String customerId,String dateId,List result){ + baseDao.deleteOldData(customerId, dateId); + insertBatch(result); + } + + + /** + * @param customerId + * @author yinzuomei + * @description 计算当前客户下,各个网格内,各项目分类下项目数量 + * @Date 2021/3/23 9:56 + **/ + @Override + public List selectListProjectCategoryGridDailyDTO(String customerId) { + List list=baseDao.selectListProjectCategoryGridDailyDTO(customerId); + return list; + } +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenExtractServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenExtractServiceImpl.java index 74e3021a00..e145f3e1bf 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenExtractServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenExtractServiceImpl.java @@ -11,10 +11,7 @@ import com.epmet.dto.indexcal.CalculateCommonFormDTO; import com.epmet.dto.screen.form.ScreenCentralZoneDataFormDTO; import com.epmet.service.evaluationindex.extract.toscreen.*; import com.epmet.service.evaluationindex.indexcal.IndexCalculateService; -import com.epmet.service.evaluationindex.screen.ScreenProjectGridDailyService; -import com.epmet.service.evaluationindex.screen.ScreenProjectOrgDailyService; -import com.epmet.service.evaluationindex.screen.ScreenProjectQuantityGridMonthlyService; -import com.epmet.service.evaluationindex.screen.ScreenProjectQuantityOrgMonthlyService; +import com.epmet.service.evaluationindex.screen.*; import com.epmet.service.stats.DimCustomerService; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; @@ -68,6 +65,8 @@ public class ScreenExtractServiceImpl implements ScreenExtractService { private ScreenProjectOrgDailyService screenProjectOrgDailyService; @Autowired private ScreenProjectSettleService screenProjectSettleService; + @Autowired + private ScreenProjectCategoryGridDailyService projectCategoryGridDailyService; /** * @param extractOriginFormDTO @@ -198,12 +197,18 @@ public class ScreenExtractServiceImpl implements ScreenExtractService { log.error("项目(事件)分析按组织_按天统计失败,customerId为:"+customerId+"dateId为:"+dateId, e); } //项目分类打标签未上线,暂时屏蔽 - /*try{ + try{ //大屏项目数据抽取_按天抽取 screenProjectSettleService.extractScreenData(param); }catch (Exception e){ log.error("大屏项目数据抽取_按天抽取_按天统计失败,customerId为:"+customerId+"dateId为:"+dateId, e); - }*/ + } + //按天统计:网格内各个分类下的项目总数 + try{ + projectCategoryGridDailyService.extractProjectCategoryData(customerId,dateId); + }catch(Exception e){ + log.error("按天统计:网格内各个分类下的项目总数,customerId为:"+customerId+"dateId为:"+dateId, e); + } log.info("===== extractDaily method end ======"); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenCustomerGridService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenCustomerGridService.java index 3d2fc7a15a..ef39e1b781 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenCustomerGridService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenCustomerGridService.java @@ -19,6 +19,7 @@ package com.epmet.service.evaluationindex.screen; import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.dto.ScreenCustomerGridDTO; import com.epmet.dto.extract.form.*; import com.epmet.dto.extract.result.GridInfoResultDTO; import com.epmet.dto.indexcollect.form.CustomerBizOrgFormDTO; @@ -92,4 +93,13 @@ public interface ScreenCustomerGridService extends BaseService selectBelongGridInfo(String customerId,String level); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenProjectCategoryGridDailyService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenProjectCategoryGridDailyService.java index da711d85e3..4fcb249db1 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenProjectCategoryGridDailyService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenProjectCategoryGridDailyService.java @@ -102,4 +102,14 @@ public interface ScreenProjectCategoryGridDailyService extends BaseService param); + + /** + * @return void + * @param customerId + * @param dateId + * @author yinzuomei + * @description 产品内部计算:网格内按分类统计项目数量 + * @Date 2021/3/22 16:46 + **/ + void extractProjectCategoryData(String customerId, String dateId); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenProjectCategoryOrgDailyService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenProjectCategoryOrgDailyService.java index ce71722794..150c15a0d4 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenProjectCategoryOrgDailyService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenProjectCategoryOrgDailyService.java @@ -102,4 +102,13 @@ public interface ScreenProjectCategoryOrgDailyService extends BaseService param); + + /** + * @Description 按组织计算分类统计项目数量 + * @Param customerId + * @Param dateId + * @author zxc + * @date 2021/3/23 上午10:07 + */ + void extractProjectCategoryOrgData(String customerId, String dateId); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenCustomerGridServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenCustomerGridServiceImpl.java index 6655be0a08..67dae90b1c 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenCustomerGridServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenCustomerGridServiceImpl.java @@ -24,6 +24,7 @@ import com.epmet.commons.tools.utils.DateUtils; import com.epmet.constant.DataSourceConstant; import com.epmet.constant.OrgSourceTypeConstant; import com.epmet.dao.evaluationindex.screen.ScreenCustomerGridDao; +import com.epmet.dto.ScreenCustomerGridDTO; import com.epmet.dto.extract.form.*; import com.epmet.dto.extract.result.GridInfoResultDTO; import com.epmet.dto.indexcollect.form.CustomerBizOrgFormDTO; @@ -166,4 +167,16 @@ public class ScreenCustomerGridServiceImpl extends BaseServiceImpl selectBelongGridInfo(String customerId, String level) { + return baseDao.selectBelongGridInfo(customerId, level); + } } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectCategoryGridDailyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectCategoryGridDailyServiceImpl.java index acc891ac1a..3a8752e20e 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectCategoryGridDailyServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectCategoryGridDailyServiceImpl.java @@ -30,8 +30,11 @@ import com.epmet.dao.evaluationindex.screen.ScreenProjectCategoryGridDailyDao; import com.epmet.dto.screen.ScreenProjectCategoryGridDailyDTO; import com.epmet.dto.screencoll.ScreenCollFormDTO; import com.epmet.entity.evaluationindex.screen.ScreenProjectCategoryGridDailyEntity; +import com.epmet.service.evaluationindex.extract.todata.FactOriginProjectCategoryDailyService; import com.epmet.service.evaluationindex.screen.ScreenProjectCategoryGridDailyService; +import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.util.CollectionUtils; @@ -46,10 +49,12 @@ import java.util.Map; * @author generator generator@elink-cn.com * @since v1.0.0 2021-02-23 */ +@Slf4j @Service @DataSource(DataSourceConstant.EVALUATION_INDEX) public class ScreenProjectCategoryGridDailyServiceImpl extends BaseServiceImpl implements ScreenProjectCategoryGridDailyService { - + @Autowired + private FactOriginProjectCategoryDailyService factOriginProjectCategoryDailyService; @Override public PageData page(Map params) { @@ -128,4 +133,22 @@ public class ScreenProjectCategoryGridDailyServiceImpl extends BaseServiceImpl listDTO= factOriginProjectCategoryDailyService.selectListProjectCategoryGridDailyDTO(customerId); + listDTO.forEach(dto->{ + dto.setDateId(dateId); + }); + boolean insertRes=insertBatch(ConvertUtils.sourceToTarget(listDTO, ScreenProjectCategoryGridDailyEntity.class)); + log.info("insertRes is {}",insertRes); + } + } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectCategoryOrgDailyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectCategoryOrgDailyServiceImpl.java index 5660fad150..8dbbe72d73 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectCategoryOrgDailyServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectCategoryOrgDailyServiceImpl.java @@ -26,20 +26,34 @@ import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.constant.DataSourceConstant; +import com.epmet.constant.ScreenConstant; +import com.epmet.dao.evaluationindex.screen.ScreenProjectCategoryGridDailyDao; import com.epmet.dao.evaluationindex.screen.ScreenProjectCategoryOrgDailyDao; +import com.epmet.dto.ScreenCustomerGridDTO; +import com.epmet.dto.extract.result.CustomerAgencyInfoResultDTO; import com.epmet.dto.screen.ScreenProjectCategoryOrgDailyDTO; +import com.epmet.dto.screen.result.CategoryProjectResultDTO; import com.epmet.dto.screencoll.ScreenCollFormDTO; +import com.epmet.entity.crm.CustomerRelationEntity; import com.epmet.entity.evaluationindex.screen.ScreenProjectCategoryOrgDailyEntity; +import com.epmet.service.crm.CustomerRelationService; +import com.epmet.service.evaluationindex.screen.ScreenCustomerAgencyService; +import com.epmet.service.evaluationindex.screen.ScreenCustomerGridService; import com.epmet.service.evaluationindex.screen.ScreenProjectCategoryOrgDailyService; import com.google.common.collect.Lists; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections4.ListUtils; import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.util.CollectionUtils; +import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Map; +import java.util.stream.Collectors; /** * 项目(事件)分类按组织_按天统计 @@ -49,8 +63,17 @@ import java.util.Map; */ @Service @DataSource(DataSourceConstant.EVALUATION_INDEX) +@Slf4j public class ScreenProjectCategoryOrgDailyServiceImpl extends BaseServiceImpl implements ScreenProjectCategoryOrgDailyService { + @Autowired + private CustomerRelationService relationService; + @Autowired + private ScreenCustomerAgencyService agencyService; + @Autowired + private ScreenProjectCategoryGridDailyDao gridDailyDao; + @Autowired + private ScreenCustomerGridService gridService; @Override public PageData page(Map params) { @@ -131,4 +154,238 @@ public class ScreenProjectCategoryOrgDailyServiceImpl extends BaseServiceImpl relationInfo = relationService.selectSubCustomer(customerId); + if (CollectionUtils.isEmpty(relationInfo)){ + // 单客户 + disposeOneCustomer(customerId, dateId); + }else { + // 多客户 + /** + * 1.查自己客户分类标签统计 + * 2.查询子级客户分类标签【分为 epmet_category_code is null 和 is not null】,pid = '0',跟父客户对比,同类标签项目数累加,不同直接添加到父客户 + * 注:加入直属网格 + */ + disposeMoreCustomer(customerId,dateId,relationInfo); + } + } + + /** + * @Description 单客户处理 + * @Param customerId + * @Param dateId + * @author zxc + * @date 2021/3/23 上午10:40 + */ + private void disposeOneCustomer(String customerId, String dateId){ + List agencyIdList = agencyService.selectAllAgencyId(customerId); + if (!CollectionUtils.isEmpty(agencyIdList)){ + // 根据组织级别分组 + Map> groupByLevel = agencyIdList.stream().collect(Collectors.groupingBy(CustomerAgencyInfoResultDTO::getLevel)); + if (groupByLevel.containsKey(ScreenConstant.COMMUNITY)){ + // 社区级别 + disposeOneCustomerSub(ScreenConstant.COMMUNITY,true,customerId,dateId); + } + if (groupByLevel.containsKey(ScreenConstant.STREET)){ + // 街道级别 + disposeOneCustomerSub(ScreenConstant.STREET,false,customerId,dateId); + } + if (groupByLevel.containsKey(ScreenConstant.DISTRICT)){ + // 区级 + disposeOneCustomerSub(ScreenConstant.DISTRICT,false,customerId,dateId); + } + if (groupByLevel.containsKey(ScreenConstant.CITY)){ + // 市级 + disposeOneCustomerSub(ScreenConstant.CITY,false,customerId,dateId); + } + if (groupByLevel.containsKey(ScreenConstant.PROVINCE)){ + // 省级 + disposeOneCustomerSub(ScreenConstant.PROVINCE,false,customerId,dateId); + } + } + } + + /** + * @Description 单客户处理 + * @Param level + * @Param isGrid + * @Param customerId + * @Param dateId + * @author zxc + * @date 2021/3/25 上午10:44 + */ + public void disposeOneCustomerSub(String level, Boolean isGrid, String customerId, String dateId){ + List result = new ArrayList<>(); + if (isGrid){ + // 是社区级别 + List categoryInfos = gridDailyDao.selectCategoryInfo(customerId, dateId,null,null); + if (!CollectionUtils.isEmpty(categoryInfos)){ + result = ConvertUtils.sourceToTarget(categoryInfos, ScreenProjectCategoryOrgDailyEntity.class); + } + }else { + List categoryProjectResultDTOS = baseDao.selectOrgCategoryInfo(customerId, dateId, level); + List belongGridInfos = gridService.selectBelongGridInfo(customerId, level); + if (!CollectionUtils.isEmpty(belongGridInfos)){ + // 存在直属网格 + List gridIds = belongGridInfos.stream().map(m -> m.getGridId()).collect(Collectors.toList()); + List categoryProjectGrid = gridDailyDao.selectCategoryInfo(customerId, dateId, level, gridIds); + if (!CollectionUtils.isEmpty(categoryProjectGrid)){ + categoryProjectResultDTOS.forEach(agency -> { + categoryProjectGrid.forEach(grid -> { + if (agency.getOrgId().equals(grid.getOrgId()) && agency.getCategoryCode().equals(grid.getCategoryCode())){ + agency.setProjectTotal(agency.getProjectTotal() + grid.getProjectTotal()); + grid.setStatus(true); + } + }); + }); + Map> groupByStatus = categoryProjectGrid.stream().collect(Collectors.groupingBy(CategoryProjectResultDTO::getStatus)); + List categoryProjectResultDTOS1 = groupByStatus.get(false); + if (!CollectionUtils.isEmpty(categoryProjectResultDTOS1)) categoryProjectResultDTOS.addAll(categoryProjectResultDTOS1); + } + } + result = ConvertUtils.sourceToTarget(categoryProjectResultDTOS,ScreenProjectCategoryOrgDailyEntity.class); + } + deleteAndInsert(customerId,dateId,result); + } + + /** + * @Description 多客户处理 + * @Param customerId + * @Param dateId + * @Param relationInfo 子级客户信息 + * @author zxc + * @date 2021/3/23 上午10:40 + */ + private void disposeMoreCustomer(String customerId, String dateId,List relationInfo){ + List agencyIdList = agencyService.selectAllAgencyId(customerId); + if (!CollectionUtils.isEmpty(agencyIdList)){ + // 根据组织级别分组 + Map> groupByLevel = agencyIdList.stream().collect(Collectors.groupingBy(CustomerAgencyInfoResultDTO::getLevel)); + if (groupByLevel.containsKey(ScreenConstant.COMMUNITY)){ + // 社区级别 + disposeMoreCustomerSub(ScreenConstant.COMMUNITY,true,customerId,dateId,relationInfo); + } + if (groupByLevel.containsKey(ScreenConstant.STREET)){ + // 街道级别 + disposeMoreCustomerSub(ScreenConstant.STREET,false,customerId,dateId,relationInfo); + } + if (groupByLevel.containsKey(ScreenConstant.DISTRICT)){ + // 区级 + disposeMoreCustomerSub(ScreenConstant.DISTRICT,false,customerId,dateId,relationInfo); + } + if (groupByLevel.containsKey(ScreenConstant.CITY)){ + // 市级 + disposeMoreCustomerSub(ScreenConstant.CITY,false,customerId,dateId,relationInfo); + } + if (groupByLevel.containsKey(ScreenConstant.PROVINCE)){ + // 省级 + disposeMoreCustomerSub(ScreenConstant.PROVINCE,false,customerId,dateId,relationInfo); + } + } + } + + /** + * @Description 多客户处理 + * @Param level 级别 + * @Param isGrid + * @Param customerId + * @Param dateId + * @Param relationInfo 子级客户信息 + * @author zxc + * @date 2021/3/25 下午1:29 + */ + private void disposeMoreCustomerSub(String level,Boolean isGrid,String customerId, String dateId, List relationInfo){ + List result = new ArrayList<>(); + if (isGrid){ + // community级别走这 + List categoryInfos = gridDailyDao.selectCategoryInfo(customerId, dateId,null,null); + if (!CollectionUtils.isEmpty(categoryInfos)){ + result = ConvertUtils.sourceToTarget(categoryInfos, ScreenProjectCategoryOrgDailyEntity.class); + } + }else { + List categoryProjectResultDTOS = baseDao.selectOrgCategoryInfo(customerId, dateId, level); + List belongGridInfos = gridService.selectBelongGridInfo(customerId, level); + if (!CollectionUtils.isEmpty(belongGridInfos)){ + // 存在直属网格 + List gridIds = belongGridInfos.stream().map(m -> m.getGridId()).collect(Collectors.toList()); + List categoryProjectGrid = gridDailyDao.selectCategoryInfo(customerId, dateId, level, gridIds); + if (!CollectionUtils.isEmpty(categoryProjectGrid)){ + categoryProjectResultDTOS.forEach(agency -> { + categoryProjectGrid.forEach(grid -> { + if (agency.getOrgId().equals(grid.getOrgId()) && agency.getCategoryCode().equals(grid.getCategoryCode())){ + agency.setProjectTotal(agency.getProjectTotal() + grid.getProjectTotal()); + grid.setStatus(true); + } + }); + }); + Map> groupByStatus = categoryProjectGrid.stream().collect(Collectors.groupingBy(CategoryProjectResultDTO::getStatus)); + List categoryProjectResultDTOS1 = groupByStatus.get(false); + categoryProjectResultDTOS.addAll(categoryProjectResultDTOS1); + } + } + result = ConvertUtils.sourceToTarget(categoryProjectResultDTOS,ScreenProjectCategoryOrgDailyEntity.class); + if (ScreenConstant.DISTRICT.equals(level)){ + // 子级客户ID + List customerIds = relationInfo.stream().map(m -> m.getCustomerId()).collect(Collectors.toList()); + // 父客户存在的分类 + List categoryProjectExists = baseDao.selectOrgCategoryMoreCustomerInfo(customerIds, dateId, level, customerId, true); + if (!CollectionUtils.isEmpty(categoryProjectExists)){ + result.forEach(r -> { + categoryProjectExists.forEach(c -> { + if (r.getCategoryCode().equals(c.getCategoryCode())){ + r.setProjectTotal(r.getProjectTotal() + c.getProjectTotal()); + c.setStatus(true); + } + }); + }); + Map> groupByStatus = categoryProjectExists.stream().collect(Collectors.groupingBy(CategoryProjectResultDTO::getStatus)); + List categoryProjectFalse = groupByStatus.get(false); + if (!CollectionUtils.isEmpty(categoryProjectFalse)){ + List f = ConvertUtils.sourceToTarget(categoryProjectFalse, ScreenProjectCategoryOrgDailyEntity.class); + result.addAll(f); + } + } + // 父客户不存在的分类 + List categoryProjectNotExists = baseDao.selectOrgCategoryMoreCustomerInfo(customerIds, dateId, level, customerId, false); + if (!CollectionUtils.isEmpty(categoryProjectNotExists)){ + List notExists = ConvertUtils.sourceToTarget(categoryProjectNotExists, ScreenProjectCategoryOrgDailyEntity.class); + result.addAll(notExists); + } + } + } + deleteAndInsert(customerId,dateId,result); + } + + /** + * @Description 删除和新增 + * @Param customerId + * @Param dateId + * @author zxc + * @date 2021/3/23 上午10:52 + */ + @Transactional(rollbackFor = Exception.class) + public void deleteAndInsert(String customerId, String dateId, List needInsert){ + if (CollectionUtils.isEmpty(needInsert)){ + return; + } + Integer row = NumConstant.ZERO; + do { + row = baseDao.deleteByDateIdAndCustomerId(customerId, dateId); + }while (row > NumConstant.ZERO && row == NumConstant.ONE_THOUSAND); + List> partition = ListUtils.partition(needInsert, NumConstant.ONE_HUNDRED); + partition.forEach(p -> { + insertBatch(p); + }); + } + } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsDimServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsDimServiceImpl.java index 6338145260..09db5e717d 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsDimServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsDimServiceImpl.java @@ -3,10 +3,12 @@ package com.epmet.service.impl; import com.epmet.constant.RobotConstant; import com.epmet.dto.org.result.CustomerAreaCodeResultDTO; import com.epmet.entity.crm.CustomerEntity; +import com.epmet.entity.issue.IssueProjectCategoryDictEntity; import com.epmet.entity.org.CustomerAgencyEntity; import com.epmet.entity.org.CustomerDepartmentEntity; import com.epmet.entity.org.CustomerGridEntity; import com.epmet.entity.stats.*; +import com.epmet.service.Issue.IssueProjectCategoryDictService; import com.epmet.service.StatsDimService; import com.epmet.service.crm.CustomerService; import com.epmet.service.org.CustomerAgencyService; @@ -52,6 +54,12 @@ public class StatsDimServiceImpl implements StatsDimService { @Autowired private DimDepartmentService dimDepartmentService; + @Autowired + private CustomerProjectCategoryDictService projectCategoryDictService; + + @Autowired + private IssueProjectCategoryDictService issueProjectCategoryDictService; + @Override public void initGridDim() { List newDimGrids = getNewDimGrids(); @@ -264,4 +272,47 @@ public class StatsDimServiceImpl implements StatsDimService { } return new ArrayList<>(); } + + /** + * @return void + * @author yinzuomei + * @description 初始化项目分类字典表 + * @Date 2021/3/19 15:44 + **/ + @Override + public void customerInitProjectCategory() { + Date now = new Date(); + List insertCategoies = listInsertCategoies(); + List updateCategoies = listUpdateCategoies(now); + projectCategoryDictService.initProjectCategory(insertCategoies,updateCategoies); + } + + /** + * @author yinzuomei + * @description 构造需要插入的分类字典 + * @Date 2021/3/19 15:52 + **/ + private List listInsertCategoies() { + CustomerProjectCategoryDictEntity lastInsertProjectCategory = projectCategoryDictService.getLatestProjectCategory(); + Date now = new Date(); + Date lastInitTime = null; + if (null != lastInsertProjectCategory) { + lastInitTime = lastInsertProjectCategory.getOriginCreatedTime(); + } + return issueProjectCategoryDictService.listInsertCategoies(lastInitTime, now); + } + + /** + * @param initTime + * @author yinzuomei + * @description + * @Date 2021/3/19 15:55 + **/ + private List listUpdateCategoies(Date initTime) { + CustomerProjectCategoryDictEntity lastUpdated = projectCategoryDictService.getLatestUpdatedEntity(); + if (lastUpdated != null) { + return issueProjectCategoryDictService.listByUpdatedTime(lastUpdated.getOriginUpdatedTime(), initTime); + } + return new ArrayList<>(); + } } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/project/ProjectService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/project/ProjectService.java index 6f283b852a..56a99d5257 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/project/ProjectService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/project/ProjectService.java @@ -18,6 +18,7 @@ package com.epmet.service.project; import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.dto.ProjectCategoryDTO; import com.epmet.dto.ProjectDTO; import com.epmet.dto.project.ProjectAgencyDTO; import com.epmet.dto.project.ProjectGridDTO; @@ -141,4 +142,14 @@ public interface ProjectService extends BaseService { */ Map> getProjectCategory(List projectIds); -} \ No newline at end of file + /** + * @Description 抽取project_category + * @param customerId + * @param dateId + * @return java.util.List + * @Author liushaowen + * @Date 2021/3/22 15:44 + */ + List getProjectCategoryData(String customerId, String dateId); + +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/project/impl/ProjectServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/project/impl/ProjectServiceImpl.java index 294d0e4f31..d2a3ff001d 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/project/impl/ProjectServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/project/impl/ProjectServiceImpl.java @@ -150,6 +150,18 @@ public class ProjectServiceImpl extends BaseServiceImpl + * @Description 抽取project_category + * @Author liushaowen + * @Date 2021/3/22 15:44 + */ + @Override + public List getProjectCategoryData(String customerId, String dateId) { + return baseDao.getProjectCategoryData(customerId,dateId); + } -} \ No newline at end of file +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/CustomerProjectCategoryDictService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/CustomerProjectCategoryDictService.java new file mode 100644 index 0000000000..ef8440c594 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/CustomerProjectCategoryDictService.java @@ -0,0 +1,58 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service.stats; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.dto.screen.form.CategoryDictFormDTO; +import com.epmet.dto.screencoll.ScreenCollFormDTO; +import com.epmet.entity.issue.IssueProjectCategoryDictEntity; +import com.epmet.entity.stats.CustomerProjectCategoryDictEntity; + +import java.util.List; + +/** + * 客户项目分类字典表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-03-19 + */ +public interface CustomerProjectCategoryDictService extends BaseService { + + void initProjectCategory(List insertCategoies, + List updateCategoies); + + /** + * @author yinzuomei + * @description 获取内部客户最近一次初始记录 + * @Date 2021/3/19 14:57 + **/ + CustomerProjectCategoryDictEntity getLatestProjectCategory(); + + CustomerProjectCategoryDictEntity getLatestUpdatedEntity(); + + /** + * 项目分类字典上报 + * 目标表:epmet_evaluation_index库的customer_project_category_dict + * + * @param formDTO + * @return void + * @Author zhangyong + * @Date 16:03 2021-03-22 + **/ + void uploadCategoryDict(ScreenCollFormDTO formDTO); +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/CustomerProjectCategoryDictServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/CustomerProjectCategoryDictServiceImpl.java new file mode 100644 index 0000000000..97a8a560f5 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/CustomerProjectCategoryDictServiceImpl.java @@ -0,0 +1,119 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service.stats.impl; + +import com.epmet.commons.dynamic.datasource.annotation.DataSource; +import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.constant.DataSourceConstant; +import com.epmet.dao.stats.CustomerProjectCategoryDictDao; +import com.epmet.dto.screen.form.CategoryDictFormDTO; +import com.epmet.dto.screencoll.ScreenCollFormDTO; +import com.epmet.entity.issue.IssueProjectCategoryDictEntity; +import com.epmet.entity.stats.CustomerProjectCategoryDictEntity; +import com.epmet.service.stats.CustomerProjectCategoryDictService; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.List; + +/** + * 客户项目分类字典表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-03-19 + */ +@Slf4j +@DataSource(DataSourceConstant.EVALUATION_INDEX) +@Service +public class CustomerProjectCategoryDictServiceImpl extends BaseServiceImpl implements CustomerProjectCategoryDictService { + + @DataSource(value = DataSourceConstant.EVALUATION_INDEX) + @Transactional(rollbackFor = Exception.class) + @Override + public void initProjectCategory(List insertCategoies, List updateCategoies) { + log.info(String.format("=============需要插入的条数=%s,更新的条数=%s",insertCategoies.size(),updateCategoies.size())); + insertCategoies.forEach(insertEntity -> { + CustomerProjectCategoryDictEntity entityInsert=new CustomerProjectCategoryDictEntity(); + entityInsert.setCustomerId(insertEntity.getCustomerId()); + entityInsert.setCustomerType("internal"); + entityInsert.setCategoryCode(insertEntity.getCategoryCode()); + entityInsert.setCategoryName(insertEntity.getCategoryName()); + entityInsert.setParentCategoryCode(insertEntity.getParentCategoryCode()); + entityInsert.setLevel(Integer.valueOf(insertEntity.getCategoryType())); + entityInsert.setSort(insertEntity.getSort()); + entityInsert.setIsDisable(insertEntity.getIsDisable()); + entityInsert.setOriginCreatedTime(insertEntity.getCreatedTime()); + entityInsert.setOriginUpdatedTime(insertEntity.getUpdatedTime()); + entityInsert.setCategoryId(insertEntity.getId()); + baseDao.insert(entityInsert); + }); + updateCategoies.forEach(updatedEntity -> { + CustomerProjectCategoryDictEntity entity=baseDao.selectByCustomerIdAndId(updatedEntity.getCustomerId(),updatedEntity.getId()); + if (null != entity) { + entity.setCategoryCode(updatedEntity.getCategoryCode()); + entity.setCategoryName(updatedEntity.getCategoryName()); + entity.setParentCategoryCode(updatedEntity.getParentCategoryCode()); + if (StringUtils.isNotBlank(updatedEntity.getCategoryType())) { + entity.setLevel(Integer.valueOf(updatedEntity.getCategoryType())); + } + entity.setSort(updatedEntity.getSort()); + entity.setIsDisable(updatedEntity.getIsDisable()); + entity.setOriginCreatedTime(updatedEntity.getCreatedTime()); + entity.setOriginUpdatedTime(updatedEntity.getUpdatedTime()); + baseDao.updateById(entity); + } + }); + } + + /** + * @author yinzuomei + * @description 获取内部客户最近一次初始记录 + * @Date 2021/3/19 14:57 + **/ + @DataSource(value = DataSourceConstant.EVALUATION_INDEX) + @Override + public CustomerProjectCategoryDictEntity getLatestProjectCategory() { + return baseDao.getLatestProjectCategory(); + } + + @DataSource(value = DataSourceConstant.EVALUATION_INDEX) + @Override + public CustomerProjectCategoryDictEntity getLatestUpdatedEntity() { + return baseDao.getLatestUpdatedEntity(); + } + + + @DataSource(value = DataSourceConstant.EVALUATION_INDEX,datasourceNameFromArg = true) + @Override + @Transactional(rollbackFor = Exception.class) + public void uploadCategoryDict(ScreenCollFormDTO formDTO) { + if (formDTO.getIsFirst()) { + int deleteNum; + do { + deleteNum = baseDao.deleteCustomerProjectCategoryDict(formDTO.getCustomerId()); + } while (deleteNum > NumConstant.ZERO); + } + if (!CollectionUtils.isEmpty(formDTO.getDataList())) { + baseDao.batchInsertCustomerProjectCategoryDict(formDTO.getDataList(), formDTO.getCustomerId()); + } + } +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/db/migration/V0.0.10__add_project_category_analysis.sql b/epmet-module/data-statistical/data-statistical-server/src/main/resources/db/migration/V0.0.10__add_project_category_analysis.sql new file mode 100644 index 0000000000..391bb2af03 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/db/migration/V0.0.10__add_project_category_analysis.sql @@ -0,0 +1,47 @@ +-- epmet_data_statistical 库: +drop table if exists fact_origin_project_category_daily; +CREATE TABLE `fact_origin_project_category_daily` ( + `ID` varchar(64) NOT NULL COMMENT '主键', + `CUSTOMER_ID` varchar(64) NOT NULL COMMENT '客户id', + `PROJECT_ID` varchar(64) NOT NULL COMMENT '项目id', + `CATEGORY_CODE` varchar(50) NOT NULL COMMENT '分类编码', + `PARENT_CATEGORY_CODE` varchar(50) NOT NULL COMMENT '所属父类分类编码', + `LEVEL` int(11) NOT NULL COMMENT '分类等级:1、2....;产品目前只有2级分类', + `DEL_FLAG` char(1) NOT NULL DEFAULT '0' COMMENT '删除标识 0未删除;1已删除', + `REVISION` int(11) NOT NULL COMMENT '乐观锁', + `CREATED_BY` varchar(64) NOT NULL COMMENT '创建人', + `CREATED_TIME` datetime NOT NULL COMMENT '创建时间', + `UPDATED_BY` varchar(64) NOT NULL COMMENT '更新人', + `UPDATED_TIME` datetime NOT NULL COMMENT '更新时间', + PRIMARY KEY (`ID`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='项目所属分类表'; + +-- epmet_data_statistical_display 、epmet_evaluation_index: +drop table if exists customer_project_category_dict; +CREATE TABLE `customer_project_category_dict` ( + `ID` varchar(64) NOT NULL COMMENT '主键', + `CUSTOMER_ID` varchar(64) NOT NULL COMMENT '客户id', + `CUSTOMER_TYPE` varchar(20) NOT NULL COMMENT '外部客户:external;内部客户:internal', + `CATEGORY_CODE` varchar(64) NOT NULL COMMENT '客户自己的分类编码', + `CATEGORY_NAME` varchar(500) CHARACTER SET utf8 NOT NULL COMMENT '客户自己的分类名称', + `PARENT_CATEGORY_CODE` varchar(64) NOT NULL COMMENT '父类分类编码,如果是一级分类,此列赋值为0', + `LEVEL` int(11) NOT NULL COMMENT '分类等级:1、2....;产品只有2级分类', + `SORT` int(11) unsigned NOT NULL COMMENT '排序', + `IS_DISABLE` varchar(32) CHARACTER SET utf8 NOT NULL COMMENT '是否禁用(enable:启用 disable:禁用)', + `EPMET_CATEGORY_CODE` varchar(64) DEFAULT NULL COMMENT '对应e世通中的分类编码,没有此列为空', + `ORIGIN_CREATED_TIME` datetime DEFAULT NULL COMMENT '原始创建时间', + `ORIGIN_UPDATED_TIME` datetime DEFAULT NULL COMMENT '原始更新时间', + `CATEGORY_ID` varchar(64) NOT NULL COMMENT '分类字典表主键', + `DEL_FLAG` char(1) NOT NULL DEFAULT '0' COMMENT '删除标识 0未删除;1已删除', + `REVISION` int(11) NOT NULL COMMENT '乐观锁', + `CREATED_BY` varchar(64) NOT NULL COMMENT '创建人', + `CREATED_TIME` datetime NOT NULL COMMENT '创建时间', + `UPDATED_BY` varchar(64) NOT NULL COMMENT '更新人', + `UPDATED_TIME` datetime NOT NULL COMMENT '更新时间', + PRIMARY KEY (`ID`) USING BTREE, + UNIQUE KEY `UN_KEY` (`CUSTOMER_ID`,`CATEGORY_CODE`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC COMMENT='客户项目分类字典表'; +-- epmet_data_statistical_display 、epmet_evaluation_index: + +alter table screen_project_category_org_daily add column `LEVEL` int(11) NOT NULL COMMENT '分类等级1、2....'; +alter table screen_project_category_grid_daily add column `LEVEL` int(11) NOT NULL COMMENT '分类等级1、2....'; diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/crm/CustomerRelationDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/crm/CustomerRelationDao.xml index 88c12c8deb..fad1ca0443 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/crm/CustomerRelationDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/crm/CustomerRelationDao.xml @@ -34,4 +34,9 @@ #{customerId}, '%') + + + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectCategoryDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectCategoryDailyDao.xml new file mode 100644 index 0000000000..7836274c05 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectCategoryDailyDao.xml @@ -0,0 +1,65 @@ + + + + + + + DELETE + FROM + fact_origin_project_category_daily + WHERE + CUSTOMER_ID = #{customerId} + + AND DATE_FORMAT(CREATED_TIME,'%Y%m%d') = #{dateId} + + + + + + + diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerGridDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerGridDao.xml index c6ad68ca8b..e5d0c1a183 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerGridDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerGridDao.xml @@ -359,4 +359,17 @@ AND cg.CUSTOMER_ID = #{customerId} + + + diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenProjectCategoryGridDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenProjectCategoryGridDailyDao.xml index bc84c6b2df..4bf7ba8edf 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenProjectCategoryGridDailyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenProjectCategoryGridDailyDao.xml @@ -3,29 +3,6 @@ - - - - - - - - - - - - - - - - - - - - - - - delete from screen_project_category_grid_daily where customer_id = #{customerId} @@ -33,5 +10,35 @@ limit 1000 + + + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenProjectCategoryOrgDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenProjectCategoryOrgDailyDao.xml index 5d8cd9a73a..98b4eb7248 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenProjectCategoryOrgDailyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenProjectCategoryOrgDailyDao.xml @@ -2,31 +2,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - delete from screen_project_category_org_daily where customer_id = #{customerId} @@ -34,4 +9,57 @@ limit 1000 + + + + + + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/issue/IssueProjectCategoryDictDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/issue/IssueProjectCategoryDictDao.xml new file mode 100644 index 0000000000..50185c99cb --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/issue/IssueProjectCategoryDictDao.xml @@ -0,0 +1,51 @@ + + + + + + + + + + + + + diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/issue/StatsIssueDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/issue/StatsIssueDao.xml index b4619ff0a2..ce72f989f2 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/issue/StatsIssueDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/issue/StatsIssueDao.xml @@ -290,35 +290,15 @@ \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/project/ProjectDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/project/ProjectDao.xml index 2a8699d341..ec1cf07215 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/project/ProjectDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/project/ProjectDao.xml @@ -105,7 +105,7 @@ and CUSTOMER_ID = #{customerId} and PARAMETER_KEY ='detention_days' - + - \ No newline at end of file + + + diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/CustomerProjectCategoryDictDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/CustomerProjectCategoryDictDao.xml new file mode 100644 index 0000000000..2802dc7625 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/CustomerProjectCategoryDictDao.xml @@ -0,0 +1,95 @@ + + + + + + + + + + + + delete from customer_project_category_dict + where CUSTOMER_ID = #{customerId} + limit 1000; + + + + insert into customer_project_category_dict + ( + ID, + CUSTOMER_ID, + CUSTOMER_TYPE, + CATEGORY_CODE, + CATEGORY_NAME, + PARENT_CATEGORY_CODE, + `LEVEL`, + SORT, + IS_DISABLE, + EPMET_CATEGORY_CODE, + ORIGIN_CREATED_TIME, + ORIGIN_UPDATED_TIME, + CATEGORY_ID, + DEL_FLAG, + REVISION, + CREATED_BY, + CREATED_TIME, + UPDATED_BY, + UPDATED_TIME + ) values + + ( + (SELECT REPLACE(UUID(), '-', '') AS id), + #{customerId}, + 'external', + #{item.categoryCode}, + #{item.categoryName}, + #{item.parentCategoryCode}, + #{item.level}, + #{item.sort}, + 'enable', + #{item.epmetCategoryCode}, + #{item.originCreatedTime}, + #{item.orginUpdatedTime}, + #{item.categoryId}, + 0, + 0, + 'APP_USER', + now(), + 'APP_USER', + now() + ) + + + diff --git a/epmet-module/data-statistical/data-statistical-server/src/test/java/resources/数据对接.txt b/epmet-module/data-statistical/data-statistical-server/src/test/java/resources/数据对接.txt new file mode 100644 index 0000000000..7d03dd36f8 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/test/java/resources/数据对接.txt @@ -0,0 +1,12 @@ +截止到2021-03-25数据对接外部客户: +1、市北党建 +2、安宁e家 +3、大美孔村街道 +4、e锦水街道(没有自己的大屏) +5、微笑榆山街道(没有自己的大屏) +产品自己的客户上线的大屏: +1、城阳 +2、临沂龙湾社区 +3、平阴县 +孔村、锦水、榆山这三个街道的数据上报时间要早于平阴县计算的时间,目前已经按天上报和按月上报的,让孔村、榆山、锦水调整到2点前推送了。 + diff --git a/epmet-module/gov-issue/gov-issue-client/pom.xml b/epmet-module/gov-issue/gov-issue-client/pom.xml index f77ec89656..9d07717da1 100644 --- a/epmet-module/gov-issue/gov-issue-client/pom.xml +++ b/epmet-module/gov-issue/gov-issue-client/pom.xml @@ -29,5 +29,11 @@ 2.0.0 compile + + com.epmet + data-report-client + 2.0.0 + compile + - \ No newline at end of file + diff --git a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/IssueCategoryDTO.java b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/IssueCategoryDTO.java new file mode 100644 index 0000000000..fd33177b01 --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/IssueCategoryDTO.java @@ -0,0 +1,101 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + + +/** + * 议题所属分类表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-12-08 + */ +@Data +public class IssueCategoryDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + private String id; + + /** + * 客户id + */ + private String customerId; + + /** + * 网格ID: 议题所属网格Id + */ + private String gridId; + + /** + * 议题id + */ + private String issueId; + + /** + * 分类id + */ + private String categoryId; + + /** + * 分类对应的所有上级,英文逗号隔开 + */ + private String categoryPids; + + /** + * 分类编码,分类编码+customer_id唯一 + */ + private String categoryCode; + + /** + * 删除标识 0未删除、1已删除 + */ + private String delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} \ No newline at end of file diff --git a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/IssueProjectCategoryDictDTO.java b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/IssueProjectCategoryDictDTO.java new file mode 100644 index 0000000000..a93a616cbf --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/IssueProjectCategoryDictDTO.java @@ -0,0 +1,116 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + + +/** + * 议题项目分类字典 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-12-08 + */ +@Data +public class IssueProjectCategoryDictDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + private String id; + + /** + * 客户id, 产品默认default + */ + private String customerId; + + /** + * 上级分类ID 顶级此列存储0 + */ + private String pid; + + /** + * 所有上级分类ID,用逗号分开 + */ + private String pids; + + /** + * 上级分类编码 + */ + private String parentCategoryCode; + + /** + * 分类编码,分类编码+customer_id唯一 + */ + private String categoryCode; + + /** + * 分类名称 + */ + private String categoryName; + + /** + * 分类类别1,2,3,4.... + */ + private String categoryType; + + /** + * 排序 + */ + private Integer sort; + + /** + * 是否禁用(enable:启用 disable:禁用) + */ + private String isDisable; + + /** + * 删除标识 0未删除、1已删除 + */ + private String delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} \ No newline at end of file diff --git a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/IssueProjectTagDictDTO.java b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/IssueProjectTagDictDTO.java new file mode 100644 index 0000000000..b07cf0042e --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/IssueProjectTagDictDTO.java @@ -0,0 +1,106 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + + +/** + * 议题、项目标签字典表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-12-08 + */ +@Data +public class IssueProjectTagDictDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键ID + */ + private String id; + + /** + * 客户ID + */ + private String customerId; + + /** + * 标签名称 + */ + private String tagName; + + /** + * 分类id, 用户自己添加的标签此列可为空 + */ + private String categoryId; + + /** + * 是否是默认标签(0:是 1:否) + */ + private String isDefault; + + /** + * 议题对标签的引用次数 + */ + private Integer issueUseCount; + + /** + * 项目对标签的引用次数 + */ + private Integer projectUseCount; + + /** + * 是否禁用(enable:启用 disable:禁用) + */ + private String isDisable; + + /** + * 删除标识 0.未删除 1.已删除 + */ + private Integer delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} \ No newline at end of file diff --git a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/IssueTagsDTO.java b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/IssueTagsDTO.java new file mode 100644 index 0000000000..6ca1c51c6a --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/IssueTagsDTO.java @@ -0,0 +1,96 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + + +/** + * 议题关联标签表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-12-08 + */ +@Data +public class IssueTagsDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键ID + */ + private String id; + + /** + * 客户ID + */ + private String customerId; + + /** + * 议题所属网格id + */ + private String gridId; + + /** + * 议题ID + */ + private String issueId; + + /** + * 标签ID + */ + private String tagId; + + /** + * 标签名称 + */ + private String tagName; + + /** + * 删除标识 0.未删除 1.已删除 + */ + private Integer delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} \ No newline at end of file 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/form/CategoryTagInitFormDTO.java b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/CategoryTagInitFormDTO.java new file mode 100644 index 0000000000..ac83a9750a --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/CategoryTagInitFormDTO.java @@ -0,0 +1,16 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @author zhaoqifeng + * @dscription + * @date 2020/12/10 10:00 + */ +@Data +public class CategoryTagInitFormDTO implements Serializable { + private static final long serialVersionUID = -3420775041990761296L; + private String customerId; +} diff --git a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/FirstCategoryFormDTO.java b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/FirstCategoryFormDTO.java new file mode 100644 index 0000000000..065b0bd359 --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/FirstCategoryFormDTO.java @@ -0,0 +1,47 @@ +package com.epmet.dto.form; + +import lombok.Data; +import org.hibernate.validator.constraints.Length; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @Description 一级分类 新增/修改 + * @Auth zy + * @Date 2021-03-22 09:17 + */ +@Data +public class FirstCategoryFormDTO implements Serializable { + private static final long serialVersionUID = 3188828578545996470L; + + /** + * 客户Id + **/ + @NotBlank(message = "customerId不能为空") + private String customerId; + + /** + * 分类Id + * issue_project_category_dict 表主键,只有执行修改操作时,才会传入 + **/ + private String categoryId; + + /** + * 分类名称 + **/ + @Length(max=20,message = "分类名称不能超过20个字") + @Length(min=2,message = "分类名称不能少于2个字") + private String categoryName; + + /** + * 排序 + **/ + private Integer sort; + + /** + * 操作类型(add:新增 edit:编辑) + **/ + @NotBlank(message = "操作类型不能为空") + private String type; +} diff --git a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/IssueCategoryTagListFormDTO.java b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/IssueCategoryTagListFormDTO.java new file mode 100644 index 0000000000..d9339a0e97 --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/IssueCategoryTagListFormDTO.java @@ -0,0 +1,21 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * 获取议题的分类、标签列表-接口入参 + * @Author sun + */ +@Data +public class IssueCategoryTagListFormDTO implements Serializable { + + private static final long serialVersionUID = 2599592072265715951L; + @NotBlank(message = "议题ID不能为空",groups = {ProjectCategoryTagListFormDTO.CategoryTag.class}) + private String issueId; + + public interface CategoryTag{} + +} diff --git a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/IssueSaveCategoryFormDTO.java b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/IssueSaveCategoryFormDTO.java new file mode 100644 index 0000000000..299a2d25d2 --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/IssueSaveCategoryFormDTO.java @@ -0,0 +1,34 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; +import java.util.List; + +/** + * 议题:保存/修改分类-接口入参 + * @Author sun + */ +@Data +public class IssueSaveCategoryFormDTO implements Serializable { + + private static final long serialVersionUID = 2599592072265715951L; + /** + * 议题Id + */ + @NotBlank(message = "议题ID不能为空",groups = {ProjectSaveCategoryFormDTO.SaveCategory.class}) + private String issueId; + /** + * 议题分类集合 + */ + private List categoryList; + + /** + * 客户Id + */ + private String customerId; + + public interface SaveCategory{} + +} diff --git a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/IssueTagFormDTO.java b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/IssueTagFormDTO.java new file mode 100644 index 0000000000..f67bbe2c34 --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/IssueTagFormDTO.java @@ -0,0 +1,26 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Author zxc + * @DateTime 2020/12/10 上午9:31 + */ +@Data +public class IssueTagFormDTO implements Serializable { + + private static final long serialVersionUID = -8678756265520573631L; + + private String id; + + private String name; + + private String categoryId; + + private String tagId; + + private String isDisable; + +} diff --git a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/IssueTagsFormDTO.java b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/IssueTagsFormDTO.java new file mode 100644 index 0000000000..8cb89dc4d7 --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/IssueTagsFormDTO.java @@ -0,0 +1,72 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Author zxc + * @DateTime 2020/12/10 上午9:31 + */ +@Data +public class IssueTagsFormDTO implements Serializable { + + private static final long serialVersionUID = -8678756265520570931L; + + /** + * 主键ID + */ + private String id; + + /** + * 客户ID + */ + private String customerId; + + /** + * 议题所属网格id + */ + private String gridId; + + /** + * 议题ID + */ + private String issueId; + + /** + * 标签ID + */ + private String tagId; + + /** + * 标签名称 + */ + private String name; + + /** + * 删除标识 0.未删除 1.已删除 + */ + private Integer delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 更新人 + */ + private String updatedBy; + + public IssueTagsFormDTO() { + this.delFlag = 0; + this.revision = 0; + this.createdBy = "APP_USER"; + this.updatedBy = "APP_USER"; + } +} diff --git a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/IssueTagsSaveFormDTO.java b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/IssueTagsSaveFormDTO.java new file mode 100644 index 0000000000..bbf3b9110e --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/IssueTagsSaveFormDTO.java @@ -0,0 +1,28 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; +import java.util.List; + +/** + * @Author zxc + * @DateTime 2020/12/10 上午9:29 + */ +@Data +public class IssueTagsSaveFormDTO implements Serializable { + + private static final long serialVersionUID = 4122102633306198151L; + + public interface IssueTagsSaveForm{} + + @NotBlank(message = "议题ID不能为空",groups = {IssueTagsSaveForm.class}) + private String issueId; + + /** + * 标签集合 为空,清除此议题标签 + */ + private List tagList; + +} diff --git a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/SaveIssueCategoryFormDTO.java b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/SaveIssueCategoryFormDTO.java new file mode 100644 index 0000000000..8941320269 --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/SaveIssueCategoryFormDTO.java @@ -0,0 +1,27 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * 议题:保存/修改分类-接口入参 + * + * @Author sun + */ +@Data +public class SaveIssueCategoryFormDTO implements Serializable { + + private static final long serialVersionUID = 2599592072265715951L; + /** + * 分类Id + */ + private String id; + /** + * 分类名称 + */ + private String name; + + +} diff --git a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/SecondCategoryFormDTO.java b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/SecondCategoryFormDTO.java new file mode 100644 index 0000000000..7b3d389462 --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/SecondCategoryFormDTO.java @@ -0,0 +1,21 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Description 二级分类 新增/修改 + * @ClassName CommonGridIdListFormDTO + * @Auth zy + * @Date 2021-03-22 09:17 + */ +@Data +public class SecondCategoryFormDTO extends FirstCategoryFormDTO implements Serializable{ + private static final long serialVersionUID = 3188828578545996470L; + + /** + * 一级分类Id + **/ + private String parentCategoryId; +} diff --git a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/ShiftProjectFormDTO.java b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/ShiftProjectFormDTO.java index cf576522ac..b44cdb4acd 100644 --- a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/ShiftProjectFormDTO.java +++ b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/ShiftProjectFormDTO.java @@ -1,6 +1,8 @@ package com.epmet.dto.form; +import com.epmet.dto.IssueCategoryDTO; import com.epmet.dto.IssueDTO; +import com.epmet.dto.IssueTagsDTO; import com.epmet.resi.group.dto.topic.ResiTopicDTO; import lombok.Data; import org.hibernate.validator.constraints.Length; @@ -42,6 +44,14 @@ public class ShiftProjectFormDTO implements Serializable { * 话题对象信息 */ private ResiTopicDTO topicDTO ; + /** + * 议题分类 + */ + private List categoryList; + /** + * 议题标签 + */ + private List tagList; } diff --git a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/TagDifferentSetFormDTO.java b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/TagDifferentSetFormDTO.java new file mode 100644 index 0000000000..93685f4a81 --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/TagDifferentSetFormDTO.java @@ -0,0 +1,28 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; +import java.util.List; + +/** + * @Description 更新标签使用率入参DTO + * @ClassName TagDifferentSetFormDTO + * @Auth wangc + * @Date 2020-12-11 14:03 + */ +@Data +public class TagDifferentSetFormDTO implements Serializable { + private static final long serialVersionUID = -5232943723252172322L; + + private List plus; + + private List minus; + + @NotBlank(message = "客户Id不能为空") + private String customerId; + + @NotBlank(message = "用户Id不能为空") + private String userId; +} diff --git a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/TagListFormDTO.java b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/TagListFormDTO.java new file mode 100644 index 0000000000..f09aaa4272 --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/TagListFormDTO.java @@ -0,0 +1,17 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + * @author zhaoqifeng + * @dscription + * @date 2020/12/9 15:32 + */ +@Data +public class TagListFormDTO implements Serializable { + private static final long serialVersionUID = -6448213704058150588L; + private List categoryIdList; +} 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-client/src/main/java/com/epmet/dto/result/CustomerCategoryResultDTO.java b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/result/CustomerCategoryResultDTO.java new file mode 100644 index 0000000000..5121a13471 --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/result/CustomerCategoryResultDTO.java @@ -0,0 +1,48 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + * 客户分类列表 + * + * @Author ZY + * @DateTime 2021/03/23 + */ +@Data +public class CustomerCategoryResultDTO implements Serializable { + + private static final long serialVersionUID = 4769136806332933579L; + + /** + * 分类Id + */ + private String categoryId; + + /** + * 分类名称 + */ + private String categoryName; + + /** + * 排序 + */ + private Integer sort; + + /** + * 是否禁用(enable:启用 disable:禁用) + */ + private String isDisable; + + /** + * 二级分类 + */ + private List children; + + /** + * pid + */ + private String pid; +} diff --git a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/result/IssueCategoryTagListResultDTO.java b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/result/IssueCategoryTagListResultDTO.java new file mode 100644 index 0000000000..cd78b59aaf --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/result/IssueCategoryTagListResultDTO.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 IssueCategoryTagListResultDTO implements Serializable { + + private static final long serialVersionUID = 5957826616179876849L; + + /** + * 类别集合 + */ + private List categoryList = new ArrayList<>(); + /** + * 标签集合 + */ + private List tagList = new ArrayList<>(); + +} diff --git a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/result/IssueCategoryTagResultDTO.java b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/result/IssueCategoryTagResultDTO.java new file mode 100644 index 0000000000..bfd9eec5f4 --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/result/IssueCategoryTagResultDTO.java @@ -0,0 +1,45 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Objects; + +/** + * @Description 获取议题的分类、标签列表-接口返参 + * @Author sun + */ +@Data +public class IssueCategoryTagResultDTO implements Serializable { + + private static final long serialVersionUID = 5957826616179876849L; + + /** + * 分类或标签Id + */ + private String id; + /** + * 分类或标签名称 + */ + private String name; + + /** + * 是否禁用(enable:启用 disable:禁用) + */ + private String isDisable; + + //equals计算时忽略isDisable属性 + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + IssueCategoryTagResultDTO that = (IssueCategoryTagResultDTO) o; + return Objects.equals(id, that.id) && + Objects.equals(name, that.name); + } + + @Override + public int hashCode() { + return Objects.hash(id, name); + } +} diff --git a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/result/IssueProjectTagsResultDTO.java b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/result/IssueProjectTagsResultDTO.java new file mode 100644 index 0000000000..55a738b52e --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/result/IssueProjectTagsResultDTO.java @@ -0,0 +1,21 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Author zxc + * @DateTime 2020/12/10 下午2:13 + */ +@Data +public class IssueProjectTagsResultDTO implements Serializable { + + private static final long serialVersionUID = -5035269596436047038L; + + private String tagId; + + private String tagName; + + private String categoryId; +} diff --git a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/result/TagListResultDTO.java b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/result/TagListResultDTO.java new file mode 100644 index 0000000000..1590463176 --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/result/TagListResultDTO.java @@ -0,0 +1,18 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + * @author zhaoqifeng + * @dscription + * @date 2020/12/9 15:33 + */ +@Data +public class TagListResultDTO implements Serializable { + private static final long serialVersionUID = -4247291364077634874L; + List defaulted; + List customized; +} diff --git a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/feign/GovIssueOpenFeignClient.java b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/feign/GovIssueOpenFeignClient.java index f5d2786c93..277239669d 100644 --- a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/feign/GovIssueOpenFeignClient.java +++ b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/feign/GovIssueOpenFeignClient.java @@ -6,6 +6,8 @@ import com.epmet.dto.*; import com.epmet.dto.form.*; import com.epmet.dto.result.*; import com.epmet.feign.fallback.GovIssueOpenFeignClientFallBack; +import com.epmet.project.dto.CustomerCategoryDTO; +import com.epmet.project.dto.result.ProjectCategoryDictResultDTO; import com.epmet.resi.group.dto.group.form.AllIssueFormDTO; import com.epmet.resi.group.dto.group.form.ApplicationDetailFormDTO; import com.epmet.resi.group.dto.group.form.ApplicationHistoryFormDTO; @@ -208,6 +210,31 @@ public interface GovIssueOpenFeignClient { @PostMapping(value = "/gov/issue/issueapplication/queryuserpubauditingissues") Result> queryUserPubAuditingIssues(@RequestBody UserPubAuditingIssueFormDTO fomrDTO); + /** + * @description 调用issue库,查询分类Id对应的分类名称,按分类升序排列 + * @author sun + **/ + @PostMapping(value = "/gov/issue/issuecategory/projectcategorylist") + Result> projectCategoryList(@RequestBody ProjectCategoryTagListFormDTO formDTO); + + /** + * @description 查询项目所属客户和所属网格信息以及分类对应的分类信息 + * @author sun + **/ + @PostMapping(value = "/gov/issue/issueprojectcategorydict/getprojectandcategoryinfo") + Result getProjectAndCategoryInfo(ProjectSaveCategoryFormDTO formDTO); + + /** + * @Description 更新标签热度 数据库/缓存 + * @param param + * @return void + * @author wangc + * @date 2020.12.11 14:00 + */ + @PostMapping("/gov/issue/issueprojecttagdict/updatecitations") + Result updateCitations(@RequestBody TagDifferentSetFormDTO param); + + /** * @Description 检查邀请关系,如果确实存在邀请关系则返回邀请人Id * 符合条件: @@ -244,4 +271,15 @@ public interface GovIssueOpenFeignClient { @PostMapping("/gov/issue/issue/detail") Result queryIssueDetail(@RequestBody IssueDetailFormDTO formDTO); + + /** + * 获取客户 分类字典 信息 + * + * @param dto + * @return com.epmet.commons.tools.utils.Result> + * @Author zhangyong + * @Date 14:10 2021-03-22 + **/ + @PostMapping(value = "/gov/issue/issueprojectcategorydict/getcustomercategorydict") + Result> getCustomerCategoryDict(@RequestBody CustomerCategoryDTO dto); } diff --git a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/feign/fallback/GovIssueOpenFeignClientFallBack.java b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/feign/fallback/GovIssueOpenFeignClientFallBack.java index 84b1220993..a304db1fa7 100644 --- a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/feign/fallback/GovIssueOpenFeignClientFallBack.java +++ b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/feign/fallback/GovIssueOpenFeignClientFallBack.java @@ -7,6 +7,8 @@ import com.epmet.dto.*; import com.epmet.dto.form.*; import com.epmet.dto.result.*; import com.epmet.feign.GovIssueOpenFeignClient; +import com.epmet.project.dto.CustomerCategoryDTO; +import com.epmet.project.dto.result.ProjectCategoryDictResultDTO; import com.epmet.resi.group.dto.group.form.AllIssueFormDTO; import com.epmet.resi.group.dto.group.form.ApplicationDetailFormDTO; import com.epmet.resi.group.dto.group.form.ApplicationHistoryFormDTO; @@ -192,6 +194,29 @@ public class GovIssueOpenFeignClientFallBack implements GovIssueOpenFeignClient return ModuleUtils.feignConError(ServiceConstant.GOV_ISSUE_SERVER, "queryUserPubAuditingIssues", fomrDTO); } + /** + * @description 调用issue库,查询分类Id对应的分类名称,按分类升序排列 + * @author sun + **/ + @Override + public Result> projectCategoryList(ProjectCategoryTagListFormDTO formDTO) { + return ModuleUtils.feignConError(ServiceConstant.GOV_ISSUE_SERVER, "projectCategoryList", formDTO); + } + + /** + * @description 查询项目所属客户和所属网格信息以及分类对应的分类信息 + * @author sun + **/ + @Override + public Result getProjectAndCategoryInfo(ProjectSaveCategoryFormDTO formDTO) { + return ModuleUtils.feignConError(ServiceConstant.GOV_ISSUE_SERVER, "getProjectAndCategoryInfo", formDTO); + } + + @Override + public Result updateCitations(TagDifferentSetFormDTO param) { + return ModuleUtils.feignConError(ServiceConstant.GOV_ISSUE_SERVER, "updateCitations", param); + } + @Override public Result checkInviteRelationship(SharableIssueAndInviteeFormDTO param) { return ModuleUtils.feignConError(ServiceConstant.GOV_ISSUE_SERVER, "checkInviteRelationship", param); @@ -211,4 +236,9 @@ public class GovIssueOpenFeignClientFallBack implements GovIssueOpenFeignClient public Result queryIssueDetail(IssueDetailFormDTO formDTO) { return ModuleUtils.feignConError(ServiceConstant.GOV_ISSUE_SERVER, "detail", formDTO); } + + @Override + public Result> getCustomerCategoryDict(CustomerCategoryDTO customerCategoryDTO) { + return ModuleUtils.feignConError(ServiceConstant.GOV_ISSUE_SERVER, "getCustomerCategoryDict", customerCategoryDTO); + } } diff --git a/epmet-module/gov-issue/gov-issue-server/pom.xml b/epmet-module/gov-issue/gov-issue-server/pom.xml index 68e7b17d5b..cce26d7129 100644 --- a/epmet-module/gov-issue/gov-issue-server/pom.xml +++ b/epmet-module/gov-issue/gov-issue-server/pom.xml @@ -96,6 +96,24 @@ 2.0.0 compile + + com.epmet + data-report-client + 2.0.0 + compile + + + com.epmet + oper-crm-client + 2.0.0 + compile + + + com.epmet + epmet-commons-rocketmq + 2.0.0 + compile + @@ -155,6 +173,9 @@ https://oapi.dingtalk.com/robot/send?access_token=90782b119f82a5b6bb8e0f819b6a77bbc2102b53aa2d7d2e24fa10b66d580b1c SEC080aac67ff78e79fdaba132aa51e3fb3f6060dec99492feaac82cabf9f8b6a19 + + + 192.168.1.130:9876;192.168.1.132:9876 @@ -192,6 +213,10 @@ https://oapi.dingtalk.com/robot/send?access_token=90782b119f82a5b6bb8e0f819b6a77bbc2102b53aa2d7d2e24fa10b66d580b1c SEC080aac67ff78e79fdaba132aa51e3fb3f6060dec99492feaac82cabf9f8b6a19 + + + 192.168.1.130:9876;192.168.1.132:9876 + epmet_message @@ -229,6 +254,8 @@ https://oapi.dingtalk.com/robot/send?access_token=90782b119f82a5b6bb8e0f819b6a77bbc2102b53aa2d7d2e24fa10b66d580b1c SEC080aac67ff78e79fdaba132aa51e3fb3f6060dec99492feaac82cabf9f8b6a19 + + 192.168.10.161:9876 @@ -266,8 +293,11 @@ SEC95f4f40b533ad379ea6a6d1af6dd37029383cfe1b7cd96dfac2678be2c1c3ed1 + + + 192.168.11.187:9876;192.168.11.184:9876 - \ No newline at end of file + diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/constant/GovIssueRedisKeys.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/constant/GovIssueRedisKeys.java index 1da3dc7911..c9890f47b5 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/constant/GovIssueRedisKeys.java +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/constant/GovIssueRedisKeys.java @@ -1,5 +1,9 @@ package com.epmet.constant; +import com.epmet.utils.ModuleConstants; + +import java.util.Optional; + /** * @Description gov-issue-server模块redis key * @Author yinzuomei @@ -18,5 +22,17 @@ public class GovIssueRedisKeys { public static String getWorkGrassrootsIssueRedDotKey(String gridId) { return rootPrefix.concat(String.format("gov:wxmp:work:grassroots:issue:%s",gridId)); } + + /** + * 议题项目标签key epmet:govern:customer:category:[customerId]:[categoryId] + * + * 自定义标签的categoryId统一为[customize] + * @param customerId + * @param categoryId + * @return + */ + public static String getGovernmentTagKey(String customerId,String categoryId){ + return rootPrefix.concat("govern:customer:category:").concat(customerId).concat(":").concat(Optional.ofNullable(categoryId).orElse(ModuleConstants.ASTERISK)); + } } diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/controller/IssueCategoryController.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/controller/IssueCategoryController.java new file mode 100644 index 0000000000..cba3ed0825 --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/controller/IssueCategoryController.java @@ -0,0 +1,138 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +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.DefaultGroup; +import com.epmet.commons.tools.validator.group.UpdateGroup; +import com.epmet.dto.IssueCategoryDTO; +import com.epmet.dto.form.IssueCategoryTagListFormDTO; +import com.epmet.dto.form.IssueSaveCategoryFormDTO; +import com.epmet.dto.form.ProjectCategoryTagListFormDTO; +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; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletResponse; +import java.util.List; +import java.util.Map; + + +/** + * 议题所属分类表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-12-08 + */ +@RestController +@RequestMapping("issuecategory") +public class IssueCategoryController { + + @Autowired + private IssueCategoryService issueCategoryService; + + @GetMapping("page") + public Result> page(@RequestParam Map params) { + PageData page = issueCategoryService.page(params); + return new Result>().ok(page); + } + + @GetMapping("{id}") + public Result get(@PathVariable("id") String id) { + IssueCategoryDTO data = issueCategoryService.get(id); + return new Result().ok(data); + } + + @PostMapping + public Result save(@RequestBody IssueCategoryDTO dto) { + //效验数据 + ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); + issueCategoryService.save(dto); + return new Result(); + } + + @PutMapping + public Result update(@RequestBody IssueCategoryDTO dto) { + //效验数据 + ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); + issueCategoryService.update(dto); + return new Result(); + } + + @DeleteMapping + public Result delete(@RequestBody String[] ids) { + //效验数据 + AssertUtils.isArrayEmpty(ids, "id"); + issueCategoryService.delete(ids); + return new Result(); + } + + @GetMapping("export") + public void export(@RequestParam Map params, HttpServletResponse response) throws Exception { + List list = issueCategoryService.list(params); + ExcelUtils.exportExcelToTarget(response, null, list, IssueCategoryExcel.class); + } + + /** + * @param formDTO + * @return + * @Description 获取议题的分类、标签列表 + * @Author sun + **/ + @PostMapping("categorytaglist") + public Result categoryTagList(@RequestBody IssueCategoryTagListFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO, IssueCategoryTagListFormDTO.CategoryTag.class); + return new Result().ok(issueCategoryService.categoryTagList(formDTO)); + } + + /** + * @param formDTO + * @return + * @Description 查询分类Id集合对应的分类名称,按分类升序排列 + * @Author sun + **/ + @PostMapping("projectcategorylist") + public Result> projectCategoryList(@RequestBody ProjectCategoryTagListFormDTO formDTO) { + return new Result>().ok(issueCategoryService.projectCategoryList(formDTO)); + } + + /** + * @param formDTO + * @return + * @Description 议题:保存/修改分类 + * @Author sun + **/ + @PostMapping("save") + public Result saveCategory(@LoginUser TokenDto tokenDto, @RequestBody IssueSaveCategoryFormDTO formDTO) { + formDTO.setCustomerId(tokenDto.getCustomerId()); + ValidatorUtils.validateEntity(formDTO, IssueSaveCategoryFormDTO.SaveCategory.class); + issueCategoryService.saveCategory(formDTO); + return new Result(); + } + +} \ No newline at end of file diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/controller/IssueManageController.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/controller/IssueManageController.java index 601b42aa66..673ff0a3fc 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/controller/IssueManageController.java +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/controller/IssueManageController.java @@ -168,6 +168,22 @@ public class IssueManageController { return new Result(); } + /** + * 议题管理-议题转项目-增加分类标签功能 + * @author zhaoqifeng + * @date 2020/12/9 9:58 + * @param tokenDTO + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + */ + @PostMapping("shiftproject-v2") + public Result shiftProjectV2(@LoginUser TokenDto tokenDTO, @RequestBody ShiftProjectFormDTO formDTO) { + formDTO.setStaffId(tokenDTO.getUserId()); + ValidatorUtils.validateEntity(formDTO); + issueService.shiftProjectV2(formDTO); + return new Result(); + } + /** * @Description 政府端查看议题进展 (已关闭单表查询,转议题跨服务查询) * @param issueId 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 new file mode 100644 index 0000000000..c4080d0f10 --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/controller/IssueProjectCategoryDictController.java @@ -0,0 +1,260 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.controller; + +import com.epmet.commons.tools.annotation.LoginUser; +import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.commons.tools.enums.CommonOperateTypeEnum; +import com.epmet.commons.tools.exception.RenException; +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.DefaultGroup; +import com.epmet.commons.tools.validator.group.UpdateGroup; +import com.epmet.dto.IssueProjectCategoryDictDTO; +import com.epmet.dto.form.*; +import com.epmet.dto.result.CustomerCategoryListResultDTO; +import com.epmet.dto.result.CustomerCategoryResultDTO; +import com.epmet.dto.result.ProjectIssueCategoryResultDTO; +import com.epmet.entity.IssueProjectCategoryDictEntity; +import com.epmet.excel.IssueProjectCategoryDictExcel; +import com.epmet.project.dto.CustomerCategoryDTO; +import com.epmet.project.dto.result.ProjectCategoryDictResultDTO; +import com.epmet.service.IssueProjectCategoryDictService; +import com.epmet.utils.ModuleConstants; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletResponse; +import java.util.List; +import java.util.Map; + + +/** + * 议题项目分类字典 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-12-08 + */ +@RestController +@RequestMapping("issueprojectcategorydict") +public class IssueProjectCategoryDictController { + + @Autowired + private IssueProjectCategoryDictService issueProjectCategoryDictService; + + @GetMapping("page") + public Result> page(@RequestParam Map params) { + PageData page = issueProjectCategoryDictService.page(params); + return new Result>().ok(page); + } + + @GetMapping("{id}") + public Result get(@PathVariable("id") String id) { + IssueProjectCategoryDictDTO data = issueProjectCategoryDictService.get(id); + return new Result().ok(data); + } + + @PostMapping + public Result save(@RequestBody IssueProjectCategoryDictDTO dto) { + //效验数据 + ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); + issueProjectCategoryDictService.save(dto); + return new Result(); + } + + @PutMapping + public Result update(@RequestBody IssueProjectCategoryDictDTO dto) { + //效验数据 + ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); + issueProjectCategoryDictService.update(dto); + return new Result(); + } + + @DeleteMapping + public Result delete(@RequestBody String[] ids) { + //效验数据 + AssertUtils.isArrayEmpty(ids, "id"); + issueProjectCategoryDictService.delete(ids); + return new Result(); + } + + @GetMapping("export") + public void export(@RequestParam Map params, HttpServletResponse response) throws Exception { + List list = issueProjectCategoryDictService.list(params); + ExcelUtils.exportExcelToTarget(response, null, list, IssueProjectCategoryDictExcel.class); + } + + /** + * @param tokenDto + * @return + * @Description 客户分类列表查询,按分类升序排列 + * @Author sun + **/ + @PostMapping("list") + public Result> categoryList(@LoginUser TokenDto tokenDto) { + return new Result>().ok(issueProjectCategoryDictService.categoryList(tokenDto.getCustomerId())); + } + + /** + * 客户分类标签数据初始化 + * @author zhaoqifeng + * @date 2020/12/10 10:02 + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + */ + @PostMapping("init") + public Result init(@RequestBody CategoryTagInitFormDTO formDTO) { + issueProjectCategoryDictService.init(formDTO); + return new Result(); + } + + /** + * @param formDTO + * @return + * @Description 批量查询分类信息 + * @Author sun + **/ + @PostMapping("getcategorylist") + public Result> getCategoryList(@RequestBody IssueProjectCategoryDictListFormDTO formDTO) { + return new Result>().ok(issueProjectCategoryDictService.getCategoryList(formDTO)); + } + + /** + * @param formDTO + * @return + * @Description 查询项目所属客户和所属网格信息以及分类对应的分类信息 + * @Author sun + **/ + @PostMapping("getprojectandcategoryinfo") + public Result getProjectAndCategoryInfo(@RequestBody ProjectSaveCategoryFormDTO formDTO) { + return new Result().ok(issueProjectCategoryDictService.getProjectAndCategoryInfo(formDTO)); + } + + /** + * @param formDTO + * @return + * @Description 分类启用与禁用 + * @Author sun + **/ + @PostMapping("isdisablecategory") + public Result isDisableCategory(@LoginUser TokenDto tokenDto, @RequestBody IsDisableCategoryFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO, IsDisableCategoryFormDTO.IsDisableCategory.class); + formDTO.setUserId(tokenDto.getUserId()); + if(!ModuleConstants.ID_ENABLE.equals(formDTO.getType())&&!ModuleConstants.IS_DISABLE.equals(formDTO.getType())){ + throw new RuntimeException("参数错误,操作类型值错误!"); + } + issueProjectCategoryDictService.isDisableCategory(formDTO); + return new Result(); + } + + /** + * @param formDTO + * @return + * @Description 分类删除【存在客户在使用时不允许删除】 + * @Author sun + **/ + @PostMapping("delcategory") + public Result delCategory(@LoginUser TokenDto tokenDto, @RequestBody DelCategoryFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO, DelCategoryFormDTO.DelCategory.class); + formDTO.setUserId(tokenDto.getUserId()); + issueProjectCategoryDictService.delCategory(formDTO); + return new Result(); + } + + /** + * 获取客户 分类字典 信息 + * + * @param dto + * pid = 0 查询一级分类 + * pid != 0 查询二级分类 + * @return com.epmet.commons.tools.utils.Result> + * @Author zhangyong + * @Date 14:10 2021-03-22 + **/ + @PostMapping("getcustomercategorydict") + public Result> getCustomerCategoryDict(@RequestBody CustomerCategoryDTO dto){ + return new Result>().ok(issueProjectCategoryDictService.listCategoryDict(dto.getCustomerId(), + dto.getPid())); + } + + /** + * 新增或修改一级分类信息,分类名称在同一个客户下有效数据中不允许重复 + * + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + * @Author zhangyong + * @Date 10:27 2021-03-23 + **/ + @PostMapping("savefirstcategory") + public Result saveFirstCategory(@RequestBody SecondCategoryFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO); + if (CommonOperateTypeEnum.ADD.getCode().equals(formDTO.getType())) { + return issueProjectCategoryDictService.saveFirstCategory(formDTO); + } else if (CommonOperateTypeEnum.EDIT.getCode().equals(formDTO.getType())){ + return issueProjectCategoryDictService.editFirstCategory(formDTO); + } + throw new RenException("操作类型为空,或错误。type:" + formDTO.getType()); + } + + /** + * 新增或修改二级分类信息,分类名称在同一个客户下同一 一级分类下有效数据中不允许重复 + * + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + * @Author zhangyong + * @Date 10:27 2021-03-23 + **/ + @PostMapping("savesecondcategory") + public Result saveSecondCategory(@RequestBody SecondCategoryFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO); + if (StringUtils.isBlank(formDTO.getParentCategoryId())) { + throw new RenException("一级分类Id 不能为空"); + } + if (CommonOperateTypeEnum.ADD.getCode().equals(formDTO.getType())) { + return issueProjectCategoryDictService.saveSecondCategory(formDTO); + } else if (CommonOperateTypeEnum.EDIT.getCode().equals(formDTO.getType())){ + return issueProjectCategoryDictService.editSecondCategory(formDTO); + } + throw new RenException("操作类型为空,或错误。type:" + formDTO.getType()); + } + + /** + * 客户分类列表 + * 按客户查询已有一级二级分类列表,升序排列,全部查询,不涉及分页 + * + * @param map + * customerId + * @return com.epmet.commons.tools.utils.Result> + * @Author zhangyong + * @Date 16:30 2021-03-23 + **/ + @PostMapping("customercategorylist") + public Result> customerCategoryList(@RequestBody Map map) { + if (StringUtils.isBlank(map.get(FieldConstant.CUSTOMER_ID_HUMP))) { + throw new RenException("客户id 不能为空"); + } + return new Result>().ok(issueProjectCategoryDictService.customerCategoryList(map.get(FieldConstant.CUSTOMER_ID_HUMP))); + } +} + diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/controller/IssueProjectTagDictController.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/controller/IssueProjectTagDictController.java new file mode 100644 index 0000000000..e87f9996d7 --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/controller/IssueProjectTagDictController.java @@ -0,0 +1,125 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +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.dto.IssueProjectTagDictDTO; +import com.epmet.dto.form.TagDifferentSetFormDTO; +import com.epmet.dto.form.TagListFormDTO; +import com.epmet.dto.result.TagListResultDTO; +import com.epmet.excel.IssueProjectTagDictExcel; +import com.epmet.service.IssueProjectTagDictService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletResponse; +import java.util.List; +import java.util.Map; + + +/** + * 议题、项目标签字典表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-12-08 + */ +@RestController +@RequestMapping("issueprojecttagdict") +public class IssueProjectTagDictController { + + @Autowired + private IssueProjectTagDictService issueProjectTagDictService; + + @GetMapping("page") + public Result> page(@RequestParam Map params){ + PageData page = issueProjectTagDictService.page(params); + return new Result>().ok(page); + } + + @GetMapping("{id}") + public Result get(@PathVariable("id") String id){ + IssueProjectTagDictDTO data = issueProjectTagDictService.get(id); + return new Result().ok(data); + } + + @PostMapping + public Result save(@RequestBody IssueProjectTagDictDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); + issueProjectTagDictService.save(dto); + return new Result(); + } + + @PutMapping + public Result update(@RequestBody IssueProjectTagDictDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); + issueProjectTagDictService.update(dto); + return new Result(); + } + + @DeleteMapping + public Result delete(@RequestBody String[] ids){ + //效验数据 + AssertUtils.isArrayEmpty(ids, "id"); + issueProjectTagDictService.delete(ids); + return new Result(); + } + + @GetMapping("export") + public void export(@RequestParam Map params, HttpServletResponse response) throws Exception { + List list = issueProjectTagDictService.list(params); + ExcelUtils.exportExcelToTarget(response, null, list, IssueProjectTagDictExcel.class); + } + + /** + * 标签列表 + * @author zhaoqifeng + * @date 2020/12/9 15:43 + * @param tokenDto + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + */ + @PostMapping("list") + public Result list(@LoginUser TokenDto tokenDto, @RequestBody TagListFormDTO formDTO) { + return new Result().ok(issueProjectTagDictService.getTagList(tokenDto, formDTO)); + } + + /** + * @Description 更新标签热度 数据库/缓存 + * @param param + * @return void + * @author wangc + * @date 2020.12.11 14:00 + */ + @PostMapping("updatecitations") + public Result updateCitations(@RequestBody TagDifferentSetFormDTO param){ + ValidatorUtils.validateEntity(param); + issueProjectTagDictService.updateTagHeat(param); + return new Result(); + } +} \ No newline at end of file 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 new file mode 100644 index 0000000000..de6cfd4cc2 --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/controller/IssueTagsController.java @@ -0,0 +1,126 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +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.DefaultGroup; +import com.epmet.commons.tools.validator.group.UpdateGroup; +import com.epmet.dto.IssueTagsDTO; +import com.epmet.dto.form.AddTagFormDTO; +import com.epmet.dto.form.IssueTagsSaveFormDTO; +import com.epmet.dto.result.AddTagResultDTO; +import com.epmet.excel.IssueTagsExcel; +import com.epmet.service.IssueTagsService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletResponse; +import java.util.List; +import java.util.Map; + + +/** + * 议题关联标签表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-12-08 + */ +@RestController +@RequestMapping("issuetags") +public class IssueTagsController { + + @Autowired + private IssueTagsService issueTagsService; + + @GetMapping("page") + public Result> page(@RequestParam Map params){ + PageData page = issueTagsService.page(params); + return new Result>().ok(page); + } + + @GetMapping("{id}") + public Result get(@PathVariable("id") String id){ + IssueTagsDTO data = issueTagsService.get(id); + return new Result().ok(data); + } + + @PostMapping + public Result save(@RequestBody IssueTagsDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); + issueTagsService.save(dto); + return new Result(); + } + + @PutMapping + public Result update(@RequestBody IssueTagsDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); + issueTagsService.update(dto); + return new Result(); + } + + @DeleteMapping + public Result delete(@RequestBody String[] ids){ + //效验数据 + AssertUtils.isArrayEmpty(ids, "id"); + issueTagsService.delete(ids); + return new Result(); + } + + @GetMapping("export") + public void export(@RequestParam Map params, HttpServletResponse response) throws Exception { + List list = issueTagsService.list(params); + 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); + } + + /** + * @Description 议题标签保存/修改 + * @Param form + * @Param tokenDto + * @author zxc + * @date 2020/12/10 上午9:37 + */ + @PostMapping("save") + public Result issueTagSave(@RequestBody IssueTagsSaveFormDTO form,@LoginUser TokenDto tokenDto){ + ValidatorUtils.validateEntity(form, IssueTagsSaveFormDTO.IssueTagsSaveForm.class); + issueTagsService.issueTagSave(form,tokenDto); + return new Result(); + } + +} \ 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 new file mode 100644 index 0000000000..650e4ac227 --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueCategoryDao.java @@ -0,0 +1,75 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.IssueCategoryDTO; +import com.epmet.dto.form.DelCategoryFormDTO; +import com.epmet.dto.form.ProjectCategoryTagListFormDTO; +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; + +import java.util.List; + +/** + * 议题所属分类表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-12-08 + */ +@Mapper +public interface IssueCategoryDao extends BaseDao { + + /** + * @Description 查询议题绑定的分类名称,按排序升序 + * @Author sun + **/ + List selectIssueCategoryList(@Param("issueId") String issueId); + + /** + * @param formDTO + * @return + * @Description 查询分类Id对应的分类名称,按分类升序排列 + * @Author sun + **/ + List selectProjectCategoryList(ProjectCategoryTagListFormDTO formDTO); + + /** + * 获取议题分类 + * @author zhaoqifeng + * @date 2020/12/9 10:46 + * @param issueId + * @return java.util.List + */ + List selectCategoryByIssue(@Param("issueId") String issueId); + + /** + * @Description 删除议题的分类信息 + * @Author sun + **/ + void delByIssueId(@Param("issueId") String issueId); + + /** + * @Description 查询客户分类有没有被议题使用 + * @Author sun + **/ + List selectIssueList(DelCategoryFormDTO formDTO); +} \ No newline at end of file diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueProjectCategoryDictDao.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueProjectCategoryDictDao.java new file mode 100644 index 0000000000..ff49f564b1 --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueProjectCategoryDictDao.java @@ -0,0 +1,170 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.IssueProjectCategoryDictDTO; +import com.epmet.dto.form.DelCategoryFormDTO; +import com.epmet.dto.form.IsDisableCategoryFormDTO; +import com.epmet.dto.form.IssueProjectCategoryDictListFormDTO; +import com.epmet.dto.result.CustomerCategoryListResultDTO; +import com.epmet.dto.result.CustomerCategoryResultDTO; +import com.epmet.entity.IssueProjectCategoryDictEntity; +import com.epmet.project.dto.result.ProjectCategoryDictResultDTO; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.LinkedList; +import java.util.List; + +/** + * 议题项目分类字典 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-12-08 + */ +@Mapper +public interface IssueProjectCategoryDictDao extends BaseDao { + + /** + * @Description 客户分类列表查询,按分类升序排列,查询未被禁用的 + * @Author sun + **/ + List selectCustomerCategoryList(@Param("customerId") String customerId); + /** + * @Description 查询某个分类的下级分类 + * @Author sun + **/ + List subCategoryList(@Param("id") String categoryId, @Param("customerId") String customerId); + + /** + * 获取默认标签配置 + * @author zhaoqifeng + * @date 2020/12/10 10:06 + * @return java.util.List + */ + List selectCategoryListByCustomer(@Param("customerId") String customerId); + + /** + * @param formDTO + * @return + * @Description 批量查询分类信息 + * @Author sun + **/ + List selectCategoryList(IssueProjectCategoryDictListFormDTO formDTO); + + /** + * @Description 根据客户Id、类别名称、类型查询单个类别 默认查询二级分类 + * @param customerId + * @param categoryName + * @param categoryType + * @return com.epmet.entity.IssueProjectCategoryDictEntity + * @author wangc + * @date 2020.12.10 13:37 + */ + IssueProjectCategoryDictEntity selectSingleByCustomerIdAndCategoryNameAndCategoryType(@Param("customerId")String customerId,@Param("categoryName")String categoryName,@Param("categoryType")String categoryType); + + /** + * 获取客户 分类字典 信息 + * + * @param customerId + * @param pid pid = 0 查询一级分类 + * pid != 0 查询二级分类 + * + * @return java.util.List + * @Author zhangyong + * @Date 14:10 2021-03-22 + **/ + List selectListCategoryDict(@Param("customerId") String customerId, @Param("pid") String pid); + + /** + * 查询客户某个分类信息 + * @author sun + */ + IssueProjectCategoryDictDTO selectByCustomerId(@Param("customerId") String customerId, @Param("categoryId") String categoryId); + + /** + * 删除一级或二级分类,二级分类下默认有的标签不作处理 + * @author sun + */ + int delCategory(DelCategoryFormDTO formDTO); + + /** + * 查询客户全部子类分类信息 + * @author sun + */ + List selectSubCustomerCategoryDict(@Param("customerId") String customerId, @Param("pid") String pid); + + /** + * 批量修改分类启用、禁用状态 + * @author sun + */ + int updateCustomerCategory(IsDisableCategoryFormDTO formDTO); + + /** + * 获取客户下 最大的分类编码(包含已被删除的编码) + * + * @param customerId + * @param parentCategoryCode + * = 0 查询一级分类的最大分类编码 + * = 10xx 根据上级分类编码,查询某个子级的最大分类编码 + * @return java.lang.Integer + * @Author zhangyong + * @Date 13:35 2021-03-23 + **/ + Integer getMaxCategoryCode(@Param("customerId") String customerId, @Param("parentCategoryCode") String parentCategoryCode); + + /** + * 判断同一个客户下有效数据中 分类名称是否重复 + * > 0 则为重复 + * + * + * @param customerId + * @param categoryName + * @param pid != null 表示 将查询范围,限制在某一个一级分类 及 一级分类下的有效数据 + * @param id 修改时,不一定会修改分类名称,所以需通过id 过滤自己 + * @return java.lang.Boolean + * @Author zhangyong + * @Date 14:11 2021-03-23 + **/ + Integer isCategoryName(@Param("customerId") String customerId, @Param("categoryName") String categoryName, + @Param("pid") String pid, @Param("id") String id); + + /** + * 获取客户所有的 分类字典 信息(包含已被禁用的) + * + * @param customerId + * @param pid pid = 0 查询一级分类 + * pid != 0 查询二级分类 + * + * @return java.util.List + * @Author zhangyong + * @Date 14:10 2021-03-22 + **/ + LinkedList selectListAllCategoryDict(@Param("customerId") String customerId, @Param("pid") String pid); + + /** + * 根据 主键+customerId 修改议题项目分类字典 + * + * @param entity + * @return int + * @Author zhangyong + * @Date 09:53 2021-03-30 + **/ + int updateIssueProjectCategoryDict(IssueProjectCategoryDictEntity entity); +} diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueProjectRelationDao.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueProjectRelationDao.java index 017723d64a..437c5e3fe9 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueProjectRelationDao.java +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueProjectRelationDao.java @@ -18,6 +18,7 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.IssueDTO; import com.epmet.entity.IssueProjectRelationEntity; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -50,4 +51,9 @@ public interface IssueProjectRelationDao extends BaseDao selectRelationList(@Param("projectIdList") List projectIdList); + /** + * @Author sun + * @Description 根据项目id查询对应的议题基本信息 + **/ + IssueDTO selectProjectToIssue(@Param("issueId") String issueId); } \ No newline at end of file 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 new file mode 100644 index 0000000000..45fa05d7cf --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueProjectTagDictDao.java @@ -0,0 +1,143 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.form.IsDisableCategoryFormDTO; +import com.epmet.dto.form.IssueTagFormDTO; +import com.epmet.dto.result.IssueCategoryTagResultDTO; +import com.epmet.entity.IssueProjectTagDictEntity; +import org.apache.ibatis.annotations.Mapper; +import org.springframework.data.repository.query.Param; + +import java.util.List; + +/** + * 议题、项目标签字典表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-12-08 + */ +@Mapper +public interface IssueProjectTagDictDao extends BaseDao { + + /** + * @Description 更新标签使用次数 + * @Param tags + * @Param status 0:+1;1:-1 + * @author zxc + * @date 2020/12/10 上午10:29 + */ + void updateTagsUseCount(@Param("tags") List tags,@Param("customerId")String customerId,@Param("status")String status); + + /** + * @Description 更新标签使用次数 + * @param tagIds + * @param customerId + * @param score + * @return void + * @author wangc + * @date 2020.12.14 09:33 + */ + void updateTagUsage(@Param("tagIds") List tagIds,@Param("customerId")String customerId,@Param("score") Integer score); + + /** + * @Description 查询标签ID + * @Param newTags + * @Param customerId + * @author zxc + * @date 2020/12/10 下午2:16 + */ + List selectTagId(@Param("list") List newTags); + + /** + * 获取客户默认分类标签 + * @author zhaoqifeng + * @date 2020/12/10 9:26 + * @param customerId + * @param list + * @return java.util.List + */ + List selectDefaultList(@Param("customerId") String customerId, @Param("list") List list); + + /** + * 获取默认标签配置 + * @author zhaoqifeng + * @date 2020/12/10 10:09 + * @param customerId + * @return java.util.List + */ + List selectTagListByCustomer(@Param("customerId") String customerId); + + /** + * @Description 根据类别查询客户下默认标签 + * @param categories + * @param customerId + * @return java.util.List + * @author wangc + * @date 2020.12.10 10:07 + */ + List selectTagByCategory(@Param("categories") List categories,@Param("customerId") String customerId,@Param("targetCustomerId") String targetCustomerId); + + /** + * @Description 查询客户下的标签数量 + * @param customerId + * @return int + * @author wangc + * @date 2021.03.23 16:51 + */ + int selectCountByCustomerId(@Param("customerId") String customerId); + + /** + * @Description 查询客户下自定义标签 + * @param customerId + * @return java.util.List + * @author wangc + * @date 2021.03.23 16:56 + */ + List selectCustomizedByCustomerId(@Param("customerId") String customerId); + + /** + * @Description 根据传入的二级分类Id查询默认标签 + * 当categories为空时,查询全部默认分类的标签,排序规则:先按照二级分类的上级分类的Sort排序(asc),然后按照二级分类的Sort排序(asc),然后按照标签名拼音排序 + * 当categories不为空时,按照传入的二级分类的顺序排序,然后按照标签名拼音排序 + * @param customerId + * @param categories + * @return java.util.List + * @author wangc + * @date 2021.03.23 15:19 + */ + List selectDefault(@Param("customerId") String customerId,@Param("categories") List categories); + + /** + * @Description 根据客户Id和标签Id集合查询标签的基础信息(标签名、标签码,标签所属分类) + * 不管标签是否被禁用,都可以更新热度,因此这个查询不能加是否禁用的限制 + * @param customerId + * @param tagIds + * @return java.util.List + * @author wangc + * @date 2020.12.13 14:23 + */ + List selectTagsByCustomerIdAndTagIds(@Param("customerId") String customerId,@Param("tagIds")List tagIds); + + /** + * 批量修改标签的启用、禁用状态 + * @author sun + */ + int updateCustomerTag(IsDisableCategoryFormDTO formDTO); +} \ No newline at end of file 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 new file mode 100644 index 0000000000..97d3bbea5e --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueTagsDao.java @@ -0,0 +1,95 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +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.form.IssueTagFormDTO; +import com.epmet.dto.form.IssueTagsFormDTO; +import com.epmet.dto.result.IssueCategoryTagResultDTO; +import com.epmet.entity.IssueTagsEntity; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 议题关联标签表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-12-08 + */ +@Mapper +public interface IssueTagsDao extends BaseDao { + + /** + * @Description 查询议题绑定的标签,按绑定时间升序 + * @Author sun + **/ + List selectIssueTagList(@Param("issueId") String issueId); + + /** + * 获取议题标签 + * @author zhaoqifeng + * @date 2020/12/9 14:05 + * @param issueId + * @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); + + /** + * @Description 根据IssueId查询标签 + * @Param issueId + * @author zxc + * @date 2020/12/10 上午10:05 + */ + List selectTagsByIssueId(@Param("issueId")String issueId); + + /** + * @Description 根据IssueId删除标签 + * @Param issueId + * @author zxc + * @date 2020/12/10 上午10:14 + */ + void deleteTagsByIssueId(@Param("issueId")String issueId); + + /** + * @Description 查询此议题一条标签记录 + * @Param issueId + * @author zxc + * @date 2020/12/10 下午1:49 + */ + IssueTagsDTO selectOneTagByIssueId(@Param("issueId")String issueId); + + /** + * @Description 插入新的标签 + * @Param needInsert + * @author zxc + * @date 2020/12/10 下午2:11 + */ + void insertNewTags(@Param("tags") List needInsert); +} \ No newline at end of file diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/entity/IssueCategoryEntity.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/entity/IssueCategoryEntity.java new file mode 100644 index 0000000000..f0478e560f --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/entity/IssueCategoryEntity.java @@ -0,0 +1,71 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.entity; + +import com.baomidou.mybatisplus.annotation.TableName; + +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; + +/** + * 议题所属分类表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-12-08 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("issue_category") +public class IssueCategoryEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户id + */ + private String customerId; + + /** + * 网格ID: 议题所属网格Id + */ + private String gridId; + + /** + * 议题id + */ + private String issueId; + + /** + * 分类id + */ + private String categoryId; + + /** + * 分类对应的所有上级,英文逗号隔开 + */ + private String categoryPids; + + /** + * 分类编码,分类编码+customer_id唯一 + */ + private String categoryCode; + +} diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/entity/IssueProjectCategoryDictEntity.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/entity/IssueProjectCategoryDictEntity.java new file mode 100644 index 0000000000..b99f37a2bf --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/entity/IssueProjectCategoryDictEntity.java @@ -0,0 +1,86 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.entity; + +import com.baomidou.mybatisplus.annotation.TableName; + +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; + +/** + * 议题项目分类字典 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-12-08 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("issue_project_category_dict") +public class IssueProjectCategoryDictEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户id, 产品默认default + */ + private String customerId; + + /** + * 上级分类ID 顶级此列存储0 + */ + private String pid; + + /** + * 所有上级分类ID,用逗号分开 + */ + private String pids; + + /** + * 上级分类编码 + */ + private String parentCategoryCode; + + /** + * 分类编码,分类编码+customer_id唯一 + */ + private String categoryCode; + + /** + * 分类名称 + */ + private String categoryName; + + /** + * 分类类别1,2,3,4.... + */ + private String categoryType; + + /** + * 排序 + */ + private Integer sort; + + /** + * 是否禁用(enable:启用 disable:禁用) + */ + private String isDisable; + +} diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/entity/IssueProjectTagDictEntity.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/entity/IssueProjectTagDictEntity.java new file mode 100644 index 0000000000..48d457624b --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/entity/IssueProjectTagDictEntity.java @@ -0,0 +1,76 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.entity; + +import com.baomidou.mybatisplus.annotation.TableName; + +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; + +/** + * 议题、项目标签字典表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-12-08 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("issue_project_tag_dict") +public class IssueProjectTagDictEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户ID + */ + private String customerId; + + /** + * 标签名称 + */ + private String tagName; + + /** + * 分类id, 用户自己添加的标签此列可为空 + */ + private String categoryId; + + /** + * 是否是默认标签(0:是 1:否) + */ + private String isDefault; + + /** + * 议题对标签的引用次数 + */ + private Integer issueUseCount; + + /** + * 项目对标签的引用次数 + */ + private Integer projectUseCount; + + /** + * 是否禁用(enable:启用 disable:禁用) + */ + private String isDisable; + +} diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/entity/IssueTagsEntity.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/entity/IssueTagsEntity.java new file mode 100644 index 0000000000..1dc56255fc --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/entity/IssueTagsEntity.java @@ -0,0 +1,66 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.entity; + +import com.baomidou.mybatisplus.annotation.TableName; + +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; + +/** + * 议题关联标签表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-12-08 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("issue_tags") +public class IssueTagsEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户ID + */ + private String customerId; + + /** + * 议题所属网格id + */ + private String gridId; + + /** + * 议题ID + */ + private String issueId; + + /** + * 标签ID + */ + private String tagId; + + /** + * 标签名称 + */ + private String tagName; + +} diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/excel/IssueCategoryExcel.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/excel/IssueCategoryExcel.java new file mode 100644 index 0000000000..1d74b3fe92 --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/excel/IssueCategoryExcel.java @@ -0,0 +1,71 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.excel; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import lombok.Data; + +import java.util.Date; + +/** + * 议题所属分类表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-12-08 + */ +@Data +public class IssueCategoryExcel { + + @Excel(name = "主键") + private String id; + + @Excel(name = "客户id") + private String customerId; + + @Excel(name = "网格ID: 议题所属网格Id") + private String gridId; + + @Excel(name = "议题id") + private String issueId; + + @Excel(name = "分类id") + private String categoryId; + + @Excel(name = "分类对应的所有上级,英文逗号隔开") + private String categoryPids; + + @Excel(name = "删除标识 0未删除、1已删除") + private String delFlag; + + @Excel(name = "乐观锁") + private Integer revision; + + @Excel(name = "创建人") + private String createdBy; + + @Excel(name = "创建时间") + private Date createdTime; + + @Excel(name = "更新人") + private String updatedBy; + + @Excel(name = "更新时间") + private Date updatedTime; + + +} \ No newline at end of file diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/excel/IssueProjectCategoryDictExcel.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/excel/IssueProjectCategoryDictExcel.java new file mode 100644 index 0000000000..4cef5ada59 --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/excel/IssueProjectCategoryDictExcel.java @@ -0,0 +1,77 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.excel; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import lombok.Data; + +import java.util.Date; + +/** + * 议题项目分类字典 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-12-08 + */ +@Data +public class IssueProjectCategoryDictExcel { + + @Excel(name = "主键") + private String id; + + @Excel(name = "客户id, 产品默认default") + private String customerId; + + @Excel(name = "上级分类ID 顶级此列存储0") + private String pid; + + @Excel(name = "所有上级分类ID,用逗号分开") + private String pids; + + @Excel(name = "分类编码,分类编码+customer_id唯一") + private String categoryCode; + + @Excel(name = "分类名称") + private String categoryName; + + @Excel(name = "分类类别1,2,3,4....") + private String categoryType; + + @Excel(name = "排序") + private Integer sort; + + @Excel(name = "删除标识 0未删除、1已删除") + private String delFlag; + + @Excel(name = "乐观锁") + private Integer revision; + + @Excel(name = "创建人") + private String createdBy; + + @Excel(name = "创建时间") + private Date createdTime; + + @Excel(name = "更新人") + private String updatedBy; + + @Excel(name = "更新时间") + private Date updatedTime; + + +} \ No newline at end of file diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/excel/IssueProjectTagDictExcel.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/excel/IssueProjectTagDictExcel.java new file mode 100644 index 0000000000..26fee432bd --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/excel/IssueProjectTagDictExcel.java @@ -0,0 +1,74 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.excel; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import lombok.Data; + +import java.util.Date; + +/** + * 议题、项目标签字典表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-12-08 + */ +@Data +public class IssueProjectTagDictExcel { + + @Excel(name = "主键ID") + private String id; + + @Excel(name = "客户ID") + private String customerId; + + @Excel(name = "标签名称") + private String tagName; + + @Excel(name = "分类id, 用户自己添加的标签此列可为空") + private String categoryId; + + @Excel(name = "是否是默认标签(0:是 1:否)") + private String isDefault; + + @Excel(name = "议题对标签的引用次数") + private Integer issueUseCount; + + @Excel(name = "项目对标签的引用次数") + private Integer projectUseCount; + + @Excel(name = "删除标识 0.未删除 1.已删除") + private Integer delFlag; + + @Excel(name = "乐观锁") + private Integer revision; + + @Excel(name = "创建人") + private String createdBy; + + @Excel(name = "创建时间") + private Date createdTime; + + @Excel(name = "更新人") + private String updatedBy; + + @Excel(name = "更新时间") + private Date updatedTime; + + +} \ No newline at end of file diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/excel/IssueTagsExcel.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/excel/IssueTagsExcel.java new file mode 100644 index 0000000000..c790e5e6e2 --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/excel/IssueTagsExcel.java @@ -0,0 +1,71 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.excel; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import lombok.Data; + +import java.util.Date; + +/** + * 议题关联标签表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-12-08 + */ +@Data +public class IssueTagsExcel { + + @Excel(name = "主键ID") + private String id; + + @Excel(name = "客户ID") + private String customerId; + + @Excel(name = "议题所属网格id") + private String gridId; + + @Excel(name = "议题ID") + private String issueId; + + @Excel(name = "标签ID") + private String tagId; + + @Excel(name = "标签名称") + private String tagName; + + @Excel(name = "删除标识 0.未删除 1.已删除") + private Integer delFlag; + + @Excel(name = "乐观锁") + private Integer revision; + + @Excel(name = "创建人") + private String createdBy; + + @Excel(name = "创建时间") + private Date createdTime; + + @Excel(name = "更新人") + private String updatedBy; + + @Excel(name = "更新时间") + private Date updatedTime; + + +} \ No newline at end of file diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/mq/listener/IssueProjectCategoryTagInitListener.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/mq/listener/IssueProjectCategoryTagInitListener.java new file mode 100644 index 0000000000..beb1fa1473 --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/mq/listener/IssueProjectCategoryTagInitListener.java @@ -0,0 +1,67 @@ +package com.epmet.mq.listener; + +import com.alibaba.fastjson.JSON; +import com.epmet.commons.rocketmq.constants.ConsomerGroupConstants; +import com.epmet.commons.rocketmq.constants.TopicConstants; +import com.epmet.commons.rocketmq.messages.InitCustomerMQMsg; +import com.epmet.commons.tools.distributedlock.DistributedLock; +import com.epmet.commons.tools.exception.ExceptionUtils; +import com.epmet.commons.tools.exception.RenException; +import com.epmet.dto.form.CategoryTagInitFormDTO; +import com.epmet.service.IssueProjectCategoryDictService; +import org.apache.rocketmq.common.message.MessageExt; +import org.apache.rocketmq.spring.annotation.MessageModel; +import org.apache.rocketmq.spring.annotation.RocketMQMessageListener; +import org.apache.rocketmq.spring.core.RocketMQListener; +import org.redisson.api.RLock; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import java.util.concurrent.TimeUnit; + +/** + * 监听初始化客户动作,为客户初始化议题、项目的分类、标签数据 + */ +@RocketMQMessageListener(topic = TopicConstants.INIT_CUSTOMER, + consumerGroup = ConsomerGroupConstants.ISSUE_PROJECT_CATEGORY_TAG, + messageModel = MessageModel.CLUSTERING, + selectorExpression = "*") +@Component +public class IssueProjectCategoryTagInitListener implements RocketMQListener { + + private Logger logger = LoggerFactory.getLogger(getClass()); + + @Autowired + private IssueProjectCategoryDictService issueProjectCategoryDictService; + + @Autowired + private DistributedLock distributedLock; + + @Override + public void onMessage(MessageExt messageExt) { + String msg = new String(messageExt.getBody()); + logger.info("初始化客户-初始化客户自定义信息-收到消息内容:{}", msg); + InitCustomerMQMsg msgObj = JSON.parseObject(msg, InitCustomerMQMsg.class); + + CategoryTagInitFormDTO dto = new CategoryTagInitFormDTO(); + dto.setCustomerId(msgObj.getCustomerId()); + + RLock lock = null; + try { + lock = distributedLock.getLock(String.format("lock:init_customer_home:%s", msgObj.getCustomerId()), + 30l, 30l, TimeUnit.SECONDS); + issueProjectCategoryDictService.init(dto); + } catch (RenException e) { + // 如果是我们手动抛出的异常,说明在业务可控范围内。目前不需要MQ重试 + logger.error("【RocketMQ】初始化客户组件失败:".concat(ExceptionUtils.getErrorStackTrace(e))); + } catch (Exception e) { + // 不是我们自己抛出的异常,可以让MQ重试 + logger.error("【RocketMQ】初始化客户组件失败:".concat(ExceptionUtils.getErrorStackTrace(e))); + throw e; + } finally { + distributedLock.unLock(lock); + } + } +} \ No newline at end of file diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/redis/IssueCategoryRedis.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/redis/IssueCategoryRedis.java new file mode 100644 index 0000000000..f05e1bac72 --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/redis/IssueCategoryRedis.java @@ -0,0 +1,47 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.redis; + +import com.epmet.commons.tools.redis.RedisUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * 议题所属分类表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-12-08 + */ +@Component +public class IssueCategoryRedis { + @Autowired + private RedisUtils redisUtils; + + public void delete(Object[] ids) { + + } + + public void set(){ + + } + + public String get(String id){ + return null; + } + +} \ No newline at end of file diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/redis/IssueProjectCategoryDictRedis.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/redis/IssueProjectCategoryDictRedis.java new file mode 100644 index 0000000000..f4bfbe0967 --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/redis/IssueProjectCategoryDictRedis.java @@ -0,0 +1,47 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.redis; + +import com.epmet.commons.tools.redis.RedisUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * 议题项目分类字典 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-12-08 + */ +@Component +public class IssueProjectCategoryDictRedis { + @Autowired + private RedisUtils redisUtils; + + public void delete(Object[] ids) { + + } + + public void set(){ + + } + + public String get(String id){ + return null; + } + +} \ 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 new file mode 100644 index 0000000000..5cfb9a1c5c --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/redis/IssueProjectTagDictRedis.java @@ -0,0 +1,480 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.redis; + +import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.exception.RenException; +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; +import com.epmet.dto.form.CategoryTagInitFormDTO; +import com.epmet.dto.result.IssueCategoryTagResultDTO; +import com.epmet.entity.IssueProjectCategoryDictEntity; +import com.epmet.entity.IssueProjectTagDictEntity; +import com.epmet.service.IssueProjectCategoryDictService; +import com.epmet.service.IssueProjectTagDictService; +import com.epmet.utils.ModuleConstants; +import com.fasterxml.jackson.databind.ObjectMapper; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.dao.DataAccessException; +import org.springframework.data.redis.connection.RedisConnection; +import org.springframework.data.redis.core.RedisCallback; +import org.springframework.data.redis.core.RedisTemplate; +import org.springframework.data.redis.core.ZSetOperations; +import org.springframework.lang.Nullable; +import org.springframework.stereotype.Component; +import org.springframework.util.CollectionUtils; + +import java.util.*; +import java.util.stream.Collectors; + +/** + * 议题、项目标签字典表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-12-08 + */ +@Component +@Slf4j +public class IssueProjectTagDictRedis { + @Autowired + private RedisUtils redisUtils; + @Autowired + private RedisTemplate redisTemplate; + @Autowired + private IssueProjectTagDictDao poolDao; + @Autowired + private IssueProjectCategoryDictDao categoryDictDao; + @Autowired + private IssueProjectCategoryDictService categoryDictService; + @Autowired + private IssueProjectTagDictService tagDictService; + public void delete(Object[] ids) { + + } + + public void set(){ + + } + + public String get(String id){ + return null; + } + + + /** + * @Description + * + * 排序规则: + * 1、默认标签,按照分类排序 + * 2、自定义标签,按照热度排序 + * + * @param customerId + * @param category + * @return + * @author wangc + * @date 2020.12.09 11:16 + */ + public Map> getDefaultTagsSortedByCategoryAndCustomizedTagsOrderByRank(String customerId,List category) { + if (StringUtils.isBlank(customerId)) { + log.error("customerId can not be null when obtain govern tags."); + throw new RenException("customerId can not be null when obtain govern tags."); + } + + //查询客户的“其他"分类的Id + IssueProjectCategoryDictEntity otherCategory = categoryDictDao.selectSingleByCustomerIdAndCategoryNameAndCategoryType(customerId, ModuleConstants.CATEGORY_NAME_OTHERS, null); + //判断入参是否是只有一个分类Id并且是"其他"的Id + boolean ifOtherOnly = null == otherCategory ? false : (!CollectionUtils.isEmpty(category) && category.size() == NumConstant.ONE && category.contains(otherCategory.getId()) ? true : false); + + Map> result = new HashMap<>(); + //传入的categories不会只包含"其他"这个分类,因为情况下ifOtherOnly为true,直接传入null + List _default = poolDao.selectDefault(customerId,ifOtherOnly ? null : category); + if(!CollectionUtils.isEmpty(_default)){ + result.put(ModuleConstants.DEFAULT_TAG_CATEGORY_NAME,_default); + }else log.error("there is no default tag data in database , customerId : {}",customerId); + + + //如果keys集合为空,说明缓存中没有当前客户的标签排行信息,直接进行补偿 + Set> customizedTuples = redisUtils.zReverseRangeWithScores(GovIssueRedisKeys.getGovernmentTagKey(customerId, ModuleConstants.CUSTOMIZED_TAG_CATEGORY_NAME), NumConstant.ZERO_L, (long) (NumConstant.ONE_NEG)); + if(!CollectionUtils.isEmpty(customizedTuples)){ + Map> customizedHeatMap = new HashMap<>(); + customizedTuples.forEach(tuple -> { + List queue = customizedHeatMap.get(tuple.getScore()); + if((CollectionUtils.isEmpty(queue))) queue = new LinkedList<>(); + queue.add(parseObject(tuple.getValue(), IssueCategoryTagResultDTO.class)); + customizedHeatMap.put(tuple.getScore(),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); + } + + + //默认、自定义标签,只要有一个是空就触发补偿 + //不信任缓存数据 + if(!CollectionUtils.isEmpty(result) && !CollectionUtils.isEmpty(result.get(ModuleConstants.DEFAULT_TAG_CATEGORY_NAME)) + && !CollectionUtils.isEmpty(result.get(ModuleConstants.CUSTOMIZED_TAG_CATEGORY_NAME))) + return result; + + + + + log.warn("fetch customer govern tag cache blankly,customerId:{},now begin compensation...", customerId); + + Map> compensate = compensate(customerId, category, ifOtherOnly,result); + + if (CollectionUtils.isEmpty(compensate)) { + log.error("compensation failure or there is no tag data in database!!"); + throw new RenException("compensation failure or there is no tag data in database!!"); + } else { + log.warn("compensation completed!!"); + return compensate; + } + } + + + + + /** + * @Description FIXME 该方法保留,默认查询缓存,默认和自定义两种标签均按热度排序 + * FIXME 如果缓存中没有相关数据,则进行补偿,返回的数据为:1、默认标签(分类排序) 2、自定义标签(热度排序) + * FIXME 补偿机制均是在缓存中存储热度得分,因此在业务改变之前不要调用该方法 + * 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; + } + + 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)); + heatMap.put(heatScore, queue); + }); + }); + List defaultResult = new LinkedList<>(); + heatMap.keySet().stream().sorted(Comparator.reverseOrder()).collect(Collectors.toList()).forEach(count -> { + defaultResult.addAll(heatMap.get(count)); + }); + + 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,null); + + 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 如果之前查询的结果为空,说明默认与自定义都没有 + * + * + * @param customerId + * @param category + * @return + * @author wangc + * @date 2020.12.10 09:34 + */ + public Map> compensate(String customerId,List category,boolean ifOtherOnly,Map> preResult){ + + List db = new LinkedList<>(); + + CategoryTagInitFormDTO customerIdParam = new CategoryTagInitFormDTO(); + customerIdParam.setCustomerId(customerId); + if (!CollectionUtils.isEmpty(redisUtils.keys(GovIssueRedisKeys.getGovernmentTagKey(customerId, null)))){ + //缓存不为空 + if(CollectionUtils.isEmpty(preResult) || CollectionUtils.isEmpty(preResult.get(ModuleConstants.DEFAULT_TAG_CATEGORY_NAME))) { + if (ifOtherOnly || CollectionUtils.isEmpty(category)) { + //补偿全部默认标签 + categoryDictService.init(customerIdParam); + db.addAll(poolDao.selectTagByCategory(null, customerId, customerId)); + } else { + if (NumConstant.ZERO <= poolDao.selectCountByCustomerId(customerId)) { + categoryDictService.init(customerIdParam); + } else { + //只插入category中的标签 + List missingTags = poolDao.selectTagByCategory(category, "default", customerId); + if(!CollectionUtils.isEmpty(missingTags)){ + tagDictService.insertBatch(missingTags); + db.addAll(missingTags);} + } + } + } + + }else{ + //缓存为空 + if (NumConstant.ZERO <= poolDao.selectCountByCustomerId(customerId)) { + categoryDictService.init(customerIdParam); + } + db.addAll(poolDao.selectTagByCategory(null, customerId, customerId)); + } + + if(CollectionUtils.isEmpty(preResult) || CollectionUtils.isEmpty(preResult.get(ModuleConstants.CUSTOMIZED_TAG_CATEGORY_NAME))){ + //先去数据库查询自定义,为空则是最终结果,不为空则补偿 + List customizedTags = poolDao.selectCustomizedByCustomerId(customerId); + if(!CollectionUtils.isEmpty(customizedTags)){ + db.addAll(customizedTags); + } + } + + + + + // key -> redisKey + // value -> [key : score ; value : object] + Map>> fulfilled = 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.getKeySerializer().serialize(redisKey), + score.doubleValue(), + redisTemplate.getValueSerializer().serialize(factor)); + }); + }); + + }); + return null; + }); + } + + Map> result = new HashMap<>(); + //默认标签:按照分类排序 Mapper返回的查询结果是有序的 + //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())); + if (!CollectionUtils.isEmpty(preResult) && !CollectionUtils.isEmpty(preResult.get(ModuleConstants.DEFAULT_TAG_CATEGORY_NAME))) { + result.put(ModuleConstants.DEFAULT_TAG_CATEGORY_NAME, preResult.get(ModuleConstants.DEFAULT_TAG_CATEGORY_NAME)); + } else { + result.put(ModuleConstants.DEFAULT_TAG_CATEGORY_NAME, poolDao.selectDefault(customerId, ifOtherOnly ? null : category)); + } + + //自定义标签:按照热度排序 sorted(Comparator.comparing(IssueProjectTagDictEntity :: getIssueUseCount).reversed()) + if (!CollectionUtils.isEmpty(preResult) && !CollectionUtils.isEmpty(preResult.get(ModuleConstants.CUSTOMIZED_TAG_CATEGORY_NAME))) { + result.put(ModuleConstants.CUSTOMIZED_TAG_CATEGORY_NAME, preResult.get(ModuleConstants.CUSTOMIZED_TAG_CATEGORY_NAME)); + } else { + 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; + } + + /** + * @Description 标签使用次数修改 + * @Param customerId 客户ID + * @Param categoryId 标签ID 自定义标签的categoryId统一为[customize] + * @Param formDTO + * @Param status 标签次数更新状态 0:+1,1:-1 + * @author zxc + * @date 2020/12/9 下午2:54 + */ + public void editTagUseCount(String customerId,String categoryId, Object formDTO,String status){ + String key = GovIssueRedisKeys.getGovernmentTagKey(customerId, categoryId); + if (status.equals(NumConstant.ZERO_STR)){ + // 标签使用次数+1 + redisUtils.zIncrementScore(key, formDTO,NumConstant.ONE); + } + if (status.equals(NumConstant.ONE_STR)){ + //标签使用次数-1 + Double score = redisUtils.getScore(key, formDTO); + // 避免score为负数 + if (null != score && score > NumConstant.ZERO){ + redisUtils.zIncrementScore(key, formDTO,NumConstant.ONE_NEG); + } + } + } + + /** + * @Description 标签添加 + * @Param customerId + * @Param categoryId + * @Param o + * @author zxc + * @date 2020/12/9 下午3:19 + */ + public void addIssueProjectTag(String customerId,String categoryId,Object o){ + String key = GovIssueRedisKeys.getGovernmentTagKey(customerId, categoryId); + redisUtils.zSetAdd(key,o); + } + + public void batchIncrScore(Map>> param){ + if(CollectionUtils.isEmpty(param)) return; + redisTemplate.executePipelined((RedisCallback) connection -> { + param.forEach((operation,map) -> { + if(!CollectionUtils.isEmpty(map)){ + map.forEach((key,list) -> { + if(!CollectionUtils.isEmpty(list)){ + list.forEach(obj -> { + connection.zSetCommands().zIncrBy(redisTemplate.getKeySerializer().serialize(key), + StringUtils.equals(NumConstant.ONE_STR,operation) ? 1d : -1d , + redisTemplate.getValueSerializer().serialize(obj)); + }); + } + }); + } + }); + return null; + }); + } + + /** + * @Description 批量更新指定分类下的标签的禁用/启用属性 + * @param customerId 客户Id + * @param secondCategoryIds 二级分类集合 + * @param availableFlag enable | disabled + * @return void + * @author wangc + * @date 2021.03.22 16:20 + */ + public void updateTagAvailabilityBySecondCategoryIds(String customerId,ListsecondCategoryIds,String availableFlag){ + if(CollectionUtils.isEmpty(secondCategoryIds)) return; + secondCategoryIds.forEach(cid -> { + String key = GovIssueRedisKeys.getGovernmentTagKey(customerId, cid); + + Set> tagTuples = + redisUtils.zReverseRangeWithScores(key, NumConstant.ZERO_L, (long) (NumConstant.ONE_NEG)); + + if(!CollectionUtils.isEmpty(tagTuples)){ + Map> heatMap = new HashMap<>(); + tagTuples.forEach(tuple -> { + Set queue = heatMap.get(tuple.getValue()); + if((CollectionUtils.isEmpty(queue))) queue = new HashSet<>(); + IssueCategoryTagResultDTO ele = parseObject(tuple.getValue(), IssueCategoryTagResultDTO.class); + ele.setIsDisable(availableFlag); + queue.add(ele); + heatMap.put(tuple.getScore(),queue); + }); + + + redisUtils.delete(key); + + redisTemplate.executePipelined((RedisCallback) connection -> { + heatMap.forEach((score,set) -> { + set.forEach(o -> { + connection.zSetCommands().zIncrBy(redisTemplate.getKeySerializer().serialize(key), + score , + redisTemplate.getValueSerializer().serialize(o)); + }); + }); + return null; + }); + } + }); + } + + public T parseObject(Object o,Class clazz){ + ObjectMapper objectMapper = new ObjectMapper(); + T t = objectMapper.convertValue(o, clazz); + return t; + } +} \ No newline at end of file diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/redis/IssueTagsRedis.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/redis/IssueTagsRedis.java new file mode 100644 index 0000000000..3219ea7b57 --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/redis/IssueTagsRedis.java @@ -0,0 +1,47 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.redis; + +import com.epmet.commons.tools.redis.RedisUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * 议题关联标签表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-12-08 + */ +@Component +public class IssueTagsRedis { + @Autowired + private RedisUtils redisUtils; + + public void delete(Object[] ids) { + + } + + public void set(){ + + } + + public String get(String id){ + return null; + } + +} \ No newline at end of file diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/IssueCategoryService.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/IssueCategoryService.java new file mode 100644 index 0000000000..5717b27db0 --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/IssueCategoryService.java @@ -0,0 +1,135 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +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.IssueCategoryTagListFormDTO; +import com.epmet.dto.form.IssueSaveCategoryFormDTO; +import com.epmet.dto.form.ProjectCategoryTagListFormDTO; +import com.epmet.dto.result.IssueCategoryTagListResultDTO; +import com.epmet.dto.result.ProjectCategoryTagResultDTO; +import com.epmet.entity.IssueCategoryEntity; + +import java.util.List; +import java.util.Map; + +/** + * 议题所属分类表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-12-08 + */ +public interface IssueCategoryService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2020-12-08 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2020-12-08 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return IssueCategoryDTO + * @author generator + * @date 2020-12-08 + */ + IssueCategoryDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2020-12-08 + */ + void save(IssueCategoryDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2020-12-08 + */ + void update(IssueCategoryDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2020-12-08 + */ + void delete(String[] ids); + + /** + * @param formDTO + * @return + * @Description 获取议题的分类、标签列表 + * @Author sun + **/ + IssueCategoryTagListResultDTO categoryTagList(IssueCategoryTagListFormDTO formDTO); + + /** + * @param formDTO + * @return + * @Description 查询分类Id集合对应的分类名称,按分类升序排列 + * @Author sun + **/ + List projectCategoryList(ProjectCategoryTagListFormDTO formDTO); + + /** + * 获取议题分类 + * @author zhaoqifeng + * @date 2020/12/9 10:48 + * @param issueId + * @return java.util.List + */ + List getCategoryByIssue(String issueId); + + + /** + * @param formDTO + * @return + * @Description 议题:保存/修改分类 + * @Author sun + **/ + void saveCategory(IssueSaveCategoryFormDTO formDTO); + +} \ No newline at end of file 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 new file mode 100644 index 0000000000..639888bc23 --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/IssueProjectCategoryDictService.java @@ -0,0 +1,211 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.IssueProjectCategoryDictDTO; +import com.epmet.dto.form.*; +import com.epmet.dto.result.CustomerCategoryListResultDTO; +import com.epmet.dto.result.CustomerCategoryResultDTO; +import com.epmet.dto.result.ProjectIssueCategoryResultDTO; +import com.epmet.entity.IssueProjectCategoryDictEntity; +import com.epmet.project.dto.result.ProjectCategoryDictResultDTO; +import org.springframework.web.bind.annotation.RequestBody; + +import java.util.List; +import java.util.Map; + +/** + * 议题项目分类字典 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-12-08 + */ +public interface IssueProjectCategoryDictService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2020-12-08 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2020-12-08 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return IssueProjectCategoryDictDTO + * @author generator + * @date 2020-12-08 + */ + IssueProjectCategoryDictDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2020-12-08 + */ + void save(IssueProjectCategoryDictDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2020-12-08 + */ + void update(IssueProjectCategoryDictDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2020-12-08 + */ + void delete(String[] ids); + + /** + * @param customerId + * @return + * @Description 客户分类列表查询,按分类升序排列 + * @Author sun + **/ + List categoryList(String customerId); + + /** + * 客户分类标签数据初始化 + * @author zhaoqifeng + * @date 2020/12/10 10:02 + * @param formDTO + * @return void + */ + void init(CategoryTagInitFormDTO formDTO); + + /** + * @param formDTO + * @return + * @Description 批量查询分类信息 + * @Author sun + **/ + List getCategoryList(IssueProjectCategoryDictListFormDTO formDTO); + + /** + * @param formDTO + * @return + * @Description 查询项目所属客户和所属网格信息以及分类对应的分类信息 + * @Author sun + **/ + ProjectIssueCategoryResultDTO getProjectAndCategoryInfo(ProjectSaveCategoryFormDTO formDTO); + + /** + * @Description 分类启用与禁用 + * @Author sun + **/ + void isDisableCategory(IsDisableCategoryFormDTO formDTO); + + /** + * @Description 分类删除 + * @Author sun + **/ + void delCategory(DelCategoryFormDTO formDTO); + + /** + * 获取客户 分类字典 信息 + * + * @param customerId + * @param pid pid = 0 查询一级分类 + * pid != 0 查询二级分类 + * + * @return java.util.List + * @Author zhangyong + * @Date 14:10 2021-03-22 + **/ + List listCategoryDict(String customerId, String pid); + + /** + * 新增一级分类信息,分类名称在同一个客户下有效数据中不允许重复 + * + * @param formDTO + * @return com.epmet.commons.tools.utils.Result 新增后的主键 + * @Author zhangyong + * @Date 10:27 2021-03-23 + **/ + Result saveFirstCategory(SecondCategoryFormDTO formDTO); + + /** + * 修改一级分类信息,分类名称在同一个客户下有效数据中不允许重复 + * + * @param formDTO + * @return com.epmet.commons.tools.utils.Result 新增后的主键 + * @Author zhangyong + * @Date 10:27 2021-03-23 + **/ + Result editFirstCategory(SecondCategoryFormDTO formDTO); + + /** + * 新增二级分类信息,分类名称在同一个客户下同一 一级分类下有效数据中不允许重复 + * + * @param formDTO + * @return com.epmet.commons.tools.utils.Result 新增后的主键 + * @Author zhangyong + * @Date 10:27 2021-03-23 + **/ + Result saveSecondCategory(SecondCategoryFormDTO formDTO); + + /** + * 修改二级分类信息,分类名称在同一个客户下有效数据中不允许重复 + * + * @param formDTO + * @return com.epmet.commons.tools.utils.Result 新增后的主键 + * @Author zhangyong + * @Date 10:27 2021-03-23 + **/ + Result editSecondCategory(SecondCategoryFormDTO formDTO); + + /** + * 客户分类列表 + * 按客户查询已有一级二级分类列表,升序排列,全部查询,不涉及分页 + * + * @param customerId + * @return java.util.List + * @Author zhangyong + * @Date 16:30 2021-03-23 + **/ + List customerCategoryList(String customerId); +} diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/IssueProjectTagDictService.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/IssueProjectTagDictService.java new file mode 100644 index 0000000000..4e37aaf0d0 --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/IssueProjectTagDictService.java @@ -0,0 +1,127 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +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.IssueProjectTagDictDTO; +import com.epmet.dto.form.TagDifferentSetFormDTO; +import com.epmet.dto.form.TagListFormDTO; +import com.epmet.dto.result.TagListResultDTO; +import com.epmet.entity.IssueProjectTagDictEntity; + +import java.util.List; +import java.util.Map; + +/** + * 议题、项目标签字典表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-12-08 + */ +public interface IssueProjectTagDictService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2020-12-08 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2020-12-08 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return IssueProjectTagDictDTO + * @author generator + * @date 2020-12-08 + */ + IssueProjectTagDictDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2020-12-08 + */ + void save(IssueProjectTagDictDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2020-12-08 + */ + void update(IssueProjectTagDictDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2020-12-08 + */ + void delete(String[] ids); + + /** + * 标签列表 + * @author zhaoqifeng + * @date 2020/12/9 15:41 + * @param tokenDto + * @param formDTO + * @return com.epmet.dto.result.TagListResultDTO + */ + TagListResultDTO getTagList(TokenDto tokenDto, TagListFormDTO formDTO); + + /** + * 获取默认标签配置 + * @author zhaoqifeng + * @date 2020/12/10 10:12 + * @param + * @return java.util.List + */ + List getTagListByCustomer(String customerId); + + /** + * @Description 更新标签热度 数据库/缓存 + * @param param + * @return void + * @author wangc + * @date 2020.12.11 14:00 + */ + void updateTagHeat(TagDifferentSetFormDTO param); +} \ No newline at end of file diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/IssueService.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/IssueService.java index 4b14996149..e22236e324 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/IssueService.java +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/IssueService.java @@ -212,6 +212,15 @@ public interface IssueService extends BaseService { **/ void shiftProject(ShiftProjectFormDTO formDTO); + /** + * 议题管理-议题转项目-增加分类标签功能 + * @author zhaoqifeng + * @date 2020/12/9 10:01 + * @param formDTO + * @return void + */ + void shiftProjectV2(ShiftProjectFormDTO formDTO); + /** * @Description 已关闭列表 政府端 * @param issueListForm 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 new file mode 100644 index 0000000000..b7970e8793 --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/IssueTagsService.java @@ -0,0 +1,125 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +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.form.IssueTagsSaveFormDTO; +import com.epmet.dto.result.AddTagResultDTO; +import com.epmet.entity.IssueTagsEntity; + +import java.util.List; +import java.util.Map; + +/** + * 议题关联标签表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-12-08 + */ +public interface IssueTagsService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2020-12-08 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2020-12-08 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return IssueTagsDTO + * @author generator + * @date 2020-12-08 + */ + IssueTagsDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2020-12-08 + */ + void save(IssueTagsDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2020-12-08 + */ + void update(IssueTagsDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2020-12-08 + */ + void delete(String[] ids); + + /** + * 获取议题标签 + * @author zhaoqifeng + * @date 2020/12/9 14:07 + * @param issueId + * @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); + + /** + * @Description 议题标签保存/修改 + * @Param form + * @Param tokenDto + * @author zxc + * @date 2020/12/10 上午9:37 + */ + void issueTagSave(IssueTagsSaveFormDTO 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/IssueCategoryServiceImpl.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueCategoryServiceImpl.java new file mode 100644 index 0000000000..c86e5d926d --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueCategoryServiceImpl.java @@ -0,0 +1,227 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +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.RenException; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.dao.IssueCategoryDao; +import com.epmet.dao.IssueTagsDao; +import com.epmet.dto.IssueCategoryDTO; +import com.epmet.dto.IssueProjectCategoryDictDTO; +import com.epmet.dto.form.*; +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.entity.IssueEntity; +import com.epmet.redis.IssueCategoryRedis; +import com.epmet.service.IssueCategoryService; +import com.epmet.service.IssueProjectCategoryDictService; +import com.epmet.service.IssueService; +import org.apache.commons.lang3.StringUtils; +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; +import java.util.stream.Collectors; + +/** + * 议题所属分类表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-12-08 + */ +@Service +public class IssueCategoryServiceImpl extends BaseServiceImpl implements IssueCategoryService { + + @Autowired + private IssueCategoryRedis issueCategoryRedis; + @Autowired + private IssueTagsDao issueTagsDao; + @Autowired + private IssueService issueService; + @Autowired + private IssueProjectCategoryDictService issueProjectCategoryDictService; + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, IssueCategoryDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, IssueCategoryDTO.class); + } + + private QueryWrapper getWrapper(Map params){ + String id = (String)params.get(FieldConstant.ID_HUMP); + + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); + + return wrapper; + } + + @Override + public IssueCategoryDTO get(String id) { + IssueCategoryEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, IssueCategoryDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(IssueCategoryDTO dto) { + IssueCategoryEntity entity = ConvertUtils.sourceToTarget(dto, IssueCategoryEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(IssueCategoryDTO dto) { + IssueCategoryEntity entity = ConvertUtils.sourceToTarget(dto, IssueCategoryEntity.class); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + + /** + * @param formDTO + * @return + * @Description 获取议题的分类、标签列表 + * @Author sun + **/ + @Override + public IssueCategoryTagListResultDTO categoryTagList(IssueCategoryTagListFormDTO formDTO) { + IssueCategoryTagListResultDTO resultDTO = new IssueCategoryTagListResultDTO(); + //1.查询议题绑定的分类名称,按排序升序 + List categoryList = baseDao.selectIssueCategoryList(formDTO.getIssueId()); + if (categoryList.size() > NumConstant.ZERO) { + resultDTO.setCategoryList(categoryList); + } + //2.查询议题绑定的标签,按绑定时间升序 + List tagList = issueTagsDao.selectIssueTagList(formDTO.getIssueId()); + if (tagList.size() > NumConstant.ZERO) { + resultDTO.setTagList(tagList); + } + return resultDTO; + } + + /** + * @param formDTO + * @return + * @Description 查询分类Id集合对应的分类名称,按分类升序排列 + * @Author sun + **/ + @Override + public List projectCategoryList(ProjectCategoryTagListFormDTO formDTO) { + return baseDao.selectProjectCategoryList(formDTO); + } + + /** + * 获取议题分类 + * + * @param issueId + * @return java.util.List + * @author zhaoqifeng + * @date 2020/12/9 10:48 + */ + @Override + public List getCategoryByIssue(String issueId) { + return baseDao.selectCategoryByIssue(issueId); + } + + /** + * @param formDTO + * @return + * @Description 议题:保存/修改分类 + * @Author sun + **/ + @Override + public void saveCategory(IssueSaveCategoryFormDTO formDTO) { + + //0.如果传入的分类集合为空不管是否存在过历史分类数据,只执行一次删除操作 + if(formDTO.getCategoryList().size()< NumConstant.ONE){ + baseDao.delByIssueId(formDTO.getIssueId()); + return; + } + + //1.查询议题所属客户和所属网格信息 + IssueEntity issue = issueService.selectById(formDTO.getIssueId()); + if (null == issue) { + throw new RenException(String.format("根据议题Id获取议题信息失败,issueId->%s", formDTO.getIssueId())); + } + + //2.批量查询分类信息 + List categoryIdList = formDTO.getCategoryList().stream().map(SaveIssueCategoryFormDTO::getId).collect(Collectors.toList()); + IssueProjectCategoryDictListFormDTO dictDto = new IssueProjectCategoryDictListFormDTO(); + dictDto.setCustomerId(formDTO.getCustomerId()); + dictDto.setCstegoryIdList(categoryIdList); + List categoryList = issueProjectCategoryDictService.getCategoryList(dictDto); + if (null == categoryList) { + throw new RenException(String.format("议题分类信息保存,根据分类Id获取分类信息失败")); + } + + //3.汇总批量新增数据 + List entityList = new ArrayList<>(); + formDTO.getCategoryList().forEach(ca -> { + IssueCategoryEntity entity = new IssueCategoryEntity(); + entity.setCustomerId(issue.getCustomerId()); + entity.setGridId(issue.getGridId()); + entity.setIssueId(formDTO.getIssueId()); + entity.setCategoryId(ca.getId()); + categoryList.forEach(cl -> { + if (ca.getId().equals(cl.getId())) { + entity.setCategoryPids(cl.getPids()); + entity.setCategoryCode(cl.getCategoryCode()); + } + }); + entityList.add(entity); + }); + + //4.根据议题Id删除可能存在的分类信息 + baseDao.delByIssueId(formDTO.getIssueId()); + + //5.批量保存议题分类信息 + if (!insertBatch(entityList)) { + throw new RenException(String.format("议题分类信息保存失败")); + } + + } + +} \ No newline at end of file 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 new file mode 100644 index 0000000000..62d39412c3 --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueProjectCategoryDictServiceImpl.java @@ -0,0 +1,453 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +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.utils.Result; +import com.epmet.dao.IssueCategoryDao; +import com.epmet.dao.IssueProjectCategoryDictDao; +import com.epmet.dao.IssueProjectRelationDao; +import com.epmet.dao.IssueProjectTagDictDao; +import com.epmet.dto.IssueCategoryDTO; +import com.epmet.dto.IssueDTO; +import com.epmet.dto.IssueProjectCategoryDictDTO; +import com.epmet.dto.ProjectCategoryDTO; +import com.epmet.dto.form.*; +import com.epmet.dto.result.*; +import com.epmet.entity.IssueProjectCategoryDictEntity; +import com.epmet.entity.IssueProjectTagDictEntity; +import com.epmet.feign.GovProjectOpenFeignClient; +import com.epmet.feign.OperCrmOpenFeignClient; +import com.epmet.project.dto.result.ProjectCategoryDictResultDTO; +import com.epmet.redis.IssueProjectCategoryDictRedis; +import com.epmet.redis.IssueProjectTagDictRedis; +import com.epmet.service.IssueProjectCategoryDictService; +import com.epmet.service.IssueProjectTagDictService; +import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.lang3.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.*; +import java.util.stream.Collectors; + +/** + * 议题项目分类字典 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-12-08 + */ +@Service +public class IssueProjectCategoryDictServiceImpl extends BaseServiceImpl implements IssueProjectCategoryDictService { + + private static Logger logger = LoggerFactory.getLogger(IssueProjectCategoryDictServiceImpl.class); + @Autowired + private IssueProjectCategoryDictRedis issueProjectCategoryDictRedis; + @Autowired + private IssueProjectRelationDao issueProjectRelationDao; + @Autowired + private IssueProjectTagDictService issueProjectTagDictService; + @Autowired + private IssueCategoryDao issueCategoryDao; + @Autowired + private GovProjectOpenFeignClient govProjectOpenFeignClient; + @Autowired + private OperCrmOpenFeignClient operCrmOpenFeignClient; + @Autowired + private IssueProjectTagDictDao issueProjectTagDictDao; + @Autowired + private IssueProjectTagDictRedis dictRedis; + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, IssueProjectCategoryDictDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, IssueProjectCategoryDictDTO.class); + } + + private QueryWrapper getWrapper(Map params) { + String id = (String) params.get(FieldConstant.ID_HUMP); + + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); + + return wrapper; + } + + @Override + public IssueProjectCategoryDictDTO get(String id) { + IssueProjectCategoryDictEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, IssueProjectCategoryDictDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(IssueProjectCategoryDictDTO dto) { + IssueProjectCategoryDictEntity entity = ConvertUtils.sourceToTarget(dto, IssueProjectCategoryDictEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(IssueProjectCategoryDictDTO dto) { + IssueProjectCategoryDictEntity entity = ConvertUtils.sourceToTarget(dto, IssueProjectCategoryDictEntity.class); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + + /** + * @param customerId + * @return + * @Description 客户分类列表查询,按分类升序排列,查询未被禁用的 + * @Author sun + **/ + @Override + public List categoryList(String customerId) { + List resultList = baseDao.selectCustomerCategoryList(customerId); + return resultList; + } + + /** + * @param formDTO + * @return + * @Description 批量查询分类信息 + * @Author sun + **/ + @Override + public List getCategoryList(IssueProjectCategoryDictListFormDTO formDTO) { + return baseDao.selectCategoryList(formDTO); + } + + /** + * @param formDTO + * @return + * @Description 查询项目所属客户和所属网格信息以及分类对应的分类信息 + * @Author sun + **/ + @Override + public ProjectIssueCategoryResultDTO getProjectAndCategoryInfo(ProjectSaveCategoryFormDTO formDTO) { + ProjectIssueCategoryResultDTO resultDTO = new ProjectIssueCategoryResultDTO(); + //1.根据项目id查询对应的议题基本信息 + IssueDTO dto = issueProjectRelationDao.selectProjectToIssue(formDTO.getProjectId()); + if (null == dto) { + throw new RenException(String.format("保存项目分类信息,获取项目对应的议题基本信息失败,projectId->%s", formDTO.getProjectId())); + } + ProjectIssueDTOResultDTO issueDTO = ConvertUtils.sourceToTarget(dto,ProjectIssueDTOResultDTO.class); + resultDTO.setIssueDTO(issueDTO); + //2.批量查询分类信息 + List categoryIdList = formDTO.getCategoryList().stream().map(SaveIssueCategoryFormDTO::getId).collect(Collectors.toList()); + IssueProjectCategoryDictListFormDTO dictDto = new IssueProjectCategoryDictListFormDTO(); + dictDto.setCustomerId(formDTO.getCustomerId()); + dictDto.setCstegoryIdList(categoryIdList); + List categoryList = getCategoryList(dictDto); + if (null == categoryList) { + throw new RenException(String.format("保存项目分类信息,根据分类Id获取分类信息失败")); + } + List list = ConvertUtils.sourceToTarget(categoryList,ProjectCategoryDTOResultDTO.class); + resultDTO.setCategoryList(list); + + return resultDTO; + } + + /** + * 客户分类标签数据初始化 + * + * @param formDTO + * @return void + * @author zhaoqifeng + * @date 2020/12/10 10:02 + */ + @Override + @Transactional(rollbackFor = Exception.class) + public void init(CategoryTagInitFormDTO formDTO) { + List list = baseDao.selectCategoryListByCustomer(formDTO.getCustomerId()); + if (CollectionUtils.isEmpty(list)) { + //分类初始化 + List categoryList = baseDao.selectCategoryListByCustomer("default"); + categoryList.forEach(item -> { + item.setCustomerId(formDTO.getCustomerId()); + }); + this.insertBatch(categoryList); + //标签初始化 + List tagList = issueProjectTagDictService.getTagListByCustomer("default"); + tagList.forEach(item -> { + item.setCustomerId(formDTO.getCustomerId()); + }); + issueProjectTagDictService.insertBatch(tagList); + } + } + + /** + * @Description 分类启用与禁用 + * @Author sun + **/ + @Override + @Transactional(rollbackFor = Exception.class) + public void isDisableCategory(IsDisableCategoryFormDTO formDTO) { + //1.查询客户分类信息 + IssueProjectCategoryDictDTO dto = baseDao.selectByCustomerId(formDTO.getCustomerId(), formDTO.getCategoryId()); + if (null == dto) { + throw new RuntimeException("未查询到客户分类信息!"); + } + //2.汇总二级分类Id集合 + //待修改的分类Id汇总 + List categoryList = new ArrayList<>(); + //待修改的二级分类Id汇总 + List secondList = new ArrayList<>(); + if ("1".equals(dto.getCategoryType())) { + //2-1.查询子类信息 + List subList = baseDao.selectSubCustomerCategoryDict(formDTO.getCustomerId(), formDTO.getCategoryId()); + secondList = subList.stream().map(sub -> sub.getId()).collect(Collectors.toList()); + categoryList.add(formDTO.getCategoryId()); + } else { + secondList.add(formDTO.getCategoryId()); + } + categoryList.addAll(secondList); + formDTO.setCategoryList(categoryList); + formDTO.setSecondCategorylist(secondList); + + //3.修改标签、分类表数据状态 + //修改分类数据 + if (baseDao.updateCustomerCategory(formDTO) < NumConstant.ONE) { + logger.error(String.format("修改分类信息状态失败,客户Id->%s,分类Id->%s", formDTO.getCustomerId(), formDTO.getCategoryId())); + throw new RuntimeException("分类信息修改失败!"); + } + //修改把二级分类下默认的标签数据 + issueProjectTagDictDao.updateCustomerTag(formDTO); + //4.修改缓存中标签状态 + dictRedis.updateTagAvailabilityBySecondCategoryIds(formDTO.getCustomerId(),formDTO.getSecondCategorylist(),formDTO.getType()); + } + + /** + * @Description 分类删除 + * 分类客户没有使用过的可以直接删除 包括子类删除,只要客户用过 不管什么状态都不能再删除,允许删除的也跟标签没关系,不删标签 + * @Author sun + **/ + @Override + @Transactional(rollbackFor = Exception.class) + public void delCategory(DelCategoryFormDTO formDTO) { + //1.查询分类信息 + IssueProjectCategoryDictDTO dto = baseDao.selectByCustomerId(formDTO.getCustomerId(), formDTO.getCategoryId()); + if (null == dto) { + throw new RuntimeException("未查询到客户分类信息!"); + } + //2.判断分类有没有被客户的议题、项目使用过 + formDTO.setLevel(dto.getCategoryType()); + //2-1.判断议题有无使用 + List issueList = issueCategoryDao.selectIssueList(formDTO); + //已使用,不允许删除 + if (null != issueList && issueList.size() > NumConstant.ZERO) { + throw new RenException(EpmetErrorCode.CUSTOMER_CATEGORY.getCode(), EpmetErrorCode.CUSTOMER_CATEGORY.getMsg()); + } + //2-2.判断项目有无使用 + Result> resultList = govProjectOpenFeignClient.getProjectCategoryList(formDTO); + if (!resultList.success()) { + throw new RenException(resultList.getCode(), resultList.getMsg()); + } + if (null != resultList.getData() && resultList.getData().size() > NumConstant.ZERO) { + throw new RenException(EpmetErrorCode.CUSTOMER_CATEGORY.getCode(), EpmetErrorCode.CUSTOMER_CATEGORY.getMsg()); + } + + //3.分类未被使用,则删除一级、二级分类,二级分类下默认有的标签不作处理 + if (baseDao.delCategory(formDTO) < NumConstant.ONE) { + logger.error(String.format("分类删除失败,客户Id->%s,分类Id->%s", formDTO.getCustomerId(), formDTO.getCategoryId())); + throw new RuntimeException("分类删除失败!"); + } + + } + + @Override + public List listCategoryDict(String customerId, String pid) { + return baseDao.selectListCategoryDict(customerId, pid); + } + + @Override + public Result saveFirstCategory(SecondCategoryFormDTO formDTO) { + // 分类名称在同一个客户下有效数据中不允许重复 + Integer numCategoryName = baseDao.isCategoryName(formDTO.getCustomerId(), formDTO.getCategoryName(), null,null); + if (NumConstant.ZERO < numCategoryName) { + throw new RenException(EpmetErrorCode.CATEGORY_NAME.getCode(), EpmetErrorCode.CATEGORY_NAME.getMsg()); + } + IssueProjectCategoryDictEntity entity = this.packageFirstCategoryDictEntity(formDTO); + baseDao.insert(entity); + return new Result().ok(entity.getId()); + } + + /** + * 一级分类 组装字段 + * + * @param formDTO + * @return com.epmet.entity.IssueProjectCategoryDictEntity + * @Author zhangyong + * @Date 10:46 2021-03-23 + **/ + private IssueProjectCategoryDictEntity packageFirstCategoryDictEntity(SecondCategoryFormDTO formDTO) { + IssueProjectCategoryDictEntity entity = new IssueProjectCategoryDictEntity(); + entity.setCustomerId(formDTO.getCustomerId()); + entity.setPid(NumConstant.ZERO_STR ); + entity.setPids(NumConstant.ZERO_STR ); + entity.setParentCategoryCode(NumConstant.ZERO_STR); + // 查询 当前客户下最大的一级分类数。 + Integer maxCategoryCode = baseDao.getMaxCategoryCode(formDTO.getCustomerId(), NumConstant.ZERO_STR); + if (NumConstant.ZERO == maxCategoryCode) { + maxCategoryCode = 1001; + } else { + maxCategoryCode++; + } + entity.setCategoryCode(String.valueOf(maxCategoryCode)); + + entity.setCategoryName(formDTO.getCategoryName()); + entity.setCategoryType(NumConstant.ONE_STR); + entity.setSort(formDTO.getSort()); + entity.setIsDisable("enable"); + return entity; + } + + @Override + public Result editFirstCategory(SecondCategoryFormDTO formDTO) { + if (StringUtils.isBlank(formDTO.getCategoryId())) { + throw new RenException("分类Id 不能为空"); + } + // 分类名称在同一个客户下有效数据中不允许重复 + Integer numCategoryName = baseDao.isCategoryName(formDTO.getCustomerId(), formDTO.getCategoryName(), null, formDTO.getCategoryId()); + if (NumConstant.ZERO < numCategoryName) { + throw new RenException(EpmetErrorCode.CATEGORY_NAME.getCode(), EpmetErrorCode.CATEGORY_NAME.getMsg()); + } + IssueProjectCategoryDictEntity entity = new IssueProjectCategoryDictEntity(); + entity.setCustomerId(formDTO.getCustomerId()); + entity.setCategoryName(formDTO.getCategoryName()); + entity.setSort(formDTO.getSort()); + entity.setId(formDTO.getCategoryId()); + baseDao.updateIssueProjectCategoryDict(entity); + return new Result<>(); + } + + @Override + public Result saveSecondCategory(SecondCategoryFormDTO formDTO) { + // 分类名称在同一个客户下同一 一级分类下有效数据中不允许重复 + Integer numCategoryName = baseDao.isCategoryName(formDTO.getCustomerId(), formDTO.getCategoryName(), formDTO.getParentCategoryId(), null); + if (NumConstant.ZERO < numCategoryName) { + throw new RenException(EpmetErrorCode.CATEGORY_NAME.getCode(), EpmetErrorCode.CATEGORY_NAME.getMsg()); + } + IssueProjectCategoryDictEntity entity = this.packageSecondCategoryDictEntity(formDTO); + baseDao.insert(entity); + return new Result().ok(entity.getId()); + } + + /** + * 二级分类 组装字段 + * + * @param formDTO + * @return com.epmet.entity.IssueProjectCategoryDictEntity + * @Author zhangyong + * @Date 10:46 2021-03-23 + **/ + private IssueProjectCategoryDictEntity packageSecondCategoryDictEntity(SecondCategoryFormDTO formDTO) { + IssueProjectCategoryDictEntity entity = new IssueProjectCategoryDictEntity(); + entity.setCustomerId(formDTO.getCustomerId()); + entity.setPid(formDTO.getParentCategoryId()); + entity.setPids(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()); + // 查询 当前客户下最大的一级分类数。 + Integer maxCategoryCode = baseDao.getMaxCategoryCode(formDTO.getCustomerId(), parentCategoryCode.getCategoryCode()); + if (NumConstant.ZERO == maxCategoryCode) { + maxCategoryCode = Integer.valueOf(parentCategoryCode.getCategoryCode() + "1001"); + } else { + maxCategoryCode++; + } + entity.setCategoryCode(String.valueOf(maxCategoryCode)); + + entity.setCategoryName(formDTO.getCategoryName()); + entity.setCategoryType(NumConstant.TWO_STR); + entity.setSort(formDTO.getSort()); + entity.setIsDisable("enable"); + return entity; + } + + @Override + public Result editSecondCategory(SecondCategoryFormDTO formDTO) { + if (StringUtils.isBlank(formDTO.getCategoryId())) { + throw new RenException("分类Id 不能为空"); + } + // 分类名称在同一个客户下同一 一级分类下有效数据中不允许重复 + Integer numCategoryName = baseDao.isCategoryName(formDTO.getCustomerId(), formDTO.getCategoryName(), formDTO.getParentCategoryId(), formDTO.getCategoryId()); + if (NumConstant.ZERO < numCategoryName) { + throw new RenException(EpmetErrorCode.CATEGORY_NAME.getCode(), EpmetErrorCode.CATEGORY_NAME.getMsg()); + } + IssueProjectCategoryDictEntity entity = new IssueProjectCategoryDictEntity(); + entity.setCustomerId(formDTO.getCustomerId()); + entity.setCategoryName(formDTO.getCategoryName()); + entity.setSort(formDTO.getSort()); + entity.setId(formDTO.getCategoryId()); + baseDao.updateIssueProjectCategoryDict(entity); + return new Result<>(); + } + + @Override + public List customerCategoryList(String customerId) { + LinkedList parentCategoryDict = baseDao.selectListAllCategoryDict(customerId, NumConstant.ZERO_STR); + LinkedList childrenCategoryDict = baseDao.selectListAllCategoryDict(customerId, NumConstant.ONE_STR); + + for (CustomerCategoryResultDTO p : parentCategoryDict) { + List children = new ArrayList<>(); + for (CustomerCategoryResultDTO c : childrenCategoryDict) { + if (p.getCategoryId().equals(c.getPid())) { + CustomerCategoryResultDTO dto = new CustomerCategoryResultDTO(); + dto.setCategoryId(c.getCategoryId()); + dto.setCategoryName(c.getCategoryName()); + dto.setSort(c.getSort()); + dto.setIsDisable(c.getIsDisable()); + dto.setPid(c.getPid()); + children.add(dto); + } + } + p.setChildren(children); + } + return parentCategoryDict; + } +} diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueProjectTagDictServiceImpl.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueProjectTagDictServiceImpl.java new file mode 100644 index 0000000000..cf5af822da --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueProjectTagDictServiceImpl.java @@ -0,0 +1,217 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +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.constant.GovIssueRedisKeys; +import com.epmet.dao.IssueProjectTagDictDao; +import com.epmet.dto.IssueProjectTagDictDTO; +import com.epmet.dto.form.CategoryTagInitFormDTO; +import com.epmet.dto.form.TagDifferentSetFormDTO; +import com.epmet.dto.form.TagListFormDTO; +import com.epmet.dto.result.IssueCategoryTagResultDTO; +import com.epmet.dto.result.TagListResultDTO; +import com.epmet.entity.IssueProjectTagDictEntity; +import com.epmet.redis.IssueProjectTagDictRedis; +import com.epmet.service.IssueProjectCategoryDictService; +import com.epmet.service.IssueProjectTagDictService; +import com.epmet.utils.ModuleConstants; +import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.lang3.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.*; +import java.util.stream.Collectors; + +/** + * 议题、项目标签字典表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-12-08 + */ +@Service +public class IssueProjectTagDictServiceImpl extends BaseServiceImpl implements IssueProjectTagDictService { + + private static Logger logger = LoggerFactory.getLogger(IssueProjectTagDictServiceImpl.class); + @Autowired + private IssueProjectTagDictRedis issueProjectTagDictRedis; + @Autowired + private IssueProjectCategoryDictService issueProjectCategoryDictService; + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, IssueProjectTagDictDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, IssueProjectTagDictDTO.class); + } + + private QueryWrapper getWrapper(Map params){ + String id = (String)params.get(FieldConstant.ID_HUMP); + + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); + + return wrapper; + } + + @Override + public IssueProjectTagDictDTO get(String id) { + IssueProjectTagDictEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, IssueProjectTagDictDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(IssueProjectTagDictDTO dto) { + IssueProjectTagDictEntity entity = ConvertUtils.sourceToTarget(dto, IssueProjectTagDictEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(IssueProjectTagDictDTO dto) { + IssueProjectTagDictEntity entity = ConvertUtils.sourceToTarget(dto, IssueProjectTagDictEntity.class); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + + /** + * 标签列表 + * + * @param tokenDto + * @param formDTO + * @return com.epmet.dto.result.TagListResultDTO + * @author zhaoqifeng + * @date 2020/12/9 15:41 + */ + @Override + public TagListResultDTO getTagList(TokenDto tokenDto, TagListFormDTO formDTO) { + TagListResultDTO result = new TagListResultDTO(); + Map> map = issueProjectTagDictRedis.getDefaultTagsSortedByCategoryAndCustomizedTagsOrderByRank(tokenDto.getCustomerId(), + formDTO.getCategoryIdList()); + result.setDefaulted(map.get(ModuleConstants.DEFAULT_TAG_CATEGORY_NAME)); + List list = map.get(ModuleConstants.CUSTOMIZED_TAG_CATEGORY_NAME); + if (CollectionUtils.isNotEmpty(list)) { + result.setCustomized(list.stream().limit(NumConstant.ONE_THOUSAND).collect(Collectors.toList())); + } else { + result.setCustomized(Collections.emptyList()); + } + return result; + } + + /** + * 获取默认标签配置 + * + * @return java.util.List + * @author zhaoqifeng + * @date 2020/12/10 10:12 + */ + @Override + public List getTagListByCustomer(String customerId) { + return baseDao.selectTagListByCustomer(customerId); + } + + /** + * @Description 更新标签热度 数据库/缓存 + * @param param + * @return void + * @author wangc + * @date 2020.12.11 14:00 + */ + @Override + @Transactional(rollbackFor = Exception.class) + public void updateTagHeat(TagDifferentSetFormDTO param) { + //key : 1(plus) 0(minus) + //value : { + // key : redisKey + // value : List + // } + Map>> redisParam = new HashMap<>(); + + if(CollectionUtils.isNotEmpty(param.getMinus())){ + List tags = baseDao.selectTagsByCustomerIdAndTagIds(param.getCustomerId(),param.getMinus()); + if(CollectionUtils.isNotEmpty(tags)){ + Map> value = new HashMap<>(); + tags.forEach(tag -> { + String redisKey = GovIssueRedisKeys.getGovernmentTagKey(param.getCustomerId(),tag.getCategoryId()); + IssueCategoryTagResultDTO cache = new IssueCategoryTagResultDTO(); + cache.setId(tag.getId());cache.setName(tag.getTagName());cache.setIsDisable(tag.getIsDisable()); + if(CollectionUtils.isNotEmpty(value.get(redisKey))){ + value.get(redisKey).add(cache); + }else{ + List list = new LinkedList<>(); + list.add(cache); + value.put(redisKey,list); + } + }); + if(!value.isEmpty()) redisParam.put(NumConstant.ZERO_STR,value); + baseDao.updateTagUsage(param.getMinus(),param.getCustomerId(),NumConstant.ONE_NEG); + } + } + + if(CollectionUtils.isNotEmpty(param.getPlus())){ + List tags = baseDao.selectTagsByCustomerIdAndTagIds(param.getCustomerId(),param.getPlus()); + if(CollectionUtils.isNotEmpty(tags)){ + Map> value = new HashMap<>(); + tags.forEach(tag -> { + String redisKey = GovIssueRedisKeys.getGovernmentTagKey(param.getCustomerId(),tag.getCategoryId()); + IssueCategoryTagResultDTO cache = new IssueCategoryTagResultDTO(); + cache.setId(tag.getId());cache.setName(tag.getTagName());cache.setIsDisable(tag.getIsDisable()); + if(CollectionUtils.isNotEmpty(value.get(redisKey))){ + value.get(redisKey).add(cache); + }else{ + List list = new LinkedList<>(); + list.add(cache); + value.put(redisKey,list); + } + }); + if(!value.isEmpty()) redisParam.put(NumConstant.ONE_STR,value); + baseDao.updateTagUsage(param.getPlus(),param.getCustomerId(),NumConstant.ONE); + } + } + + issueProjectTagDictRedis.batchIncrScore(redisParam); + } + +} \ No newline at end of file diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueServiceImpl.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueServiceImpl.java index b7d6c57015..25c1322338 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueServiceImpl.java +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueServiceImpl.java @@ -112,6 +112,12 @@ public class IssueServiceImpl extends BaseServiceImpl imp private EpmetUserOpenFeignClient userOpenFeignClient; @Autowired private EpmetMessageOpenFeignClient epmetMessageOpenFeignClient; + @Autowired + private IssueCategoryService issueCategoryService; + @Autowired + private IssueTagsService issueTagsService; + @Autowired + private IssueProjectTagDictService issueProjectTagDictService; @@ -901,6 +907,129 @@ public class IssueServiceImpl extends BaseServiceImpl imp } } + /** + * 议题管理-议题转项目-增加分类标签功能 + * + * @param formDTO + * @return void + * @author zhaoqifeng + * @date 2020/12/9 10:01 + */ + @Override + public void shiftProjectV2(ShiftProjectFormDTO formDTO) { + + //获取议题分类 + List categoryList = issueCategoryService.getCategoryByIssue(formDTO.getIssueId()); + if (CollectionUtils.isEmpty(categoryList)) { + throw new RenException(EpmetErrorCode.CATEGORY_IS_NULL.getCode()); + } + + //公开回复内容审核 + if (StringUtils.isNotBlank(formDTO.getPublicReply())) { + TextScanParamDTO textScanParamDTO = new TextScanParamDTO(); + TextTaskDTO taskDTO = new TextTaskDTO(); + taskDTO.setDataId(UUID.randomUUID().toString().replace("-", "")); + taskDTO.setContent(formDTO.getPublicReply()); + textScanParamDTO.getTasks().add(taskDTO); + Result textSyncScanResult = ScanContentUtils.textSyncScan(scanApiUrl.concat(textSyncScanMethod), textScanParamDTO); + if (!textSyncScanResult.success()) { + throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode()); + } else { + if (!textSyncScanResult.getData().isAllPass()) { + throw new RenException(EpmetErrorCode.TEXT_SCAN_FAILED.getCode()); + } + } + } + + //因需要保证议题表中的转项目时间与创建项目时间一致 因此先新增项目数据再更新议题数据 + //1:查询议题数据 + IssueEntity entity = baseDao.selectById(formDTO.getIssueId()); + if (null == entity) { + throw new RenException(IssueConstant.SELECT_EXCEPTION); + } + if (IssueConstant.ISSUE_SHIFT_PROJECT.equals(entity.getIssueStatus())) { + throw new RenException(IssueConstant.ISSUE_SHIFT_PROJECT_EXCEPTION); + } + if (!IssueConstant.ISSUE_VOTING.equals(entity.getIssueStatus())) { + throw new RenException(IssueConstant.ISSUE_VOTING_EXCEPTION); + } + formDTO.setIssueDTO(ConvertUtils.sourceToTarget(entity, IssueDTO.class)); + + //2:调用resi-group查询话题创建人数据(目前议题来源只有来自话题),为了到项目服务初始数据以及发送消息使用 + Result resultTopicDTO = resiGroupFeignClient.getTopicById(entity.getSourceId()); + if (!resultTopicDTO.success() || null == resultTopicDTO.getData()) { + throw new RenException(IssueConstant.SELECT_TOPIC_EXCEPTION); + } + ResiTopicDTO topicDTO = resultTopicDTO.getData(); + formDTO.setTopicDTO(topicDTO); + + //3:调用gov-project服务,新增项目各业务表初始数据 + formDTO.setCategoryList(categoryList); + List tagList = issueTagsService.getTagsByIssue(formDTO.getIssueId()); + formDTO.setTagList(tagList); + Result resultDTO = govProjectFeignClient.issueShiftProject(formDTO); + if (!resultDTO.success() || null == resultDTO.getData()) { + logger.error(resultDTO.getInternalMsg()); + throw new RenException(IssueConstant.GOV_PRJECT_EXCEPTION); + } + IssueProjectResultDTO issueProjectResultDTO = resultDTO.getData(); + //更新项目对标签的引用次数 + if (CollectionUtils.isNotEmpty(tagList)) { + tagList.forEach(item -> { + IssueProjectTagDictDTO tag = issueProjectTagDictService.get(item.getTagId()); + tag.setProjectUseCount(tag.getProjectUseCount() + NumConstant.ONE); + issueProjectTagDictService.update(tag); + }); + } + + //4:更新议题相关业务表数据 + //4.1:更新议题表数据 + entity.setIssueStatus(IssueConstant.ISSUE_SHIFT_PROJECT); + entity.setShiftedTime(issueProjectResultDTO.getShiftedTime()); + baseDao.updateById(entity); + + //4.2:议题处理进展表新增数据 + IssueProcessEntity processEntity = new IssueProcessEntity(); + processEntity.setIssueId(entity.getId()); + processEntity.setIssueStatus(IssueConstant.ISSUE_SHIFT_PROJECT); + processEntity.setOrgType(IssueConstant.ISSUE_GRID); + processEntity.setOrgId(entity.getGridId()); + processEntity.setOrgName(issueProjectResultDTO.getOrgName()); + issueProcessDao.insert(processEntity); + + //4.3:议题项目关系表新增数据 + IssueProjectRelationEntity relationEntity = new IssueProjectRelationEntity(); + relationEntity.setIssueId(entity.getId()); + relationEntity.setProjectId(issueProjectResultDTO.getProjectId()); + issueProjectRelationDao.insert(relationEntity); + + //5:调用epmet-message服务,给居民端话题创建人、议题发起人以及政府端工作人员发送消息 + if (!shiftProjectMessage(issueProjectResultDTO, formDTO, entity).success()) { + throw new RenException(IssueConstant.SAVE_MSG_EXCEPTION); + } + //5-1:2020.10.26 添加给居民端话题创建人、议题发起人以及政府端工作人员推送微信订阅消息功能 sun + if (!wxmpShiftProjectMessage(issueProjectResultDTO, formDTO, entity).success()) { + logger.error("议题转项目,推送微信订阅消息失败!"); + } + + //6:缓存中网格下表决中的议题总数减1 + govIssueRedis.subtractWorkGrassrootsIssueRedDotValue(entity.getGridId()); + try{ + issueVoteStatisticalService.syncVotingCacheToDbByParams(formDTO.getIssueId(),entity.getGridId(),null); + }catch(RenException e){ + logger.error(e.getInternalMsg()); + } + + + //7:发送话题转议题积分事件 + TopicEventFormDTO eventParam = new TopicEventFormDTO(); + eventParam.setTopicId(entity.getSourceId()); + eventParam.setEvent(EventEnum.TOPIC_SHIFTED_TO_PROJECT); + if(!resiGroupOpenFeignClient.sendEvent(eventParam).success()){ + logger.warn("com.epmet.service.impl.IssueServiceImpl.shiftProjectV2,话题被转为项目积分事件发送失败,参数:{}", JSON.toJSONString(formDTO)); + } + } + /** * @Description 议题转项目时给话题创建人、议题发起人、勾选的工作人员分别推送消息 * @author sun 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 new file mode 100644 index 0000000000..1d24217321 --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueTagsServiceImpl.java @@ -0,0 +1,247 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +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.dao.IssueDao; +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.form.IssueTagFormDTO; +import com.epmet.dto.form.IssueTagsFormDTO; +import com.epmet.dto.form.IssueTagsSaveFormDTO; +import com.epmet.dto.result.AddTagResultDTO; +import com.epmet.dto.result.IssueCategoryTagResultDTO; +import com.epmet.entity.IssueEntity; +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; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.CollectionUtils; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +import static java.util.stream.Collectors.toList; + +/** + * 议题关联标签表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-12-08 + */ +@Service +public class IssueTagsServiceImpl extends BaseServiceImpl implements IssueTagsService { + + @Autowired + private IssueTagsRedis issueTagsRedis; + @Autowired + private IssueProjectTagDictDao issueProjectTagDictDao; + @Autowired + private IssueProjectTagDictRedis dictRedis; + @Autowired + private IssueDao issueDao; + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, IssueTagsDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, IssueTagsDTO.class); + } + + private QueryWrapper getWrapper(Map params){ + String id = (String)params.get(FieldConstant.ID_HUMP); + + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); + + return wrapper; + } + + @Override + public IssueTagsDTO get(String id) { + IssueTagsEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, IssueTagsDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(IssueTagsDTO dto) { + IssueTagsEntity entity = ConvertUtils.sourceToTarget(dto, IssueTagsEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(IssueTagsDTO dto) { + IssueTagsEntity entity = ConvertUtils.sourceToTarget(dto, IssueTagsEntity.class); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + + /** + * 获取议题标签 + * + * @param issueId + * @return java.util.List + * @author zhaoqifeng + * @date 2020/12/9 14:07 + */ + @Override + public List getTagsByIssue(String issueId) { + return baseDao.selectTagsByIssue(issueId); + } + + /** + * @Description 标签添加 + * @Param form + * @author zxc + * @date 2020/12/9 下午3:29 + */ + @Override + @Transactional(rollbackFor = Exception.class) + public AddTagResultDTO addTag(AddTagFormDTO form, TokenDto tokenDto) { + form.setCustomerId(tokenDto.getCustomerId()); + String tagId = baseDao.selectTagNameCount(form); + if (StringUtils.isNotBlank(tagId)){ + return new AddTagResultDTO(tagId); + } + IssueProjectTagDictEntity entity = new IssueProjectTagDictEntity(); + entity.setCustomerId(form.getCustomerId()); + entity.setCategoryId(ModuleConstants.CUSTOMIZED_TAG_CATEGORY_NAME); + entity.setTagName(form.getTagName()); + entity.setIsDefault(NumConstant.ONE_STR); + entity.setIssueUseCount(NumConstant.ZERO); + entity.setProjectUseCount(NumConstant.ZERO); + entity.setIsDisable(ModuleConstants.ID_ENABLE); + issueProjectTagDictDao.insert(entity); + IssueCategoryTagResultDTO issueCategoryTagResultDTO = new IssueCategoryTagResultDTO(); + issueCategoryTagResultDTO.setId(entity.getId()); + issueCategoryTagResultDTO.setName(entity.getTagName()); + issueCategoryTagResultDTO.setIsDisable(entity.getIsDisable()); + dictRedis.addIssueProjectTag(entity.getCustomerId(),entity.getCategoryId(),issueCategoryTagResultDTO); + return new AddTagResultDTO(entity.getId()); + } + + /** + * @Description 议题标签保存/修改 + * @Param form + * @Param tokenDto + * @author zxc + * @date 2020/12/10 上午9:37 + */ + @Override + @Transactional(rollbackFor = Exception.class) + public void issueTagSave(IssueTagsSaveFormDTO form, TokenDto tokenDto) { + String customerId = tokenDto.getCustomerId(); + // 根据议题ID查询此议题原来有哪些标签 + List tags = baseDao.selectTagsByIssueId(form.getIssueId()); + if (CollectionUtils.isEmpty(form.getTagList())){ + // 清空此议题的标签 + if (!CollectionUtils.isEmpty(tags)){ + tags.forEach(t -> { + // 缓存标签 -1 + IssueCategoryTagResultDTO issueCategoryTagResultDTO = new IssueCategoryTagResultDTO(); + issueCategoryTagResultDTO.setName(t.getName()); + issueCategoryTagResultDTO.setId(t.getId()); + issueCategoryTagResultDTO.setIsDisable(t.getIsDisable()); + dictRedis.editTagUseCount(customerId,t.getCategoryId(),issueCategoryTagResultDTO,NumConstant.ONE_STR); + }); + // 数据库有关标签使用次数 -1 0:+1 ; 1:-1; + issueProjectTagDictDao.updateTagsUseCount(tags,customerId,NumConstant.ONE_STR); + } + // 删除数据库有关此议题标签 + baseDao.deleteTagsByIssueId(form.getIssueId()); + return; + } + // 不为空时走这 + List selectTags = form.getTagList(); + List newTags = issueProjectTagDictDao.selectTagId(selectTags); + IssueEntity issueEntity = issueDao.selectById(form.getIssueId()); + if (!CollectionUtils.isEmpty(newTags)){ + // 需要删除的标签 + List delList = tags.stream().filter(tag -> !newTags.contains(tag)).collect(toList()); + if (!CollectionUtils.isEmpty(delList)){ + delList.forEach(d -> { + IssueCategoryTagResultDTO issueCategoryTagResultDTO = new IssueCategoryTagResultDTO(); + issueCategoryTagResultDTO.setName(d.getName()); + issueCategoryTagResultDTO.setId(d.getId()); + issueCategoryTagResultDTO.setIsDisable(d.getIsDisable()); + dictRedis.editTagUseCount(customerId,d.getCategoryId(),issueCategoryTagResultDTO,NumConstant.ONE_STR); + }); + // 数据库有关标签使用次数 -1 0:+1 ; 1:-1; + issueProjectTagDictDao.updateTagsUseCount(delList,customerId,NumConstant.ONE_STR); + } + // 需要新增的标签 + List addList = newTags.stream().filter(tag -> !tags.contains(tag)).collect(toList()); + if (!CollectionUtils.isEmpty(addList)){ + addList.forEach(a -> { + // 缓存标签+1 + IssueCategoryTagResultDTO issueCategoryTagResultDTO = new IssueCategoryTagResultDTO(); + issueCategoryTagResultDTO.setName(a.getName()); + issueCategoryTagResultDTO.setId(a.getId()); + issueCategoryTagResultDTO.setIsDisable(a.getIsDisable()); + dictRedis.editTagUseCount(customerId,a.getCategoryId(),issueCategoryTagResultDTO,NumConstant.ZERO_STR); + }); + // 数据库对应标签 议题使用次数 +1 + issueProjectTagDictDao.updateTagsUseCount(addList,customerId,NumConstant.ZERO_STR); + } + // 删除数据库有关此议题标签 + baseDao.deleteTagsByIssueId(form.getIssueId()); + // 新增最新议题标签 + List needInsert = ConvertUtils.sourceToTarget(newTags, IssueTagsFormDTO.class); + needInsert.forEach(n -> { + n.setCustomerId(customerId); + n.setGridId(issueEntity.getGridId()); + n.setIssueId(form.getIssueId()); + }); + baseDao.insertNewTags(needInsert); + } + } + +} \ No newline at end of file diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueVoteStatisticalServiceImpl.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueVoteStatisticalServiceImpl.java index 258f91bd74..5cb0fc1e02 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueVoteStatisticalServiceImpl.java +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueVoteStatisticalServiceImpl.java @@ -519,6 +519,8 @@ public class IssueVoteStatisticalServiceImpl extends BaseServiceImpl + + + + + + + + + + + + + + DELETE + FROM + issue_category + WHERE + issue_id = #{issueId} + + + \ No newline at end of file diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueProjectCategoryDictDao.xml b/epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueProjectCategoryDictDao.xml new file mode 100644 index 0000000000..3a29df5f14 --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueProjectCategoryDictDao.xml @@ -0,0 +1,248 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + UPDATE issue_project_category_dict + SET del_flag = '1', + updated_by = #{userId}, + updated_time = NOW() + WHERE + customer_id = #{customerId} + + AND id = #{categoryId} OR pid = #{categoryId} + + + AND id = #{categoryId} + + + + + UPDATE issue_project_category_dict + SET is_disable = #{type}, + updated_by = #{userId}, + updated_time = NOW() + WHERE + customer_id = #{customerId} + + id = #{ids} + + + + + + + + + + + + UPDATE issue_project_category_dict + SET + + PID = #{pid}, + + + PIDS = #{pids}, + + + PARENT_CATEGORY_CODE = #{parentCategoryCode}, + + + CATEGORY_CODE = #{categoryCode}, + + + CATEGORY_NAME = #{categoryName}, + + + CATEGORY_TYPE = #{categoryType}, + + + + SORT = #{sort}, + + + IS_DISABLE = #{isDisable}, + + UPDATED_TIME = NOW() + WHERE + customer_id = #{customerId} AND id = #{id} AND DEL_FLAG = '0' + + diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueProjectRelationDao.xml b/epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueProjectRelationDao.xml index ae7ee4b255..44dac4af6c 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueProjectRelationDao.xml +++ b/epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueProjectRelationDao.xml @@ -46,4 +46,16 @@ ) + + \ No newline at end of file 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 new file mode 100644 index 0000000000..6e63c32fab --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueProjectTagDictDao.xml @@ -0,0 +1,218 @@ + + + + + + + + UPDATE issue_project_tag_dict + + SET ISSUE_USE_COUNT = (CASE WHEN ISSUE_USE_COUNT = 0 THEN 0 ELSE (ISSUE_USE_COUNT - 1) END) + + + SET ISSUE_USE_COUNT = ISSUE_USE_COUNT + 1 + + + DEL_FLAG = 0 + AND + + id = #{t.id} + + + + + + UPDATE issue_project_tag_dict + SET issue_use_count = (CASE + WHEN issue_use_count IS NULL THEN IF(#{score} > 0 ,#{score} ,0) + WHEN issue_use_count 0 THEN 0 + ELSE issue_use_count + #{score} END) + + del_flag = 0 + AND + customer_id = #{customerId} + + id = #{tagId} + + + + + + + + + + + + + + + + + + + + + + UPDATE issue_project_tag_dict + SET is_disable = #{type}, + updated_by = #{userId}, + updated_time = NOW() + WHERE + customer_id = #{customerId} + + category_id = #{ids} + + + + \ No newline at end of file diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueTagsDao.xml b/epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueTagsDao.xml new file mode 100644 index 0000000000..064a02b31e --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueTagsDao.xml @@ -0,0 +1,94 @@ + + + + + + + + + + + + + + + + + DELETE FROM issue_tags + WHERE DEL_FLAG = 0 + AND ISSUE_ID = #{issueId} + + + + + + + + INSERT INTO issue_tags ( ID, CUSTOMER_ID, GRID_ID, ISSUE_ID, TAG_ID, TAG_NAME, DEL_FLAG, REVISION, CREATED_BY, CREATED_TIME, UPDATED_BY, UPDATED_TIME ) + VALUES + + ( + REPLACE ( UUID(), '-', '' ), + #{l.customerId}, + #{l.gridId}, + #{l.issueId}, + #{l.tagId}, + #{l.name}, + #{l.delFlag}, + #{l.revision}, + #{l.createdBy}, + NOW(), + #{l.updatedBy}, + NOW() + ) + + + + \ No newline at end of file diff --git a/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/ProjectCategoryDTO.java b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/ProjectCategoryDTO.java new file mode 100644 index 0000000000..cbce91656e --- /dev/null +++ b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/ProjectCategoryDTO.java @@ -0,0 +1,101 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + + +/** + * 项目所属分类表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-12-08 + */ +@Data +public class ProjectCategoryDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + private String id; + + /** + * 客户id + */ + private String customerId; + + /** + * 来源网格id + */ + private String gridId; + + /** + * 项目id + */ + private String projectId; + + /** + * 分类id + */ + private String categoryId; + + /** + * 分类对应的所有上级,英文逗号隔开 + */ + private String categoryPids; + + /** + * 分类编码,分类编码+customer_id唯一 + */ + private String categoryCode; + + /** + * 删除标识 0未删除、1已删除 + */ + private String delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} \ No newline at end of file diff --git a/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/ProjectTagsDTO.java b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/ProjectTagsDTO.java new file mode 100644 index 0000000000..1cc47c4bb6 --- /dev/null +++ b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/ProjectTagsDTO.java @@ -0,0 +1,91 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + + +/** + * 项目关联标签表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-12-08 + */ +@Data +public class ProjectTagsDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键ID + */ + private String id; + + /** + * 客户ID + */ + private String customerId; + + /** + * 项目ID + */ + private String projectId; + + /** + * 标签ID + */ + private String tagId; + + /** + * 标签名称 + */ + private String tagName; + + /** + * 删除标识 0.未删除 1.已删除 + */ + private Integer delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} \ No newline at end of file diff --git a/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/DelCategoryFormDTO.java b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/DelCategoryFormDTO.java new file mode 100644 index 0000000000..48ac7e6404 --- /dev/null +++ b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/DelCategoryFormDTO.java @@ -0,0 +1,40 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; +import java.util.List; + +/** + * 分类删除-接口入参 + * @Author sun + */ +@Data +public class DelCategoryFormDTO implements Serializable { + + private static final long serialVersionUID = 2599592072265715951L; + public interface DelCategory{} + + /** + * 客户Id + */ + @NotBlank(message = "客户ID不能为空",groups = {DelCategory.class}) + private String customerId; + /** + * 分类Id + */ + @NotBlank(message = "分类ID不能为空",groups = {DelCategory.class}) + private String categoryId; + /** + * 分类级别 1:一类 2:二类 + */ + private String level; + + /** + * token中用户 + */ + private String userId; + + +} diff --git a/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/IsDisableCategoryFormDTO.java b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/IsDisableCategoryFormDTO.java new file mode 100644 index 0000000000..ccd91a49c5 --- /dev/null +++ b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/IsDisableCategoryFormDTO.java @@ -0,0 +1,49 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; +import java.util.List; + +/** + * 议题:保存/修改分类-接口入参 + * @Author sun + */ +@Data +public class IsDisableCategoryFormDTO implements Serializable { + + private static final long serialVersionUID = 2599592072265715951L; + public interface IsDisableCategory{} + /** + * 客户Id + */ + @NotBlank(message = "客户ID不能为空",groups = {IsDisableCategory.class}) + private String customerId; + /** + * 分类Id + */ + @NotBlank(message = "分类ID不能为空",groups = {IsDisableCategory.class}) + private String categoryId; + /** + * 操作类型(启用:enable 禁用:disable) + */ + @NotBlank(message = "是否启用类型不能为空",groups = {IsDisableCategory.class}) + private String type; + + /** + * 一类、二类分类Id集合 + */ + private List categoryList; + + /** + * 二类分类Id集合 + */ + private List secondCategorylist; + + /** + * token中用户 + */ + private String userId; + +} diff --git a/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/IssueProjectCategoryDictListFormDTO.java b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/IssueProjectCategoryDictListFormDTO.java new file mode 100644 index 0000000000..ac2903fe32 --- /dev/null +++ b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/IssueProjectCategoryDictListFormDTO.java @@ -0,0 +1,25 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + * 批量查询分类信息-接口入参 + * @Author sun + */ +@Data +public class IssueProjectCategoryDictListFormDTO implements Serializable { + + private static final long serialVersionUID = 2599592072265715951L; + /** + * 客户Id + */ + private String customerId; + /** + * 分类Id集合 + */ + private List cstegoryIdList; + +} diff --git a/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/ProjectCategoryTagListFormDTO.java b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/ProjectCategoryTagListFormDTO.java new file mode 100644 index 0000000000..34b2543486 --- /dev/null +++ b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/ProjectCategoryTagListFormDTO.java @@ -0,0 +1,32 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; +import java.util.List; + +/** + * 获取议题的分类、标签列表-接口入参 + * @Author sun + */ +@Data +public class ProjectCategoryTagListFormDTO implements Serializable { + + private static final long serialVersionUID = 2599592072265715951L; + /** + * 客户ID + */ + private String customerId; + + @NotBlank(message = "议题ID不能为空",groups = {ProjectCategoryTagListFormDTO.CategoryTag.class}) + private String projectId; + /** + * 分类Id + */ + private List categoryIdList; + public interface CategoryTag{} + + + +} diff --git a/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/ProjectSaveCategoryFormDTO.java b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/ProjectSaveCategoryFormDTO.java new file mode 100644 index 0000000000..34a8732be5 --- /dev/null +++ b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/ProjectSaveCategoryFormDTO.java @@ -0,0 +1,34 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; +import java.util.List; + +/** + * 议题:保存/修改分类-接口入参 + * @Author sun + */ +@Data +public class ProjectSaveCategoryFormDTO implements Serializable { + + private static final long serialVersionUID = 2599592072265715951L; + /** + * 项目Id + */ + @NotBlank(message = "项目ID不能为空",groups = {SaveCategory.class}) + private String projectId; + /** + * 议题分类集合 + */ + private List categoryList; + + /** + * 客户Id + */ + private String customerId; + + public interface SaveCategory{} + +} diff --git a/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/ProjectTagHookFormDTO.java b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/ProjectTagHookFormDTO.java new file mode 100644 index 0000000000..983dec0c1a --- /dev/null +++ b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/ProjectTagHookFormDTO.java @@ -0,0 +1,43 @@ +package com.epmet.dto.form; + +import com.epmet.dto.result.ProjectCategoryTagResultDTO; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; +import java.util.List; + +/** + * @Description 项目-标签-钩子入参 + * @ClassName ProjectTagHookFormDTO + * @Auth wangc + * @Date 2020-12-11 11:02 + */ +@Data +public class ProjectTagHookFormDTO implements Serializable { + private static final long serialVersionUID = 1432932825980640139L; + + /** + * 项目Id + */ + @NotBlank(message = "项目Id不能为空") + private String projectId; + + /** + * 标签列表 标签Id 标签Name + * 为空表示清除项目的标签信息 + */ + private List tagList; + + /** + * 客户Id,从token中获取 + */ + @NotBlank(message = "客户Id不能为空") + private String customerId; + + /** + * 工作人员Id,从token中获取 + */ + @NotBlank(message = "工作人员Id不能为空") + private String staffId; +} diff --git a/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/SaveIssueCategoryFormDTO.java b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/SaveIssueCategoryFormDTO.java new file mode 100644 index 0000000000..7c9a491004 --- /dev/null +++ b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/SaveIssueCategoryFormDTO.java @@ -0,0 +1,26 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import java.io.Serializable; + +/** + * 议题:保存/修改分类-接口入参 + * + * @Author sun + */ +@Data +public class SaveIssueCategoryFormDTO implements Serializable { + + private static final long serialVersionUID = 2599592072265715951L; + /** + * 分类Id + */ + private String id; + /** + * 分类名称 + */ + private String name; + + +} diff --git a/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/CustomerCategoryListResultDTO.java b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/CustomerCategoryListResultDTO.java new file mode 100644 index 0000000000..117c6cd42b --- /dev/null +++ b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/CustomerCategoryListResultDTO.java @@ -0,0 +1,37 @@ +package com.epmet.dto.result; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + * @Description 获取议题的分类、标签列表-接口返参 + * @Author sun + */ +@Data +public class CustomerCategoryListResultDTO implements Serializable { + + private static final long serialVersionUID = 5957826616179876849L; + + /** + * 分类Id + */ + private String id; + /** + * 分类名称 + */ + private String name; + /** + * 分类名称 + */ + @JsonIgnore + private String customerId; + + /** + * 子级分类对象 + */ + private List subCategory; + +} diff --git a/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/ProjectCategoryDTOResultDTO.java b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/ProjectCategoryDTOResultDTO.java new file mode 100644 index 0000000000..8215a8850f --- /dev/null +++ b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/ProjectCategoryDTOResultDTO.java @@ -0,0 +1,65 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @dscription 项目所属网格、分类基本信息-接口返参 + * @author sun + */ +@Data +public class ProjectCategoryDTOResultDTO implements Serializable { + + private static final long serialVersionUID = 5957826616179876849L; + /** + * 主键 + */ + private String id; + + /** + * 客户id, 产品默认default + */ + private String customerId; + + /** + * 上级分类ID 顶级此列存储0 + */ + private String pid; + + /** + * 所有上级分类ID,用逗号分开 + */ + private String pids; + + /** + * 上级分类编码 + */ + private String parentCategoryCode; + + /** + * 分类编码,分类编码+customer_id唯一 + */ + private String categoryCode; + + /** + * 分类名称 + */ + private String categoryName; + + /** + * 分类类别1,2,3,4.... + */ + private String categoryType; + + /** + * 排序 + */ + private Integer sort; + + /** + * 是否禁用(enable:启用 disable:禁用) + */ + private String isDisable; + +} diff --git a/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/ProjectCategoryTagListResultDTO.java b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/ProjectCategoryTagListResultDTO.java new file mode 100644 index 0000000000..43b33a74bf --- /dev/null +++ b/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 categoryList = new ArrayList<>(); + /** + * 标签集合 + */ + private List tagList = new ArrayList<>(); + +} diff --git a/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/ProjectCategoryTagResultDTO.java b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/ProjectCategoryTagResultDTO.java new file mode 100644 index 0000000000..375bc1a898 --- /dev/null +++ b/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; + +} diff --git a/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/ProjectIssueCategoryResultDTO.java b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/ProjectIssueCategoryResultDTO.java new file mode 100644 index 0000000000..e035523fe7 --- /dev/null +++ b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/ProjectIssueCategoryResultDTO.java @@ -0,0 +1,25 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + * @dscription 项目所属网格、分类基本信息-接口返参 + * @author sun + */ +@Data +public class ProjectIssueCategoryResultDTO implements Serializable { + + private static final long serialVersionUID = 5957826616179876849L; + /** + * 项目Id + */ + private ProjectIssueDTOResultDTO issueDTO; + /** + * 项目标题 + */ + private List categoryList; + +} diff --git a/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/ProjectIssueDTOResultDTO.java b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/ProjectIssueDTOResultDTO.java new file mode 100644 index 0000000000..0dd2698c4c --- /dev/null +++ b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/ProjectIssueDTOResultDTO.java @@ -0,0 +1,96 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** + * @dscription 项目所属网格、分类基本信息-接口返参 + * @author sun + */ +@Data +public class ProjectIssueDTOResultDTO implements Serializable { + + private static final long serialVersionUID = 5957826616179876849L; + /** + * 议题ID + */ + private String id; + + /** + * 议题状态 表决中:voting 已转项目:shift_project 已关闭:closed + */ + private String issueStatus; + + /** + * 来源类型 eg:resi_topic + */ + private String sourceType; + + /** + * 来源ID eg:2223232(当SOURCE_TYPE为"resi_topic"时,这里指话题的ID) + */ + private String sourceId; + + /** + * 关闭理由 【未关闭时可以为空】关闭议题时必填的理由,转项目后而且已经结案,这个字段不回写 + */ + private String closeReason; + + /** + * 解决类型 【未关闭时可以为空】已解决resolved、未解决unresolved,对应在关闭议题时所选的checkbox,转项目后而且已经结案,这个字段不回写 + */ + private String resolveType; + + /** + * 议题名称 最多20字 + */ + private String issueTitle; + + /** + * 建议 最多1000字 + */ + private String suggestion; + + /** + * 客户ID + */ + private String customerId; + + /** + * 网格ID 居民端议题对应一个网格Id + */ + private String gridId; + + /** + * 所属机关 【数据权限-非必填】11:22:33(agencyId)数据权限控制 + */ + private String orgIdPath; + + /** + * 组织ID 【数据权限-非必填】agencyId + */ + private String orgId; + + /** + * 表决截止日期 + */ + private Date votingDeadline; + + /** + * 表决发起日期(转议题日期) + */ + private Date decidedTime; + + /** + * 转项目日期 (服务间调用日期一致性) + */ + private Date shiftedTime; + + /** + * 关闭日期 + */ + private Date closedTime; + +} diff --git a/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/feign/GovProjectOpenFeignClient.java b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/feign/GovProjectOpenFeignClient.java index 49b573f0be..e3246e8bae 100644 --- a/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/feign/GovProjectOpenFeignClient.java +++ b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/feign/GovProjectOpenFeignClient.java @@ -2,7 +2,9 @@ package com.epmet.feign; import com.epmet.commons.tools.constant.ServiceConstant; import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.ProjectCategoryDTO; import com.epmet.dto.ProjectDTO; +import com.epmet.dto.form.DelCategoryFormDTO; import com.epmet.dto.form.ProcessListFormDTO; import com.epmet.dto.form.ProjectByCreateTopicUserFormDTO; import com.epmet.dto.form.ProjectListFromDTO; @@ -77,4 +79,11 @@ public interface GovProjectOpenFeignClient { @GetMapping("gov/project/project/queryprojectinfobyprojectid/{projectId}") Result queryProjectInfoByProjectId(@PathVariable("projectId")String projectId); + + /** + * @Description 判断分类有没有被项目使用 + * @Author sun + **/ + @PostMapping("gov/project/projectcategory/getprojectcategorylist") + Result> getProjectCategoryList(@RequestBody DelCategoryFormDTO formDTO); } diff --git a/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/feign/fallback/GovProjectOpenFeignClientFallback.java b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/feign/fallback/GovProjectOpenFeignClientFallback.java index ca4488be17..f03dabfef1 100644 --- a/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/feign/fallback/GovProjectOpenFeignClientFallback.java +++ b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/feign/fallback/GovProjectOpenFeignClientFallback.java @@ -3,7 +3,9 @@ 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.ProjectCategoryDTO; import com.epmet.dto.ProjectDTO; +import com.epmet.dto.form.DelCategoryFormDTO; import com.epmet.dto.form.ProcessListFormDTO; import com.epmet.dto.form.ProjectByCreateTopicUserFormDTO; import com.epmet.dto.form.ProjectListFromDTO; @@ -71,4 +73,9 @@ public class GovProjectOpenFeignClientFallback implements GovProjectOpenFeignCli public Result queryProjectInfoByProjectId(String projectId) { return ModuleUtils.feignConError(ServiceConstant.GOV_PROJECT_SERVER, "queryProjectInfoByProjectId", projectId); } + + @Override + public Result> getProjectCategoryList(DelCategoryFormDTO formDTO) { + return ModuleUtils.feignConError(ServiceConstant.GOV_PROJECT_SERVER, "getProjectCategoryList", formDTO); + } } diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/ProjectCategoryController.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/ProjectCategoryController.java new file mode 100644 index 0000000000..ff9417e6ca --- /dev/null +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/ProjectCategoryController.java @@ -0,0 +1,139 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.controller; + +import com.epmet.commons.tools.annotation.LoginUser; +import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.exception.RenException; +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.DefaultGroup; +import com.epmet.commons.tools.validator.group.UpdateGroup; +import com.epmet.dto.ProjectCategoryDTO; +import com.epmet.dto.form.DelCategoryFormDTO; +import com.epmet.dto.form.ProjectCategoryTagListFormDTO; +import com.epmet.dto.form.ProjectSaveCategoryFormDTO; +import com.epmet.dto.result.ProjectCategoryTagListResultDTO; +import com.epmet.excel.ProjectCategoryExcel; +import com.epmet.service.ProjectCategoryService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletResponse; +import java.util.List; +import java.util.Map; + + +/** + * 项目所属分类表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-12-08 + */ +@RestController +@RequestMapping("projectcategory") +public class ProjectCategoryController { + + @Autowired + private ProjectCategoryService projectCategoryService; + + @GetMapping("page") + public Result> page(@RequestParam Map params){ + PageData page = projectCategoryService.page(params); + return new Result>().ok(page); + } + + @GetMapping("{id}") + public Result get(@PathVariable("id") String id){ + ProjectCategoryDTO data = projectCategoryService.get(id); + return new Result().ok(data); + } + + @PostMapping + public Result save(@RequestBody ProjectCategoryDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); + projectCategoryService.save(dto); + return new Result(); + } + + @PutMapping + public Result update(@RequestBody ProjectCategoryDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); + projectCategoryService.update(dto); + return new Result(); + } + + @DeleteMapping + public Result delete(@RequestBody String[] ids){ + //效验数据 + AssertUtils.isArrayEmpty(ids, "id"); + projectCategoryService.delete(ids); + return new Result(); + } + + @GetMapping("export") + public void export(@RequestParam Map params, HttpServletResponse response) throws Exception { + List list = projectCategoryService.list(params); + ExcelUtils.exportExcelToTarget(response, null, list, ProjectCategoryExcel.class); + } + + /** + * @param formDTO + * @return + * @Description 获取项目的分类、标签列表 + * @Author sun + **/ + @PostMapping("categorytaglist") + public Result categoryTagList(@LoginUser TokenDto tokenDto, @RequestBody ProjectCategoryTagListFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO, ProjectCategoryTagListFormDTO.CategoryTag.class); + formDTO.setCustomerId(tokenDto.getCustomerId()); + return new Result().ok(projectCategoryService.categoryTagList(formDTO)); + } + + /** + * @param formDTO + * @return + * @Description 项目:保存/修改分类 + * @Author sun + **/ + @PostMapping("save") + public Result saveCategory(@LoginUser TokenDto tokenDto, @RequestBody ProjectSaveCategoryFormDTO formDTO) { + formDTO.setCustomerId(tokenDto.getCustomerId()); + ValidatorUtils.validateEntity(formDTO, ProjectSaveCategoryFormDTO.SaveCategory.class); + projectCategoryService.saveCategory(formDTO); + return new Result(); + } + + /** + * @param formDTO + * @Description 判断分类有没有被项目使用 + * @Author sun + **/ + @PostMapping("getprojectcategorylist") + public Result> getProjectCategoryList(@RequestBody DelCategoryFormDTO formDTO) { + return new Result>().ok(projectCategoryService.getProjectCategoryList(formDTO)); + } + +} \ No newline at end of file diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/ProjectTagsController.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/ProjectTagsController.java new file mode 100644 index 0000000000..80fad9fab5 --- /dev/null +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/ProjectTagsController.java @@ -0,0 +1,99 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +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.dto.ProjectTagsDTO; +import com.epmet.dto.form.ProjectTagHookFormDTO; +import com.epmet.excel.ProjectTagsExcel; +import com.epmet.service.ProjectTagsService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletResponse; +import java.util.List; +import java.util.Map; + + +/** + * 项目关联标签表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-12-08 + */ +@RestController +@RequestMapping("projecttags") +public class ProjectTagsController { + + @Autowired + private ProjectTagsService projectTagsService; + + @GetMapping("page") + public Result> page(@RequestParam Map params){ + PageData page = projectTagsService.page(params); + return new Result>().ok(page); + } + + @GetMapping("{id}") + public Result get(@PathVariable("id") String id){ + ProjectTagsDTO data = projectTagsService.get(id); + return new Result().ok(data); + } + + @PostMapping("save") + public Result save(@RequestBody ProjectTagHookFormDTO dto, @LoginUser TokenDto token){ + dto.setCustomerId(token.getCustomerId()); + dto.setStaffId(token.getUserId()); + //效验数据 + ValidatorUtils.validateEntity(dto); + projectTagsService.saveDifferentSet(dto); + return new Result(); + } + + @PutMapping + public Result update(@RequestBody ProjectTagsDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); + projectTagsService.update(dto); + return new Result(); + } + + @DeleteMapping + public Result delete(@RequestBody String[] ids){ + //效验数据 + AssertUtils.isArrayEmpty(ids, "id"); + projectTagsService.delete(ids); + return new Result(); + } + + @GetMapping("export") + public void export(@RequestParam Map params, HttpServletResponse response) throws Exception { + List list = projectTagsService.list(params); + ExcelUtils.exportExcelToTarget(response, null, list, ProjectTagsExcel.class); + } + +} \ No newline at end of file diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/dao/ProjectCategoryDao.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/dao/ProjectCategoryDao.java new file mode 100644 index 0000000000..247f239261 --- /dev/null +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/dao/ProjectCategoryDao.java @@ -0,0 +1,55 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.ProjectCategoryDTO; +import com.epmet.dto.form.DelCategoryFormDTO; +import com.epmet.entity.ProjectCategoryEntity; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 项目所属分类表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-12-08 + */ +@Mapper +public interface ProjectCategoryDao extends BaseDao { + + /** + * @Description 查询项目绑定的分类Id集合 + * @Author sun + **/ + List selectProjectCategoryIdList(@Param("projectId") String projectId); + + /** + * @Description 删除项目的分类信息 + * @Author sun + **/ + void delByProjectId(@Param("projectId") String projectId); + + /** + * @Description 判断分类有没有被项目使用 + * @Author sun + **/ + List selectProjectCategoryList(DelCategoryFormDTO formDTO); +} \ No newline at end of file diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/dao/ProjectTagsDao.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/dao/ProjectTagsDao.java new file mode 100644 index 0000000000..6c72f46614 --- /dev/null +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/dao/ProjectTagsDao.java @@ -0,0 +1,60 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +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; + +/** + * 项目关联标签表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-12-08 + */ +@Mapper +public interface ProjectTagsDao extends BaseDao { + + /** + * @Description 查询项目绑定的标签,按绑定时间升序 + * @Author sun + **/ + List selectProjectTagList(@Param("projectId") String projectId); + + /** + * @Description 删除项目的标签 + * @param projectId + * @return void + * @author wangc + * @date 2020.12.11 13:26 + */ + void deleteProjectTags(@Param("projectId") String projectId); + + /** + * @Description 批量插入 + * @param list + * @return void + * @author wangc + * @date 2020.12.11 13:39 + */ + void insertBatch(@Param("list")List list); +} \ No newline at end of file diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/entity/ProjectCategoryEntity.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/entity/ProjectCategoryEntity.java new file mode 100644 index 0000000000..f1fc7eb4e8 --- /dev/null +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/entity/ProjectCategoryEntity.java @@ -0,0 +1,71 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.entity; + +import com.baomidou.mybatisplus.annotation.TableName; + +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; + +/** + * 项目所属分类表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-12-08 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("project_category") +public class ProjectCategoryEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户id + */ + private String customerId; + + /** + * 来源网格id + */ + private String gridId; + + /** + * 项目id + */ + private String projectId; + + /** + * 分类id + */ + private String categoryId; + + /** + * 分类对应的所有上级,英文逗号隔开 + */ + private String categoryPids; + + /** + * 分类编码,分类编码+customer_id唯一 + */ + private String categoryCode; + +} diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/entity/ProjectTagsEntity.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/entity/ProjectTagsEntity.java new file mode 100644 index 0000000000..12febddfea --- /dev/null +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/entity/ProjectTagsEntity.java @@ -0,0 +1,61 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.entity; + +import com.baomidou.mybatisplus.annotation.TableName; + +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; + +/** + * 项目关联标签表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-12-08 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("project_tags") +public class ProjectTagsEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户ID + */ + private String customerId; + + /** + * 项目ID + */ + private String projectId; + + /** + * 标签ID + */ + private String tagId; + + /** + * 标签名称 + */ + private String tagName; + +} diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/excel/ProjectCategoryExcel.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/excel/ProjectCategoryExcel.java new file mode 100644 index 0000000000..515c2ddf7e --- /dev/null +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/excel/ProjectCategoryExcel.java @@ -0,0 +1,71 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.excel; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import lombok.Data; + +import java.util.Date; + +/** + * 项目所属分类表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-12-08 + */ +@Data +public class ProjectCategoryExcel { + + @Excel(name = "主键") + private String id; + + @Excel(name = "客户id") + private String customerId; + + @Excel(name = "来源网格id") + private String gridId; + + @Excel(name = "项目id") + private String projectId; + + @Excel(name = "分类id") + private String categoryId; + + @Excel(name = "分类对应的所有上级,英文逗号隔开") + private String categoryPids; + + @Excel(name = "删除标识 0未删除、1已删除") + private String delFlag; + + @Excel(name = "乐观锁") + private Integer revision; + + @Excel(name = "创建人") + private String createdBy; + + @Excel(name = "创建时间") + private Date createdTime; + + @Excel(name = "更新人") + private String updatedBy; + + @Excel(name = "更新时间") + private Date updatedTime; + + +} \ No newline at end of file diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/excel/ProjectTagsExcel.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/excel/ProjectTagsExcel.java new file mode 100644 index 0000000000..e923b47d6c --- /dev/null +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/excel/ProjectTagsExcel.java @@ -0,0 +1,68 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.excel; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import lombok.Data; + +import java.util.Date; + +/** + * 项目关联标签表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-12-08 + */ +@Data +public class ProjectTagsExcel { + + @Excel(name = "主键ID") + private String id; + + @Excel(name = "客户ID") + private String customerId; + + @Excel(name = "项目ID") + private String projectId; + + @Excel(name = "标签ID") + private String tagId; + + @Excel(name = "标签名称") + private String tagName; + + @Excel(name = "删除标识 0.未删除 1.已删除") + private Integer delFlag; + + @Excel(name = "乐观锁") + private Integer revision; + + @Excel(name = "创建人") + private String createdBy; + + @Excel(name = "创建时间") + private Date createdTime; + + @Excel(name = "更新人") + private String updatedBy; + + @Excel(name = "更新时间") + private Date updatedTime; + + +} \ No newline at end of file diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/redis/ProjectCategoryRedis.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/redis/ProjectCategoryRedis.java new file mode 100644 index 0000000000..cdf23a7a26 --- /dev/null +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/redis/ProjectCategoryRedis.java @@ -0,0 +1,47 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.redis; + +import com.epmet.commons.tools.redis.RedisUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * 项目所属分类表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-12-08 + */ +@Component +public class ProjectCategoryRedis { + @Autowired + private RedisUtils redisUtils; + + public void delete(Object[] ids) { + + } + + public void set(){ + + } + + public String get(String id){ + return null; + } + +} \ No newline at end of file diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/redis/ProjectTagsRedis.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/redis/ProjectTagsRedis.java new file mode 100644 index 0000000000..08f8b14e55 --- /dev/null +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/redis/ProjectTagsRedis.java @@ -0,0 +1,47 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.redis; + +import com.epmet.commons.tools.redis.RedisUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * 项目关联标签表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-12-08 + */ +@Component +public class ProjectTagsRedis { + @Autowired + private RedisUtils redisUtils; + + public void delete(Object[] ids) { + + } + + public void set(){ + + } + + public String get(String id){ + return null; + } + +} \ No newline at end of file diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/ProjectCategoryService.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/ProjectCategoryService.java new file mode 100644 index 0000000000..37fb5fa984 --- /dev/null +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/ProjectCategoryService.java @@ -0,0 +1,122 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +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.DelCategoryFormDTO; +import com.epmet.dto.form.ProjectCategoryTagListFormDTO; +import com.epmet.dto.form.ProjectSaveCategoryFormDTO; +import com.epmet.dto.result.ProjectCategoryTagListResultDTO; +import com.epmet.entity.ProjectCategoryEntity; + +import java.util.List; +import java.util.Map; + +/** + * 项目所属分类表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-12-08 + */ +public interface ProjectCategoryService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2020-12-08 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2020-12-08 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return ProjectCategoryDTO + * @author generator + * @date 2020-12-08 + */ + ProjectCategoryDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2020-12-08 + */ + void save(ProjectCategoryDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2020-12-08 + */ + void update(ProjectCategoryDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2020-12-08 + */ + void delete(String[] ids); + + /** + * @param formDTO + * @return + * @Description 获取项目的分类、标签列表 + * @Author sun + **/ + ProjectCategoryTagListResultDTO categoryTagList(ProjectCategoryTagListFormDTO formDTO); + + /** + * @param formDTO + * @return + * @Description 项目:保存/修改分类 + * @Author sun + **/ + void saveCategory(ProjectSaveCategoryFormDTO formDTO); + + /** + * @param formDTO + * @Description 判断分类有没有被项目使用 + * @Author sun + **/ + List getProjectCategoryList(DelCategoryFormDTO formDTO); +} \ No newline at end of file diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/ProjectTagsService.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/ProjectTagsService.java new file mode 100644 index 0000000000..a16e725bec --- /dev/null +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/ProjectTagsService.java @@ -0,0 +1,106 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.commons.tools.page.PageData; +import com.epmet.dto.ProjectTagsDTO; +import com.epmet.dto.form.ProjectTagHookFormDTO; +import com.epmet.entity.ProjectTagsEntity; + +import java.util.List; +import java.util.Map; + +/** + * 项目关联标签表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-12-08 + */ +public interface ProjectTagsService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2020-12-08 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2020-12-08 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return ProjectTagsDTO + * @author generator + * @date 2020-12-08 + */ + ProjectTagsDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2020-12-08 + */ + void save(ProjectTagsDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2020-12-08 + */ + void update(ProjectTagsDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2020-12-08 + */ + void delete(String[] ids); + + /** + * @Description 修改项目于标签的绑定关系并对标签的引用量做出相应调整 + * saveDifferentSet :: 保存差集 + * @param param + * @return void + * @author wangc + * @date 2020.12.11 11:10 + */ + void saveDifferentSet(ProjectTagHookFormDTO param); +} \ No newline at end of file diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectCategoryServiceImpl.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectCategoryServiceImpl.java new file mode 100644 index 0000000000..022e777d9a --- /dev/null +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectCategoryServiceImpl.java @@ -0,0 +1,205 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +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.RenException; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.ConvertUtils; +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.DelCategoryFormDTO; +import com.epmet.dto.form.ProjectCategoryTagListFormDTO; +import com.epmet.dto.form.ProjectSaveCategoryFormDTO; +import com.epmet.dto.result.*; +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; +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; + +/** + * 项目所属分类表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-12-08 + */ +@Service +public class ProjectCategoryServiceImpl extends BaseServiceImpl implements ProjectCategoryService { + + @Autowired + private ProjectCategoryRedis projectCategoryRedis; + @Autowired + private ProjectTagsDao projectTagsDao; + @Autowired + private GovIssueOpenFeignClient govIssueOpenFeignClient; + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, ProjectCategoryDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, ProjectCategoryDTO.class); + } + + private QueryWrapper getWrapper(Map params){ + String id = (String)params.get(FieldConstant.ID_HUMP); + + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); + + return wrapper; + } + + @Override + public ProjectCategoryDTO get(String id) { + ProjectCategoryEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, ProjectCategoryDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(ProjectCategoryDTO dto) { + ProjectCategoryEntity entity = ConvertUtils.sourceToTarget(dto, ProjectCategoryEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(ProjectCategoryDTO dto) { + ProjectCategoryEntity entity = ConvertUtils.sourceToTarget(dto, ProjectCategoryEntity.class); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + + /** + * @param formDTO + * @return + * @Description 获取项目的分类、标签列表 + * @Author sun + **/ + @Override + public ProjectCategoryTagListResultDTO categoryTagList(ProjectCategoryTagListFormDTO formDTO) { + ProjectCategoryTagListResultDTO resultDTO = new ProjectCategoryTagListResultDTO(); + //1.查询项目绑定的分类名称,按排序升序 + List categoryIdList = baseDao.selectProjectCategoryIdList(formDTO.getProjectId()); + if (categoryIdList.size() > NumConstant.ZERO) { + //1-1.调用issue库,查询分类Id对应的分类名称,按分类升序排列 + formDTO.setCategoryIdList(categoryIdList); + Result> result = govIssueOpenFeignClient.projectCategoryList(formDTO); + if (!result.success()) { + throw new RenException(result.getInternalMsg()); + } + resultDTO.setCategoryList(result.getData()); + } + //2.查询项目绑定的标签,按绑定时间升序 + List tagList = projectTagsDao.selectProjectTagList(formDTO.getProjectId()); + if (tagList.size() > NumConstant.ZERO) { + resultDTO.setTagList(tagList); + } + return resultDTO; + } + + /** + * @param formDTO + * @return + * @Description 项目:保存/修改分类 + * @Author sun + **/ + @Override + public void saveCategory(ProjectSaveCategoryFormDTO formDTO) { + + //0.如果传入的分类集合为空不管是否存在过历史分类数据,只执行一次删除操作 + if(formDTO.getCategoryList().size()< NumConstant.ONE){ + baseDao.delByProjectId(formDTO.getProjectId()); + return; + } + //1.查询项目所属客户和所属网格信息以及分类对应的分类信息 + Result result = govIssueOpenFeignClient.getProjectAndCategoryInfo(formDTO); + if (!result.success()) { + throw new RenException(String.format("保存项目分类,获取项目对应的议题信息以及分类信息失败,projiectId->%s", formDTO.getProjectId())); + } + ProjectIssueDTOResultDTO issue = result.getData().getIssueDTO(); + List categoryList = result.getData().getCategoryList(); + + //2.汇总批量新增数据 + List entityList = new ArrayList<>(); + formDTO.getCategoryList().forEach(ca -> { + ProjectCategoryEntity entity = new ProjectCategoryEntity(); + entity.setCustomerId(issue.getCustomerId()); + entity.setGridId(issue.getGridId()); + entity.setProjectId(formDTO.getProjectId()); + entity.setCategoryId(ca.getId()); + categoryList.forEach(cl -> { + if (ca.getId().equals(cl.getId())) { + entity.setCategoryPids(cl.getPids()); + entity.setCategoryCode(cl.getCategoryCode()); + } + }); + entityList.add(entity); + }); + + //3.根据议题Id删除可能存在的分类信息 + baseDao.delByProjectId(formDTO.getProjectId()); + + //4.批量保存议题分类信息 + if (!insertBatch(entityList)) { + throw new RenException(String.format("项目分类信息保存失败")); + } + + } + + /** + * @param formDTO + * @Description 判断分类有没有被项目使用 + * @Author sun + **/ + @Override + public List getProjectCategoryList(DelCategoryFormDTO formDTO) { + return baseDao.selectProjectCategoryList(formDTO); + } + +} \ No newline at end of file diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectServiceImpl.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectServiceImpl.java index e3c0f23a2d..73f5955859 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectServiceImpl.java +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectServiceImpl.java @@ -104,6 +104,10 @@ public class ProjectServiceImpl extends BaseServiceImpl categoryList = new ArrayList<>(); + formDTO.getCategoryList().forEach(item -> { + ProjectCategoryEntity entity = new ProjectCategoryEntity(); + entity.setCategoryId(item.getCategoryId()); + entity.setCategoryPids(item.getCategoryPids()); + entity.setCustomerId(item.getCustomerId()); + entity.setGridId(item.getGridId()); + entity.setProjectId(projectEntity.getId()); + entity.setCategoryCode(item.getCategoryCode()); + categoryList.add(entity); + }); + projectCategoryService.insertBatch(categoryList); + + if (CollectionUtils.isNotEmpty(formDTO.getTagList())) { + List tagList = new ArrayList<>(); + formDTO.getTagList().forEach(item -> { + ProjectTagsEntity entity = new ProjectTagsEntity(); + entity.setCustomerId(item.getCustomerId()); + entity.setTagId(item.getTagId()); + entity.setTagName(item.getTagName()); + entity.setProjectId(projectEntity.getId()); + tagList.add(entity); + }); + projectTagsService.insertBatch(tagList); + } + } + //6:返回接口参数 issueProjectResultDTO.setProjectId(projectEntity.getId()); issueProjectResultDTO.setOrgName(processEntity.getDepartmentName()); @@ -1037,6 +1070,7 @@ public class ProjectServiceImpl extends BaseServiceImpl + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +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.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.ProjectTagsDao; +import com.epmet.dto.ProjectTagsDTO; +import com.epmet.dto.form.ProjectTagHookFormDTO; +import com.epmet.dto.form.TagDifferentSetFormDTO; +import com.epmet.dto.result.ProjectCategoryTagResultDTO; +import com.epmet.entity.ProjectTagsEntity; +import com.epmet.feign.GovIssueOpenFeignClient; +import com.epmet.redis.ProjectTagsRedis; +import com.epmet.service.ProjectTagsService; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.CollectionUtils; + +import java.util.Arrays; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +/** + * 项目关联标签表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-12-08 + */ +@Service +public class ProjectTagsServiceImpl extends BaseServiceImpl implements ProjectTagsService { + + @Autowired + private ProjectTagsRedis projectTagsRedis; + + @Autowired + private GovIssueOpenFeignClient issueClient; + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, ProjectTagsDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, ProjectTagsDTO.class); + } + + private QueryWrapper getWrapper(Map params){ + String id = (String)params.get(FieldConstant.ID_HUMP); + + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); + + return wrapper; + } + + @Override + public ProjectTagsDTO get(String id) { + ProjectTagsEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, ProjectTagsDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(ProjectTagsDTO dto) { + ProjectTagsEntity entity = ConvertUtils.sourceToTarget(dto, ProjectTagsEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(ProjectTagsDTO dto) { + ProjectTagsEntity entity = ConvertUtils.sourceToTarget(dto, ProjectTagsEntity.class); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + + /** + * @Description 修改项目于标签的绑定关系并对标签的引用量做出相应调整 + * saveDifferentSet :: 保存差集 + * @param param + * @return void + * @author wangc + * @date 2020.12.11 11:10 + */ + @Override + @Transactional(rollbackFor = Exception.class) + public void saveDifferentSet(ProjectTagHookFormDTO param) { + //原始 + List orientHooks = baseDao.selectProjectTagList(param.getProjectId()); + //新增 + List newHooks = param.getTagList(); + if(!CollectionUtils.isEmpty(orientHooks)) baseDao.deleteProjectTags(param.getProjectId()); + if(!CollectionUtils.isEmpty(newHooks)){ + baseDao.insertBatch(newHooks.stream().map(o->{ + ProjectTagsEntity hook = ConvertUtils.sourceToTarget(param,ProjectTagsEntity.class);hook.setTagId(o.getId());hook.setTagName(o.getName());hook.setCreatedBy(param.getStaffId());return hook; + }).collect(Collectors.toList())); + } + + List orientIds = CollectionUtils.isEmpty(orientHooks) ? null : orientHooks.stream().map(ProjectCategoryTagResultDTO :: getId).collect(Collectors.toList()); + List newIds = CollectionUtils.isEmpty(newHooks) ? null : newHooks.stream().map(ProjectCategoryTagResultDTO::getId).collect(Collectors.toList()); + TagDifferentSetFormDTO differentSet = ConvertUtils.sourceToTarget(param,TagDifferentSetFormDTO.class); + differentSet.setUserId(param.getStaffId()); + if(null == orientIds && null == newIds) return ; + if(null != orientIds && null == newIds) differentSet.setMinus(orientIds); + if(null == orientIds && null != newIds) differentSet.setPlus(newIds); + if(null != orientIds && null != newIds){ + List replaceNews = new LinkedList<>(newIds); + differentSet.setPlus(newIds.removeAll(orientIds) ? newIds : null); + differentSet.setMinus(orientIds.removeAll(replaceNews) ? orientIds : null); + } + Result result = issueClient.updateCitations(differentSet); + if(!result.success()) throw new RenException(result.getInternalMsg()); + } + +} \ No newline at end of file diff --git a/epmet-module/gov-project/gov-project-server/src/main/resources/db/migration/V0.0.5__add_category_tag.sql b/epmet-module/gov-project/gov-project-server/src/main/resources/db/migration/V0.0.5__add_category_tag.sql new file mode 100644 index 0000000000..b67338043b --- /dev/null +++ b/epmet-module/gov-project/gov-project-server/src/main/resources/db/migration/V0.0.5__add_category_tag.sql @@ -0,0 +1,30 @@ +CREATE TABLE `project_category` ( + `ID` varchar(64) NOT NULL COMMENT '主键', + `CUSTOMER_ID` varchar(64) NOT NULL COMMENT '客户id', + `GRID_ID` varchar(64) DEFAULT NULL COMMENT '来源网格id', + `PROJECT_ID` varchar(64) NOT NULL COMMENT '项目id', + `CATEGORY_ID` varchar(64) NOT NULL COMMENT '分类id', + `CATEGORY_PIDS` varchar(512) NOT NULL COMMENT '分类对应的所有上级,英文逗号隔开', + `DEL_FLAG` varchar(1) NOT NULL DEFAULT '0' COMMENT '删除标识 0未删除、1已删除', + `REVISION` int(11) NOT NULL DEFAULT '0' COMMENT '乐观锁', + `CREATED_BY` varchar(64) NOT NULL COMMENT '创建人', + `CREATED_TIME` datetime NOT NULL COMMENT '创建时间', + `UPDATED_BY` varchar(64) NOT NULL COMMENT '更新人', + `UPDATED_TIME` datetime NOT NULL COMMENT '更新时间', + PRIMARY KEY (`ID`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC COMMENT='项目所属分类表'; + +CREATE TABLE `project_tags` ( + `ID` varchar(64) NOT NULL COMMENT '主键ID', + `CUSTOMER_ID` varchar(64) NOT NULL COMMENT '客户ID', + `PROJECT_ID` varchar(64) NOT NULL COMMENT '项目ID', + `TAG_ID` varchar(64) NOT NULL COMMENT '标签ID', + `TAG_NAME` varchar(32) NOT NULL COMMENT '标签名称', + `DEL_FLAG` int(11) NOT NULL DEFAULT '0' COMMENT '删除标识 0.未删除 1.已删除', + `REVISION` int(11) NOT NULL COMMENT '乐观锁', + `CREATED_BY` varchar(32) NOT NULL COMMENT '创建人', + `CREATED_TIME` datetime NOT NULL COMMENT '创建时间', + `UPDATED_BY` varchar(32) NOT NULL COMMENT '更新人', + `UPDATED_TIME` datetime NOT NULL COMMENT '更新时间', + PRIMARY KEY (`ID`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC COMMENT='项目关联标签表'; diff --git a/epmet-module/gov-project/gov-project-server/src/main/resources/db/migration/V0.0.7__alter_category_tag.sql b/epmet-module/gov-project/gov-project-server/src/main/resources/db/migration/V0.0.7__alter_category_tag.sql new file mode 100644 index 0000000000..9b343fa74a --- /dev/null +++ b/epmet-module/gov-project/gov-project-server/src/main/resources/db/migration/V0.0.7__alter_category_tag.sql @@ -0,0 +1,10 @@ +ALTER TABLE `project_category` +ADD COLUMN `CATEGORY_CODE` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '分类编码,分类编码+customer_id唯一' AFTER `CATEGORY_PIDS`, +ADD COLUMN `IS_DISABLE` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '是否禁用(enable:启用 disable:禁用)' AFTER `CATEGORY_CODE`; + +ALTER TABLE `project_tags` +ADD COLUMN `IS_DISABLE` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '是否禁用(enable:启用 disable:禁用)' AFTER `TAG_NAME`; + +-- 删除表中历史数据,因为db做了调整 +DELETE FROM project_category; +DELETE FROM project_tags; diff --git a/epmet-module/gov-project/gov-project-server/src/main/resources/db/migration/V0.0.9__del_category_tag_field.sql b/epmet-module/gov-project/gov-project-server/src/main/resources/db/migration/V0.0.9__del_category_tag_field.sql new file mode 100644 index 0000000000..7ab81a8c1d --- /dev/null +++ b/epmet-module/gov-project/gov-project-server/src/main/resources/db/migration/V0.0.9__del_category_tag_field.sql @@ -0,0 +1,4 @@ +ALTER TABLE `project_category` DROP COLUMN `IS_DISABLE`; + +ALTER TABLE `project_tags` DROP COLUMN `IS_DISABLE`; + diff --git a/epmet-module/gov-project/gov-project-server/src/main/resources/mapper/ProjectCategoryDao.xml b/epmet-module/gov-project/gov-project-server/src/main/resources/mapper/ProjectCategoryDao.xml new file mode 100644 index 0000000000..30033c620e --- /dev/null +++ b/epmet-module/gov-project/gov-project-server/src/main/resources/mapper/ProjectCategoryDao.xml @@ -0,0 +1,38 @@ + + + + + + + + + + + DELETE + FROM + project_category + WHERE + project_id = #{projectId} + + + \ No newline at end of file diff --git a/epmet-module/gov-project/gov-project-server/src/main/resources/mapper/ProjectDao.xml b/epmet-module/gov-project/gov-project-server/src/main/resources/mapper/ProjectDao.xml index c47def3cc0..50f8bc6433 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/resources/mapper/ProjectDao.xml +++ b/epmet-module/gov-project/gov-project-server/src/main/resources/mapper/ProjectDao.xml @@ -38,7 +38,7 @@ GROUP BY ps.PROJECT_ID) psp ON p.ID = psp.PROJECT_ID WHERE p.DEL_FLAG = '0' AND p.status = 'pending' - ORDER BY p.CREATED_TIME ASC + ORDER BY psp.created_time, p.created_time ASC LIMIT #{pageNo}, #{pageSize} + 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 + + + + + delete from project_tags + where del_flag = '0' + and project_id = #{projectId} + + + + INSERT INTO project_tags + ( + ID, + CUSTOMER_ID, + PROJECT_ID, + TAG_ID, + TAG_NAME, + DEL_FLAG, + REVISION, + CREATED_BY, + CREATED_TIME, + UPDATED_BY, + UPDATED_TIME + ) values + + ( + (SELECT REPLACE(UUID(), '-', '') AS id), + #{item.customerId}, + #{item.projectId}, + #{item.tagId}, + #{item.tagName}, + 0, + 0, + #{item.createdBy}, + now(), + #{item.createdBy}, + now() + ) + + + \ No newline at end of file diff --git a/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/feign/OperCrmOpenFeignClient.java b/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/feign/OperCrmOpenFeignClient.java index 0f4313dfad..04508ac6df 100644 --- a/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/feign/OperCrmOpenFeignClient.java +++ b/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/feign/OperCrmOpenFeignClient.java @@ -122,4 +122,15 @@ public interface OperCrmOpenFeignClient { **/ @GetMapping("/oper/crm/customer/getallsubcustomerids/{customerId}") Result> getAllSubCustomerIds(@PathVariable("customerId") String customerId); + + /** + * 获取外部客户,的父级 客户id + * + * @param customerId + * @return com.epmet.commons.tools.utils.Result + * @Author zhangyong + * @Date 14:57 2021-03-22 + **/ + @GetMapping("/oper/crm/customer/getexternalandparentcustomerid/{customerId}") + Result getExternalAndParentCustomerId(@PathVariable("customerId") String customerId); } diff --git a/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/feign/fallback/OperCrmOpenFeignClientFallback.java b/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/feign/fallback/OperCrmOpenFeignClientFallback.java index 5de09ce167..b718517d4b 100644 --- a/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/feign/fallback/OperCrmOpenFeignClientFallback.java +++ b/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/feign/fallback/OperCrmOpenFeignClientFallback.java @@ -95,4 +95,9 @@ public class OperCrmOpenFeignClientFallback implements OperCrmOpenFeignClient { public Result> getAllSubCustomerIds(String customerId) { return ModuleUtils.feignConError(ServiceConstant.OPER_CRM_SERVER, "getAllSubCustomerIds", customerId); } + + @Override + public Result getExternalAndParentCustomerId(String customerId) { + return ModuleUtils.feignConError(ServiceConstant.OPER_CRM_SERVER, "getExternalAndParentCustomerId", customerId); + } } diff --git a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/controller/CustomerController.java b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/controller/CustomerController.java index c5330a9abd..30fe309079 100644 --- a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/controller/CustomerController.java +++ b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/controller/CustomerController.java @@ -376,4 +376,21 @@ public class CustomerController { } return new Result<>(); } + + /** + * 获取外部客户,的父级 客户id + * + * @param customerId + * @return com.epmet.commons.tools.utils.Result + * @Author zhangyong + * @Date 14:57 2021-03-22 + **/ + @GetMapping("getexternalandparentcustomerid/{customerId}") + public Result getExternalAndParentCustomerId(@PathVariable("customerId") String customerId){ + if(StringUtils.isNotBlank(customerId)){ + String resultDTO = customerService.getExternalAndParentCustomerId(customerId); + return new Result().ok(resultDTO); + } + return new Result<>(); + } } diff --git a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/dao/CustomerDao.java b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/dao/CustomerDao.java index b7aed8f55a..02ae9d9890 100644 --- a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/dao/CustomerDao.java +++ b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/dao/CustomerDao.java @@ -48,7 +48,7 @@ public interface CustomerDao extends BaseDao { * @param customerIdList * @Author yinzuomei * @Description 根据客户id查询客户信息 - * @Date 2020/4/24 9:21 + * @Date 2020/4/24 9:21 **/ List selectListByIds(@Param("customerIdList") List customerIdList); @@ -98,4 +98,13 @@ public interface CustomerDao extends BaseDao { */ List selectAllCustomerList(@Param("customerName") String customerName); + /** + * 获取外部客户,的父级 客户id + * + * @param customerId + * @return java.lang.String + * @Author zhangyong + * @Date 14:57 2021-03-22 + **/ + String getExternalAndParentCustomerId(@Param("customerId") String customerId); } diff --git a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/CustomerService.java b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/CustomerService.java index 82e872e511..f1efa2d087 100644 --- a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/CustomerService.java +++ b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/CustomerService.java @@ -226,4 +226,14 @@ public interface CustomerService extends BaseService { * @Date 2021/2/3 12:52 **/ CustomerRelationInfoResultDTO queryCustomerInfoByCustomerId(String customerId); + + /** + * 获取外部客户,的父级 客户id + * + * @param customerId + * @return java.lang.String + * @Author zhangyong + * @Date 14:57 2021-03-22 + **/ + String getExternalAndParentCustomerId(String customerId); } diff --git a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/impl/CustomerServiceImpl.java b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/impl/CustomerServiceImpl.java index 1fadbd8443..c2677c0504 100644 --- a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/impl/CustomerServiceImpl.java +++ b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/impl/CustomerServiceImpl.java @@ -785,4 +785,8 @@ public class CustomerServiceImpl extends BaseServiceImpl + +