From 75f1896054480483176cd1c7021f44810467ff72 Mon Sep 17 00:00:00 2001 From: HAHA Date: Tue, 14 Jun 2022 16:09:03 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E7=94=A8ruoyi=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E8=8E=B7=E5=8F=96wgh=5Fsqxx=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dto/constant/CaWghDataConstant.java | 3 +- .../controller/WghSqxxController.java | 15 +++- .../com/epmet/opendata/dao/WghSqxxDao.java | 1 + .../opendata/service/WghSqxxService.java | 11 +++ .../impl/GuardarDatosTaskServiceImpl.java | 7 ++ .../service/impl/WghSqxxServiceImpl.java | 86 +++++++++++++++++++ .../src/main/resources/mapper/WghSqxxDao.xml | 3 + 7 files changed, 124 insertions(+), 2 deletions(-) diff --git a/epmet-module/open-data-worker/open-data-worker-client/src/main/java/com/epmet/opendata/dto/constant/CaWghDataConstant.java b/epmet-module/open-data-worker/open-data-worker-client/src/main/java/com/epmet/opendata/dto/constant/CaWghDataConstant.java index c3f83ace8a..66f8395df5 100644 --- a/epmet-module/open-data-worker/open-data-worker-client/src/main/java/com/epmet/opendata/dto/constant/CaWghDataConstant.java +++ b/epmet-module/open-data-worker/open-data-worker-client/src/main/java/com/epmet/opendata/dto/constant/CaWghDataConstant.java @@ -28,7 +28,8 @@ public interface CaWghDataConstant { String SHARE_WGH_JQZ = "wgh_jqz"; String SHARE_WGH_JXCS = "wgh_jxcs"; String SHARE_WGH_JYZ = "wgh_jyz"; - String SHARE_WGH_SJXX = "wgh_sjxx"; + String SHARE_WGH_SJXX = "wgh_sjxxb"; + String SHARE_WGH_SQXX = "wgh_sqxx"; String DATA_URL_UNICON = "http://120.221.72.83:9090/bridge/unicom/page"; String DATA_URL_SHARE = "http://120.221.72.83:9090/bridge/share/sharePage"; diff --git a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/controller/WghSqxxController.java b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/controller/WghSqxxController.java index 8e5b513d15..1c36726db0 100644 --- a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/controller/WghSqxxController.java +++ b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/controller/WghSqxxController.java @@ -9,6 +9,7 @@ import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.commons.tools.validator.group.AddGroup; import com.epmet.commons.tools.validator.group.DefaultGroup; import com.epmet.commons.tools.validator.group.UpdateGroup; +import com.epmet.opendata.dto.form.PreserVationFormDTO; import com.epmet.opendata.dto.wgh.WghSqxxDTO; import com.epmet.opendata.excel.WghSqxxExcel; import com.epmet.opendata.service.WghSqxxService; @@ -77,6 +78,18 @@ public class WghSqxxController { ExcelUtils.exportExcelToTarget(response, null, list, WghSqxxExcel.class); } - + /** + * 调用ruoyi接口获取wgh_sqxx数据 + * + * @param dto + * @return com.epmet.commons.tools.utils.Result + * @author LZN + * @date 2022/6/14 16:08 + */ + @PostMapping("/preserWghSqxxVation") + public Result getPreserWghSqxxVation(@RequestBody PreserVationFormDTO dto) { + wghSqxxService.getPreserWghSqxxVation(dto); + return new Result(); + } } diff --git a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/dao/WghSqxxDao.java b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/dao/WghSqxxDao.java index 53b16dfb73..8a75f69fde 100644 --- a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/dao/WghSqxxDao.java +++ b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/dao/WghSqxxDao.java @@ -14,4 +14,5 @@ import org.apache.ibatis.annotations.Mapper; @Mapper public interface WghSqxxDao extends BaseDao { + int deleteAll(); } diff --git a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/WghSqxxService.java b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/WghSqxxService.java index 8b2f86155c..93a9a297b4 100644 --- a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/WghSqxxService.java +++ b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/WghSqxxService.java @@ -2,6 +2,7 @@ package com.epmet.opendata.service; import com.epmet.commons.mybatis.service.BaseService; import com.epmet.commons.tools.page.PageData; +import com.epmet.opendata.dto.form.PreserVationFormDTO; import com.epmet.opendata.dto.wgh.WghSqxxDTO; import com.epmet.opendata.entity.WghSqxxEntity; @@ -76,4 +77,14 @@ public interface WghSqxxService extends BaseService { * @date 2022-06-14 */ void delete(String[] ids); + + /** + * 调用ruoyi接口获取wgh_sqxx数据 + * + * @param dto + * @return void + * @author LZN + * @date 2022/6/14 16:08 + */ + void getPreserWghSqxxVation(PreserVationFormDTO dto); } diff --git a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/GuardarDatosTaskServiceImpl.java b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/GuardarDatosTaskServiceImpl.java index 97ade4add6..5207614dd2 100644 --- a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/GuardarDatosTaskServiceImpl.java +++ b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/GuardarDatosTaskServiceImpl.java @@ -53,6 +53,9 @@ public class GuardarDatosTaskServiceImpl implements GuardarDatosTaskService { @Autowired private WghSjxxbService wghSjxxbService; + @Autowired + private WghSqxxService wghSqxxService; + @Override public void guardarDatosTask(PreserVationFormDTO dto) { if (StringUtils.isBlank(dto.getTableName())) { @@ -69,6 +72,7 @@ public class GuardarDatosTaskServiceImpl implements GuardarDatosTaskService { wghJxcsService.preserWghJxcsVation(dto); wghJyzService.getPreserWghJyzVation(dto); wghSjxxbService.getPreserSjxxVation(dto); + wghSqxxService.getPreserWghSqxxVation(dto); } else { switch (dto.getTableName()) { @@ -114,6 +118,9 @@ public class GuardarDatosTaskServiceImpl implements GuardarDatosTaskService { case CaWghDataConstant.SHARE_WGH_SJXX: wghSjxxbService.getPreserSjxxVation(dto); break; + case CaWghDataConstant.SHARE_WGH_SQXX: + wghSqxxService.getPreserWghSqxxVation(dto); + break; } } } diff --git a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/WghSqxxServiceImpl.java b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/WghSqxxServiceImpl.java index 791f65fcb7..496cff2a62 100644 --- a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/WghSqxxServiceImpl.java +++ b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/WghSqxxServiceImpl.java @@ -1,16 +1,25 @@ package com.epmet.opendata.service.impl; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; 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.NumConstant; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.commons.tools.utils.HttpClientManager; +import com.epmet.commons.tools.utils.Result; import com.epmet.opendata.dao.WghSqxxDao; +import com.epmet.opendata.dto.constant.CaWghDataConstant; +import com.epmet.opendata.dto.form.PreserVationFormDTO; import com.epmet.opendata.dto.wgh.WghSqxxDTO; +import com.epmet.opendata.entity.CaLoudongEntity; import com.epmet.opendata.entity.WghSqxxEntity; import com.epmet.opendata.redis.WghSqxxRedis; import com.epmet.opendata.service.WghSqxxService; +import com.epmet.opendata.util.AesUtils; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -84,4 +93,81 @@ public class WghSqxxServiceImpl extends BaseServiceImpl= 0) { + dto.setPageNo(NumConstant.ONE); + dto.setPageSize(NumConstant.FIFTY); + dto.setTableSchema(CaWghDataConstant.TABLESCHEMA_SHARE); + dto.setTableName(CaWghDataConstant.SHARE_WGH_SQXX); + + dto.setWhereCase("1=1"); + dto.setOrderBy("OBJECTID,街道编码,社区编码,insert_time"); + + int pageNo = 1; + + int total = 0; + + do { + try { + total = listWghSqxx(dto); + pageNo++; + dto.setPageNo(pageNo); + } catch (Exception e) { + e.printStackTrace(); + } + } while (total > (pageNo * NumConstant.FIFTY)); + } + + } + + + private int listWghSqxx(PreserVationFormDTO dto) throws Exception { + String aes = AesUtils.encryptByAES(JSONObject.toJSONString(dto), CaWghDataConstant.AESKEY); + JSONObject obj = new JSONObject(); + obj.put(CaWghDataConstant.SHARE_CONDITION, aes); + String data = HttpClientManager.getInstance().sendPostByJSON(CaWghDataConstant.DATA_URL_SHARE, obj.toJSONString()).getData(); + JSONObject toResult = JSON.parseObject(data); + Result result = ConvertUtils.mapToEntity(toResult, Result.class); + if (!result.success()) { + return dto.getPageNo() + 1; + } + + ReturnDate returnDate = JSONObject.parseObject(JSONObject.toJSONString(result.getData()), ReturnDate.class); + this.insertBatch(returnDate.getList()); + return returnDate.getTotal(); + } + + static class ReturnDate { + + private int total; + private List list; + + + public int getTotal() { + return total; + } + + public void setTotal(int total) { + this.total = total; + } + + public List getList() { + return list; + } + + public void setList(List list) { + this.list = list; + } + } + } diff --git a/epmet-module/open-data-worker/open-data-worker-server/src/main/resources/mapper/WghSqxxDao.xml b/epmet-module/open-data-worker/open-data-worker-server/src/main/resources/mapper/WghSqxxDao.xml index fd055baeb0..2987884be1 100644 --- a/epmet-module/open-data-worker/open-data-worker-server/src/main/resources/mapper/WghSqxxDao.xml +++ b/epmet-module/open-data-worker/open-data-worker-server/src/main/resources/mapper/WghSqxxDao.xml @@ -29,6 +29,9 @@ + + delete from wgh_sqxx +