From 7574c09938aaed4e8d7babf9b2402fefda0042b5 Mon Sep 17 00:00:00 2001 From: wxz Date: Wed, 1 Jul 2020 00:00:31 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=BB=B4=E5=BA=A6=E5=88=9D?= =?UTF-8?q?=E5=A7=8B=E5=8C=96=E9=80=BB=E8=BE=91=EF=BC=8C=E6=A0=B9=E6=8D=AE?= =?UTF-8?q?createTime=EF=BC=8C=E8=8E=B7=E5=8F=96createTime(=E5=90=AB)?= =?UTF-8?q?=E5=88=B0now(=E4=B8=8D=E5=90=AB)=E4=B9=8B=E9=97=B4=E7=9A=84?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E6=8F=92=E5=85=A5=E7=BB=B4=E5=BA=A6=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../handler/FieldMetaObjectHandler.java | 26 +++++- .../com/epmet/dao/stats/DimAgencyDao.java | 1 + .../com/epmet/dao/stats/DimCustomerDao.java | 2 + .../java/com/epmet/dao/stats/DimDateDao.java | 2 +- .../com/epmet/dao/stats/DimDepartmentDao.java | 2 + .../java/com/epmet/dao/stats/DimMonthDao.java | 2 +- .../com/epmet/dao/stats/DimQuarterDao.java | 3 +- .../java/com/epmet/dao/stats/DimWeekDao.java | 3 +- .../java/com/epmet/dao/stats/DimYearDao.java | 2 + .../service/impl/StatsDimServiceImpl.java | 80 +++++++++---------- .../epmet/service/stats/DimAgencyService.java | 4 +- .../service/stats/DimCustomerService.java | 5 +- .../service/stats/DimDepartmentService.java | 5 +- .../stats/impl/DimAgencyServiceImpl.java | 19 +++-- .../stats/impl/DimCustomerServiceImpl.java | 9 ++- .../stats/impl/DimDateServiceImpl.java | 24 ++---- .../stats/impl/DimDepartmentServiceImpl.java | 9 ++- .../stats/impl/DimMonthServiceImpl.java | 21 ++--- .../stats/impl/DimQuarterServiceImpl.java | 25 ++---- .../stats/impl/DimWeekServiceImpl.java | 14 +--- .../stats/impl/DimYearServiceImpl.java | 19 +---- .../resources/mapper/stats/DimAgencyDao.xml | 20 +++++ .../resources/mapper/stats/DimCustomerDao.xml | 14 ++++ .../resources/mapper/stats/DimDateDao.xml | 2 +- .../mapper/stats/DimDepartmentDao.xml | 16 ++++ .../resources/mapper/stats/DimMonthDao.xml | 21 ++++- .../resources/mapper/stats/DimQuarterDao.xml | 19 ++++- .../resources/mapper/stats/DimWeekDao.xml | 21 ++++- .../resources/mapper/stats/DimYearDao.xml | 14 ++++ 29 files changed, 261 insertions(+), 143 deletions(-) diff --git a/epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/handler/FieldMetaObjectHandler.java b/epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/handler/FieldMetaObjectHandler.java index 1015ade75d..a5ea6a1a37 100644 --- a/epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/handler/FieldMetaObjectHandler.java +++ b/epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/handler/FieldMetaObjectHandler.java @@ -49,9 +49,9 @@ public class FieldMetaObjectHandler implements MetaObjectHandler { Date date = new Date(); if (metaObject.getOriginalObject() instanceof BaseEpmetEntity) { // epmet项目新增的 - setFieldValByName(FieldConstant.CREATED_TIME_HUMP, date, metaObject); + setFieldValByName(FieldConstant.CREATED_TIME_HUMP, getCreatedTimeByFieldValue(metaObject), metaObject); setFieldValByName(FieldConstant.CREATED_BY_HUMP, getCreatedByFieldValue(metaObject), metaObject); - setFieldValByName(FieldConstant.UPDATED_TIME_HUMP, date, metaObject); + setFieldValByName(FieldConstant.UPDATED_TIME_HUMP, getUpdatedTimeByFieldValue(metaObject), metaObject); setFieldValByName(FieldConstant.UPDATED_BY_HUMP, getUpdatedByFieldValue(metaObject), metaObject); setFieldValByName(FieldConstant.REVISION_HUMP, NumConstant.ZERO, metaObject); //删除标识 @@ -92,6 +92,28 @@ public class FieldMetaObjectHandler implements MetaObjectHandler { return value; } + public Object getCreatedTimeByFieldValue(MetaObject metaObject) { + Object createdTime = null; + if (metaObject.hasGetter(FieldConstant.CREATED_TIME_HUMP)) { + createdTime = metaObject.getValue(FieldConstant.CREATED_TIME_HUMP); + } + if (createdTime == null) { + createdTime = new Date(); + } + return createdTime; + } + + public Object getUpdatedTimeByFieldValue(MetaObject metaObject) { + Object createdTime = null; + if (metaObject.hasGetter(FieldConstant.CREATED_TIME_HUMP)) { + createdTime = metaObject.getValue(FieldConstant.CREATED_TIME_HUMP); + } + if (createdTime == null) { + createdTime = new Date(); + } + return createdTime; + } + public Object getUpdatedByFieldValue(MetaObject metaObject) { Object value = loginUserUtil.getLoginUserId(); if (value == null) { 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 7ed92bc461..419a54ef2c 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 @@ -123,4 +123,5 @@ public interface DimAgencyDao extends BaseDao { */ String getPidByAgencyId(@Param("agencyId") String agencyId); + DimAgencyEntity getLatestCreatedAgencyDimEntity(); } \ 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 b20779cd4c..1834b73ffc 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 @@ -45,4 +45,6 @@ public interface DimCustomerDao extends BaseDao { List selectCustomerIdPage(@Param("offset") Integer offset, @Param("pageSize") Integer pageSize); void insertOne(DimCustomerEntity dim); + + DimCustomerEntity getLatestCreatedDimEntity(); } \ 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 1075290163..5fd171160a 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 @@ -38,7 +38,7 @@ public interface DimDateDao extends BaseDao { /** * 最新的按日维度 */ - DimDateDTO getLatestDimDate(); + DimDateDTO getLatestDim(); int insertOne(DimDateEntity dimDateEntity); diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/DimDepartmentDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/DimDepartmentDao.java index c7848dffcb..5098869983 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/DimDepartmentDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/DimDepartmentDao.java @@ -40,4 +40,6 @@ public interface DimDepartmentDao extends BaseDao { * @return */ List getDepartmentListByCustomerId(@Param("customerId") String customerId); + + DimDepartmentEntity getLatestCreatedDimEntity(); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/DimMonthDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/DimMonthDao.java index b12c76a4f5..b9803ed69a 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/DimMonthDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/DimMonthDao.java @@ -29,5 +29,5 @@ import org.apache.ibatis.annotations.Mapper; */ @Mapper public interface DimMonthDao extends BaseDao { - + DimMonthEntity getLatestDimEntity(); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/DimQuarterDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/DimQuarterDao.java index f2ec40f5ce..4cf155caa2 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/DimQuarterDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/DimQuarterDao.java @@ -30,5 +30,6 @@ import org.apache.ibatis.annotations.Mapper; */ @Mapper public interface DimQuarterDao extends BaseDao { - + + DimQuarterEntity getLatestDimEntity(); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/DimWeekDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/DimWeekDao.java index ffabc979d6..e1dda5b48a 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/DimWeekDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/DimWeekDao.java @@ -29,5 +29,6 @@ import org.apache.ibatis.annotations.Mapper; */ @Mapper public interface DimWeekDao extends BaseDao { - + + DimWeekEntity getLatestDimEntity(); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/DimYearDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/DimYearDao.java index 7cfbedc4bf..09ecfb4d9c 100755 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/DimYearDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/DimYearDao.java @@ -30,4 +30,6 @@ import org.apache.ibatis.annotations.Mapper; @Mapper public interface DimYearDao extends BaseDao { int insertOne(DimYearEntity entity); + + DimYearEntity getLatestDimEntity(); } \ No newline at end of file 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 fc0241db68..dde7d9f14e 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 @@ -7,8 +7,7 @@ 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.entity.stats.*; import com.epmet.service.StatsDimService; import com.epmet.service.crm.CustomerService; import com.epmet.service.org.CustomerAgencyService; @@ -55,21 +54,18 @@ public class StatsDimServiceImpl implements StatsDimService { @Override public void initGridDim() { - DimGridEntity lastCreatedGridDim = dimGridService.getLastCreatedGridDim(); + DimGridEntity lastDimEntity = dimGridService.getLastCreatedGridDim(); List grids; - if (lastCreatedGridDim == null) { + Date now = new Date(); + if (lastDimEntity == null) { // 首次初始化 - grids = customerGridService.listGridsByCreateTime(null, null); + grids = customerGridService.listGridsByCreateTime(null, now); } else { - // 非首次初始化 - // 结束时间边界与开始时间边界,包含开始时间不包含结束时间。结束时间可以为空,则查询从开始时间往后的所有新创建网格 - Date startTimeBorder = DateUtils.parse(DateUtils.format(lastCreatedGridDim.getCreatedTime(), DateUtils.DATE_PATTERN_YYYYMMDD), DateUtils.DATE_PATTERN_YYYYMMDD); - Date endTimeBorder = DateUtils.parse(DateUtils.format(new Date(), DateUtils.DATE_PATTERN_YYYYMMDD), DateUtils.DATE_PATTERN_YYYYMMDD); - - grids = customerGridService.listGridsByCreateTime(startTimeBorder, endTimeBorder); + Date lastInitTime = lastDimEntity.getCreatedTime(); + grids = customerGridService.listGridsByCreateTime(lastInitTime, now); } - List gridDims = convertCustomerGrid2GridDim(grids); + List gridDims = convertCustomerGrid2GridDim(grids, now); if (!CollectionUtils.isEmpty(gridDims)) { dimGridService.initGridDims(gridDims); } @@ -78,9 +74,10 @@ public class StatsDimServiceImpl implements StatsDimService { /** * 将网格信息转换成网格维度信息 * @param grids + * @param initTime 创建时间会用来作为下一次查询的输入条件,因此必须和本次初始化查询的endTime一致 * @return */ - private List convertCustomerGrid2GridDim(List grids) { + private List convertCustomerGrid2GridDim(List grids, Date initTime) { return grids.stream().map(grid -> { DimGridEntity dimGrid = new DimGridEntity(); dimGrid.setAgencyId(grid.getPid()); @@ -90,6 +87,8 @@ public class StatsDimServiceImpl implements StatsDimService { dimGrid.setCreatedBy(RobotConstant.DIMENSION_ROBOT); dimGrid.setId(grid.getId()); dimGrid.setUpdatedBy(RobotConstant.DIMENSION_ROBOT); + dimGrid.setCreatedTime(initTime); + dimGrid.setUpdatedTime(initTime); return dimGrid; }).collect(Collectors.toList()); } @@ -99,20 +98,18 @@ public class StatsDimServiceImpl implements StatsDimService { */ @Override public void initAgencyDim() { - LastExecRecordEntity lastExecRecord = lastExecRecordService.getLastExecRecord(StatsSubject.DIM_AGENCY); - if (lastExecRecord == null) { - lastExecRecord = lastExecRecordService.createLastExecRecord(StatsSubject.DIM_AGENCY); - } + DimAgencyEntity latestCreatedAgencyDim = dimAgencyService.getLatestCreatedAgencyDimEntity(); - 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); + Date now = new Date(); + Date lastInitTime = null; + + if (latestCreatedAgencyDim != null) { + lastInitTime = latestCreatedAgencyDim.getCreatedTime(); } - List agencies = customerAgencyService.listAgenciesByCreateTime(statsStartTime, statsEndTime); + List agencies = customerAgencyService.listAgenciesByCreateTime(lastInitTime, now); if (!CollectionUtils.isEmpty(agencies)) { - dimAgencyService.initAgencyDims(agencies); + dimAgencyService.initAgencyDims(agencies, now); } } @@ -121,39 +118,36 @@ public class StatsDimServiceImpl implements StatsDimService { */ @Override public void initCustomerDim() { - LastExecRecordEntity lastExecRecord = lastExecRecordService.getLastExecRecord(StatsSubject.DIM_CUSTOMER); - if (lastExecRecord == null) { - lastExecRecord = lastExecRecordService.createLastExecRecord(StatsSubject.DIM_CUSTOMER); - } + DimCustomerEntity lastCreateDim = dimCustomerService.getLatestCreatedDimEntity(); - 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); + Date now = new Date(); + Date lastInitTime = null; + + if (lastCreateDim != null) { + lastInitTime = lastCreateDim.getCreatedTime(); } - List customers = customerService.listValidCustomersByCreateTime(statsStartTime, statsEndTime); + List customers = customerService.listValidCustomersByCreateTime(lastInitTime, now); if (!CollectionUtils.isEmpty(customers)) { - dimCustomerService.initCustomerDims(customers); + dimCustomerService.initCustomerDims(customers, now); } } @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); + DimDepartmentEntity lastCreatedDeptDim = dimDepartmentService.getLatestCreatedDimEntity(); + + Date now = new Date(); + Date lastInitTime = null; + + if (lastCreatedDeptDim != null) { + lastInitTime = lastCreatedDeptDim.getCreatedTime(); } - List departments = departmentService.listDepartmentsByCreatedTime(statsStartTime, statsEndTime); + List departments = departmentService.listDepartmentsByCreatedTime(lastInitTime, now); if (!CollectionUtils.isEmpty(departments)) { - dimDepartmentService.initDepartmentDims(departments); + dimDepartmentService.initDepartmentDims(departments, now); } } } 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 8d4e8d938d..df58489fd0 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 @@ -109,7 +109,7 @@ public interface DimAgencyService extends BaseService { * 初始化机关维度 * @param agencies */ - void initAgencyDims(List agencies); + void initAgencyDims(List agencies, Date initTime); /** * @Description 查询所有机关以及它下级机关的信息 @@ -173,4 +173,6 @@ public interface DimAgencyService extends BaseService { * @author zxc */ String getPidByAgencyId(String agencyId); + + DimAgencyEntity getLatestCreatedAgencyDimEntity(); } \ 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 a2d7aadaf5..d3562d01db 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 @@ -24,6 +24,7 @@ import com.epmet.entity.crm.CustomerEntity; import com.epmet.entity.org.CustomerDepartmentEntity; import com.epmet.entity.stats.DimCustomerEntity; +import java.util.Date; import java.util.List; import java.util.Map; @@ -111,5 +112,7 @@ public interface DimCustomerService extends BaseService { * 添加客户维度 * @param customers */ - void initCustomerDims(List customers); + void initCustomerDims(List customers, Date initTime); + + DimCustomerEntity getLatestCreatedDimEntity(); } \ 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 7bf0b63b7c..fe839ac0c9 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 @@ -23,6 +23,7 @@ import com.epmet.dto.stats.DimDepartmentDTO; import com.epmet.entity.org.CustomerDepartmentEntity; import com.epmet.entity.stats.DimDepartmentEntity; +import java.util.Date; import java.util.List; import java.util.Map; @@ -94,7 +95,7 @@ public interface DimDepartmentService extends BaseService { */ void delete(String[] ids); - void initDepartmentDims(List departments); + void initDepartmentDims(List departments, Date initTime); /** * desc: 根据客户Id获取 部门数据 @@ -105,4 +106,6 @@ public interface DimDepartmentService extends BaseService { * @author: jianjun liu */ List getDepartmentListByCustomerId(String customerId); + + DimDepartmentEntity getLatestCreatedDimEntity(); } \ No newline at end of file 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 fe45c20ddc..0d21b5525f 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 @@ -123,16 +123,16 @@ public class DimAgencyServiceImpl extends BaseServiceImpl agencies) { + public void initAgencyDims(List agencies, Date initTime) { for (CustomerAgencyEntity agency : agencies) { - initAgencyAllDim(agency); - initAgencySelfDim(agency); + initAgencyAllDim(agency, initTime); + initAgencySelfDim(agency, initTime); } lastExecRecordDao.updateExecTimeBySubject(new Date(), StatsSubject.DIM_AGENCY); } - public void initAgencyAllDim(CustomerAgencyEntity agency) { + public void initAgencyAllDim(CustomerAgencyEntity agency, Date initTime) { DimAgencyEntity dimAgencyEntity = new DimAgencyEntity(); dimAgencyEntity.setAgencyName(agency.getOrganizationName()); dimAgencyEntity.setAllParentName(agency.getAllParentName()); @@ -144,6 +144,8 @@ public class DimAgencyServiceImpl extends BaseServiceImpl customers) { + public void initCustomerDims(List customers, Date initTime) { for (CustomerEntity customer : customers) { DimCustomerEntity dim = new DimCustomerEntity(); dim.setCustomerName(customer.getCustomerName()); dim.setCreatedBy(RobotConstant.DIMENSION_ROBOT); dim.setUpdatedBy(RobotConstant.DIMENSION_ROBOT); dim.setId(customer.getId()); + dim.setCreatedTime(initTime); + dim.setUpdatedTime(initTime); baseDao.insert(dim); } lastExecRecordDao.updateExecTimeBySubject(new Date(), StatsSubject.DIM_CUSTOMER); } + + @Override + public DimCustomerEntity getLatestCreatedDimEntity() { + return baseDao.getLatestCreatedDimEntity(); + } } \ 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 15ae161fbb..b754794b8a 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 @@ -108,28 +108,20 @@ public class DimDateServiceImpl extends BaseServiceImpl departments) { + public void initDepartmentDims(List departments, Date initTime) { for (CustomerDepartmentEntity department : departments) { DimDepartmentEntity dim = new DimDepartmentEntity(); dim.setAgencyId(department.getAgencyId()); @@ -118,6 +118,8 @@ public class DimDepartmentServiceImpl extends BaseServiceImpl + + \ 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 120be8603a..7b8ad49e3c 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 @@ -11,4 +11,18 @@ + + \ 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 ad531351b0..d7a0fb2d23 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 @@ -4,7 +4,7 @@ - SELECT * FROM dim_date WHERE DEL_FLAG = 0 diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimDepartmentDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimDepartmentDao.xml index 8941d496fd..68de10bef6 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimDepartmentDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimDepartmentDao.xml @@ -19,4 +19,20 @@ WHERE DEL_FLAG = '0' AND CUSTOMER_ID = #{customerId,jdbcType=VARCHAR} + + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimMonthDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimMonthDao.xml index ffffa6903e..ffd2f0fd31 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimMonthDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimMonthDao.xml @@ -2,7 +2,22 @@ - - - + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimQuarterDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimQuarterDao.xml index e9a609876a..7a8e2a9de4 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimQuarterDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimQuarterDao.xml @@ -3,6 +3,21 @@ - - + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimWeekDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimWeekDao.xml index 04575603f2..a0897440f0 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimWeekDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimWeekDao.xml @@ -2,8 +2,21 @@ - - - - + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimYearDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimYearDao.xml index bfe7f01551..d34dabcc5d 100755 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimYearDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimYearDao.xml @@ -21,5 +21,19 @@ (#{id}, #{yearName}, #{delFlag}, #{revision}, #{createdBy}, #{createdTime}, #{updatedBy}, #{updatedTime}) + + \ No newline at end of file