huanghongfa
2021-07-22 956c53f7362ba31b2741d45160a500d53c2947e9
大屏根据绘制图形查询事件数据接口
9个文件已修改
5个文件已添加
569 ■■■■■ 已修改文件
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/community/bigscreen/event/ScreenDrawEventListDTO.java 43 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/community/bigscreen/event/ScreenDrawLngLatDTO.java 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/community/screen/event/EventGridIncidentStatisticsVO.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/community/screen/event/EventLeftDownStatisticsVO.java 28 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/screen/ScreenDrawEventPopulationTotalVO.java 56 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/screen/ScreenDrawEventVO.java 29 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/service/grid/GridService.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/utlis/GisPointUtil.java 121 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/community_backstage/src/main/java/com/panzhihua/community_backstage/api/BigScreenStatisticsApi.java 16 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_grid/src/main/java/com/panzhihua/service_grid/api/BigScreenApi.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_grid/src/main/java/com/panzhihua/service_grid/dao/EventMapper.java 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_grid/src/main/java/com/panzhihua/service_grid/service/EventService.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_grid/src/main/java/com/panzhihua/service_grid/service/impl/EventServiceImpl.java 187 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_grid/src/main/resources/mapper/EventMapper.xml 36 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/community/bigscreen/event/ScreenDrawEventListDTO.java
New file
@@ -0,0 +1,43 @@
package com.panzhihua.common.model.dtos.community.bigscreen.event;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotNull;
import java.util.List;
@Data
@ApiModel("大屏事件列表请求参数")
public class ScreenDrawEventListDTO {
    @ApiModelProperty(value = "最大展示事件数量",example = "100")
    private Integer count = 100;
    @ApiModelProperty(value = "社区id", example = "2", required = true)
    @NotNull(message = "社区id不能为空")
    private Long communityId;
    @ApiModelProperty(value = "多边形类型(1.圆形 2.多边形)")
    private Integer type;
    @ApiModelProperty(value = "圆心坐标经度")
    private Double centerLng;
    @ApiModelProperty(value = "圆心坐标纬度")
    private Double centerLat;
    @ApiModelProperty(value = "圆心半径")
    private String radius;
    @ApiModelProperty(value = "多边形经纬度列表")
    private List<ScreenDrawLngLatDTO> lngLatList;
    /**
     * 多边形类型(1.圆形 2.多边形)
     */
    public interface type{
        int yx = 1;
        int dbx = 2;
    }
}
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/community/bigscreen/event/ScreenDrawLngLatDTO.java
New file
@@ -0,0 +1,19 @@
package com.panzhihua.common.model.dtos.community.bigscreen.event;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotNull;
@Data
@ApiModel("经纬度参数")
public class ScreenDrawLngLatDTO {
    @ApiModelProperty(value = "经度")
    private Double lng;
    @ApiModelProperty(value = "纬度")
    private Double lat;
}
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/community/screen/event/EventGridIncidentStatisticsVO.java
@@ -20,4 +20,7 @@
    @ApiModelProperty("事件发生经纬度")
    private String latLng;
    @ApiModelProperty("处理状态")
    private Integer status;
}
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/community/screen/event/EventLeftDownStatisticsVO.java
@@ -11,46 +11,46 @@
public class EventLeftDownStatisticsVO {
    @ApiModelProperty("治安隐患事件总数")
    private Integer eventZATotal;
    private Integer eventZATotal = 0;
    @ApiModelProperty("治安隐患已完成事件总数")
    private Integer yesEventZATotal;
    private Integer yesEventZATotal = 0;
    @ApiModelProperty("突发事件总数")
    private Integer eventTFTotal;
    private Integer eventTFTotal = 0;
    @ApiModelProperty("突发事件已完成总数")
    private Integer yesEventTFTotal;
    private Integer yesEventTFTotal = 0;
    @ApiModelProperty("特殊人群信息上报总数")
    private Integer eventTSTotal;
    private Integer eventTSTotal = 0;
    @ApiModelProperty("特殊人群信息上报已完成事件总数")
    private Integer yesEventTSTotal;
    private Integer yesEventTSTotal = 0;
    @ApiModelProperty("矛盾纠纷事件总数")
    private Integer eventMDTotal;
    private Integer eventMDTotal = 0;
    @ApiModelProperty("矛盾纠纷已完成事件总数")
    private Integer yesEventMDTotal;
    private Integer yesEventMDTotal = 0;
    @ApiModelProperty("不稳定因素事件总数")
    private Integer eventBWDTotal;
    private Integer eventBWDTotal = 0;
    @ApiModelProperty("不稳定因素已完成事件总数")
    private Integer yesEventBWDTotal;
    private Integer yesEventBWDTotal = 0;
    @ApiModelProperty("公共服务事件总数")
    private Integer eventGGTotal;
    private Integer eventGGTotal = 0;
    @ApiModelProperty("公共服务已完成事件总数")
    private Integer yesEventGGTotal;
    private Integer yesEventGGTotal = 0;
    @ApiModelProperty("随手拍总数")
    private Integer eventSSPTotal;
    private Integer eventSSPTotal = 0;
    @ApiModelProperty("随手拍已完成总数")
    private Integer yesEventSSPTotal;
    private Integer yesEventSSPTotal = 0;
    
}
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/screen/ScreenDrawEventPopulationTotalVO.java
New file
@@ -0,0 +1,56 @@
package com.panzhihua.common.model.vos.screen;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
 * 实有人口统计返回参数
 */
@Data
@ApiModel("实有人口统计返回参数")
public class ScreenDrawEventPopulationTotalVO {
    @ApiModelProperty("居民总数")
    private Integer populationTotal = 0;
    @ApiModelProperty("户籍人口")
    private Integer localTotal = 0;
    @ApiModelProperty("流动人口")
    private Integer outTotal = 0;
    @ApiModelProperty("其他人员")
    private Integer specialTotal = 0;
    @ApiModelProperty("小区数")
    private Integer villageTotal = 0;
    @ApiModelProperty("楼栋数")
    private Integer buildTotal = 0;
    @ApiModelProperty("居民小组长")
    private Integer JMXZZTotal = 8;
    @ApiModelProperty("楼栋长")
    private Integer LDZTotal = 28;
    @ApiModelProperty("党小组长")
    private Integer DXZZTotal = 10;
    @ApiModelProperty("妇女小组长")
    private Integer FNXZZTotal = 7;
    @ApiModelProperty("卫生员")
    private Integer WSYTotal = 7;
    @ApiModelProperty("监督员")
    private Integer JDYTotal = 7;
    @ApiModelProperty("安全员")
    private Integer AQYTotal = 7;
    @ApiModelProperty("网格员")
    private Integer WGYTotal = 6;
}
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/screen/ScreenDrawEventVO.java
New file
@@ -0,0 +1,29 @@
package com.panzhihua.common.model.vos.screen;
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.EventLeftDownStatisticsVO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
@Data
@ApiModel("大屏绘制多边形返回参数")
public class ScreenDrawEventVO {
    @ApiModelProperty("社区事件数据")
    private List<EventGridIncidentStatisticsVO> gridIncidentList;
    @ApiModelProperty("小区列表数据")
    private List<CivilVillageStatisticsVO> villageStatisticsList;
    @ApiModelProperty("人数统计数据")
    private ScreenDrawEventPopulationTotalVO drawEventPopulationTotalVO;
    @ApiModelProperty("事件数量统计数据")
    private EventLeftDownStatisticsVO leftDownStatisticsVO;
}
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/service/grid/GridService.java
@@ -1,6 +1,7 @@
package com.panzhihua.common.service.grid;
import com.panzhihua.common.model.dtos.IdDTO;
import com.panzhihua.common.model.dtos.community.bigscreen.event.ScreenDrawEventListDTO;
import com.panzhihua.common.model.dtos.community.bigscreen.event.ScreenEventListDTO;
import com.panzhihua.common.model.dtos.grid.*;
import com.panzhihua.common.model.dtos.grid.admin.EventGridMemberCascadeAddDTO;
@@ -1240,4 +1241,12 @@
     */
    @PostMapping("/map/getMapGridsListsByApp")
    R getMapGridsListsByApp(@RequestParam("userId") Long userId);
    /**
     * 绘制多边形统计数据
     * @param eventListDTO  请求参数
     * @return  统计数据
     */
    @PostMapping("/screen/getCivilDrawList")
    R getCivilDrawList(@RequestBody ScreenDrawEventListDTO eventListDTO);
}
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/utlis/GisPointUtil.java
New file
@@ -0,0 +1,121 @@
package com.panzhihua.common.utlis;
import java.awt.Point;
import java.awt.geom.Point2D;
import java.util.ArrayList;
import java.util.List;
import com.alibaba.fastjson.JSONArray;
import com.panzhihua.common.model.dtos.community.bigscreen.event.ScreenDrawLngLatDTO;
/**
 * 判断坐标点位置状态
 */
public class GisPointUtil {
    private static double EARTH_RADIUS = 6378137d;
    private static double rad(double d) {
        return d * Math.PI / 180.0;
    }
    /**
     * 通过经纬度获取距离(单位:米)
     *
     * @param lat1
     * @param lng1
     * @param lat2
     * @param lng2
     * @return
     */
    public static double getDistance(double lat1, double lng1, double lat2,
                                     double lng2) {
        double radLat1 = rad(lat1);
        double radLat2 = rad(lat2);
        double a = radLat1 - radLat2;
        double b = rad(lng1) - rad(lng2);
        double s = 2 * Math.asin(Math.sqrt(Math.pow(Math.sin(a / 2), 2) +
                Math.cos(radLat1) * Math.cos(radLat2) * Math.pow(Math.sin(b / 2), 2)));
        s = s * EARTH_RADIUS;
        s = Math.round(s * 10000d) / 10000d;
        return s;
    }
    /**
     * 判断一个点是否在圆形区域内
     * @param radius 半径
     * @param lat1  圆心纬度
     * @param lng1  圆心经度
     * @param lat2  坐标纬度
     * @param lng2  坐标经度
     */
    public static boolean isInCircle(double lng1, double lat1, double lng2, double lat2, String radius) {
        return getDistance(lat1, lng1, lat2, lng2) < Double.parseDouble(radius);
    }
    /**
     * 判断是否在多边形区域内
     *
     * @param pointLon
     *            要判断的点的纵坐标
     * @param pointLat
     *            要判断的点的横坐标
//     * @param lon
     *            区域各顶点的纵坐标数组
//     * @param lat
     *            区域各顶点的横坐标数组
     * @return
     */
    public static boolean isInPolygon(double pointLon, double pointLat, List<ScreenDrawLngLatDTO> lngLatList) {
        // 将要判断的横纵坐标组成一个点
        Point2D.Double point = new Point.Double(pointLon, pointLat);
        // 将区域各顶点的横纵坐标放到一个点集合里面
        List<Point2D.Double> pointList = new ArrayList<Point2D.Double>();
        double polygonPoint_x = 0.0, polygonPoint_y = 0.0;
        int len = lngLatList.size();
        for (int i = 0; i < len; i++) {
            polygonPoint_x = lngLatList.get(i).getLng();
            polygonPoint_y = lngLatList.get(i).getLat();
            Point2D.Double polygonPoint = new Point2D.Double(polygonPoint_x, polygonPoint_y);
            pointList.add(polygonPoint);
        }
        return check(point, pointList);
    }
    /**
     * 一个点是否在多边形内
     *
     * @param point
     *            要判断的点的横纵坐标
     * @param polygon
     *            组成的顶点坐标集合
     * @return
     */
    private static boolean check(Point2D.Double point, List<Point2D.Double> polygon) {
        java.awt.geom.GeneralPath peneralPath = new java.awt.geom.GeneralPath();
        Point2D.Double first = polygon.get(0);
        // 通过移动到指定坐标(以双精度指定),将一个点添加到路径中
        peneralPath.moveTo(first.x, first.y);
        polygon.remove(0);
        for (Point2D.Double d : polygon) {
            // 通过绘制一条从当前坐标到新指定坐标(以双精度指定)的直线,将一个点添加到路径中。
            peneralPath.lineTo(d.x, d.y);
        }
        // 将几何多边形封闭
        peneralPath.lineTo(first.x, first.y);
        peneralPath.closePath();
        // 测试指定的 Point2D 是否在 Shape 的边界内。
        return peneralPath.contains(point);
    }
    public static void main(String[] args) {
//        String points = "[{\"sets\":[{\"name\":\"sswg\",\"value\":\"402881f6681232c00168129b896e0078\"}],\"where\":[{\"name\":\"id\",\"value\":3231735,\"type\":\"=\"}]},{\"sets\":[{\"name\":\"sswg\",\"value\":\"000000006817dd6f0168313b9b89049a\"}],\"where\":[{\"name\":\"id\",\"value\":3231735,\"type\":\"=\"}]}]";
//        JSONArray pointArray = (JSONArray)JSONArray.parse(points);
//        System.out.println(isInPolygon(120.636514,31.341752, pointArray));
//        String points = "[{\"x\":120.61123416,\"y\":31.32889074,\"z\":137.05},{\"x\":120.61312695,\"y\":31.31892631,\"z\":128.61},{\"x\":120.61455616,\"y\":31.30808702,\"z\":43.66},{\"x\":120.62127327,\"y\":31.30899876,\"z\":62.21},{\"x\":120.63003506,\"y\":31.31057071,\"z\":29.43},{\"x\":120.63726235,\"y\":31.31203339,\"z\":92.90},{\"x\":120.64536616,\"y\":31.31334188,\"z\":78.36},{\"x\":120.64402082,\"y\":31.31947999,\"z\":13.19},{\"x\":120.64136126,\"y\":31.32757908,\"z\":87.36},{\"x\":120.63689776,\"y\":31.33287239,\"z\":60.62},{\"x\":120.63502091,\"y\":31.33742080,\"z\":114.21},{\"x\":120.63071787,\"y\":31.33793104,\"z\":32.99},{\"x\":120.62952446,\"y\":31.34483170,\"z\":164.79},{\"x\":120.62710968,\"y\":31.34801804,\"z\":164.15},{\"x\":120.62731359,\"y\":31.34823458,\"z\":189.53},{\"x\":120.62700980,\"y\":31.34894193,\"z\":194.24},{\"x\":120.62700980,\"y\":31.34894193,\"z\":194.24},{\"x\":120.62700980,\"y\":31.34894193,\"z\":194.24},{\"x\":120.62665860,\"y\":31.34861797,\"z\":155.41},{\"x\":120.61706620,\"y\":31.34846463,\"z\":200.05},{\"x\":120.61854348,\"y\":31.34267516,\"z\":138.68},{\"x\":120.62111689,\"y\":31.33313042,\"z\":154.61}]";
//        JSONArray pointArray = (JSONArray)JSONArray.parse(points);
//        System.out.println(isInPolygon(120.66615036,31.33525453, pointArray));//不在范围内
//        System.out.println(isInPolygon(120.62171413,31.32044689, pointArray));//在范围内
    }
}
springcloud_k8s_panzhihuazhihuishequ/community_backstage/src/main/java/com/panzhihua/community_backstage/api/BigScreenStatisticsApi.java
@@ -2,14 +2,13 @@
import com.panzhihua.common.model.dtos.community.bigscreen.BigScreenEventDTO;
import com.panzhihua.common.model.dtos.community.bigscreen.BigScreenEventDetailDTO;
import com.panzhihua.common.model.dtos.community.bigscreen.event.ScreenDrawEventListDTO;
import com.panzhihua.common.model.dtos.community.bigscreen.event.ScreenEventListDTO;
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;
import com.panzhihua.common.model.vos.community.screen.event.EventListVO;
import com.panzhihua.common.model.vos.community.screen.event.EventNewStatisticsVO;
import com.panzhihua.common.model.vos.community.screen.event.EventStatisticsVO;
import com.panzhihua.common.model.vos.community.screen.event.*;
import com.panzhihua.common.model.vos.community.screen.index.IndexStatisticsVO;
import com.panzhihua.common.model.vos.screen.ScreenDrawEventVO;
import com.panzhihua.common.service.community.CommunityService;
import com.panzhihua.common.service.grid.GridService;
import io.swagger.annotations.Api;
@@ -89,4 +88,13 @@
        }
        return gridService.getScreenEventList(eventListDTO);
    }
    @ApiOperation(value = "事件大屏画圈展示事件坐标点接口@lyq",response = ScreenDrawEventVO.class)
    @PostMapping("/civil/draw/list/noToken")
    public R civilDrawList(@RequestBody ScreenDrawEventListDTO eventListDTO) {
        if(eventListDTO.getCommunityId() == null){
            return R.fail("参数错误");
        }
        return gridService.getCivilDrawList(eventListDTO);
    }
}
springcloud_k8s_panzhihuazhihuishequ/service_grid/src/main/java/com/panzhihua/service_grid/api/BigScreenApi.java
@@ -1,6 +1,7 @@
package com.panzhihua.service_grid.api;
import com.panzhihua.common.controller.BaseController;
import com.panzhihua.common.model.dtos.community.bigscreen.event.ScreenDrawEventListDTO;
import com.panzhihua.common.model.dtos.community.bigscreen.event.ScreenEventListDTO;
import com.panzhihua.common.model.vos.R;
import com.panzhihua.service_grid.service.EventService;
@@ -44,4 +45,9 @@
        return eventService.eventWork(communityId);
    }
    @PostMapping("/getCivilDrawList")
    public R getCivilDrawList(@RequestBody ScreenDrawEventListDTO eventListDTO) {
        return eventService.getCivilDrawList(eventListDTO);
    }
}
springcloud_k8s_panzhihuazhihuishequ/service_grid/src/main/java/com/panzhihua/service_grid/dao/EventMapper.java
@@ -6,12 +6,11 @@
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.panzhihua.common.model.dtos.community.bigscreen.event.ScreenEventListDTO;
import com.panzhihua.common.model.dtos.grid.*;
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.EventListVO;
import com.panzhihua.common.model.vos.grid.*;
import com.panzhihua.common.model.vos.screen.DateScreenVO;
import com.panzhihua.common.model.vos.screen.EventDetailWorkVO;
import com.panzhihua.common.model.vos.screen.EventTypeWorkVO;
import com.panzhihua.common.model.vos.screen.EventWorkVO;
import com.panzhihua.common.model.vos.screen.*;
import com.panzhihua.service_grid.model.dos.EventDO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@@ -132,4 +131,10 @@
    EventTypeWorkVO getNoComplete(@Param("communityId") Long communityId);
    Map<String,Long> getSSPEventTotal(@Param("communityId") Long communityId);
    List<EventGridIncidentStatisticsVO> getEventListByCommunityId(@Param("communityId") Long communityId);
    List<CivilVillageStatisticsVO> getCivilScreenVillageList(@Param("communityId") Long communityId);
    ScreenDrawEventPopulationTotalVO getVillagePopulationTotal(@Param("villageId") Long villageId);
}
springcloud_k8s_panzhihuazhihuishequ/service_grid/src/main/java/com/panzhihua/service_grid/service/EventService.java
@@ -2,6 +2,7 @@
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.panzhihua.common.model.dtos.community.bigscreen.event.ScreenDrawEventListDTO;
import com.panzhihua.common.model.dtos.community.bigscreen.event.ScreenEventListDTO;
import com.panzhihua.common.model.dtos.grid.*;
import com.panzhihua.common.model.vos.R;
@@ -275,4 +276,6 @@
    Boolean updateLcUploadFlag(Long id);
    R eventWork(Long communityId);
    R getCivilDrawList(ScreenDrawEventListDTO eventListDTO);
}
springcloud_k8s_panzhihuazhihuishequ/service_grid/src/main/java/com/panzhihua/service_grid/service/impl/EventServiceImpl.java
@@ -12,15 +12,20 @@
import com.panzhihua.common.enums.EventType;
import com.panzhihua.common.exceptions.ServiceException;
import com.panzhihua.common.model.dtos.community.ComMngPopulationDTO;
import com.panzhihua.common.model.dtos.community.bigscreen.event.ScreenDrawEventListDTO;
import com.panzhihua.common.model.dtos.community.bigscreen.event.ScreenEventListDTO;
import com.panzhihua.common.model.dtos.grid.*;
import com.panzhihua.common.model.vos.R;
import com.panzhihua.common.model.vos.community.ComActVO;
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.EventLeftDownStatisticsVO;
import com.panzhihua.common.model.vos.community.screen.event.EventListVO;
import com.panzhihua.common.model.vos.grid.*;
import com.panzhihua.common.model.vos.screen.*;
import com.panzhihua.common.service.community.CommunityService;
import com.panzhihua.common.utlis.DateUtils;
import com.panzhihua.common.utlis.GisPointUtil;
import com.panzhihua.common.utlis.LngLatUtils;
import com.panzhihua.common.utlis.StringUtils;
import com.panzhihua.service_grid.dao.*;
@@ -2268,6 +2273,7 @@
        return false;
    }
    @Override
    public R eventWork(Long communityId){
        EventWorkScreenVO workScreenVO = new EventWorkScreenVO();
        String date = DateUtils.getDateFormatString(new Date(),moth_format_str);
@@ -2347,4 +2353,185 @@
        }
        return dateList;
    }
    @Override
    public R getCivilDrawList(ScreenDrawEventListDTO eventListDTO){
        ScreenDrawEventVO drawEventVO = new ScreenDrawEventVO();
        //返回事件列表结果集
        List<EventGridIncidentStatisticsVO> eventResultList = new ArrayList<>();
        //返回小区列表结果集
        List<CivilVillageStatisticsVO> villageResultList = new ArrayList<>();
        //返回事件统计
        EventLeftDownStatisticsVO leftDownStatisticsVO = new EventLeftDownStatisticsVO();
        //返回人口统计
        ScreenDrawEventPopulationTotalVO drawEventPopulationTotalVO = new ScreenDrawEventPopulationTotalVO();
        //查询所有事件
        List<EventGridIncidentStatisticsVO> gridIncidentList = this.baseMapper.getEventListByCommunityId(eventListDTO.getCommunityId());
        if(!gridIncidentList.isEmpty()){
            gridIncidentList.forEach(gridIncident -> {
                //拆分事件经纬度
                Double lng = 0.0;//经度
                Double lat = 0.0;//纬度
                String []lngLatString = gridIncident.getLatLng().split(",");
                if(!gridIncident.getType().equals(7)){
                    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);
                        }
                    switch (gridIncident.getType()){
                            case 1:
                                leftDownStatisticsVO.setEventZATotal(leftDownStatisticsVO.getEventZATotal() + 1);
                                if(gridIncident.getStatus().equals(4)){
                                    leftDownStatisticsVO.setYesEventZATotal(leftDownStatisticsVO.getYesEventZATotal() + 1);
                                }
                                break;
                            case 2:
                                leftDownStatisticsVO.setEventGGTotal(leftDownStatisticsVO.getEventGGTotal() + 1);
                                if(gridIncident.getStatus().equals(4)){
                                    leftDownStatisticsVO.setYesEventGGTotal(leftDownStatisticsVO.getYesEventGGTotal() + 1);
                                }
                                break;
                            case 3:
                                leftDownStatisticsVO.setEventMDTotal(leftDownStatisticsVO.getEventMDTotal() + 1);
                                if(gridIncident.getStatus().equals(4)){
                                    leftDownStatisticsVO.setYesEventMDTotal(leftDownStatisticsVO.getYesEventMDTotal() + 1);
                                }
                                break;
                            case 4:
                                leftDownStatisticsVO.setEventBWDTotal(leftDownStatisticsVO.getEventBWDTotal() + 1);
                                if(gridIncident.getStatus().equals(4)){
                                    leftDownStatisticsVO.setYesEventBWDTotal(leftDownStatisticsVO.getYesEventBWDTotal() + 1);
                                }
                                break;
                            case 5:
                                leftDownStatisticsVO.setEventTFTotal(leftDownStatisticsVO.getEventTFTotal() + 1);
                                if(gridIncident.getStatus().equals(4)){
                                    leftDownStatisticsVO.setYesEventTFTotal(leftDownStatisticsVO.getYesEventTFTotal() + 1);
                                }
                                break;
                            case 6:
                                leftDownStatisticsVO.setEventTSTotal(leftDownStatisticsVO.getEventTSTotal() + 1);
                                if(gridIncident.getStatus().equals(4)){
                                    leftDownStatisticsVO.setYesEventTSTotal(leftDownStatisticsVO.getYesEventTSTotal() + 1);
                                }
                                break;
                            case 7:
                                leftDownStatisticsVO.setEventSSPTotal(leftDownStatisticsVO.getEventSSPTotal() + 1);
                                if(gridIncident.getStatus().equals(2)){
                                    leftDownStatisticsVO.setYesEventSSPTotal(leftDownStatisticsVO.getYesEventSSPTotal() + 1);
                                }
                                break;
                            default:
                                break;
                        }
                    }
                }else{//多边形类型
                    if(GisPointUtil.isInPolygon(lng,lat,eventListDTO.getLngLatList())){
                        if(eventResultList.size() <= eventListDTO.getCount()){
                            eventResultList.add(gridIncident);
                        }
                        switch (gridIncident.getType()){
                            case 1:
                                leftDownStatisticsVO.setEventZATotal(leftDownStatisticsVO.getEventZATotal() + 1);
                                if(gridIncident.getStatus().equals(4)){
                                    leftDownStatisticsVO.setYesEventZATotal(leftDownStatisticsVO.getYesEventZATotal() + 1);
                                }
                                break;
                            case 2:
                                leftDownStatisticsVO.setEventGGTotal(leftDownStatisticsVO.getEventGGTotal() + 1);
                                if(gridIncident.getStatus().equals(4)){
                                    leftDownStatisticsVO.setYesEventGGTotal(leftDownStatisticsVO.getYesEventGGTotal() + 1);
                                }
                                break;
                            case 3:
                                leftDownStatisticsVO.setEventMDTotal(leftDownStatisticsVO.getEventMDTotal() + 1);
                                if(gridIncident.getStatus().equals(4)){
                                    leftDownStatisticsVO.setYesEventMDTotal(leftDownStatisticsVO.getYesEventMDTotal() + 1);
                                }
                                break;
                            case 4:
                                leftDownStatisticsVO.setEventBWDTotal(leftDownStatisticsVO.getEventBWDTotal() + 1);
                                if(gridIncident.getStatus().equals(4)){
                                    leftDownStatisticsVO.setYesEventBWDTotal(leftDownStatisticsVO.getYesEventBWDTotal() + 1);
                                }
                                break;
                            case 5:
                                leftDownStatisticsVO.setEventTFTotal(leftDownStatisticsVO.getEventTFTotal() + 1);
                                if(gridIncident.getStatus().equals(4)){
                                    leftDownStatisticsVO.setYesEventTFTotal(leftDownStatisticsVO.getYesEventTFTotal() + 1);
                                }
                                break;
                            case 6:
                                leftDownStatisticsVO.setEventTSTotal(leftDownStatisticsVO.getEventTSTotal() + 1);
                                if(gridIncident.getStatus().equals(4)){
                                    leftDownStatisticsVO.setYesEventTSTotal(leftDownStatisticsVO.getYesEventTSTotal() + 1);
                                }
                                break;
                            case 7:
                                leftDownStatisticsVO.setEventSSPTotal(leftDownStatisticsVO.getEventSSPTotal() + 1);
                                if(gridIncident.getStatus().equals(2)){
                                    leftDownStatisticsVO.setYesEventSSPTotal(leftDownStatisticsVO.getYesEventSSPTotal() + 1);
                                }
                                break;
                            default:
                                break;
                        }
                    }
                }
            });
        }
        drawEventVO.setGridIncidentList(eventResultList);
        drawEventVO.setLeftDownStatisticsVO(leftDownStatisticsVO);
        //查询所有小区
        List<CivilVillageStatisticsVO> villageStatisticsList = this.baseMapper.getCivilScreenVillageList(eventListDTO.getCommunityId());
        if(!villageStatisticsList.isEmpty()){
            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())){
                        villageResultList.add(village);
                        ScreenDrawEventPopulationTotalVO populationTotalVO = this.baseMapper.getVillagePopulationTotal(village.getVillageId());
                        if(populationTotalVO != null){
                            drawEventPopulationTotalVO.setVillageTotal(drawEventPopulationTotalVO.getVillageTotal() + 1);
                            drawEventPopulationTotalVO.setPopulationTotal(drawEventPopulationTotalVO.getPopulationTotal() + populationTotalVO.getPopulationTotal());
                            drawEventPopulationTotalVO.setLocalTotal(drawEventPopulationTotalVO.getLocalTotal() + populationTotalVO.getLocalTotal());
                            drawEventPopulationTotalVO.setOutTotal(drawEventPopulationTotalVO.getOutTotal() + populationTotalVO.getOutTotal());
                            drawEventPopulationTotalVO.setSpecialTotal(drawEventPopulationTotalVO.getSpecialTotal() + populationTotalVO.getSpecialTotal());
                            drawEventPopulationTotalVO.setBuildTotal(drawEventPopulationTotalVO.getBuildTotal() + populationTotalVO.getBuildTotal());
                        }
                    }
                }else {//多边形类型
                    if(GisPointUtil.isInPolygon(Double.parseDouble(village.getLng()),Double.parseDouble(village.getLat()),eventListDTO.getLngLatList())){
                        villageResultList.add(village);
                        ScreenDrawEventPopulationTotalVO populationTotalVO = this.baseMapper.getVillagePopulationTotal(village.getVillageId());
                        if(populationTotalVO != null){
                            drawEventPopulationTotalVO.setVillageTotal(drawEventPopulationTotalVO.getVillageTotal() + 1);
                            drawEventPopulationTotalVO.setPopulationTotal(drawEventPopulationTotalVO.getPopulationTotal() + populationTotalVO.getPopulationTotal());
                            drawEventPopulationTotalVO.setLocalTotal(drawEventPopulationTotalVO.getLocalTotal() + populationTotalVO.getLocalTotal());
                            drawEventPopulationTotalVO.setOutTotal(drawEventPopulationTotalVO.getOutTotal() + populationTotalVO.getOutTotal());
                            drawEventPopulationTotalVO.setSpecialTotal(drawEventPopulationTotalVO.getSpecialTotal() + populationTotalVO.getSpecialTotal());
                            drawEventPopulationTotalVO.setBuildTotal(drawEventPopulationTotalVO.getBuildTotal() + populationTotalVO.getBuildTotal());
                        }
                    }
                }
            });
        }
        drawEventVO.setVillageStatisticsList(villageResultList);
        drawEventVO.setDrawEventPopulationTotalVO(drawEventPopulationTotalVO);
        return R.ok(drawEventVO);
    }
}
springcloud_k8s_panzhihuazhihuishequ/service_grid/src/main/resources/mapper/EventMapper.xml
@@ -1315,4 +1315,40 @@
            AND community_id = #{communityId}
    </select>
    <select id="getEventListByCommunityId" parameterType="Long"
            resultType="com.panzhihua.common.model.vos.community.screen.event.EventGridIncidentStatisticsVO">
        SELECT
            e.id,
            e.event_type AS type,
            e.happent_lat_lng AS latLng,
            e.event_deal_status as 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_status = 2
            AND egd.grid_community_id = #{communityId}
            AND e.event_deal_status IN (1,2,3,4)
            union all
            select id,7 as type,lng_lat as latLng,handle_status as status from com_act_easy_photo as caep where community_id = #{communityId} and lng_lat is not null
    </select>
    <select id="getCivilScreenVillageList" parameterType="Long"  resultType="com.panzhihua.common.model.vos.community.screen.civil.CivilVillageStatisticsVO">
        SELECT `NAME`,  user_sum,  lng,  lat,  village_images,  village_id  FROM  com_mng_village AS cmv  WHERE  community_id = #{communityId}
    </select>
    <select id="getVillagePopulationTotal" parameterType="Long" resultType="com.panzhihua.common.model.vos.screen.ScreenDrawEventPopulationTotalVO">
        SELECT
            count( id ) as populationTotal,
            (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 localTotal,
            (select count(id) from com_mng_population where village_id = #{villageId} and label is not null) as specialTotal,
            (select count(id) from com_mng_building where village_id = #{villageId}) as buildTotal
        FROM
            com_mng_population AS cmp
        WHERE
            village_id = #{villageId}
    </select>
</mapper>