CeDo
2021-06-07 67b9a654ef3dc38366962e8ea867fc291dcdcdd0
Merge remote-tracking branch 'origin/test_future_wangge' into test_future_wangge

# Conflicts:
# springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/service/grid/GridService.java
# springcloud_k8s_panzhihuazhihuishequ/service_grid/src/main/java/com/panzhihua/service_grid/service/EventService.java
11个文件已修改
4个文件已添加
649 ■■■■■ 已修改文件
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/grid/GridEventStatisticsDTO.java 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/grid/GridEventStatisticsDetailVO.java 71 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/grid/GridEventStatisticsVO.java 37 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/grid/GridMemberPositionDTO.java 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/service/grid/GridService.java 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/grid_app/src/main/java/com/panzhihua/grid_app/api/StatisticsApi.java 21 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/grid_app/src/main/java/com/panzhihua/grid_app/api/UserApi.java 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_grid/src/main/java/com/panzhihua/service_grid/api/EventGridMemberGpsLogApi.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_grid/src/main/java/com/panzhihua/service_grid/api/StatisticsApi.java 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_grid/src/main/java/com/panzhihua/service_grid/dao/EventMapper.java 19 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_grid/src/main/java/com/panzhihua/service_grid/service/EventGridMemberGpsLogService.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_grid/src/main/java/com/panzhihua/service_grid/service/EventService.java 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_grid/src/main/java/com/panzhihua/service_grid/service/impl/EventGridMemberGpsLogServiceImpl.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_grid/src/main/java/com/panzhihua/service_grid/service/impl/EventServiceImpl.java 48 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_grid/src/main/resources/mapper/EventMapper.xml 313 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/grid/GridEventStatisticsDTO.java
New file
@@ -0,0 +1,19 @@
package com.panzhihua.common.model.dtos.grid;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
@ApiModel("统计模块-网格事件统计请求参数")
public class GridEventStatisticsDTO {
    @ApiModelProperty("网格id")
    private Long gridId;
    @ApiModelProperty("查询开始时间")
    private String startTime;
    @ApiModelProperty("查询结束时间")
    private String endTime;
}
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/grid/GridEventStatisticsDetailVO.java
New file
@@ -0,0 +1,71 @@
package com.panzhihua.common.model.vos.grid;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
 * 地图模块-网格事件统计数据
 */
@Data
@ApiModel("统计模块-网格事件统计数据")
public class GridEventStatisticsDetailVO {
    @ApiModelProperty("总完成数量")
    private Integer sum = 0;
    @ApiModelProperty("总未完成数量")
    private Integer noSum = 0;
    @ApiModelProperty("突发事件完成数量")
    private Integer eventTFTotal = 0;
    @ApiModelProperty("突发事件未完成数量")
    private Integer noEventTFTotal = 0;
    @ApiModelProperty("矛盾纠纷完成数量")
    private Integer eventMDTotal = 0;
    @ApiModelProperty("矛盾纠纷未完成数量")
    private Integer noEventMDTotal = 0;
    @ApiModelProperty("治安隐患完成数量")
    private Integer eventZATotal = 0;
    @ApiModelProperty("治安隐患未完成数量")
    private Integer noEventZATotal = 0;
    @ApiModelProperty("不稳定因素完成数量")
    private Integer eventBWDTotal = 0;
    @ApiModelProperty("不稳定因素未完成数量")
    private Integer noEventBWDTotal = 0;
    @ApiModelProperty("特殊人员上报完成数量")
    private Integer eventTSTotal = 0;
    @ApiModelProperty("特殊人员上报未完成数量")
    private Integer noEventTSTotal = 0;
    @ApiModelProperty("公共服务完成数量")
    private Integer eventGGTotal = 0;
    @ApiModelProperty("公共服务未完成数量")
    private Integer noEventGGTotal = 0;
    @ApiModelProperty("走访任务完成数量")
    private Integer eventZFTotal = 0;
    @ApiModelProperty("走访任务未完成数量")
    private Integer noEventZFTotal = 0;
    @ApiModelProperty("随手拍完成数量")
    private Integer eventSSPTotal = 0;
    @ApiModelProperty("随手拍未完成数量")
    private Integer noEventSSPTotal = 0;
    @ApiModelProperty("宣传教育发布数量")
    private Integer eventXCTotal = 0;
}
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/grid/GridEventStatisticsVO.java
New file
@@ -0,0 +1,37 @@
package com.panzhihua.common.model.vos.grid;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
/**
 * 地图模块-网格详细信息
 */
@Data
@ApiModel("统计模块-网格统计数据")
public class GridEventStatisticsVO {
    @ApiModelProperty("今日完成")
    private Integer todayNum = 0;
    @ApiModelProperty("本月完成")
    private Integer monthNum = 0;
    @ApiModelProperty("今日发布宣传教育")
    private Integer todayEducationNum = 0;
    @ApiModelProperty("总发布宣传教育")
    private Integer educationNum = 0;
    @ApiModelProperty("今日特殊人群上报")
    private Integer todaySpecialTotal = 0;
    @ApiModelProperty("总特殊人群上报")
    private Integer specialTotal = 0;
    @ApiModelProperty("实有房屋总数")
    private Integer houseTotal = 0;
}
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/grid/GridMemberPositionDTO.java
New file
@@ -0,0 +1,26 @@
package com.panzhihua.common.model.vos.grid;
import com.panzhihua.common.validated.AddGroup;
import com.panzhihua.common.validated.PutGroup;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotBlank;
@Data
@ApiModel(value = "网格员定时上报请求参数")
public class GridMemberPositionDTO {
    @ApiModelProperty("经纬度,以,隔开")
    @NotBlank(groups = {AddGroup.class}, message = "经纬度不能为空")
    private String lngLat;
    @ApiModelProperty("经纬度定位地址")
    @NotBlank(groups = {AddGroup.class}, message = "经纬度定位地址不能为空")
    private String positionAddress;
    @ApiModelProperty(value = "网格员id",hidden = true)
    private Long gridMemberId;
}
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/service/grid/GridService.java
@@ -853,4 +853,28 @@
     */
    @PostMapping("/event/grid/nearby")
    R getNearByGrid(PageEventGridNearbyDTO pageEventGridNearbyDTO);
    /**
     * 根据网格id查询网格统计数据
     * @param gridId    网格id
     * @return  网格统计数据
     */
    @PostMapping("/statistics/getGridEventStatistics")
    R getGridEventStatisticsByApp(@RequestParam("gridId") Long gridId);
    /**
     * 查询网格事件统计数据
     * @param statisticsDTO 请求参数
     * @return  网格事件统计数据
     */
    @PostMapping("/statistics/event/getGridEventStatistics")
    R getGridEventDetailStatisticsByApp(@RequestBody GridEventStatisticsDTO statisticsDTO);
    /**
     * 网格员上报地理位置
     * @param memberPositionDTO 请求参数
     * @return  上报结果
     */
    @PostMapping("/eventgridmembergpslog/add")
    R gridReportPosition(@RequestBody GridMemberPositionDTO memberPositionDTO);
}
springcloud_k8s_panzhihuazhihuishequ/grid_app/src/main/java/com/panzhihua/grid_app/api/StatisticsApi.java
@@ -1,15 +1,15 @@
package com.panzhihua.grid_app.api;
import com.panzhihua.common.controller.BaseController;
import com.panzhihua.common.model.dtos.grid.GridEventStatisticsDTO;
import com.panzhihua.common.model.vos.R;
import com.panzhihua.common.model.vos.grid.ComMapGridDetailVO;
import com.panzhihua.common.model.vos.grid.GridEventStatisticsDetailVO;
import com.panzhihua.common.model.vos.grid.GridEventStatisticsVO;
import com.panzhihua.common.service.grid.GridService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
@@ -21,13 +21,22 @@
    @Resource
    private GridService gridService;
    @ApiOperation(value = "根据网格id查询统计详情-lyq",response = ComMapGridDetailVO.class)
    @ApiOperation(value = "根据网格id查询统计详情-lyq",response = GridEventStatisticsVO.class)
    @PostMapping("event")
    public R getGridDetail(@RequestParam("gridId") Long gridId){
        if(gridId == null){
            return R.fail("参数错误");
        }
        return null;
        return gridService.getGridEventStatisticsByApp(gridId);
    }
    @ApiOperation(value = "网格id查询统计事件详情-lyq",response = GridEventStatisticsDetailVO.class)
    @PostMapping("event/detail")
    public R getGridEventDetailStatistics(@RequestBody GridEventStatisticsDTO statisticsDTO){
        if(statisticsDTO == null || statisticsDTO.getGridId() == null){
            return R.fail("参数错误");
        }
        return gridService.getGridEventDetailStatisticsByApp(statisticsDTO);
    }
springcloud_k8s_panzhihuazhihuishequ/grid_app/src/main/java/com/panzhihua/grid_app/api/UserApi.java
@@ -7,16 +7,19 @@
import com.panzhihua.common.model.vos.LoginUserInfoVO;
import com.panzhihua.common.model.vos.R;
import com.panzhihua.common.model.vos.community.ComActVO;
import com.panzhihua.common.model.vos.grid.GridMemberPositionDTO;
import com.panzhihua.common.service.auth.TokenService;
import com.panzhihua.common.service.community.CommunityService;
import com.panzhihua.common.service.grid.GridService;
import com.panzhihua.common.service.user.UserService;
import com.panzhihua.common.utlis.StringUtils;
import com.panzhihua.common.validated.AddGroup;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.util.ObjectUtils;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
@@ -110,4 +113,15 @@
        return gridService.editionUpdate();
    }
    @ApiOperation(value = "网格员定时上报地理位置-lyq")
    @PostMapping("/report")
    public R gridReportPosition(@RequestBody @Validated(AddGroup.class)GridMemberPositionDTO memberPositionDTO){
        LoginUserInfoVO loginUserInfo = this.getLoginUserInfo();
        if(loginUserInfo == null){
            return R.fail("请先登录");
        }
        memberPositionDTO.setGridMemberId(loginUserInfo.getUserId());
        return gridService.gridReportPosition(memberPositionDTO);
    }
}
springcloud_k8s_panzhihuazhihuishequ/service_grid/src/main/java/com/panzhihua/service_grid/api/EventGridMemberGpsLogApi.java
@@ -9,6 +9,7 @@
import com.panzhihua.common.model.vos.R;
import com.panzhihua.common.model.vos.grid.EventGridMemberGpsLogDetailsVO;
import com.panzhihua.common.model.vos.grid.EventGridMemberGpsLogVO;
import com.panzhihua.common.model.vos.grid.GridMemberPositionDTO;
import com.panzhihua.service_grid.service.EventGridMemberGpsLogService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
@@ -32,13 +33,13 @@
    /**
     * 新增网格员定时上报地理信息
     * @param eventGridMemberGpsLogAddDTO
     * @param memberPositionDTO 请求参数
     * @return 新增结果
     */
    @PostMapping("/add")
    R add(@RequestBody EventGridMemberGpsLogAddDTO eventGridMemberGpsLogAddDTO){
        return eventGridMemberGpsLogService.add(eventGridMemberGpsLogAddDTO);
    };
    public R add(@RequestBody GridMemberPositionDTO memberPositionDTO){
        return eventGridMemberGpsLogService.add(memberPositionDTO);
    }
    /**
     * 修改网格员定时上报地理信息
springcloud_k8s_panzhihuazhihuishequ/service_grid/src/main/java/com/panzhihua/service_grid/api/StatisticsApi.java
@@ -1,5 +1,6 @@
package com.panzhihua.service_grid.api;
import com.panzhihua.common.model.dtos.grid.GridEventStatisticsDTO;
import com.panzhihua.common.model.dtos.grid.MemberStatisticsAdminDTO;
import com.panzhihua.common.model.vos.R;
import com.panzhihua.service_grid.service.EventService;
@@ -35,4 +36,24 @@
    public R gridMemberStatistics(@RequestBody MemberStatisticsAdminDTO statisticsAdminDTO){
        return eventService.gridMemberStatistics(statisticsAdminDTO);
    }
    /**
     * 根据网格id查询网格统计数据
     * @param gridId    网格id
     * @return  网格统计数据
     */
    @PostMapping("/getGridEventStatistics")
    public R getGridEventStatisticsByApp(@RequestParam("gridId") Long gridId){
        return eventService.getGridEventStatisticsByApp(gridId);
    }
    /**
     * 查询网格事件统计数据
     * @param statisticsDTO 请求参数
     * @return  网格事件统计数据
     */
    @PostMapping("/event/getGridEventStatistics")
    public R getGridEventDetailStatisticsByApp(@RequestBody GridEventStatisticsDTO statisticsDTO){
        return eventService.getGridEventDetailStatisticsByApp(statisticsDTO);
    }
}
springcloud_k8s_panzhihuazhihuishequ/service_grid/src/main/java/com/panzhihua/service_grid/dao/EventMapper.java
@@ -5,11 +5,8 @@
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.panzhihua.common.model.dtos.grid.*;
import com.panzhihua.common.model.vos.grid.ComMapGridEventVO;
import com.panzhihua.common.model.vos.grid.EventStatisticsAllAdminVO;
import com.panzhihua.common.model.vos.grid.EventStatisticsMemberAdminVO;
import com.panzhihua.common.model.vos.grid.*;
import com.panzhihua.service_grid.model.dos.EventDO;
import com.panzhihua.common.model.vos.grid.EventVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@@ -79,4 +76,18 @@
    EventStatisticsAllAdminVO eventStatistics(@Param("communityId") Long communityId);
    Integer getEventCountByGridIds(@Param("ids") List<Long> ids);
    /**
     * 根据网格id查询网格统计数据
     * @param gridId    网格id
     * @return  网格统计数据
     */
    GridEventStatisticsVO getGridEventStatisticsByApp(@Param("gridId") Long gridId);
    /**
     * 查询网格事件统计数据
     * @param statisticsDTO 请求参数
     * @return  网格事件统计数据
     */
    GridEventStatisticsDetailVO getGridEventDetailStatisticsByApp(@Param("statisticsDTO") GridEventStatisticsDTO statisticsDTO);
}
springcloud_k8s_panzhihuazhihuishequ/service_grid/src/main/java/com/panzhihua/service_grid/service/EventGridMemberGpsLogService.java
@@ -6,6 +6,7 @@
import com.panzhihua.common.model.vos.R;
import com.panzhihua.common.model.vos.grid.EventGridMemberGpsLogDetailsVO;
import com.panzhihua.common.model.vos.grid.EventGridMemberGpsLogVO;
import com.panzhihua.common.model.vos.grid.GridMemberPositionDTO;
import com.panzhihua.service_grid.model.dos.EventGridMemberGpsLogDO;
/**
@@ -20,10 +21,10 @@
    /**
     * 新增网格员定时上报地理信息
     * @param eventGridMemberGpsLogAddDTO
     * @param memberPositionDTO 请求参数
     * @return 新增结果
     */
    R add(EventGridMemberGpsLogAddDTO eventGridMemberGpsLogAddDTO);
    R add(GridMemberPositionDTO memberPositionDTO);
    /**
     * 修改网格员定时上报地理信息
springcloud_k8s_panzhihuazhihuishequ/service_grid/src/main/java/com/panzhihua/service_grid/service/EventService.java
@@ -219,4 +219,18 @@
     * @return
     */
    R batchMarkEventInvalid(EventBatchRevokeDTO eventBatchRevokeDTO);
    /**
     * 根据网格id查询网格统计数据
     * @param gridId    网格id
     * @return  网格统计数据
     */
    R getGridEventStatisticsByApp(Long gridId);
    /**
     * 查询网格事件统计数据
     * @param statisticsDTO 请求参数
     * @return  网格事件统计数据
     */
    R getGridEventDetailStatisticsByApp(GridEventStatisticsDTO statisticsDTO);
}
springcloud_k8s_panzhihuazhihuishequ/service_grid/src/main/java/com/panzhihua/service_grid/service/impl/EventGridMemberGpsLogServiceImpl.java
@@ -7,6 +7,7 @@
import com.panzhihua.common.model.vos.R;
import com.panzhihua.common.model.vos.grid.EventGridMemberGpsLogDetailsVO;
import com.panzhihua.common.model.vos.grid.EventGridMemberGpsLogVO;
import com.panzhihua.common.model.vos.grid.GridMemberPositionDTO;
import com.panzhihua.service_grid.dao.*;
import com.panzhihua.service_grid.model.dos.*;
import com.panzhihua.service_grid.service.EventGridMemberGpsLogService;
@@ -32,13 +33,14 @@
    private EventGridMemberGpsLogMapper eventGridMemberGpsLogMapper;
    /**
     * 新增网格员定时上报地理信息
     * @param eventGridMemberGpsLogAddDTO
     * @param memberPositionDTO 请求参数
     * @return 新增结果
     */
    public R add(EventGridMemberGpsLogAddDTO eventGridMemberGpsLogAddDTO){
    public R add(GridMemberPositionDTO memberPositionDTO){
        EventGridMemberGpsLogDO eventGridMemberGpsLogDO = new EventGridMemberGpsLogDO();
        BeanUtils.copyProperties(eventGridMemberGpsLogAddDTO, eventGridMemberGpsLogDO);
        BeanUtils.copyProperties(memberPositionDTO, eventGridMemberGpsLogDO);
        eventGridMemberGpsLogDO.setCreateAt(new Date());
        eventGridMemberGpsLogDO.setCreateBy(memberPositionDTO.getGridMemberId());
        if(eventGridMemberGpsLogMapper.insert(eventGridMemberGpsLogDO)>0){
            return R.ok();
        }
springcloud_k8s_panzhihuazhihuishequ/service_grid/src/main/java/com/panzhihua/service_grid/service/impl/EventServiceImpl.java
@@ -1788,4 +1788,52 @@
            return R.fail("参数错误");
        }
    }
    /**
     * 根据网格id查询网格统计数据
     * @param gridId    网格id
     * @return  网格统计数据
     */
    @Override
    public R getGridEventStatisticsByApp(Long gridId){
        return R.ok(this.baseMapper.getGridEventStatisticsByApp(gridId));
    }
    /**
     * 查询网格事件统计数据
     * @param statisticsDTO 请求参数
     * @return  网格事件统计数据
     */
    @Override
    public R getGridEventDetailStatisticsByApp(GridEventStatisticsDTO statisticsDTO){
        GridEventStatisticsDetailVO statisticsDetailVO = this.baseMapper.getGridEventDetailStatisticsByApp(statisticsDTO);
        if(statisticsDetailVO == null){
            statisticsDetailVO = new GridEventStatisticsDetailVO();
        }
        if(statisticsDetailVO.getEventSSPTotal() == null){
            statisticsDetailVO.setEventSSPTotal(0);
        }
        if(statisticsDetailVO.getNoEventSSPTotal() == null){
            statisticsDetailVO.setNoEventSSPTotal(0);
        }
        if(statisticsDetailVO.getEventZFTotal() == null){
            statisticsDetailVO.setEventZFTotal(0);
        }
        if(statisticsDetailVO.getNoEventZFTotal() == null){
            statisticsDetailVO.setNoEventZFTotal(0);
        }
        //统计数据
        Integer sum = statisticsDetailVO.getEventTFTotal() + statisticsDetailVO.getEventMDTotal() + statisticsDetailVO.getEventZATotal()
                + statisticsDetailVO.getEventBWDTotal() + statisticsDetailVO.getEventTSTotal() + statisticsDetailVO.getEventGGTotal()
                + statisticsDetailVO.getEventXCTotal() + statisticsDetailVO.getEventSSPTotal() + statisticsDetailVO.getEventZFTotal();
        statisticsDetailVO.setSum(sum);
        Integer noSum = statisticsDetailVO.getNoEventTFTotal() + statisticsDetailVO.getNoEventMDTotal() + statisticsDetailVO.getNoEventZATotal()
                + statisticsDetailVO.getNoEventBWDTotal() + statisticsDetailVO.getNoEventTSTotal() + statisticsDetailVO.getNoEventGGTotal()
                + statisticsDetailVO.getNoEventSSPTotal() + statisticsDetailVO.getNoEventZFTotal();
        statisticsDetailVO.setNoSum(noSum);
        return R.ok(statisticsDetailVO);
    }
}
springcloud_k8s_panzhihuazhihuishequ/service_grid/src/main/resources/mapper/EventMapper.xml
@@ -550,4 +550,317 @@
        </foreach>
    </select>
    <select id="getGridEventStatisticsByApp" resultType="com.panzhihua.common.model.vos.grid.GridEventStatisticsVO">
        SELECT
            count( id ) AS todayNum,
            (
            SELECT
                count( id )
            FROM
                `event`
            WHERE
                event_category = 1
                AND event_process_status = 2
                AND create_at BETWEEN DATE_FORMAT( DATE_ADD( curdate(), INTERVAL - DAY ( curdate())+ 1 DAY ), '%Y-%m-%d %H:%i:%s' )
            AND NOW()
            <if test="gridId!=null">
                 AND grid_id = #{gridId}
            </if>
            ) AS monthNum,
            (
            SELECT
                count( id )
            FROM
                `event`
            WHERE
                event_category = 2
                AND event_status = 2
                AND create_at BETWEEN DATE_FORMAT( CURDATE(), '%Y-%m-%d %H:%i:%s' )
            AND NOW()
            <if test="gridId!=null">
                AND grid_id = #{gridId}
            </if>
            ) AS todayEducationNum,
            ( SELECT count( id ) FROM `event` WHERE event_category = 2 AND event_status = 2 ) AS educationNum,
            (
            SELECT
                count( id )
            FROM
                `event`
            WHERE
                event_category = 1
                AND event_type = 6
                AND event_status = 2
                AND event_process_status = 2
                AND create_at BETWEEN DATE_FORMAT( CURDATE(), '%Y-%m-%d %H:%i:%s' )
            AND NOW()
            <if test="gridId!=null">
                AND grid_id = #{gridId}
            </if>
            ) AS todaySpecialTotal,
            ( SELECT count( id ) FROM `event` WHERE event_category = 1 AND event_type = 6 AND event_status = 2 AND event_process_status = 2 ) AS specialTotal
        FROM
            `event`
        WHERE
            event_category = 1
            AND event_process_status = 2
            AND create_at BETWEEN DATE_FORMAT( CURDATE(), '%Y-%m-%d %H:%i:%s' )
            AND NOW()
            <if test="gridId!=null">
                AND grid_id = #{gridId}
            </if>
    </select>
    <select id="getGridEventDetailStatisticsByApp" parameterType="com.panzhihua.common.model.dtos.grid.GridEventStatisticsDTO"
            resultType="com.panzhihua.common.model.vos.grid.GridEventStatisticsDetailVO">
        SELECT
            count( e.id ) AS eventTFTotal,
            (
            SELECT
                count( id )
            FROM
                `event`
            WHERE
                event_category = 1
                AND event_type = 5
                AND event_process_status IN ( 1, 3 )
                AND event_status = 2
                <if test="statisticsDTO.gridId!=null">
                    AND grid_id = #{statisticsDTO.gridId}
                </if>
                <if test='statisticsDTO.startTime != null and statisticsDTO.startTime != &quot;&quot;'>
                    AND create_at <![CDATA[ >= ]]> #{statisticsDTO.ageStartTime}
                </if>
                <if test='statisticsDTO.endTime != null and statisticsDTO.endTime != &quot;&quot;'>
                    AND create_at <![CDATA[ <= ]]> #{statisticsDTO.endTime}
                </if>
            ) AS noEventTFTotal,
            ( SELECT count( id ) FROM `event` WHERE event_category = 1 AND event_type = 3 AND event_process_status = 2
                <if test="statisticsDTO.gridId!=null">
                    AND grid_id = #{statisticsDTO.gridId}
                </if>
                <if test='statisticsDTO.startTime != null and statisticsDTO.startTime != &quot;&quot;'>
                    AND create_at <![CDATA[ >= ]]> #{statisticsDTO.ageStartTime}
                </if>
                <if test='statisticsDTO.endTime != null and statisticsDTO.endTime != &quot;&quot;'>
                    AND create_at <![CDATA[ <= ]]> #{statisticsDTO.endTime}
                </if>
            ) AS eventMDTotal,
            (
            SELECT
                count( id )
            FROM
                `event`
            WHERE
                event_category = 1
                AND event_type = 3
                AND event_process_status IN ( 1, 3 )
                AND event_status = 2
                <if test="statisticsDTO.gridId!=null">
                    AND grid_id = #{statisticsDTO.gridId}
                </if>
                <if test='statisticsDTO.startTime != null and statisticsDTO.startTime != &quot;&quot;'>
                    AND create_at <![CDATA[ >= ]]> #{statisticsDTO.ageStartTime}
                </if>
                <if test='statisticsDTO.endTime != null and statisticsDTO.endTime != &quot;&quot;'>
                    AND create_at <![CDATA[ <= ]]> #{statisticsDTO.endTime}
                </if>
            ) AS noEventMDTotal,
            ( SELECT count( id ) FROM `event` WHERE event_category = 1 AND event_type = 1 AND event_process_status = 2
                <if test="statisticsDTO.gridId!=null">
                    AND grid_id = #{statisticsDTO.gridId}
                </if>
                <if test='statisticsDTO.startTime != null and statisticsDTO.startTime != &quot;&quot;'>
                    AND create_at <![CDATA[ >= ]]> #{statisticsDTO.ageStartTime}
                </if>
                <if test='statisticsDTO.endTime != null and statisticsDTO.endTime != &quot;&quot;'>
                    AND create_at <![CDATA[ <= ]]> #{statisticsDTO.endTime}
                </if>
            ) AS eventZATotal,
            (
            SELECT
                count( id )
            FROM
                `event`
            WHERE
                event_category = 1
                AND event_type = 1
                AND event_process_status IN ( 1, 3 )
                AND event_status = 2
                <if test="statisticsDTO.gridId!=null">
                    AND grid_id = #{statisticsDTO.gridId}
                </if>
                <if test='statisticsDTO.startTime != null and statisticsDTO.startTime != &quot;&quot;'>
                    AND create_at <![CDATA[ >= ]]> #{statisticsDTO.ageStartTime}
                </if>
                <if test='statisticsDTO.endTime != null and statisticsDTO.endTime != &quot;&quot;'>
                    AND create_at <![CDATA[ <= ]]> #{statisticsDTO.endTime}
                </if>
            ) AS noEventZATotal,
            ( SELECT count( id ) FROM `event` WHERE event_category = 1 AND event_type = 4 AND event_process_status = 2
                <if test="statisticsDTO.gridId!=null">
                    AND grid_id = #{statisticsDTO.gridId}
                </if>
                <if test='statisticsDTO.startTime != null and statisticsDTO.startTime != &quot;&quot;'>
                    AND create_at <![CDATA[ >= ]]> #{statisticsDTO.ageStartTime}
                </if>
                <if test='statisticsDTO.endTime != null and statisticsDTO.endTime != &quot;&quot;'>
                    AND create_at <![CDATA[ <= ]]> #{statisticsDTO.endTime}
                </if>
            ) AS eventBWDTotal,
            (
            SELECT
                count( id )
            FROM
                `event`
            WHERE
                event_category = 1
                AND event_type = 4
                AND event_process_status IN ( 1, 3 )
                AND event_status = 2
                <if test="statisticsDTO.gridId!=null">
                    AND grid_id = #{statisticsDTO.gridId}
                </if>
                <if test='statisticsDTO.startTime != null and statisticsDTO.startTime != &quot;&quot;'>
                    AND create_at <![CDATA[ >= ]]> #{statisticsDTO.ageStartTime}
                </if>
                <if test='statisticsDTO.endTime != null and statisticsDTO.endTime != &quot;&quot;'>
                    AND create_at <![CDATA[ <= ]]> #{statisticsDTO.endTime}
                </if>
            ) AS noEventBWDTotal,
            ( SELECT count( id ) FROM `event` WHERE event_category = 1 AND event_type = 6 AND event_process_status = 2
                <if test="statisticsDTO.gridId!=null">
                    AND grid_id = #{statisticsDTO.gridId}
                </if>
                <if test='statisticsDTO.startTime != null and statisticsDTO.startTime != &quot;&quot;'>
                    AND create_at <![CDATA[ >= ]]> #{statisticsDTO.ageStartTime}
                </if>
                <if test='statisticsDTO.endTime != null and statisticsDTO.endTime != &quot;&quot;'>
                    AND create_at <![CDATA[ <= ]]> #{statisticsDTO.endTime}
                </if>
            ) AS eventTSTotal,
            (
            SELECT
                count( id )
            FROM
                `event`
            WHERE
                event_category = 1
                AND event_type = 6
                AND event_process_status IN ( 1, 3 )
                AND event_status = 2
                <if test="statisticsDTO.gridId!=null">
                    AND grid_id = #{statisticsDTO.gridId}
                </if>
                <if test='statisticsDTO.startTime != null and statisticsDTO.startTime != &quot;&quot;'>
                    AND create_at <![CDATA[ >= ]]> #{statisticsDTO.ageStartTime}
                </if>
                <if test='statisticsDTO.endTime != null and statisticsDTO.endTime != &quot;&quot;'>
                    AND create_at <![CDATA[ <= ]]> #{statisticsDTO.endTime}
                </if>
            ) AS noEventTSTotal,
            ( SELECT count( id ) FROM `event` WHERE event_category = 1 AND event_type = 2 AND event_process_status = 2
                <if test="statisticsDTO.gridId!=null">
                    AND grid_id = #{statisticsDTO.gridId}
                </if>
                <if test='statisticsDTO.startTime != null and statisticsDTO.startTime != &quot;&quot;'>
                    AND create_at <![CDATA[ >= ]]> #{statisticsDTO.ageStartTime}
                </if>
                <if test='statisticsDTO.endTime != null and statisticsDTO.endTime != &quot;&quot;'>
                    AND create_at <![CDATA[ <= ]]> #{statisticsDTO.endTime}
                </if>
            ) AS eventGGTotal,
            (
            SELECT
                count( id )
            FROM
                `event`
            WHERE
                event_category = 1
                AND event_type = 2
                AND event_process_status IN ( 1, 3 )
                AND event_status = 2
                <if test="statisticsDTO.gridId!=null">
                    AND grid_id = #{statisticsDTO.gridId}
                </if>
                <if test='statisticsDTO.startTime != null and statisticsDTO.startTime != &quot;&quot;'>
                    AND create_at <![CDATA[ >= ]]> #{statisticsDTO.ageStartTime}
                </if>
                <if test='statisticsDTO.endTime != null and statisticsDTO.endTime != &quot;&quot;'>
                    AND create_at <![CDATA[ <= ]]> #{statisticsDTO.endTime}
                </if>
            ) AS noEventGGTotal,
            ( SELECT count( id ) FROM `event` WHERE event_category = 2 AND event_status = 2
                <if test="statisticsDTO.gridId!=null">
                    AND grid_id = #{statisticsDTO.gridId}
                </if>
                <if test='statisticsDTO.startTime != null and statisticsDTO.startTime != &quot;&quot;'>
                    AND create_at <![CDATA[ >= ]]> #{statisticsDTO.ageStartTime}
                </if>
                <if test='statisticsDTO.endTime != null and statisticsDTO.endTime != &quot;&quot;'>
                    AND create_at <![CDATA[ <= ]]> #{statisticsDTO.endTime}
                </if>
            ) AS eventXCTotal,
            ( SELECT count( id ) FROM event_visiting_tasks WHERE event_status = 2
                <if test="statisticsDTO.gridId!=null">
                    AND grid_id = #{statisticsDTO.gridId}
                </if>
                <if test='statisticsDTO.startTime != null and statisticsDTO.startTime != &quot;&quot;'>
                    AND create_at <![CDATA[ >= ]]> #{statisticsDTO.ageStartTime}
                </if>
                <if test='statisticsDTO.endTime != null and statisticsDTO.endTime != &quot;&quot;'>
                    AND create_at <![CDATA[ <= ]]> #{statisticsDTO.endTime}
                </if>
            ) AS eventZFTotal,
            (
            SELECT
                count( id )
            FROM
                event_visiting_tasks
            WHERE
            event_status IN ( 1, 3 )
            <if test="statisticsDTO.gridId!=null">
                AND grid_id = #{statisticsDTO.gridId}
            </if>
            <if test='statisticsDTO.startTime != null and statisticsDTO.startTime != &quot;&quot;'>
                AND create_at <![CDATA[ >= ]]> #{statisticsDTO.ageStartTime}
            </if>
            <if test='statisticsDTO.endTime != null and statisticsDTO.endTime != &quot;&quot;'>
                AND create_at <![CDATA[ <= ]]> #{statisticsDTO.endTime}
            </if>
            ) AS noEventZFTotal,
            ( SELECT count( id ) FROM com_act_easy_photo WHERE handle_status = 2 AND community_id = egd.grid_community_id
            <if test='statisticsDTO.startTime != null and statisticsDTO.startTime != &quot;&quot;'>
                AND create_at <![CDATA[ >= ]]> #{statisticsDTO.ageStartTime}
            </if>
            <if test='statisticsDTO.endTime != null and statisticsDTO.endTime != &quot;&quot;'>
                AND create_at <![CDATA[ <= ]]> #{statisticsDTO.endTime}
            </if>
            ) AS eventSSPTotal,
            ( SELECT count( id ) FROM com_act_easy_photo WHERE handle_status = 1 AND community_id = egd.grid_community_id
            <if test='statisticsDTO.startTime != null and statisticsDTO.startTime != &quot;&quot;'>
                AND create_at <![CDATA[ >= ]]> #{statisticsDTO.ageStartTime}
            </if>
            <if test='statisticsDTO.endTime != null and statisticsDTO.endTime != &quot;&quot;'>
                AND create_at <![CDATA[ <= ]]> #{statisticsDTO.endTime}
            </if>
            ) AS noEventSSPTotal
        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_process_status = 2
            <if test="statisticsDTO.gridId!=null">
                AND grid_id = #{statisticsDTO.gridId}
            </if>
            <if test='statisticsDTO.startTime != null and statisticsDTO.startTime != &quot;&quot;'>
                AND create_at <![CDATA[ >= ]]> #{statisticsDTO.ageStartTime}
            </if>
            <if test='statisticsDTO.endTime != null and statisticsDTO.endTime != &quot;&quot;'>
                AND create_at <![CDATA[ <= ]]> #{statisticsDTO.endTime}
            </if>
    </select>
</mapper>