From 33afca8d0d2a496b70801fdcea4c06809d8a87d9 Mon Sep 17 00:00:00 2001
From: huanghongfa <huanghongfa123456>
Date: 星期五, 09 七月 2021 14:11:00 +0800
Subject: [PATCH] 修改bug
---
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActServiceImpl.java | 71 ++++++++++++++++++++++++-----------
1 files changed, 49 insertions(+), 22 deletions(-)
diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActServiceImpl.java b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActServiceImpl.java
index 55dad24..40d813c 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActServiceImpl.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActServiceImpl.java
@@ -9,7 +9,11 @@
import com.panzhihua.common.model.vos.community.ComActVO;
import com.panzhihua.common.model.vos.community.ComMngStructOtherBuildVO;
import com.panzhihua.service_community.dao.ComActDAO;
+import com.panzhihua.service_community.dao.ComActVillageDAO;
+import com.panzhihua.service_community.dao.ComStreetDAO;
import com.panzhihua.service_community.model.dos.ComActDO;
+import com.panzhihua.service_community.model.dos.ComMngVillageDO;
+import com.panzhihua.service_community.model.dos.ComStreetDO;
import com.panzhihua.service_community.service.ComActService;
import org.springframework.beans.BeanUtils;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
@@ -30,6 +34,9 @@
public class ComActServiceImpl implements ComActService {
@Resource
private ComActDAO comActDAO;
+ @Resource
+ private ComStreetDAO comStreetDAO;
+
/**
* 新增社区
*
@@ -41,16 +48,20 @@
String password = comActVO.getPassword();
String encode = new BCryptPasswordEncoder().encode(password);
comActVO.setPassword(encode);
- ComActDO comActDO=new ComActDO();
+ ComStreetDO comStreetDO = comStreetDAO.selectById(comActVO.getStreetId());
+ if (comStreetDO == null) {
+ return R.fail("当前街道不存在!");
+ }
+ ComActDO comActDO = new ComActDO();
Integer integer = comActDAO.selectCount(new QueryWrapper<ComActDO>().lambda().eq(ComActDO::getName, comActVO.getName()));
- if (integer>0) {
+ if (integer > 0) {
return R.fail("社区已经存在");
}
- BeanUtils.copyProperties(comActVO,comActDO);
+ BeanUtils.copyProperties(comActVO, comActDO);
int insert = comActDAO.insert(comActDO);
- if (insert>0) {
+ if (insert > 0) {
ComActDO comActDO1 = comActDAO.selectOne(new QueryWrapper<ComActDO>().lambda().eq(ComActDO::getName, comActVO.getName()));
- BeanUtils.copyProperties(comActDO1,comActVO);
+ BeanUtils.copyProperties(comActDO1, comActVO);
return R.ok(comActVO);
}
return R.fail();
@@ -64,26 +75,31 @@
*/
@Override
public R putCommunity(ComActVO comActVO) {
- ComActDO comActDO=new ComActDO();
+ ComActDO comActDO = new ComActDO();
String password = comActVO.getPassword();
String account = comActVO.getAccount();
Long communityId = comActVO.getCommunityId();
// String contacts = comActVO.getContacts();
- int a=0;
+ int a = 0;
if (!ObjectUtils.isEmpty(password)) {
String encode = new BCryptPasswordEncoder().encode(password);
comActVO.setPassword(encode);
- a=1;
+ a = 1;
+ }
+ ComStreetDO comStreetDO = comStreetDAO.selectById(comActVO.getStreetId());
+ if (comStreetDO == null) {
+ return R.fail("当前街道不存在!");
}
// if(!ObjectUtils.isEmpty(account)||!ObjectUtils.isEmpty(contacts)){
// a=1;
// }
- BeanUtils.copyProperties(comActVO,comActDO);
+ BeanUtils.copyProperties(comActVO, comActDO);
+
int update = comActDAO.updateById(comActDO);
- if (update>0) {
- if (a==1) {
+ if (update > 0) {
+ if (a == 1) {
// 修改登录账户的密码
- comActDAO.updateAccountPassword(comActVO.getPassword(),account,communityId);
+ comActDAO.updateAccountPassword(comActVO.getPassword(), account, communityId);
}
return R.ok();
}
@@ -98,7 +114,7 @@
*/
@Override
public R listCommunity(ComActVO comActVO) {
- List<ComActVO> comActVOS=comActDAO.listCommunity(comActVO);
+ List<ComActVO> comActVOS = comActDAO.listCommunity(comActVO);
return R.ok(comActVOS);
}
@@ -114,8 +130,8 @@
if (ObjectUtils.isEmpty(comActDO)) {
return R.fail();
}
- ComActVO comActVO=new ComActVO();
- BeanUtils.copyProperties(comActDO,comActVO);
+ ComActVO comActVO = new ComActVO();
+ BeanUtils.copyProperties(comActDO, comActVO);
comActVO.setAreaName(comActDAO.selectAreaName(comActVO.getAreaCode()));
return R.ok(comActVO);
}
@@ -131,10 +147,10 @@
Page page = new Page<>();
Long pageNum = pageComActDTO.getPageNum();
Long pageSize = pageComActDTO.getPageSize();
- if (null==pageNum||0==pageNum) {
+ if (null == pageNum || 0 == pageNum) {
pageNum = 1l;
}
- if (null==pageSize||0==pageSize) {
+ if (null == pageSize || 0 == pageSize) {
pageSize = 10l;
}
page.setSize(pageSize);
@@ -150,12 +166,14 @@
*/
@Override
public R listCommunityAll() {
- List<ComActDO> comActDOS = comActDAO.selectList(new QueryWrapper<ComActDO>().lambda().eq(ComActDO::getState, 0).orderByDesc(ComActDO::getCreateAt));
- List<ComActVO> comActVOS=new ArrayList<>();
+ List<ComActDO> comActDOS = comActDAO.selectList(new QueryWrapper<ComActDO>().lambda().eq(ComActDO::getState, 0)
+ .eq(ComActDO::getCityCode, "510400")
+ .orderByDesc(ComActDO::getCreateAt));
+ List<ComActVO> comActVOS = new ArrayList<>();
if (!ObjectUtils.isEmpty(comActDOS)) {
comActDOS.forEach(comActDO -> {
- ComActVO comActVO=new ComActVO();
- BeanUtils.copyProperties(comActDO,comActVO);
+ ComActVO comActVO = new ComActVO();
+ BeanUtils.copyProperties(comActDO, comActVO);
comActVOS.add(comActVO);
});
}
@@ -171,11 +189,20 @@
@Override
public R delectCommunity(Long communityId) {
int delete = comActDAO.deleteById(communityId);
- if (delete>0) {
+ if (delete > 0) {
return R.ok();
}
return R.fail();
}
+ /**
+ * 综治后台-查询社区列表
+ * @return 社区列表
+ */
+ @Override
+ public R getCommunityLists(){
+ return R.ok(this.comActDAO.getCommunityLists());
+ }
+
}
--
Gitblit v1.7.1