|
@ -2,47 +2,53 @@ |
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSON; |
|
|
import com.alibaba.fastjson.JSON; |
|
|
import com.epmet.commons.dynamic.datasource.annotation.DataSource; |
|
|
import com.epmet.commons.dynamic.datasource.annotation.DataSource; |
|
|
import com.epmet.commons.tools.constant.NumConstant; |
|
|
import com.epmet.commons.tools.constant.NumConstant; |
|
|
import com.epmet.commons.tools.constant.StrConstant; |
|
|
import com.epmet.commons.tools.constant.StrConstant; |
|
|
import com.epmet.commons.tools.enums.OrgLevelEnum; |
|
|
import com.epmet.commons.tools.enums.OrgLevelEnum; |
|
|
import com.epmet.commons.tools.utils.DateUtils; |
|
|
import com.epmet.commons.tools.exception.RenException; |
|
|
import com.epmet.dataaggre.constant.DataSourceConstant; |
|
|
import com.epmet.commons.tools.utils.DateUtils; |
|
|
import com.epmet.dataaggre.constant.OrgConstant; |
|
|
import com.epmet.commons.tools.utils.ExcelUtils; |
|
|
import com.epmet.dataaggre.dao.datastats.DataStatsDao; |
|
|
import com.epmet.dataaggre.constant.DataSourceConstant; |
|
|
import com.epmet.dataaggre.dao.datastats.FactGridMemberStatisticsDailyDao; |
|
|
import com.epmet.dataaggre.constant.OrgConstant; |
|
|
import com.epmet.dataaggre.dto.datastats.FactGroupActDailyDTO; |
|
|
import com.epmet.dataaggre.dao.datastats.DataStatsDao; |
|
|
import com.epmet.dataaggre.dto.datastats.form.*; |
|
|
import com.epmet.dataaggre.dao.datastats.FactGridMemberStatisticsDailyDao; |
|
|
import com.epmet.dataaggre.dto.datastats.result.*; |
|
|
import com.epmet.dataaggre.dto.datastats.FactGroupActDailyDTO; |
|
|
|
|
|
import com.epmet.dataaggre.dto.datastats.form.*; |
|
|
|
|
|
import com.epmet.dataaggre.dto.datastats.result.*; |
|
|
import com.epmet.dataaggre.dto.epmetuser.form.GridMemberPatrolListFormDTO; |
|
|
import com.epmet.dataaggre.dto.epmetuser.form.GridMemberPatrolListFormDTO; |
|
|
import com.epmet.dataaggre.dto.epmetuser.result.GridMemberPatrolListResultDTO; |
|
|
import com.epmet.dataaggre.dto.epmetuser.result.GridMemberPatrolListResultDTO; |
|
|
import com.epmet.dataaggre.dto.epmetuser.result.PatrolDailySumResult; |
|
|
import com.epmet.dataaggre.dto.epmetuser.result.PatrolDailySumResult; |
|
|
import com.epmet.dataaggre.dto.evaluationindex.ScreenCustomerAgencyDTO; |
|
|
import com.epmet.dataaggre.dto.evaluationindex.ScreenAgencyOrGridListDTO; |
|
|
import com.epmet.dataaggre.dto.evaluationindex.ScreenCustomerGridDTO; |
|
|
import com.epmet.dataaggre.dto.evaluationindex.ScreenCustomerAgencyDTO; |
|
|
import com.epmet.dataaggre.dto.evaluationindex.ScreenGovernRankDataDailyDTO; |
|
|
import com.epmet.dataaggre.dto.evaluationindex.ScreenCustomerGridDTO; |
|
|
import com.epmet.dataaggre.dto.govorg.result.GridMemberDataAnalysisResultDTO; |
|
|
import com.epmet.dataaggre.dto.evaluationindex.ScreenGovernRankDataDailyDTO; |
|
|
import com.epmet.dataaggre.dto.resigroup.ActCategoryDictDTO; |
|
|
import com.epmet.dataaggre.dto.govorg.result.GridMemberDataAnalysisResultDTO; |
|
|
import com.epmet.dataaggre.dto.resigroup.result.GroupActRankDetailDTO; |
|
|
import com.epmet.dataaggre.dto.resigroup.ActCategoryDictDTO; |
|
|
import com.epmet.dataaggre.entity.datastats.DimAgencyEntity; |
|
|
import com.epmet.dataaggre.dto.resigroup.result.GroupActRankDetailDTO; |
|
|
import com.epmet.dataaggre.entity.datastats.FactAgencyGovernDailyEntity; |
|
|
import com.epmet.dataaggre.entity.datastats.DimAgencyEntity; |
|
|
import com.epmet.dataaggre.service.datastats.DataStatsService; |
|
|
import com.epmet.dataaggre.entity.datastats.FactAgencyGovernDailyEntity; |
|
|
import com.epmet.dataaggre.service.epmetuser.StatsStaffPatrolRecordDailyService; |
|
|
import com.epmet.dataaggre.excel.CustomerDataManageExcel; |
|
|
import com.epmet.dataaggre.service.evaluationindex.EvaluationIndexService; |
|
|
import com.epmet.dataaggre.service.datastats.DataStatsService; |
|
|
import com.epmet.dataaggre.service.opercrm.CustomerRelation; |
|
|
import com.epmet.dataaggre.service.epmetuser.StatsStaffPatrolRecordDailyService; |
|
|
import com.github.pagehelper.PageHelper; |
|
|
import com.epmet.dataaggre.service.evaluationindex.EvaluationIndexService; |
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
import com.epmet.dataaggre.service.opercrm.CustomerRelation; |
|
|
import org.apache.commons.collections4.CollectionUtils; |
|
|
import com.github.pagehelper.PageHelper; |
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.apache.commons.collections4.CollectionUtils; |
|
|
import org.springframework.stereotype.Service; |
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import java.math.BigDecimal; |
|
|
import org.springframework.stereotype.Service; |
|
|
import java.math.RoundingMode; |
|
|
|
|
|
import java.text.NumberFormat; |
|
|
import javax.servlet.http.HttpServletResponse; |
|
|
import java.text.SimpleDateFormat; |
|
|
import java.math.BigDecimal; |
|
|
import java.util.*; |
|
|
import java.math.RoundingMode; |
|
|
import java.util.concurrent.atomic.AtomicInteger; |
|
|
import java.text.NumberFormat; |
|
|
import java.util.concurrent.atomic.AtomicReference; |
|
|
import java.text.ParseException; |
|
|
import java.util.stream.Collectors; |
|
|
import java.text.SimpleDateFormat; |
|
|
|
|
|
import java.util.*; |
|
|
|
|
|
import java.util.concurrent.atomic.AtomicInteger; |
|
|
|
|
|
import java.util.concurrent.atomic.AtomicReference; |
|
|
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* @Author sun |
|
|
* @Author sun |
|
@ -1841,4 +1847,121 @@ public class DataStatsServiceImpl implements DataStatsService { |
|
|
return dataStatsDao.selectGirdMemberPatrol(formDTO); |
|
|
return dataStatsDao.selectGirdMemberPatrol(formDTO); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* @Description 客户数据管理导出 |
|
|
|
|
|
* @Param formDTO |
|
|
|
|
|
* @Param response |
|
|
|
|
|
* @author zxc |
|
|
|
|
|
* @date 2021/9/10 3:52 下午 |
|
|
|
|
|
*/ |
|
|
|
|
|
@Override |
|
|
|
|
|
public void CustomerDataManage(CustomerDataManageFormDTO formDTO, HttpServletResponse response) throws Exception { |
|
|
|
|
|
List<CustomerDataManageResultDTO> result = operateExport(formDTO); |
|
|
|
|
|
if (!CollectionUtils.isEmpty(result)){ |
|
|
|
|
|
CustomerDataManageResultDTO c = new CustomerDataManageResultDTO(); |
|
|
|
|
|
c.setOrgName("合计"); |
|
|
|
|
|
c.setUserCount(result.stream().collect(Collectors.summingInt(CustomerDataManageResultDTO::getUserCount))); |
|
|
|
|
|
c.setResidentCount(result.stream().collect(Collectors.summingInt(CustomerDataManageResultDTO::getResidentCount))); |
|
|
|
|
|
c.setPartyMemberCount(result.stream().collect(Collectors.summingInt(CustomerDataManageResultDTO::getPartyMemberCount))); |
|
|
|
|
|
c.setGroupCount(result.stream().collect(Collectors.summingInt(CustomerDataManageResultDTO::getGroupCount))); |
|
|
|
|
|
c.setTopicCount(result.stream().collect(Collectors.summingInt(CustomerDataManageResultDTO::getTopicCount))); |
|
|
|
|
|
c.setIssueCount(result.stream().collect(Collectors.summingInt(CustomerDataManageResultDTO::getIssueCount))); |
|
|
|
|
|
c.setProjectCount(result.stream().collect(Collectors.summingInt(CustomerDataManageResultDTO::getProjectCount))); |
|
|
|
|
|
c.setClosedProjectCount(result.stream().collect(Collectors.summingInt(CustomerDataManageResultDTO::getClosedProjectCount))); |
|
|
|
|
|
c.setPatrolPeopleCount(result.stream().collect(Collectors.summingInt(CustomerDataManageResultDTO::getPatrolPeopleCount))); |
|
|
|
|
|
c.setPatrolCount(result.stream().collect(Collectors.summingInt(CustomerDataManageResultDTO::getPatrolCount))); |
|
|
|
|
|
c.setPatrolDurationInteger(result.stream().collect(Collectors.summingInt(CustomerDataManageResultDTO::getPatrolDurationInteger))); |
|
|
|
|
|
c.setPatrolDuration(getHm(c.getPatrolDurationInteger())); |
|
|
|
|
|
result.add(c); |
|
|
|
|
|
} |
|
|
|
|
|
String fileName = excelName(formDTO); |
|
|
|
|
|
ExcelUtils.exportExcelToTargetDisposeAll(response,fileName,result, CustomerDataManageExcel.class); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* @Description 秒转换时分 |
|
|
|
|
|
* @Param seconds |
|
|
|
|
|
* @author zxc |
|
|
|
|
|
* @date 2021/9/13 10:03 上午 |
|
|
|
|
|
*/ |
|
|
|
|
|
public String getHm(Integer seconds){ |
|
|
|
|
|
String result = "0分钟"; |
|
|
|
|
|
if (seconds >= NumConstant.SIXTY) { |
|
|
|
|
|
Integer hours = seconds / 3600; |
|
|
|
|
|
Integer minutes = seconds % 3600 / 60; |
|
|
|
|
|
result = (hours < NumConstant.ONE ? "" : hours + "小时") + (minutes < NumConstant.ONE ? "" : minutes + "分钟"); |
|
|
|
|
|
}else if (seconds < NumConstant.SIXTY && seconds > NumConstant.ZERO){ |
|
|
|
|
|
result = "1分钟"; |
|
|
|
|
|
} |
|
|
|
|
|
return result; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* @Description 表头获取 |
|
|
|
|
|
* @Param formDTO |
|
|
|
|
|
* @author zxc |
|
|
|
|
|
* @date 2021/9/13 10:02 上午 |
|
|
|
|
|
*/ |
|
|
|
|
|
public String excelName(CustomerDataManageFormDTO formDTO){ |
|
|
|
|
|
StringBuffer s = new StringBuffer(); |
|
|
|
|
|
String agencyName = indexService.selectAgencyNameByAgencyId(formDTO.getAgencyId()); |
|
|
|
|
|
s.append(agencyName); |
|
|
|
|
|
if (StringUtils.isNotBlank(formDTO.getStartTime())){ |
|
|
|
|
|
String startTime = formDTO.getStartTime(); |
|
|
|
|
|
String sYear = startTime.substring(0, 4); |
|
|
|
|
|
String sMonth = startTime.substring(4, 6); |
|
|
|
|
|
String sDay = startTime.substring(6, 8); |
|
|
|
|
|
String endTime = formDTO.getEndTime(); |
|
|
|
|
|
String eYear = endTime.substring(0, 4); |
|
|
|
|
|
String eMonth = endTime.substring(4, 6); |
|
|
|
|
|
String eDay = endTime.substring(6, 8); |
|
|
|
|
|
s.append(sYear).append("年").append(sMonth).append("月").append(sDay).append("日-") |
|
|
|
|
|
.append(eYear).append("年").append(eMonth).append("月").append(eDay).append("日区间新增值"); |
|
|
|
|
|
}else { |
|
|
|
|
|
String endTime = formDTO.getEndTime(); |
|
|
|
|
|
String eYear = endTime.substring(0, 4); |
|
|
|
|
|
String eMonth = endTime.substring(4, 6); |
|
|
|
|
|
String eDay = endTime.substring(6, 8); |
|
|
|
|
|
s.append(eYear).append("年").append(eMonth).append("月").append(eDay).append("日截止累计值"); |
|
|
|
|
|
} |
|
|
|
|
|
return s.toString(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* @Param formDTO |
|
|
|
|
|
* @Description 运营情况数据查询 |
|
|
|
|
|
* @author sun |
|
|
|
|
|
*/ |
|
|
|
|
|
@Override |
|
|
|
|
|
public List<CustomerDataManageResultDTO> operateExport(CustomerDataManageFormDTO formDTO) throws ParseException { |
|
|
|
|
|
//1.必要参数校验及处理
|
|
|
|
|
|
if (!"Interval".equals(formDTO.getType()) && StringUtils.isEmpty(formDTO.getStartTime())) { |
|
|
|
|
|
throw new RenException("请选择开始时间或查询累计值"); |
|
|
|
|
|
} |
|
|
|
|
|
//入参有开始时间的则需要减去一天
|
|
|
|
|
|
if (StringUtils.isNotBlank(formDTO.getStartTime())) { |
|
|
|
|
|
SimpleDateFormat format = new SimpleDateFormat(DateUtils.DATE_PATTERN_YYYYMMDD); |
|
|
|
|
|
Date date = format.parse(formDTO.getStartTime()); |
|
|
|
|
|
Date yesterday = DateUtils.addDateDays(date, -1); |
|
|
|
|
|
formDTO.setStartTime(format.format(yesterday)); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//2.查询组织现在,判断查询下级组织还是网格数据
|
|
|
|
|
|
ScreenAgencyOrGridListDTO agencyGrid = indexService.getSubAgencyOrGridList(formDTO.getAgencyId()); |
|
|
|
|
|
if (null == agencyGrid) { |
|
|
|
|
|
return new ArrayList<>(); |
|
|
|
|
|
} |
|
|
|
|
|
List<String> idList; |
|
|
|
|
|
if (!"community".equals(agencyGrid.getLevel())) { |
|
|
|
|
|
//组织层级用户、群组、话题、议题、项目、巡查数据查询
|
|
|
|
|
|
idList = agencyGrid.getAgencyGridList().stream().map(ScreenAgencyOrGridListDTO.AgencyGrid::getAgencyId).collect(Collectors.toList()); |
|
|
|
|
|
} else { |
|
|
|
|
|
//网格层级用户、群组、话题、议题、项目、巡查数据查询
|
|
|
|
|
|
idList = agencyGrid.getAgencyGridList().stream().map(ScreenAgencyOrGridListDTO.AgencyGrid::getGridId).collect(Collectors.toList()); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
//3.封装数据并返回
|
|
|
|
|
|
return null; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|