12 changed files with 574 additions and 0 deletions
@ -0,0 +1,90 @@ |
|||
package com.epmet.dataaggre.dto.datastats.result; |
|||
|
|||
import lombok.AllArgsConstructor; |
|||
import lombok.Data; |
|||
import lombok.NoArgsConstructor; |
|||
|
|||
@Data |
|||
@NoArgsConstructor |
|||
@AllArgsConstructor |
|||
public class GridMemberDataStatsResultDTO { |
|||
/** |
|||
* yyyyMMdd |
|||
*/ |
|||
private String dateId; |
|||
|
|||
/** |
|||
* 月份ID |
|||
*/ |
|||
private String monthId; |
|||
|
|||
/** |
|||
* 年度ID |
|||
*/ |
|||
private String yearId; |
|||
|
|||
/** |
|||
* 客户ID |
|||
*/ |
|||
private String customerId; |
|||
|
|||
/** |
|||
* 组织ID |
|||
*/ |
|||
private String agencyId; |
|||
|
|||
/** |
|||
* 网格I |
|||
*/ |
|||
private String gridId; |
|||
|
|||
/** |
|||
* 上级ID(项目来源Agency的上级组织Id) |
|||
*/ |
|||
private String pid; |
|||
|
|||
/** |
|||
* 所有agencyId的上级组织ID(包含agencyId) |
|||
*/ |
|||
private String pids; |
|||
|
|||
/** |
|||
* 工作人员ID |
|||
*/ |
|||
private String staffId; |
|||
|
|||
/** |
|||
* 工作人员姓名 |
|||
*/ |
|||
private String staffName; |
|||
|
|||
/** |
|||
* 项目立项数 |
|||
*/ |
|||
private Integer projectCount; |
|||
|
|||
/** |
|||
* 议题转项目数 |
|||
*/ |
|||
private Integer issueToProjectCount; |
|||
|
|||
/** |
|||
* 议题关闭数 |
|||
*/ |
|||
private Integer closedIssueCount; |
|||
|
|||
/** |
|||
* 项目响应数 |
|||
*/ |
|||
private Integer projectResponseCount; |
|||
|
|||
/** |
|||
* 项目吹哨数 |
|||
*/ |
|||
private Integer projectTransferCount; |
|||
|
|||
/** |
|||
* 项目结案数 |
|||
*/ |
|||
private Integer projectClosedCount; |
|||
} |
@ -0,0 +1,23 @@ |
|||
package com.epmet.dataaggre.dto.govorg.form; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
import java.util.List; |
|||
|
|||
@Data |
|||
public class GridMemberDataAnalysisFromDTO { |
|||
|
|||
public interface listGridMemberDatas {} |
|||
|
|||
private List<String> gridIds; |
|||
|
|||
// 搜索的人员姓名
|
|||
private String searchedStaffName; |
|||
@NotBlank(message = "月份不能为空", groups = { listGridMemberDatas.class }) |
|||
private String month; |
|||
@NotBlank(message = "排序规则不能为空", groups = { listGridMemberDatas.class }) |
|||
private String sort; |
|||
private Integer pageNo = 1; |
|||
private Integer pageSize = 10; |
|||
} |
@ -0,0 +1,19 @@ |
|||
package com.epmet.dataaggre.dto.govorg.result; |
|||
|
|||
import lombok.Data; |
|||
|
|||
@Data |
|||
public class GridMemberDataAnalysisResultDTO { |
|||
|
|||
private String gridId; |
|||
private String staffId; |
|||
private String staffName; |
|||
private String orgName; |
|||
private Integer projectCount; |
|||
private Integer issueToProjectCount; |
|||
private Integer closedIssueCount; |
|||
private Integer projectResponseCount; |
|||
private Integer projectTransferCount; |
|||
private Integer projectClosedCount; |
|||
|
|||
} |
@ -0,0 +1,39 @@ |
|||
package com.epmet.dataaggre.enums; |
|||
|
|||
import java.util.ArrayList; |
|||
import java.util.List; |
|||
|
|||
public enum GridMemberDataAnalysisEnums { |
|||
|
|||
SORT_SORT_PROJECT_COUNT("projectCount", "project_count"), |
|||
SORT_ISSUE_TO_PROJECT_COUNT("issueToProjectCount", "issue_to_project_count"), |
|||
SORT_CLOSED_ISSUE_COUNT("closedIssueCount", "closed_issue_count"), |
|||
SORT_PROJECT_RESPONSE_COUNT("projectResponseCount", "project_response_count"), |
|||
SORT_PROJECT_TRANSFER_COUNT("projectTransferCount", "project_transfer_count"), |
|||
SORT_PROJECT_CLOSED_COUNT("projectClosedCount", "project_closed_count"); |
|||
|
|||
private String key; |
|||
private String value; |
|||
|
|||
GridMemberDataAnalysisEnums(String key, String value) { |
|||
this.key = key; |
|||
this.value = value; |
|||
} |
|||
|
|||
public static GridMemberDataAnalysisEnums get(String key) { |
|||
for (GridMemberDataAnalysisEnums gm : GridMemberDataAnalysisEnums.values()) { |
|||
if (gm.key.equals(key)) { |
|||
return gm; |
|||
} |
|||
} |
|||
return null; |
|||
} |
|||
|
|||
public String getKey() { |
|||
return key; |
|||
} |
|||
|
|||
public String getValue() { |
|||
return value; |
|||
} |
|||
} |
@ -0,0 +1,48 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.dataaggre.dao.datastats; |
|||
|
|||
import com.epmet.commons.mybatis.dao.BaseDao; |
|||
import com.epmet.dataaggre.dto.datastats.result.GridMemberDataStatsResultDTO; |
|||
import com.epmet.dataaggre.dto.govorg.result.GridMemberDataAnalysisResultDTO; |
|||
import com.epmet.dataaggre.entity.datastats.FactGridMemberStatisticsDailyEntity; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
import org.apache.ibatis.annotations.Param; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 网格员数据统计_日统计 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2021-07-05 |
|||
*/ |
|||
@Mapper |
|||
public interface FactGridMemberStatisticsDailyDao extends BaseDao<FactGridMemberStatisticsDailyEntity> { |
|||
|
|||
/** |
|||
* @Description 查询网格员统计数据 |
|||
* @return |
|||
* @author wxz |
|||
* @date 2021.07.05 13:19 |
|||
*/ |
|||
List<GridMemberDataAnalysisResultDTO > listGridMemberDataStats(@Param("gridIds") List<String> gridIds, |
|||
@Param("searchedStaffName") String searchedStaffName, |
|||
@Param("month") String month, |
|||
@Param("sort") String sort); |
|||
} |
@ -0,0 +1,121 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.dataaggre.entity.datastats; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.TableName; |
|||
|
|||
import com.epmet.commons.mybatis.entity.BaseEpmetEntity; |
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
|
|||
import java.util.Date; |
|||
|
|||
/** |
|||
* 网格员数据统计_日统计 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2021-07-05 |
|||
*/ |
|||
@Data |
|||
@EqualsAndHashCode(callSuper=false) |
|||
@TableName("fact_grid_member_statistics_daily") |
|||
public class FactGridMemberStatisticsDailyEntity extends BaseEpmetEntity { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* yyyyMMdd |
|||
*/ |
|||
private String dateId; |
|||
|
|||
/** |
|||
* 月份ID |
|||
*/ |
|||
private String monthId; |
|||
|
|||
/** |
|||
* 年度ID |
|||
*/ |
|||
private String yearId; |
|||
|
|||
/** |
|||
* 客户ID |
|||
*/ |
|||
private String customerId; |
|||
|
|||
/** |
|||
* 组织ID |
|||
*/ |
|||
private String agencyId; |
|||
|
|||
/** |
|||
* 网格I |
|||
*/ |
|||
private String gridId; |
|||
|
|||
/** |
|||
* 上级ID(项目来源Agency的上级组织Id) |
|||
*/ |
|||
private String pid; |
|||
|
|||
/** |
|||
* 所有agencyId的上级组织ID(包含agencyId) |
|||
*/ |
|||
private String pids; |
|||
|
|||
/** |
|||
* 工作人员ID |
|||
*/ |
|||
private String staffId; |
|||
|
|||
/** |
|||
* 工作人员姓名 |
|||
*/ |
|||
private String staffName; |
|||
|
|||
/** |
|||
* 项目立项数 |
|||
*/ |
|||
private Integer projectCount; |
|||
|
|||
/** |
|||
* 议题转项目数 |
|||
*/ |
|||
private Integer issueToProjectCount; |
|||
|
|||
/** |
|||
* 议题关闭数 |
|||
*/ |
|||
private Integer closedIssueCount; |
|||
|
|||
/** |
|||
* 项目响应数 |
|||
*/ |
|||
private Integer projectResponseCount; |
|||
|
|||
/** |
|||
* 项目吹哨数 |
|||
*/ |
|||
private Integer projectTransferCount; |
|||
|
|||
/** |
|||
* 项目结案数 |
|||
*/ |
|||
private Integer projectClosedCount; |
|||
|
|||
} |
@ -0,0 +1,20 @@ |
|||
package com.epmet.dataaggre.service; |
|||
|
|||
import com.epmet.dataaggre.dto.govorg.result.GridMemberDataAnalysisResultDTO; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @Description 聚合的网格相关service,不指定具体的数据源,它调用其他子service,子service中指定具体数据源 |
|||
* @author wxz |
|||
* @date 2021.07.05 13:06:35 |
|||
*/ |
|||
public interface AggreGridService { |
|||
/** |
|||
* @Description 网格员数据统计列表查询 |
|||
* @return |
|||
* @author wxz |
|||
* @date 2021.07.05 11:17 |
|||
*/ |
|||
List<GridMemberDataAnalysisResultDTO> getGridMemberDataAnalysis(List<String> gridIds, String searchedStaffName, String currStaffId, String month, String sort, Integer pageNo, Integer pageSize); |
|||
} |
@ -0,0 +1,51 @@ |
|||
package com.epmet.dataaggre.service.impl; |
|||
|
|||
import com.epmet.dataaggre.dto.govorg.CustomerGridDTO; |
|||
import com.epmet.dataaggre.dto.govorg.result.GridMemberDataAnalysisResultDTO; |
|||
import com.epmet.dataaggre.service.AggreGridService; |
|||
import com.epmet.dataaggre.service.datastats.DataStatsService; |
|||
import com.epmet.dataaggre.service.govorg.GovOrgService; |
|||
import org.apache.commons.collections4.CollectionUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
import java.util.ArrayList; |
|||
import java.util.HashMap; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
import java.util.stream.Collectors; |
|||
|
|||
@Service |
|||
public class AggreGridServiceImpl implements AggreGridService { |
|||
|
|||
@Autowired |
|||
private GovOrgService govOrgService; |
|||
|
|||
@Autowired |
|||
private DataStatsService dataStatsService; |
|||
|
|||
@Override |
|||
public List<GridMemberDataAnalysisResultDTO> getGridMemberDataAnalysis( |
|||
List<String> gridIds, |
|||
String searchedStaffName, |
|||
String currStaffId, |
|||
String month, |
|||
String sort, |
|||
Integer pageNo, |
|||
Integer pageSize) { |
|||
|
|||
//1.得到网格id列表
|
|||
Map<String, String> gridIdAndName = new HashMap<>(); |
|||
List<CustomerGridDTO> grids = govOrgService.getGridInfoList(gridIds, currStaffId); |
|||
grids.forEach(g -> { |
|||
gridIds.add(g.getId()); |
|||
gridIdAndName.put(g.getId(), g.getGridName()); |
|||
}); |
|||
|
|||
//2.查询列表,并且填充内容
|
|||
List<GridMemberDataAnalysisResultDTO> records = dataStatsService.listGridMemberDataStats(gridIds, searchedStaffName, month, sort, pageNo, pageSize); |
|||
records.forEach(r -> r.setOrgName(gridIdAndName.get(r.getGridId()))); |
|||
return records; |
|||
} |
|||
|
|||
} |
@ -0,0 +1,70 @@ |
|||
<?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"> |
|||
|
|||
<mapper namespace="com.epmet.dataaggre.dao.datastats.FactGridMemberStatisticsDailyDao"> |
|||
|
|||
<resultMap type="com.epmet.dataaggre.entity.datastats.FactGridMemberStatisticsDailyEntity" id="factGridMemberStatisticsDailyMap"> |
|||
<result property="id" column="ID"/> |
|||
<result property="dateId" column="DATE_ID"/> |
|||
<result property="monthId" column="MONTH_ID"/> |
|||
<result property="yearId" column="YEAR_ID"/> |
|||
<result property="customerId" column="CUSTOMER_ID"/> |
|||
<result property="agencyId" column="AGENCY_ID"/> |
|||
<result property="gridId" column="GRID_ID"/> |
|||
<result property="pid" column="PID"/> |
|||
<result property="pids" column="PIDS"/> |
|||
<result property="staffId" column="STAFF_ID"/> |
|||
<result property="staffName" column="STAFF_NAME"/> |
|||
<result property="projectCount" column="PROJECT_COUNT"/> |
|||
<result property="issueToProjectCount" column="ISSUE_TO_PROJECT_COUNT"/> |
|||
<result property="closedIssueCount" column="CLOSED_ISSUE_COUNT"/> |
|||
<result property="projectResponseCount" column="PROJECT_RESPONSE_COUNT"/> |
|||
<result property="projectTransferCount" column="PROJECT_TRANSFER_COUNT"/> |
|||
<result property="projectClosedCount" column="PROJECT_CLOSED_COUNT"/> |
|||
<result property="delFlag" column="DEL_FLAG"/> |
|||
<result property="revision" column="REVISION"/> |
|||
<result property="createdBy" column="CREATED_BY"/> |
|||
<result property="createdTime" column="CREATED_TIME"/> |
|||
<result property="updatedBy" column="UPDATED_BY"/> |
|||
<result property="updatedTime" column="UPDATED_TIME"/> |
|||
</resultMap> |
|||
|
|||
<!--查询网格员统计数据--> |
|||
<select id="listGridMemberDataStats" |
|||
resultType="com.epmet.dataaggre.dto.govorg.result.GridMemberDataAnalysisResultDTO"> |
|||
select member.id, |
|||
member.date_id, |
|||
member.month_id, |
|||
member.year_id, |
|||
member.customer_id, |
|||
member.agency_id, |
|||
member.grid_id, |
|||
member.pid, |
|||
member.pids, |
|||
member.staff_id, |
|||
member.staff_name, |
|||
member.project_count, |
|||
member.issue_to_project_count, |
|||
member.closed_issue_count, |
|||
member.project_response_count, |
|||
member.project_transfer_count, |
|||
member.project_closed_count |
|||
from fact_grid_member_statistics_daily member |
|||
<where> |
|||
<if test="gridIds != null and gridIds.size() > 0"> |
|||
<foreach collection="gridIds" item="gridId" separator="OR" open="(" close=")"> |
|||
member.GRID_ID = #{gridId} |
|||
</foreach> |
|||
</if> |
|||
<if test="searchedStaffName != null and searchedStaffName != ''"> |
|||
and member.STAFF_NAME like CONCAT('%',#{searchedStaffName},'%') |
|||
</if> |
|||
<if test="month != null and month != ''"> |
|||
and member.MONTH_ID = #{month} |
|||
</if> |
|||
</where> |
|||
order by ${sort} desc |
|||
</select> |
|||
|
|||
|
|||
</mapper> |
Loading…
Reference in new issue