springcloud_k8s_panzhihuazhihuishequ/applets_backstage/src/main/java/com/panzhihua/applets_backstage/api/CommunityApi.java
@@ -48,7 +48,7 @@ @ApiOperation(value = "新增社区",response = ComActVO.class) @PostMapping("community") @OperLog(operModul = "社区管理",operType = 1) public R addCommunity(@RequestBody @Validated(AddGroup.class) ComActVO comActVO){ public R addCommunity(@Validated(AddGroup.class) @RequestBody ComActVO comActVO){ R r = communityService.addCommunity(comActVO); if (R.isOk(r)) { ComActVO comActVO1 = JSONObject.parseObject(JSONObject.toJSONString(r.getData()),ComActVO.class); springcloud_k8s_panzhihuazhihuishequ/applets_backstage/src/main/java/com/panzhihua/applets_backstage/api/VillageApi.java
New file @@ -0,0 +1,70 @@ package com.panzhihua.applets_backstage.api; import com.panzhihua.common.controller.BaseController; import com.panzhihua.common.model.dtos.community.PageComMngVillageDTO; import com.panzhihua.common.model.dtos.community.PageComStreetDTO; import com.panzhihua.common.model.vos.LoginUserInfoVO; import com.panzhihua.common.model.vos.R; import com.panzhihua.common.model.vos.community.ComMngVillageVO; import com.panzhihua.common.model.vos.community.ComStreetVO; import com.panzhihua.common.service.community.CommunityService; import com.panzhihua.common.service.user.UserService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.springframework.transaction.annotation.Transactional; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import javax.annotation.Resource; import javax.validation.Valid; import java.util.List; /** * @description: 实有房屋(小区)管理 * @author: llming **/ @Api(tags = {"实有房屋管理"}) @RestController @RequestMapping("/villagemanager/") public class VillageApi extends BaseController { @Resource private CommunityService communityService; @Resource private UserService userService; @ApiOperation(value = "分页查询实有房屋",response = PageComMngVillageDTO.class ) @PostMapping("pagevillage") public R pageVillage(@RequestBody PageComMngVillageDTO pageComMngVillageDTO) { LoginUserInfoVO loginUserInfo = this.getLoginUserInfo(); Long communityId = loginUserInfo.getCommunityId(); pageComMngVillageDTO.setCommunityId(communityId); return communityService.pageVillage(pageComMngVillageDTO); } @ApiOperation(value = "查询实有房屋",response = ComMngVillageVO.class ) @PostMapping("listvillage") public R listVillage(@RequestBody ComMngVillageVO comMngVillageVO) { LoginUserInfoVO loginUserInfo = this.getLoginUserInfo(); Long communityId = loginUserInfo.getCommunityId(); comMngVillageVO.setCommunityId(communityId); return communityService.listVillage(comMngVillageVO); } @ApiOperation(value = "新增实有房屋",response = ComMngVillageVO.class ) @PostMapping("addvillage") public R addVillage(@Valid @RequestBody ComMngVillageVO comMngVillageVO) { LoginUserInfoVO loginUserInfo = this.getLoginUserInfo(); Long communityId = loginUserInfo.getCommunityId(); comMngVillageVO.setCommunityId(communityId); return communityService.addVillage(comMngVillageVO); } @ApiOperation(value = "删除实有房屋") @PostMapping("deletevillage") public R delectVillage(@RequestBody List<Long> Ids) { return communityService.delectVillage(Ids); } } springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/community/PageComMngVillageDTO.java
New file @@ -0,0 +1,29 @@ package com.panzhihua.common.model.dtos.community; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; /** * @author: llming * @description: 实有房屋 **/ @Data @ApiModel("实有房屋请求参数") public class PageComMngVillageDTO { @ApiModelProperty("街路巷") private String alley; @ApiModelProperty(value = "分页-当前页数",example = "1") private Long pageNum; @ApiModelProperty(value = "分页-每页记录数",example = "10") private Long pageSize; @ApiModelProperty("社区id") private Long communityId; } springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/community/PageComStreetDTO.java
@@ -18,9 +18,6 @@ @ApiModelProperty("街道名字") private String name; @ApiModelProperty("区级地址编码") private String areaCode; @ApiModelProperty(value = "分页-当前页数",example = "1") private Long pageNum; springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/community/ComActVO.java
@@ -81,4 +81,8 @@ @ApiModelProperty("距离-单位米") private String distance; @ApiModelProperty("街道Id") @NotBlank(groups = {AddGroup.class},message = "街道Id不能为空") private Integer streetId; } springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/community/ComMngVillageVO.java
New file @@ -0,0 +1,35 @@ package com.panzhihua.common.model.vos.community; import com.fasterxml.jackson.annotation.JsonFormat; import com.panzhihua.common.validated.AddGroup; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import javax.validation.constraints.NotBlank; import java.util.Date; /** * @author: llming * @description: 实有房屋(小区) **/ @Data @ApiModel("实有房屋(小区)") public class ComMngVillageVO { @ApiModelProperty("街路巷") @NotBlank(groups = {AddGroup.class}, message = "街路巷不能为空") private String alley; @ApiModelProperty("门牌号") @NotBlank(groups = {AddGroup.class}, message = "门牌号不能为空") private Integer houseNum; @ApiModelProperty("小区(组)") private String group; @ApiModelProperty("社区id") private Long communityId; @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") private Date createAt; } springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/community/ComStreetVO.java
@@ -26,15 +26,15 @@ @ApiModelProperty("省份地址编码") @NotBlank(groups = {AddGroup.class},message = "省份地址编码不能为空") private String provinceCode; private Integer provinceCode; @ApiModelProperty("市级地址编码") @NotBlank(groups = {AddGroup.class},message = "市级地址编码不能为空") private String cityCode; private Integer cityCode; @ApiModelProperty("区级地址编码") @NotBlank(groups = {AddGroup.class},message = "纬度不能为空") private String areaCode; private Integer areaCode; @ApiModelProperty("街道地址") @NotBlank(groups = {AddGroup.class},message = "街道地址不能为空") springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/service/community/CommunityService.java
@@ -835,11 +835,11 @@ /** * 查询城市下属所有地区列表 * @param provinceAdcode 城市地址编码 * @param cityAdcode 城市地址编码 * @return 地区列表 */ @GetMapping("/common/data/city") R listAreaDistrict(@RequestParam("provinceAdcode") Long provinceAdcode); @PostMapping("listareadistrict") R listAreaDistrict(@RequestParam("cityAdcode") Long cityAdcode); /** * 首页图表数据汇总 @@ -1352,4 +1352,36 @@ */ @PostMapping("/liststreet") R listStreet(ComStreetVO comStreetVO); /** * 分页查询实有房屋 * @param pageComMngVillageDTO * @return */ @PostMapping("/pagevillage") R pageVillage(@RequestBody PageComMngVillageDTO pageComMngVillageDTO); /** * 新增实有房屋 * @param comMngVillageVO * @return */ @PostMapping("/addvillage") R addVillage(@RequestBody ComMngVillageVO comMngVillageVO); /** * 删除实有房屋 * @param Ids * @return */ @PostMapping("/deletestreet") R delectVillage(@RequestBody List<Long> Ids); /** * 查询实有房屋 * @param comMngVillageVO * @return */ @PostMapping("/listvillage") R listVillage(ComMngVillageVO comMngVillageVO); } springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/api/ComMngVillageApi.java
New file @@ -0,0 +1,78 @@ package com.panzhihua.service_community.api; import com.panzhihua.common.model.dtos.community.PageComMngVillageDTO; import com.panzhihua.common.model.dtos.community.PageComStreetDTO; import com.panzhihua.common.model.vos.R; import com.panzhihua.common.model.vos.community.ComMngVillageVO; import com.panzhihua.common.model.vos.community.ComStreetVO; import com.panzhihua.service_community.service.ComMngVillageService; import com.panzhihua.service_community.service.ComStreetService; import lombok.extern.slf4j.Slf4j; import org.springframework.transaction.annotation.Transactional; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import javax.annotation.Resource; import javax.validation.Valid; import java.util.List; /** * @Author: llming * @Description: 实有房屋管理 */ @Slf4j @RestController @RequestMapping("/") public class ComMngVillageApi { @Resource private ComMngVillageService comMngVillageService; /** * 新增实有房屋 * @param comMngVillageVO 新增信息 * @return 新增结果 */ @PostMapping("addvillage") @Transactional(rollbackFor = Exception.class) public R addVillage(@Valid @RequestBody ComMngVillageVO comMngVillageVO) { R r = comMngVillageService.addComMngVillage(comMngVillageVO); return R.ok(r); } /** * 分页查询实有房屋 * @param pageComMngVillageDTO 查询条件 * @return 新增结果 */ @PostMapping("pagevillage") public R pageVillage(@RequestBody PageComMngVillageDTO pageComMngVillageDTO) { R r = comMngVillageService.pageComMngVillage(pageComMngVillageDTO); return R.ok(r); } /** * 查询实有房屋 * @param comMngVillageVO 查询条件 * @return 新增结果 */ @PostMapping("listvillage") public R listVillage(@RequestBody ComMngVillageVO comMngVillageVO) { R r = comMngVillageService.listComMngVillage(comMngVillageVO); return R.ok(r); } /** * 删除实有房屋 * @param Ids 动态id * @return 删除结果 */ @PostMapping("deletevillage") @Transactional(rollbackFor = Exception.class) public R delectVillage(@RequestBody List<Long> Ids) { R r = comMngVillageService.delecComMngVillage(Ids); return R.ok(r); } } springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComMngVillageDAO.java
New file @@ -0,0 +1,13 @@ package com.panzhihua.service_community.dao; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.panzhihua.service_community.model.dos.ComMngVillageDO; import org.apache.ibatis.annotations.Mapper; /** * @author: llming * @description: 街道 **/ @Mapper public interface ComMngVillageDAO extends BaseMapper<ComMngVillageDO> { } springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComStreetDAO.java
@@ -21,26 +21,4 @@ @Mapper public interface ComStreetDAO extends BaseMapper<ComStreetDO> { @Select("<script> " + "SELECT\n" + "c.community_id,\n" + "c.`name`,\n" + "ST_Distance_Sphere ( Point ( #{lng}, #{lat} ), Point ( c.lng, c.lat ) ) AS distance \n" + "FROM\n" + "com_act c \n" + " <where>" + "<if test='areaCode != null and areaCode.trim() != ""'>" + "c.area_code = #{areaCode} \n" + " </if> " + " </where>" + "ORDER BY\n" + "distance ASC" + "<if test='lng != null and lng.trim() != ""'>" + " limit 10 " + " </if> " + "</script>") List<ComActVO> listCommunity(ComActVO comActVO); @Select("select district_name from com_mng_struct_area_district where district_adcode=#{areaCode}") String selectAreaName(String areaCode); } springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/model/dos/ComActDO.java
@@ -94,5 +94,10 @@ */ private Integer state; /** * 街道ID */ private Integer streetId; } springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/model/dos/ComMngVillageDO.java
New file @@ -0,0 +1,53 @@ package com.panzhihua.service_community.model.dos; import com.baomidou.mybatisplus.annotation.*; import com.fasterxml.jackson.annotation.JsonFormat; import lombok.Data; import java.io.Serializable; import java.util.Date; /** * @author: llming * @description: 实有房屋(小区) **/ @Data @TableName(value = "com_mng_village") public class ComMngVillageDO implements Serializable { private static final long serialVersionUID = 1L; /** * villageId */ @TableId(type = IdType.AUTO) private Long villageId; /** * 街路巷 */ private String alley; /** * 门牌号 */ private Integer houseNum; /** * 小区(组) */ private String group; /** * 创建时间 */ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") @TableField(fill = FieldFill.INSERT) private Date createAt; /** * 社区id */ @TableId(type = IdType.AUTO) private Long communityId; /** * 街道id */ @TableId(type = IdType.AUTO) private Long streetId; } springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/model/dos/ComStreetDO.java
@@ -2,11 +2,7 @@ import com.baomidou.mybatisplus.annotation.*; import com.fasterxml.jackson.annotation.JsonFormat; import com.panzhihua.common.validated.AddGroup; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import javax.validation.constraints.NotBlank; import java.io.Serializable; import java.util.Date; @@ -31,15 +27,15 @@ /** * 省份地址编码 */ private String provinceCode; private Integer provinceCode; /** * 市级地址编码 */ private String cityCode; private Integer cityCode; /** * 区级地址编码 */ private String areaCode; private Integer areaCode; /** * 街道地址 */ springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/ComMngVillageService.java
New file @@ -0,0 +1,40 @@ package com.panzhihua.service_community.service; import com.panzhihua.common.model.dtos.community.PageComMngVillageDTO; import com.panzhihua.common.model.vos.R; import com.panzhihua.common.model.vos.community.ComMngVillageVO; import java.util.List; /** * @author: llming * @description: 实有房屋(小区) **/ public interface ComMngVillageService { /** * 添加实有房屋 * @param comMngVillageVO 实有房屋 * @return 新增结果 */ R addComMngVillage(ComMngVillageVO comMngVillageVO); /** * 查询实有房屋 * @param comMngVillageVO 登录人的经纬度、或者指定区域的社区 * @return 社区集合 */ R listComMngVillage(ComMngVillageVO comMngVillageVO); /** * 分页查询实有房屋 * @param pageComMngVillageDTO 查询参数 * @return 分页集合 */ R pageComMngVillage(PageComMngVillageDTO pageComMngVillageDTO); /** * 删除实有房屋 * @param Ids 实有房屋ids * @return 删除结果 */ R delecComMngVillage(List<Long> Ids); } springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComMngVillageServiceImpl.java
New file @@ -0,0 +1,97 @@ package com.panzhihua.service_community.service.impl; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.google.common.collect.Lists; import com.panzhihua.common.model.dtos.community.PageComMngVillageDTO; import com.panzhihua.common.model.vos.R; import com.panzhihua.common.model.vos.community.ComMngVillageVO; import com.panzhihua.common.model.vos.community.ComStreetVO; import com.panzhihua.service_community.dao.ComActDAO; import com.panzhihua.service_community.dao.ComMngVillageDAO; 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.ComMngVillageService; import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Service; import javax.annotation.Resource; import java.util.List; /** * @author: llming * @description: 实有房屋 **/ @Service public class ComMngVillageServiceImpl implements ComMngVillageService { @Resource ComMngVillageDAO comMngVillageDAO; @Override public R addComMngVillage(ComMngVillageVO comMngVillageVO) { ComMngVillageDO comMngVillageDO = new ComMngVillageDO(); LambdaQueryWrapper<ComMngVillageDO> param = new QueryWrapper<ComMngVillageDO>().lambda(); param.eq(ComMngVillageDO::getCommunityId, comMngVillageVO.getCommunityId()); Integer resultCount = comMngVillageDAO.selectCount(param); if (resultCount > 0) { return R.fail("实有房屋已经存在"); } BeanUtils.copyProperties(comMngVillageVO, comMngVillageDO); int insert = comMngVillageDAO.insert(comMngVillageDO); if (insert > 0) { param.eq(ComMngVillageDO::getAlley, comMngVillageVO.getAlley()); param.eq(ComMngVillageDO::getHouseNum, comMngVillageVO.getHouseNum()); ComMngVillageDO comMngVillageDO1 = comMngVillageDAO.selectOne(param); BeanUtils.copyProperties(comMngVillageDO1, comMngVillageVO); return R.ok(comMngVillageVO); } return R.fail(); } @Override public R listComMngVillage(ComMngVillageVO comMngVillageVO) { List<ComMngVillageDO> vos = Lists.newArrayList(); LambdaQueryWrapper<ComMngVillageDO> param = new QueryWrapper<ComMngVillageDO>().lambda(); param.eq(ComMngVillageDO::getAlley, comMngVillageVO.getAlley()); param.eq(ComMngVillageDO::getCommunityId, comMngVillageVO.getCommunityId()); List<ComMngVillageDO> comMngVillageDOS = comMngVillageDAO.selectList(param); BeanUtils.copyProperties(vos, comMngVillageDOS); return R.ok(vos); } @Override public R pageComMngVillage(PageComMngVillageDTO pageComMngVillageDTO) { Page page = new Page<>(); Long pageNum = pageComMngVillageDTO.getPageNum(); Long pageSize = pageComMngVillageDTO.getPageSize(); if (null == pageNum || 0 == pageNum) { pageNum = 1l; } if (null == pageSize || 0 == pageSize) { pageSize = 10l; } page.setSize(pageSize); page.setCurrent(pageNum); LambdaQueryWrapper<ComMngVillageDO> userLambdaQueryWrapper = Wrappers.lambdaQuery(); if (!pageComMngVillageDTO.getAlley().isEmpty()) { userLambdaQueryWrapper.like(ComMngVillageDO::getAlley, pageComMngVillageDTO.getAlley()); } Page userPage = new Page(pageNum, pageSize); IPage<ComMngVillageDO> doPager = comMngVillageDAO.selectPage(userPage, userLambdaQueryWrapper); return R.ok(doPager); } @Override public R delecComMngVillage(List<Long> Ids) { int delete = comMngVillageDAO.deleteBatchIds(Ids); if (delete > 0) { return R.ok(); } return R.fail(); } } springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComStreetServiceImpl.java
@@ -81,7 +81,7 @@ param.eq(ComStreetDO::getAreaCode, comStreetVO.getCityCode()); List<ComStreetDO> ComStreetDOS = comStreetDAO.selectList(param); BeanUtils.copyProperties(vos, ComStreetDOS); return R.ok(comStreetVO); return R.ok(vos); } /**