From b827b2710c1f9ac64fe8879f08e1008a8647966a Mon Sep 17 00:00:00 2001
From: puhanshu <a9236326>
Date: 星期四, 07 七月 2022 13:42:12 +0800
Subject: [PATCH] 大屏数据调整
---
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComStreetServiceImpl.java | 53 ++++++++++++++++++++++++++++++++++++++---------------
1 files changed, 38 insertions(+), 15 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 1f9b4c0..fc7bf59 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,9 +4,12 @@
import javax.annotation.Resource;
+import com.panzhihua.common.model.vos.user.AdministratorsUserVO;
+import com.panzhihua.common.service.user.UserService;
import org.springframework.beans.BeanUtils;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.ObjectUtils;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
@@ -37,6 +40,9 @@
@Resource
private ComStreetDAO comStreetDAO;
+ @Resource
+ private UserService userService;
+
/**
* 新增社区
*
@@ -45,10 +51,8 @@
* @return 新增结果
*/
@Override
- public R addStreet(ComStreetVO comStreetVO) {
- String password = comStreetVO.getPassword();
- String encode = new BCryptPasswordEncoder().encode(password);
- comStreetVO.setPassword(encode);
+ @Transactional
+ public R<ComStreetVO> addStreet(ComStreetVO comStreetVO) {
ComStreetDO comStreetDO = new ComStreetDO();
LambdaQueryWrapper<ComStreetDO> param = new QueryWrapper<ComStreetDO>().lambda();
param.eq(ComStreetDO::getName, comStreetVO.getName());
@@ -59,14 +63,30 @@
if (integer > 0) {
return R.fail(500, "街道已经存在");
}
- BeanUtils.copyProperties(comStreetVO, comStreetDO);
- int insert = comStreetDAO.insert(comStreetDO);
- if (insert > 0) {
- ComStreetDO comStreetDO1 = comStreetDAO.selectOne(param);
- BeanUtils.copyProperties(comStreetDO1, comStreetVO);
- return R.ok(comStreetVO);
+ AdministratorsUserVO administratorsUserVO=new AdministratorsUserVO();
+ administratorsUserVO.setType(3);
+ administratorsUserVO.setAccount(comStreetVO.getAccount());
+ administratorsUserVO.setPassword(comStreetVO.getPassword());
+ administratorsUserVO.setSocialType(1);
+ administratorsUserVO.setRoleId(777777777L);
+ administratorsUserVO.setStreetId(0L);
+ administratorsUserVO.setName(comStreetVO.getName());
+ R r=userService.addUserBackstageProperty(administratorsUserVO);
+ if(R.isOk(r)){
+ BeanUtils.copyProperties(comStreetVO, comStreetDO);
+ int insert = comStreetDAO.insert(comStreetDO);
+ if (insert > 0) {
+ AdministratorsUserVO administratorsUserVO1=new AdministratorsUserVO();
+ administratorsUserVO1.setUserId(Long.parseLong(r.getData().toString()));
+ administratorsUserVO1.setStreetId(comStreetDO.getStreetId());
+ userService.updateStreet(administratorsUserVO1);
+ ComStreetDO comStreetDO1 = comStreetDAO.selectOne(param);
+ BeanUtils.copyProperties(comStreetDO1, comStreetVO);
+ return R.ok(comStreetVO);
+ }
+ return R.fail(500, "");
}
- return R.fail(500, "");
+ return R.fail("账号已存在");
}
/**
@@ -111,10 +131,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);
}
/**
@@ -141,6 +161,9 @@
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 =
comStreetDAO.selectPage(userPage, userLambdaQueryWrapper.orderByDesc(ComStreetDO::getCreateAt));
--
Gitblit v1.7.1