fix: 行政区划
This commit is contained in:
parent
e8808e805c
commit
90c2e14fd1
|
|
@ -39,8 +39,8 @@ public class CrmGsdjxxController {
|
||||||
|
|
||||||
@PostMapping("/queryGsdjxxByDate/{date}")
|
@PostMapping("/queryGsdjxxByDate/{date}")
|
||||||
@ApiOperation("根据日期查询(默认是当天)")
|
@ApiOperation("根据日期查询(默认是当天)")
|
||||||
public Result<BasePage<Map<String, Object>>> queryGsdjxxByDate(@PathVariable String date) {
|
public Result<BasePage<Map<String, Object>>> queryGsdjxxByDate(@RequestBody CrmQueryGsdjxxDTO crmQueryGsdjxxDTO) {
|
||||||
BasePage<Map<String, Object>> basePage = iCrmGsdjxxService.queryGsdjxxByDate(date);
|
BasePage<Map<String, Object>> basePage = iCrmGsdjxxService.queryGsdjxxByDate(crmQueryGsdjxxDTO);
|
||||||
return R.ok(basePage);
|
return R.ok(basePage);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,99 @@
|
||||||
|
package com.kakarote.crm.controller;
|
||||||
|
|
||||||
|
|
||||||
|
import com.kakarote.core.common.ParamAspect;
|
||||||
|
import com.kakarote.core.common.R;
|
||||||
|
import com.kakarote.core.common.Result;
|
||||||
|
import com.kakarote.crm.entity.PO.Xzqh;
|
||||||
|
import com.kakarote.crm.entity.VO.XzqhOptionVO;
|
||||||
|
import com.kakarote.crm.service.IXzqhService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 行政区划Controller
|
||||||
|
*
|
||||||
|
* @author natural
|
||||||
|
* @date 2023-08-21
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/crmXzqh")
|
||||||
|
public class XzqhController
|
||||||
|
{
|
||||||
|
@Autowired
|
||||||
|
private IXzqhService xzqhService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询行政区划列表
|
||||||
|
*/
|
||||||
|
@GetMapping("/list")
|
||||||
|
public Result<List<Xzqh>> list(Xzqh xzqh)
|
||||||
|
{
|
||||||
|
List<Xzqh> list = xzqhService.selectXzqhList(xzqh);
|
||||||
|
return R.ok(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询行政区划列表
|
||||||
|
*/
|
||||||
|
@GetMapping("/all")
|
||||||
|
@ParamAspect
|
||||||
|
public Result<List<Xzqh>> all(Xzqh xzqh)
|
||||||
|
{
|
||||||
|
List<Xzqh> list = xzqhService.selectXzqhList(xzqh);
|
||||||
|
return R.ok(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取嵌套结构的行政区划数据,用于前端多级选择组件
|
||||||
|
* @return 嵌套结构的行政区划数据
|
||||||
|
*/
|
||||||
|
@GetMapping("/treeOptions")
|
||||||
|
@ParamAspect
|
||||||
|
public Result<List<XzqhOptionVO>> getTreeOptions() {
|
||||||
|
List<XzqhOptionVO> options = xzqhService.buildXzqhTree();
|
||||||
|
return R.ok(options);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出行政区划列表
|
||||||
|
*/
|
||||||
|
// @PostMapping("/export")
|
||||||
|
// public void export(HttpServletResponse response, Xzqh xzqh)
|
||||||
|
// {
|
||||||
|
// List<Xzqh> list = xzqhService.selectXzqhList(xzqh);
|
||||||
|
// ExcelUtil<Xzqh> util = new ExcelUtil<Xzqh>(Xzqh.class);
|
||||||
|
// util.exportExcel(response, list, "行政区划数据");
|
||||||
|
// }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取行政区划详细信息
|
||||||
|
*/
|
||||||
|
@GetMapping(value = "/{id}")
|
||||||
|
public Result<Xzqh> getInfo(@PathVariable("id") String id)
|
||||||
|
{
|
||||||
|
return R.ok(xzqhService.selectXzqhById(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
// * 获取省行政区域
|
||||||
|
// * @return
|
||||||
|
// */
|
||||||
|
// @GetMapping("/getProvinceArea")
|
||||||
|
// public AjaxResult getProvinceArea(){
|
||||||
|
// AjaxResult ajax = AjaxResult.success();
|
||||||
|
// List<Xzqh> provinceArea = xzqhService.getProvinceArea();
|
||||||
|
// ajax.put("qyDm",provinceArea);
|
||||||
|
// return ajax;
|
||||||
|
// }
|
||||||
|
// @GetMapping("/syncXzqh")
|
||||||
|
// public AjaxResult syncXzqh(){
|
||||||
|
// AjaxResult ajax = AjaxResult.success();
|
||||||
|
// xzqhService.syncXzqhFromRpa();
|
||||||
|
// return ajax;
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,108 @@
|
||||||
|
package com.kakarote.crm.entity.PO;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 行政区划对象 xzqh
|
||||||
|
*
|
||||||
|
* @author natural
|
||||||
|
* @date 2023-08-21
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@TableName(value = "xzqh")
|
||||||
|
public class Xzqh implements Serializable
|
||||||
|
{
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@TableId(type = IdType.ASSIGN_ID)
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
/** 行政区划字母代码 */
|
||||||
|
@TableField("xzqhzm_dm")
|
||||||
|
private String xzqhzmDm;
|
||||||
|
|
||||||
|
/** 行政区划名称 */
|
||||||
|
@TableField("xzqhmc")
|
||||||
|
private String xzqhmc;
|
||||||
|
|
||||||
|
/** 上级行政区划数字代码 */
|
||||||
|
@TableField("sjxzqhsz_dm")
|
||||||
|
private String sjxzqhszDm;
|
||||||
|
|
||||||
|
/** 行政区划级次(1省级 2市级 3区县) */
|
||||||
|
private String xzqhjc;
|
||||||
|
|
||||||
|
/** 有效标志 */
|
||||||
|
@TableField("yxbz")
|
||||||
|
private String yxbz;
|
||||||
|
|
||||||
|
/** 选用标志 */
|
||||||
|
@TableField("xybz")
|
||||||
|
private String xybz;
|
||||||
|
|
||||||
|
/** 行政区划罗马字母代码 */
|
||||||
|
@TableField("xzqhlmzm_dm")
|
||||||
|
private String xzqhlmzmDm;
|
||||||
|
|
||||||
|
/** 所属行政区名称||所属行政区 */
|
||||||
|
@TableField("ssxzqmc")
|
||||||
|
private String ssxzqmc;
|
||||||
|
|
||||||
|
/** 税务机关代码 */
|
||||||
|
@TableField("swjg_dm")
|
||||||
|
private String swjgDm;
|
||||||
|
|
||||||
|
/** 行政区划类型代码||行政区划类型代码 */
|
||||||
|
@TableField("xzqhlx_dm")
|
||||||
|
private String xzqhlxDm;
|
||||||
|
|
||||||
|
/** 行政区域代码 */
|
||||||
|
@TableField("xzqh_dm")
|
||||||
|
private String xzqhDm;
|
||||||
|
|
||||||
|
/** 有下级*/
|
||||||
|
@TableField("yxj")
|
||||||
|
private String yxj;
|
||||||
|
|
||||||
|
/** 总名称*/
|
||||||
|
@TableField("xzqh_cj")
|
||||||
|
private String xzqhCj;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 区划代码层级
|
||||||
|
* */
|
||||||
|
@TableField("dm_hierarchy")
|
||||||
|
private String dmHierarchy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 区划名称层级
|
||||||
|
*/
|
||||||
|
@TableField("mc_hierarchy")
|
||||||
|
private String mcHierarchy;
|
||||||
|
|
||||||
|
/** 创建者 */
|
||||||
|
@TableField(fill = FieldFill.INSERT)
|
||||||
|
private String createBy;
|
||||||
|
|
||||||
|
/** 创建时间 */
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
@TableField(fill = FieldFill.INSERT)
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
/** 更新者 */
|
||||||
|
@TableField(fill = FieldFill.UPDATE)
|
||||||
|
private String updateBy;
|
||||||
|
|
||||||
|
/** 更新时间 */
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
@TableField(fill = FieldFill.UPDATE)
|
||||||
|
private LocalDateTime updateTime;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,46 @@
|
||||||
|
package com.kakarote.crm.entity.VO;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 行政区划选项VO,用于前端多级选择组件
|
||||||
|
* 提供符合前端组件要求的value-label-children嵌套结构
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class XzqhOptionVO {
|
||||||
|
/**
|
||||||
|
* 值,对应行政区划代码
|
||||||
|
*/
|
||||||
|
private String value;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 显示文本,对应行政区划名称
|
||||||
|
*/
|
||||||
|
private String label;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 子级行政区划列表,实现层级嵌套结构
|
||||||
|
*/
|
||||||
|
private List<XzqhOptionVO> children;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 默认构造函数,初始化空的子级列表
|
||||||
|
*/
|
||||||
|
public XzqhOptionVO() {
|
||||||
|
this.children = new ArrayList<>();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 带参构造函数,方便快速创建对象
|
||||||
|
* @param value 行政区划代码
|
||||||
|
* @param label 行政区划名称
|
||||||
|
*/
|
||||||
|
public XzqhOptionVO(String value, String label) {
|
||||||
|
this.value = value;
|
||||||
|
this.label = label;
|
||||||
|
this.children = new ArrayList<>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,37 @@
|
||||||
|
package com.kakarote.crm.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.kakarote.crm.entity.PO.Xzqh;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 行政区划Mapper接口
|
||||||
|
*
|
||||||
|
* @author natural
|
||||||
|
* @date 2023-08-21
|
||||||
|
*/
|
||||||
|
public interface XzqhMapper extends BaseMapper<Xzqh>
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 查询行政区划列表
|
||||||
|
*
|
||||||
|
* @param xzqh 行政区划
|
||||||
|
* @return 行政区划集合
|
||||||
|
*/
|
||||||
|
public List<Xzqh> selectXzqhList(Xzqh xzqh);
|
||||||
|
|
||||||
|
void clearTemp();
|
||||||
|
|
||||||
|
void updateXzqh();
|
||||||
|
|
||||||
|
void deleteDuplicate();
|
||||||
|
|
||||||
|
void insertSsbmFromTemp();
|
||||||
|
|
||||||
|
String getXzqhDm(String xzqhDm);
|
||||||
|
|
||||||
|
String getXzqhName(String xzqhDm);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,107 @@
|
||||||
|
<?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="com.kakarote.crm.mapper.XzqhMapper">
|
||||||
|
|
||||||
|
<resultMap type="com.kakarote.crm.entity.PO.Xzqh" id="XzqhResult">
|
||||||
|
<result property="id" column="id" />
|
||||||
|
<result property="createBy" column="create_by" />
|
||||||
|
<result property="createTime" column="create_time" />
|
||||||
|
<result property="updateBy" column="update_by" />
|
||||||
|
<result property="updateTime" column="update_time" />
|
||||||
|
<result property="xzqhzmDm" column="xzqhzm_dm" />
|
||||||
|
<result property="xzqhmc" column="xzqhmc" />
|
||||||
|
<result property="sjxzqhszDm" column="sjxzqhsz_dm" />
|
||||||
|
<result property="xzqhjc" column="xzqhjc" />
|
||||||
|
<result property="yxbz" column="yxbz" />
|
||||||
|
<result property="xybz" column="xybz" />
|
||||||
|
<result property="xzqhlmzmDm" column="xzqhlmzm_dm" />
|
||||||
|
<result property="ssxzqmc" column="ssxzqmc" />
|
||||||
|
<result property="swjgDm" column="swjg_dm" />
|
||||||
|
<result property="xzqhlxDm" column="xzqhlx_dm" />
|
||||||
|
<result property="xzqhDm" column="xzqh_dm" />
|
||||||
|
<result property="xzqhCj" column="xzqh_cj" />
|
||||||
|
<result property="yxj" column="yxj" />
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<sql id="selectXzqhVo">
|
||||||
|
select id,
|
||||||
|
create_by,
|
||||||
|
create_time,
|
||||||
|
update_by,
|
||||||
|
update_time,
|
||||||
|
xzqhzm_dm,
|
||||||
|
xzqhmc,
|
||||||
|
sjxzqhsz_dm,
|
||||||
|
xzqhjc,
|
||||||
|
yxbz,
|
||||||
|
xybz,
|
||||||
|
xzqhlmzm_dm,
|
||||||
|
ssxzqmc,
|
||||||
|
swjg_dm,
|
||||||
|
xzqhlx_dm,
|
||||||
|
xzqh_dm,
|
||||||
|
yxj
|
||||||
|
from xzqh
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<select id="selectXzqhList" parameterType="com.kakarote.crm.entity.PO.Xzqh" resultMap="XzqhResult">
|
||||||
|
<include refid="selectXzqhVo"/>
|
||||||
|
<where>
|
||||||
|
<if test="xzqhzmDm != null and xzqhzmDm != ''"> and xzqhzm_dm = #{xzqhzmDm}</if>
|
||||||
|
<if test="xzqhmc != null and xzqhmc != ''"> and xzqhmc = #{xzqhmc}</if>
|
||||||
|
<if test="sjxzqhszDm != null and sjxzqhszDm != ''"> and sjxzqhsz_dm = #{sjxzqhszDm}</if>
|
||||||
|
<if test="xzqhjc != null and xzqhjc != ''"> and xzqhjc = #{xzqhjc}</if>
|
||||||
|
<if test="yxbz != null and yxbz != ''"> and yxbz = #{yxbz}</if>
|
||||||
|
<if test="xybz != null and xybz != ''"> and xybz = #{xybz}</if>
|
||||||
|
<if test="xzqhlmzmDm != null and xzqhlmzmDm != ''"> and xzqhlmzm_dm = #{xzqhlmzmDm}</if>
|
||||||
|
<if test="ssxzqmc != null and ssxzqmc != ''"> and ssxzqmc = #{ssxzqmc}</if>
|
||||||
|
<if test="swjgDm != null and swjgDm != ''"> and swjg_dm = #{swjgDm}</if>
|
||||||
|
<if test="xzqhlxDm != null and xzqhlxDm != ''"> and xzqhlx_dm = #{xzqhlxDm}</if>
|
||||||
|
<if test="xzqhCj != null and xzqhCj != ''"> and xzqh_cj = #{xzqhCj}</if>
|
||||||
|
<if test="xzqhDm != null and xzqhDm != ''"> and xzqh_dm = #{xzqhDm}</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<delete id="clearTemp">
|
||||||
|
delete from sync_xzqh_temp
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
<insert id="insertTempData">
|
||||||
|
insert into sync_xzqh_temp (id,sj_xzqh_dm,xzqh_dm,xzqh_mc,xzqh_jb,yxj,yxbz)
|
||||||
|
values
|
||||||
|
<foreach collection="xzqhList" item="xzqh" separator="," >
|
||||||
|
(#{xzqh.id},#{xzqh.sjXzqhDm},#{xzqh.xzqhDm},#{xzqh.xzqhMc},#{xzqh.xzqhJb},#{xzqh.yxj},#{xzqh.yxbz})
|
||||||
|
</foreach>
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<update id="updateXzqh">
|
||||||
|
update xzqh qh ,sync_xzqh_temp temp
|
||||||
|
set qh.xzqh_dm = temp.xzqh_dm,
|
||||||
|
qh.xzqhmc = temp.xzqh_mc,
|
||||||
|
qh.sjxzqhsz_dm = temp.sj_xzqh_dm,
|
||||||
|
qh.xzqhjc = temp.xzqh_jb,
|
||||||
|
qh.yxj = temp.yxj,
|
||||||
|
qh.yxbz=temp.yxbz,
|
||||||
|
update_time=now()
|
||||||
|
where qh.id = temp.id
|
||||||
|
</update>
|
||||||
|
<delete id="deleteDuplicate">
|
||||||
|
delete sync
|
||||||
|
from sync_xzqh_temp sync , xzqh qh
|
||||||
|
where qh.id = sync.id
|
||||||
|
</delete>
|
||||||
|
<insert id="insertSsbmFromTemp">
|
||||||
|
insert into xzqh (id,sjxzqhsz_dm,xzqh_dm,xzqhmc,xzqhjc,yxj,yxbz,create_time)
|
||||||
|
select id, sj_xzqh_dm, xzqh_dm, xzqh_mc, xzqh_jb, yxj, yxbz,now()
|
||||||
|
from sync_xzqh_temp;
|
||||||
|
</insert>
|
||||||
|
<select id="getXzqhDm" parameterType="String" resultType="String">
|
||||||
|
select dm_hierarchy from xzqh where xzqh_cj=#{xzqhDm}
|
||||||
|
</select>
|
||||||
|
<select id="getXzqhName" parameterType="String" resultType="String">
|
||||||
|
select xzqhmc from xzqh where xzqh_dm=#{xzqhDm}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
</mapper>
|
||||||
|
|
@ -27,5 +27,5 @@ public interface ICrmGsdjxxService extends BaseService<CrmGsdjxx> {
|
||||||
/**
|
/**
|
||||||
* 根据日期查询(默认是当天)
|
* 根据日期查询(默认是当天)
|
||||||
*/
|
*/
|
||||||
BasePage<Map<String, Object>> queryGsdjxxByDate(String date);
|
BasePage<Map<String, Object>> queryGsdjxxByDate(CrmQueryGsdjxxDTO crmQueryGsdjxxDTO);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,104 @@
|
||||||
|
package com.kakarote.crm.service;
|
||||||
|
|
||||||
|
|
||||||
|
import com.kakarote.crm.entity.PO.Xzqh;
|
||||||
|
import com.kakarote.crm.entity.VO.XzqhOptionVO;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 行政区划Service接口
|
||||||
|
*
|
||||||
|
* @author natural
|
||||||
|
* @date 2023-08-21
|
||||||
|
*/
|
||||||
|
public interface IXzqhService
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 查询行政区划
|
||||||
|
*
|
||||||
|
* @param id 行政区划主键
|
||||||
|
* @return 行政区划
|
||||||
|
*/
|
||||||
|
public Xzqh selectXzqhById(String id);
|
||||||
|
|
||||||
|
// AddVo addressCheck(String add);
|
||||||
|
/**
|
||||||
|
* 查询行政区划列表
|
||||||
|
*
|
||||||
|
* @param xzqh 行政区划
|
||||||
|
* @return 行政区划集合
|
||||||
|
*/
|
||||||
|
public List<Xzqh> selectXzqhList(Xzqh xzqh);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增行政区划
|
||||||
|
*
|
||||||
|
* @param xzqh 行政区划
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
// public int insertXzqh(Xzqh xzqh);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改行政区划
|
||||||
|
*
|
||||||
|
* @param xzqh 行政区划
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
// public int updateXzqh(Xzqh xzqh);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除行政区划
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的行政区划主键集合
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteXzqhByIds(String[] ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除行政区划信息
|
||||||
|
*
|
||||||
|
* @param id 行政区划主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteXzqhById(String id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过级联行政区划代码来查询行政区划名
|
||||||
|
* @param cascadeCodes 级别代码
|
||||||
|
* @param separator 多个行政区划之间的分隔符,可为空。默认为 "/"
|
||||||
|
* @return 行政区划名
|
||||||
|
*/
|
||||||
|
// String findByCascadeCode(String cascadeCodes,String separator);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取省级行政区域
|
||||||
|
* @return 返回行政区域列表
|
||||||
|
*/
|
||||||
|
public List<Xzqh> getProvinceArea();
|
||||||
|
|
||||||
|
// void syncXzqhFromRpa();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据行政区划的名称获取行政区划的代码
|
||||||
|
* @param xzqhName
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public String getXzqhDm(String xzqhName);
|
||||||
|
|
||||||
|
String getXzqhName(String xzqhDm);
|
||||||
|
// List<String> getXzqhDmFromMcHierarchy(String join);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 构建行政区划树形结构
|
||||||
|
* @return 行政区划树形结构数据
|
||||||
|
*/
|
||||||
|
public List<XzqhOptionVO> buildXzqhTree();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据行政区划代码查询该区域及其所有下级区域的总名称(xzqhCj)
|
||||||
|
* @param xzqhDm 行政区划代码
|
||||||
|
* @return 包含当前区域及其所有下级区域总名称的列表
|
||||||
|
*/
|
||||||
|
public List<String> getXzqhCjListByCode(String xzqhDm);
|
||||||
|
}
|
||||||
|
|
@ -151,6 +151,9 @@ public class CrmCustomerServiceImpl extends BaseServiceImpl<CrmCustomerMapper, C
|
||||||
@Autowired
|
@Autowired
|
||||||
private ICrmDjzclxService crmDjzclxService;
|
private ICrmDjzclxService crmDjzclxService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IXzqhService xzqhService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询字段配置
|
* 查询字段配置
|
||||||
*
|
*
|
||||||
|
|
@ -652,7 +655,8 @@ public class CrmCustomerServiceImpl extends BaseServiceImpl<CrmCustomerMapper, C
|
||||||
}else if ("客户详细地址".equals(crmField.getName())){
|
}else if ("客户详细地址".equals(crmField.getName())){
|
||||||
field.setValue(gsdjxx.getScjydz());
|
field.setValue(gsdjxx.getScjydz());
|
||||||
}else if ("客户所在地区".equals(crmField.getName())){
|
}else if ("客户所在地区".equals(crmField.getName())){
|
||||||
field.setValue(gsdjxx.getDz());
|
String xzqhName = xzqhService.getXzqhName(gsdjxx.getXzqhDm());
|
||||||
|
field.setValue(xzqhName);
|
||||||
}else if ("开业日期".equals(crmField.getName())){
|
}else if ("开业日期".equals(crmField.getName())){
|
||||||
field.setValue(gsdjxx.getKyrq());
|
field.setValue(gsdjxx.getKyrq());
|
||||||
}else if ("客户名称".equals(crmField.getName())){
|
}else if ("客户名称".equals(crmField.getName())){
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@ import com.kakarote.crm.mapper.CrmGsdjxxMapper;
|
||||||
import com.kakarote.crm.service.ICrmCustomerPoolService;
|
import com.kakarote.crm.service.ICrmCustomerPoolService;
|
||||||
import com.kakarote.crm.service.ICrmCustomerService;
|
import com.kakarote.crm.service.ICrmCustomerService;
|
||||||
import com.kakarote.crm.service.ICrmGsdjxxService;
|
import com.kakarote.crm.service.ICrmGsdjxxService;
|
||||||
|
import com.kakarote.crm.service.IXzqhService;
|
||||||
import com.kakarote.crm.util.JsonUtil;
|
import com.kakarote.crm.util.JsonUtil;
|
||||||
import com.kakarote.crm.util.WebServiceHandlerUtil;
|
import com.kakarote.crm.util.WebServiceHandlerUtil;
|
||||||
import com.kakarote.crm.webService.config.TaxWebServiceConfig;
|
import com.kakarote.crm.webService.config.TaxWebServiceConfig;
|
||||||
|
|
@ -46,6 +47,9 @@ public class CrmGsdjxxServiceImpl extends BaseServiceImpl<CrmGsdjxxMapper,CrmGsd
|
||||||
|
|
||||||
private static final Log log = LogFactory.get();
|
private static final Log log = LogFactory.get();
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IXzqhService xzqhService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<CrmQueryGsdjxxVO> queryByMonthAndXzqhDm(CrmQueryGsdjxxDTO crmQueryGsdjxxDTO) throws Exception {
|
public List<CrmQueryGsdjxxVO> queryByMonthAndXzqhDm(CrmQueryGsdjxxDTO crmQueryGsdjxxDTO) throws Exception {
|
||||||
//处理请求参数
|
//处理请求参数
|
||||||
|
|
@ -154,11 +158,13 @@ public class CrmGsdjxxServiceImpl extends BaseServiceImpl<CrmGsdjxxMapper,CrmGsd
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BasePage<Map<String, Object>> queryGsdjxxByDate(String date) {
|
public BasePage<Map<String, Object>> queryGsdjxxByDate(CrmQueryGsdjxxDTO crmQueryGsdjxxDTO) {
|
||||||
System.out.println(date);
|
|
||||||
|
//通过行政区划代码回去
|
||||||
|
List<String> xzqhCjListByCode = xzqhService.getXzqhCjListByCode(crmQueryGsdjxxDTO.getXzqhDm());
|
||||||
|
|
||||||
List<String> values = new ArrayList<>();
|
List<String> values = new ArrayList<>();
|
||||||
values.add(date);
|
values.add(crmQueryGsdjxxDTO.getRq());
|
||||||
|
|
||||||
CrmSearchBO.Search search = new CrmSearchBO.Search();
|
CrmSearchBO.Search search = new CrmSearchBO.Search();
|
||||||
search.setFormType("text");
|
search.setFormType("text");
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,389 @@
|
||||||
|
package com.kakarote.crm.service.impl;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
|
||||||
|
import com.kakarote.crm.entity.PO.Xzqh;
|
||||||
|
import com.kakarote.crm.entity.VO.XzqhOptionVO;
|
||||||
|
import com.kakarote.crm.mapper.XzqhMapper;
|
||||||
|
import com.kakarote.crm.service.IXzqhService;
|
||||||
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.data.redis.core.RedisTemplate;
|
||||||
|
import org.springframework.scheduling.annotation.Async;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.*;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 行政区划Service业务层处理
|
||||||
|
*
|
||||||
|
* @author natural
|
||||||
|
* @date 2023-08-21
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class XzqhServiceImpl implements IXzqhService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private XzqhMapper xzqhMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private RedisTemplate<String, String> redisTemplate;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询行政区划
|
||||||
|
*
|
||||||
|
* @param id 行政区划主键
|
||||||
|
* @return 行政区划
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Xzqh selectXzqhById(String id) {
|
||||||
|
return xzqhMapper.selectById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
// /**
|
||||||
|
// * 区分省级,市级....
|
||||||
|
// * @param add
|
||||||
|
// * @return
|
||||||
|
// */
|
||||||
|
// @Override
|
||||||
|
// public AddVo addressCheck(String add){
|
||||||
|
// if (StringUtils.isNotNull(add)){
|
||||||
|
// AddVo addVo =new AddVo();
|
||||||
|
// Xzqh xhmc = new Xzqh();
|
||||||
|
// xhmc.setXzqhCj(add);
|
||||||
|
// xhmc=selectXzqhList(xhmc).get(0);
|
||||||
|
//
|
||||||
|
// switch (xhmc.getXzqhjc()){
|
||||||
|
// case "3":
|
||||||
|
// addVo.setXjmc(xhmc.getXzqhmc());
|
||||||
|
//
|
||||||
|
// Xzqh dDjmc = new Xzqh();
|
||||||
|
// dDjmc.setXzqhDm(xhmc.getSjxzqhszDm());
|
||||||
|
// dDjmc = selectXzqhList(dDjmc).get(0);
|
||||||
|
// addVo.setDsjmc(dDjmc.getXzqhmc());
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// Xzqh sjmc = new Xzqh();
|
||||||
|
// sjmc.setXzqhDm(dDjmc.getSjxzqhszDm());
|
||||||
|
// sjmc = selectXzqhList(sjmc).get(0);
|
||||||
|
// addVo.setSjmc(sjmc.getXzqhmc());
|
||||||
|
// break;
|
||||||
|
//
|
||||||
|
// case "2":
|
||||||
|
// addVo.setDsjmc(xhmc.getXzqhmc());
|
||||||
|
//
|
||||||
|
// Xzqh sjmc2 = new Xzqh();
|
||||||
|
// sjmc2.setXzqhDm(xhmc.getSjxzqhszDm());
|
||||||
|
// sjmc2 = selectXzqhList(sjmc2).get(0);
|
||||||
|
// addVo.setSjmc(sjmc2.getXzqhmc());
|
||||||
|
// break;
|
||||||
|
//
|
||||||
|
// case "1":
|
||||||
|
// addVo.setSjmc(add);
|
||||||
|
// break;
|
||||||
|
// default:
|
||||||
|
// return null;
|
||||||
|
// }
|
||||||
|
// return addVo;
|
||||||
|
// }else {
|
||||||
|
// return null;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
/**
|
||||||
|
* 查询行政区划列表
|
||||||
|
*
|
||||||
|
* @param xzqh 行政区划
|
||||||
|
* @return 行政区划
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<Xzqh> selectXzqhList(Xzqh xzqh) {
|
||||||
|
return xzqhMapper.selectXzqhList(xzqh);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增行政区划
|
||||||
|
*
|
||||||
|
* @param xzqh 行政区划
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
// @Override
|
||||||
|
// public int insertXzqh(Xzqh xzqh) {
|
||||||
|
// xzqh.setCreateTime(LocalDateTime.now());
|
||||||
|
// return xzqhMapper.insert(xzqh);
|
||||||
|
// }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改行政区划
|
||||||
|
*
|
||||||
|
* @param xzqh 行政区划
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
// @Override
|
||||||
|
// public int updateXzqh(Xzqh xzqh) {
|
||||||
|
// xzqh.setUpdateTime(LocalDateTime.now());
|
||||||
|
// return xzqhMapper.updateById(xzqh);
|
||||||
|
// }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除行政区划
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的行政区划主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int deleteXzqhByIds(String[] ids) {
|
||||||
|
return xzqhMapper.deleteBatchIds(Arrays.asList(ids));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除行政区划信息
|
||||||
|
*
|
||||||
|
* @param id 行政区划主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int deleteXzqhById(String id) {
|
||||||
|
return xzqhMapper.deleteById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
// @Override
|
||||||
|
// public String findByCascadeCode(String cascadeCodes, String separator) {
|
||||||
|
// separator = StringUtils.isNotEmpty(separator) ? separator : "/";
|
||||||
|
// List<String> cascadeList = Arrays.asList(StringUtils.split(cascadeCodes, ","));
|
||||||
|
// String keyPrefix = "xzqh:id:";
|
||||||
|
// if (CollectionUtils.isNotEmpty(cascadeList)) {
|
||||||
|
// List<String> nameList = new ArrayList<>();
|
||||||
|
// for (String cascadeCode : cascadeList) {
|
||||||
|
// String key = keyPrefix + cascadeCode;
|
||||||
|
// if (Boolean.TRUE.equals(redisTemplate.hasKey(key))) {
|
||||||
|
// String value = redisTemplate.boundValueOps(key).get();
|
||||||
|
// nameList.add(value);
|
||||||
|
// } else {
|
||||||
|
// Xzqh xzqh = xzqhMapper.selectById(cascadeCode);
|
||||||
|
// nameList.add(xzqh.getXzqhmc());
|
||||||
|
// redisTemplate.boundValueOps(key).set(xzqh.getXzqhmc(), 30, TimeUnit.MINUTES);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// return String.join(separator, nameList);
|
||||||
|
// }
|
||||||
|
// return "";
|
||||||
|
// }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Xzqh> getProvinceArea() {
|
||||||
|
//返回省级行政数据
|
||||||
|
List<Xzqh> list = new LambdaQueryChainWrapper<>(xzqhMapper)
|
||||||
|
.eq(Xzqh::getXzqhjc,"1")
|
||||||
|
.orderByAsc(Xzqh::getXzqhDm)
|
||||||
|
.list();
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
//
|
||||||
|
// @Override
|
||||||
|
// @Transactional(rollbackFor = Exception.class)
|
||||||
|
// @Async
|
||||||
|
// public void syncXzqhFromRpa() {
|
||||||
|
// List<ForeseeXzqh> xzqhList = new ArrayList<>();
|
||||||
|
// sync("86", xzqhList);
|
||||||
|
// if (CollectionUtils.isNotEmpty(xzqhList)) {
|
||||||
|
// int size = xzqhList.size();
|
||||||
|
// int batch = 800;
|
||||||
|
// int count = size / batch;
|
||||||
|
// if (size % batch != 0) {
|
||||||
|
// count++;
|
||||||
|
// }
|
||||||
|
// for (int i = 0; i < count; i++) {
|
||||||
|
// int from = i * batch;
|
||||||
|
// int to = (i + 1) * batch - 1;
|
||||||
|
// to = Math.min(to, xzqhList.size());
|
||||||
|
// List<ForeseeXzqh> ssmbList = xzqhList.subList(from, to);
|
||||||
|
// xzqhMapper.insertTempData(ssmbList);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
// xzqhMapper.updateXzqh();
|
||||||
|
// xzqhMapper.deleteDuplicate();
|
||||||
|
// xzqhMapper.insertSsbmFromTemp();
|
||||||
|
// }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getXzqhDm(String xzqhName) {
|
||||||
|
return xzqhMapper.getXzqhDm(xzqhName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getXzqhName(String xzqhDm) {
|
||||||
|
return xzqhMapper.getXzqhName(xzqhDm);
|
||||||
|
}
|
||||||
|
|
||||||
|
// @Override
|
||||||
|
// public List<String> getXzqhDmFromMcHierarchy(String mcHierarchy) {
|
||||||
|
// if (StringUtils.isNotEmpty(mcHierarchy)) {
|
||||||
|
// Xzqh xzqh = new LambdaQueryChainWrapper<>(xzqhMapper)
|
||||||
|
// .eq(Xzqh::getMcHierarchy, mcHierarchy)
|
||||||
|
// .last("limit 1")
|
||||||
|
// .one();
|
||||||
|
// if (Objects.nonNull(xzqh)) {
|
||||||
|
// return Arrays.asList(StringUtils.split(xzqh.getMcHierarchy(), ","));
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// return Collections.emptyList();
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// private void sync(String sjxzbm, List<ForeseeXzqh> respList) {
|
||||||
|
// QyTaxUser qyTaxUsers = qyTaxUserService.getRandomOnlineTaxUser(null);
|
||||||
|
// if (Objects.nonNull(qyTaxUsers)) {
|
||||||
|
// List<ForeseeXzqh> xzqhList = foreseeInvoiceHandler.qgxzqhcx(sjxzbm, qyTaxUsers.getToken());
|
||||||
|
// if (CollectionUtils.isNotEmpty(xzqhList)) {
|
||||||
|
// respList.addAll(xzqhList);
|
||||||
|
// for (ForeseeXzqh xzqh : xzqhList) {
|
||||||
|
// String xzqhDm = xzqh.getXzqhDm();
|
||||||
|
// sync(xzqhDm, respList);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 构建行政区划树形结构(优化版本)
|
||||||
|
* @return 行政区划树形结构数据
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<XzqhOptionVO> buildXzqhTree() {
|
||||||
|
// 先获取所有有效的行政区划数据
|
||||||
|
List<Xzqh> allXzqhList = selectXzqhList(null);
|
||||||
|
|
||||||
|
if (CollectionUtils.isEmpty(allXzqhList)) {
|
||||||
|
return new ArrayList<>();
|
||||||
|
}
|
||||||
|
// 使用Map优化构建过程
|
||||||
|
List<XzqhOptionVO> result = buildTreeWithMap(allXzqhList);
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 使用Map优化构建树形结构
|
||||||
|
* @param allXzqhList 所有行政区划数据
|
||||||
|
* @return 树形结构数据
|
||||||
|
*/
|
||||||
|
private List<XzqhOptionVO> buildTreeWithMap(List<Xzqh> allXzqhList) {
|
||||||
|
List<XzqhOptionVO> result = new ArrayList<>();
|
||||||
|
Map<String, XzqhOptionVO> codeToOptionMap = new HashMap<>();
|
||||||
|
|
||||||
|
// 1. 先将所有行政区划转换为OptionVO并放入Map
|
||||||
|
for (Xzqh xzqh : allXzqhList) {
|
||||||
|
XzqhOptionVO option = new XzqhOptionVO(xzqh.getXzqhDm(), xzqh.getXzqhmc());
|
||||||
|
codeToOptionMap.put(xzqh.getXzqhDm(), option);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2. 构建父子关系
|
||||||
|
for (Xzqh xzqh : allXzqhList) {
|
||||||
|
XzqhOptionVO currentOption = codeToOptionMap.get(xzqh.getXzqhDm());
|
||||||
|
String parentCode = xzqh.getSjxzqhszDm();
|
||||||
|
|
||||||
|
// 如果没有父级代码或父级代码不存在于Map中,则为根节点
|
||||||
|
if (parentCode == null || parentCode.isEmpty() || !codeToOptionMap.containsKey(parentCode)) {
|
||||||
|
// 省级行政区划通常没有父级或父级代码为特殊值
|
||||||
|
if ("1".equals(xzqh.getXzqhjc())) {
|
||||||
|
result.add(currentOption);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// 有父级,则添加到父级的children中
|
||||||
|
XzqhOptionVO parentOption = codeToOptionMap.get(parentCode);
|
||||||
|
parentOption.getChildren().add(currentOption);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 3. 遍历所有节点,将空的children列表设置为null
|
||||||
|
for (XzqhOptionVO option : codeToOptionMap.values()) {
|
||||||
|
if (option.getChildren() != null && option.getChildren().isEmpty()) {
|
||||||
|
option.setChildren(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<String> getXzqhCjListByCode(String xzqhDm) {
|
||||||
|
List<String> resultList = new ArrayList<>();
|
||||||
|
|
||||||
|
// 参数校验
|
||||||
|
if (xzqhDm == null || xzqhDm.isEmpty()) {
|
||||||
|
return resultList;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
// 1. 先获取当前行政区划数据
|
||||||
|
Xzqh currentXzqh = new Xzqh();
|
||||||
|
currentXzqh.setXzqhDm(xzqhDm);
|
||||||
|
List<Xzqh> currentList = selectXzqhList(currentXzqh);
|
||||||
|
|
||||||
|
if (CollectionUtils.isEmpty(currentList)) {
|
||||||
|
return resultList;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2. 获取所有行政区划数据,便于构建父子关系
|
||||||
|
List<Xzqh> allXzqhList = selectXzqhList(null);
|
||||||
|
if (CollectionUtils.isEmpty(allXzqhList)) {
|
||||||
|
// 如果查询到当前区域但没有其他数据,只返回当前区域的xzqhCj
|
||||||
|
Xzqh xzqh = currentList.get(0);
|
||||||
|
if (xzqh.getXzqhCj() != null && !xzqh.getXzqhCj().isEmpty()) {
|
||||||
|
resultList.add(xzqh.getXzqhCj());
|
||||||
|
}
|
||||||
|
return resultList;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 3. 构建行政区划的父子关系映射
|
||||||
|
Map<String, List<Xzqh>> parentChildMap = new HashMap<>();
|
||||||
|
Map<String, Xzqh> codeToXzqhMap = new HashMap<>();
|
||||||
|
|
||||||
|
for (Xzqh xzqh : allXzqhList) {
|
||||||
|
codeToXzqhMap.put(xzqh.getXzqhDm(), xzqh);
|
||||||
|
|
||||||
|
String parentCode = xzqh.getSjxzqhszDm();
|
||||||
|
if (parentCode != null && !parentCode.isEmpty()) {
|
||||||
|
parentChildMap.computeIfAbsent(parentCode, k -> new ArrayList<>()).add(xzqh);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 4. 从当前行政区划开始,递归收集所有区域的xzqhCj
|
||||||
|
Xzqh startXzqh = currentList.get(0);
|
||||||
|
collectXzqhCj(resultList, startXzqh, parentChildMap, codeToXzqhMap);
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
// 实际应用中应使用日志框架记录异常
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
return resultList;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 递归收集指定行政区划及其所有下级区域的xzqhCj
|
||||||
|
*/
|
||||||
|
private void collectXzqhCj(List<String> resultList, Xzqh currentXzqh,
|
||||||
|
Map<String, List<Xzqh>> parentChildMap, Map<String, Xzqh> codeToXzqhMap) {
|
||||||
|
// 添加当前区域的xzqhCj
|
||||||
|
if (currentXzqh != null && currentXzqh.getXzqhCj() != null && !currentXzqh.getXzqhCj().isEmpty()) {
|
||||||
|
resultList.add(currentXzqh.getXzqhCj());
|
||||||
|
}
|
||||||
|
|
||||||
|
// 递归处理所有子区域
|
||||||
|
String currentCode = currentXzqh.getXzqhDm();
|
||||||
|
List<Xzqh> children = parentChildMap.get(currentCode);
|
||||||
|
|
||||||
|
if (CollectionUtils.isNotEmpty(children)) {
|
||||||
|
for (Xzqh child : children) {
|
||||||
|
collectXzqhCj(resultList, child, parentChildMap, codeToXzqhMap);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue