From a8e77d738952c6e231769a4112fce7299eb4f56c Mon Sep 17 00:00:00 2001
From: CeDo <cedoogle@gmail.com>
Date: 星期四, 20 五月 2021 19:15:01 +0800
Subject: [PATCH] bugfixed

---
 springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComMngVillageServiceImpl.java |   34 +++++++++++++++++++++++++++++-----
 1 files changed, 29 insertions(+), 5 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 0770984..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
@@ -56,6 +51,9 @@
         }
         BeanUtils.copyProperties(comMngVillageVO, comMngVillageDO);
         ComActDO comActDO = comActDAO.selectById(comMngVillageDO.getCommunityId());
+        if (comActDO == null || comActDO.getStreetId() == null) {
+            return R.fail("社区没有绑定街道,请绑定后操作!");
+        }
         comMngVillageDO.setStreetId(comActDO.getStreetId());
         int insert = comActVillageDAO.insert(comMngVillageDO);
         if (insert > 0) {
@@ -94,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());
         }
@@ -140,6 +141,9 @@
             index++;
         }
         ComActDO comActDO = comActDAO.selectById(communityId);
+        if(comActDO.getStreetId()==null||comActDO.getStreetId().toString().equals("")){
+            return R.fail("请绑定街道,再操作!");
+        }
         ArrayList<ComMngVillageDO> comMngVillageDOS = Lists.newArrayList();
         list.forEach(vo -> {
             ComMngVillageDO comMngVillageDO = new ComMngVillageDO();
@@ -151,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