orgIdList;
/**
- * 操作类型【新增:add 修改删除:edit】
+ * 操作类型【新增:add 修改删除:edit 初始化所有数据:all】
*/
private String type;
diff --git a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/dao/ExDeptDao.java b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/dao/ExDeptDao.java
new file mode 100644
index 0000000000..fa088c958f
--- /dev/null
+++ b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/dao/ExDeptDao.java
@@ -0,0 +1,55 @@
+/**
+ * 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.opendata.dao;
+
+import com.epmet.commons.mybatis.dao.BaseDao;
+import com.epmet.opendata.entity.BaseGridInfoEntity;
+import com.epmet.opendata.entity.ExDeptEntity;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * 网格基础信息表
+ *
+ * @author generator generator@elink-cn.com
+ * @since v1.0.0 2021-10-15
+ */
+@Mapper
+public interface ExDeptDao extends BaseDao {
+
+ /**
+ * @Author sun
+ * @Description 网格基础信息批量更新部分字段
+ **/
+ int updateBatch(@Param("list") List entityList);
+
+ /**
+ * @Author sun
+ * @Description 网格基础信息批量更新部分字段
+ **/
+ int insertBatch(@Param("list") List entityList);
+
+ /**
+ * @Author sun
+ * @Description 网格基础信息批量更新部分字段
+ **/
+ int updateBatchGrid(@Param("list") List entityList);
+
+}
\ No newline at end of file
diff --git a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/entity/ExDeptEntity.java b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/entity/ExDeptEntity.java
new file mode 100644
index 0000000000..ecda9e6b11
--- /dev/null
+++ b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/entity/ExDeptEntity.java
@@ -0,0 +1,53 @@
+/**
+ * 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.opendata.entity;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.epmet.commons.mybatis.entity.BaseEpmetEntity;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * 部门(网格)中间表
+ *
+ * @author generator generator@elink-cn.com
+ * @since v1.0.0 2021-10-15
+ */
+@Data
+@EqualsAndHashCode(callSuper=false)
+@TableName("ex_dept")
+public class ExDeptEntity extends BaseEpmetEntity {
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * (区县平台)部门id
+ */
+ private String deptIdQx;
+
+ /**
+ * (区县平台)部门/网格名称
+ */
+ private String deptNameQx;
+
+ /**
+ * 部门/网格编码
+ */
+ private String gridCode;
+
+}
diff --git a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/BaseGridInfoServiceImpl.java b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/BaseGridInfoServiceImpl.java
index 1d4f4a1e17..7802dfc707 100644
--- a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/BaseGridInfoServiceImpl.java
+++ b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/BaseGridInfoServiceImpl.java
@@ -18,14 +18,17 @@
package com.epmet.opendata.service.impl;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
+import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.org.result.CustomerAgencyDTO;
import com.epmet.dto.org.result.CustomerGridDTO;
import com.epmet.feign.DataStatisticalOpenFeignClient;
import com.epmet.opendata.dao.BaseGridInfoDao;
+import com.epmet.opendata.dao.ExDeptDao;
import com.epmet.opendata.dto.form.GridBaseInfoFormDTO;
import com.epmet.opendata.entity.BaseGridInfoEntity;
+import com.epmet.opendata.entity.ExDeptEntity;
import com.epmet.opendata.service.BaseGridInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -44,6 +47,8 @@ import java.util.List;
public class BaseGridInfoServiceImpl extends BaseServiceImpl implements BaseGridInfoService {
@Autowired
private DataStatisticalOpenFeignClient dataStatisticalOpenFeignClient;
+ @Autowired
+ private ExDeptDao exDeptDao;
/**
* @Author sun
@@ -52,13 +57,16 @@ public class BaseGridInfoServiceImpl extends BaseServiceImpl> result = dataStatisticalOpenFeignClient.getAgencyBaseInfo(formDTO);
if (!result.success()) {
throw new RenException(result.getInternalMsg());
}
+ if (null == result.getData() || result.getData().size() < NumConstant.ONE) {
+ return;
+ }
//2.中间库新增/修改数据
- List entityList = new ArrayList<>();
+ /*List entityList = new ArrayList<>();
result.getData().forEach(ag->{
BaseGridInfoEntity entity = new BaseGridInfoEntity();
entity.setCustomerId(ag.getCustomerId());
@@ -76,13 +84,22 @@ public class BaseGridInfoServiceImpl extends BaseServiceImpl ExList = new ArrayList<>();
+ result.getData().forEach(ag->{
+ ExDeptEntity entity = new ExDeptEntity();
+ entity.setDeptIdQx(ag.getId());
+ entity.setDeptNameQx(ag.getOrganizationName());
+ entity.setGridCode(ag.getCode());
+ ExList.add(entity);
});
- if("add".equals(formDTO.getType())){
- insertBatch(entityList);
+ if(null!=formDTO.getType()&& "all".equals(formDTO.getType())){
+ exDeptDao.updateBatch(ExList);
}else {
- baseDao.updateBatch(entityList);
+ exDeptDao.insertBatch(ExList);
}
+
}
/**
@@ -97,8 +114,11 @@ public class BaseGridInfoServiceImpl extends BaseServiceImpl entityList = new ArrayList<>();
+ /*List entityList = new ArrayList<>();
result.getData().forEach(ag->{
BaseGridInfoEntity entity = new BaseGridInfoEntity();
entity.setCustomerId(ag.getCustomerId());
@@ -111,11 +131,19 @@ public class BaseGridInfoServiceImpl extends BaseServiceImpl ExList = new ArrayList<>();
+ result.getData().forEach(ag -> {
+ ExDeptEntity entity = new ExDeptEntity();
+ entity.setDeptIdQx(ag.getId());
+ entity.setDeptNameQx(ag.getGridName());
+ entity.setGridCode(ag.getCode());
+ ExList.add(entity);
});
- if("add".equals(formDTO.getType())){
- insertBatch(entityList);
- }else {
- baseDao.updateBatch(entityList);
+ if (null != formDTO.getType() && "all".equals(formDTO.getType())) {
+ exDeptDao.updateBatchGrid(ExList);
+ } else {
+ exDeptDao.insertBatch(ExList);
}
}
diff --git a/epmet-module/open-data-worker/open-data-worker-server/src/main/resources/mapper/ExDeptDao.xml b/epmet-module/open-data-worker/open-data-worker-server/src/main/resources/mapper/ExDeptDao.xml
new file mode 100644
index 0000000000..9090a77af5
--- /dev/null
+++ b/epmet-module/open-data-worker/open-data-worker-server/src/main/resources/mapper/ExDeptDao.xml
@@ -0,0 +1,82 @@
+
+
+
+
+
+
+ UPDATE ex_dept
+
+
+
+
+
+ when grid_code = #{item.gridCode} then #{item.deptIdQx}
+
+
+
+
+
+
+
+ when grid_code = #{item.gridCode} then #{item.deptNameQx}
+
+
+
+
+
+ WHERE
+ 1=1
+
+ grid_code = #{item.gridCode}
+
+
+
+
+ INSERT INTO ex_dept
+ (
+ dept_id_qx,
+ dept_name_qx
+ )
+ VALUES
+
+ (
+ #{i.deptIdQx},
+ #{i.deptNameQx}
+ )
+
+ ON DUPLICATE KEY
+ UPDATE
+ dept_id_qx = values(dept_id_qx),
+ dept_name_qx = values(dept_name_qx)
+
+
+
+ UPDATE ex_dept
+
+
+
+
+
+ when dept_name LIKE CONCAT(left(#{item.deptNameQx},2),'%',right(#{item.deptNameQx},2),if(LOCATE('第二', #{item.deptNameQx})>0,'%2','%1')) then #{item.deptIdQx}
+
+
+
+
+
+
+
+ when dept_name LIKE CONCAT(left(#{item.deptNameQx},2),'%',right(#{item.deptNameQx},2),if(LOCATE('第二', #{item.deptNameQx})>0,'%2','%1')) then #{item.deptNameQx}
+
+
+
+
+
+ WHERE
+ 1=1
+
+ dept_name LIKE CONCAT(left(#{item.deptNameQx},2),'%',right(#{item.deptNameQx},2),if(LOCATE('第二', #{item.deptNameQx})>0,'%2','%1'))
+
+
+
+
+
\ No newline at end of file