Browse Source

大屏导出

feature/dangjian
wanggongfeng 3 years ago
parent
commit
42aaf64111
  1. 30
      esua-epdc/epdc-module/epdc-events/epdc-events-client/src/main/java/com/elink/esua/epdc/dto/item/result/EvaluationInfoResultDTO.java
  2. 30
      esua-epdc/epdc-module/epdc-events/epdc-events-client/src/main/java/com/elink/esua/epdc/dto/item/result/OnTimeDealInfoResultDTO.java
  3. 30
      esua-epdc/epdc-module/epdc-events/epdc-events-client/src/main/java/com/elink/esua/epdc/dto/item/result/YellowRedInfoResultDTO.java
  4. 52
      esua-epdc/epdc-module/epdc-events/epdc-events-client/src/main/java/com/elink/esua/epdc/dto/screen/result/EventStatisticsResultDTO.java
  5. 24
      esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/java/com/elink/esua/epdc/modules/screen/dao/ScreenDeptEventStatDao.java
  6. 3
      esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/java/com/elink/esua/epdc/modules/screen/excel/ScreenDataExportExcel.java
  7. 76
      esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/java/com/elink/esua/epdc/modules/screen/service/impl/ScreenDeptEventStatServiceImpl.java
  8. 342
      esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/resources/mapper/screen/ScreenDeptEventStatDao.xml

30
esua-epdc/epdc-module/epdc-events/epdc-events-client/src/main/java/com/elink/esua/epdc/dto/item/result/EvaluationInfoResultDTO.java

@ -0,0 +1,30 @@
package com.elink.esua.epdc.dto.item.result;
import lombok.Data;
import java.io.Serializable;
/**
* 大屏导出-满意度信息
* @Author wgf
* @Date 2022-10-10
*/
@Data
public class EvaluationInfoResultDTO implements Serializable {
private static final long serialVersionUID = -2494874960456321677L;
/**
* 部门ID
*/
private String deptId;
/**
*
*/
private String value;
/**
* 占比
*/
private String proportion;
}

30
esua-epdc/epdc-module/epdc-events/epdc-events-client/src/main/java/com/elink/esua/epdc/dto/item/result/OnTimeDealInfoResultDTO.java

@ -0,0 +1,30 @@
package com.elink.esua.epdc.dto.item.result;
import lombok.Data;
import java.io.Serializable;
/**
* 大屏导出-按时
* @Author wgf
* @Date 2022-10-10
*/
@Data
public class OnTimeDealInfoResultDTO implements Serializable {
private static final long serialVersionUID = -2494874960456321677L;
/**
* 部门ID
*/
private String deptId;
/**
*
*/
private String value;
/**
* 占比
*/
private String proportion;
}

30
esua-epdc/epdc-module/epdc-events/epdc-events-client/src/main/java/com/elink/esua/epdc/dto/item/result/YellowRedInfoResultDTO.java

@ -0,0 +1,30 @@
package com.elink.esua.epdc.dto.item.result;
import lombok.Data;
import java.io.Serializable;
/**
* 大屏导出-红黄灯数
* @Author wgf
* @Date 2022-10-10
*/
@Data
public class YellowRedInfoResultDTO implements Serializable {
private static final long serialVersionUID = -2494874960456321677L;
/**
* 部门ID
*/
private String deptId;
/**
* 黄灯数
*/
private Integer yellowNum;
/**
* 红灯数
*/
private Integer redNum;
}

52
esua-epdc/epdc-module/epdc-events/epdc-events-client/src/main/java/com/elink/esua/epdc/dto/screen/result/EventStatisticsResultDTO.java

@ -48,6 +48,10 @@ public class EventStatisticsResultDTO implements Serializable {
*/ */
@JsonIgnore @JsonIgnore
private Integer closedCount; private Integer closedCount;
/**
* 结案率
*/
private String closedRatio;
@JsonIgnore @JsonIgnore
private Integer livelihoodClosedCount; private Integer livelihoodClosedCount;
@JsonIgnore @JsonIgnore
@ -55,5 +59,53 @@ public class EventStatisticsResultDTO implements Serializable {
@JsonIgnore @JsonIgnore
private Integer lawClosedCount; private Integer lawClosedCount;
/**
* 响应数
*/
private Integer responseCount; private Integer responseCount;
/**
* 响应率
*/
private String responseRatio;
/**
* 满意数
*/
private String satisfiedCount;
/**
* 满意率
*/
private String satisfiedRatio;
/**
* 按期办结数
*/
private String scheduleClosedCount;
/**
* 按期办结率
*/
private String scheduleClosedRatio;
/**
* 黄灯预警数
*/
private Integer yellowCount;
/**
* 红灯超期数
*/
private Integer redCount;
/**
* 不予受理数
*/
private Integer unAcceptCount;
/**
* 街道以下部门办理诉求数
*/
private Integer gridCommunityDealNum;
} }

24
esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/java/com/elink/esua/epdc/modules/screen/dao/ScreenDeptEventStatDao.java

@ -18,6 +18,9 @@
package com.elink.esua.epdc.modules.screen.dao; package com.elink.esua.epdc.modules.screen.dao;
import com.elink.esua.epdc.commons.mybatis.dao.BaseDao; import com.elink.esua.epdc.commons.mybatis.dao.BaseDao;
import com.elink.esua.epdc.dto.item.result.EvaluationInfoResultDTO;
import com.elink.esua.epdc.dto.item.result.OnTimeDealInfoResultDTO;
import com.elink.esua.epdc.dto.item.result.YellowRedInfoResultDTO;
import com.elink.esua.epdc.dto.screen.ScreenDeptEventStatDTO; import com.elink.esua.epdc.dto.screen.ScreenDeptEventStatDTO;
import com.elink.esua.epdc.dto.screen.form.EventStatisticsFormDTO; import com.elink.esua.epdc.dto.screen.form.EventStatisticsFormDTO;
import com.elink.esua.epdc.dto.screen.result.EventStatisticsResultDTO; import com.elink.esua.epdc.dto.screen.result.EventStatisticsResultDTO;
@ -83,4 +86,25 @@ public interface ScreenDeptEventStatDao extends BaseDao<ScreenDeptEventStatEntit
*/ */
List<EventStatisticsResultDTO> getScreenExportData(EventStatisticsFormDTO formDTO); List<EventStatisticsResultDTO> getScreenExportData(EventStatisticsFormDTO formDTO);
/**
* 导出满意数满意率
* @param formDTO
* @return
*/
List<EvaluationInfoResultDTO> getSatisfiedInfo(EventStatisticsFormDTO formDTO);
/**
* 导出按时办结信息
* @param formDTO
* @return
*/
List<OnTimeDealInfoResultDTO> getOnTimeDealInfo(EventStatisticsFormDTO formDTO);
/**
* 导出红黄灯数
* @param formDTO
* @return
*/
List<YellowRedInfoResultDTO> getYellowRedInfo(EventStatisticsFormDTO formDTO);
} }

3
esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/java/com/elink/esua/epdc/modules/screen/excel/ScreenDataExportExcel.java

@ -59,4 +59,7 @@ public class ScreenDataExportExcel {
@ColumnWidth(20) @ColumnWidth(20)
@ExcelProperty(value = "不予受理数", order = 16) @ExcelProperty(value = "不予受理数", order = 16)
private Integer unAcceptCount; private Integer unAcceptCount;
@ColumnWidth(20)
@ExcelProperty(value = "街道以下、部门办理诉求数", order = 17)
private Integer gridCommunityDealNum;
} }

76
esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/java/com/elink/esua/epdc/modules/screen/service/impl/ScreenDeptEventStatServiceImpl.java

@ -20,6 +20,9 @@ package com.elink.esua.epdc.modules.screen.service.impl;
import com.elink.esua.epdc.commons.mybatis.service.impl.BaseServiceImpl; import com.elink.esua.epdc.commons.mybatis.service.impl.BaseServiceImpl;
import com.elink.esua.epdc.commons.tools.constant.NumConstant; import com.elink.esua.epdc.commons.tools.constant.NumConstant;
import com.elink.esua.epdc.commons.tools.utils.DateUtils; import com.elink.esua.epdc.commons.tools.utils.DateUtils;
import com.elink.esua.epdc.dto.item.result.EvaluationInfoResultDTO;
import com.elink.esua.epdc.dto.item.result.OnTimeDealInfoResultDTO;
import com.elink.esua.epdc.dto.item.result.YellowRedInfoResultDTO;
import com.elink.esua.epdc.dto.screen.form.DataStatisticsFormDTO; import com.elink.esua.epdc.dto.screen.form.DataStatisticsFormDTO;
import com.elink.esua.epdc.dto.screen.form.EventStatisticsFormDTO; import com.elink.esua.epdc.dto.screen.form.EventStatisticsFormDTO;
import com.elink.esua.epdc.dto.screen.result.*; import com.elink.esua.epdc.dto.screen.result.*;
@ -228,7 +231,78 @@ public class ScreenDeptEventStatServiceImpl extends BaseServiceImpl<ScreenDeptEv
formDTO.setStatDate(DateUtils.format(new Date(), DateUtils.DATE_PATTERN).substring(0, 4)); formDTO.setStatDate(DateUtils.format(new Date(), DateUtils.DATE_PATTERN).substring(0, 4));
formDTO.setStartDate(DateUtils.format(DateUtils.addDateDays(new Date(), -1), DateUtils.DATE_PATTERN)); formDTO.setStartDate(DateUtils.format(DateUtils.addDateDays(new Date(), -1), DateUtils.DATE_PATTERN));
} }
return baseDao.getScreenExportData(formDTO); List<EventStatisticsResultDTO> resultDTOList = baseDao.getScreenExportData(formDTO);
// 组装满意度信息
resultDTOList = getSatisfiedInfo(formDTO,resultDTOList);
// 获取按期办结信息
resultDTOList = getOnTimeDealInfo(formDTO,resultDTOList);
// 获取红黄灯预警数
resultDTOList = getYellowRedInfo(formDTO,resultDTOList);
return resultDTOList;
}
/**
* 获取满意度和满意率
* @param formDTO
* @return
*/
private List<EventStatisticsResultDTO> getSatisfiedInfo(EventStatisticsFormDTO formDTO,List<EventStatisticsResultDTO> resultDTOList){
List<EvaluationInfoResultDTO> resultDto = baseDao.getSatisfiedInfo(formDTO);
// 组装满意度信息
for(EventStatisticsResultDTO totalDto : resultDTOList){
for(EvaluationInfoResultDTO childDto : resultDto){
if(totalDto.getDeptId().equals(childDto.getDeptId())){
totalDto.setSatisfiedCount(childDto.getValue());
totalDto.setSatisfiedRatio(childDto.getProportion());
break;
}
}
}
return resultDTOList;
}
/**
* 获取按期办结信息
* @param formDTO
* @return
*/
private List<EventStatisticsResultDTO> getOnTimeDealInfo(EventStatisticsFormDTO formDTO,List<EventStatisticsResultDTO> resultDTOList){
List<OnTimeDealInfoResultDTO> resultDto = baseDao.getOnTimeDealInfo(formDTO);
// 组装满意度信息
for(EventStatisticsResultDTO totalDto : resultDTOList){
for(OnTimeDealInfoResultDTO childDto : resultDto){
if(totalDto.getDeptId().equals(childDto.getDeptId())){
totalDto.setScheduleClosedCount(childDto.getValue());
totalDto.setScheduleClosedRatio(childDto.getProportion());
break;
}
}
}
return resultDTOList;
}
/**
* 获取红黄灯事件数
* @param formDTO
* @return
*/
private List<EventStatisticsResultDTO> getYellowRedInfo(EventStatisticsFormDTO formDTO,List<EventStatisticsResultDTO> resultDTOList){
List<YellowRedInfoResultDTO> resultDto = baseDao.getYellowRedInfo(formDTO);
// 组装满意度信息
for(EventStatisticsResultDTO totalDto : resultDTOList){
for(YellowRedInfoResultDTO childDto : resultDto){
if(totalDto.getDeptId().equals(childDto.getDeptId())){
totalDto.setYellowCount(childDto.getYellowNum());
totalDto.setRedCount(childDto.getRedNum());
break;
}
}
}
return resultDTOList;
} }
private BarCategoryResultDTO getBarCategoryResultDTO(BarCategoryResultDTO result, List<EventStatisticsResultDTO> list, String peopleFlag) { private BarCategoryResultDTO getBarCategoryResultDTO(BarCategoryResultDTO result, List<EventStatisticsResultDTO> list, String peopleFlag) {

342
esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/resources/mapper/screen/ScreenDeptEventStatDao.xml

@ -243,78 +243,280 @@
ORDER BY a.sort ORDER BY a.sort
</select> </select>
<select id="getScreenExportData" resultType="com.elink.esua.epdc.dto.screen.result.EventStatisticsResultDTO"> <select id="getSatisfiedInfo" resultType="com.elink.esua.epdc.dto.item.result.EvaluationInfoResultDTO"
SELECT a.id AS deptId, parameterType="com.elink.esua.epdc.dto.screen.form.EventStatisticsFormDTO">
a.`name` AS deptName,
a.pid, SELECT
a.pids, a.id AS deptId,
a.type_key AS deptLevel, IFNULL(SUM(b.value), 0) AS value,
a.sort AS deptSort, concat(ROUND(IFNULL(SUM(b.value) / SUM(b.total) * 100 , 0) ,1 ),'%') as proportion
IFNULL(SUM(b.eventCount), 0) AS 'eventCount',
IFNULL(SUM(b.closedCount), 0) AS 'closedCount',
IFNULL(SUM(b.livelihoodCount), 0) AS 'livelihoodCount',
IFNULL(SUM(b.developCount), 0) AS 'developCount',
IFNULL(SUM(b.lawCount), 0) AS 'lawCount',
IFNULL(SUM(b.responseCount), 0) AS 'responseCount'
FROM meta_sys_dept a FROM meta_sys_dept a
LEFT JOIN ( left join (
SELECT a.ALL_DEPT_IDS, select
COUNT(a.ID) AS 'eventCount', item.ALL_DEPT_IDS,
CASE WHEN a.ITEM_STATE = '10' THEN COUNT(a.ID) END AS 'closedCount', count((item.EVALUATION_SCORE = 1 or item.EVALUATION_SCORE = 2) or null) as value,
CASE a.PEOPLE_FLAG WHEN '0' THEN COUNT(a.ID) END AS 'livelihoodCount', count(item.ID) as total
CASE a.PEOPLE_FLAG WHEN '1' THEN COUNT(a.ID) END AS 'developCount', from epdc_item item
CASE a.PEOPLE_FLAG WHEN '2' THEN COUNT(a.ID) END AS 'lawCount', where item.DEL_FLAG = '0'
COUNT(c.ITEM_ID) AS 'responseCount' and item.IS_PEOPLE = '1'
FROM epdc_item a and item.EVENT_ID is null
and item.ISSUE_ID is null
and item.EVALUATION_SCORE is not null
and ((SUBSTRING_INDEX(item.CATEGORY_FULL_NAME,'-',1) != '其他' and item.PEOPLE_FLAG = '0') or (item.PEOPLE_FLAG in ('1','2')))
<if test='"1" == statType'>
AND DATE_FORMAT(item.CREATED_TIME, '%Y-%m-%d') &lt;= #{statDate}
</if>
<if test='"2" == statType'>
AND DATE_FORMAT(item.CREATED_TIME, '%Y-%m') = #{statDate}
AND DATE_FORMAT(item.CREATED_TIME, '%Y-%m-%d') &lt;= #{startDate}
</if>
<if test='"3" == statType'>
AND DATE_FORMAT(item.CREATED_TIME, '%Y') = #{statDate}
AND DATE_FORMAT(item.CREATED_TIME, '%Y-%m-%d') &lt;= #{startDate}
</if>
<if test='"4" == statType'>
AND DATE_FORMAT(item.CREATED_TIME, '%Y-%m-%d') &gt;= #{startDate}
AND DATE_FORMAT(item.CREATED_TIME, '%Y-%m-%d') &lt;= #{endDate}
</if>
<if test="peopleFlag != null and peopleFlag != ''">
AND item.PEOPLE_FLAG = #{peopleFlag}
</if>
GROUP BY item.ALL_DEPT_IDS
) b ON b.ALL_DEPT_IDS LIKE CONCAT('%', a.id, '%')
WHERE a.del_flag = '0'
<if test="deptId != null and deptId != ''">
AND a.pid = #{deptId}
</if>
AND a.type_key != 'street_dept'
AND a.type_key != 'district_dept'
GROUP BY a.id
ORDER BY a.sort, CONVERT(a.`name` USING gbk) ASC
</select>
<select id="getOnTimeDealInfo" resultType="com.elink.esua.epdc.dto.item.result.OnTimeDealInfoResultDTO"
parameterType="com.elink.esua.epdc.dto.screen.form.EventStatisticsFormDTO">
SELECT
a.id AS deptId,
IFNULL(SUM(b.value), 0) AS value,
concat(ROUND(IFNULL(SUM(b.value) / SUM(b.total) * 100 , 0) ,1 ),'%') as proportion
FROM meta_sys_dept a
left join (
SELECT
item.ALL_DEPT_IDS,
count(item.ID) as total,
count((getworkminute(item.CREATED_TIME,process.CREATED_TIME) / 60 &lt;= 8) or null) value
FROM epdc_item item
left join (
select b.ID,b.ITEM_ID,b.CREATED_TIME,b.state
from epdc_item_handle_process b
where b.DEL_FLAG = '0'
and b.CREATED_TIME = (
SELECT
min(CREATED_TIME)
from epdc_item_handle_process
where b.ITEM_ID = ITEM_ID
and DEL_FLAG = '0'
and HANDLER_DEPT = '网格化平台'
)
) process on process.ITEM_ID = item.ID
where item.DEL_FLAG = '0'
and item.ITEM_STATE = '10'
and item.IS_PEOPLE = '1'
and item.EVENT_ID is null
and item.ISSUE_ID is null
and item.EVALUATION_SCORE is not null
and ((SUBSTRING_INDEX(item.CATEGORY_FULL_NAME,'-',1) != '其他' and item.PEOPLE_FLAG = '0') or (item.PEOPLE_FLAG in ('1','2')))
<if test='"1" == statType'>
AND DATE_FORMAT(item.CREATED_TIME, '%Y-%m-%d') &lt;= #{statDate}
</if>
<if test='"2" == statType'>
AND DATE_FORMAT(item.CREATED_TIME, '%Y-%m') = #{statDate}
AND DATE_FORMAT(item.CREATED_TIME, '%Y-%m-%d') &lt;= #{startDate}
</if>
<if test='"3" == statType'>
AND DATE_FORMAT(item.CREATED_TIME, '%Y') = #{statDate}
AND DATE_FORMAT(item.CREATED_TIME, '%Y-%m-%d') &lt;= #{startDate}
</if>
<if test='"4" == statType'>
AND DATE_FORMAT(item.CREATED_TIME, '%Y-%m-%d') &gt;= #{startDate}
AND DATE_FORMAT(item.CREATED_TIME, '%Y-%m-%d') &lt;= #{endDate}
</if>
<if test="peopleFlag != null and peopleFlag != ''">
AND item.PEOPLE_FLAG = #{peopleFlag}
</if>
GROUP BY item.ALL_DEPT_IDS
) b ON b.ALL_DEPT_IDS LIKE CONCAT('%', a.id, '%')
WHERE a.del_flag = '0'
<if test="deptId != null and deptId != ''">
AND a.pid = #{deptId}
</if>
AND a.type_key != 'street_dept'
AND a.type_key != 'district_dept'
GROUP BY a.id
ORDER BY a.sort, CONVERT(a.`name` USING gbk) ASC
</select>
<select id="getYellowRedInfo" resultType="com.elink.esua.epdc.dto.item.result.YellowRedInfoResultDTO"
parameterType="com.elink.esua.epdc.dto.screen.form.EventStatisticsFormDTO">
SELECT
a.id AS deptId,
IFNULL(SUM(b.redNum), 0) AS redNum,
IFNULL(SUM(b.yellowNum), 0) AS yellowNum
FROM meta_sys_dept a
left join (
SELECT
aa.ALL_DEPT_IDS,
sum((case when bb.handleId is null and aa.item_state='0' and getworkminute(aa.created_time, now()) > 480 then 1 else 0 end)) redNum,
sum((case when bb.handleId is null and aa.item_state = '0' and (getworkminute(aa.created_time, now()) BETWEEN 360 and 480) then 1 else 0 end))yellowNum
FROM epdc_item aa
LEFT JOIN (
select h.id,h.item_id,h.created_time,h.state,p.id as handleId
from epdc_item ei
inner join epdc_item_handle_process h on ei.id = h.item_id
LEFT JOIN ( LEFT JOIN (
SELECT h.id, select id,item_id FROM epdc_item_handle_process where handler_dept = '网格化平台' and del_flag = '0' group by item_id
h.item_id, ) p ON ei.id = p.item_id
h.created_time, where ei.is_people = '1'
h.state and ei.del_flag = '0'
FROM epdc_item ei AND ei.event_id is NULL
INNER JOIN epdc_item_handle_process h ON ei.id = h.item_id AND ei.issue_id is NULL
WHERE ei.is_people = '1' and h.del_flag = '0'
AND ei.del_flag = '0' and h.created_time = (
AND ei.event_id IS NULL select max(created_time)
AND ei.issue_id IS NULL from epdc_item_handle_process
AND h.del_flag = '0' where h.item_id = item_id
AND h.created_time = (SELECT max(created_time) and del_flag = '0'
FROM epdc_item_handle_process )
WHERE h.item_id = item_id AND del_flag = '0') GROUP BY h.item_id
AND h.STATE != 1001 )bb ON aa.id = bb.item_id
GROUP BY h.item_id WHERE aa.is_people = '1'
ORDER BY h.item_id AND aa.del_flag = '0'
) c ON c.ITEM_ID = a.ID AND aa.event_id is NULL
WHERE a.DEL_FLAG = '0' AND aa.issue_id is NULL
AND a.PEOPLE_FLAG IS NOT NULL <if test='"1" == statType'>
AND a.IS_PEOPLE = '1' AND DATE_FORMAT(aa.CREATED_TIME, '%Y-%m-%d') &lt;= #{statDate}
AND a.EVENT_ID is null </if>
AND a.ISSUE_ID is null <if test='"2" == statType'>
<if test='"1" == statType'> AND DATE_FORMAT(aa.CREATED_TIME, '%Y-%m') = #{statDate}
AND DATE_FORMAT(a.CREATED_TIME, '%Y-%m-%d') &lt;= #{statDate} AND DATE_FORMAT(aa.CREATED_TIME, '%Y-%m-%d') &lt;= #{startDate}
</if> </if>
<if test='"2" == statType'> <if test='"3" == statType'>
AND DATE_FORMAT(a.CREATED_TIME, '%Y-%m') = #{statDate} AND DATE_FORMAT(aa.CREATED_TIME, '%Y') = #{statDate}
AND DATE_FORMAT(a.CREATED_TIME, '%Y-%m-%d') &lt;= #{startDate} AND DATE_FORMAT(aa.CREATED_TIME, '%Y-%m-%d') &lt;= #{startDate}
</if> </if>
<if test='"3" == statType'> <if test='"4" == statType'>
AND DATE_FORMAT(a.CREATED_TIME, '%Y') = #{statDate} AND DATE_FORMAT(aa.CREATED_TIME, '%Y-%m-%d') &gt;= #{startDate}
AND DATE_FORMAT(a.CREATED_TIME, '%Y-%m-%d') &lt;= #{startDate} AND DATE_FORMAT(aa.CREATED_TIME, '%Y-%m-%d') &lt;= #{endDate}
</if> </if>
<if test='"4" == statType'> <if test="peopleFlag != null and peopleFlag != ''">
AND DATE_FORMAT(a.CREATED_TIME, '%Y-%m-%d') &gt;= #{startDate} AND aa.PEOPLE_FLAG = #{peopleFlag}
AND DATE_FORMAT(a.CREATED_TIME, '%Y-%m-%d') &lt;= #{endDate} </if>
</if> GROUP BY aa.ALL_DEPT_IDS
<if test="mobile != null and mobile != ''"> ) b ON b.ALL_DEPT_IDS LIKE CONCAT('%', a.id, '%')
AND a.MOBILE LIKE CONCAT('%', #{mobile}, '%') WHERE a.del_flag = '0'
</if> <if test="deptId != null and deptId != ''">
<if test="category != null and category != ''"> AND a.pid = #{deptId}
AND a.CATEGORY_FULL_CODE LIKE CONCAT('%', #{category}, '%') </if>
</if> AND a.type_key != 'street_dept'
<if test="evaluationScore != null and evaluationScore != ''"> AND a.type_key != 'district_dept'
AND a.EVALUATION_SCORE = #{category} GROUP BY a.id
</if> ORDER BY a.sort, CONVERT(a.`name` USING gbk) ASC
GROUP BY ALL_DEPT_IDS
</select>
<select id="getScreenExportData" resultType="com.elink.esua.epdc.dto.screen.result.EventStatisticsResultDTO">
SELECT
a.id AS deptId,
a.`name` AS deptName,
a.pid,
a.pids,
a.type_key AS deptLevel,
a.sort AS deptSort,
IFNULL(SUM(b.eventCount), 0) AS 'eventCount',
IFNULL(SUM(b.closedCount), 0) AS 'closedCount',
CONCAT(ROUND(IFNULL(SUM(b.closedCount) / SUM(b.eventCount) * 100,0),1),'%') as closedRatio,
IFNULL(SUM(b.livelihoodCount), 0) AS 'livelihoodCount',
IFNULL(SUM(b.developCount), 0) AS 'developCount',
IFNULL(SUM(b.lawCount), 0) AS 'lawCount',
IFNULL(SUM(b.responseCount), 0) AS 'responseCount',
CONCAT(ROUND(IFNULL(SUM(b.responseCount) / SUM(b.eventCount) * 100,0),1),'%') as responseRatio,
IFNULL(SUM(b.unAcceptCount), 0) AS 'unAcceptCount',
IFNULL(SUM(b.gridCommunityDealNum), 0) AS 'gridCommunityDealNum'
FROM meta_sys_dept a
LEFT JOIN (
SELECT
a.ALL_DEPT_IDS,
COUNT(a.ID) AS 'eventCount',
CASE WHEN a.ITEM_STATE = '10' THEN COUNT(a.ID) END AS 'closedCount',
CASE a.PEOPLE_FLAG WHEN '0' THEN COUNT(a.ID) END AS 'livelihoodCount',
CASE a.PEOPLE_FLAG WHEN '1' THEN COUNT(a.ID) END AS 'developCount',
CASE a.PEOPLE_FLAG WHEN '2' THEN COUNT(a.ID) END AS 'lawCount',
COUNT(c.ITEM_ID) AS 'responseCount',
COUNT(d.ITEM_ID) AS 'unAcceptCount',
COUNT(e.ITEM_ID) AS 'gridCommunityDealNum'
FROM epdc_item a
LEFT JOIN (
SELECT h.id, h.item_id, h.created_time, h.state
FROM epdc_item ei
INNER JOIN epdc_item_handle_process h ON ei.id = h.item_id
WHERE ei.is_people = '1' AND ei.del_flag = '0' AND ei.event_id IS NULL AND ei.issue_id IS NULL AND h.del_flag = '0'
AND h.created_time = (SELECT max(created_time) FROM epdc_item_handle_process WHERE h.item_id = item_id AND del_flag = '0')
AND h.STATE != 1001
GROUP BY h.item_id
ORDER BY h.item_id
) c ON c.ITEM_ID = a.ID
LEFT JOIN (
SELECT h.id, h.item_id, h.created_time, h.state
FROM epdc_item ei
INNER JOIN epdc_item_handle_process h ON ei.id = h.item_id
WHERE ei.is_people = '1' AND ei.del_flag = '0' AND ei.event_id IS NULL AND ei.issue_id IS NULL AND h.del_flag = '0'
AND h.HANDLE_ADVICE like '%您反映的诉求属于不予受理情形中的%'
GROUP BY h.item_id
ORDER BY h.item_id
) d ON d.ITEM_ID = a.ID
LEFT JOIN (
SELECT h.id, h.item_id, h.created_time, h.state
FROM epdc_item ei
INNER JOIN epdc_item_handle_process h ON ei.id = h.item_id
WHERE ei.is_people = '1' AND ei.del_flag = '0' AND ei.event_id IS NULL AND ei.issue_id IS NULL AND h.del_flag = '0'
AND h.STATE = '11'
GROUP BY h.item_id
ORDER BY h.item_id
) e ON e.ITEM_ID = a.ID
WHERE a.DEL_FLAG = '0'
AND a.PEOPLE_FLAG IS NOT NULL
AND a.IS_PEOPLE = '1'
AND a.EVENT_ID is null
AND a.ISSUE_ID is null
<if test='"1" == statType'>
AND DATE_FORMAT(a.CREATED_TIME, '%Y-%m-%d') &lt;= #{statDate}
</if>
<if test='"2" == statType'>
AND DATE_FORMAT(a.CREATED_TIME, '%Y-%m') = #{statDate}
AND DATE_FORMAT(a.CREATED_TIME, '%Y-%m-%d') &lt;= #{startDate}
</if>
<if test='"3" == statType'>
AND DATE_FORMAT(a.CREATED_TIME, '%Y') = #{statDate}
AND DATE_FORMAT(a.CREATED_TIME, '%Y-%m-%d') &lt;= #{startDate}
</if>
<if test='"4" == statType'>
AND DATE_FORMAT(a.CREATED_TIME, '%Y-%m-%d') &gt;= #{startDate}
AND DATE_FORMAT(a.CREATED_TIME, '%Y-%m-%d') &lt;= #{endDate}
</if>
<if test="mobile != null and mobile != ''">
AND a.MOBILE LIKE CONCAT('%', #{mobile}, '%')
</if>
<if test="category != null and category != ''">
AND a.CATEGORY_FULL_CODE LIKE CONCAT('%', #{category}, '%')
</if>
<if test="evaluationScore != null and evaluationScore != ''">
AND a.EVALUATION_SCORE = #{category}
</if>
GROUP BY ALL_DEPT_IDS
) b ON b.ALL_DEPT_IDS LIKE CONCAT('%', a.id, '%') ) b ON b.ALL_DEPT_IDS LIKE CONCAT('%', a.id, '%')
WHERE a.del_flag = '0' WHERE a.del_flag = '0'
AND a.pid = #{deptId} AND a.pid = #{deptId}

Loading…
Cancel
Save