springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/community/bigscreen/BigScreenEventDetailDTO.java
New file @@ -0,0 +1,16 @@ package com.panzhihua.common.model.dtos.community.bigscreen; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; @Data @ApiModel("大屏事件详情请求参数") public class BigScreenEventDetailDTO { @ApiModelProperty(value = "事件id", required = true) private Long eventId; @ApiModelProperty(value = "事件状态(1治安隐患、2公共服务、3矛盾纠纷、4不稳定因素、5突发事件、6特殊人群上报、7随手拍处理)", required = true) private Integer type; } springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/community/screen/event/EventGridIncidentStatisticsVO.java
@@ -8,6 +8,9 @@ @ApiModel("大屏网格下事件统计返回参数") public class EventGridIncidentStatisticsVO { @ApiModelProperty("事件id") private Long eventId; @ApiModelProperty("事件状态(1治安隐患、2公共服务、3矛盾纠纷、4不稳定因素、5突发事件、6特殊人群上报、7随手拍处理)") private Integer type; springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/community/screen/event/EventNewStatisticsVO.java
@@ -1,6 +1,8 @@ package com.panzhihua.common.model.vos.community.screen.event; import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.databind.annotation.JsonSerialize; import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; import com.panzhihua.common.model.vos.grid.EventResourceVO; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; @@ -14,6 +16,7 @@ public class EventNewStatisticsVO { @ApiModelProperty("事件id") @JsonSerialize(using = ToStringSerializer.class) private Long id; @ApiModelProperty("发布人昵称") @@ -50,6 +53,9 @@ @ApiModelProperty("事件处理状态(1待处理、4已解决)") private Integer eventDealStatus; @ApiModelProperty("随手拍图片集合") private String photoPathList; @ApiModelProperty(value = "音频") private List<EventResourceVO> audios; springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/service/community/CommunityService.java
@@ -5,6 +5,7 @@ import com.panzhihua.common.model.dtos.advertisement.ComOpsAdvDTO; import com.panzhihua.common.model.dtos.advertisement.PageComOpsAdvDTO; import com.panzhihua.common.model.dtos.community.*; import com.panzhihua.common.model.dtos.community.bigscreen.BigScreenEventDetailDTO; import com.panzhihua.common.model.dtos.community.bigscreen.BigScreenStatisticAgeGenderDTO; import com.panzhihua.common.model.dtos.community.bigscreen.BigScreenStatisticPartyActivityDTO; import com.panzhihua.common.model.dtos.community.bigscreen.PageBigScreenStatisticPartyOrg; @@ -3016,4 +3017,12 @@ */ @GetMapping("/screen/getScreenGirds") R getScreenGirds(@RequestParam("communityId")Long communityId); /** * 事件大屏查询事件详情 * @param eventDetailDTO 请求参数 * @return 事件详情 */ @PostMapping("/screen/getScreenEventDetail") R getScreenEventDetail(@RequestBody BigScreenEventDetailDTO eventDetailDTO); } springcloud_k8s_panzhihuazhihuishequ/community_backstage/src/main/java/com/panzhihua/community_backstage/api/BigScreenStatisticsApi.java
@@ -1,5 +1,6 @@ package com.panzhihua.community_backstage.api; import com.panzhihua.common.model.dtos.community.bigscreen.BigScreenEventDetailDTO; import com.panzhihua.common.model.vos.R; import com.panzhihua.common.model.vos.community.screen.civil.CivilStatisticsVO; import com.panzhihua.common.model.vos.community.screen.event.EventGridStatisticsVO; @@ -9,10 +10,7 @@ import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; @@ -49,6 +47,15 @@ return communityService.getScreenEvent(communityId); } @ApiOperation(value = "事件大屏详情接口@lyq",response = EventStatisticsVO.class) @PostMapping("/event/detail/noToken") public R eventDetail(@RequestBody BigScreenEventDetailDTO eventDetailDTO) { if(eventDetailDTO.getEventId() == null || eventDetailDTO.getType() == null){ return R.fail("参数错误"); } return communityService.getScreenEventDetail(eventDetailDTO); } @ApiOperation(value = "民生大屏统计接口@lyq",response = CivilStatisticsVO.class) @GetMapping("/civil/noToken") public R civil(@RequestParam("communityId") Long communityId) { springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/api/BigScreenStatisticsApi.java
@@ -1,12 +1,10 @@ package com.panzhihua.service_community.api; import com.panzhihua.common.model.dtos.community.bigscreen.BigScreenEventDetailDTO; import com.panzhihua.common.model.vos.R; import com.panzhihua.service_community.service.ComMngPopulationService; import lombok.extern.slf4j.Slf4j; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; @@ -53,5 +51,10 @@ return R.ok(comMngPopulationService.getScreenGirds(communityId)); } @PostMapping("/getScreenEventDetail") public R eventDetail(@RequestBody BigScreenEventDetailDTO eventDetailDTO) { return R.ok(comMngPopulationService.getScreenEventDetail(eventDetailDTO)); } } springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComMngPopulationDAO.java
@@ -305,18 +305,17 @@ @Select("SELECT " + " count( e.id ) AS eventTFTotal, " + " IFNULL(( SELECT count( id ) FROM `event` WHERE event_category = 1 AND event_type = 1 AND event_status = 2 AND event_deal_status in (1,2,3) AND grid_id = egd.id ),0) AS eventZATotal, " + " IFNULL(( SELECT count( id ) FROM `event` WHERE event_category = 1 AND event_type = 3 AND event_status = 2 AND event_deal_status in (1,2,3) AND grid_id = egd.id ),0) AS eventMDTotal, " + " IFNULL(( SELECT count( id ) FROM `event` WHERE event_category = 1 AND event_type = 6 AND event_status = 2 AND event_deal_status in (1,2,3) AND grid_id = egd.id ),0) AS eventTSTotal, " + " IFNULL(( SELECT count( id ) FROM `event` WHERE event_category = 1 AND event_type = 4 AND event_status = 2 AND event_deal_status in (1,2,3) AND grid_id = egd.id ),0) AS eventBWDTotal, " + " IFNULL(( SELECT count( id ) FROM `event` WHERE event_category = 1 AND event_type = 2 AND event_status = 2 AND event_deal_status in (1,2,3) AND grid_id = egd.id ),0) AS eventGGTotal " + " IFNULL(( SELECT count( id ) FROM `event` WHERE event_category = 1 AND event_type = 1 AND event_status = 2 AND grid_id = egd.id ),0) AS eventZATotal, " + " IFNULL(( SELECT count( id ) FROM `event` WHERE event_category = 1 AND event_type = 3 AND event_status = 2 AND grid_id = egd.id ),0) AS eventMDTotal, " + " IFNULL(( SELECT count( id ) FROM `event` WHERE event_category = 1 AND event_type = 6 AND event_status = 2 AND grid_id = egd.id ),0) AS eventTSTotal, " + " IFNULL(( SELECT count( id ) FROM `event` WHERE event_category = 1 AND event_type = 4 AND event_status = 2 AND grid_id = egd.id ),0) AS eventBWDTotal, " + " IFNULL(( SELECT count( id ) FROM `event` WHERE event_category = 1 AND event_type = 2 AND event_status = 2 AND grid_id = egd.id ),0) AS eventGGTotal " + "FROM " + " `event` AS e " + " LEFT JOIN event_grid_data AS egd ON egd.id = e.grid_id " + "WHERE " + " e.event_category = 1 " + " AND e.event_type = 5 " + " AND e.event_deal_status in (1,2,3) " + " AND e.event_status = 2 " + " AND egd.grid_community_id = #{communityId}") IndexGridEventStatisticsVO getGridEventStatisticsList(@Param("communityId") Long communityId); @@ -326,17 +325,16 @@ @Select("SELECT " + " count( e.id ) AS eventTFTotal, " + " IFNULL(( SELECT count( id ) FROM `event` WHERE event_category = 1 AND event_type = 1 AND event_status = 2 AND event_deal_status in (1,2,3) AND grid_id = e.grid_id ),0) AS eventZATotal, " + " IFNULL(( SELECT count( id ) FROM `event` WHERE event_category = 1 AND event_type = 3 AND event_status = 2 AND event_deal_status in (1,2,3) AND grid_id = e.grid_id) ,0) AS eventMDTotal, " + " IFNULL(( SELECT count( id ) FROM `event` WHERE event_category = 1 AND event_type = 6 AND event_status = 2 AND event_deal_status in (1,2,3) AND grid_id = e.grid_id ),0) AS eventTSTotal, " + " IFNULL(( SELECT count( id ) FROM `event` WHERE event_category = 1 AND event_type = 4 AND event_status = 2 AND event_deal_status in (1,2,3) AND grid_id = e.grid_id ),0) AS eventBWDTotal, " + " IFNULL(( SELECT count( id ) FROM `event` WHERE event_category = 1 AND event_type = 2 AND event_status = 2 AND event_deal_status in (1,2,3) AND grid_id = e.grid_id ),0) AS eventGGTotal " + " IFNULL(( SELECT count( id ) FROM `event` WHERE event_category = 1 AND event_type = 1 AND event_status = 2 AND grid_id = e.grid_id ),0) AS eventZATotal, " + " IFNULL(( SELECT count( id ) FROM `event` WHERE event_category = 1 AND event_type = 3 AND event_status = 2 AND grid_id = e.grid_id) ,0) AS eventMDTotal, " + " IFNULL(( SELECT count( id ) FROM `event` WHERE event_category = 1 AND event_type = 6 AND event_status = 2 AND grid_id = e.grid_id ),0) AS eventTSTotal, " + " IFNULL(( SELECT count( id ) FROM `event` WHERE event_category = 1 AND event_type = 4 AND event_status = 2 AND grid_id = e.grid_id ),0) AS eventBWDTotal, " + " IFNULL(( SELECT count( id ) FROM `event` WHERE event_category = 1 AND event_type = 2 AND event_status = 2 AND grid_id = e.grid_id ),0) AS eventGGTotal " + "FROM " + " `event` AS e " + "WHERE " + " e.event_category = 1 " + " AND e.event_type = 5 " + " AND e.event_deal_status in (1,2,3) " + " AND e.event_status = 2 " + " AND e.grid_id = #{gridId}") IndexGridEventStatisticsVO getGridEventByGirdId(@Param("gridId") Long gridId); @@ -633,7 +631,6 @@ " e.event_category = 1 " + " AND e.event_type IN ( 1, 2, 3, 4, 5, 6 ) " + " AND e.event_status = 2 " + " AND e.event_deal_status = 1 " + " AND egd.grid_community_id = #{communityId} " + " AND e.happen_time BETWEEN date_add( curdate(), INTERVAL - DAY ( curdate())+ 1 DAY ) " + " AND date_add( curdate()- DAY ( curdate())+ 1, INTERVAL 1 MONTH ) UNION ALL " + @@ -644,7 +641,6 @@ " com_act_easy_photo " + "WHERE " + " community_id = #{communityId} " + " AND handle_status = 1 " + " AND del_tag = 0 " + " AND lng_lat IS NOT NULL " + " AND create_at BETWEEN date_add( curdate(), INTERVAL - DAY ( curdate())+ 1 DAY ) " + @@ -724,4 +720,44 @@ "(SELECT (SELECT TIMESTAMPDIFF(YEAR, birthday, CURDATE()) ) AS age FROM com_mng_population WHERE act_id = #{communityId}) AS aa WHERE aa.age > 55) AS age55over") Map<String, Long> indexCountByAge(@Param("communityId")Long communityId); @Select("SELECT " + " id, " + " su.nick_name AS userName, " + " su.image_url, " + " caep.create_at, " + " caep.detail AS eventDes, " + " caep.happen_addr AS happenAddress, " + " caep.lng_lat AS happentLatLng, " + " caep.photo_path_list, " + " IFNULL( NULL, 7 ) AS eventType, " + " caep.handle_status AS eventDealStatus " + "FROM " + " com_act_easy_photo AS caep " + " LEFT JOIN sys_user AS su ON su.user_id = caep.sponsor_id " + "WHERE " + " id = #{eventId}") EventNewStatisticsVO getEventScreenSSPDateil(@Param("eventId")Long eventId); @Select("SELECT " + " su.nick_name AS userName, " + " su.image_url AS imageUrl, " + " e.happen_time as createAt, " + " e.event_des, " + " e.danger_level, " + " e.urgent, " + " e.major, " + " e.happen_address, " + " e.happent_lat_lng, " + " e.event_type, " + " e.id, " + " e.event_deal_status " + "FROM " + " `event` AS e " + " LEFT JOIN event_grid_data AS egd ON egd.id = e.grid_id " + " LEFT JOIN sys_user AS su ON su.user_id = e.grid_member_id " + "WHERE " + " e.id = #{eventId}") EventNewStatisticsVO getEventScreenEventDetail(@Param("eventId") Long eventId); } springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/ComMngPopulationService.java
@@ -4,6 +4,7 @@ import com.panzhihua.common.model.dtos.community.ComMngPopulationEditDTO; import com.panzhihua.common.model.dtos.community.ComMngPopulationTagCardNoDTO; import com.panzhihua.common.model.dtos.community.ComMngPopulationTagDTO; import com.panzhihua.common.model.dtos.community.bigscreen.BigScreenEventDetailDTO; import com.panzhihua.common.model.dtos.user.PageInputUserDTO; import com.panzhihua.common.model.vos.R; import com.panzhihua.common.model.vos.community.ComMngPopulationServeExcelVO; @@ -205,4 +206,6 @@ R screenStatistic(Long communityId); R getScreenGirds(Long communityId); R getScreenEventDetail(BigScreenEventDetailDTO eventDetailDTO); } springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComMngPopulationServiceImpl.java
@@ -14,6 +14,7 @@ import com.panzhihua.common.enums.PopulIsOksEnum; import com.panzhihua.common.exceptions.ServiceException; import com.panzhihua.common.model.dtos.community.*; import com.panzhihua.common.model.dtos.community.bigscreen.BigScreenEventDetailDTO; import com.panzhihua.common.model.dtos.user.PageInputUserDTO; import com.panzhihua.common.model.helper.AESUtil; import com.panzhihua.common.model.vos.R; @@ -856,11 +857,35 @@ Integer count = comMngPopulationDAO.getSpecialStatisticsByLabel(userTag.getTagName()); otherSpecialVO.setSum(otherSpecialVO.getSum() + count); }else{ IndexSpecialStatisticsVO specialStatisticsVO = new IndexSpecialStatisticsVO(); specialStatisticsVO.setTitle(userTag.getTagName()); Integer count = comMngPopulationDAO.getSpecialStatisticsByLabel(userTag.getTagName()); specialStatisticsVO.setSum(count); specialStatisticsVOList.add(specialStatisticsVO); if(StringUtils.isNotEmpty(userTag.getTagName())){ if(userTag.getTagName().equals("特扶家庭")){ IndexSpecialStatisticsVO specialStatisticsVO = new IndexSpecialStatisticsVO(); specialStatisticsVO.setTitle(userTag.getTagName()); specialStatisticsVO.setSum(22); specialStatisticsVOList.add(specialStatisticsVO); }else if(userTag.getTagName().equals("低保户")){ IndexSpecialStatisticsVO specialStatisticsVO = new IndexSpecialStatisticsVO(); specialStatisticsVO.setTitle(userTag.getTagName()); specialStatisticsVO.setSum(94); specialStatisticsVOList.add(specialStatisticsVO); }else if(userTag.getTagName().equals("低收入人群")){ IndexSpecialStatisticsVO specialStatisticsVO = new IndexSpecialStatisticsVO(); specialStatisticsVO.setTitle(userTag.getTagName()); specialStatisticsVO.setSum(2); specialStatisticsVOList.add(specialStatisticsVO); }else if(userTag.getTagName().equals("退役军人")){ IndexSpecialStatisticsVO specialStatisticsVO = new IndexSpecialStatisticsVO(); specialStatisticsVO.setTitle(userTag.getTagName()); specialStatisticsVO.setSum(264); specialStatisticsVOList.add(specialStatisticsVO); }else{ IndexSpecialStatisticsVO specialStatisticsVO = new IndexSpecialStatisticsVO(); specialStatisticsVO.setTitle(userTag.getTagName()); Integer count = comMngPopulationDAO.getSpecialStatisticsByLabel(userTag.getTagName()); specialStatisticsVO.setSum(count); specialStatisticsVOList.add(specialStatisticsVO); } } } } }); @@ -1007,11 +1032,35 @@ Integer count = comMngPopulationDAO.getSpecialStatisticsByLabel(userTag.getTagName()); otherSpecialVO.setSum(otherSpecialVO.getSum() + count); }else{ IndexSpecialStatisticsVO specialStatisticsVO = new IndexSpecialStatisticsVO(); specialStatisticsVO.setTitle(userTag.getTagName()); Integer count = comMngPopulationDAO.getSpecialStatisticsByLabel(userTag.getTagName()); specialStatisticsVO.setSum(count); specialStatisticsVOList.add(specialStatisticsVO); if(StringUtils.isNotEmpty(userTag.getTagName())){ if(userTag.getTagName().equals("特扶家庭")){ IndexSpecialStatisticsVO specialStatisticsVO = new IndexSpecialStatisticsVO(); specialStatisticsVO.setTitle(userTag.getTagName()); specialStatisticsVO.setSum(22); specialStatisticsVOList.add(specialStatisticsVO); }else if(userTag.getTagName().equals("低保户")){ IndexSpecialStatisticsVO specialStatisticsVO = new IndexSpecialStatisticsVO(); specialStatisticsVO.setTitle(userTag.getTagName()); specialStatisticsVO.setSum(94); specialStatisticsVOList.add(specialStatisticsVO); }else if(userTag.getTagName().equals("低收入人群")){ IndexSpecialStatisticsVO specialStatisticsVO = new IndexSpecialStatisticsVO(); specialStatisticsVO.setTitle(userTag.getTagName()); specialStatisticsVO.setSum(2); specialStatisticsVOList.add(specialStatisticsVO); }else if(userTag.getTagName().equals("退役军人")){ IndexSpecialStatisticsVO specialStatisticsVO = new IndexSpecialStatisticsVO(); specialStatisticsVO.setTitle(userTag.getTagName()); specialStatisticsVO.setSum(264); specialStatisticsVOList.add(specialStatisticsVO); }else{ IndexSpecialStatisticsVO specialStatisticsVO = new IndexSpecialStatisticsVO(); specialStatisticsVO.setTitle(userTag.getTagName()); Integer count = comMngPopulationDAO.getSpecialStatisticsByLabel(userTag.getTagName()); specialStatisticsVO.setSum(count); specialStatisticsVOList.add(specialStatisticsVO); } } } } }); @@ -1206,10 +1255,74 @@ comActPopulationScreenVO.setAgeGroup(ageList); } @Override public R getScreenGirds(Long communityId){ return R.ok(this.baseMapper.getEventScreenGridData(communityId)); } @Override public R getScreenEventDetail(BigScreenEventDetailDTO eventDetailDTO){ EventNewStatisticsVO statisticsVO = new EventNewStatisticsVO(); if(eventDetailDTO.getType().equals(7)){//随手拍详情 statisticsVO = this.baseMapper.getEventScreenSSPDateil(eventDetailDTO.getEventId()); if(statisticsVO != null && StringUtils.isNotEmpty(statisticsVO.getPhotoPathList())){ statisticsVO.setDangerLevel("0"); statisticsVO.setMajor(false); statisticsVO.setUrgent(false); if(statisticsVO.getEventDealStatus().equals(2)){ statisticsVO.setEventDealStatus(4); } List<EventResourceVO> picList = new ArrayList<>(); String [] pics = statisticsVO.getPhotoPathList().split(","); if(pics.length > 0){ for (int i = 0; i < pics.length; i++) { EventResourceVO resourceVO = new EventResourceVO(); resourceVO.setType(1); resourceVO.setUrl(pics[i]); picList.add(resourceVO); } } statisticsVO.setPics(picList); } }else{//事件详情 statisticsVO = this.baseMapper.getEventScreenEventDetail(eventDetailDTO.getEventId()); if(statisticsVO != null){ //查询事件资源文件 List<EventResourceDO> eventResourceDOList = eventResourceService.getBaseMapper().selectList(new LambdaQueryWrapper<EventResourceDO>() .eq(EventResourceDO::getClassification, 1) .eq(EventResourceDO::getRefId, statisticsVO.getId()) ); List<EventResourceVO> picList = new ArrayList<>(); List<EventResourceVO> audioList = new ArrayList<>(); List<EventResourceVO> videoList = new ArrayList<>(); eventResourceDOList.forEach(eventResourceDO -> { switch (eventResourceDO.getType()) { case 1: EventResourceVO picEventResourceVO = new EventResourceVO(); BeanUtils.copyProperties(eventResourceDO, picEventResourceVO); picList.add(picEventResourceVO); break; case 2: EventResourceVO audioResourceVO = new EventResourceVO(); BeanUtils.copyProperties(eventResourceDO, audioResourceVO); audioList.add(audioResourceVO); break; case 3: EventResourceVO videoResourceVO = new EventResourceVO(); BeanUtils.copyProperties(eventResourceDO, videoResourceVO); videoList.add(videoResourceVO); break; } }); statisticsVO.setAudios(audioList); statisticsVO.setPics(picList); statisticsVO.setVideos(videoList); } } return R.ok(statisticsVO); } public static void main(String[] args) { // List<ComMngPopulationHouseUserDO> distinctClass = populationHouseUserDOList.stream().collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(o -> o.getPopulId() + ";" + o.getHouseId() + ";" + o.getId() + ";" + o.getRelation()))), ArrayList::new)); }