21 changed files with 377 additions and 14 deletions
@ -1,8 +0,0 @@ |
|||||
package com.epmet.constant; |
|
||||
|
|
||||
/** |
|
||||
* 日期格式常量 |
|
||||
*/ |
|
||||
public interface DatePatternConstant { |
|
||||
|
|
||||
} |
|
@ -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"; |
||||
|
} |
@ -0,0 +1,35 @@ |
|||||
|
/** |
||||
|
* Copyright 2018 人人开源 https://www.renren.io
|
||||
|
* <p> |
||||
|
* This program is free software: you can redistribute it and/or modify |
||||
|
* it under the terms of the GNU General Public License as published by |
||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||
|
* (at your option) any later version. |
||||
|
* <p> |
||||
|
* This program is distributed in the hope that it will be useful, |
||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
* GNU General Public License for more details. |
||||
|
* <p> |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
*/ |
||||
|
|
||||
|
package com.epmet.dao.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> { |
||||
|
|
||||
|
LastExecRecordEntity getLastExecRecord(@Param("statsSubject") String statsSubject); |
||||
|
} |
@ -0,0 +1,51 @@ |
|||||
|
/** |
||||
|
* Copyright 2018 人人开源 https://www.renren.io
|
||||
|
* <p> |
||||
|
* This program is free software: you can redistribute it and/or modify |
||||
|
* it under the terms of the GNU General Public License as published by |
||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||
|
* (at your option) any later version. |
||||
|
* <p> |
||||
|
* This program is distributed in the hope that it will be useful, |
||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
* GNU General Public License for more details. |
||||
|
* <p> |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
*/ |
||||
|
|
||||
|
package com.epmet.entity.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; |
||||
|
|
||||
|
} |
@ -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<CustomerAgencyEntity> listAgenciesByCreateTime(Date statsStartTime, Date statsEndTime); |
||||
|
} |
@ -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<CustomerAgencyEntity> listAgenciesByCreateTime(Date statsStartTime, Date statsEndTime) { |
||||
|
return customerAgencyDao.listAgenciesByCreateTime(statsStartTime, statsEndTime); |
||||
|
} |
||||
|
} |
@ -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); |
||||
|
} |
@ -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); |
||||
|
} |
||||
|
} |
@ -0,0 +1,25 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
||||
|
|
||||
|
<mapper namespace="com.epmet.dao.stats.LastExecRecordDao"> |
||||
|
|
||||
|
<resultMap type="com.epmet.entity.stats.LastExecRecordEntity" id="lastExecRecordMap"> |
||||
|
<result property="id" column="ID"/> |
||||
|
<result property="subject" column="SUBJECT"/> |
||||
|
<result property="execTime" column="EXEC_TIME"/> |
||||
|
<result property="delFlag" column="DEL_FLAG"/> |
||||
|
<result property="revision" column="REVISION"/> |
||||
|
<result property="createdBy" column="CREATED_BY"/> |
||||
|
<result property="createdTime" column="CREATED_TIME"/> |
||||
|
<result property="updatedBy" column="UPDATED_BY"/> |
||||
|
<result property="updatedTime" column="UPDATED_TIME"/> |
||||
|
</resultMap> |
||||
|
|
||||
|
<select id="getLastExecRecord" resultType="com.epmet.entity.stats.LastExecRecordEntity"> |
||||
|
SELECT * |
||||
|
FROM last_exec_record |
||||
|
WHERE SUBJECT = #{statsSubject} |
||||
|
</select> |
||||
|
|
||||
|
|
||||
|
</mapper> |
Loading…
Reference in new issue