Browse Source

调用ruoyi接口获取dywg数据

dev
HAHA 3 years ago
parent
commit
33b73c6312
  1. 1
      epmet-module/open-data-worker/open-data-worker-client/src/main/java/com/epmet/opendata/dto/constant/CaWghDataConstant.java
  2. 15
      epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/controller/WghDywgController.java
  3. 1
      epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/dao/WghDywgDao.java
  4. 11
      epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/WghDywgService.java
  5. 7
      epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/GuardarDatosTaskServiceImpl.java
  6. 84
      epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/WghDywgServiceImpl.java
  7. 3
      epmet-module/open-data-worker/open-data-worker-server/src/main/resources/mapper/WghDywgDao.xml

1
epmet-module/open-data-worker/open-data-worker-client/src/main/java/com/epmet/opendata/dto/constant/CaWghDataConstant.java

@ -23,6 +23,7 @@ public interface CaWghDataConstant {
String SHARE_BASE_GRID = "BaseGrid"; String SHARE_BASE_GRID = "BaseGrid";
String SHARE_BM_GRID = "bm_grid"; String SHARE_BM_GRID = "bm_grid";
String SHARE_COMMUNITY = "community"; String SHARE_COMMUNITY = "community";
String SHARE_WGH_DYWG = "wgh_dywg";
String DATA_URL_UNICON = "http://120.221.72.83:9090/bridge/unicom/page"; 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"; String DATA_URL_SHARE = "http://120.221.72.83:9090/bridge/share/sharePage";

15
epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/controller/WghDywgController.java

@ -10,6 +10,7 @@ import com.epmet.commons.tools.validator.group.AddGroup;
import com.epmet.commons.tools.validator.group.UpdateGroup; import com.epmet.commons.tools.validator.group.UpdateGroup;
import com.epmet.commons.tools.validator.group.DefaultGroup; import com.epmet.commons.tools.validator.group.DefaultGroup;
import com.epmet.opendata.dto.form.PreserVationFormDTO;
import com.epmet.opendata.dto.wgh.WghDywgDTO; import com.epmet.opendata.dto.wgh.WghDywgDTO;
import com.epmet.opendata.excel.WghDywgExcel; import com.epmet.opendata.excel.WghDywgExcel;
import com.epmet.opendata.service.WghDywgService; import com.epmet.opendata.service.WghDywgService;
@ -78,6 +79,18 @@ public class WghDywgController {
ExcelUtils.exportExcelToTarget(response, null, list, WghDywgExcel.class); ExcelUtils.exportExcelToTarget(response, null, list, WghDywgExcel.class);
} }
/**
* 调用ruoyi接口获取dywg数据
*
* @param dto
* @return com.epmet.commons.tools.utils.Result
* @author LZN
* @date 2022/6/14 15:11
*/
@PostMapping("preserDywgVation")
public Result getPreserDywgVation(@RequestBody PreserVationFormDTO dto) {
wghDywgService.getPreserDywgVation(dto);
return new Result();
}
} }

1
epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/dao/WghDywgDao.java

@ -14,4 +14,5 @@ import org.apache.ibatis.annotations.Mapper;
@Mapper @Mapper
public interface WghDywgDao extends BaseDao<WghDywgEntity> { public interface WghDywgDao extends BaseDao<WghDywgEntity> {
int deleteAll();
} }

11
epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/WghDywgService.java

@ -2,6 +2,7 @@ package com.epmet.opendata.service;
import com.epmet.commons.mybatis.service.BaseService; import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.page.PageData;
import com.epmet.opendata.dto.form.PreserVationFormDTO;
import com.epmet.opendata.dto.wgh.WghDywgDTO; import com.epmet.opendata.dto.wgh.WghDywgDTO;
import com.epmet.opendata.entity.WghDywgEntity; import com.epmet.opendata.entity.WghDywgEntity;
@ -75,4 +76,14 @@ public interface WghDywgService extends BaseService<WghDywgEntity> {
* @date 2022-06-14 * @date 2022-06-14
*/ */
void delete(String[] ids); void delete(String[] ids);
/**
* 调用ruoyi接口获取dywg数据
*
* @param dto
* @return void
* @author LZN
* @date 2022/6/14 15:11
*/
void getPreserDywgVation(PreserVationFormDTO dto);
} }

7
epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/GuardarDatosTaskServiceImpl.java

@ -35,6 +35,9 @@ public class GuardarDatosTaskServiceImpl implements GuardarDatosTaskService {
@Autowired @Autowired
private CommunityService communityService; private CommunityService communityService;
@Autowired
private WghDywgService wghDywgService;
@Override @Override
public void guardarDatosTask(PreserVationFormDTO dto) { public void guardarDatosTask(PreserVationFormDTO dto) {
if (StringUtils.isBlank(dto.getTableName())) { if (StringUtils.isBlank(dto.getTableName())) {
@ -46,6 +49,7 @@ public class GuardarDatosTaskServiceImpl implements GuardarDatosTaskService {
basegridService.preserBaseGridVation(dto); basegridService.preserBaseGridVation(dto);
bmGridService.getPreserBmGridVation(dto); bmGridService.getPreserBmGridVation(dto);
communityService.getPreserCommunityVation(dto); communityService.getPreserCommunityVation(dto);
wghDywgService.getPreserDywgVation(dto);
} }
switch (dto.getTableName()) { switch (dto.getTableName()) {
@ -73,6 +77,9 @@ public class GuardarDatosTaskServiceImpl implements GuardarDatosTaskService {
case CaWghDataConstant.SHARE_COMMUNITY: case CaWghDataConstant.SHARE_COMMUNITY:
communityService.getPreserCommunityVation(dto); communityService.getPreserCommunityVation(dto);
break; break;
case CaWghDataConstant.SHARE_WGH_DYWG:
wghDywgService.getPreserDywgVation(dto);
break;
} }
} }
} }

84
epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/WghDywgServiceImpl.java

@ -1,16 +1,25 @@
package com.epmet.opendata.service.impl; 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.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.HttpClientManager;
import com.epmet.commons.tools.utils.Result;
import com.epmet.opendata.dao.WghDywgDao; import com.epmet.opendata.dao.WghDywgDao;
import com.epmet.opendata.dto.constant.CaWghDataConstant;
import com.epmet.opendata.dto.form.PreserVationFormDTO;
import com.epmet.opendata.dto.wgh.WghDywgDTO; import com.epmet.opendata.dto.wgh.WghDywgDTO;
import com.epmet.opendata.entity.CaLoudongEntity;
import com.epmet.opendata.entity.WghDywgEntity; import com.epmet.opendata.entity.WghDywgEntity;
import com.epmet.opendata.redis.WghDywgRedis; import com.epmet.opendata.redis.WghDywgRedis;
import com.epmet.opendata.service.WghDywgService; import com.epmet.opendata.service.WghDywgService;
import com.epmet.opendata.util.AesUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -84,4 +93,79 @@ public class WghDywgServiceImpl extends BaseServiceImpl<WghDywgDao, WghDywgEntit
baseDao.deleteBatchIds(Arrays.asList(ids)); baseDao.deleteBatchIds(Arrays.asList(ids));
} }
/**
* 调用ruoyi接口获取dywg数据
*
* @param dto
* @return void
* @author LZN
* @date 2022/6/14 15:12
*/
@Override
public void getPreserDywgVation(PreserVationFormDTO dto) {
int i = baseDao.deleteAll();
if (i >= 0) {
dto.setPageNo(NumConstant.ONE);
dto.setPageSize(NumConstant.FIFTY);
dto.setTableSchema(CaWghDataConstant.TABLESCHEMA_SHARE);
dto.setTableName(CaWghDataConstant.SHARE_WGH_DYWG);
dto.setWhereCase("1=1");
dto.setOrderBy("ORDATE");
int pageNo = 1;
int total = 0;
do {
try {
total = listDywg(dto);
pageNo++;
dto.setPageNo(pageNo);
} catch (Exception e) {
e.printStackTrace();
}
} while (total > (pageNo * NumConstant.FIFTY));
}
}
private int listDywg(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<WghDywgEntity> list;
public int getTotal() {
return total;
}
public void setTotal(int total) {
this.total = total;
}
public List<WghDywgEntity> getList() {
return list;
}
public void setList(List<WghDywgEntity> list) {
this.list = list;
}
}
} }

3
epmet-module/open-data-worker/open-data-worker-server/src/main/resources/mapper/WghDywgDao.xml

@ -16,6 +16,9 @@
<result property="telphone" column="TELPHONE"/> <result property="telphone" column="TELPHONE"/>
<result property="insertTime" column="insert_time"/> <result property="insertTime" column="insert_time"/>
</resultMap> </resultMap>
<delete id="deleteAll">
delete from wgh_dywg
</delete>
</mapper> </mapper>

Loading…
Cancel
Save