From c6489e4d08e4e0389e8fbf264cb5fd1bf1dca4d6 Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Thu, 18 Jun 2020 15:34:19 +0800 Subject: [PATCH] =?UTF-8?q?=E6=95=B0=E6=8D=AE-=E9=A1=B9=E7=9B=AE-=E6=9C=BA?= =?UTF-8?q?=E5=85=B3=E6=9C=88=E7=BB=9F=E8=AE=A1-=E9=83=A8=E5=88=86?= =?UTF-8?q?=E4=BB=A3=E7=A0=81=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../project/form/MonthProjectListFormDTO.java | 37 ++++ .../com/epmet/dto/project/result/.gitkeep | 0 .../java/com/epmet/dao/stats/DimDateDao.java | 8 - .../dao/stats/FactAgencyProjectDailyDao.java | 18 +- .../stats/FactAgencyProjectMonthlyDao.java | 9 +- .../service/impl/StatsProjectServiceImpl.java | 176 +++++++++++++++--- .../epmet/service/stats/DimDateService.java | 8 - .../stats/FactAgencyProjectDailyService.java | 16 ++ .../FactAgencyProjectMonthlyService.java | 7 + .../stats/impl/DimDateServiceImpl.java | 11 -- .../FactAgencyProjectDailyServiceImpl.java | 22 +++ .../FactAgencyProjectMonthlyServiceImpl.java | 11 +- .../resources/mapper/stats/DimDateDao.xml | 13 -- .../stats/FactAgencyProjectDailyDao.xml | 24 +++ .../stats/FactAgencyProjectMonthlyDao.xml | 9 +- 15 files changed, 296 insertions(+), 73 deletions(-) create mode 100644 epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/project/form/MonthProjectListFormDTO.java create mode 100644 epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/project/result/.gitkeep diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/project/form/MonthProjectListFormDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/project/form/MonthProjectListFormDTO.java new file mode 100644 index 0000000000..4b47eb0237 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/project/form/MonthProjectListFormDTO.java @@ -0,0 +1,37 @@ +package com.epmet.dto.project.form; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** + * @Author sun + * 查询项目机关过去一个月的日统计数据 + */ +@Data +public class MonthProjectListFormDTO implements Serializable { + + private static final long serialVersionUID = -3634745091993094743L; + + /** + * 客户Id + */ + private String customerId; + + /** + * 机关Id + */ + private String agencyId; + + /** + * 起始时间 + */ + private Date startTime; + + /** + * 结束时间 + */ + private Date endTime; + +} diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/project/result/.gitkeep b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/project/result/.gitkeep new file mode 100644 index 0000000000..e69de29bb2 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 f9091f4be4..1075290163 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 @@ -35,14 +35,6 @@ import java.util.List; @Mapper public interface DimDateDao extends BaseDao { - /** - * @param dto - * @return - * @Author sun - * @Description 根据创建时间查询日维度信息 - **/ - List selectDimDate(DimDateDTO dto); - /** * 最新的按日维度 */ 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 index 6e961d85c9..2fbabdec6c 100644 --- 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 @@ -18,9 +18,12 @@ package com.epmet.dao.stats; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.project.form.MonthProjectListFormDTO; import com.epmet.entity.stats.FactAgencyProjectDailyEntity; import org.apache.ibatis.annotations.Mapper; +import java.util.List; + /** * 机关下日项目数据统计 存放机关下截止到当前日期的各项总数据以及昨日新增各项数据 * @@ -29,5 +32,18 @@ import org.apache.ibatis.annotations.Mapper; */ @Mapper public interface FactAgencyProjectDailyDao extends BaseDao { - + + /** + * @param formDTO + * @Author sun + * @Description 查询上一月机关日统计数据,按时间倒序 + **/ + List selectMonthProjectList(MonthProjectListFormDTO formDTO); + + /** + * @param delEntity + * @Author sun + * @Description 根据客户Id、日维度Id批量物理删除一下可能存在的历史数据 + **/ + void delDateProject(FactAgencyProjectDailyEntity delEntity); } \ 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 index 6cd1e39250..e6fb0c37b7 100644 --- 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 @@ -29,5 +29,12 @@ import org.apache.ibatis.annotations.Mapper; */ @Mapper public interface FactAgencyProjectMonthlyDao extends BaseDao { - + + /** + * @param delEntity + * @return + * @Author sun + * @Description 根据客户Id、月份Id批量物理删除可能存在的历史数据 + **/ + void delMonthProject(FactAgencyProjectMonthlyEntity delEntity); } \ No newline at end of file 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 6b20e06655..433a951a0c 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,16 +2,20 @@ package com.epmet.service.impl; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.constant.ProjectConstant; +import com.epmet.dto.project.form.MonthProjectListFormDTO; import com.epmet.dto.stats.DimAgencyDTO; import com.epmet.dto.stats.DimDateDTO; import com.epmet.entity.project.ProjectEntity; import com.epmet.entity.project.ProjectProcessEntity; import com.epmet.entity.stats.DimDateEntity; import com.epmet.entity.stats.FactAgencyProjectDailyEntity; +import com.epmet.entity.stats.FactAgencyProjectMonthlyEntity; import com.epmet.service.StatsProjectService; import com.epmet.service.project.ProjectProcessService; import com.epmet.service.project.ProjectService; import com.epmet.service.stats.*; +import com.epmet.util.DimIdGenerator; +import oracle.sql.NUMBER; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -63,13 +67,20 @@ public class StatsProjectServiceImpl implements StatsProjectService { **/ @Override public void statsAgencyProject(String customerId) { - //1:执行机关日数据统计 - agencyDateProjectStats(customerId); - //2:执行机关月数据统计 - if (Calendar.getInstance().get(Calendar.DATE) == 1) { - agencyMonthProjectStats(customerId); - } + //1:根据客户Id查询机关维度表数据 + DimAgencyDTO dimAgencyDTO = new DimAgencyDTO(); + dimAgencyDTO.setCustomerId(customerId); + List dimAgencyList = dimAgencyService.getDimAgencyList(dimAgencyDTO); + + if (null != dimAgencyList && dimAgencyList.size() > NumConstant.ZERO) { + //2:执行机关日数据统计 + agencyDateProjectStats(customerId, dimAgencyList); + //3:执行机关月数据统计 + if (Calendar.getInstance().get(Calendar.DATE) == 1) { + agencyMonthProjectStats(customerId, dimAgencyList); + } + } } /** @@ -77,28 +88,18 @@ public class StatsProjectServiceImpl implements StatsProjectService { * @Author sun * @Description 数据-项目-机关日统计 **/ - private String agencyDateProjectStats(String customerId) { + private String agencyDateProjectStats(String customerId, List dimAgencyList) { Date date = yesterDay(); - //1:查询各维度表Id,方便使用 //TODO - DimDateDTO dimDateDTO = new DimDateDTO(); - dimDateDTO.setCreatedTime(date); - dimDateDTO = dimDateService.getDimDate(dimDateDTO).get(0); - - //2:根据客户Id查询机关维度表数据 - DimAgencyDTO dimAgencyDTO = new DimAgencyDTO(); - dimAgencyDTO.setCustomerId(customerId); - List dimAgencyList = dimAgencyService.getDimAgencyList(dimAgencyDTO); - if (null == dimAgencyList || dimAgencyList.size() < NumConstant.ONE) { - return null; - } + //1:查询各维度表Id,方便使用 + DimIdGenerator.DimIdBean dimId = DimIdGenerator.getDimIdBean(yesterDay()); - //3:根据客户Id查询项目业务表数据 + //2:根据客户Id查询项目业务表数据 List projectList = projectService.getProjectList(customerId); - //4:查询项目处理进展表中是创建项目和结案两种进展的有效数据(创建日期截取yyyy-mm-dd格式字段值) + //3:查询项目处理进展表中是创建项目和结案两种进展的有效数据(创建日期截取yyyy-mm-dd格式字段值) List processList = projectProcessService.getProcessList(customerId); - //5:遍历统计每个机关各项指标数 + //4:遍历统计每个机关各项指标数 //批量机关日统计新增对象 List dimDateEntityList = new ArrayList<>(); //计算百分比使用,保留小数点后两位 @@ -172,11 +173,10 @@ public class StatsProjectServiceImpl implements StatsProjectService { agencyDailyEntity.setCustomerId(customerId); agencyDailyEntity.setAgencyId(agency.getId()); agencyDailyEntity.setParentId(agency.getPid()); - //TODO - agencyDailyEntity.setDateId(""); - agencyDailyEntity.setWeekId(""); - agencyDailyEntity.setMonthId(""); - agencyDailyEntity.setYearId(""); + agencyDailyEntity.setDateId(dimId.getDateId()); + agencyDailyEntity.setWeekId(dimId.getWeekId()); + agencyDailyEntity.setMonthId(dimId.getMonthId()); + agencyDailyEntity.setYearId(dimId.getYearId()); agencyDailyEntity.setProjectTotal(projectTotal.intValue()); agencyDailyEntity.setPendingTotal(pendingTotal.intValue()); agencyDailyEntity.setClosedTotal(closedTotal.intValue()); @@ -199,8 +199,15 @@ public class StatsProjectServiceImpl implements StatsProjectService { dimDateEntityList.add(agencyDailyEntity); } - //6:批量保存机关日统计数据 + //先删后增 if (null != dimDateEntityList && dimDateEntityList.size() > NumConstant.ZERO) { + //5:根据客户Id、日维度Id批量物理删除一下可能存在的历史数据 + FactAgencyProjectDailyEntity delEntity = new FactAgencyProjectDailyEntity(); + delEntity.setCustomerId(customerId); + delEntity.setDateId(dimId.getDateId()); + factAgencyProjectDailyService.delDateProject(delEntity); + + //6:批量保存机关日统计数据 factAgencyProjectDailyService.insertBatch(dimDateEntityList); } return null; @@ -211,8 +218,76 @@ public class StatsProjectServiceImpl implements StatsProjectService { * @Author sun * @Description 数据-项目-机关月统计 **/ - private void agencyMonthProjectStats(String customerId) { + private String agencyMonthProjectStats(String customerId, List dimAgencyList) { + //1:获取个维度Id方便使用 + DimIdGenerator.DimIdBean dimId = DimIdGenerator.getDimIdBean(yesterDay()); + + //2:获取昨天日期所在月份的起始日期和结束日期 + MonthProjectListFormDTO formDTO = new MonthProjectListFormDTO(); + formDTO.setCustomerId(customerId); + formDTO.setStartTime(getMonthBegin(yesterDay())); + formDTO.setEndTime(getMonthEnd(yesterDay())); + + //批量月数据新增对象 + List monthlyEntityList = new ArrayList<>(); + //3:遍历机关维度数据,分别统计每个组织月数据 + for (DimAgencyDTO agency : dimAgencyList) { + //4:查询上一月机关日统计数据,按时间倒序 + formDTO.setAgencyId(agency.getId()); + List projectDailyList = factAgencyProjectDailyService.getMonthProjectList(formDTO); + //5:汇总统计上一月机关月统计数据 + //月增量中项目总数、处理中总数、已结案总数、已结案已解决总数、已结案未解决总数 + int pendingIncr = 0; + int closedIncr = 0; + int resolvedIncr = 0; + int unResolvedIncr = 0; + for (FactAgencyProjectDailyEntity date : projectDailyList) { + pendingIncr += date.getPendingIncr(); + closedIncr += date.getClosedIncr(); + resolvedIncr += date.getResolvedIncr(); + unResolvedIncr += date.getUnresolvedIncr(); + } + //6:实体字段属性赋值 + FactAgencyProjectMonthlyEntity monthlyEntity = new FactAgencyProjectMonthlyEntity(); + monthlyEntity.setCustomerId(customerId); + monthlyEntity.setAgencyId(agency.getId()); + monthlyEntity.setParentId(agency.getPid()); + monthlyEntity.setMonthId(dimId.getMonthId()); + monthlyEntity.setQuarterId(dimId.getQuarterId()); + monthlyEntity.setYearId(dimId.getYearId()); + if (null != projectDailyList && projectDailyList.size() > NumConstant.ZERO) { + FactAgencyProjectDailyEntity entity = projectDailyList.get(0); + monthlyEntity.setProjectTotal(entity.getProjectTotal()); + monthlyEntity.setPendingTotal(entity.getPendingTotal()); + monthlyEntity.setPendingRatio(entity.getPendingRatio()); + monthlyEntity.setClosedTotal(entity.getClosedTotal()); + monthlyEntity.setClosedRatio(entity.getClosedRatio()); + monthlyEntity.setResolvedTotal(entity.getResolvedTotal()); + monthlyEntity.setResolvedRatio(entity.getResolvedRatio()); + monthlyEntity.setUnresolvedTotal(entity.getUnresolvedTotal()); + monthlyEntity.setUnresolvedRatio(entity.getUnresolvedRatio()); + monthlyEntity.setProjectIncr(pendingIncr + closedIncr); + monthlyEntity.setPendingIncr(pendingIncr); + monthlyEntity.setClosedIncr(closedIncr); + monthlyEntity.setResolvedIncr(resolvedIncr); + monthlyEntity.setUnresolvedIncr(unResolvedIncr); + } + + monthlyEntityList.add(monthlyEntity); + } + + if (null != monthlyEntityList && monthlyEntityList.size() > NumConstant.ZERO) { + //7:根据客户Id、月份Id批量删除一下可能存在的历史数据 + FactAgencyProjectMonthlyEntity delEntity = new FactAgencyProjectMonthlyEntity(); + delEntity.setCustomerId(customerId); + delEntity.setMonthId(dimId.getMonthId()); + factAgencyProjectMonthlyService.delMonthProject(delEntity); + + //8:批量保存机关月统计数据 + factAgencyProjectMonthlyService.insertBatch(monthlyEntityList); + } + return null; } /** @@ -251,4 +326,47 @@ public class StatsProjectServiceImpl implements StatsProjectService { return date; } + /** + * @Author sun + * @Description 获取指定日期所在月份开始的时间 + **/ + public Date getMonthBegin(Date date) { + Calendar c = Calendar.getInstance(); + c.setTime(date); + //设置为1号,当前日期既为本月第一天 + c.set(Calendar.DAY_OF_MONTH, 1); + //将小时至0 + c.set(Calendar.HOUR_OF_DAY, 0); + //将分钟至0 + c.set(Calendar.MINUTE, 0); + //将秒至0 + c.set(Calendar.SECOND, 0); + //将毫秒至0 + c.set(Calendar.MILLISECOND, 0); + //获取本月第一天的时间 + return c.getTime(); + } + + /** + * @Author sun + * @Description 获取指定日期所在月份结束的时间 + **/ + public Date getMonthEnd(Date date) { + Calendar c = Calendar.getInstance(); + c.setTime(date); + //设置为当月最后一天 + c.set(Calendar.DAY_OF_MONTH, c.getActualMaximum(Calendar.DAY_OF_MONTH)); + //将小时至23 + c.set(Calendar.HOUR_OF_DAY, 23); + //将分钟至59 + c.set(Calendar.MINUTE, 59); + //将秒至59 + c.set(Calendar.SECOND, 59); + //将毫秒至999 + c.set(Calendar.MILLISECOND, 999); + //获取本月最后一天的时间 + System.out.println(c.getTime()); + System.out.println(c); + return c.getTime(); + } } 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 8c376e33e7..02f644be46 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 @@ -93,14 +93,6 @@ public interface DimDateService extends BaseService { */ 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/FactAgencyProjectDailyService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactAgencyProjectDailyService.java index 49a1030a1e..f7df122755 100644 --- 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 @@ -18,8 +18,11 @@ package com.epmet.service.stats; import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.dto.project.form.MonthProjectListFormDTO; import com.epmet.entity.stats.FactAgencyProjectDailyEntity; +import java.util.List; + /** * 机关下日项目数据统计 存放机关下截止到当前日期的各项总数据以及昨日新增各项数据 * @@ -28,4 +31,17 @@ import com.epmet.entity.stats.FactAgencyProjectDailyEntity; */ public interface FactAgencyProjectDailyService extends BaseService { + /** + * @param formDTO + * @Author sun + * @Description 查询上一月机关日统计数据,按时间倒序 + **/ + List getMonthProjectList(MonthProjectListFormDTO formDTO); + + /** + * @param delEntity + * @Author sun + * @Description 根据客户Id、日维度Id批量物理删除一下可能存在的历史数据 + **/ + void delDateProject(FactAgencyProjectDailyEntity delEntity); } \ 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 index 38f18b9a8c..e1e6ebdc25 100644 --- 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 @@ -28,4 +28,11 @@ import com.epmet.entity.stats.FactAgencyProjectMonthlyEntity; */ public interface FactAgencyProjectMonthlyService extends BaseService { + /** + * @param delEntity + * @return + * @Author sun + * @Description 根据客户Id、月份Id批量物理删除可能存在的历史数据 + **/ + void delMonthProject(FactAgencyProjectMonthlyEntity delEntity); } \ 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 0d0d756c12..3684c6daa3 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 @@ -95,17 +95,6 @@ public class DimDateServiceImpl extends BaseServiceImpl getDimDate(DimDateDTO dto) { - return baseDao.selectDimDate(dto); - } - @Override public void initDimDate() { DimDateDTO latestDimDateDto = baseDao.getLatestDimDate(); diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactAgencyProjectDailyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactAgencyProjectDailyServiceImpl.java index c523aef2a2..bbb1b39e44 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactAgencyProjectDailyServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactAgencyProjectDailyServiceImpl.java @@ -19,10 +19,13 @@ package com.epmet.service.stats.impl; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.dao.stats.FactAgencyProjectDailyDao; +import com.epmet.dto.project.form.MonthProjectListFormDTO; import com.epmet.entity.stats.FactAgencyProjectDailyEntity; import com.epmet.service.stats.FactAgencyProjectDailyService; import org.springframework.stereotype.Service; +import java.util.List; + /** * 机关下日项目数据统计 存放机关下截止到当前日期的各项总数据以及昨日新增各项数据 * @@ -33,4 +36,23 @@ import org.springframework.stereotype.Service; public class FactAgencyProjectDailyServiceImpl extends BaseServiceImpl implements FactAgencyProjectDailyService { + /** + * @param formDTO + * @Author sun + * @Description 查询上一月机关日统计数据,按时间倒序 + **/ + @Override + public List getMonthProjectList(MonthProjectListFormDTO formDTO) { + return baseDao.selectMonthProjectList(formDTO); + } + + /** + * @param delEntity + * @Author sun + * @Description 根据客户Id、日维度Id批量物理删除一下可能存在的历史数据 + **/ + @Override + public void delDateProject(FactAgencyProjectDailyEntity delEntity) { + baseDao.delDateProject(delEntity); + } } \ 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 index 5ad3f8eeda..df869107f9 100644 --- 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 @@ -32,5 +32,14 @@ import org.springframework.stereotype.Service; @Service public class FactAgencyProjectMonthlyServiceImpl extends BaseServiceImpl implements FactAgencyProjectMonthlyService { - + /** + * @param delEntity + * @return + * @Author sun + * @Description 根据客户Id、月份Id批量物理删除可能存在的历史数据 + **/ + @Override + public void delMonthProject(FactAgencyProjectMonthlyEntity delEntity) { + baseDao.delMonthProject(delEntity); + } } \ 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 94eb88062b..ad531351b0 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,19 +3,6 @@ - - + SELECT + * + FROM + fact_agency_project_daily + WHERE + del_flag = '0' + AND customer_id = #{customerId} + AND agency_id = #{agencyId} + AND ( + DATE_FORMAT(created_time, "%Y-%m-%d") + BETWEEN DATE_FORMAT(#{startTime}, "%Y-%m-%d") + AND DATE_FORMAT(#{endTime}, "%Y-%m-%d") + ) + ORDER BY created_time DESC,project_total DESC + + + DELETE + FROM + fact_agency_project_daily + WHERE + customer_id = #{customerId} + AND date_id = #{dateId} + \ 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 index 15e59960ea..846b2c7a26 100644 --- 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 @@ -3,6 +3,13 @@ - + + DELETE + FROM + fact_agency_project_monthly + WHERE + customer_id = #{customerId} + AND month_id = #{monthId} + \ No newline at end of file