From a44cca13c424f3358faa170342b67c01eb83583e Mon Sep 17 00:00:00 2001
From: yinzuomei <576302893@qq.com>
Date: Mon, 12 Apr 2021 14:49:23 +0800
Subject: [PATCH 01/21] =?UTF-8?q?=E6=96=B0=E5=A2=9Ecustomer=5Forg=5Fparame?=
=?UTF-8?q?ter;=E4=BF=AE=E6=94=B9/gov/org/agency/agencydetail=E6=8E=A5?=
=?UTF-8?q?=E5=8F=A3=EF=BC=8C=E4=BF=AE=E6=94=B9=E6=B7=BB=E5=8A=A0=E7=BD=91?=
=?UTF-8?q?=E6=A0=BC=20=E6=B7=BB=E5=8A=A0=E9=83=A8=E9=97=A8=E6=8E=A5?=
=?UTF-8?q?=E5=8F=A3?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../dto/govorg/CustomerAgencyDTO.java | 22 +++-
.../entity/govorg/CustomerAgencyEntity.java | 16 ++-
.../govorg/CustomerDepartmentEntity.java | 4 +
.../entity/org/CustomerAgencyEntity.java | 16 ++-
.../java/com/epmet/dto/CustomerAgencyDTO.java | 22 +++-
.../epmet/dto/CustomerOrgParameterDTO.java | 96 +++++++++++++++
.../epmet/dto/result/AgencysResultDTO.java | 21 +++-
.../constant/CustomerAgencyConstant.java | 9 ++
.../epmet/dao/CustomerOrgParameterDao.java | 43 +++++++
.../epmet/entity/CustomerAgencyEntity.java | 16 ++-
.../entity/CustomerDepartmentEntity.java | 4 +
.../entity/CustomerOrgParameterEntity.java | 66 ++++++++++
.../service/CustomerOrgParameterService.java | 104 ++++++++++++++++
.../epmet/service/impl/AgencyServiceImpl.java | 10 +-
.../service/impl/CustomerGridServiceImpl.java | 5 +
.../impl/CustomerOrgParameterServiceImpl.java | 116 ++++++++++++++++++
.../service/impl/DepartmentServiceImpl.java | 3 +
.../mapper/CustomerOrgParameterDao.xml | 14 +++
18 files changed, 562 insertions(+), 25 deletions(-)
create mode 100644 epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/CustomerOrgParameterDTO.java
create mode 100644 epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerOrgParameterDao.java
create mode 100644 epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/entity/CustomerOrgParameterEntity.java
create mode 100644 epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerOrgParameterService.java
create mode 100644 epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerOrgParameterServiceImpl.java
create mode 100644 epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerOrgParameterDao.xml
diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/CustomerAgencyDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/CustomerAgencyDTO.java
index 4b98fb899f..cea8221c31 100644
--- a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/CustomerAgencyDTO.java
+++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/CustomerAgencyDTO.java
@@ -114,17 +114,17 @@ public class CustomerAgencyDTO implements Serializable {
private Integer totalUser;
/**
- * 省份
+ * 区域编码字典中的【省份】名称
*/
- private String province;
+ private String province;
/**
- * 城市
+ * 区域编码字典中的【城市】名称
*/
- private String city;
-
+ private String city;
+
/**
- * 区县
+ * 区域编码字典中的【区县】名称
*/
private String district;
@@ -132,4 +132,14 @@ public class CustomerAgencyDTO implements Serializable {
* 当前组织的上级行政地区编码add0204;举例平阴县对应的是济南市3701
*/
private String parentAreaCode;
+
+ /**
+ * 区域编码字典中的【街道】名称0409
+ */
+ private String street;
+
+ /**
+ * 区域编码字典中的【社区】名称0409
+ */
+ private String community;
}
\ No newline at end of file
diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/govorg/CustomerAgencyEntity.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/govorg/CustomerAgencyEntity.java
index 79f226ca2f..b12cd2112a 100644
--- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/govorg/CustomerAgencyEntity.java
+++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/govorg/CustomerAgencyEntity.java
@@ -80,17 +80,17 @@ public class CustomerAgencyEntity extends BaseEpmetEntity {
private Integer totalUser;
/**
- * 省份
+ * 区域编码字典中的【省份】名称
*/
private String province;
/**
- * 城市
+ * 区域编码字典中的【城市】名称
*/
private String city;
/**
- * 区县
+ * 区域编码字典中的【区县】名称
*/
private String district;
@@ -98,4 +98,14 @@ public class CustomerAgencyEntity extends BaseEpmetEntity {
* 当前组织的上级行政地区编码add0204;举例平阴县对应的是济南市3701
*/
private String parentAreaCode;
+
+ /**
+ * 区域编码字典中的【街道】名称0409
+ */
+ private String street;
+
+ /**
+ * 区域编码字典中的【社区】名称0409
+ */
+ private String community;
}
diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/govorg/CustomerDepartmentEntity.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/govorg/CustomerDepartmentEntity.java
index c0d80a3d9f..74d4ceddc9 100644
--- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/govorg/CustomerDepartmentEntity.java
+++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/govorg/CustomerDepartmentEntity.java
@@ -60,4 +60,8 @@ public class CustomerDepartmentEntity extends BaseEpmetEntity {
*/
private Integer totalUser;
+ /**
+ * 部门所属的行政地区编码:实际就是所属组织的地区编码
+ */
+ private String areaCode;
}
diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/org/CustomerAgencyEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/org/CustomerAgencyEntity.java
index eaf0c0d52a..4f5f964710 100644
--- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/org/CustomerAgencyEntity.java
+++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/org/CustomerAgencyEntity.java
@@ -80,17 +80,17 @@ public class CustomerAgencyEntity extends BaseEpmetEntity {
private Integer totalUser;
/**
- * 省份
+ * 区域编码字典中的【省份】名称
*/
private String province;
/**
- * 城市
+ * 区域编码字典中的【城市】名称
*/
private String city;
/**
- * 区县
+ * 区域编码字典中的【区县】名称
*/
private String district;
@@ -98,4 +98,14 @@ public class CustomerAgencyEntity extends BaseEpmetEntity {
* 当前组织的上级行政地区编码add0204;举例平阴县370124对应的是济南市3701
*/
private String parentAreaCode;
+
+ /**
+ * 区域编码字典中的【街道】名称0409
+ */
+ private String street;
+
+ /**
+ * 区域编码字典中的【社区】名称0409
+ */
+ private String community;
}
diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/CustomerAgencyDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/CustomerAgencyDTO.java
index ea30dbd600..5a7ad8fc85 100644
--- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/CustomerAgencyDTO.java
+++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/CustomerAgencyDTO.java
@@ -114,17 +114,17 @@ public class CustomerAgencyDTO implements Serializable {
private Integer totalUser;
/**
- * 省份
+ * 区域编码字典中的【省份】名称
*/
- private String province;
+ private String province;
/**
- * 城市
+ * 区域编码字典中的【城市】名称
*/
- private String city;
-
+ private String city;
+
/**
- * 区县
+ * 区域编码字典中的【区县】名称
*/
private String district;
@@ -132,4 +132,14 @@ public class CustomerAgencyDTO implements Serializable {
* 当前组织的上级行政地区编码add0204;举例平阴县对应的是济南市3701
*/
private String parentAreaCode;
+
+ /**
+ * 区域编码字典中的【街道】名称0409
+ */
+ private String street;
+
+ /**
+ * 区域编码字典中的【社区】名称0409
+ */
+ private String community;
}
\ No newline at end of file
diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/CustomerOrgParameterDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/CustomerOrgParameterDTO.java
new file mode 100644
index 0000000000..8710b66d01
--- /dev/null
+++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/CustomerOrgParameterDTO.java
@@ -0,0 +1,96 @@
+/**
+ * Copyright 2018 人人开源 https://www.renren.io
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package com.epmet.dto;
+
+import java.io.Serializable;
+import java.util.Date;
+import lombok.Data;
+
+
+/**
+ * 客户组织相关参数表
+ *
+ * @author generator generator@elink-cn.com
+ * @since v1.0.0 2021-04-12
+ */
+@Data
+public class CustomerOrgParameterDTO implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * 主键ID
+ */
+ private String id;
+
+ /**
+ * 客户ID
+ */
+ private String customerId;
+
+ /**
+ * 参数键 eg:area_code_switch
+ */
+ private String parameterKey;
+
+ /**
+ * 参数名 eg:是否开启区域编码
+ */
+ private String parameterName;
+
+ /**
+ * 参数值 eg:开启:open;关闭:closed
+ */
+ private String parameterValue;
+
+ /**
+ * 参数说明 eg:open:当前客户新增组织需要选择areaCode;closed: 无需选择区域编码
+ */
+ private String description;
+
+ /**
+ * 删除标志 0:未删除,1:已删除
+ */
+ private String delFlag;
+
+ /**
+ * 乐观锁
+ */
+ private Integer revision;
+
+ /**
+ * 创建人
+ */
+ private String createdBy;
+
+ /**
+ * 创建时间
+ */
+ private Date createdTime;
+
+ /**
+ * 更新人
+ */
+ private String updatedBy;
+
+ /**
+ * 更新时间
+ */
+ private Date updatedTime;
+
+}
\ No newline at end of file
diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AgencysResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AgencysResultDTO.java
index 4b819ec2b5..3dd448de95 100644
--- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AgencysResultDTO.java
+++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AgencysResultDTO.java
@@ -58,17 +58,17 @@ public class AgencysResultDTO implements Serializable {
private String areaCode = "";
/**
- * 省份
+ * 区域编码字典中的【省份】名称
*/
private String province = "";
/**
- * 城市
+ * 区域编码字典中的【城市】名称
*/
private String city = "";
/**
- * 区县
+ * 区域编码字典中的【区县】名称
*/
private String district = "";
@@ -76,4 +76,19 @@ public class AgencysResultDTO implements Serializable {
* 本机关的所有上级机关
*/
private List parentList;
+
+ /**
+ * 区域编码字典中的【街道】名称0409
+ */
+ private String street;
+
+ /**
+ * 区域编码字典中的【社区】名称0409
+ */
+ private String community;
+
+ /**
+ * open: 选择地区编码必填;closed: 无需选择地区编码;;0409新增返参
+ */
+ private String areaCodeSwitch;
}
\ No newline at end of file
diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/constant/CustomerAgencyConstant.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/constant/CustomerAgencyConstant.java
index da89288f00..3853a0272d 100644
--- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/constant/CustomerAgencyConstant.java
+++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/constant/CustomerAgencyConstant.java
@@ -71,4 +71,13 @@ public interface CustomerAgencyConstant {
* 获取工作人员组织信息失败
*/
String SELECT_STAFF_AGENCY_EXCEPTION = "获取工作人员组织信息失败";
+
+ /**
+ * 参数(area_code_switch)值open: 选择地区编码必填;closed:
+ */
+ String AREA_CODE_SWITCH="area_code_switch";
+
+ String AREA_CODE_SWITCH_CLOSED="closed";
+
+ String AREA_CODE_SWITCH_OPEN="open";
}
diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerOrgParameterDao.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerOrgParameterDao.java
new file mode 100644
index 0000000000..ccbde93bda
--- /dev/null
+++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerOrgParameterDao.java
@@ -0,0 +1,43 @@
+/**
+ * Copyright 2018 人人开源 https://www.renren.io
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package com.epmet.dao;
+
+import com.epmet.commons.mybatis.dao.BaseDao;
+import com.epmet.entity.CustomerOrgParameterEntity;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+/**
+ * 客户组织相关参数表
+ *
+ * @author generator generator@elink-cn.com
+ * @since v1.0.0 2021-04-12
+ */
+@Mapper
+public interface CustomerOrgParameterDao extends BaseDao {
+
+ /**
+ * @return com.epmet.entity.CustomerOrgParameterEntity
+ * @param customerId
+ * @param parameterKey
+ * @author yinzuomei
+ * @description 根据customerId查询参数(area_code_switch)值
+ * @Date 2021/4/12 14:26
+ **/
+ CustomerOrgParameterEntity selectByCustomerId(@Param("customerId") String customerId, @Param("parameterKey") String parameterKey);
+}
\ No newline at end of file
diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/entity/CustomerAgencyEntity.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/entity/CustomerAgencyEntity.java
index 5306281a03..91852ac516 100644
--- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/entity/CustomerAgencyEntity.java
+++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/entity/CustomerAgencyEntity.java
@@ -80,17 +80,17 @@ public class CustomerAgencyEntity extends BaseEpmetEntity {
private Integer totalUser;
/**
- * 省份
+ * 区域编码字典中的【省份】名称
*/
private String province;
/**
- * 城市
+ * 区域编码字典中的【城市】名称
*/
private String city;
/**
- * 区县
+ * 区域编码字典中的【区县】名称
*/
private String district;
@@ -98,4 +98,14 @@ public class CustomerAgencyEntity extends BaseEpmetEntity {
* 当前组织的上级行政地区编码add0204;举例平阴县对应的是济南市3701
*/
private String parentAreaCode;
+
+ /**
+ * 区域编码字典中的【街道】名称0409
+ */
+ private String street;
+
+ /**
+ * 区域编码字典中的【社区】名称0409
+ */
+ private String community;
}
diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/entity/CustomerDepartmentEntity.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/entity/CustomerDepartmentEntity.java
index ba9b1ddcd5..cb54609d3f 100644
--- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/entity/CustomerDepartmentEntity.java
+++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/entity/CustomerDepartmentEntity.java
@@ -60,4 +60,8 @@ public class CustomerDepartmentEntity extends BaseEpmetEntity {
*/
private Integer totalUser;
+ /**
+ * 部门所属的行政地区编码:实际就是所属组织的地区编码
+ */
+ private String areaCode;
}
diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/entity/CustomerOrgParameterEntity.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/entity/CustomerOrgParameterEntity.java
new file mode 100644
index 0000000000..489118f7c8
--- /dev/null
+++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/entity/CustomerOrgParameterEntity.java
@@ -0,0 +1,66 @@
+/**
+ * Copyright 2018 人人开源 https://www.renren.io
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package com.epmet.entity;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+
+import com.epmet.commons.mybatis.entity.BaseEpmetEntity;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+import java.util.Date;
+
+/**
+ * 客户组织相关参数表
+ *
+ * @author generator generator@elink-cn.com
+ * @since v1.0.0 2021-04-12
+ */
+@Data
+@EqualsAndHashCode(callSuper=false)
+@TableName("customer_org_parameter")
+public class CustomerOrgParameterEntity extends BaseEpmetEntity {
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * 客户ID
+ */
+ private String customerId;
+
+ /**
+ * 参数键 eg:area_code_switch
+ */
+ private String parameterKey;
+
+ /**
+ * 参数名 eg:是否开启区域编码
+ */
+ private String parameterName;
+
+ /**
+ * 参数值 eg:开启:open;关闭:closed
+ */
+ private String parameterValue;
+
+ /**
+ * 参数说明 eg:open:当前客户新增组织需要选择areaCode;closed: 无需选择区域编码
+ */
+ private String description;
+
+}
diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerOrgParameterService.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerOrgParameterService.java
new file mode 100644
index 0000000000..a57bdc26a1
--- /dev/null
+++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerOrgParameterService.java
@@ -0,0 +1,104 @@
+/**
+ * Copyright 2018 人人开源 https://www.renren.io
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package com.epmet.service;
+
+import com.epmet.commons.mybatis.service.BaseService;
+import com.epmet.commons.tools.page.PageData;
+import com.epmet.dto.CustomerOrgParameterDTO;
+import com.epmet.entity.CustomerOrgParameterEntity;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 客户组织相关参数表
+ *
+ * @author generator generator@elink-cn.com
+ * @since v1.0.0 2021-04-12
+ */
+public interface CustomerOrgParameterService extends BaseService {
+
+ /**
+ * 默认分页
+ *
+ * @param params
+ * @return PageData
+ * @author generator
+ * @date 2021-04-12
+ */
+ PageData page(Map params);
+
+ /**
+ * 默认查询
+ *
+ * @param params
+ * @return java.util.List
+ * @author generator
+ * @date 2021-04-12
+ */
+ List list(Map params);
+
+ /**
+ * 单条查询
+ *
+ * @param id
+ * @return CustomerOrgParameterDTO
+ * @author generator
+ * @date 2021-04-12
+ */
+ CustomerOrgParameterDTO get(String id);
+
+ /**
+ * 默认保存
+ *
+ * @param dto
+ * @return void
+ * @author generator
+ * @date 2021-04-12
+ */
+ void save(CustomerOrgParameterDTO dto);
+
+ /**
+ * 默认更新
+ *
+ * @param dto
+ * @return void
+ * @author generator
+ * @date 2021-04-12
+ */
+ void update(CustomerOrgParameterDTO dto);
+
+ /**
+ * 批量删除
+ *
+ * @param ids
+ * @return void
+ * @author generator
+ * @date 2021-04-12
+ */
+ void delete(String[] ids);
+
+ /**
+ * @return java.lang.String
+ * @param customerId
+ * @author yinzuomei
+ * @description 根据customerId查询参数(area_code_switch)值open: 选择地区编码必填;closed: 无需选择地区编码;;0409新增返参;没配置,返回closed
+ * @Date 2021/4/12 14:23
+ **/
+ String getAreaCodeSwitch(String customerId);
+}
\ No newline at end of file
diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java
index f507af7c29..69f88e0dd3 100644
--- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java
+++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java
@@ -37,6 +37,7 @@ import com.epmet.feign.EpmetUserOpenFeignClient;
import com.epmet.redis.CustomerAgencyRedis;
import com.epmet.service.AgencyService;
import com.epmet.service.CustomerAgencyService;
+import com.epmet.service.CustomerOrgParameterService;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -45,7 +46,10 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Date;
+import java.util.List;
/**
* 机关单位信息
@@ -70,6 +74,9 @@ public class AgencyServiceImpl implements AgencyService {
private CustomerGridDao customerGridDao;
@Autowired
private LoginUserUtil loginUserUtil;
+ @Autowired
+ private CustomerOrgParameterService customerOrgParameterService;
+
/**
* @param formDTO
* @return
@@ -235,6 +242,7 @@ public class AgencyServiceImpl implements AgencyService {
List listStr = Arrays.asList(entity.getPids().split(":"));
parentList = customerAgencyDao.selectPAgencyById(listStr);
agencysResultDTO.setParentList(parentList);
+ agencysResultDTO.setAreaCodeSwitch(customerOrgParameterService.getAreaCodeSwitch(entity.getCustomerId()));
return new Result().ok(agencysResultDTO);
}
diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridServiceImpl.java
index 8302b1252f..81ef5efbb6 100644
--- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridServiceImpl.java
+++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridServiceImpl.java
@@ -22,6 +22,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.constant.NumConstant;
+import com.epmet.commons.tools.constant.StrConstant;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.page.PageData;
@@ -244,6 +245,10 @@ public class CustomerGridServiceImpl extends BaseServiceImpl
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package com.epmet.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
+import com.epmet.commons.tools.constant.FieldConstant;
+import com.epmet.commons.tools.page.PageData;
+import com.epmet.commons.tools.utils.ConvertUtils;
+import com.epmet.constant.CustomerAgencyConstant;
+import com.epmet.dao.CustomerOrgParameterDao;
+import com.epmet.dto.CustomerOrgParameterDTO;
+import com.epmet.entity.CustomerOrgParameterEntity;
+import com.epmet.service.CustomerOrgParameterService;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 客户组织相关参数表
+ *
+ * @author generator generator@elink-cn.com
+ * @since v1.0.0 2021-04-12
+ */
+@Service
+public class CustomerOrgParameterServiceImpl extends BaseServiceImpl implements CustomerOrgParameterService {
+
+ @Override
+ public PageData page(Map params) {
+ IPage page = baseDao.selectPage(
+ getPage(params, FieldConstant.CREATED_TIME, false),
+ getWrapper(params)
+ );
+ return getPageData(page, CustomerOrgParameterDTO.class);
+ }
+
+ @Override
+ public List list(Map params) {
+ List entityList = baseDao.selectList(getWrapper(params));
+
+ return ConvertUtils.sourceToTarget(entityList, CustomerOrgParameterDTO.class);
+ }
+
+ private QueryWrapper getWrapper(Map params){
+ String id = (String)params.get(FieldConstant.ID_HUMP);
+
+ QueryWrapper wrapper = new QueryWrapper<>();
+ wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id);
+
+ return wrapper;
+ }
+
+ @Override
+ public CustomerOrgParameterDTO get(String id) {
+ CustomerOrgParameterEntity entity = baseDao.selectById(id);
+ return ConvertUtils.sourceToTarget(entity, CustomerOrgParameterDTO.class);
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public void save(CustomerOrgParameterDTO dto) {
+ CustomerOrgParameterEntity entity = ConvertUtils.sourceToTarget(dto, CustomerOrgParameterEntity.class);
+ insert(entity);
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public void update(CustomerOrgParameterDTO dto) {
+ CustomerOrgParameterEntity entity = ConvertUtils.sourceToTarget(dto, CustomerOrgParameterEntity.class);
+ updateById(entity);
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public void delete(String[] ids) {
+ // 逻辑删除(@TableLogic 注解)
+ baseDao.deleteBatchIds(Arrays.asList(ids));
+ }
+
+ /**
+ * @param customerId
+ * @return java.lang.String
+ * @author yinzuomei
+ * @description 根据customerId查询参数(area_code_switch)值open: 选择地区编码必填;closed: 无需选择地区编码;;0409新增返参;没配置,返回closed
+ * @Date 2021/4/12 14:23
+ **/
+ @Override
+ public String getAreaCodeSwitch(String customerId) {
+ CustomerOrgParameterEntity entity = baseDao.selectByCustomerId(customerId, CustomerAgencyConstant.AREA_CODE_SWITCH);
+ if (null == entity || StringUtils.isBlank(entity.getParameterValue())) {
+ return CustomerAgencyConstant.AREA_CODE_SWITCH_CLOSED;
+ }
+ return entity.getParameterValue();
+ }
+
+}
\ No newline at end of file
diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/DepartmentServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/DepartmentServiceImpl.java
index 5b53e49d0b..41d87332ed 100644
--- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/DepartmentServiceImpl.java
+++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/DepartmentServiceImpl.java
@@ -18,6 +18,7 @@
package com.epmet.service.impl;
import com.epmet.commons.tools.constant.NumConstant;
+import com.epmet.commons.tools.constant.StrConstant;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.security.dto.TokenDto;
@@ -90,6 +91,8 @@ public class DepartmentServiceImpl implements DepartmentService {
//1:查询当前组织机构信息,获取客户Id
CustomerAgencyEntity parentEntity = customerAgencyDao.selectById(formDTO.getAgencyId());
entity.setCustomerId(parentEntity.getCustomerId());
+ //新增area_code,部门的area_code=所属组织的area_code
+ entity.setAreaCode(null!=parentEntity&&StringUtils.isNotBlank(parentEntity.getAreaCode())?parentEntity.getAreaCode(): StrConstant.EPMETY_STR);
//2:保存部门信息
if (customerDepartmentDao.insert(entity) < NumConstant.ONE) {
log.error(CustomerDepartmentConstant.SAVE_EXCEPTION);
diff --git a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerOrgParameterDao.xml b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerOrgParameterDao.xml
new file mode 100644
index 0000000000..7e5cc8da13
--- /dev/null
+++ b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerOrgParameterDao.xml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+ select *
+ from customer_org_parameter p
+ where p.DEL_FLAG='0'
+ and p.CUSTOMER_ID=#{customerId}
+ and p.PARAMETER_KEY=#{parameterKey}
+
+
+
\ No newline at end of file
From b237654f1dba2ee89d016e3e481b9b2afca743cd Mon Sep 17 00:00:00 2001
From: yinzuomei <576302893@qq.com>
Date: Mon, 12 Apr 2021 15:42:19 +0800
Subject: [PATCH 02/21] =?UTF-8?q?agencydetail=20=E6=96=B0=E5=A2=9E?=
=?UTF-8?q?=E8=BF=94=E5=8F=82areaName?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../epmet/dto/result/AgencysResultDTO.java | 5 ++++
.../constant/CustomerAgencyConstant.java | 9 ++++++++
.../epmet/service/impl/AgencyServiceImpl.java | 23 +++++++++++++++++++
3 files changed, 37 insertions(+)
diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AgencysResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AgencysResultDTO.java
index 3dd448de95..a3c7bf0413 100644
--- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AgencysResultDTO.java
+++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AgencysResultDTO.java
@@ -91,4 +91,9 @@ public class AgencysResultDTO implements Serializable {
* open: 选择地区编码必填;closed: 无需选择地区编码;;0409新增返参
*/
private String areaCodeSwitch;
+
+ /**
+ * 组织区划的名称
+ */
+ private String areaName;
}
\ No newline at end of file
diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/constant/CustomerAgencyConstant.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/constant/CustomerAgencyConstant.java
index 3853a0272d..d738d662f8 100644
--- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/constant/CustomerAgencyConstant.java
+++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/constant/CustomerAgencyConstant.java
@@ -26,6 +26,15 @@ public interface CustomerAgencyConstant {
* 机关级别-市级
*/
String CITY_LEVEL = "city";
+
+ // 社区级:community,
+ String COMMUNITY_LEVEL="community";
+
+ // 乡(镇、街道)级:street,
+ String STREET_LEVEL="street";
+
+ // 区县级: district,
+ String DISTRICT="district";
/**
* 市级名称不能为空
*/
diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java
index 69f88e0dd3..7e5f4b2831 100644
--- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java
+++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java
@@ -19,6 +19,7 @@ package com.epmet.service.impl;
import com.alibaba.fastjson.JSON;
import com.epmet.commons.tools.constant.NumConstant;
+import com.epmet.commons.tools.constant.StrConstant;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.security.user.LoginUserUtil;
@@ -243,6 +244,28 @@ public class AgencyServiceImpl implements AgencyService {
parentList = customerAgencyDao.selectPAgencyById(listStr);
agencysResultDTO.setParentList(parentList);
agencysResultDTO.setAreaCodeSwitch(customerOrgParameterService.getAreaCodeSwitch(entity.getCustomerId()));
+ //查询组织区划的名称
+ if (null != entity && StringUtils.isNotBlank(entity.getAreaCode())) {
+ switch (entity.getLevel()) {
+ case CustomerAgencyConstant.PROVINCE_LEVEL:
+ agencysResultDTO.setAgencyName(entity.getProvince());
+ break;
+ case CustomerAgencyConstant.CITY_LEVEL:
+ agencysResultDTO.setAgencyName(entity.getCity());
+ break;
+ case CustomerAgencyConstant.DISTRICT:
+ agencysResultDTO.setAgencyName(entity.getDistrict());
+ break;
+ case CustomerAgencyConstant.STREET_LEVEL:
+ agencysResultDTO.setAgencyName(entity.getStreet());
+ break;
+ case CustomerAgencyConstant.COMMUNITY_LEVEL:
+ agencysResultDTO.setAgencyName(entity.getCommunity());
+ break;
+ default:
+ agencysResultDTO.setAgencyName(StrConstant.EPMETY_STR);
+ }
+ }
return new Result().ok(agencysResultDTO);
}
From 588add80cc528f7bf7c804eeca64647fa1e51503 Mon Sep 17 00:00:00 2001
From: yinzuomei <576302893@qq.com>
Date: Tue, 13 Apr 2021 10:29:53 +0800
Subject: [PATCH 03/21] =?UTF-8?q?=E7=BB=84=E7=BB=87=E5=8C=BA=E5=88=92?=
=?UTF-8?q?=E4=B8=8B=E6=8B=89=E6=A1=86=E6=8E=A5=E5=8F=A3V1?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../constant/DataSourceConstant.java | 2 +
.../dto/govorg/form/NextAreaCodeFormDTO.java | 31 ++++++++
.../govorg/result/NextAreaCodeResultDTO.java | 27 +++++++
.../data-aggregator-server/pom.xml | 28 +++++++
.../controller/GovOrgController.java | 17 +++++
.../dao/commonservice/AreaCodeDao.java | 39 ++++++++++
.../dao/govorg/CustomerAgencyDao.java | 2 +
.../commonservice/AreaCodeService.java | 23 ++++++
.../impl/AreaCodeServiceImpl.java | 75 +++++++++++++++++++
.../service/govorg/GovOrgService.java | 3 +
.../govorg/impl/GovOrgServiceImpl.java | 67 ++++++++++++++++-
.../src/main/resources/bootstrap.yml | 6 +-
.../mapper/commonservice/AreaCodeDao.xml | 57 ++++++++++++++
.../mapper/govorg/CustomerAgencyDao.xml | 9 +++
14 files changed, 384 insertions(+), 2 deletions(-)
create mode 100644 epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/form/NextAreaCodeFormDTO.java
create mode 100644 epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/result/NextAreaCodeResultDTO.java
create mode 100644 epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/commonservice/AreaCodeDao.java
create mode 100644 epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/commonservice/AreaCodeService.java
create mode 100644 epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/commonservice/impl/AreaCodeServiceImpl.java
create mode 100644 epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/commonservice/AreaCodeDao.xml
diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/constant/DataSourceConstant.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/constant/DataSourceConstant.java
index 70f42dc1e2..2dee5bb941 100644
--- a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/constant/DataSourceConstant.java
+++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/constant/DataSourceConstant.java
@@ -23,4 +23,6 @@ public interface DataSourceConstant {
*/
String EPMET_USER = "epmetuser";
+ String EPMET_COMMON_SERVICE="commonservice";
+
}
diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/form/NextAreaCodeFormDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/form/NextAreaCodeFormDTO.java
new file mode 100644
index 0000000000..ad3783df46
--- /dev/null
+++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/form/NextAreaCodeFormDTO.java
@@ -0,0 +1,31 @@
+package com.epmet.dataaggre.dto.govorg.form;
+
+import lombok.Data;
+
+import javax.validation.constraints.NotBlank;
+import java.io.Serializable;
+
+/**
+ * 描述一下
+ *
+ * @author yinzuomei@elink-cn.com
+ * @date 2021/4/12 15:55
+ */
+@Data
+public class NextAreaCodeFormDTO implements Serializable {
+ private static final long serialVersionUID = -1974456701949979946L;
+
+ @NotBlank(message = "areaCode不能为空")
+ private String areaCode;
+
+ /**
+ * 社区级:community,
+ * 乡(镇、街道)级:street,
+ * 区县级: district,
+ * 市级: city
+ * 省级:province
+ */
+ @NotBlank(message = "level不能为空")
+ private String level;
+
+}
diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/result/NextAreaCodeResultDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/result/NextAreaCodeResultDTO.java
new file mode 100644
index 0000000000..ef2db07581
--- /dev/null
+++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/result/NextAreaCodeResultDTO.java
@@ -0,0 +1,27 @@
+package com.epmet.dataaggre.dto.govorg.result;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * 描述一下
+ *
+ * @author yinzuomei@elink-cn.com
+ * @date 2021/4/12 15:56
+ */
+@Data
+public class NextAreaCodeResultDTO implements Serializable {
+ private static final long serialVersionUID = 9188265480821079966L;
+
+ private String areaCode;
+ private String areaName;
+ /**
+ * 社区级:community,
+ * 乡(镇、街道)级:street,
+ * 区县级: district,
+ * 市级: city
+ * 省级:province
+ */
+ private String level;
+}
diff --git a/epmet-module/data-aggregator/data-aggregator-server/pom.xml b/epmet-module/data-aggregator/data-aggregator-server/pom.xml
index c1e47d3b7e..a0fcbb3f6d 100644
--- a/epmet-module/data-aggregator/data-aggregator-server/pom.xml
+++ b/epmet-module/data-aggregator/data-aggregator-server/pom.xml
@@ -143,6 +143,13 @@
epmet_user_user
EpmEt-db-UsEr
+
+
+
+
+ epmet_common_service_user
+ EpmEt-db-UsEr
+
0
192.168.1.130
@@ -210,6 +217,13 @@
epmet_user_user
EpmEt-db-UsEr
+
+
+
+
+ epmet_common_service_user
+ EpmEt-db-UsEr
+
0
192.168.1.130
@@ -277,6 +291,13 @@
epmet
elink@833066
+
+
+
+
+ epmet
+ elink@833066
+
0
r-m5eoz5b6tkx09y6bpz.redis.rds.aliyuncs.com
@@ -344,6 +365,13 @@
epmet_user_user
EpmEt-db-UsEr
+
+
+
+
+ epmet_common_service_user
+ EpmEt-db-UsEr
+
0
r-m5ez3n1j0qc3ykq2ut.redis.rds.aliyuncs.com
diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/GovOrgController.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/GovOrgController.java
index aebb23a8b5..262aff38c3 100644
--- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/GovOrgController.java
+++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/GovOrgController.java
@@ -3,13 +3,19 @@ package com.epmet.dataaggre.controller;
import com.epmet.commons.tools.annotation.LoginUser;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.Result;
+import com.epmet.commons.tools.validator.ValidatorUtils;
+import com.epmet.dataaggre.dto.govorg.form.NextAreaCodeFormDTO;
import com.epmet.dataaggre.dto.govorg.result.AgencyGridListResultDTO;
+import com.epmet.dataaggre.dto.govorg.result.NextAreaCodeResultDTO;
import com.epmet.dataaggre.service.govorg.GovOrgService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
+import java.util.List;
+
/**
* @Author zxc
* @DateTime 2020/12/25 上午9:45
@@ -34,4 +40,15 @@ public class GovOrgController {
return new Result().ok(agencyGridList);
}
+ /**
+ * @param formDTO
+ * @author yinzuomei
+ * @description 新增组织-查询下一级可选的组织区划
+ * @Date 2021/4/12 16:01
+ **/
+ @PostMapping("nextlevelareacodelist")
+ public Result> queryNextLevelAreaCodeList(@RequestBody NextAreaCodeFormDTO formDTO) {
+ ValidatorUtils.validateEntity(formDTO);
+ return new Result>().ok(govOrgService.queryNextLevelAreaCodeList(formDTO));
+ }
}
diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/commonservice/AreaCodeDao.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/commonservice/AreaCodeDao.java
new file mode 100644
index 0000000000..0de5235518
--- /dev/null
+++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/commonservice/AreaCodeDao.java
@@ -0,0 +1,39 @@
+/**
+ * Copyright 2018 人人开源 https://www.renren.io
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package com.epmet.dataaggre.dao.commonservice;
+
+import com.epmet.dataaggre.dto.govorg.result.NextAreaCodeResultDTO;
+import org.apache.ibatis.annotations.Mapper;
+
+import java.util.List;
+
+/**
+ * @author generator generator@elink-cn.com
+ * @since v1.0.0 2021-01-07
+ */
+@Mapper
+public interface AreaCodeDao {
+
+ List selectCityList(String areaCode);
+
+ List selectDistrictList(String areaCode);
+
+ List selectStreetList(String areaCode);
+
+ List selectCommunityList(String areaCode);
+}
\ No newline at end of file
diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/govorg/CustomerAgencyDao.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/govorg/CustomerAgencyDao.java
index 445baf2477..fc33ce00bb 100644
--- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/govorg/CustomerAgencyDao.java
+++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/govorg/CustomerAgencyDao.java
@@ -47,4 +47,6 @@ public interface CustomerAgencyDao extends BaseDao {
* @date 2020/12/25 下午4:55
*/
String getAgencyIdByUserId(@Param("userId") String userId);
+
+ List selectUsedAreaCodeList(@Param("parentAreaCode") String parentAreaCode);
}
\ No newline at end of file
diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/commonservice/AreaCodeService.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/commonservice/AreaCodeService.java
new file mode 100644
index 0000000000..c9ebb57d5e
--- /dev/null
+++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/commonservice/AreaCodeService.java
@@ -0,0 +1,23 @@
+package com.epmet.dataaggre.service.commonservice;
+
+import com.epmet.dataaggre.dto.govorg.form.NextAreaCodeFormDTO;
+import com.epmet.dataaggre.dto.govorg.result.NextAreaCodeResultDTO;
+
+import java.util.List;
+
+/**
+ * 描述一下
+ *
+ * @author yinzuomei@elink-cn.com
+ * @date 2021/4/12 15:45
+ */
+public interface AreaCodeService {
+ /**
+ * @return java.util.List
+ * @param formDTO
+ * @author yinzuomei
+ * @description 新增组织-查询下一级可选的组织区划
+ * @Date 2021/4/12 16:02
+ **/
+ List queryNextLevelAreaCodeList(NextAreaCodeFormDTO formDTO);
+}
diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/commonservice/impl/AreaCodeServiceImpl.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/commonservice/impl/AreaCodeServiceImpl.java
new file mode 100644
index 0000000000..ed6ce54264
--- /dev/null
+++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/commonservice/impl/AreaCodeServiceImpl.java
@@ -0,0 +1,75 @@
+package com.epmet.dataaggre.service.commonservice.impl;
+
+import com.epmet.commons.dynamic.datasource.annotation.DataSource;
+import com.epmet.dataaggre.constant.DataSourceConstant;
+import com.epmet.dataaggre.dao.commonservice.AreaCodeDao;
+import com.epmet.dataaggre.dto.govorg.form.NextAreaCodeFormDTO;
+import com.epmet.dataaggre.dto.govorg.result.NextAreaCodeResultDTO;
+import com.epmet.dataaggre.service.commonservice.AreaCodeService;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.collections4.CollectionUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * 描述一下
+ *
+ * @author yinzuomei@elink-cn.com
+ * @date 2021/4/12 15:46
+ */
+@DataSource(DataSourceConstant.EPMET_COMMON_SERVICE)
+@Slf4j
+@Service
+public class AreaCodeServiceImpl implements AreaCodeService {
+
+ @Autowired
+ private AreaCodeDao areaCodeDao;
+
+ /**
+ * @param formDTO
+ * @return java.util.List
+ * @author yinzuomei
+ * @description 新增组织-查询下一级可选的组织区划
+ * @Date 2021/4/12 16:02
+ **/
+ @Override
+ public List queryNextLevelAreaCodeList(NextAreaCodeFormDTO formDTO) {
+ List list = new ArrayList<>();
+ NextAreaCodeResultDTO other = new NextAreaCodeResultDTO();
+ other.setAreaCode("other");
+ other.setAreaName("其它");
+ switch (formDTO.getLevel()) {
+ /**
+ * 社区级:community,
+ * 乡(镇、街道)级:street,
+ * 区县级: district,
+ * 市级: city
+ * 省级:province
+ */
+ case "province":
+ list = areaCodeDao.selectCityList(formDTO.getAreaCode());
+ other.setLevel("city");
+ break;
+ case "city":
+ list = areaCodeDao.selectDistrictList(formDTO.getAreaCode());
+ other.setLevel("district");
+ break;
+ case "district":
+ list = areaCodeDao.selectStreetList(formDTO.getAreaCode());
+ other.setLevel("street");
+ break;
+ case "street":
+ list = areaCodeDao.selectCommunityList(formDTO.getAreaCode());
+ other.setLevel("community");
+ break;
+ default:
+ }
+ if (CollectionUtils.isNotEmpty(list)) {
+ list.add(other);
+ }
+ return list;
+ }
+}
diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/GovOrgService.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/GovOrgService.java
index c0b7fff4bd..7d9fc8f339 100644
--- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/GovOrgService.java
+++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/GovOrgService.java
@@ -1,8 +1,10 @@
package com.epmet.dataaggre.service.govorg;
+import com.epmet.dataaggre.dto.govorg.form.NextAreaCodeFormDTO;
import com.epmet.dataaggre.dto.govorg.result.AgencyGridResultDTO;
import com.epmet.dataaggre.dto.govorg.result.GridInfoResultDTO;
import com.epmet.dataaggre.dto.govorg.result.GridsInfoListResultDTO;
+import com.epmet.dataaggre.dto.govorg.result.NextAreaCodeResultDTO;
import java.util.List;
@@ -42,4 +44,5 @@ public interface GovOrgService {
*/
String getAgencyIdByUserId(String userId);
+ List queryNextLevelAreaCodeList(NextAreaCodeFormDTO formDTO);
}
diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/impl/GovOrgServiceImpl.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/impl/GovOrgServiceImpl.java
index 7b3314f5dc..a076f1b73d 100644
--- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/impl/GovOrgServiceImpl.java
+++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/impl/GovOrgServiceImpl.java
@@ -1,5 +1,6 @@
package com.epmet.dataaggre.service.govorg.impl;
+import com.alibaba.fastjson.JSON;
import com.epmet.commons.dynamic.datasource.annotation.DataSource;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.exception.RenException;
@@ -8,17 +9,23 @@ import com.epmet.dataaggre.dao.govorg.CustomerAgencyDao;
import com.epmet.dataaggre.dao.govorg.CustomerGridDao;
import com.epmet.dataaggre.dao.govorg.CustomerStaffAgencyDao;
import com.epmet.dataaggre.dto.govorg.CustomerStaffAgencyDTO;
+import com.epmet.dataaggre.dto.govorg.form.NextAreaCodeFormDTO;
import com.epmet.dataaggre.dto.govorg.result.AgencyGridResultDTO;
import com.epmet.dataaggre.dto.govorg.result.GridInfoResultDTO;
import com.epmet.dataaggre.dto.govorg.result.GridsInfoListResultDTO;
+import com.epmet.dataaggre.dto.govorg.result.NextAreaCodeResultDTO;
import com.epmet.dataaggre.entity.govorg.CustomerAgencyEntity;
+import com.epmet.dataaggre.service.commonservice.AreaCodeService;
import com.epmet.dataaggre.service.govorg.GovOrgService;
import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.collections4.CollectionUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
+import java.util.ArrayList;
+import java.util.Iterator;
import java.util.List;
/**
@@ -37,7 +44,8 @@ public class GovOrgServiceImpl implements GovOrgService {
private CustomerStaffAgencyDao customerStaffAgencyDao;
@Autowired
private CustomerGridDao customerGridDao;
-
+ @Autowired
+ private AreaCodeService areaCodeService;
/**
* @param staffId
@@ -120,5 +128,62 @@ public class GovOrgServiceImpl implements GovOrgService {
return customerAgencyDao.getAgencyIdByUserId(userId);
}
+ @Override
+ public List queryNextLevelAreaCodeList(NextAreaCodeFormDTO formDTO) {
+ //全部下级
+ List allList = areaCodeService.queryNextLevelAreaCodeList(formDTO);
+ if (CollectionUtils.isNotEmpty(allList)) {
+ //已经被使用过的areaCode
+ List usedAreaCodeList = customerAgencyDao.selectUsedAreaCodeList(formDTO.getAreaCode());
+ //已经被使用的移除不显示
+ Iterator iterator = allList.iterator();
+ while (iterator.hasNext()) {
+ NextAreaCodeResultDTO next = iterator.next();
+ for (String usedAreaCode : usedAreaCodeList) {
+ if (next.getAreaCode().equals(usedAreaCode)) {
+ iterator.remove();
+ }
+ }
+ //todo 移除掉 子客户下使用的
+ }
+ }
+ return allList;
+ }
+
+ public static void main(String[] args) {
+ List allList = new ArrayList<>();
+ NextAreaCodeResultDTO m1 = new NextAreaCodeResultDTO();
+ m1.setAreaCode("1");
+ m1.setAreaName("a");
+ allList.add(m1);
+
+ NextAreaCodeResultDTO m2 = new NextAreaCodeResultDTO();
+ m2.setAreaCode("2");
+ m2.setAreaName("b");
+ allList.add(m2);
+
+
+ NextAreaCodeResultDTO m3 = new NextAreaCodeResultDTO();
+ m3.setAreaCode("3");
+ m3.setAreaName("c");
+ allList.add(m3);
+
+ List stringList = new ArrayList<>();
+ stringList.add("1");
+ stringList.add("2");
+
+ Iterator iterator = allList.iterator();
+ while (iterator.hasNext()) {
+ NextAreaCodeResultDTO next = iterator.next();
+ for (String usedAreaCode : stringList) {
+ if (next.getAreaCode().equals(usedAreaCode)) {
+ iterator.remove();
+ }
+ }
+
+ }
+ System.out.println(JSON.toJSONString(allList, true));
+ }
+
}
diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/bootstrap.yml b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/bootstrap.yml
index 50e01db7ee..86be3fc91c 100644
--- a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/bootstrap.yml
+++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/bootstrap.yml
@@ -119,7 +119,11 @@ dynamic:
url: @datasource.druid.epmetuser.url@
username: @datasource.druid.epmetuser.username@
password: @datasource.druid.epmetuser.password@
-
+ commonservice:
+ driver-class-name: com.mysql.cj.jdbc.Driver
+ url: @datasource.druid.commonservice.url@
+ username: @datasource.druid.commonservice.username@
+ password: @datasource.druid.commonservice.password@
feign:
hystrix:
enabled: true
diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/commonservice/AreaCodeDao.xml b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/commonservice/AreaCodeDao.xml
new file mode 100644
index 0000000000..ae56a91b6a
--- /dev/null
+++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/commonservice/AreaCodeDao.xml
@@ -0,0 +1,57 @@
+
+
+
+
+
+
+ SELECT DISTINCT
+ ac.CITY_CODE AS areaCode,
+ ac.CITY_NAME AS areaName,
+ 'city' LEVEL
+ FROM
+ area_code ac
+ WHERE
+ ac.DEL_FLAG='0'
+ and ac.PROVINCE_CODE = #{areaCode}
+ ORDER BY
+ ac.CITY_CODE ASC
+
+
+
+ SELECT DISTINCT
+ ac.COUNTY_CODE AS areaCode,
+ ac.COUNTY_NAME AS areaName,
+ 'district' LEVEL
+ FROM
+ area_code ac
+ WHERE ac.DEL_FLAG='0'
+ and ac.CITY_CODE = #{areaCode}
+ ORDER BY
+ ac.COUNTY_CODE ASC
+
+
+
+ SELECT DISTINCT CODE AS areaCode,
+ NAME AS areaName,
+ 'street' AS LEVEL
+ FROM
+ area_code_child acc
+ WHERE
+ acc.DEL_FLAG = '0'
+ AND acc.P_CODE = #{areaCode}
+ order by acc.CODE ASC
+
+
+
+
\ No newline at end of file
diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govorg/CustomerAgencyDao.xml b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govorg/CustomerAgencyDao.xml
index aece51edb3..f27f969e31 100644
--- a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govorg/CustomerAgencyDao.xml
+++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govorg/CustomerAgencyDao.xml
@@ -22,4 +22,13 @@
SELECT AGENCY_ID FROM customer_staff_agency WHERE DEL_FLAG = 0 AND USER_ID = #{userId}
+
+ SELECT
+ ca.AREA_CODE
+ FROM
+ customer_agency ca
+ WHERE
+ ca.DEL_FLAG = '0'
+ AND ca.PARENT_AREA_CODE = #{parentAreaCode}
+
\ No newline at end of file
From f77163b57dc5b4285478dedf22dc66d685f4d593 Mon Sep 17 00:00:00 2001
From: yinzuomei <576302893@qq.com>
Date: Tue, 13 Apr 2021 10:58:10 +0800
Subject: [PATCH 04/21] =?UTF-8?q?=E7=BB=84=E7=BB=87=E5=8C=BA=E5=88=92?=
=?UTF-8?q?=E4=B8=8B=E6=8B=89=E6=A1=86=E6=8E=A5=E5=8F=A3V2?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../constant/DataSourceConstant.java | 1 +
.../data-aggregator-server/pom.xml | 28 +++++++++++++++++
.../dao/opercrm/CustomerRelationDao.java | 16 ++++++++++
.../govorg/impl/GovOrgServiceImpl.java | 19 ++++++++----
.../service/opercrm/CustomerRelation.java | 13 ++++++++
.../opercrm/impl/CustomerRelationImpl.java | 30 +++++++++++++++++++
.../src/main/resources/bootstrap.yml | 5 ++++
.../mapper/opercrm/CustomerRelationDao.xml | 16 ++++++++++
8 files changed, 123 insertions(+), 5 deletions(-)
create mode 100644 epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/opercrm/CustomerRelationDao.java
create mode 100644 epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/opercrm/CustomerRelation.java
create mode 100644 epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/opercrm/impl/CustomerRelationImpl.java
create mode 100644 epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/opercrm/CustomerRelationDao.xml
diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/constant/DataSourceConstant.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/constant/DataSourceConstant.java
index 2dee5bb941..07604c401d 100644
--- a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/constant/DataSourceConstant.java
+++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/constant/DataSourceConstant.java
@@ -25,4 +25,5 @@ public interface DataSourceConstant {
String EPMET_COMMON_SERVICE="commonservice";
+ String OPER_CRM="opercrm";
}
diff --git a/epmet-module/data-aggregator/data-aggregator-server/pom.xml b/epmet-module/data-aggregator/data-aggregator-server/pom.xml
index a0fcbb3f6d..7b74f08a23 100644
--- a/epmet-module/data-aggregator/data-aggregator-server/pom.xml
+++ b/epmet-module/data-aggregator/data-aggregator-server/pom.xml
@@ -150,6 +150,13 @@
epmet_common_service_user
EpmEt-db-UsEr
+
+
+
+
+ epmet_oper_crm_user
+ EpmEt-db-UsEr
+
0
192.168.1.130
@@ -224,6 +231,13 @@
epmet_common_service_user
EpmEt-db-UsEr
+
+
+
+
+ epmet_oper_crm_user
+ EpmEt-db-UsEr
+
0
192.168.1.130
@@ -298,6 +312,13 @@
epmet
elink@833066
+
+
+
+
+ epmet
+ elink@833066
+
0
r-m5eoz5b6tkx09y6bpz.redis.rds.aliyuncs.com
@@ -372,6 +393,13 @@
epmet_common_service_user
EpmEt-db-UsEr
+
+
+
+
+ epmet_oper_crm_user
+ EpmEt-db-UsEr
+
0
r-m5ez3n1j0qc3ykq2ut.redis.rds.aliyuncs.com
diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/opercrm/CustomerRelationDao.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/opercrm/CustomerRelationDao.java
new file mode 100644
index 0000000000..ed7aef852a
--- /dev/null
+++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/opercrm/CustomerRelationDao.java
@@ -0,0 +1,16 @@
+package com.epmet.dataaggre.dao.opercrm;
+
+import org.apache.ibatis.annotations.Mapper;
+
+import java.util.List;
+
+/**
+ * 描述一下
+ *
+ * @author yinzuomei@elink-cn.com
+ * @date 2021/4/13 10:43
+ */
+@Mapper
+public interface CustomerRelationDao {
+ List selectUsedAreaCodeList(String areaCode);
+}
diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/impl/GovOrgServiceImpl.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/impl/GovOrgServiceImpl.java
index a076f1b73d..5006efd5f7 100644
--- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/impl/GovOrgServiceImpl.java
+++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/impl/GovOrgServiceImpl.java
@@ -17,6 +17,7 @@ import com.epmet.dataaggre.dto.govorg.result.NextAreaCodeResultDTO;
import com.epmet.dataaggre.entity.govorg.CustomerAgencyEntity;
import com.epmet.dataaggre.service.commonservice.AreaCodeService;
import com.epmet.dataaggre.service.govorg.GovOrgService;
+import com.epmet.dataaggre.service.opercrm.CustomerRelation;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.slf4j.Logger;
@@ -46,6 +47,8 @@ public class GovOrgServiceImpl implements GovOrgService {
private CustomerGridDao customerGridDao;
@Autowired
private AreaCodeService areaCodeService;
+ @Autowired
+ private CustomerRelation customerRelation;
/**
* @param staffId
@@ -133,18 +136,24 @@ public class GovOrgServiceImpl implements GovOrgService {
//全部下级
List allList = areaCodeService.queryNextLevelAreaCodeList(formDTO);
if (CollectionUtils.isNotEmpty(allList)) {
- //已经被使用过的areaCode
- List usedAreaCodeList = customerAgencyDao.selectUsedAreaCodeList(formDTO.getAreaCode());
+ //内部客户: 已经被使用过的areaCode
+ List usedAreaCodeList1 = customerAgencyDao.selectUsedAreaCodeList(formDTO.getAreaCode());
+ //外部子客户:
+ List usedAreaCodeList2= customerRelation.selectUsedAreaCodeList(formDTO.getAreaCode());
//已经被使用的移除不显示
Iterator iterator = allList.iterator();
while (iterator.hasNext()) {
NextAreaCodeResultDTO next = iterator.next();
- for (String usedAreaCode : usedAreaCodeList) {
- if (next.getAreaCode().equals(usedAreaCode)) {
+ for (String usedAreaCode1 : usedAreaCodeList1) {
+ if (next.getAreaCode().equals(usedAreaCode1)) {
+ iterator.remove();
+ }
+ }
+ for (String usedAreaCode2 : usedAreaCodeList2) {
+ if (next.getAreaCode().contains(usedAreaCode2)) {
iterator.remove();
}
}
- //todo 移除掉 子客户下使用的
}
}
return allList;
diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/opercrm/CustomerRelation.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/opercrm/CustomerRelation.java
new file mode 100644
index 0000000000..af0dc94e88
--- /dev/null
+++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/opercrm/CustomerRelation.java
@@ -0,0 +1,13 @@
+package com.epmet.dataaggre.service.opercrm;
+
+import java.util.List;
+
+/**
+ * 描述一下
+ *
+ * @author yinzuomei@elink-cn.com
+ * @date 2021/4/13 10:38
+ */
+public interface CustomerRelation {
+ List selectUsedAreaCodeList(String areaCode);
+}
diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/opercrm/impl/CustomerRelationImpl.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/opercrm/impl/CustomerRelationImpl.java
new file mode 100644
index 0000000000..045232e1a7
--- /dev/null
+++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/opercrm/impl/CustomerRelationImpl.java
@@ -0,0 +1,30 @@
+package com.epmet.dataaggre.service.opercrm.impl;
+
+import com.epmet.commons.dynamic.datasource.annotation.DataSource;
+import com.epmet.dataaggre.constant.DataSourceConstant;
+import com.epmet.dataaggre.dao.opercrm.CustomerRelationDao;
+import com.epmet.dataaggre.service.opercrm.CustomerRelation;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * 描述一下
+ *
+ * @author yinzuomei@elink-cn.com
+ * @date 2021/4/13 10:38
+ */
+@DataSource(DataSourceConstant.OPER_CRM)
+@Slf4j
+@Service
+public class CustomerRelationImpl implements CustomerRelation {
+ @Autowired
+ private CustomerRelationDao customerRelationDao;
+
+ @Override
+ public List selectUsedAreaCodeList(String areaCode) {
+ return customerRelationDao.selectUsedAreaCodeList(areaCode);
+ }
+}
diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/bootstrap.yml b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/bootstrap.yml
index 86be3fc91c..6e27140e97 100644
--- a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/bootstrap.yml
+++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/bootstrap.yml
@@ -124,6 +124,11 @@ dynamic:
url: @datasource.druid.commonservice.url@
username: @datasource.druid.commonservice.username@
password: @datasource.druid.commonservice.password@
+ opercrm:
+ driver-class-name: com.mysql.cj.jdbc.Driver
+ url: @datasource.druid.opercrm.url@
+ username: @datasource.druid.opercrm.username@
+ password: @datasource.druid.opercrm.password@
feign:
hystrix:
enabled: true
diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/opercrm/CustomerRelationDao.xml b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/opercrm/CustomerRelationDao.xml
new file mode 100644
index 0000000000..5c0ec4f533
--- /dev/null
+++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/opercrm/CustomerRelationDao.xml
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+ SELECT
+ cr.AREA_CODE
+ FROM
+ customer_relation cr
+ WHERE
+ cr.DEL_FLAG = '0'
+ AND cr.AREA_CODE LIKE concat(#{areaCode}, '%')
+ AND cr.AREA_CODE != #{areaCode}
+
+
\ No newline at end of file
From 9df85e7e4a381dcae631bc6a14550845871ac09e Mon Sep 17 00:00:00 2001
From: yinzuomei <576302893@qq.com>
Date: Tue, 13 Apr 2021 16:40:55 +0800
Subject: [PATCH 05/21] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E7=BB=84=E7=BB=87V2?=
=?UTF-8?q?=E6=8E=A5=E5=8F=A3=E6=8F=90=E4=BA=A4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../tools/exception/EpmetErrorCode.java | 2 +
.../epmet/dto/form/AddAreaCodeFormDTO.java | 27 ++++++
.../EpmetCommonServiceOpenFeignClient.java | 10 +++
...tCommonServiceOpenFeignClientFallback.java | 12 +++
.../com/epmet/constant/AreaCodeConstant.java | 4 +
.../epmet/controller/AreaCodeController.java | 14 +++
.../main/java/com/epmet/dao/AreaCodeDao.java | 4 +
.../com/epmet/service/AreaCodeService.java | 10 +++
.../service/impl/AreaCodeServiceImpl.java | 70 +++++++++++++--
.../src/main/resources/mapper/AreaCodeDao.xml | 16 ++++
.../epmet/dto/form/AddAgencyV2FormDTO.java | 86 +++++++++++++++++++
.../epmet/dto/result/AddAgencyResultDTO.java | 14 ++-
epmet-module/gov-org/gov-org-server/pom.xml | 6 ++
.../epmet/controller/AgencyController.java | 22 +++++
.../java/com/epmet/dao/CustomerAgencyDao.java | 2 +
.../java/com/epmet/service/AgencyService.java | 9 ++
.../epmet/service/CustomerAgencyService.java | 2 +
.../epmet/service/impl/AgencyServiceImpl.java | 63 ++++++++++++++
.../impl/CustomerAgencyServiceImpl.java | 12 +++
.../src/main/resources/logback-spring.xml | 4 +-
.../resources/mapper/CustomerAgencyDao.xml | 10 +++
21 files changed, 388 insertions(+), 11 deletions(-)
create mode 100644 epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/dto/form/AddAreaCodeFormDTO.java
create mode 100644 epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AddAgencyV2FormDTO.java
diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java
index 210f2d3443..79f5421789 100644
--- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java
+++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java
@@ -70,6 +70,8 @@ public enum EpmetErrorCode {
NOT_DEL_AGENCY_PER(8205, "该机关存在工作人员,不允许删除"),
NOT_DEL_DEPARTMENT(8206, "该部门存在工作人员,不允许删除"),
NOT_DEL_AGENCY_GRID(8207, "该机关存在网格,不允许删除"),
+ AREA_CODE_ALREADY_EXISTS(8208,"组织区划已被占用,请重新选择"),
+ AGENCY_NAME_ALREADY_EXISTS(8209,"您当前的组织名称已存在,请重新修改"),
REQUIRE_PERMISSION(8301, "您没有足够的操作权限"),
THIRD_PLAT_REQUEST_ERROR(8302, "请求第三方平台错误"),
diff --git a/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/dto/form/AddAreaCodeFormDTO.java b/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/dto/form/AddAreaCodeFormDTO.java
new file mode 100644
index 0000000000..349e6f89e3
--- /dev/null
+++ b/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/dto/form/AddAreaCodeFormDTO.java
@@ -0,0 +1,27 @@
+package com.epmet.dto.form;
+
+import lombok.Data;
+
+import javax.validation.constraints.NotBlank;
+import java.io.Serializable;
+
+/**
+ * 描述一下
+ *
+ * @author yinzuomei@elink-cn.com
+ * @date 2021/4/13 14:36
+ */
+@Data
+public class AddAreaCodeFormDTO implements Serializable {
+
+ @NotBlank(message = "currentAreaLevel不能为空")
+ private String currentAreaLevel;
+ @NotBlank(message = "parentAreaCode不能为空")
+ private String parentAreaCode;
+
+ /**
+ * 新增的街道或者社区名称
+ */
+ @NotBlank(message = "name不能为空")
+ private String name;
+}
diff --git a/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/feign/EpmetCommonServiceOpenFeignClient.java b/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/feign/EpmetCommonServiceOpenFeignClient.java
index 66a1f46ee7..62989575c3 100644
--- a/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/feign/EpmetCommonServiceOpenFeignClient.java
+++ b/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/feign/EpmetCommonServiceOpenFeignClient.java
@@ -113,4 +113,14 @@ public interface EpmetCommonServiceOpenFeignClient {
**/
@PostMapping(value = "commonservice/areacode/addstreetcommareacode", consumes = MediaType.APPLICATION_JSON_VALUE)
Result addStreetCommAreaCode(@RequestBody AddAreaCodeDictFormDTO formDTO);
+
+ /**
+ * @param formDTO
+ * @return com.epmet.commons.tools.utils.Result
+ * @author yinzuomei
+ * @description 自定义行政地区编码
+ * @Date 2021/4/13 14:31
+ **/
+ @PostMapping(value = "commonservice/areacode/addareacode", consumes = MediaType.APPLICATION_JSON_VALUE)
+ Result addAreaCode(AddAreaCodeFormDTO formDTO);
}
diff --git a/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/feign/fallback/EpmetCommonServiceOpenFeignClientFallback.java b/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/feign/fallback/EpmetCommonServiceOpenFeignClientFallback.java
index d9731558cd..4abd2dce39 100644
--- a/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/feign/fallback/EpmetCommonServiceOpenFeignClientFallback.java
+++ b/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/feign/fallback/EpmetCommonServiceOpenFeignClientFallback.java
@@ -89,4 +89,16 @@ public class EpmetCommonServiceOpenFeignClientFallback implements EpmetCommonSer
public Result addStreetCommAreaCode(AddAreaCodeDictFormDTO formDTO) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_COMMON_SERVICE, "addStreetCommAreaCode", formDTO);
}
+
+ /**
+ * @param formDTO
+ * @return com.epmet.commons.tools.utils.Result
+ * @author yinzuomei
+ * @description 自定义行政地区编码
+ * @Date 2021/4/13 14:31
+ **/
+ @Override
+ public Result addAreaCode(AddAreaCodeFormDTO formDTO) {
+ return ModuleUtils.feignConError(ServiceConstant.EPMET_COMMON_SERVICE, "addAreaCode", formDTO);
+ }
}
diff --git a/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/constant/AreaCodeConstant.java b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/constant/AreaCodeConstant.java
index 3ee44fec5f..1768f08c37 100644
--- a/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/constant/AreaCodeConstant.java
+++ b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/constant/AreaCodeConstant.java
@@ -26,4 +26,8 @@ public interface AreaCodeConstant {
String LEVEL_ERROR = "RootAreaLevel填写错误【%s】";
+ String FIRST_THREE_UD="001_UD";
+
+ String FIRST_TOW_UD="01_UD";
+ String UD="_UD";
}
diff --git a/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/controller/AreaCodeController.java b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/controller/AreaCodeController.java
index af8ecf093f..df821f7410 100644
--- a/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/controller/AreaCodeController.java
+++ b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/controller/AreaCodeController.java
@@ -26,6 +26,7 @@ import com.epmet.commons.tools.validator.group.DefaultGroup;
import com.epmet.commons.tools.validator.group.UpdateGroup;
import com.epmet.dto.AreaCodeDTO;
import com.epmet.dto.form.AddAreaCodeDictFormDTO;
+import com.epmet.dto.form.AddAreaCodeFormDTO;
import com.epmet.dto.form.AreaCodeDictFormDTO;
import com.epmet.dto.result.AreaCodeDictResultDTO;
import com.epmet.service.AreaCodeService;
@@ -107,4 +108,17 @@ public class AreaCodeController {
ValidatorUtils.validateEntity(formDTO);
return new Result().ok(areaCodeService.addStreetCommAreaCode(formDTO));
}
+
+ /**
+ * @param formDTO
+ * @return com.epmet.commons.tools.utils.Result
+ * @author yinzuomei
+ * @description 自定义行政地区编码-产品自身使用
+ * @Date 2021/4/13 14:40
+ **/
+ @PostMapping(value = "addareacode")
+ Result addAreaCode(@RequestBody AddAreaCodeFormDTO formDTO) {
+ ValidatorUtils.validateEntity(formDTO);
+ return new Result().ok(areaCodeService.addAreaCode(formDTO));
+ }
}
\ No newline at end of file
diff --git a/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/dao/AreaCodeDao.java b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/dao/AreaCodeDao.java
index a5496cecc4..54b89ee82f 100644
--- a/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/dao/AreaCodeDao.java
+++ b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/dao/AreaCodeDao.java
@@ -36,4 +36,8 @@ public interface AreaCodeDao extends BaseDao {
List selectAllArea();
AreaCodeDTO selectByCountyCode(String countyCode);
+
+ AreaCodeDTO selectByCityCode(String cityCode);
+
+ AreaCodeDTO selectMaxCounty(String cityCode);
}
\ No newline at end of file
diff --git a/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/AreaCodeService.java b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/AreaCodeService.java
index 415712de43..99c25ab2f2 100644
--- a/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/AreaCodeService.java
+++ b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/AreaCodeService.java
@@ -21,6 +21,7 @@ import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData;
import com.epmet.dto.AreaCodeDTO;
import com.epmet.dto.form.AddAreaCodeDictFormDTO;
+import com.epmet.dto.form.AddAreaCodeFormDTO;
import com.epmet.dto.form.AreaCodeDictFormDTO;
import com.epmet.dto.result.AreaCodeDictResultDTO;
import com.epmet.entity.AreaCodeEntity;
@@ -113,4 +114,13 @@ public interface AreaCodeService extends BaseService {
* @Date 2021/2/5 17:39
**/
String addStreetCommAreaCode(AddAreaCodeDictFormDTO formDTO);
+
+ /**
+ * @return java.lang.String
+ * @param formDTO
+ * @author yinzuomei
+ * @description 自定义行政地区编码
+ * @Date 2021/4/13 14:40
+ **/
+ String addAreaCode(AddAreaCodeFormDTO formDTO);
}
\ No newline at end of file
diff --git a/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/impl/AreaCodeServiceImpl.java b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/impl/AreaCodeServiceImpl.java
index f34ff30605..29cfc457aa 100644
--- a/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/impl/AreaCodeServiceImpl.java
+++ b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/impl/AreaCodeServiceImpl.java
@@ -34,6 +34,7 @@ import com.epmet.dao.AreaCodeDao;
import com.epmet.dto.AreaCodeChildDTO;
import com.epmet.dto.AreaCodeDTO;
import com.epmet.dto.form.AddAreaCodeDictFormDTO;
+import com.epmet.dto.form.AddAreaCodeFormDTO;
import com.epmet.dto.form.AreaCodeDictFormDTO;
import com.epmet.dto.result.AreaCodeDictResultDTO;
import com.epmet.entity.AreaCodeEntity;
@@ -588,7 +589,7 @@ public class AreaCodeServiceImpl extends BaseServiceImpl
select * from area_code m where m.COUNTY_CODE=#{countyCode}
+
+
+ select distinct ac.PROVINCE_CODE,ac.PROVINCE_NAME,ac.CITY_CODE,ac.CITY_NAME
+ from area_code ac
+ where ac.DEL_FLAG='0'
+ and ac.CITY_CODE=#{cityCode}
+
+
+
+ select *
+ from area_code ac
+ where ac.DEL_FLAG='0'
+ and ac.CITY_CODE=#{cityCode}
+ order by ac.COUNTY_CODE desc
+ limit 1
+
\ No newline at end of file
diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AddAgencyV2FormDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AddAgencyV2FormDTO.java
new file mode 100644
index 0000000000..bf29a4aede
--- /dev/null
+++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AddAgencyV2FormDTO.java
@@ -0,0 +1,86 @@
+package com.epmet.dto.form;
+
+import com.epmet.commons.tools.validator.group.CustomerClientShowGroup;
+import lombok.Data;
+import org.hibernate.validator.constraints.Length;
+
+import javax.validation.constraints.NotBlank;
+import java.io.Serializable;
+
+/**
+ * 添加组织V2
+ *
+ * @author yinzuomei@elink-cn.com
+ * @date 2021/4/13 11:08
+ */
+@Data
+public class AddAgencyV2FormDTO implements Serializable {
+ private static final long serialVersionUID = -8951334902226679043L;
+
+ public interface AddUserInternalGroup {
+ }
+
+ public interface DefaultUserShowGroup extends CustomerClientShowGroup {
+ }
+
+ public interface AreaCodeGroup extends CustomerClientShowGroup {
+ }
+
+
+ @NotBlank(message = "上级组织ID不能为空", groups = AddUserInternalGroup.class)
+ private String parentAgencyId;
+
+ /**
+ * 机构组织名称
+ */
+ @NotBlank(message = "组织名称不能为空", groups = DefaultUserShowGroup.class)
+ @Length(max = 50, message = "组织名称不能超过50个字", groups = DefaultUserShowGroup.class)
+ private String agencyName;
+
+ /**
+ * 机关级别(社区级:community,
+ * 乡(镇、街道)级:street,
+ * 区县级: district,
+ * 市级: city
+ * 省级:province)
+ */
+ @NotBlank(message = "组织级别不能为空;社区级:community,乡(镇、街道)级:street,区县级: district,市级: city省级:province", groups = AddUserInternalGroup.class)
+ private String level;
+
+ /**
+ * open: 选择地区编码必填;closed: 无需选择地区编码;0409新增返参
+ */
+ @NotBlank(message = "areaCodeSwitch不能为空", groups = AddUserInternalGroup.class)
+ private String areaCodeSwitch;
+
+ /**
+ * 地区编码
+ */
+ @NotBlank(message = "请选择组织区划", groups = AreaCodeGroup.class)
+ private String areaCode;
+
+ /**
+ * 省份
+ */
+ private String province;
+
+ /**
+ * 城市
+ */
+ private String city;
+
+ /**
+ * 区县
+ */
+ private String district;
+
+ /**
+ * 区域编码字典中的【街道】名称;来源于【/data/aggregator/org/nextlevelareacodelist】接口里的areaName
+ */
+ private String street;
+
+ /**
+ * 区域编码字典中的【社区】名称;来源于【/data/aggregator/org/nextlevelareacodelist】接口里的areaName
+ */
+ private String community;
+}
diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AddAgencyResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AddAgencyResultDTO.java
index bd8d994b8a..c77356968d 100644
--- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AddAgencyResultDTO.java
+++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AddAgencyResultDTO.java
@@ -33,8 +33,18 @@ public class AddAgencyResultDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
- * 机关组织Id
+ * 新添加的组织Id
*/
- private String agencyId = "";
+ private String agencyId;
+
+ /**
+ * 新添加的组织地区编码
+ */
+ private String areaCode;
+
+ /**
+ * open: 选择地区编码必填;closed: 无需选择地区编码;0409新增返参
+ */
+ private String areaCodeSwitch;
}
\ No newline at end of file
diff --git a/epmet-module/gov-org/gov-org-server/pom.xml b/epmet-module/gov-org/gov-org-server/pom.xml
index 595c20f348..7644b56007 100644
--- a/epmet-module/gov-org/gov-org-server/pom.xml
+++ b/epmet-module/gov-org/gov-org-server/pom.xml
@@ -101,6 +101,12 @@
epmet-commons-rocketmq
2.0.0
+
+ com.epmet
+ common-service-client
+ 2.0.0
+ compile
+
diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/AgencyController.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/AgencyController.java
index 08154a921d..74e095de3e 100644
--- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/AgencyController.java
+++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/AgencyController.java
@@ -33,6 +33,7 @@ import com.epmet.dto.result.AgencysResultDTO;
import com.epmet.dto.result.SubAgencyResultDTO;
import com.epmet.entity.CustomerAgencyEntity;
import com.epmet.service.AgencyService;
+import com.epmet.service.CustomerAgencyService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
@@ -54,6 +55,8 @@ public class AgencyController {
@Autowired
private AgencyService agencyService;
+ @Autowired
+ private CustomerAgencyService customerAgencyService;
/**
* @param formDTO
@@ -81,6 +84,25 @@ public class AgencyController {
return agencyService.addAgency(formDTO);
}
+ /**
+ * @param formDTO
+ * @return com.epmet.commons.tools.utils.Result
+ * @author yinzuomei
+ * @description 添加组织V2
+ * @Date 2021/4/13 11:09
+ **/
+ @PostMapping("addagency-v2")
+ @RequirePermission(requirePermission = RequirePermissionEnum.ORG_SUBAGENCY_CREATE)
+ public Result addAgencyV2(@RequestBody AddAgencyV2FormDTO formDTO) {
+ ValidatorUtils.validateEntity(formDTO, AddAgencyV2FormDTO.DefaultUserShowGroup.class, AddAgencyV2FormDTO.AddUserInternalGroup.class);
+ if (formDTO.getAreaCodeSwitch().equals(CustomerAgencyConstant.AREA_CODE_SWITCH_OPEN)) {
+ ValidatorUtils.validateEntity(formDTO, AddAgencyV2FormDTO.AreaCodeGroup.class);
+ }
+ //组织名称是否存在
+ customerAgencyService.checkAgencyName(formDTO.getAgencyName());
+ return new Result().ok(agencyService.addAgencyV2(formDTO));
+ }
+
/**
* 添加根级组织
* @param form
diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerAgencyDao.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerAgencyDao.java
index c304943b30..f9742f72e3 100644
--- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerAgencyDao.java
+++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerAgencyDao.java
@@ -224,4 +224,6 @@ public interface CustomerAgencyDao extends BaseDao {
* @Date 2020/12/15 10:04
**/
int delByAgencyId(@Param("agencyId") String agencyId, @Param("operateUserId") String operateUserId);
+
+ List selectAgencyIdsByAreaCode(String areaCode);
}
\ No newline at end of file
diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/AgencyService.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/AgencyService.java
index 2eb012ca11..381fb7256a 100644
--- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/AgencyService.java
+++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/AgencyService.java
@@ -108,4 +108,13 @@ public interface AgencyService {
* @Date 2020/7/16 17:13
**/
void saveRootAgency(AddAgencyAndStaffFormDTO agencyAndStaff);
+
+ /**
+ * 添加组织V2
+ *
+ * @param formDTO rule id
+ * @return com.epmet.dto.result.AddAgencyResultDTO
+ */
+ AddAgencyResultDTO addAgencyV2(AddAgencyV2FormDTO formDTO);
+
}
\ No newline at end of file
diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java
index 8051ca63f5..464c46c8dc 100644
--- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java
+++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java
@@ -234,4 +234,6 @@ public interface CustomerAgencyService extends BaseService
* @author sun
**/
OrganizeTreeResultDTO organizeTree(String agencyId);
+
+ void checkAgencyName(String agencyName);
}
\ No newline at end of file
diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java
index 7e5f4b2831..40e81e9ff5 100644
--- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java
+++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java
@@ -34,11 +34,13 @@ import com.epmet.dto.GovStaffRoleDTO;
import com.epmet.dto.form.*;
import com.epmet.dto.result.*;
import com.epmet.entity.CustomerAgencyEntity;
+import com.epmet.feign.EpmetCommonServiceOpenFeignClient;
import com.epmet.feign.EpmetUserOpenFeignClient;
import com.epmet.redis.CustomerAgencyRedis;
import com.epmet.service.AgencyService;
import com.epmet.service.CustomerAgencyService;
import com.epmet.service.CustomerOrgParameterService;
+import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -77,6 +79,9 @@ public class AgencyServiceImpl implements AgencyService {
private LoginUserUtil loginUserUtil;
@Autowired
private CustomerOrgParameterService customerOrgParameterService;
+ @Autowired
+ private EpmetCommonServiceOpenFeignClient epmetCommonServiceOpenFeignClient;
+
/**
* @param formDTO
@@ -411,4 +416,62 @@ public class AgencyServiceImpl implements AgencyService {
}
+ /**
+ * 添加组织V2
+ *
+ * @param formDTO rule id
+ * @return com.epmet.dto.result.AddAgencyResultDTO
+ */
+ @Transactional(rollbackFor = Exception.class)
+ @Override
+ public AddAgencyResultDTO addAgencyV2(AddAgencyV2FormDTO formDTO) {
+ CustomerAgencyDTO parent = customerAgencyService.get(formDTO.getParentAgencyId());
+ if (null == parent) {
+ throw new RenException(String.format("添加组织失败:没有找到跟组织信息,parentAgencyId=%s", formDTO.getParentAgencyId()));
+ }
+ AddAgencyResultDTO resultDTO = new AddAgencyResultDTO();
+ resultDTO.setAreaCodeSwitch(formDTO.getAreaCodeSwitch());
+ //判断areaCodeSwitch:open: 选择地区编码必填;closed: 无需选择地区编码
+ CustomerAgencyEntity insertEntity = ConvertUtils.sourceToTarget(formDTO, CustomerAgencyEntity.class);
+ insertEntity.setOrganizationName(formDTO.getAgencyName());
+ insertEntity.setTotalUser(NumConstant.ZERO);
+ insertEntity.setPid(parent.getId());
+ insertEntity.setCustomerId(parent.getCustomerId());
+ insertEntity.setParentAreaCode(parent.getAreaCode());
+ if (StringUtils.isBlank(parent.getPid()) || NumConstant.ZERO_STR.equals(parent.getPid())) {
+ //如果上级是根级组织
+ insertEntity.setPids(parent.getId());
+ insertEntity.setAllParentName(parent.getOrganizationName());
+ } else {
+ insertEntity.setPids(parent.getPids().concat(StrConstant.COLON).concat(parent.getId()));
+ insertEntity.setAllParentName(parent.getAllParentName().concat(StrConstant.HYPHEN).concat(parent.getOrganizationName()));
+ }
+ if (CustomerAgencyConstant.AREA_CODE_SWITCH_OPEN.equals(formDTO.getAreaCodeSwitch())) {
+ //校验areaCode是否被使用过
+ if (!"other".equals(formDTO.getAreaCode())) {
+ List agencyIds = customerAgencyDao.selectAgencyIdsByAreaCode(insertEntity.getAreaCode());
+ if (CollectionUtils.isNotEmpty(agencyIds)) {
+ //已经被占用,提示
+ throw new RenException(EpmetErrorCode.AREA_CODE_ALREADY_EXISTS.getCode(), EpmetErrorCode.AREA_CODE_ALREADY_EXISTS.getMsg());
+ }
+ }else{
+ //如果选择的是other,需要自定义一个编码
+ AddAreaCodeFormDTO addAreaCodeFormDTO = new AddAreaCodeFormDTO();
+ addAreaCodeFormDTO.setCurrentAreaLevel(formDTO.getLevel());
+ addAreaCodeFormDTO.setParentAreaCode(parent.getAreaCode());
+ addAreaCodeFormDTO.setName(formDTO.getAgencyName());
+ Result addAreaCodeResult = epmetCommonServiceOpenFeignClient.addAreaCode(addAreaCodeFormDTO);
+ if (!addAreaCodeResult.success() || StringUtils.isBlank(addAreaCodeResult.getData())) {
+ throw new RenException("自定义area_code异常" + addAreaCodeResult.getInternalMsg());
+ }
+ insertEntity.setAreaCode(addAreaCodeResult.getData());
+ }
+ }
+ customerAgencyDao.insert(insertEntity);
+ //3:返回新组织Id
+ resultDTO.setAgencyId(insertEntity.getId());
+ resultDTO.setAreaCode(StrConstant.EPMETY_STR);
+ return resultDTO;
+ }
+
}
\ No newline at end of file
diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java
index bc91668e7c..dc81a51b47 100644
--- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java
+++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java
@@ -22,6 +22,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.constant.NumConstant;
+import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils;
@@ -40,6 +41,7 @@ import com.epmet.feign.OperCrmFeignClient;
import com.epmet.redis.CustomerAgencyRedis;
import com.epmet.service.CustomerAgencyService;
import com.epmet.util.ModuleConstant;
+import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -1057,4 +1059,14 @@ public class CustomerAgencyServiceImpl extends BaseServiceImpl wrapper = new QueryWrapper<>();
+ wrapper.eq(StringUtils.isNotBlank(agencyName), "ORGANIZATION_NAME", agencyName);
+ List entityList = baseDao.selectList(wrapper);
+ if (CollectionUtils.isNotEmpty(entityList)) {
+ throw new RenException(EpmetErrorCode.AGENCY_NAME_ALREADY_EXISTS.getCode(), EpmetErrorCode.AGENCY_NAME_ALREADY_EXISTS.getMsg());
+ }
+ }
+
}
\ No newline at end of file
diff --git a/epmet-module/gov-org/gov-org-server/src/main/resources/logback-spring.xml b/epmet-module/gov-org/gov-org-server/src/main/resources/logback-spring.xml
index 24d44d88f9..6c2d82a05b 100644
--- a/epmet-module/gov-org/gov-org-server/src/main/resources/logback-spring.xml
+++ b/epmet-module/gov-org/gov-org-server/src/main/resources/logback-spring.xml
@@ -128,14 +128,14 @@
15
-
+
diff --git a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml
index 87f00d6652..27d446f644 100644
--- a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml
+++ b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml
@@ -399,4 +399,14 @@
UPDATED_TIME=NOW()
where id=#{agencyId}
+
+
+ SELECT
+ ca.id
+ FROM
+ customer_agency ca
+ WHERE
+ ca.DEL_FLAG = '0'
+ AND ca.AREA_CODE = #{areaCode}
+
\ No newline at end of file
From 4153d52873217bca4e3abfea01d048b9d09b5dbe Mon Sep 17 00:00:00 2001
From: yinzuomei <576302893@qq.com>
Date: Wed, 14 Apr 2021 09:35:24 +0800
Subject: [PATCH 06/21] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E7=BB=84=E7=BB=87V2?=
=?UTF-8?q?=E6=8E=A5=E5=8F=A3=E6=8F=90=E4=BA=A4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../service/commonservice/impl/AreaCodeServiceImpl.java | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/commonservice/impl/AreaCodeServiceImpl.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/commonservice/impl/AreaCodeServiceImpl.java
index ed6ce54264..be9d117721 100644
--- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/commonservice/impl/AreaCodeServiceImpl.java
+++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/commonservice/impl/AreaCodeServiceImpl.java
@@ -7,9 +7,9 @@ import com.epmet.dataaggre.dto.govorg.form.NextAreaCodeFormDTO;
import com.epmet.dataaggre.dto.govorg.result.NextAreaCodeResultDTO;
import com.epmet.dataaggre.service.commonservice.AreaCodeService;
import lombok.extern.slf4j.Slf4j;
-import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
+import org.springframework.util.CollectionUtils;
import java.util.ArrayList;
import java.util.List;
@@ -67,9 +67,10 @@ public class AreaCodeServiceImpl implements AreaCodeService {
break;
default:
}
- if (CollectionUtils.isNotEmpty(list)) {
- list.add(other);
+ if (CollectionUtils.isEmpty(list)) {
+ list = new ArrayList<>();
}
+ list.add(other);
return list;
}
}
From 807c78ccbc650d3a77b06251bea666813f9ebbe1 Mon Sep 17 00:00:00 2001
From: yinzuomei <576302893@qq.com>
Date: Wed, 14 Apr 2021 10:35:44 +0800
Subject: [PATCH 07/21] =?UTF-8?q?=E7=BB=84=E7=BB=87=E5=8C=BA=E5=88=92?=
=?UTF-8?q?=EF=BC=9A=E5=B8=82=E7=BA=A7=E5=88=97=E8=A1=A8=E4=B8=8D=E5=B1=95?=
=?UTF-8?q?=E7=A4=BA=E5=85=B6=E4=BB=96?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../impl/AreaCodeServiceImpl.java | 4 +-
.../govorg/impl/GovOrgServiceImpl.java | 2 +-
.../epmet/service/impl/AgencyServiceImpl.java | 51 ++++++++++++++-----
3 files changed, 41 insertions(+), 16 deletions(-)
diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/commonservice/impl/AreaCodeServiceImpl.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/commonservice/impl/AreaCodeServiceImpl.java
index be9d117721..6d127a135a 100644
--- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/commonservice/impl/AreaCodeServiceImpl.java
+++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/commonservice/impl/AreaCodeServiceImpl.java
@@ -70,7 +70,9 @@ public class AreaCodeServiceImpl implements AreaCodeService {
if (CollectionUtils.isEmpty(list)) {
list = new ArrayList<>();
}
- list.add(other);
+ if(!"province".equals(formDTO.getLevel())){
+ list.add(other);
+ }
return list;
}
}
diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/impl/GovOrgServiceImpl.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/impl/GovOrgServiceImpl.java
index 5006efd5f7..ebc8cac4b3 100644
--- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/impl/GovOrgServiceImpl.java
+++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/impl/GovOrgServiceImpl.java
@@ -139,7 +139,7 @@ public class GovOrgServiceImpl implements GovOrgService {
//内部客户: 已经被使用过的areaCode
List usedAreaCodeList1 = customerAgencyDao.selectUsedAreaCodeList(formDTO.getAreaCode());
//外部子客户:
- List usedAreaCodeList2= customerRelation.selectUsedAreaCodeList(formDTO.getAreaCode());
+ List usedAreaCodeList2 = customerRelation.selectUsedAreaCodeList(formDTO.getAreaCode());
//已经被使用的移除不显示
Iterator iterator = allList.iterator();
while (iterator.hasNext()) {
diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java
index 40e81e9ff5..2a50885c94 100644
--- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java
+++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java
@@ -431,21 +431,8 @@ public class AgencyServiceImpl implements AgencyService {
}
AddAgencyResultDTO resultDTO = new AddAgencyResultDTO();
resultDTO.setAreaCodeSwitch(formDTO.getAreaCodeSwitch());
+ CustomerAgencyEntity insertEntity=this.constructInsertEntity(formDTO,parent);
//判断areaCodeSwitch:open: 选择地区编码必填;closed: 无需选择地区编码
- CustomerAgencyEntity insertEntity = ConvertUtils.sourceToTarget(formDTO, CustomerAgencyEntity.class);
- insertEntity.setOrganizationName(formDTO.getAgencyName());
- insertEntity.setTotalUser(NumConstant.ZERO);
- insertEntity.setPid(parent.getId());
- insertEntity.setCustomerId(parent.getCustomerId());
- insertEntity.setParentAreaCode(parent.getAreaCode());
- if (StringUtils.isBlank(parent.getPid()) || NumConstant.ZERO_STR.equals(parent.getPid())) {
- //如果上级是根级组织
- insertEntity.setPids(parent.getId());
- insertEntity.setAllParentName(parent.getOrganizationName());
- } else {
- insertEntity.setPids(parent.getPids().concat(StrConstant.COLON).concat(parent.getId()));
- insertEntity.setAllParentName(parent.getAllParentName().concat(StrConstant.HYPHEN).concat(parent.getOrganizationName()));
- }
if (CustomerAgencyConstant.AREA_CODE_SWITCH_OPEN.equals(formDTO.getAreaCodeSwitch())) {
//校验areaCode是否被使用过
if (!"other".equals(formDTO.getAreaCode())) {
@@ -474,4 +461,40 @@ public class AgencyServiceImpl implements AgencyService {
return resultDTO;
}
+ private CustomerAgencyEntity constructInsertEntity(AddAgencyV2FormDTO formDTO, CustomerAgencyDTO parent) {
+ CustomerAgencyEntity insertEntity = ConvertUtils.sourceToTarget(formDTO, CustomerAgencyEntity.class);
+ insertEntity.setOrganizationName(formDTO.getAgencyName());
+ insertEntity.setTotalUser(NumConstant.ZERO);
+ insertEntity.setPid(parent.getId());
+ insertEntity.setCustomerId(parent.getCustomerId());
+ insertEntity.setParentAreaCode(parent.getAreaCode());
+ if (StringUtils.isBlank(parent.getPid()) || NumConstant.ZERO_STR.equals(parent.getPid())) {
+ //如果上级是根级组织
+ insertEntity.setPids(parent.getId());
+ insertEntity.setAllParentName(parent.getOrganizationName());
+ } else {
+ insertEntity.setPids(parent.getPids().concat(StrConstant.COLON).concat(parent.getId()));
+ insertEntity.setAllParentName(parent.getAllParentName().concat(StrConstant.HYPHEN).concat(parent.getOrganizationName()));
+ }
+ switch(parent.getLevel())
+ {
+ case CustomerAgencyConstant.PROVINCE_LEVEL:
+ insertEntity.setLevel(CustomerAgencyConstant.CITY_LEVEL);
+ break;
+ case CustomerAgencyConstant.CITY_LEVEL:
+ insertEntity.setLevel(CustomerAgencyConstant.DISTRICT);
+ break;
+ case CustomerAgencyConstant.DISTRICT:
+ insertEntity.setLevel(CustomerAgencyConstant.STREET_LEVEL);
+ break;
+ case CustomerAgencyConstant.STREET_LEVEL:
+ insertEntity.setLevel(CustomerAgencyConstant.COMMUNITY_LEVEL);
+ break;
+ default:
+ log.info("parent.getLevel()="+parent.getLevel());
+ break;
+ }
+ return insertEntity;
+ }
+
}
\ No newline at end of file
From c4f6d4469c294e6bd6c6d1c4477fe17253cee86f Mon Sep 17 00:00:00 2001
From: yinzuomei <576302893@qq.com>
Date: Wed, 14 Apr 2021 12:12:09 +0800
Subject: [PATCH 08/21] =?UTF-8?q?"editagency"=E4=BF=AE=E6=94=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../dto/govorg/CustomerAgencyDTO.java | 10 +++---
.../entity/govorg/CustomerAgencyEntity.java | 10 +++---
.../entity/org/CustomerAgencyEntity.java | 10 +++---
.../java/com/epmet/dto/CustomerAgencyDTO.java | 10 +++---
.../epmet/dto/form/AddAgencyV2FormDTO.java | 4 +--
.../epmet/dto/result/AgencysResultDTO.java | 10 +++---
.../epmet/entity/CustomerAgencyEntity.java | 10 +++---
.../epmet/service/impl/AgencyServiceImpl.java | 36 +++++++++++++++----
8 files changed, 62 insertions(+), 38 deletions(-)
diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/CustomerAgencyDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/CustomerAgencyDTO.java
index cea8221c31..496a2c87cc 100644
--- a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/CustomerAgencyDTO.java
+++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/CustomerAgencyDTO.java
@@ -114,17 +114,17 @@ public class CustomerAgencyDTO implements Serializable {
private Integer totalUser;
/**
- * 区域编码字典中的【省份】名称
+ * 【省份】名称
*/
private String province;
/**
- * 区域编码字典中的【城市】名称
+ * 【城市】名称
*/
private String city;
/**
- * 区域编码字典中的【区县】名称
+ * 【区县】名称
*/
private String district;
@@ -134,12 +134,12 @@ public class CustomerAgencyDTO implements Serializable {
private String parentAreaCode;
/**
- * 区域编码字典中的【街道】名称0409
+ * 街道
*/
private String street;
/**
- * 区域编码字典中的【社区】名称0409
+ * 社区
*/
private String community;
}
\ No newline at end of file
diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/govorg/CustomerAgencyEntity.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/govorg/CustomerAgencyEntity.java
index b12cd2112a..6c6420ffc8 100644
--- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/govorg/CustomerAgencyEntity.java
+++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/govorg/CustomerAgencyEntity.java
@@ -80,17 +80,17 @@ public class CustomerAgencyEntity extends BaseEpmetEntity {
private Integer totalUser;
/**
- * 区域编码字典中的【省份】名称
+ * 【省份】名称
*/
private String province;
/**
- * 区域编码字典中的【城市】名称
+ * 【城市】名称
*/
private String city;
/**
- * 区域编码字典中的【区县】名称
+ * 【区县】名称
*/
private String district;
@@ -100,12 +100,12 @@ public class CustomerAgencyEntity extends BaseEpmetEntity {
private String parentAreaCode;
/**
- * 区域编码字典中的【街道】名称0409
+ * 街道
*/
private String street;
/**
- * 区域编码字典中的【社区】名称0409
+ * 社区
*/
private String community;
}
diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/org/CustomerAgencyEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/org/CustomerAgencyEntity.java
index 4f5f964710..4fbb9bfb83 100644
--- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/org/CustomerAgencyEntity.java
+++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/org/CustomerAgencyEntity.java
@@ -80,17 +80,17 @@ public class CustomerAgencyEntity extends BaseEpmetEntity {
private Integer totalUser;
/**
- * 区域编码字典中的【省份】名称
+ * 【省份】名称
*/
private String province;
/**
- * 区域编码字典中的【城市】名称
+ * 【城市】名称
*/
private String city;
/**
- * 区域编码字典中的【区县】名称
+ * 【区县】名称
*/
private String district;
@@ -100,12 +100,12 @@ public class CustomerAgencyEntity extends BaseEpmetEntity {
private String parentAreaCode;
/**
- * 区域编码字典中的【街道】名称0409
+ * 街道
*/
private String street;
/**
- * 区域编码字典中的【社区】名称0409
+ * 社区
*/
private String community;
}
diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/CustomerAgencyDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/CustomerAgencyDTO.java
index 5a7ad8fc85..12f5488ac4 100644
--- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/CustomerAgencyDTO.java
+++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/CustomerAgencyDTO.java
@@ -114,17 +114,17 @@ public class CustomerAgencyDTO implements Serializable {
private Integer totalUser;
/**
- * 区域编码字典中的【省份】名称
+ * 省
*/
private String province;
/**
- * 区域编码字典中的【城市】名称
+ * 市
*/
private String city;
/**
- * 区域编码字典中的【区县】名称
+ * 区县
*/
private String district;
@@ -134,12 +134,12 @@ public class CustomerAgencyDTO implements Serializable {
private String parentAreaCode;
/**
- * 区域编码字典中的【街道】名称0409
+ * 街道
*/
private String street;
/**
- * 区域编码字典中的【社区】名称0409
+ * 社区
*/
private String community;
}
\ No newline at end of file
diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AddAgencyV2FormDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AddAgencyV2FormDTO.java
index bf29a4aede..c426bc6d41 100644
--- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AddAgencyV2FormDTO.java
+++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AddAgencyV2FormDTO.java
@@ -75,12 +75,12 @@ public class AddAgencyV2FormDTO implements Serializable {
private String district;
/**
- * 区域编码字典中的【街道】名称;来源于【/data/aggregator/org/nextlevelareacodelist】接口里的areaName
+ * 街道
*/
private String street;
/**
- * 区域编码字典中的【社区】名称;来源于【/data/aggregator/org/nextlevelareacodelist】接口里的areaName
+ * 社区
*/
private String community;
}
diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AgencysResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AgencysResultDTO.java
index a3c7bf0413..175fe56674 100644
--- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AgencysResultDTO.java
+++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AgencysResultDTO.java
@@ -58,17 +58,17 @@ public class AgencysResultDTO implements Serializable {
private String areaCode = "";
/**
- * 区域编码字典中的【省份】名称
+ * 【省份】名称
*/
private String province = "";
/**
- * 区域编码字典中的【城市】名称
+ * 【城市】名称
*/
private String city = "";
/**
- * 区域编码字典中的【区县】名称
+ * 【区县】名称
*/
private String district = "";
@@ -78,12 +78,12 @@ public class AgencysResultDTO implements Serializable {
private List parentList;
/**
- * 区域编码字典中的【街道】名称0409
+ * 街道
*/
private String street;
/**
- * 区域编码字典中的【社区】名称0409
+ * 社区
*/
private String community;
diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/entity/CustomerAgencyEntity.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/entity/CustomerAgencyEntity.java
index 91852ac516..ee327e421e 100644
--- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/entity/CustomerAgencyEntity.java
+++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/entity/CustomerAgencyEntity.java
@@ -80,17 +80,17 @@ public class CustomerAgencyEntity extends BaseEpmetEntity {
private Integer totalUser;
/**
- * 区域编码字典中的【省份】名称
+ * 省
*/
private String province;
/**
- * 区域编码字典中的【城市】名称
+ * 【城市】名称
*/
private String city;
/**
- * 区域编码字典中的【区县】名称
+ * 【区县】名称
*/
private String district;
@@ -100,12 +100,12 @@ public class CustomerAgencyEntity extends BaseEpmetEntity {
private String parentAreaCode;
/**
- * 区域编码字典中的【街道】名称0409
+ * 街道
*/
private String street;
/**
- * 区域编码字典中的【社区】名称0409
+ * 【社区】名称0409
*/
private String community;
}
diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java
index 2a50885c94..e7dd1a0674 100644
--- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java
+++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java
@@ -133,9 +133,7 @@ public class AgencyServiceImpl implements AgencyService {
@Transactional(rollbackFor = Exception.class)
public Result editAgency(EditAgencyFormDTO formDTO) {
Result result = new Result();
- CustomerAgencyEntity entity = new CustomerAgencyEntity();
- entity.setId(formDTO.getAgencyId());
- entity.setOrganizationName(formDTO.getAgencyName());
+ CustomerAgencyEntity entity = getUpdateEntity(formDTO);
//1:更新当前组织信息
if (customerAgencyDao.updateById(entity) < NumConstant.ONE) {
log.error(CustomerAgencyConstant.UPDATE_EXCEPTION);
@@ -152,7 +150,6 @@ public class AgencyServiceImpl implements AgencyService {
List editList = new ArrayList<>();
Date date = new Date();
agencyList.forEach(agency->{
- CustomerAgencyEntity customerAgencyEntity = new CustomerAgencyEntity();
//3-1:查询当前组织的所有上级组织
List listStr = Arrays.asList(agency.getPids().split(":"));
List parentList = customerAgencyDao.selectPAgencyById(listStr);
@@ -165,10 +162,20 @@ public class AgencyServiceImpl implements AgencyService {
allParentName.append("-").append(parents.getName());
}
});
- customerAgencyEntity.setId(agency.getId());
+ CustomerAgencyEntity customerAgencyEntity = ConvertUtils.sourceToTarget(agency,CustomerAgencyEntity.class);
customerAgencyEntity.setAllParentName(allParentName.toString());
customerAgencyEntity.setUpdatedBy(formDTO.getUserId());
- customerAgencyEntity.setUpdatedTime(date);
+ if (CustomerAgencyConstant.PROVINCE_LEVEL.equals(entity.getLevel())) {
+ customerAgencyEntity.setProvince(entity.getOrganizationName());
+ } else if (CustomerAgencyConstant.CITY_LEVEL.equals(entity.getLevel())) {
+ customerAgencyEntity.setCity(entity.getOrganizationName());
+ } else if (CustomerAgencyConstant.DISTRICT.equals(entity.getLevel())) {
+ customerAgencyEntity.setDistrict(entity.getOrganizationName());
+ } else if (CustomerAgencyConstant.STREET_LEVEL.equals(entity.getLevel())) {
+ customerAgencyEntity.setStreet(entity.getOrganizationName());
+ } else if (CustomerAgencyConstant.COMMUNITY_LEVEL.equals(entity.getLevel())) {
+ customerAgencyEntity.setCommunity(entity.getOrganizationName());
+ }
editList.add(customerAgencyEntity);
});
//4:批量更新因一个组织名称变动而引起的其他组织字段值的变动
@@ -182,6 +189,23 @@ public class AgencyServiceImpl implements AgencyService {
return result;
}
+ private CustomerAgencyEntity getUpdateEntity(EditAgencyFormDTO formDTO) {
+ CustomerAgencyEntity entity = customerAgencyDao.selectById(formDTO.getAgencyId());
+ entity.setOrganizationName(formDTO.getAgencyName());
+ if (CustomerAgencyConstant.PROVINCE_LEVEL.equals(entity.getLevel())) {
+ entity.setProvince(entity.getOrganizationName());
+ } else if (CustomerAgencyConstant.CITY_LEVEL.equals(entity.getLevel())) {
+ entity.setCity(entity.getOrganizationName());
+ } else if (CustomerAgencyConstant.DISTRICT.equals(entity.getLevel())) {
+ entity.setDistrict(entity.getOrganizationName());
+ } else if (CustomerAgencyConstant.STREET_LEVEL.equals(entity.getLevel())) {
+ entity.setStreet(entity.getOrganizationName());
+ } else if (CustomerAgencyConstant.COMMUNITY_LEVEL.equals(entity.getLevel())) {
+ entity.setCommunity(entity.getOrganizationName());
+ }
+ return entity;
+ }
+
/**
* @param formDTO
* @return
From 45008813d241385c16eb351ebca2fa121e1138fb Mon Sep 17 00:00:00 2001
From: yinzuomei <576302893@qq.com>
Date: Wed, 14 Apr 2021 13:38:55 +0800
Subject: [PATCH 09/21] =?UTF-8?q?"editagency"=E4=BF=AE=E6=94=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../epmet/service/impl/AgencyServiceImpl.java | 22 -------------------
1 file changed, 22 deletions(-)
diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java
index e7dd1a0674..ad1fa72220 100644
--- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java
+++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java
@@ -165,17 +165,6 @@ public class AgencyServiceImpl implements AgencyService {
CustomerAgencyEntity customerAgencyEntity = ConvertUtils.sourceToTarget(agency,CustomerAgencyEntity.class);
customerAgencyEntity.setAllParentName(allParentName.toString());
customerAgencyEntity.setUpdatedBy(formDTO.getUserId());
- if (CustomerAgencyConstant.PROVINCE_LEVEL.equals(entity.getLevel())) {
- customerAgencyEntity.setProvince(entity.getOrganizationName());
- } else if (CustomerAgencyConstant.CITY_LEVEL.equals(entity.getLevel())) {
- customerAgencyEntity.setCity(entity.getOrganizationName());
- } else if (CustomerAgencyConstant.DISTRICT.equals(entity.getLevel())) {
- customerAgencyEntity.setDistrict(entity.getOrganizationName());
- } else if (CustomerAgencyConstant.STREET_LEVEL.equals(entity.getLevel())) {
- customerAgencyEntity.setStreet(entity.getOrganizationName());
- } else if (CustomerAgencyConstant.COMMUNITY_LEVEL.equals(entity.getLevel())) {
- customerAgencyEntity.setCommunity(entity.getOrganizationName());
- }
editList.add(customerAgencyEntity);
});
//4:批量更新因一个组织名称变动而引起的其他组织字段值的变动
@@ -192,17 +181,6 @@ public class AgencyServiceImpl implements AgencyService {
private CustomerAgencyEntity getUpdateEntity(EditAgencyFormDTO formDTO) {
CustomerAgencyEntity entity = customerAgencyDao.selectById(formDTO.getAgencyId());
entity.setOrganizationName(formDTO.getAgencyName());
- if (CustomerAgencyConstant.PROVINCE_LEVEL.equals(entity.getLevel())) {
- entity.setProvince(entity.getOrganizationName());
- } else if (CustomerAgencyConstant.CITY_LEVEL.equals(entity.getLevel())) {
- entity.setCity(entity.getOrganizationName());
- } else if (CustomerAgencyConstant.DISTRICT.equals(entity.getLevel())) {
- entity.setDistrict(entity.getOrganizationName());
- } else if (CustomerAgencyConstant.STREET_LEVEL.equals(entity.getLevel())) {
- entity.setStreet(entity.getOrganizationName());
- } else if (CustomerAgencyConstant.COMMUNITY_LEVEL.equals(entity.getLevel())) {
- entity.setCommunity(entity.getOrganizationName());
- }
return entity;
}
From 50554d2216fe4dbfd422006e03eb4861c7406703 Mon Sep 17 00:00:00 2001
From: yinzuomei <576302893@qq.com>
Date: Wed, 14 Apr 2021 13:46:44 +0800
Subject: [PATCH 10/21] =?UTF-8?q?"agencydetail"=E4=BF=AE=E6=94=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../epmet/service/impl/AgencyServiceImpl.java | 22 -------------------
1 file changed, 22 deletions(-)
diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java
index ad1fa72220..155bad550c 100644
--- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java
+++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java
@@ -251,28 +251,6 @@ public class AgencyServiceImpl implements AgencyService {
parentList = customerAgencyDao.selectPAgencyById(listStr);
agencysResultDTO.setParentList(parentList);
agencysResultDTO.setAreaCodeSwitch(customerOrgParameterService.getAreaCodeSwitch(entity.getCustomerId()));
- //查询组织区划的名称
- if (null != entity && StringUtils.isNotBlank(entity.getAreaCode())) {
- switch (entity.getLevel()) {
- case CustomerAgencyConstant.PROVINCE_LEVEL:
- agencysResultDTO.setAgencyName(entity.getProvince());
- break;
- case CustomerAgencyConstant.CITY_LEVEL:
- agencysResultDTO.setAgencyName(entity.getCity());
- break;
- case CustomerAgencyConstant.DISTRICT:
- agencysResultDTO.setAgencyName(entity.getDistrict());
- break;
- case CustomerAgencyConstant.STREET_LEVEL:
- agencysResultDTO.setAgencyName(entity.getStreet());
- break;
- case CustomerAgencyConstant.COMMUNITY_LEVEL:
- agencysResultDTO.setAgencyName(entity.getCommunity());
- break;
- default:
- agencysResultDTO.setAgencyName(StrConstant.EPMETY_STR);
- }
- }
return new Result().ok(agencysResultDTO);
}
From ffd3d6252f111f33c92faa99dc80c050d53ac929 Mon Sep 17 00:00:00 2001
From: yinzuomei <576302893@qq.com>
Date: Wed, 14 Apr 2021 13:59:43 +0800
Subject: [PATCH 11/21] =?UTF-8?q?nextlevelareacodelist=E4=BF=AE=E6=94=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../src/main/resources/mapper/govorg/CustomerAgencyDao.xml | 2 +-
.../src/main/resources/mapper/opercrm/CustomerRelationDao.xml | 1 +
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govorg/CustomerAgencyDao.xml b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govorg/CustomerAgencyDao.xml
index f27f969e31..fda4f7245c 100644
--- a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govorg/CustomerAgencyDao.xml
+++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govorg/CustomerAgencyDao.xml
@@ -24,7 +24,7 @@
SELECT
- ca.AREA_CODE
+ distinct ca.AREA_CODE
FROM
customer_agency ca
WHERE
diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/opercrm/CustomerRelationDao.xml b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/opercrm/CustomerRelationDao.xml
index 5c0ec4f533..169a44070f 100644
--- a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/opercrm/CustomerRelationDao.xml
+++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/opercrm/CustomerRelationDao.xml
@@ -10,6 +10,7 @@
customer_relation cr
WHERE
cr.DEL_FLAG = '0'
+ and cr.CUSTOMER_TYPE='external'
AND cr.AREA_CODE LIKE concat(#{areaCode}, '%')
AND cr.AREA_CODE != #{areaCode}
From fe69f95eb5e3be7299ad3f78aa1449a6479b17f8 Mon Sep 17 00:00:00 2001
From: yinzuomei <576302893@qq.com>
Date: Wed, 14 Apr 2021 17:45:03 +0800
Subject: [PATCH 12/21] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=8C=BA=E7=BC=96?=
=?UTF-8?q?=E7=A0=81=E4=BF=AE=E6=94=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../java/com/epmet/service/impl/AreaCodeServiceImpl.java | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/impl/AreaCodeServiceImpl.java b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/impl/AreaCodeServiceImpl.java
index 29cfc457aa..9a793cc0d2 100644
--- a/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/impl/AreaCodeServiceImpl.java
+++ b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/impl/AreaCodeServiceImpl.java
@@ -702,12 +702,12 @@ public class AreaCodeServiceImpl extends BaseServiceImpl
Date: Wed, 14 Apr 2021 17:53:17 +0800
Subject: [PATCH 13/21] =?UTF-8?q?"agencydetail"=E4=BF=AE=E6=94=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../epmet/service/impl/AgencyServiceImpl.java | 22 +++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java
index 155bad550c..2a5bcbb838 100644
--- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java
+++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java
@@ -251,6 +251,28 @@ public class AgencyServiceImpl implements AgencyService {
parentList = customerAgencyDao.selectPAgencyById(listStr);
agencysResultDTO.setParentList(parentList);
agencysResultDTO.setAreaCodeSwitch(customerOrgParameterService.getAreaCodeSwitch(entity.getCustomerId()));
+ //查询组织区划的名称
+ if (null != entity && StringUtils.isNotBlank(entity.getAreaCode())) {
+ switch (entity.getLevel()) {
+ case CustomerAgencyConstant.PROVINCE_LEVEL:
+ agencysResultDTO.setAreaName(entity.getProvince());
+ break;
+ case CustomerAgencyConstant.CITY_LEVEL:
+ agencysResultDTO.setAreaName(entity.getCity());
+ break;
+ case CustomerAgencyConstant.DISTRICT:
+ agencysResultDTO.setAreaName(entity.getDistrict());
+ break;
+ case CustomerAgencyConstant.STREET_LEVEL:
+ agencysResultDTO.setAreaName(entity.getStreet());
+ break;
+ case CustomerAgencyConstant.COMMUNITY_LEVEL:
+ agencysResultDTO.setAreaName(entity.getCommunity());
+ break;
+ default:
+ agencysResultDTO.setAreaName(StrConstant.EPMETY_STR);
+ }
+ }
return new Result().ok(agencysResultDTO);
}
From 017bf883dc1f0cdc2a02896a2414097f3c1478d7 Mon Sep 17 00:00:00 2001
From: yinzuomei <576302893@qq.com>
Date: Wed, 14 Apr 2021 18:10:39 +0800
Subject: [PATCH 14/21] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E7=BB=84=E7=BB=87V2?=
=?UTF-8?q?=E6=8E=A5=E5=8F=A3=E6=8F=90=E4=BA=A4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../epmet/dto/form/AddAgencyV2FormDTO.java | 52 ++++++++++---------
.../epmet/service/impl/AgencyServiceImpl.java | 16 +++++-
2 files changed, 43 insertions(+), 25 deletions(-)
diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AddAgencyV2FormDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AddAgencyV2FormDTO.java
index c426bc6d41..e5b775c067 100644
--- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AddAgencyV2FormDTO.java
+++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AddAgencyV2FormDTO.java
@@ -59,28 +59,32 @@ public class AddAgencyV2FormDTO implements Serializable {
@NotBlank(message = "请选择组织区划", groups = AreaCodeGroup.class)
private String areaCode;
- /**
- * 省份
- */
- private String province;
-
- /**
- * 城市
- */
- private String city;
-
- /**
- * 区县
- */
- private String district;
-
- /**
- * 街道
- */
- private String street;
-
- /**
- * 社区
- */
- private String community;
+ // /**
+ // * 省份
+ // */
+ // private String province;
+ //
+ // /**
+ // * 城市
+ // */
+ // private String city;
+ //
+ // /**
+ // * 区县
+ // */
+ // private String district;
+ //
+ // /**
+ // * 街道
+ // */
+ // private String street;
+ //
+ // /**
+ // * 社区
+ // */
+ // private String community;
+
+ //区域编码名称
+ @NotBlank(message = "请选择组织区划", groups = AreaCodeGroup.class)
+ private String areaName;
}
diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java
index 2a5bcbb838..6202cc038c 100644
--- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java
+++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java
@@ -459,7 +459,7 @@ public class AgencyServiceImpl implements AgencyService {
customerAgencyDao.insert(insertEntity);
//3:返回新组织Id
resultDTO.setAgencyId(insertEntity.getId());
- resultDTO.setAreaCode(StrConstant.EPMETY_STR);
+ resultDTO.setAreaCode(insertEntity.getAreaCode());
return resultDTO;
}
@@ -482,15 +482,29 @@ public class AgencyServiceImpl implements AgencyService {
{
case CustomerAgencyConstant.PROVINCE_LEVEL:
insertEntity.setLevel(CustomerAgencyConstant.CITY_LEVEL);
+ insertEntity.setProvince(parent.getProvince());
+ insertEntity.setCity(formDTO.getAreaName());
break;
case CustomerAgencyConstant.CITY_LEVEL:
insertEntity.setLevel(CustomerAgencyConstant.DISTRICT);
+ insertEntity.setProvince(parent.getProvince());
+ insertEntity.setCity(parent.getCity());
+ insertEntity.setDistrict(formDTO.getAreaName());
break;
case CustomerAgencyConstant.DISTRICT:
insertEntity.setLevel(CustomerAgencyConstant.STREET_LEVEL);
+ insertEntity.setProvince(parent.getProvince());
+ insertEntity.setCity(parent.getCity());
+ insertEntity.setDistrict(parent.getDistrict());
+ insertEntity.setStreet(formDTO.getAreaName());
break;
case CustomerAgencyConstant.STREET_LEVEL:
insertEntity.setLevel(CustomerAgencyConstant.COMMUNITY_LEVEL);
+ insertEntity.setProvince(parent.getProvince());
+ insertEntity.setCity(parent.getCity());
+ insertEntity.setDistrict(parent.getDistrict());
+ insertEntity.setStreet(parent.getStreet());
+ insertEntity.setCommunity(formDTO.getAreaName());
break;
default:
log.info("parent.getLevel()="+parent.getLevel());
From ff7a5bed55ee0009fed97c442477b12165b99834 Mon Sep 17 00:00:00 2001
From: yinzuomei <576302893@qq.com>
Date: Wed, 14 Apr 2021 18:32:53 +0800
Subject: [PATCH 15/21] departmentdetail
---
.../java/com/epmet/dto/result/DepartmentDetailResultDTO.java | 1 +
1 file changed, 1 insertion(+)
diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/DepartmentDetailResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/DepartmentDetailResultDTO.java
index 8d7ab9dff2..11271d8009 100644
--- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/DepartmentDetailResultDTO.java
+++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/DepartmentDetailResultDTO.java
@@ -58,5 +58,6 @@ public class DepartmentDetailResultDTO implements Serializable {
*/
private List staffList;
+ private String areaCode;
}
\ No newline at end of file
From 5e410685a9e3e78a502e7fdcd86d7f249dbd3aec Mon Sep 17 00:00:00 2001
From: yinzuomei <576302893@qq.com>
Date: Fri, 16 Apr 2021 10:03:54 +0800
Subject: [PATCH 16/21] =?UTF-8?q?=E8=AF=B7=E9=80=89=E6=8B=A9=E7=BB=84?=
=?UTF-8?q?=E7=BB=87=E5=8C=BA=E5=88=92=E9=87=8D=E5=A4=8D=E6=8F=90=E7=A4=BA?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../src/main/java/com/epmet/dto/form/AddAgencyV2FormDTO.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AddAgencyV2FormDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AddAgencyV2FormDTO.java
index e5b775c067..21867756d5 100644
--- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AddAgencyV2FormDTO.java
+++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AddAgencyV2FormDTO.java
@@ -85,6 +85,6 @@ public class AddAgencyV2FormDTO implements Serializable {
// private String community;
//区域编码名称
- @NotBlank(message = "请选择组织区划", groups = AreaCodeGroup.class)
+ @NotBlank(message = "", groups = AreaCodeGroup.class)
private String areaName;
}
From efcf6d4d2aced66715b2d11d4dd427eab3120786 Mon Sep 17 00:00:00 2001
From: yinzuomei <576302893@qq.com>
Date: Fri, 16 Apr 2021 10:05:26 +0800
Subject: [PATCH 17/21] =?UTF-8?q?agencydetail=E6=8E=A5=E5=8F=A3=E8=86=9D?=
=?UTF-8?q?=E7=9B=96=EF=BC=8CareaName=E8=BF=94=E5=9B=9E=E7=A9=BA=E5=AD=97?=
=?UTF-8?q?=E7=AC=A6=E4=B8=B2not=20null?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../java/com/epmet/service/impl/AgencyServiceImpl.java | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java
index 6202cc038c..e34fe06786 100644
--- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java
+++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java
@@ -255,19 +255,19 @@ public class AgencyServiceImpl implements AgencyService {
if (null != entity && StringUtils.isNotBlank(entity.getAreaCode())) {
switch (entity.getLevel()) {
case CustomerAgencyConstant.PROVINCE_LEVEL:
- agencysResultDTO.setAreaName(entity.getProvince());
+ agencysResultDTO.setAreaName(null == entity.getProvince() ? StrConstant.EPMETY_STR : entity.getProvince());
break;
case CustomerAgencyConstant.CITY_LEVEL:
- agencysResultDTO.setAreaName(entity.getCity());
+ agencysResultDTO.setAreaName(null == entity.getCity() ? StrConstant.EPMETY_STR : entity.getCity());
break;
case CustomerAgencyConstant.DISTRICT:
- agencysResultDTO.setAreaName(entity.getDistrict());
+ agencysResultDTO.setAreaName(null == entity.getDistrict() ? StrConstant.EPMETY_STR : entity.getDistrict());
break;
case CustomerAgencyConstant.STREET_LEVEL:
- agencysResultDTO.setAreaName(entity.getStreet());
+ agencysResultDTO.setAreaName(null == entity.getStreet() ? StrConstant.EPMETY_STR : entity.getStreet());
break;
case CustomerAgencyConstant.COMMUNITY_LEVEL:
- agencysResultDTO.setAreaName(entity.getCommunity());
+ agencysResultDTO.setAreaName(null == entity.getCommunity() ? StrConstant.EPMETY_STR : entity.getCommunity());
break;
default:
agencysResultDTO.setAreaName(StrConstant.EPMETY_STR);
From 8d647eab78eb1cbc320c189c0406d4ff475177ec Mon Sep 17 00:00:00 2001
From: yinzuomei <576302893@qq.com>
Date: Fri, 16 Apr 2021 10:46:49 +0800
Subject: [PATCH 18/21] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=BB=84=E7=BB=87?=
=?UTF-8?q?=E4=BF=A1=E6=81=AF?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../tools/exception/EpmetErrorCode.java | 3 +-
.../dto/govorg/form/NextAreaCodeFormDTO.java | 7 ++-
.../govorg/impl/GovOrgServiceImpl.java | 9 ++--
.../com/epmet/dto/form/EditAgencyFormDTO.java | 30 ++++++++++-
.../epmet/controller/AgencyController.java | 11 ++--
.../java/com/epmet/dao/CustomerAgencyDao.java | 8 ++-
.../epmet/service/CustomerAgencyService.java | 2 +-
.../epmet/service/impl/AgencyServiceImpl.java | 52 ++++++++++++++-----
.../impl/CustomerAgencyServiceImpl.java | 6 +--
.../resources/mapper/CustomerAgencyDao.xml | 18 +++++++
10 files changed, 116 insertions(+), 30 deletions(-)
diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java
index 79f5421789..2f340981fa 100644
--- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java
+++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java
@@ -71,7 +71,8 @@ public enum EpmetErrorCode {
NOT_DEL_DEPARTMENT(8206, "该部门存在工作人员,不允许删除"),
NOT_DEL_AGENCY_GRID(8207, "该机关存在网格,不允许删除"),
AREA_CODE_ALREADY_EXISTS(8208,"组织区划已被占用,请重新选择"),
- AGENCY_NAME_ALREADY_EXISTS(8209,"您当前的组织名称已存在,请重新修改"),
+ AGENCY_NAME_ALREADY_EXISTS(8209,"当前组织名称已存在,请重新修改"),
+ SET_PARENT_AREA_CODE(8210,"请先设置上级组织区划"),
REQUIRE_PERMISSION(8301, "您没有足够的操作权限"),
THIRD_PLAT_REQUEST_ERROR(8302, "请求第三方平台错误"),
diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/form/NextAreaCodeFormDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/form/NextAreaCodeFormDTO.java
index ad3783df46..5bdd66cf68 100644
--- a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/form/NextAreaCodeFormDTO.java
+++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/form/NextAreaCodeFormDTO.java
@@ -14,8 +14,11 @@ import java.io.Serializable;
@Data
public class NextAreaCodeFormDTO implements Serializable {
private static final long serialVersionUID = -1974456701949979946L;
+ public interface AddUserInternalGroup {
+ }
+ @NotBlank(message = "parentAgencyId不能为空",groups = AddUserInternalGroup.class)
+ private String parentAgencyId;
- @NotBlank(message = "areaCode不能为空")
private String areaCode;
/**
@@ -25,7 +28,7 @@ public class NextAreaCodeFormDTO implements Serializable {
* 市级: city
* 省级:province
*/
- @NotBlank(message = "level不能为空")
+ @NotBlank(message = "level不能为空",groups = AddUserInternalGroup.class)
private String level;
}
diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/impl/GovOrgServiceImpl.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/impl/GovOrgServiceImpl.java
index ebc8cac4b3..b09414f1bd 100644
--- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/impl/GovOrgServiceImpl.java
+++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/impl/GovOrgServiceImpl.java
@@ -3,6 +3,7 @@ package com.epmet.dataaggre.service.govorg.impl;
import com.alibaba.fastjson.JSON;
import com.epmet.commons.dynamic.datasource.annotation.DataSource;
import com.epmet.commons.tools.constant.NumConstant;
+import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.dataaggre.constant.DataSourceConstant;
import com.epmet.dataaggre.dao.govorg.CustomerAgencyDao;
@@ -20,8 +21,7 @@ import com.epmet.dataaggre.service.govorg.GovOrgService;
import com.epmet.dataaggre.service.opercrm.CustomerRelation;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -37,7 +37,6 @@ import java.util.List;
@DataSource(DataSourceConstant.GOV_ORG)
@Slf4j
public class GovOrgServiceImpl implements GovOrgService {
- private static final Logger logger = LoggerFactory.getLogger(GovOrgServiceImpl.class);
@Autowired
private CustomerAgencyDao customerAgencyDao;
@@ -133,6 +132,10 @@ public class GovOrgServiceImpl implements GovOrgService {
@Override
public List queryNextLevelAreaCodeList(NextAreaCodeFormDTO formDTO) {
+ CustomerAgencyEntity parent=customerAgencyDao.selectById(formDTO.getParentAgencyId());
+ if (null == parent || StringUtils.isBlank(parent.getAreaCode())) {
+ throw new RenException(EpmetErrorCode.SET_PARENT_AREA_CODE.getCode(),EpmetErrorCode.SET_PARENT_AREA_CODE.getMsg());
+ }
//全部下级
List allList = areaCodeService.queryNextLevelAreaCodeList(formDTO);
if (CollectionUtils.isNotEmpty(allList)) {
diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/EditAgencyFormDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/EditAgencyFormDTO.java
index 276099576a..0202ecd894 100644
--- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/EditAgencyFormDTO.java
+++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/EditAgencyFormDTO.java
@@ -17,6 +17,7 @@
package com.epmet.dto.form;
+import com.epmet.commons.tools.validator.group.CustomerClientShowGroup;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
@@ -33,23 +34,48 @@ import java.io.Serializable;
public class EditAgencyFormDTO implements Serializable {
private static final long serialVersionUID = 1L;
+ public interface AddUserInternalGroup {
+ }
+
+ public interface DefaultUserShowGroup extends CustomerClientShowGroup {
+ }
+
+ public interface AreaCodeGroup extends CustomerClientShowGroup {
+ }
/**
* 机关组织Id
*/
- @NotBlank(message = "机关组织ID不能为空")
+ @NotBlank(message = "机关组织ID不能为空", groups = AddUserInternalGroup.class)
private String agencyId;
/**
* 机关组织名称
*/
@NotBlank(message = "机关组织名称不能为空")
- @Length(max=50,message = "机构名称不能超过50个字")
+ @Length(max=50,message = "机构名称不能超过50个字",groups = DefaultUserShowGroup.class)
private String agencyName;
/**
* token中用户Id
*/
+ @NotBlank(message = "tokenDto获取userId为空", groups = AddUserInternalGroup.class)
private String userId;
+ //2021.04.16 area_code需求 新增入参
+ /**
+ * open: 选择地区编码必填;closed: 无需选择地区编码;0409新增返参
+ */
+ @NotBlank(message = "areaCodeSwitch不能为空", groups = AddUserInternalGroup.class)
+ private String areaCodeSwitch;
+
+ /**
+ * 地区编码
+ */
+ @NotBlank(message = "请选择组织区划", groups = AreaCodeGroup.class)
+ private String areaCode;
+
+ //区域编码名称
+ @NotBlank(message = "", groups = AreaCodeGroup.class)
+ private String areaName;
}
\ No newline at end of file
diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/AgencyController.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/AgencyController.java
index 74e095de3e..ddd60b569a 100644
--- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/AgencyController.java
+++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/AgencyController.java
@@ -93,13 +93,13 @@ public class AgencyController {
**/
@PostMapping("addagency-v2")
@RequirePermission(requirePermission = RequirePermissionEnum.ORG_SUBAGENCY_CREATE)
- public Result addAgencyV2(@RequestBody AddAgencyV2FormDTO formDTO) {
+ public Result addAgencyV2(@LoginUser TokenDto tokenDTO,@RequestBody AddAgencyV2FormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, AddAgencyV2FormDTO.DefaultUserShowGroup.class, AddAgencyV2FormDTO.AddUserInternalGroup.class);
if (formDTO.getAreaCodeSwitch().equals(CustomerAgencyConstant.AREA_CODE_SWITCH_OPEN)) {
ValidatorUtils.validateEntity(formDTO, AddAgencyV2FormDTO.AreaCodeGroup.class);
}
- //组织名称是否存在
- customerAgencyService.checkAgencyName(formDTO.getAgencyName());
+ //当前客户下,同级组织中,组织名称不允许重复
+ customerAgencyService.checkAgencyName(formDTO.getAgencyName(),tokenDTO.getCustomerId(),formDTO.getLevel(),null);
return new Result().ok(agencyService.addAgencyV2(formDTO));
}
@@ -127,7 +127,10 @@ public class AgencyController {
@RequirePermission(requirePermission = RequirePermissionEnum.ORG_AGENCY_UPDATE)
public Result editAgency(@LoginUser TokenDto tokenDTO, @RequestBody EditAgencyFormDTO formDTO) {
formDTO.setUserId(tokenDTO.getUserId());
- ValidatorUtils.validateEntity(formDTO);
+ ValidatorUtils.validateEntity(formDTO, EditAgencyFormDTO.DefaultUserShowGroup.class, EditAgencyFormDTO.AddUserInternalGroup.class);
+ if (formDTO.getAreaCodeSwitch().equals(CustomerAgencyConstant.AREA_CODE_SWITCH_OPEN)) {
+ ValidatorUtils.validateEntity(formDTO, EditAgencyFormDTO.AreaCodeGroup.class);
+ }
return agencyService.editAgency(formDTO);
}
diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerAgencyDao.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerAgencyDao.java
index f9742f72e3..bdc8814ff4 100644
--- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerAgencyDao.java
+++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerAgencyDao.java
@@ -225,5 +225,11 @@ public interface CustomerAgencyDao extends BaseDao {
**/
int delByAgencyId(@Param("agencyId") String agencyId, @Param("operateUserId") String operateUserId);
- List selectAgencyIdsByAreaCode(String areaCode);
+ List selectAgencyIdsByAreaCode(@Param("areaCode") String areaCode,
+ @Param("agencyId") String agencyId);
+
+ List checkAgencyName(@Param("agencyName") String agencyName,
+ @Param("customerId") String customerId,
+ @Param("level") String level,
+ @Param("agencyId") String agencyId);
}
\ No newline at end of file
diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java
index 464c46c8dc..59941f1f60 100644
--- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java
+++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java
@@ -235,5 +235,5 @@ public interface CustomerAgencyService extends BaseService
**/
OrganizeTreeResultDTO organizeTree(String agencyId);
- void checkAgencyName(String agencyName);
+ void checkAgencyName(String agencyName,String customerId,String level,String agencyId);
}
\ No newline at end of file
diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java
index e34fe06786..d3af8846f0 100644
--- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java
+++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java
@@ -51,7 +51,6 @@ import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.Arrays;
-import java.util.Date;
import java.util.List;
/**
@@ -133,9 +132,45 @@ public class AgencyServiceImpl implements AgencyService {
@Transactional(rollbackFor = Exception.class)
public Result editAgency(EditAgencyFormDTO formDTO) {
Result result = new Result();
- CustomerAgencyEntity entity = getUpdateEntity(formDTO);
+ CustomerAgencyEntity originalEntity = customerAgencyDao.selectById(formDTO.getAgencyId());
+ //当前客户下,同级组织中,组织名称不允许重复
+ customerAgencyService.checkAgencyName(formDTO.getAgencyName(),originalEntity.getCustomerId(),originalEntity.getLevel(),originalEntity.getId());
+
+ if (formDTO.getAreaCodeSwitch().equals(CustomerAgencyConstant.AREA_CODE_SWITCH_OPEN)) {
+ //开关开启,areaCode,areaName必填
+ if(!formDTO.getAreaCode().equals(originalEntity.getAreaCode())){
+ //重新选择了新的area_code
+ CustomerAgencyDTO parent = customerAgencyService.get(originalEntity.getPid());
+ if (null == parent ||StringUtils.isBlank(parent.getAreaCode())) {
+ throw new RenException(EpmetErrorCode.SET_PARENT_AREA_CODE.getCode(),EpmetErrorCode.SET_PARENT_AREA_CODE.getMsg());
+ }
+ originalEntity.setParentAreaCode(parent.getAreaCode());
+ if (!"other".equals(formDTO.getAreaCode())) {
+ //校验areaCode是否被使用过
+ List agencyIds = customerAgencyDao.selectAgencyIdsByAreaCode(formDTO.getAreaCode(),formDTO.getAgencyId());
+ if (CollectionUtils.isNotEmpty(agencyIds)) {
+ //已经被占用,提示
+ throw new RenException(EpmetErrorCode.AREA_CODE_ALREADY_EXISTS.getCode(), EpmetErrorCode.AREA_CODE_ALREADY_EXISTS.getMsg());
+ }
+ originalEntity.setAreaCode(formDTO.getAreaCode());
+ }else{
+ //如果选择的是other,需要自定义一个编码
+ AddAreaCodeFormDTO addAreaCodeFormDTO = new AddAreaCodeFormDTO();
+ addAreaCodeFormDTO.setCurrentAreaLevel(originalEntity.getLevel());
+ addAreaCodeFormDTO.setParentAreaCode(parent.getAreaCode());
+ addAreaCodeFormDTO.setName(formDTO.getAgencyName());
+ Result addAreaCodeResult = epmetCommonServiceOpenFeignClient.addAreaCode(addAreaCodeFormDTO);
+ if (!addAreaCodeResult.success() || StringUtils.isBlank(addAreaCodeResult.getData())) {
+ throw new RenException("自定义area_code异常" + addAreaCodeResult.getInternalMsg());
+ }
+ originalEntity.setAreaCode(addAreaCodeResult.getData());
+ }
+ }
+ }
+ originalEntity.setOrganizationName(formDTO.getAgencyName());
+
//1:更新当前组织信息
- if (customerAgencyDao.updateById(entity) < NumConstant.ONE) {
+ if (customerAgencyDao.updateById(originalEntity) < NumConstant.ONE) {
log.error(CustomerAgencyConstant.UPDATE_EXCEPTION);
throw new RenException(CustomerAgencyConstant.UPDATE_EXCEPTION);
}
@@ -148,7 +183,6 @@ public class AgencyServiceImpl implements AgencyService {
}
//3:循环组织列表,查询每一个组织的所有上级组织重新拼接所有上级名称(allParentName)字段值
List editList = new ArrayList<>();
- Date date = new Date();
agencyList.forEach(agency->{
//3-1:查询当前组织的所有上级组织
List listStr = Arrays.asList(agency.getPids().split(":"));
@@ -178,12 +212,6 @@ public class AgencyServiceImpl implements AgencyService {
return result;
}
- private CustomerAgencyEntity getUpdateEntity(EditAgencyFormDTO formDTO) {
- CustomerAgencyEntity entity = customerAgencyDao.selectById(formDTO.getAgencyId());
- entity.setOrganizationName(formDTO.getAgencyName());
- return entity;
- }
-
/**
* @param formDTO
* @return
@@ -429,7 +457,7 @@ public class AgencyServiceImpl implements AgencyService {
public AddAgencyResultDTO addAgencyV2(AddAgencyV2FormDTO formDTO) {
CustomerAgencyDTO parent = customerAgencyService.get(formDTO.getParentAgencyId());
if (null == parent) {
- throw new RenException(String.format("添加组织失败:没有找到跟组织信息,parentAgencyId=%s", formDTO.getParentAgencyId()));
+ throw new RenException(String.format("添加组织失败:没有找到上级组织信息,agencyId=%s", formDTO.getParentAgencyId()));
}
AddAgencyResultDTO resultDTO = new AddAgencyResultDTO();
resultDTO.setAreaCodeSwitch(formDTO.getAreaCodeSwitch());
@@ -438,7 +466,7 @@ public class AgencyServiceImpl implements AgencyService {
if (CustomerAgencyConstant.AREA_CODE_SWITCH_OPEN.equals(formDTO.getAreaCodeSwitch())) {
//校验areaCode是否被使用过
if (!"other".equals(formDTO.getAreaCode())) {
- List agencyIds = customerAgencyDao.selectAgencyIdsByAreaCode(insertEntity.getAreaCode());
+ List agencyIds = customerAgencyDao.selectAgencyIdsByAreaCode(insertEntity.getAreaCode(),null);
if (CollectionUtils.isNotEmpty(agencyIds)) {
//已经被占用,提示
throw new RenException(EpmetErrorCode.AREA_CODE_ALREADY_EXISTS.getCode(), EpmetErrorCode.AREA_CODE_ALREADY_EXISTS.getMsg());
diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java
index dc81a51b47..3753412331 100644
--- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java
+++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java
@@ -1060,10 +1060,8 @@ public class CustomerAgencyServiceImpl extends BaseServiceImpl wrapper = new QueryWrapper<>();
- wrapper.eq(StringUtils.isNotBlank(agencyName), "ORGANIZATION_NAME", agencyName);
- List entityList = baseDao.selectList(wrapper);
+ public void checkAgencyName(String agencyName,String customerId,String level,String agencyId) {
+ List entityList = baseDao.checkAgencyName(agencyName,customerId,level,agencyId);
if (CollectionUtils.isNotEmpty(entityList)) {
throw new RenException(EpmetErrorCode.AGENCY_NAME_ALREADY_EXISTS.getCode(), EpmetErrorCode.AGENCY_NAME_ALREADY_EXISTS.getMsg());
}
diff --git a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml
index 27d446f644..ea6f94a1e8 100644
--- a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml
+++ b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml
@@ -408,5 +408,23 @@
WHERE
ca.DEL_FLAG = '0'
AND ca.AREA_CODE = #{areaCode}
+
+ AND ca.id !=#{agencyId}
+
+
+
+
+ SELECT
+ ca.id
+ FROM
+ customer_agency ca
+ WHERE
+ ca.DEL_FLAG = '0'
+ AND ca.CUSTOMER_ID = #{customerId}
+ AND ca.ORGANIZATION_NAME = #{agencyName}
+ AND ca.`LEVEL` = #{level}
+
+ AND ca.id !=#{agencyId}
+
\ No newline at end of file
From 3d7e1af75cf2ce17d953efb18fac84920aec7da8 Mon Sep 17 00:00:00 2001
From: yinzuomei <576302893@qq.com>
Date: Fri, 16 Apr 2021 10:56:28 +0800
Subject: [PATCH 19/21] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=BB=84=E7=BB=87?=
=?UTF-8?q?=E4=BF=A1=E6=81=AF?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../com/epmet/dto/form/EditAgencyFormDTO.java | 19 -----------
.../epmet/controller/AgencyController.java | 3 --
.../epmet/service/impl/AgencyServiceImpl.java | 33 -------------------
3 files changed, 55 deletions(-)
diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/EditAgencyFormDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/EditAgencyFormDTO.java
index 0202ecd894..66984fc62e 100644
--- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/EditAgencyFormDTO.java
+++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/EditAgencyFormDTO.java
@@ -40,9 +40,6 @@ public class EditAgencyFormDTO implements Serializable {
public interface DefaultUserShowGroup extends CustomerClientShowGroup {
}
- public interface AreaCodeGroup extends CustomerClientShowGroup {
- }
-
/**
* 机关组织Id
*/
@@ -62,20 +59,4 @@ public class EditAgencyFormDTO implements Serializable {
@NotBlank(message = "tokenDto获取userId为空", groups = AddUserInternalGroup.class)
private String userId;
- //2021.04.16 area_code需求 新增入参
- /**
- * open: 选择地区编码必填;closed: 无需选择地区编码;0409新增返参
- */
- @NotBlank(message = "areaCodeSwitch不能为空", groups = AddUserInternalGroup.class)
- private String areaCodeSwitch;
-
- /**
- * 地区编码
- */
- @NotBlank(message = "请选择组织区划", groups = AreaCodeGroup.class)
- private String areaCode;
-
- //区域编码名称
- @NotBlank(message = "", groups = AreaCodeGroup.class)
- private String areaName;
}
\ No newline at end of file
diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/AgencyController.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/AgencyController.java
index ddd60b569a..b0ec95dfd2 100644
--- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/AgencyController.java
+++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/AgencyController.java
@@ -128,9 +128,6 @@ public class AgencyController {
public Result editAgency(@LoginUser TokenDto tokenDTO, @RequestBody EditAgencyFormDTO formDTO) {
formDTO.setUserId(tokenDTO.getUserId());
ValidatorUtils.validateEntity(formDTO, EditAgencyFormDTO.DefaultUserShowGroup.class, EditAgencyFormDTO.AddUserInternalGroup.class);
- if (formDTO.getAreaCodeSwitch().equals(CustomerAgencyConstant.AREA_CODE_SWITCH_OPEN)) {
- ValidatorUtils.validateEntity(formDTO, EditAgencyFormDTO.AreaCodeGroup.class);
- }
return agencyService.editAgency(formDTO);
}
diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java
index d3af8846f0..8134ff776a 100644
--- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java
+++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java
@@ -135,40 +135,7 @@ public class AgencyServiceImpl implements AgencyService {
CustomerAgencyEntity originalEntity = customerAgencyDao.selectById(formDTO.getAgencyId());
//当前客户下,同级组织中,组织名称不允许重复
customerAgencyService.checkAgencyName(formDTO.getAgencyName(),originalEntity.getCustomerId(),originalEntity.getLevel(),originalEntity.getId());
-
- if (formDTO.getAreaCodeSwitch().equals(CustomerAgencyConstant.AREA_CODE_SWITCH_OPEN)) {
- //开关开启,areaCode,areaName必填
- if(!formDTO.getAreaCode().equals(originalEntity.getAreaCode())){
- //重新选择了新的area_code
- CustomerAgencyDTO parent = customerAgencyService.get(originalEntity.getPid());
- if (null == parent ||StringUtils.isBlank(parent.getAreaCode())) {
- throw new RenException(EpmetErrorCode.SET_PARENT_AREA_CODE.getCode(),EpmetErrorCode.SET_PARENT_AREA_CODE.getMsg());
- }
- originalEntity.setParentAreaCode(parent.getAreaCode());
- if (!"other".equals(formDTO.getAreaCode())) {
- //校验areaCode是否被使用过
- List agencyIds = customerAgencyDao.selectAgencyIdsByAreaCode(formDTO.getAreaCode(),formDTO.getAgencyId());
- if (CollectionUtils.isNotEmpty(agencyIds)) {
- //已经被占用,提示
- throw new RenException(EpmetErrorCode.AREA_CODE_ALREADY_EXISTS.getCode(), EpmetErrorCode.AREA_CODE_ALREADY_EXISTS.getMsg());
- }
- originalEntity.setAreaCode(formDTO.getAreaCode());
- }else{
- //如果选择的是other,需要自定义一个编码
- AddAreaCodeFormDTO addAreaCodeFormDTO = new AddAreaCodeFormDTO();
- addAreaCodeFormDTO.setCurrentAreaLevel(originalEntity.getLevel());
- addAreaCodeFormDTO.setParentAreaCode(parent.getAreaCode());
- addAreaCodeFormDTO.setName(formDTO.getAgencyName());
- Result addAreaCodeResult = epmetCommonServiceOpenFeignClient.addAreaCode(addAreaCodeFormDTO);
- if (!addAreaCodeResult.success() || StringUtils.isBlank(addAreaCodeResult.getData())) {
- throw new RenException("自定义area_code异常" + addAreaCodeResult.getInternalMsg());
- }
- originalEntity.setAreaCode(addAreaCodeResult.getData());
- }
- }
- }
originalEntity.setOrganizationName(formDTO.getAgencyName());
-
//1:更新当前组织信息
if (customerAgencyDao.updateById(originalEntity) < NumConstant.ONE) {
log.error(CustomerAgencyConstant.UPDATE_EXCEPTION);
From bf753487ff7a813f475a82c631f5ddce11e53b0f Mon Sep 17 00:00:00 2001
From: yinzuomei <576302893@qq.com>
Date: Fri, 16 Apr 2021 11:09:45 +0800
Subject: [PATCH 20/21] agencyDetail
---
.../main/java/com/epmet/service/impl/AgencyServiceImpl.java | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java
index 8134ff776a..9cb313c547 100644
--- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java
+++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java
@@ -246,6 +246,7 @@ public class AgencyServiceImpl implements AgencyService {
parentList = customerAgencyDao.selectPAgencyById(listStr);
agencysResultDTO.setParentList(parentList);
agencysResultDTO.setAreaCodeSwitch(customerOrgParameterService.getAreaCodeSwitch(entity.getCustomerId()));
+ agencysResultDTO.setAreaName(StrConstant.EPMETY_STR);
//查询组织区划的名称
if (null != entity && StringUtils.isNotBlank(entity.getAreaCode())) {
switch (entity.getLevel()) {
@@ -271,6 +272,10 @@ public class AgencyServiceImpl implements AgencyService {
return new Result().ok(agencysResultDTO);
}
+ public static void main(String[] args) {
+ String m="1234";
+ System.out.println(m.equals("1234") ? "yes" : "no");
+ }
/**
* @param formDTO
* @return
From 54106eccd32dd8482cd39ed6e6c68dd41e1dcfd5 Mon Sep 17 00:00:00 2001
From: yinzuomei <576302893@qq.com>
Date: Fri, 16 Apr 2021 11:12:08 +0800
Subject: [PATCH 21/21] agencyDetail
---
.../src/main/java/com/epmet/service/impl/AgencyServiceImpl.java | 1 +
1 file changed, 1 insertion(+)
diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java
index 9cb313c547..e83b78ba77 100644
--- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java
+++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java
@@ -247,6 +247,7 @@ public class AgencyServiceImpl implements AgencyService {
agencysResultDTO.setParentList(parentList);
agencysResultDTO.setAreaCodeSwitch(customerOrgParameterService.getAreaCodeSwitch(entity.getCustomerId()));
agencysResultDTO.setAreaName(StrConstant.EPMETY_STR);
+ agencysResultDTO.setAreaCode(StringUtils.isNotBlank(entity.getAreaCode())?entity.getAreaCode():StrConstant.EPMETY_STR);
//查询组织区划的名称
if (null != entity && StringUtils.isNotBlank(entity.getAreaCode())) {
switch (entity.getLevel()) {