|
|
@ -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.CaKettleBaseDisputeProcessDao; |
|
|
|
import com.epmet.opendata.dto.ca.CaKettleBaseDisputeProcessDTO; |
|
|
|
import com.epmet.opendata.dto.constant.CaWghDataConstant; |
|
|
|
import com.epmet.opendata.dto.form.PreserVationFormDTO; |
|
|
|
import com.epmet.opendata.entity.CaKettleBaseDisputeProcessEntity; |
|
|
|
import com.epmet.opendata.entity.CaLoudongEntity; |
|
|
|
import com.epmet.opendata.redis.CaKettleBaseDisputeProcessRedis; |
|
|
|
import com.epmet.opendata.service.CaKettleBaseDisputeProcessService; |
|
|
|
import com.epmet.opendata.util.AesUtils; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
@ -21,8 +30,6 @@ import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
|
|
|
|
/** |
|
|
|
* |
|
|
|
* |
|
|
|
* @author generator generator@elink-cn.com |
|
|
|
* @since v1.0.0 2022-07-06 |
|
|
|
*/ |
|
|
@ -84,4 +91,80 @@ public class CaKettleBaseDisputeProcessServiceImpl extends BaseServiceImpl<CaKet |
|
|
|
baseDao.deleteBatchIds(Arrays.asList(ids)); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 调用ruoyi接口存储数据 |
|
|
|
* |
|
|
|
* @param dto |
|
|
|
* @return void |
|
|
|
* @author LZN |
|
|
|
* @date 2022/7/6 17:02 |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public void getPreserKettleVation(PreserVationFormDTO dto) { |
|
|
|
int i = baseDao.deleteAll(); |
|
|
|
if (i >= 0) { |
|
|
|
dto.setPageNo(NumConstant.ONE); |
|
|
|
dto.setPageSize(CaWghDataConstant.PAGE_LIMIT); |
|
|
|
dto.setTableSchema(CaWghDataConstant.TABLESCHEMA_UNICOM); |
|
|
|
dto.setTableName(CaWghDataConstant.UNICOM_KETTLE); |
|
|
|
|
|
|
|
dto.setWhereCase("1=1"); |
|
|
|
dto.setOrderBy("timelimit,create_time,update_time,import_time,eventdate desc"); |
|
|
|
|
|
|
|
int pageNo = 1; |
|
|
|
|
|
|
|
int total = 0; |
|
|
|
|
|
|
|
do { |
|
|
|
try { |
|
|
|
total = listKettle(dto); |
|
|
|
pageNo++; |
|
|
|
dto.setPageNo(pageNo); |
|
|
|
} catch (Exception e) { |
|
|
|
e.printStackTrace(); |
|
|
|
} |
|
|
|
} while (total > (pageNo * NumConstant.FIFTY)); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
private int listKettle(PreserVationFormDTO dto) throws Exception { |
|
|
|
String aes = AesUtils.encryptByAES(JSONObject.toJSONString(dto), CaWghDataConstant.AESKEY); |
|
|
|
JSONObject obj = new JSONObject(); |
|
|
|
obj.put(CaWghDataConstant.UNICOM_CONDITION, aes); |
|
|
|
String data = HttpClientManager.getInstance().sendPostByJSON(CaWghDataConstant.DATA_URL_UNICON, 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<CaKettleBaseDisputeProcessEntity> list; |
|
|
|
|
|
|
|
|
|
|
|
public int getTotal() { |
|
|
|
return total; |
|
|
|
} |
|
|
|
|
|
|
|
public void setTotal(int total) { |
|
|
|
this.total = total; |
|
|
|
} |
|
|
|
|
|
|
|
public List<CaKettleBaseDisputeProcessEntity> getList() { |
|
|
|
return list; |
|
|
|
} |
|
|
|
|
|
|
|
public void setList(List<CaKettleBaseDisputeProcessEntity> list) { |
|
|
|
this.list = list; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|