From a2c792ee79e69224d71dc6204c6cc01f92b9384e Mon Sep 17 00:00:00 2001 From: manailin <261030956@qq.com> Date: 星期一, 23 八月 2021 16:14:46 +0800 Subject: [PATCH] [新增]整理代码规范 --- springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActServiceImpl.java | 121 ++++++++++++++++++++++------------------ 1 files changed, 66 insertions(+), 55 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 68ddeaf..41cd082 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 @@ -1,34 +1,31 @@ package com.panzhihua.service_community.service.impl; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import com.panzhihua.common.model.dtos.community.PageComActDTO; -import com.panzhihua.common.model.dtos.community.switchs.SearchCommunityDTO; -import com.panzhihua.common.model.dtos.user.PageFeedBackDTO; -import com.panzhihua.common.model.vos.R; -import com.panzhihua.common.model.vos.community.ComActVO; -import com.panzhihua.common.model.vos.community.ComMngStructOtherBuildVO; -import com.panzhihua.common.model.vos.community.switchs.CommunitySwitchAllAppletsVO; -import com.panzhihua.common.model.vos.community.switchs.StreetAllAppletsVO; -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 java.util.ArrayList; +import java.util.Comparator; +import java.util.List; +import java.util.stream.Collectors; + +import javax.annotation.Resource; + import org.springframework.beans.BeanUtils; import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; import org.springframework.stereotype.Service; import org.springframework.util.ObjectUtils; -import javax.annotation.Resource; -import java.util.ArrayList; -import java.util.Collections; -import java.util.Comparator; -import java.util.List; -import java.util.stream.Collectors; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.panzhihua.common.model.dtos.community.PageComActDTO; +import com.panzhihua.common.model.dtos.community.switchs.SearchCommunityDTO; +import com.panzhihua.common.model.vos.R; +import com.panzhihua.common.model.vos.community.ComActVO; +import com.panzhihua.common.model.vos.community.switchs.CommunitySwitchAllAppletsVO; +import com.panzhihua.common.model.vos.community.switchs.StreetAllAppletsVO; +import com.panzhihua.service_community.dao.ComActDAO; +import com.panzhihua.service_community.dao.ComStreetDAO; +import com.panzhihua.service_community.model.dos.ComActDO; +import com.panzhihua.service_community.model.dos.ComStreetDO; +import com.panzhihua.service_community.service.ComActService; /** * @program: springcloud_k8s_panzhihuazhihuishequ @@ -46,7 +43,8 @@ /** * 新增社区 * - * @param comActVO 社区信息 + * @param comActVO + * 社区信息 * @return 新增结果 */ @Override @@ -59,14 +57,16 @@ return R.fail("当前街道不存在!"); } ComActDO comActDO = new ComActDO(); - Integer integer = comActDAO.selectCount(new QueryWrapper<ComActDO>().lambda().eq(ComActDO::getName, comActVO.getName())); + Integer integer = + comActDAO.selectCount(new QueryWrapper<ComActDO>().lambda().eq(ComActDO::getName, comActVO.getName())); if (integer > 0) { return R.fail("社区已经存在"); } BeanUtils.copyProperties(comActVO, comActDO); int insert = comActDAO.insert(comActDO); if (insert > 0) { - ComActDO comActDO1 = comActDAO.selectOne(new QueryWrapper<ComActDO>().lambda().eq(ComActDO::getName, comActVO.getName())); + ComActDO comActDO1 = + comActDAO.selectOne(new QueryWrapper<ComActDO>().lambda().eq(ComActDO::getName, comActVO.getName())); BeanUtils.copyProperties(comActDO1, comActVO); return R.ok(comActVO); } @@ -76,7 +76,8 @@ /** * 编辑社区 * - * @param comActVO 编辑内容 + * @param comActVO + * 编辑内容 * @return 编辑结果 */ @Override @@ -85,7 +86,7 @@ String password = comActVO.getPassword(); String account = comActVO.getAccount(); Long communityId = comActVO.getCommunityId(); -// String contacts = comActVO.getContacts(); + // String contacts = comActVO.getContacts(); int a = 0; if (!ObjectUtils.isEmpty(password)) { String encode = new BCryptPasswordEncoder().encode(password); @@ -96,15 +97,15 @@ if (comStreetDO == null) { return R.fail("当前街道不存在!"); } -// if(!ObjectUtils.isEmpty(account)||!ObjectUtils.isEmpty(contacts)){ -// a=1; -// } + // if(!ObjectUtils.isEmpty(account)||!ObjectUtils.isEmpty(contacts)){ + // a=1; + // } BeanUtils.copyProperties(comActVO, comActDO); int update = comActDAO.updateById(comActDO); if (update > 0) { if (a == 1) { -// 修改登录账户的密码 + // 修改登录账户的密码 comActDAO.updateAccountPassword(comActVO.getPassword(), account, communityId); } return R.ok(); @@ -115,7 +116,8 @@ /** * 查询社区 * - * @param comActVO 登录人的经纬度、或者指定区域的社区 + * @param comActVO + * 登录人的经纬度、或者指定区域的社区 * @return 社区集合 */ @Override @@ -127,7 +129,8 @@ /** * 社区详情 * - * @param communityId 社区id + * @param communityId + * 社区id * @return 社区详情 */ @Override @@ -145,7 +148,8 @@ /** * 分页查询社区 * - * @param pageComActDTO 查询参数 + * @param pageComActDTO + * 查询参数 * @return 分页集合 */ @Override @@ -173,8 +177,7 @@ @Override public R listCommunityAll() { List<ComActDO> comActDOS = comActDAO.selectList(new QueryWrapper<ComActDO>().lambda().eq(ComActDO::getState, 0) - .eq(ComActDO::getCityCode, "510400") - .orderByDesc(ComActDO::getCreateAt)); + .eq(ComActDO::getCityCode, "510400").orderByDesc(ComActDO::getCreateAt)); List<ComActVO> comActVOS = new ArrayList<>(); if (!ObjectUtils.isEmpty(comActDOS)) { comActDOS.forEach(comActDO -> { @@ -189,7 +192,8 @@ /** * 删除社区 * - * @param communityId 社区id + * @param communityId + * 社区id * @return 删除结果 */ @Override @@ -203,52 +207,59 @@ /** * 综治后台-查询社区列表 - * @return 社区列表 + * + * @return 社区列表 */ @Override - public R getCommunityLists(){ + public R getCommunityLists() { return R.ok(this.comActDAO.getCommunityLists()); } /** * 查询社区所有列表 - * @return 社区列表 + * + * @return 社区列表 */ @Override - public R getCommunityAllList(){ - //查询街道列表 + public R getCommunityAllList() { + // 查询街道列表 List<StreetAllAppletsVO> streetList = this.comActDAO.getStreetList(); streetList.forEach(street -> { - //查询街道下社区列表 - List<CommunitySwitchAllAppletsVO> communityList = this.comActDAO.getCommunityListByStreetId(street.getStreetId()); - if(!communityList.isEmpty()){ + // 查询街道下社区列表 + List<CommunitySwitchAllAppletsVO> communityList = + this.comActDAO.getCommunityListByStreetId(street.getStreetId()); + if (!communityList.isEmpty()) { street.setChildList(communityList); street.setCount(communityList.size()); } }); - streetList = streetList.stream().sorted(Comparator.comparing(StreetAllAppletsVO::getCount).reversed()).collect(Collectors.toList()); + streetList = streetList.stream().sorted(Comparator.comparing(StreetAllAppletsVO::getCount).reversed()) + .collect(Collectors.toList()); return R.ok(streetList); } /** * 根据名字查询所有社区列表 - * @param name 社区名字 - * @return 社区列表 + * + * @param name + * 社区名字 + * @return 社区列表 */ @Override - public R communitySwitchSearchList(String name){ + public R communitySwitchSearchList(String name) { return R.ok(this.comActDAO.getCommunityListByName(name)); } /** * 根据经纬度以及距离搜索附近社区列表 - * @param communityDTO 请求参数 - * @return 社区列表 + * + * @param communityDTO + * 请求参数 + * @return 社区列表 */ @Override - public R communitySwitchSearchDistanceList(SearchCommunityDTO communityDTO){ + public R communitySwitchSearchDistanceList(SearchCommunityDTO communityDTO) { return R.ok(this.comActDAO.getCommunityListByNearby(communityDTO)); } - } -- Gitblit v1.7.1