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