|
@ -155,8 +155,12 @@ public class KpiMetaDataServiceImpl extends BaseServiceImpl<KpiMetaDataDao, KpiM |
|
|
eventReportAmountFormDto.setGridIdList(gridList); |
|
|
eventReportAmountFormDto.setGridIdList(gridList); |
|
|
// 从events模块获取统计数据
|
|
|
// 从events模块获取统计数据
|
|
|
List<KpiEventReportAmountResultDTO> reportAmountList = this.getMetaDateFromEventsModule(eventReportAmountFormDto); |
|
|
List<KpiEventReportAmountResultDTO> reportAmountList = this.getMetaDateFromEventsModule(eventReportAmountFormDto); |
|
|
// 组装元数据对象并插入数据库
|
|
|
// 组装元数据对象
|
|
|
this.insertBatch(this.packageMetaDataList(reportAmountList, eventReportAmountFormDto, kpiCycle)); |
|
|
List<KpiMetaDataEntity> kpiMetaDataEntities = this.packageMetaDataList(reportAmountList, eventReportAmountFormDto, kpiCycle); |
|
|
|
|
|
// 插入之前删除已存在
|
|
|
|
|
|
this.deleteRepetitionMetaList(kpiMetaDataEntities); |
|
|
|
|
|
// 插入数据库
|
|
|
|
|
|
this.insertBatch(kpiMetaDataEntities); |
|
|
pageIndex++; |
|
|
pageIndex++; |
|
|
gridList = deptUtils.getDeptIdList(OrganizationTypeConstant.ORG_TYPE_GRID_PARTY, pageSize, pageIndex); |
|
|
gridList = deptUtils.getDeptIdList(OrganizationTypeConstant.ORG_TYPE_GRID_PARTY, pageSize, pageIndex); |
|
|
} while (CollUtil.isNotEmpty(gridList)); |
|
|
} while (CollUtil.isNotEmpty(gridList)); |
|
@ -306,24 +310,34 @@ public class KpiMetaDataServiceImpl extends BaseServiceImpl<KpiMetaDataDao, KpiM |
|
|
// 页码
|
|
|
// 页码
|
|
|
int pageIndex = NumConstant.ONE; |
|
|
int pageIndex = NumConstant.ONE; |
|
|
List<KpiMetaDataDTO> kpiMetaDataDTOList; |
|
|
List<KpiMetaDataDTO> kpiMetaDataDTOList; |
|
|
|
|
|
List<KpiMetaDataEntity> kpiMetaDataEntitiesList; |
|
|
List<Long> gridList = deptUtils.getDeptIdList(OrganizationTypeConstant.ORG_TYPE_GRID_PARTY, pageSize, pageIndex); |
|
|
List<Long> gridList = deptUtils.getDeptIdList(OrganizationTypeConstant.ORG_TYPE_GRID_PARTY, pageSize, pageIndex); |
|
|
do { |
|
|
do { |
|
|
monthFromDto.setGridIdList(gridList); |
|
|
monthFromDto.setGridIdList(gridList); |
|
|
monthFromDto.setType(KpiCycleEnum.KPI_CYCLE_MONTH.getValue()); |
|
|
monthFromDto.setType(KpiCycleEnum.KPI_CYCLE_MONTH.getValue()); |
|
|
kpiMetaDataDTOList = eventFeignClient.queryEvaluationData(monthFromDto).getData(); |
|
|
kpiMetaDataDTOList = eventFeignClient.queryEvaluationData(monthFromDto).getData(); |
|
|
insertBatch(ConvertUtils.sourceToTarget(kpiMetaDataDTOList, KpiMetaDataEntity.class)); |
|
|
kpiMetaDataEntitiesList = ConvertUtils.sourceToTarget(kpiMetaDataDTOList, KpiMetaDataEntity.class); |
|
|
|
|
|
// 插入之前删除已存在
|
|
|
|
|
|
this.deleteRepetitionMetaList(kpiMetaDataEntitiesList); |
|
|
|
|
|
insertBatch(kpiMetaDataEntitiesList); |
|
|
// 1,4,7,10 月份的时候统计 季度 季度第一天统计上一季度
|
|
|
// 1,4,7,10 月份的时候统计 季度 季度第一天统计上一季度
|
|
|
if (nowMonth == NumConstant.ONE || nowMonth == NumConstant.FOUR || nowMonth == NumConstant.SEVEN || nowMonth == NumConstant.TEN) { |
|
|
if (nowMonth == NumConstant.ONE || nowMonth == NumConstant.FOUR || nowMonth == NumConstant.SEVEN || nowMonth == NumConstant.TEN) { |
|
|
monthFromDto.setType(KpiCycleEnum.KPI_CYCLE_QUARTER.getValue()); |
|
|
monthFromDto.setType(KpiCycleEnum.KPI_CYCLE_QUARTER.getValue()); |
|
|
kpiMetaDataDTOList = eventFeignClient.queryEvaluationData(quarterFromDto).getData(); |
|
|
kpiMetaDataDTOList = eventFeignClient.queryEvaluationData(quarterFromDto).getData(); |
|
|
insertBatch(ConvertUtils.sourceToTarget(kpiMetaDataDTOList, KpiMetaDataEntity.class)); |
|
|
kpiMetaDataEntitiesList = ConvertUtils.sourceToTarget(kpiMetaDataDTOList, KpiMetaDataEntity.class); |
|
|
|
|
|
// 插入之前删除已存在
|
|
|
|
|
|
this.deleteRepetitionMetaList(kpiMetaDataEntitiesList); |
|
|
|
|
|
insertBatch(kpiMetaDataEntitiesList); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// 一月份统计去年的
|
|
|
// 一月份统计去年的
|
|
|
if (nowMonth == NumConstant.ONE) { |
|
|
if (nowMonth == NumConstant.ONE) { |
|
|
monthFromDto.setType(KpiCycleEnum.KPI_CYCLE_YEAR.getValue()); |
|
|
monthFromDto.setType(KpiCycleEnum.KPI_CYCLE_YEAR.getValue()); |
|
|
kpiMetaDataDTOList = eventFeignClient.queryEvaluationData(yearFromDto).getData(); |
|
|
kpiMetaDataDTOList = eventFeignClient.queryEvaluationData(yearFromDto).getData(); |
|
|
insertBatch(ConvertUtils.sourceToTarget(kpiMetaDataDTOList, KpiMetaDataEntity.class)); |
|
|
kpiMetaDataEntitiesList = ConvertUtils.sourceToTarget(kpiMetaDataDTOList, KpiMetaDataEntity.class); |
|
|
|
|
|
// 插入之前删除已存在
|
|
|
|
|
|
this.deleteRepetitionMetaList(kpiMetaDataEntitiesList); |
|
|
|
|
|
insertBatch(kpiMetaDataEntitiesList); |
|
|
} |
|
|
} |
|
|
pageIndex++; |
|
|
pageIndex++; |
|
|
gridList = deptUtils.getDeptIdList(OrganizationTypeConstant.ORG_TYPE_GRID_PARTY, pageSize, pageIndex); |
|
|
gridList = deptUtils.getDeptIdList(OrganizationTypeConstant.ORG_TYPE_GRID_PARTY, pageSize, pageIndex); |
|
@ -374,12 +388,14 @@ public class KpiMetaDataServiceImpl extends BaseServiceImpl<KpiMetaDataDao, KpiM |
|
|
getCountItem(monthFromDto, quarterFromDto, yearFromDto, nowMonth, OrganizationTypeConstant.ORG_TYPE_STREET_DEPT); |
|
|
getCountItem(monthFromDto, quarterFromDto, yearFromDto, nowMonth, OrganizationTypeConstant.ORG_TYPE_STREET_DEPT); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void getCountItem(EpdcEventsItemMataFromDTO monthFromDto, EpdcEventsItemMataFromDTO quarterFromDto, EpdcEventsItemMataFromDTO yearFromDto, int nowMonth, String dept) { |
|
|
private void getCountItem(EpdcEventsItemMataFromDTO monthFromDto, EpdcEventsItemMataFromDTO quarterFromDto, EpdcEventsItemMataFromDTO yearFromDto, int nowMonth, String dept) { |
|
|
List<KpiMetaDataDTO> kpiMetaDataDTOList; |
|
|
List<KpiMetaDataDTO> kpiMetaDataDTOList; |
|
|
|
|
|
List<KpiMetaDataEntity> kpiMetaDataEntitiesList; |
|
|
//容量
|
|
|
//容量
|
|
|
int pageSize = 10; |
|
|
int pageSize = NumConstant.TEN; |
|
|
//页码
|
|
|
//页码
|
|
|
int pageIndex = 1; |
|
|
int pageIndex = NumConstant.ONE; |
|
|
List<Long> deptIdList; |
|
|
List<Long> deptIdList; |
|
|
do { |
|
|
do { |
|
|
// 分页获取所有网格
|
|
|
// 分页获取所有网格
|
|
@ -388,23 +404,43 @@ public class KpiMetaDataServiceImpl extends BaseServiceImpl<KpiMetaDataDao, KpiM |
|
|
monthFromDto.setDeptIdList(deptIdList); |
|
|
monthFromDto.setDeptIdList(deptIdList); |
|
|
monthFromDto.setTimeType(KpiCycleEnum.KPI_CYCLE_MONTH.getValue()); |
|
|
monthFromDto.setTimeType(KpiCycleEnum.KPI_CYCLE_MONTH.getValue()); |
|
|
kpiMetaDataDTOList = eventFeignClient.queryItemCountData(monthFromDto).getData(); |
|
|
kpiMetaDataDTOList = eventFeignClient.queryItemCountData(monthFromDto).getData(); |
|
|
insertBatch(ConvertUtils.sourceToTarget(kpiMetaDataDTOList, KpiMetaDataEntity.class)); |
|
|
// 插入之前删除已存在
|
|
|
|
|
|
kpiMetaDataEntitiesList = ConvertUtils.sourceToTarget(kpiMetaDataDTOList, KpiMetaDataEntity.class); |
|
|
|
|
|
this.deleteRepetitionMetaList(kpiMetaDataEntitiesList); |
|
|
|
|
|
insertBatch(kpiMetaDataEntitiesList); |
|
|
// 1,4,7,10 月份的时候统计 季度 季度第一天统计上一季度
|
|
|
// 1,4,7,10 月份的时候统计 季度 季度第一天统计上一季度
|
|
|
if (nowMonth == NumConstant.ONE || nowMonth == NumConstant.FOUR || nowMonth == NumConstant.SEVEN || nowMonth == NumConstant.TEN) { |
|
|
if (nowMonth == NumConstant.ONE || nowMonth == NumConstant.FOUR || nowMonth == NumConstant.SEVEN || nowMonth == NumConstant.TEN) { |
|
|
monthFromDto.setTimeType(KpiCycleEnum.KPI_CYCLE_QUARTER.getValue()); |
|
|
monthFromDto.setTimeType(KpiCycleEnum.KPI_CYCLE_QUARTER.getValue()); |
|
|
kpiMetaDataDTOList = eventFeignClient.queryItemCountData(quarterFromDto).getData(); |
|
|
kpiMetaDataDTOList = eventFeignClient.queryItemCountData(quarterFromDto).getData(); |
|
|
insertBatch(ConvertUtils.sourceToTarget(kpiMetaDataDTOList, KpiMetaDataEntity.class)); |
|
|
kpiMetaDataEntitiesList = ConvertUtils.sourceToTarget(kpiMetaDataDTOList, KpiMetaDataEntity.class); |
|
|
|
|
|
// 插入之前删除已存在
|
|
|
|
|
|
this.deleteRepetitionMetaList(kpiMetaDataEntitiesList); |
|
|
|
|
|
insertBatch(kpiMetaDataEntitiesList); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// 一月份统计去年的
|
|
|
// 一月份统计去年的
|
|
|
if (nowMonth == NumConstant.ONE) { |
|
|
if (nowMonth == NumConstant.ONE) { |
|
|
monthFromDto.setTimeType(KpiCycleEnum.KPI_CYCLE_YEAR.getValue()); |
|
|
monthFromDto.setTimeType(KpiCycleEnum.KPI_CYCLE_YEAR.getValue()); |
|
|
kpiMetaDataDTOList = eventFeignClient.queryItemCountData(yearFromDto).getData(); |
|
|
kpiMetaDataDTOList = eventFeignClient.queryItemCountData(yearFromDto).getData(); |
|
|
insertBatch(ConvertUtils.sourceToTarget(kpiMetaDataDTOList, KpiMetaDataEntity.class)); |
|
|
kpiMetaDataEntitiesList = ConvertUtils.sourceToTarget(kpiMetaDataDTOList, KpiMetaDataEntity.class); |
|
|
|
|
|
// 插入之前删除已存在
|
|
|
|
|
|
this.deleteRepetitionMetaList(kpiMetaDataEntitiesList); |
|
|
|
|
|
insertBatch(kpiMetaDataEntitiesList); |
|
|
} |
|
|
} |
|
|
//页码
|
|
|
//页码
|
|
|
pageIndex++; |
|
|
pageIndex++; |
|
|
deptIdList = deptUtils.getDeptIdList(dept, pageSize, pageIndex); |
|
|
deptIdList = deptUtils.getDeptIdList(dept, pageSize, pageIndex); |
|
|
} while (CollUtil.isNotEmpty(deptIdList)); |
|
|
} while (CollUtil.isNotEmpty(deptIdList)); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/*** |
|
|
|
|
|
* 插入之前删除数据 防止插入部分出异常 |
|
|
|
|
|
* @param |
|
|
|
|
|
* @return void |
|
|
|
|
|
* @author qushutong |
|
|
|
|
|
* @date 2019/12/20 13:24 |
|
|
|
|
|
*/ |
|
|
|
|
|
public void deleteRepetitionMetaList(List<KpiMetaDataEntity> metaList) { |
|
|
|
|
|
baseDao.deleteListRepetitionMeta(metaList); |
|
|
|
|
|
} |
|
|
} |
|
|
} |