From 193560dcd660d2e1f2438d240dd66dd5a6a19fc4 Mon Sep 17 00:00:00 2001 From: wxz Date: Wed, 17 Jun 2020 18:23:05 +0800 Subject: [PATCH] =?UTF-8?q?1.=E6=96=B0=E5=A2=9E=EF=BC=9A=E6=9C=BA=E5=85=B3?= =?UTF-8?q?=E5=8D=95=E4=BD=8D=E7=BB=B4=E5=BA=A6=E5=88=9D=E5=A7=8B=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet/commons/tools/utils/DateUtils.java | 10 +++ .../epmet/constant/DatePatternConstant.java | 8 --- .../java/com/epmet/constant/StatsSubject.java | 66 +++++++++++++++++++ .../com/epmet/controller/DimController.java | 11 ++++ .../epmet/dao/org/StatsCustomerAgencyDao.java | 5 ++ .../epmet/dao/stats/LastExecRecordDao.java | 35 ++++++++++ .../entity/stats/LastExecRecordEntity.java | 51 ++++++++++++++ .../com/epmet/service/StatsDimService.java | 1 + .../service/impl/StatsDimServiceImpl.java | 38 +++++++++++ .../service/org/CustomerAgencyService.java | 10 +++ .../org/impl/CustomerAgencyServiceImpl.java | 25 +++++++ .../epmet/service/stats/DimAgencyService.java | 3 + .../epmet/service/stats/DimGridService.java | 1 + .../service/stats/LastExecRecordService.java | 10 +++ .../stats/impl/DimAgencyServiceImpl.java | 24 +++++++ .../stats/impl/DimDateServiceImpl.java | 3 - .../stats/impl/DimGridServiceImpl.java | 5 +- .../stats/impl/LastExecRecordServiceImpl.java | 45 +++++++++++++ .../mapper/org/StatsCustomerAgencyDao.xml | 14 ++++ .../mapper/stats/LastExecRecordDao.xml | 25 +++++++ epmet-module/pom.xml | 1 - 21 files changed, 377 insertions(+), 14 deletions(-) delete mode 100644 epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/constant/DatePatternConstant.java create mode 100644 epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/constant/StatsSubject.java create mode 100755 epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/LastExecRecordDao.java create mode 100755 epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/stats/LastExecRecordEntity.java create mode 100644 epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/CustomerAgencyService.java create mode 100644 epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/impl/CustomerAgencyServiceImpl.java create mode 100644 epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/LastExecRecordService.java create mode 100644 epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/LastExecRecordServiceImpl.java create mode 100755 epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/LastExecRecordDao.xml 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 616092ce1c..a83670615d 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 @@ -234,6 +234,16 @@ public class DateUtils { return dateTime.getWeekOfWeekyear(); } + /** + * 按照格式进行时间取整 + * @param targetDate + * @param pattern + * @return + */ + public static Date integrate(Date targetDate, String pattern) { + return DateUtils.parse(DateUtils.format(targetDate, pattern), pattern); + } + public static void main(String[] args) { //int weekOfYear = getWeekOfYear(new Date()); diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/constant/DatePatternConstant.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/constant/DatePatternConstant.java deleted file mode 100644 index 867752ebdc..0000000000 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/constant/DatePatternConstant.java +++ /dev/null @@ -1,8 +0,0 @@ -package com.epmet.constant; - -/** - * 日期格式常量 - */ -public interface DatePatternConstant { - -} 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-server/src/main/java/com/epmet/controller/DimController.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DimController.java index 9c53f16bab..d9439f5b67 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DimController.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DimController.java @@ -3,6 +3,7 @@ package com.epmet.controller; import com.epmet.commons.tools.utils.Result; import com.epmet.service.StatsDimService; import com.epmet.service.stats.DimDateService; +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; @@ -38,4 +39,14 @@ public class DimController { return new Result(); } + /** + * 初始化机关单位维度 + * @return + */ + @PostMapping("/agency/init") + public Result intiAgencyDim() { + statsDimService.initAgencyDim(); + return new Result(); + } + } 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 8e6b2330bd..58fbbac089 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 @@ -3,7 +3,9 @@ package com.epmet.dao.org; import com.epmet.commons.mybatis.dao.BaseDao; 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 @@ -11,4 +13,7 @@ public interface StatsCustomerAgencyDao extends BaseDao { List listAllEntities(); + List listAgenciesByCreateTime( + @Param("statsStartTime") Date statsStartTime, + @Param("statsEndTime") Date statsEndTime); } 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/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/service/StatsDimService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/StatsDimService.java index d678c16447..8e99082086 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/StatsDimService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/StatsDimService.java @@ -4,4 +4,5 @@ public interface StatsDimService { void initGridDim(); + void initAgencyDim(); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsDimServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsDimServiceImpl.java index 50a83f3489..b919440cbe 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsDimServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsDimServiceImpl.java @@ -1,11 +1,18 @@ package com.epmet.service.impl; import com.epmet.commons.tools.utils.DateUtils; +import com.epmet.constant.StatsSubject; +import com.epmet.dao.stats.LastExecRecordDao; +import com.epmet.entity.org.CustomerAgencyEntity; 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.org.CustomerAgencyService; import com.epmet.service.org.CustomerGridService; +import com.epmet.service.stats.DimAgencyService; import com.epmet.service.stats.DimGridService; +import com.epmet.service.stats.LastExecRecordService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -19,9 +26,18 @@ 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; + @Override public void initGridDim() { DimGridEntity lastCreatedGridDim = dimGridService.getLastCreatedGridDim(); @@ -65,4 +81,26 @@ public class StatsDimServiceImpl implements StatsDimService { 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); + } } 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/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/stats/DimAgencyService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/DimAgencyService.java index 87fcd68627..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; @@ -100,4 +101,6 @@ public interface DimAgencyService extends BaseService { * @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/DimGridService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/DimGridService.java index 989d20704b..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,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.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; 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 c9de98bb4f..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; @@ -108,4 +110,26 @@ public class DimAgencyServiceImpl extends BaseServiceImpl 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/DimDateServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/DimDateServiceImpl.java index 4ec6214798..5c3fdb96aa 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 @@ -24,17 +24,14 @@ 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.DatePatternConstant; 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.time.LocalDateTime; import java.util.*; /** 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 10f4dd0db2..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,6 +25,8 @@ 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; @@ -32,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; @@ -108,6 +111,4 @@ public class DimGridServiceImpl extends BaseServiceImpl select * from customer_agency + + \ 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/pom.xml b/epmet-module/pom.xml index 6a43dfe29f..aa37ab3129 100644 --- a/epmet-module/pom.xml +++ b/epmet-module/pom.xml @@ -39,7 +39,6 @@ resi-voice data-statistical data-report - data-report