DESKTOP-71BH0QO\L、ming
2021-03-26 3abb261e5a10b11b20f4bc1712a524be9cbc82f1
Add:新增街道管理相关接口
11个文件已修改
453 ■■■■■ 已修改文件
springcloud_k8s_panzhihuazhihuishequ/applets/src/main/java/com/panzhihua/applets/api/CommonApi.java 44 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/controller/BaseController.java 29 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/community/ComMngCityVO.java 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/community/ComMngProvinceVO.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/community/ComOpsHouseVO.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/service/community/CommunityService.java 47 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/community_backstage/src/main/java/com/panzhihua/community_backstage/api/CommonDataApi.java 246 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/pom.xml 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/api/CommonDataApi.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/ComMngProvinceService.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComMngProvinceServiceImpl.java 52 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/applets/src/main/java/com/panzhihua/applets/api/CommonApi.java
@@ -1,11 +1,15 @@
package com.panzhihua.applets.api;
import cn.binarywang.wx.miniapp.api.WxMaSecCheckService;
import com.netflix.discovery.converters.Auto;
import com.panzhihua.applets.config.WxMaConfiguration;
import com.panzhihua.common.constants.FtpConstants;
import com.panzhihua.common.constants.UserConstants;
import com.panzhihua.common.model.vos.R;
import com.panzhihua.common.model.vos.area.AreaInfoVo;
import com.panzhihua.common.model.vos.user.UserPhoneVO;
import com.panzhihua.common.service.community.CommunityService;
import com.panzhihua.common.service.user.UserService;
import com.panzhihua.common.utlis.SFTPUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@@ -25,6 +29,7 @@
import java.io.IOException;
import java.io.InputStream;
import java.util.Base64;
import java.util.List;
import java.util.UUID;
import java.util.concurrent.TimeUnit;
@@ -58,37 +63,39 @@
    @Resource
    private WxMaConfiguration wxMaConfiguration;
    @Resource
    private CommunityService communityService;
    @ApiOperation(value = "上传照片")
    @PostMapping(value = "uploadimage",consumes = "multipart/*",headers = "content-type=multipart/form-date")
    @PostMapping(value = "uploadimage", consumes = "multipart/*", headers = "content-type=multipart/form-date")
    public R uploadImage(@RequestParam MultipartFile file, HttpServletRequest request) throws IOException {
//        微信图片内容校验
        WxMaSecCheckService wxMaSecCheckService=wxMaConfiguration.getMaService().getSecCheckService();
        WxMaSecCheckService wxMaSecCheckService = wxMaConfiguration.getMaService().getSecCheckService();
        String property = System.getProperty("user.dir");
        String fileName = property + File.separator + UUID.randomUUID().toString().replace("-", "")+".jpg";
        File file1=new File(fileName);
        String fileName = property + File.separator + UUID.randomUUID().toString().replace("-", "") + ".jpg";
        File file1 = new File(fileName);
        String name = file.getOriginalFilename();
        name= UUID.randomUUID().toString().replaceAll("-","")+".jpg";
        name = UUID.randomUUID().toString().replaceAll("-", "") + ".jpg";
        try {
            SFTPUtil sftp = new SFTPUtil(userName,password,host,port);
            SFTPUtil sftp = new SFTPUtil(userName, password, host, port);
            sftp.login();
            InputStream is = file.getInputStream();
            file.transferTo(file1);
        try {
            boolean b = wxMaSecCheckService.checkImage(file1);
            boolean delete = file1.delete();
            log.info("临时文件删除【{}】",delete);
            if (!b) {
                return R.fail("图片内容违规");
            try {
                boolean b = wxMaSecCheckService.checkImage(file1);
                boolean delete = file1.delete();
                log.info("临时文件删除【{}】", delete);
                if (!b) {
                    return R.fail("图片内容违规");
                }
            } catch (WxErrorException e) {
                log.error("微信审核图片出错【{}】", e.getMessage());
                e.printStackTrace();
            }
        } catch (WxErrorException e) {
            log.error("微信审核图片出错【{}】",e.getMessage());
            e.printStackTrace();
        }
            sftp.uploadMore(FtpConstants.FTPFILEPATH_IDCARD, name, is);
            sftp.logout();
            return R.ok(url+"/idcard/" + name);
            return R.ok(url + "/idcard/" + name);
        } catch (Exception e) {
            log.error("上传照片失败【{}】", e.getMessage());
            return R.fail();
@@ -106,10 +113,11 @@
        //todo 发送验证码接第三方
        int nextInt = RandomUtils.nextInt(99999, 1000000);
        ValueOperations<String, String> valueOperations = stringRedisTemplate.opsForValue();
        valueOperations.set(UserConstants.PHONE_PUT+newPhone,nextInt+"",3, TimeUnit.MINUTES);
        valueOperations.set(UserConstants.PHONE_PUT + newPhone, nextInt + "", 3, TimeUnit.MINUTES);
        return R.ok(nextInt);
    }
    public static void main(String[] args) {
//        int nextInt = RandomUtils.nextInt(99999, 1000000);
//        System.out.println(nextInt);
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/controller/BaseController.java
@@ -14,9 +14,9 @@
import org.springframework.util.ObjectUtils;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import sun.security.krb5.internal.crypto.Aes256;
import javax.servlet.http.HttpServletRequest;
/**
 * @program: springcloud_k8s_panzhihuazhihuishequ
@@ -35,9 +35,10 @@
    /**
     * 获取登录对象信息
     *
     * @return 对象userid
     */
    public Long getUserId(){
    public Long getUserId() {
        LoginUserInfoVO loginUserInfo = this.getLoginUserInfo();
        Long userId = loginUserInfo.getUserId();
        return userId;
@@ -45,35 +46,38 @@
    /**
     * 获取登录对象所在社区id
     *
     * @return 社区id
     */
    public Long getCommunityId(){
    public Long getCommunityId() {
        LoginUserInfoVO loginUserInfo = this.getLoginUserInfo();
        Long communityId = loginUserInfo.getCommunityId();
        if (null==communityId||0==communityId) {
            throw  new ServiceException("用户未绑定社区");
        if (null == communityId || 0 == communityId) {
            throw new ServiceException("用户未绑定社区");
        }
        return communityId;
    }
    /**
     * 获取登录对象所在小区
     *
     * @return 小区id
     */
    public Long getAreaId(){
    public Long getAreaId() {
        LoginUserInfoVO loginUserInfo = this.getLoginUserInfo();
        Long areaId = loginUserInfo.getAreaId();
        if (null==areaId||0==areaId) {
            throw  new ServiceException("用户未绑定社区");
        if (null == areaId || 0 == areaId) {
            throw new ServiceException("用户未绑定社区");
        }
        return areaId;
    }
    /**
     * 获取登录token
     *
     * @return token
     */
    public String getToken(){
    public String getToken() {
        HttpServletRequest request = this.getRequest();
        String header = request.getHeader(TokenConstant.TOKEN_LOGOUT);
        return header;
@@ -81,10 +85,11 @@
    /**
     * 获取登录对象所有信息
     *
     * @return 所有信息
     */
    @SneakyThrows
    public LoginUserInfoVO getLoginUserInfo(){
    public LoginUserInfoVO getLoginUserInfo() {
        HttpServletRequest request = this.getRequest();
        String userInfo = request.getHeader(TokenConstant.TOKEN_USERINFO);
        boolean empty = ObjectUtils.isEmpty(userInfo);
@@ -96,8 +101,8 @@
//        log.info("bytes【{}】",bytes);
        byte[] decrypt = AES.decrypt(bytes, Constants.AES_KEY);
//        log.info("decrypt【{}】",decrypt);
        userInfo=new String(decrypt);
        LoginUserInfoVO loginUserInfoVO= JSONObject.parseObject(userInfo,LoginUserInfoVO.class);
        userInfo = new String(decrypt);
        LoginUserInfoVO loginUserInfoVO = JSONObject.parseObject(userInfo, LoginUserInfoVO.class);
        return loginUserInfoVO;
    }
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/community/ComMngCityVO.java
@@ -1,8 +1,11 @@
package com.panzhihua.common.model.vos.community;
import com.google.common.collect.Lists;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
@Data
@ApiModel("城市")
@@ -15,5 +18,4 @@
    /**城市行政区划代码*/
    @ApiModelProperty("城市行政区划代码")
    private Integer cityAdcode;
}
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/community/ComMngProvinceVO.java
@@ -1,8 +1,11 @@
package com.panzhihua.common.model.vos.community;
import com.google.common.collect.Lists;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
@Data
@ApiModel("省份")
@@ -13,4 +16,5 @@
    @ApiModelProperty("省份行政区划代码")
    private Integer provinceAdcode;
}
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/community/ComOpsHouseVO.java
@@ -149,8 +149,8 @@
    /**
     * create_at
     */
    @DateTimeFormat(pattern = "yyyy/MM/dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy/MM/dd HH:mm:ss", timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date createAt;
    @ApiModelProperty("发布人名字")
    private String userName;
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/service/community/CommunityService.java
@@ -8,7 +8,6 @@
import com.panzhihua.common.model.vos.SystemmanagementConfigVO;
import com.panzhihua.common.model.vos.community.*;
import com.panzhihua.common.model.vos.user.UserPhoneVO;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;
@@ -836,11 +835,11 @@
    /**
     * 查询城市下属所有地区列表
     * @param cityAdcode 城市地址编码
     * @param provinceAdcode 城市地址编码
     * @return 地区列表
     */
    @PostMapping("listareadistrict")
    R listAreaDistrict(@RequestParam("cityAdcode") Long cityAdcode);
    @GetMapping("/common/data/city")
    R listAreaDistrict(@RequestParam("provinceAdcode") Long provinceAdcode);
    /**
     * 首页图表数据汇总
@@ -1308,4 +1307,44 @@
     */
    @GetMapping("/common/data/district")
    R getDistrictByCityCode(@RequestParam(value = "cityAdcode") Integer cityAdcode);
    /**
     * 查询省下所有区域  tree结构
     * @param provinceAdcode
     * @return
     */
    @GetMapping("/common/data/area/all")
    R getCityTreeByProvinceCode(@RequestParam(value = "provinceAdcode") Integer provinceAdcode);
    /**
     * 分页查询街道
     * @param pageComStreetDTO
     * @return
     */
    @PostMapping("/liststreet")
    R pageStreet(@RequestBody PageComStreetDTO pageComStreetDTO);
    /**
     * 新增街道
     * @param comStreetVOO
     * @return
     */
    @PostMapping("/addstreet")
    R pageStreet(@RequestBody ComStreetVO comStreetVOO);
    /**
     * 删除街道
     * @param Ids
     * @return
     */
    @PostMapping("/deletestreet")
    R delectStreat(@RequestBody List<Long> Ids);
    /**
     * 查询街道
     * @param comStreetVO
     * @return
     */
    @PostMapping("/liststreet")
    R listStreet(ComStreetVO comStreetVO);
}
springcloud_k8s_panzhihuazhihuishequ/community_backstage/src/main/java/com/panzhihua/community_backstage/api/CommonDataApi.java
@@ -65,11 +65,11 @@
    @Value("${excel.userurl}")
    private String excelUrl;
    @Value("${excel.carUrl}")
    private String carUrl="http://panzhihua.nhys.cdnhxx.com/web/%e8%bd%a6%e8%be%86%e5%af%bc%e5%85%a5%e6%a8%a1%e6%9d%bf.xlsx";
    private String carUrl = "http://panzhihua.nhys.cdnhxx.com/web/%e8%bd%a6%e8%be%86%e5%af%bc%e5%85%a5%e6%a8%a1%e6%9d%bf.xlsx";
    @Value("${excel.companyUrl}")
    private String companyUrl="http://panzhihua.nhys.cdnhxx.com/web/%e5%ae%9e%e6%9c%89%e5%8d%95%e4%bd%8d%e5%af%bc%e5%85%a5%e6%a8%a1%e6%9d%bf.xlsx";
    private String companyUrl = "http://panzhihua.nhys.cdnhxx.com/web/%e5%ae%9e%e6%9c%89%e5%8d%95%e4%bd%8d%e5%af%bc%e5%85%a5%e6%a8%a1%e6%9d%bf.xlsx";
    @Value("${excel.assetsUrl}")
    private String assetsUrl="http://panzhihua.nhys.cdnhxx.com/web/%e5%ae%9e%e6%9c%89%e5%8d%95%e4%bd%8d%e5%af%bc%e5%85%a5%e6%a8%a1%e6%9d%bf.xlsx";
    private String assetsUrl = "http://panzhihua.nhys.cdnhxx.com/web/%e5%ae%9e%e6%9c%89%e5%8d%95%e4%bd%8d%e5%af%bc%e5%85%a5%e6%a8%a1%e6%9d%bf.xlsx";
    // FTP 登录用户名
    @Value("${ftp.username}")
@@ -86,7 +86,7 @@
    @Value("${ftp.url}")
    private String url;
    @ApiOperation(value = "分页查询车辆管理列表",response = ComMngCarVO.class)
    @ApiOperation(value = "分页查询车辆管理列表", response = ComMngCarVO.class)
    @PostMapping("/car/page")
    public R pageQueryComMngCar(@RequestBody PageComMngCarDTO pageComMngCarDTO) {
        pageComMngCarDTO.setCommunityId(this.getCommunityId());
@@ -118,11 +118,11 @@
    @PostMapping(value = "/car/import", consumes = "multipart/*", headers = "content-type=multipart/form-date")
    public R downloadTemplate(@RequestParam MultipartFile file, HttpServletRequest request) {
        String fileName = file.getOriginalFilename();  //获取文件名
        log.info("传入文件名字【{}】",fileName);
        log.info("传入文件名字【{}】", fileName);
        InputStream inputStream = null;
        try {
            inputStream = file.getInputStream();
            EasyExcel.read(inputStream, ComMngCarExcelVO.class, new ComMngCarExcelListen(communityService,this.getCommunityId())).sheet().doRead();
            EasyExcel.read(inputStream, ComMngCarExcelVO.class, new ComMngCarExcelListen(communityService, this.getCommunityId())).sheet().doRead();
        } catch (IOException e) {
            e.printStackTrace();
            log.error("导入模板失败【{}】", e.getMessage());
@@ -132,36 +132,36 @@
    @ApiOperation(value = "下载居民导入模板")
    @GetMapping("/user/template")
    @ApiImplicitParam(name ="id",value = "小区id",required = true)
    public R exportUser(@RequestParam("id") Long id ){
    @ApiImplicitParam(name = "id", value = "小区id", required = true)
    public R exportUser(@RequestParam("id") Long id) {
//        检查小区是否已经批量设置过房屋并且返回小区房屋门号规则
        R r=communityService.checkAreaHouse(id);
        R r = communityService.checkAreaHouse(id);
        if (R.isOk(r)) {
//            生成动态模板excel通过ftp工具上传到主节点,然后返回模板下载地址
            ComMngStructAreaVO comMngStructAreaVO= JSONObject.parseObject(JSONObject.toJSONString(r.getData()),ComMngStructAreaVO.class);
            ComMngStructAreaVO comMngStructAreaVO = JSONObject.parseObject(JSONObject.toJSONString(r.getData()), ComMngStructAreaVO.class);
            String areaName = comMngStructAreaVO.getAreaName();
            String roleFloor = comMngStructAreaVO.getRoleFloor();
            String roleConnector = comMngStructAreaVO.getRoleConnector();
            String roleDoor = comMngStructAreaVO.getRoleDoor();
            String doorNumber="1-1-1-"+roleFloor+roleConnector+roleDoor;
            String doorNumber = "1-1-1-" + roleFloor + roleConnector + roleDoor;
//            String url="http://www.psciio.com/web/excel/";
            String ftpUrl="/mnt/data/web/excel/";
            String name=areaName + ".xlsx";
            String ftpUrl = "/mnt/data/web/excel/";
            String name = areaName + ".xlsx";
            try {
                SFTPUtil sftp = new SFTPUtil(userName,password,host,port);
                SFTPUtil sftp = new SFTPUtil(userName, password, host, port);
                sftp.login();
                boolean existDir = sftp.isExistDir(ftpUrl+name);
                boolean existDir = sftp.isExistDir(ftpUrl + name);
                if (!existDir) {
                    String property = System.getProperty("user.dir");
                    String fileName = property + File.separator+name;
                    String fileName = property + File.separator + name;
                    // 这里 需要指定写用哪个class去写
                    ExcelWriter excelWriter = null;
                    InputStream inputStream=null;
                    InputStream inputStream = null;
                    try {
                        excelWriter = EasyExcel.write(fileName, EexcelUserDTO.class).registerWriteHandler(new LongestMatchColumnWidthStyleStrategy()).registerWriteHandler(new CustomSheetWriteHandler()).build();
                        WriteSheet writeSheet = EasyExcel.writerSheet(areaName+"居民导入模板").build();
                        List<EexcelUserDTO> eexcelUserDTOS=new ArrayList<>();
                        EexcelUserDTO eexcelUserDTO=new EexcelUserDTO();
                        WriteSheet writeSheet = EasyExcel.writerSheet(areaName + "居民导入模板").build();
                        List<EexcelUserDTO> eexcelUserDTOS = new ArrayList<>();
                        EexcelUserDTO eexcelUserDTO = new EexcelUserDTO();
                        eexcelUserDTO.setOrder("例子(可不用删除)");
                        eexcelUserDTO.setDoorNumber(doorNumber);
                        eexcelUserDTO.setIsRent("是");
@@ -188,14 +188,14 @@
                        eexcelUserDTOS.add(eexcelUserDTO);
                        excelWriter.write(eexcelUserDTOS, writeSheet);
                        excelWriter.finish();
                        File file=new File(fileName);
                        inputStream=new FileInputStream(file);
                        File file = new File(fileName);
                        inputStream = new FileInputStream(file);
                        sftp.uploadMore(ftpUrl, name, inputStream);
                        sftp.logout();
                        inputStream.close();
                        String absolutePath = file.getAbsolutePath();
                        boolean delete = file.delete();
                        log.info("删除excel【{}】结果【{}】",absolutePath,delete);
                        log.info("删除excel【{}】结果【{}】", absolutePath, delete);
                    } finally {
                        // 千万别忘记finish 会帮忙关闭流
                        if (inputStream != null) {
@@ -206,42 +206,42 @@
                        }
                    }
                }
                return R.ok(excelUrl+areaName+".xlsx");
                return R.ok(excelUrl + areaName + ".xlsx");
            } catch (Exception e) {
                e.printStackTrace();
                log.error("文件传输失败【{}】", e.getMessage());
                return R.fail();
            }
        }else{
        } else {
            return r;
        }
    }
    @ApiOperation(value = "居民管理导入居民")
    @PostMapping("/user/import")
    public R importUser(@RequestParam MultipartFile file)throws IOException {
    public R importUser(@RequestParam MultipartFile file) throws IOException {
        String name = file.getOriginalFilename();
        Float size = Float.parseFloat(String.valueOf(file.getSize())) / 1024;
        BigDecimal b = new BigDecimal(size);
        size = b.setScale(2, BigDecimal.ROUND_HALF_UP).floatValue();
        log.info("导入文件名字【{}】,文件大小【{}】KB",name,size);
        String fileType=name.substring(name.indexOf("."),name.length());
        log.info("导入文件名字【{}】,文件大小【{}】KB", name, size);
        String fileType = name.substring(name.indexOf("."), name.length());
        boolean isXls = !fileType.contains("xls") && !fileType.contains("xlsx");
        if (isXls) {
            return R.fail("请上传xls或者xlsx格式的文件");
        }
        EasyExcel.read(file.getInputStream(), EexcelUserDTO.class, new UploadEexcelUserDTOListener(userService,name)) .extraRead(CellExtraTypeEnum.MERGE).headRowNumber(1).sheet().doRead();
        EasyExcel.read(file.getInputStream(), EexcelUserDTO.class, new UploadEexcelUserDTOListener(userService, name)).extraRead(CellExtraTypeEnum.MERGE).headRowNumber(1).sheet().doRead();
        return R.ok();
    }
    @ApiOperation(value = "居民管理选择导入的小区",response =ComMngStructAreaVO.class )
    @ApiOperation(value = "居民管理选择导入的小区", response = ComMngStructAreaVO.class)
    @GetMapping("/user/areas")
    public R listAreas() {
        Long communityId = this.getCommunityId();
        return communityService.listAreas("",communityId);
        return communityService.listAreas("", communityId);
    }
    @ApiOperation(value = "居民管理 分页查询居民列表",response =InputUserInfoVO.class )
    @ApiOperation(value = "居民管理 分页查询居民列表", response = InputUserInfoVO.class)
    @PostMapping("/user/page")
    public R userPage(@RequestBody PageInputUserDTO pageInputUserDTO) {
        Long communityId = this.getCommunityId();
@@ -249,49 +249,49 @@
        return userService.pageInputUser(pageInputUserDTO);
    }
    @ApiOperation(value = "居民管理 居民详情",response = InputUserInfoVO.class)
    @ApiOperation(value = "居民管理 居民详情", response = InputUserInfoVO.class)
    @GetMapping("/user/detail")
    @ApiImplicitParam(name ="id",value = "用户ID",required = true)
    public R detailUser(@RequestParam("id")Long id){
    @ApiImplicitParam(name = "id", value = "用户ID", required = true)
    public R detailUser(@RequestParam("id") Long id) {
        return userService.inputUserDetail(id);
    }
    @ApiOperation(value = "居民管理 导出居民Excel" )
    @ApiOperation(value = "居民管理 导出居民Excel")
    @PostMapping("/user/export")
    public R export(@RequestBody ExportUserDTO exportUserDTO){
    public R export(@RequestBody ExportUserDTO exportUserDTO) {
        exportUserDTO.setCommunityId(this.getCommunityId());
        String url=excelUrl;
        String uuid= UUID.randomUUID().toString().replace("-","");
        String name=uuid+".xlsx";
        String ftpUrl="/mnt/data/web/excel/";
        String url = excelUrl;
        String uuid = UUID.randomUUID().toString().replace("-", "");
        String name = uuid + ".xlsx";
        String ftpUrl = "/mnt/data/web/excel/";
//        用户搜索了就下载搜索的用户否则下载所有用户
        R r=userService.inputUserExport(exportUserDTO);
        R r = userService.inputUserExport(exportUserDTO);
        if (R.isOk(r)) {
            List<EexcelUserDTO>eexcelUserDTOS= JSONArray.parseArray(JSONArray.toJSONString(r.getData()),EexcelUserDTO.class);
            List<EexcelUserDTO> eexcelUserDTOS = JSONArray.parseArray(JSONArray.toJSONString(r.getData()), EexcelUserDTO.class);
            try {
                SFTPUtil sftp = new SFTPUtil(userName,password,host,port);
                SFTPUtil sftp = new SFTPUtil(userName, password, host, port);
                sftp.login();
                boolean existDir = sftp.isExistDir(ftpUrl+name);
                boolean existDir = sftp.isExistDir(ftpUrl + name);
                if (!existDir) {
                    String property = System.getProperty("user.dir");
                    String fileName = property + File.separator+name;
                    String fileName = property + File.separator + name;
                    // 这里 需要指定写用哪个class去写
                    ExcelWriter excelWriter = null;
                    InputStream inputStream=null;
                    InputStream inputStream = null;
                    try {
                        excelWriter = EasyExcel.write(fileName, EexcelUserDTO.class).registerWriteHandler(new LongestMatchColumnWidthStyleStrategy()).registerWriteHandler(new CustomSheetWriteHandler()).build();
                        WriteSheet writeSheet = EasyExcel.writerSheet("模板").build();
                        excelWriter.write(eexcelUserDTOS, writeSheet);
                        excelWriter.finish();
                        File file=new File(fileName);
                        inputStream=new FileInputStream(file);
                        File file = new File(fileName);
                        inputStream = new FileInputStream(file);
                        sftp.uploadMore(ftpUrl, name, inputStream);
                        sftp.logout();
                        inputStream.close();
                        String absolutePath = file.getAbsolutePath();
                        boolean delete = file.delete();
                        log.info("删除excel【{}】结果【{}】",absolutePath,delete);
                        log.info("删除excel【{}】结果【{}】", absolutePath, delete);
                    } finally {
                        // 千万别忘记finish 会帮忙关闭流
                        if (inputStream != null) {
@@ -302,7 +302,7 @@
                        }
                    }
                }
                return R.ok(url+name);
                return R.ok(url + name);
            } catch (Exception e) {
                e.printStackTrace();
                log.error("文件传输失败【{}】", e.getMessage());
@@ -314,16 +314,17 @@
    /**
     * 设置居民标签
     *
     * @param inputUserTagsDTO 标签信息
     * @return 设置结果
     */
    @ApiOperation(value = "居民管理 设置居民标签",response = InputUserInfoVO.class)
    @ApiOperation(value = "居民管理 设置居民标签", response = InputUserInfoVO.class)
    @PostMapping("/user/tags")
    public R putUserTag(@RequestBody InputUserTagsDTO inputUserTagsDTO){
    public R putUserTag(@RequestBody InputUserTagsDTO inputUserTagsDTO) {
        return userService.setInputUserTag(inputUserTagsDTO);
    }
    @ApiOperation(value = "特殊群体/分页查询特殊群体列表",response =InputUserInfoVO.class )
    @ApiOperation(value = "特殊群体/分页查询特殊群体列表", response = InputUserInfoVO.class)
    @PostMapping("/special/page")
    public R specialInputUser(@RequestBody PageInputUserDTO pageInputUserDTO) {
        Long communityId = this.getCommunityId();
@@ -331,47 +332,47 @@
        return userService.specialInputUser(pageInputUserDTO);
    }
    @ApiOperation(value = "特殊群体/删除",response =InputUserInfoVO.class )
    @ApiOperation(value = "特殊群体/删除", response = InputUserInfoVO.class)
    @DeleteMapping("/special/delete")
    public R deleteSpecialInputUser(@RequestParam(value = "id") Long id) {
        return userService.deleteSpecialInputUser(id);
    }
    @ApiOperation(value = "特殊群体 导出特殊群体Excel" )
    @ApiOperation(value = "特殊群体 导出特殊群体Excel")
    @PostMapping("/special/export")
    public R exportSpecial(@RequestBody ExportSpecialUserDTO exportSpecialUserDTO){
    public R exportSpecial(@RequestBody ExportSpecialUserDTO exportSpecialUserDTO) {
        exportSpecialUserDTO.setCommunityId(this.getCommunityId());
        String url=excelUrl;
        String uuid= UUID.randomUUID().toString().replace("-","");
        String name=uuid+".xlsx";
        String ftpUrl="/mnt/data/web/excel/";
        String url = excelUrl;
        String uuid = UUID.randomUUID().toString().replace("-", "");
        String name = uuid + ".xlsx";
        String ftpUrl = "/mnt/data/web/excel/";
//        用户搜索了就下载搜索的用户否则下载所有用户
        R r=userService.specialUserExport(exportSpecialUserDTO);
        R r = userService.specialUserExport(exportSpecialUserDTO);
        if (R.isOk(r)) {
            List<EexcelUserDTO>eexcelUserDTOS= JSONArray.parseArray(JSONArray.toJSONString(r.getData()),EexcelUserDTO.class);
            List<EexcelUserDTO> eexcelUserDTOS = JSONArray.parseArray(JSONArray.toJSONString(r.getData()), EexcelUserDTO.class);
            try {
                SFTPUtil sftp = new SFTPUtil(userName,password,host,port);
                SFTPUtil sftp = new SFTPUtil(userName, password, host, port);
                sftp.login();
                boolean existDir = sftp.isExistDir(ftpUrl+name);
                boolean existDir = sftp.isExistDir(ftpUrl + name);
                if (!existDir) {
                    String property = System.getProperty("user.dir");
                    String fileName = property + File.separator+name;
                    String fileName = property + File.separator + name;
                    // 这里 需要指定写用哪个class去写
                    ExcelWriter excelWriter = null;
                    InputStream inputStream=null;
                    InputStream inputStream = null;
                    try {
                        excelWriter = EasyExcel.write(fileName, EexcelUserDTO.class).registerWriteHandler(new LongestMatchColumnWidthStyleStrategy()).registerWriteHandler(new CustomSheetWriteHandler()).build();
                        WriteSheet writeSheet = EasyExcel.writerSheet("模板").build();
                        excelWriter.write(eexcelUserDTOS, writeSheet);
                        excelWriter.finish();
                        File file=new File(fileName);
                        inputStream=new FileInputStream(file);
                        File file = new File(fileName);
                        inputStream = new FileInputStream(file);
                        sftp.uploadMore(ftpUrl, name, inputStream);
                        sftp.logout();
                        inputStream.close();
                        String absolutePath = file.getAbsolutePath();
                        boolean delete = file.delete();
                        log.info("删除excel【{}】结果【{}】",absolutePath,delete);
                        log.info("删除excel【{}】结果【{}】", absolutePath, delete);
                    } finally {
                        // 千万别忘记finish 会帮忙关闭流
                        if (inputStream != null) {
@@ -382,7 +383,7 @@
                        }
                    }
                }
                return R.ok(url+name);
                return R.ok(url + name);
            } catch (Exception e) {
                e.printStackTrace();
                log.error("文件传输失败【{}】", e.getMessage());
@@ -392,7 +393,7 @@
        return R.fail("未查询到用户");
    }
    @ApiOperation(value = "特殊群体/分页查询标签列表",response = ComMngTagVO.class )
    @ApiOperation(value = "特殊群体/分页查询标签列表", response = ComMngTagVO.class)
    @PostMapping("/special/tags/page")
    public R specialInputUserTags(@RequestBody ComMngUserTagDTO comMngUserTagDTO) {
        Long communityId = this.getCommunityId();
@@ -402,6 +403,7 @@
    /**
     * 新增或修改特殊群体标签
     *
     * @param comMngTagVO
     * @return
     */
@@ -415,6 +417,7 @@
    /**
     * 删除特殊群体标签
     *
     * @param id
     * @return
     */
@@ -424,7 +427,7 @@
        return userService.deleteSpecialInputUserTags(id);
    }
    @ApiOperation(value = "分页查询单位管理列表",response = ComMngRealCompanyVO.class)
    @ApiOperation(value = "分页查询单位管理列表", response = ComMngRealCompanyVO.class)
    @PostMapping("/company/page")
    public R pageQueryComMngRealCompany(@RequestBody PageComMngRealCompanyDTO pageComMngRealCompanyDTO) {
        return communityService.pageQueryComMngRealCompany(pageComMngRealCompanyDTO);
@@ -444,7 +447,7 @@
        return communityService.deleteComMngRealCompany(id);
    }
    @ApiOperation(value = "实有单位详情",response = ComMngRealCompanyVO.class)
    @ApiOperation(value = "实有单位详情", response = ComMngRealCompanyVO.class)
    @GetMapping("/company/detail")
    public R detailComMngRealCompany(@RequestParam(value = "id") Long id) {
        return communityService.detailComMngRealCompany(id);
@@ -460,11 +463,11 @@
    @PostMapping(value = "/company/import", consumes = "multipart/*", headers = "content-type=multipart/form-date")
    public R importRealCompany(@RequestParam MultipartFile file, HttpServletRequest request) {
        String fileName = file.getOriginalFilename();  //获取文件名
        log.info("传入文件名字【{}】",fileName);
        log.info("传入文件名字【{}】", fileName);
        InputStream inputStream = null;
        try {
            inputStream = file.getInputStream();
            EasyExcel.read(inputStream, ComMngRealCompanyExcelVO.class, new ComMngRealCompanyExcelListen(communityService,this.getCommunityId())).sheet().doRead();
            EasyExcel.read(inputStream, ComMngRealCompanyExcelVO.class, new ComMngRealCompanyExcelListen(communityService, this.getCommunityId())).sheet().doRead();
        } catch (IOException e) {
            e.printStackTrace();
            log.error("导入模板失败【{}】", e.getMessage());
@@ -472,41 +475,41 @@
        return R.ok();
    }
    @ApiOperation(value = "实有单位Excel" )
    @ApiOperation(value = "实有单位Excel")
    @PostMapping("/company/export")
    public R exportRealCompany(@RequestBody ExportRealCompanyExcelDTO exportRealCompanyExcelDTO){
    public R exportRealCompany(@RequestBody ExportRealCompanyExcelDTO exportRealCompanyExcelDTO) {
        exportRealCompanyExcelDTO.setCommunityId(this.getCommunityId());
        String url=excelUrl;
        String uuid= UUID.randomUUID().toString().replace("-","");
        String name=uuid+".xlsx";
        String ftpUrl="/mnt/data/web/excel/";
        String url = excelUrl;
        String uuid = UUID.randomUUID().toString().replace("-", "");
        String name = uuid + ".xlsx";
        String ftpUrl = "/mnt/data/web/excel/";
//        用户搜索了就下载搜索的用户否则下载所有用户
        R r=communityService.exportRealCompany(exportRealCompanyExcelDTO);
        R r = communityService.exportRealCompany(exportRealCompanyExcelDTO);
        if (R.isOk(r)) {
            List<ComMngRealCompanyExcelVO>eexcelUserDTOS= JSONArray.parseArray(JSONArray.toJSONString(r.getData()),ComMngRealCompanyExcelVO.class);
            List<ComMngRealCompanyExcelVO> eexcelUserDTOS = JSONArray.parseArray(JSONArray.toJSONString(r.getData()), ComMngRealCompanyExcelVO.class);
            try {
                SFTPUtil sftp = new SFTPUtil(userName,password,host,port);
                SFTPUtil sftp = new SFTPUtil(userName, password, host, port);
                sftp.login();
                boolean existDir = sftp.isExistDir(ftpUrl+name);
                boolean existDir = sftp.isExistDir(ftpUrl + name);
                if (!existDir) {
                    String property = System.getProperty("user.dir");
                    String fileName = property + File.separator+name;
                    String fileName = property + File.separator + name;
                    // 这里 需要指定写用哪个class去写
                    ExcelWriter excelWriter = null;
                    InputStream inputStream=null;
                    InputStream inputStream = null;
                    try {
                        excelWriter = EasyExcel.write(fileName, ComMngRealCompanyExcelVO.class).registerWriteHandler(new LongestMatchColumnWidthStyleStrategy()).registerWriteHandler(new CustomSheetWriteHandler()).build();
                        WriteSheet writeSheet = EasyExcel.writerSheet("实有单位导出").build();
                        excelWriter.write(eexcelUserDTOS, writeSheet);
                        excelWriter.finish();
                        File file=new File(fileName);
                        inputStream=new FileInputStream(file);
                        File file = new File(fileName);
                        inputStream = new FileInputStream(file);
                        sftp.uploadMore(ftpUrl, name, inputStream);
                        sftp.logout();
                        inputStream.close();
                        String absolutePath = file.getAbsolutePath();
                        boolean delete = file.delete();
                        log.info("删除excel【{}】结果【{}】",absolutePath,delete);
                        log.info("删除excel【{}】结果【{}】", absolutePath, delete);
                    } finally {
                        // 千万别忘记finish 会帮忙关闭流
                        if (inputStream != null) {
@@ -517,7 +520,7 @@
                        }
                    }
                }
                return R.ok(url+name);
                return R.ok(url + name);
            } catch (Exception e) {
                e.printStackTrace();
                log.error("文件传输失败【{}】", e.getMessage());
@@ -530,7 +533,7 @@
    /////////////
    @ApiOperation(value = "分页查询实有资产列表",response = ComMngRealAssetsVO.class)
    @ApiOperation(value = "分页查询实有资产列表", response = ComMngRealAssetsVO.class)
    @PostMapping("/assets/page")
    public R pageQueryComMngRealAssets(@RequestBody PageComMngRealAssetsDTO pageComMngRealAssetsDTO) {
        return communityService.pageQueryComMngRealAssets(pageComMngRealAssetsDTO);
@@ -550,7 +553,7 @@
        return communityService.deleteComMngRealAssets(id);
    }
    @ApiOperation(value = "实有资产详情",response = ComMngRealAssetsVO.class)
    @ApiOperation(value = "实有资产详情", response = ComMngRealAssetsVO.class)
    @GetMapping("/assets/detail")
    public R detailComMngRealAssets(@RequestParam(value = "id") Long id) {
        return communityService.detailComMngRealAssets(id);
@@ -566,11 +569,11 @@
    @PostMapping(value = "/assets/import", consumes = "multipart/*", headers = "content-type=multipart/form-date")
    public R importRealAssets(@RequestParam MultipartFile file, HttpServletRequest request) {
        String fileName = file.getOriginalFilename();  //获取文件名
        log.info("传入文件名字【{}】",fileName);
        log.info("传入文件名字【{}】", fileName);
        InputStream inputStream = null;
        try {
            inputStream = file.getInputStream();
            EasyExcel.read(inputStream, ComMngRealAssetsExcelVO.class, new ComMngRealAssetsExcelListen(communityService,this.getCommunityId())).sheet().doRead();
            EasyExcel.read(inputStream, ComMngRealAssetsExcelVO.class, new ComMngRealAssetsExcelListen(communityService, this.getCommunityId())).sheet().doRead();
        } catch (IOException e) {
            e.printStackTrace();
            log.error("导入模板失败【{}】", e.getMessage());
@@ -578,41 +581,41 @@
        return R.ok();
    }
    @ApiOperation(value = "实有资产Excel" )
    @ApiOperation(value = "实有资产Excel")
    @PostMapping("/assets/export")
    public R exportRealAssets(@RequestBody ExportRealAssetsExcelDTO exportRealAssetsExcelDTO){
    public R exportRealAssets(@RequestBody ExportRealAssetsExcelDTO exportRealAssetsExcelDTO) {
        exportRealAssetsExcelDTO.setCommunityId(this.getCommunityId());
        String url=excelUrl;
        String uuid= UUID.randomUUID().toString().replace("-","");
        String name=uuid+".xlsx";
        String ftpUrl="/mnt/data/web/excel/";
        String url = excelUrl;
        String uuid = UUID.randomUUID().toString().replace("-", "");
        String name = uuid + ".xlsx";
        String ftpUrl = "/mnt/data/web/excel/";
//        用户搜索了就下载搜索的用户否则下载所有用户
        R r=communityService.exportRealAssets(exportRealAssetsExcelDTO);
        R r = communityService.exportRealAssets(exportRealAssetsExcelDTO);
        if (R.isOk(r)) {
            List<ComMngRealAssetsExcelVO>eexcelUserDTOS= JSONArray.parseArray(JSONArray.toJSONString(r.getData()),ComMngRealAssetsExcelVO.class);
            List<ComMngRealAssetsExcelVO> eexcelUserDTOS = JSONArray.parseArray(JSONArray.toJSONString(r.getData()), ComMngRealAssetsExcelVO.class);
            try {
                SFTPUtil sftp = new SFTPUtil(userName,password,host,port);
                SFTPUtil sftp = new SFTPUtil(userName, password, host, port);
                sftp.login();
                boolean existDir = sftp.isExistDir(ftpUrl+name);
                boolean existDir = sftp.isExistDir(ftpUrl + name);
                if (!existDir) {
                    String property = System.getProperty("user.dir");
                    String fileName = property + File.separator+name;
                    String fileName = property + File.separator + name;
                    // 这里 需要指定写用哪个class去写
                    ExcelWriter excelWriter = null;
                    InputStream inputStream=null;
                    InputStream inputStream = null;
                    try {
                        excelWriter = EasyExcel.write(fileName, ComMngRealAssetsExcelVO.class).registerWriteHandler(new LongestMatchColumnWidthStyleStrategy()).registerWriteHandler(new CustomSheetWriteHandler()).build();
                        WriteSheet writeSheet = EasyExcel.writerSheet("实有单位导出").build();
                        excelWriter.write(eexcelUserDTOS, writeSheet);
                        excelWriter.finish();
                        File file=new File(fileName);
                        inputStream=new FileInputStream(file);
                        File file = new File(fileName);
                        inputStream = new FileInputStream(file);
                        sftp.uploadMore(ftpUrl, name, inputStream);
                        sftp.logout();
                        inputStream.close();
                        String absolutePath = file.getAbsolutePath();
                        boolean delete = file.delete();
                        log.info("删除excel【{}】结果【{}】",absolutePath,delete);
                        log.info("删除excel【{}】结果【{}】", absolutePath, delete);
                    } finally {
                        // 千万别忘记finish 会帮忙关闭流
                        if (inputStream != null) {
@@ -623,7 +626,7 @@
                        }
                    }
                }
                return R.ok(url+name);
                return R.ok(url + name);
            } catch (Exception e) {
                e.printStackTrace();
                log.error("文件传输失败【{}】", e.getMessage());
@@ -635,9 +638,10 @@
    /**
     * 查询所有省份
     *
     * @return
     */
    @ApiOperation(value = "查询所有省份" ,response = ComMngProvinceVO.class)
    @ApiOperation(value = "查询所有省份", response = ComMngProvinceVO.class)
    @GetMapping("/province")
    public R getProvince() {
        return communityService.getProvince();
@@ -645,23 +649,31 @@
    /**
     * 查询省份下所有的城市
     *
     * @param provinceAdcode
     * @return
     */
    @ApiOperation(value = "查询省份下所有的城市" ,response = ComMngCityVO.class)
    @ApiOperation(value = "查询省份下所有的城市", response = ComMngCityVO.class)
    @GetMapping("/city")
    public R getCityByProvinceCode(@ApiParam(name = "省份编码", required = true) @RequestParam(value = "provinceAdcode") Integer provinceAdcode){
    public R getCityByProvinceCode(@ApiParam(name = "省份编码", required = true) @RequestParam(value = "provinceAdcode") Integer provinceAdcode) {
        return communityService.getCityByProvinceCode(provinceAdcode);
    }
    /**
     * 查询城市下所有的区县
     *
     * @param cityAdcode
     * @return
     */
    @ApiOperation(value = "查询城市下所有的区县" ,response = ComMngDistrictVO.class)
    @ApiOperation(value = "查询城市下所有的区县", response = ComMngDistrictVO.class)
    @GetMapping("/district")
    R getDistrictByCityCode(@ApiParam(name = "城市编码", required = true) @RequestParam(value = "cityAdcode") Integer cityAdcode){
    R getDistrictByCityCode(@ApiParam(name = "城市编码", required = true) @RequestParam(value = "cityAdcode") Integer cityAdcode) {
        return communityService.getDistrictByCityCode(cityAdcode);
    }
    @ApiOperation(value = "获取树结构区域信息")
    @GetMapping(value = "arealist")
    public R getAllArea(@ApiParam(name = "城市编码:四川510000", required = true) @RequestParam(value = "provinceAdcode") Integer provinceAdcode) {
        return communityService.getCityTreeByProvinceCode(provinceAdcode);
    }
}
springcloud_k8s_panzhihuazhihuishequ/service_community/pom.xml
@@ -14,7 +14,6 @@
    <description>社区</description>
    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
@@ -69,6 +68,11 @@
            <groupId>org.springframework.data</groupId>
            <artifactId>spring-data-redis</artifactId>
        </dependency>
        <dependency>
            <groupId>commons-lang</groupId>
            <artifactId>commons-lang</artifactId>
            <version>2.6</version>
        </dependency>
    </dependencies>
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/api/CommonDataApi.java
@@ -236,4 +236,14 @@
    R getDistrictByCityCode(@RequestParam(value = "cityAdcode") Integer cityAdcode){
        return comMngProvinceService.getDistrictByCityCode(cityAdcode);
    }
    /**
     * 查询特定省下所有区域 tree结构
     * @param provinceAdcode
     * @return
     */
    @GetMapping("/area/all")
    R getCityTreeByProvinceCode(@RequestParam(value = "provinceAdcode") Integer provinceAdcode){
        return comMngProvinceService.getCityTreeByProvinceCode(provinceAdcode);
    }
}
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/ComMngProvinceService.java
@@ -29,4 +29,11 @@
     * @return
     */
    R getDistrictByCityCode(Integer cityAdcode);
    /**
     * 获取省下的所有区域 tree结构
     * @param provinceAdcode
     * @return
     */
    R getCityTreeByProvinceCode(Integer provinceAdcode);
}
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComMngProvinceServiceImpl.java
@@ -2,6 +2,7 @@
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.panzhihua.common.model.vos.R;
import com.panzhihua.common.model.vos.community.ComMngAreaVO;
import com.panzhihua.common.model.vos.community.ComMngCityVO;
import com.panzhihua.common.model.vos.community.ComMngDistrictVO;
import com.panzhihua.common.model.vos.community.ComMngProvinceVO;
@@ -18,6 +19,7 @@
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
@Service
public class ComMngProvinceServiceImpl implements ComMngProvinceService {
@@ -36,9 +38,9 @@
    public R getProvince() {
        List<ComMngProvinceDO> provinceDOS = comMngProvinceDAO.selectList(null);
        List<ComMngProvinceVO> vos = new ArrayList<>();
        provinceDOS.forEach(p->{
        provinceDOS.forEach(p -> {
            ComMngProvinceVO vo = new ComMngProvinceVO();
            BeanUtils.copyProperties(p,vo);
            BeanUtils.copyProperties(p, vo);
            vos.add(vo);
        });
        return R.ok(vos);
@@ -46,24 +48,50 @@
    @Override
    public R getCityByProvinceCode(Integer provinceAdcode) {
        List<ComMngCityDO> comMngCityDOS = comMngCityDAO.selectList(new QueryWrapper<ComMngCityDO>().lambda().eq(ComMngCityDO::getProvinceAdcode,provinceAdcode));
        List<ComMngCityDO> comMngCityDOS = comMngCityDAO.selectList(new QueryWrapper<ComMngCityDO>().lambda().eq(ComMngCityDO::getProvinceAdcode, provinceAdcode));
        List<ComMngCityVO> vos = new ArrayList<>();
        comMngCityDOS.forEach(c->{
        comMngCityDOS.forEach(c -> {
            ComMngCityVO vo = new ComMngCityVO();
            BeanUtils.copyProperties(c,vo);
            BeanUtils.copyProperties(c, vo);
            vos.add(vo);
        });
        return R.ok(vos);
    }
    @Override
    public R getDistrictByCityCode(Integer cityAdcode) {
        List<ComMngDistrictDO> comMngDistrictDOS = comMngDistrictDAO.selectList(new QueryWrapper<ComMngDistrictDO>().lambda().eq(ComMngDistrictDO::getCityAdcode, cityAdcode));
        List<ComMngDistrictVO> vos = new ArrayList<>();
        comMngDistrictDOS.forEach(c -> {
            ComMngDistrictVO vo = new ComMngDistrictVO();
            BeanUtils.copyProperties(c, vo);
            vos.add(vo);
        });
        return R.ok(vos);
    }
    @Override
    public R getDistrictByCityCode(Integer cityAdcode) {
        List<ComMngDistrictDO> comMngDistrictDOS = comMngDistrictDAO.selectList(new QueryWrapper<ComMngDistrictDO>().lambda().eq(ComMngDistrictDO::getCityAdcode,cityAdcode));
        List<ComMngDistrictVO> vos = new ArrayList<>();
        comMngDistrictDOS.forEach(c->{
            ComMngDistrictVO vo = new ComMngDistrictVO();
            BeanUtils.copyProperties(c,vo);
            vos.add(vo);
    public R getCityTreeByProvinceCode(Integer provinceAdcode) {
        List<ComMngProvinceDO> provinceDOS = comMngProvinceDAO.selectList(new QueryWrapper<ComMngProvinceDO>().lambda().eq(ComMngProvinceDO::getProvinceAdcode, provinceAdcode));
        List<ComMngCityDO> cityDOS = comMngCityDAO.selectList(null);
        List<ComMngDistrictDO> districtDOS = comMngDistrictDAO.selectList(null);
        List<ComMngAreaVO> vos = new ArrayList<>();
        provinceDOS.forEach(p -> {
            ComMngAreaVO pvo = new ComMngAreaVO(p.getProvinceAdcode(), p.getProvinceName());
            vos.add(pvo);
            List<ComMngCityDO> citys = cityDOS.stream().filter(city -> city.getProvinceAdcode().equals(p.getProvinceAdcode())).collect(Collectors.toList());
            citys.forEach(c -> {
                ComMngAreaVO cityVo = new ComMngAreaVO(c.getCityAdcode(), c.getCityName());
                BeanUtils.copyProperties(c, cityVo);
                pvo.getChildren().add(cityVo);
                List<ComMngDistrictDO> districts = districtDOS.stream().filter(district -> district.getCityAdcode().equals(c.getCityAdcode())).collect(Collectors.toList());
                districts.forEach(d -> {
                    ComMngAreaVO districtVo = new ComMngAreaVO(d.getDistrictAdcode(), d.getDistrictName());
                    BeanUtils.copyProperties(d, districtVo);
                    cityVo.getChildren().add(districtVo);
                });
            });
        });
        return R.ok(vos);
    }