Browse Source

【大屏展示】-【接口开发】-(王童)-2020/8/21

feature/dangjian
Jackwang 5 years ago
parent
commit
93e2d2f4e2
  1. 82
      esua-epdc/epdc-module/epdc-analysis/epdc-analysis-client/src/main/java/com/elink/esua/epdc/dto/screen/result/CpcbasedataDTO.java
  2. 18
      esua-epdc/epdc-module/epdc-analysis/epdc-analysis-client/src/main/java/com/elink/esua/epdc/dto/screen/result/DataStatsScreencollResultDTO.java
  3. 34
      esua-epdc/epdc-module/epdc-analysis/epdc-analysis-client/src/main/java/com/elink/esua/epdc/dto/screen/result/EventdataImgListDTO.java
  4. 121
      esua-epdc/epdc-module/epdc-analysis/epdc-analysis-client/src/main/java/com/elink/esua/epdc/dto/screen/result/EventdataResultDTO.java
  5. 47
      esua-epdc/epdc-module/epdc-analysis/epdc-analysis-client/src/main/java/com/elink/esua/epdc/dto/screen/result/PartylinkmassesdataResultDTO.java
  6. 63
      esua-epdc/epdc-module/epdc-analysis/epdc-analysis-client/src/main/java/com/elink/esua/epdc/dto/screen/result/PioneerdataResultDTO.java
  7. 760
      esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/resources/mapper/screen/DataStatsScreencollDao.xml

82
esua-epdc/epdc-module/epdc-analysis/epdc-analysis-client/src/main/java/com/elink/esua/epdc/dto/screen/result/CpcbasedataDTO.java

@ -0,0 +1,82 @@
package com.elink.esua.epdc.dto.screen.result;
import lombok.Data;
import java.io.Serializable;
/**
* @program: esua-epdc
* @description: 党员基本情况
* @author: wangtong
* @create: 2020-08-19 13:58
**/
@Data
public class CpcbasedataDTO implements Serializable {
private static final long serialVersionUID = 7240758113851172699L;
/**
*组织类别 agency组织部门department网格grid
*/
private String orgType;
/**
*组织Id 可以为网格机关id
*/
private String orgId;
/**
*上级组织Id
*/
private String parentId;
/**
*组织名称
*/
private String orgName;
/**
*注册用户数
*/
private Integer registerUserCount;
/**
*群众用户数
*/
private Integer resiTotal;
/**
*注册党员数
*/
private Integer partyMemberCount;
/**
*小于20岁
*/
private Integer ageLevel1;
/**
*20-30岁
*/
private Integer ageLevel2;
/**
*31-40岁
*/
private Integer ageLevel3;
/**
*41-50岁
*/
private Integer ageLevel4;
/**
*51-60岁
*/
private Integer ageLevel5;
/**
*60+
*/
private Integer ageLevel6;
}

18
esua-epdc/epdc-module/epdc-analysis/epdc-analysis-client/src/main/java/com/elink/esua/epdc/dto/screen/result/DataStatsScreencollResultDTO.java

@ -0,0 +1,18 @@
package com.elink.esua.epdc.dto.screen.result;
import lombok.Data;
import java.io.Serializable;
/**
* @program: esua-epdc
* @description: 大屏展示
* @author: wangtong
* @create: 2020-08-19 13:46
**/
@Data
public class DataStatsScreencollResultDTO implements Serializable {
private static final long serialVersionUID = -83110725240264840L;
}

34
esua-epdc/epdc-module/epdc-analysis/epdc-analysis-client/src/main/java/com/elink/esua/epdc/dto/screen/result/EventdataImgListDTO.java

@ -0,0 +1,34 @@
package com.elink.esua.epdc.dto.screen.result;
import lombok.Data;
import java.io.Serializable;
/**
* @program: esua-epdc
* @description: 事件数据-图片列表
* @author: wangtong
* @create: 2020-08-20 13:38
**/
@Data
public class EventdataImgListDTO implements Serializable {
private static final long serialVersionUID = -5661511223100857441L;
/**
* 原始事件id
*/
private String eventId;
/**
* 图片地址
*/
private String imgUrl;
/**
* 排序
*/
private Integer sort;
}

121
esua-epdc/epdc-module/epdc-analysis/epdc-analysis-client/src/main/java/com/elink/esua/epdc/dto/screen/result/EventdataResultDTO.java

@ -0,0 +1,121 @@
package com.elink.esua.epdc.dto.screen.result;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;
/**
* @program: esua-epdc
* @description: 事件数据
* @author: wangtong
* @create: 2020-08-20 11:20
**/
@Data
public class EventdataResultDTO implements Serializable {
private static final long serialVersionUID = 3736021322966785928L;
/**
*组织类别 agency组织部门department网格grid
*/
private String orgType;
/**
*组织Id 可以为网格机关id
*/
private String orgId;
/**
*上级组织Id
*/
private String parentId;
/**
*组织名称
*/
private String orgName;
/**
*原始事件Id
*/
private String eventId;
/**
*事件名称
*/
private String eventTitle;
/**
*yyyy-MM-dd HH:mm:ss事件时间
*/
private String eventCreateTime;
/**
*联系人
*/
private String linkMobile;
/**
*事件内容
*/
private String eventContent;
/**
*事件图片如果有图片此列为第一张图片
*/
private String eventImgUrl;
/**
*事件待处理级别 red:yellow , green绿色
*/
private String eventLevel;
/**
*事件发生的地址
*/
private String eventAddress;
/**
*经度
*/
private BigDecimal longitude;
/**
*纬度
*/
private BigDecimal latitude;
/**
*最后处理的组织名称
*/
private String lastProcessDept;
/**
*最后处理的时间
*/
private String lastProcessDate;
/**
* 图片列表
*/
private List<EventdataImgListDTO> imgDataList;
/**
*事件状态描述
*/
private String eventStatusDesc;
/**
*事件状态key
*/
private String eventStatusCode;
/**
*最近一次操作说明 eg: 转项目结案流转
*/
private String latestOperateDesc;
}

47
esua-epdc/epdc-module/epdc-analysis/epdc-analysis-client/src/main/java/com/elink/esua/epdc/dto/screen/result/PartylinkmassesdataResultDTO.java

@ -0,0 +1,47 @@
package com.elink.esua.epdc.dto.screen.result;
import lombok.Data;
import java.io.Serializable;
/**
* @program: esua-epdc
* @description: 党建引领-党员联系群众数据
* @author: wangtong
* @create: 2020-08-20 14:25
**/
@Data
public class PartylinkmassesdataResultDTO implements Serializable {
private static final long serialVersionUID = 4303651299312624786L;
/**
*组织类别 agency组织部门department网格grid
*/
private String orgType;
/**
*组织Id 可以为网格机关id
*/
private String orgId;
/**
*上级组织Id
*/
private String parentId;
/**
*组织名称
*/
private String orgName;
/**
*建群总数
*/
private Integer createGroupTotal;
/**
*群成员总数
*/
private Integer groupUserTotal;
}

63
esua-epdc/epdc-module/epdc-analysis/epdc-analysis-client/src/main/java/com/elink/esua/epdc/dto/screen/result/PioneerdataResultDTO.java

@ -0,0 +1,63 @@
package com.elink.esua.epdc.dto.screen.result;
import lombok.Data;
import java.io.Serializable;
/**
* @program: esua-epdc
* @description: 党建引领-先锋模范数据
* @author: wangtong
* @create: 2020-08-20 18:03
**/
@Data
public class PioneerdataResultDTO implements Serializable {
private static final long serialVersionUID = -4681354998669289322L;
/**
*组织类别 agency组织部门department网格grid
*/
private String orgType;
/**
*组织Id 可以为网格机关id
*/
private String orgId;
/**
*上级组织Id
*/
private String parentId;
/**
*组织名称
*/
private String orgName;
/**
*用户总数
*/
private Integer userTotal;
/**
*议事数
*/
private Integer issueTotal;
/**
*话题总数
*/
private Integer topicTotal;
/**
*议题转项目数
*/
private Integer shiftProjectTotal;
/**
*解决项目总数
*/
private Integer resolvedProjectTotal;
}

760
esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/resources/mapper/screen/DataStatsScreencollDao.xml

@ -0,0 +1,760 @@
<?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.elink.esua.epdc.modules.screen.dao.DataStatsScreencollDao">
<select id="cpcbasedata" resultType="com.elink.esua.epdc.dto.screen.result.CpcbasedataDTO">
SELECT
total.orgId,
total.orgName,
total.parentId,
'grid' as orgType,
SUM( total.USER_TOTAL) AS USER_TOTAL,
SUM( total.RESIDENTS_TOTAL ) AS RESIDENTS_TOTAL,
SUM( total.PARTY_TOTAL ) AS PARTY_TOTAL,
SUM( total.ageLevel1 ) AS ageLevel1,
SUM( total.ageLevel2 ) AS ageLevel2,
SUM( total.ageLevel3 ) AS ageLevel3,
SUM( total.ageLevel4 ) AS ageLevel4,
SUM( total.ageLevel5 ) AS ageLevel5,
SUM( total.ageLevel6 ) AS ageLevel6
FROM
(SELECT
t1.orgId,
d.name as orgName,
d.pid as parentId,
t1.USER_TOTAL,
IFNULL(( t1.USER_TOTAL - t1.PARTY_TOTAL ),0) AS RESIDENTS_TOTAL,
t1.PARTY_TOTAL,
t1.ageLevel1,
t1.ageLevel2,
t1.ageLevel3,
t1.ageLevel4,
t1.ageLevel5,
t1.ageLevel6
FROM
(SELECT
t.orgId,
COUNT( t.ID ) AS USER_TOTAL,
count( t.PARTY_FLAG = '1' OR NULL ) AS PARTY_TOTAL,
count( ( t.age <![CDATA[<]]> 20 AND t.PARTY_FLAG = '1' ) OR NULL ) AS ageLevel1,
count( ( 20 <![CDATA[<]]>= t.age AND t.age <![CDATA[<]]>= 30 AND t.PARTY_FLAG = '1') OR NULL ) AS ageLevel2,
count( ( 31 <![CDATA[<]]>= t.age AND t.age <![CDATA[<]]>= 40 AND t.PARTY_FLAG = '1') OR NULL ) AS ageLevel3,
count( ( 41 <![CDATA[<]]>= t.age AND t.age <![CDATA[<]]>= 50 AND t.PARTY_FLAG = '1') OR NULL ) AS ageLevel4,
count( ( 51 <![CDATA[<]]>= t.age AND t.age <![CDATA[<]]>= 60 AND t.PARTY_FLAG = '1') OR NULL ) AS ageLevel5,
count( ( 60 <![CDATA[<]]> t.age AND t.PARTY_FLAG = '1') OR NULL ) AS ageLevel6
FROM
(SELECT
eu.ID,
eu.PARTY_FLAG,
IFNULL( TIMESTAMPDIFF( YEAR, eu.BIRTHDAY, CURDATE( ) ), 0 ) AS age,
d.id AS orgId
FROM
esua_epdc_admin.sys_dept d
left join esua_epdc_user.epdc_user eu on d.id=eu.DEPT_ID and eu.DEL_FLAG = '0'
WHERE
d.DEL_FLAG = '0'
and d.type_key='grid_party'
) t
GROUP BY
t.orgId
) t1
left join esua_epdc_admin.sys_dept d on d.id=t1.orgId
) total
GROUP BY
total.orgId
union all
SELECT
total.orgId,
total.orgName,
total.parentId,
'department' as orgType,
SUM( total.USER_TOTAL) AS USER_TOTAL,
SUM( total.RESIDENTS_TOTAL ) AS RESIDENTS_TOTAL,
SUM( total.PARTY_TOTAL ) AS PARTY_TOTAL,
SUM( total.ageLevel1 ) AS ageLevel1,
SUM( total.ageLevel2 ) AS ageLevel2,
SUM( total.ageLevel3 ) AS ageLevel3,
SUM( total.ageLevel4 ) AS ageLevel4,
SUM( total.ageLevel5 ) AS ageLevel5,
SUM( total.ageLevel6 ) AS ageLevel6
FROM
(SELECT
t1.orgId,
d.name as orgName,
d.pid as parentId,
t1.USER_TOTAL,
IFNULL(( t1.USER_TOTAL - t1.PARTY_TOTAL ),0) AS RESIDENTS_TOTAL,
t1.PARTY_TOTAL,
t1.ageLevel1,
t1.ageLevel2,
t1.ageLevel3,
t1.ageLevel4,
t1.ageLevel5,
t1.ageLevel6
FROM
(SELECT
t.orgId,
COUNT( t.ID ) AS USER_TOTAL,
count( t.PARTY_FLAG = '1' OR NULL ) AS PARTY_TOTAL,
count( ( t.age <![CDATA[<]]> 20 AND t.PARTY_FLAG = '1' ) OR NULL ) AS ageLevel1,
count( ( 20 <![CDATA[<]]>= t.age AND t.age <![CDATA[<]]>= 30 AND t.PARTY_FLAG = '1') OR NULL ) AS ageLevel2,
count( ( 31 <![CDATA[<]]>= t.age AND t.age <![CDATA[<]]>= 40 AND t.PARTY_FLAG = '1') OR NULL ) AS ageLevel3,
count( ( 41 <![CDATA[<]]>= t.age AND t.age <![CDATA[<]]>= 50 AND t.PARTY_FLAG = '1') OR NULL ) AS ageLevel4,
count( ( 51 <![CDATA[<]]>= t.age AND t.age <![CDATA[<]]>= 60 AND t.PARTY_FLAG = '1') OR NULL ) AS ageLevel5,
count( ( 60 <![CDATA[<]]> t.age AND t.PARTY_FLAG = '1') OR NULL ) AS ageLevel6
FROM
(SELECT
eu.ID,
eu.PARTY_FLAG,
IFNULL( TIMESTAMPDIFF( YEAR, eu.BIRTHDAY, CURDATE( ) ), 0 ) AS age,
co.id AS orgId
FROM
esua_epdc_admin.sys_dept co
left join esua_epdc_admin.sys_dept gr on gr.pid=co.id
left join esua_epdc_user.epdc_user eu on gr.id=eu.DEPT_ID and eu.DEL_FLAG = '0'
WHERE
co.DEL_FLAG = '0'
and gr.DEL_FLAG = '0'
and co.type_key='community_party'
) t
GROUP BY
t.orgId
) t1
left join esua_epdc_admin.sys_dept d on d.id=t1.orgId
) total
GROUP BY
total.orgId
union all
SELECT
total.orgId,
total.orgName,
total.parentId,
'department' as orgType,
SUM( total.USER_TOTAL) AS USER_TOTAL,
SUM( total.RESIDENTS_TOTAL ) AS RESIDENTS_TOTAL,
SUM( total.PARTY_TOTAL ) AS PARTY_TOTAL,
SUM( total.ageLevel1 ) AS ageLevel1,
SUM( total.ageLevel2 ) AS ageLevel2,
SUM( total.ageLevel3 ) AS ageLevel3,
SUM( total.ageLevel4 ) AS ageLevel4,
SUM( total.ageLevel5 ) AS ageLevel5,
SUM( total.ageLevel6 ) AS ageLevel6
FROM
(SELECT
t1.orgId,
d.name as orgName,
d.pid as parentId,
t1.USER_TOTAL,
IFNULL(( t1.USER_TOTAL - t1.PARTY_TOTAL ),0) AS RESIDENTS_TOTAL,
t1.PARTY_TOTAL,
t1.ageLevel1,
t1.ageLevel2,
t1.ageLevel3,
t1.ageLevel4,
t1.ageLevel5,
t1.ageLevel6
FROM
(SELECT
t.orgId,
COUNT( t.ID ) AS USER_TOTAL,
count( t.PARTY_FLAG = '1' OR NULL ) AS PARTY_TOTAL,
count( ( t.age <![CDATA[<]]> 20 AND t.PARTY_FLAG = '1' ) OR NULL ) AS ageLevel1,
count( ( 20 <![CDATA[<]]>= t.age AND t.age <![CDATA[<]]>= 30 AND t.PARTY_FLAG = '1') OR NULL ) AS ageLevel2,
count( ( 31 <![CDATA[<]]>= t.age AND t.age <![CDATA[<]]>= 40 AND t.PARTY_FLAG = '1') OR NULL ) AS ageLevel3,
count( ( 41 <![CDATA[<]]>= t.age AND t.age <![CDATA[<]]>= 50 AND t.PARTY_FLAG = '1') OR NULL ) AS ageLevel4,
count( ( 51 <![CDATA[<]]>= t.age AND t.age <![CDATA[<]]>= 60 AND t.PARTY_FLAG = '1') OR NULL ) AS ageLevel5,
count( ( 60 <![CDATA[<]]> t.age AND t.PARTY_FLAG = '1') OR NULL ) AS ageLevel6
FROM
(SELECT
eu.ID,
eu.PARTY_FLAG,
IFNULL( TIMESTAMPDIFF( YEAR, eu.BIRTHDAY, CURDATE( ) ), 0 ) AS age,
st.id AS orgId
FROM
esua_epdc_admin.sys_dept st
left join esua_epdc_admin.sys_dept co on co.pid=st.id
left join esua_epdc_admin.sys_dept gr on gr.pid=co.id
left join esua_epdc_user.epdc_user eu on gr.id=eu.DEPT_ID and eu.DEL_FLAG = '0'
WHERE
st.DEL_FLAG = '0'
and co.DEL_FLAG = '0'
and gr.DEL_FLAG = '0'
and st.type_key='street_party'
) t
GROUP BY
t.orgId
) t1
left join esua_epdc_admin.sys_dept d on d.id=t1.orgId
) total
GROUP BY
total.orgId
union all
SELECT
total.orgId,
total.orgName,
total.parentId,
'department' as orgType,
SUM( total.USER_TOTAL) AS USER_TOTAL,
SUM( total.RESIDENTS_TOTAL ) AS RESIDENTS_TOTAL,
SUM( total.PARTY_TOTAL ) AS PARTY_TOTAL,
SUM( total.ageLevel1 ) AS ageLevel1,
SUM( total.ageLevel2 ) AS ageLevel2,
SUM( total.ageLevel3 ) AS ageLevel3,
SUM( total.ageLevel4 ) AS ageLevel4,
SUM( total.ageLevel5 ) AS ageLevel5,
SUM( total.ageLevel6 ) AS ageLevel6
FROM
(SELECT
t1.orgId,
d.name as orgName,
d.pid as parentId,
t1.USER_TOTAL,
IFNULL(( t1.USER_TOTAL - t1.PARTY_TOTAL ),0) AS RESIDENTS_TOTAL,
t1.PARTY_TOTAL,
t1.ageLevel1,
t1.ageLevel2,
t1.ageLevel3,
t1.ageLevel4,
t1.ageLevel5,
t1.ageLevel6
FROM
(SELECT
t.orgId,
COUNT( t.ID ) AS USER_TOTAL,
count( t.PARTY_FLAG = '1' OR NULL ) AS PARTY_TOTAL,
count( ( t.age <![CDATA[<]]> 20 AND t.PARTY_FLAG = '1' ) OR NULL ) AS ageLevel1,
count( ( 20 <![CDATA[<]]>= t.age AND t.age <![CDATA[<]]>= 30 AND t.PARTY_FLAG = '1') OR NULL ) AS ageLevel2,
count( ( 31 <![CDATA[<]]>= t.age AND t.age <![CDATA[<]]>= 40 AND t.PARTY_FLAG = '1') OR NULL ) AS ageLevel3,
count( ( 41 <![CDATA[<]]>= t.age AND t.age <![CDATA[<]]>= 50 AND t.PARTY_FLAG = '1') OR NULL ) AS ageLevel4,
count( ( 51 <![CDATA[<]]>= t.age AND t.age <![CDATA[<]]>= 60 AND t.PARTY_FLAG = '1') OR NULL ) AS ageLevel5,
count( ( 60 <![CDATA[<]]> t.age AND t.PARTY_FLAG = '1') OR NULL ) AS ageLevel6
FROM
(SELECT
eu.ID,
eu.PARTY_FLAG,
IFNULL( TIMESTAMPDIFF( YEAR, eu.BIRTHDAY, CURDATE( ) ), 0 ) AS age,
city.id AS orgId
FROM
esua_epdc_admin.sys_dept city
left join esua_epdc_admin.sys_dept st on st.pid=city.id
left join esua_epdc_admin.sys_dept co on co.pid=st.id
left join esua_epdc_admin.sys_dept gr on gr.pid=co.id
left join esua_epdc_user.epdc_user eu on gr.id=eu.DEPT_ID and eu.DEL_FLAG = '0'
WHERE
city.DEL_FLAG = '0'
and st.DEL_FLAG = '0'
and co.DEL_FLAG = '0'
and gr.DEL_FLAG = '0'
and city.type_key='district_party' and city.party_code='shibei'
) t
GROUP BY
t.orgId
) t1
left join esua_epdc_admin.sys_dept d on d.id=t1.orgId
) total
GROUP BY
total.orgId
</select>
<resultMap id="eventdata_map" type="com.elink.esua.epdc.dto.screen.result.EventdataResultDTO">
<result property="orgId" column="orgId"></result>
<result property="orgName" column="orgName"></result>
<result property="parentId" column="parentId"></result>
<result property="orgType" column="orgType"></result>
<result property="eventId" column="eventId"></result>
<result property="eventCreateTime" column="eventCreateTime"></result>
<result property="linkMobile" column="linkMobile"></result>
<result property="eventContent" column="eventContent"></result>
<result property="eventImgUrl" column="eventImgUrl"></result>
<result property="eventLevel" column="eventLevel"></result>
<result property="eventAddress" column="eventAddress"></result>
<result property="latitude" column="latitude"></result>
<result property="longitude" column="longitude"></result>
<result property="lastProcessDate" column="lastProcessDate"></result>
<result property="lastProcessDept" column="lastProcessDept"></result>
<result property="eventStatusCode" column="eventStatusCode"></result>
<result property="eventStatusDesc" column="eventStatusDesc"></result>
<result property="latestOperateDesc" column="latestOperateDesc"></result>
<collection property="imgDataList" ofType="com.elink.esua.epdc.dto.screen.result.EventdataImgListDTO">
<result property="imgUrl" column="imgUrl"></result>
</collection>
</resultMap>
<select id="eventdata" resultMap="eventdata_map">
select d.id as orgId,
d.name as orgName,
d.pid as parentId,
if(d.type_key='grid_party','grid','department') as orgType,
ei.EVENT_ID as eventId,
ei.CREATED_TIME as eventCreateTime,
ei.MOBILE as linkMobile,
ei.ITEM_CONTENT as eventContent,
(select IMG_URL from esua_epdc_events.epdc_img i
where DEL_FLAG=0 and ei.EVENT_ID=i.REFERENCE_ID order by CREATED_TIME asc,id limit 1) as eventImgUrl,
(CASE WHEN TIMESTAMPDIFF(HOUR, ei.CREATED_TIME, now()) <![CDATA[<]]> t.VALID_CLOSE_TIME/2 THEN 'green'
WHEN TIMESTAMPDIFF(HOUR, ei.CREATED_TIME, now()) >= t.VALID_CLOSE_TIME/2
and TIMESTAMPDIFF(HOUR, ei.CREATED_TIME, now()) <![CDATA[<]]> t.VALID_CLOSE_TIME THEN 'yellow'
WHEN TIMESTAMPDIFF(HOUR, ei.CREATED_TIME, now()) >= t.VALID_CLOSE_TIME THEN 'red' end) as eventLevel,
ei.ISSUE_ADDRESS as eventAddress,
ei.ISSUE_LATITUDE as latitude,
ei.ISSUE_LONGITUDE as longitude,
(select UPDATED_TIME from esua_epdc_events.epdc_item_handle_process eih
where eih.DEL_FLAG=0 and eih.ITEM_ID=ei.ID order by CREATED_TIME desc,id limit 1) as lastProcessDate,
(select HANDLER_DEPT from esua_epdc_events.epdc_item_handle_process eih
where eih.DEL_FLAG=0 and eih.ITEM_ID=ei.ID order by CREATED_TIME desc,id limit 1) as lastProcessDept,
i.IMG_URL as imgUrl,
ei.ITEM_STATE as eventStatusCode,
(CASE WHEN ei.ITEM_STATE='0' THEN '处理中'
WHEN ei.ITEM_STATE='5' THEN '已关闭'
WHEN ei.ITEM_STATE='10' THEN '已结案'END) as eventStatusDesc,
(select OUT_HANDLE_ADVICE from esua_epdc_events.epdc_item_handle_process eih
where eih.DEL_FLAG=0 and eih.ITEM_ID=ei.ID order by CREATED_TIME desc,id limit 1) as latestOperateDesc
from esua_epdc_events.epdc_item ei
left join esua_epdc_admin.sys_dept d on d.id=ei.GRID_ID
left join esua_epdc_events.epdc_img i on ei.EVENT_ID=i.REFERENCE_ID
LEFT JOIN esua_epdc_events.epdc_category c ON ei.CATEGORY_CODE = c.CATEGORY_CODE
LEFT JOIN esua_epdc_kpi.epdc_kpi_time_limit_item t ON c.id = t.CATEGORY_ID
where
d.DEL_FLAG = '0'
and ei.DEL_FLAG=0
and ei.ITEM_STATE=0
and i.DEL_FLAG=0
order by ei.CREATED_TIME desc,i.id
</select>
<select id="partylinkmassesdata" resultType="com.elink.esua.epdc.dto.screen.result.PartylinkmassesdataResultDTO">
select gr.id as orgId,
gr.name as orgName,
gr.pid as parentId,
'grid' as orgType,
IFNULL(dg.createGroupTotal,0) AS createGroupTotal,
IFNULL(dg.groupUserTotal,0) AS groupUserTotal
from esua_epdc_admin.sys_dept gr
left join
(select eg.GRID_ID,
count(eg.id) as createGroupTotal,
sum(group_user.userCount) as groupUserTotal
from esua_epdc_group.epdc_group eg
left join (select GROUP_ID,
count(STATE = 10 OR NULL) AS userCount
from esua_epdc_group.epdc_user_group eu
where eu.DEL_FLAG=0
group by GROUP_ID)group_user on group_user.GROUP_ID = eg.id
where eg.DEL_FLAG=0 and eg.STATE=10
group by eg.GRID_ID)dg on dg.GRID_ID=gr.id
where gr.del_flag=0 and gr.type_key='grid_party'
union all
select co.id as orgId,
co.name as orgName,
co.pid as parentId,
'department' as orgType,
sum(IFNULL(dg.createGroupTotal,0)) AS createGroupTotal,
sum(IFNULL(dg.groupUserTotal,0)) AS groupUserTotal
from esua_epdc_admin.sys_dept co
left join esua_epdc_admin.sys_dept gr on co.id=gr.pid
left join
(select eg.GRID_ID,
count(eg.id) as createGroupTotal,
sum(group_user.userCount) as groupUserTotal
from esua_epdc_group.epdc_group eg
left join (select GROUP_ID,
count(STATE = 10 OR NULL) AS userCount
from esua_epdc_group.epdc_user_group eu
where eu.DEL_FLAG=0
group by GROUP_ID)group_user on group_user.GROUP_ID = eg.id
where eg.DEL_FLAG=0 and eg.STATE=10
group by eg.GRID_ID)dg on dg.GRID_ID=gr.id
where gr.del_flag=0
and co.del_flag=0
and co.type_key='community_party'
group by co.id
union all
select st.id as orgId,
st.name as orgName,
st.pid as parentId,
'department' as orgType,
sum(IFNULL(dg.createGroupTotal,0)) AS createGroupTotal,
sum(IFNULL(dg.groupUserTotal,0)) AS groupUserTotal
from esua_epdc_admin.sys_dept st
left join esua_epdc_admin.sys_dept co on st.id=co.pid
left join esua_epdc_admin.sys_dept gr on co.id=gr.pid
left join
(select eg.GRID_ID,
count(eg.id) as createGroupTotal,
sum(group_user.userCount) as groupUserTotal
from esua_epdc_group.epdc_group eg
left join (select GROUP_ID,
count(STATE = 10 OR NULL) AS userCount
from esua_epdc_group.epdc_user_group eu
where eu.DEL_FLAG=0
group by GROUP_ID)group_user on group_user.GROUP_ID = eg.id
where eg.DEL_FLAG=0 and eg.STATE=10
group by eg.GRID_ID)dg on dg.GRID_ID=gr.id
where gr.del_flag=0
and co.del_flag=0
and st.del_flag=0
and st.type_key='street_party'
group by st.id
union all
select city.id as orgId,
city.name as orgName,
city.pid as parentId,
'department' as orgType,
sum(IFNULL(dg.createGroupTotal,0)) AS createGroupTotal,
sum(IFNULL(dg.groupUserTotal,0)) AS groupUserTotal
from esua_epdc_admin.sys_dept city
left join esua_epdc_admin.sys_dept st on city.id=st.pid
left join esua_epdc_admin.sys_dept co on st.id=co.pid
left join esua_epdc_admin.sys_dept gr on co.id=gr.pid
left join
(select eg.GRID_ID,
count(eg.id) as createGroupTotal,
sum(group_user.userCount) as groupUserTotal
from esua_epdc_group.epdc_group eg
left join (select GROUP_ID,
count(STATE = 10 OR NULL) AS userCount
from esua_epdc_group.epdc_user_group eu
where eu.DEL_FLAG=0
group by GROUP_ID)group_user on group_user.GROUP_ID = eg.id
where eg.DEL_FLAG=0 and eg.STATE=10
group by eg.GRID_ID)dg on dg.GRID_ID=gr.id
where gr.del_flag=0
and co.del_flag=0
and st.del_flag=0
and city.del_flag=0
and city.type_key='district_party' and city.party_code='shibei'
group by city.id
</select>
<select id="pioneerdata" resultType="com.elink.esua.epdc.dto.screen.result.PioneerdataResultDTO">
SELECT gr.id as orgId,
gr.name as orgName,
gr.pid as parentId,
'grid' as orgType,
IFNULL(t.userTotal,0) AS userTotal,
IFNULL(t.issueTotal,0) AS issueTotal,
IFNULL(t.topicTotal,0) AS topicTotal,
IFNULL(t.shiftProjectTotal,0) AS shiftProjectTotal,
IFNULL(t.resolvedProjectTotal,0) AS resolvedProjectTotal
FROM esua_epdc_admin.sys_dept gr
left join
(select total.GRID_ID,
sum(total.userTotal) as userTotal,
sum(total.issueTotal) as issueTotal,
sum(total.topicTotal) as topicTotal,
sum(total.shiftProjectTotal) as shiftProjectTotal,
sum(total.resolvedProjectTotal) as resolvedProjectTotal
from
(select ifnull(if(eu.DEPT_ID = 0, NULL, eu.DEPT_ID), (
SELECT GRID_ID FROM esua_epdc_user.epdc_user_grid_relation
WHERE DEL_FLAG = '0' AND USER_ID = eu.ID
ORDER BY
CREATED_TIME,id
LIMIT 1 )
) AS GRID_ID,
count(eu.id) as userTotal,
0 as issueTotal,
0 as topicTotal,
0 as shiftProjectTotal,
0 as resolvedProjectTotal
from esua_epdc_user.epdc_user eu
where eu.DEL_FLAG=0
group by eu.DEPT_ID
UNION ALL
select GRID_ID,
0 as userTotal,
count(id) as issueTotal,
0 as topicTotal,
0 as shiftProjectTotal,
0 as resolvedProjectTotal
from esua_epdc_events.epdc_issue
where DEL_FLAG=0
group by GRID_ID
UNION ALL
select GRID_ID,
0 as userTotal,
0 as issueTotal,
count(id) as topicTotal,
0 as shiftProjectTotal,
0 as resolvedProjectTotal
from esua_epdc_group.epdc_topic
where DEL_FLAG=0
group by GRID_ID
UNION ALL
select GRID_ID,
0 as userTotal,
0 as issueTotal,
0 as topicTotal,
count(id) as shiftProjectTotal,
count(ITEM_STATE = 10 OR NULL) as resolvedProjectTotal
from esua_epdc_events.epdc_item
where DEL_FLAG=0
group by GRID_ID)total
group by total.GRID_ID)t on gr.id=t.GRID_ID
where gr.del_flag=0
and gr.type_key='grid_party'
UNION ALL
SELECT co.id as orgId,
co.name as orgName,
co.pid as parentId,
'department' as orgType,
SUM(IFNULL(t.userTotal,0)) AS userTotal,
SUM(IFNULL(t.issueTotal,0)) AS issueTotal,
SUM(IFNULL(t.topicTotal,0)) AS topicTotal,
SUM(IFNULL(t.shiftProjectTotal,0)) AS shiftProjectTotal,
SUM(IFNULL(t.resolvedProjectTotal,0)) AS resolvedProjectTotal
FROM esua_epdc_admin.sys_dept co
LEFT JOIN esua_epdc_admin.sys_dept gr on co.id=gr.pid
left join
(select total.GRID_ID,
sum(total.userTotal) as userTotal,
sum(total.issueTotal) as issueTotal,
sum(total.topicTotal) as topicTotal,
sum(total.shiftProjectTotal) as shiftProjectTotal,
sum(total.resolvedProjectTotal) as resolvedProjectTotal
from
(select ifnull(if(eu.DEPT_ID = 0, NULL, eu.DEPT_ID), (
SELECT GRID_ID FROM esua_epdc_user.epdc_user_grid_relation
WHERE DEL_FLAG = '0' AND USER_ID = eu.ID
ORDER BY
CREATED_TIME,id
LIMIT 1 )
) AS GRID_ID,
count(eu.id) as userTotal,
0 as issueTotal,
0 as topicTotal,
0 as shiftProjectTotal,
0 as resolvedProjectTotal
from esua_epdc_user.epdc_user eu
where eu.DEL_FLAG=0
group by eu.DEPT_ID
UNION ALL
select GRID_ID,
0 as userTotal,
count(id) as issueTotal,
0 as topicTotal,
0 as shiftProjectTotal,
0 as resolvedProjectTotal
from esua_epdc_events.epdc_issue
where DEL_FLAG=0
group by GRID_ID
UNION ALL
select GRID_ID,
0 as userTotal,
0 as issueTotal,
count(id) as topicTotal,
0 as shiftProjectTotal,
0 as resolvedProjectTotal
from esua_epdc_group.epdc_topic
where DEL_FLAG=0
group by GRID_ID
UNION ALL
select GRID_ID,
0 as userTotal,
0 as issueTotal,
0 as topicTotal,
count(id) as shiftProjectTotal,
count(ITEM_STATE = 10 OR NULL) as resolvedProjectTotal
from esua_epdc_events.epdc_item
where DEL_FLAG=0
group by GRID_ID)total
group by total.GRID_ID)t on gr.id=t.GRID_ID
where gr.del_flag=0
and co.del_flag=0
and co.type_key='community_party'
GROUP BY co.id
union all
SELECT st.id as orgId,
st.name as orgName,
st.pid as parentId,
'department' as orgType,
SUM(IFNULL(t.userTotal,0)) AS userTotal,
SUM(IFNULL(t.issueTotal,0)) AS issueTotal,
SUM(IFNULL(t.topicTotal,0)) AS topicTotal,
SUM(IFNULL(t.shiftProjectTotal,0)) AS shiftProjectTotal,
SUM(IFNULL(t.resolvedProjectTotal,0)) AS resolvedProjectTotal
FROM esua_epdc_admin.sys_dept st
left join esua_epdc_admin.sys_dept co on co.pid=st.id
LEFT JOIN esua_epdc_admin.sys_dept gr on co.id=gr.pid
left join
(select total.GRID_ID,
sum(total.userTotal) as userTotal,
sum(total.issueTotal) as issueTotal,
sum(total.topicTotal) as topicTotal,
sum(total.shiftProjectTotal) as shiftProjectTotal,
sum(total.resolvedProjectTotal) as resolvedProjectTotal
from
(select ifnull(if(eu.DEPT_ID = 0, NULL, eu.DEPT_ID), (
SELECT GRID_ID FROM esua_epdc_user.epdc_user_grid_relation
WHERE DEL_FLAG = '0' AND USER_ID = eu.ID
ORDER BY
CREATED_TIME,id
LIMIT 1 )
) AS GRID_ID,
count(eu.id) as userTotal,
0 as issueTotal,
0 as topicTotal,
0 as shiftProjectTotal,
0 as resolvedProjectTotal
from esua_epdc_user.epdc_user eu
where eu.DEL_FLAG=0
group by eu.DEPT_ID
UNION ALL
select GRID_ID,
0 as userTotal,
count(id) as issueTotal,
0 as topicTotal,
0 as shiftProjectTotal,
0 as resolvedProjectTotal
from esua_epdc_events.epdc_issue
where DEL_FLAG=0
group by GRID_ID
UNION ALL
select GRID_ID,
0 as userTotal,
0 as issueTotal,
count(id) as topicTotal,
0 as shiftProjectTotal,
0 as resolvedProjectTotal
from esua_epdc_group.epdc_topic
where DEL_FLAG=0
group by GRID_ID
UNION ALL
select GRID_ID,
0 as userTotal,
0 as issueTotal,
0 as topicTotal,
count(id) as shiftProjectTotal,
count(ITEM_STATE = 10 OR NULL) as resolvedProjectTotal
from esua_epdc_events.epdc_item
where DEL_FLAG=0
group by GRID_ID)total
group by total.GRID_ID)t on gr.id=t.GRID_ID
where gr.del_flag=0
and co.del_flag=0
and st.del_flag=0
and st.type_key='street_party'
GROUP BY st.id
union all
SELECT city.id as orgId,
city.name as orgName,
city.pid as parentId,
'department' as orgType,
SUM(IFNULL(t.userTotal,0)) AS userTotal,
SUM(IFNULL(t.issueTotal,0)) AS issueTotal,
SUM(IFNULL(t.topicTotal,0)) AS topicTotal,
SUM(IFNULL(t.shiftProjectTotal,0)) AS shiftProjectTotal,
SUM(IFNULL(t.resolvedProjectTotal,0)) AS resolvedProjectTotal
FROM esua_epdc_admin.sys_dept city
left join esua_epdc_admin.sys_dept st on st.pid=city.id
left join esua_epdc_admin.sys_dept co on co.pid=st.id
LEFT JOIN esua_epdc_admin.sys_dept gr on co.id=gr.pid
left join
(select total.GRID_ID,
sum(total.userTotal) as userTotal,
sum(total.issueTotal) as issueTotal,
sum(total.topicTotal) as topicTotal,
sum(total.shiftProjectTotal) as shiftProjectTotal,
sum(total.resolvedProjectTotal) as resolvedProjectTotal
from
(select ifnull(if(eu.DEPT_ID = 0, NULL, eu.DEPT_ID), (
SELECT GRID_ID FROM esua_epdc_user.epdc_user_grid_relation
WHERE DEL_FLAG = '0' AND USER_ID = eu.ID
ORDER BY
CREATED_TIME,id
LIMIT 1 )
) AS GRID_ID,
count(eu.id) as userTotal,
0 as issueTotal,
0 as topicTotal,
0 as shiftProjectTotal,
0 as resolvedProjectTotal
from esua_epdc_user.epdc_user eu
where eu.DEL_FLAG=0
group by eu.DEPT_ID
UNION ALL
select GRID_ID,
0 as userTotal,
count(id) as issueTotal,
0 as topicTotal,
0 as shiftProjectTotal,
0 as resolvedProjectTotal
from esua_epdc_events.epdc_issue
where DEL_FLAG=0
group by GRID_ID
UNION ALL
select GRID_ID,
0 as userTotal,
0 as issueTotal,
count(id) as topicTotal,
0 as shiftProjectTotal,
0 as resolvedProjectTotal
from esua_epdc_group.epdc_topic
where DEL_FLAG=0
group by GRID_ID
UNION ALL
select GRID_ID,
0 as userTotal,
0 as issueTotal,
0 as topicTotal,
count(id) as shiftProjectTotal,
count(ITEM_STATE = 10 OR NULL) as resolvedProjectTotal
from esua_epdc_events.epdc_item
where DEL_FLAG=0
group by GRID_ID)total
group by total.GRID_ID)t on gr.id=t.GRID_ID
where gr.del_flag=0
and co.del_flag=0
and st.del_flag=0
and city.DEL_FLAG=0
and city.type_key='district_party' and city.party_code='shibei'
GROUP BY city.id
</select>
</mapper>
Loading…
Cancel
Save