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 7970dc7226..c3f83ace8a 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,6 +28,7 @@ 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 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/WghSjxxbController.java b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/controller/WghSjxxbController.java index 512d3f19d4..4d3a6cd04b 100644 --- a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/controller/WghSjxxbController.java +++ b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/controller/WghSjxxbController.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.WghSjxxbDTO; import com.epmet.opendata.excel.WghSjxxbExcel; import com.epmet.opendata.service.WghSjxxbService; @@ -77,6 +78,18 @@ public class WghSjxxbController { ExcelUtils.exportExcelToTarget(response, null, list, WghSjxxbExcel.class); } - + /** + * 调用ruoyi接口获取wgh_sjxx数据 + * + * @param dto + * @return com.epmet.commons.tools.utils.Result + * @author LZN + * @date 2022/6/14 16:01 + */ + @PostMapping("/preserSjxxVation") + public Result getPreserSjxxVation(@RequestBody PreserVationFormDTO dto) { + wghSjxxbService.getPreserSjxxVation(dto); + return new Result(); + } } diff --git a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/dao/WghSjxxbDao.java b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/dao/WghSjxxbDao.java index 8734113bd2..d2806b93fe 100644 --- a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/dao/WghSjxxbDao.java +++ b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/dao/WghSjxxbDao.java @@ -13,4 +13,5 @@ import org.apache.ibatis.annotations.Mapper; @Mapper public interface WghSjxxbDao extends BaseDao { + int deleteAll(); } diff --git a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/WghSjxxbService.java b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/WghSjxxbService.java index 260daf8c31..1185b76fcb 100644 --- a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/WghSjxxbService.java +++ b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/WghSjxxbService.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.WghSjxxbDTO; import com.epmet.opendata.entity.WghSjxxbEntity; @@ -75,4 +76,14 @@ public interface WghSjxxbService extends BaseService { * @date 2022-06-14 */ void delete(String[] ids); + + /** + * 调用ruoyi接口获取wgh_sjxx数据 + * + * @param dto + * @return void + * @author LZN + * @date 2022/6/14 16:02 + */ + void getPreserSjxxVation(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 95cc8812d3..97ade4add6 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 @@ -50,6 +50,9 @@ public class GuardarDatosTaskServiceImpl implements GuardarDatosTaskService { @Autowired private WghJyzService wghJyzService; + @Autowired + private WghSjxxbService wghSjxxbService; + @Override public void guardarDatosTask(PreserVationFormDTO dto) { if (StringUtils.isBlank(dto.getTableName())) { @@ -65,6 +68,7 @@ public class GuardarDatosTaskServiceImpl implements GuardarDatosTaskService { wghJqzService.getPreserWghjqzVation(dto); wghJxcsService.preserWghJxcsVation(dto); wghJyzService.getPreserWghJyzVation(dto); + wghSjxxbService.getPreserSjxxVation(dto); } else { switch (dto.getTableName()) { @@ -107,6 +111,9 @@ public class GuardarDatosTaskServiceImpl implements GuardarDatosTaskService { case CaWghDataConstant.SHARE_WGH_JYZ: wghJyzService.getPreserWghJyzVation(dto); break; + case CaWghDataConstant.SHARE_WGH_SJXX: + wghSjxxbService.getPreserSjxxVation(dto); + break; } } } diff --git a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/WghSjxxbServiceImpl.java b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/WghSjxxbServiceImpl.java index 1ecbbcfa48..387a4c7649 100644 --- a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/WghSjxxbServiceImpl.java +++ b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/WghSjxxbServiceImpl.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.WghSjxxbDao; +import com.epmet.opendata.dto.constant.CaWghDataConstant; +import com.epmet.opendata.dto.form.PreserVationFormDTO; import com.epmet.opendata.dto.wgh.WghSjxxbDTO; +import com.epmet.opendata.entity.CaLoudongEntity; import com.epmet.opendata.entity.WghSjxxbEntity; import com.epmet.opendata.redis.WghSjxxbRedis; import com.epmet.opendata.service.WghSjxxbService; +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 WghSjxxbServiceImpl extends BaseServiceImpl= 0) { + dto.setPageNo(NumConstant.ONE); + dto.setPageSize(NumConstant.FIFTY); + dto.setTableSchema(CaWghDataConstant.TABLESCHEMA_SHARE); + dto.setTableName(CaWghDataConstant.SHARE_WGH_SJXX); + + dto.setWhereCase("1=1"); + dto.setOrderBy("OBJECTID,OBJECTID_1,insert_time"); + + int pageNo = 1; + + int total = 0; + + do { + try { + total = listLouDong(dto); + pageNo++; + dto.setPageNo(pageNo); + } catch (Exception e) { + e.printStackTrace(); + } + } while (total > (pageNo * NumConstant.FIFTY)); + } + + } + + + private int listLouDong(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/WghSjxxbDao.xml b/epmet-module/open-data-worker/open-data-worker-server/src/main/resources/mapper/WghSjxxbDao.xml index 8fd239723f..9749b49da5 100644 --- a/epmet-module/open-data-worker/open-data-worker-server/src/main/resources/mapper/WghSjxxbDao.xml +++ b/epmet-module/open-data-worker/open-data-worker-server/src/main/resources/mapper/WghSjxxbDao.xml @@ -20,6 +20,9 @@ + + delete from wgh_sjxx +