springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/community/sanshuo/IndexDateDTO.java
New file @@ -0,0 +1,17 @@ package com.panzhihua.common.model.dtos.community.sanshuo; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import springfox.documentation.annotations.ApiIgnore; @Data @ApiModel("大屏事件入参(区三说会堂,行业分中心,街道,社区数据)") public class IndexDateDTO { @ApiModelProperty("1区三说会堂,2行业分中心,3街道、镇,4社区/村") private Integer type; @ApiModelProperty("行业分中心id或街道id或社区id(type=1不传,type=2传行业分中心id,type=3传街道id,type=4传社区id)") private Long id; @ApiModelProperty(hidden = true) private Integer level; } springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/sanshuo/IndexDateVO.java
New file @@ -0,0 +1,39 @@ package com.panzhihua.common.model.vos.sanshuo; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import java.math.BigDecimal; import java.util.List; @Data @ApiModel("大屏事件数据统计(三说会堂,行业分中心,街道,社区)") public class IndexDateVO { @ApiModelProperty("受理案件") private Integer accept; @ApiModelProperty("正在调解") private Integer accepting; @ApiModelProperty("已完成调解") private Integer accepted; @ApiModelProperty("经验累计") private Integer total; @ApiModelProperty("调解专家") private Integer expert; @ApiModelProperty("调解成功") private Integer success; @ApiModelProperty("调解失败") private Integer fail; @ApiModelProperty("成功率") private BigDecimal successRate; @ApiModelProperty("本月新增") private Integer monthIncrease; @ApiModelProperty("本月办结") private Integer monthFinish; @ApiModelProperty("X轴") private List<String> X; @ApiModelProperty("Y轴:新增案件") private List<Integer> Y1; @ApiModelProperty("Y轴:办结案件") private List<Integer> Y2; } springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/api/ComSanShuoEventApi.java
@@ -6,6 +6,7 @@ import com.panzhihua.common.controller.BaseController; import com.panzhihua.common.model.dtos.community.sanshuo.ComMediateTypeDTO; import com.panzhihua.common.model.dtos.community.sanshuo.ComSanshuoEventDTO; import com.panzhihua.common.model.dtos.community.sanshuo.IndexDateDTO; import com.panzhihua.common.model.vos.R; import com.panzhihua.service_community.entity.ComMediateType; import com.panzhihua.service_community.entity.ComSanshuoEvent; @@ -78,4 +79,12 @@ comMediateType.setModifyUser(this.getLoginUserInfo().getUserId()); return R.ok(commediateTypeService.updateById(comMediateType)); } /** * 大屏接口-事件统计 * */ @PostMapping("/indexDate") public R indexDate(@RequestBody IndexDateDTO indexDateDTO){ return commediateTypeService.indexDate(indexDateDTO); } } springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComEventMapper.java
@@ -3,7 +3,10 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.panzhihua.common.model.dtos.community.sanshuo.IndexDateDTO; import com.panzhihua.common.model.vos.IndexDataVO; import com.panzhihua.common.model.vos.sanshuo.ComEventCalculateVO; import com.panzhihua.common.model.vos.sanshuo.IndexDateVO; import com.panzhihua.service_community.entity.ComEvent; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -39,4 +42,29 @@ List<ComEvent> listByComEvent(@Param("comEvent") ComEvent comEvent); List<ComEventCalculateVO> calculate(); /** * 大屏事件统计 * @param indexDateDTO * @return 处理结果 * @author zhangtiansen * */ IndexDateVO dateAnalysis(@Param("dto") IndexDateDTO indexDateDTO); /** * 大屏事件统计-月新增 * @param beginDate 开始时间 * @param endDate 结束时间 * @author zhangtiansen * */ Integer dateAnalysisY(@Param("beginDate")String beginDate,@Param("endDate")String endDate); /** * 大屏事件统计-月办结 * @param beginDate 开始时间 * @param endDate 结束时间 * @author zhangtiansen * */ Integer dateAnalysisYTwo(@Param("beginDate")String beginDate,@Param("endDate")String endDate); } springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/CommediateTypeService.java
@@ -2,6 +2,7 @@ import com.baomidou.mybatisplus.extension.service.IService; import com.panzhihua.common.model.dtos.community.sanshuo.ComMediateTypeDTO; import com.panzhihua.common.model.dtos.community.sanshuo.IndexDateDTO; import com.panzhihua.common.model.vos.R; import com.panzhihua.service_community.entity.ComMediateType; @@ -21,4 +22,11 @@ * @return 处理结果 * */ R addOrUpdate(ComMediateTypeDTO comMediateTypeDTO); /** * 首页事件统计看板 * @param indexDateDTO * @return 处理结果 * */ R indexDate(IndexDateDTO indexDateDTO); } springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/CommediateTypeServiceImpl.java
@@ -6,8 +6,10 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.panzhihua.common.model.dtos.community.sanshuo.ComMediateTypeDTO; import com.panzhihua.common.model.dtos.community.sanshuo.IndexDateDTO; import com.panzhihua.common.model.vos.R; import com.panzhihua.common.utlis.Snowflake; import com.panzhihua.service_community.dao.ComEventMapper; import com.panzhihua.service_community.dao.ComMediateTypeDao; import com.panzhihua.service_community.entity.ComMediateType; import com.panzhihua.service_community.service.CommediateTypeService; @@ -25,6 +27,8 @@ @Resource private ComMediateTypeDao comMediateTypeDao; @Resource private ComEventMapper comEventMapper; /** * 后台获取事件列表 @@ -61,4 +65,15 @@ mediateType.setCreateDate(new Date()); return R.ok(comMediateTypeDao.insert(mediateType)); } /** * 首页事件统计看板 * @param indexDateDTO * @return 处理结果 * */ @Override public R indexDate(IndexDateDTO indexDateDTO) { comEventMapper.dateAnalysis(indexDateDTO); return null; } } springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ComEventMapper.xml
@@ -66,5 +66,165 @@ from com_sanshuo_event_info group by event_process_status </select> <select id="dateAnalysis" resultType="com.panzhihua.common.model.vos.sanshuo.IndexDateVO"> SELECT (SELECT count(id) FROM com_sanshuo_event_info where event_process_status in (3,5,6) AND user_event_status not in(3,4) <if test="dto.type == 2"> AND type=1 <if test="dto.id != null"> AND center_id=#{dto.id} </if> </if> <if test="dto.type == 3"> AND type=2 <if test="dto.id != null"> AND request_user_community in (select com_act.community_id from com_act where street_id=#{dto.id}) </if> </if> <if test="dto.type == 4"> AND type=3 <if test="dto.id != null"> AND request_user_community=#{dto.id} </if> </if> ) as accept, (SELECT count(id) FROM com_sanshuo_event_info where event_process_status = 5 AND user_event_status not in(3,4) <if test="dto.type == 2"> AND type=1 <if test="dto.id != null"> AND center_id=#{dto.id} </if> </if> <if test="dto.type == 3"> AND type=2 <if test="dto.id != null"> AND request_user_community in (select com_act.community_id from com_act where street_id=#{dto.id}) </if> </if> <if test="dto.type == 4"> AND type=3 <if test="dto.id != null"> AND request_user_community=#{dto.id} </if> </if>) as accepting, (SELECT count(id) FROM com_sanshuo_event_info where event_process_status = 6 AND user_event_status not in(3,4) <if test="dto.type == 2"> AND type=1 <if test="dto.id != null"> AND center_id=#{dto.id} </if> </if> <if test="dto.type == 3"> AND type=2 <if test="dto.id != null"> AND request_user_community in (select com_act.community_id from com_act where street_id=#{dto.id}) </if> </if> <if test="dto.type == 4"> AND type=3 <if test="dto.id != null"> AND request_user_community=#{dto.id} </if> </if>) as accepted, (SELECT count(id) FROM com_sanshuo_event_info where event_process_status in (6,7) AND user_event_status not in(3,4) <if test="dto.type == 2"> AND type=1 <if test="dto.id != null"> AND center_id=#{dto.id} </if> </if> <if test="dto.type == 3"> AND type=2 <if test="dto.id != null"> AND request_user_community in (select com_act.community_id from com_act where street_id=#{dto.id}) </if> </if> <if test="dto.type == 4"> AND type=3 <if test="dto.id != null"> AND request_user_community=#{dto.id} </if> </if>) as expirences, (select count(id) FROM com_sanshuo_event_info where event_result=1 AND user_event_status not in(3,4) <if test="dto.type == 2"> AND type=1 <if test="dto.id != null"> AND center_id=#{dto.id} </if> </if> <if test="dto.type == 3"> AND type=2 <if test="dto.id != null"> AND request_user_community in (select com_act.community_id from com_act where street_id=#{dto.id}) </if> </if> <if test="dto.type == 4"> AND type=3 <if test="dto.id != null"> AND request_user_community=#{dto.id} </if> </if>) as success, (select count(id) FROM com_sanshuo_event_info where event_result=2 AND user_event_status not in(3,4) <if test="dto.type == 2"> AND type=1 <if test="dto.id != null"> AND center_id=#{dto.id} </if> </if> <if test="dto.type == 3"> AND type=2 <if test="dto.id != null"> AND request_user_community in (select com_act.community_id from com_act where street_id=#{dto.id}) </if> </if> <if test="dto.type == 4"> AND type=3 <if test="dto.id != null"> AND request_user_community=#{dto.id} </if> </if>) as fail, (select count(id) from com_sanshuo_expert where `status`=1 and del_flag=1 AND user_event_status not in(3,4) <if test="dto.type == 2"> AND type=1 <if test="dto.id != null"> AND center_id=#{dto.id} </if> </if> <if test="dto.type == 3"> AND type=2 <if test="dto.id != null"> AND request_user_community in (select com_act.community_id from com_act where street_id=#{dto.id}) </if> </if> <if test="dto.type == 4"> AND type=3 <if test="dto.id != null"> AND request_user_community=#{dto.id} </if> </if>) as expert FROM com_sanshuo_event_info limit 1 </select> <select id="dateAnalysisY" resultType="java.lang.Integer"> SELECT COUNT(id) FROM com_sanshuo_event_info WHERE create_time BETWEEN DATE_FORMAT(#{beginDate}, '%Y-%m-%d 00:00:00') AND DATE_FORMAT(#{endDate}, '%Y-%m-%d 23:59:59') </select> <select id="dateAnalysisYTwo" resultType="java.lang.Integer"> SELECT COUNT(id) FROM com_sanshuo_event_info WHERE create_time BETWEEN DATE_FORMAT(#{beginDate}, '%Y-%m-%d 00:00:00') AND DATE_FORMAT(#{endDate}, '%Y-%m-%d 23:59:59') AND event_process_status=6 </select> </mapper>