diff --git a/epmet-cloud-generator/src/main/resources/application.yml b/epmet-cloud-generator/src/main/resources/application.yml index f759f036b9..8e526e2a73 100644 --- a/epmet-cloud-generator/src/main/resources/application.yml +++ b/epmet-cloud-generator/src/main/resources/application.yml @@ -9,7 +9,7 @@ spring: type: com.alibaba.druid.pool.DruidDataSource #MySQL配置 driverClassName: com.mysql.jdbc.Driver - url: jdbc:mysql://192.168.1.130:3306/epmet_user?useUnicode=true&characterEncoding=UTF-8&useSSL=false + url: jdbc:mysql://192.168.1.130:3306/epmet_gov_voice?useUnicode=true&characterEncoding=UTF-8&useSSL=false username: epmet_dba password: EpmEt-dbA-UsEr #oracle配置 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 321211465d..dcf93d3a24 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 @@ -8,6 +8,8 @@ package com.epmet.commons.tools.redis; +import com.epmet.commons.tools.constant.StrConstant; + /** * @author Mark sunlightcs@gmail.com * @since 1.0.0 @@ -213,4 +215,43 @@ public class RedisKeys { public static String getAgencyByIdKey(String agencyId) { return rootPrefix.concat("gov:agency:").concat(agencyId); } + + /** + * 客户标签排行 缓存Key + * @param customerId + * @return + */ + public static String getCustomerTagKey(String customerId) { + return rootPrefix.concat("tags:customer:rankingTag:").concat(customerId); + } + + /** + * 客户关联标签 缓存Key + * @param customerId + * @param tagId + * @return + */ + public static String getCustomerReTagKey(String customerId,String tagId) { + return rootPrefix.concat("tags:customer:relationTag:").concat(customerId).concat(StrConstant.COLON).concat(tagId); + } + + /** + * 网格标签排行 缓存Key + * @param gridId + * @return + */ + public static String getGridTagKey(String gridId) { + return rootPrefix.concat("tags:grid:rankingTag:").concat(gridId); + } + + /** + * 网格关联标签 缓存Key + * @param gridId + * @param tagId + * @return + */ + public static String getGridReTagKey(String gridId,String tagId) { + return rootPrefix.concat("tags:grid:relationTag:").concat(gridId).concat(StrConstant.COLON).concat(tagId); + } + } diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/DateUtils.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/DateUtils.java index e4fcc31010..2887ed1adf 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/DateUtils.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/DateUtils.java @@ -16,6 +16,7 @@ import org.joda.time.format.DateTimeFormatter; import java.text.ParseException; import java.text.SimpleDateFormat; +import java.util.Calendar; import java.util.Date; /** @@ -25,6 +26,7 @@ import java.util.Date; * @since 1.0.0 */ public class DateUtils { + /** 时间格式(yyyy-MM-dd) */ public final static String DATE_PATTERN = "yyyy-MM-dd"; /** 时间格式(yyyy-MM-dd HH:mm:ss) */ @@ -34,6 +36,15 @@ public class DateUtils { /** 时间格式(yyyy-MM-dd HH:mm) */ public final static String DATE_TIME_PATTERN_END_WITH_MINUTE = "yyyy-MM-dd HH:mm"; + public static final String DATE_PATTERN_YYYYMMDD = "yyyyMMdd"; + public static final String DATE_NAME_PATTERN = "yyyy年MM月dd日"; + public static final String MONTH_NAME_PATTERN = "yyyy年MM月"; + public static final String DATE_PATTERN_YYYY = "yyyy"; + public static final String DATE_PATTERN_YYYYMM = "yyyyMM"; + + public static final String WEEK_TYPE_ENGLISH = "english"; + public static final String WEEK_TYPE_CHINESE = "chinese"; + /** * 日期格式化 日期格式为:yyyy-MM-dd * @param date 日期 @@ -184,4 +195,93 @@ public class DateUtils { DateTime dateTime = new DateTime(date); return dateTime.plusYears(years).toDate(); } + + /** + * 获取星期几,例如:星期一 + * @param date + * @return + */ + public static String getWeekNameOfWeek(Date date, String type) { + Calendar calendar = Calendar.getInstance(); + calendar.setTime(date); + int dayOfWeek = calendar.get(Calendar.DAY_OF_WEEK); + String[] chineseWeekDayName = { "星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六" }; + String[] englishWeekDayName = { "Sunday", "Monday","Tuesday","Wednesday","Thursday","Friday","Saturday" }; + + String weekDayName; + switch (type) { + case WEEK_TYPE_ENGLISH: + weekDayName = englishWeekDayName[dayOfWeek - 1]; + break; + case WEEK_TYPE_CHINESE: + weekDayName = chineseWeekDayName[dayOfWeek - 1]; + break; + default: + weekDayName = ""; + } + + return weekDayName; + } + + //public static String getEnglishWeekName(Date date) { + // new SimpleDateFormat("E"); + //} + + /** + * 获取属于一年的第几周 + * @param date + * @return + */ + public static int getWeekOfYear(Date date) { + DateTime dateTime = new DateTime(date); + return dateTime.getWeekOfWeekyear(); + } + + /** + * 按照格式进行时间取整 + * @param targetDate + * @param pattern + * @return + */ + public static Date integrate(Date targetDate, String pattern) { + return DateUtils.parse(DateUtils.format(targetDate, pattern), pattern); + } + + /** + * 查询指定日期是几月 + * @param date + * @return + */ + public static int getMonthOfYear(Date date) { + LocalDate localDate = new LocalDate(date); + return localDate.getMonthOfYear(); + } + + /** + * 获取季度 + * @param date + * @return + */ + public static int getQuarterIndex(Date date) { + LocalDate localDate = new LocalDate(date); + int monthOfYear = localDate.getMonthOfYear(); + if (monthOfYear == 1 || monthOfYear == 2 || monthOfYear == 3) { + return 1; + } + if (monthOfYear == 4 || monthOfYear == 5 || monthOfYear == 6) { + return 2; + } + if (monthOfYear == 7 || monthOfYear == 8 || monthOfYear == 9) { + return 3; + } + return 4; + } + + public static void main(String[] args) { + //int weekOfYear = getWeekOfYear(new Date()); + + int quarterIndex = DateUtils.getQuarterIndex(DateUtils.parse("20201001", DateUtils.DATE_PATTERN_YYYYMMDD)); + + System.out.println(666); + } } diff --git a/epmet-module/data-report/data-report-client/pom.xml b/epmet-module/data-report/data-report-client/pom.xml new file mode 100644 index 0000000000..f001810eaa --- /dev/null +++ b/epmet-module/data-report/data-report-client/pom.xml @@ -0,0 +1,15 @@ + + + + data-report + com.epmet + 2.0.0 + + 4.0.0 + + data-report-client + + + \ No newline at end of file diff --git a/epmet-module/data-report/data-report-server/Dockerfile b/epmet-module/data-report/data-report-server/Dockerfile new file mode 100644 index 0000000000..1f773a109f --- /dev/null +++ b/epmet-module/data-report/data-report-server/Dockerfile @@ -0,0 +1,11 @@ +FROM java:8 + +RUN export LANG="zh_CN.UTF-8" +RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime +RUN echo 'Asia/Shanghai' > /etc/timezone + +COPY ./target/*.jar ./app.jar + +EXPOSE 8109 + +ENTRYPOINT ["sh", "-c", "$RUN_INSTRUCT"] \ No newline at end of file diff --git a/epmet-module/data-report/data-report-server/deploy/docker-compose-dev.yml b/epmet-module/data-report/data-report-server/deploy/docker-compose-dev.yml new file mode 100644 index 0000000000..f2b8960a42 --- /dev/null +++ b/epmet-module/data-report/data-report-server/deploy/docker-compose-dev.yml @@ -0,0 +1,17 @@ +version: "3.7" +services: + data-report-server: + container_name: data-report-server-dev + image: 192.168.1.130:10080/epmet-cloud-dev/data-report-server:0.3.1 + ports: + - "8109:8109" + network_mode: host # 使用现有网络 + volumes: + - "/opt/epmet-cloud-logs/dev:/logs" + environment: + RUN_INSTRUCT: "java -Xms32m -Xmx200m -jar ./app.jar" + deploy: + resources: + limits: + cpus: '0.1' + memory: 250M \ No newline at end of file diff --git a/epmet-module/data-report/data-report-server/deploy/docker-compose-test.yml b/epmet-module/data-report/data-report-server/deploy/docker-compose-test.yml new file mode 100644 index 0000000000..5181a184da --- /dev/null +++ b/epmet-module/data-report/data-report-server/deploy/docker-compose-test.yml @@ -0,0 +1,17 @@ +version: "3.7" +services: + data-report-server: + container_name: data-report-server-dev + image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-release/data-report-server:0.3.1 + ports: + - "8108:8108" + network_mode: host # 使用现有网络 + volumes: + - "/opt/epmet-cloud-logs/test:/logs" + environment: + RUN_INSTRUCT: "java -Xms32m -Xmx300m -jar ./app.jar" + deploy: + resources: + limits: + cpus: '0.1' + memory: 400M \ No newline at end of file diff --git a/epmet-module/data-report/data-report-server/pom.xml b/epmet-module/data-report/data-report-server/pom.xml new file mode 100644 index 0000000000..b8c65eda08 --- /dev/null +++ b/epmet-module/data-report/data-report-server/pom.xml @@ -0,0 +1,159 @@ + + + + 0.3.1 + data-report-server + + + data-report + com.epmet + 2.0.0 + + 4.0.0 + + + + com.epmet + data-report-client + 2.0.0 + + + com.epmet + epmet-commons-mybatis + 2.0.0 + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework + spring-context-support + + + org.springframework.boot + spring-boot-starter-actuator + + + de.codecentric + spring-boot-admin-starter-client + ${spring.boot.admin.version} + + + com.alibaba.cloud + spring-cloud-starter-alibaba-nacos-discovery + + + com.alibaba.cloud + spring-cloud-starter-alibaba-nacos-config + + + + + com.epmet + epmet-commons-service-call + 0.3.1 + + + + + + ${project.artifactId} + + + org.springframework.boot + spring-boot-maven-plugin + + + org.apache.maven.plugins + maven-surefire-plugin + + true + + + + ${project.basedir}/src/main/java + + + true + ${basedir}/src/main/resources + + + + + + + dev + + true + + + 8109 + dev + + + + + + epmet_data_statistical_user + EpmEt-db-UsEr + + + 0 + 118.190.150.119 + 47379 + 123456 + + + false + 122.152.200.70:8848 + fcd6fc8f-ca3a-4b01-8026-2b05cdc5976b + + + false + + + + false + + + + test + + + 8109 + test + + + + + + epmet + elink@833066 + + + 0 + r-m5eoz5b6tkx09y6bpz.redis.rds.aliyuncs.com + 6379 + EpmEtrEdIs!q@w + + + true + 192.168.10.150:8848 + 67e3c350-533e-4d7c-9f8f-faf1b4aa82ae + + + false + + + + true + + + + + \ No newline at end of file diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/DataReportApplication.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/DataReportApplication.java new file mode 100644 index 0000000000..dced5aa566 --- /dev/null +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/DataReportApplication.java @@ -0,0 +1,11 @@ +package com.epmet; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class DataReportApplication { + public static void main(String[] args) { + SpringApplication.run(DataReportApplication.class, args); + } +} diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/config/ModuleConfigImpl.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/config/ModuleConfigImpl.java new file mode 100644 index 0000000000..c52ec15b50 --- /dev/null +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/config/ModuleConfigImpl.java @@ -0,0 +1,24 @@ +/** + * Copyright (c) 2018 人人开源 All rights reserved. + *

+ * https://www.renren.io + *

+ * 版权所有,侵权必究! + */ + +package com.epmet.config; + +import com.epmet.commons.tools.config.ModuleConfig; +import org.springframework.stereotype.Service; + +/** + * @author Mark sunlightcs@gmail.com + * @since 1.0.0 + */ +@Service +public class ModuleConfigImpl implements ModuleConfig { + @Override + public String getName() { + return "data-report"; + } +} diff --git a/epmet-module/data-report/data-report-server/src/main/resources/bootstrap.yml b/epmet-module/data-report/data-report-server/src/main/resources/bootstrap.yml new file mode 100644 index 0000000000..19e6e4b584 --- /dev/null +++ b/epmet-module/data-report/data-report-server/src/main/resources/bootstrap.yml @@ -0,0 +1,119 @@ +server: + port: @server.port@ + servlet: + context-path: /data/report + +spring: + main: + allow-bean-definition-overriding: true + application: + name: data-report-server + #环境 dev|test|prod + profiles: + active: dev + jackson: + time-zone: GMT+8 + date-format: yyyy-MM-dd HH:mm:ss + redis: + database: @spring.redis.index@ + host: @spring.redis.host@ + port: @spring.redis.port@ + password: @spring.redis.password@ + timeout: 30s + datasource: + druid: + #MySQL + driver-class-name: com.mysql.cj.jdbc.Driver + url: @datasource.druid.url@ + username: @datasource.druid.username@ + password: @datasource.druid.password@ + cloud: + nacos: + discovery: + server-addr: @nacos.server-addr@ + #nacos的命名空间ID,默认是public + namespace: @nacos.discovery.namespace@ + #不把自己注册到注册中心的地址 + register-enabled: @nacos.register-enabled@ + ip: @nacos.ip@ + config: + enabled: @nacos.config-enabled@ + server-addr: @nacos.server-addr@ + namespace: @nacos.config.namespace@ + group: @nacos.config.group@ + file-extension: yaml + #指定共享配置,且支持动态刷新 + # ext-config: + # - data-id: datasource.yaml + # group: ${spring.cloud.nacos.config.group} + # refresh: true + # - data-id: common.yaml + # group: ${spring.cloud.nacos.config.group} + # refresh: true + + # 数据迁移工具flyway + flyway: + enabled: false + locations: classpath:db/migration + url: @datasource.druid.url@ + user: @datasource.druid.username@ + password: @datasource.druid.password@ + baseline-on-migrate: true + baseline-version: 0 + +management: + endpoints: + web: + exposure: + include: "*" + endpoint: + health: + show-details: ALWAYS + +mybatis-plus: + mapper-locations: classpath:/mapper/**/*.xml + #实体扫描,多个package用逗号或者分号分隔 + typeAliasesPackage: com.epmet.entity + global-config: + #数据库相关配置 + db-config: + #主键类型 AUTO:"数据库ID自增", INPUT:"用户输入ID", ID_WORKER:"全局唯一ID (数字类型唯一ID)", UUID:"全局唯一ID UUID"; + id-type: INPUT + #字段策略 IGNORED:"忽略判断",NOT_NULL:"非 NULL 判断"),NOT_EMPTY:"非空判断" + field-strategy: NOT_NULL + #驼峰下划线转换 + column-underline: true + banner: false + #原生配置 + configuration: + map-underscore-to-camel-case: true + cache-enabled: false + call-setters-on-nulls: true + jdbc-type-for-null: 'null' + +feign: + hystrix: + enabled: true + client: + config: + default: + loggerLevel: BASIC + httpclient: + enabled: true + +hystrix: + command: + default: + execution: + isolation: + thread: + timeoutInMilliseconds: 60000 #缺省为1000 + +ribbon: + ReadTimeout: 300000 + ConnectTimeout: 300000 + +#pageHelper分页插件 +pagehelper: + helper-dialect: mysql + reasonable: false #分页合理化配置,例如输入页码为-1,则自动转化为最小页码1 \ No newline at end of file diff --git a/epmet-module/data-report/pom.xml b/epmet-module/data-report/pom.xml new file mode 100644 index 0000000000..d85eb578fd --- /dev/null +++ b/epmet-module/data-report/pom.xml @@ -0,0 +1,20 @@ + + + + epmet-module + com.epmet + 2.0.0 + + 4.0.0 + + data-report + pom + + data-report-client + data-report-server + + + + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/constant/DataSourceConstant.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/constant/DataSourceConstant.java index b972365b19..f79ab899cf 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/constant/DataSourceConstant.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/constant/DataSourceConstant.java @@ -6,5 +6,7 @@ public interface DataSourceConstant { String STATS = "stats"; String GOV_ISSUE = "govIssue"; String GOV_PROJECT = "govProject"; + String GOV_VOICE = "govVoice"; + String OPER_CRM = "operCrm"; } diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/constant/StatsSubject.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/constant/StatsSubject.java new file mode 100644 index 0000000000..4573d9daf8 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/constant/StatsSubject.java @@ -0,0 +1,66 @@ +package com.epmet.constant; + +public interface StatsSubject { + String DIM_AGENCY = "dim_agency"; + String DIM_CUSTOMER = "dim_customer"; + String DIM_DATE = "dim_date"; + String DIM_DEPARTMENT = "dim_department"; + String DIM_GRID = "dim_grid"; + String DIM_MONTH = "dim_month"; + String DIM_QUARTER = "dim_quarter"; + String DIM_TOPIC_STATUS = "dim_topic_status"; + String DIM_WEEK = "dim_week"; + String DIM_YEAR = "dim_year"; + String FACT_AGENCY_PROJECT_DAILY = "fact_agency_project_daily"; + String FACT_AGENCY_PROJECT_MONTHLY = "fact_agency_project_monthly"; + String FACT_ARTICLE_PUBLISHED_AGENCY_DAILY = "fact_article_published_agency_daily"; + String FACT_ARTICLE_PUBLISHED_DEPARTMENT_DAILY = "fact_article_published_department_daily"; + String FACT_ARTICLE_PUBLISHED_GRID_DAILY = "fact_article_published_grid_daily"; + String FACT_GRID_PROJECT_DAILY = "fact_grid_project_daily"; + String FACT_GRID_PROJECT_MONTHLY = "fact_grid_project_monthly"; + String FACT_GROUP_AGENCY_DAILY = "fact_group_agency_daily"; + String FACT_GROUP_AGENCY_MONTHLY = "fact_group_agency_monthly"; + String FACT_GROUP_GRID_DAILY = "fact_group_grid_daily"; + String FACT_ISSUE_AGENCY_DAILY = "fact_issue_agency_daily"; + String FACT_ISSUE_AGENCY_MONTHLY = "fact_issue_agency_monthly"; + String FACT_ISSUE_GRID_DAILY = "fact_issue_grid_daily"; + String FACT_ISSUE_GRID_MONTHLY = "fact_issue_grid_monthly"; + String FACT_PARTICIPATION_USER_AGENCY_DAILY = "fact_participation_user_agency_daily"; + String FACT_PARTICIPATION_USER_AGENCY_MONTHLY = "fact_participation_user_agency_monthly"; + String FACT_PARTICIPATION_USER_GRID_DAILY = "fact_participation_user_grid_daily"; + String FACT_PARTICIPATION_USER_GRID_MONTHLY = "fact_participation_user_grid_monthly"; + String FACT_REG_USER_AGENCY_DAILY = "fact_reg_user_agency_daily"; + String FACT_REG_USER_AGENCY_MONTHLY = "fact_reg_user_agency_monthly"; + String FACT_REG_USER_GRID_DAILY = "fact_reg_user_grid_daily"; + String FACT_REG_USER_GRID_MONTHLY = "fact_reg_user_grid_monthly"; + String FACT_TAG_USED_AGENCY_DAILY = "fact_tag_used_agency_daily"; + String FACT_TAG_USED_AGENCY_MONTHLY = "fact_tag_used_agency_monthly"; + String FACT_TAG_USED_AGENCY_QUARTERLY = "fact_tag_used_agency_quarterly"; + String FACT_TAG_USED_AGENCY_YEARLY = "fact_tag_used_agency_yearly"; + String FACT_TAG_USED_DEPARTMENT_DAILY = "fact_tag_used_department_daily"; + String FACT_TAG_USED_DEPARTMENT_MONTHLY = "fact_tag_used_department_monthly"; + String FACT_TAG_USED_DEPARTMENT_QUARTERLY = "fact_tag_used_department_quarterly"; + String FACT_TAG_USED_DEPARTMENT_YEARLY = "fact_tag_used_department_yearly"; + String FACT_TAG_USED_GRID_DAILY = "fact_tag_used_grid_daily"; + String FACT_TAG_USED_GRID_MONTHLY = "fact_tag_used_grid_monthly"; + String FACT_TAG_USED_GRID_QUARTERLY = "fact_tag_used_grid_quarterly"; + String FACT_TAG_USED_GRID_YEARLY = "fact_tag_used_grid_yearly"; + String FACT_TAG_VIEWED_AGENCY_DAILY = "fact_tag_viewed_agency_daily"; + String FACT_TAG_VIEWED_AGENCY_MONTHLY = "fact_tag_viewed_agency_monthly"; + String FACT_TAG_VIEWED_AGENCY_QUARTERLY = "fact_tag_viewed_agency_quarterly"; + String FACT_TAG_VIEWED_AGENCY_YEARLY = "fact_tag_viewed_agency_yearly"; + String FACT_TAG_VIEWED_GRID_DAILY = "fact_tag_viewed_grid_daily"; + String FACT_TAG_VIEWED_GRID_MONTHLY = "fact_tag_viewed_grid_monthly"; + String FACT_TAG_VIEWED_GRID_QUARTERLY = "fact_tag_viewed_grid_quarterly"; + String FACT_TAG_VIEWED_GRID_YEARLY = "fact_tag_viewed_grid_yearly"; + String FACT_TOPIC_ISSUE_AGENCY_DAILY = "fact_topic_issue_agency_daily"; + String FACT_TOPIC_ISSUE_AGENCY_MONTHLY = "fact_topic_issue_agency_monthly"; + String FACT_TOPIC_ISSUE_GRID_DAILY = "fact_topic_issue_grid_daily"; + String FACT_TOPIC_ISSUE_GRID_MONTHLY = "fact_topic_issue_grid_monthly"; + String FACT_TOPIC_STATUS_AGENCY_DAILY = "fact_topic_status_agency_daily"; + String FACT_TOPIC_STATUS_AGENCY_MONTHLY = "fact_topic_status_agency_monthly"; + String FACT_TOPIC_STATUS_GRID_DAILY = "fact_topic_status_grid_daily"; + String FACT_TOPIC_TOTAL_AGENCY_DAILY = "fact_topic_total_agency_daily"; + String FACT_TOPIC_TOTAL_GRID_DAILY = "fact_topic_total_grid_daily"; + String LAST_EXEC_RECORD = "last_exec_record"; +} diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/ArticleGridPublishedSummaryDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/ArticleGridPublishedSummaryDTO.java new file mode 100644 index 0000000000..138ae7efec --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/ArticleGridPublishedSummaryDTO.java @@ -0,0 +1,38 @@ +package com.epmet.dto.stats; +/** + * @author jianjun liu + * @email liujianjun@yunzongnet.com + * @date 2020-06-17 16:43 + **/ + +import lombok.Data; + +import java.io.Serializable; + +/** + * desc:文章总数 统计返回结果 dto + * + * @author liujianjun + * @date 2020/6/17 16:43 + */ +@Data +public class ArticleGridPublishedSummaryDTO implements Serializable { + private static final long serialVersionUID = 6755654148306711602L; + + /** + * 客户id + */ + private String customerId; + /** + * 网格Id + */ + private String gridId; + /** + * 发布文章总数 + */ + private Integer publishedCount; + /** + * 状态为发布中的文章总数 + */ + private Integer publishingCount; +} diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/DimDateDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/DimDateDTO.java index 75c3bf51f8..e539cda274 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/DimDateDTO.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/DimDateDTO.java @@ -88,4 +88,6 @@ public class DimDateDTO implements Serializable { */ private Date updatedTime; + private String monthId; + } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/FactAgencyProjectDailyDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/FactAgencyProjectDailyDTO.java new file mode 100644 index 0000000000..04ae53b189 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/FactAgencyProjectDailyDTO.java @@ -0,0 +1,177 @@ +/** + * 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.stats; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + +import java.math.BigDecimal; + +/** + * 机关下日项目数据统计 存放机关下截止到当前日期的各项总数据以及昨日新增各项数据,每日定时执行,先删后增 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-06-16 + */ +@Data +public class FactAgencyProjectDailyDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 唯一标识 + */ + private String id; + + /** + * 客户Id 【dim_customer.id】 + */ + private String customerId; + + /** + * 机关Id 【dim_agency.id】 + */ + private String agencyId; + + /** + * 上级组织Id【dim_agency.pid】 + */ + private String parentId; + + /** + * 日维度Id 【dim_date.id】 + */ + private String dateId; + + /** + * 周维度Id 【dim_week.id】 + */ + private String weekId; + + /** + * 月维度Id 【dim_month.id】 + */ + private String monthId; + + /** + * 年维度Id 【dim_year.id】 + */ + private String yearId; + + /** + * 截止当日项目总数 【当前组织及下级项目总数】 + */ + private Integer projectTotal; + + /** + * 截止当日处理中项目数 【当前组织及下级所有未结案项目总数】 + */ + private Integer pendingTotal; + + /** + * 截止当日处理中项目占比 【当前组织及下级未结案项目百分比(存百分比数,小数点后两位)】 + */ + private BigDecimal pendingRatio; + + /** + * 截止当日已结案项目数 【当前组织及下级已结案项目总数】 + */ + private Integer closedTotal; + + /** + * 截止当日已结案项目占比 【当前组织及下级已结案项目百分比(存百分比数,小数点后两位)】 + */ + private BigDecimal closedRatio; + + /** + * 截止当日已结案中已解决项目数 【当前组织及下级已结案项目中已解决总数】 + */ + private Integer resolvedTotal; + + /** + * 截止当日已结案中已解决项目占比 【当前组织及下级已结案项目中已解决占比】 + */ + private BigDecimal resolvedRatio; + + /** + * 截止当日已结案中未解决项目数 【当前组织及下级已结案项目中未解决总数】 + */ + private Integer unresolvedTotal; + + /** + * 截止当日已结案中未解决项目占比 【当前组织及下级已结案项目中未解决占比】 + */ + private BigDecimal unresolvedRatio; + + /** + * 当日项目总数 【当前组织及下级项目总数】 + */ + private Integer projectIncr; + + /** + * 当日处理中项目数 【当前组织及下级前一日新增处理中项目数】 + */ + private Integer pendingIncr; + + /** + * 当日已结案项目数 【当前组织及下级前一日新增结案项目数】 + */ + private Integer closedIncr; + + /** + * 当日已结案项目中已解决数 【当前组织及下级前一日新增结案中已解决项目数】 + */ + private Integer resolvedIncr; + + /** + * 当日已结案项目组未解决数 【当前组织及下级前一日新增结案中未解决项目数】 + */ + private Integer unresolvedIncr; + + /** + * 删除标识 【0.未删除 1.已删除】 + */ + private Integer delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/FactAgencyProjectMonthlyDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/FactAgencyProjectMonthlyDTO.java new file mode 100644 index 0000000000..3c56190036 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/FactAgencyProjectMonthlyDTO.java @@ -0,0 +1,172 @@ +/** + * 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.stats; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + +import java.math.BigDecimal; + +/** + * 机关下月项目数据统计 存放机关下截止到当前月份的各项总数据以及上月新增各项数据,每月月初定时执行,先删后增 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-06-16 + */ +@Data +public class FactAgencyProjectMonthlyDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 唯一标识 + */ + private String id; + + /** + * 客户Id 【dim_customer.id】 + */ + private String customerId; + + /** + * 机关Id 【dim_agency.id】 + */ + private String agencyId; + + /** + * 上级组织Id【dim_agency.pid】 + */ + private String parentId; + + /** + * 月维度Id 【dim_month.id】 + */ + private String monthId; + + /** + * 季维度Id 【dim_quarter.id】 + */ + private String quarterId; + + /** + * 年维度Id 【dim_year.id】 + */ + private String yearId; + + /** + * 截止当月项目总数 【当前组织及下级项目总数】 + */ + private Integer projectTotal; + + /** + * 截止当月处理中项目数 【当前组织及下级所有未结案项目总数】 + */ + private Integer pendingTotal; + + /** + * 截止当月处理中项目占比 【当前组织及下级未结案项目百分比(存百分比数,小数点后两位)】 + */ + private BigDecimal pendingRatio; + + /** + * 截止当月已结案项目数 【当前组织及下级已结案项目总数】 + */ + private Integer closedTotal; + + /** + * 截止当月已结案项目占比 【当前组织及下级已结案项目百分比(存百分比数,小数点后两位)】 + */ + private BigDecimal closedRatio; + + /** + * 截止当月已结案中已解决项目数 【当前组织及下级已结案项目中已解决总数】 + */ + private Integer resolvedTotal; + + /** + * 截止当月已结案中已解决项目占比 【当前组织及下级已结案项目中已解决占比】 + */ + private BigDecimal resolvedRatio; + + /** + * 截止当月已结案中未解决项目数 【当前组织及下级已结案项目中未解决总数】 + */ + private Integer unresolvedTotal; + + /** + * 截止当月已结案中未解决项目占比 【当前组织及下级已结案项目中未解决占比】 + */ + private BigDecimal unresolvedRatio; + + /** + * 当月项目总数 【当前组织及下级前一月新增项目数】 + */ + private Integer projectIncr; + + /** + * 当月处理中项目数 【当前组织及下级前一月新增处理中项目数】 + */ + private Integer pendingIncr; + + /** + * 当月已结案项目数 【当前组织及下级前一月新增结案项目数】 + */ + private Integer closedIncr; + + /** + * 当月已结案项目中已解决数 【当前组织及下级前一日新增结案中已解决项目数】 + */ + private Integer resolvedIncr; + + /** + * 当月已结案项目组未解决数 【当前组织及下级前一日新增结案中未解决项目数】 + */ + private Integer unresolvedIncr; + + /** + * 删除标识 【0.未删除 1.已删除】 + */ + private Integer delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/FactGridProjectDailyDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/FactGridProjectDailyDTO.java new file mode 100644 index 0000000000..eb25380fb9 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/FactGridProjectDailyDTO.java @@ -0,0 +1,172 @@ +/** + * 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.stats; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + +import java.math.BigDecimal; + +/** + * 网格下日项目数据统计表 存放机关下截止到当前日期的各项总数据以及昨日新增各项数据,每日定时执行,先删后增 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-06-16 + */ +@Data +public class FactGridProjectDailyDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 唯一标识 + */ + private String id; + + /** + * 客户Id 【dim_customer.id】 + */ + private String customerId; + + /** + * 机关Id 【dim_agency.id】 + */ + private String agencyId; + + /** + * 网格Id 【dim_grid.id】 + */ + private String gridId; + + /** + * 日维度Id 【dim_date.id】 + */ + private String dateId; + + /** + * 周维度Id 【dim_week.id】 + */ + private String weekId; + + /** + * 月维度Id 【dim_month.id】 + */ + private String monthId; + + /** + * 截止当日网格下项目总数 【当前组织及下级项目总数】 + */ + private Integer projectTotal; + + /** + * 截止当日网格下处理中项目数 【当前组织及下级所有未结案项目总数】 + */ + private Integer pendingTotal; + + /** + * 截止当日网格下处理中项目占比 【当前组织及下级未结案项目百分比(存百分比数,小数点后两位)】 + */ + private BigDecimal pendingRatio; + + /** + * 截止当日网格下已结案项目数 【当前组织及下级已结案项目总数】 + */ + private Integer closedTotal; + + /** + * 截止当日网格下已结案项目占比 【当前组织及下级已结案项目百分比(存百分比数,小数点后两位)】 + */ + private BigDecimal closedRatio; + + /** + * 截止当日已结案中已解决项目数 【当前组织及下级已结案项目中已解决总数】 + */ + private Integer resolvedTotal; + + /** + * 截止当日已结案中已解决项目占比 【当前组织及下级已结案项目中已解决占比】 + */ + private BigDecimal resolvedRatio; + + /** + * 截止当日已结案中未解决项目数 【当前组织及下级已结案项目中未解决总数】 + */ + private Integer unresolvedTotal; + + /** + * 截止当日已结案中未解决项目占比 【当前组织及下级已结案项目中未解决占比】 + */ + private BigDecimal unresolvedRatio; + + /** + * 当日已结案项目中已解决数 【当前组织及下级前一日新增结案中已解决项目数】 + */ + private Integer resolvedIncr; + + /** + * 当日已结案项目组未解决数 【当前组织及下级前一日新增结案中未解决项目数】 + */ + private Integer unresolvedIncr; + + /** + * 当日网格下项目总数 【该网格下项目总数】 + */ + private Integer gridIncr; + + /** + * 当日网格下处理中项目数 【该网格下未结案项目总数】 + */ + private Integer pendingIncr; + + /** + * 当日网格下已结案项目数 【该网格下已结案项目总数】 + */ + private String closedIncr; + + /** + * 删除标识 【0.未删除 1.已删除】 + */ + private Integer delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/FactGridProjectMonthlyDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/FactGridProjectMonthlyDTO.java new file mode 100644 index 0000000000..277e87e27e --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/FactGridProjectMonthlyDTO.java @@ -0,0 +1,172 @@ +/** + * 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.stats; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + +import java.math.BigDecimal; + +/** + * 网格下月项目数据统计表 存放机关下截止到当前月份的各项总数据以及上月新增各项数据,每月月初定时执行,先删后增 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-06-16 + */ +@Data +public class FactGridProjectMonthlyDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 唯一标识 + */ + private String id; + + /** + * 客户Id 【dim_customer.id】 + */ + private String customerId; + + /** + * 机关Id 【dim_agency.id】 + */ + private String agencyId; + + /** + * 网格Id 【dim_grid.id】 + */ + private String gridId; + + /** + * 月维度Id 【dim_month.id】 + */ + private String monthId; + + /** + * 季维度Id 【dim_quarter.id】 + */ + private String quarterId; + + /** + * 年维度Id 【dim_year.id】 + */ + private String yearId; + + /** + * 截止当月项目总数 【当前组织及下级项目总数】 + */ + private Integer projectTotal; + + /** + * 截止当月处理中项目数 【当前组织及下级所有未结案项目总数】 + */ + private Integer pendingTotal; + + /** + * 截止当月处理中项目占比 【当前组织及下级未结案项目百分比(存百分比数,小数点后两位)】 + */ + private BigDecimal pendingRatio; + + /** + * 截止当月已结案项目数 【当前组织及下级已结案项目总数】 + */ + private Integer closedTotal; + + /** + * 截止当月已结案项目占比 【当前组织及下级已结案项目百分比(存百分比数,小数点后两位)】 + */ + private BigDecimal closedRatio; + + /** + * 截止当月已结案中已解决项目数 【当前组织及下级已结案项目中已解决总数】 + */ + private Integer resolvedTotal; + + /** + * 截止当月已结案中已解决项目占比 【当前组织及下级已结案项目中已解决占比】 + */ + private BigDecimal resolvedRatio; + + /** + * 截止当月已结案中未解决项目数 【当前组织及下级已结案项目中未解决总数】 + */ + private Integer unresolvedTotal; + + /** + * 截止当月已结案中未解决项目占比 【当前组织及下级已结案项目中未解决占比】 + */ + private BigDecimal unresolvedRatio; + + /** + * 当月项目总数 【当前组织及下级前一月新增项目数】 + */ + private Integer projectIncr; + + /** + * 当月处理中项目数 【当前组织及下级前一月新增处理中项目数】 + */ + private Integer pendingIncr; + + /** + * 当月已结案项目数 【当前组织及下级前一月新增结案项目数】 + */ + private Integer closedIncr; + + /** + * 当月已结案项目中已解决数 【当前组织及下级前一日新增结案中已解决项目数】 + */ + private Integer resolvedIncr; + + /** + * 当月已结案项目组未解决数 【当前组织及下级前一日新增结案中未解决项目数】 + */ + private Integer unresolvedIncr; + + /** + * 删除标识 【0.未删除 1.已删除】 + */ + private Integer delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/Dockerfile b/epmet-module/data-statistical/data-statistical-server/Dockerfile new file mode 100644 index 0000000000..e592acbf38 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/Dockerfile @@ -0,0 +1,11 @@ +FROM java:8 + +RUN export LANG="zh_CN.UTF-8" +RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime +RUN echo 'Asia/Shanghai' > /etc/timezone + +COPY ./target/*.jar ./app.jar + +EXPOSE 8108 + +ENTRYPOINT ["sh", "-c", "$RUN_INSTRUCT"] \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/deploy/docker-compose-dev.yml b/epmet-module/data-statistical/data-statistical-server/deploy/docker-compose-dev.yml new file mode 100644 index 0000000000..de1ff9baa5 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/deploy/docker-compose-dev.yml @@ -0,0 +1,17 @@ +version: "3.7" +services: + data-statistical-server: + container_name: data-statistical-server-dev + image: 192.168.1.130:10080/epmet-cloud-dev/data-statistical-server:0.3.1 + ports: + - "8108:8108" + network_mode: host # 使用现有网络 + volumes: + - "/opt/epmet-cloud-logs/dev:/logs" + environment: + RUN_INSTRUCT: "java -Xms32m -Xmx200m -jar ./app.jar" + deploy: + resources: + limits: + cpus: '0.1' + memory: 250M \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/deploy/docker-compose-test.yml b/epmet-module/data-statistical/data-statistical-server/deploy/docker-compose-test.yml new file mode 100644 index 0000000000..7d80790041 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/deploy/docker-compose-test.yml @@ -0,0 +1,17 @@ +version: "3.7" +services: + data-statistical-server: + container_name: data-statistical-server-dev + image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-release/data-statistical-server:0.3.1 + ports: + - "8108:8108" + network_mode: host # 使用现有网络 + volumes: + - "/opt/epmet-cloud-logs/test:/logs" + environment: + RUN_INSTRUCT: "java -Xms32m -Xmx300m -jar ./app.jar" + deploy: + resources: + limits: + cpus: '0.1' + memory: 400M \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/pom.xml b/epmet-module/data-statistical/data-statistical-server/pom.xml index 90a95b59f0..dcd55b9ad9 100644 --- a/epmet-module/data-statistical/data-statistical-server/pom.xml +++ b/epmet-module/data-statistical/data-statistical-server/pom.xml @@ -2,6 +2,7 @@ + 0.3.1 data-statistical com.epmet @@ -122,6 +123,18 @@ epmet_gov_project_user EpmEt-db-UsEr + + + + epmet_gov_voice_user + EpmEt-db-UsEr + + + + + epmet_oper_crm_user + EpmEt-db-UsEr + 0 192.168.1.130 @@ -138,6 +151,12 @@ false + + + 5 + 8 + 10 + 30 @@ -151,10 +170,10 @@ - + - epmet - elink@833066 + epmet + elink@833066 @@ -174,6 +193,18 @@ epmet_gov_project_user EpmEt-db-UsEr + + + + epmet + elink@8473066 + + + + + epmet + elink@8473066 + 0 r-m5eoz5b6tkx09y6bpz.redis.rds.aliyuncs.com @@ -190,6 +221,12 @@ true + + + 5 + 8 + 10 + 30 diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/config/AsyncConfig.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/config/AsyncConfig.java new file mode 100644 index 0000000000..ba50e40a30 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/config/AsyncConfig.java @@ -0,0 +1,49 @@ +package com.epmet.config; + +import com.epmet.properties.ThreadProperties; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.context.properties.EnableConfigurationProperties; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.scheduling.annotation.EnableAsync; +import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; + +import java.util.concurrent.Executor; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.ThreadPoolExecutor; + +/** + * 线程池配置类 + */ +@Configuration +@EnableConfigurationProperties(ThreadProperties.class) +@EnableAsync +public class AsyncConfig { + + @Autowired + private ThreadProperties threadProperties; + + @Bean + public Executor executor() { + ThreadProperties.ThreadPoolProperties threadPoolProps = threadProperties.getThreadPool(); + + ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor(); + executor.setCorePoolSize(threadPoolProps.getCorePoolSize()); + executor.setMaxPoolSize(threadPoolProps.getMaxPoolSize()); + executor.setQueueCapacity(threadPoolProps.getQueueCapacity()); + executor.setThreadNamePrefix("data-stats-"); + // rejection-policy:当pool已经达到max size的时候,如何处理新任务 + // CALLER_RUNS:不在新线程中执行任务,而是由调用者所在的线程来执行 + executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy()); //对拒绝task的处理策略 + executor.setKeepAliveSeconds(threadPoolProps.getKeepAlive()); + executor.initialize(); + return executor; + } + + @Bean + public ExecutorService executorService() { + ThreadPoolTaskExecutor executor = (ThreadPoolTaskExecutor) executor(); + return executor.getThreadPoolExecutor(); + } + +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/config/ModuleConfigImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/config/ModuleConfigImpl.java index 5dfeb091b3..be1b632462 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/config/ModuleConfigImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/config/ModuleConfigImpl.java @@ -19,6 +19,6 @@ import org.springframework.stereotype.Service; public class ModuleConfigImpl implements ModuleConfig { @Override public String getName() { - return "data-stats"; + return "data-statistical"; } } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java index 69cdd8776f..85dcc1ae04 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java @@ -7,6 +7,11 @@ import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; +import java.time.LocalDateTime; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Future; + import java.util.List; @RequestMapping("demo") @@ -16,6 +21,9 @@ public class DemoController { @Autowired private StatsDemoService demoService; + @Autowired + private ExecutorService executorService; + @GetMapping("testlist") public void testList() { demoService.testList(); @@ -26,11 +34,58 @@ public class DemoController { demoService.testTx(); } + /** + * 异步方式1,手动submit + */ + @GetMapping("testthreadpool") + public void testThreadPool() { + System.out.println(LocalDateTime.now().getSecond());; + System.out.println("----------->>"); + Future future1 = executorService.submit(() -> demoService.testThreadPool()); + + Future future2 = executorService.submit(() -> demoService.testThreadPool()); + + Future future3 = executorService.submit(() -> demoService.testThreadPool()); + + try { + // 可以获取返回值,此处会阻塞 + Boolean o1 = future1.get(); + System.out.println(LocalDateTime.now().getSecond()); + + + + Boolean o2 = future2.get(); + System.out.println(LocalDateTime.now().getSecond()); + + Boolean o3 = future3.get(); + System.out.println(LocalDateTime.now().getSecond()); + + System.out.println("<<-----------"); + } catch (InterruptedException e) { + e.printStackTrace(); + } catch (ExecutionException e) { + e.printStackTrace(); + } + } + + /** + * 异步方式2,service方法中加注解@Async + */ + @GetMapping("testthreadpoolasyncs") + public void testThreadPoolAsync() { + System.out.println(LocalDateTime.now().getSecond()); + System.out.println("----------->>"); + + demoService.testThreadPoolAsync(); + demoService.testThreadPoolAsync(); + demoService.testThreadPoolAsync(); + demoService.testThreadPoolAsync(); + demoService.testThreadPoolAsync(); + } + @GetMapping("cascadegencyinfo") public List selectAllAgency(){ List result = demoService.getAllAgency(); return result; } - - } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DimController.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DimController.java new file mode 100644 index 0000000000..c393a74bb3 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DimController.java @@ -0,0 +1,86 @@ +package com.epmet.controller; + +import com.epmet.commons.tools.utils.Result; +import com.epmet.service.StatsDimService; +import com.epmet.service.stats.DimDateService; +import com.epmet.service.stats.DimMonthService; +import oracle.jdbc.proxy.annotation.Post; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +@RestController +@RequestMapping("dim") +public class DimController { + + @Autowired + private DimDateService dimDateService; + + @Autowired + private DimMonthService dimMonthService; + + @Autowired + private StatsDimService statsDimService; + + /** + * 初始化按日维度 + * @return + */ + @PostMapping("/date/init") + public Result initDateDim() { + dimDateService.initDimDate(); + return new Result(); + } + + /** + * 初始化网格维度 + * @return + */ + @PostMapping("/grid/init") + public Result initGridDim() { + statsDimService.initGridDim(); + return new Result(); + } + + /** + * 初始化机关单位维度 + * @return + */ + @PostMapping("/agency/init") + public Result intiAgencyDim() { + statsDimService.initAgencyDim(); + return new Result(); + } + + /** + * 客户维度 + * @return + */ + @PostMapping("/customer/init") + public Result intiCustomerDim() { + statsDimService.initCustomerDim(); + return new Result(); + } + + /** + * 部门维度 + * @return + */ + @PostMapping("/department/init") + public Result intiDepartmentDim() { + statsDimService.initDepartmentDim(); + return new Result(); + } + + /** + * 月维度 + * @return + */ + @PostMapping("/month/init") + public Result initMonthDim() { + dimMonthService.initMonthDim(); + return new Result(); + } + +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/PublicityController.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/PublicityController.java new file mode 100644 index 0000000000..a8860b0cff --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/PublicityController.java @@ -0,0 +1,29 @@ +package com.epmet.controller; + +import com.epmet.commons.tools.utils.Result; +import com.epmet.service.StatsDemoService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.concurrent.ExecutorService; + +/** + * desc:宣传能力controller + */ +@RequestMapping("publicity") +@RestController +public class PublicityController { + + @Autowired + private StatsDemoService demoService; + + @Autowired + private ExecutorService executorService; + + @PostMapping(value = "publicitySummaryStatsjob") + public Result publicitySummaryStatsjob(){ + return null; + } +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/StatsProjectController.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/StatsProjectController.java index 2c9f83f70a..6c7c907c15 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/StatsProjectController.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/StatsProjectController.java @@ -1,23 +1,32 @@ package com.epmet.controller; +import com.epmet.commons.tools.utils.Result; import com.epmet.service.StatsDemoService; import com.epmet.service.StatsProjectService; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; /** * 数据统计-项目 * @author sun */ -@RequestMapping("statsProject") +@RequestMapping("statsproject") @RestController public class StatsProjectController { @Autowired private StatsProjectService statsProjectService; - + /** + * @param customerId + * @return + * @Author sun + * @Description 数据-项目-机关日(月)统计 + **/ + @PostMapping("agencyproject/{customerId}") + public Result statsAgencyProject(@PathVariable("customerId") String customerId) { + statsProjectService.statsAgencyProject(customerId); + return new Result(); + } } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/crm/CustomerDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/crm/CustomerDao.java new file mode 100644 index 0000000000..bfe699c25e --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/crm/CustomerDao.java @@ -0,0 +1,46 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dao.crm; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.entity.crm.CustomerEntity; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.Date; +import java.util.List; + +/** + * 客户表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-03-11 + */ +@Mapper +public interface CustomerDao extends BaseDao { + + /** + * 根据创建时间起止查询有效客户列表 + * @param createTimeFrom + * @param createTimeTo + * @return + */ + List listValidCustomersByCreateTime( + @Param("createTimeFrom") Date createTimeFrom, + @Param("createTimeTo") Date createTimeTo); +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/org/CustomerDepartmentDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/org/CustomerDepartmentDao.java new file mode 100644 index 0000000000..2b9b4705ab --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/org/CustomerDepartmentDao.java @@ -0,0 +1,41 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dao.org; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.entity.org.CustomerDepartmentEntity; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.Date; +import java.util.List; + +/** + * 客户部门表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-04-20 + */ +@Mapper +public interface CustomerDepartmentDao extends BaseDao { + + List listDepartmentsByCreatedTime( + @Param("createdTimeFrom") Date createdTimeFrom, + @Param("createdTimeTo") Date createdTimeTo); + +} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/org/CustomerGridDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/org/CustomerGridDao.java new file mode 100644 index 0000000000..ee1547a190 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/org/CustomerGridDao.java @@ -0,0 +1,44 @@ +/** + * 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.org; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.entity.org.CustomerGridEntity; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.Date; +import java.util.List; + +/** + * 客户网格表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-03-16 + */ +@Mapper +public interface CustomerGridDao extends BaseDao { + + /** + * 根据创建时间,截取时间段内的网格 + * @param start + * @param end + * @return + */ + List listGridsByCreateTime(@Param("start") Date start, @Param("end") Date end); +} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/org/StatsCustomerAgencyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/org/StatsCustomerAgencyDao.java index ef6ab4005d..b3de9cfd02 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/org/StatsCustomerAgencyDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/org/StatsCustomerAgencyDao.java @@ -6,6 +6,7 @@ import com.epmet.entity.org.CustomerAgencyEntity; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; +import java.util.Date; import java.util.List; @Mapper @@ -13,6 +14,9 @@ public interface StatsCustomerAgencyDao extends BaseDao { List listAllEntities(); + List listAgenciesByCreateTime( + @Param("statsStartTime") Date statsStartTime, + @Param("statsEndTime") Date statsEndTime); List selectAllAgency(); List selectSubAgencyByPid(@Param("pid")String pid); diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/DimAgencyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/DimAgencyDao.java index a451b9e19f..9ead9c7114 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/DimAgencyDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/DimAgencyDao.java @@ -19,9 +19,12 @@ package com.epmet.dao.stats; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.stats.DimAgencyDTO; import com.epmet.entity.stats.DimAgencyEntity; import org.apache.ibatis.annotations.Mapper; +import java.util.List; + /** * 机关维度 * @@ -30,5 +33,12 @@ import org.apache.ibatis.annotations.Mapper; */ @Mapper public interface DimAgencyDao extends BaseDao { - + + /** + * @param dto + * @return + * @Author sun + * @Description 根据客户Id查询机关维度列表数据 + **/ + List selectDimAgencyList(DimAgencyDTO dto); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/DimCustomerDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/DimCustomerDao.java index 5a8a5351ce..66ea22ad59 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/DimCustomerDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/DimCustomerDao.java @@ -21,6 +21,8 @@ import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.entity.stats.DimCustomerEntity; import org.apache.ibatis.annotations.Mapper; +import java.util.List; + /** * 客户维度 * @@ -29,5 +31,16 @@ import org.apache.ibatis.annotations.Mapper; */ @Mapper public interface DimCustomerDao extends BaseDao { - + + /** + * desc: 分页获取客户id + * + * @param pageNo + * @param offset + * return: List + * @date: 2020/6/17 16:33 + * @author: jianjun liu + * email:liujianjun@git.elinkit.com.cn + */ + List selectCustomerIdPage(Integer pageNo, int offset); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/DimDateDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/DimDateDao.java index f07e5fab41..3a1436cbcc 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/DimDateDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/DimDateDao.java @@ -18,9 +18,12 @@ package com.epmet.dao.stats; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.stats.DimDateDTO; import com.epmet.entity.stats.DimDateEntity; import org.apache.ibatis.annotations.Mapper; +import java.util.List; + /** * 日期维度表 * @@ -29,5 +32,19 @@ import org.apache.ibatis.annotations.Mapper; */ @Mapper public interface DimDateDao extends BaseDao { - + + /** + * @param dto + * @return + * @Author sun + * @Description 根据创建时间查询日维度信息 + **/ + List selectDimDate(DimDateDTO dto); + + /** + * 最新的按日维度 + */ + DimDateDTO getLatestDimDate(); + + int insertOne(DimDateEntity dimDateEntity); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/DimGridDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/DimGridDao.java index 4a8129f98e..a2d36e2481 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/DimGridDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/DimGridDao.java @@ -18,9 +18,13 @@ package com.epmet.dao.stats; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.entity.org.CustomerGridEntity; import com.epmet.entity.stats.DimGridEntity; import org.apache.ibatis.annotations.Mapper; +import java.util.Date; +import java.util.List; + /** * 客户网格维度 * @@ -29,5 +33,7 @@ import org.apache.ibatis.annotations.Mapper; */ @Mapper public interface DimGridDao extends BaseDao { - + + DimGridEntity getLastCreatedGridDimEntity(); + } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/FactAgencyProjectDailyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/FactAgencyProjectDailyDao.java new file mode 100644 index 0000000000..6e961d85c9 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/FactAgencyProjectDailyDao.java @@ -0,0 +1,33 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dao.stats; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.entity.stats.FactAgencyProjectDailyEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 机关下日项目数据统计 存放机关下截止到当前日期的各项总数据以及昨日新增各项数据 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-06-16 + */ +@Mapper +public interface FactAgencyProjectDailyDao extends BaseDao { + +} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/FactAgencyProjectMonthlyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/FactAgencyProjectMonthlyDao.java new file mode 100644 index 0000000000..6cd1e39250 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/FactAgencyProjectMonthlyDao.java @@ -0,0 +1,33 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dao.stats; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.entity.stats.FactAgencyProjectMonthlyEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 机关下月项目数据统计 存放机关下截止到当前月份的各项总数据以及上月新增各项数据 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-06-16 + */ +@Mapper +public interface FactAgencyProjectMonthlyDao extends BaseDao { + +} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/FactGridProjectDailyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/FactGridProjectDailyDao.java new file mode 100644 index 0000000000..bc4602ff38 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/FactGridProjectDailyDao.java @@ -0,0 +1,33 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dao.stats; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.entity.stats.FactGridProjectDailyEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 网格下日项目数据统计表 存放机关下截止到当前日期的各项总数据以及昨日新增各项数据 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-06-16 + */ +@Mapper +public interface FactGridProjectDailyDao extends BaseDao { + +} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/FactGridProjectMonthlyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/FactGridProjectMonthlyDao.java new file mode 100644 index 0000000000..ea7b4c0353 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/FactGridProjectMonthlyDao.java @@ -0,0 +1,33 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dao.stats; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.entity.stats.FactGridProjectMonthlyEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 网格下月项目数据统计表 存放机关下截止到当前月份的各项总数据以及上月新增各项数据 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-06-16 + */ +@Mapper +public interface FactGridProjectMonthlyDao extends BaseDao { + +} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/LastExecRecordDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/LastExecRecordDao.java new file mode 100755 index 0000000000..b90c6c6856 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/LastExecRecordDao.java @@ -0,0 +1,35 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dao.stats; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.entity.stats.LastExecRecordEntity; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +/** + * 最后一次执行记录表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-06-17 + */ +@Mapper +public interface LastExecRecordDao extends BaseDao { + + LastExecRecordEntity getLastExecRecord(@Param("statsSubject") String statsSubject); +} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/voice/ArticleDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/voice/ArticleDao.java new file mode 100644 index 0000000000..4609722502 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/voice/ArticleDao.java @@ -0,0 +1,33 @@ +/** + * 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.voice; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.entity.voice.ArticleEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 文章表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-06-17 + */ +@Mapper +public interface ArticleDao extends BaseDao { + +} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/voice/ArticlePublishRangeDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/voice/ArticlePublishRangeDao.java new file mode 100644 index 0000000000..13b47c66b5 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/voice/ArticlePublishRangeDao.java @@ -0,0 +1,46 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dao.voice; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.stats.ArticleGridPublishedSummaryDTO; +import com.epmet.entity.voice.ArticlePublishRangeEntity; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.Date; +import java.util.List; + +/** + * 文章发布范围表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-06-17 + */ +@Mapper +public interface ArticlePublishRangeDao extends BaseDao { + + /** + * desc:查询网格发布文章总数及状态为发布中的文章总数 + * + * @param customerId + * @param createDate + * @return + */ + List selectByCreatedDate(@Param("customerId") String customerId, @Param("createDate") Date createDate); +} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/crm/CustomerEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/crm/CustomerEntity.java new file mode 100644 index 0000000000..a2fa408a43 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/crm/CustomerEntity.java @@ -0,0 +1,91 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.entity.crm; + +import com.baomidou.mybatisplus.annotation.TableName; + +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; + +/** + * 客户表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-03-11 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("customer") +public class CustomerEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户名称 + */ + private String customerName; + + /** + * 产品标题 显示在产品顶端的标题 + */ + private String title; + + /** + * 组织机构代码 + */ + private String organizationNumber; + + /** + * 组织机构代码证图片 + */ + private String organizationImg; + + /** + * 有效期 + */ + private Date validityTime; + + /** + * 客户管理员 + */ + private String customerAdmin; + + /** + * 密码 加密存储 + */ + private String customerPassword; + + /** + * 客户组织级别:机关级别 + * (社区级:community, + * 乡(镇、街道)级:street, + * 区县级: district, + * 市级: city + * 省级:province) 机关级别(社区级:community,乡(镇、街道)级:street,区县级: district,市级: city省级:province) + */ + private String organizationLevel; + + /** + * 客户logo + */ + private String logo; + +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/org/CustomerDepartmentEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/org/CustomerDepartmentEntity.java new file mode 100644 index 0000000000..0f46e25ffd --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/org/CustomerDepartmentEntity.java @@ -0,0 +1,63 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.entity.org; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 客户部门表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-04-20 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("customer_department") +public class CustomerDepartmentEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户ID + */ + private String customerId; + + /** + * 所属组织机构ID(customer_agency.id) + */ + private String agencyId; + + /** + * 部门名称 + */ + private String departmentName; + + /** + * 部门职责 + */ + private String departmentDuty; + + /** + * 总人数 + */ + private Integer totalUser; + +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/org/CustomerGridEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/org/CustomerGridEntity.java new file mode 100644 index 0000000000..6c01df7df8 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/org/CustomerGridEntity.java @@ -0,0 +1,82 @@ +/** + * 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.org; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 客户网格表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-03-16 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("customer_grid") +public class CustomerGridEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户ID + */ + private String customerId; + + /** + * 网格名称 + */ + private String gridName; + + /** + * 中心位置经度 + */ + private String longitude; + + /** + * 中心位置纬度 + */ + private String latitude; + + /** + * 所属地区码(所属组织地区码) + */ + private String areaCode; + + /** + * 管辖区域 + */ + private String manageDistrict; + + /** + * 当前网格总人数 + */ + private Integer totalUser; + + /** + * 所属组织机构ID(customer_organization.id) + */ + private String pid; + + /** + * 所有上级组织ID + */ + private String pids; +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/stats/DimDateEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/stats/DimDateEntity.java index 8b919277a1..8048c15070 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/stats/DimDateEntity.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/stats/DimDateEntity.java @@ -58,4 +58,6 @@ public class DimDateEntity extends BaseEpmetEntity { */ private String weekId; + private String monthId; + } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/stats/FactAgencyProjectDailyEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/stats/FactAgencyProjectDailyEntity.java new file mode 100644 index 0000000000..2fbb30284a --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/stats/FactAgencyProjectDailyEntity.java @@ -0,0 +1,147 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.entity.stats; + +import com.baomidou.mybatisplus.annotation.TableName; + +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.math.BigDecimal; +import java.util.Date; + +/** + * 机关下日项目数据统计 存放机关下截止到当前日期的各项总数据以及昨日新增各项数据 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-06-16 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("fact_agency_project_daily") +public class FactAgencyProjectDailyEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户Id 【dim_customer.id】 + */ + private String customerId; + + /** + * 机关Id 【dim_agency.id】 + */ + private String agencyId; + + /** + * 上级组织Id【dim_agency.pid】 + */ + private String parentId; + + /** + * 日维度Id 【dim_date.id】 + */ + private String dateId; + + /** + * 周维度Id 【dim_week.id】 + */ + private String weekId; + + /** + * 月维度Id 【dim_month.id】 + */ + private String monthId; + + /** + * 年维度Id 【dim_year.id】 + */ + private String yearId; + + /** + * 截止当日项目总数 【当前组织及下级项目总数】 + */ + private Integer projectTotal; + + /** + * 截止当日处理中项目数 【当前组织及下级所有未结案项目总数】 + */ + private Integer pendingTotal; + + /** + * 截止当日处理中项目占比 【当前组织及下级未结案项目百分比(存百分比数,小数点后两位)】 + */ + private BigDecimal pendingRatio; + + /** + * 截止当日已结案项目数 【当前组织及下级已结案项目总数】 + */ + private Integer closedTotal; + + /** + * 截止当日已结案项目占比 【当前组织及下级已结案项目百分比(存百分比数,小数点后两位)】 + */ + private BigDecimal closedRatio; + + /** + * 截止当日已结案中已解决项目数 【当前组织及下级已结案项目中已解决总数】 + */ + private Integer resolvedTotal; + + /** + * 截止当日已结案中已解决项目占比 【当前组织及下级已结案项目中已解决占比】 + */ + private BigDecimal resolvedRatio; + + /** + * 截止当日已结案中未解决项目数 【当前组织及下级已结案项目中未解决总数】 + */ + private Integer unresolvedTotal; + + /** + * 截止当日已结案中未解决项目占比 【当前组织及下级已结案项目中未解决占比】 + */ + private BigDecimal unresolvedRatio; + + /** + * 当日项目总数 【当前组织及下级项目总数】 + */ + private Integer projectIncr; + + /** + * 当日处理中项目数 【当前组织及下级前一日新增处理中项目数】 + */ + private Integer pendingIncr; + + /** + * 当日已结案项目数 【当前组织及下级前一日新增结案项目数】 + */ + private Integer closedIncr; + + /** + * 当日已结案项目中已解决数 【当前组织及下级前一日新增结案中已解决项目数】 + */ + private Integer resolvedIncr; + + /** + * 当日已结案项目组未解决数 【当前组织及下级前一日新增结案中未解决项目数】 + */ + private Integer unresolvedIncr; + +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/stats/FactAgencyProjectMonthlyEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/stats/FactAgencyProjectMonthlyEntity.java new file mode 100644 index 0000000000..8b147a3f18 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/stats/FactAgencyProjectMonthlyEntity.java @@ -0,0 +1,142 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.entity.stats; + +import com.baomidou.mybatisplus.annotation.TableName; + +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.math.BigDecimal; +import java.util.Date; + +/** + * 机关下月项目数据统计 存放机关下截止到当前月份的各项总数据以及上月新增各项数据 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-06-16 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("fact_agency_project_monthly") +public class FactAgencyProjectMonthlyEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户Id 【dim_customer.id】 + */ + private String customerId; + + /** + * 机关Id 【dim_agency.id】 + */ + private String agencyId; + + /** + * 上级组织Id【dim_agency.pid】 + */ + private String parentId; + + /** + * 月维度Id 【dim_month.id】 + */ + private String monthId; + + /** + * 季维度Id 【dim_quarter.id】 + */ + private String quarterId; + + /** + * 年维度Id 【dim_year.id】 + */ + private String yearId; + + /** + * 截止当月项目总数 【当前组织及下级项目总数】 + */ + private Integer projectTotal; + + /** + * 截止当月处理中项目数 【当前组织及下级所有未结案项目总数】 + */ + private Integer pendingTotal; + + /** + * 截止当月处理中项目占比 【当前组织及下级未结案项目百分比(存百分比数,小数点后两位)】 + */ + private BigDecimal pendingRatio; + + /** + * 截止当月已结案项目数 【当前组织及下级已结案项目总数】 + */ + private Integer closedTotal; + + /** + * 截止当月已结案项目占比 【当前组织及下级已结案项目百分比(存百分比数,小数点后两位)】 + */ + private BigDecimal closedRatio; + + /** + * 截止当月已结案中已解决项目数 【当前组织及下级已结案项目中已解决总数】 + */ + private Integer resolvedTotal; + + /** + * 截止当月已结案中已解决项目占比 【当前组织及下级已结案项目中已解决占比】 + */ + private BigDecimal resolvedRatio; + + /** + * 截止当月已结案中未解决项目数 【当前组织及下级已结案项目中未解决总数】 + */ + private Integer unresolvedTotal; + + /** + * 截止当月已结案中未解决项目占比 【当前组织及下级已结案项目中未解决占比】 + */ + private BigDecimal unresolvedRatio; + + /** + * 当月项目总数 【当前组织及下级前一月新增项目数】 + */ + private Integer projectIncr; + + /** + * 当月处理中项目数 【当前组织及下级前一月新增处理中项目数】 + */ + private Integer pendingIncr; + + /** + * 当月已结案项目数 【当前组织及下级前一月新增结案项目数】 + */ + private Integer closedIncr; + + /** + * 当月已结案项目中已解决数 【当前组织及下级前一日新增结案中已解决项目数】 + */ + private Integer resolvedIncr; + + /** + * 当月已结案项目组未解决数 【当前组织及下级前一日新增结案中未解决项目数】 + */ + private Integer unresolvedIncr; + +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/stats/FactGridProjectDailyEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/stats/FactGridProjectDailyEntity.java new file mode 100644 index 0000000000..509217111d --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/stats/FactGridProjectDailyEntity.java @@ -0,0 +1,142 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.entity.stats; + +import com.baomidou.mybatisplus.annotation.TableName; + +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.math.BigDecimal; +import java.util.Date; + +/** + * 网格下日项目数据统计表 存放机关下截止到当前日期的各项总数据以及昨日新增各项数据 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-06-16 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("fact_grid_project_daily") +public class FactGridProjectDailyEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户Id 【dim_customer.id】 + */ + private String customerId; + + /** + * 机关Id 【dim_agency.id】 + */ + private String agencyId; + + /** + * 网格Id 【dim_grid.id】 + */ + private String gridId; + + /** + * 日维度Id 【dim_date.id】 + */ + private String dateId; + + /** + * 周维度Id 【dim_week.id】 + */ + private String weekId; + + /** + * 月维度Id 【dim_month.id】 + */ + private String monthId; + + /** + * 截止当日网格下项目总数 【当前组织及下级项目总数】 + */ + private Integer projectTotal; + + /** + * 截止当日网格下处理中项目数 【当前组织及下级所有未结案项目总数】 + */ + private Integer pendingTotal; + + /** + * 截止当日网格下处理中项目占比 【当前组织及下级未结案项目百分比(存百分比数,小数点后两位)】 + */ + private BigDecimal pendingRatio; + + /** + * 截止当日网格下已结案项目数 【当前组织及下级已结案项目总数】 + */ + private Integer closedTotal; + + /** + * 截止当日网格下已结案项目占比 【当前组织及下级已结案项目百分比(存百分比数,小数点后两位)】 + */ + private BigDecimal closedRatio; + + /** + * 截止当日已结案中已解决项目数 【当前组织及下级已结案项目中已解决总数】 + */ + private Integer resolvedTotal; + + /** + * 截止当日已结案中已解决项目占比 【当前组织及下级已结案项目中已解决占比】 + */ + private BigDecimal resolvedRatio; + + /** + * 截止当日已结案中未解决项目数 【当前组织及下级已结案项目中未解决总数】 + */ + private Integer unresolvedTotal; + + /** + * 截止当日已结案中未解决项目占比 【当前组织及下级已结案项目中未解决占比】 + */ + private BigDecimal unresolvedRatio; + + /** + * 当日已结案项目中已解决数 【当前组织及下级前一日新增结案中已解决项目数】 + */ + private Integer resolvedIncr; + + /** + * 当日已结案项目组未解决数 【当前组织及下级前一日新增结案中未解决项目数】 + */ + private Integer unresolvedIncr; + + /** + * 当日网格下项目总数 【该网格下项目总数】 + */ + private Integer gridIncr; + + /** + * 当日网格下处理中项目数 【该网格下未结案项目总数】 + */ + private Integer pendingIncr; + + /** + * 当日网格下已结案项目数 【该网格下已结案项目总数】 + */ + private String closedIncr; + +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/stats/FactGridProjectMonthlyEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/stats/FactGridProjectMonthlyEntity.java new file mode 100644 index 0000000000..dd79ecc9fa --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/stats/FactGridProjectMonthlyEntity.java @@ -0,0 +1,142 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.entity.stats; + +import com.baomidou.mybatisplus.annotation.TableName; + +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.math.BigDecimal; +import java.util.Date; + +/** + * 网格下月项目数据统计表 存放机关下截止到当前月份的各项总数据以及上月新增各项数据 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-06-16 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("fact_grid_project_monthly") +public class FactGridProjectMonthlyEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户Id 【dim_customer.id】 + */ + private String customerId; + + /** + * 机关Id 【dim_agency.id】 + */ + private String agencyId; + + /** + * 网格Id 【dim_grid.id】 + */ + private String gridId; + + /** + * 月维度Id 【dim_month.id】 + */ + private String monthId; + + /** + * 季维度Id 【dim_quarter.id】 + */ + private String quarterId; + + /** + * 年维度Id 【dim_year.id】 + */ + private String yearId; + + /** + * 截止当月项目总数 【当前组织及下级项目总数】 + */ + private Integer projectTotal; + + /** + * 截止当月处理中项目数 【当前组织及下级所有未结案项目总数】 + */ + private Integer pendingTotal; + + /** + * 截止当月处理中项目占比 【当前组织及下级未结案项目百分比(存百分比数,小数点后两位)】 + */ + private BigDecimal pendingRatio; + + /** + * 截止当月已结案项目数 【当前组织及下级已结案项目总数】 + */ + private Integer closedTotal; + + /** + * 截止当月已结案项目占比 【当前组织及下级已结案项目百分比(存百分比数,小数点后两位)】 + */ + private BigDecimal closedRatio; + + /** + * 截止当月已结案中已解决项目数 【当前组织及下级已结案项目中已解决总数】 + */ + private Integer resolvedTotal; + + /** + * 截止当月已结案中已解决项目占比 【当前组织及下级已结案项目中已解决占比】 + */ + private BigDecimal resolvedRatio; + + /** + * 截止当月已结案中未解决项目数 【当前组织及下级已结案项目中未解决总数】 + */ + private Integer unresolvedTotal; + + /** + * 截止当月已结案中未解决项目占比 【当前组织及下级已结案项目中未解决占比】 + */ + private BigDecimal unresolvedRatio; + + /** + * 当月项目总数 【当前组织及下级前一月新增项目数】 + */ + private Integer projectIncr; + + /** + * 当月处理中项目数 【当前组织及下级前一月新增处理中项目数】 + */ + private Integer pendingIncr; + + /** + * 当月已结案项目数 【当前组织及下级前一月新增结案项目数】 + */ + private Integer closedIncr; + + /** + * 当月已结案项目中已解决数 【当前组织及下级前一日新增结案中已解决项目数】 + */ + private Integer resolvedIncr; + + /** + * 当月已结案项目组未解决数 【当前组织及下级前一日新增结案中未解决项目数】 + */ + private Integer unresolvedIncr; + +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/stats/LastExecRecordEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/stats/LastExecRecordEntity.java new file mode 100755 index 0000000000..833954276d --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/stats/LastExecRecordEntity.java @@ -0,0 +1,51 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.entity.stats; + +import com.baomidou.mybatisplus.annotation.TableName; + +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; + +/** + * 最后一次执行记录表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-06-17 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("last_exec_record") +public class LastExecRecordEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 执行主体,即每一个统计表 + */ + private String subject; + + /** + * 最后一次执行时间 + */ + private Date execTime; + +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/voice/ArticleEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/voice/ArticleEntity.java new file mode 100644 index 0000000000..98d9beb507 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/voice/ArticleEntity.java @@ -0,0 +1,125 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.entity.voice; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; + +/** + * 文章表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-06-17 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("article") +public class ArticleEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户ID + */ + private String customerId; + + /** + * 草稿ID + */ + private String draftId; + + /** + * 文章标题 + */ + private String title; + + /** + * 文章内容 精简内容 + */ + private String previewContent; + + /** + * 是否置顶 1是;0否; + */ + private Integer isTop; + + /** + * 发布范围描述 所有发布范围集合,顿号隔开 + */ + private String publishRangeDesc; + + /** + * 发布单位ID + */ + private String publisherId; + + /** + * 发布单位名称 + */ + private String publisherName; + + /** + * 发布单位类型 机关:agency;部门:department;网格:grid + */ + private String publisherType; + + /** + * 发布时间 + */ + private Date publishDate; + + /** + * 发布状态 已发布:published;已下线:offline + */ + private String statusFlag; + + /** + * 下线时间 + */ + private Date offLineTime; + + /** + * 文章标签串 竖杠分割的标签名称 + */ + private String tags; + + /** + * 组织ID + */ + private String orgId; + + /** + * 组织ID路径 eg:字段为def:abc + */ + private String orgIdPath; + + /** + * 网格ID 数据权限使用 + */ + private String gridId; + + /** + * 部门ID 数据权限使用 + */ + private String departmentId; + +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/voice/ArticlePublishRangeEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/voice/ArticlePublishRangeEntity.java new file mode 100644 index 0000000000..1aac103337 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/voice/ArticlePublishRangeEntity.java @@ -0,0 +1,85 @@ +/** + * 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.voice; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; + +/** + * 文章发布范围表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-06-17 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("article_publish_range") +public class ArticlePublishRangeEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户ID + */ + private String customerId; + + /** + * 文章ID + */ + private String articleId; + + /** + * 网格ID + */ + private String gridId; + + /** + * 组织-网格名称 + */ + private String agencyGridName; + + /** + * 组织ID + */ + private String agencyId; + + /** + * 所有上级组织机构ID 以英文:隔开 + */ + private String pids; + + /** + * 所有上级名称 以横杠隔开 + */ + private String allParentName; + + /** + * 下线时间 + */ + private Date offLineTime; + + /** + * 发布状态 已发布:published;已下线:offline + */ + private String publishStatus; + +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/properties/ThreadProperties.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/properties/ThreadProperties.java new file mode 100644 index 0000000000..aaec7cb719 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/properties/ThreadProperties.java @@ -0,0 +1,25 @@ +package com.epmet.properties; + +import lombok.Data; +import org.springframework.boot.context.properties.ConfigurationProperties; + +/** + * 线程池属性类 + */ +@ConfigurationProperties(prefix = "thread") +@Data +public class ThreadProperties { + + private ThreadPoolProperties threadPool; + + @Data + public static class ThreadPoolProperties { + private int corePoolSize; + private int maxPoolSize; + private int queueCapacity; + private int keepAlive; + + public ThreadPoolProperties() { + } + } +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/StatsDemoService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/StatsDemoService.java index 3ee8455f70..0f5524072c 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/StatsDemoService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/StatsDemoService.java @@ -8,5 +8,8 @@ public interface StatsDemoService { void testList(); void testTx(); + Boolean testThreadPool(); + void testThreadPoolAsync(); + List getAllAgency(); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/StatsDimService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/StatsDimService.java new file mode 100644 index 0000000000..b566f3d160 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/StatsDimService.java @@ -0,0 +1,12 @@ +package com.epmet.service; + +public interface StatsDimService { + + void initGridDim(); + + void initAgencyDim(); + + void initCustomerDim(); + + void initDepartmentDim(); +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/StatsProjectService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/StatsProjectService.java index 06066f976b..c2d837d172 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/StatsProjectService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/StatsProjectService.java @@ -7,4 +7,11 @@ package com.epmet.service; public interface StatsProjectService { + /** + * @param customerId + * @return + * @Author sun + * @Description 数据-项目-机关日(月)统计 + **/ + void statsAgencyProject(String customerId); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/StatsPublicityService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/StatsPublicityService.java new file mode 100644 index 0000000000..e861ab90fc --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/StatsPublicityService.java @@ -0,0 +1,15 @@ +package com.epmet.service; + + +public interface StatsPublicityService { + /** + * desc: 统计宣传能力的汇总信息 + * + * return: + * @date: 2020/6/17 16:11 + * @author: jianjun liu + * email:liujianjun@git.elinkit.com.cn + */ + Boolean publicitySummary(); + +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/crm/CustomerService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/crm/CustomerService.java new file mode 100644 index 0000000000..e562a08365 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/crm/CustomerService.java @@ -0,0 +1,12 @@ +package com.epmet.service.crm; + +import com.epmet.entity.crm.CustomerEntity; + +import java.util.Date; +import java.util.List; + +public interface CustomerService { + + List listValidCustomersByCreateTime(Date createTimeFrom, Date createTimeTo); + +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/crm/impl/CustomerServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/crm/impl/CustomerServiceImpl.java new file mode 100644 index 0000000000..3db2f197bd --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/crm/impl/CustomerServiceImpl.java @@ -0,0 +1,25 @@ +package com.epmet.service.crm.impl; + +import com.epmet.commons.dynamic.datasource.annotation.DataSource; +import com.epmet.constant.DataSourceConstant; +import com.epmet.dao.crm.CustomerDao; +import com.epmet.entity.crm.CustomerEntity; +import com.epmet.service.crm.CustomerService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.Date; +import java.util.List; + +@Service +@DataSource(DataSourceConstant.OPER_CRM) +public class CustomerServiceImpl implements CustomerService { + + @Autowired + private CustomerDao customerDao; + + @Override + public List listValidCustomersByCreateTime(Date createTimeFrom, Date createTimeTo) { + return customerDao.listValidCustomersByCreateTime(createTimeFrom, createTimeTo); + } +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsDemoServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsDemoServiceImpl.java index cde6df48b8..343c0bed94 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsDemoServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsDemoServiceImpl.java @@ -8,8 +8,10 @@ import com.epmet.service.StatsDemoService; import com.epmet.service.org.DemoGovOrgService; import com.epmet.service.stats.DemoDataStatsService; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.scheduling.annotation.Async; import org.springframework.stereotype.Service; +import java.time.LocalDateTime; import java.util.List; /** @@ -27,6 +29,7 @@ public class StatsDemoServiceImpl implements StatsDemoService { @Autowired private DemoDataStatsService demoDataStatsService; + @Override public void testList() { List agencies = demoGovOrgService.listAllEntities(); List issues = demoIssueService.listAllEntities(); @@ -35,10 +38,37 @@ public class StatsDemoServiceImpl implements StatsDemoService { //该service不加事务 //@Transactional(rollbackFor = Exception.class) + @Override public void testTx() { demoDataStatsService.testTx(); } + @Override + public Boolean testThreadPool() { + try { + Thread.sleep(2000l); + } catch (InterruptedException e) { + System.err.println("睡眠发生异常"); + e.printStackTrace(); + } + return true; + } + + /** + * 推荐 + */ + @Async //注意此处注解 + @Override + public void testThreadPoolAsync() { + try { + Thread.sleep(2000l); + System.out.println(LocalDateTime.now().getSecond()); + } catch (InterruptedException e) { + System.err.println("睡眠发生异常"); + e.printStackTrace(); + } + } + public List getAllAgency(){ return demoGovOrgService.getAllAgency(); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsDimServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsDimServiceImpl.java new file mode 100644 index 0000000000..c4666ba77b --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsDimServiceImpl.java @@ -0,0 +1,172 @@ +package com.epmet.service.impl; + +import com.epmet.commons.tools.utils.DateUtils; +import com.epmet.constant.StatsSubject; +import com.epmet.dao.org.CustomerDepartmentDao; +import com.epmet.dao.stats.LastExecRecordDao; +import com.epmet.entity.crm.CustomerEntity; +import com.epmet.entity.org.CustomerAgencyEntity; +import com.epmet.entity.org.CustomerDepartmentEntity; +import com.epmet.entity.org.CustomerGridEntity; +import com.epmet.entity.stats.DimGridEntity; +import com.epmet.entity.stats.LastExecRecordEntity; +import com.epmet.service.StatsDimService; +import com.epmet.service.crm.CustomerService; +import com.epmet.service.org.CustomerAgencyService; +import com.epmet.service.org.CustomerDepartmentService; +import com.epmet.service.org.CustomerGridService; +import com.epmet.service.stats.*; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.Date; +import java.util.List; +import java.util.stream.Collectors; + +@Service +public class StatsDimServiceImpl implements StatsDimService { + + @Autowired + private DimGridService dimGridService; + + @Autowired + private DimAgencyService dimAgencyService; + + @Autowired + private CustomerGridService customerGridService; + + @Autowired + private LastExecRecordService lastExecRecordService; + + @Autowired + private CustomerAgencyService customerAgencyService; + + @Autowired + private CustomerService customerService; + + @Autowired + private DimCustomerService dimCustomerService; + + @Autowired + private CustomerDepartmentService departmentService; + + @Autowired + private DimDepartmentService dimDepartmentService; + + @Override + public void initGridDim() { + DimGridEntity lastCreatedGridDim = dimGridService.getLastCreatedGridDim(); + List grids; + if (lastCreatedGridDim == null) { + // 首次初始化 + grids = customerGridService.listGridsByCreateTime(null, null); + } else { + // 非首次初始化 + // 结束时间边界与开始时间边界,包含开始时间不包含结束时间。结束时间可以为空,则查询从开始时间往后的所有新创建网格 + //Date endTimeBorder = DateUtils.parse(DateUtils.format(new Date(), DateUtils.DATE_PATTERN_YYYYMMDD), DateUtils.DATE_PATTERN_YYYYMMDD); + Date startTimeBorder = DateUtils.parse(DateUtils.format(lastCreatedGridDim.getCreatedTime(), DateUtils.DATE_PATTERN_YYYYMMDD), DateUtils.DATE_PATTERN_YYYYMMDD); + + grids = customerGridService.listGridsByCreateTime(startTimeBorder, null); + } + + List gridDims = convertCustomerGrid2GridDim(grids); + dimGridService.addGridDims(gridDims); + } + + /** + * 将网格信息转换成网格维度信息 + * @param grids + * @return + */ + private List convertCustomerGrid2GridDim(List grids) { + Date now = new Date(); + return grids.stream().map(grid -> { + DimGridEntity dimGrid = new DimGridEntity(); + dimGrid.setAgencyId(grid.getPid()); + dimGrid.setAreaCode(grid.getAreaCode()); + dimGrid.setCustomerId(grid.getCustomerId()); + dimGrid.setGridName(grid.getGridName()); + dimGrid.setCreatedBy("APP_USER"); + dimGrid.setCreatedTime(now); + dimGrid.setDelFlag("0"); + dimGrid.setId(grid.getId()); + dimGrid.setRevision(0); + dimGrid.setUpdatedBy("APP_USER"); + dimGrid.setUpdatedTime(now); + return dimGrid; + }).collect(Collectors.toList()); + } + + /** + * 初始化机关单位维度 + */ + @Override + public void initAgencyDim() { + LastExecRecordEntity lastExecRecord = lastExecRecordService.getLastExecRecord(StatsSubject.DIM_AGENCY); + if (lastExecRecord == null) { + lastExecRecord = lastExecRecordService.createLastExecRecord(StatsSubject.DIM_AGENCY); + } + + Date statsEndTime = DateUtils.integrate(new Date(), DateUtils.DATE_PATTERN_YYYYMMDD); + Date statsStartTime = null; + if (lastExecRecord.getExecTime() != null) { + statsStartTime = DateUtils.integrate(lastExecRecord.getExecTime(), DateUtils.DATE_PATTERN_YYYYMMDD); + } + + List agencies = customerAgencyService.listAgenciesByCreateTime(statsStartTime, statsEndTime); + dimAgencyService.addAgencyDims(agencies); + lastExecRecord.setExecTime(new Date()); + + // 记录最后一次统计时间 + lastExecRecordService.updateById(lastExecRecord); + } + + /** + * 初始化网格维度 + */ + @Override + public void initCustomerDim() { + LastExecRecordEntity lastExecRecord = lastExecRecordService.getLastExecRecord(StatsSubject.DIM_CUSTOMER); + if (lastExecRecord == null) { + lastExecRecord = lastExecRecordService.createLastExecRecord(StatsSubject.DIM_CUSTOMER); + } + + Date statsEndTime = DateUtils.integrate(new Date(), DateUtils.DATE_PATTERN_YYYYMMDD); + Date statsStartTime = null; + if (lastExecRecord.getExecTime() != null) { + statsStartTime = DateUtils.integrate(lastExecRecord.getExecTime(), DateUtils.DATE_PATTERN_YYYYMMDD); + } + + List customers = customerService.listValidCustomersByCreateTime(statsStartTime, statsEndTime); + dimCustomerService.addCustomerDims(customers); + + lastExecRecord.setExecTime(new Date()); + + // 记录最后一次统计时间 + lastExecRecordService.updateById(lastExecRecord); + } + + @Override + public void initDepartmentDim() { + LastExecRecordEntity lastExecRecord = lastExecRecordService.getLastExecRecord(StatsSubject.DIM_DEPARTMENT); + if (lastExecRecord == null) { + lastExecRecord = lastExecRecordService.createLastExecRecord(StatsSubject.DIM_DEPARTMENT); + } + + Date statsEndTime = DateUtils.integrate(new Date(), DateUtils.DATE_PATTERN_YYYYMMDD); + Date statsStartTime = null; + if (lastExecRecord.getExecTime() != null) { + statsStartTime = DateUtils.integrate(lastExecRecord.getExecTime(), DateUtils.DATE_PATTERN_YYYYMMDD); + } + + List departments = departmentService.listDepartmentsByCreatedTime(statsStartTime, statsEndTime); + + dimDepartmentService.addDepartmentDims(departments); + + lastExecRecord.setExecTime(new Date()); + + // 记录最后一次统计时间 + lastExecRecordService.updateById(lastExecRecord); + + } +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsProjectServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsProjectServiceImpl.java index 7427ba994d..24214d1262 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsProjectServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsProjectServiceImpl.java @@ -2,6 +2,7 @@ package com.epmet.service.impl; import com.epmet.service.StatsProjectService; import com.epmet.service.project.ProjectService; +import com.epmet.service.stats.*; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -12,7 +13,37 @@ import org.springframework.stereotype.Service; @Service public class StatsProjectServiceImpl implements StatsProjectService { + @Autowired + private DimAgencyService dimAgencyService; + @Autowired + private DimDateService dimDateService; + @Autowired + private DimWeekService dimWeekService; + @Autowired + private DimMonthService dimMonthService; + @Autowired + private DimQuarterService dimQuarterService; + @Autowired + private DimYearService dimYearService; @Autowired private ProjectService projectService; + @Autowired + private FactAgencyProjectDailyService factAgencyProjectDailyService; + @Autowired + private FactAgencyProjectMonthlyService factAgencyProjectMonthlyService; + @Autowired + private FactGridProjectDailyService factGridProjectDailyService; + @Autowired + private FactGridProjectMonthlyService factGridProjectMonthlyService; + + /** + * @param customerId + * @return + * @Author sun + * @Description 数据-项目-机关日(月)统计 + **/ + @Override + public void statsAgencyProject(String customerId) { + } } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsPublicityServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsPublicityServiceImpl.java new file mode 100644 index 0000000000..844d11d04c --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsPublicityServiceImpl.java @@ -0,0 +1,68 @@ +package com.epmet.service.impl; + +import com.epmet.commons.tools.utils.DateUtils; +import com.epmet.dto.stats.ArticleGridPublishedSummaryDTO; +import com.epmet.service.StatsPublicityService; +import com.epmet.service.stats.*; +import com.epmet.service.voice.ArticlePublishRangeService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.util.CollectionUtils; + +import java.util.Date; +import java.util.List; + +/** + * desc: 宣传能力数据统计 service + * + * @date: 2020/6/17 16:08 + * @author: jianjun liu + * email:liujianjun@git.elinkit.com.cn + */ +@Service +public class StatsPublicityServiceImpl implements StatsPublicityService { + + @Autowired + private DimAgencyService dimAgencyService; + @Autowired + private DimDateService dimDateService; + @Autowired + private DimWeekService dimWeekService; + @Autowired + private DimMonthService dimMonthService; + @Autowired + private DimQuarterService dimQuarterService; + @Autowired + private DimYearService dimYearService; + @Autowired + private DimCustomerService dimCustomerService; + + @Autowired + private ArticlePublishRangeService articlePublishRangeService; + + @Override + public Boolean publicitySummary() { + int pageNo = 1; + int pageSize = 100; + List customerIdList = null; + do { + customerIdList = dimCustomerService.selectCustomerIdPage(pageNo, (pageNo - 1) * pageSize); + if (!CollectionUtils.isEmpty(customerIdList)) { + customerIdList.forEach(customerId -> { + + }); + } + + } while (!CollectionUtils.isEmpty(customerIdList) || customerIdList.size() >= pageSize); + return null; + } + + private String statsPublishArticle(String customerId, Date statsDate) { + //1.先查询昨天的 有没有数据 有则 昨日发布文章总数 = 昨日的发布文章数增量 + 统计表中已有的昨日的网格总数 ; + // 否则 昨日发布文章总数 = 发布范围表中计算所有发布文章总数 + + List articleCount = articlePublishRangeService.selectByCreatedDate(customerId, statsDate == null ? DateUtils.addDateDays(new Date(), -1) : statsDate); + + return null; + } +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/CustomerAgencyService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/CustomerAgencyService.java new file mode 100644 index 0000000000..034499e955 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/CustomerAgencyService.java @@ -0,0 +1,10 @@ +package com.epmet.service.org; + +import com.epmet.entity.org.CustomerAgencyEntity; + +import java.util.Date; +import java.util.List; + +public interface CustomerAgencyService { + List listAgenciesByCreateTime(Date statsStartTime, Date statsEndTime); +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/CustomerDepartmentService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/CustomerDepartmentService.java new file mode 100644 index 0000000000..1aa2c2f7db --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/CustomerDepartmentService.java @@ -0,0 +1,11 @@ +package com.epmet.service.org; + +import com.epmet.entity.org.CustomerDepartmentEntity; + +import java.util.Date; +import java.util.List; + +public interface CustomerDepartmentService { + + List listDepartmentsByCreatedTime(Date createdTimeFrom, Date createdTimeTo); +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/CustomerGridService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/CustomerGridService.java new file mode 100644 index 0000000000..b8308aede1 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/CustomerGridService.java @@ -0,0 +1,17 @@ +package com.epmet.service.org; + +import com.epmet.entity.org.CustomerGridEntity; + +import java.util.Date; +import java.util.List; + +public interface CustomerGridService { + /** + * 根据创建时间,截取时间段内的网格 + * @param start + * @param end + * @return + * @Param("start") Date start, @Param("end") Date end + */ + List listGridsByCreateTime(Date start, Date end); +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/impl/CustomerAgencyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/impl/CustomerAgencyServiceImpl.java new file mode 100644 index 0000000000..2912ca0cca --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/impl/CustomerAgencyServiceImpl.java @@ -0,0 +1,25 @@ +package com.epmet.service.org.impl; + +import com.epmet.commons.dynamic.datasource.annotation.DataSource; +import com.epmet.constant.DataSourceConstant; +import com.epmet.dao.org.StatsCustomerAgencyDao; +import com.epmet.entity.org.CustomerAgencyEntity; +import com.epmet.service.org.CustomerAgencyService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.Date; +import java.util.List; + +@Service +@DataSource(DataSourceConstant.GOV_ORG) +public class CustomerAgencyServiceImpl implements CustomerAgencyService { + + @Autowired + private StatsCustomerAgencyDao customerAgencyDao; + + @Override + public List listAgenciesByCreateTime(Date statsStartTime, Date statsEndTime) { + return customerAgencyDao.listAgenciesByCreateTime(statsStartTime, statsEndTime); + } +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/impl/CustomerDepartmentServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/impl/CustomerDepartmentServiceImpl.java new file mode 100644 index 0000000000..ac430a3abd --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/impl/CustomerDepartmentServiceImpl.java @@ -0,0 +1,31 @@ +package com.epmet.service.org.impl; + +import com.epmet.commons.dynamic.datasource.annotation.DataSource; +import com.epmet.constant.DataSourceConstant; +import com.epmet.dao.org.CustomerDepartmentDao; +import com.epmet.entity.org.CustomerDepartmentEntity; +import com.epmet.service.org.CustomerDepartmentService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.Date; +import java.util.List; + +@Service +@DataSource(DataSourceConstant.GOV_ORG) +public class CustomerDepartmentServiceImpl implements CustomerDepartmentService { + + @Autowired + private CustomerDepartmentDao departmentDao; + + /** + * 根据创建时间查询部门列表 + * @param createdTimeFrom + * @param createdTimeTo + * @return + */ + @Override + public List listDepartmentsByCreatedTime(Date createdTimeFrom, Date createdTimeTo) { + return departmentDao.listDepartmentsByCreatedTime(createdTimeFrom, createdTimeTo); + } +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/impl/CustomerGridServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/impl/CustomerGridServiceImpl.java new file mode 100644 index 0000000000..191b074d19 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/impl/CustomerGridServiceImpl.java @@ -0,0 +1,25 @@ +package com.epmet.service.org.impl; + +import com.epmet.commons.dynamic.datasource.annotation.DataSource; +import com.epmet.constant.DataSourceConstant; +import com.epmet.dao.org.CustomerGridDao; +import com.epmet.entity.org.CustomerGridEntity; +import com.epmet.service.org.CustomerGridService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.Date; +import java.util.List; + +@Service +@DataSource(DataSourceConstant.GOV_ORG) +public class CustomerGridServiceImpl implements CustomerGridService { + + @Autowired + private CustomerGridDao customerGridDao; + + @Override + public List listGridsByCreateTime(Date start, Date end) { + return customerGridDao.listGridsByCreateTime(start, end); + } +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/DimAgencyService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/DimAgencyService.java index 7cb47dbcf6..d5e978046f 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/DimAgencyService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/DimAgencyService.java @@ -20,6 +20,7 @@ package com.epmet.service.stats; import com.epmet.commons.mybatis.service.BaseService; import com.epmet.commons.tools.page.PageData; import com.epmet.dto.stats.DimAgencyDTO; +import com.epmet.entity.org.CustomerAgencyEntity; import com.epmet.entity.stats.DimAgencyEntity; import java.util.List; @@ -92,4 +93,14 @@ public interface DimAgencyService extends BaseService { * @date 2020-06-16 */ void delete(String[] ids); + + /** + * @param dto + * @return + * @Author sun + * @Description 根据客户Id查询机关维度列表数据 + **/ + List getDimAgencyList(DimAgencyDTO dto); + + void addAgencyDims(List agencies); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/DimCustomerService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/DimCustomerService.java index dc19f54861..85e7c06202 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/DimCustomerService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/DimCustomerService.java @@ -20,6 +20,8 @@ package com.epmet.service.stats; import com.epmet.commons.mybatis.service.BaseService; import com.epmet.commons.tools.page.PageData; import com.epmet.dto.stats.DimCustomerDTO; +import com.epmet.entity.crm.CustomerEntity; +import com.epmet.entity.org.CustomerDepartmentEntity; import com.epmet.entity.stats.DimCustomerEntity; import java.util.List; @@ -92,4 +94,22 @@ public interface DimCustomerService extends BaseService { * @date 2020-06-16 */ void delete(String[] ids); + + /** + * desc: 分页获取 客户id + * + * @param pageNo + * @param pageSize + * return: List + * @date: 2020/6/17 16:26 + * @author: jianjun liu + * email:liujianjun@git.elinkit.com.cn + */ + List selectCustomerIdPage(Integer pageNo, Integer pageSize); + + /** + * 添加客户维度 + * @param customers + */ + void addCustomerDims(List customers); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/DimDateService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/DimDateService.java index b191da62f7..8c376e33e7 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/DimDateService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/DimDateService.java @@ -92,4 +92,15 @@ public interface DimDateService extends BaseService { * @date 2020-06-16 */ void delete(String[] ids); + + /** + * @param dto + * @return + * @Author sun + * @Description 根据创建时间查询日维度信息 + **/ + List getDimDate(DimDateDTO dto); + + void initDimDate(); + } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/DimDepartmentService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/DimDepartmentService.java index ffb1601678..0055e81fb5 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/DimDepartmentService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/DimDepartmentService.java @@ -20,6 +20,7 @@ package com.epmet.service.stats; import com.epmet.commons.mybatis.service.BaseService; import com.epmet.commons.tools.page.PageData; import com.epmet.dto.stats.DimDepartmentDTO; +import com.epmet.entity.org.CustomerDepartmentEntity; import com.epmet.entity.stats.DimDepartmentEntity; import java.util.List; @@ -92,4 +93,6 @@ public interface DimDepartmentService extends BaseService { * @date 2020-06-16 */ void delete(String[] ids); + + void addDepartmentDims(List departments); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/DimGridService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/DimGridService.java index dbb255500b..5bcf8f1e48 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/DimGridService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/DimGridService.java @@ -20,8 +20,12 @@ package com.epmet.service.stats; import com.epmet.commons.mybatis.service.BaseService; import com.epmet.commons.tools.page.PageData; import com.epmet.dto.stats.DimGridDTO; +import com.epmet.entity.org.CustomerAgencyEntity; +import com.epmet.entity.org.CustomerGridEntity; import com.epmet.entity.stats.DimGridEntity; +import org.apache.ibatis.annotations.Param; +import java.util.Date; import java.util.List; import java.util.Map; @@ -92,4 +96,8 @@ public interface DimGridService extends BaseService { * @date 2020-06-16 */ void delete(String[] ids); + + DimGridEntity getLastCreatedGridDim(); + + void addGridDims(List gridDims); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/DimMonthService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/DimMonthService.java index 160625db05..d6f8a75943 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/DimMonthService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/DimMonthService.java @@ -92,4 +92,6 @@ public interface DimMonthService extends BaseService { * @date 2020-06-16 */ void delete(String[] ids); + + void initMonthDim(); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactAgencyProjectDailyService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactAgencyProjectDailyService.java new file mode 100644 index 0000000000..49a1030a1e --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactAgencyProjectDailyService.java @@ -0,0 +1,31 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service.stats; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.entity.stats.FactAgencyProjectDailyEntity; + +/** + * 机关下日项目数据统计 存放机关下截止到当前日期的各项总数据以及昨日新增各项数据 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-06-16 + */ +public interface FactAgencyProjectDailyService extends BaseService { + +} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactAgencyProjectMonthlyService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactAgencyProjectMonthlyService.java new file mode 100644 index 0000000000..38f18b9a8c --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactAgencyProjectMonthlyService.java @@ -0,0 +1,31 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service.stats; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.entity.stats.FactAgencyProjectMonthlyEntity; + +/** + * 机关下月项目数据统计 存放机关下截止到当前月份的各项总数据以及上月新增各项数据 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-06-16 + */ +public interface FactAgencyProjectMonthlyService extends BaseService { + +} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactGridProjectDailyService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactGridProjectDailyService.java new file mode 100644 index 0000000000..88c6aa3286 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactGridProjectDailyService.java @@ -0,0 +1,31 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service.stats; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.entity.stats.FactGridProjectDailyEntity; + +/** + * 网格下日项目数据统计表 存放机关下截止到当前日期的各项总数据以及昨日新增各项数据 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-06-16 + */ +public interface FactGridProjectDailyService extends BaseService { + +} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactGridProjectMonthlyService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactGridProjectMonthlyService.java new file mode 100644 index 0000000000..7beb0d019d --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactGridProjectMonthlyService.java @@ -0,0 +1,31 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service.stats; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.entity.stats.FactGridProjectMonthlyEntity; + +/** + * 网格下月项目数据统计表 存放机关下截止到当前月份的各项总数据以及上月新增各项数据 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-06-16 + */ +public interface FactGridProjectMonthlyService extends BaseService { + +} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/LastExecRecordService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/LastExecRecordService.java new file mode 100644 index 0000000000..35bf90a324 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/LastExecRecordService.java @@ -0,0 +1,10 @@ +package com.epmet.service.stats; + +import com.epmet.entity.stats.LastExecRecordEntity; + +public interface LastExecRecordService { + LastExecRecordEntity getLastExecRecord(String statsSubject); + LastExecRecordEntity createLastExecRecord(String statsSubject); + + void updateById(LastExecRecordEntity lastExecRecord); +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/DimAgencyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/DimAgencyServiceImpl.java index 817c3b774f..9824d21721 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/DimAgencyServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/DimAgencyServiceImpl.java @@ -25,6 +25,7 @@ import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.dao.stats.DimAgencyDao; import com.epmet.dto.stats.DimAgencyDTO; +import com.epmet.entity.org.CustomerAgencyEntity; import com.epmet.entity.stats.DimAgencyEntity; import com.epmet.service.stats.DimAgencyService; import org.apache.commons.lang3.StringUtils; @@ -33,6 +34,7 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.util.Arrays; +import java.util.Date; import java.util.List; import java.util.Map; @@ -97,4 +99,37 @@ public class DimAgencyServiceImpl extends BaseServiceImpl getDimAgencyList(DimAgencyDTO dto) { + return baseDao.selectDimAgencyList(dto); + } + + @Transactional + @Override + public void addAgencyDims(List agencies) { + Date now = new Date(); + for (CustomerAgencyEntity agency : agencies) { + DimAgencyEntity dimAgencyEntity = new DimAgencyEntity(); + dimAgencyEntity.setAgencyName(agency.getOrganizationName()); + dimAgencyEntity.setAllParentName(agency.getAllParentName()); + dimAgencyEntity.setCustomerId(agency.getCustomerId()); + dimAgencyEntity.setLevel(agency.getLevel()); + dimAgencyEntity.setPid(agency.getPid()); + dimAgencyEntity.setPids(agency.getPid()); + dimAgencyEntity.setCreatedBy("APP_USER"); + dimAgencyEntity.setUpdatedBy("APP_USER"); + dimAgencyEntity.setCreatedTime(now); + dimAgencyEntity.setUpdatedTime(now); + dimAgencyEntity.setRevision(0); + dimAgencyEntity.setDelFlag("0"); + baseDao.insert(dimAgencyEntity); + } + } + } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/DimCustomerServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/DimCustomerServiceImpl.java index 4b66ed3e11..87ab6d789d 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/DimCustomerServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/DimCustomerServiceImpl.java @@ -20,19 +20,24 @@ package com.epmet.service.stats.impl; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.commons.tools.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.constant.FieldConstant; import com.epmet.dao.stats.DimCustomerDao; import com.epmet.dto.stats.DimCustomerDTO; +import com.epmet.entity.crm.CustomerEntity; +import com.epmet.entity.org.CustomerDepartmentEntity; import com.epmet.entity.stats.DimCustomerEntity; import com.epmet.service.stats.DimCustomerService; +import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.util.Arrays; +import java.util.Date; import java.util.List; import java.util.Map; @@ -43,6 +48,7 @@ import java.util.Map; * @since v1.0.0 2020-06-16 */ @Service +@Slf4j public class DimCustomerServiceImpl extends BaseServiceImpl implements DimCustomerService { @Override @@ -61,8 +67,8 @@ public class DimCustomerServiceImpl extends BaseServiceImpl getWrapper(Map params){ - String id = (String)params.get(FieldConstant.ID_HUMP); + 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); @@ -97,4 +103,30 @@ public class DimCustomerServiceImpl extends BaseServiceImpl selectCustomerIdPage(Integer pageNo, Integer pageSize) { + if (pageNo == null || pageNo < 1 || pageSize == null || pageSize < 0) { + log.error("selectCustomerIdPage param error,pageNo:{},pageSize:{}", pageNo, pageSize); + throw new RenException(EpmetErrorCode.CUSTOMER_VALIDATE_ERROR.getCode(), EpmetErrorCode.CUSTOMER_VALIDATE_ERROR.getMsg()); + } + return baseDao.selectCustomerIdPage(pageNo, (pageNo - 1) * pageSize); + } + + @Transactional + @Override + public void addCustomerDims(List customers) { + Date now = new Date(); + for (CustomerEntity customer : customers) { + DimCustomerEntity dim = new DimCustomerEntity(); + dim.setCustomerName(customer.getCustomerName()); + dim.setCreatedBy("APP_USER"); + dim.setCreatedTime(now); + dim.setUpdatedBy("APP_USER"); + dim.setUpdatedTime(now); + dim.setDelFlag("0"); + dim.setRevision(0); + dim.setId(customer.getId()); + baseDao.insert(dim); + } + } } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/DimDateServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/DimDateServiceImpl.java index 7cd094209a..0d0d756c12 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/DimDateServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/DimDateServiceImpl.java @@ -23,18 +23,16 @@ import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.commons.tools.utils.DateUtils; import com.epmet.dao.stats.DimDateDao; import com.epmet.dto.stats.DimDateDTO; import com.epmet.entity.stats.DimDateEntity; import com.epmet.service.stats.DimDateService; import org.apache.commons.lang3.StringUtils; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import java.util.Arrays; -import java.util.List; -import java.util.Map; +import java.util.*; /** * 日期维度表 @@ -45,7 +43,6 @@ import java.util.Map; @Service public class DimDateServiceImpl extends BaseServiceImpl implements DimDateService { - @Override public PageData page(Map params) { IPage page = baseDao.selectPage( @@ -98,4 +95,84 @@ public class DimDateServiceImpl extends BaseServiceImpl getDimDate(DimDateDTO dto) { + return baseDao.selectDimDate(dto); + } + + @Override + public void initDimDate() { + DimDateDTO latestDimDateDto = baseDao.getLatestDimDate(); + + Date targetDate = DateUtils.addDateDays(DateUtils.parse( + DateUtils.format(new Date(), DateUtils.DATE_PATTERN_YYYYMMDD), + DateUtils.DATE_PATTERN_YYYYMMDD), -1); + + Date lastDimDate; + + if (latestDimDateDto == null) { + // 没有维度数据 + initDimDate(targetDate); + } else if(targetDate.after(lastDimDate = DateUtils.parse(latestDimDateDto.getId(), DateUtils.DATE_PATTERN_YYYYMMDD))) { + // 有维度数据,并且当前日期大于最大按日维度数据的id,需要连续生成至少一天的维度数据(补缺) + initDimDate(lastDimDate, targetDate); + } + } + + /** + * 连续初始化 + * @param lastDimDate + * @param targetDate + */ + private void initDimDate(Date lastDimDate, Date targetDate) { + while (lastDimDate.before(targetDate)) { + lastDimDate = DateUtils.addDateDays(lastDimDate, 1); + initDimDate(lastDimDate); + } + } + + /** + * 初始化单日 + * @param targetDate + */ + public void initDimDate(Date targetDate) { + DimDateEntity dimDateEntity = generateDimDate(targetDate); + int c = baseDao.insertOne(dimDateEntity); + } + + public DimDateEntity generateDimDate(Date targetDate) { + Date now = new Date(); + // 日期id + String id = DateUtils.format(targetDate, DateUtils.DATE_PATTERN_YYYYMMDD); + // 月份id + String monthId = DateUtils.format(targetDate, DateUtils.DATE_PATTERN_YYYYMM); + // 日期名称字符串 + String dateNameStr = DateUtils.format(targetDate, DateUtils.DATE_NAME_PATTERN); + // 星期几 + String chineseWeekName = DateUtils.getWeekNameOfWeek(targetDate, DateUtils.WEEK_TYPE_CHINESE); + String englishWeekName = DateUtils.getWeekNameOfWeek(targetDate, DateUtils.WEEK_TYPE_ENGLISH); + // 一年的第几周 + String weekId = DateUtils.format(targetDate, DateUtils.DATE_PATTERN_YYYY).concat("W").concat(String.valueOf(DateUtils.getWeekOfYear(targetDate))); + + DimDateEntity dimDateEntity = new DimDateEntity(); + dimDateEntity.setId(id); + dimDateEntity.setDateName(dateNameStr); + dimDateEntity.setDayOfWeek(englishWeekName); + dimDateEntity.setDayOfWeekName(chineseWeekName); + dimDateEntity.setWeekId(weekId); + dimDateEntity.setMonthId(monthId); + dimDateEntity.setDelFlag("0"); + dimDateEntity.setCreatedBy("APP_USER"); + dimDateEntity.setCreatedTime(now); + dimDateEntity.setRevision(0); + dimDateEntity.setUpdatedBy("APP_USER"); + dimDateEntity.setUpdatedTime(now); + return dimDateEntity; + } } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/DimDepartmentServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/DimDepartmentServiceImpl.java index 3b500d1056..a28dff6493 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/DimDepartmentServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/DimDepartmentServiceImpl.java @@ -25,6 +25,7 @@ import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.dao.stats.DimDepartmentDao; import com.epmet.dto.stats.DimDepartmentDTO; +import com.epmet.entity.org.CustomerDepartmentEntity; import com.epmet.entity.stats.DimDepartmentEntity; import com.epmet.service.stats.DimDepartmentService; import org.apache.commons.lang3.StringUtils; @@ -33,6 +34,7 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.util.Arrays; +import java.util.Date; import java.util.List; import java.util.Map; @@ -97,4 +99,22 @@ public class DimDepartmentServiceImpl extends BaseServiceImpl departments) { + Date now = new Date(); + for (CustomerDepartmentEntity department : departments) { + DimDepartmentEntity dim = new DimDepartmentEntity(); + dim.setAgencyId(department.getAgencyId()); + dim.setCustomerId(department.getCustomerId()); + dim.setDepartmentName(department.getDepartmentName()); + dim.setCreatedBy("APP_USER"); + dim.setUpdatedBy("APP_USER"); + dim.setCreatedTime(now); + dim.setUpdatedTime(now); + dim.setRevision(0); + dim.setDelFlag("0"); + baseDao.insert(dim); + } + } } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/DimGridServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/DimGridServiceImpl.java index 1a30850b2c..1a0af837a4 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/DimGridServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/DimGridServiceImpl.java @@ -25,14 +25,16 @@ import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.dao.stats.DimGridDao; import com.epmet.dto.stats.DimGridDTO; +import com.epmet.entity.org.CustomerAgencyEntity; +import com.epmet.entity.stats.DimAgencyEntity; import com.epmet.entity.stats.DimGridEntity; import com.epmet.service.stats.DimGridService; import org.apache.commons.lang3.StringUtils; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.util.Arrays; +import java.util.Date; import java.util.List; import java.util.Map; @@ -97,4 +99,16 @@ public class DimGridServiceImpl extends BaseServiceImpl gridDims) { + for (DimGridEntity gridDim : gridDims) { + baseDao.insert(gridDim); + } + } } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/DimMonthServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/DimMonthServiceImpl.java index b495b76284..39db16d77f 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/DimMonthServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/DimMonthServiceImpl.java @@ -23,16 +23,22 @@ import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.commons.tools.utils.DateUtils; +import com.epmet.constant.StatsSubject; import com.epmet.dao.stats.DimMonthDao; import com.epmet.dto.stats.DimMonthDTO; import com.epmet.entity.stats.DimMonthEntity; +import com.epmet.entity.stats.LastExecRecordEntity; import com.epmet.service.stats.DimMonthService; +import com.epmet.service.stats.LastExecRecordService; import org.apache.commons.lang3.StringUtils; +import org.joda.time.LocalDate; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.util.Arrays; +import java.util.Date; import java.util.List; import java.util.Map; @@ -45,6 +51,9 @@ import java.util.Map; @Service public class DimMonthServiceImpl extends BaseServiceImpl implements DimMonthService { + @Autowired + private LastExecRecordService lastExecRecordService; + @Override public PageData page(Map params) { IPage page = baseDao.selectPage( @@ -97,4 +106,62 @@ public class DimMonthServiceImpl extends BaseServiceImpl + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service.stats.impl; + +import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.dao.stats.FactAgencyProjectDailyDao; +import com.epmet.entity.stats.FactAgencyProjectDailyEntity; +import com.epmet.service.stats.FactAgencyProjectDailyService; +import org.springframework.stereotype.Service; + +/** + * 机关下日项目数据统计 存放机关下截止到当前日期的各项总数据以及昨日新增各项数据 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-06-16 + */ +@Service +public class FactAgencyProjectDailyServiceImpl extends BaseServiceImpl implements FactAgencyProjectDailyService { + + +} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactAgencyProjectMonthlyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactAgencyProjectMonthlyServiceImpl.java new file mode 100644 index 0000000000..5ad3f8eeda --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactAgencyProjectMonthlyServiceImpl.java @@ -0,0 +1,36 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service.stats.impl; + +import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.dao.stats.FactAgencyProjectMonthlyDao; +import com.epmet.entity.stats.FactAgencyProjectMonthlyEntity; +import com.epmet.service.stats.FactAgencyProjectMonthlyService; +import org.springframework.stereotype.Service; + +/** + * 机关下月项目数据统计 存放机关下截止到当前月份的各项总数据以及上月新增各项数据 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-06-16 + */ +@Service +public class FactAgencyProjectMonthlyServiceImpl extends BaseServiceImpl implements FactAgencyProjectMonthlyService { + + +} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactGridProjectDailyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactGridProjectDailyServiceImpl.java new file mode 100644 index 0000000000..2665db9d91 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactGridProjectDailyServiceImpl.java @@ -0,0 +1,36 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service.stats.impl; + +import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.dao.stats.FactGridProjectDailyDao; +import com.epmet.entity.stats.FactGridProjectDailyEntity; +import com.epmet.service.stats.FactGridProjectDailyService; +import org.springframework.stereotype.Service; + +/** + * 网格下日项目数据统计表 存放机关下截止到当前日期的各项总数据以及昨日新增各项数据 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-06-16 + */ +@Service +public class FactGridProjectDailyServiceImpl extends BaseServiceImpl implements FactGridProjectDailyService { + + +} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactGridProjectMonthlyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactGridProjectMonthlyServiceImpl.java new file mode 100644 index 0000000000..e2f5fb654c --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactGridProjectMonthlyServiceImpl.java @@ -0,0 +1,36 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service.stats.impl; + +import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.dao.stats.FactGridProjectMonthlyDao; +import com.epmet.entity.stats.FactGridProjectMonthlyEntity; +import com.epmet.service.stats.FactGridProjectMonthlyService; +import org.springframework.stereotype.Service; + +/** + * 网格下月项目数据统计表 存放机关下截止到当前月份的各项总数据以及上月新增各项数据 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-06-16 + */ +@Service +public class FactGridProjectMonthlyServiceImpl extends BaseServiceImpl implements FactGridProjectMonthlyService { + + +} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/LastExecRecordServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/LastExecRecordServiceImpl.java new file mode 100644 index 0000000000..3e183a368b --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/LastExecRecordServiceImpl.java @@ -0,0 +1,45 @@ +package com.epmet.service.stats.impl; + +import com.epmet.dao.stats.LastExecRecordDao; +import com.epmet.entity.stats.LastExecRecordEntity; +import com.epmet.service.stats.LastExecRecordService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.Date; + +@Service +public class LastExecRecordServiceImpl implements LastExecRecordService { + @Autowired + private LastExecRecordDao lastExecRecordDao; + + public LastExecRecordEntity getLastExecRecord(String statsSubject) { + return lastExecRecordDao.getLastExecRecord(statsSubject); + } + + /** + * 创建末次执行记录 + * @param statsSubject + * @return + */ + @Override + public LastExecRecordEntity createLastExecRecord(String statsSubject) { + Date now = new Date(); + LastExecRecordEntity entity = new LastExecRecordEntity(); + entity.setExecTime(now); + entity.setSubject(statsSubject); + entity.setCreatedBy("APP_USER"); + entity.setUpdatedBy("APP_USER"); + entity.setCreatedTime(now); + entity.setUpdatedTime(now); + entity.setDelFlag("0"); + entity.setRevision(0); + lastExecRecordDao.insert(entity); + return entity; + } + + @Override + public void updateById(LastExecRecordEntity lastExecRecord) { + lastExecRecordDao.updateById(lastExecRecord); + } +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/voice/ArticlePublishRangeService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/voice/ArticlePublishRangeService.java new file mode 100644 index 0000000000..0f6ac51535 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/voice/ArticlePublishRangeService.java @@ -0,0 +1,46 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service.voice; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.dto.stats.ArticleGridPublishedSummaryDTO; +import com.epmet.entity.voice.ArticlePublishRangeEntity; + +import java.util.Date; +import java.util.List; + +/** + * 文章发布范围表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-06-17 + */ +public interface ArticlePublishRangeService extends BaseService { + + /** + * desc: 根据客户Id 、创建日期查询 发布范围数据 + * + * @param customerId + * @param createDate + * return: + * @date: 2020/6/17 16:59 + * @author: jianjun liu + * email:liujianjun@git.elinkit.com.cn + */ + List selectByCreatedDate(String customerId, Date createDate); +} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/voice/ArticleService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/voice/ArticleService.java new file mode 100644 index 0000000000..366e167ad1 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/voice/ArticleService.java @@ -0,0 +1,33 @@ +/** + * 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.voice; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.entity.voice.ArticleEntity; + +/** + * desc: 数据统计文章service + * + * return: + * @date: 2020/6/17 15:28 + * @author: jianjun liu + * email:liujianjun@git.elinkit.com.cn + */ +public interface ArticleService extends BaseService { + +} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/voice/impl/ArticlePublishRangeServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/voice/impl/ArticlePublishRangeServiceImpl.java new file mode 100644 index 0000000000..47b2e194ec --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/voice/impl/ArticlePublishRangeServiceImpl.java @@ -0,0 +1,47 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service.voice.impl; + +import com.epmet.commons.dynamic.datasource.annotation.DataSource; +import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.constant.DataSourceConstant; +import com.epmet.dao.voice.ArticlePublishRangeDao; +import com.epmet.dto.stats.ArticleGridPublishedSummaryDTO; +import com.epmet.entity.voice.ArticlePublishRangeEntity; +import com.epmet.service.voice.ArticlePublishRangeService; +import org.springframework.stereotype.Service; + +import java.util.Date; +import java.util.List; + +/** + * 文章发布范围表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-06-17 + */ +@Service +@DataSource(DataSourceConstant.GOV_VOICE) +public class ArticlePublishRangeServiceImpl extends BaseServiceImpl implements ArticlePublishRangeService { + + + @Override + public List selectByCreatedDate(String customerId, Date createDate) { + return baseDao.selectByCreatedDate(customerId,createDate); + } +} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/voice/impl/ArticleServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/voice/impl/ArticleServiceImpl.java new file mode 100644 index 0000000000..f1a788fc30 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/voice/impl/ArticleServiceImpl.java @@ -0,0 +1,41 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service.voice.impl; + +import com.epmet.commons.dynamic.datasource.annotation.DataSource; +import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.constant.DataSourceConstant; +import com.epmet.dao.voice.ArticleDao; +import com.epmet.entity.voice.ArticleEntity; +import com.epmet.service.voice.ArticleService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +/** + * 项目表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-05-11 + */ +@Service +@DataSource(DataSourceConstant.GOV_VOICE) +public class ArticleServiceImpl extends BaseServiceImpl implements ArticleService { + @Autowired + private ArticleDao articleDao; + +} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/bootstrap.yml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/bootstrap.yml index b25b8a540e..5bfa6c0bb7 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/bootstrap.yml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/bootstrap.yml @@ -61,19 +61,6 @@ spring: baseline-on-migrate: true baseline-version: 0 -#stats: -# datasources: -# - name: statsDatasource -# driver-class-name: com.mysql.cj.jdbc.Driver -# url: @datasource.druid.stats.url@ -# username: @datasource.druid.stats.username@ -# password: @datasource.druid.stats.password@ -# - name: orgDatasource -# driver-class-name: com.mysql.cj.jdbc.Driver -# url: @datasource.druid.org.url@ -# username: @datasource.druid.org.username@ -# password: @datasource.druid.org.password@ - management: endpoints: web: @@ -147,4 +134,22 @@ dynamic: driver-class-name: com.mysql.cj.jdbc.Driver url: @datasource.druid.project.url@ username: @datasource.druid.project.username@ - password: @datasource.druid.project.password@ \ No newline at end of file + password: @datasource.druid.project.password@ + govVoice: + driver-class-name: com.mysql.cj.jdbc.Driver + url: @datasource.druid.voice.url@ + username: @datasource.druid.voice.username@ + password: @datasource.druid.voice.password@ + operCrm: + driver-class-name: com.mysql.cj.jdbc.Driver + url: @datasource.druid.crm.url@ + username: @datasource.druid.crm.username@ + password: @datasource.druid.crm.password@ + +thread: + # 线程池配置 + threadPool: + corePoolSize: @thread.pool.core-pool-size@ + maxPoolSize: @thread.pool.max-pool-size@ + queueCapacity: @thread.pool.queue-capacity@ + keepAlive: @thread.pool.keep-alive@ \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/db/migration/data_statistical.sql b/epmet-module/data-statistical/data-statistical-server/src/main/resources/db/migration/data_statistical.sql new file mode 100644 index 0000000000..adeeac3769 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/db/migration/data_statistical.sql @@ -0,0 +1,650 @@ +/*================================ 宣传能力 ======================================*/ + +/* + Navicat Premium Data Transfer + + Source Server : localhost + Source Server Type : MySQL + Source Server Version : 50720 + Source Host : localhost:3306 + Source Schema : pd + + Target Server Type : MySQL + Target Server Version : 50720 + File Encoding : 65001 + + Date: 16/06/2020 18:04:53 +*/ + +SET NAMES utf8mb4; +SET FOREIGN_KEY_CHECKS = 0; + +-- ---------------------------- +-- Table structure for fact_article_published_agency_daily +-- ---------------------------- +DROP TABLE IF EXISTS `fact_article_published_agency_daily`; +CREATE TABLE `fact_article_published_agency_daily` ( + `ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ID ID', + `CUSTOMER_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '客户ID 客户ID', + `PID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '上级机关ID 上级机关ID', + `AGENCY_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '机关ID', + `ARTICLE_TOTAL_COUNT` int(11) NULL DEFAULT NULL COMMENT '文章累计发文数量 文章数量', + `ARTICLE_PUBLISHED_COUNT` int(11) NULL DEFAULT NULL COMMENT '当前发文数量 当前未下线的文章数量', + `DATE_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '日期ID 日期ID', + `WEEK_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '周ID 周ID eg:2020W01 = 2020年第一周', + `MONTH_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '月份ID 月份ID eg:202006 = 2020年6月、2020-07 = 2020年7月', + `QUARTER_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '季度ID 季度ID eg:2020Q1 = 2020年第一季度、2020Q2 = 2020年第二季度、2020Q3 = 2020年第三季度、2020Q4 = 2020年第四季度', + `YEAR_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '年度ID 年度ID eg:2020 = 2020年、2021 = 2021年', + `DEL_FLAG` int(11) NULL DEFAULT 0 COMMENT '删除状态', + `REVISION` int(11) NULL DEFAULT NULL COMMENT '乐观锁', + `CREATED_BY` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '创建人', + `CREATED_TIME` datetime(0) NULL DEFAULT NULL COMMENT '创建时间', + `UPDATED_BY` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '更新人', + `UPDATED_TIME` datetime(0) NULL DEFAULT NULL COMMENT '更新时间', + PRIMARY KEY (`ID`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '文章发布数量【机关】日统计表' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of fact_article_published_agency_daily +-- ---------------------------- + +-- ---------------------------- +-- Table structure for fact_article_published_department_daily +-- ---------------------------- +DROP TABLE IF EXISTS `fact_article_published_department_daily`; +CREATE TABLE `fact_article_published_department_daily` ( + `ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ID ID', + `CUSTOMER_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '客户ID 客户ID', + `AGENCY_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '发布文章单位所属机关ID 发布文章单位所属机关ID', + `DEPSARTMENT_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '部门ID', + `ARTICLE_TOTAL_COUNT` int(11) NULL DEFAULT NULL COMMENT '文章累计发文数量 文章数量', + `ARTICLE_PUBLISHED_COUNT` int(11) NULL DEFAULT NULL COMMENT '当前发文数量 当前未下线的文章数量', + `DATE_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '日期ID 日期ID', + `WEEK_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '周ID 周ID eg:2020W01 = 2020年第一周', + `MONTH_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '月份ID 月份ID eg:202006 = 2020年6月、2020-07 = 2020年7月', + `QUARTER_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '季度ID 季度ID eg:2020Q1 = 2020年第一季度、2020Q2 = 2020年第二季度、2020Q3 = 2020年第三季度、2020Q4 = 2020年第四季度', + `YEAR_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '年度ID 年度ID eg:2020 = 2020年、2021 = 2021年', + `DEL_FLAG` int(11) NULL DEFAULT 0 COMMENT '删除状态', + `REVISION` int(11) NULL DEFAULT NULL COMMENT '乐观锁', + `CREATED_BY` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '创建人', + `CREATED_TIME` datetime(0) NULL DEFAULT NULL COMMENT '创建时间', + `UPDATED_BY` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '更新人', + `UPDATED_TIME` datetime(0) NULL DEFAULT NULL COMMENT '更新时间', + PRIMARY KEY (`ID`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '文章发布数量【部门】日统计表' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of fact_article_published_department_daily +-- ---------------------------- + +-- ---------------------------- +-- Table structure for fact_article_published_grid_daily +-- ---------------------------- +DROP TABLE IF EXISTS `fact_article_published_grid_daily`; +CREATE TABLE `fact_article_published_grid_daily` ( + `ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ID ID', + `CUSTOMER_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '客户ID 客户ID', + `AGENCY_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '发布单位所属机关ID 发布单位所属机关ID', + `GRID_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '网格ID', + `ARTICLE_TOTAL_COUNT` int(11) NULL DEFAULT NULL COMMENT '文章累计发文数量 文章数量', + `ARTICLE_PUBLISHED_COUNT` int(11) NULL DEFAULT NULL COMMENT '当前发文数量 当前未下线的文章数量', + `DATE_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '日期ID 日期ID', + `WEEK_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '周ID 周ID eg:2020W01 = 2020年第一周', + `MONTH_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '月份ID 月份ID eg:202006 = 2020年6月、2020-07 = 2020年7月', + `QUARTER_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '季度ID 季度ID eg:2020Q1 = 2020年第一季度、2020Q2 = 2020年第二季度、2020Q3 = 2020年第三季度、2020Q4 = 2020年第四季度', + `YEAR_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '年度ID 年度ID eg:2020 = 2020年、2021 = 2021年', + `DEL_FLAG` int(11) NULL DEFAULT 0 COMMENT '删除状态', + `REVISION` int(11) NULL DEFAULT NULL COMMENT '乐观锁', + `CREATED_BY` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '创建人', + `CREATED_TIME` datetime(0) NULL DEFAULT NULL COMMENT '创建时间', + `UPDATED_BY` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '更新人', + `UPDATED_TIME` datetime(0) NULL DEFAULT NULL COMMENT '更新时间', + PRIMARY KEY (`ID`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '文章发布数量【网格】日统计表' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of fact_article_published_grid_daily +-- ---------------------------- + +-- ---------------------------- +-- Table structure for fact_tag_used_agency_daily +-- ---------------------------- +DROP TABLE IF EXISTS `fact_tag_used_agency_daily`; +CREATE TABLE `fact_tag_used_agency_daily` ( + `ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ID ID', + `CUSTOMER_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '客户ID 客户ID', + `PID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '上级机关ID 上级机关ID', + `AGENCY_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '机关ID', + `TAG_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '标签ID 标签ID', + `TAG_NAME` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '标签名称 标签名称', + `USED_COUNT` int(11) NULL DEFAULT NULL COMMENT '标签使用次数 标签的使用次数', + `DATE_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '日期ID 天ID eg:20200601 = 2020年6月1日、20200602 = 2020年6月2日', + `WEEK_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '周ID 周ID eg:2020W01 = 2020年第一周', + `MONTH_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '月份ID 月份ID eg:2020-06 = 2020年6月、2020-07 = 2020年7月', + `QUARTER_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '季度ID 季度ID eg:2020Q1 = 2020年第一季度、2020Q2 = 2020年第二季度、2020Q3 = 2020年第三季度、2020Q4 = 2020年第四季度', + `YEAR_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '年度ID 年度ID eg:2020 = 2020年、2021 = 2021年', + `DEL_FLAG` int(11) NULL DEFAULT 0 COMMENT '删除状态', + `REVISION` int(11) NULL DEFAULT NULL COMMENT '乐观锁', + `CREATED_BY` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '创建人', + `CREATED_TIME` datetime(0) NULL DEFAULT NULL COMMENT '创建时间', + `UPDATED_BY` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '更新人', + `UPDATED_TIME` datetime(0) NULL DEFAULT NULL COMMENT '更新时间', + PRIMARY KEY (`ID`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '标签【机关】日统计表' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of fact_tag_used_agency_daily +-- ---------------------------- + +-- ---------------------------- +-- Table structure for fact_tag_used_agency_monthly +-- ---------------------------- +DROP TABLE IF EXISTS `fact_tag_used_agency_monthly`; +CREATE TABLE `fact_tag_used_agency_monthly` ( + `ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ID ID', + `CUSTOMER_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '客户ID 客户ID', + `PID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '上级机关ID 上级机关ID', + `AGENCY_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '机关ID', + `TAG_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '标签ID 标签ID', + `TAG_NAME` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '标签名称 标签名称', + `USED_COUNT` int(11) NULL DEFAULT NULL COMMENT '标签使用次数 标签的使用次数', + `MONTH_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '月份ID 月份ID eg:202006 = 2020年6月、202007 = 2020年7月', + `DEL_FLAG` int(11) NULL DEFAULT 0 COMMENT '删除状态', + `REVISION` int(11) NULL DEFAULT NULL COMMENT '乐观锁', + `CREATED_BY` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '创建人', + `CREATED_TIME` datetime(0) NULL DEFAULT NULL COMMENT '创建时间', + `UPDATED_BY` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '更新人', + `UPDATED_TIME` datetime(0) NULL DEFAULT NULL COMMENT '更新时间', + PRIMARY KEY (`ID`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '标签【机关】月统计表' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of fact_tag_used_agency_monthly +-- ---------------------------- + +-- ---------------------------- +-- Table structure for fact_tag_used_agency_quarterly +-- ---------------------------- +DROP TABLE IF EXISTS `fact_tag_used_agency_quarterly`; +CREATE TABLE `fact_tag_used_agency_quarterly` ( + `ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ID ID', + `CUSTOMER_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '客户ID 客户ID', + `PID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '上级机关ID 上级机关ID', + `AGENCY_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '机关ID', + `TAG_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '标签ID 标签ID', + `TAG_NAME` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '标签名称 标签名称', + `USED_COUNT` int(11) NULL DEFAULT NULL COMMENT '标签使用次数 标签的使用次数', + `QUARTER_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '季度ID 季度ID eg:2020Q1 = 2020年第一季度、2020Q2 = 2020年第二季度、2020Q3 = 2020年第三季度、2020Q4 = 2020年第四季度', + `DEL_FLAG` int(11) NULL DEFAULT 0 COMMENT '删除状态', + `REVISION` int(11) NULL DEFAULT NULL COMMENT '乐观锁', + `CREATED_BY` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '创建人', + `CREATED_TIME` datetime(0) NULL DEFAULT NULL COMMENT '创建时间', + `UPDATED_BY` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '更新人', + `UPDATED_TIME` datetime(0) NULL DEFAULT NULL COMMENT '更新时间', + PRIMARY KEY (`ID`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '标签【机关】季度统计表' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of fact_tag_used_agency_quarterly +-- ---------------------------- + +-- ---------------------------- +-- Table structure for fact_tag_used_agency_yearly +-- ---------------------------- +DROP TABLE IF EXISTS `fact_tag_used_agency_yearly`; +CREATE TABLE `fact_tag_used_agency_yearly` ( + `ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ID ID', + `CUSTOMER_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '客户ID 客户ID', + `PID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '上级机关ID 上级机关ID', + `AGENCY_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '机关ID', + `TAG_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '标签ID 标签ID', + `TAG_NAME` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '标签名称 标签名称', + `USED_COUNT` int(11) NULL DEFAULT NULL COMMENT '标签使用次数 标签的使用次数', + `YEAR_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '年度ID 年度ID eg:2020 = 2020年、2021 = 2021年', + `DEL_FLAG` int(11) NULL DEFAULT 0 COMMENT '删除状态', + `REVISION` int(11) NULL DEFAULT NULL COMMENT '乐观锁', + `CREATED_BY` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '创建人', + `CREATED_TIME` datetime(0) NULL DEFAULT NULL COMMENT '创建时间', + `UPDATED_BY` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '更新人', + `UPDATED_TIME` datetime(0) NULL DEFAULT NULL COMMENT '更新时间', + PRIMARY KEY (`ID`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '标签【机关】年度统计表' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of fact_tag_used_agency_yearly +-- ---------------------------- + +-- ---------------------------- +-- Table structure for fact_tag_used_department_daily +-- ---------------------------- +DROP TABLE IF EXISTS `fact_tag_used_department_daily`; +CREATE TABLE `fact_tag_used_department_daily` ( + `ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ID ID', + `CUSTOMER_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '客户ID 客户ID', + `PID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '上级机关ID 上级机关ID', + `AGENCY_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '文章发布所属机关ID', + `DEPARTMENT_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '部门ID', + `TAG_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '标签ID 标签ID', + `TAG_NAME` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '标签名称 标签名称', + `USED_COUNT` int(11) NULL DEFAULT NULL COMMENT '标签使用次数 标签的使用次数', + `DATE_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '日期ID 天ID eg:20200601 = 2020年6月1日、20200602 = 2020年6月2日', + `WEEK_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '周ID 周ID eg:2020W01 = 2020年第一周', + `MONTH_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '月份ID 月份ID eg:202006 = 2020年6月、202007 = 2020年7月', + `QUARTER_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '季度ID 季度ID eg:2020Q1 = 2020年第一季度、2020Q2 = 2020年第二季度、2020Q3 = 2020年第三季度、2020Q4 = 2020年第四季度', + `YEAR_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '年度ID 年度ID eg:2020 = 2020年、2021 = 2021年', + `DEL_FLAG` int(11) NULL DEFAULT 0 COMMENT '删除状态', + `REVISION` int(11) NULL DEFAULT NULL COMMENT '乐观锁', + `CREATED_BY` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '创建人', + `CREATED_TIME` datetime(0) NULL DEFAULT NULL COMMENT '创建时间', + `UPDATED_BY` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '更新人', + `UPDATED_TIME` datetime(0) NULL DEFAULT NULL COMMENT '更新时间', + PRIMARY KEY (`ID`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '标签【部门】日统计表' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of fact_tag_used_department_daily +-- ---------------------------- + +-- ---------------------------- +-- Table structure for fact_tag_used_department_monthly +-- ---------------------------- +DROP TABLE IF EXISTS `fact_tag_used_department_monthly`; +CREATE TABLE `fact_tag_used_department_monthly` ( + `ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ID ID', + `CUSTOMER_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '客户ID 客户ID', + `AGENCY_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '文章发布所属机关ID 文章发布所属机关ID', + `DEPARTMENT_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '部门ID', + `TAG_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '标签ID 标签ID', + `TAG_NAME` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '标签名称 标签名称', + `USED_COUNT` int(11) NULL DEFAULT NULL COMMENT '标签使用次数 标签的使用次数', + `MONTH_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '月份ID 月份ID eg:202006 = 2020年6月、202007 = 2020年7月', + `DEL_FLAG` int(11) NULL DEFAULT 0 COMMENT '删除状态', + `REVISION` int(11) NULL DEFAULT NULL COMMENT '乐观锁', + `CREATED_BY` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '创建人', + `CREATED_TIME` datetime(0) NULL DEFAULT NULL COMMENT '创建时间', + `UPDATED_BY` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '更新人', + `UPDATED_TIME` datetime(0) NULL DEFAULT NULL COMMENT '更新时间', + PRIMARY KEY (`ID`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '标签【部门】月统计表' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of fact_tag_used_department_monthly +-- ---------------------------- + +-- ---------------------------- +-- Table structure for fact_tag_used_department_quarterly +-- ---------------------------- +DROP TABLE IF EXISTS `fact_tag_used_department_quarterly`; +CREATE TABLE `fact_tag_used_department_quarterly` ( + `ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ID ID', + `CUSTOMER_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '客户ID 客户ID', + `AGENCY_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '文章发布所属机关ID 文章发布所属机关ID', + `DEPARTMENT_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '部门ID', + `TAG_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '标签ID 标签ID', + `TAG_NAME` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '标签名称 标签名称', + `USED_COUNT` int(11) NULL DEFAULT NULL COMMENT '标签使用次数 标签的使用次数', + `QUARTER_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '季度ID 季度ID eg:2020Q1 = 2020年第一季度、2020Q2 = 2020年第二季度、2020Q3 = 2020年第三季度、2020Q4 = 2020年第四季度', + `DEL_FLAG` int(11) NULL DEFAULT 0 COMMENT '删除状态', + `REVISION` int(11) NULL DEFAULT NULL COMMENT '乐观锁', + `CREATED_BY` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '创建人', + `CREATED_TIME` datetime(0) NULL DEFAULT NULL COMMENT '创建时间', + `UPDATED_BY` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '更新人', + `UPDATED_TIME` datetime(0) NULL DEFAULT NULL COMMENT '更新时间', + PRIMARY KEY (`ID`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '标签【部门】季度统计表' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of fact_tag_used_department_quarterly +-- ---------------------------- + +-- ---------------------------- +-- Table structure for fact_tag_used_department_yearly +-- ---------------------------- +DROP TABLE IF EXISTS `fact_tag_used_department_yearly`; +CREATE TABLE `fact_tag_used_department_yearly` ( + `ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ID ID', + `CUSTOMER_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '客户ID 客户ID', + `AGENCY_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '文章发布所属机关ID 文章发布所属机关ID', + `DEPARTMENT_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '部门ID', + `TAG_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '标签ID 标签ID', + `TAG_NAME` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '标签名称 标签名称', + `USED_COUNT` int(11) NULL DEFAULT NULL COMMENT '标签使用次数 标签的使用次数', + `YEAR_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '年度ID 年度ID eg:2020 = 2020年、2021 = 2021年', + `DEL_FLAG` int(11) NULL DEFAULT 0 COMMENT '删除状态', + `REVISION` int(11) NULL DEFAULT NULL COMMENT '乐观锁', + `CREATED_BY` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '创建人', + `CREATED_TIME` datetime(0) NULL DEFAULT NULL COMMENT '创建时间', + `UPDATED_BY` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '更新人', + `UPDATED_TIME` datetime(0) NULL DEFAULT NULL COMMENT '更新时间', + PRIMARY KEY (`ID`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '标签【部门】年度统计表' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of fact_tag_used_department_yearly +-- ---------------------------- + +-- ---------------------------- +-- Table structure for fact_tag_used_grid_daily +-- ---------------------------- +DROP TABLE IF EXISTS `fact_tag_used_grid_daily`; +CREATE TABLE `fact_tag_used_grid_daily` ( + `ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ID ID', + `CUSTOMER_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '客户ID 客户ID', + `AGENCY_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '文章发布所属机关ID 文章发布所属机关ID', + `GRID_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '网格ID', + `TAG_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '标签ID 标签ID', + `TAG_NAME` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '标签名称 标签名称', + `USED_COUNT` int(11) NULL DEFAULT NULL COMMENT '标签使用次数 标签的使用次数', + `DATE_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '日期ID 天ID eg:20200601 = 2020年6月1日、20200602 = 2020年6月2日', + `WEEK_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '周ID 周ID eg:2020W01 = 2020年第一周', + `MONTH_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '月份ID 月份ID eg:202006 = 2020年6月、202007 = 2020年7月', + `QUARTER_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '季度ID 季度ID eg:2020Q1 = 2020年第一季度、2020Q2 = 2020年第二季度、2020Q3 = 2020年第三季度、2020Q4 = 2020年第四季度', + `YEAR_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '年度ID 年度ID eg:2020 = 2020年、2021 = 2021年', + `DEL_FLAG` int(11) NULL DEFAULT 0 COMMENT '删除状态', + `REVISION` int(11) NULL DEFAULT NULL COMMENT '乐观锁', + `CREATED_BY` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '创建人', + `CREATED_TIME` datetime(0) NULL DEFAULT NULL COMMENT '创建时间', + `UPDATED_BY` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '更新人', + `UPDATED_TIME` datetime(0) NULL DEFAULT NULL COMMENT '更新时间', + PRIMARY KEY (`ID`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '标签【网格】日统计表' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of fact_tag_used_grid_daily +-- ---------------------------- + +-- ---------------------------- +-- Table structure for fact_tag_used_grid_monthly +-- ---------------------------- +DROP TABLE IF EXISTS `fact_tag_used_grid_monthly`; +CREATE TABLE `fact_tag_used_grid_monthly` ( + `ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ID ID', + `CUSTOMER_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '客户ID 客户ID', + `AGENCY_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '文章发布所属机关ID 文章发布所属机关ID', + `GRID_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '网格ID', + `TAG_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '标签ID 标签ID', + `TAG_NAME` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '标签名称 标签名称', + `USED_COUNT` int(11) NULL DEFAULT NULL COMMENT '标签使用次数 标签的使用次数', + `MONTH_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '月份ID 月份ID eg:2020-06 = 2020年6月、2020-07 = 2020年7月', + `DEL_FLAG` int(11) NULL DEFAULT 0 COMMENT '删除状态', + `REVISION` int(11) NULL DEFAULT NULL COMMENT '乐观锁', + `CREATED_BY` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '创建人', + `CREATED_TIME` datetime(0) NULL DEFAULT NULL COMMENT '创建时间', + `UPDATED_BY` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '更新人', + `UPDATED_TIME` datetime(0) NULL DEFAULT NULL COMMENT '更新时间', + PRIMARY KEY (`ID`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '标签【网格】月统计表' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of fact_tag_used_grid_monthly +-- ---------------------------- + +-- ---------------------------- +-- Table structure for fact_tag_used_grid_quarterly +-- ---------------------------- +DROP TABLE IF EXISTS `fact_tag_used_grid_quarterly`; +CREATE TABLE `fact_tag_used_grid_quarterly` ( + `ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ID ID', + `CUSTOMER_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '客户ID 客户ID', + `AGENCY_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '文章发布所属机关ID 文章发布所属机关ID', + `GRID_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '网格ID', + `TAG_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '标签ID 标签ID', + `TAG_NAME` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '标签名称 标签名称', + `USED_COUNT` int(11) NULL DEFAULT NULL COMMENT '标签使用次数 标签的使用次数', + `QUARTER_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '季度ID 季度ID eg:2020Q1 = 2020年第一季度、2020Q2 = 2020年第二季度、2020Q3 = 2020年第三季度、2020Q4 = 2020年第四季度', + `DEL_FLAG` int(11) NULL DEFAULT 0 COMMENT '删除状态', + `REVISION` int(11) NULL DEFAULT NULL COMMENT '乐观锁', + `CREATED_BY` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '创建人', + `CREATED_TIME` datetime(0) NULL DEFAULT NULL COMMENT '创建时间', + `UPDATED_BY` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '更新人', + `UPDATED_TIME` datetime(0) NULL DEFAULT NULL COMMENT '更新时间', + PRIMARY KEY (`ID`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '标签【网格】季度统计表' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of fact_tag_used_grid_quarterly +-- ---------------------------- + +-- ---------------------------- +-- Table structure for fact_tag_used_grid_yearly +-- ---------------------------- +DROP TABLE IF EXISTS `fact_tag_used_grid_yearly`; +CREATE TABLE `fact_tag_used_grid_yearly` ( + `ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ID ID', + `CUSTOMER_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '客户ID 客户ID', + `AGENCY_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '文章发布所属机关ID 文章发布所属机关ID', + `GRID_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '网格ID', + `TAG_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '标签ID 标签ID', + `TAG_NAME` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '标签名称 标签名称', + `USED_COUNT` int(11) NULL DEFAULT NULL COMMENT '标签使用次数 标签的使用次数', + `YEAR_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '年度ID 年度ID eg:2020 = 2020年、2021 = 2021年', + `DEL_FLAG` int(11) NULL DEFAULT 0 COMMENT '删除状态', + `REVISION` int(11) NULL DEFAULT NULL COMMENT '乐观锁', + `CREATED_BY` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '创建人', + `CREATED_TIME` datetime(0) NULL DEFAULT NULL COMMENT '创建时间', + `UPDATED_BY` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '更新人', + `UPDATED_TIME` datetime(0) NULL DEFAULT NULL COMMENT '更新时间', + PRIMARY KEY (`ID`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '标签【网格】年度统计表' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of fact_tag_used_grid_yearly +-- ---------------------------- + +-- ---------------------------- +-- Table structure for fact_tag_viewed_agency_daily +-- ---------------------------- +DROP TABLE IF EXISTS `fact_tag_viewed_agency_daily`; +CREATE TABLE `fact_tag_viewed_agency_daily` ( + `ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ID ID', + `CUSTOMER_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '客户ID 客户ID', + `PID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '上级机关ID 上级机关ID', + `AGENCY_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '机关ID', + `TAG_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '标签ID 标签ID', + `TAG_NAME` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '标签名称 标签名称', + `TAG_READ_COUNT` int(11) NULL DEFAULT NULL COMMENT '文章引用标签阅读数 文章引用标签阅读数', + `DATE_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '日期ID 天数ID eg:20200601 = 2020年6月1日、20200602 = 2020年6月2日', + `WEEK_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '周ID 周ID eg:2020W01 = 2020年第一周', + `MONTH_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '月份ID 月份ID eg:202006 = 2020年6月、2020-07 = 2020年7月', + `QUARTER_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '季度ID 季度ID eg:2020Q1 = 2020年第一季度、2020Q2 = 2020年第二季度、2020Q3 = 2020年第三季度、2020Q4 = 2020年第四季度', + `YEAR_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '年度ID 年度ID eg:2020 = 2020年、2021 = 2021年', + `DEL_FLAG` int(11) NULL DEFAULT 0 COMMENT '删除状态', + `REVISION` int(11) NULL DEFAULT NULL COMMENT '乐观锁', + `CREATED_BY` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '创建人', + `CREATED_TIME` datetime(0) NULL DEFAULT NULL COMMENT '创建时间', + `UPDATED_BY` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '更新人', + `UPDATED_TIME` datetime(0) NULL DEFAULT NULL COMMENT '更新时间', + PRIMARY KEY (`ID`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '文章引用标签阅读数量【机关】日统计表' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of fact_tag_viewed_agency_daily +-- ---------------------------- + +-- ---------------------------- +-- Table structure for fact_tag_viewed_agency_monthly +-- ---------------------------- +DROP TABLE IF EXISTS `fact_tag_viewed_agency_monthly`; +CREATE TABLE `fact_tag_viewed_agency_monthly` ( + `ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ID ID', + `CUSTOMER_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '客户ID 客户ID', + `PID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '上级机关ID 上级机关ID', + `AGENCY_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '机关ID', + `TAG_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '标签ID 标签ID', + `TAG_NAME` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '标签名称 标签名称', + `TAG_READ_COUNT` int(11) NULL DEFAULT NULL COMMENT '文章引用标签阅读数 文章引用标签阅读数', + `MONTH_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '月份ID 月份ID eg:2020-06 = 2020年6月、2020-07 = 2020年7月', + `DEL_FLAG` int(11) NULL DEFAULT 0 COMMENT '删除状态', + `REVISION` int(11) NULL DEFAULT NULL COMMENT '乐观锁', + `CREATED_BY` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '创建人', + `CREATED_TIME` datetime(0) NULL DEFAULT NULL COMMENT '创建时间', + `UPDATED_BY` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '更新人', + `UPDATED_TIME` datetime(0) NULL DEFAULT NULL COMMENT '更新时间', + PRIMARY KEY (`ID`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '文章引用标签阅读数量【机关】月统计表' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of fact_tag_viewed_agency_monthly +-- ---------------------------- + +-- ---------------------------- +-- Table structure for fact_tag_viewed_agency_quarterly +-- ---------------------------- +DROP TABLE IF EXISTS `fact_tag_viewed_agency_quarterly`; +CREATE TABLE `fact_tag_viewed_agency_quarterly` ( + `ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ID ID', + `CUSTOMER_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '客户ID 客户ID', + `PID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '上级机关ID 上级机关ID', + `AGENCY_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '机关ID', + `TAG_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '标签ID 标签ID', + `TAG_NAME` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '标签名称 标签名称', + `TAG_READ_COUNT` int(11) NULL DEFAULT NULL COMMENT '文章引用标签阅读数 文章引用标签阅读数', + `QUARTER_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '季度ID 季度ID eg:2020Q1 = 2020年第一季度、2020Q2 = 2020年第二季度、2020Q3 = 2020年第三季度、2020Q4 = 2020年第四季度', + `DEL_FLAG` int(11) NULL DEFAULT 0 COMMENT '删除状态', + `REVISION` int(11) NULL DEFAULT NULL COMMENT '乐观锁', + `CREATED_BY` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '创建人', + `CREATED_TIME` datetime(0) NULL DEFAULT NULL COMMENT '创建时间', + `UPDATED_BY` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '更新人', + `UPDATED_TIME` datetime(0) NULL DEFAULT NULL COMMENT '更新时间', + PRIMARY KEY (`ID`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '文章引用标签阅读数量【机关】季度统计表' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of fact_tag_viewed_agency_quarterly +-- ---------------------------- + +-- ---------------------------- +-- Table structure for fact_tag_viewed_agency_yearly +-- ---------------------------- +DROP TABLE IF EXISTS `fact_tag_viewed_agency_yearly`; +CREATE TABLE `fact_tag_viewed_agency_yearly` ( + `ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ID ID', + `CUSTOMER_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '客户ID 客户ID', + `PID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '上级机关ID 上级机关ID', + `AGENCY_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '机关ID', + `TAG_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '标签ID 标签ID', + `TAG_NAME` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '标签名称 标签名称', + `TAG_READ_COUNT` int(11) NULL DEFAULT NULL COMMENT '文章引用标签阅读数 文章引用标签阅读数', + `YEAR_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '年度ID 年度ID eg:2020 = 2020年、2021 = 2021年', + `DEL_FLAG` int(11) NULL DEFAULT 0 COMMENT '删除状态', + `REVISION` int(11) NULL DEFAULT NULL COMMENT '乐观锁', + `CREATED_BY` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '创建人', + `CREATED_TIME` datetime(0) NULL DEFAULT NULL COMMENT '创建时间', + `UPDATED_BY` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '更新人', + `UPDATED_TIME` datetime(0) NULL DEFAULT NULL COMMENT '更新时间', + PRIMARY KEY (`ID`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '文章引用标签阅读数量【机关】年度统计表' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of fact_tag_viewed_agency_yearly +-- ---------------------------- + +-- ---------------------------- +-- Table structure for fact_tag_viewed_grid_daily +-- ---------------------------- +DROP TABLE IF EXISTS `fact_tag_viewed_grid_daily`; +CREATE TABLE `fact_tag_viewed_grid_daily` ( + `ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ID ID', + `CUSTOMER_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '客户ID 客户ID', + `AGENCY_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '文章发布所属机关ID 文章发布所属机关ID', + `GRID_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '网格ID', + `TAG_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '标签ID 标签ID', + `TAG_NAME` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '标签名称 标签名称', + `TAG_READ_COUNT` int(11) NULL DEFAULT NULL COMMENT '文章引用标签阅读数 文章引用标签阅读数', + `DATE_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '日期ID 天数ID eg:20200601 = 2020年6月1日、20200602 = 2020年6月2日', + `WEEK_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '周ID 周ID eg:2020W01 = 2020年第一周', + `MONTH_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '月份ID 月份ID eg:202006 = 2020年6月、2020-07 = 2020年7月', + `QUARTER_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '季度ID 季度ID eg:2020Q1 = 2020年第一季度、2020Q2 = 2020年第二季度、2020Q3 = 2020年第三季度、2020Q4 = 2020年第四季度', + `YEAR_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '年度ID 年度ID eg:2020 = 2020年、2021 = 2021年', + `DEL_FLAG` int(11) NULL DEFAULT 0 COMMENT '删除状态', + `REVISION` int(11) NULL DEFAULT NULL COMMENT '乐观锁', + `CREATED_BY` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '创建人', + `CREATED_TIME` datetime(0) NULL DEFAULT NULL COMMENT '创建时间', + `UPDATED_BY` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '更新人', + `UPDATED_TIME` datetime(0) NULL DEFAULT NULL COMMENT '更新时间', + PRIMARY KEY (`ID`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '文章引用标签阅读数量【网格】日统计表' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of fact_tag_viewed_grid_daily +-- ---------------------------- + +-- ---------------------------- +-- Table structure for fact_tag_viewed_grid_monthly +-- ---------------------------- +DROP TABLE IF EXISTS `fact_tag_viewed_grid_monthly`; +CREATE TABLE `fact_tag_viewed_grid_monthly` ( + `ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ID ID', + `CUSTOMER_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '客户ID 客户ID', + `AGENCY_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '文章发布所属机关ID 文章发布所属机关ID', + `GRID_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '网格ID', + `TAG_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '标签ID 标签ID', + `TAG_NAME` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '标签名称 标签名称', + `TAG_READ_COUNT` int(11) NULL DEFAULT NULL COMMENT '文章引用标签阅读数 文章引用标签阅读数', + `MONTH_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '月份ID 月份ID eg:2020-06 = 2020年6月、2020-07 = 2020年7月', + `DEL_FLAG` int(11) NULL DEFAULT 0 COMMENT '删除状态', + `REVISION` int(11) NULL DEFAULT NULL COMMENT '乐观锁', + `CREATED_BY` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '创建人', + `CREATED_TIME` datetime(0) NULL DEFAULT NULL COMMENT '创建时间', + `UPDATED_BY` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '更新人', + `UPDATED_TIME` datetime(0) NULL DEFAULT NULL COMMENT '更新时间', + PRIMARY KEY (`ID`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '文章引用标签阅读数量【网格】月统计表' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of fact_tag_viewed_grid_monthly +-- ---------------------------- + +-- ---------------------------- +-- Table structure for fact_tag_viewed_grid_quarterly +-- ---------------------------- +DROP TABLE IF EXISTS `fact_tag_viewed_grid_quarterly`; +CREATE TABLE `fact_tag_viewed_grid_quarterly` ( + `ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ID ID', + `CUSTOMER_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '客户ID 客户ID', + `AGENCY_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '文章发布所属机关ID 文章发布所属机关ID', + `GRID_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '网格ID', + `TAG_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '标签ID 标签ID', + `TAG_NAME` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '标签名称 标签名称', + `TAG_READ_COUNT` int(11) NULL DEFAULT NULL COMMENT '文章引用标签阅读数 文章引用标签阅读数', + `QUARTER_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '季度ID 季度ID eg:2020Q1 = 2020年第一季度、2020Q2 = 2020年第二季度、2020Q3 = 2020年第三季度、2020Q4 = 2020年第四季度', + `DEL_FLAG` int(11) NULL DEFAULT 0 COMMENT '删除状态', + `REVISION` int(11) NULL DEFAULT NULL COMMENT '乐观锁', + `CREATED_BY` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '创建人', + `CREATED_TIME` datetime(0) NULL DEFAULT NULL COMMENT '创建时间', + `UPDATED_BY` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '更新人', + `UPDATED_TIME` datetime(0) NULL DEFAULT NULL COMMENT '更新时间', + PRIMARY KEY (`ID`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '文章引用标签阅读数量【网格】季度统计表' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of fact_tag_viewed_grid_quarterly +-- ---------------------------- + +-- ---------------------------- +-- Table structure for fact_tag_viewed_grid_yearly +-- ---------------------------- +DROP TABLE IF EXISTS `fact_tag_viewed_grid_yearly`; +CREATE TABLE `fact_tag_viewed_grid_yearly` ( + `ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ID ID', + `CUSTOMER_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '客户ID 客户ID', + `AGENCY_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '文章发布所属机关ID 文章发布所属机关ID', + `GRID_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '网格ID', + `TAG_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '标签ID 标签ID', + `TAG_NAME` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '标签名称 标签名称', + `TAG_READ_COUNT` int(11) NULL DEFAULT NULL COMMENT '文章引用标签阅读数 文章引用标签阅读数', + `YEAR_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '年度ID 年度ID eg:2020 = 2020年、2021 = 2021年', + `DEL_FLAG` int(11) NULL DEFAULT 0 COMMENT '删除状态', + `REVISION` int(11) NULL DEFAULT NULL COMMENT '乐观锁', + `CREATED_BY` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '创建人', + `CREATED_TIME` datetime(0) NULL DEFAULT NULL COMMENT '创建时间', + `UPDATED_BY` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '更新人', + `UPDATED_TIME` datetime(0) NULL DEFAULT NULL COMMENT '更新时间', + PRIMARY KEY (`ID`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '文章引用标签阅读数量【网格】年度统计表' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of fact_tag_viewed_grid_yearly +-- ---------------------------- + +SET FOREIGN_KEY_CHECKS = 1; diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/crm/CustomerDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/crm/CustomerDao.xml new file mode 100644 index 0000000000..0aac258069 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/crm/CustomerDao.xml @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/CustomerDepartmentDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/CustomerDepartmentDao.xml new file mode 100644 index 0000000000..6d3bc43ce3 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/CustomerDepartmentDao.xml @@ -0,0 +1,19 @@ + + + + + + + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/CustomerGridDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/CustomerGridDao.xml new file mode 100644 index 0000000000..54e81a8d69 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/CustomerGridDao.xml @@ -0,0 +1,21 @@ + + + + + + + + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/StatsCustomerAgencyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/StatsCustomerAgencyDao.xml index 937233021b..3e22e1b5c3 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/StatsCustomerAgencyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/StatsCustomerAgencyDao.xml @@ -11,6 +11,20 @@ select * from customer_agency + + diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimAgencyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimAgencyDao.xml index c819753376..5ca1ddca1c 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimAgencyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimAgencyDao.xml @@ -4,6 +4,16 @@ - + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimCustomerDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimCustomerDao.xml index ed01bed0da..6cc8b750fd 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimCustomerDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimCustomerDao.xml @@ -4,6 +4,7 @@ - - + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimDateDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimDateDao.xml index 899d853e10..c0d460ae90 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimDateDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimDateDao.xml @@ -3,6 +3,32 @@ + + + + + INSERT INTO dim_date + (ID, DATE_NAME, DAY_OF_WEEK, DAY_OF_WEEK_NAME, WEEK_ID, DEL_FLAG, REVISION, CREATED_BY, CREATED_TIME, UPDATED_BY, UPDATED_TIME) + VALUES + (#{id}, #{dateName}, #{dayOfWeek}, #{dayOfWeekName}, #{weekId}, #{delFlag}, #{revision}, #{createdBy}, #{createdTime}, #{updatedBy}, #{updatedTime}) + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimGridDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimGridDao.xml index 6c1d1f28ca..67d130dfde 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimGridDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimGridDao.xml @@ -3,7 +3,13 @@ - + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactAgencyProjectDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactAgencyProjectDailyDao.xml new file mode 100644 index 0000000000..1b56baee0a --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactAgencyProjectDailyDao.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactAgencyProjectMonthlyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactAgencyProjectMonthlyDao.xml new file mode 100644 index 0000000000..15e59960ea --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactAgencyProjectMonthlyDao.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactGridProjectDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactGridProjectDailyDao.xml new file mode 100644 index 0000000000..42e8b29c51 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactGridProjectDailyDao.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactGridProjectMonthlyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactGridProjectMonthlyDao.xml new file mode 100644 index 0000000000..67b5a3bfdd --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactGridProjectMonthlyDao.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/LastExecRecordDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/LastExecRecordDao.xml new file mode 100755 index 0000000000..53f2846161 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/LastExecRecordDao.xml @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/voice/ArticleDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/voice/ArticleDao.xml new file mode 100644 index 0000000000..d411b3513e --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/voice/ArticleDao.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/voice/ArticlePublishRangeDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/voice/ArticlePublishRangeDao.xml new file mode 100644 index 0000000000..19691045f1 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/voice/ArticlePublishRangeDao.xml @@ -0,0 +1,40 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/InitTagFormDTO.java b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/InitTagFormDTO.java new file mode 100644 index 0000000000..c8517f896d --- /dev/null +++ b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/InitTagFormDTO.java @@ -0,0 +1,18 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + * desc:初始化/重新加载标签数据到数据库 + */ +@Data +public class InitTagFormDTO implements Serializable { + private static final long serialVersionUID = -4982447946629101341L; + /** + * 客户列表 list,非必填,如果不填则初始化或重新加载所有客户 + */ + private List customerIdList; +} 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 8bc0f69d21..fba5e29854 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 @@ -13,6 +13,15 @@ public class UpdateTagUseCountsResultDTO implements Serializable { private static final long serialVersionUID = -6331586672885417576L; + public UpdateTagUseCountsResultDTO() { + super(); + } + + public UpdateTagUseCountsResultDTO(String tagId, String tagName) { + this.tagId = tagId; + this.tagName = tagName; + } + /** * 标签id */ diff --git a/epmet-module/gov-voice/gov-voice-server/README.md b/epmet-module/gov-voice/gov-voice-server/README.md new file mode 100644 index 0000000000..0d08501df5 --- /dev/null +++ b/epmet-module/gov-voice/gov-voice-server/README.md @@ -0,0 +1,6 @@ +## epmet-cloud + +客户(网格)标签如果redis中需要重新加载数据到redis +执行以下命令: +参数:customerIdList 数组 非必填;不填则刷新全部客户 +curl -H "Content-Type:application/json" -X POST --data '{"customerIdList": ["客户ID"]}' http://localhost:8105/gov/voice/tag/inittag diff --git a/epmet-module/gov-voice/gov-voice-server/deploy/docker-compose-dev.yml b/epmet-module/gov-voice/gov-voice-server/deploy/docker-compose-dev.yml index 1295d20edb..80855c22df 100644 --- a/epmet-module/gov-voice/gov-voice-server/deploy/docker-compose-dev.yml +++ b/epmet-module/gov-voice/gov-voice-server/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: gov-voice-server: container_name: gov-voice-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/gov-voice-server:0.3.51 + image: 192.168.1.130:10080/epmet-cloud-dev/gov-voice-server:0.3.54 ports: - "8105:8105" network_mode: host # 使用现有网络 diff --git a/epmet-module/gov-voice/gov-voice-server/deploy/docker-compose-test.yml b/epmet-module/gov-voice/gov-voice-server/deploy/docker-compose-test.yml index a9b5649b95..36b6cb3e26 100644 --- a/epmet-module/gov-voice/gov-voice-server/deploy/docker-compose-test.yml +++ b/epmet-module/gov-voice/gov-voice-server/deploy/docker-compose-test.yml @@ -2,7 +2,7 @@ version: "3.7" services: gov-voice-server: container_name: gov-voice-server-test - image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-release/gov-voice-server:0.3.49 + image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-release/gov-voice-server:0.3.54 ports: - "8105:8105" network_mode: host # 使用现有网络 diff --git a/epmet-module/gov-voice/gov-voice-server/pom.xml b/epmet-module/gov-voice/gov-voice-server/pom.xml index b4c0e841a5..713902afb2 100644 --- a/epmet-module/gov-voice/gov-voice-server/pom.xml +++ b/epmet-module/gov-voice/gov-voice-server/pom.xml @@ -3,7 +3,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - 0.3.51 + 0.3.54 gov-voice com.epmet diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/constant/DraftConstant.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/constant/DraftConstant.java index b4d0f0f12f..6ee205ec7d 100644 --- a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/constant/DraftConstant.java +++ b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/constant/DraftConstant.java @@ -71,4 +71,9 @@ public interface DraftConstant { * 草稿预览内容大小长度 */ Integer PREVIEW_CONTENT_MAX_LENGTH = 50; + + /** + * 草稿预览内容超过50 添加... + */ + String PREVIEW_CONTENT_MORE = "..."; } diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/constant/TagConstant.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/constant/TagConstant.java index b5e1375746..f2de457976 100644 --- a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/constant/TagConstant.java +++ b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/constant/TagConstant.java @@ -15,30 +15,34 @@ package com.epmet.constant; */ public interface TagConstant { - /** +/* *//** * 客户维度(政府端) 热度标签 key的前缀 【zset】 - */ + * 完整key:GRID_TAG_KEY:客户ID + *//* String GOV_TAG_KEY = "epmet:tags:customer:rankingTag:"; - /** + *//** * 客户维度(政府端) 关联标签 key的前缀 【set】 - */ + * 完整key:GRID_TAG_KEY:标签ID + *//* String GOV_RETAG_KEY = "epmet:tags:customer:relationTag:"; - /** + *//** * 网格热度标签(居民端) key的前缀 【zset】 - */ + * 完整key:GRID_TAG_KEY:网格ID + *//* String GRID_TAG_KEY = "epmet:tags:grid:rankingTag:"; - /** + *//** * 网格关联标签(居民端) key的前缀 【set】 - */ + * 完整key:GRID_RETAG_KEY:网格ID:标签ID + *//* String GRID_RETAG_KEY ="epmet:tags:grid:relationTag:"; - /** + *//** * 冒号 - */ - String COLON = ":"; + *//* + String COLON = ":";*/ String BEGIN_UPDATE = "开始更新标签缓存... ..."; String SUCCESS_UPDATE = "更新标签缓存成功... ..."; diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/controller/TagController.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/controller/TagController.java index 5dbec6fa20..bd2603685b 100644 --- a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/controller/TagController.java +++ b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/controller/TagController.java @@ -1,12 +1,11 @@ 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.CorrelationTagListFormDTO; +import com.epmet.dto.form.InitTagFormDTO; import com.epmet.dto.form.ResiTagListFormDTO; import com.epmet.dto.form.TagCascadeListFormDTO; import com.epmet.dto.result.CorrelationTagListResultDTO; @@ -72,4 +71,14 @@ public class TagController { return new Result>().ok(tagService.tagCascadeList(formDto)); } + /** + * desc:初始化/重新加载 db标签到redis + * @param formDto + * @return + */ + @PostMapping("inittag") + public Result initTag(@RequestBody InitTagFormDTO formDto){ + return new Result().ok(tagService.initTag(formDto)); + } + } diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/dao/ArticlePublishRangeDao.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/dao/ArticlePublishRangeDao.java index 9d9ffa0830..9fe5fa1614 100644 --- a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/dao/ArticlePublishRangeDao.java +++ b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/dao/ArticlePublishRangeDao.java @@ -18,7 +18,6 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; -import com.epmet.dto.ArticlePublishRangeDTO; import com.epmet.entity.ArticlePublishRangeEntity; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -42,5 +41,10 @@ public interface ArticlePublishRangeDao extends BaseDao selectByArticleId(ArticlePublishRangeEntity rangeEntity); - + /** + * desc:获取网格发布的文章 用于初始化数据库标签数据到redis + * @param customerIdList + * @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/dao/ArticleTagsDao.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/dao/ArticleTagsDao.java index 4bba49e743..e6a006e166 100644 --- a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/dao/ArticleTagsDao.java +++ b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/dao/ArticleTagsDao.java @@ -40,5 +40,11 @@ public interface ArticleTagsDao extends BaseDao { * @author zxc */ void addArticleTags(@Param("addArticleTags")List addArticleTags); - + + /** + * desc:获取文章标签数据 用于初始化到redis + * @param customerIdList + * @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/dao/TagCustomerDao.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/dao/TagCustomerDao.java index ea9faaef02..edcc5ec3b5 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 @@ -49,4 +49,10 @@ public interface TagCustomerDao extends BaseDao { */ void initTags(@Param("tags") List tags); + /** + * desc:获取需要初始化的客户标签 + * @param customerIdList + * @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/dao/TagGridDao.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/dao/TagGridDao.java index 8dc949f8cd..26c393f3ce 100644 --- a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/dao/TagGridDao.java +++ b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/dao/TagGridDao.java @@ -40,5 +40,11 @@ public interface TagGridDao extends BaseDao { * @author zxc */ void updateGridTag(@Param("gridTags") List gridTags,@Param("userId")String userId); - + + /** + * desc:获取网格初始化数据 用于加载数据库数据到redis + * @param customerIdList + * @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/redis/TagRedis.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/redis/TagRedis.java index 47957e68dd..c8657af1a5 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 @@ -19,6 +19,7 @@ package com.epmet.redis; 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.constant.TagConstant; import com.epmet.dto.form.CorrelationTagListFormDTO; @@ -49,11 +50,28 @@ public class TagRedis { @Autowired private RedisTemplate redisTemplate; - public void delete(Object[] ids) { + private Long zAdd(String key,Set> value) { + return redisTemplate.opsForZSet().add(key,value); + } + /** + * desc:添加或修改客户标签排行 + * @param customerId + * @param value + * @return + */ + public Long zAddCustomerTag(String customerId,Set> value){ + return this.zAdd(RedisKeys.getCustomerTagKey(customerId),value); } - public void set(){ + /** + * desc:添加或修改网格标签排行 + * @param gridId + * @param value + * @return + */ + public Long zAddGridTag(String gridId,Set> value){ + return this.zAdd(RedisKeys.getGridTagKey(gridId),value); } /** @@ -70,14 +88,14 @@ public class TagRedis { if (tagIdList.size() > 1){ for (int i = NumConstant.ONE; i < tagIdList.size(); i++) { String tagId = tagIdList.get(i); - tagId = TagConstant.GOV_RETAG_KEY+customerId+TagConstant.COLON+tagId; + tagId = RedisKeys.getCustomerReTagKey(customerId,tagId); keys.add(tagId); } - String key = TagConstant.GOV_RETAG_KEY+customerId+TagConstant.COLON+tagIdList.get(0); + String key = RedisKeys.getCustomerReTagKey(customerId,tagIdList.get(0)); objects = redisUtils.intersect(key, keys); }else { // 查询关联标签数量 等于1条时 - String key = TagConstant.GOV_RETAG_KEY+customerId+TagConstant.COLON+tagIdList.get(0); + String key = RedisKeys.getCustomerReTagKey(customerId,tagIdList.get(0)); objects = redisUtils.sMembers(key); } List resultList = new ArrayList<>(); @@ -95,7 +113,7 @@ public class TagRedis { if (resultList.size() > NumConstant.ZERO) { long start = 0; long end = -1; - String customerKey = TagConstant.GOV_TAG_KEY + customerId; + String customerKey = RedisKeys.getCustomerTagKey(customerId); Set> typedTuples = redisUtils.zReverseRangeWithScores(customerKey, start, end); for (CorrelationTagListResultDTO correlationTagList : resultList) { for (ZSetOperations.TypedTuple typedTuple : typedTuples) { @@ -127,7 +145,7 @@ public class TagRedis { public List zRevRange(String key){ long start = 0; long end = -1; - String tagKey = TagConstant.GOV_TAG_KEY+key; + String tagKey = RedisKeys.getCustomerTagKey(key); Set objects = redisUtils.zRevRange(tagKey, start, end); if (objects.size()== NumConstant.ZERO){ return new ArrayList<>(); @@ -148,7 +166,7 @@ public class TagRedis { public List zGridRevRange(String key){ long start = 0; long end = -1; - String tagKey = TagConstant.GRID_TAG_KEY+key; + String tagKey = RedisKeys.getGridTagKey(key); Set objects = redisUtils.zRevRange(tagKey, start, end); if (objects.size()== NumConstant.ZERO){ return new ArrayList<>(); @@ -174,14 +192,14 @@ public class TagRedis { if (tagIdList.size() > 1){ for (int i = NumConstant.ONE; i < tagIdList.size(); i++) { String tagId = tagIdList.get(i); - tagId = TagConstant.GRID_RETAG_KEY+gridId+TagConstant.COLON+tagId; + tagId = RedisKeys.getGridReTagKey(gridId,tagId); keys.add(tagId); } - String key = TagConstant.GRID_RETAG_KEY+gridId+TagConstant.COLON+tagIdList.get(0); + String key = RedisKeys.getGridReTagKey(gridId,tagIdList.get(0)); objects = redisUtils.intersect(key, keys); }else { //当级联标签为一条时 - String key = TagConstant.GRID_RETAG_KEY+gridId+TagConstant.COLON+tagIdList.get(0); + String key = RedisKeys.getGridReTagKey(gridId,tagIdList.get(0)); objects = redisUtils.sMembers(key); } List resultList = new ArrayList<>(); @@ -198,8 +216,9 @@ public class TagRedis { if (resultList.size() > NumConstant.ZERO) { long start = 0; long end = -1; - String customerKey = TagConstant.GRID_TAG_KEY+formDto.getGridId(); - Set> typedTuples = redisUtils.zReverseRangeWithScores(customerKey, start, end); + String gridTagKey =RedisKeys.getGridTagKey(formDto.getGridId()); + + Set> typedTuples = redisUtils.zReverseRangeWithScores(gridTagKey, start, end); for (TagInfoResultDTO tagInfo : resultList) { for (ZSetOperations.TypedTuple typedTuple : typedTuples) { TagRankResultDTO tagRank = objectToDTO(typedTuple.getValue(), TagRankResultDTO.class); @@ -273,14 +292,11 @@ public class TagRedis { public void updateMoreTag(String key, Set value) { try { log.info(TagConstant.BEGIN_UPDATE); - redisTemplate.executePipelined(new RedisCallback>() { - @Override - public Set doInRedis(RedisConnection connection) throws DataAccessException { - for (UpdateTagUseCountsResultDTO tag : value) { - connection.sAdd(redisTemplate.getKeySerializer().serialize(key),redisTemplate.getValueSerializer().serialize(tag)); - } - return null; + redisTemplate.executePipelined((RedisCallback>) connection -> { + for (UpdateTagUseCountsResultDTO tag : value) { + connection.sAdd(redisTemplate.getKeySerializer().serialize(key),redisTemplate.getValueSerializer().serialize(tag)); } + return null; }); log.info(TagConstant.SUCCESS_UPDATE); }catch (Exception e){ diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/TagService.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/TagService.java index b78a9f837a..c4e3e85f49 100644 --- a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/TagService.java +++ b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/TagService.java @@ -2,6 +2,7 @@ package com.epmet.service; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.dto.form.CorrelationTagListFormDTO; +import com.epmet.dto.form.InitTagFormDTO; import com.epmet.dto.form.ResiTagListFormDTO; import com.epmet.dto.form.TagCascadeListFormDTO; import com.epmet.dto.result.CorrelationTagListResultDTO; @@ -40,4 +41,10 @@ public interface TagService { */ List tagCascadeList(TagCascadeListFormDTO formDto); + /** + * desc:初始化/重新加载 客户标签到redis,用于数据库与redis数据同步的 + * @param formDto + * @return + */ + Boolean initTag(InitTagFormDTO 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 37b6b60664..10c59c6450 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 @@ -26,6 +26,7 @@ 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.redis.RedisKeys; import com.epmet.commons.tools.scan.param.ImgScanParamDTO; import com.epmet.commons.tools.scan.param.ImgTaskDTO; import com.epmet.commons.tools.scan.param.TextScanParamDTO; @@ -226,7 +227,7 @@ public class ArticleServiceImpl extends BaseServiceImpl DraftConstant.PREVIEW_CONTENT_MAX_LENGTH) { - content = content.substring(NumConstant.ZERO, DraftConstant.PREVIEW_CONTENT_MAX_LENGTH); + content = content.substring(NumConstant.ZERO, DraftConstant.PREVIEW_CONTENT_MAX_LENGTH).concat(DraftConstant.PREVIEW_CONTENT_MORE); } break; } @@ -1196,14 +1197,14 @@ public class ArticleServiceImpl extends BaseServiceImpl { - String customerKey = TagConstant.GOV_TAG_KEY + customerId; + String customerKey = RedisKeys.getCustomerTagKey(customerId); tagRedis.updateTagUseCounts(customerKey, resultDTO); }); //政府端更新redis的级联标签(set) List tagsInfoCopy = new ArrayList<>(); for (int i = 0; i < tagsInfo.size(); i++) { tagsInfoCopy.addAll(tagsInfo); - String key = TagConstant.GOV_RETAG_KEY + customerId + TagConstant.COLON + tagsInfo.get(i).getTagId(); + String key = RedisKeys.getCustomerReTagKey(customerId, tagsInfo.get(i).getTagId()); tagsInfoCopy.remove(tagsInfo.get(i)); Set setTag = new HashSet<>(tagsInfoCopy); tagRedis.updateMoreTag(key, setTag); @@ -1259,7 +1260,7 @@ public class ArticleServiceImpl extends BaseServiceImpl gridTagCacheCopy = new ArrayList<>(); gridTagCache.forEach(cacheDTO -> { String gridId = cacheDTO.getGridId(); - String key = TagConstant.GRID_TAG_KEY + gridId; + String key = RedisKeys.getGridTagKey(gridId); List tagsInfo = cacheDTO.getTagsInfo(); tagsInfo.forEach(resultDTO -> { tagRedis.updateTagUseCounts(key, resultDTO); @@ -1267,7 +1268,7 @@ public class ArticleServiceImpl extends BaseServiceImpl setTag = new HashSet<>(gridTagCacheCopy); tagRedis.updateMoreTag(moreKey, setTag); diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/TagServiceImpl.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/TagServiceImpl.java index 19dcbf3d5d..e1fb6b092c 100644 --- a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/TagServiceImpl.java +++ b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/TagServiceImpl.java @@ -1,25 +1,33 @@ package com.epmet.service.impl; import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.constant.StrConstant; +import com.epmet.commons.tools.exception.RenException; +import com.epmet.commons.tools.redis.RedisKeys; import com.epmet.commons.tools.security.dto.TokenDto; -import com.epmet.constant.TagConstant; -import com.epmet.dao.ArticleDao; -import com.epmet.dao.TagCustomerDao; -import com.epmet.dao.TagDefaultDao; +import com.epmet.dao.*; import com.epmet.dto.form.*; import com.epmet.dto.result.CorrelationTagListResultDTO; import com.epmet.dto.result.TagInfoResultDTO; import com.epmet.dto.result.UpdateTagUseCountsResultDTO; +import com.epmet.entity.ArticlePublishRangeEntity; +import com.epmet.entity.ArticleTagsEntity; +import com.epmet.entity.TagCustomerEntity; +import com.epmet.entity.TagGridEntity; import com.epmet.redis.TagRedis; import com.epmet.service.TagService; +import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.redis.core.DefaultTypedTuple; +import org.springframework.data.redis.core.ZSetOperations; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.CollectionUtils; -import java.util.ArrayList; -import java.util.List; -import java.util.UUID; +import java.util.*; +import java.util.stream.Collectors; +@Slf4j @Service public class TagServiceImpl implements TagService { @@ -31,6 +39,12 @@ public class TagServiceImpl implements TagService { private TagDefaultDao tagDefaultDao; @Autowired private TagCustomerDao tagCustomerDao; + @Autowired + private ArticleTagsDao articleTagsDao; + @Autowired + private TagGridDao tagGridDao; + @Autowired + private ArticlePublishRangeDao articlePublishRangeDao; /** * @Description 已发布列表页的标签——政府端 @@ -76,7 +90,7 @@ public class TagServiceImpl implements TagService { InitTagsFormDTO tagInfo = new InitTagsFormDTO(); UpdateTagUseCountsResultDTO initTag = new UpdateTagUseCountsResultDTO(); UUID uuid = UUID.randomUUID(); - String replaceUuid = uuid.toString().replace("-", ""); + String replaceUuid = uuid.toString().replace(StrConstant.HYPHEN, ""); tagInfo.setId(replaceUuid); initTag.setTagId(replaceUuid); tagInfo.setTagName(tagName); @@ -86,7 +100,7 @@ public class TagServiceImpl implements TagService { initCacheTags.add(initTag); }); tagCustomerDao.initTags(tags); - String key = TagConstant.GOV_TAG_KEY+customerId; + String key = RedisKeys.getCustomerTagKey(customerId); tagRedis.initCacheTags(key,initCacheTags); return tagRedis.zRevRange(customerId); } @@ -118,4 +132,120 @@ public class TagServiceImpl implements TagService { } return tagRedis.getResiTag(formDto); } + + @Override + public Boolean initTag(InitTagFormDTO formDto) { + List customerTagList = tagCustomerDao.selectInitData(formDto.getCustomerIdList()); + if (CollectionUtils.isEmpty(customerTagList)) { + throw new RenException("客户标签数为空"); + } + + Map>> customerTag = new HashMap<>(); + customerTagList.stream().forEach(tag -> { + buildZset(customerTag, tag.getCustomerId(), tag.getId(), tag.getTagName(), tag.getUseCount()); + }); + + if (customerTag.size() > 0) { + customerTag.forEach((customerId, tagSet) -> tagRedis.zAddCustomerTag(customerId, tagSet)); + } + //key customerId:tagId + Map> reCustomerTagMap = new HashMap<>(); + List articleTagList = articleTagsDao.selectInitData(formDto.getCustomerIdList()); + Map> articleReTagMap = new HashMap<>(); + if (!CollectionUtils.isEmpty(articleTagList)) { + articleReTagMap = articleTagList.stream().collect(Collectors.groupingBy(ArticleTagsEntity::getArticleId)); + articleReTagMap.forEach((articleId, articleReTagList) -> { + buildReTag(reCustomerTagMap, articleReTagList); + }); + } + if (reCustomerTagMap.size() > 0) { + reCustomerTagMap.forEach((customerAndTagId, tagSet) -> { + String[] customerIdAndTagIdArr = customerAndTagId.split(StrConstant.COLON); + tagRedis.updateMoreTag(RedisKeys.getCustomerReTagKey(customerIdAndTagIdArr[0], customerIdAndTagIdArr[1]), tagSet); + }); + } + + + //初始化 网格级标签 + List gridTagList = tagGridDao.selectInitData(formDto.getCustomerIdList()); + if (CollectionUtils.isEmpty(gridTagList)) { + throw new RenException("网格标签数为空"); + } + customerTag.clear(); + gridTagList.stream().forEach(tag -> buildZset(customerTag, tag.getGridId(), tag.getTagId(), tag.getTagName(), tag.getUseCount())); + if (customerTag.size() > 0) { + customerTag.forEach((gridId, tagSet) -> tagRedis.zAddGridTag(gridId, tagSet)); + } + + //获取网格发布的文章 按网格排序 + List publishRangeTagList = articlePublishRangeDao.selectInitData(formDto.getCustomerIdList()); + if (CollectionUtils.isEmpty(publishRangeTagList)){ + log.error("publishRangeTagList return empty"); + return false; + } + //网格关联标签结果 key:gridId:tagId + Map> resultMap = new HashMap<>(); + Map> gridArticleListMap = publishRangeTagList.stream().collect(Collectors.groupingBy(ArticlePublishRangeEntity::getGridId)); + for (Map.Entry> entry : gridArticleListMap.entrySet()) { + String gridId = entry.getKey(); + List articleIdList = entry.getValue(); + for (ArticlePublishRangeEntity publishRange : articleIdList) { + List articleTagsEntities = articleReTagMap.get(publishRange.getArticleId()); + if (CollectionUtils.isEmpty(articleTagsEntities)){ + //该文章没有标签 + continue; + } + buildGridReTag(resultMap,gridId,articleTagsEntities); + } + } + if (resultMap.size() > 0) { + resultMap.forEach((gridIdAndTagId, tagSet) -> { + String[] gridIdAndTagIdArr = gridIdAndTagId.split(StrConstant.COLON); + tagRedis.updateMoreTag(RedisKeys.getGridReTagKey(gridIdAndTagIdArr[0],gridIdAndTagIdArr[1]), tagSet); + }); + } + return true; + } + + private void buildReTag(Map> reCustomerTagMap, List articleReTagList) { + articleReTagList.forEach(articleTag -> { + + String key = articleTag.getCustomerId().concat(StrConstant.COLON).concat(articleTag.getTagId()); + Set reTagSet = reCustomerTagMap.get(key); + if (reTagSet == null) { + reTagSet = new HashSet<>(); + reCustomerTagMap.put(key, reTagSet); + } + Set newReTagSet = articleReTagList.stream().filter(o -> !o.getTagId().equals(articleTag.getTagId())) + .map(tag -> new UpdateTagUseCountsResultDTO(tag.getTagId(), tag.getTagName())).collect(Collectors.toSet()); + reTagSet.addAll(newReTagSet); + }); + } + + private void buildGridReTag(Map> resultMap,String gridId, List articleReTagList) { + articleReTagList.forEach(articleTag -> { + String key = gridId.concat(StrConstant.COLON).concat(articleTag.getTagId()); + Set reTagSet = resultMap.get(key); + if (reTagSet == null) { + reTagSet = new HashSet<>(); + resultMap.put(key, reTagSet); + } + Set newReTagSet = articleReTagList.stream().filter(o -> !o.getTagId().equals(articleTag.getTagId())) + .map(tag -> new UpdateTagUseCountsResultDTO(tag.getTagId(), tag.getTagName())).collect(Collectors.toSet()); + reTagSet.addAll(newReTagSet); + }); + } + + private void buildZset(Map>> customerTag, String customerId, String id, String tagName, Integer useCount) { + Set> typedTupleSet = customerTag.get(customerId); + if (typedTupleSet == null) { + typedTupleSet = new HashSet<>(); + customerTag.put(customerId, typedTupleSet); + } + UpdateTagUseCountsResultDTO initTag = new UpdateTagUseCountsResultDTO(); + initTag.setTagId(id); + initTag.setTagName(tagName); + 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/resources/mapper/ArticlePublishRangeDao.xml b/epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/ArticlePublishRangeDao.xml index b80067be18..c58c230891 100644 --- a/epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/ArticlePublishRangeDao.xml +++ b/epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/ArticlePublishRangeDao.xml @@ -18,6 +18,22 @@ ORDER BY created_time ASC + \ No newline at end of file diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/ArticleTagsDao.xml b/epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/ArticleTagsDao.xml index 974966df8c..4995354629 100644 --- a/epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/ArticleTagsDao.xml +++ b/epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/ArticleTagsDao.xml @@ -12,5 +12,22 @@ #{tag.revision}, #{tag.createdBy}, NOW(),#{tag.updatedBy}, NOW()) + \ 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 edca182943..12da65d434 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 @@ -36,5 +36,22 @@ ON DUPLICATE KEY UPDATE UPDATED_TIME = NOW() + \ No newline at end of file diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/TagGridDao.xml b/epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/TagGridDao.xml index c3000b425c..c4b54c4dfa 100644 --- a/epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/TagGridDao.xml +++ b/epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/TagGridDao.xml @@ -17,5 +17,23 @@ UPDATED_TIME = NOW(), UPDATED_BY = #{userId} + \ No newline at end of file diff --git a/epmet-module/pom.xml b/epmet-module/pom.xml index 45ca155078..aa37ab3129 100644 --- a/epmet-module/pom.xml +++ b/epmet-module/pom.xml @@ -38,6 +38,7 @@ gov-voice resi-voice data-statistical - + data-report +