From 3ee15525efd4e1bb276a9b52d95e1f30a25bea8c Mon Sep 17 00:00:00 2001
From: huanghongfa <huanghongfa123456>
Date: 星期四, 17 六月 2021 11:22:09 +0800
Subject: [PATCH] 修改bug以及新增根据社区查网格列表接口

---
 springcloud_k8s_panzhihuazhihuishequ/service_grid/src/main/java/com/panzhihua/service_grid/service/impl/EventServiceImpl.java |   50 ++++++++++++++++++++++++++++++--------------------
 1 files changed, 30 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 ce37efe..81ea73c 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
@@ -515,6 +515,8 @@
         eventDO.setUpdateBy(eventRevokeDTO.getUserId());
         eventDO.setProcessType(1);//网格员处理
         eventDO.setCommunityProcess(0);//非 社区处理
+        eventDO.setRevokeType(eventRevokeDTO.getRevokeType());
+        eventDO.setRevokeId(eventRevokeDTO.getRevokeId());
         int updated = this.getBaseMapper().updateById(eventDO);
         if (updated == 1) {
             addTransferRecord(eventDO.getId(), eventRevokeDTO.getUserId(), eventRevokeDTO.getUserName(),
@@ -531,10 +533,10 @@
         if (eventDO == null) {
             return R.fail("事件不存在");
         }
-        boolean canDealByUser = eventDO.getEventStatus() == 2 && eventDO.getEventProcessStatus() == 1;
+        boolean canDealByUser = (eventDO.getEventStatus() == 2||eventDO.getEventStatus()==4) && eventDO.getEventProcessStatus() == 1;
         if (!canDealByUser) {
-            if (eventDO.getEventStatus() != 2) {
-                return R.fail("事件不是发布状态");
+            if (eventDO.getEventStatus() != 2 ) {
+                return R.fail("事件不是发布/待处理状态");
             }
             if (eventDO.getEventProcessStatus() != 1) {
                 return R.fail("事件不是待处理状态");
@@ -650,7 +652,8 @@
     @Override
     public R republishEvent(CommonEventRepublishDTO commonEventRepublishDTO) {
         EventDO eventDO = this.getBaseMapper().selectById(commonEventRepublishDTO.getId());
-        boolean canRepublishByUser = eventDO.getEventStatus() == 4 || eventDO.getEventStatus() == 1;
+        //boolean canRepublishByUser = eventDO.getEventStatus() == 4 || eventDO.getEventStatus() == 1;
+        boolean canRepublishByUser = eventDO.getEventDealStatus() == 7|eventDO.getEventDealStatus() == 5; //已失效状态
         if (!canRepublishByUser) {
             return R.fail("当前不是撤销/草稿状态");
         }
@@ -1179,6 +1182,11 @@
                 eventVO.setAudios(audioList);
                 eventVO.setPics(picList);
                 eventVO.setVideos(videoList);
+                //查询网格员头像
+                String imageUrl = eventMapper.getGridMemberImageUrl(eventVO.getGridMemberId());
+                if (StringUtils.isNotEmpty(imageUrl)) {
+                    eventVO.setGridMemberImageUrl(imageUrl);
+                }
             });
             return R.ok(ipage);
         }
@@ -1256,12 +1264,12 @@
             if (eventDO.getEventCategory() == 1) {
                 boolean canRevoke = eventDO.getEventDealStatus() == 3; //上报状态
                 if (!canRevoke) {
-                    return R.fail("当前事件不是上报状态,不允许标为无效");
+                    return R.fail("当前事件不是上报状态,不允许撤销");
                 }
             } else if (eventDO.getEventCategory() == 2) {
                 boolean canRevoke = eventDO.getEventDealStatus() == 8; //发布状态
                 if (!canRevoke) {
-                    return R.fail("当前事件不是发布状态,不允许标为无效");
+                    return R.fail("当前事件不是发布状态,不允许撤销");
                 }
             } else {
                 return R.fail("");
@@ -1275,6 +1283,8 @@
         eventDO.setEventStatus(4);//4、撤销
         eventDO.setProcessType(1);//网格员处理
         eventDO.setCommunityProcess(0);//非 社区处理
+        eventDO.setRevokeId(eventRevokeDTO.getRevokeId());
+        eventDO.setRevokeType(eventRevokeDTO.getRevokeType());
         int updated = this.getBaseMapper().updateById(eventDO);
         if (updated == 1) {
             addTransferRecord(eventDO.getId(), eventRevokeDTO.getUserId(), eventRevokeDTO.getUserName(), 1, "标为无效", eventRevokeDTO.getCommunityId(), eventRevokeDTO.getCommunityName(), 4);
@@ -1504,14 +1514,13 @@
                 .eq(EventTransferRecordDO::getEventId, eventId)
                 .orderByDesc(EventTransferRecordDO::getCreateAt)
         );
-        if (list == null || list.size() == 0) {
-            throw new ServiceException("事件流转记录异常");
-        }
-        EventTransferRecordDO lastRecord = list.get(0);
         EventTransferRecordDO eventTransferRecordDO = new EventTransferRecordDO();
-        eventTransferRecordDO.setFromType(lastRecord.getToType());
-        eventTransferRecordDO.setFromId(lastRecord.getToId());
-        eventTransferRecordDO.setFromName(lastRecord.getToName());
+        if (list != null && list.size() > 0) {
+            EventTransferRecordDO lastRecord = list.get(0);
+            eventTransferRecordDO.setFromType(lastRecord.getToType());
+            eventTransferRecordDO.setFromId(lastRecord.getToId());
+            eventTransferRecordDO.setFromName(lastRecord.getToName());
+        }
         eventTransferRecordDO.setToType(toType);
         eventTransferRecordDO.setToId(toId);
         eventTransferRecordDO.setProcessDate(new Date());
@@ -1576,10 +1585,11 @@
                 Integer community_process = eventDO.getCommunityProcess() != null ? eventDO.getCommunityProcess() : -1;
 
                 Integer eventDealStatus = -1;
-                if (eventDO.getInvalid() != null && eventDO.getInvalid() == false) {
+                /*if (eventDO.getInvalid() != null && eventDO.getInvalid() == false) {
                     eventDealStatus = 7;
                     //7已失效
-                } else if (event_status == 1) {
+                }*/
+                if (event_status == 1) {
                     eventDealStatus = 5;
                     //"草稿箱"
                 } else if (event_status == 4) {
@@ -1644,7 +1654,7 @@
     public R getNearByGrid(PageEventGridNearbyDTO pageEventGridNearbyDTO) {
         Page page = new Page(pageEventGridNearbyDTO.getPageNum(), pageEventGridNearbyDTO.getPageSize());
         String latLng = pageEventGridNearbyDTO.getHappentLatLng();
-        if(!latLng.matches("^[\\-\\+]?((0|([1-8]\\d?))(\\.\\d{1,10})?|90(\\.0{1,10})?),[\\-\\+]?(0(\\.\\d{1,10})?|([1-9](\\d)?)(\\.\\d{1,10})?|1[0-7]\\d{1}(\\.\\d{1,10})?|180\\.0{1,10})$")){
+        if(!latLng.matches("^[\\-\\+]?(0(\\.\\d{1,10})?|([1-9](\\d)?)(\\.\\d{1,10})?|1[0-7]\\d{1}(\\.\\d{1,10})?|180\\.0{1,10}),[\\-\\+]?((0|([1-8]\\d?))(\\.\\d{1,10})?|90(\\.0{1,10})?)$")){
             return R.fail("经纬度参数错误");
         }
         String latLngArr[] = latLng.split(",");
@@ -1771,15 +1781,15 @@
                     throw new ServiceException("id为" + id + "的事件不存在");
                 }
                 if (eventDO.getEventCategory() != null) {
-                    if (eventDO.getEventCategory() == 1) {
+                    if (eventDO.getEventCategory() == 1) {//
                         boolean canRevoke = eventDO.getEventDealStatus() == 3; //上报状态
                         if (!canRevoke) {
-                            throw new ServiceException("当前事件不是上报状态,不允许标为无效");
+                            throw new ServiceException("当前事件不是上报状态,不允许撤销");
                         }
-                    } else if (eventDO.getEventCategory() == 2) {
+                    } else if (eventDO.getEventCategory() == 2) {//宣传教育
                         boolean canRevoke = eventDO.getEventDealStatus() == 8; //发布状态
                         if (!canRevoke) {
-                            throw new ServiceException("当前事件不是发布状态,不允许标为无效");
+                            throw new ServiceException("当前事件不是发布状态,不允许撤销");
                         }
                     } else {
                         throw new ServiceException("事件分类错误");

--
Gitblit v1.7.1