From 73acd2a65a5dbab4573ef2a93a258c0da177bcd3 Mon Sep 17 00:00:00 2001
From: 张天森 <1292933220@qq.com>
Date: 星期四, 17 十一月 2022 11:58:38 +0800
Subject: [PATCH] 普达物业公司权限处理
---
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComStreetServiceImpl.java | 81 ++++++++++++++++++++++++++++++++++++++--
1 files changed, 77 insertions(+), 4 deletions(-)
diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComStreetServiceImpl.java b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComStreetServiceImpl.java
index 370380c..1149166 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComStreetServiceImpl.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComStreetServiceImpl.java
@@ -4,8 +4,13 @@
import javax.annotation.Resource;
+import cn.hutool.core.bean.BeanUtil;
+import cn.hutool.core.codec.Base64;
import com.panzhihua.common.model.vos.user.AdministratorsUserVO;
import com.panzhihua.common.service.user.UserService;
+import com.panzhihua.service_community.dao.ComEventMapper;
+import com.panzhihua.service_community.entity.ComEvent;
+import com.panzhihua.service_community.util.MyAESUtil;
import org.springframework.beans.BeanUtils;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.stereotype.Service;
@@ -42,6 +47,9 @@
@Resource
private UserService userService;
+
+ @Resource
+ private ComEventMapper comEventMapper;
/**
* 新增社区
@@ -131,10 +139,10 @@
if (ObjectUtils.isEmpty(comStreetDO)) {
return R.fail();
}
- ComActVO comActVO = new ComActVO();
- BeanUtils.copyProperties(comStreetDO, comActVO);
- comActVO.setAreaName(comActDAO.selectAreaName(comActVO.getAreaCode()));
- return R.ok(comActVO);
+ ComStreetVO comStreetVO = new ComStreetVO();
+ BeanUtils.copyProperties(comStreetDO, comStreetVO);
+ comStreetVO.setAdministrativeRegions(comStreetDAO.retrieveRegions(comStreetVO.getAreaCode().toString()));
+ return R.ok(comStreetVO);
}
/**
@@ -160,6 +168,9 @@
LambdaQueryWrapper<ComStreetDO> userLambdaQueryWrapper = Wrappers.lambdaQuery();
if (pageComStreetDTO.getName() != null) {
userLambdaQueryWrapper.like(ComStreetDO::getName, pageComStreetDTO.getName());
+ }
+ if (pageComStreetDTO.getAreaCode() != null) {
+ userLambdaQueryWrapper.like(ComStreetDO::getAreaCode, pageComStreetDTO.getAreaCode());
}
Page userPage = new Page(pageNum, pageSize);
IPage<ComStreetDO> doPager =
@@ -190,4 +201,66 @@
return R.fail();
}
+
+ /**
+ * 修改街道信息
+ * @param comStreetVO 街道信息
+ * */
+ @Override
+ public R update(ComStreetVO comStreetVO) {
+ ComStreetDO comStreetDO=new ComStreetDO();
+ BeanUtils.copyProperties(comStreetVO,comStreetDO );
+ return R.ok(comStreetDAO.updateById(comStreetDO));
+ }
+
+ /**
+ * 删除街道
+ * */
+ @Override
+ public R remove(Long id) {
+ //是否有未结事件
+ List<Long> longs = comActDAO.selectCommunityByStreetId(id);
+ List<ComEvent> comEvents = comEventMapper.selectList(new QueryWrapper<ComEvent>().lambda().in(ComEvent::getEventProcessStatus, (4), (6), (7), (8)).in(ComEvent::getRequestUserCommunity, longs));
+ if (comEvents.size()!=0){
+ return R.fail("有未结事件不可删除");
+ }
+ comStreetDAO.deleteById(id);
+ return R.ok();
+ }
+
+ @Override
+ public R removeCommunity(Long id) {
+ //是否有未结案件
+ List<ComEvent> comEvents = comEventMapper.selectList(new QueryWrapper<ComEvent>().lambda().in(ComEvent::getEventProcessStatus, (4), (6), (7), (8)).eq(ComEvent::getRequestUserCommunity, id));
+ if (comEvents.size()!=0){
+ return R.fail("有未结事件不可删除");
+ }
+ comActDAO.deleteById(id);
+ return R.ok();
+ }
+
+ @Override
+ public R repassCommunity(ComActVO comActVO) {
+ ComActDO comActDO=new ComActDO();
+ try {
+ comActDO.setPassword(MyAESUtil.Encrypt(comActVO.getPassword(),"Ryo7M3n8loC5Abcd" ));
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ comActDO.setCommunityId(comActVO.getCommunityId());
+ return R.ok(comActDAO.updateById(comActDO));
+ }
+
+ @Override
+ public R repssStreet(ComStreetVO comActVO) {
+ ComStreetDO comStreetDO=new ComStreetDO();
+ try {
+ comStreetDO.setPassword(MyAESUtil.Encrypt(comActVO.getPassword(),"Ryo7M3n8loC5Abcd" ));
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ comStreetDO.setStreetId(comActVO.getStreetId());
+ return R.ok(comStreetDAO.updateById(comStreetDO));
+ }
+
}
--
Gitblit v1.7.1