| | |
| | | package com.panzhihua.sangeshenbian.service.impl; |
| | | |
| | | import cn.hutool.core.date.DateUtil; |
| | | import com.beust.jcommander.internal.Lists; |
| | | import com.fasterxml.jackson.databind.ser.std.ObjectArraySerializer; |
| | | import com.panzhihua.common.exceptions.ServiceException; |
| | | import com.panzhihua.common.model.vos.LoginUserInfoVO; |
| | | import com.panzhihua.common.utlis.DateUtils; |
| | | import com.panzhihua.common.utlis.StringUtils; |
| | | import com.panzhihua.sangeshenbian.dao.SystemUserMapper; |
| | | import com.panzhihua.sangeshenbian.model.entity.ComAct; |
| | | import com.panzhihua.sangeshenbian.model.entity.ComStreet; |
| | | import com.panzhihua.sangeshenbian.model.entity.Complaint; |
| | | import com.panzhihua.sangeshenbian.model.entity.PartyMember; |
| | | import com.panzhihua.sangeshenbian.model.entity.SystemUserLevel; |
| | | import com.panzhihua.sangeshenbian.model.query.AppStaticsQuery; |
| | | import com.panzhihua.sangeshenbian.model.vo.AnalyticStatisticsOneVo; |
| | | import com.panzhihua.sangeshenbian.model.vo.AnalyticStatisticsTwoVo; |
| | | import com.panzhihua.sangeshenbian.model.vo.RegionVO; |
| | | import com.panzhihua.sangeshenbian.service.IBcRegionService; |
| | | import com.panzhihua.sangeshenbian.service.IComActService; |
| | |
| | | import org.springframework.context.annotation.Lazy; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.ArrayList; |
| | | import java.util.Collections; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | | /** |
| | | * @author mitao |
| | |
| | | private final IComStreetService comStreetService; |
| | | private final IComActService comActService; |
| | | private final SystemUserMapper systemUserMapper; |
| | | |
| | | private static final SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | public List<RegionVO> queryRegionTree(LoginUserInfoVO loginUserInfo) { |
| | | IdentityInformation currentIdentityInformation = identityInformationService.getCurrentIdentityInformation(loginUserInfo); |
| | | if (!Integer.valueOf(2).equals(currentIdentityInformation.getIdentity())) { |
| | |
| | | return Collections.singletonList(regionVO); |
| | | } |
| | | |
| | | /** |
| | | * 统计分析-第一部分 |
| | | * @param query |
| | | * @param loginUserInfo |
| | | * @return |
| | | */ |
| | | public AnalyticStatisticsOneVo queryStaticsPartOne(AppStaticsQuery query, LoginUserInfoVO loginUserInfo) { |
| | | List<Complaint> complaints = complaintService.queryCompliantList(query,loginUserInfo); |
| | | return complaintService.analyticStatisticsOne(null, complaints, simpleDateFormat); |
| | | } |
| | | |
| | | public List<AnalyticStatisticsTwoVo> queryStaticsPartTwo(AppStaticsQuery query, LoginUserInfoVO loginUserInfo) { |
| | | List<Complaint> complaints = complaintService.queryCompliantList(query,loginUserInfo); |
| | | //时间范围 |
| | | String time = ""; |
| | | if (Objects.nonNull(query.getTimeType())) { |
| | | Date now = new Date(); |
| | | Date start = null; |
| | | switch (query.getTimeType()) { |
| | | case 2: |
| | | start = DateUtils.addDay(now, -15); |
| | | break; |
| | | case 3: |
| | | start = DateUtils.addDay(now, -30); |
| | | break; |
| | | default: |
| | | start = DateUtils.addDay(now, -7); |
| | | break; |
| | | } |
| | | //格式化 |
| | | String startStr = DateUtils.format(start, DateUtils.yyyyMMdd_format); |
| | | String endStr = DateUtils.format(now, DateUtils.yyyyMMdd_format); |
| | | time = startStr + " - " + endStr; |
| | | } |
| | | return complaintService.analyticStatisticsTwo(time, complaints, simpleDateFormat); |
| | | } |
| | | |
| | | } |