From 2cd698f605659f20f85cc97aff8c4e043dd65f96 Mon Sep 17 00:00:00 2001 From: wanggongfeng <1305282856@qq.com> Date: Mon, 11 Jul 2022 17:04:07 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E7=BB=9F=E8=AE=A1=EF=BC=8C?= =?UTF-8?q?=E5=AE=9A=E6=97=B6=E4=BB=BB=E5=8A=A1=E5=88=A0=E9=99=A4=E9=80=BB?= =?UTF-8?q?=E8=BE=91=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/epmet/dao/stats/BaseReportDao.java | 2 ++ .../service/impl/BaseReportServiceImpl.java | 21 +++++++++++++++---- .../resources/mapper/stats/BaseReportDao.xml | 9 ++++++++ 3 files changed, 28 insertions(+), 4 deletions(-) diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/BaseReportDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/BaseReportDao.java index e11ba2d776..f371759d60 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/BaseReportDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/BaseReportDao.java @@ -94,6 +94,8 @@ public interface BaseReportDao { */ int delAgencyProject(@Param("customerId") String customerId, @Param("dateId") String dateId); + void delAgencyProjectDaily(@Param("customerId") String customerId,@Param("dateIdList")List dateIdList); + /** * @Description 批量新增组织项目数据 * @Param dataList diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/BaseReportServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/BaseReportServiceImpl.java index 1f8fdf806c..9d3158e06b 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/BaseReportServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/BaseReportServiceImpl.java @@ -11,6 +11,7 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.util.CollectionUtils; +import java.util.ArrayList; import java.util.List; /** @@ -288,10 +289,22 @@ public class BaseReportServiceImpl implements BaseReportService { @Override public void agencyProject(AgencyProjectFormDTO formDTO) { if (formDTO.getIsFirst()) { - int deleteNum; - do { - deleteNum = baseReportDao.delAgencyProject(formDTO.getDataList().get(NumConstant.ZERO).getCustomerId(), formDTO.getDataList().get(NumConstant.ZERO).getDateId()); - } while (deleteNum > NumConstant.ZERO); + // 20220711修改逻辑 +// int deleteNum; +// do { +// deleteNum = baseReportDao.delAgencyProject(formDTO.getDataList().get(NumConstant.ZERO).getCustomerId(), formDTO.getDataList().get(NumConstant.ZERO).getDateId()); +// } while (deleteNum > NumConstant.ZERO); + + List dataList = formDTO.getDataList(); + List dateIdList = new ArrayList(); + String customerId = dataList.get(NumConstant.ZERO).getCustomerId(); + for(AgencyProjectFormDTO.DataList d : dataList){ + if(!dateIdList.contains(d.getDateId())){ + dateIdList.add(d.getDateId()); + } + } + baseReportDao.delAgencyProjectDaily(customerId,dateIdList); + } List> partition = ListUtils.partition(formDTO.getDataList(), NumConstant.ONE_HUNDRED); partition.forEach(p -> { diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/BaseReportDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/BaseReportDao.xml index 5bd8912385..7f491393ad 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/BaseReportDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/BaseReportDao.xml @@ -364,6 +364,15 @@ LIMIT 1000 + + DELETE FROM fact_agency_project_daily + WHERE customer_id = #{customerId} + AND date_id IN + + #{dateId} + + + INSERT INTO fact_agency_project_daily