|
|
@ -1,17 +1,24 @@ |
|
|
|
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.CaRentalDao; |
|
|
|
import com.epmet.opendata.dto.CaRentalDTO; |
|
|
|
import com.epmet.opendata.dto.form.CaRentalFormtDTO; |
|
|
|
import com.epmet.opendata.dto.form.PreserVationFormDTO; |
|
|
|
import com.epmet.opendata.dto.result.CaLoudongResultDTO; |
|
|
|
import com.epmet.opendata.dto.result.CaRentalResultDTO; |
|
|
|
import com.epmet.opendata.entity.CaLoudongEntity; |
|
|
|
import com.epmet.opendata.entity.CaRentalEntity; |
|
|
|
import com.epmet.opendata.redis.CaRentalRedis; |
|
|
|
import com.epmet.opendata.service.CaRentalService; |
|
|
@ -98,4 +105,89 @@ public class CaRentalServiceImpl extends BaseServiceImpl<CaRentalDao, CaRentalEn |
|
|
|
return new PageData<>(result, info.getTotal()); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 出租房调用ruoyi接口存储数据 |
|
|
|
* |
|
|
|
* @param dto |
|
|
|
* @return void |
|
|
|
* @author LZN |
|
|
|
* @date 2022/6/2 10:31 |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public void preserRentalVation(PreserVationFormDTO dto) { |
|
|
|
baseDao.deleteAll(); |
|
|
|
|
|
|
|
dto.setPageNo(NumConstant.ONE); |
|
|
|
dto.setPageSize(NumConstant.FIFTY); |
|
|
|
dto.setTableSchema(rentalEnum.CZF.name); |
|
|
|
dto.setTableName(rentalEnum.CZF.code); |
|
|
|
|
|
|
|
dto.setWhereCase("delete_flag = 'normal'"); |
|
|
|
dto.setOrderBy("grid_id,update_date desc"); |
|
|
|
|
|
|
|
int pageNo = 1; |
|
|
|
|
|
|
|
int total = 0; |
|
|
|
|
|
|
|
do { |
|
|
|
total = listRental(dto); |
|
|
|
pageNo++; |
|
|
|
dto.setPageNo(pageNo); |
|
|
|
} while (total > (pageNo * NumConstant.FIFTY)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
enum rentalEnum { |
|
|
|
|
|
|
|
CZF("unicom", "ca_rental"), |
|
|
|
; |
|
|
|
|
|
|
|
private String name; |
|
|
|
private String code; |
|
|
|
|
|
|
|
|
|
|
|
rentalEnum(String name, String code) { |
|
|
|
this.name = name; |
|
|
|
this.code = code; |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
private int listRental(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<CaRentalEntity> list; |
|
|
|
|
|
|
|
|
|
|
|
public int getTotal() { |
|
|
|
return total; |
|
|
|
} |
|
|
|
|
|
|
|
public void setTotal(int total) { |
|
|
|
this.total = total; |
|
|
|
} |
|
|
|
|
|
|
|
public List<CaRentalEntity> getList() { |
|
|
|
return list; |
|
|
|
} |
|
|
|
|
|
|
|
public void setList(List<CaRentalEntity> list) { |
|
|
|
this.list = list; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |