From baff3fde20ca7cd8c5bf3a7d23c3a593abbc5b21 Mon Sep 17 00:00:00 2001
From: huanghongfa <huanghongfa123456>
Date: 星期四, 13 五月 2021 13:32:10 +0800
Subject: [PATCH] 修改bug

---
 springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComMngVillageServiceImpl.java |   32 +++++++++++++++++++++++++-------
 1 files changed, 25 insertions(+), 7 deletions(-)

diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComMngVillageServiceImpl.java b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComMngVillageServiceImpl.java
index 2b6174b..da1869d 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComMngVillageServiceImpl.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComMngVillageServiceImpl.java
@@ -14,9 +14,7 @@
 import com.panzhihua.service_community.dao.ComActDAO;
 import com.panzhihua.service_community.dao.ComActVillageDAO;
 import com.panzhihua.service_community.dao.ComMngPopulationDAO;
-import com.panzhihua.service_community.dao.ComMngVolunteerMngDAO;
 import com.panzhihua.service_community.model.dos.ComActDO;
-import com.panzhihua.service_community.model.dos.ComActDiscussDO;
 import com.panzhihua.service_community.model.dos.ComMngPopulationDO;
 import com.panzhihua.service_community.model.dos.ComMngVillageDO;
 import com.panzhihua.service_community.service.ComMngVillageService;
@@ -25,10 +23,7 @@
 
 import javax.annotation.Resource;
 import java.util.ArrayList;
-import java.util.HashMap;
 import java.util.List;
-import java.util.Map;
-import java.util.stream.Collectors;
 
 /**
  * @author: llming
@@ -97,6 +92,9 @@
         page.setSize(pageSize);
         page.setCurrent(pageNum);
         LambdaQueryWrapper<ComMngVillageDO> userLambdaQueryWrapper = Wrappers.lambdaQuery();
+        if(pageComMngVillageDTO.getCommunityId() != null){
+            userLambdaQueryWrapper.eq(ComMngVillageDO::getCommunityId,pageComMngVillageDTO.getCommunityId());
+        }
         if (pageComMngVillageDTO.getAlley() != null) {
             userLambdaQueryWrapper.like(ComMngVillageDO::getAlley, pageComMngVillageDTO.getAlley());
         }
@@ -143,8 +141,8 @@
             index++;
         }
         ComActDO comActDO = comActDAO.selectById(communityId);
-        if(comActDO.getStreetId()==null){
-            return R.fail("请绑定街道,再操作!"+comActDO.toString());
+        if(comActDO.getStreetId()==null||comActDO.getStreetId().toString().equals("")){
+            return R.fail("请绑定街道,再操作!");
         }
         ArrayList<ComMngVillageDO> comMngVillageDOS = Lists.newArrayList();
         list.forEach(vo -> {
@@ -157,4 +155,24 @@
         this.saveBatch(comMngVillageDOS);
         return R.ok("共计导入实有房屋数量:" + comMngVillageDOS.size());
     }
+
+    @Override
+    public R editVillage(Long villageId, ComMngVillageVO comMngVillageVO) {
+        ComMngVillageDO comMngVillageDO = this.baseMapper.selectById(villageId);
+        if (comMngVillageDO == null) {
+            return R.fail("id有误!");
+        }
+        BeanUtils.copyProperties(comMngVillageVO, comMngVillageDO);
+        ComActDO comActDO = comActDAO.selectById(comMngVillageDO.getCommunityId());
+        if (comActDO == null || comActDO.getStreetId() == null) {
+            return R.fail("社区没有绑定街道,请绑定后操作!");
+        }
+        comMngVillageDO.setStreetId(comActDO.getStreetId());
+        int update = this.baseMapper.update(comMngVillageDO, new LambdaQueryWrapper<ComMngVillageDO>()
+                .eq(ComMngVillageDO::getVillageId, villageId));
+        if(update>0){
+            return R.ok(comMngVillageVO);
+        }
+        return R.fail();
+    }
 }

--
Gitblit v1.7.1