From db60d01170e541685c41b25200b335d728ffab68 Mon Sep 17 00:00:00 2001 From: HAHA Date: Tue, 14 Jun 2022 16:34:31 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E7=94=A8ruoyi=E7=B3=BB=E7=BB=9F?= =?UTF-8?q?=E8=8E=B7=E5=8F=96wgh=5Fwhpdw=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 | 1 + .../controller/WghWhpdwController.java | 15 +++- .../com/epmet/opendata/dao/WghWhpdwDao.java | 1 + .../opendata/service/WghWhpdwService.java | 11 +++ .../impl/GuardarDatosTaskServiceImpl.java | 7 ++ .../service/impl/WghWhpdwServiceImpl.java | 86 +++++++++++++++++++ .../src/main/resources/mapper/WghWhpdwDao.xml | 3 + 7 files changed, 123 insertions(+), 1 deletion(-) 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 93661f72c9..362d920dbf 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 @@ -32,6 +32,7 @@ public interface CaWghDataConstant { String SHARE_WGH_SQXX = "wgh_sqxx"; String SHARE_WGH_SZCGWGH = "wgh_szcgwgh"; String SHARE_WGH_SZZRWG = "wgh_szzrwg"; + String SHARE_WGH_WHPDW = "wgh_whpdw"; 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/WghWhpdwController.java b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/controller/WghWhpdwController.java index 2a7a81f156..9381038398 100644 --- a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/controller/WghWhpdwController.java +++ b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/controller/WghWhpdwController.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.UpdateGroup; import com.epmet.commons.tools.validator.group.DefaultGroup; +import com.epmet.opendata.dto.form.PreserVationFormDTO; import com.epmet.opendata.dto.wgh.WghWhpdwDTO; import com.epmet.opendata.excel.WghWhpdwExcel; import com.epmet.opendata.service.WghWhpdwService; @@ -77,6 +78,18 @@ public class WghWhpdwController { ExcelUtils.exportExcelToTarget(response, null, list, WghWhpdwExcel.class); } - + /** + * 调用ruoyi系统获取wgh_whpdw数据 + * + * @param dto + * @return com.epmet.commons.tools.utils.Result + * @author LZN + * @date 2022/6/14 16:33 + */ + @PostMapping("/preserWhpdwVation") + public Result getPreserWhpdwVation(@RequestBody PreserVationFormDTO dto) { + wghWhpdwService.getPreserWhpdwVation(dto); + return new Result(); + } } diff --git a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/dao/WghWhpdwDao.java b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/dao/WghWhpdwDao.java index 98ab1ed32c..cffef5c3f0 100644 --- a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/dao/WghWhpdwDao.java +++ b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/dao/WghWhpdwDao.java @@ -13,4 +13,5 @@ import org.apache.ibatis.annotations.Mapper; @Mapper public interface WghWhpdwDao extends BaseDao { + int deleteAll(); } diff --git a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/WghWhpdwService.java b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/WghWhpdwService.java index 44469f2890..16214aeb9f 100644 --- a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/WghWhpdwService.java +++ b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/WghWhpdwService.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.WghWhpdwDTO; import com.epmet.opendata.entity.WghWhpdwEntity; @@ -76,4 +77,14 @@ public interface WghWhpdwService extends BaseService { * @date 2022-06-14 */ void delete(String[] ids); + + /** + * 调用ruoyi系统获取wgh_whpdw数据 + * + * @param dto + * @return void + * @author LZN + * @date 2022/6/14 16:34 + */ + void getPreserWhpdwVation(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 57114cbec3..3c6c61cab6 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 @@ -62,6 +62,9 @@ public class GuardarDatosTaskServiceImpl implements GuardarDatosTaskService { @Autowired private WghSzzrwgService wghSzzrwgService; + @Autowired + private WghWhpdwService wghWhpdwService; + @Override public void guardarDatosTask(PreserVationFormDTO dto) { if (StringUtils.isBlank(dto.getTableName())) { @@ -81,6 +84,7 @@ public class GuardarDatosTaskServiceImpl implements GuardarDatosTaskService { wghSqxxService.getPreserWghSqxxVation(dto); wghSzcgwghService.getPreserWghSzcgwghVation(dto); wghSzzrwgService.getPreserWghSzzrwgVation(dto); + wghWhpdwService.getPreserWhpdwVation(dto); } else { switch (dto.getTableName()) { @@ -135,6 +139,9 @@ public class GuardarDatosTaskServiceImpl implements GuardarDatosTaskService { case CaWghDataConstant.SHARE_WGH_SZZRWG: wghSzzrwgService.getPreserWghSzzrwgVation(dto); break; + case CaWghDataConstant.SHARE_WGH_WHPDW: + wghWhpdwService.getPreserWhpdwVation(dto); + break; } } } diff --git a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/WghWhpdwServiceImpl.java b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/WghWhpdwServiceImpl.java index b2e05da08a..785493b305 100644 --- a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/WghWhpdwServiceImpl.java +++ b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/WghWhpdwServiceImpl.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.WghWhpdwDao; +import com.epmet.opendata.dto.constant.CaWghDataConstant; +import com.epmet.opendata.dto.form.PreserVationFormDTO; import com.epmet.opendata.dto.wgh.WghWhpdwDTO; +import com.epmet.opendata.entity.CaLoudongEntity; import com.epmet.opendata.entity.WghWhpdwEntity; import com.epmet.opendata.redis.WghWhpdwRedis; import com.epmet.opendata.service.WghWhpdwService; +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 WghWhpdwServiceImpl extends BaseServiceImpl= 0) { + dto.setPageNo(NumConstant.ONE); + dto.setPageSize(NumConstant.FIFTY); + dto.setTableSchema(CaWghDataConstant.TABLESCHEMA_SHARE); + dto.setTableName(CaWghDataConstant.SHARE_WGH_WHPDW); + + dto.setWhereCase("1=1"); + dto.setOrderBy("OBJECTID,XH,GRADE,insert_time"); + + int pageNo = 1; + + int total = 0; + + do { + try { + total = listWghWhpdw(dto); + pageNo++; + dto.setPageNo(pageNo); + } catch (Exception e) { + e.printStackTrace(); + } + } while (total > (pageNo * NumConstant.FIFTY)); + } + + } + + + private int listWghWhpdw(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/WghWhpdwDao.xml b/epmet-module/open-data-worker/open-data-worker-server/src/main/resources/mapper/WghWhpdwDao.xml index d4c41c8e94..3c5a295dc3 100644 --- a/epmet-module/open-data-worker/open-data-worker-server/src/main/resources/mapper/WghWhpdwDao.xml +++ b/epmet-module/open-data-worker/open-data-worker-server/src/main/resources/mapper/WghWhpdwDao.xml @@ -28,6 +28,9 @@ + + delete from wgh_whpdw +