diff --git a/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/messages/OrgOrStaffMQMsg.java b/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/messages/OrgOrStaffMQMsg.java
index 14a5a24ff8..bda7f50a7a 100644
--- a/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/messages/OrgOrStaffMQMsg.java
+++ b/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/messages/OrgOrStaffMQMsg.java
@@ -18,6 +18,7 @@ public class OrgOrStaffMQMsg implements Serializable {
//数据类型【组织:agency 网格:grid 人员:staff】
private String orgType;
//操作类型【组织新增:agency_create 组织变更:agency_change 网格新增:grid_create 网格变更:grid_change 人员新增:staff_create 人员变更:staff_change】
+ //删除网格:grid_delete;删除组织:agency_delete
private String type;
diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/NumConstant.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/NumConstant.java
index 95158b2929..1f0d76e14f 100644
--- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/NumConstant.java
+++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/NumConstant.java
@@ -49,6 +49,8 @@ public interface NumConstant {
BigDecimal ONE_HUNDRED_DECIMAL = new BigDecimal(100);
BigDecimal ZERO_DECIMAL = new BigDecimal(0);
int ONE_THOUSAND = 1000;
+ int TEN_THOUSAND = 10000;
+
int THREE_THOUSAND = 3000;
int MAX = 99999999;
int EIGHTY_EIGHT = 88;
diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/org/form/GridBaseInfoFormDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/org/form/GridBaseInfoFormDTO.java
index 9d39ef6b81..768fad2827 100644
--- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/org/form/GridBaseInfoFormDTO.java
+++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/org/form/GridBaseInfoFormDTO.java
@@ -28,7 +28,7 @@ public class GridBaseInfoFormDTO implements Serializable {
* 操作类型【新增:add 修改删除:edit 初始化所有数据:all】
*/
private String type;
-
+ private String delFlag;
public interface Grid extends CustomerClientShowGroup {}
}
diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/CustomerGridDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/CustomerGridDao.xml
index 5d6dc4042c..edab6411d7 100644
--- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/CustomerGridDao.xml
+++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/CustomerGridDao.xml
@@ -158,8 +158,10 @@
*
FROM
customer_grid
- WHERE del_flag = '0'
- AND customer_id = #{customerId}
+ WHERE customer_id = #{customerId}
+
+ AND del_flag = #{delFlag}
+
and CODE is not null
and CODE !=''
and grid_name not like '%专属网格'
diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/StatsCustomerAgencyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/StatsCustomerAgencyDao.xml
index 105a4efcc7..fec3627bc0 100644
--- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/StatsCustomerAgencyDao.xml
+++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/StatsCustomerAgencyDao.xml
@@ -214,10 +214,12 @@
*
FROM
customer_agency
- WHERE del_flag = '0'
- AND customer_id = #{customerId}
+ WHERE customer_id = #{customerId}
and CODE is not null
and CODE !=''
+
+ AND del_flag = #{delFlag}
+
#{agencyId}
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 ae07816fa2..893bc95cda 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
@@ -201,7 +201,16 @@ public class AgencyController {
public Result removeAgency(@LoginUser TokenDto tokenDTO, @RequestBody RemoveAgencyFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO);
formDTO.setCustomerId(tokenDTO.getCustomerId());
- return agencyService.removeAgency(formDTO);
+ Result result= agencyService.removeAgency(formDTO);
+ //2021-11-30 推送mq,数据同步到中介库 start
+ OrgOrStaffMQMsg mq = new OrgOrStaffMQMsg();
+ mq.setCustomerId(tokenDTO.getCustomerId());
+ mq.setOrgId(formDTO.getAgencyId());
+ mq.setOrgType("agency");
+ mq.setType("agency_delete");
+ SendMqMsgUtil.build().openFeignClient(epmetMessageOpenFeignClient).sendOrgStaffMqMsg(mq);
+ //2021-11-30 end
+ return result;
}
/**
diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/GridController.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/GridController.java
index 8f026e9f44..171197d40e 100644
--- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/GridController.java
+++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/GridController.java
@@ -100,7 +100,18 @@ public class GridController {
@RequirePermission(requirePermission = RequirePermissionEnum.ORG_GRID_DELETE)
public Result deleteGrid(@LoginUser TokenDto tokenDto, @RequestBody DeleteGridFormDTO deleteGridFormDTO){
deleteGridFormDTO.setCustomerId(tokenDto.getCustomerId());
- return customerGridService.deleteGrid(tokenDto,deleteGridFormDTO);
+ Result result =customerGridService.deleteGrid(tokenDto,deleteGridFormDTO);
+ //2021-10-18 推送mq,数据同步到中介库 start
+ if (result.success()) {
+ OrgOrStaffMQMsg mq = new OrgOrStaffMQMsg();
+ mq.setCustomerId(tokenDto.getCustomerId());
+ mq.setOrgId(deleteGridFormDTO.getGridId());
+ mq.setOrgType("grid");
+ mq.setType("grid_delete");
+ SendMqMsgUtil.build().openFeignClient(epmetMessageOpenFeignClient).sendOrgStaffMqMsg(mq);
+ }
+ //2021-10-18 end
+ return result;
}
/**
diff --git a/epmet-module/open-data-worker/open-data-worker-client/src/main/java/com/epmet/opendata/dto/constant/DataWorkerConstant.java b/epmet-module/open-data-worker/open-data-worker-client/src/main/java/com/epmet/opendata/dto/constant/DataWorkerConstant.java
new file mode 100644
index 0000000000..df1781038f
--- /dev/null
+++ b/epmet-module/open-data-worker/open-data-worker-client/src/main/java/com/epmet/opendata/dto/constant/DataWorkerConstant.java
@@ -0,0 +1,8 @@
+package com.epmet.opendata.dto.constant;
+
+public interface DataWorkerConstant {
+ String ALL = "all";
+ String CREATE = "create";
+ String CHANGE = "change";
+ String DELETE = "delete";
+}
diff --git a/epmet-module/open-data-worker/open-data-worker-client/src/main/java/com/epmet/opendata/dto/form/ExractGridInfoPingYinFormDTO.java b/epmet-module/open-data-worker/open-data-worker-client/src/main/java/com/epmet/opendata/dto/form/ExractGridInfoPingYinFormDTO.java
index b4324bb2ee..970f98e1ab 100644
--- a/epmet-module/open-data-worker/open-data-worker-client/src/main/java/com/epmet/opendata/dto/form/ExractGridInfoPingYinFormDTO.java
+++ b/epmet-module/open-data-worker/open-data-worker-client/src/main/java/com/epmet/opendata/dto/form/ExractGridInfoPingYinFormDTO.java
@@ -32,9 +32,9 @@ public class ExractGridInfoPingYinFormDTO implements Serializable {
/**
* 废弃:这个不对。操作类型【新增:add 修改删除:edit 初始化所有数据:all】
* 操作类型【组织新增:agency_create 组织变更:agency_change 网格新增:grid_create 网格变更:grid_change 人员新增:staff_create 人员变更:staff_change】
+ * 删除网格grid_delete,删除组织agency_delete
*/
@NotBlank(message = "操作类型【新增:add 修改删除:edit 初始化所有数据:all】不能为空", groups = {GridInfo.class})
-
private String type;
}
diff --git a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/dao/GridInfoPingyinDao.java b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/dao/GridInfoPingyinDao.java
index 0ae3ac01e9..986b8f2ff7 100755
--- a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/dao/GridInfoPingyinDao.java
+++ b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/dao/GridInfoPingyinDao.java
@@ -28,4 +28,6 @@ public interface GridInfoPingyinDao extends BaseDao {
@Param("gridLevel")Integer gridLevel,
@Param("lng")BigDecimal lng,
@Param("lat")BigDecimal lat);
+
+ int deleteByCode(String gridCode);
}
diff --git a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/GridInfoPingyinServiceImpl.java b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/GridInfoPingyinServiceImpl.java
index 454ef351fc..2f54aecee6 100755
--- a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/GridInfoPingyinServiceImpl.java
+++ b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/GridInfoPingyinServiceImpl.java
@@ -1,6 +1,7 @@
package com.epmet.opendata.service.impl;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
+import com.epmet.commons.tools.constant.Constant;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.utils.ConvertUtils;
@@ -10,11 +11,13 @@ import com.epmet.dto.org.result.CustomerAgencyDTO;
import com.epmet.dto.org.result.CustomerGridDTO;
import com.epmet.feign.DataStatisticalOpenFeignClient;
import com.epmet.opendata.dao.GridInfoPingyinDao;
+import com.epmet.opendata.dto.constant.DataWorkerConstant;
import com.epmet.opendata.dto.form.ExractGridInfoPingYinFormDTO;
import com.epmet.opendata.entity.GridInfoPingyinEntity;
import com.epmet.opendata.service.GridInfoPingyinService;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.ListUtils;
+import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -44,6 +47,15 @@ public class GridInfoPingyinServiceImpl extends BaseServiceImpl> result = dataStatisticalOpenFeignClient.getAgencyBaseInfo(formDTO1);
if (!result.success()) {
throw new RenException(result.getInternalMsg());
@@ -59,11 +71,11 @@ public class GridInfoPingyinServiceImpl extends BaseServiceImpl orginList = baseDao.selectByGridCode(entity.getGridCode());
+ if (CollectionUtils.isNotEmpty(orginList)) {
+ for (GridInfoPingyinEntity oigin : orginList) {
+ baseDao.deleteByCode(oigin.getGridCode());
+ }
+ }
+ }
}
}
@@ -115,6 +137,15 @@ public class GridInfoPingyinServiceImpl extends BaseServiceImpl> result = dataStatisticalOpenFeignClient.getGridBaseInfo(formDTO1);
if (!result.success()) {
throw new RenException(result.getInternalMsg());
@@ -145,7 +176,7 @@ public class GridInfoPingyinServiceImpl extends BaseServiceImpl {
this.insertBatch(list);
});
- } else if (formDTO.getType().contains("create")) {
+ } else if (formDTO.getType().contains(DataWorkerConstant.CREATE)) {
// 单独新增组织
this.insertBatch(gridInfoList);
- } else if (formDTO.getType().contains("change")) {
+ } else if (formDTO.getType().contains(DataWorkerConstant.CHANGE)) {
// 修改组织时,先根据code查询,如果有数据,更新
for (GridInfoPingyinEntity entity : gridInfoList) {
@@ -175,6 +206,16 @@ public class GridInfoPingyinServiceImpl extends BaseServiceImpl orginList = baseDao.selectByGridCode(entity.getGridCode());
+ if (CollectionUtils.isNotEmpty(orginList)) {
+ for (GridInfoPingyinEntity oigin : orginList) {
+ baseDao.deleteByCode(oigin.getGridCode());
+ }
+ }
+ }
}
}
diff --git a/epmet-module/open-data-worker/open-data-worker-server/src/main/resources/mapper/GridInfoPingyinDao.xml b/epmet-module/open-data-worker/open-data-worker-server/src/main/resources/mapper/GridInfoPingyinDao.xml
index a6f7c2ef5a..c79ef11f2a 100755
--- a/epmet-module/open-data-worker/open-data-worker-server/src/main/resources/mapper/GridInfoPingyinDao.xml
+++ b/epmet-module/open-data-worker/open-data-worker-server/src/main/resources/mapper/GridInfoPingyinDao.xml
@@ -44,4 +44,9 @@
lat = #{lat}
where grid_code = #{gridCode} and is_del = 'N'
+
+
+ update grid_info_pingyin set is_del = 'Y'
+ where grid_code = #{gridCode}
+