Browse Source

Merge remote-tracking branch 'remotes/origin/dev'

master
jianjun 4 years ago
parent
commit
db933e49ae
  1. 21
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/result/PatrolDailySumResult.java
  2. 5
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/evaluationindex/ScreenCustomerAgencyDTO.java
  3. 5
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmetuser/StatsStaffPatrolRecordDailyDao.java
  4. 51
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/datastats/impl/DataStatsServiceImpl.java
  5. 3
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/StatsStaffPatrolRecordDailyService.java
  6. 7
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/StatsStaffPatrolRecordDailyServiceImpl.java
  7. 13
      epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/StatsStaffPatrolRecordDailyDao.xml
  8. 5
      epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/evaluationindex/EvaluationIndexDao.xml

21
epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/result/PatrolDailySumResult.java

@ -0,0 +1,21 @@
package com.epmet.dataaggre.dto.epmetuser.result;
import lombok.Data;
import java.io.Serializable;
/**
* desc:
*
* @author: LiuJanJun
* @date: 2021/8/8 11:01 上午
* @version: 1.0
*/
@Data
public class PatrolDailySumResult implements Serializable {
private static final long serialVersionUID = 310405655189243944L;
private String fullAgencyId;
private Integer patrolTotal;
private Integer totalTime;
}

5
epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/evaluationindex/ScreenCustomerAgencyDTO.java

@ -23,6 +23,11 @@ public class ScreenCustomerAgencyDTO implements Serializable {
*/ */
private String agencyId; private String agencyId;
/**
* pids
*/
private String pids;
/** /**
* 组织名称 * 组织名称
*/ */

5
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmetuser/StatsStaffPatrolRecordDailyDao.java

@ -19,6 +19,7 @@ package com.epmet.dataaggre.dao.epmetuser;
import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dataaggre.dto.epmetuser.result.PatrolDailySumResult;
import com.epmet.dataaggre.entity.epmetuser.StatsStaffPatrolRecordDailyEntity; import com.epmet.dataaggre.entity.epmetuser.StatsStaffPatrolRecordDailyEntity;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
@ -36,10 +37,10 @@ public interface StatsStaffPatrolRecordDailyDao extends BaseDao<StatsStaffPatrol
/** /**
* desc:获取巡查次数和时间 * desc:获取巡查次数和时间
* @param agencyList * @param agencyFullIdList
* @param startDateId * @param startDateId
* @param endDateId * @param endDateId
* @return * @return
*/ */
List<StatsStaffPatrolRecordDailyEntity> getPatrolSumList(@Param("agencyList") List<String> agencyList, @Param("startDateId") String startDateId, @Param("endDateId") String endDateId); List<PatrolDailySumResult> getPatrolSumList(@Param("agencyFullIdList") List<String> agencyFullIdList, @Param("startDateId") String startDateId, @Param("endDateId") String endDateId);
} }

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

@ -2,7 +2,8 @@
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.enums.OrgLevelEnum; import com.epmet.commons.tools.constant.StrConstant;
import com.epmet.commons.tools.enums.OrgLevelEnum;
import com.epmet.commons.tools.utils.DateUtils; import com.epmet.commons.tools.utils.DateUtils;
import com.epmet.dataaggre.constant.DataSourceConstant; import com.epmet.dataaggre.constant.DataSourceConstant;
import com.epmet.dataaggre.constant.OrgConstant; import com.epmet.dataaggre.constant.OrgConstant;
@ -11,6 +12,7 @@ import com.epmet.dataaggre.dao.datastats.FactGridMemberStatisticsDailyDao;
import com.epmet.dataaggre.dto.datastats.FactGroupActDailyDTO; import com.epmet.dataaggre.dto.datastats.FactGroupActDailyDTO;
import com.epmet.dataaggre.dto.datastats.form.*; import com.epmet.dataaggre.dto.datastats.form.*;
import com.epmet.dataaggre.dto.datastats.result.*; import com.epmet.dataaggre.dto.datastats.result.*;
import com.epmet.dataaggre.dto.epmetuser.result.PatrolDailySumResult;
import com.epmet.dataaggre.dto.evaluationindex.ScreenCustomerAgencyDTO; import com.epmet.dataaggre.dto.evaluationindex.ScreenCustomerAgencyDTO;
import com.epmet.dataaggre.dto.evaluationindex.ScreenCustomerGridDTO; import com.epmet.dataaggre.dto.evaluationindex.ScreenCustomerGridDTO;
import com.epmet.dataaggre.dto.evaluationindex.ScreenGovernRankDataDailyDTO; import com.epmet.dataaggre.dto.evaluationindex.ScreenGovernRankDataDailyDTO;
@ -19,7 +21,6 @@ import com.epmet.dataaggre.dto.resigroup.ActCategoryDictDTO;
import com.epmet.dataaggre.dto.resigroup.result.GroupActRankDetailDTO; import com.epmet.dataaggre.dto.resigroup.result.GroupActRankDetailDTO;
import com.epmet.dataaggre.entity.datastats.DimAgencyEntity; import com.epmet.dataaggre.entity.datastats.DimAgencyEntity;
import com.epmet.dataaggre.entity.datastats.FactAgencyGovernDailyEntity; import com.epmet.dataaggre.entity.datastats.FactAgencyGovernDailyEntity;
import com.epmet.dataaggre.entity.epmetuser.StatsStaffPatrolRecordDailyEntity;
import com.epmet.dataaggre.service.datastats.DataStatsService; import com.epmet.dataaggre.service.datastats.DataStatsService;
import com.epmet.dataaggre.service.epmetuser.StatsStaffPatrolRecordDailyService; import com.epmet.dataaggre.service.epmetuser.StatsStaffPatrolRecordDailyService;
import com.epmet.dataaggre.service.evaluationindex.EvaluationIndexService; import com.epmet.dataaggre.service.evaluationindex.EvaluationIndexService;
@ -1538,8 +1539,8 @@ public class DataStatsServiceImpl implements DataStatsService {
Map<String, Integer> closeProjectStartMap = closeProjectStart.stream().collect(Collectors.toMap(SubGridProjectResultDTO::getGridId, SubGridProjectResultDTO::getClosedProjectTotal, (o1, o2) -> o1)); Map<String, Integer> closeProjectStartMap = closeProjectStart.stream().collect(Collectors.toMap(SubGridProjectResultDTO::getGridId, SubGridProjectResultDTO::getClosedProjectTotal, (o1, o2) -> o1));
Map<String, Integer> closeProjectEndMap = closeProjectEnd.stream().collect(Collectors.toMap(SubGridProjectResultDTO::getGridId, SubGridProjectResultDTO::getClosedProjectTotal, (o1, o2) -> o1)); Map<String, Integer> closeProjectEndMap = closeProjectEnd.stream().collect(Collectors.toMap(SubGridProjectResultDTO::getGridId, SubGridProjectResultDTO::getClosedProjectTotal, (o1, o2) -> o1));
//巡查次数和时间 //巡查次数和时间
List<StatsStaffPatrolRecordDailyEntity> patrolList = statsStaffPatrolRecordDailyService.getPatrolSumList(gridIdList,formDTO.getStartDateId(),formDTO.getEndDateId()); List<PatrolDailySumResult> patrolList = statsStaffPatrolRecordDailyService.getPatrolSumList(gridIdList,formDTO.getStartDateId(),formDTO.getEndDateId());
Map<String, StatsStaffPatrolRecordDailyEntity> patrolListMap = patrolList.stream().collect(Collectors.toMap(StatsStaffPatrolRecordDailyEntity::getAgencyId, o -> o, (o1, o2) -> o1)); Map<String, PatrolDailySumResult> patrolListMap = patrolList.stream().collect(Collectors.toMap(PatrolDailySumResult::getFullAgencyId, o -> o, (o1, o2) -> o1));
subAgencyList.forEach(agency->{ subAgencyList.forEach(agency->{
String gridId = agency.getGridId(); String gridId = agency.getGridId();
@ -1549,14 +1550,9 @@ public class DataStatsServiceImpl implements DataStatsService {
resultDTO.setTopicToIssueTotal(getTotal(toIssueStartMap,toIssueEndMap,gridId)); resultDTO.setTopicToIssueTotal(getTotal(toIssueStartMap,toIssueEndMap,gridId));
resultDTO.setIssueToProjectTotal(getTotal(toProjectStartMap,toProjectEndMap,gridId)); resultDTO.setIssueToProjectTotal(getTotal(toProjectStartMap,toProjectEndMap,gridId));
resultDTO.setClosedProjectTotal(getTotal(closeProjectStartMap,closeProjectEndMap,gridId)); resultDTO.setClosedProjectTotal(getTotal(closeProjectStartMap,closeProjectEndMap,gridId));
StatsStaffPatrolRecordDailyEntity patrolRecordDTO = patrolListMap.get(gridId);
if (patrolRecordDTO != null){ PatrolDailySumResult patrolRecordDTO = patrolListMap.get(agency.getAllParentIds());
resultDTO.setPatrolTotal(patrolRecordDTO.getPatrolTotal()); setPatrolAttr(resultDTO, patrolRecordDTO);
Integer totalTime = patrolRecordDTO.getTotalTime();
int minutes = totalTime / 60;
String totalTimeDesc = minutes / 60 + "小时"+ minutes % 60 + "分";
resultDTO.setPatrolTotalTime(totalTimeDesc);
}
result.add(resultDTO); result.add(resultDTO);
}); });
}else { }else {
@ -1583,8 +1579,9 @@ public class DataStatsServiceImpl implements DataStatsService {
Map<String, Integer> closeProjectStartMap = closeProjectStart.stream().collect(Collectors.toMap(SubAgencyProjectResultDTO::getAgencyId, SubAgencyProjectResultDTO::getClosedProjectTotal, (o1, o2) -> o1)); Map<String, Integer> closeProjectStartMap = closeProjectStart.stream().collect(Collectors.toMap(SubAgencyProjectResultDTO::getAgencyId, SubAgencyProjectResultDTO::getClosedProjectTotal, (o1, o2) -> o1));
Map<String, Integer> closeProjectEndMap = closeProjectEnd.stream().collect(Collectors.toMap(SubAgencyProjectResultDTO::getAgencyId, SubAgencyProjectResultDTO::getClosedProjectTotal, (o1, o2) -> o1)); Map<String, Integer> closeProjectEndMap = closeProjectEnd.stream().collect(Collectors.toMap(SubAgencyProjectResultDTO::getAgencyId, SubAgencyProjectResultDTO::getClosedProjectTotal, (o1, o2) -> o1));
//巡查次数和时间 //巡查次数和时间
List<StatsStaffPatrolRecordDailyEntity> patrolList = statsStaffPatrolRecordDailyService.getPatrolSumList(agencyList,formDTO.getStartDateId(),formDTO.getEndDateId()); List<String> agencyFullIds = subAgencyList.stream().map(o -> o.getPids().concat(StrConstant.COLON).concat(o.getAgencyId())).collect(Collectors.toList());
Map<String, StatsStaffPatrolRecordDailyEntity> patrolListMap = patrolList.stream().collect(Collectors.toMap(StatsStaffPatrolRecordDailyEntity::getAgencyId, o -> o, (o1, o2) -> o1)); List<PatrolDailySumResult> patrolList = statsStaffPatrolRecordDailyService.getPatrolSumList(agencyFullIds,formDTO.getStartDateId(),formDTO.getEndDateId());
Map<String, PatrolDailySumResult> patrolListMap = patrolList.stream().collect(Collectors.toMap(PatrolDailySumResult::getFullAgencyId, o -> o, (o1, o2) -> o1));
subAgencyList.forEach(agency->{ subAgencyList.forEach(agency->{
String agencyId = agency.getAgencyId(); String agencyId = agency.getAgencyId();
@ -1594,14 +1591,9 @@ public class DataStatsServiceImpl implements DataStatsService {
resultDTO.setTopicToIssueTotal(getTotal(toIssueStartMap,toIssueEndMap,agencyId)); resultDTO.setTopicToIssueTotal(getTotal(toIssueStartMap,toIssueEndMap,agencyId));
resultDTO.setIssueToProjectTotal(getTotal(toProjectStartMap,toProjectEndMap,agencyId)); resultDTO.setIssueToProjectTotal(getTotal(toProjectStartMap,toProjectEndMap,agencyId));
resultDTO.setClosedProjectTotal(getTotal(closeProjectStartMap,closeProjectEndMap,agencyId)); resultDTO.setClosedProjectTotal(getTotal(closeProjectStartMap,closeProjectEndMap,agencyId));
StatsStaffPatrolRecordDailyEntity patrolRecordDTO = patrolListMap.get(agencyId); String fullAgencyId = agency.getPids().concat(StrConstant.COLON).concat(agencyId);
if (patrolRecordDTO != null){ PatrolDailySumResult patrolRecordDTO = patrolListMap.get(fullAgencyId);
resultDTO.setPatrolTotal(patrolRecordDTO.getPatrolTotal()); setPatrolAttr(resultDTO,patrolRecordDTO);
Integer totalTime = patrolRecordDTO.getTotalTime();
int minutes = totalTime / 60;
String totalTimeDesc = minutes / 60 + "小时"+ minutes % 60 + "分";
resultDTO.setPatrolTotalTime(totalTimeDesc);
}
result.add(resultDTO); result.add(resultDTO);
}); });
} }
@ -1609,6 +1601,21 @@ public class DataStatsServiceImpl implements DataStatsService {
List<WorkFactResultDTO> newResult = result.stream().sorted(Comparator.comparing(o -> o.getTopicToIssueTotal() + o.getIssueToProjectTotal() + o.getClosedProjectTotal() + o.getPatrolTotal())).collect(Collectors.toList()); List<WorkFactResultDTO> newResult = result.stream().sorted(Comparator.comparing(o -> o.getTopicToIssueTotal() + o.getIssueToProjectTotal() + o.getClosedProjectTotal() + o.getPatrolTotal())).collect(Collectors.toList());
return newResult; return newResult;
} }
private void setPatrolAttr(WorkFactResultDTO resultDTO, PatrolDailySumResult patrolRecordDTO) {
if (patrolRecordDTO != null){
resultDTO.setPatrolTotal(patrolRecordDTO.getPatrolTotal());
Integer totalTime = patrolRecordDTO.getTotalTime();
if (totalTime != null || totalTime > 0){
int minutes = totalTime / 60;
if (minutes >0){
String totalTimeDesc = minutes / 60 + "小时"+ minutes % 60 + "分";
resultDTO.setPatrolTotalTime(totalTimeDesc);
}
}
}
}
private Integer getTotal(Map<String,Integer> startMap, Map<String,Integer> endMap,String agencyId){ private Integer getTotal(Map<String,Integer> startMap, Map<String,Integer> endMap,String agencyId){
Integer total1 = startMap.getOrDefault(agencyId,NumConstant.ZERO); Integer total1 = startMap.getOrDefault(agencyId,NumConstant.ZERO);
Integer total2 = endMap.getOrDefault(agencyId,NumConstant.ZERO); Integer total2 = endMap.getOrDefault(agencyId,NumConstant.ZERO);

3
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/StatsStaffPatrolRecordDailyService.java

@ -18,6 +18,7 @@
package com.epmet.dataaggre.service.epmetuser; package com.epmet.dataaggre.service.epmetuser;
import com.epmet.commons.mybatis.service.BaseService; import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.dataaggre.dto.epmetuser.result.PatrolDailySumResult;
import com.epmet.dataaggre.entity.epmetuser.StatsStaffPatrolRecordDailyEntity; import com.epmet.dataaggre.entity.epmetuser.StatsStaffPatrolRecordDailyEntity;
import java.util.List; import java.util.List;
@ -37,6 +38,6 @@ public interface StatsStaffPatrolRecordDailyService extends BaseService<StatsSta
* @param endDateId * @param endDateId
* @return * @return
*/ */
List<StatsStaffPatrolRecordDailyEntity> getPatrolSumList(List<String> agencyList, String startDateId, String endDateId); List<PatrolDailySumResult> getPatrolSumList(List<String> agencyList, String startDateId, String endDateId);
} }

7
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/StatsStaffPatrolRecordDailyServiceImpl.java

@ -4,6 +4,7 @@ import com.epmet.commons.dynamic.datasource.annotation.DataSource;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.dataaggre.constant.DataSourceConstant; import com.epmet.dataaggre.constant.DataSourceConstant;
import com.epmet.dataaggre.dao.epmetuser.StatsStaffPatrolRecordDailyDao; import com.epmet.dataaggre.dao.epmetuser.StatsStaffPatrolRecordDailyDao;
import com.epmet.dataaggre.dto.epmetuser.result.PatrolDailySumResult;
import com.epmet.dataaggre.entity.epmetuser.StatsStaffPatrolRecordDailyEntity; import com.epmet.dataaggre.entity.epmetuser.StatsStaffPatrolRecordDailyEntity;
import com.epmet.dataaggre.service.epmetuser.StatsStaffPatrolRecordDailyService; import com.epmet.dataaggre.service.epmetuser.StatsStaffPatrolRecordDailyService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
@ -25,14 +26,14 @@ public class StatsStaffPatrolRecordDailyServiceImpl extends BaseServiceImpl<Stat
/** /**
* desc:获取组织或网格的 时间段内的总次数等 * desc:获取组织或网格的 时间段内的总次数等
* *
* @param agencyList * @param agencyFullIdList
* @param startDateId * @param startDateId
* @param endDateId * @param endDateId
* @return * @return
*/ */
@Override @Override
public List<StatsStaffPatrolRecordDailyEntity> getPatrolSumList(List<String> agencyList, String startDateId, String endDateId) { public List<PatrolDailySumResult> getPatrolSumList(List<String> agencyFullIdList, String startDateId, String endDateId) {
return baseDao.getPatrolSumList(agencyList,startDateId,endDateId); return baseDao.getPatrolSumList(agencyFullIdList,startDateId,endDateId);
} }
} }

13
epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/StatsStaffPatrolRecordDailyDao.xml

@ -1,17 +1,18 @@
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.epmet.dataaggre.dao.epmetuser.StatsStaffPatrolRecordDailyDao"> <mapper namespace="com.epmet.dataaggre.dao.epmetuser.StatsStaffPatrolRecordDailyDao">
<select id="getPatrolSumList" resultType="com.epmet.dataaggre.entity.epmetuser.StatsStaffPatrolRecordDailyEntity"> <select id="getPatrolSumList" resultType="com.epmet.dataaggre.dto.epmetuser.result.PatrolDailySumResult">
<foreach collection="agencyFullIdList" item="fullAgencyId" separator="UNION ALL">
SELECT SELECT
agency_id, LEFT (GRID_PIDS,LENGTH( #{fullAgencyId} )) fullAgencyId,
sum(patrol_total) patrolTotal, sum(patrol_total) patrolTotal,
sum(TOTAL_TIME) totalTime sum(TOTAL_TIME) totalTime
FROM stats_staff_patrol_record_daily FROM stats_staff_patrol_record_daily
WHERE del_flag = '0' WHERE del_flag = '0'
AND date_id BETWEEN #{startDateId} and #{endDateId} AND date_id BETWEEN #{startDateId} and #{endDateId}
<foreach item="agencyId" collection="agencyList" open="AND (" separator="or" close=")" index=""> AND GRID_PIDS like CONCAT( #{fullAgencyId},'%')
GRID_PIDS like CONCAT( #{agencyId},'%') GROUP BY fullAgencyId
</foreach> </foreach>
GROUP BY customer_id,agency_id
</select> </select>
</mapper> </mapper>

5
epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/evaluationindex/EvaluationIndexDao.xml

@ -154,7 +154,8 @@
agency_name AS agencyName, agency_name AS agencyName,
level AS level, level AS level,
area_code AS areaCode, area_code AS areaCode,
parent_area_code AS parentAreaCode parent_area_code AS parentAreaCode,
PIDS
FROM FROM
screen_customer_agency screen_customer_agency
WHERE WHERE
@ -174,4 +175,4 @@
</if> </if>
</select> </select>
</mapper> </mapper>

Loading…
Cancel
Save