From 4b4239c73b70c6e6087442c258777ec31d935014 Mon Sep 17 00:00:00 2001
From: lidongdong <1459917685@qq.com>
Date: 星期三, 30 八月 2023 17:02:22 +0800
Subject: [PATCH] 修改小程序商家商品新增
---
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComStreetServiceImpl.java | 87 ++++++++++++++++++++++++++++++++++++++++---
1 files changed, 80 insertions(+), 7 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 b9ed547..f40788b 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,14 @@
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.common.utlis.Snowflake;
+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;
@@ -43,6 +49,9 @@
@Resource
private UserService userService;
+ @Resource
+ private ComEventMapper comEventMapper;
+
/**
* 新增社区
*
@@ -53,9 +62,6 @@
@Override
@Transactional
public R<ComStreetVO> addStreet(ComStreetVO comStreetVO) {
- String password = comStreetVO.getPassword();
- String encode = new BCryptPasswordEncoder().encode(password);
- comStreetVO.setPassword(encode);
ComStreetDO comStreetDO = new ComStreetDO();
LambdaQueryWrapper<ComStreetDO> param = new QueryWrapper<ComStreetDO>().lambda();
param.eq(ComStreetDO::getName, comStreetVO.getName());
@@ -74,11 +80,16 @@
administratorsUserVO.setRoleId(777777777L);
administratorsUserVO.setStreetId(0L);
administratorsUserVO.setName(comStreetVO.getName());
+ administratorsUserVO.setUserId(Snowflake.getId());
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);
@@ -130,10 +141,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);
}
/**
@@ -192,4 +203,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