|
|
|
@ -12,6 +12,7 @@ import com.epmet.commons.tools.page.PageData; |
|
|
|
import com.epmet.commons.tools.redis.common.CustomerOrgRedis; |
|
|
|
import com.epmet.commons.tools.redis.common.bean.GridInfoCache; |
|
|
|
import com.epmet.commons.tools.utils.ConvertUtils; |
|
|
|
import com.epmet.commons.tools.utils.DateUtils; |
|
|
|
import com.epmet.commons.tools.utils.EpmetRequestHolder; |
|
|
|
import com.epmet.dao.IcEventDao; |
|
|
|
import com.epmet.dto.CustomerAgencyDTO; |
|
|
|
@ -33,10 +34,8 @@ import org.springframework.transaction.annotation.Transactional; |
|
|
|
import org.springframework.util.CollectionUtils; |
|
|
|
|
|
|
|
import java.math.BigDecimal; |
|
|
|
import java.util.Arrays; |
|
|
|
import java.util.Date; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
import java.util.*; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
/** |
|
|
|
* 事件管理表 |
|
|
|
@ -214,4 +213,46 @@ public class IcEventServiceImpl extends BaseServiceImpl<IcEventDao, IcEventEntit |
|
|
|
|
|
|
|
return new PageData<>(list, pageInfo.getTotal()); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public List<IcEventMonthlyIncrementResultDTO> listMonthlyIncrement(String orgType, String orgId, Date queryStartTime, Date queryEndTime) { |
|
|
|
List<IcEventMonthlyIncrementResultDTO> resultList = new ArrayList<>(); |
|
|
|
|
|
|
|
String gridPids = null; |
|
|
|
if ("agency".equals(orgType)) { |
|
|
|
gridPids = getEventGridPids(orgId); |
|
|
|
} |
|
|
|
|
|
|
|
// 从输入开始月份上一个月的开始查
|
|
|
|
queryEndTime = DateUtils.addDateMonths(queryEndTime, 1); |
|
|
|
|
|
|
|
// 查询分组统计后的结果,此时月份数据不全,如果数量是0的月份不会在这里面
|
|
|
|
List<IcEventMonthlyCountResultDTO> eventCountDataList = baseDao.listMonthlyEventCount(orgType, orgId, gridPids, queryStartTime, queryEndTime); |
|
|
|
Map<String, Integer> monthAndCount = eventCountDataList.stream().collect(Collectors.toMap((e) -> e.getMonthName(), (e) -> e.getEventCount())); |
|
|
|
|
|
|
|
Date tempMonth = DateUtils.integrate(queryStartTime, DateUtils.DATE_PATTERN_YYYY_MM); |
|
|
|
Date endMonth = DateUtils.integrate(queryEndTime, DateUtils.DATE_PATTERN_YYYY_MM); |
|
|
|
|
|
|
|
// 按照开始和结束时间,对比数据库查出来的,没有数据的填0
|
|
|
|
while (true) { |
|
|
|
Integer increment = 0; |
|
|
|
|
|
|
|
if (tempMonth.equals(endMonth)) { |
|
|
|
break; |
|
|
|
} |
|
|
|
|
|
|
|
String tempMonthString = DateUtils.format(tempMonth, DateUtils.DATE_PATTERN_YYYY_MM); |
|
|
|
Integer eventCountOfMonth = monthAndCount.get(tempMonthString); |
|
|
|
if (eventCountOfMonth != null) { |
|
|
|
increment = eventCountOfMonth; |
|
|
|
} |
|
|
|
|
|
|
|
tempMonth = DateUtils.addDateMonths(tempMonth, 1); |
|
|
|
|
|
|
|
resultList.add(new IcEventMonthlyIncrementResultDTO(tempMonthString, increment)); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return resultList; |
|
|
|
} |
|
|
|
} |