Browse Source

大屏统计接口逻辑调整

feature/dangjian
wanggongfeng 3 years ago
parent
commit
7792d06622
  1. 5
      esua-epdc/epdc-module/epdc-events/epdc-events-client/src/main/java/com/elink/esua/epdc/dto/item/form/ScreenTotalFormDTO.java
  2. 1
      esua-epdc/epdc-module/epdc-events/epdc-events-client/src/main/java/com/elink/esua/epdc/dto/item/result/CategoryAnalysisPieResultDTO.java
  3. 3
      esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/java/com/elink/esua/epdc/modules/item/dao/ItemDao.java
  4. 54
      esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/java/com/elink/esua/epdc/modules/item/service/impl/ItemServiceImpl.java
  5. 33
      esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/resources/mapper/item/ItemDao.xml

5
esua-epdc/epdc-module/epdc-events/epdc-events-client/src/main/java/com/elink/esua/epdc/dto/item/form/ScreenTotalFormDTO.java

@ -40,6 +40,11 @@ public class ScreenTotalFormDTO implements Serializable {
*/ */
private String yearMonth; private String yearMonth;
/**
* 是否查询其他数据(0:1)
*/
private String isElse;
/** /**
* 时间数组 * 时间数组
*/ */

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

@ -3,6 +3,7 @@ package com.elink.esua.epdc.dto.item.result;
import lombok.Data; import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;

3
esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/java/com/elink/esua/epdc/modules/item/dao/ItemDao.java

@ -503,7 +503,8 @@ public interface ItemDao extends BaseDao<ItemEntity> {
* @param formDTO * @param formDTO
* @return * @return
*/ */
List<CategoryAnalysisPieResultDTO> categoryAnalysis(ScreenTotalFormDTO formDTO); List<CategoryAnalysisPieResultDTO> categoryAnalysisFirst(ScreenTotalFormDTO formDTO);
List<CategoryAnalysisPieResultDTO> categoryAnalysisSecond(ScreenTotalFormDTO formDTO);
/** /**
* 满意度统计 * 满意度统计

54
esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/java/com/elink/esua/epdc/modules/item/service/impl/ItemServiceImpl.java

@ -3937,10 +3937,60 @@ public class ItemServiceImpl extends BaseServiceImpl<ItemDao, ItemEntity> implem
@Override @Override
public List<CategoryAnalysisPieResultDTO> categoryAnalysis(ScreenTotalFormDTO formDTO) { public List<CategoryAnalysisPieResultDTO> categoryAnalysis(ScreenTotalFormDTO formDTO) {
// 返回值
List<CategoryAnalysisPieResultDTO> resultList = new ArrayList<CategoryAnalysisPieResultDTO>();
if("0".equals(formDTO.getIsElse())){
// 城市综合
// 定义初始【城市综合】5大类
List<String> cityCompre = new ArrayList<>();
cityCompre.add("城市综合-交通运输");
cityCompre.add("城市综合-城市管理");
cityCompre.add("城市综合-城管执法");
cityCompre.add("城市综合-环境保护");
cityCompre.add("城市综合-居民生活");
// 获取分类全部数据
List<CategoryAnalysisPieResultDTO> list = baseDao.categoryAnalysisSecond(formDTO);
// 其他总数
Integer elseValue = 0;
for(CategoryAnalysisPieResultDTO dto : list){
if(cityCompre.contains(dto.getName())){
resultList.add(dto);
}else{
elseValue += Integer.parseInt(dto.getValue());
}
}
// 定义【其他】
CategoryAnalysisPieResultDTO elseCategory = new CategoryAnalysisPieResultDTO();
elseCategory.setCode("其他");
elseCategory.setName("其他");
elseCategory.setValue(elseValue.toString());
resultList.add(elseCategory);
}else{
// 其他
// 总数
Integer total = 0;
List<CategoryAnalysisPieResultDTO> list = baseDao.categoryAnalysisFirst(formDTO);
for(CategoryAnalysisPieResultDTO dto1 : list){
total += Integer.parseInt(dto1.getValue());
}
for(CategoryAnalysisPieResultDTO dto2 : list){
if(!"城市综合".equals(dto2.getName())){
List<CategoryAnalysisPieResultDTO> list = baseDao.categoryAnalysis(formDTO); BigDecimal value = BigDecimal.valueOf(Integer.parseInt(dto2.getValue()));
BigDecimal totalBig = BigDecimal.valueOf(total);
BigDecimal proportion = value .divide(totalBig,2, RoundingMode.HALF_UP);
dto2.setProportion(proportion + "%");
resultList.add(dto2);
return list; }
}
}
return resultList;
} }
@Override @Override

33
esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/resources/mapper/item/ItemDao.xml

@ -2364,7 +2364,7 @@
order by i.created_time DESC order by i.created_time DESC
</select> </select>
<select id="categoryAnalysis" resultType="com.elink.esua.epdc.dto.item.result.CategoryAnalysisPieResultDTO" <select id="categoryAnalysisFirst" resultType="com.elink.esua.epdc.dto.item.result.CategoryAnalysisPieResultDTO"
parameterType="com.elink.esua.epdc.dto.item.form.ScreenTotalFormDTO"> parameterType="com.elink.esua.epdc.dto.item.form.ScreenTotalFormDTO">
select select
SUBSTRING_INDEX(item.CATEGORY_FULL_NAME,'-',1) as name, SUBSTRING_INDEX(item.CATEGORY_FULL_NAME,'-',1) as name,
@ -2388,6 +2388,30 @@
group by SUBSTRING_INDEX(item.CATEGORY_FULL_NAME,'-',1) group by SUBSTRING_INDEX(item.CATEGORY_FULL_NAME,'-',1)
ORDER BY count(item.ID) desc ORDER BY count(item.ID) desc
</select> </select>
<select id="categoryAnalysisSecond" resultType="com.elink.esua.epdc.dto.item.result.CategoryAnalysisPieResultDTO"
parameterType="com.elink.esua.epdc.dto.item.form.ScreenTotalFormDTO">
select
SUBSTRING_INDEX(item.CATEGORY_FULL_NAME,'-',2) as name,
SUBSTRING_INDEX(item.CATEGORY_FULL_CODE,'-',2) as code,
count(item.ID) as value
from epdc_item item
where item.DEL_FLAG = '0'
and item.IS_PEOPLE = '1'
and item.EVENT_ID is null
and item.ISSUE_ID is null
and SUBSTRING_INDEX(item.CATEGORY_FULL_NAME,'-',1) != '其他'
<if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
AND DATE_FORMAT( item.CREATED_TIME, '%Y-%m-%d' ) BETWEEN #{startTime} AND #{endTime}
</if>
<if test="deptId != null and deptId != ''">
AND find_in_set(#{deptId},item.ALL_DEPT_IDS)
</if>
<if test="peopleFlag != null and peopleFlag != ''">
AND item.PEOPLE_FLAG = #{peopleFlag}
</if>
group by SUBSTRING_INDEX(item.CATEGORY_FULL_NAME,'-',2)
ORDER BY count(item.ID) desc
</select>
<select id="evaluationTotal" resultType="com.elink.esua.epdc.dto.item.result.EvaluationTotalPieResultDTO" <select id="evaluationTotal" resultType="com.elink.esua.epdc.dto.item.result.EvaluationTotalPieResultDTO"
parameterType="com.elink.esua.epdc.dto.item.form.ScreenTotalFormDTO"> parameterType="com.elink.esua.epdc.dto.item.form.ScreenTotalFormDTO">
@ -2423,12 +2447,13 @@
parameterType="com.elink.esua.epdc.dto.item.form.ScreenTotalFormDTO"> parameterType="com.elink.esua.epdc.dto.item.form.ScreenTotalFormDTO">
select select
DATE_FORMAT(item.CREATED_TIME,'%Y-%m-%d') as time, DATE_FORMAT(item.CREATED_TIME,'%Y-%m-%d') as time,
count(item.EVALUATION_SCORE = 0 or null) as bmy, ROUND(count(item.EVALUATION_SCORE = 0 or null) / count(item.ID) * 100,1) as bmy,
count(item.EVALUATION_SCORE = 1 or null) as jbmy, ROUND(count(item.EVALUATION_SCORE = 1 or null) / count(item.ID) * 100,1) as jbmy,
count(item.EVALUATION_SCORE = 2 or null) as fcmy ROUND(count(item.EVALUATION_SCORE = 2 or null) / count(item.ID) * 100,1) as fcmy
from epdc_item item from epdc_item item
where item.DEL_FLAG = '0' where item.DEL_FLAG = '0'
and item.IS_PEOPLE = '1' and item.IS_PEOPLE = '1'
and item.ITEM_STATE = '10'
and item.EVENT_ID is null and item.EVENT_ID is null
and item.ISSUE_ID is null and item.ISSUE_ID is null
and SUBSTRING_INDEX(item.CATEGORY_FULL_NAME,'-',1) != '其他' and SUBSTRING_INDEX(item.CATEGORY_FULL_NAME,'-',1) != '其他'

Loading…
Cancel
Save