| | |
| | | |
| | | @ApiModelProperty(value = "事件状态(1治安隐患、2公共服务、3矛盾纠纷、4不稳定因素、5突发事件、6特殊人群上报、7随手拍处理)", required = true) |
| | | private Integer type; |
| | | |
| | | @ApiModelProperty("事件类型(1、网格事件 2、随手拍事件)") |
| | | private Integer eventType; |
| | | } |
New file |
| | |
| | | package com.panzhihua.common.model.vos.community; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @title: StatisticsCommVO |
| | | * @projectName: 成都呐喊信息技术有限公司-智慧社区项目 |
| | | * @description: |
| | | * @author: hans |
| | | * @date: 2021/12/06 10:51 |
| | | */ |
| | | @Data |
| | | @ApiModel("统计通用信息") |
| | | public class StatisticsCommVO { |
| | | |
| | | @ApiModelProperty(value = "统计日期") |
| | | private String statisticsDate; |
| | | |
| | | @ApiModelProperty(value = "统计项") |
| | | private String filed; |
| | | |
| | | @ApiModelProperty(value = "数量") |
| | | private Integer num; |
| | | |
| | | @ApiModelProperty("统计项占比") |
| | | private BigDecimal percent; |
| | | |
| | | @ApiModelProperty("统计数据列表") |
| | | private List<StatisticsCommVO> statisticsCommVOS; |
| | | } |
New file |
| | |
| | | package com.panzhihua.common.model.vos.community.bigscreen; |
| | | |
| | | import java.util.List; |
| | | |
| | | import com.panzhihua.common.model.vos.community.convenient.ConvenientMerchantVO; |
| | | import com.panzhihua.common.model.vos.community.screen.civil.CivilVillageStatisticsVO; |
| | | import com.panzhihua.common.model.vos.community.screen.event.EventGridStatisticsVO; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @title: BigScreenCommunityStatisticsVO |
| | | * @projectName: 成都呐喊信息技术有限公司-智慧社区项目 |
| | | * @description: 大屏社区服务统计信息 |
| | | * @author: hans |
| | | * @date: 2021/12/10 13:16 |
| | | */ |
| | | @Data |
| | | @ApiModel("大屏社区服务统计信息") |
| | | public class BigScreenCommunityStatisticsVO { |
| | | |
| | | @ApiModelProperty("大屏网格数据") |
| | | private List<EventGridStatisticsVO> gridStatisticsList; |
| | | |
| | | @ApiModelProperty("小区列表数据") |
| | | private List<CivilVillageStatisticsVO> villageStatisticsList; |
| | | |
| | | @ApiModelProperty("商家地图点位数据") |
| | | private List<ConvenientMerchantVO> merchantMapDataList; |
| | | } |
New file |
| | |
| | | package com.panzhihua.common.model.vos.community.bigscreen; |
| | | |
| | | import com.panzhihua.common.model.vos.community.StatisticsCommVO; |
| | | import com.panzhihua.common.model.vos.community.screen.civil.CivilVillageStatisticsVO; |
| | | import com.panzhihua.common.model.vos.community.screen.event.EventGridIncidentStatisticsVO; |
| | | import com.panzhihua.common.model.vos.community.screen.event.EventGridStatisticsVO; |
| | | import com.panzhihua.common.model.vos.screen.ScreenDrawEventPopulationTotalVO; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @title: GridsGovernanceStatisticsVO |
| | | * @projectName: 成都呐喊信息技术有限公司-智慧社区项目 |
| | | * @description: 清网治格统计信息 |
| | | * @author: hans |
| | | * @date: 2021/12/08 14:38 |
| | | */ |
| | | @Data |
| | | @ApiModel("清网治格统计信息") |
| | | public class GridsGovernanceStatisticsVO { |
| | | |
| | | @ApiModelProperty("事件总数") |
| | | private Integer eventTotal = 0; |
| | | |
| | | @ApiModelProperty("已处理事件总数") |
| | | private Integer dealTotal = 0; |
| | | |
| | | @ApiModelProperty("待处理事件总数") |
| | | private Integer unDealTotal = 0; |
| | | |
| | | @ApiModelProperty("突发事件报告总数") |
| | | private Integer eventTFTotal = 0; |
| | | |
| | | @ApiModelProperty("治安防控事件总数") |
| | | private Integer eventZATotal = 0; |
| | | |
| | | @ApiModelProperty("矛盾劝解事件总数") |
| | | private Integer eventMDTotal = 0; |
| | | |
| | | @ApiModelProperty("特殊人群服务事件总数") |
| | | private Integer eventTSTotal = 0; |
| | | |
| | | @ApiModelProperty("民生服务事件总数") |
| | | private Integer eventMSTotal = 0; |
| | | |
| | | @ApiModelProperty("防灾减灾事件总数") |
| | | private Integer eventFJTotal = 0; |
| | | |
| | | @ApiModelProperty("其他事件总数") |
| | | private Integer otherTotal = 0; |
| | | |
| | | @ApiModelProperty("突发事件报告完成数") |
| | | private Integer eventTFDeal = 0; |
| | | |
| | | @ApiModelProperty("治安防控事件完成数") |
| | | private Integer eventZADeal = 0; |
| | | |
| | | @ApiModelProperty("矛盾劝解事件完成数") |
| | | private Integer eventMDDeal = 0; |
| | | |
| | | @ApiModelProperty("特殊人群服务事件完成数") |
| | | private Integer eventTSDeal = 0; |
| | | |
| | | @ApiModelProperty("民生服务事件完成数") |
| | | private Integer eventMSDeal = 0; |
| | | |
| | | @ApiModelProperty("防灾减灾事件完成数") |
| | | private Integer eventFJDeal = 0; |
| | | |
| | | @ApiModelProperty("其他事件完成数") |
| | | private Integer otherDeal = 0; |
| | | |
| | | @ApiModelProperty("网格数") |
| | | private Integer gridTotal = 0; |
| | | |
| | | @ApiModelProperty("调解员") |
| | | private Integer gridMemberTotal = 0; |
| | | |
| | | @ApiModelProperty("大屏网格数据") |
| | | private List<EventGridStatisticsVO> gridStatisticsList; |
| | | |
| | | @ApiModelProperty("小区列表数据") |
| | | private List<CivilVillageStatisticsVO> villageStatisticsList; |
| | | |
| | | @ApiModelProperty("社区事件数据") |
| | | private List<EventGridIncidentStatisticsVO> gridIncidentList; |
| | | |
| | | @ApiModelProperty("人口统计") |
| | | private ScreenDrawEventPopulationTotalVO drawEventPopulationTotalVO; |
| | | |
| | | @ApiModelProperty("年龄段统计") |
| | | private List<StatisticsCommVO> ageGroupStatistics; |
| | | |
| | | @ApiModelProperty("事件分析新增折线数据") |
| | | private List<StatisticsCommVO> eventAddPolylineData; |
| | | |
| | | @ApiModelProperty("事件分析累计折线数据") |
| | | private List<StatisticsCommVO> eventTotalPolylineData; |
| | | |
| | | public void generateStatisticsData() { |
| | | this.eventTotal = this.eventTFTotal + this.eventZATotal + this.eventMDTotal + |
| | | this.eventTSTotal + this.eventMSTotal + this.eventFJTotal + this.otherTotal; |
| | | this.dealTotal = this.eventTFDeal + this.eventZADeal + this.eventMDDeal + |
| | | this.eventTSDeal + this.eventMSDeal + this.eventFJDeal + this.otherDeal; |
| | | this.unDealTotal = this.eventTotal - this.dealTotal; |
| | | } |
| | | } |
New file |
| | |
| | | package com.panzhihua.common.model.vos.community.bigscreen; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | |
| | | import com.panzhihua.common.model.vos.community.StatisticsCommVO; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @title: ResidentAutonomyStatisticsVO |
| | | * @projectName: 成都呐喊信息技术有限公司-智慧社区项目 |
| | | * @description: 居民自治统计信息 |
| | | * @author: hans |
| | | * @date: 2021/12/06 14:27 |
| | | */ |
| | | @Data |
| | | @ApiModel("居民自治统计信息") |
| | | public class ResidentAutonomyStatisticsVO { |
| | | |
| | | @ApiModelProperty(value = "随手拍本月总数") |
| | | private Integer easyPhotoCurrentMonCount; |
| | | |
| | | @ApiModelProperty(value = "随手拍总数") |
| | | private Integer easyPhotoTotalCount; |
| | | |
| | | @ApiModelProperty(value = "随手拍分类柱状统计") |
| | | private List<StatisticsCommVO> easyPhotoHistogram; |
| | | |
| | | @ApiModelProperty(value = "微心愿本月总数") |
| | | private Integer microWishCurrentMonCount; |
| | | |
| | | @ApiModelProperty(value = "集心池") |
| | | private Integer aimNum; |
| | | |
| | | @ApiModelProperty(value = "微心愿总数") |
| | | private Integer microWishTotal; |
| | | |
| | | @ApiModelProperty(value = "微心愿待实现&已实现数目及占比") |
| | | private List<StatisticsCommVO> microWishRealizePercent; |
| | | |
| | | @ApiModelProperty(value = "微心愿图片") |
| | | private List<String> microWishImages; |
| | | |
| | | @ApiModelProperty(value = "业主委员会本月总数") |
| | | private Integer committeeCurrentMonCount; |
| | | |
| | | @ApiModelProperty(value = "业主委员会总数") |
| | | private Integer committeeTotal; |
| | | |
| | | @ApiModelProperty(value = "业主委员会小区覆盖率") |
| | | private BigDecimal areaCoverPercent; |
| | | |
| | | @ApiModelProperty(value = "议事投票本月总数") |
| | | private Integer discussCurrentMonCount; |
| | | |
| | | @ApiModelProperty(value = "议事投票总数") |
| | | private Integer discussTotal; |
| | | |
| | | @ApiModelProperty(value = "议事参与人总数") |
| | | private Integer discussCount; |
| | | |
| | | @ApiModelProperty(value = "投票参与人总数") |
| | | private Integer voteCount; |
| | | |
| | | @ApiModelProperty(value = "议事标题") |
| | | private List<String> discussTitles; |
| | | |
| | | @ApiModelProperty(value = "投票标题") |
| | | private List<String> voteTitles; |
| | | |
| | | @ApiModelProperty(value = "议事投票类型占比") |
| | | private List<StatisticsCommVO> discussTypePercent; |
| | | |
| | | @ApiModelProperty(value = "邻里圈本月总数") |
| | | private Integer neighborCurrentMonCount; |
| | | |
| | | @ApiModelProperty(value = "邻里圈总数") |
| | | private Integer neighborTotal; |
| | | |
| | | @ApiModelProperty(value = "邻里圈点赞量") |
| | | private Integer neighborFabulousNum; |
| | | |
| | | @ApiModelProperty(value = "邻里圈分享量") |
| | | private Integer neighborForwardNum; |
| | | |
| | | @ApiModelProperty(value = "邻里圈评论量") |
| | | private Integer neighborCommentNum; |
| | | |
| | | @ApiModelProperty(value = "邻里圈图片") |
| | | private List<String> neighborImages; |
| | | |
| | | @ApiModelProperty(value = "邻里圈文本内容") |
| | | private List<String> neighborContents; |
| | | |
| | | @ApiModelProperty(value = "报事报修本月总数") |
| | | private Integer repairCurrentMonCount; |
| | | |
| | | @ApiModelProperty(value = "报事报修总数") |
| | | private Integer repairTotal; |
| | | |
| | | @ApiModelProperty(value = "报事报修新增折线数据") |
| | | private List<StatisticsCommVO> repairAddPolylineData; |
| | | |
| | | @ApiModelProperty(value = "报事报修累计折线数据") |
| | | private List<StatisticsCommVO> repairTotalPolylineData; |
| | | |
| | | @ApiModelProperty(value = "爱心义仓本月总数") |
| | | private Integer warehouseCurrentMonCount; |
| | | |
| | | @ApiModelProperty(value = "爱心义仓总捐赠数") |
| | | private Integer warehouseTotal; |
| | | |
| | | @ApiModelProperty(value = "爱心义仓剩余物品数") |
| | | private Integer warehouseSurplusTotal; |
| | | |
| | | @ApiModelProperty(value = "爱心义仓已领取物品数") |
| | | private Integer warehouseApplyTotal; |
| | | |
| | | @ApiModelProperty(value = "爱心义仓捐赠记录") |
| | | private List<String> warehouseDonateRecords; |
| | | |
| | | @ApiModelProperty(value = "爱心义仓爱心传递") |
| | | private List<String> warehouseLoveTransfer; |
| | | |
| | | @ApiModelProperty(value = "爱心义仓捐赠物品图片") |
| | | private List<String> warehouseImages; |
| | | } |
| | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | |
| | | @Data |
| | | @ApiModel("大屏网格下事件统计返回参数") |
| | | public class EventGridIncidentStatisticsVO { |
| | |
| | | @JsonSerialize(using = ToStringSerializer.class) |
| | | private Long eventId; |
| | | |
| | | @ApiModelProperty("事件状态(1治安隐患、2公共服务、3矛盾纠纷、4不稳定因素、5突发事件、6特殊人群上报、7随手拍处理)") |
| | | // 旧版参照@ApiModelProperty("事件状态(1治安隐患、2公共服务、3矛盾纠纷、4不稳定因素、5突发事件、6特殊人群上报、7随手拍处理)") |
| | | /** |
| | | * type不代表网格类型 |
| | | */ |
| | | @ApiModelProperty("事件状态(1治安防控、2民生服务、3矛盾劝解、4不稳定因素、5突发事件报告、6特殊人群服务、9防灾减灾、10其他)") |
| | | private Integer type; |
| | | |
| | | @ApiModelProperty("事件类型(1、网格事件 2、随手拍事件)") |
| | | private Integer eventType; |
| | | |
| | | @ApiModelProperty("事件发生经纬度") |
| | | private String latLng; |
| | | |
| | | @ApiModelProperty("处理状态") |
| | | @ApiModelProperty("事件内容") |
| | | private String content; |
| | | |
| | | @ApiModelProperty("事件封面") |
| | | private String cover; |
| | | |
| | | @ApiModelProperty("处理状态(1.已处理 2.待处理)") |
| | | private Integer status; |
| | | |
| | | @ApiModelProperty("事件创建时间") |
| | | private Date createAt; |
| | | |
| | | } |
| | |
| | | @ApiModelProperty(value = "社区id") |
| | | @JsonSerialize(using = ToStringSerializer.class) |
| | | private Long communityId; |
| | | |
| | | @ApiModelProperty(value = "社区名称") |
| | | private String name; |
| | | @ApiModelProperty("经度") |
| | | |
| | | @ApiModelProperty(value = "经度") |
| | | private String lng; |
| | | @ApiModelProperty("纬度") |
| | | |
| | | @ApiModelProperty(value = "维度") |
| | | private String lat; |
| | | } |
| | |
| | | @ApiModelProperty("网格员") |
| | | private Integer WGYTotal = 6; |
| | | |
| | | @ApiModelProperty("总户数") |
| | | private Integer houseTotal = 0; |
| | | |
| | | @ApiModelProperty("残疾人") |
| | | private Integer disabilityTotal = 0; |
| | | |
| | | @ApiModelProperty("低保户") |
| | | private Integer lowSecurityTotal = 0; |
| | | |
| | | @ApiModelProperty("高龄老人") |
| | | private Integer elderTotal = 0; |
| | | |
| | | @ApiModelProperty("特殊情况") |
| | | private Integer specialSituationTotal = 0; |
| | | |
| | | @ApiModelProperty("其他") |
| | | private Integer otherTotal = 0; |
| | | |
| | | @ApiModelProperty("特扶家庭") |
| | | private Integer specialHelpTotal = 0; |
| | | |
| | | @ApiModelProperty("退役军人") |
| | | private Integer veteransTotal = 0; |
| | | |
| | | @ApiModelProperty("老年人") |
| | | private Integer oldTotal = 0; |
| | | |
| | | @ApiModelProperty("养老人员") |
| | | private Integer pensionTotal = 0; |
| | | |
| | | @ApiModelProperty("出租房源") |
| | | private Integer rentingHouseTotal = 0; |
| | | |
| | | @ApiModelProperty("社会工作者") |
| | | private Integer socialWorkerTotal = 0; |
| | | |
| | | @ApiModelProperty("志愿者") |
| | | private Integer volunteerTotal = 0; |
| | | |
| | | @ApiModelProperty("平均年龄") |
| | | private Integer averageAge = 0; |
| | | |
| | | } |
| | |
| | | */ |
| | | @GetMapping("/screen/serviceUser") |
| | | R serviceUser(@RequestParam("communityId") Long communityId); |
| | | |
| | | /** |
| | | * 大数据分析平台-居民自治 |
| | | * @param communityId |
| | | * @return |
| | | */ |
| | | @GetMapping("/screen/resident/autonomy") |
| | | R getResidentAutonomy(@RequestParam("communityId") Long communityId); |
| | | |
| | | /** |
| | | * 大数据分析平台-清网治格 |
| | | * @param communityId |
| | | * @return |
| | | */ |
| | | @GetMapping("/screen/grids/governance") |
| | | R getGridsGovernance(@RequestParam("communityId") Long communityId); |
| | | |
| | | /** |
| | | * 大数据分析平台-社区服务 |
| | | * @param communityId |
| | | * @return |
| | | */ |
| | | @GetMapping("/screen/community/service") |
| | | R getCommunityServiceStatistics(@RequestParam("communityId") Long communityId); |
| | | |
| | | /** |
| | | * 分页获取热度排行商家 |
| | | * @param pagePopularMerchantDTO |
| | | * @return |
| | | */ |
| | | @PostMapping("/screen/merchant/popular") |
| | | R getScreenPopularMerchants(@RequestBody PagePopularMerchantDTO pagePopularMerchantDTO); |
| | | } |
| | |
| | | R getCivilDrawList(@RequestBody ScreenDrawEventListDTO eventListDTO); |
| | | |
| | | /** |
| | | * 新版绘制多边形统计数据 |
| | | * @param eventListDTO |
| | | * @return |
| | | */ |
| | | @PostMapping("/screen/getCivilDrawListNew") |
| | | R getCivilDrawListNew(@RequestBody ScreenDrawEventListDTO eventListDTO); |
| | | |
| | | /** |
| | | * 大屏-根据小区id查询小区统计人数 |
| | | * |
| | | * @param villageId |
| | |
| | | */ |
| | | @GetMapping("/screen/member/trajectory") |
| | | R getGridsMemberTrajectory(@RequestParam("communityId") Long communityId); |
| | | |
| | | /** |
| | | * 大屏-新根据小区id查询小区统计人数 |
| | | * |
| | | * @param villageId |
| | | * 小区id |
| | | * @return 小区统计数据 |
| | | */ |
| | | @GetMapping("/screen/village/statistics-new") |
| | | R civilVillageStatisticsNew(@RequestParam("villageId") Long villageId); |
| | | } |
| | |
| | | package com.panzhihua.community_backstage.api; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.validation.Valid; |
| | | |
| | | import cn.hutool.http.HttpUtil; |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.panzhihua.common.constants.HttpConstant; |
| | | import com.panzhihua.common.model.dtos.community.convenient.PagePopularMerchantDTO; |
| | | import com.panzhihua.common.model.dtos.property.CommonPage; |
| | | import com.panzhihua.common.model.vos.community.bigscreen.BigScreenServiceData; |
| | | import com.panzhihua.common.model.vos.community.bigscreen.BigScreenServiceUser; |
| | | import com.panzhihua.common.model.vos.community.bigscreen.BigScreenCommunityStatisticsVO; |
| | | import com.panzhihua.common.model.vos.community.bigscreen.GridsGovernanceStatisticsVO; |
| | | import com.panzhihua.common.model.vos.community.bigscreen.ResidentAutonomyStatisticsVO; |
| | | import com.panzhihua.common.model.vos.community.convenient.ConvenientMerchantVO; |
| | | import com.panzhihua.common.utlis.HttpClientUtil; |
| | | import com.panzhihua.common.utlis.HttpUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | |
| | | return this.communityService.serviceUser(this.getCommunityId()); |
| | | } |
| | | |
| | | @ApiOperation(value = "大数据分析平台-居民自治", response = ResidentAutonomyStatisticsVO.class) |
| | | @GetMapping("/resident/autonomy") |
| | | public R getResidentAutonomy() { |
| | | Long communityId = this.getCommunityId(); |
| | | if (communityId == null) { |
| | | return R.fail(401, "请先登录"); |
| | | } |
| | | return communityService.getResidentAutonomy(communityId); |
| | | } |
| | | |
| | | @ApiOperation(value = "大数据分析平台-清网治格", response = GridsGovernanceStatisticsVO.class) |
| | | @GetMapping("/grids/governance") |
| | | public R getGridsGovernance() { |
| | | Long communityId = this.getCommunityId(); |
| | | if (communityId == null) { |
| | | return R.fail(401, "请先登录"); |
| | | } |
| | | return communityService.getGridsGovernance(communityId); |
| | | } |
| | | |
| | | @ApiOperation(value = "新版事件大屏画圈展示事件坐标点接口", response = GridsGovernanceStatisticsVO.class) |
| | | @PostMapping("/civil/draw/list-new") |
| | | public R civilDrawListNew(@RequestBody ScreenDrawEventListDTO eventListDTO) { |
| | | Long id = this.getCommunityId(); |
| | | if (id == null) { |
| | | return R.fail(401, "请先登录"); |
| | | } |
| | | eventListDTO.setCommunityId(id); |
| | | return gridService.getCivilDrawListNew(eventListDTO); |
| | | } |
| | | |
| | | @ApiOperation(value = "新版根据小区id获取小区信息", response = GridsGovernanceStatisticsVO.class) |
| | | @GetMapping("/civil/village/statistics-new") |
| | | public R civilVillageStatisticsNew(@RequestParam("villageId") Long villageId) { |
| | | if (villageId == null) { |
| | | return R.fail("参数错误"); |
| | | } |
| | | return gridService.civilVillageStatisticsNew(villageId); |
| | | } |
| | | |
| | | @ApiOperation(value = "大数据分析平台-社区服务", response = BigScreenCommunityStatisticsVO.class) |
| | | @GetMapping("/community/service") |
| | | public R getCommunityServiceStatistics() { |
| | | Long communityId = this.getCommunityId(); |
| | | if (communityId == null) { |
| | | return R.fail(401, "请先登录"); |
| | | } |
| | | return communityService.getCommunityServiceStatistics(communityId); |
| | | } |
| | | |
| | | @ApiOperation(value = "分页获取热度排行商家", response = ConvenientMerchantVO.class) |
| | | @PostMapping("/merchant/popular") |
| | | public R getScreenPopularMerchants(@RequestBody PagePopularMerchantDTO pagePopularMerchantDTO) { |
| | | Long communityId = this.getCommunityId(); |
| | | if (communityId == null) { |
| | | return R.fail(401, "请先登录"); |
| | | } |
| | | pagePopularMerchantDTO.setCommunityId(communityId); |
| | | return communityService.getScreenPopularMerchants(pagePopularMerchantDTO); |
| | | } |
| | | } |
| | |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | import com.panzhihua.common.model.dtos.community.convenient.PagePopularMerchantDTO; |
| | | import com.panzhihua.service_community.service.BigScreenStatisticsService; |
| | | import com.panzhihua.service_community.service.BigScreenService; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | |
| | | private ComMngPopulationService comMngPopulationService; |
| | | @Resource |
| | | private BigScreenService bigScreenService; |
| | | @Resource |
| | | private BigScreenStatisticsService bigScreenStatisticsService; |
| | | |
| | | /** |
| | | * 首页大屏统计接口 |
| | |
| | | return this.bigScreenService.serviceUser(communityId); |
| | | } |
| | | |
| | | /** |
| | | * 大数据分析平台-居民自治 |
| | | * @param communityId |
| | | * @return |
| | | */ |
| | | @GetMapping("/resident/autonomy") |
| | | public R getResidentAutonomy(@RequestParam("communityId") Long communityId) { |
| | | return bigScreenStatisticsService.getResidentAutonomy(communityId); |
| | | } |
| | | |
| | | /** |
| | | * 大数据分析平台-清网治格 |
| | | * @param communityId |
| | | * @return |
| | | */ |
| | | @GetMapping("/grids/governance") |
| | | public R getGridsGovernance(@RequestParam("communityId") Long communityId) { |
| | | return bigScreenStatisticsService.getGridsGovernance(communityId); |
| | | } |
| | | |
| | | /** |
| | | * 大数据分析平台-社区服务 |
| | | * @param communityId |
| | | * @return |
| | | */ |
| | | @GetMapping("/community/service") |
| | | public R getCommunityServiceStatistics(@RequestParam("communityId") Long communityId) { |
| | | return bigScreenStatisticsService.getCommunityServiceStatistics(communityId); |
| | | } |
| | | |
| | | /** |
| | | * 分页获取热度排行商家 |
| | | * @param pagePopularMerchantDTO |
| | | * @return |
| | | */ |
| | | @PostMapping("/merchant/popular") |
| | | public R getScreenPopularMerchants(@RequestBody PagePopularMerchantDTO pagePopularMerchantDTO) { |
| | | return bigScreenStatisticsService.getScreenPopularMerchants(pagePopularMerchantDTO); |
| | | } |
| | | |
| | | } |
| | |
| | | void updateAccountPassword(@Param("password") String password, @Param("account") String account, |
| | | @Param("communityId") Long communityId); |
| | | |
| | | @Select("select community_id,`name` from com_act where state = 0") |
| | | @Select("select community_id,`name`,lng,lat from com_act where state = 0") |
| | | List<EventGridCommunityAdminVO> getCommunityLists(); |
| | | |
| | | @Select("select ca.`name`,cmsap.province_name,cmsac.city_name,cmsad.district_name,ca.street_id,ca.community_id,cs.`name` as streetName from com_act as ca \n" |
| | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | import com.panzhihua.common.model.vos.community.StatisticsCommVO; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | import org.apache.ibatis.annotations.Select; |
| | |
| | | * @return |
| | | */ |
| | | int batchUpdateViewNum(@Param("needDealMap") HashMap<Long, Integer> needDealMap); |
| | | |
| | | /** |
| | | * 居民自治-议事投票类型占比统计 |
| | | * @param communityId |
| | | * @return |
| | | */ |
| | | List<StatisticsCommVO> selectTypePercent(@Param("communityId") Long communityId); |
| | | |
| | | /** |
| | | * 获取一起议标题 |
| | | * @param type |
| | | * @param communityId |
| | | * @param pageSize |
| | | * @return |
| | | */ |
| | | List<String> getTitles(@Param("type") int type, @Param("communityId") Long communityId, @Param("pageSize") Integer pageSize); |
| | | } |
| | |
| | | import com.panzhihua.common.model.dtos.community.easyPhoto.ExportEasyPhotoDTO; |
| | | import com.panzhihua.common.model.vos.community.ComActEasyPhotoVO; |
| | | import com.panzhihua.common.model.vos.community.TodoEventsVO; |
| | | import com.panzhihua.common.model.vos.community.bigscreen.GridsGovernanceStatisticsVO; |
| | | import com.panzhihua.common.model.vos.community.bigscreen.ResidentAutonomyStatisticsVO; |
| | | import com.panzhihua.common.model.vos.community.easyPhoto.BannerVO; |
| | | import com.panzhihua.common.model.vos.community.easyPhoto.ComActEasyPhotoCountVO; |
| | | import com.panzhihua.common.model.vos.community.easyPhoto.ComActEasyPhotoStatisticsVO; |
| | |
| | | * @return |
| | | */ |
| | | List<BannerVO> banner(@Param("communityId") Long communityId); |
| | | |
| | | /** |
| | | * 获取随手拍居民自治统计数据 |
| | | * @param communityId |
| | | * @return |
| | | */ |
| | | List<ComActEasyPhotoVO> selectStatisticsList(@Param("communityId") Long communityId); |
| | | |
| | | /** |
| | | * 获取居民自治统计数据 |
| | | * @param communityId |
| | | * @return |
| | | */ |
| | | ResidentAutonomyStatisticsVO selectResidentAutonomyStatistics(@Param("communityId") Long communityId); |
| | | |
| | | /** |
| | | * 获取清网治格统计数据 |
| | | * @param communityId |
| | | * @return |
| | | */ |
| | | GridsGovernanceStatisticsVO selectGridsGovernance(@Param("communityId") Long communityId); |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.panzhihua.common.model.dtos.community.bigscreen.work.ScreenMicroListDTO; |
| | | import com.panzhihua.common.model.vos.community.ComActMicroWishVO; |
| | | import com.panzhihua.common.model.vos.community.StatisticsCommVO; |
| | | import com.panzhihua.common.model.vos.community.TodoEventsVO; |
| | | import com.panzhihua.common.model.vos.community.screen.work.MicroListVO; |
| | | import com.panzhihua.common.model.vos.user.SysUserVO; |
| | |
| | | List<SysUserVO> getWishHandleListAdmin(@Param("type") Integer type,@Param("communityId") Long communityId); |
| | | |
| | | SysUserVO getUserByUserId(@Param("userId") Long userId); |
| | | |
| | | /** |
| | | * 待实现&已实现数目及占比 |
| | | * @param communityId |
| | | * @return |
| | | */ |
| | | List<StatisticsCommVO> selectRealizePercent(@Param("communityId") Long communityId); |
| | | |
| | | /** |
| | | * 获取通过的微心愿图片 |
| | | * @param communityId |
| | | * @param pageSize |
| | | * @return |
| | | */ |
| | | List<String> getPassedAllImages(@Param("communityId") Long communityId, @Param("pageSize") Integer pageSize); |
| | | } |
| | |
| | | void addHotNum(@Param("circleId") Long circleId,@Param("hotNum") Long hotNum); |
| | | |
| | | void addTopicHotNum(@Param("circleId") Long circleId,@Param("hotNum") Long hotNum); |
| | | |
| | | /** |
| | | * 获取大屏邻里圈展示图片 |
| | | * @param communityId |
| | | * @param pageSize |
| | | * @return |
| | | */ |
| | | List<String> getAllImages(@Param("communityId") Long communityId, @Param("pageSize") Integer pageSize); |
| | | |
| | | /** |
| | | * 获取大屏邻里圈展示文本内容 |
| | | * @param communityId |
| | | * @param pageSize |
| | | * @return |
| | | */ |
| | | List<String> getContents(@Param("communityId") Long communityId, @Param("pageSize") Integer pageSize); |
| | | } |
| | |
| | | */ |
| | | DonatesStatisticsVO selectDonatesStatistics(@Param("communityId") Long communityId, @Param("currentYear") String currentYear, |
| | | @Param("currentMonth") String currentMonth, @Param("today") String today); |
| | | |
| | | /** |
| | | * 居民自治大屏-捐赠记录 |
| | | * @param communityId |
| | | * @param pageSize |
| | | * @return |
| | | */ |
| | | List<String> getWarehouseDonateRecords(@Param("communityId") Long communityId, @Param("pageSize") Integer pageSize); |
| | | |
| | | /** |
| | | * 居民自治大屏-爱心传递 |
| | | * @param communityId |
| | | * @param pageSize |
| | | * @return |
| | | */ |
| | | List<String> getWarehouseLoveTransfer(@Param("communityId") Long communityId, @Param("pageSize") Integer pageSize); |
| | | |
| | | /** |
| | | * 居民自治大屏-捐赠物品图片 |
| | | * @param communityId |
| | | * @param pageSize |
| | | * @return |
| | | */ |
| | | List<String> getWarehouseImages(@Param("communityId") Long communityId, @Param("pageSize") Integer pageSize); |
| | | } |
| | |
| | | * @return |
| | | */ |
| | | IndexDynamic indexDynamic(Long communityId); |
| | | |
| | | /** |
| | | * 大屏事件数据 |
| | | * @param communityId |
| | | * @return |
| | | */ |
| | | List<EventGridIncidentStatisticsVO> getGridsGovernanceEventList(@Param("communityId") Long communityId); |
| | | } |
| | |
| | | import com.panzhihua.common.model.dtos.property.CommonPage; |
| | | import com.panzhihua.common.model.vos.community.ComActSocialOrgVO; |
| | | import com.panzhihua.common.model.vos.community.ComPropertyVO; |
| | | import com.panzhihua.common.model.vos.community.StatisticsCommVO; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import com.panzhihua.service_community.entity.ComProperty; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * (ComProperty)表数据库访问层 |
| | |
| | | * @return |
| | | */ |
| | | IPage<ComPropertyVO> pageList(Page page, @Param("commonPage") CommonPage commonPage); |
| | | |
| | | /** |
| | | * 居民自治大屏统计数据获取 |
| | | * @param communityId |
| | | * @return |
| | | */ |
| | | List<StatisticsCommVO> getRepairPolylineDate(@Param("communityId") Long communityId); |
| | | |
| | | /** |
| | | * 报事报修date之前的累计数量 |
| | | * @param communityId |
| | | * @param date |
| | | * @return |
| | | */ |
| | | StatisticsCommVO getRepairTotalPolylineDate(@Param("communityId") Long communityId, @Param("date") String date); |
| | | |
| | | List<StatisticsCommVO> getEventAddPolylineData(@Param("communityId") Long communityId); |
| | | |
| | | StatisticsCommVO getEventTotalPolylineDate(@Param("communityId") Long communityId, @Param("date") String date); |
| | | } |
| | |
| | | import com.panzhihua.common.model.dtos.community.convenient.ExportMerchantDTO; |
| | | import com.panzhihua.common.model.dtos.community.convenient.PageClassifyMerchantDTO; |
| | | import com.panzhihua.common.model.dtos.community.convenient.PageConvenientMerchantDTO; |
| | | import com.panzhihua.common.model.dtos.community.convenient.PagePopularMerchantDTO; |
| | | import com.panzhihua.common.model.dtos.community.convenient.PageSearchDTO; |
| | | import com.panzhihua.common.model.vos.community.convenient.ConvenientConsultationStatisticsVO; |
| | | import com.panzhihua.common.model.vos.community.convenient.ConvenientMerchantVO; |
| | |
| | | * @return |
| | | */ |
| | | int batchUpdateBusinessStatus(@Param("convenientMerchantDOList") List<ConvenientMerchantDO> convenientMerchantDOList, @Param("status") int status); |
| | | |
| | | /** |
| | | * 社区商家 |
| | | * @param communityId |
| | | * @return |
| | | */ |
| | | List<ConvenientMerchantVO> selectMerchantListByCommunity(@Param("communityId") Long communityId); |
| | | |
| | | /** |
| | | * 大屏分页获取热度排行商家 |
| | | * @param page |
| | | * @param pagePopularMerchantDTO |
| | | * @return |
| | | */ |
| | | List<ConvenientMerchantVO> getScreenPopularMerchants(@Param("page") Page page, @Param("pagePopularMerchantDTO") PagePopularMerchantDTO pagePopularMerchantDTO); |
| | | } |
New file |
| | |
| | | package com.panzhihua.service_community.service; |
| | | |
| | | import com.panzhihua.common.model.dtos.community.convenient.PagePopularMerchantDTO; |
| | | import com.panzhihua.common.model.vos.R; |
| | | |
| | | /** |
| | | * @title: BigScreenStatisticsService |
| | | * @projectName: 成都呐喊信息技术有限公司-智慧社区项目 |
| | | * @description: 大屏统计服务类 |
| | | * @author: hans |
| | | * @date: 2021/12/06 9:56 |
| | | */ |
| | | public interface BigScreenStatisticsService { |
| | | |
| | | /** |
| | | * 大数据分析平台-居民自治 |
| | | * @param communityId |
| | | * @return |
| | | */ |
| | | R getResidentAutonomy(Long communityId); |
| | | |
| | | /** |
| | | * 大数据分析平台-清网治格 |
| | | * @param communityId |
| | | * @return |
| | | */ |
| | | R getGridsGovernance(Long communityId); |
| | | |
| | | /** |
| | | * 大数据分析平台-社区服务 |
| | | * @param communityId |
| | | * @return |
| | | */ |
| | | R getCommunityServiceStatistics(Long communityId); |
| | | |
| | | /** |
| | | * 分页获取热度排行商家 |
| | | * @param pagePopularMerchantDTO |
| | | * @return |
| | | */ |
| | | R getScreenPopularMerchants(PagePopularMerchantDTO pagePopularMerchantDTO); |
| | | } |
New file |
| | |
| | | package com.panzhihua.service_community.service.impl; |
| | | |
| | | import static java.util.Objects.isNull; |
| | | import static java.util.Objects.nonNull; |
| | | |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.ArrayList; |
| | | import java.util.Comparator; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Objects; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.panzhihua.common.model.dtos.community.convenient.PagePopularMerchantDTO; |
| | | import com.panzhihua.common.model.vos.community.bigscreen.BigScreenCommunityStatisticsVO; |
| | | import com.panzhihua.common.model.vos.community.bigscreen.GridsGovernanceStatisticsVO; |
| | | import com.panzhihua.common.model.vos.community.convenient.ConvenientMerchantVO; |
| | | import com.panzhihua.common.model.vos.community.screen.civil.CivilVillageStatisticsVO; |
| | | import com.panzhihua.common.model.vos.community.screen.event.EventGridIncidentStatisticsVO; |
| | | import com.panzhihua.common.model.vos.community.screen.event.EventGridStatisticsVO; |
| | | import com.panzhihua.service_community.dao.ComMngPopulationDAO; |
| | | import com.panzhihua.service_community.dao.ConvenientMerchantDAO; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import com.panzhihua.common.model.vos.R; |
| | | import com.panzhihua.common.model.vos.community.ComActEasyPhotoVO; |
| | | import com.panzhihua.common.model.vos.community.StatisticsCommVO; |
| | | import com.panzhihua.common.model.vos.community.bigscreen.ResidentAutonomyStatisticsVO; |
| | | import com.panzhihua.service_community.dao.ComActDiscussDAO; |
| | | import com.panzhihua.service_community.dao.ComActEasyPhotoDAO; |
| | | import com.panzhihua.service_community.dao.ComActMicroWishDAO; |
| | | import com.panzhihua.service_community.dao.ComActNeighborCircleDAO; |
| | | import com.panzhihua.service_community.dao.ComActWarehouseDonatesDao; |
| | | import com.panzhihua.service_community.dao.ComPropertyDao; |
| | | import com.panzhihua.service_community.service.BigScreenStatisticsService; |
| | | |
| | | import lombok.extern.slf4j.Slf4j; |
| | | |
| | | /** |
| | | * @title: BigScreenStatisticsServiceImpl |
| | | * @projectName: 成都呐喊信息技术有限公司-智慧社区项目 |
| | | * @description: 大屏统计服务实现类 |
| | | * @author: hans |
| | | * @date: 2021/12/06 9:56 |
| | | */ |
| | | @Service |
| | | @Slf4j |
| | | public class BigScreenStatisticsServiceImpl implements BigScreenStatisticsService { |
| | | |
| | | private static final Integer pageSize = 200; |
| | | |
| | | @Resource |
| | | private ComActEasyPhotoDAO comActEasyPhotoDAO; |
| | | |
| | | @Resource |
| | | private ComActMicroWishDAO comActMicroWishDAO; |
| | | |
| | | @Resource |
| | | private ComActDiscussDAO comActDiscussDAO; |
| | | |
| | | @Resource |
| | | private ComActNeighborCircleDAO comActNeighborCircleDAO; |
| | | |
| | | @Resource |
| | | private ComPropertyDao comPropertyDao; |
| | | |
| | | @Resource |
| | | private ComActWarehouseDonatesDao comActWarehouseDonatesDao; |
| | | |
| | | @Resource |
| | | private ComMngPopulationDAO comMngPopulationDAO; |
| | | |
| | | @Resource |
| | | private ConvenientMerchantDAO convenientMerchantDAO; |
| | | |
| | | /** |
| | | * 大数据分析平台-居民自治 |
| | | * @param communityId |
| | | * @return |
| | | */ |
| | | @Override |
| | | public R getResidentAutonomy(Long communityId) { |
| | | ResidentAutonomyStatisticsVO statisticsVO = comActEasyPhotoDAO.selectResidentAutonomyStatistics(communityId); |
| | | if (isNull(statisticsVO)) { |
| | | statisticsVO = new ResidentAutonomyStatisticsVO(); |
| | | } |
| | | List<ComActEasyPhotoVO> easyPhotoVOList = comActEasyPhotoDAO.selectStatisticsList(communityId); |
| | | //随手拍总数 |
| | | Integer easyPhotoTotalCount = 0; |
| | | //随手拍柱状统计 |
| | | List<StatisticsCommVO> easyPhotoHistogram = new ArrayList<>(); |
| | | if (Objects.nonNull(easyPhotoVOList) && !easyPhotoVOList.isEmpty()) { |
| | | Map<String, List<ComActEasyPhotoVO>> easyPhotoVOMap = easyPhotoVOList.stream().collect(Collectors.groupingBy(ComActEasyPhotoVO::getClassifyName)); |
| | | for (Map.Entry<String, List<ComActEasyPhotoVO>> entry : easyPhotoVOMap.entrySet()) { |
| | | StatisticsCommVO commVO = new StatisticsCommVO(); |
| | | commVO.setFiled(entry.getKey()); |
| | | commVO.setNum(entry.getValue().size()); |
| | | easyPhotoHistogram.add(commVO); |
| | | } |
| | | easyPhotoTotalCount = easyPhotoVOList.size(); |
| | | } |
| | | statisticsVO.setEasyPhotoTotalCount(easyPhotoTotalCount); |
| | | statisticsVO.setEasyPhotoHistogram(easyPhotoHistogram); |
| | | |
| | | //待实现&已实现数目及占比 |
| | | List<StatisticsCommVO> microWishRealizePercent = comActMicroWishDAO.selectRealizePercent(communityId); |
| | | statisticsVO.setMicroWishRealizePercent(microWishRealizePercent); |
| | | //微心愿图片 |
| | | List<String> microWishImages = comActMicroWishDAO.getPassedAllImages(communityId, pageSize); |
| | | statisticsVO.setMicroWishImages(microWishImages); |
| | | |
| | | //议事投票类型占比 |
| | | List<StatisticsCommVO> discussTypePercent = comActDiscussDAO.selectTypePercent(communityId); |
| | | statisticsVO.setDiscussTypePercent(discussTypePercent); |
| | | //议事标题 |
| | | List<String> discussTitles = comActDiscussDAO.getTitles(1, communityId, pageSize); |
| | | statisticsVO.setDiscussTitles(discussTitles); |
| | | //投票标题 |
| | | List<String> voteTitles = comActDiscussDAO.getTitles(2, communityId, pageSize); |
| | | statisticsVO.setVoteTitles(voteTitles); |
| | | |
| | | //邻里圈图片 |
| | | List<String> neighborImages = comActNeighborCircleDAO.getAllImages(communityId, pageSize); |
| | | statisticsVO.setNeighborImages(neighborImages); |
| | | //邻里圈文本内容 |
| | | List<String> neighborContents = comActNeighborCircleDAO.getContents(communityId, pageSize); |
| | | statisticsVO.setNeighborContents(neighborContents); |
| | | |
| | | //报事报修新增折线数据 |
| | | Date nowDate = new Date(); |
| | | List<StatisticsCommVO> repairAddPolylineData = comPropertyDao.getRepairPolylineDate(communityId); |
| | | int currentMon = Integer.parseInt(new SimpleDateFormat("MM").format(nowDate)); |
| | | for (int i = 1; i <= currentMon; i++) { |
| | | String temp; |
| | | if (i > 9) { |
| | | temp = "" + i; |
| | | } else { |
| | | temp = "0" + i; |
| | | } |
| | | boolean isExist = repairAddPolylineData.stream().anyMatch(e -> nonNull(e.getFiled()) && |
| | | e.getFiled().endsWith(temp)); |
| | | if (!isExist) { |
| | | StatisticsCommVO other = new StatisticsCommVO(); |
| | | other.setFiled(temp); |
| | | other.setNum(0); |
| | | repairAddPolylineData.add(other); |
| | | } |
| | | } |
| | | repairAddPolylineData = repairAddPolylineData.stream().filter(e -> nonNull(e.getFiled())) |
| | | .sorted(Comparator.comparing(e -> e.getFiled())).collect(Collectors.toList()); |
| | | statisticsVO.setRepairAddPolylineData(repairAddPolylineData); |
| | | //报事报修累计折线数据 |
| | | List<StatisticsCommVO> repairTotalPolylineData = new ArrayList<>(); |
| | | String year = new SimpleDateFormat("yyyy").format(nowDate); |
| | | repairAddPolylineData.forEach(e -> { |
| | | StatisticsCommVO temp = comPropertyDao.getRepairTotalPolylineDate(communityId, year + e.getFiled()); |
| | | temp.setFiled(e.getFiled()); |
| | | repairTotalPolylineData.add(temp); |
| | | }); |
| | | statisticsVO.setRepairTotalPolylineData(repairTotalPolylineData); |
| | | |
| | | //捐赠记录 |
| | | List<String> warehouseDonateRecords = comActWarehouseDonatesDao.getWarehouseDonateRecords(communityId, pageSize); |
| | | statisticsVO.setWarehouseDonateRecords(warehouseDonateRecords); |
| | | //爱心传递 |
| | | List<String> warehouseLoveTransfer = comActWarehouseDonatesDao.getWarehouseLoveTransfer(communityId, pageSize); |
| | | statisticsVO.setWarehouseLoveTransfer(warehouseLoveTransfer); |
| | | //捐赠图片 |
| | | List<String> warehouseImages = comActWarehouseDonatesDao.getWarehouseImages(communityId, pageSize); |
| | | statisticsVO.setWarehouseImages(warehouseImages); |
| | | return R.ok(statisticsVO); |
| | | } |
| | | |
| | | /** |
| | | * 大数据分析平台-清网治格 |
| | | * @param communityId |
| | | * @return |
| | | */ |
| | | @Override |
| | | public R getGridsGovernance(Long communityId) { |
| | | GridsGovernanceStatisticsVO statisticsVO = comActEasyPhotoDAO.selectGridsGovernance(communityId); |
| | | if (isNull(statisticsVO)) { |
| | | statisticsVO = new GridsGovernanceStatisticsVO(); |
| | | } |
| | | // 查询网格数据 |
| | | List<EventGridStatisticsVO> gridStatisticsList = comMngPopulationDAO.getEventScreenGridData(communityId); |
| | | statisticsVO.setGridStatisticsList(gridStatisticsList); |
| | | |
| | | // 查询小区列表 |
| | | List<CivilVillageStatisticsVO> villageStatisticsList = comMngPopulationDAO.getCivilScreenVillageList(communityId); |
| | | if (!villageStatisticsList.isEmpty()) { |
| | | villageStatisticsList.forEach(village -> { |
| | | CivilVillageStatisticsVO villageStatisticsVO = |
| | | comMngPopulationDAO.getCivilScreenVillageStatistics(village.getVillageId()); |
| | | if (villageStatisticsVO != null) { |
| | | village.setPeopleNum(villageStatisticsVO.getPeopleNum()); |
| | | village.setHouseNum(villageStatisticsVO.getHouseNum()); |
| | | village.setRegisterNum(villageStatisticsVO.getRegisterNum()); |
| | | village.setFlowNum(villageStatisticsVO.getFlowNum()); |
| | | // BeanUtils.copyProperties(villageStatisticsVO,village); |
| | | } |
| | | }); |
| | | } |
| | | statisticsVO.setVillageStatisticsList(villageStatisticsList); |
| | | // 查询社区事件列表 |
| | | List<EventGridIncidentStatisticsVO> gridIncidentList = comMngPopulationDAO.getGridsGovernanceEventList(communityId); |
| | | statisticsVO.setGridIncidentList(gridIncidentList); |
| | | //事件分析新增折线数据 |
| | | Date nowDate = new Date(); |
| | | List<StatisticsCommVO> eventAddPolylineData = comPropertyDao.getEventAddPolylineData(communityId); |
| | | int currentMon = Integer.parseInt(new SimpleDateFormat("MM").format(nowDate)); |
| | | for (int i = 1; i <= currentMon; i++) { |
| | | String temp; |
| | | if (i > 9) { |
| | | temp = "" + i; |
| | | } else { |
| | | temp = "0" + i; |
| | | } |
| | | boolean isExist = eventAddPolylineData.stream().anyMatch(e -> nonNull(e.getFiled()) && |
| | | e.getFiled().endsWith(temp)); |
| | | if (!isExist) { |
| | | StatisticsCommVO other = new StatisticsCommVO(); |
| | | other.setFiled(temp); |
| | | other.setNum(0); |
| | | eventAddPolylineData.add(other); |
| | | } |
| | | } |
| | | eventAddPolylineData = eventAddPolylineData.stream().filter(e -> nonNull(e.getFiled())) |
| | | .sorted(Comparator.comparing(e -> e.getFiled())).collect(Collectors.toList()); |
| | | statisticsVO.setEventAddPolylineData(eventAddPolylineData); |
| | | //事件分析累计折线数据 |
| | | List<StatisticsCommVO> eventTotalPolylineData = new ArrayList<>(); |
| | | String year = new SimpleDateFormat("yyyy").format(nowDate); |
| | | eventAddPolylineData.forEach(e -> { |
| | | StatisticsCommVO temp = comPropertyDao.getEventTotalPolylineDate(communityId, year + e.getFiled()); |
| | | temp.setFiled(e.getFiled()); |
| | | eventTotalPolylineData.add(temp); |
| | | }); |
| | | statisticsVO.setEventTotalPolylineData(eventTotalPolylineData); |
| | | statisticsVO.generateStatisticsData(); |
| | | return R.ok(statisticsVO); |
| | | } |
| | | |
| | | /** |
| | | * 大数据分析平台-社区服务 |
| | | * @param communityId |
| | | * @return |
| | | */ |
| | | @Override |
| | | public R getCommunityServiceStatistics(Long communityId) { |
| | | BigScreenCommunityStatisticsVO statisticsVO = new BigScreenCommunityStatisticsVO(); |
| | | // 查询网格数据 |
| | | List<EventGridStatisticsVO> gridStatisticsList = comMngPopulationDAO.getEventScreenGridData(communityId); |
| | | statisticsVO.setGridStatisticsList(gridStatisticsList); |
| | | // 查询小区列表 |
| | | List<CivilVillageStatisticsVO> villageStatisticsList = comMngPopulationDAO.getCivilScreenVillageList(communityId); |
| | | if (!villageStatisticsList.isEmpty()) { |
| | | villageStatisticsList.forEach(village -> { |
| | | CivilVillageStatisticsVO villageStatisticsVO = |
| | | comMngPopulationDAO.getCivilScreenVillageStatistics(village.getVillageId()); |
| | | if (villageStatisticsVO != null) { |
| | | village.setPeopleNum(villageStatisticsVO.getPeopleNum()); |
| | | village.setHouseNum(villageStatisticsVO.getHouseNum()); |
| | | village.setRegisterNum(villageStatisticsVO.getRegisterNum()); |
| | | village.setFlowNum(villageStatisticsVO.getFlowNum()); |
| | | } |
| | | }); |
| | | } |
| | | statisticsVO.setVillageStatisticsList(villageStatisticsList); |
| | | //商家地图点位数据 |
| | | List<ConvenientMerchantVO> merchantVOList = convenientMerchantDAO.selectMerchantListByCommunity(communityId); |
| | | statisticsVO.setMerchantMapDataList(merchantVOList); |
| | | return R.ok(statisticsVO); |
| | | } |
| | | |
| | | /** |
| | | * 分页获取热度排行商家 |
| | | * @param pagePopularMerchantDTO |
| | | * @return |
| | | */ |
| | | @Override |
| | | public R getScreenPopularMerchants(PagePopularMerchantDTO pagePopularMerchantDTO) { |
| | | Page page = new Page<>(); |
| | | page.setSize(pagePopularMerchantDTO.getPageSize()); |
| | | page.setCurrent(pagePopularMerchantDTO.getPageNum()); |
| | | List<ConvenientMerchantVO> popularMerchants = convenientMerchantDAO.getScreenPopularMerchants(page, pagePopularMerchantDTO); |
| | | return R.ok(popularMerchants); |
| | | } |
| | | } |
| | |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | |
| | | import static java.util.Objects.nonNull; |
| | | |
| | | /** |
| | | * 实有人口Service实现类 |
| | | */ |
| | |
| | | @Override |
| | | public R getScreenEventDetail(BigScreenEventDetailDTO eventDetailDTO) { |
| | | EventNewStatisticsVO statisticsVO = new EventNewStatisticsVO(); |
| | | if (eventDetailDTO.getType().equals(7)) {// 随手拍详情 |
| | | Integer eventType = eventDetailDTO.getEventType(); |
| | | if (eventDetailDTO.getType().equals(7) || (nonNull(eventType) && eventType.equals(2))) {// 随手拍详情 |
| | | statisticsVO = this.baseMapper.getEventScreenSSPDateil(eventDetailDTO.getEventId()); |
| | | if (statisticsVO != null && StringUtils.isNotEmpty(statisticsVO.getPhotoPathList())) { |
| | | statisticsVO.setDangerLevel("0"); |
| | |
| | | order by cadc.create_at desc |
| | | limit 10 |
| | | </select> |
| | | <select id="selectTypePercent" resultType="com.panzhihua.common.model.vos.community.StatisticsCommVO"> |
| | | SELECT t1.filed, t1.num, ROUND( t1.num / t2.sum * 100, 2 ) AS percent, |
| | | FROM |
| | | (SELECT IF(`type` = 1,'议事','投票') AS filed, COUNT(id) AS num FROM com_act_discuss |
| | | WHERE community_id = #{communityId} AND is_del = 2 GROUP BY filed) t1, |
| | | (SELECT COUNT(id) AS sum FROM com_act_discuss WHERE community_id = #{communityId} AND is_del = 2) t2 |
| | | </select> |
| | | <select id="getTitles" resultType="java.lang.String"> |
| | | SELECT discuss_subject FROM com_act_discuss WHERE community_id = #{communityId} AND `type` = #{type} AND is_del = 2 ORDER BY release_at DESC limit #{pageSize} |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | select id,logo as cover,release_at as show_time,7 as type,"" as jump_url,"" as jump_type from com_act_easy_photo_activity where status =2 and community_id =#{communityId} |
| | | order by show_time desc limit 30 |
| | | </select> |
| | | <select id="selectStatisticsList" resultType="com.panzhihua.common.model.vos.community.ComActEasyPhotoVO"> |
| | | SELECT t1.id, IF(`name` IS NULL,'其他',`name`) AS classifyName |
| | | FROM com_act_easy_photo t1 |
| | | LEFT JOIN com_act_easy_photo_classify t2 ON t1.classify_id = t2.id |
| | | WHERE t1.community_id = #{communityId} AND del_tag = 0 |
| | | </select> |
| | | <select id="selectResidentAutonomyStatistics" |
| | | resultType="com.panzhihua.common.model.vos.community.bigscreen.ResidentAutonomyStatisticsVO"> |
| | | SELECT * FROM |
| | | (SELECT COUNT(id) AS easyPhotoCurrentMonCount FROM com_act_easy_photo WHERE community_id = #{communityId} AND del_tag = 0 AND DATE_FORMAT( create_at, '%Y%m' ) = DATE_FORMAT( CURDATE( ) , '%Y%m' )) t1, |
| | | (SELECT COUNT(id) AS microWishCurrentMonCount FROM com_act_micro_wish WHERE community_id = #{communityId} AND DATE_FORMAT( create_at, '%Y%m' ) = DATE_FORMAT( CURDATE( ) , '%Y%m' )) t2, |
| | | (SELECT IF(SUM(aim_num) IS NULL,0,SUM(aim_num)) AS aimNum FROM com_act_micro_wish WHERE community_id = #{communityId} AND `status` != 4) t3, |
| | | (SELECT COUNT(id) AS microWishTotal FROM com_act_micro_wish WHERE community_id = #{communityId} AND `status` != 4) t4, |
| | | (SELECT COUNT(id) AS committeeCurrentMonCount FROM com_act_committee WHERE community_id = #{communityId} AND DATE_FORMAT( create_time, '%Y%m' ) = DATE_FORMAT( CURDATE( ) , '%Y%m' )) t5, |
| | | (SELECT COUNT(id) AS committeeTotal FROM com_act_committee WHERE community_id = #{communityId}) t6, |
| | | (SELECT ROUND( a.num / b.total * 100, 2 ) AS areaCoverPercent FROM |
| | | (SELECT COUNT(DISTINCT(area_id)) AS num FROM com_act_committee WHERE community_id = #{communityId}) a, |
| | | (SELECT COUNT(village_id) AS total FROM com_mng_village WHERE community_id = #{communityId}) b |
| | | ) t7, |
| | | (SELECT COUNT(id) AS discussCurrentMonCount FROM com_act_discuss WHERE community_id = #{communityId} AND is_del = 2 AND DATE_FORMAT( create_at, '%Y%m' ) = DATE_FORMAT( CURDATE( ) , '%Y%m' )) t8, |
| | | (SELECT COUNT(id) AS discussTotal FROM com_act_discuss WHERE community_id = #{communityId} AND is_del = 2) t9, |
| | | (SELECT COUNT(id) AS neighborCurrentMonCount FROM com_act_neighbor_circle WHERE community_id = #{communityId} AND is_del = 2 AND DATE_FORMAT( create_at, '%Y%m' ) = DATE_FORMAT( CURDATE( ) , '%Y%m' )) t10, |
| | | (SELECT COUNT(id) AS neighborTotal, SUM(fabulous_num) AS neighborFabulousNum, SUM(forward_num) AS neighborForwardNum, |
| | | SUM(comment_num) AS neighborCommentNum FROM com_act_neighbor_circle WHERE community_id = #{communityId} AND is_del = 2) t11, |
| | | (SELECT COUNT(c1.id) AS repairCurrentMonCount FROM com_property_repair c1 |
| | | LEFT JOIN com_property c2 ON c1.property_id = c2.id |
| | | WHERE c2.community_id = #{communityId} AND DATE_FORMAT( c1.create_time, '%Y%m' ) = DATE_FORMAT( CURDATE( ) , '%Y%m' )) t12, |
| | | (SELECT COUNT(c1.id) AS repairTotal FROM com_property_repair c1 |
| | | LEFT JOIN com_property c2 ON c1.property_id = c2.id |
| | | WHERE c2.community_id = #{communityId}) t13, |
| | | (SELECT IF(SUM(quantity) IS NULL,0,SUM(quantity)) AS warehouseCurrentMonCount FROM com_act_warehouse_donates WHERE community_id = #{communityId} AND `status` = 2 AND DATE_FORMAT( signing_at, '%Y%m' ) = DATE_FORMAT( CURDATE( ) , '%Y%m' )) t14, |
| | | (SELECT warehouseTotal, warehouseSurplusTotal, warehouseTotal - warehouseSurplusTotal AS warehouseApplyTotal FROM |
| | | (SELECT IF(SUM(quantity) IS NULL,0,SUM(quantity)) AS warehouseTotal, IF(SUM(surplus_quantity) IS NULL,0,SUM(surplus_quantity)) AS warehouseSurplusTotal FROM com_act_warehouse_donates WHERE community_id = #{communityId} AND `status` = 2) temp) t15, |
| | | (SELECT COUNT(DISTINCT d2.user_id) AS discussCount FROM com_act_discuss d1 |
| | | INNER JOIN com_act_discuss_comment d2 ON d1.id = d2.discuss_id |
| | | WHERE d1.community_id = #{communityId} AND d1.is_del = 2 AND `type` = 1) t16, |
| | | (SELECT COUNT(DISTINCT d2.user_id) AS voteCount FROM com_act_discuss d1 |
| | | INNER JOIN com_act_discuss_option_user d2 ON d1.id = d2.discuss_id |
| | | WHERE d1.community_id = #{communityId} AND d1.is_del = 2 AND `type` = 2) t17 |
| | | </select> |
| | | <select id="selectGridsGovernance" |
| | | resultType="com.panzhihua.common.model.vos.community.bigscreen.GridsGovernanceStatisticsVO"> |
| | | SELECT |
| | | IFNULL((SELECT count( e.id ) 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_status = 2 AND egd.grid_community_id = 2), 0) + |
| | | IFNULL((SELECT COUNT(1) FROM com_act_easy_photo |
| | | WHERE community_id = #{communityId} AND `status` IN (1,2,4) AND del_tag = 0 AND classify_id = 7), 0) AS eventTFTotal, |
| | | |
| | | IFNULL(( SELECT count( e1.id ) FROM `event` AS e1 |
| | | LEFT JOIN event_grid_data AS egd1 ON egd1.id = e1.grid_id WHERE event_category = 1 AND event_type = 1 AND event_status = 2 AND egd1.grid_community_id = 2 ), 0 ) + |
| | | IFNULL((SELECT COUNT(1) FROM com_act_easy_photo |
| | | WHERE community_id = #{communityId} AND `status` IN (1,2,4) AND del_tag = 0 AND classify_id = 4), 0) AS eventZATotal, |
| | | |
| | | IFNULL(( SELECT count( e2.id ) FROM `event` AS e2 LEFT JOIN event_grid_data AS egd2 ON egd2.id = e2.grid_id WHERE event_category = 1 AND event_type = 3 AND event_status = 2 AND egd2.grid_community_id = 2 ), 0 ) + |
| | | IFNULL((SELECT COUNT(1) FROM com_act_easy_photo |
| | | WHERE community_id = #{communityId} AND `status` IN (1,2,4) AND del_tag = 0 AND classify_id = 5), 0) AS eventMDTotal, |
| | | |
| | | IFNULL(( SELECT count( e3.id ) FROM `event` AS e3 LEFT JOIN event_grid_data AS egd3 ON egd3.id = e3.grid_id WHERE event_category = 1 AND event_type = 6 AND event_status = 2 AND egd3.grid_community_id = 2 ), 0 ) + |
| | | IFNULL((SELECT COUNT(1) FROM com_act_easy_photo |
| | | WHERE community_id = #{communityId} AND `status` IN (1,2,4) AND del_tag = 0 AND classify_id = 3), 0) AS eventTSTotal, |
| | | |
| | | IFNULL((SELECT COUNT(1) FROM com_act_easy_photo |
| | | WHERE community_id = #{communityId} AND `status` IN (1,2,4) AND del_tag = 0 AND classify_id = 8), 0) AS eventFJTotal, |
| | | |
| | | IFNULL(( SELECT count( e5.id ) FROM `event` AS e5 LEFT JOIN event_grid_data AS egd5 ON egd5.id = e5.grid_id WHERE event_category = 1 AND event_type = 2 AND event_status = 2 AND egd5.grid_community_id = 2 ), 0 ) + |
| | | IFNULL((SELECT COUNT(1) FROM com_act_easy_photo |
| | | WHERE community_id = #{communityId} AND `status` IN (1,2,4) AND del_tag = 0 AND classify_id = 6), 0) AS eventMSTotal, |
| | | |
| | | IFNULL((SELECT COUNT(1) FROM com_act_easy_photo |
| | | WHERE community_id = #{communityId} AND `status` IN (1,2,4) AND del_tag = 0 AND classify_id = 1), 0) AS otherTotal, |
| | | |
| | | IFNULL((SELECT count( e.id ) 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 = 4 AND egd.grid_community_id = 2), 0) + |
| | | IFNULL((SELECT COUNT(1) FROM com_act_easy_photo |
| | | WHERE community_id = #{communityId} AND `status` = 4 AND del_tag = 0 AND classify_id = 7), 0) AS eventTFDeal, |
| | | |
| | | IFNULL(( SELECT count( e1.id ) FROM `event` AS e1 |
| | | LEFT JOIN event_grid_data AS egd1 ON egd1.id = e1.grid_id WHERE event_category = 1 AND event_type = 1 AND event_deal_status = 4 AND egd1.grid_community_id = 2 ), 0 ) + |
| | | IFNULL((SELECT COUNT(1) FROM com_act_easy_photo |
| | | WHERE community_id = #{communityId} AND `status` = 4 AND del_tag = 0 AND classify_id = 4), 0) AS eventZADeal, |
| | | |
| | | IFNULL(( SELECT count( e2.id ) FROM `event` AS e2 LEFT JOIN event_grid_data AS egd2 ON egd2.id = e2.grid_id WHERE event_category = 1 AND event_type = 3 AND event_deal_status = 4 AND egd2.grid_community_id = 2 ), 0 ) + |
| | | IFNULL((SELECT COUNT(1) FROM com_act_easy_photo |
| | | WHERE community_id = #{communityId} AND `status` = 4 AND del_tag = 0 AND classify_id = 5), 0) AS eventMDDeal, |
| | | |
| | | IFNULL(( SELECT count( e3.id ) FROM `event` AS e3 LEFT JOIN event_grid_data AS egd3 ON egd3.id = e3.grid_id WHERE event_category = 1 AND event_type = 6 AND event_deal_status = 4 AND egd3.grid_community_id = 2 ), 0 ) + |
| | | IFNULL((SELECT COUNT(1) FROM com_act_easy_photo |
| | | WHERE community_id = #{communityId} AND `status` = 4 AND del_tag = 0 AND classify_id = 3), 0) AS eventTSDeal, |
| | | |
| | | IFNULL((SELECT COUNT(1) FROM com_act_easy_photo |
| | | WHERE community_id = #{communityId} AND `status` = 4 AND del_tag = 0 AND classify_id = 8), 0) AS eventFJDeal, |
| | | |
| | | IFNULL(( SELECT count( e5.id ) FROM `event` AS e5 LEFT JOIN event_grid_data AS egd5 ON egd5.id = e5.grid_id WHERE event_category = 1 AND event_type = 2 AND event_deal_status = 4 AND egd5.grid_community_id = 2 ), 0 ) + |
| | | IFNULL((SELECT COUNT(1) FROM com_act_easy_photo |
| | | WHERE community_id = #{communityId} AND `status` = 4 AND del_tag = 0 AND classify_id = 6), 0) AS eventMSDeal, |
| | | |
| | | IFNULL((SELECT COUNT(1) FROM com_act_easy_photo |
| | | WHERE community_id = #{communityId} AND `status` = 4 AND del_tag = 0 AND classify_id = 1), 0) AS otherDeal, |
| | | IFNULL((SELECT count(id) FROM event_grid_data WHERE grid_community_id = #{communityId}), 0) AS gridTotal, |
| | | IFNULL((select count(egmr.id) from event_grid_member_relation as egmr left join event_grid_data as egd1 on egd1.id = egmr.grid_id where egd1.grid_community_id = #{communityId}), 0) AS gridMemberTotal |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | |
| | | ORDER BY w.create_at desc |
| | | </select> |
| | | <select id="selectRealizePercent" resultType="com.panzhihua.common.model.vos.community.StatisticsCommVO"> |
| | | SELECT t1.filed, t1.num, ROUND( t1.num / t2.sum * 100, 2 ) AS percent |
| | | FROM |
| | | (SELECT IF(`status` IN(5,6),'已实现','待实现') AS filed, COUNT(`status`) AS num FROM com_act_micro_wish |
| | | WHERE community_id = #{communityId} AND `status` != 4 GROUP BY filed) t1, |
| | | (SELECT COUNT(id) AS sum FROM com_act_micro_wish WHERE community_id = #{communityId} AND `status` != 4) t2 |
| | | </select> |
| | | <select id="getPassedAllImages" resultType="java.lang.String"> |
| | | SELECT photo_path_list FROM com_act_micro_wish |
| | | WHERE community_id = #{communityId} AND (`status` =2 OR `status` = 3 OR `status` = 5 OR `status` = 6 OR `status` = 7) |
| | | AND photo_path_list IS NOT NULL AND photo_path_list != '' |
| | | ORDER BY create_at DESC limit #{pageSize} |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | case when nc.`status`=1 then 0 else 1 end, |
| | | nc.`status` asc,nc.create_at desc |
| | | </select> |
| | | <select id="getAllImages" resultType="java.lang.String"> |
| | | SELECT release_images FROM com_act_neighbor_circle |
| | | WHERE community_id = #{communityId} AND `status` = 2 AND release_images IS NOT NULL AND release_images != '' |
| | | ORDER BY create_at DESC limit #{pageSize} |
| | | </select> |
| | | <select id="getContents" resultType="java.lang.String"> |
| | | SELECT release_content FROM com_act_neighbor_circle |
| | | WHERE community_id = #{communityId} AND `status` = 2 AND release_content IS NOT NULL AND release_content != '' |
| | | ORDER BY create_at DESC limit #{pageSize} |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | (SELECT IF(SUM(goods_num) IS NULL,0,SUM(goods_num)) FROM com_act_warehouse_apply WHERE community_id = #{communityId} AND `status` = 3 AND actual_time LIKE #{currentMonth}) as mothDec, |
| | | (SELECT IF(SUM(goods_num) IS NULL,0,SUM(goods_num)) FROM com_act_warehouse_apply WHERE community_id = #{communityId} AND `status` = 3 AND actual_time LIKE #{today}) as dayDec |
| | | </select> |
| | | <select id="getWarehouseDonateRecords" resultType="java.lang.String"> |
| | | SELECT CONCAT('收到爱心人士捐赠的',item,'x', quantity) |
| | | FROM com_act_warehouse_donates WHERE community_id = #{communityId} AND `status` = 2 ORDER BY signing_at DESC limit #{pageSize} |
| | | </select> |
| | | <select id="getWarehouseLoveTransfer" resultType="java.lang.String"> |
| | | SELECT t1.content FROM com_act_warehouse_operation t1 |
| | | LEFT JOIN com_act_warehouse_donates t2 ON t1.goods_id = t2.id |
| | | WHERE t2.community_id = #{communityId} AND t1.`type` = 2 ORDER BY create_time DESC limit #{pageSize} |
| | | </select> |
| | | <select id="getWarehouseImages" resultType="java.lang.String"> |
| | | SELECT image FROM com_act_warehouse_donates |
| | | WHERE community_id = #{communityId} AND `status` = 2 AND image IS NOT NULL AND image != '' ORDER BY signing_at DESC limit #{pageSize} |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | FROM com_act_micro_wish AS camw WHERE camw.STATUS = 6 |
| | | AND camw.community_id = #{communityId} |
| | | </select> |
| | | <select id="getGridsGovernanceEventList" |
| | | resultType="com.panzhihua.common.model.vos.community.screen.event.EventGridIncidentStatisticsVO"> |
| | | SELECT event_type AS type, IFNULL( NULL, 1 ) AS eventType, e.id AS eventId, happent_lat_lng AS latLng, event_des AS content, |
| | | (SELECT url FROM event_resource WHERE ref_id = e.id AND classification = 1 AND `type` = 1 LIMIT 1) AS cover, e.create_at, |
| | | CASE |
| | | WHEN event_deal_status = 4 THEN 1 |
| | | ELSE 2 END `status` |
| | | 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 IN ( 1, 2, 3, 5, 6 ) AND e.event_status = 2 AND egd.grid_community_id = #{communityId} |
| | | UNION ALL SELECT |
| | | CASE |
| | | WHEN classify_id = 4 THEN 1 |
| | | WHEN classify_id = 6 THEN 2 |
| | | WHEN classify_id = 5 THEN 3 |
| | | WHEN classify_id = 7 THEN 5 |
| | | WHEN classify_id = 3 THEN 6 |
| | | WHEN classify_id = 8 THEN 9 |
| | | WHEN classify_id = 1 THEN 10 |
| | | END type, IFNULL( NULL, 2 ) AS eventType, id AS eventId, lng_lat AS latLng, detail AS content, substring_index(photo_path_list, ',', 1) AS cover, create_at, |
| | | CASE |
| | | WHEN handle_status = 2 THEN 1 |
| | | ELSE 2 END `status` |
| | | FROM com_act_easy_photo WHERE community_id = #{communityId} AND `status` IN (1,2,4) AND del_tag = 0 AND classify_id IN (1,3,4,5,6,7,8) |
| | | </select> |
| | | </mapper> |
| | |
| | | </where> |
| | | order by t.create_time desc |
| | | </select> |
| | | <select id="getRepairPolylineDate" resultType="com.panzhihua.common.model.vos.community.StatisticsCommVO"> |
| | | SELECT DATE_FORMAT( p1.create_time, '%m' ) AS filed, COUNT(1) AS num FROM com_property_repair p1 |
| | | LEFT JOIN com_property p2 ON p1.property_id = p2.id |
| | | WHERE p2.community_id = #{communityId} AND DATE_FORMAT( p1.create_time, '%Y' ) = DATE_FORMAT( CURDATE( ) , '%Y' ) GROUP BY filed |
| | | </select> |
| | | <select id="getRepairTotalPolylineDate" |
| | | resultType="com.panzhihua.common.model.vos.community.StatisticsCommVO"> |
| | | SELECT COUNT(1) AS num FROM com_property_repair p1 |
| | | LEFT JOIN com_property p2 ON p1.property_id = p2.id |
| | | WHERE p2.community_id = #{communityId} AND DATE_FORMAT( p1.create_time, '%Y%m' ) <= #{date} |
| | | </select> |
| | | <select id="getEventAddPolylineData" |
| | | resultType="com.panzhihua.common.model.vos.community.StatisticsCommVO"> |
| | | SELECT DATE_FORMAT( e.create_at, '%m' ) AS filed, COUNT(e.id) AS num |
| | | 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 IN ( 1, 2, 3, 5, 6 ) AND e.event_status = 2 AND egd.grid_community_id = #{communityId} |
| | | AND DATE_FORMAT( e.create_at, '%Y' ) = DATE_FORMAT( CURDATE( ) , '%Y' ) GROUP BY filed |
| | | UNION ALL SELECT |
| | | DATE_FORMAT( create_at, '%m' ) AS filed, COUNT(id) AS num |
| | | FROM com_act_easy_photo WHERE community_id = #{communityId} AND `status` IN (1,2,4) AND del_tag = 0 AND classify_id IN (1,3,4,5,6,7,8) AND DATE_FORMAT( create_at, '%Y' ) = DATE_FORMAT( CURDATE( ) , '%Y' ) GROUP BY filed |
| | | </select> |
| | | <select id="getEventTotalPolylineDate" |
| | | resultType="com.panzhihua.common.model.vos.community.StatisticsCommVO"> |
| | | SELECT COUNT(e.id) AS num |
| | | 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 IN ( 1, 2, 3, 5, 6 ) AND e.event_status = 2 AND egd.grid_community_id = #{communityId} |
| | | AND DATE_FORMAT( e.create_at, '%Y%m' ) <= #{date} |
| | | UNION ALL SELECT |
| | | COUNT(id) AS num |
| | | FROM com_act_easy_photo WHERE community_id = #{communityId} AND `status` IN (1,2,4) AND del_tag = 0 AND classify_id IN (1,3,4,5,6,7,8) AND DATE_FORMAT( create_at, '%Y%m' ) <= #{date} |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | </foreach> |
| | | GROUP BY ccm.id |
| | | </select> |
| | | <select id="selectMerchantListByCommunity" |
| | | resultType="com.panzhihua.common.model.vos.community.convenient.ConvenientMerchantVO"> |
| | | SELECT id, `name`, logo, lat, lon FROM com_convenient_merchants WHERE community_id = #{communityId} AND is_del = 0 |
| | | </select> |
| | | <select id="getScreenPopularMerchants" |
| | | resultType="com.panzhihua.common.model.vos.community.convenient.ConvenientMerchantVO"> |
| | | SELECT id, `name`, consultation_volume, view_num |
| | | FROM com_convenient_merchants |
| | | WHERE community_id = #{pagePopularMerchantDTO.communityId} AND is_del = 0 ORDER BY (consultation_volume + consultation_volume) DESC LIMIT 100 |
| | | </select> |
| | | <update id="deleteMerchantById"> |
| | | UPDATE com_convenient_merchants SET is_del = 1, updated_by = #{operator} WHERE id = #{merchantId} |
| | | </update> |
| | |
| | | } |
| | | |
| | | /** |
| | | * 新版绘制多边形统计数据 |
| | | * @param eventListDTO |
| | | * @return |
| | | */ |
| | | @PostMapping("/getCivilDrawListNew") |
| | | public R getCivilDrawListNew(@RequestBody ScreenDrawEventListDTO eventListDTO) { |
| | | return eventService.getCivilDrawListNew(eventListDTO); |
| | | } |
| | | |
| | | /** |
| | | * 大屏-根据小区id查询小区统计人数 |
| | | * |
| | | * @param villageId |
| | |
| | | return eventGridMemberRelationService.getGridsMemberTrajectory(communityId); |
| | | } |
| | | |
| | | /** |
| | | * 大屏-新根据小区id查询小区统计人数 |
| | | * |
| | | * @param villageId |
| | | * 小区id |
| | | * @return 小区统计数据 |
| | | */ |
| | | @GetMapping("/village/statistics-new") |
| | | public R civilVillageStatisticsNew(@RequestParam("villageId") Long villageId) { |
| | | return eventService.civilVillageStatisticsNew(villageId); |
| | | } |
| | | |
| | | } |
| | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | import com.panzhihua.common.model.vos.community.StatisticsCommVO; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | |
| | | List<Map<String, Object>> getMemberBuildName(@Param("userId") Long userId); |
| | | |
| | | Integer getPopulationByLabelCount(@Param("floor") String floor, @Param("villageId") Long villageId); |
| | | |
| | | List<EventGridIncidentStatisticsVO> getGridsGovernanceEventList(@Param("communityId") Long communityId); |
| | | |
| | | ScreenDrawEventPopulationTotalVO getVillagePopulationTotalNew(@Param("villageId") Long villageId); |
| | | |
| | | List<StatisticsCommVO> selectStatisticsForAge(@Param("villageIds") List<Long> villageIds); |
| | | } |
| | |
| | | R getCivilDrawList(ScreenDrawEventListDTO eventListDTO); |
| | | |
| | | /** |
| | | * 新版绘制多边形统计数据 |
| | | * |
| | | * @param eventListDTO |
| | | * 请求参数 |
| | | * @return 统计数据 |
| | | */ |
| | | R getCivilDrawListNew(ScreenDrawEventListDTO eventListDTO); |
| | | |
| | | /** |
| | | * 大屏-根据小区id查询小区统计人数 |
| | | * |
| | | * @param villageId |
| | |
| | | * @return 网格员工作汇总数据 |
| | | */ |
| | | R gridMemberStatisticsAll(MemberStatisticsAdminDTO statisticsAdminDTO); |
| | | |
| | | /** |
| | | * 大屏-新根据小区id查询小区统计人数 |
| | | * |
| | | * @param villageId |
| | | * 小区id |
| | | * @return 小区统计数据 |
| | | */ |
| | | R civilVillageStatisticsNew(Long villageId); |
| | | } |
| | |
| | | |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | import com.panzhihua.common.model.vos.community.StatisticsCommVO; |
| | | import com.panzhihua.common.model.vos.community.bigscreen.GridsGovernanceStatisticsVO; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | |
| | | return R.ok(drawEventVO); |
| | | } |
| | | |
| | | @Override |
| | | public R getCivilDrawListNew(ScreenDrawEventListDTO eventListDTO) { |
| | | GridsGovernanceStatisticsVO statisticsVO = new GridsGovernanceStatisticsVO(); |
| | | // 返回事件列表结果集 |
| | | List<EventGridIncidentStatisticsVO> eventResultList = new ArrayList<>(); |
| | | // 返回小区列表结果集 |
| | | List<CivilVillageStatisticsVO> villageResultList = new ArrayList<>(); |
| | | // 返回人口统计 |
| | | ScreenDrawEventPopulationTotalVO drawEventPopulationTotalVO = new ScreenDrawEventPopulationTotalVO(); |
| | | //年龄段统计 |
| | | List<StatisticsCommVO> ageGroupStatistics = new ArrayList<>(); |
| | | // 查询所有事件 |
| | | List<EventGridIncidentStatisticsVO> gridIncidentList = |
| | | this.baseMapper.getGridsGovernanceEventList(eventListDTO.getCommunityId()); |
| | | if (!gridIncidentList.isEmpty()) { |
| | | gridIncidentList.forEach(gridIncident -> { |
| | | // 拆分事件经纬度 |
| | | Double lng = 0.0;// 经度 |
| | | Double lat = 0.0;// 纬度 |
| | | String[] lngLatString = gridIncident.getLatLng().split(","); |
| | | if (gridIncident.getEventType().equals(1)) { |
| | | lat = Double.parseDouble(lngLatString[0]); |
| | | lng = Double.parseDouble(lngLatString[1]); |
| | | } else { |
| | | lat = Double.parseDouble(lngLatString[1]); |
| | | lng = Double.parseDouble(lngLatString[0]); |
| | | } |
| | | // 判断绘制的图形类型 |
| | | if (eventListDTO.getType().equals(ScreenDrawEventListDTO.type.yx)) { |
| | | // 判断这个点是否在圆形范围内 |
| | | if (GisPointUtil.isInCircle(eventListDTO.getCenterLng(), eventListDTO.getCenterLat(), lng, lat, |
| | | eventListDTO.getRadius())) { |
| | | if (eventResultList.size() <= eventListDTO.getCount()) { |
| | | eventResultList.add(gridIncident); |
| | | } |
| | | countGridIncidentData(statisticsVO, gridIncident); |
| | | } |
| | | } else {// 多边形类型 |
| | | if (GisPointUtil.isInPolygon(lng, lat, eventListDTO.getLngLatList())) { |
| | | if (eventResultList.size() <= eventListDTO.getCount()) { |
| | | eventResultList.add(gridIncident); |
| | | } |
| | | countGridIncidentData(statisticsVO, gridIncident); |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | statisticsVO.setGridIncidentList(eventResultList); |
| | | // 查询所有小区 |
| | | List<CivilVillageStatisticsVO> villageStatisticsList = |
| | | this.baseMapper.getCivilScreenVillageList(eventListDTO.getCommunityId()); |
| | | if (!villageStatisticsList.isEmpty()) { |
| | | List<Long> villageIds = villageStatisticsList.stream().map(CivilVillageStatisticsVO::getVillageId).collect(Collectors.toList()); |
| | | ageGroupStatistics = this.baseMapper.selectStatisticsForAge(villageIds); |
| | | villageStatisticsList.forEach(village -> { |
| | | // 判断绘制的图形类型 |
| | | if (eventListDTO.getType().equals(ScreenDrawEventListDTO.type.yx)) { |
| | | // 判断这个点是否在圆形范围内 |
| | | if (GisPointUtil.isInCircle(eventListDTO.getCenterLng(), eventListDTO.getCenterLat(), |
| | | Double.parseDouble(village.getLng()), Double.parseDouble(village.getLat()), |
| | | eventListDTO.getRadius())) { |
| | | fillVillageResultList(villageResultList, drawEventPopulationTotalVO, village); |
| | | } |
| | | } else {// 多边形类型 |
| | | if (GisPointUtil.isInPolygon(Double.parseDouble(village.getLng()), |
| | | Double.parseDouble(village.getLat()), eventListDTO.getLngLatList())) { |
| | | fillVillageResultList(villageResultList, drawEventPopulationTotalVO, village); |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | statisticsVO.setVillageStatisticsList(villageResultList); |
| | | statisticsVO.setDrawEventPopulationTotalVO(drawEventPopulationTotalVO); |
| | | statisticsVO.setAgeGroupStatistics(ageGroupStatistics); |
| | | statisticsVO.generateStatisticsData(); |
| | | return R.ok(statisticsVO); |
| | | } |
| | | |
| | | private void fillVillageResultList(List<CivilVillageStatisticsVO> villageResultList, |
| | | ScreenDrawEventPopulationTotalVO drawEventPopulationTotalVO, CivilVillageStatisticsVO village) { |
| | | villageResultList.add(village); |
| | | ScreenDrawEventPopulationTotalVO populationTotalVO = |
| | | this.baseMapper.getVillagePopulationTotalNew(village.getVillageId()); |
| | | if (populationTotalVO != null) { |
| | | drawEventPopulationTotalVO.setVillageTotal(drawEventPopulationTotalVO.getVillageTotal() + 1); |
| | | drawEventPopulationTotalVO.setPopulationTotal(drawEventPopulationTotalVO.getPopulationTotal() + populationTotalVO.getPopulationTotal()); |
| | | drawEventPopulationTotalVO.setBuildTotal(drawEventPopulationTotalVO.getBuildTotal() + populationTotalVO.getBuildTotal()); |
| | | drawEventPopulationTotalVO.setHouseTotal(drawEventPopulationTotalVO.getHouseTotal() + populationTotalVO.getHouseTotal()); |
| | | drawEventPopulationTotalVO.setLocalTotal(drawEventPopulationTotalVO.getLocalTotal() + populationTotalVO.getLocalTotal()); |
| | | drawEventPopulationTotalVO.setOutTotal(drawEventPopulationTotalVO.getOutTotal() + populationTotalVO.getOutTotal()); |
| | | drawEventPopulationTotalVO.setDisabilityTotal(drawEventPopulationTotalVO.getDisabilityTotal() + populationTotalVO.getDisabilityTotal()); |
| | | drawEventPopulationTotalVO.setLowSecurityTotal(drawEventPopulationTotalVO.getLowSecurityTotal() + populationTotalVO.getLowSecurityTotal()); |
| | | drawEventPopulationTotalVO.setElderTotal(drawEventPopulationTotalVO.getElderTotal() + populationTotalVO.getElderTotal()); |
| | | drawEventPopulationTotalVO.setSpecialSituationTotal(drawEventPopulationTotalVO.getSpecialSituationTotal() + populationTotalVO.getSpecialSituationTotal()); |
| | | drawEventPopulationTotalVO.setOtherTotal(drawEventPopulationTotalVO.getOtherTotal() + populationTotalVO.getOtherTotal()); |
| | | drawEventPopulationTotalVO.setSpecialHelpTotal(drawEventPopulationTotalVO.getSpecialHelpTotal() + populationTotalVO.getSpecialHelpTotal()); |
| | | drawEventPopulationTotalVO.setVeteransTotal(drawEventPopulationTotalVO.getVeteransTotal() + populationTotalVO.getVeteransTotal()); |
| | | drawEventPopulationTotalVO.setOldTotal(drawEventPopulationTotalVO.getOldTotal() + populationTotalVO.getOldTotal()); |
| | | drawEventPopulationTotalVO.setPensionTotal(drawEventPopulationTotalVO.getPensionTotal() + populationTotalVO.getPensionTotal()); |
| | | drawEventPopulationTotalVO.setRentingHouseTotal(drawEventPopulationTotalVO.getRentingHouseTotal() + populationTotalVO.getRentingHouseTotal()); |
| | | drawEventPopulationTotalVO.setVolunteerTotal(drawEventPopulationTotalVO.getVolunteerTotal() + populationTotalVO.getVolunteerTotal()); |
| | | drawEventPopulationTotalVO.setAverageAge(drawEventPopulationTotalVO.getAverageAge() + populationTotalVO.getAverageAge()); |
| | | } |
| | | } |
| | | |
| | | private void countGridIncidentData(GridsGovernanceStatisticsVO statisticsVO, EventGridIncidentStatisticsVO gridIncident) { |
| | | switch (gridIncident.getType()) { |
| | | case 1: |
| | | statisticsVO.setEventZATotal(statisticsVO.getEventZATotal() + 1); |
| | | if (gridIncident.getStatus().equals(1)) { |
| | | statisticsVO.setEventZADeal(statisticsVO.getEventZADeal() + 1); |
| | | } |
| | | break; |
| | | case 2: |
| | | statisticsVO.setEventMSTotal(statisticsVO.getEventMSTotal() + 1); |
| | | if (gridIncident.getStatus().equals(1)) { |
| | | statisticsVO.setEventMSDeal(statisticsVO.getEventMSDeal() + 1); |
| | | } |
| | | break; |
| | | case 3: |
| | | statisticsVO.setEventMDTotal(statisticsVO.getEventMDTotal() + 1); |
| | | if (gridIncident.getStatus().equals(1)) { |
| | | statisticsVO.setEventMDDeal(statisticsVO.getEventMDDeal() + 1); |
| | | } |
| | | break; |
| | | case 5: |
| | | statisticsVO.setEventTFTotal(statisticsVO.getEventTFTotal() + 1); |
| | | if (gridIncident.getStatus().equals(1)) { |
| | | statisticsVO.setEventTFDeal(statisticsVO.getEventTFDeal() + 1); |
| | | } |
| | | break; |
| | | case 6: |
| | | statisticsVO.setEventTSTotal(statisticsVO.getEventTSTotal() + 1); |
| | | if (gridIncident.getStatus().equals(1)) { |
| | | statisticsVO.setEventTSDeal(statisticsVO.getEventTSDeal() + 1); |
| | | } |
| | | break; |
| | | case 9: |
| | | statisticsVO.setEventFJTotal(statisticsVO.getEventFJTotal() + 1); |
| | | if (gridIncident.getStatus().equals(1)) { |
| | | statisticsVO.setEventFJDeal(statisticsVO.getEventFJDeal() + 1); |
| | | } |
| | | break; |
| | | case 10: |
| | | statisticsVO.setOtherTotal(statisticsVO.getOtherTotal() + 1); |
| | | if (gridIncident.getStatus().equals(1)) { |
| | | statisticsVO.setOtherDeal(statisticsVO.getOtherDeal() + 1); |
| | | } |
| | | break; |
| | | default: |
| | | break; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 大屏-根据小区id查询小区统计人数 |
| | | * |
| | |
| | | public R gridMemberStatisticsAll(MemberStatisticsAdminDTO statisticsAdminDTO) { |
| | | return R.ok(eventGridMemberRelationMapper.gridMemberStatisticsAll(statisticsAdminDTO)); |
| | | } |
| | | |
| | | /** |
| | | * 大屏-新根据小区id查询小区统计人数 |
| | | * |
| | | * @param villageId |
| | | * 小区id |
| | | * @return 小区统计数据 |
| | | */ |
| | | @Override |
| | | public R civilVillageStatisticsNew(Long villageId) { |
| | | GridsGovernanceStatisticsVO statisticsVO = new GridsGovernanceStatisticsVO(); |
| | | List<Long> villageIds = new ArrayList<>(); |
| | | villageIds.add(villageId); |
| | | List<StatisticsCommVO> ageGroupStatistics = this.baseMapper.selectStatisticsForAge(villageIds); |
| | | ScreenDrawEventPopulationTotalVO populationTotalVO = this.baseMapper.getVillagePopulationTotalNew(villageId); |
| | | statisticsVO.setAgeGroupStatistics(ageGroupStatistics); |
| | | statisticsVO.setDrawEventPopulationTotalVO(populationTotalVO); |
| | | return R.ok(statisticsVO); |
| | | } |
| | | } |
| | |
| | | left join com_mng_population AS cmp on cmp.id = cmpct.population_id |
| | | where cmtct.label is not null and cmp.village_id = #{villageId} and floor = #{floor} |
| | | </select> |
| | | <select id="getGridsGovernanceEventList" |
| | | resultType="com.panzhihua.common.model.vos.community.screen.event.EventGridIncidentStatisticsVO"> |
| | | SELECT event_type AS type, IFNULL( NULL, 1 ) AS eventType, e.id AS eventId, happent_lat_lng AS latLng, event_des AS content, |
| | | (SELECT url FROM event_resource WHERE ref_id = e.id AND classification = 1 AND `type` = 1 LIMIT 1) AS cover, e.create_at, |
| | | CASE |
| | | WHEN event_deal_status = 4 THEN 1 |
| | | ELSE 2 END `status` |
| | | 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 IN ( 1, 2, 3, 5, 6 ) AND e.event_status = 2 AND egd.grid_community_id = #{communityId} |
| | | UNION ALL SELECT |
| | | CASE |
| | | WHEN classify_id = 4 THEN 1 |
| | | WHEN classify_id = 6 THEN 2 |
| | | WHEN classify_id = 5 THEN 3 |
| | | WHEN classify_id = 7 THEN 5 |
| | | WHEN classify_id = 3 THEN 6 |
| | | WHEN classify_id = 8 THEN 9 |
| | | WHEN classify_id = 1 THEN 10 |
| | | END type, IFNULL( NULL, 2 ) AS eventType, id AS eventId, lng_lat AS latLng, detail AS content, substring_index(photo_path_list, ',', 1) AS cover, create_at, |
| | | CASE |
| | | WHEN handle_status = 2 THEN 1 |
| | | ELSE 2 END `status` |
| | | FROM com_act_easy_photo WHERE community_id = #{communityId} AND `status` IN (1,2,4) AND del_tag = 0 AND classify_id IN (1,3,4,5,6,7,8) |
| | | </select> |
| | | <select id="getVillagePopulationTotalNew" |
| | | resultType="com.panzhihua.common.model.vos.screen.ScreenDrawEventPopulationTotalVO"> |
| | | SELECT |
| | | (SELECT count(id) FROM com_mng_population WHERE village_id = #{villageId}) as populationTotal, |
| | | (select count(id) from com_mng_building where village_id = #{villageId}) as buildTotal, |
| | | (SELECT COUNT(DISTINCT CONCAT(road,door_no,floor,unit_no,house_no)) FROM com_mng_population WHERE village_id = #{villageId}) as houseTotal, |
| | | (select count(id) from com_mng_population where village_id = #{villageId} and out_or_local = 1) as localTotal, |
| | | (select count(id) from com_mng_population where village_id = #{villageId} and out_or_local = 2) as outTotal, |
| | | (SELECT COUNT(t1.id) FROM com_disability_population t1 LEFT JOIN com_mng_population t2 ON t1.population_id = t2.id WHERE t2.village_id = #{villageId}) as disabilityTotal, |
| | | (SELECT COUNT(t1.id) FROM com_low_security_population t1 LEFT JOIN com_mng_population t2 ON t1.population_id = t2.id WHERE t2.village_id = #{villageId}) as lowSecurityTotal, |
| | | (SELECT COUNT(id) FROM com_mng_population WHERE village_id = #{villageId} AND TIMESTAMPDIFF(YEAR, SUBSTRING(card_no_str, 7, 8), NOW()) > 80) as elderTotal, |
| | | (SELECT COUNT(t1.id) FROM com_mng_population t1 LEFT JOIN com_mng_population_community_tags t2 ON t1.id = t2.population_id WHERE t1.village_id = #{villageId} AND t2.label LIKE '%特殊情况%') as specialSituationTotal, |
| | | (SELECT COUNT(id) FROM |
| | | (SELECT t1.id FROM com_drug_population t1 LEFT JOIN com_mng_population t2 ON t1.population_id = t2.id WHERE t2.village_id = #{villageId} |
| | | UNION ALL |
| | | SELECT t1.id FROM com_correct_population t1 LEFT JOIN com_mng_population t2 ON t1.population_id = t2.id WHERE t2.village_id = #{villageId} |
| | | UNION ALL |
| | | SELECT t1.id FROM com_cult_population t1 LEFT JOIN com_mng_population t2 ON t1.population_id = t2.id WHERE t2.village_id = #{villageId} |
| | | UNION ALL |
| | | SELECT t1.id FROM com_rehabilitation_population t1 LEFT JOIN com_mng_population t2 ON t1.population_id = t2.id WHERE t2.village_id = #{villageId} |
| | | UNION ALL |
| | | SELECT t1.id FROM com_key_population t1 LEFT JOIN com_mng_population t2 ON t1.population_id = t2.id WHERE t2.village_id = #{villageId} |
| | | UNION ALL |
| | | SELECT t1.id FROM com_major_population t1 LEFT JOIN com_mng_population t2 ON t1.population_id = t2.id WHERE t2.village_id = #{villageId} |
| | | ) temp) as otherTotal, |
| | | (SELECT COUNT(t1.id) FROM com_mng_population t1 LEFT JOIN com_mng_population_community_tags t2 ON t1.id = t2.population_id WHERE t1.village_id = #{villageId} AND t2.label LIKE '%特扶家庭%') as specialHelpTotal, |
| | | (SELECT COUNT(t1.id) FROM com_veterans_population t1 LEFT JOIN com_mng_population t2 ON t1.population_id = t2.id WHERE t2.village_id = #{villageId}) as veteransTotal, |
| | | (SELECT COUNT(id) FROM com_mng_population WHERE village_id = #{villageId} AND TIMESTAMPDIFF(YEAR, SUBSTRING(card_no_str, 7, 8), NOW()) > 60) as oldTotal, |
| | | (SELECT COUNT(t1.id) FROM com_pension_auth_pensioners t1 LEFT JOIN com_mng_population t2 ON t1.population_id = t2.id WHERE t2.village_id = #{villageId}) as pensionTotal, |
| | | (SELECT COUNT(id) FROM renting_hourse_register WHERE village_id = #{villageId} AND auth_status = 2) as rentingHouseTotal, |
| | | (SELECT COUNT(id) FROM com_mng_population t1 LEFT JOIN sys_user t2 ON t1.card_no_str = t2.id_card WHERE t1.village_id = #{villageId} AND t2.is_volunteer = 1) as volunteerTotal, |
| | | (SELECT ROUND(AVG(TIMESTAMPDIFF(YEAR, SUBSTRING(card_no_str, 7, 8), NOW()))) FROM com_mng_population) as averageAge |
| | | </select> |
| | | <select id="selectStatisticsForAge" resultType="com.panzhihua.common.model.vos.community.StatisticsCommVO"> |
| | | SELECT filed, SUM(num) AS num FROM ( |
| | | SELECT filed, COUNT(filed) AS num FROM ( |
| | | SELECT |
| | | CASE |
| | | WHEN TIMESTAMPDIFF(YEAR, SUBSTRING(card_no_str, 7, 8), NOW()) BETWEEN 0 AND 18 THEN '0-18岁' |
| | | WHEN TIMESTAMPDIFF(YEAR, SUBSTRING(card_no_str, 7, 8), NOW()) BETWEEN 19 AND 30 THEN '19-30岁' |
| | | WHEN TIMESTAMPDIFF(YEAR, SUBSTRING(card_no_str, 7, 8), NOW()) BETWEEN 31 AND 40 THEN '31-40岁' |
| | | WHEN TIMESTAMPDIFF(YEAR, SUBSTRING(card_no_str, 7, 8), NOW()) BETWEEN 41 AND 50 THEN '41-50岁' |
| | | WHEN TIMESTAMPDIFF(YEAR, SUBSTRING(card_no_str, 7, 8), NOW()) BETWEEN 51 AND 60 THEN '51-60岁' |
| | | WHEN TIMESTAMPDIFF(YEAR, SUBSTRING(card_no_str, 7, 8), NOW()) BETWEEN 61 AND 79 THEN '61-79岁' |
| | | WHEN TIMESTAMPDIFF(YEAR, SUBSTRING(card_no_str, 7, 8), NOW()) BETWEEN 80 AND 89 THEN '80-89岁' |
| | | WHEN TIMESTAMPDIFF(YEAR, SUBSTRING(card_no_str, 7, 8), NOW()) > 89 THEN '89岁以上' |
| | | END filed |
| | | FROM com_mng_population WHERE village_id IN |
| | | <foreach collection="villageIds" index="index" item="item" open="(" separator="," close=")"> |
| | | item |
| | | </foreach> |
| | | ) temp GROUP BY filed |
| | | UNION ALL |
| | | (SELECT '0-18岁' AS filed, 0 AS num) |
| | | UNION ALL |
| | | (SELECT '19-30岁' AS filed, 0 AS num) |
| | | UNION ALL |
| | | (SELECT '31-40岁' AS filed, 0 AS num) |
| | | UNION ALL |
| | | (SELECT '41-50岁' AS filed, 0 AS num) |
| | | UNION ALL |
| | | (SELECT '51-60岁' AS filed, 0 AS num) |
| | | UNION ALL |
| | | (SELECT '61-79岁' AS filed, 0 AS num) |
| | | UNION ALL |
| | | (SELECT '80-89岁' AS filed, 0 AS num) |
| | | UNION ALL |
| | | (SELECT '89岁以上' AS filed, 0 AS num) |
| | | ) t GROUP BY filed |
| | | </select> |
| | | |
| | | </mapper> |