Browse Source

Merge branch 'dev_export_excel' into develop

master
sunyuchao 4 years ago
parent
commit
0b47b0a8d7
  1. 2
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/datastats/form/CustomerDataManageFormDTO.java
  2. 124
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/datastats/impl/DataStatsServiceImpl.java
  3. 20
      epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/datastats/DatsStatsDao.xml

2
epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/datastats/form/CustomerDataManageFormDTO.java

@ -60,6 +60,8 @@ public class CustomerDataManageFormDTO implements Serializable {
//组织或网格Id集合 //组织或网格Id集合
private List<String> idList; private List<String> idList;
//按起始时间还是结束时间查数据【start end】
private String sourceType;
//数据类型【组织agency 网格grid】 //数据类型【组织agency 网格grid】
private String dataType; private String dataType;
} }

124
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/datastats/impl/DataStatsServiceImpl.java

@ -1960,34 +1960,46 @@ public class DataStatsServiceImpl implements DataStatsService {
resultDTO.setTotal(idList.size()); resultDTO.setTotal(idList.size());
//3.查询截止日期用户、群组、话题、议题、项目、巡查数据 //3.查询截止日期用户、群组、话题、议题、项目、巡查数据
formDTO.setSourceType("end");
List<CustomerDataManageResultDTO.CustomerDataManage> userEnd = dataStatsDao.regUserList(formDTO); List<CustomerDataManageResultDTO.CustomerDataManage> userEnd = dataStatsDao.regUserList(formDTO);
HashMap<String, CustomerDataManageResultDTO.CustomerDataManage> uEndMap = new HashMap<>();
userEnd.stream().forEach(u->uEndMap.put(u.getOrgId(),u));
List<CustomerDataManageResultDTO.CustomerDataManage> groupEnd = dataStatsDao.groupList(formDTO); List<CustomerDataManageResultDTO.CustomerDataManage> groupEnd = dataStatsDao.groupList(formDTO);
HashMap<String, CustomerDataManageResultDTO.CustomerDataManage> gEndMap = new HashMap<>();
groupEnd.stream().forEach(u->gEndMap.put(u.getOrgId(),u));
List<CustomerDataManageResultDTO.CustomerDataManage> topicEnd = dataStatsDao.topicList(formDTO); List<CustomerDataManageResultDTO.CustomerDataManage> topicEnd = dataStatsDao.topicList(formDTO);
HashMap<String, CustomerDataManageResultDTO.CustomerDataManage> tEndMap = new HashMap<>();
topicEnd.stream().forEach(u->tEndMap.put(u.getOrgId(),u));
List<CustomerDataManageResultDTO.CustomerDataManage> issueEnd = dataStatsDao.issueList(formDTO); List<CustomerDataManageResultDTO.CustomerDataManage> issueEnd = dataStatsDao.issueList(formDTO);
HashMap<String, CustomerDataManageResultDTO.CustomerDataManage> iEndMap = new HashMap<>();
issueEnd.stream().forEach(u->iEndMap.put(u.getOrgId(),u));
List<CustomerDataManageResultDTO.CustomerDataManage> projectEnd = dataStatsDao.projectList(formDTO); List<CustomerDataManageResultDTO.CustomerDataManage> projectEnd = dataStatsDao.projectList(formDTO);
HashMap<String, CustomerDataManageResultDTO.CustomerDataManage> pEndMap = new HashMap<>();
projectEnd.stream().forEach(u->pEndMap.put(u.getOrgId(),u));
//巡查数据不区分区间差值,只计算累计值,人员做去重处理且是有巡查记录的人员 //巡查数据不区分区间差值,只计算累计值,人员做去重处理且是有巡查记录的人员
List<CustomerDataManageResultDTO.CustomerDataManage> patrolEnd = statsStaffPatrolRecordDailyService.patrolList(formDTO); List<CustomerDataManageResultDTO.CustomerDataManage> patrolEnd = statsStaffPatrolRecordDailyService.patrolList(formDTO);
//4.判断是否需要查询起始日期用户、群组、话题、议题、项目、巡查数据 //4.判断是否需要查询起始日期用户、群组、话题、议题、项目、巡查数据
List<CustomerDataManageResultDTO.CustomerDataManage> userStart = new ArrayList<>(); HashMap<String, CustomerDataManageResultDTO.CustomerDataManage> uStartMap = new HashMap<>();
List<CustomerDataManageResultDTO.CustomerDataManage> groupStart = new ArrayList<>(); HashMap<String, CustomerDataManageResultDTO.CustomerDataManage> gStartMap = new HashMap<>();
List<CustomerDataManageResultDTO.CustomerDataManage> topicStart = new ArrayList<>(); HashMap<String, CustomerDataManageResultDTO.CustomerDataManage> tStartMap = new HashMap<>();
List<CustomerDataManageResultDTO.CustomerDataManage> issueStart = new ArrayList<>(); HashMap<String, CustomerDataManageResultDTO.CustomerDataManage> iStartMap = new HashMap<>();
List<CustomerDataManageResultDTO.CustomerDataManage> projectStart = new ArrayList<>(); HashMap<String, CustomerDataManageResultDTO.CustomerDataManage> pStartMap = new HashMap<>();
if ("Interval".equals(formDTO.getType())) { if ("Interval".equals(formDTO.getType())) {
userStart = dataStatsDao.regUserList(formDTO); formDTO.setSourceType("start");
groupStart = dataStatsDao.groupList(formDTO); List<CustomerDataManageResultDTO.CustomerDataManage> userStart = dataStatsDao.regUserList(formDTO);
topicStart = dataStatsDao.topicList(formDTO); userStart.stream().forEach(u->uStartMap.put(u.getOrgId(),u));
issueStart = dataStatsDao.issueList(formDTO); List<CustomerDataManageResultDTO.CustomerDataManage> groupStart = dataStatsDao.groupList(formDTO);
projectStart = dataStatsDao.projectList(formDTO); groupStart.stream().forEach(u->gStartMap.put(u.getOrgId(),u));
List<CustomerDataManageResultDTO.CustomerDataManage> topicStart = dataStatsDao.topicList(formDTO);
topicStart.stream().forEach(u->tStartMap.put(u.getOrgId(),u));
List<CustomerDataManageResultDTO.CustomerDataManage> issueStart = dataStatsDao.issueList(formDTO);
issueStart.stream().forEach(u->iStartMap.put(u.getOrgId(),u));
List<CustomerDataManageResultDTO.CustomerDataManage> projectStart = dataStatsDao.projectList(formDTO);
projectStart.stream().forEach(u->pStartMap.put(u.getOrgId(),u));
} }
//5.封装数据 //5.封装数据
List<CustomerDataManageResultDTO.CustomerDataManage> finalUserStart = userStart;
List<CustomerDataManageResultDTO.CustomerDataManage> finalGroupStart = groupStart;
List<CustomerDataManageResultDTO.CustomerDataManage> finalTopicStart = topicStart;
List<CustomerDataManageResultDTO.CustomerDataManage> finalIssueStart = issueStart;
List<CustomerDataManageResultDTO.CustomerDataManage> finalProjectStart = projectStart;
agencyGrid.getAgencyGridList().forEach(org -> { agencyGrid.getAgencyGridList().forEach(org -> {
CustomerDataManageResultDTO.CustomerDataManage dto = new CustomerDataManageResultDTO.CustomerDataManage(); CustomerDataManageResultDTO.CustomerDataManage dto = new CustomerDataManageResultDTO.CustomerDataManage();
dto.setOrgId(org.getOrgId()); dto.setOrgId(org.getOrgId());
@ -1995,75 +2007,45 @@ public class DataStatsServiceImpl implements DataStatsService {
int user = 0; int user = 0;
int resi = 0; int resi = 0;
int part = 0; int part = 0;
for (CustomerDataManageResultDTO.CustomerDataManage u : userEnd) { if(uEndMap.containsKey(org.getOrgId())){
if (org.getOrgId().equals(u.getOrgId())) { user = uEndMap.get(org.getOrgId()).getUserCount();
user = u.getUserCount(); resi = uEndMap.get(org.getOrgId()).getResidentCount();
resi = u.getResidentCount(); part = uEndMap.get(org.getOrgId()).getPartyMemberCount();
part = u.getPartyMemberCount(); if ("Interval".equals(formDTO.getType())&&uStartMap.containsKey(org.getOrgId())) {
if ("Interval".equals(formDTO.getType())) { user = user - uStartMap.get(org.getOrgId()).getUserCount();
for (CustomerDataManageResultDTO.CustomerDataManage s : finalUserStart) { resi = resi - uStartMap.get(org.getOrgId()).getResidentCount();
if (u.getOrgId().equals(s.getOrgId())) { part = part - uStartMap.get(org.getOrgId()).getPartyMemberCount();
user = user - s.getUserCount();
resi = resi - s.getResidentCount();
part = part - s.getPartyMemberCount();
}
}
}
} }
} }
int group = 0; int group = 0;
for (CustomerDataManageResultDTO.CustomerDataManage u : groupEnd) { if(gEndMap.containsKey(org.getOrgId())){
if (org.getOrgId().equals(u.getOrgId())) { group = gEndMap.get(org.getOrgId()).getGroupCount();
group = u.getGroupCount(); if ("Interval".equals(formDTO.getType())&&gStartMap.containsKey(org.getOrgId())) {
if ("Interval".equals(formDTO.getType())) { group = group - gStartMap.get(org.getOrgId()).getGroupCount();
for (CustomerDataManageResultDTO.CustomerDataManage s : finalGroupStart) {
if (u.getOrgId().equals(s.getOrgId())) {
group = group - s.getGroupCount();
}
}
}
} }
} }
int topic = 0; int topic = 0;
for (CustomerDataManageResultDTO.CustomerDataManage u : topicEnd) { if(tEndMap.containsKey(org.getOrgId())){
if (org.getOrgId().equals(u.getOrgId())) { topic = tEndMap.get(org.getOrgId()).getTopicCount();
topic = u.getTopicCount(); if ("Interval".equals(formDTO.getType())&&tStartMap.containsKey(org.getOrgId())) {
if ("Interval".equals(formDTO.getType())) { topic = topic - tStartMap.get(org.getOrgId()).getTopicCount();
for (CustomerDataManageResultDTO.CustomerDataManage s : finalTopicStart) {
if (u.getOrgId().equals(s.getOrgId())) {
topic = topic - s.getTopicCount();
}
}
}
} }
} }
int issue = 0; int issue = 0;
for (CustomerDataManageResultDTO.CustomerDataManage u : issueEnd) { if(iEndMap.containsKey(org.getOrgId())){
if (org.getOrgId().equals(u.getOrgId())) { issue = iEndMap.get(org.getOrgId()).getIssueCount();
issue = u.getIssueCount(); if ("Interval".equals(formDTO.getType())&&iStartMap.containsKey(org.getOrgId())) {
if ("Interval".equals(formDTO.getType())) { issue = issue - iStartMap.get(org.getOrgId()).getIssueCount();
for (CustomerDataManageResultDTO.CustomerDataManage s : finalIssueStart) {
if (u.getOrgId().equals(s.getOrgId())) {
issue = issue - s.getIssueCount();
}
}
}
} }
} }
int project = 0; int project = 0;
int closed = 0; int closed = 0;
for (CustomerDataManageResultDTO.CustomerDataManage u : projectEnd) { if(pEndMap.containsKey(org.getOrgId())){
if (org.getOrgId().equals(u.getOrgId())) { project = pEndMap.get(org.getOrgId()).getProjectCount();
project = u.getProjectCount(); closed = pEndMap.get(org.getOrgId()).getClosedProjectCount();
closed = u.getClosedProjectCount(); if ("Interval".equals(formDTO.getType())&&pStartMap.containsKey(org.getOrgId())) {
if ("Interval".equals(formDTO.getType())) { project = project - pStartMap.get(org.getOrgId()).getProjectCount();
for (CustomerDataManageResultDTO.CustomerDataManage s : finalProjectStart) { closed = closed - pStartMap.get(org.getOrgId()).getClosedProjectCount();
if (u.getOrgId().equals(s.getOrgId())) {
project = project - s.getProjectCount();
closed = closed - s.getClosedProjectCount();
}
}
}
} }
} }
int patro = 0; int patro = 0;

20
epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/datastats/DatsStatsDao.xml

@ -822,11 +822,11 @@
</foreach> </foreach>
</otherwise> </otherwise>
</choose> </choose>
<if test='type != "" and type == "Interval" and startTime != "" and startTime != null '> <if test='sourceType != "" and sourceType == "start" and startTime != "" and startTime != null '>
AND date_id <![CDATA[>=]]> #{startTime} AND date_id <![CDATA[>=]]> #{startTime}
ORDER BY date_id ASC ORDER BY date_id ASC
</if> </if>
<if test='type != "" and type == "end" and endTime != "" and endTime != null '> <if test='sourceType != "" and sourceType == "end" and endTime != "" and endTime != null '>
AND date_id <![CDATA[<=]]> #{endTime} AND date_id <![CDATA[<=]]> #{endTime}
ORDER BY date_id DESC ORDER BY date_id DESC
</if> </if>
@ -862,11 +862,11 @@
</foreach> </foreach>
</otherwise> </otherwise>
</choose> </choose>
<if test='type != "" and type == "Interval" and startTime != "" and startTime != null '> <if test='sourceType != "" and sourceType == "start" and startTime != "" and startTime != null '>
AND date_id <![CDATA[>=]]> #{startTime} AND date_id <![CDATA[>=]]> #{startTime}
ORDER BY date_id ASC ORDER BY date_id ASC
</if> </if>
<if test='type != "" and type == "end" and endTime != "" and endTime != null '> <if test='sourceType != "" and sourceType == "end" and endTime != "" and endTime != null '>
AND date_id <![CDATA[<=]]> #{endTime} AND date_id <![CDATA[<=]]> #{endTime}
ORDER BY date_id DESC ORDER BY date_id DESC
</if> </if>
@ -902,11 +902,11 @@
</foreach> </foreach>
</otherwise> </otherwise>
</choose> </choose>
<if test='type != "" and type == "Interval" and startTime != "" and startTime != null '> <if test='sourceType != "" and sourceType == "start" and startTime != "" and startTime != null '>
AND date_id <![CDATA[>=]]> #{startTime} AND date_id <![CDATA[>=]]> #{startTime}
ORDER BY date_id ASC ORDER BY date_id ASC
</if> </if>
<if test='type != "" and type == "end" and endTime != "" and endTime != null '> <if test='sourceType != "" and sourceType == "end" and endTime != "" and endTime != null '>
AND date_id <![CDATA[<=]]> #{endTime} AND date_id <![CDATA[<=]]> #{endTime}
ORDER BY date_id DESC ORDER BY date_id DESC
</if> </if>
@ -942,11 +942,11 @@
</foreach> </foreach>
</otherwise> </otherwise>
</choose> </choose>
<if test='type != "" and type == "Interval" and startTime != "" and startTime != null '> <if test='sourceType != "" and sourceType == "start" and startTime != "" and startTime != null '>
AND date_id <![CDATA[>=]]> #{startTime} AND date_id <![CDATA[>=]]> #{startTime}
ORDER BY date_id ASC ORDER BY date_id ASC
</if> </if>
<if test='type != "" and type == "end" and endTime != "" and endTime != null '> <if test='sourceType != "" and sourceType == "end" and endTime != "" and endTime != null '>
AND date_id <![CDATA[<=]]> #{endTime} AND date_id <![CDATA[<=]]> #{endTime}
ORDER BY date_id DESC ORDER BY date_id DESC
</if> </if>
@ -982,11 +982,11 @@
</foreach> </foreach>
</otherwise> </otherwise>
</choose> </choose>
<if test='type != "" and type == "Interval" and startTime != "" and startTime != null '> <if test='sourceType != "" and sourceType == "start" and startTime != "" and startTime != null '>
AND date_id <![CDATA[>=]]> #{startTime} AND date_id <![CDATA[>=]]> #{startTime}
ORDER BY date_id ASC ORDER BY date_id ASC
</if> </if>
<if test='type != "" and type == "end" and endTime != "" and endTime != null '> <if test='sourceType != "" and sourceType == "end" and endTime != "" and endTime != null '>
AND date_id <![CDATA[<=]]> #{endTime} AND date_id <![CDATA[<=]]> #{endTime}
ORDER BY date_id DESC ORDER BY date_id DESC
</if> </if>

Loading…
Cancel
Save