From db31c68b10e3a58bce17e3bbf880db05b6f341fe Mon Sep 17 00:00:00 2001
From: huanghongfa <huanghongfa123456>
Date: 星期五, 16 七月 2021 16:39:56 +0800
Subject: [PATCH] 修改bug

---
 springcloud_k8s_panzhihuazhihuishequ/service_grid/src/main/java/com/panzhihua/service_grid/service/impl/EventServiceImpl.java |   51 +++++++++++++++++++++++++++++++--------------------
 1 files changed, 31 insertions(+), 20 deletions(-)

diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_grid/src/main/java/com/panzhihua/service_grid/service/impl/EventServiceImpl.java b/springcloud_k8s_panzhihuazhihuishequ/service_grid/src/main/java/com/panzhihua/service_grid/service/impl/EventServiceImpl.java
index cdbec76..8f0aefd 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/service_grid/src/main/java/com/panzhihua/service_grid/service/impl/EventServiceImpl.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/service_grid/src/main/java/com/panzhihua/service_grid/service/impl/EventServiceImpl.java
@@ -293,13 +293,15 @@
         if (eventGridDataDO == null) {
             return R.fail("网格不存在");
         }
+        eventDO.setGridMemberCommunity(eventGridDataDO.getGridCommunityId());
+        eventDO.setGridMemberStreet(eventGridDataDO.getGridStreetId());
 
         //检查特殊人群上报时参数
-        if(commonEventAddDTO.getEventType().equals(6)){
-            if(commonEventAddDTO.getPopulationIds() == null || commonEventAddDTO.getPopulationIds().size() <= 0){
-                return R.fail("上报人员为空");
-            }
-        }
+//        if(commonEventAddDTO.getEventType().equals(6)){
+//            if(commonEventAddDTO.getPopulationIds() == null || commonEventAddDTO.getPopulationIds().size() <= 0){
+//                return R.fail("上报人员为空");
+//            }
+//        }
 
         eventDO.setEventCategory(1l);//办件事件
         eventDO.setEventStatus(2);//事件状态 2发布
@@ -311,20 +313,22 @@
         eventDO.setCreateBy(commonEventAddDTO.getUserId());
         eventDO.setSubmitDate(new Date());
         eventDO.setOrderSn(getEventOrderSn(eventDO.getEventType()));
-        if (eventMapper.insert(eventDO) == 1) {
 
+        if (eventMapper.insert(eventDO) == 1) {
             //如果是特殊人群,则新增特殊人群与事件关系
             if(commonEventAddDTO.getEventType().equals(6)){
-                List<EventSpecialCrowdRecordDO> crowdRecordList = new ArrayList<>();
-                commonEventAddDTO.getPopulationIds().forEach(populationId -> {
-                    EventSpecialCrowdRecordDO specialCrowdRecordDO = new EventSpecialCrowdRecordDO();
-                    specialCrowdRecordDO.setEventId(eventDO.getId());
-                    specialCrowdRecordDO.setPopulationId(populationId);
-                    specialCrowdRecordDO.setCreateAt(new Date());
-                    crowdRecordList.add(specialCrowdRecordDO);
-                });
-                //添加特殊人群上报事件与人口关系
-                eventSpecialCrowdRecordService.saveBatch(crowdRecordList);
+                if(commonEventAddDTO.getPopulationIds() != null && commonEventAddDTO.getPopulationIds().size() > 0){
+                    List<EventSpecialCrowdRecordDO> crowdRecordList = new ArrayList<>();
+                    commonEventAddDTO.getPopulationIds().forEach(populationId -> {
+                        EventSpecialCrowdRecordDO specialCrowdRecordDO = new EventSpecialCrowdRecordDO();
+                        specialCrowdRecordDO.setEventId(eventDO.getId());
+                        specialCrowdRecordDO.setPopulationId(populationId);
+                        specialCrowdRecordDO.setCreateAt(new Date());
+                        crowdRecordList.add(specialCrowdRecordDO);
+                    });
+                    //添加特殊人群上报事件与人口关系
+                    eventSpecialCrowdRecordService.saveBatch(crowdRecordList);
+                }
             }
 
             //添加音频
@@ -1031,6 +1035,8 @@
         eventDO.setEventCategory(2l);//宣传事件
         eventDO.setEventStatus(2);//事件状态 2发布
         eventDO.setEventType(8);
+        eventDO.setGridMemberCommunity(eventGridDataDO.getGridCommunityId());
+        eventDO.setGridMemberStreet(eventGridDataDO.getGridStreetId());
         if(publicityEventAddDTO.getGridMemberId()!=null) {
             eventDO.setGridMemberId(publicityEventAddDTO.getGridMemberId());
         }else{
@@ -1748,9 +1754,9 @@
 //            return R.fail("经纬度参数错误");
 //        }
         //经纬度匹配规则:(短(纬度)在前长(经度)在后,不要擅自修改此规则,否则出现问题后果自负)
-        if(!latLng.matches("[1-9][0-9](\\.[0-9]{1,6})?,[1-9][0-9]{2}(\\.[0-9]{1,6})?")){
-            return R.fail("经纬度参数错误");
-        }
+//        if(!latLng.matches("[1-9][0-9](\\.[0-9]{1,6})?,[1-9][0-9]{2}(\\.[0-9]{1,6})?")){
+//            return R.fail("经纬度参数错误");
+//        }
         String latLngArr[] = latLng.split(",");
         try {
             Double lat = Double.valueOf(latLngArr[1]);
@@ -1917,7 +1923,12 @@
      */
     @Override
     public R getGridEventStatisticsByApp(Long gridId){
-        return R.ok(this.baseMapper.getGridEventStatisticsByApp(gridId));
+        GridEventStatisticsVO result = this.baseMapper.getGridEventStatisticsByApp(gridId);
+        if(result != null){
+            result.setTodayNum(result.getTodayNum() + result.getZfTodayNum());
+            result.setMonthNum(result.getMonthNum() + result.getZfMonthNum());
+        }
+        return R.ok(result);
     }
 
     /**

--
Gitblit v1.7.1