diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/ApplicationReadyEventListener.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/ApplicationReadyEventListener.java index 901163e7ac..b24afb28b0 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/ApplicationReadyEventListener.java +++ b/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 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(); } diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/RequirePermissionEnum.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/RequirePermissionEnum.java index 8c8fd0dab3..831913de5e 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/RequirePermissionEnum.java +++ b/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","专题管理:移除专题","专题管理:移除专题"), /** * 基层治理-支部管理 diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java index 43c5468cc3..3a213b5191 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java @@ -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,"手机号未注册,请先完成信息注册"), diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/filter/LogMsgSendFilter.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/filter/LogMsgSendFilter.java index c6b349102f..ffadf837b3 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/filter/LogMsgSendFilter.java +++ b/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; } diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java index 6f5e7bf1f3..6d5a5f0cfb 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java +++ b/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; } /** diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/SpringContextUtils.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/SpringContextUtils.java index cb5b455b14..3acb96c868 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/SpringContextUtils.java +++ b/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 getBean(Class requiredType) { + if (applicationContext == null){ + return null; + } return applicationContext.getBean(requiredType); } diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/result/StaffRoleListResultDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/result/StaffRoleListResultDTO.java new file mode 100644 index 0000000000..24547c5dcc --- /dev/null +++ b/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; + +} diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/result/StaffAgencyGridListResultDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/result/StaffAgencyGridListResultDTO.java new file mode 100644 index 0000000000..ec17ca86db --- /dev/null +++ b/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 gridList = new ArrayList<>(); + //当前组织的所有下级组织信息(递归) + private List 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 = ""; + } + +} diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/GovOrgController.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/GovOrgController.java index 064669c50d..1f044a21e2 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/GovOrgController.java +++ b/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 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 staffAgencyGridList(@LoginUser TokenDto tokenDto) { + return new Result().ok(govOrgService.staffAgencyGridList(tokenDto)); + } + } diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmetuser/StaffRoleDao.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmetuser/StaffRoleDao.java index ac0cf9a846..e6435c6507 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmetuser/StaffRoleDao.java +++ b/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 { * @author sun */ List staffGridRole(@Param("forms") List forms, @Param("staffName") String staffName); + + /** + * @Description 根据客户Id和staffId查询工作人员拥有的角色列表 + * @Author sun + **/ + List selectStaffRoleList(@Param("customerId") String customerId, @Param("staffId") String staffId); + } \ No newline at end of file diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/govorg/CustomerAgencyDao.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/govorg/CustomerAgencyDao.java index 7d705c2aa3..8287c13882 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/govorg/CustomerAgencyDao.java +++ b/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 { List selectNextAgency(@Param("customerId")String customerId, @Param("pid")String pid); + + /** + * @Author sun + * @Description 递归查询当前组织的直属下级组织列表 + **/ + List selectSubAgencyList(@Param("subAgencyPids") String subAgencyPids); } \ No newline at end of file diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/govorg/CustomerGridDao.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/govorg/CustomerGridDao.java index 3fcc8655ed..56d07daafb 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/govorg/CustomerGridDao.java +++ b/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 { * @author sun */ List getGridInfoList(@Param("gridIds") List gridIds, @Param("staffId") String staffId); + + /** + * @Author sun + * @Description 查询当前组织下网格列表 + **/ + List getGridListByAgencyId(@Param("agencyId") String agencyId); + } \ No newline at end of file diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/govorg/CustomerStaffGridDao.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/govorg/CustomerStaffGridDao.java index 233c68d67d..a6757c8cca 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/govorg/CustomerStaffGridDao.java +++ b/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 { * @author sun */ List selectGridStaffByGridIds(@Param("gridIds") List gridIds); + + /** + * @Description 查询工作人员参与的网格列表信息 + * @author sun + */ + List getStaffGridList(@Param("agencyId") String agencyId, @Param("staffId") String staffId); } \ No newline at end of file diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/EpmetUserService.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/EpmetUserService.java index 027e36fb8a..10f164c6a9 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/EpmetUserService.java +++ b/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 getStaffRoleList(String customerId, String userId); } diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/EpmetUserServiceImpl.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/EpmetUserServiceImpl.java index 326bb24f20..281f24cc6d 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/EpmetUserServiceImpl.java +++ b/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 getStaffRoleList(String customerId, String userId) { + return staffRoleDao.selectStaffRoleList(customerId, userId); + } + } diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/GovOrgService.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/GovOrgService.java index 8cfd4a2276..2e5422376b 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/GovOrgService.java +++ b/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); + } diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/impl/GovOrgServiceImpl.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/impl/GovOrgServiceImpl.java index 31b5f9272c..8cfe95113f 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/impl/GovOrgServiceImpl.java +++ b/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 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 gridList = customerGridDao.getGridListByAgencyId(agencyDTO.getId()); + resultDTO.setGridList(gridList); + //递归查询当前组织的下级组织以及每个下级组织对应的网格列表 + //根组织pids为空 + List subAgencyGridList = getSubAgencyAndGridList(("".equals(agencyDTO.getPids()) ? "" : agencyDTO.getPids() + ":") + agencyDTO.getId()); + resultDTO.setSubAgencyGridList(subAgencyGridList); + } else if (gridParty) { + resultDTO.setIsOpt(false); + //4.2:查询人员在当前机关下参与的网格列表 + List 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 getSubAgencyAndGridList(String subAgencyPids) { + List subAgencyList = customerAgencyDao.selectSubAgencyList(subAgencyPids); + if (subAgencyList.size() > NumConstant.ZERO) { + for (StaffAgencyGridListResultDTO sub : subAgencyList) { + List gridList = customerGridDao.getGridListByAgencyId(sub.getAgencyId()); + sub.setGridList(gridList); + List subAgency = getSubAgencyAndGridList(sub.getPids() + ":" + sub.getAgencyId()); + sub.setSubAgencyGridList(subAgency); + } + } + return subAgencyList; + } + } diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/StaffRoleDao.xml b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/StaffRoleDao.xml index 7805f832f4..fe5ecb1ff5 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/StaffRoleDao.xml +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/StaffRoleDao.xml @@ -22,4 +22,28 @@ + + \ No newline at end of file diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govorg/CustomerAgencyDao.xml b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govorg/CustomerAgencyDao.xml index 3033937191..58856e4c7c 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govorg/CustomerAgencyDao.xml +++ b/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 + + + \ No newline at end of file diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govorg/CustomerGridDao.xml b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govorg/CustomerGridDao.xml index 2ca96e0edd..0fa266afc8 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govorg/CustomerGridDao.xml +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govorg/CustomerGridDao.xml @@ -147,4 +147,20 @@ + + diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govorg/CustomerStaffAgencyDao.xml b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govorg/CustomerStaffAgencyDao.xml index 763c06694b..4ed6d3a2d1 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govorg/CustomerStaffAgencyDao.xml +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govorg/CustomerStaffAgencyDao.xml @@ -19,7 +19,14 @@ + + \ No newline at end of file diff --git a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/impl/StaffAgencyServiceImpl.java b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/impl/StaffAgencyServiceImpl.java index a025a0b74b..c6f9ad683b 100644 --- a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/impl/StaffAgencyServiceImpl.java +++ b/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 getLatestGrid(LatestGridFormDTO latestGridFormDTO) { - Result latestGridResult = - epmetUserFeignClient.getStaffLatestGrid(latestGridFormDTO); + //首先获取该员工的网格列表 如果为空则直接返回 + Result> 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 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 staffGridResult = getStaffLatestGridAndSaveVisitRecord(latestGridFormDTO); + if (staffGridResult != null) { + return staffGridResult; + } + } return latestGridResult; } else { - Result 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 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 + * @author LiuJanJun + * @date 2021/7/27 4:04 下午 + */ + @Nullable + private Result getStaffLatestGridAndSaveVisitRecord(LatestGridFormDTO latestGridFormDTO) { + Result 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) { @@ -253,4 +285,4 @@ public class StaffAgencyServiceImpl implements StaffAgencyService { } -} \ No newline at end of file +} diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/UpdateTagFormDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/UpdateTagFormDTO.java index d2000b366f..96b7f73fa2 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/UpdateTagFormDTO.java +++ b/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; + /** * 使用计数 */ diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/GovOrgOpenFeignClient.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/GovOrgOpenFeignClient.java index 629c659c66..bf6df86b7b 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/GovOrgOpenFeignClient.java +++ b/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 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 selectPidsByGridId(@RequestParam("gridId") String gridId); + + /** + * 工作人员的个人信息 + * @param fromDTO + * @return + */ + @PostMapping("/gov/org/staff/mine") + Result queryStaffProfile(@RequestBody StaffInfoFromDTO fromDTO); } diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/fallback/GovOrgOpenFeignClientFallback.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/fallback/GovOrgOpenFeignClientFallback.java index ac4e8fa930..c384f302aa 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/fallback/GovOrgOpenFeignClientFallback.java +++ b/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 getAreaCodeSwitch(String customerId) { return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "getAreaCodeSwitch", customerId); } + + @Override + public Result queryStaffProfile(StaffInfoFromDTO fromDTO) { + return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "mine", fromDTO); + } + + @Override + public Result selectPidsByGridId(String gridId) { + return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "selectPidsByGridId", gridId); + } } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerGridController.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerGridController.java index eec27314ba..bb06477812 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerGridController.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerGridController.java @@ -241,4 +241,15 @@ public class CustomerGridController { List resultDTOS = customerGridService.listGridIdsInCommunity(gridId); return new Result>().ok(resultDTOS); } + + /** + * @Description 根据网格ID查询pids + * @Param gridId + * @author zxc + * @date 2021/7/16 9:52 上午 + */ + @PostMapping("pidsbygrid") + public Result selectPidsByGridId(@RequestParam("gridId") String gridId){ + return new Result().ok(customerGridService.selectPidsByGridId(gridId)); + } } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerGridDao.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerGridDao.java index 4277be98c6..ec16bf0dcd 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerGridDao.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerGridDao.java @@ -268,4 +268,12 @@ public interface CustomerGridDao extends BaseDao { * @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); } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerGridService.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerGridService.java index 4799c38890..b892fa84f8 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerGridService.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerGridService.java @@ -287,4 +287,12 @@ public interface CustomerGridService extends BaseService { * @date 2021/4/19 11:53 上午 */ Result getBaseInfo(CustomerGridFormDTO customerGridFormDTO); + + /** + * @Description 根据网格ID查询pids + * @Param gridId + * @author zxc + * @date 2021/7/16 9:52 上午 + */ + String selectPidsByGridId(String gridId); } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridServiceImpl.java index c0a987206b..007aabd4b9 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridServiceImpl.java +++ b/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 getBaseInfo(CustomerGridFormDTO customerGridFormDTO) { return new Result().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 ""; + } } diff --git a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml index 49dbe8f5ef..58d2fd628e 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml +++ b/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' + + + diff --git a/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/SpecialSubjectDTO.java b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/SpecialSubjectDTO.java new file mode 100644 index 0000000000..8c3a8332aa --- /dev/null +++ b/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 + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto; + +import 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; +} \ No newline at end of file diff --git a/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/AddSpecialSubjectFormDTO.java b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/AddSpecialSubjectFormDTO.java new file mode 100644 index 0000000000..46d3e38926 --- /dev/null +++ b/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; +} diff --git a/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/DelSpecialSubjectFormDTO.java b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/DelSpecialSubjectFormDTO.java new file mode 100644 index 0000000000..fc2f919147 --- /dev/null +++ b/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; + +} diff --git a/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/HotSubjectTagFormDTO.java b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/HotSubjectTagFormDTO.java new file mode 100644 index 0000000000..3208ad1137 --- /dev/null +++ b/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; +} diff --git a/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/InitTagsFormDTO.java b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/InitTagsFormDTO.java index ded8bc1f43..13d14e5fef 100644 --- a/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/InitTagsFormDTO.java +++ b/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; + /** * 使用计数 */ diff --git a/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/PreviewFormDTO.java b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/PreviewFormDTO.java new file mode 100644 index 0000000000..d1e8b137b7 --- /dev/null +++ b/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 tagIdList; + private Integer pageSize; + private Integer pageNo; +} diff --git a/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/QuerySpecialSubFormDTO.java b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/QuerySpecialSubFormDTO.java new file mode 100644 index 0000000000..2410d1fedd --- /dev/null +++ b/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; +} diff --git a/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/SubjectArticleListFormDTO.java b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/SubjectArticleListFormDTO.java new file mode 100644 index 0000000000..d5417bec01 --- /dev/null +++ b/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; +} diff --git a/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/SubjectListFormDTO.java b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/SubjectListFormDTO.java new file mode 100644 index 0000000000..41edf32d48 --- /dev/null +++ b/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; +} diff --git a/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/AddSpecialSubjectResultDTO.java b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/AddSpecialSubjectResultDTO.java new file mode 100644 index 0000000000..6e31d7fa46 --- /dev/null +++ b/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; + } +} diff --git a/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/ArticleListResultDTO.java b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/ArticleListResultDTO.java index 04d4f14a27..5d420de782 100644 --- a/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/ArticleListResultDTO.java +++ b/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; } diff --git a/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/PreviewResultDTO.java b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/PreviewResultDTO.java new file mode 100644 index 0000000000..16681096c8 --- /dev/null +++ b/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 articleList; +} diff --git a/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/SubjectArticleListResultDTO.java b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/SubjectArticleListResultDTO.java new file mode 100644 index 0000000000..dc26eb1fbe --- /dev/null +++ b/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 = ""; + } +} diff --git a/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/SubjectListResultDTO.java b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/SubjectListResultDTO.java new file mode 100644 index 0000000000..6696380f3f --- /dev/null +++ b/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; +} diff --git a/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/TagInfoResultDTO.java b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/TagInfoResultDTO.java index a547af8767..1c63a56c9f 100644 --- a/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/TagInfoResultDTO.java +++ b/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; } diff --git a/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/UpdateTagUseCountsResultDTO.java b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/UpdateTagUseCountsResultDTO.java index fba5e29854..2e282b17e5 100644 --- a/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/UpdateTagUseCountsResultDTO.java +++ b/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; } diff --git a/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/WorkSpecialSubjectResultDTO.java b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/WorkSpecialSubjectResultDTO.java new file mode 100644 index 0000000000..bd90c9c462 --- /dev/null +++ b/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; +} diff --git a/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/feign/GovVoiceOpenFeignClient.java b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/feign/GovVoiceOpenFeignClient.java index 8e50537e0c..bfad56b2f5 100644 --- a/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/feign/GovVoiceOpenFeignClient.java +++ b/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 resiArticleDetail(@RequestBody ResiArticleDetailFormDTO articleDetailFormDTO); + /** + * @Description 专题文章列表 + * @Param formDTO + * @author zxc + * @date 2021/7/16 1:26 下午 + */ + @PostMapping("/gov/voice/article/subjectarticlelist") + Result> subjectArticleList(@RequestBody SubjectArticleListFormDTO formDTO); + + /** + * @Description 专题列表 + * @Param formDTO + * @author zxc + * @date 2021/7/16 1:26 下午 + */ + @PostMapping("/gov/voice/article/subjectlist") + Result> subjectList(@RequestBody SubjectListFormDTO formDTO); } diff --git a/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/feign/fallback/GovVoiceOpenFeignClientFallback.java b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/feign/fallback/GovVoiceOpenFeignClientFallback.java index 67d42a3738..86af110762 100644 --- a/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/feign/fallback/GovVoiceOpenFeignClientFallback.java +++ b/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 resiArticleDetail(ResiArticleDetailFormDTO articleDetailFormDTO) { return ModuleUtils.feignConError(ServiceConstant.GOV_VOICE_SERVER, "resiArticleDetail", articleDetailFormDTO); } + + @Override + public Result> subjectArticleList(SubjectArticleListFormDTO formDTO) { + return ModuleUtils.feignConError(ServiceConstant.GOV_VOICE_SERVER, "subjectArticleList", formDTO); + } + + @Override + public Result> subjectList(SubjectListFormDTO formDTO) { + return ModuleUtils.feignConError(ServiceConstant.GOV_VOICE_SERVER, "subjectList", formDTO); + } } diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/controller/ArticleController.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/controller/ArticleController.java index 8f9b03861f..d81affca3a 100644 --- a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/controller/ArticleController.java +++ b/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().ok(draftDetailResultDTO); } -} \ No newline at end of file + /** + * @Description 专题文章列表 + * @Param formDTO + * @author zxc + * @date 2021/7/15 2:21 下午 + */ + @PostMapping("subjectarticlelist") + public Result> subjectArticleList(@RequestBody SubjectArticleListFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO,SubjectArticleListFormDTO.SubjectArticleListForm.class); + return new Result>().ok(articleService.subjectArticleList(formDTO)); + } + + /** + * @Description 专题列表 + * @Param formDTO + * @author zxc + * @date 2021/7/15 5:22 下午 + */ + @PostMapping("subjectlist") + public Result> subjectList(@RequestBody SubjectListFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO, SubjectListFormDTO.SubjectListForm.class); + return new Result>().ok(articleService.subjectList(formDTO)); + } + +} diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/controller/SpecialSubjectController.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/controller/SpecialSubjectController.java new file mode 100644 index 0000000000..017338b433 --- /dev/null +++ b/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 + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.controller; + +import com.epmet.commons.tools.annotation.LoginUser; +import com.epmet.commons.tools.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 addSpecialSubject(@LoginUser TokenDto tokenDto, @RequestBody AddSpecialSubjectFormDTO formDTO) { + formDTO.setAddUserId(tokenDto.getUserId()); + formDTO.setCustomerId(tokenDto.getCustomerId()); + ValidatorUtils.validateEntity(formDTO, AddSpecialSubjectFormDTO.AddUserInternalGroup.class); + return new Result().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> + * @param formDTO + * @author yinzuomei + * @description 【专题管理】已有专题列表 + * @Date 2021/7/15 21:17 + **/ + @PostMapping("existedlist") + public Result> queryExistedList(@LoginUser TokenDto tokenDto, @RequestBody QuerySpecialSubFormDTO formDTO) { + formDTO.setUserId(tokenDto.getUserId()); + formDTO.setCustomerId(tokenDto.getCustomerId()); + ValidatorUtils.validateEntity(formDTO, QuerySpecialSubFormDTO.AddUserInternalGroup.class); + return new Result>().ok(specialSubjectService.queryExistedList(formDTO)); + } + + /** + * 热门标签列表 + * @author zhaoqifeng + * @date 2021/7/15 15:36 + * @param tokenDto + * @return com.epmet.commons.tools.utils.Result> + */ + @PostMapping("hot-subject-taglist") + public Result> hotSubjectTagList(@LoginUser TokenDto tokenDto, @RequestBody HotSubjectTagFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO, HotSubjectTagFormDTO.HotSubjectTagGroup.class); + formDTO.setCustomerId(tokenDto.getCustomerId()); + return new Result>().ok(specialSubjectService.hotSubjectTagList(formDTO)); + } + + /** + * 效果预览 + * @author zhaoqifeng + * @date 2021/7/16 15:54 + * @param formDTO + * @return com.epmet.commons.tools.utils.Result> + */ + @PostMapping("preview") + public Result> preview(@RequestBody PreviewFormDTO formDTO) { + return new Result>().ok(specialSubjectService.preview(formDTO)); + } +} \ No newline at end of file diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/dao/ArticleDao.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/dao/ArticleDao.java index b0c4af6252..1650ee5fb2 100644 --- a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/dao/ArticleDao.java +++ b/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 { **/ List selectArticleList(@Param("gridId") String gridId, @Param("tagIdList") List tagIdList); + List 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 { * @author zxc */ String getArticleIdByDraftId(@Param("draftId") String draftId); + + /** + * @Description 专题下的文章 + * @Param gridId + * @Param tagId + * @author zxc + * @date 2021/7/15 3:49 下午 + */ + List subjectArticleList(@Param("gridId") String gridId,@Param("tagId") String tagId); + + /** + * @Description 专题列表查询 + * @Param pidList + * @author zxc + * @date 2021/7/16 10:29 上午 + */ + List subjectList(@Param("pidList")List pidList); } diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/dao/SpecialSubjectDao.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/dao/SpecialSubjectDao.java new file mode 100644 index 0000000000..4fcd896952 --- /dev/null +++ b/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 + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.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 { + + int delSpecialSubject(@Param("id") String id, @Param("userId") String userId); + + List queryExistedList(@Param("orgId") String orgId,@Param("notList")List notList); + + SpecialSubjectDTO getInfo(@Param("tagId") String tagId); + +} \ No newline at end of file diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/dao/TagCustomerDao.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/dao/TagCustomerDao.java index edcc5ec3b5..595f2a9a18 100644 --- a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/dao/TagCustomerDao.java +++ b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/dao/TagCustomerDao.java @@ -40,7 +40,7 @@ public interface TagCustomerDao extends BaseDao { * @param formDTO * @author zxc */ - void upsertTagCount(UpdateTagFormDTO formDTO); + void upsertTagCount(UpdateTagFormDTO formDTO); /** * @Description 初始化默认标签 @@ -55,4 +55,4 @@ public interface TagCustomerDao extends BaseDao { * @return */ List selectInitData(@Param("customerIdList") List customerIdList); -} \ No newline at end of file +} diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/entity/SpecialSubjectEntity.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/entity/SpecialSubjectEntity.java new file mode 100644 index 0000000000..2b78ecd37a --- /dev/null +++ b/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 + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 专题表 + * + * @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; + +} diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/entity/TagCustomerEntity.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/entity/TagCustomerEntity.java index 878b9e05e5..7a2a54d7ae 100644 --- a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/entity/TagCustomerEntity.java +++ b/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; + /** * 使用计数 */ diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/redis/TagRedis.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/redis/TagRedis.java index c8657af1a5..45a3548367 100644 --- a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/redis/TagRedis.java +++ b/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 resultEquals = new ArrayList<>(); @@ -117,7 +113,7 @@ public class TagRedis { Set> typedTuples = redisUtils.zReverseRangeWithScores(customerKey, start, end); for (CorrelationTagListResultDTO correlationTagList : resultList) { for (ZSetOperations.TypedTuple 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 collect = resultEquals.stream().sorted(Comparator.comparing(TagRankResultDTO::getScore).reversed()).collect(Collectors.toList()); - List 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 result = new ArrayList(); - for (Object object : objects) { - result.add(objectToDTO(object,TagInfoResultDTO.class)); - } -// List 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 result = new ArrayList(); - 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 resultEquals = new ArrayList<>(); @@ -221,7 +200,7 @@ public class TagRedis { Set> typedTuples = redisUtils.zReverseRangeWithScores(gridTagKey, start, end); for (TagInfoResultDTO tagInfo : resultList) { for (ZSetOperations.TypedTuple 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 collect = resultEquals.stream().sorted(Comparator.comparing(TagRankResultDTO::getScore).reversed()).collect(Collectors.toList()); - List 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 objectToDTO(Object o,Class tClass){ - ObjectMapper objectMapper = new ObjectMapper(); - T t = objectMapper.convertValue(o, tClass); - return t; + return ConvertUtils.sourceToTarget(collect, TagInfoResultDTO.class); } /** @@ -282,7 +243,7 @@ public class TagRedis { } }); } - + /** * @Description set 更新标签级联 * @param key @@ -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); + } -} \ No newline at end of file + 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); + } +} diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/ArticleService.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/ArticleService.java index 634fcfa7f5..db03b3a0c5 100644 --- a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/ArticleService.java +++ b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/ArticleService.java @@ -216,4 +216,31 @@ public interface ArticleService extends BaseService { * @return */ void manualPublish(TokenDto tokenDto, String draftId); + + /** + * @Description 专题文章列表 + * @Param formDTO + * @author zxc + * @date 2021/7/15 2:21 下午 + */ + List subjectArticleList(SubjectArticleListFormDTO formDTO); + + /** + * @Description 专题列表 + * @Param formDTO + * @author zxc + * @date 2021/7/15 5:22 下午 + */ + List subjectList(SubjectListFormDTO formDTO); + + /** + * 根据tag查找文章列表 + * @author zhaoqifeng + * @date 2021/7/16 14:50 + * @param tagId + * @param pageNo + * @param pageSize + * @return java.util.List + */ + List getArticleListByTag(String tagId, Integer pageNo, Integer pageSize); } \ No newline at end of file diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/SpecialSubjectService.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/SpecialSubjectService.java new file mode 100644 index 0000000000..8fa6bd1aa7 --- /dev/null +++ b/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 + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.commons.tools.page.PageData; +import com.epmet.dto.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 { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2021-07-15 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2021-07-15 + */ + List list(Map 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 + */ + List 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 queryExistedList(QuerySpecialSubFormDTO formDTO); + + /** + * 效果预览 + * @author zhaoqifeng + * @date 2021/7/16 14:28 + * @param formDTO + * @return java.util.List + */ + List preview(PreviewFormDTO formDTO); +} \ No newline at end of file diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/ArticleServiceImpl.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/ArticleServiceImpl.java index d7786573ff..f45707ee7b 100644 --- a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/ArticleServiceImpl.java +++ b/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 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 subjectArticleList(SubjectArticleListFormDTO formDTO) { + PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize()); + List 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 subjectList(SubjectListFormDTO formDTO) { + String gridId = formDTO.getGridId(); + Result pidsByGridId = govOrgOpenFeignClient.selectPidsByGridId(gridId); + if (!pidsByGridId.success()){ + throw new RenException("查询pids失败【"+pidsByGridId.getMsg()+"】"); + } + String pids = pidsByGridId.getData(); + List pidList = Arrays.stream(pids.split(":")).collect(Collectors.toList()); + pidList.add(gridId); + List 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 + * @author zhaoqifeng + * @date 2021/7/16 14:47 + */ + @Override + public List getArticleListByTag(String tagId, Integer pageNo, Integer pageSize) { + return baseDao.selectArticleListByTag(tagId, pageNo, pageSize); + } } diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/SpecialSubjectServiceImpl.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/SpecialSubjectServiceImpl.java new file mode 100644 index 0000000000..3667e35988 --- /dev/null +++ b/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 + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.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 implements SpecialSubjectService { + @Autowired + private TagCustomerService tagCustomerService; + @Resource + private TagRedis tagRedis; + @Autowired + private GovOrgOpenFeignClient govOrgOpenFeignClient; + @Resource + private ArticleService articleService; + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, SpecialSubjectDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, SpecialSubjectDTO.class); + } + + private QueryWrapper getWrapper(Map params){ + String id = (String)params.get(FieldConstant.ID_HUMP); + + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); + + return wrapper; + } + + @Override + public 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 havedList=this.queryExistedList(querySpecialSubFormDTO); + List 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 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 queryExistedList(QuerySpecialSubFormDTO formDTO) { + Result staffResult = govOrgOpenFeignClient.getAgencyByStaff(formDTO.getUserId()); + if (!staffResult.success() && null == staffResult.getData()) { + throw new RenException("查询当前工作人员信息异常"); + } + List resultDTOList = new ArrayList<>(); + List notList = new ArrayList<>(); + //当前组织或者网格自己建立的 + List currentOrgList = new ArrayList<>(); + List 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 pidList = Arrays.asList(formDTO.getPids().split(StrConstant.COLON)); + for (String pid : pidList) { + if(CollectionUtils.isNotEmpty(resultDTOList)){ + List parentAddList=resultDTOList.stream().map(WorkSpecialSubjectResultDTO::getTagId).distinct().collect(Collectors.toList()); + notList.addAll(parentAddList); + } + //优先展示自己的,所以要排除掉自己的,自上向下查,优先展示上层领导们给我建立的专题 + List 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 + * @author zhaoqifeng + * @date 2021/7/15 15:35 + */ + @Override + public List hotSubjectTagList(HotSubjectTagFormDTO formDTO) { + + List list = tagRedis.zRevRange(formDTO.getCustomerId()); + List orgIds = Stream.of(formDTO.getPids().split(StrConstant.COLON)).collect(Collectors.toList()); + orgIds.add(formDTO.getOrgId()); + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(SpecialSubjectEntity :: getCustomerId, formDTO.getCustomerId()); + wrapper.eq(SpecialSubjectEntity :: getDelFlag, NumConstant.ZERO_STR); + wrapper.in(SpecialSubjectEntity :: getAddOrgId, orgIds); + //查询出当前组织或网格已有的专题, + List specialSubjectList = baseDao.selectList(wrapper); + if (CollectionUtils.isNotEmpty(specialSubjectList)) { + List 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 + * @author zhaoqifeng + * @date 2021/7/16 14:28 + */ + @Override + public List preview(PreviewFormDTO formDTO) { + List 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; + + } + +} diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/TagCustomerServiceImpl.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/TagCustomerServiceImpl.java index 58ece05108..b5c69d76c1 100644 --- a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/TagCustomerServiceImpl.java +++ b/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,11 +115,15 @@ public class TagCustomerServiceImpl extends BaseServiceImpl>> 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> 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>> customerTag, String customerId, String id, String tagName, Integer useCount) { + private void buildZset(Map>> customerTag, String customerId, String id, String tagName, String tagColor, Integer useCount) { Set> typedTupleSet = customerTag.get(customerId); if (typedTupleSet == null) { typedTupleSet = new HashSet<>(); @@ -245,7 +253,8 @@ public class TagServiceImpl implements TagService { UpdateTagUseCountsResultDTO initTag = new UpdateTagUseCountsResultDTO(); initTag.setTagId(id); initTag.setTagName(tagName); + initTag.setTagColor(tagColor); ZSetOperations.TypedTuple typedTuple1 = new DefaultTypedTuple<>(initTag, Double.valueOf(useCount)); typedTupleSet.add(typedTuple1); } -} \ No newline at end of file +} diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/utils/TagColorUtils.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/utils/TagColorUtils.java new file mode 100644 index 0000000000..ce1e289f31 --- /dev/null +++ b/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]; + } +} diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/resources/db/migration/V0.0.4__create_specialsubject.sql b/epmet-module/gov-voice/gov-voice-server/src/main/resources/db/migration/V0.0.4__create_specialsubject.sql new file mode 100644 index 0000000000..87004cd042 --- /dev/null +++ b/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='专题表'; \ No newline at end of file diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/resources/db/migration/V0.0.5__add_tag_color.sql b/epmet-module/gov-voice/gov-voice-server/src/main/resources/db/migration/V0.0.5__add_tag_color.sql new file mode 100644 index 0000000000..fad88adfab --- /dev/null +++ b/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; + + + + + diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/resources/db/migration/V0.0.6__add_del_staffid.sql b/epmet-module/gov-voice/gov-voice-server/src/main/resources/db/migration/V0.0.6__add_del_staffid.sql new file mode 100644 index 0000000000..edc1c28425 --- /dev/null +++ b/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; \ No newline at end of file diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/ArticleDao.xml b/epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/ArticleDao.xml index b781bbd889..732bf2683a 100644 --- a/epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/ArticleDao.xml +++ b/epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/ArticleDao.xml @@ -347,4 +347,83 @@ AND a.draft_id = #{draftId} + + + + + + + diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/SpecialSubjectDao.xml b/epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/SpecialSubjectDao.xml new file mode 100644 index 0000000000..d5d457bb02 --- /dev/null +++ b/epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/SpecialSubjectDao.xml @@ -0,0 +1,42 @@ + + + + + + + update special_subject set del_flag='1',UPDATED_BY=#{userId},UPDATED_TIME=Now(),DEL_STAFF_ID=#{userId} + where id=#{id} + + + + + \ No newline at end of file diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/TagCustomerDao.xml b/epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/TagCustomerDao.xml index 12da65d434..183eb8317f 100644 --- a/epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/TagCustomerDao.xml +++ b/epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/TagCustomerDao.xml @@ -7,11 +7,12 @@ select id from tag_customer where tag_name = #{tagName} AND CUSTOMER_ID = #{customerId} - 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 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 ( - #{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() ) ON DUPLICATE KEY UPDATE @@ -41,6 +42,7 @@ ID, CUSTOMER_ID, TAG_NAME, + TAG_COLOR, USE_COUNT FROM tag_customer @@ -54,4 +56,4 @@ ORDER BY CUSTOMER_ID - \ No newline at end of file + diff --git a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/impl/CustomerAppServiceImpl.java b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/impl/CustomerAppServiceImpl.java index c245f3a06e..00da16612d 100644 --- a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/impl/CustomerAppServiceImpl.java +++ b/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 appSet = redisTemplate.opsForSet(); List configAllApp = this.getConfigAllApp(); @@ -127,4 +126,4 @@ public class CustomerAppServiceImpl extends BaseServiceImpl 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 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 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()); + } } } } diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/invitation/service/impl/GroupInvitationServiceImpl.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/invitation/service/impl/GroupInvitationServiceImpl.java index f13010a93c..3a59f101a0 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/invitation/service/impl/GroupInvitationServiceImpl.java +++ b/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 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()); } diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/service/impl/NoticeServiceImpl.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/service/impl/NoticeServiceImpl.java index 1414d430ee..b21c69a4ae 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/service/impl/NoticeServiceImpl.java +++ b/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 textScanParamDTO.getTasks().add(taskDTO); Result 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,13 +534,15 @@ public class NoticeServiceImpl extends BaseServiceImpl }); Result 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()); + } + } } -} \ No newline at end of file +} diff --git a/epmet-module/resi-voice/resi-voice-server/src/main/java/com/epmet/controller/ArticleController.java b/epmet-module/resi-voice/resi-voice-server/src/main/java/com/epmet/controller/ArticleController.java index 2a8bbfd988..e4e7d5628e 100644 --- a/epmet-module/resi-voice/resi-voice-server/src/main/java/com/epmet/controller/ArticleController.java +++ b/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> subjectArticleList(@RequestBody SubjectArticleListFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO,SubjectArticleListFormDTO.SubjectArticleListForm.class); + return new Result>().ok(articleService.subjectArticleList(formDTO)); + } + + /** + * @Description 专题列表 + * @Param formDTO + * @author zxc + * @date 2021/7/16 1:30 下午 + */ + @PostMapping("subjectlist") + public Result> subjectList(@RequestBody SubjectListFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO, SubjectListFormDTO.SubjectListForm.class); + return new Result>().ok(articleService.subjectList(formDTO)); + } + } diff --git a/epmet-module/resi-voice/resi-voice-server/src/main/java/com/epmet/service/ArticleService.java b/epmet-module/resi-voice/resi-voice-server/src/main/java/com/epmet/service/ArticleService.java index d84c9fb966..ff95816e96 100644 --- a/epmet-module/resi-voice/resi-voice-server/src/main/java/com/epmet/service/ArticleService.java +++ b/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 articleList(ArticlePageFormDTO articlePageFormDTO); + + /** + * @Description 专题文章列表 + * @Param formDTO + * @author zxc + * @date 2021/7/16 1:31 下午 + */ + List subjectArticleList(SubjectArticleListFormDTO formDTO); + + /** + * @Description 专题列表 + * @Param formDTO + * @author zxc + * @date 2021/7/16 1:31 下午 + */ + List subjectList(SubjectListFormDTO formDTO); } diff --git a/epmet-module/resi-voice/resi-voice-server/src/main/java/com/epmet/service/impl/ArticleServiceImpl.java b/epmet-module/resi-voice/resi-voice-server/src/main/java/com/epmet/service/impl/ArticleServiceImpl.java index 55ad32285d..72b5def2d8 100644 --- a/epmet-module/resi-voice/resi-voice-server/src/main/java/com/epmet/service/impl/ArticleServiceImpl.java +++ b/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 subjectArticleList(SubjectArticleListFormDTO formDTO) { + Result> 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 subjectList(SubjectListFormDTO formDTO) { + Result> listResult = govVoiceOpenFeignClient.subjectList(formDTO); + if (!listResult.success()){ + throw new RenException("resi-voice调用gov-voice查询 专题列表失败【"+listResult.getMsg()+"】"); + } + return listResult.getData(); + } + } diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/GridLatestDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/GridLatestDao.xml index 911c243bc8..59f1be1af7 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/GridLatestDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/GridLatestDao.xml @@ -47,6 +47,7 @@ AND la.customer_user_id = #{customerUserId} + order by la.CREATED_TIME desc limit 1