wuxw 1 год назад
Родитель
Сommit
4a1e7c9d58

+ 7 - 3
java110-bean/src/main/java/com/java110/dto/area/AreaDto.java

@@ -15,7 +15,11 @@ import java.util.Date;
  **/
 public class AreaDto extends PageDto implements Serializable {
 
-    private int id;
+    public static final String AREA_LEVEL_ONE = "101"; // 一级
+    public static final String AREA_LEVEL_TWO = "202"; // 二级
+    public static final String AREA_LEVEL_THREE = "303"; // 三级
+
+    private String id;
     private String areaCode;
     private String[] areaCodes;
     private String areaName;
@@ -31,11 +35,11 @@ public class AreaDto extends PageDto implements Serializable {
     private String cityName;
 
 
-    public int getId() {
+    public String getId() {
         return id;
     }
 
-    public void setId(int id) {
+    public void setId(String id) {
         this.id = id;
     }
 

+ 113 - 0
java110-bean/src/main/java/com/java110/dto/cityArea/CityAreaDto.java

@@ -0,0 +1,113 @@
+package com.java110.dto.cityArea;
+
+import com.java110.dto.PageDto;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * @ClassName FloorDto
+ * @Description 地区数据层封装
+ * @Author wuxw
+ * @Date 2019/4/24 8:52
+ * @Version 1.0
+ * add by wuxw 2019/4/24
+ **/
+public class CityAreaDto extends PageDto implements Serializable {
+
+    private String areaCode;
+    private String areaName;
+    private String areaLevel;
+    private String lon;
+    private String id;
+    private String parentAreaCode;
+    private String parentAreaName;
+    private String lat;
+
+
+    private Date createTime;
+
+    private String statusCd = "0";
+
+
+    public String getAreaCode() {
+        return areaCode;
+    }
+
+    public void setAreaCode(String areaCode) {
+        this.areaCode = areaCode;
+    }
+
+    public String getAreaName() {
+        return areaName;
+    }
+
+    public void setAreaName(String areaName) {
+        this.areaName = areaName;
+    }
+
+    public String getAreaLevel() {
+        return areaLevel;
+    }
+
+    public void setAreaLevel(String areaLevel) {
+        this.areaLevel = areaLevel;
+    }
+
+    public String getLon() {
+        return lon;
+    }
+
+    public void setLon(String lon) {
+        this.lon = lon;
+    }
+
+    public String getId() {
+        return id;
+    }
+
+    public void setId(String id) {
+        this.id = id;
+    }
+
+    public String getParentAreaCode() {
+        return parentAreaCode;
+    }
+
+    public void setParentAreaCode(String parentAreaCode) {
+        this.parentAreaCode = parentAreaCode;
+    }
+
+    public String getParentAreaName() {
+        return parentAreaName;
+    }
+
+    public void setParentAreaName(String parentAreaName) {
+        this.parentAreaName = parentAreaName;
+    }
+
+    public String getLat() {
+        return lat;
+    }
+
+    public void setLat(String lat) {
+        this.lat = lat;
+    }
+
+
+    public Date getCreateTime() {
+        return createTime;
+    }
+
+    public void setCreateTime(Date createTime) {
+        this.createTime = createTime;
+    }
+
+    public String getStatusCd() {
+        return statusCd;
+    }
+
+    public void setStatusCd(String statusCd) {
+        this.statusCd = statusCd;
+    }
+}

+ 96 - 0
java110-bean/src/main/java/com/java110/po/cityArea/CityAreaPo.java

@@ -0,0 +1,96 @@
+/*
+ * Copyright 2017-2020 吴学文 and java110 team.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.java110.po.cityArea;
+
+import java.io.Serializable;
+
+/**
+ * 类表述: Po 数据模型实体对象 基本保持与数据库模型一直 用于 增加修改删除 等时的数据载体
+ * add by 吴学文 at 2025-03-07 19:47:09 mail: 928255095@qq.com
+ * open source address: https://gitee.com/wuxw7/MicroCommunity
+ * 官网:http://www.homecommunity.cn
+ * 温馨提示:如果您对此文件进行修改 请不要删除原有作者及注释信息,请补充您的 修改的原因以及联系邮箱如下
+ * // modify by 张三 at 2021-09-12 第10行在某种场景下存在某种bug 需要修复,注释10至20行 加入 20行至30行
+ */
+public class CityAreaPo implements Serializable {
+
+    private String areaCode;
+private String areaName;
+private String areaLevel;
+private String lon;
+private String statusCd = "0";
+private String id;
+private String parentAreaCode;
+private String parentAreaName;
+private String lat;
+public String getAreaCode() {
+        return areaCode;
+    }
+public void setAreaCode(String areaCode) {
+        this.areaCode = areaCode;
+    }
+public String getAreaName() {
+        return areaName;
+    }
+public void setAreaName(String areaName) {
+        this.areaName = areaName;
+    }
+public String getAreaLevel() {
+        return areaLevel;
+    }
+public void setAreaLevel(String areaLevel) {
+        this.areaLevel = areaLevel;
+    }
+public String getLon() {
+        return lon;
+    }
+public void setLon(String lon) {
+        this.lon = lon;
+    }
+public String getStatusCd() {
+        return statusCd;
+    }
+public void setStatusCd(String statusCd) {
+        this.statusCd = statusCd;
+    }
+public String getId() {
+        return id;
+    }
+public void setId(String id) {
+        this.id = id;
+    }
+public String getParentAreaCode() {
+        return parentAreaCode;
+    }
+public void setParentAreaCode(String parentAreaCode) {
+        this.parentAreaCode = parentAreaCode;
+    }
+public String getParentAreaName() {
+        return parentAreaName;
+    }
+public void setParentAreaName(String parentAreaName) {
+        this.parentAreaName = parentAreaName;
+    }
+public String getLat() {
+        return lat;
+    }
+public void setLat(String lat) {
+        this.lat = lat;
+    }
+
+
+
+}

+ 3 - 3
java110-bean/src/main/java/com/java110/vo/api/area/ApiAreaDataVo.java

@@ -4,7 +4,7 @@ import java.io.Serializable;
 
 public class ApiAreaDataVo implements Serializable {
 
-    private int id;
+    private String id;
     private String areaCode;
     private String areaName;
     private String areaLevel;
@@ -14,11 +14,11 @@ public class ApiAreaDataVo implements Serializable {
     private String lat;
 
 
-    public int getId() {
+    public String getId() {
         return id;
     }
 
-    public void setId(int id) {
+    public void setId(String id) {
         this.id = id;
     }
 

+ 3 - 0
java110-db/src/main/resources/mapper/common/AreaServiceDaoImplMapper.xml

@@ -17,6 +17,9 @@
         from city_area t
         where 1=1
         and t.status_cd = '0'
+        <if test="id != null and id !=''">
+            and t.id = #{id}
+        </if>
         <if test="areaCode != null and areaCode !=''">
             and t.area_code = #{areaCode}
         </if>

+ 129 - 0
java110-db/src/main/resources/mapper/common/CityAreaV1ServiceDaoImplMapper.xml

@@ -0,0 +1,129 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="cityAreaV1ServiceDaoImpl">
+
+
+    <!-- 保存地区信息 add by wuxw 2018-07-03 -->
+    <insert id="saveCityAreaInfo" parameterType="Map">
+        insert into city_area(
+        area_code,area_name,area_level,lon,id,parent_area_code,parent_area_name,lat
+        ) values (
+        #{areaCode},#{areaName},#{areaLevel},#{lon},#{id},#{parentAreaCode},#{parentAreaName},#{lat}
+        )
+    </insert>
+
+
+    <!-- 查询地区信息 add by wuxw 2018-07-03 -->
+    <select id="getCityAreaInfo" parameterType="Map" resultType="Map">
+        select t.area_code areaCode,t.area_name areaName,t.area_level areaLevel,t.lon,t.status_cd
+        statusCd,t.id,t.parent_area_code parentAreaCode,t.parent_area_name parentAreaName,t.lat,t.create_time createTime
+        from city_area t
+        where 1 =1
+        <if test="areaCode !=null and areaCode != ''">
+            and t.area_code= #{areaCode}
+        </if>
+        <if test="areaName !=null and areaName != ''">
+            and t.area_name= #{areaName}
+        </if>
+        <if test="areaLevel !=null and areaLevel != ''">
+            and t.area_level= #{areaLevel}
+        </if>
+        <if test="lon !=null and lon != ''">
+            and t.lon= #{lon}
+        </if>
+        <if test="statusCd !=null and statusCd != ''">
+            and t.status_cd= #{statusCd}
+        </if>
+        <if test="id !=null and id != ''">
+            and t.id= #{id}
+        </if>
+        <if test="parentAreaCode !=null and parentAreaCode != ''">
+            and t.parent_area_code= #{parentAreaCode}
+        </if>
+        <if test="parentAreaName !=null and parentAreaName != ''">
+            and t.parent_area_name= #{parentAreaName}
+        </if>
+        <if test="lat !=null and lat != ''">
+            and t.lat= #{lat}
+        </if>
+        order by t.create_time desc
+        <if test="page != -1 and page != null ">
+            limit #{page}, #{row}
+        </if>
+
+    </select>
+
+
+    <!-- 修改地区信息 add by wuxw 2018-07-03 -->
+    <update id="updateCityAreaInfo" parameterType="Map">
+        update city_area t set t.status_cd = #{statusCd}
+        <if test="newBId != null and newBId != ''">
+            ,t.b_id = #{newBId}
+        </if>
+        <if test="areaCode !=null and areaCode != ''">
+            , t.area_code= #{areaCode}
+        </if>
+        <if test="areaName !=null and areaName != ''">
+            , t.area_name= #{areaName}
+        </if>
+        <if test="areaLevel !=null and areaLevel != ''">
+            , t.area_level= #{areaLevel}
+        </if>
+        <if test="lon !=null and lon != ''">
+            , t.lon= #{lon}
+        </if>
+        <if test="parentAreaCode !=null and parentAreaCode != ''">
+            , t.parent_area_code= #{parentAreaCode}
+        </if>
+        <if test="parentAreaName !=null and parentAreaName != ''">
+            , t.parent_area_name= #{parentAreaName}
+        </if>
+        <if test="lat !=null and lat != ''">
+            , t.lat= #{lat}
+        </if>
+        where 1=1
+        <if test="id !=null and id != ''">
+            and t.id= #{id}
+        </if>
+
+    </update>
+
+    <!-- 查询地区数量 add by wuxw 2018-07-03 -->
+    <select id="queryCityAreasCount" parameterType="Map" resultType="Map">
+        select count(1) count
+        from city_area t
+        where 1 =1
+        <if test="areaCode !=null and areaCode != ''">
+            and t.area_code= #{areaCode}
+        </if>
+        <if test="areaName !=null and areaName != ''">
+            and t.area_name= #{areaName}
+        </if>
+        <if test="areaLevel !=null and areaLevel != ''">
+            and t.area_level= #{areaLevel}
+        </if>
+        <if test="lon !=null and lon != ''">
+            and t.lon= #{lon}
+        </if>
+        <if test="statusCd !=null and statusCd != ''">
+            and t.status_cd= #{statusCd}
+        </if>
+        <if test="id !=null and id != ''">
+            and t.id= #{id}
+        </if>
+        <if test="parentAreaCode !=null and parentAreaCode != ''">
+            and t.parent_area_code= #{parentAreaCode}
+        </if>
+        <if test="parentAreaName !=null and parentAreaName != ''">
+            and t.parent_area_name= #{parentAreaName}
+        </if>
+        <if test="lat !=null and lat != ''">
+            and t.lat= #{lat}
+        </if>
+
+
+    </select>
+
+</mapper>

+ 68 - 0
java110-interface/src/main/java/com/java110/intf/common/ICityAreaV1InnerServiceSMO.java

@@ -0,0 +1,68 @@
+/*
+ * Copyright 2017-2020 吴学文 and java110 team.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.java110.intf.common;
+
+import com.java110.config.feign.FeignConfiguration;
+import com.java110.dto.cityArea.CityAreaDto;
+import com.java110.po.cityArea.CityAreaPo;
+import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+
+import java.util.List;
+
+/**
+ * 类表述: 服务之前调用的接口类,不对外提供接口能力 只用于接口建调用
+ * add by 吴学文 at 2025-03-07 19:47:09 mail: 928255095@qq.com
+ * open source address: https://gitee.com/wuxw7/MicroCommunity
+ * 官网:http://www.homecommunity.cn
+ * 温馨提示:如果您对此文件进行修改 请不要删除原有作者及注释信息,请补充您的 修改的原因以及联系邮箱如下
+ * // modify by 张三 at 2021-09-12 第10行在某种场景下存在某种bug 需要修复,注释10至20行 加入 20行至30行
+ */
+@FeignClient(name = "common-service", configuration = {FeignConfiguration.class})
+@RequestMapping("/cityAreaV1Api")
+public interface ICityAreaV1InnerServiceSMO {
+
+
+    @RequestMapping(value = "/saveCityArea", method = RequestMethod.POST)
+     int saveCityArea(@RequestBody CityAreaPo cityAreaPo);
+
+    @RequestMapping(value = "/updateCityArea", method = RequestMethod.POST)
+     int updateCityArea(@RequestBody  CityAreaPo cityAreaPo);
+
+    @RequestMapping(value = "/deleteCityArea", method = RequestMethod.POST)
+     int deleteCityArea(@RequestBody  CityAreaPo cityAreaPo);
+
+    /**
+     * <p>查询小区楼信息</p>
+     *
+     *
+     * @param cityAreaDto 数据对象分享
+     * @return CityAreaDto 对象数据
+     */
+    @RequestMapping(value = "/queryCityAreas", method = RequestMethod.POST)
+    List<CityAreaDto> queryCityAreas(@RequestBody CityAreaDto cityAreaDto);
+
+    /**
+     * 查询<p>小区楼</p>总记录数
+     *
+     * @param cityAreaDto 数据对象分享
+     * @return 小区下的小区楼记录数
+     */
+    @RequestMapping(value = "/queryCityAreasCount", method = RequestMethod.POST)
+    int queryCityAreasCount(@RequestBody CityAreaDto cityAreaDto);
+}

+ 88 - 0
service-common/src/main/java/com/java110/common/cmd/area/DeleteCityAreaCmd.java

@@ -0,0 +1,88 @@
+/*
+ * Copyright 2017-2020 吴学文 and java110 team.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.java110.common.cmd.area;
+
+import com.alibaba.fastjson.JSONObject;
+import com.java110.core.annotation.Java110Cmd;
+import com.java110.core.annotation.Java110Transactional;
+import com.java110.core.context.ICmdDataFlowContext;
+import com.java110.core.event.cmd.Cmd;
+import com.java110.core.event.cmd.CmdEvent;
+import com.java110.dto.area.AreaDto;
+import com.java110.dto.cityArea.CityAreaDto;
+import com.java110.intf.common.ICityAreaV1InnerServiceSMO;
+import com.java110.po.cityArea.CityAreaPo;
+import com.java110.utils.exception.CmdException;
+import com.java110.utils.util.Assert;
+import com.java110.utils.util.BeanConvertUtil;
+import com.java110.vo.ResultVo;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import java.util.List;
+
+/**
+ * 类表述:删除
+ * 服务编码:cityArea.deleteCityArea
+ * 请求路劲:/app/cityArea.DeleteCityArea
+ * add by 吴学文 at 2025-03-07 19:47:09 mail: 928255095@qq.com
+ * open source address: https://gitee.com/wuxw7/MicroCommunity
+ * 官网:http://www.homecommunity.cn
+ * 温馨提示:如果您对此文件进行修改 请不要删除原有作者及注释信息,请补充您的 修改的原因以及联系邮箱如下
+ * // modify by 张三 at 2021-09-12 第10行在某种场景下存在某种bug 需要修复,注释10至20行 加入 20行至30行
+ */
+@Java110Cmd(serviceCode = "area.deleteCityArea")
+public class DeleteCityAreaCmd extends Cmd {
+  private static Logger logger = LoggerFactory.getLogger(DeleteCityAreaCmd.class);
+
+    @Autowired
+    private ICityAreaV1InnerServiceSMO cityAreaV1InnerServiceSMOImpl;
+
+    @Override
+    public void validate(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) {
+        Assert.hasKeyAndValue(reqJson, "id", "id不能为空");
+
+        CityAreaDto cityAreaDto = new CityAreaDto();
+        cityAreaDto.setId(reqJson.getString("id"));
+        List<CityAreaDto> cityAreaDtos = cityAreaV1InnerServiceSMOImpl.queryCityAreas(cityAreaDto);
+
+        Assert.listOnlyOne(cityAreaDtos,"地区不存在");
+        if(AreaDto.AREA_LEVEL_THREE.equals(cityAreaDtos.get(0).getAreaLevel())){
+            return;
+        }
+        cityAreaDto = new CityAreaDto();
+        cityAreaDto.setParentAreaCode(cityAreaDtos.get(0).getAreaCode());
+        int count = cityAreaV1InnerServiceSMOImpl.queryCityAreasCount(cityAreaDto);
+        if(count> 1){
+            throw new CmdException("存在子节点,先删除子节点");
+        }
+    }
+
+    @Override
+    @Java110Transactional
+    public void doCmd(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) throws CmdException {
+
+       CityAreaPo cityAreaPo = BeanConvertUtil.covertBean(reqJson, CityAreaPo.class);
+        int flag = cityAreaV1InnerServiceSMOImpl.deleteCityArea(cityAreaPo);
+
+        if (flag < 1) {
+            throw new CmdException("删除数据失败");
+        }
+
+        cmdDataFlowContext.setResponseEntity(ResultVo.success());
+    }
+}

+ 123 - 0
service-common/src/main/java/com/java110/common/cmd/area/QueryAreaTreeCmd.java

@@ -0,0 +1,123 @@
+package com.java110.common.cmd.area;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.java110.core.annotation.Java110Cmd;
+import com.java110.core.context.ICmdDataFlowContext;
+import com.java110.core.event.cmd.Cmd;
+import com.java110.core.event.cmd.CmdEvent;
+import com.java110.dto.area.AreaDto;
+import com.java110.intf.common.IAreaInnerServiceSMO;
+import com.java110.utils.exception.CmdException;
+import com.java110.utils.util.ListUtil;
+import com.java110.vo.ResultVo;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import java.util.List;
+
+/**
+ * 查询地区树形结构
+ */
+@Java110Cmd(serviceCode = "area.queryAreaTree")
+public class QueryAreaTreeCmd extends Cmd {
+
+    @Autowired
+    private IAreaInnerServiceSMO areaInnerServiceSMOImpl;
+
+    @Override
+    public void validate(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJson) throws CmdException {
+
+    }
+
+    @Override
+    public void doCmd(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJson) throws CmdException {
+
+        AreaDto areaDto = new AreaDto();
+        List<AreaDto> areaDtos = areaInnerServiceSMOImpl.getArea(areaDto);
+
+        JSONObject areaData = new JSONObject();
+        areaData.put("id", "0");
+        areaData.put("areaCode", "0");
+
+        areaData.put("text", "地区");
+        areaData.put("icon", "/img/org.png");
+        areaData.put("children", new JSONArray());
+        JSONArray areas = areaData.getJSONArray("children");
+        if (ListUtil.isNull(areaDtos)) {
+            context.setResponseEntity(ResultVo.createResponseEntity(areas));
+            return;
+        }
+
+        JSONObject areaInfo = null;
+        for (AreaDto tmpAreaDto : areaDtos) {
+            if (AreaDto.AREA_LEVEL_ONE.equals(tmpAreaDto.getAreaLevel())) {
+                areaInfo = new JSONObject();
+                areaInfo.put("id", tmpAreaDto.getId());
+                areaInfo.put("areaCode", tmpAreaDto.getAreaCode());
+                areaInfo.put("areaLevel", tmpAreaDto.getAreaLevel());
+                areaInfo.put("text", tmpAreaDto.getAreaName());
+                areaInfo.put("icon", "/img/org.png");
+                areaInfo.put("children", new JSONArray());
+                areas.add(areaInfo);
+            }
+        }
+
+        JSONObject area = null;
+        for (int cIndex = 0; cIndex < areas.size(); cIndex++) {
+            area = areas.getJSONObject(cIndex);
+            // find floor data in unitDtos
+            findTwoLevel(area, areaDtos);
+        }
+        context.setResponseEntity(ResultVo.createResponseEntity(areaData));
+
+    }
+
+    private void findTwoLevel(JSONObject area, List<AreaDto> areaDtos) {
+
+        JSONArray childrens = area.getJSONArray("children");
+        JSONObject childrenInfo = null;
+        for (AreaDto tmpAreaDto : areaDtos) {
+            if (!AreaDto.AREA_LEVEL_TWO.equals(tmpAreaDto.getAreaLevel())) {
+                continue;
+            }
+            if (area.getString("areaCode").equals(tmpAreaDto.getParentAreaCode())) {
+                childrenInfo = new JSONObject();
+                childrenInfo.put("id", tmpAreaDto.getId());
+                childrenInfo.put("areaCode", tmpAreaDto.getAreaCode());
+                childrenInfo.put("areaLevel", tmpAreaDto.getAreaLevel());
+                childrenInfo.put("text", tmpAreaDto.getAreaName());
+                childrenInfo.put("children", new JSONArray());
+                childrenInfo.put("icon", "/img/floor.png");
+                childrens.add(childrenInfo);
+            }
+        }
+
+
+        JSONObject floor = null;
+        for (int cIndex = 0; cIndex < childrens.size(); cIndex++) {
+            floor = childrens.getJSONObject(cIndex);
+            // find floor data in unitDtos
+            findThreeLevel(floor, areaDtos);
+        }
+    }
+
+    private void findThreeLevel(JSONObject twoArea, List<AreaDto> areaDtos) {
+        JSONArray childrens = twoArea.getJSONArray("children");
+        JSONObject childrenInfo = null;
+        for (AreaDto tmpAreaDto : areaDtos) {
+            if (!AreaDto.AREA_LEVEL_THREE.equals(tmpAreaDto.getAreaLevel())) {
+                continue;
+            }
+            if (twoArea.getString("areaCode").equals(tmpAreaDto.getParentAreaCode())) {
+                childrenInfo = new JSONObject();
+                childrenInfo.put("id", tmpAreaDto.getId());
+                childrenInfo.put("areaCode", tmpAreaDto.getAreaCode());
+                childrenInfo.put("areaLevel", tmpAreaDto.getAreaLevel());
+                childrenInfo.put("text", tmpAreaDto.getAreaName());
+                childrenInfo.put("children", new JSONArray());
+                childrenInfo.put("icon", "/img/unit.png");
+                childrens.add(childrenInfo);
+            }
+        }
+    }
+}

+ 79 - 0
service-common/src/main/java/com/java110/common/cmd/area/SaveCityAreaCmd.java

@@ -0,0 +1,79 @@
+/*
+ * Copyright 2017-2020 吴学文 and java110 team.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.java110.common.cmd.area;
+
+import com.alibaba.fastjson.JSONObject;
+import com.java110.core.annotation.Java110Cmd;
+import com.java110.core.annotation.Java110Transactional;
+import com.java110.core.context.ICmdDataFlowContext;
+import com.java110.core.event.cmd.Cmd;
+import com.java110.core.event.cmd.CmdEvent;
+import com.java110.core.factory.GenerateCodeFactory;
+import com.java110.intf.common.ICityAreaV1InnerServiceSMO;
+import com.java110.po.cityArea.CityAreaPo;
+import com.java110.utils.exception.CmdException;
+import com.java110.utils.util.Assert;
+import com.java110.utils.util.BeanConvertUtil;
+import com.java110.vo.ResultVo;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+
+/**
+ * 类表述:保存
+ * 服务编码:cityArea.saveCityArea
+ * 请求路劲:/app/cityArea.SaveCityArea
+ * add by 吴学文 at 2025-03-07 19:47:09 mail: 928255095@qq.com
+ * open source address: https://gitee.com/wuxw7/MicroCommunity
+ * 官网:http://www.homecommunity.cn
+ * 温馨提示:如果您对此文件进行修改 请不要删除原有作者及注释信息,请补充您的 修改的原因以及联系邮箱如下
+ * // modify by 张三 at 2021-09-12 第10行在某种场景下存在某种bug 需要修复,注释10至20行 加入 20行至30行
+ */
+@Java110Cmd(serviceCode = "area.saveCityArea")
+public class SaveCityAreaCmd extends Cmd {
+
+    private static Logger logger = LoggerFactory.getLogger(SaveCityAreaCmd.class);
+
+    public static final String CODE_PREFIX_ID = "10";
+
+    @Autowired
+    private ICityAreaV1InnerServiceSMO cityAreaV1InnerServiceSMOImpl;
+
+    @Override
+    public void validate(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) {
+        Assert.hasKeyAndValue(reqJson, "areaCode", "请求报文中未包含areaCode");
+        Assert.hasKeyAndValue(reqJson, "areaName", "请求报文中未包含areaName");
+        Assert.hasKeyAndValue(reqJson, "areaLevel", "请求报文中未包含areaLevel");
+        Assert.hasKeyAndValue(reqJson, "parentAreaCode", "请求报文中未包含parentAreaCode");
+        Assert.hasKeyAndValue(reqJson, "parentAreaName", "请求报文中未包含parentAreaName");
+
+    }
+
+    @Override
+    @Java110Transactional
+    public void doCmd(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) throws CmdException {
+
+        CityAreaPo cityAreaPo = BeanConvertUtil.covertBean(reqJson, CityAreaPo.class);
+        cityAreaPo.setId(GenerateCodeFactory.getGeneratorId(CODE_PREFIX_ID));
+        int flag = cityAreaV1InnerServiceSMOImpl.saveCityArea(cityAreaPo);
+
+        if (flag < 1) {
+            throw new CmdException("保存数据失败");
+        }
+
+        cmdDataFlowContext.setResponseEntity(ResultVo.success());
+    }
+}

+ 73 - 0
service-common/src/main/java/com/java110/common/cmd/area/UpdateCityAreaCmd.java

@@ -0,0 +1,73 @@
+/*
+ * Copyright 2017-2020 吴学文 and java110 team.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.java110.common.cmd.area;
+
+import com.alibaba.fastjson.JSONObject;
+import com.java110.core.annotation.Java110Cmd;
+import com.java110.core.annotation.Java110Transactional;
+import com.java110.core.context.ICmdDataFlowContext;
+import com.java110.core.event.cmd.Cmd;
+import com.java110.core.event.cmd.CmdEvent;
+import com.java110.intf.common.ICityAreaV1InnerServiceSMO;
+import com.java110.po.cityArea.CityAreaPo;
+import com.java110.utils.exception.CmdException;
+import com.java110.utils.util.Assert;
+import com.java110.utils.util.BeanConvertUtil;
+import com.java110.vo.ResultVo;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+
+
+/**
+ * 类表述:更新
+ * 服务编码:cityArea.updateCityArea
+ * 请求路劲:/app/cityArea.UpdateCityArea
+ * add by 吴学文 at 2025-03-07 19:47:09 mail: 928255095@qq.com
+ * open source address: https://gitee.com/wuxw7/MicroCommunity
+ * 官网:http://www.homecommunity.cn
+ * 温馨提示:如果您对此文件进行修改 请不要删除原有作者及注释信息,请补充您的 修改的原因以及联系邮箱如下
+ * // modify by 张三 at 2021-09-12 第10行在某种场景下存在某种bug 需要修复,注释10至20行 加入 20行至30行
+ */
+@Java110Cmd(serviceCode = "area.updateCityArea")
+public class UpdateCityAreaCmd extends Cmd {
+
+    private static Logger logger = LoggerFactory.getLogger(UpdateCityAreaCmd.class);
+
+
+    @Autowired
+    private ICityAreaV1InnerServiceSMO cityAreaV1InnerServiceSMOImpl;
+
+    @Override
+    public void validate(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) {
+        Assert.hasKeyAndValue(reqJson, "id", "id不能为空");
+
+    }
+
+    @Override
+    @Java110Transactional
+    public void doCmd(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) throws CmdException {
+
+        CityAreaPo cityAreaPo = BeanConvertUtil.covertBean(reqJson, CityAreaPo.class);
+        int flag = cityAreaV1InnerServiceSMOImpl.updateCityArea(cityAreaPo);
+
+        if (flag < 1) {
+            throw new CmdException("更新数据失败");
+        }
+
+        cmdDataFlowContext.setResponseEntity(ResultVo.success());
+    }
+}

+ 72 - 0
service-common/src/main/java/com/java110/common/dao/ICityAreaV1ServiceDao.java

@@ -0,0 +1,72 @@
+/*
+ * Copyright 2017-2020 吴学文 and java110 team.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.java110.common.dao;
+
+
+import com.java110.utils.exception.DAOException;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 类表述:
+ * add by 吴学文 at 2025-03-07 19:47:09 mail: 928255095@qq.com
+ * open source address: https://gitee.com/wuxw7/MicroCommunity
+ * 官网:http://www.homecommunity.cn
+ * 温馨提示:如果您对此文件进行修改 请不要删除原有作者及注释信息,请补充您的 修改的原因以及联系邮箱如下
+ * // modify by 张三 at 2021-09-12 第10行在某种场景下存在某种bug 需要修复,注释10至20行 加入 20行至30行
+ */
+public interface ICityAreaV1ServiceDao {
+
+
+    /**
+     * 保存 地区信息
+     * @param info
+     * @throws DAOException DAO异常
+     */
+    int saveCityAreaInfo(Map info) throws DAOException;
+
+
+
+
+    /**
+     * 查询地区信息(instance过程)
+     * 根据bId 查询地区信息
+     * @param info bId 信息
+     * @return 地区信息
+     * @throws DAOException DAO异常
+     */
+    List<Map> getCityAreaInfo(Map info) throws DAOException;
+
+
+
+    /**
+     * 修改地区信息
+     * @param info 修改信息
+     * @throws DAOException DAO异常
+     */
+    int updateCityAreaInfo(Map info) throws DAOException;
+
+
+    /**
+     * 查询地区总数
+     *
+     * @param info 地区信息
+     * @return 地区数量
+     */
+    int queryCityAreasCount(Map info);
+
+}

+ 108 - 0
service-common/src/main/java/com/java110/common/dao/impl/CityAreaV1ServiceDaoImpl.java

@@ -0,0 +1,108 @@
+/*
+ * Copyright 2017-2020 吴学文 and java110 team.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.java110.common.dao.impl;
+
+import com.java110.common.dao.ICityAreaV1ServiceDao;
+import com.java110.core.base.dao.BaseServiceDao;
+import com.java110.utils.exception.DAOException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 类表述:
+ * add by 吴学文 at 2025-03-07 19:47:09 mail: 928255095@qq.com
+ * open source address: https://gitee.com/wuxw7/MicroCommunity
+ * 官网:http://www.homecommunity.cn
+ * 温馨提示:如果您对此文件进行修改 请不要删除原有作者及注释信息,请补充您的 修改的原因以及联系邮箱如下
+ * // modify by 张三 at 2021-09-12 第10行在某种场景下存在某种bug 需要修复,注释10至20行 加入 20行至30行
+ */
+@Service("cityAreaV1ServiceDaoImpl")
+public class CityAreaV1ServiceDaoImpl extends BaseServiceDao implements ICityAreaV1ServiceDao {
+
+    private static Logger logger = LoggerFactory.getLogger(CityAreaV1ServiceDaoImpl.class);
+
+
+
+
+
+    /**
+     * 保存地区信息 到 instance
+     * @param info   bId 信息
+     * @throws DAOException DAO异常
+     */
+    @Override
+    public int saveCityAreaInfo(Map info) throws DAOException {
+        logger.debug("保存 saveCityAreaInfo 入参 info : {}",info);
+
+        int saveFlag = sqlSessionTemplate.insert("cityAreaV1ServiceDaoImpl.saveCityAreaInfo",info);
+
+        return saveFlag;
+    }
+
+
+    /**
+     * 查询地区信息(instance)
+     * @param info bId 信息
+     * @return List<Map>
+     * @throws DAOException DAO异常
+     */
+    @Override
+    public List<Map> getCityAreaInfo(Map info) throws DAOException {
+        logger.debug("查询 getCityAreaInfo 入参 info : {}",info);
+
+        List<Map> infos = sqlSessionTemplate.selectList("cityAreaV1ServiceDaoImpl.getCityAreaInfo",info);
+
+        return infos;
+    }
+
+
+    /**
+     * 修改地区信息
+     * @param info 修改信息
+     * @throws DAOException DAO异常
+     */
+    @Override
+    public int updateCityAreaInfo(Map info) throws DAOException {
+        logger.debug("修改 updateCityAreaInfo 入参 info : {}",info);
+
+        int saveFlag = sqlSessionTemplate.update("cityAreaV1ServiceDaoImpl.updateCityAreaInfo",info);
+
+        return saveFlag;
+    }
+
+     /**
+     * 查询地区数量
+     * @param info 地区信息
+     * @return 地区数量
+     */
+    @Override
+    public int queryCityAreasCount(Map info) {
+        logger.debug("查询 queryCityAreasCount 入参 info : {}",info);
+
+        List<Map> infos = sqlSessionTemplate.selectList("cityAreaV1ServiceDaoImpl.queryCityAreasCount", info);
+        if (infos.size() < 1) {
+            return 0;
+        }
+
+        return Integer.parseInt(infos.get(0).get("count").toString());
+    }
+
+
+}

+ 87 - 0
service-common/src/main/java/com/java110/common/smo/impl/CityAreaV1InnerServiceSMOImpl.java

@@ -0,0 +1,87 @@
+/*
+ * Copyright 2017-2020 吴学文 and java110 team.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.java110.common.smo.impl;
+
+
+import com.java110.common.dao.ICityAreaV1ServiceDao;
+import com.java110.core.base.smo.BaseServiceSMO;
+import com.java110.dto.PageDto;
+import com.java110.dto.cityArea.CityAreaDto;
+import com.java110.intf.common.ICityAreaV1InnerServiceSMO;
+import com.java110.po.cityArea.CityAreaPo;
+import com.java110.utils.util.BeanConvertUtil;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
+
+/**
+ * 类表述: 服务之前调用的接口实现类,不对外提供接口能力 只用于接口建调用
+ * add by 吴学文 at 2025-03-07 19:47:09 mail: 928255095@qq.com
+ * open source address: https://gitee.com/wuxw7/MicroCommunity
+ * 官网:http://www.homecommunity.cn
+ * 温馨提示:如果您对此文件进行修改 请不要删除原有作者及注释信息,请补充您的 修改的原因以及联系邮箱如下
+ * // modify by 张三 at 2021-09-12 第10行在某种场景下存在某种bug 需要修复,注释10至20行 加入 20行至30行
+ */
+@RestController
+public class CityAreaV1InnerServiceSMOImpl extends BaseServiceSMO implements ICityAreaV1InnerServiceSMO {
+
+    @Autowired
+    private ICityAreaV1ServiceDao cityAreaV1ServiceDaoImpl;
+
+
+    @Override
+    public int saveCityArea(@RequestBody  CityAreaPo cityAreaPo) {
+        int saveFlag = cityAreaV1ServiceDaoImpl.saveCityAreaInfo(BeanConvertUtil.beanCovertMap(cityAreaPo));
+        return saveFlag;
+    }
+
+     @Override
+    public int updateCityArea(@RequestBody  CityAreaPo cityAreaPo) {
+        int saveFlag = cityAreaV1ServiceDaoImpl.updateCityAreaInfo(BeanConvertUtil.beanCovertMap(cityAreaPo));
+        return saveFlag;
+    }
+
+     @Override
+    public int deleteCityArea(@RequestBody  CityAreaPo cityAreaPo) {
+       cityAreaPo.setStatusCd("1");
+       int saveFlag = cityAreaV1ServiceDaoImpl.updateCityAreaInfo(BeanConvertUtil.beanCovertMap(cityAreaPo));
+       return saveFlag;
+    }
+
+    @Override
+    public List<CityAreaDto> queryCityAreas(@RequestBody  CityAreaDto cityAreaDto) {
+
+        //校验是否传了 分页信息
+
+        int page = cityAreaDto.getPage();
+
+        if (page != PageDto.DEFAULT_PAGE) {
+            cityAreaDto.setPage((page - 1) * cityAreaDto.getRow());
+        }
+
+        List<CityAreaDto> cityAreas = BeanConvertUtil.covertBeanList(cityAreaV1ServiceDaoImpl.getCityAreaInfo(BeanConvertUtil.beanCovertMap(cityAreaDto)), CityAreaDto.class);
+
+        return cityAreas;
+    }
+
+
+    @Override
+    public int queryCityAreasCount(@RequestBody CityAreaDto cityAreaDto) {
+        return cityAreaV1ServiceDaoImpl.queryCityAreasCount(BeanConvertUtil.beanCovertMap(cityAreaDto));    }
+
+}