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 66f8395df5..f08c274ee2 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 @@ -30,6 +30,7 @@ public interface CaWghDataConstant { String SHARE_WGH_JYZ = "wgh_jyz"; String SHARE_WGH_SJXX = "wgh_sjxxb"; String SHARE_WGH_SQXX = "wgh_sqxx"; + String SHARE_WGH_SZCGWGH = "wgh_szcgwgh"; 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/WghSzcgwghController.java b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/controller/WghSzcgwghController.java index 809db1330d..c678c9a7fd 100644 --- a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/controller/WghSzcgwghController.java +++ b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/controller/WghSzcgwghController.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.WghSzcgwghDTO; import com.epmet.opendata.excel.WghSzcgwghExcel; import com.epmet.opendata.service.WghSzcgwghService; @@ -77,6 +78,18 @@ public class WghSzcgwghController { ExcelUtils.exportExcelToTarget(response, null, list, WghSzcgwghExcel.class); } - + /** + * 调用ruoyi系统获取wgh_szcgwgh数据 + * + * @param dto + * @return com.epmet.commons.tools.utils.Result + * @author LZN + * @date 2022/6/14 16:19 + */ + @PostMapping("/preserWghSzcgwghVation") + public Result getPreserWghSzcgwghVation(@RequestBody PreserVationFormDTO dto) { + wghSzcgwghService.getPreserWghSzcgwghVation(dto); + return new Result(); + } } diff --git a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/dao/WghSzcgwghDao.java b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/dao/WghSzcgwghDao.java index 900503ff51..66d2c0197c 100644 --- a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/dao/WghSzcgwghDao.java +++ b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/dao/WghSzcgwghDao.java @@ -14,4 +14,5 @@ import org.apache.ibatis.annotations.Mapper; @Mapper public interface WghSzcgwghDao extends BaseDao { + int deleteAll(); } diff --git a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/WghSzcgwghService.java b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/WghSzcgwghService.java index c31d4d68ad..39533fc2a1 100644 --- a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/WghSzcgwghService.java +++ b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/WghSzcgwghService.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.WghSzcgwghDTO; import com.epmet.opendata.entity.WghSzcgwghEntity; @@ -76,4 +77,14 @@ public interface WghSzcgwghService extends BaseService { * @date 2022-06-14 */ void delete(String[] ids); + + /** + * 调用ruoyi系统获取wgh_szcgwgh数据 + * + * @param dto + * @return void + * @author LZN + * @date 2022/6/14 16:20 + */ + void getPreserWghSzcgwghVation(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 5207614dd2..540142a28f 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 @@ -56,6 +56,9 @@ public class GuardarDatosTaskServiceImpl implements GuardarDatosTaskService { @Autowired private WghSqxxService wghSqxxService; + @Autowired + private WghSzcgwghService wghSzcgwghService; + @Override public void guardarDatosTask(PreserVationFormDTO dto) { if (StringUtils.isBlank(dto.getTableName())) { @@ -73,6 +76,7 @@ public class GuardarDatosTaskServiceImpl implements GuardarDatosTaskService { wghJyzService.getPreserWghJyzVation(dto); wghSjxxbService.getPreserSjxxVation(dto); wghSqxxService.getPreserWghSqxxVation(dto); + wghSzcgwghService.getPreserWghSzcgwghVation(dto); } else { switch (dto.getTableName()) { @@ -121,6 +125,9 @@ public class GuardarDatosTaskServiceImpl implements GuardarDatosTaskService { case CaWghDataConstant.SHARE_WGH_SQXX: wghSqxxService.getPreserWghSqxxVation(dto); break; + case CaWghDataConstant.SHARE_WGH_SZCGWGH: + wghSzcgwghService.getPreserWghSzcgwghVation(dto); + break; } } } diff --git a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/WghSzcgwghServiceImpl.java b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/WghSzcgwghServiceImpl.java index 945a091d0a..313001955d 100644 --- a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/WghSzcgwghServiceImpl.java +++ b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/WghSzcgwghServiceImpl.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.WghSzcgwghDao; +import com.epmet.opendata.dto.constant.CaWghDataConstant; +import com.epmet.opendata.dto.form.PreserVationFormDTO; import com.epmet.opendata.dto.wgh.WghSzcgwghDTO; +import com.epmet.opendata.entity.CaLoudongEntity; import com.epmet.opendata.entity.WghSzcgwghEntity; import com.epmet.opendata.redis.WghSzcgwghRedis; import com.epmet.opendata.service.WghSzcgwghService; +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 WghSzcgwghServiceImpl extends BaseServiceImpl= 0) { + dto.setPageNo(NumConstant.ONE); + dto.setPageSize(NumConstant.FIFTY); + dto.setTableSchema(CaWghDataConstant.TABLESCHEMA_SHARE); + dto.setTableName(CaWghDataConstant.SHARE_WGH_SZCGWGH); + + dto.setWhereCase("1=1"); + dto.setOrderBy("OBJECTID,ID,insert_time"); + + int pageNo = 1; + + int total = 0; + + do { + try { + total = listWghSzcgWgh(dto); + pageNo++; + dto.setPageNo(pageNo); + } catch (Exception e) { + e.printStackTrace(); + } + } while (total > (pageNo * NumConstant.FIFTY)); + } + + } + + + private int listWghSzcgWgh(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/WghSzcgwghDao.xml b/epmet-module/open-data-worker/open-data-worker-server/src/main/resources/mapper/WghSzcgwghDao.xml index 4c68a27413..adcc9df6f8 100644 --- a/epmet-module/open-data-worker/open-data-worker-server/src/main/resources/mapper/WghSzcgwghDao.xml +++ b/epmet-module/open-data-worker/open-data-worker-server/src/main/resources/mapper/WghSzcgwghDao.xml @@ -11,6 +11,9 @@ + + delete from wgh_szcgwgh +