|
@ -1,16 +1,23 @@ |
|
|
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.CaPingfangDao; |
|
|
import com.epmet.opendata.dao.CaPingfangDao; |
|
|
import com.epmet.opendata.dto.CaPingfangDTO; |
|
|
import com.epmet.opendata.dto.CaPingfangDTO; |
|
|
import com.epmet.opendata.dto.form.CaPingfangFormDTO; |
|
|
import com.epmet.opendata.dto.form.CaPingfangFormDTO; |
|
|
|
|
|
import com.epmet.opendata.dto.form.PreserVationFormDTO; |
|
|
import com.epmet.opendata.dto.result.CaLoudongResultDTO; |
|
|
import com.epmet.opendata.dto.result.CaLoudongResultDTO; |
|
|
import com.epmet.opendata.dto.result.CaPingfangResultDTO; |
|
|
import com.epmet.opendata.dto.result.CaPingfangResultDTO; |
|
|
|
|
|
import com.epmet.opendata.entity.CaLoudongEntity; |
|
|
import com.epmet.opendata.entity.CaPingfangEntity; |
|
|
import com.epmet.opendata.entity.CaPingfangEntity; |
|
|
import com.epmet.opendata.redis.CaPingfangRedis; |
|
|
import com.epmet.opendata.redis.CaPingfangRedis; |
|
|
import com.epmet.opendata.service.CaPingfangService; |
|
|
import com.epmet.opendata.service.CaPingfangService; |
|
@ -95,4 +102,85 @@ public class CaPingfangServiceImpl extends BaseServiceImpl<CaPingfangDao, CaPing |
|
|
return new PageData<>(result, info.getTotal()); |
|
|
return new PageData<>(result, info.getTotal()); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* 平房调用ruoyi接口存储数据 |
|
|
|
|
|
* |
|
|
|
|
|
* @param dto |
|
|
|
|
|
* @return void |
|
|
|
|
|
* @author LZN |
|
|
|
|
|
* @date 2022/6/2 10:21 |
|
|
|
|
|
*/ |
|
|
|
|
|
@Override |
|
|
|
|
|
public void preserPingFangVation(PreserVationFormDTO dto) { |
|
|
|
|
|
baseDao.deleteAll(); |
|
|
|
|
|
|
|
|
|
|
|
dto.setPageNo(NumConstant.ONE); |
|
|
|
|
|
dto.setPageSize(NumConstant.FIFTY); |
|
|
|
|
|
dto.setTableSchema(pingFangEnum.PF.name); |
|
|
|
|
|
dto.setTableName(pingFangEnum.PF.code); |
|
|
|
|
|
|
|
|
|
|
|
dto.setWhereCase("delete_flag = 'normal'"); |
|
|
|
|
|
dto.setOrderBy("grid_id,update_date desc"); |
|
|
|
|
|
|
|
|
|
|
|
int pageNo = 1; |
|
|
|
|
|
|
|
|
|
|
|
int total = 0; |
|
|
|
|
|
|
|
|
|
|
|
do { |
|
|
|
|
|
total = listPingFang(dto); |
|
|
|
|
|
pageNo++; |
|
|
|
|
|
dto.setPageNo(pageNo); |
|
|
|
|
|
} while (total > (pageNo * NumConstant.FIFTY)); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
enum pingFangEnum { |
|
|
|
|
|
|
|
|
|
|
|
PF("unicom", "ca_pingfang"), |
|
|
|
|
|
; |
|
|
|
|
|
|
|
|
|
|
|
pingFangEnum(String name, String code) { |
|
|
|
|
|
this.name = name; |
|
|
|
|
|
this.code = code; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private String name; |
|
|
|
|
|
private String code; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private int listPingFang(PreserVationFormDTO dto) { |
|
|
|
|
|
String data = HttpClientManager.getInstance().sendPostByJSON("http://120.221.72.83:9090/bridge/unicom/page", JSON.toJSONString(dto)).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(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
class ReturnDate { |
|
|
|
|
|
|
|
|
|
|
|
private int total; |
|
|
|
|
|
private List<CaPingfangEntity> list; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public int getTotal() { |
|
|
|
|
|
return total; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void setTotal(int total) { |
|
|
|
|
|
this.total = total; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public List<CaPingfangEntity> getList() { |
|
|
|
|
|
return list; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void setList(List<CaPingfangEntity> list) { |
|
|
|
|
|
this.list = list; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |