Browse Source

Merge branch 'dev' of http://git.elinkit.com.cn:7070/r/epmet-cloud into dev_healthcheck

master
wxz 4 years ago
parent
commit
445c1d6f23
  1. 30
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/ApplicationReadyEventListener.java
  2. 6
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/RequirePermissionEnum.java
  3. 4
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java
  4. 45
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/filter/LogMsgSendFilter.java
  5. 12
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java
  6. 3
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/SpringContextUtils.java
  7. 40
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/result/StaffRoleListResultDTO.java
  8. 48
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/result/StaffAgencyGridListResultDTO.java
  9. 15
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/GovOrgController.java
  10. 8
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmetuser/StaffRoleDao.java
  11. 7
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/govorg/CustomerAgencyDao.java
  12. 8
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/govorg/CustomerGridDao.java
  13. 7
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/govorg/CustomerStaffGridDao.java
  14. 5
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/EpmetUserService.java
  15. 9
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/EpmetUserServiceImpl.java
  16. 9
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/GovOrgService.java
  17. 83
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/impl/GovOrgServiceImpl.java
  18. 24
      epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/StaffRoleDao.xml
  19. 17
      epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govorg/CustomerAgencyDao.xml
  20. 16
      epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govorg/CustomerGridDao.xml
  21. 9
      epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govorg/CustomerStaffAgencyDao.xml
  22. 17
      epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govorg/CustomerStaffGridDao.xml
  23. 60
      epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/impl/StaffAgencyServiceImpl.java
  24. 5
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/UpdateTagFormDTO.java
  25. 17
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/GovOrgOpenFeignClient.java
  26. 10
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/fallback/GovOrgOpenFeignClientFallback.java
  27. 11
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerGridController.java
  28. 8
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerGridDao.java
  29. 8
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerGridService.java
  30. 14
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridServiceImpl.java
  31. 2
      epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml
  32. 5
      epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerGridDao.xml
  33. 120
      epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/SpecialSubjectDTO.java
  34. 56
      epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/AddSpecialSubjectFormDTO.java
  35. 42
      epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/DelSpecialSubjectFormDTO.java
  36. 22
      epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/HotSubjectTagFormDTO.java
  37. 6
      epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/InitTagsFormDTO.java
  38. 19
      epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/PreviewFormDTO.java
  39. 41
      epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/QuerySpecialSubFormDTO.java
  40. 33
      epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/SubjectArticleListFormDTO.java
  41. 23
      epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/SubjectListFormDTO.java
  42. 23
      epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/AddSpecialSubjectResultDTO.java
  43. 4
      epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/ArticleListResultDTO.java
  44. 19
      epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/PreviewResultDTO.java
  45. 61
      epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/SubjectArticleListResultDTO.java
  46. 31
      epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/SubjectListResultDTO.java
  47. 5
      epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/TagInfoResultDTO.java
  48. 5
      epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/UpdateTagUseCountsResultDTO.java
  49. 63
      epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/WorkSpecialSubjectResultDTO.java
  50. 17
      epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/feign/GovVoiceOpenFeignClient.java
  51. 10
      epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/feign/fallback/GovVoiceOpenFeignClientFallback.java
  52. 28
      epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/controller/ArticleController.java
  53. 128
      epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/controller/SpecialSubjectController.java
  54. 20
      epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/dao/ArticleDao.java
  55. 43
      epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/dao/SpecialSubjectDao.java
  56. 2
      epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/dao/TagCustomerDao.java
  57. 89
      epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/entity/SpecialSubjectEntity.java
  58. 8
      epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/entity/TagCustomerEntity.java
  59. 81
      epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/redis/TagRedis.java
  60. 27
      epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/ArticleService.java
  61. 148
      epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/SpecialSubjectService.java
  62. 62
      epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/ArticleServiceImpl.java
  63. 306
      epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/SpecialSubjectServiceImpl.java
  64. 9
      epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/TagCustomerServiceImpl.java
  65. 21
      epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/TagServiceImpl.java
  66. 28
      epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/utils/TagColorUtils.java
  67. 18
      epmet-module/gov-voice/gov-voice-server/src/main/resources/db/migration/V0.0.4__create_specialsubject.sql
  68. 37
      epmet-module/gov-voice/gov-voice-server/src/main/resources/db/migration/V0.0.5__add_tag_color.sql
  69. 1
      epmet-module/gov-voice/gov-voice-server/src/main/resources/db/migration/V0.0.6__add_del_staffid.sql
  70. 79
      epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/ArticleDao.xml
  71. 42
      epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/SpecialSubjectDao.xml
  72. 8
      epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/TagCustomerDao.xml
  73. 3
      epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/impl/CustomerAppServiceImpl.java
  74. 11
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/form/ApplyCreateGroupFormDTO.java
  75. 2
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/controller/ResiGroupController.java
  76. 30
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupServiceImpl.java
  77. 10
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/invitation/service/impl/GroupInvitationServiceImpl.java
  78. 14
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/service/impl/NoticeServiceImpl.java
  79. 33
      epmet-module/resi-voice/resi-voice-server/src/main/java/com/epmet/controller/ArticleController.java
  80. 22
      epmet-module/resi-voice/resi-voice-server/src/main/java/com/epmet/service/ArticleService.java
  81. 38
      epmet-module/resi-voice/resi-voice-server/src/main/java/com/epmet/service/impl/ArticleServiceImpl.java
  82. 1
      epmet-user/epmet-user-server/src/main/resources/mapper/GridLatestDao.xml

30
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/ApplicationReadyEventListener.java

@ -13,10 +13,7 @@ import com.dingtalk.api.DefaultDingTalkClient;
import com.dingtalk.api.DingTalkClient;
import com.dingtalk.api.request.OapiRobotSendRequest;
import com.dingtalk.api.response.OapiRobotSendResponse;
import com.epmet.commons.tools.dto.form.DingTalkTextMsg;
import com.epmet.commons.tools.enums.EnvEnum;
import com.epmet.commons.tools.utils.HttpClientManager;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.utils.SpringContextUtils;
import com.taobao.api.ApiException;
import org.apache.logging.log4j.LogManager;
@ -47,36 +44,15 @@ public class ApplicationReadyEventListener implements ApplicationListener<Applic
EnvEnum currentEnv = EnvEnum.getCurrentEnv();
logger.info(currentEnv);
if (!EnvEnum.DEV.getCode().equals(currentEnv.getCode()) && !EnvEnum.LOCAL.getCode().equals(currentEnv.getCode())) {
//sendDingTextMsg();
sendDingMarkDownMsg();
}
}
private void sendDingTextMsg() {
//发送启动成功消息
InetUtils inetUtils = SpringContextUtils.getBean(InetUtils.class);
String serverIp = inetUtils.findFirstNonLoopbackHostInfo().getIpAddress();
//开发小组 群机器人地址
String url = "https://oapi.dingtalk.com/robot/send?access_token=ffd7c972b0525e249283df1a16b65a8b9d0012601f3a458dfc588c2eac497bb5";
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append(EnvEnum.getCurrentEnv().getName())
.append("【")
.append(appName)
.append("】")
.append("ip地址: ")
.append(serverIp)
.append("部署完毕!");
DingTalkTextMsg msg = new DingTalkTextMsg();
msg.setWebHook(url);
msg.setAtAll(true);
msg.setContent(stringBuilder.toString());
Result<String> stringResult = HttpClientManager.getInstance().sendPostByJSON(url, msg.getMsgContent());
logger.info(stringResult);
}
private String getServerIp() {
InetUtils inetUtils = SpringContextUtils.getBean(InetUtils.class);
if (inetUtils == null){
return null;
}
return inetUtils.findFirstNonLoopbackHostInfo().getIpAddress();
}

6
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/RequirePermissionEnum.java

@ -126,6 +126,12 @@ public enum RequirePermissionEnum {
WORK_PARTY_VOICE_EDIT("work_party_voice_edit", "党建声音:重新编辑", ""),
WORK_PARTY_VOICE_OFFLINE("work_party_voice_offline", "党建声音:下线文章", ""),
WORK_PARTY_VOICE_OPERATION_LIST("work_party_voice_operation_list","党建声音:查看文章操作记录",""),
/**
* 党务工作-专题管理
*/
WORK_SPECIAL_PROJECT_ENTRANCE("work_special_project_entrance","专题管理:功能入口图标","专题管理:图标入口"),
WORK_SPECIAL_PROJECT_ADD("work_special_project_add","专题管理:新增专题","专题管理:新增专题"),
WORK_SPECIAL_PROJECT_DEL("work_special_project_del","专题管理:移除专题","专题管理:移除专题"),
/**
* 基层治理-支部管理

4
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java

@ -138,7 +138,9 @@ public enum EpmetErrorCode {
REPEATED_SUBMIT_ERROR(8804, "请勿重复提交"),
CUSTOMER_VALIDATE_ERROR(8805, "内部数据校验异常"),
CATEGORY_IS_NULL(8806, "请设置分类"),
EXISTED_SPECIAL_PROJECT(8807, "已经添加过此专题"),
CAN_NOT_DEL_SPECIAL_PROJECT(8808, "您没有权限删除此专题"),
TAG_NOT_EXIST(8809,"标签不存在"),
//公众号 865..开头的码
PUBLIC_NOT_EXISTS(8651,"手机号未注册,请先完成信息注册"),

45
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/filter/LogMsgSendFilter.java

@ -9,19 +9,18 @@ import ch.qos.logback.core.spi.FilterReply;
import com.epmet.commons.tools.constant.ThreadLocalConstant;
import com.epmet.commons.tools.dto.form.DingTalkTextMsg;
import com.epmet.commons.tools.enums.EnvEnum;
import com.epmet.commons.tools.utils.DateUtils;
import com.epmet.commons.tools.utils.DingdingMsgSender;
import com.epmet.commons.tools.utils.SpringContextUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.commons.util.InetUtils;
import org.springframework.core.env.Environment;
import org.springframework.web.context.request.RequestAttributes;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.HttpServletRequest;
import java.text.SimpleDateFormat;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@ -47,40 +46,42 @@ public class LogMsgSendFilter extends LevelFilter {
//如果日志级别等于设置的日志级别 则发送消息
if (event.getLevel().isGreaterOrEqual(Level.ERROR)) {
try {
getServerInfo();
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append("【日志告警】\n");
stringBuilder.append("\n");
stringBuilder.append("告警级别:" + event.getLevel());
stringBuilder.append("告警级别:").append(event.getLevel());
stringBuilder.append("\n");
if (StringUtils.isNotBlank(appName)) {
stringBuilder.append("服务名称:" + appName);
stringBuilder.append("服务名称:").append(appName);
stringBuilder.append("\n");
}
getServerInfo();
if (StringUtils.isNotBlank(activeEnv)) {
stringBuilder.append("告警环境:" + EnvEnum.getEnum(activeEnv).getName());
stringBuilder.append("告警环境:").append(activeEnv);
stringBuilder.append("\n");
}
if (StringUtils.isNotBlank(serverIp)) {
stringBuilder.append("IP地址:" + serverIp);
stringBuilder.append("IP地址:").append(serverIp);
stringBuilder.append("\n");
}
stringBuilder.append("故障时间:" + formatLongTime2Str(event.getTimeStamp()));
stringBuilder.append("故障时间:").append(DateUtils.formatTimestamp(event.getTimeStamp(),DateUtils.DATE_TIME_PATTERN));
stringBuilder.append("\n");
stringBuilder.append("TraceId:" + Thread.currentThread().getName());
stringBuilder.append("TraceId:").append(Thread.currentThread().getName());
stringBuilder.append("\n");
HttpServletRequest request = getRequest();
if (request != null) {
String requestURI = request.getRequestURI();
stringBuilder.append("请求路径:" + requestURI);
stringBuilder.append("请求路径:").append(requestURI);
stringBuilder.append("\n");
stringBuilder.append("请求参数:" + ThreadLocalConstant.requestParam.get());
stringBuilder.append("请求参数:").append(ThreadLocalConstant.requestParam.get());
stringBuilder.append("\n");
}
@ -89,7 +90,7 @@ public class LogMsgSendFilter extends LevelFilter {
if (throwableProxy == null && formattedMessage.length() > 1000) {
formattedMessage = formattedMessage.substring(0, getCharacterPosition(formattedMessage, baseProjectPackage, 5));
}
stringBuilder.append("告警信息:" + formattedMessage);
stringBuilder.append("告警信息:").append(formattedMessage);
stringBuilder.append("\n");
@ -123,7 +124,7 @@ public class LogMsgSendFilter extends LevelFilter {
try {
if (serverIp == null) {
InetUtils inetUtils = SpringContextUtils.getBean(InetUtils.class);
if (inetUtils.findFirstNonLoopbackHostInfo() == null){
if (inetUtils == null || inetUtils.findFirstNonLoopbackHostInfo() == null){
return;
}
serverIp = inetUtils.findFirstNonLoopbackHostInfo().getIpAddress();
@ -134,12 +135,8 @@ public class LogMsgSendFilter extends LevelFilter {
}
try {
if (activeEnv == null) {
Environment environment = SpringContextUtils.getBean(Environment.class);
String[] activeProfiles = environment.getActiveProfiles();
if (activeProfiles != null && activeProfiles.length > 0) {
logger.info("activeProfiles:{}", activeProfiles);
activeEnv = activeProfiles[0];
}
EnvEnum currentEnv = EnvEnum.getCurrentEnv();
activeEnv = currentEnv.getName();
}
} catch (Exception e) {
logger.warn("getServerInfo get bean Environment exception", e);
@ -212,16 +209,6 @@ public class LogMsgSendFilter extends LevelFilter {
}
}
private String formatLongTime2Str(long timestamp) {
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
return dateFormat.format(timestamp);
}
public void setActiveEnv(String activeEnv) {
this.activeEnv = activeEnv;
}
public void setAppName(String appName) {
this.appName = appName;
}

12
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java

@ -228,7 +228,11 @@ public class RedisKeys {
* @return
*/
public static String getCustomerReTagKey(String customerId,String tagId) {
return rootPrefix.concat("tags:customer:relationTag:").concat(customerId).concat(StrConstant.COLON).concat(tagId);
String reTagKey = rootPrefix.concat("tags:customer:relationTag:").concat(customerId);
if (StringUtils.isNotBlank(tagId)){
reTagKey = reTagKey.concat(StrConstant.COLON).concat(tagId);
}
return reTagKey;
}
/**
@ -247,7 +251,11 @@ public class RedisKeys {
* @return
*/
public static String getGridReTagKey(String gridId,String tagId) {
return rootPrefix.concat("tags:grid:relationTag:").concat(gridId).concat(StrConstant.COLON).concat(tagId);
String gridReTagKey = rootPrefix.concat("tags:grid:relationTag:").concat(gridId);
if (StringUtils.isNotBlank(tagId)){
gridReTagKey = gridReTagKey.concat(StrConstant.COLON).concat(tagId);
}
return gridReTagKey;
}
/**

3
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/SpringContextUtils.java

@ -34,6 +34,9 @@ public class SpringContextUtils implements ApplicationContextAware {
}
public static <T> T getBean(Class<T> requiredType) {
if (applicationContext == null){
return null;
}
return applicationContext.getBean(requiredType);
}

40
epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/result/StaffRoleListResultDTO.java

@ -0,0 +1,40 @@
package com.epmet.dataaggre.dto.epmetuser.result;
import lombok.Data;
import java.io.Serializable;
/**
* @Description 根据客户Id staffId查询人员在客户下的角色列表-接口返参
* @Author sun
*/
@Data
public class StaffRoleListResultDTO implements Serializable {
private static final long serialVersionUID = -2049883620062097446L;
/**
* 客户Id
* */
private String customerId;
/**
* 员工Id
* */
private String staffId;
/**
* 员工姓名
* */
private String staffName;
/**
* 角色Id
* */
private String roleId;
/**
* 角色Key
* */
private String roleKey;
/**
* 角色名称
* */
private String roleName;
}

48
epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/result/StaffAgencyGridListResultDTO.java

@ -0,0 +1,48 @@
package com.epmet.dataaggre.dto.govorg.result;
import lombok.Data;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
/**
* 专题设置-组织网格切换树结构-接口返参
* @author sun
*/
@Data
public class StaffAgencyGridListResultDTO implements Serializable {
private static final long serialVersionUID = 1L;
//机关组织Id
private String agencyId = "";
//机关组织名称
private String agencyName = "";
//机关组织名称
private Boolean isOpt = true;
//网格:grid;社区级:community, 乡(镇、街道)级:street, 区县级: district, 市级: city 省级:province
private String orgLevel = "";
//当前组织id的上级id,如果当前是跟组织返回0
private String pid = "";
//当前组织id的所有上级id,如果当前是跟组织返回0
private String pids = "";
//当前机关的下属网格列表
private List<StaffAgencyGridListResultDTO.GridResultDTO> gridList = new ArrayList<>();
//当前组织的所有下级组织信息(递归)
private List<StaffAgencyGridListResultDTO> subAgencyGridList = new ArrayList<>();
@Data
public static class GridResultDTO{
//机关组织Id
private String gridId = "";
//机关组织名称
private String gridName = "";
//网格:grid;社区级:community, 乡(镇、街道)级:street, 区县级: district, 市级: city 省级:province
private String orgLevel = "";
//当前网格所属的组织id
private String pid = "";
//当前网格所有上级
private String pids = "";
}
}

15
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/GovOrgController.java

@ -14,12 +14,11 @@ import com.epmet.dataaggre.dto.govorg.form.NextAreaCodeFormDTO;
import com.epmet.dataaggre.dto.govorg.result.AgencyGridListResultDTO;
import com.epmet.dataaggre.dto.govorg.result.GridMemberDataAnalysisResultDTO;
import com.epmet.dataaggre.dto.govorg.result.NextAreaCodeResultDTO;
import com.epmet.dataaggre.dto.govorg.result.StaffAgencyGridListResultDTO;
import com.epmet.dataaggre.enums.GridMemberDataAnalysisEnums;
import com.epmet.dataaggre.service.AggreGridService;
import com.epmet.dataaggre.service.govorg.GovOrgService;
import com.epmet.dto.result.PublicAndInternalFileResultDTO;
import org.apache.commons.lang3.StringUtils;
import org.apache.xmlbeans.impl.xb.xsdschema.Public;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.PostMapping;
@ -29,7 +28,6 @@ import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.List;
import java.util.PriorityQueue;
/**
* @Author zxc
@ -119,4 +117,15 @@ public class GovOrgController {
List<GridMemberDataAnalysisResultDTO> resultList = aggreGridService.getGridMemberDataAnalysis(gridIds, searchedStaffName, loginUserId, month, sortType.getValue(), pageNo, pageSize);
return new Result().ok(resultList);
}
/**
* @Param tokenDto
* @Description 专题设置-组织网格切换树结构
* @author sun
*/
@PostMapping("staffagencygridlist")
public Result<StaffAgencyGridListResultDTO> staffAgencyGridList(@LoginUser TokenDto tokenDto) {
return new Result<StaffAgencyGridListResultDTO>().ok(govOrgService.staffAgencyGridList(tokenDto));
}
}

8
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmetuser/StaffRoleDao.java

@ -18,6 +18,7 @@
package com.epmet.dataaggre.dao.epmetuser;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dataaggre.dto.epmetuser.result.StaffRoleListResultDTO;
import com.epmet.dataaggre.dto.govorg.result.GridStaffResultDTO;
import com.epmet.dataaggre.entity.epmetuser.StaffRoleEntity;
import org.apache.ibatis.annotations.Mapper;
@ -40,4 +41,11 @@ public interface StaffRoleDao extends BaseDao<StaffRoleEntity> {
* @author sun
*/
List<GridStaffResultDTO> staffGridRole(@Param("forms") List<GridStaffResultDTO> forms, @Param("staffName") String staffName);
/**
* @Description 根据客户Id和staffId查询工作人员拥有的角色列表
* @Author sun
**/
List<StaffRoleListResultDTO> selectStaffRoleList(@Param("customerId") String customerId, @Param("staffId") String staffId);
}

7
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/govorg/CustomerAgencyDao.java

@ -19,6 +19,7 @@ package com.epmet.dataaggre.dao.govorg;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dataaggre.dto.govorg.result.AgencyGridResultDTO;
import com.epmet.dataaggre.dto.govorg.result.StaffAgencyGridListResultDTO;
import com.epmet.dataaggre.entity.govorg.CustomerAgencyEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@ -52,4 +53,10 @@ public interface CustomerAgencyDao extends BaseDao<CustomerAgencyEntity> {
List<CustomerAgencyEntity> selectNextAgency(@Param("customerId")String customerId, @Param("pid")String pid);
/**
* @Author sun
* @Description 递归查询当前组织的直属下级组织列表
**/
List<StaffAgencyGridListResultDTO> selectSubAgencyList(@Param("subAgencyPids") String subAgencyPids);
}

8
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/govorg/CustomerGridDao.java

@ -21,6 +21,7 @@ import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dataaggre.dto.govorg.CustomerGridDTO;
import com.epmet.dataaggre.dto.govorg.result.GridInfoResultDTO;
import com.epmet.dataaggre.dto.govorg.result.GridsInfoListResultDTO;
import com.epmet.dataaggre.dto.govorg.result.StaffAgencyGridListResultDTO;
import com.epmet.dataaggre.entity.govorg.CustomerGridEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@ -68,4 +69,11 @@ public interface CustomerGridDao extends BaseDao<CustomerGridEntity> {
* @author sun
*/
List<CustomerGridDTO> getGridInfoList(@Param("gridIds") List<String> gridIds, @Param("staffId") String staffId);
/**
* @Author sun
* @Description 查询当前组织下网格列表
**/
List<StaffAgencyGridListResultDTO.GridResultDTO> getGridListByAgencyId(@Param("agencyId") String agencyId);
}

7
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/govorg/CustomerStaffGridDao.java

@ -19,6 +19,7 @@ package com.epmet.dataaggre.dao.govorg;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dataaggre.dto.govorg.result.GridStaffResultDTO;
import com.epmet.dataaggre.dto.govorg.result.StaffAgencyGridListResultDTO;
import com.epmet.dataaggre.entity.govorg.CustomerStaffGridEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@ -39,4 +40,10 @@ public interface CustomerStaffGridDao extends BaseDao<CustomerStaffGridEntity> {
* @author sun
*/
List<GridStaffResultDTO> selectGridStaffByGridIds(@Param("gridIds") List<String> gridIds);
/**
* @Description 查询工作人员参与的网格列表信息
* @author sun
*/
List<StaffAgencyGridListResultDTO.GridResultDTO> getStaffGridList(@Param("agencyId") String agencyId, @Param("staffId") String staffId);
}

5
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/EpmetUserService.java

@ -81,4 +81,9 @@ public interface EpmetUserService {
*/
OpenStaffDetailResultDTO openStaffDetail(OpenStaffDetailFormDTO formDTO);
/**
* @Description 根据客户Id和staffId查询工作人员拥有的角色列表
* @Author sun
**/
List<StaffRoleListResultDTO> getStaffRoleList(String customerId, String userId);
}

9
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/EpmetUserServiceImpl.java

@ -365,5 +365,14 @@ public class EpmetUserServiceImpl implements EpmetUserService {
return resultDTO;
}
/**
* @Description 根据客户Id和staffId查询工作人员拥有的角色列表
* @Author sun
**/
@Override
public List<StaffRoleListResultDTO> getStaffRoleList(String customerId, String userId) {
return staffRoleDao.selectStaffRoleList(customerId, userId);
}
}

9
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/GovOrgService.java

@ -1,5 +1,6 @@
package com.epmet.dataaggre.service.govorg;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.dataaggre.dto.govorg.CustomerAgencyDTO;
import com.epmet.dataaggre.dto.govorg.CustomerGridDTO;
import com.epmet.dataaggre.dto.govorg.form.NextAreaCodeFormDTO;
@ -72,4 +73,12 @@ public interface GovOrgService {
* @author sun
*/
CustomerAgencyDTO gridByAgencyId(String customerId, String staffId);
/**
* @Param tokenDto
* @Description 专题设置-组织网格切换树结构
* @author sun
*/
StaffAgencyGridListResultDTO staffAgencyGridList(TokenDto tokenDto);
}

83
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/impl/GovOrgServiceImpl.java

@ -5,12 +5,13 @@ import com.epmet.commons.dynamic.datasource.annotation.DataSource;
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.utils.Result;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.dataaggre.constant.DataSourceConstant;
import com.epmet.dataaggre.dao.govorg.CustomerAgencyDao;
import com.epmet.dataaggre.dao.govorg.CustomerGridDao;
import com.epmet.dataaggre.dao.govorg.CustomerStaffAgencyDao;
import com.epmet.dataaggre.dao.govorg.CustomerStaffGridDao;
import com.epmet.dataaggre.dto.epmetuser.result.StaffRoleListResultDTO;
import com.epmet.dataaggre.dto.govorg.CustomerAgencyDTO;
import com.epmet.dataaggre.dto.govorg.CustomerGridDTO;
import com.epmet.dataaggre.dto.govorg.CustomerStaffAgencyDTO;
@ -285,4 +286,84 @@ public class GovOrgServiceImpl implements GovOrgService {
return customerStaffAgencyDao.selectAgencyByStaffId(customerId, staffId);
}
/**
* @Param tokenDto
* @Description 专题设置-组织网格切换树结构
* @author sun
*/
@Override
public StaffAgencyGridListResultDTO staffAgencyGridList(TokenDto tokenDto) {
StaffAgencyGridListResultDTO resultDTO = new StaffAgencyGridListResultDTO();
//1.查询当前人员所属组织信息
CustomerAgencyDTO agencyDTO = customerStaffAgencyDao.selectAgencyByStaffId(tokenDto.getCustomerId(), tokenDto.getUserId());
if (null == agencyDTO) {
throw new RenException("未查询到当前工作人员所属组织信息");
}
//2.获取当前人员工作端角色列表信息
List<StaffRoleListResultDTO> roleList = epmetUserService.getStaffRoleList(tokenDto.getCustomerId(), tokenDto.getUserId());
if (roleList.size() < NumConstant.ONE) {
return resultDTO;
}
//3.判断是否具有党建负责人或党建宣传员角色
//机关党建负责人角色
boolean party = false;
//党建宣传员角色
boolean gridParty = false;
for (StaffRoleListResultDTO role : roleList) {
if ("party_principals".equals(role.getRoleKey())) {
party = true;
}
if ("grid_party_director".equals(role.getRoleKey())) {
gridParty = true;
}
}
if (!party && !gridParty) {
return resultDTO;
}
//4.根据不同角色查询不同数据
if (party) {
//4.1:查询当前机关的网格列表以及所有下级机关的网格列表
//当前机关下网格列表
List<StaffAgencyGridListResultDTO.GridResultDTO> gridList = customerGridDao.getGridListByAgencyId(agencyDTO.getId());
resultDTO.setGridList(gridList);
//递归查询当前组织的下级组织以及每个下级组织对应的网格列表
//根组织pids为空
List<StaffAgencyGridListResultDTO> subAgencyGridList = getSubAgencyAndGridList(("".equals(agencyDTO.getPids()) ? "" : agencyDTO.getPids() + ":") + agencyDTO.getId());
resultDTO.setSubAgencyGridList(subAgencyGridList);
} else if (gridParty) {
resultDTO.setIsOpt(false);
//4.2:查询人员在当前机关下参与的网格列表
List<StaffAgencyGridListResultDTO.GridResultDTO> gridList = customerStaffGridDao.getStaffGridList(agencyDTO.getId(), tokenDto.getUserId());
resultDTO.setGridList(gridList);
}
//5.封装数据并返回
resultDTO.setAgencyId(agencyDTO.getId());
resultDTO.setAgencyName(agencyDTO.getOrganizationName());
resultDTO.setOrgLevel(agencyDTO.getLevel());
resultDTO.setPid(agencyDTO.getPid());
resultDTO.setPids(("".equals(agencyDTO.getPids()) ? "0" : agencyDTO.getPids()));
return resultDTO;
}
/**
* @Author sun
* @Description 递归查询当前组织的下一级组织网格列表
**/
private List<StaffAgencyGridListResultDTO> getSubAgencyAndGridList(String subAgencyPids) {
List<StaffAgencyGridListResultDTO> subAgencyList = customerAgencyDao.selectSubAgencyList(subAgencyPids);
if (subAgencyList.size() > NumConstant.ZERO) {
for (StaffAgencyGridListResultDTO sub : subAgencyList) {
List<StaffAgencyGridListResultDTO.GridResultDTO> gridList = customerGridDao.getGridListByAgencyId(sub.getAgencyId());
sub.setGridList(gridList);
List<StaffAgencyGridListResultDTO> subAgency = getSubAgencyAndGridList(sub.getPids() + ":" + sub.getAgencyId());
sub.setSubAgencyGridList(subAgency);
}
}
return subAgencyList;
}
}

24
epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/StaffRoleDao.xml

@ -22,4 +22,28 @@
</foreach>
</select>
<select id="selectStaffRoleList" resultType="com.epmet.dataaggre.dto.epmetuser.result.StaffRoleListResultDTO">
SELECT
staff.customer_id AS "customerId",
staff.user_id AS "staffId",
staff.real_name AS "staffName",
role.role_id AS "roleId",
rolename.role_key AS "roleKey",
rolename.role_name AS "roleName"
FROM
staff_role role
LEFT JOIN customer_staff staff ON ( role.staff_id = staff.user_id )
LEFT JOIN gov_staff_role rolename ON ( role.role_id = rolename.id )
WHERE
role.del_flag = '0'
AND staff.del_flag = '0'
AND rolename.del_flag = '0'
<if test='null != customerId and "" != customerId'>
AND staff.customer_id = #{customerId}
</if>
<if test='null != staffId and "" != staffId'>
AND staff.user_id = #{staffId}
</if>
</select>
</mapper>

17
epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govorg/CustomerAgencyDao.xml

@ -45,4 +45,21 @@
AND ca.PID = #{pid}
order by ca.CREATED_TIME asc
</select>
<select id="selectSubAgencyList" resultType="com.epmet.dataaggre.dto.govorg.result.StaffAgencyGridListResultDTO">
SELECT
id AS "agencyId",
organization_name AS "agencyName",
level AS "orgLevel",
pid AS "pid",
pids AS "pids"
FROM
customer_agency
WHERE
del_flag = '0'
AND pids = #{subAgencyPids}
ORDER BY
created_time DESC
</select>
</mapper>

16
epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govorg/CustomerGridDao.xml

@ -147,4 +147,20 @@
</choose>
</select>
<select id="getGridListByAgencyId" resultType="com.epmet.dataaggre.dto.govorg.result.StaffAgencyGridListResultDTO$GridResultDTO">
SELECT
cg.id AS "gridId",
cg.grid_name AS "gridName",
'grid' AS "orgLevel",
ca.id AS "pid",
IF (ca.pids = '', ca.id, CONCAT(ca.pids, ':', ca.id)) AS "pids"
FROM
customer_grid cg
INNER JOIN customer_agency ca ON cg.pid = ca.id
WHERE
cg.del_flag = '0'
AND ca.del_flag = '0'
AND cg.pid = #{agencyId}
</select>
</mapper>

9
epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govorg/CustomerStaffAgencyDao.xml

@ -19,7 +19,14 @@
<select id="selectAgencyByStaffId" resultType="com.epmet.dataaggre.dto.govorg.CustomerAgencyDTO">
SELECT
ca.id,
ca.all_parent_name
ca.customer_id,
ca.pid,
ca.pids AS "pids" ,
ca.all_parent_name,
ca.organization_name,
ca.level,
ca.area_code,
ca.parent_area_code
FROM
customer_staff_agency csa
INNER JOIN customer_agency ca ON csa.agency_id = ca.id

17
epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govorg/CustomerStaffGridDao.xml

@ -18,4 +18,21 @@
)
</select>
<select id="getStaffGridList" resultType="com.epmet.dataaggre.dto.govorg.result.StaffAgencyGridListResultDTO$GridResultDTO">
SELECT
cg.id AS "gridId",
cg.grid_name AS "gridName",
'grid' AS "orgLevel",
ca.id AS "pid",
IF (ca.pids = '', ca.id, CONCAT(ca.pids, ':', ca.id)) AS "pids"
FROM
customer_staff_grid csg
INNER JOIN customer_grid cg ON csg.grid_id = cg.id
INNER JOIN customer_agency ca ON cg.pid = ca.id
WHERE
csg.del_flag = '0'
AND csg.user_id = #{staffId}
AND ca.id = #{agencyId}
</select>
</mapper>

60
epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/impl/StaffAgencyServiceImpl.java

@ -17,6 +17,7 @@
package com.epmet.service.impl;
import com.alibaba.fastjson.JSON;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.ConvertUtils;
@ -31,10 +32,12 @@ import com.epmet.dto.result.StaffGridResultDTO;
import com.epmet.feign.*;
import com.epmet.service.StaffAgencyService;
import org.apache.commons.lang3.StringUtils;
import org.jetbrains.annotations.Nullable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.util.ArrayList;
import java.util.List;
@ -214,30 +217,59 @@ public class StaffAgencyServiceImpl implements StaffAgencyService {
**/
@Override
public Result<CustomerGridByUserIdResultDTO> getLatestGrid(LatestGridFormDTO latestGridFormDTO) {
Result<CustomerGridByUserIdResultDTO> latestGridResult =
epmetUserFeignClient.getStaffLatestGrid(latestGridFormDTO);
//首先获取该员工的网格列表 如果为空则直接返回
Result<List<CustomerGridByUserIdResultDTO>> staffGridListResult = govOrgFeignClient.getMyGrids(latestGridFormDTO.getStaffId());
if (staffGridListResult == null || !staffGridListResult.success() || CollectionUtils.isEmpty(staffGridListResult.getData())){
logger.warn("getLatestGrid method getMyGrids return null,param:{}", JSON.toJSONString(latestGridFormDTO));
return new Result<>();
}
//获取该工作人员的最后访问记录 如果不为空 判断下是否所访问网格有效 无效则取工作人员的任意网格返回并生成记录 否则 直接返回访问记录中的网格
Result<CustomerGridByUserIdResultDTO> latestGridResult = epmetUserFeignClient.getStaffLatestGrid(latestGridFormDTO);
if (latestGridResult.success() && null != latestGridResult.getData() && StringUtils.isNotBlank(latestGridResult.getData().getGridId())) {
long count = staffGridListResult.getData().stream().filter(o -> o.getGridId().equals(latestGridResult.getData().getGridId())).count();
//count 如果==0 说明访问记录中的网格已经无效了 则直接查询工作人员最新的网格作为进入的网格
if (count == 0){
Result<CustomerGridByUserIdResultDTO> staffGridResult = getStaffLatestGridAndSaveVisitRecord(latestGridFormDTO);
if (staffGridResult != null) {
return staffGridResult;
}
}
return latestGridResult;
} else {
Result<CustomerGridByUserIdResultDTO> staffGridResult =
govOrgFeignClient.getStaffGrid(latestGridFormDTO);
if (staffGridResult.success() && null != staffGridResult.getData() && StringUtils.isNotBlank(staffGridResult.getData().getGridId())) {
StaffGridVisitedFormDTO gridRecordParam = new StaffGridVisitedFormDTO();
gridRecordParam.setGridId(staffGridResult.getData().getGridId());
gridRecordParam.setCustomerId(latestGridFormDTO.getCustomerId());
gridRecordParam.setStaffId(latestGridFormDTO.getStaffId());
Result writeRecordResult = epmetUserFeignClient.saveStaffGridVisitedRecord(gridRecordParam);
if(writeRecordResult.success()){
logger.warn("com.epmet.service.impl.StaffAgencyServiceImpl.getLatestGrid,工作人员网格访问网格写入失败,staffId:{},gridId:{}",latestGridFormDTO.getStaffId(),staffGridResult.getData().getGridId());
}
Result<CustomerGridByUserIdResultDTO> staffGridResult = getStaffLatestGridAndSaveVisitRecord(latestGridFormDTO);
if (staffGridResult != null) {
return staffGridResult;
}
}
logger.info(String.format("客户id%s,staffId%s查询最后一次登录网格为空",latestGridFormDTO.getCustomerId(),latestGridFormDTO.getStaffId()));
//.error(StaffAgencyConstant.QUERY_LATEST_GRID_INFO_FAILED)
return new Result<>();
}
/**
* desc: 根据参数获取工作人员最新网格 并生成网格网格记录
*
* @param latestGridFormDTO
* @return com.epmet.commons.tools.utils.Result<com.epmet.dto.result.CustomerGridByUserIdResultDTO>
* @author LiuJanJun
* @date 2021/7/27 4:04 下午
*/
@Nullable
private Result<CustomerGridByUserIdResultDTO> getStaffLatestGridAndSaveVisitRecord(LatestGridFormDTO latestGridFormDTO) {
Result<CustomerGridByUserIdResultDTO> staffGridResult = govOrgFeignClient.getStaffGrid(latestGridFormDTO);
if (staffGridResult.success() && null != staffGridResult.getData() && StringUtils.isNotBlank(staffGridResult.getData().getGridId())) {
StaffGridVisitedFormDTO gridRecordParam = new StaffGridVisitedFormDTO();
gridRecordParam.setGridId(staffGridResult.getData().getGridId());
gridRecordParam.setCustomerId(latestGridFormDTO.getCustomerId());
gridRecordParam.setStaffId(latestGridFormDTO.getStaffId());
Result writeRecordResult = epmetUserFeignClient.saveStaffGridVisitedRecord(gridRecordParam);
if(writeRecordResult.success()){
logger.warn("com.epmet.service.impl.StaffAgencyServiceImpl.getLatestGrid,工作人员网格访问网格写入失败,staffId:{},gridId:{}",latestGridFormDTO.getStaffId(),staffGridResult.getData().getGridId());
}
return staffGridResult;
}
return null;
}
@Override
public void switchGrid(SwitchGridFormDTO switchGridFormDTO) {

5
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/UpdateTagFormDTO.java

@ -25,6 +25,11 @@ public class UpdateTagFormDTO implements Serializable {
*/
private String tagName;
/**
* 标签颜色
*/
private String tagColor;
/**
* 使用计数
*/

17
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/GovOrgOpenFeignClient.java

@ -353,4 +353,21 @@ public interface GovOrgOpenFeignClient {
**/
@GetMapping(value = "/gov/org/customeragency/getareacodeswitch/{customerId}")
Result<String> getAreaCodeSwitch(@PathVariable("customerId")String customerId);
/**
* @Description 根据网格ID查询pids
* @Param gridId
* @author zxc
* @date 2021/7/16 9:52 上午
*/
@PostMapping(value = "/gov/org/customergrid/pidsbygrid")
Result<String> selectPidsByGridId(@RequestParam("gridId") String gridId);
/**
* 工作人员的个人信息
* @param fromDTO
* @return
*/
@PostMapping("/gov/org/staff/mine")
Result<MineResultDTO> queryStaffProfile(@RequestBody StaffInfoFromDTO fromDTO);
}

10
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/fallback/GovOrgOpenFeignClientFallback.java

@ -209,4 +209,14 @@ public class GovOrgOpenFeignClientFallback implements GovOrgOpenFeignClient {
public Result<String> getAreaCodeSwitch(String customerId) {
return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "getAreaCodeSwitch", customerId);
}
@Override
public Result<MineResultDTO> queryStaffProfile(StaffInfoFromDTO fromDTO) {
return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "mine", fromDTO);
}
@Override
public Result<String> selectPidsByGridId(String gridId) {
return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "selectPidsByGridId", gridId);
}
}

11
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerGridController.java

@ -241,4 +241,15 @@ public class CustomerGridController {
List<String> resultDTOS = customerGridService.listGridIdsInCommunity(gridId);
return new Result<List<String>>().ok(resultDTOS);
}
/**
* @Description 根据网格ID查询pids
* @Param gridId
* @author zxc
* @date 2021/7/16 9:52 上午
*/
@PostMapping("pidsbygrid")
public Result<String> selectPidsByGridId(@RequestParam("gridId") String gridId){
return new Result<String>().ok(customerGridService.selectPidsByGridId(gridId));
}
}

8
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerGridDao.java

@ -268,4 +268,12 @@ public interface CustomerGridDao extends BaseDao<CustomerGridEntity> {
* @date 2021/4/19 11:56 上午
*/
CustomerGridDTO getGridBaseInfoById(@Param("gridId") String gridId);
/**
* @Description 根据网格ID查询pids
* @Param gridId
* @author zxc
* @date 2021/7/16 9:52 上午
*/
String selectPidsByGridId(@Param("gridId")String gridId);
}

8
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerGridService.java

@ -287,4 +287,12 @@ public interface CustomerGridService extends BaseService<CustomerGridEntity> {
* @date 2021/4/19 11:53 上午
*/
Result<CustomerGridDTO> getBaseInfo(CustomerGridFormDTO customerGridFormDTO);
/**
* @Description 根据网格ID查询pids
* @Param gridId
* @author zxc
* @date 2021/7/16 9:52 上午
*/
String selectPidsByGridId(String gridId);
}

14
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridServiceImpl.java

@ -707,4 +707,18 @@ public class CustomerGridServiceImpl extends BaseServiceImpl<CustomerGridDao, Cu
public Result<CustomerGridDTO> getBaseInfo(CustomerGridFormDTO customerGridFormDTO) {
return new Result<CustomerGridDTO>().ok(ConvertUtils.sourceToTarget(baseDao.selectById(customerGridFormDTO.getGridId()), CustomerGridDTO.class));
}
/**
* @Description 根据网格ID查询pids
* @Param gridId
* @author zxc
* @date 2021/7/16 9:52 上午
*/
@Override
public String selectPidsByGridId(String gridId) {
if (StringUtils.isNotBlank(gridId)){
return baseDao.selectPidsByGridId(gridId);
}
return "";
}
}

2
epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml

@ -118,6 +118,8 @@
FROM customer_staff_agency csa
INNER JOIN customer_agency ca ON (csa.AGENCY_ID = ca.ID)
WHERE csa.USER_ID = #{staffId}
and csa.del_flag='0'
and ca.del_flag='0'
</select>
<select id="selectAgencyListByIds" resultType="com.epmet.dto.CustomerAgencyDTO">

5
epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerGridDao.xml

@ -579,4 +579,9 @@
cg.ID = #{gridId}
AND cg.DEL_FLAG = '0'
</select>
<!-- 根据网格ID查询pids -->
<select id="selectPidsByGridId" resultType="java.lang.String">
SELECT PIDS FROM customer_grid WHERE DEL_FLAG = '0' AND ID = #{gridId}
</select>
</mapper>

120
epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/SpecialSubjectDTO.java

@ -0,0 +1,120 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.dto;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* 专题表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-07-15
*/
@Data
public class SpecialSubjectDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键(专题id)
*/
private String id;
/**
* 客户id
*/
private String customerId;
/**
* 标签id
*/
private String tagId;
/**
* 新增此专题的用户id
*/
private String addUserId;
/**
* 新增此专题时用户所在的组织id或者网格id
*/
private String addOrgId;
/**
* 网格grid社区级community
街道:street,
区县级: district,
市级: city
省级:province
*/
private String orgLevel;
/**
* 新增此专题用户所属的组织id
*/
private String addUserAgencyId;
/**
* 删除标识 0未删除1已删除
*/
private String delFlag;
/**
* 乐观锁
*/
private Integer revision;
/**
* 创建人
*/
private String createdBy;
/**
* 创建时间
*/
private Date createdTime;
/**
* 更新人
*/
private String updatedBy;
/**
* 更新时间
*/
private Date updatedTime;
/**
* 标签名
*/
private String tagName;
/**
* 扩展属性标签颜色
*/
private String tagColor;
/**
* 删除人id
*/
private String delStaffId;
}

56
epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/AddSpecialSubjectFormDTO.java

@ -0,0 +1,56 @@
package com.epmet.dto.form;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* 专题管理添加专题
*
* @author yinzuomei@elink-cn.com
* @date 2021/7/15 14:24
*/
@Data
public class AddSpecialSubjectFormDTO implements Serializable {
private static final long serialVersionUID = -4469613386814496224L;
public interface AddUserInternalGroup {
}
/**
* 当前所在网格或者组织id
*/
@NotBlank(message = "orgId不能为空", groups = AddUserInternalGroup.class)
private String orgId;
@NotBlank(message = "pid不能为空", groups = AddUserInternalGroup.class)
private String pid;
/**
* orgId的所有上级id
*/
@NotBlank(message = "pids不能为空", groups = AddUserInternalGroup.class)
private String pids;
/**
* 网格grid社区级community 街道:street, 区县级: district, 市级: city 省级:province
*/
@NotBlank(message = "orgLevel不能为空", groups = AddUserInternalGroup.class)
private String orgLevel;
/**
* 所选的标签id
*/
@NotBlank(message = "tagId不能为空", groups = AddUserInternalGroup.class)
private String tagId;
// 以下属性从token中获取
/**
* 从TokenDto中获取当前用户id
*/
@NotBlank(message = "从token中获取userId为空", groups = AddUserInternalGroup.class)
private String addUserId;
@NotBlank(message = "从token中获取客户id为空", groups = AddUserInternalGroup.class)
private String customerId;
}

42
epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/DelSpecialSubjectFormDTO.java

@ -0,0 +1,42 @@
package com.epmet.dto.form;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* 专题管理删除专题
*
* @author yinzuomei@elink-cn.com
* @date 2021/7/15 20:50
*/
@Data
public class DelSpecialSubjectFormDTO implements Serializable {
private static final long serialVersionUID = -2305529822756834522L;
public interface AddUserInternalGroup {
}
/**
* 专题id
*/
@NotBlank(message = "specialSubjectId不能为空", groups = AddUserInternalGroup.class)
private String specialSubjectId;
/**
* 当前所在网格或者组织id
*/
@NotBlank(message = "orgId不能为空", groups = AddUserInternalGroup.class)
private String orgId;
// 以下属性从token中获取
/**
* 从TokenDto中获取当前用户id
*/
@NotBlank(message = "从token中获取userId为空", groups = AddUserInternalGroup.class)
private String userId;
@NotBlank(message = "从token中获取客户id为空", groups = AddUserInternalGroup.class)
private String customerId;
}

22
epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/HotSubjectTagFormDTO.java

@ -0,0 +1,22 @@
package com.epmet.dto.form;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* @author zhaoqifeng
* @dscription
* @date 2021/7/16 10:14
*/
@Data
public class HotSubjectTagFormDTO implements Serializable {
private static final long serialVersionUID = -5526800827207175876L;
public interface HotSubjectTagGroup {}
private String customerId;
@NotBlank(message = "orgId不能为空", groups = HotSubjectTagGroup.class)
private String orgId;
@NotBlank(message = "pids不能为空", groups = HotSubjectTagGroup.class)
private String pids;
}

6
epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/InitTagsFormDTO.java

@ -3,7 +3,6 @@ package com.epmet.dto.form;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* @Author zxc
@ -29,6 +28,11 @@ public class InitTagsFormDTO implements Serializable {
*/
private String tagName;
/**
* 标签颜色
*/
private String tagColor;
/**
* 使用计数
*/

19
epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/PreviewFormDTO.java

@ -0,0 +1,19 @@
package com.epmet.dto.form;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* @author zhaoqifeng
* @dscription
* @date 2021/7/16 9:41
*/
@Data
public class PreviewFormDTO implements Serializable {
private static final long serialVersionUID = -3764759458780976123L;
private List<String> tagIdList;
private Integer pageSize;
private Integer pageNo;
}

41
epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/QuerySpecialSubFormDTO.java

@ -0,0 +1,41 @@
package com.epmet.dto.form;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* 专题管理已有专题列表
*
* @author yinzuomei@elink-cn.com
* @date 2021/7/15 21:09
*/
@Data
public class QuerySpecialSubFormDTO implements Serializable {
private static final long serialVersionUID = -436139256753489157L;
public interface AddUserInternalGroup {
}
/**
* 当前所在网格或者组织id
*/
@NotBlank(message = "orgId不能为空", groups = AddUserInternalGroup.class)
private String orgId;
/**
* orgId的所有上级id
*/
@NotBlank(message = "pids不能为空", groups = AddUserInternalGroup.class)
private String pids;
/**
* 当前登录用户userId,
*/
private String userId;
/**
* 当前登录用户客户id
*/
private String customerId;
}

33
epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/SubjectArticleListFormDTO.java

@ -0,0 +1,33 @@
package com.epmet.dto.form;
import com.epmet.commons.tools.validator.group.CustomerClientShowGroup;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
/**
* @Author zxc
* @DateTime 2021/7/15 2:05 下午
* @DESC
*/
@Data
public class SubjectArticleListFormDTO implements Serializable {
private static final long serialVersionUID = 7657974985102791998L;
public interface SubjectArticleListForm extends CustomerClientShowGroup{};
@NotBlank(message = "网格ID不能为空",groups = SubjectArticleListForm.class)
private String gridId;
@NotBlank(message = "标签ID不能为空",groups = SubjectArticleListForm.class)
private String tagId;
@NotNull(message = "pageSize不能为空",groups = SubjectArticleListForm.class)
private Integer pageSize;
@NotNull(message = "pageNo不能为空",groups = SubjectArticleListForm.class)
private Integer pageNo;
}

23
epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/SubjectListFormDTO.java

@ -0,0 +1,23 @@
package com.epmet.dto.form;
import com.epmet.commons.tools.validator.group.CustomerClientShowGroup;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* @Author zxc
* @DateTime 2021/7/15 4:34 下午
* @DESC
*/
@Data
public class SubjectListFormDTO implements Serializable {
private static final long serialVersionUID = 6397877545890473794L;
public interface SubjectListForm extends CustomerClientShowGroup{}
@NotBlank(message = "网格ID不能为空",groups = SubjectListForm.class)
private String gridId;
}

23
epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/AddSpecialSubjectResultDTO.java

@ -0,0 +1,23 @@
package com.epmet.dto.result;
import lombok.Data;
import java.io.Serializable;
/**
* 专题管理添加专题
*
* @author yinzuomei@elink-cn.com
* @date 2021/7/15 17:46
*/
@Data
public class AddSpecialSubjectResultDTO implements Serializable {
/**
* 刚添加成功的专题id
* */
private String specialSubjectId;
public AddSpecialSubjectResultDTO(String id) {
this.specialSubjectId=id;
}
}

4
epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/ArticleListResultDTO.java

@ -43,4 +43,8 @@ public class ArticleListResultDTO implements Serializable {
* */
private String tagName;
/**
* 文章封面
* */
private String articleCoverImg;
}

19
epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/PreviewResultDTO.java

@ -0,0 +1,19 @@
package com.epmet.dto.result;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* @author zhaoqifeng
* @dscription
* @date 2021/7/16 14:26
*/
@Data
public class PreviewResultDTO implements Serializable {
private static final long serialVersionUID = 4801322472642418941L;
private String specialSubjectId;
private String tagName;
private List<ArticleListResultDTO> articleList;
}

61
epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/SubjectArticleListResultDTO.java

@ -0,0 +1,61 @@
package com.epmet.dto.result;
import lombok.Data;
import java.io.Serializable;
/**
* @Author zxc
* @DateTime 2021/7/15 2:11 下午
* @DESC
*/
@Data
public class SubjectArticleListResultDTO implements Serializable {
private static final long serialVersionUID = 2580894348808140034L;
/**
* 文章标题
*/
private String articleTitle;
/**
* 文章内容
*/
private String articleContent;
/**
* 文章ID
*/
private String articleId;
/**
* 发布者姓名
*/
private String publisherName;
/**
* 发布时间
*/
private String publishDate;
/**
* 标签名字集合
*/
private String tagNames;
/**
* 文章封面
*/
private String articleCoverImg;
public SubjectArticleListResultDTO() {
this.articleTitle = "";
this.articleContent = "";
this.articleId = "";
this.publisherName = "";
this.publishDate = "";
this.tagNames = "";
this.articleCoverImg = "";
}
}

31
epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/SubjectListResultDTO.java

@ -0,0 +1,31 @@
package com.epmet.dto.result;
import lombok.Data;
import java.io.Serializable;
/**
* @Author zxc
* @DateTime 2021/7/15 4:46 下午
* @DESC
*/
@Data
public class SubjectListResultDTO implements Serializable {
private static final long serialVersionUID = -7761847964768693672L;
/**
* 标签ID
*/
private String tagId;
/**
* 专题名字
*/
private String tagName;
/**
* 标签颜色
*/
private String tagColor;
}

5
epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/TagInfoResultDTO.java

@ -24,4 +24,9 @@ public class TagInfoResultDTO implements Serializable {
* 标签名称
*/
private String tagName;
/**
* 标签颜色
*/
private String tagColor;
}

5
epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/UpdateTagUseCountsResultDTO.java

@ -31,4 +31,9 @@ public class UpdateTagUseCountsResultDTO implements Serializable {
* 标签名称
*/
private String tagName;
/**
* 标签颜色
*/
private String tagColor;
}

63
epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/WorkSpecialSubjectResultDTO.java

@ -0,0 +1,63 @@
package com.epmet.dto.result;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* 专题管理已有专题列表
*
* @author yinzuomei@elink-cn.com
* @date 2021/7/15 21:14
*/
@Data
public class WorkSpecialSubjectResultDTO implements Serializable {
private static final long serialVersionUID = 8147664815754574860L;
/**
* 标签id
*/
private String tagId;
/**
* 标签名称
*/
private String tagName;
/**
* 标签颜色
*/
private String tagColor;
/**
* true代表可以删除false不可删除隐藏减号
*/
private Boolean canDel;
/**
* 专题id
*/
private String specialSubjectId;
private String addOrgId;
private String orgLevel;
/**
* 创建时间-前端无用
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date createdTime;
/**
* 创建人-前端无用
*/
private String createdBy;
/**
* 新增此专题用户所属的组织id
* mean:当前人是谁
* -前端无用
*/
private String addUserAgencyId;
}

17
epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/feign/GovVoiceOpenFeignClient.java

@ -81,5 +81,22 @@ public interface GovVoiceOpenFeignClient {
@PostMapping("/gov/voice/article/resiarticledetail")
Result<ArticleDetailResultDTO> resiArticleDetail(@RequestBody ResiArticleDetailFormDTO articleDetailFormDTO);
/**
* @Description 专题文章列表
* @Param formDTO
* @author zxc
* @date 2021/7/16 1:26 下午
*/
@PostMapping("/gov/voice/article/subjectarticlelist")
Result<List<SubjectArticleListResultDTO>> subjectArticleList(@RequestBody SubjectArticleListFormDTO formDTO);
/**
* @Description 专题列表
* @Param formDTO
* @author zxc
* @date 2021/7/16 1:26 下午
*/
@PostMapping("/gov/voice/article/subjectlist")
Result<List<SubjectListResultDTO>> subjectList(@RequestBody SubjectListFormDTO formDTO);
}

10
epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/feign/fallback/GovVoiceOpenFeignClientFallback.java

@ -47,4 +47,14 @@ public class GovVoiceOpenFeignClientFallback implements GovVoiceOpenFeignClient
public Result<ArticleDetailResultDTO> resiArticleDetail(ResiArticleDetailFormDTO articleDetailFormDTO) {
return ModuleUtils.feignConError(ServiceConstant.GOV_VOICE_SERVER, "resiArticleDetail", articleDetailFormDTO);
}
@Override
public Result<List<SubjectArticleListResultDTO>> subjectArticleList(SubjectArticleListFormDTO formDTO) {
return ModuleUtils.feignConError(ServiceConstant.GOV_VOICE_SERVER, "subjectArticleList", formDTO);
}
@Override
public Result<List<SubjectListResultDTO>> subjectList(SubjectListFormDTO formDTO) {
return ModuleUtils.feignConError(ServiceConstant.GOV_VOICE_SERVER, "subjectList", formDTO);
}
}

28
epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/controller/ArticleController.java

@ -249,14 +249,14 @@ public class ArticleController {
log.error("scanContent draftId:{} return result null", draftId);
}
if (syncScanResult.isAllPass()) {
if (syncScanResult != null && syncScanResult.isAllPass()) {
articleService.scanAllPassPublishArticle(tokenDto, draftId, syncScanResult);
} else {
articleService.updateAuditStatusFailById(draftId, syncScanResult);
}
} catch (Exception e) {
articleService.updateDraftPublishStatus(draftId, DraftConstant.AUDITFAIL, null);
log.error("scanContent exception draftId:{} return result null", e);
log.error("scanContent exception return result null", e);
}
}
@ -378,4 +378,28 @@ public class ArticleController {
return new Result<DraftDetailResultDTO>().ok(draftDetailResultDTO);
}
/**
* @Description 专题文章列表
* @Param formDTO
* @author zxc
* @date 2021/7/15 2:21 下午
*/
@PostMapping("subjectarticlelist")
public Result<List<SubjectArticleListResultDTO>> subjectArticleList(@RequestBody SubjectArticleListFormDTO formDTO){
ValidatorUtils.validateEntity(formDTO,SubjectArticleListFormDTO.SubjectArticleListForm.class);
return new Result<List<SubjectArticleListResultDTO>>().ok(articleService.subjectArticleList(formDTO));
}
/**
* @Description 专题列表
* @Param formDTO
* @author zxc
* @date 2021/7/15 5:22 下午
*/
@PostMapping("subjectlist")
public Result<List<SubjectListResultDTO>> subjectList(@RequestBody SubjectListFormDTO formDTO){
ValidatorUtils.validateEntity(formDTO, SubjectListFormDTO.SubjectListForm.class);
return new Result<List<SubjectListResultDTO>>().ok(articleService.subjectList(formDTO));
}
}

128
epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/controller/SpecialSubjectController.java

@ -0,0 +1,128 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.controller;
import com.epmet.commons.tools.annotation.LoginUser;
import com.epmet.commons.tools.annotation.RequirePermission;
import com.epmet.commons.tools.enums.RequirePermissionEnum;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.dto.form.*;
import com.epmet.dto.result.AddSpecialSubjectResultDTO;
import com.epmet.dto.result.PreviewResultDTO;
import com.epmet.dto.result.TagInfoResultDTO;
import com.epmet.dto.result.WorkSpecialSubjectResultDTO;
import com.epmet.service.SpecialSubjectService;
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 java.util.List;
/**
* 专题表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-07-15
*/
@RestController
@RequestMapping("specialsubject")
public class SpecialSubjectController {
@Autowired
private SpecialSubjectService specialSubjectService;
/**
* @param formDTO
* @return com.epmet.commons.tools.utils.Result
* @author yinzuomei
* @description 添加专题
* @Date 2021/7/15 15:31
**/
@RequirePermission(requirePermission = RequirePermissionEnum.WORK_SPECIAL_PROJECT_ADD)
@PostMapping("add")
public Result<AddSpecialSubjectResultDTO> addSpecialSubject(@LoginUser TokenDto tokenDto, @RequestBody AddSpecialSubjectFormDTO formDTO) {
formDTO.setAddUserId(tokenDto.getUserId());
formDTO.setCustomerId(tokenDto.getCustomerId());
ValidatorUtils.validateEntity(formDTO, AddSpecialSubjectFormDTO.AddUserInternalGroup.class);
return new Result<AddSpecialSubjectResultDTO>().ok(specialSubjectService.addSpecialSubject(formDTO));
}
/**
* @return com.epmet.commons.tools.utils.Result
* @param
* @author yinzuomei
* @description 专题管理删除专题
* @Date 2021/7/15 20:49
**/
@RequirePermission(requirePermission = RequirePermissionEnum.WORK_SPECIAL_PROJECT_DEL)
@PostMapping("del")
public Result delSpecialSubject(@LoginUser TokenDto tokenDto, @RequestBody DelSpecialSubjectFormDTO formDTO){
formDTO.setUserId(tokenDto.getUserId());
formDTO.setCustomerId(tokenDto.getCustomerId());
ValidatorUtils.validateEntity(formDTO);
specialSubjectService.delSpecialSubject(formDTO);
return new Result();
}
/**
* @return com.epmet.commons.tools.utils.Result<java.util.List<com.epmet.dto.result.WorkSpecialSubjectResultDTO>>
* @param formDTO
* @author yinzuomei
* @description 专题管理已有专题列表
* @Date 2021/7/15 21:17
**/
@PostMapping("existedlist")
public Result<List<WorkSpecialSubjectResultDTO>> queryExistedList(@LoginUser TokenDto tokenDto, @RequestBody QuerySpecialSubFormDTO formDTO) {
formDTO.setUserId(tokenDto.getUserId());
formDTO.setCustomerId(tokenDto.getCustomerId());
ValidatorUtils.validateEntity(formDTO, QuerySpecialSubFormDTO.AddUserInternalGroup.class);
return new Result<List<WorkSpecialSubjectResultDTO>>().ok(specialSubjectService.queryExistedList(formDTO));
}
/**
* 热门标签列表
* @author zhaoqifeng
* @date 2021/7/15 15:36
* @param tokenDto
* @return com.epmet.commons.tools.utils.Result<java.util.List<com.epmet.dto.result.TagInfoResultDTO>>
*/
@PostMapping("hot-subject-taglist")
public Result<List<TagInfoResultDTO>> hotSubjectTagList(@LoginUser TokenDto tokenDto, @RequestBody HotSubjectTagFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, HotSubjectTagFormDTO.HotSubjectTagGroup.class);
formDTO.setCustomerId(tokenDto.getCustomerId());
return new Result<List<TagInfoResultDTO>>().ok(specialSubjectService.hotSubjectTagList(formDTO));
}
/**
* 效果预览
* @author zhaoqifeng
* @date 2021/7/16 15:54
* @param formDTO
* @return com.epmet.commons.tools.utils.Result<java.util.List<com.epmet.dto.result.PreviewResultDTO>>
*/
@PostMapping("preview")
public Result<List<PreviewResultDTO>> preview(@RequestBody PreviewFormDTO formDTO) {
return new Result<List<PreviewResultDTO>>().ok(specialSubjectService.preview(formDTO));
}
}

20
epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/dao/ArticleDao.java

@ -16,6 +16,7 @@ package com.epmet.dao;
import com.epmet.commons.mybatis.annotation.DataFilter;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.form.SubjectArticleListFormDTO;
import com.epmet.dto.result.*;
import com.epmet.dto.form.ResiTagListFormDTO;
import com.epmet.dto.result.GovArticleContentDTO;
@ -130,6 +131,8 @@ public interface ArticleDao extends BaseDao<ArticleEntity> {
**/
List<ArticleListResultDTO> selectArticleList(@Param("gridId") String gridId, @Param("tagIdList") List<String> tagIdList);
List<ArticleListResultDTO> selectArticleListByTag(@Param("tagId") String tagId, @Param("pageNo") Integer pageNo, @Param("pageSize") Integer pageSize);
/**
* @param gridId
* @param articleId
@ -146,4 +149,21 @@ public interface ArticleDao extends BaseDao<ArticleEntity> {
* @author zxc
*/
String getArticleIdByDraftId(@Param("draftId") String draftId);
/**
* @Description 专题下的文章
* @Param gridId
* @Param tagId
* @author zxc
* @date 2021/7/15 3:49 下午
*/
List<SubjectArticleListResultDTO> subjectArticleList(@Param("gridId") String gridId,@Param("tagId") String tagId);
/**
* @Description 专题列表查询
* @Param pidList
* @author zxc
* @date 2021/7/16 10:29 上午
*/
List<SubjectListResultDTO> subjectList(@Param("pidList")List<String> pidList);
}

43
epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/dao/SpecialSubjectDao.java

@ -0,0 +1,43 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.SpecialSubjectDTO;
import com.epmet.entity.SpecialSubjectEntity;
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-07-15
*/
@Mapper
public interface SpecialSubjectDao extends BaseDao<SpecialSubjectEntity> {
int delSpecialSubject(@Param("id") String id, @Param("userId") String userId);
List<SpecialSubjectDTO> queryExistedList(@Param("orgId") String orgId,@Param("notList")List<String> notList);
SpecialSubjectDTO getInfo(@Param("tagId") String tagId);
}

2
epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/dao/TagCustomerDao.java

@ -40,7 +40,7 @@ public interface TagCustomerDao extends BaseDao<TagCustomerEntity> {
* @param formDTO
* @author zxc
*/
void upsertTagCount(UpdateTagFormDTO formDTO);
void upsertTagCount(UpdateTagFormDTO formDTO);
/**
* @Description 初始化默认标签

89
epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/entity/SpecialSubjectEntity.java

@ -0,0 +1,89 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.entity;
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-07-15
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("special_subject")
public class SpecialSubjectEntity extends BaseEpmetEntity {
private static final long serialVersionUID = 1L;
/**
* 客户id
*/
private String customerId;
/**
* 标签id
*/
private String tagId;
/**
* 新增此专题的用户id
*/
private String addUserId;
/**
* 新增此专题时用户所在的组织id或者网格id
* mean:给谁添加的
*/
private String addOrgId;
/**
* ADD_ORG_ID的上级id
*/
private String addOrgPid;
/**
* 用户所在的组织或者网格的所有上级
*/
private String addOrgPids;
/**
* 网格grid社区级community
街道:street,
区县级: district,
市级: city
省级:province
*/
private String orgLevel;
/**
* 新增此专题用户所属的组织id
* mean:当前人是谁
*/
private String addUserAgencyId;
/**
* 删除人id
*/
private String delStaffId;
}

8
epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/entity/TagCustomerEntity.java

@ -18,13 +18,10 @@
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;
/**
* 客户标签表
*
@ -48,6 +45,11 @@ public class TagCustomerEntity extends BaseEpmetEntity {
*/
private String tagName;
/**
* 标签颜色
*/
private String tagColor;
/**
* 使用计数
*/

81
epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/redis/TagRedis.java

@ -21,6 +21,7 @@ import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.redis.RedisKeys;
import com.epmet.commons.tools.redis.RedisUtils;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.constant.TagConstant;
import com.epmet.dto.form.CorrelationTagListFormDTO;
import com.epmet.dto.form.TagCascadeListFormDTO;
@ -28,9 +29,7 @@ import com.epmet.dto.result.CorrelationTagListResultDTO;
import com.epmet.dto.result.TagInfoResultDTO;
import com.epmet.dto.result.TagRankResultDTO;
import com.epmet.dto.result.UpdateTagUseCountsResultDTO;
import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DataAccessException;
import org.springframework.data.redis.connection.RedisConnection;
@ -103,10 +102,7 @@ public class TagRedis {
return resultList;
}
//转换DTO
for (Object object : objects) {
resultList.add(objectToDTO(object,CorrelationTagListResultDTO.class));
}
// resultList = JSONObject.parseArray(objects.toString(), CorrelationTagListResultDTO.class);
resultList = ConvertUtils.sourceToTarget(objects,CorrelationTagListResultDTO.class);
//级联标签排序
//1.取出 zset 中的有序标签,根据级联标签,筛选有序标签
List<TagRankResultDTO> resultEquals = new ArrayList<>();
@ -117,7 +113,7 @@ public class TagRedis {
Set<ZSetOperations.TypedTuple<Object>> typedTuples = redisUtils.zReverseRangeWithScores(customerKey, start, end);
for (CorrelationTagListResultDTO correlationTagList : resultList) {
for (ZSetOperations.TypedTuple<Object> typedTuple : typedTuples) {
TagRankResultDTO tagRank = objectToDTO(typedTuple.getValue(), TagRankResultDTO.class);
TagRankResultDTO tagRank = ConvertUtils.sourceToTarget(typedTuple.getValue(), TagRankResultDTO.class);
tagRank.setScore(typedTuple.getScore());
if (correlationTagList.getTagId().equals(tagRank.getTagId())){
resultEquals.add(tagRank);
@ -127,13 +123,7 @@ public class TagRedis {
}
// 根据标签使用顺序倒叙
List<TagRankResultDTO> collect = resultEquals.stream().sorted(Comparator.comparing(TagRankResultDTO::getScore).reversed()).collect(Collectors.toList());
List<CorrelationTagListResultDTO> realResult = new ArrayList<>();
for (TagRankResultDTO tagRankResultDTO : collect) {
CorrelationTagListResultDTO correlation = new CorrelationTagListResultDTO();
BeanUtils.copyProperties(tagRankResultDTO,correlation);
realResult.add(correlation);
}
return realResult;
return ConvertUtils.sourceToTarget(collect, CorrelationTagListResultDTO.class);
}
@ -150,12 +140,7 @@ public class TagRedis {
if (objects.size()== NumConstant.ZERO){
return new ArrayList<>();
}
List<TagInfoResultDTO> result = new ArrayList<TagInfoResultDTO>();
for (Object object : objects) {
result.add(objectToDTO(object,TagInfoResultDTO.class));
}
// List<TagInfoResultDTO> tagInfoResultDTOS = JSONObject.parseArray(objects.toString(), TagInfoResultDTO.class);
return result;
return ConvertUtils.sourceToTarget(objects, TagInfoResultDTO.class);
}
/**
@ -171,11 +156,7 @@ public class TagRedis {
if (objects.size()== NumConstant.ZERO){
return new ArrayList<>();
}
List<TagInfoResultDTO> result = new ArrayList<TagInfoResultDTO>();
for (Object object : objects) {
result.add(objectToDTO(object,TagInfoResultDTO.class));
}
return result;
return ConvertUtils.sourceToTarget(objects, TagInfoResultDTO.class);
}
/**
@ -207,9 +188,7 @@ public class TagRedis {
return resultList;
}
//转换DTO
for (Object object : objects) {
resultList.add(objectToDTO(object, TagInfoResultDTO.class));
}
resultList = ConvertUtils.sourceToTarget(objects,TagInfoResultDTO.class);
//级联标签排序
//1.取出 zset 中的有序标签,根据级联标签,筛选有序标签
List<TagRankResultDTO> resultEquals = new ArrayList<>();
@ -221,7 +200,7 @@ public class TagRedis {
Set<ZSetOperations.TypedTuple<Object>> typedTuples = redisUtils.zReverseRangeWithScores(gridTagKey, start, end);
for (TagInfoResultDTO tagInfo : resultList) {
for (ZSetOperations.TypedTuple<Object> typedTuple : typedTuples) {
TagRankResultDTO tagRank = objectToDTO(typedTuple.getValue(), TagRankResultDTO.class);
TagRankResultDTO tagRank = ConvertUtils.sourceToTarget(typedTuple.getValue(), TagRankResultDTO.class);
tagRank.setScore(typedTuple.getScore());
if (tagInfo.getTagId().equals(tagRank.getTagId())){
resultEquals.add(tagRank);
@ -231,25 +210,7 @@ public class TagRedis {
}
// 根据标签使用顺序倒叙
List<TagRankResultDTO> collect = resultEquals.stream().sorted(Comparator.comparing(TagRankResultDTO::getScore).reversed()).collect(Collectors.toList());
List<TagInfoResultDTO> tagInfoResultList = new ArrayList<>();
for (TagRankResultDTO tagRankResultDTO : collect) {
TagInfoResultDTO tagInfoResult = new TagInfoResultDTO();
BeanUtils.copyProperties(tagRankResultDTO,tagInfoResult);
tagInfoResultList.add(tagInfoResult);
}
return tagInfoResultList;
}
/**
* @Description Object 转换 DTO
* @param o
* @param tClass
* @author zxc
*/
public <T> T objectToDTO(Object o,Class<T> tClass){
ObjectMapper objectMapper = new ObjectMapper();
T t = objectMapper.convertValue(o, tClass);
return t;
return ConvertUtils.sourceToTarget(collect, TagInfoResultDTO.class);
}
/**
@ -305,6 +266,30 @@ public class TagRedis {
}
}
/**
* desc: 根据Key删除 缓存
*
* @param customerId
* @return java.lang.Boolean
* @author LiuJanJun
* @date 2021/7/19 1:34 下午
*/
public void clearCustomerTag(String customerId) {
String customerTagKey = RedisKeys.getCustomerTagKey(customerId);
Boolean delete = redisTemplate.delete(customerTagKey);
log.info("clearCustomerTag result:{}, customerRankingTagKey:{}",delete, customerTagKey);
String customerReTagKey = RedisKeys.getCustomerReTagKey(customerId, null).concat(":*");
delete = redisTemplate.delete(customerReTagKey);
log.info("clearCustomerTag result:{}, customerReTagKey:{}",delete, customerReTagKey);
}
public void clearGridTag(String gridId) {
String gridTagKey = RedisKeys.getGridTagKey(gridId);
Boolean delete = redisTemplate.delete(gridTagKey);
log.info("clearGridTag result:{}, gridRankingTagKey:{}",delete, gridTagKey);
String gridReTagKey = RedisKeys.getGridReTagKey(gridId, null).concat(":*");
delete = redisTemplate.delete(gridReTagKey);
log.info("clearGridTag result:{}, gridReTagKey:{}",delete, gridReTagKey);
}
}

27
epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/ArticleService.java

@ -216,4 +216,31 @@ public interface ArticleService extends BaseService<ArticleEntity> {
* @return
*/
void manualPublish(TokenDto tokenDto, String draftId);
/**
* @Description 专题文章列表
* @Param formDTO
* @author zxc
* @date 2021/7/15 2:21 下午
*/
List<SubjectArticleListResultDTO> subjectArticleList(SubjectArticleListFormDTO formDTO);
/**
* @Description 专题列表
* @Param formDTO
* @author zxc
* @date 2021/7/15 5:22 下午
*/
List<SubjectListResultDTO> subjectList(SubjectListFormDTO formDTO);
/**
* 根据tag查找文章列表
* @author zhaoqifeng
* @date 2021/7/16 14:50
* @param tagId
* @param pageNo
* @param pageSize
* @return java.util.List<com.epmet.dto.result.ArticleListResultDTO>
*/
List<ArticleListResultDTO> getArticleListByTag(String tagId, Integer pageNo, Integer pageSize);
}

148
epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/SpecialSubjectService.java

@ -0,0 +1,148 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.service;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData;
import com.epmet.dto.SpecialSubjectDTO;
import com.epmet.dto.form.*;
import com.epmet.dto.result.PreviewResultDTO;
import com.epmet.dto.result.TagInfoResultDTO;
import com.epmet.dto.result.AddSpecialSubjectResultDTO;
import com.epmet.dto.result.WorkSpecialSubjectResultDTO;
import com.epmet.entity.SpecialSubjectEntity;
import java.util.List;
import java.util.Map;
/**
* 专题表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-07-15
*/
public interface SpecialSubjectService extends BaseService<SpecialSubjectEntity> {
/**
* 默认分页
*
* @param params
* @return PageData<SpecialSubjectDTO>
* @author generator
* @date 2021-07-15
*/
PageData<SpecialSubjectDTO> page(Map<String, Object> params);
/**
* 默认查询
*
* @param params
* @return java.util.List<SpecialSubjectDTO>
* @author generator
* @date 2021-07-15
*/
List<SpecialSubjectDTO> list(Map<String, Object> params);
/**
* 单条查询
*
* @param id
* @return SpecialSubjectDTO
* @author generator
* @date 2021-07-15
*/
SpecialSubjectDTO get(String id);
/**
* 默认保存
*
* @param dto
* @return void
* @author generator
* @date 2021-07-15
*/
void save(SpecialSubjectDTO dto);
/**
* 默认更新
*
* @param dto
* @return void
* @author generator
* @date 2021-07-15
*/
void update(SpecialSubjectDTO dto);
/**
* 批量删除
*
* @param ids
* @return void
* @author generator
* @date 2021-07-15
*/
void delete(String[] ids);
/**
* 热门标签列表
* @author zhaoqifeng
* @date 2021/7/15 15:35
* @param formDTO
* @return java.util.List<com.epmet.dto.result.TagInfoResultDTO>
*/
List<TagInfoResultDTO> hotSubjectTagList(HotSubjectTagFormDTO formDTO);
/**
* 添加专题
*
* @param formDTO
* @return void
* @author yinzuomei
* @date 2021-07-15
*/
AddSpecialSubjectResultDTO addSpecialSubject(AddSpecialSubjectFormDTO formDTO);
/**
* 专题管理删除专题
*
* @param formDTO
* @return void
* @author yinzuomei
* @date 2021-07-15
*/
void delSpecialSubject(DelSpecialSubjectFormDTO formDTO);
/**
* 专题管理已有专题列表
*
* @param formDTO
* @return void
* @author yinzuomei
* @date 2021-07-15
*/
List<WorkSpecialSubjectResultDTO> queryExistedList(QuerySpecialSubFormDTO formDTO);
/**
* 效果预览
* @author zhaoqifeng
* @date 2021/7/16 14:28
* @param formDTO
* @return java.util.List<com.epmet.dto.result.PreviewResultDTO>
*/
List<PreviewResultDTO> preview(PreviewFormDTO formDTO);
}

62
epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/ArticleServiceImpl.java

@ -1105,7 +1105,7 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit
log.error("updateAuditStatusFailById draftId:{} is not exist in db", draftId);
throw new RenException(EpmetErrorCode.INTERNAL_VALIDATE_ERROR.getCode(), EpmetErrorCode.INTERNAL_VALIDATE_ERROR.getMsg());
}
if (syncScanResult.isAllPass()) {
if (syncScanResult != null && syncScanResult.isAllPass()) {
this.updateDraftPublishStatus(draftId, DraftConstant.PUBLISHED, null);
} else {
this.updateDraftPublishStatus(draftId, DraftConstant.AUDITFAIL, null);
@ -1113,6 +1113,9 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit
boolean coverFail = false, contentFail = false, titleFail = false;
try {
if (syncScanResult == null){
syncScanResult = new SyncScanResult();
}
List<String> failDataIds = syncScanResult.getFailDataIds();
for (String id : failDataIds) {
if (id.indexOf(ModuleConstant.SCAN_COVER_PREFIX) >= NumConstant.ZERO) {
@ -1236,7 +1239,7 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit
}
/**
/**
* @param draftId
* @Description 更新DB的标签使用次数 政府端
* @author zxc
@ -1380,4 +1383,59 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit
});
articleTagsDao.addArticleTags(addArticleTags);
}
/**
* @Description 专题文章列表
* @Param formDTO
* @author zxc
* @date 2021/7/15 2:21 下午
*/
@Override
public List<SubjectArticleListResultDTO> subjectArticleList(SubjectArticleListFormDTO formDTO) {
PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize());
List<SubjectArticleListResultDTO> result = baseDao.subjectArticleList(formDTO.getGridId(), formDTO.getTagId());
if (!CollectionUtils.isEmpty(result)){
return result;
}
return new ArrayList<>();
}
/**
* @Description 专题列表
* @Param formDTO
* @author zxc
* @date 2021/7/15 5:22 下午
*/
@Override
public List<SubjectListResultDTO> subjectList(SubjectListFormDTO formDTO) {
String gridId = formDTO.getGridId();
Result<String> pidsByGridId = govOrgOpenFeignClient.selectPidsByGridId(gridId);
if (!pidsByGridId.success()){
throw new RenException("查询pids失败【"+pidsByGridId.getMsg()+"】");
}
String pids = pidsByGridId.getData();
List<String> pidList = Arrays.stream(pids.split(":")).collect(Collectors.toList());
pidList.add(gridId);
List<SubjectListResultDTO> result = baseDao.subjectList(pidList);
if (CollectionUtils.isEmpty(result)){
return new ArrayList<>();
}
result = result.stream().distinct().collect(Collectors.toList());
return result;
}
/**
* 根据tag查找文章列表
*
* @param tagId
* @param pageNo
* @param pageSize
* @return java.util.List<com.epmet.dto.result.ArticleListResultDTO>
* @author zhaoqifeng
* @date 2021/7/16 14:47
*/
@Override
public List<ArticleListResultDTO> getArticleListByTag(String tagId, Integer pageNo, Integer pageSize) {
return baseDao.selectArticleListByTag(tagId, pageNo, pageSize);
}
}

306
epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/SpecialSubjectServiceImpl.java

@ -0,0 +1,306 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
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.constant.StrConstant;
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.SpecialSubjectDao;
import com.epmet.dto.CustomerAgencyDTO;
import com.epmet.dto.SpecialSubjectDTO;
import com.epmet.dto.TagCustomerDTO;
import com.epmet.dto.form.*;
import com.epmet.dto.result.*;
import com.epmet.entity.SpecialSubjectEntity;
import com.epmet.feign.GovOrgOpenFeignClient;
import com.epmet.redis.TagRedis;
import com.epmet.service.ArticleService;
import com.epmet.service.SpecialSubjectService;
import com.epmet.service.TagCustomerService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
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 javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import java.util.stream.Stream;
/**
* 专题表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-07-15
*/
@Slf4j
@Service
public class SpecialSubjectServiceImpl extends BaseServiceImpl<SpecialSubjectDao, SpecialSubjectEntity> implements SpecialSubjectService {
@Autowired
private TagCustomerService tagCustomerService;
@Resource
private TagRedis tagRedis;
@Autowired
private GovOrgOpenFeignClient govOrgOpenFeignClient;
@Resource
private ArticleService articleService;
@Override
public PageData<SpecialSubjectDTO> page(Map<String, Object> params) {
IPage<SpecialSubjectEntity> page = baseDao.selectPage(
getPage(params, FieldConstant.CREATED_TIME, false),
getWrapper(params)
);
return getPageData(page, SpecialSubjectDTO.class);
}
@Override
public List<SpecialSubjectDTO> list(Map<String, Object> params) {
List<SpecialSubjectEntity> entityList = baseDao.selectList(getWrapper(params));
return ConvertUtils.sourceToTarget(entityList, SpecialSubjectDTO.class);
}
private QueryWrapper<SpecialSubjectEntity> getWrapper(Map<String, Object> params){
String id = (String)params.get(FieldConstant.ID_HUMP);
QueryWrapper<SpecialSubjectEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id);
return wrapper;
}
@Override
public SpecialSubjectDTO get(String id) {
SpecialSubjectEntity entity = baseDao.selectById(id);
return ConvertUtils.sourceToTarget(entity, SpecialSubjectDTO.class);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void save(SpecialSubjectDTO dto) {
SpecialSubjectEntity entity = ConvertUtils.sourceToTarget(dto, SpecialSubjectEntity.class);
insert(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(SpecialSubjectDTO dto) {
SpecialSubjectEntity entity = ConvertUtils.sourceToTarget(dto, SpecialSubjectEntity.class);
updateById(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void delete(String[] ids) {
// 逻辑删除(@TableLogic 注解)
baseDao.deleteBatchIds(Arrays.asList(ids));
}
/**
* 添加专题
*
* @param formDTO
* @return void
* @author yinzuomei
* @date 2021-07-15
*/
@Override
public AddSpecialSubjectResultDTO addSpecialSubject(AddSpecialSubjectFormDTO formDTO) {
// 1、标签是否存在
TagCustomerDTO tagCustomerDTO=tagCustomerService.get(formDTO.getTagId());
if(null==tagCustomerDTO){
throw new RenException(EpmetErrorCode.TAG_NOT_EXIST.getCode(), EpmetErrorCode.TAG_NOT_EXIST.getMsg());
}
//2、校验当前组织是否添加过此专题
QuerySpecialSubFormDTO querySpecialSubFormDTO=ConvertUtils.sourceToTarget(formDTO,QuerySpecialSubFormDTO.class);
querySpecialSubFormDTO.setUserId(formDTO.getAddUserId());
List<WorkSpecialSubjectResultDTO> havedList=this.queryExistedList(querySpecialSubFormDTO);
List<String> haveTagIds=havedList.stream().map(WorkSpecialSubjectResultDTO::getTagId).distinct().collect(Collectors.toList());
haveTagIds.forEach(tagId->{
if(tagId.equals(formDTO.getTagId())){
throw new RenException(EpmetErrorCode.EXISTED_SPECIAL_PROJECT.getCode(), EpmetErrorCode.EXISTED_SPECIAL_PROJECT.getMsg());
}
});
// 3、保存
SpecialSubjectEntity insertEntity = ConvertUtils.sourceToTarget(formDTO, SpecialSubjectEntity.class);
Result<CustomerAgencyDTO> result = govOrgOpenFeignClient.getAgencyByStaff(formDTO.getAddUserId());
if(result.success()&&null!=result.getData()){
insertEntity.setAddUserAgencyId(result.getData().getId());
}
insertEntity.setAddOrgId(formDTO.getOrgId());
insertEntity.setAddOrgPid(formDTO.getPid());
insertEntity.setAddOrgPids(formDTO.getPids());
baseDao.insert(insertEntity);
return new AddSpecialSubjectResultDTO(insertEntity.getId());
}
/**
* 专题管理删除专题
*
* @param formDTO
* @return void
* @author yinzuomei
* @date 2021-07-15
*/
@Override
public void delSpecialSubject(DelSpecialSubjectFormDTO formDTO) {
SpecialSubjectEntity original = baseDao.selectById(formDTO.getSpecialSubjectId());
if (null != original) {
if (!original.getAddOrgId().equals(formDTO.getOrgId())) {
log.warn("当前专题id=" + original.getId() + ";是属于orgId=" + original.getAddOrgId() + ";当前用户正处在orgId=" + formDTO.getOrgId()+";所以无权删除");
throw new RenException(EpmetErrorCode.CAN_NOT_DEL_SPECIAL_PROJECT.getCode(), EpmetErrorCode.CAN_NOT_DEL_SPECIAL_PROJECT.getMsg());
}
baseDao.delSpecialSubject(formDTO.getSpecialSubjectId(), formDTO.getUserId());
}
}
/**
* 专题管理已有专题列表
*
* @param formDTO
* @return void
* @author yinzuomei
* @date 2021-07-15
*/
@Override
public List<WorkSpecialSubjectResultDTO> queryExistedList(QuerySpecialSubFormDTO formDTO) {
Result<CustomerAgencyDTO> staffResult = govOrgOpenFeignClient.getAgencyByStaff(formDTO.getUserId());
if (!staffResult.success() && null == staffResult.getData()) {
throw new RenException("查询当前工作人员信息异常");
}
List<WorkSpecialSubjectResultDTO> resultDTOList = new ArrayList<>();
List<String> notList = new ArrayList<>();
//当前组织或者网格自己建立的
List<WorkSpecialSubjectResultDTO> currentOrgList = new ArrayList<>();
List<SpecialSubjectDTO> currentOrgCreatedList = baseDao.queryExistedList(formDTO.getOrgId(), notList);
currentOrgCreatedList.forEach(dto -> {
WorkSpecialSubjectResultDTO result = ConvertUtils.sourceToTarget(dto,WorkSpecialSubjectResultDTO.class);
result.setSpecialSubjectId(dto.getId());
//1、如果当前专题是给当前所在组织(or网格)添加的;
//2、当前工作人员所属的组织,与专题添加人所属的组织一致,同时满足这两个条件即可删除
// A组织添加到G1网格的专题,只有A组织下的工作人员,切换到G1时,才可以删除。
if(dto.getAddUserAgencyId().equals(staffResult.getData().getId())
&& dto.getAddOrgId().equals(formDTO.getOrgId())){
result.setCanDel(true);
}else{
result.setCanDel(false);
}
currentOrgList.add(result);
});
if (CollectionUtils.isNotEmpty(currentOrgList)) {
notList = currentOrgList.stream().map(WorkSpecialSubjectResultDTO::getTagId).distinct().collect(Collectors.toList());
}
if (!NumConstant.ZERO_STR.equals(formDTO.getPids())) {
List<String> pidList = Arrays.asList(formDTO.getPids().split(StrConstant.COLON));
for (String pid : pidList) {
if(CollectionUtils.isNotEmpty(resultDTOList)){
List<String> parentAddList=resultDTOList.stream().map(WorkSpecialSubjectResultDTO::getTagId).distinct().collect(Collectors.toList());
notList.addAll(parentAddList);
}
//优先展示自己的,所以要排除掉自己的,自上向下查,优先展示上层领导们给我建立的专题
List<SpecialSubjectDTO> list = baseDao.queryExistedList(pid, notList);
list.forEach(dto -> {
WorkSpecialSubjectResultDTO result = ConvertUtils.sourceToTarget(dto,WorkSpecialSubjectResultDTO.class);
result.setSpecialSubjectId(dto.getId());
//1、如果当前专题是给当前所在组织(or网格)添加的;
//2、当前工作人员所属的组织,与专题添加人所属的组织一致,同时满足这两个条件即可删除
if (dto.getAddUserAgencyId().equals(staffResult.getData().getId())
&& dto.getAddOrgId().equals(formDTO.getOrgId())) {
result.setCanDel(true);
} else {
result.setCanDel(false);
}
resultDTOList.add(result);
});
}
}
//自己建立的在最后面
if (CollectionUtils.isNotEmpty(currentOrgList)) {
resultDTOList.addAll(currentOrgList);
}
return resultDTOList;
}
/**
* 热门标签列表
*
* @param formDTO
* @return java.util.List<com.epmet.dto.result.TagInfoResultDTO>
* @author zhaoqifeng
* @date 2021/7/15 15:35
*/
@Override
public List<TagInfoResultDTO> hotSubjectTagList(HotSubjectTagFormDTO formDTO) {
List<TagInfoResultDTO> list = tagRedis.zRevRange(formDTO.getCustomerId());
List<String> orgIds = Stream.of(formDTO.getPids().split(StrConstant.COLON)).collect(Collectors.toList());
orgIds.add(formDTO.getOrgId());
LambdaQueryWrapper<SpecialSubjectEntity> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(SpecialSubjectEntity :: getCustomerId, formDTO.getCustomerId());
wrapper.eq(SpecialSubjectEntity :: getDelFlag, NumConstant.ZERO_STR);
wrapper.in(SpecialSubjectEntity :: getAddOrgId, orgIds);
//查询出当前组织或网格已有的专题,
List<SpecialSubjectEntity> specialSubjectList = baseDao.selectList(wrapper);
if (CollectionUtils.isNotEmpty(specialSubjectList)) {
List<String> tags = specialSubjectList.stream().map(SpecialSubjectEntity :: getTagId).distinct().collect(Collectors.toList());
// 排除
list = list.stream().filter(item -> !tags.contains(item.getTagId())).collect(Collectors.toList());
}
return list;
}
/**
* 效果预览
*
* @param formDTO
* @return java.util.List<com.epmet.dto.result.PreviewResultDTO>
* @author zhaoqifeng
* @date 2021/7/16 14:28
*/
@Override
public List<PreviewResultDTO> preview(PreviewFormDTO formDTO) {
List<PreviewResultDTO> result = new ArrayList<>();
if (CollectionUtils.isNotEmpty(formDTO.getTagIdList())) {
formDTO.getTagIdList().forEach(tagId -> {
PreviewResultDTO previewResultDTO = new PreviewResultDTO();
previewResultDTO.setArticleList(articleService.getArticleListByTag(tagId, (formDTO.getPageNo() - NumConstant.ONE) * formDTO.getPageSize(),
formDTO.getPageSize()));
result.add(previewResultDTO);
});
}
return result;
}
}

9
epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/TagCustomerServiceImpl.java

@ -29,6 +29,7 @@ import com.epmet.dto.form.UpdateTagFormDTO;
import com.epmet.dto.result.UpdateTagUseCountsResultDTO;
import com.epmet.entity.TagCustomerEntity;
import com.epmet.service.TagCustomerService;
import com.epmet.utils.TagColorUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -114,10 +115,14 @@ public class TagCustomerServiceImpl extends BaseServiceImpl<TagCustomerDao, TagC
formDTO.setCustomerId(customerId);
formDTO.setUpdatedBy(userId);
formDTO.setTagName(tagName);
String randomColor = TagColorUtils.getRandomColor();
formDTO.setTagColor(randomColor);
baseDao.upsertTagCount(formDTO);
TagCustomerEntity tagCustomerEntity = baseDao.selectById(formDTO.getId());
UpdateTagUseCountsResultDTO resultDTO = new UpdateTagUseCountsResultDTO();
resultDTO.setTagId(formDTO.getId());
resultDTO.setTagName(tagName);
resultDTO.setTagId(tagCustomerEntity.getId());
resultDTO.setTagName(tagCustomerEntity.getTagName());
resultDTO.setTagColor(tagCustomerEntity.getTagColor());
return resultDTO;
}

21
epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/TagServiceImpl.java

@ -141,12 +141,16 @@ public class TagServiceImpl implements TagService {
}
Map<String, Set<ZSetOperations.TypedTuple<UpdateTagUseCountsResultDTO>>> customerTag = new HashMap<>();
customerTagList.stream().forEach(tag -> {
buildZset(customerTag, tag.getCustomerId(), tag.getId(), tag.getTagName(), tag.getUseCount());
customerTagList.forEach(tag -> {
buildZset(customerTag, tag.getCustomerId(), tag.getId(), tag.getTagName(),tag.getTagColor(), tag.getUseCount());
});
if (customerTag.size() > 0) {
customerTag.forEach((customerId, tagSet) -> tagRedis.zAddCustomerTag(customerId, tagSet));
customerTag.forEach((customerId, tagSet) -> {
//先删除(排行及关联标签) 再添加
tagRedis.clearCustomerTag(customerId);
tagRedis.zAddCustomerTag(customerId, tagSet);
});
}
//key customerId:tagId
Map<String, Set<UpdateTagUseCountsResultDTO>> reCustomerTagMap = new HashMap<>();
@ -172,9 +176,13 @@ public class TagServiceImpl implements TagService {
throw new RenException("网格标签数为空");
}
customerTag.clear();
gridTagList.stream().forEach(tag -> buildZset(customerTag, tag.getGridId(), tag.getTagId(), tag.getTagName(), tag.getUseCount()));
gridTagList.forEach(tag -> buildZset(customerTag, tag.getGridId(), tag.getTagId(), tag.getTagName(), null, tag.getUseCount()));
if (customerTag.size() > 0) {
customerTag.forEach((gridId, tagSet) -> tagRedis.zAddGridTag(gridId, tagSet));
customerTag.forEach((gridId, tagSet) -> {
//先删除(排行及关联标签) 再添加
tagRedis.clearGridTag(gridId);
tagRedis.zAddGridTag(gridId, tagSet);
});
}
//获取网格发布的文章 按网格排序
@ -236,7 +244,7 @@ public class TagServiceImpl implements TagService {
});
}
private void buildZset(Map<String, Set<ZSetOperations.TypedTuple<UpdateTagUseCountsResultDTO>>> customerTag, String customerId, String id, String tagName, Integer useCount) {
private void buildZset(Map<String, Set<ZSetOperations.TypedTuple<UpdateTagUseCountsResultDTO>>> customerTag, String customerId, String id, String tagName, String tagColor, Integer useCount) {
Set<ZSetOperations.TypedTuple<UpdateTagUseCountsResultDTO>> typedTupleSet = customerTag.get(customerId);
if (typedTupleSet == null) {
typedTupleSet = new HashSet<>();
@ -245,6 +253,7 @@ public class TagServiceImpl implements TagService {
UpdateTagUseCountsResultDTO initTag = new UpdateTagUseCountsResultDTO();
initTag.setTagId(id);
initTag.setTagName(tagName);
initTag.setTagColor(tagColor);
ZSetOperations.TypedTuple<UpdateTagUseCountsResultDTO> typedTuple1 = new DefaultTypedTuple<>(initTag, Double.valueOf(useCount));
typedTupleSet.add(typedTuple1);
}

28
epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/utils/TagColorUtils.java

@ -0,0 +1,28 @@
package com.epmet.utils;
import java.util.Random;
/**
* desc:标签颜色工具类
*
* @author: LiuJanJun
* @date: 2021/7/19 10:39 上午
* @version: 1.0
*/
public class TagColorUtils {
private static final String[] tagColorArr = {"#E3271C","#FB7900","#FFC100","#0089FF","#17B886"};
/**
* desc: 随机获取标签颜色
*
* @param
* @return java.lang.String
* @author LiuJanJun
* @date 2021/7/19 2:38 下午
*/
public static String getRandomColor(){
int size = tagColorArr.length;
int index = new Random().nextInt(size);
return tagColorArr[index];
}
}

18
epmet-module/gov-voice/gov-voice-server/src/main/resources/db/migration/V0.0.4__create_specialsubject.sql

@ -0,0 +1,18 @@
CREATE TABLE `special_subject` (
`ID` varchar(64) NOT NULL COMMENT '主键(专题id)',
`CUSTOMER_ID` varchar(64) NOT NULL COMMENT '客户id',
`TAG_ID` varchar(64) NOT NULL COMMENT '标签id',
`ADD_USER_ID` varchar(64) NOT NULL COMMENT '新增此专题的用户id',
`ADD_ORG_ID` varchar(64) NOT NULL COMMENT '新增此专题时用户所在的组织id或者网格id',
`ADD_ORG_PID` varchar(64) NOT NULL COMMENT 'ADD_ORG_ID的上级id',
`ADD_ORG_PIDS` varchar(255) NOT NULL COMMENT '用户所在的组织或者网格的所有上级',
`ORG_LEVEL` varchar(10) NOT NULL COMMENT '网格:grid;社区级:community,\r\n乡(镇、街道)级:street,\r\n区县级: district,\r\n市级: city\r\n省级:province',
`ADD_USER_AGENCY_ID` varchar(64) NOT NULL COMMENT '新增此专题用户所属的组织id',
`DEL_FLAG` char(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`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='专题表';

37
epmet-module/gov-voice/gov-voice-server/src/main/resources/db/migration/V0.0.5__add_tag_color.sql

@ -0,0 +1,37 @@
#添加标签颜色字段
ALTER TABLE `epmet_gov_voice`.`tag_default`
ADD COLUMN `TAG_COLOR` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '标签颜色' AFTER `TAG_NAME`,
DROP PRIMARY KEY,
ADD PRIMARY KEY (`ID`) USING BTREE;
ALTER TABLE `epmet_gov_voice`.`tag_customer`
ADD COLUMN `TAG_COLOR` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '标签颜色' AFTER `TAG_NAME`,
DROP PRIMARY KEY,
ADD PRIMARY KEY (`ID`) USING BTREE;
#给默认标签添加颜色
update tag_default set tag_color='#E3271C' where id='6dd39a3dab9011ea8c52c03fd56f7847';
update tag_default set tag_color='#FB7900' where id='6dd55595ab9011ea8c52c03fd56f7847';
update tag_default set tag_color='#FFC100' where id='6dd6c2eeab9011ea8c52c03fd56f7847';
update tag_default set tag_color='#0089FF' where id='6dd804d1ab9011ea8c52c03fd56f7847';
update tag_default set tag_color='#17B886' where id='6dda6acaab9011ea8c52c03fd56f7847';
#给已有的客户默认标签 添加统一的颜色
update tag_customer set tag_color='#E3271C' where TAG_NAME='发现榜样';
update tag_customer set tag_color='#FB7900' where TAG_NAME='党建动态';
update tag_customer set tag_color='#FFC100' where TAG_NAME='通知公告';
update tag_customer set tag_color='#0089FF' where TAG_NAME='生活服务';
update tag_customer set tag_color='#17B886' where TAG_NAME='党建要闻';
#手动去执行
#获取有哪些客户的标签需要赋值颜色
# SELECT CUSTOMER_ID ,COUNT(ID) c FROM tag_customer where tag_color IS NULL GROUP BY CUSTOMER_ID;
#按照时间顺序 依次更新5个颜色
# update tag_customer set tag_color='#E3271C' where tag_color is null and customer_id = '上面sql客户Id' order by created_time desc limit 1;
# update tag_customer set tag_color='#FB7900' where tag_color is null and customer_id = '上面sql客户Id' order by created_time desc limit 1;
# update tag_customer set tag_color='#FFC100' where tag_color is null and customer_id = '上面sql客户Id' order by created_time desc limit 1;
# update tag_customer set tag_color='#0089FF' where tag_color is null and customer_id = '上面sql客户Id' order by created_time desc limit 1;
# update tag_customer set tag_color='#17B886' where tag_color is null and customer_id = '上面sql客户Id' order by created_time desc limit 1;

1
epmet-module/gov-voice/gov-voice-server/src/main/resources/db/migration/V0.0.6__add_del_staffid.sql

@ -0,0 +1 @@
alter table special_subject add COLUMN DEL_STAFF_ID VARCHAR(64) COMMENT '删除人id' AFTER ADD_USER_AGENCY_ID;

79
epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/ArticleDao.xml

@ -347,4 +347,83 @@
AND a.draft_id = #{draftId}
</select>
<!-- 专题下的文章 -->
<select id="subjectArticleList" resultType="com.epmet.dto.result.SubjectArticleListResultDTO">
SELECT
art.ID AS articleId,
art.TITLE AS articleTitle,
art.PUBLISHER_NAME AS publisherName,
art.PUBLISH_DATE AS publishDate,
IFNULL( art.PREVIEW_CONTENT, '' ) AS articleContent,
IFNULL( art.TAGS, '' ) AS tagNames,
IFNULL(ac.IMG_URL,'') AS articleCoverImg
FROM ARTICLE art
LEFT JOIN ARTICLE_PUBLISH_RANGE prange ON
(art.ID = prange.ARTICLE_ID AND prange.DEL_FLAG = '0' AND prange.PUBLISH_STATUS = 'published')
LEFT JOIN article_tags ats ON (ats.ARTICLE_ID = art.ID)
LEFT JOIN article_cover ac ON (ac.ARTICLE_ID = art.ID AND ac.DEL_FLAG = 0)
WHERE
art.DEL_FLAG = '0'
AND art.STATUS_FLAG = 'published'
AND ats.TAG_ID = #{tagId}
AND prange.GRID_ID = #{gridId}
ORDER BY
art.PUBLISH_DATE DESC,
art.CREATED_TIME DESC
</select>
<!-- 专题列表查询 -->
<select id="subjectList" resultType="com.epmet.dto.result.SubjectListResultDTO">
SELECT
DISTINCT (ss.TAG_ID) AS tagId,
tc.TAG_NAME,
tc.TAG_COLOR
FROM special_subject ss
LEFT JOIN tag_customer tc ON (tc.ID = ss.TAG_ID AND tc.DEL_FLAG = 0)
WHERE ss.DEL_FLAG = '0'
AND (
<foreach collection="pidList" item="pid" separator=" OR ">
ss.ADD_ORG_ID = #{pid}
</foreach>
)
order by field(
ss.ADD_ORG_ID,
<foreach collection="pidList" item="pid" separator=" , ">
#{pid}
</foreach>)
,ss.CREATED_TIME DESC
</select>
<select id="selectArticleListByTag" resultType="com.epmet.dto.result.ArticleListResultDTO">
SELECT
art.ID AS articleId,
art.TITLE AS articleTitle,
art.PUBLISHER_NAME AS publishName,
ac.IMG_URL AS articleCoverImg,
date_format(art.PUBLISH_DATE,'%Y-%m-%d') AS publishDate,
IFNULL(art.PREVIEW_CONTENT,'') AS articleContent,
IFNULL(art.TAGS,'') AS tagName
FROM
ARTICLE art
LEFT JOIN article_cover ac ON art.ID = ac.ARTICLE_ID
LEFT JOIN ARTICLE_PUBLISH_RANGE prange
ON art.ID = prange.ARTICLE_ID
AND
prange.DEL_FLAG = '0'
AND
prange.PUBLISH_STATUS = 'published'
WHERE
art.DEL_FLAG = '0'
AND art.STATUS_FLAG = 'published'
AND EXISTS(
SELECT 1
FROM ARTICLE_TAGS
WHERE DEL_FLAG = '0'
AND ARTICLE_ID = art.ID
AND TAG_ID=#{tagId}
)
ORDER BY art.PUBLISH_DATE DESC , art.CREATED_TIME DESC
LIMIT #{pageNo}, #{pageSize}
</select>
</mapper>

42
epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/SpecialSubjectDao.xml

@ -0,0 +1,42 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.epmet.dao.SpecialSubjectDao">
<update id="delSpecialSubject" parameterType="map">
update special_subject set del_flag='1',UPDATED_BY=#{userId},UPDATED_TIME=Now(),DEL_STAFF_ID=#{userId}
where id=#{id}
</update>
<select id="queryExistedList" parameterType="map" resultType="com.epmet.dto.SpecialSubjectDTO">
SELECT
ss.*,
tc.TAG_NAME AS tagName,
tc.TAG_COLOR as tagColor
FROM
special_subject ss
INNER JOIN tag_customer tc ON ( ss.CUSTOMER_ID = tc.CUSTOMER_ID AND ss.TAG_ID = tc.id )
WHERE
ss.DEL_FLAG = '0'
AND tc.DEL_FLAG = '0'
AND ss.ADD_ORG_ID = #{orgId}
<if test="null != notList and notList.size()>0">
and ss.tag_id not in
<foreach item="tagId" collection="notList" open="(" separator="," close=")">
#{tagId}
</foreach>
</if>
order by ss.CREATED_TIME desc
</select>
<select id="getInfo" resultType="com.epmet.dto.SpecialSubjectDTO">
SELECT
ss.id,
TAG_NAME
FROM
special_subject ss
INNER JOIN tag_customer ts ON ss.tag_id = ts.id
WHERE
ss.del_flag = '0'
AND ss.tag_id = #{tagId}
</select>
</mapper>

8
epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/TagCustomerDao.xml

@ -7,11 +7,12 @@
<selectKey keyProperty="id" order="AFTER" resultType="String">
select id from tag_customer where tag_name = #{tagName} AND CUSTOMER_ID = #{customerId}
</selectKey>
INSERT INTO tag_customer ( ID, CUSTOMER_ID, TAG_NAME, USE_COUNT, DEL_FLAG, REVISION, CREATED_BY, CREATED_TIME, UPDATED_BY, UPDATED_TIME )
INSERT INTO tag_customer ( ID, CUSTOMER_ID, TAG_NAME, TAG_COLOR, USE_COUNT, DEL_FLAG, REVISION, CREATED_BY, CREATED_TIME, UPDATED_BY, UPDATED_TIME )
VALUES
(REPLACE ( UUID(), '-', '' ),
#{customerId},
#{tagName},
#{tagColor},
#{useCount},
#{delFlag},
#{revision},
@ -26,11 +27,11 @@
<!-- 初始化默认标签 -->
<insert id="initTags">
INSERT INTO tag_customer ( ID, CUSTOMER_ID, TAG_NAME, USE_COUNT, DEL_FLAG, REVISION, CREATED_BY, CREATED_TIME, UPDATED_BY, UPDATED_TIME )
INSERT INTO tag_customer ( ID, CUSTOMER_ID, TAG_NAME, TAG_COLOR, USE_COUNT, DEL_FLAG, REVISION, CREATED_BY, CREATED_TIME, UPDATED_BY, UPDATED_TIME )
VALUES
<foreach collection="tags" item="tag" separator=",">
(
#{tag.id},#{tag.customerId}, #{tag.tagName}, #{tag.useCount}, #{tag.delFlag}, #{tag.revision}, #{tag.createdBy}, NOW(), #{tag.updatedBy}, NOW()
#{tag.id},#{tag.customerId}, #{tag.tagName}, #{tag.tagColor} #{tag.useCount}, #{tag.delFlag}, #{tag.revision}, #{tag.createdBy}, NOW(), #{tag.updatedBy}, NOW()
)
</foreach>
ON DUPLICATE KEY UPDATE
@ -41,6 +42,7 @@
ID,
CUSTOMER_ID,
TAG_NAME,
TAG_COLOR,
USE_COUNT
FROM
tag_customer

3
epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/impl/CustomerAppServiceImpl.java

@ -38,7 +38,6 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import javax.annotation.PostConstruct;
import java.util.List;
import java.util.Map;
@ -54,7 +53,7 @@ public class CustomerAppServiceImpl extends BaseServiceImpl<CustomerAppDao, Cust
@Autowired
private RedisTemplate redisTemplate;
@PostConstruct
//@PostConstruct
private void initApp2Redis() {
SetOperations<String, CustomerAppRedisDTO> appSet = redisTemplate.opsForSet();
List<CustomerAppDTO> configAllApp = this.getConfigAllApp();

11
epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/form/ApplyCreateGroupFormDTO.java

@ -15,7 +15,8 @@ import java.io.Serializable;
@Data
public class ApplyCreateGroupFormDTO implements Serializable {
private static final long serialVersionUID = 1570620480398949075L;
public interface AddUserInternalGroup {
}
/**
* 添加用户操作的用户可见异常分组
* 该分组用于校验需要返回给前端错误信息提示的列需要继承CustomerClientShowGroup
@ -27,7 +28,7 @@ public class ApplyCreateGroupFormDTO implements Serializable {
/**
* 当前登录用户id由TokenDto赋值
*/
@NotBlank(message = "当前用户id不能为空")
@NotBlank(message = "当前用户id不能为空",groups ={AddUserInternalGroup.class})
private String userId;
/**
@ -53,19 +54,19 @@ public class ApplyCreateGroupFormDTO implements Serializable {
/**
* 当前网格所属客户id
*/
@NotBlank(message = "当前网格所属客户id不能为空")
@NotBlank(message = "当前网格所属客户id不能为空",groups ={AddUserInternalGroup.class})
private String customerId;
/**
* 当前网格id
*/
@NotBlank(message = "当前网格id不能为空")
@NotBlank(message = "当前网格id不能为空",groups ={AddUserInternalGroup.class})
private String gridId;
/**
* 当前登录用户来源从token中获取
*/
@NotBlank(message = "app不能为空")
@NotBlank(message = "app不能为空",groups ={AddUserInternalGroup.class})
private String app;
/**

2
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/controller/ResiGroupController.java

@ -157,7 +157,7 @@ public class ResiGroupController {
@RequestBody ApplyCreateGroupFormDTO applyCreateGroupFormDTO) {
applyCreateGroupFormDTO.setUserId(tokenDto.getUserId());
applyCreateGroupFormDTO.setApp(tokenDto.getApp());
ValidatorUtils.validateEntity(applyCreateGroupFormDTO);
ValidatorUtils.validateEntity(applyCreateGroupFormDTO,ApplyCreateGroupFormDTO.AddUserShowGroup.class,ApplyCreateGroupFormDTO.AddUserInternalGroup.class);
resiGroupService.applyCreateGroup(applyCreateGroupFormDTO);
return new Result();
}

30
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupServiceImpl.java

@ -1598,7 +1598,7 @@ public class ResiGroupServiceImpl extends BaseServiceImpl<ResiGroupDao, ResiGrou
textScanParamDTO.getTasks().add(taskDTO);
Result<SyncScanResult> textSyncScanResult = ScanContentUtils.textSyncScan(scanApiUrl.concat(textSyncScanMethod), textScanParamDTO);
if (!textSyncScanResult.success()) {
logger.error("调用内容审核服务审核文本发生错误:{}", textSyncScanResult.getInternalMsg());
logger.warn("调用内容审核服务审核文本发生错误:{}", textSyncScanResult.getInternalMsg());
throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode());
} else {
if (!textSyncScanResult.getData().isAllPass()) {
@ -1607,19 +1607,21 @@ public class ResiGroupServiceImpl extends BaseServiceImpl<ResiGroupDao, ResiGrou
}
// 图片内容审核
ImgScanParamDTO imgScanParamDTO = new ImgScanParamDTO();
ImgTaskDTO task = new ImgTaskDTO();
task.setDataId(UUID.randomUUID().toString().replace("-", ""));
task.setUrl(groupHeadPhoto);
imgScanParamDTO.getTasks().add(task);
Result<SyncScanResult> imgScanResult = ScanContentUtils.imgSyncScan(scanApiUrl.concat(imgSyncScanMethod), imgScanParamDTO);
if (!imgScanResult.success()){
logger.error("调用内容审核服务审核图片发生错误:{}", textSyncScanResult.getInternalMsg());
throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode());
} else {
if (!textSyncScanResult.getData().isAllPass()) {
throw new RenException(EpmetErrorCode.IMG_SCAN_FAILED.getCode(), EpmetErrorCode.IMG_SCAN_FAILED.getMsg());
if(StringUtils.isNotBlank(groupHeadPhoto)){
ImgScanParamDTO imgScanParamDTO = new ImgScanParamDTO();
ImgTaskDTO task = new ImgTaskDTO();
task.setDataId(UUID.randomUUID().toString().replace("-", ""));
task.setUrl(groupHeadPhoto);
imgScanParamDTO.getTasks().add(task);
Result<SyncScanResult> imgScanResult = ScanContentUtils.imgSyncScan(scanApiUrl.concat(imgSyncScanMethod), imgScanParamDTO);
if (!imgScanResult.success()){
logger.warn("调用内容审核服务审核图片发生错误:{}", textSyncScanResult.getInternalMsg());
throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode());
} else {
if (!imgScanResult.getData().isAllPass()) {
throw new RenException(EpmetErrorCode.IMG_SCAN_FAILED.getCode(), EpmetErrorCode.IMG_SCAN_FAILED.getMsg());
}
}
}
}

10
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/invitation/service/impl/GroupInvitationServiceImpl.java

@ -494,9 +494,13 @@ public class GroupInvitationServiceImpl extends BaseServiceImpl<GroupInvitationD
Result<UserInfoOnEnterGridResultDTO> result=resiGuideFeignClient.enterGrid(userEnterGridFormDTO);
if (!result.success() || null == result.getData()) {
logger.warn(String.format("用户同意邀请进组,进入网格失败。入参:userId【%s】、invitationId【%s】、groupId【%s】、customerId【%s】、gridId【%s】",
formDTO.getUserId(), formDTO.getInvitationId(),
groupInvitationDTO.getResiGroupId()),
resiGroupDTO.getCustomerId(), resiGroupDTO.getGridId());
formDTO.getUserId(),
formDTO.getInvitationId(),
groupInvitationDTO.getResiGroupId(),
resiGroupDTO.getCustomerId(),
resiGroupDTO.getGridId()
)
);
logger.warn(String.format("用户同意邀请进组,进入网格失败。当前接口返回8000,调用enterGrid接口返回", result.toString()));
throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode());
}

14
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/service/impl/NoticeServiceImpl.java

@ -18,6 +18,7 @@
package com.epmet.modules.notice.service.impl;
import cn.hutool.core.collection.CollUtil;
import com.alibaba.fastjson.JSON;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.AppClientConstant;
import com.epmet.commons.tools.constant.NumConstant;
@ -512,10 +513,11 @@ public class NoticeServiceImpl extends BaseServiceImpl<NoticeDao, NoticeEntity>
textScanParamDTO.getTasks().add(taskDTO);
Result<SyncScanResult> textSyncScanResult = ScanContentUtils.textSyncScan(scanApiUrl.concat(textSyncScanMethod), textScanParamDTO);
if (!textSyncScanResult.success()) {
logger.error("safetyCheck textScan return failed,result:"+ JSON.toJSONString(textSyncScanResult));
throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode());
} else {
if (!textSyncScanResult.getData().isAllPass()) {
logger.error(String.format(TopicConstant.CREATE_TOPIC, word));
logger.warn(EpmetErrorCode.TEXT_SCAN_FAILED.getMsg().concat(String.format(TopicConstant.CREATE_TOPIC, word)));
throw new RenException(EpmetErrorCode.TEXT_SCAN_FAILED.getCode());
}
}
@ -532,12 +534,14 @@ public class NoticeServiceImpl extends BaseServiceImpl<NoticeDao, NoticeEntity>
});
Result<SyncScanResult> imgScanResult = ScanContentUtils.imgSyncScan(scanApiUrl.concat(imgSyncScanMethod), imgScanParamDTO);
if (!imgScanResult.success()) {
logger.error("safetyCheck imgScan return failed,result:"+ JSON.toJSONString(imgScanResult));
throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode());
} else {
if (!imgScanResult.getData().isAllPass()) {
throw new RenException(EpmetErrorCode.IMG_SCAN_FAILED.getCode());
}
}
if (!imgScanResult.getData().isAllPass()) {
logger.warn(EpmetErrorCode.IMG_SCAN_FAILED.getMsg());
throw new RenException(EpmetErrorCode.IMG_SCAN_FAILED.getCode());
}
}
}

33
epmet-module/resi-voice/resi-voice-server/src/main/java/com/epmet/controller/ArticleController.java

@ -4,13 +4,8 @@ import com.epmet.commons.tools.annotation.LoginUser;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.dto.form.ArticlePageFormDTO;
import com.epmet.dto.form.ResiArticleDetailFormDTO;
import com.epmet.dto.form.ResiTagListFormDTO;
import com.epmet.dto.form.TagCascadeListFormDTO;
import com.epmet.dto.result.ArticleDetailResultDTO;
import com.epmet.dto.result.ArticleWithTagsResultDTO;
import com.epmet.dto.result.TagInfoResultDTO;
import com.epmet.dto.form.*;
import com.epmet.dto.result.*;
import com.epmet.feign.GovVoiceOpenFeignClient;
import com.epmet.service.ArticleService;
import org.springframework.beans.factory.annotation.Autowired;
@ -79,4 +74,28 @@ public class ArticleController {
return govVoiceOpenFeignClient.resiArticleDetail(articleDetailFormDTO);
}
/**
* @Description 专题文章列表
* @Param formDTO
* @author zxc
* @date 2021/7/16 1:30 下午
*/
@PostMapping("subjectarticlelist")
public Result<List<SubjectArticleListResultDTO>> subjectArticleList(@RequestBody SubjectArticleListFormDTO formDTO){
ValidatorUtils.validateEntity(formDTO,SubjectArticleListFormDTO.SubjectArticleListForm.class);
return new Result<List<SubjectArticleListResultDTO>>().ok(articleService.subjectArticleList(formDTO));
}
/**
* @Description 专题列表
* @Param formDTO
* @author zxc
* @date 2021/7/16 1:30 下午
*/
@PostMapping("subjectlist")
public Result<List<SubjectListResultDTO>> subjectList(@RequestBody SubjectListFormDTO formDTO){
ValidatorUtils.validateEntity(formDTO, SubjectListFormDTO.SubjectListForm.class);
return new Result<List<SubjectListResultDTO>>().ok(articleService.subjectList(formDTO));
}
}

22
epmet-module/resi-voice/resi-voice-server/src/main/java/com/epmet/service/ArticleService.java

@ -1,10 +1,10 @@
package com.epmet.service;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.dto.form.ArticlePageFormDTO;
import com.epmet.dto.form.ResiTagListFormDTO;
import com.epmet.dto.form.TagCascadeListFormDTO;
import com.epmet.dto.form.*;
import com.epmet.dto.result.ArticleWithTagsResultDTO;
import com.epmet.dto.result.SubjectArticleListResultDTO;
import com.epmet.dto.result.SubjectListResultDTO;
import com.epmet.dto.result.TagInfoResultDTO;
import java.util.List;
@ -37,4 +37,20 @@ public interface ArticleService {
* @date 2020.06.03 14:19
**/
List<ArticleWithTagsResultDTO> articleList(ArticlePageFormDTO articlePageFormDTO);
/**
* @Description 专题文章列表
* @Param formDTO
* @author zxc
* @date 2021/7/16 1:31 下午
*/
List<SubjectArticleListResultDTO> subjectArticleList(SubjectArticleListFormDTO formDTO);
/**
* @Description 专题列表
* @Param formDTO
* @author zxc
* @date 2021/7/16 1:31 下午
*/
List<SubjectListResultDTO> subjectList(SubjectListFormDTO formDTO);
}

38
epmet-module/resi-voice/resi-voice-server/src/main/java/com/epmet/service/impl/ArticleServiceImpl.java

@ -5,12 +5,8 @@ import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.form.ArticlePageFormDTO;
import com.epmet.dto.form.ResiTagListFormDTO;
import com.epmet.dto.form.TagCascadeListFormDTO;
import com.epmet.dto.result.ArticleListResultDTO;
import com.epmet.dto.result.ArticleWithTagsResultDTO;
import com.epmet.dto.result.TagInfoResultDTO;
import com.epmet.dto.form.*;
import com.epmet.dto.result.*;
import com.epmet.feign.GovVoiceOpenFeignClient;
import com.epmet.service.ArticleService;
import com.epmet.utils.ModuleConstant;
@ -89,4 +85,34 @@ public class ArticleServiceImpl implements ArticleService {
throw new RenException(articles.getInternalMsg());
}
/**
* @Description 专题文章列表
* @Param formDTO
* @author zxc
* @date 2021/7/16 1:31 下午
*/
@Override
public List<SubjectArticleListResultDTO> subjectArticleList(SubjectArticleListFormDTO formDTO) {
Result<List<SubjectArticleListResultDTO>> listResult = govVoiceOpenFeignClient.subjectArticleList(formDTO);
if (!listResult.success()){
throw new RenException("resi-voice调用gov-voice查询 专题文章列表失败【"+listResult.getMsg()+"】");
}
return listResult.getData();
}
/**
* @Description 专题列表
* @Param formDTO
* @author zxc
* @date 2021/7/16 1:31 下午
*/
@Override
public List<SubjectListResultDTO> subjectList(SubjectListFormDTO formDTO) {
Result<List<SubjectListResultDTO>> listResult = govVoiceOpenFeignClient.subjectList(formDTO);
if (!listResult.success()){
throw new RenException("resi-voice调用gov-voice查询 专题列表失败【"+listResult.getMsg()+"】");
}
return listResult.getData();
}
}

1
epmet-user/epmet-user-server/src/main/resources/mapper/GridLatestDao.xml

@ -47,6 +47,7 @@
<if test='customerUserId != "" and customerUserId != null'>
AND la.customer_user_id = #{customerUserId}
</if>
order by la.CREATED_TIME desc limit 1
</select>
<update id="updateByLatestId">

Loading…
Cancel
Save