|
@ -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.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.constant.FieldConstant; |
|
|
import com.epmet.commons.tools.constant.FieldConstant; |
|
|
|
|
|
import com.epmet.commons.tools.utils.HttpClientManager; |
|
|
|
|
|
import com.epmet.commons.tools.utils.Result; |
|
|
|
|
|
import com.epmet.dto.IcResiUserDTO; |
|
|
|
|
|
import com.epmet.feign.EpmetUserOpenFeignClient; |
|
|
import com.epmet.opendata.dao.CaRotatorsDao; |
|
|
import com.epmet.opendata.dao.CaRotatorsDao; |
|
|
import com.epmet.opendata.dto.CaRotatorsDTO; |
|
|
import com.epmet.opendata.dto.CaRotatorsDTO; |
|
|
import com.epmet.opendata.dto.form.CaRotatorsFormDTO; |
|
|
import com.epmet.opendata.dto.form.CaRotatorsFormDTO; |
|
|
|
|
|
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.CaRotatorsResultDTO; |
|
|
import com.epmet.opendata.dto.result.CaRotatorsResultDTO; |
|
|
|
|
|
import com.epmet.opendata.entity.CaLoudongEntity; |
|
|
import com.epmet.opendata.entity.CaRotatorsEntity; |
|
|
import com.epmet.opendata.entity.CaRotatorsEntity; |
|
|
import com.epmet.opendata.redis.CaRotatorsRedis; |
|
|
import com.epmet.opendata.redis.CaRotatorsRedis; |
|
|
import com.epmet.opendata.service.CaRotatorsService; |
|
|
import com.epmet.opendata.service.CaRotatorsService; |
|
@ -37,6 +46,9 @@ public class CaRotatorsServiceImpl extends BaseServiceImpl<CaRotatorsDao, CaRota |
|
|
@Autowired |
|
|
@Autowired |
|
|
private CaRotatorsRedis caRotatorsRedis; |
|
|
private CaRotatorsRedis caRotatorsRedis; |
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
|
private EpmetUserOpenFeignClient openFeignClient; |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public PageData<CaRotatorsDTO> page(Map<String, Object> params) { |
|
|
public PageData<CaRotatorsDTO> page(Map<String, Object> params) { |
|
|
IPage<CaRotatorsEntity> page = baseDao.selectPage( |
|
|
IPage<CaRotatorsEntity> page = baseDao.selectPage( |
|
@ -53,8 +65,8 @@ public class CaRotatorsServiceImpl extends BaseServiceImpl<CaRotatorsDao, CaRota |
|
|
return ConvertUtils.sourceToTarget(entityList, CaRotatorsDTO.class); |
|
|
return ConvertUtils.sourceToTarget(entityList, CaRotatorsDTO.class); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private QueryWrapper<CaRotatorsEntity> getWrapper(Map<String, Object> params){ |
|
|
private QueryWrapper<CaRotatorsEntity> getWrapper(Map<String, Object> params) { |
|
|
String id = (String)params.get(FieldConstant.ID_HUMP); |
|
|
String id = (String) params.get(FieldConstant.ID_HUMP); |
|
|
|
|
|
|
|
|
QueryWrapper<CaRotatorsEntity> wrapper = new QueryWrapper<>(); |
|
|
QueryWrapper<CaRotatorsEntity> wrapper = new QueryWrapper<>(); |
|
|
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); |
|
|
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); |
|
@ -97,4 +109,96 @@ public class CaRotatorsServiceImpl extends BaseServiceImpl<CaRotatorsDao, CaRota |
|
|
return new PageData<>(result, info.getTotal()); |
|
|
return new PageData<>(result, info.getTotal()); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* 流动人口调用ruoyi接口存储数据 |
|
|
|
|
|
* |
|
|
|
|
|
* @param dto |
|
|
|
|
|
* @return void |
|
|
|
|
|
* @author LZN |
|
|
|
|
|
* @date 2022/6/2 11:01 |
|
|
|
|
|
*/ |
|
|
|
|
|
@Override |
|
|
|
|
|
public void preserRotatorsVation(PreserVationFormDTO dto) { |
|
|
|
|
|
baseDao.deleteAll(); |
|
|
|
|
|
dto.setPageNo(NumConstant.ONE); |
|
|
|
|
|
dto.setPageSize(NumConstant.FIFTY); |
|
|
|
|
|
dto.setTableSchema(rotatorsEnum.LDRK.name); |
|
|
|
|
|
dto.setTableName(rotatorsEnum.LDRK.code); |
|
|
|
|
|
|
|
|
|
|
|
dto.setWhereCase("delete_flag = 'normal'"); |
|
|
|
|
|
dto.setOrderBy("grid_id,update_date desc"); |
|
|
|
|
|
|
|
|
|
|
|
int pageNo = 1; |
|
|
|
|
|
|
|
|
|
|
|
int total = 0; |
|
|
|
|
|
|
|
|
|
|
|
do { |
|
|
|
|
|
total = listRotators(dto); |
|
|
|
|
|
pageNo++; |
|
|
|
|
|
dto.setPageNo(pageNo); |
|
|
|
|
|
} while (total > (pageNo * NumConstant.FIFTY)); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
enum rotatorsEnum { |
|
|
|
|
|
|
|
|
|
|
|
LDRK("unicom", "ca_rotators"), |
|
|
|
|
|
; |
|
|
|
|
|
|
|
|
|
|
|
private String name; |
|
|
|
|
|
private String code; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
rotatorsEnum(String name, String code) { |
|
|
|
|
|
this.name = name; |
|
|
|
|
|
this.code = code; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private int listRotators(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); |
|
|
|
|
|
|
|
|
|
|
|
returnDate.getList().forEach(item -> { |
|
|
|
|
|
if (StringUtils.isNotBlank(item.getIdCard())) { |
|
|
|
|
|
Result<IcResiUserDTO> client = openFeignClient.getByResiIdCard(item.getIdCard()); |
|
|
|
|
|
IcResiUserDTO clientData = client.getData(); |
|
|
|
|
|
item.setIcResiUser(clientData.getId()); |
|
|
|
|
|
item.setHomeId(clientData.getHomeId()); |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
this.insertBatch(returnDate.getList()); |
|
|
|
|
|
return returnDate.getTotal(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static class ReturnDate { |
|
|
|
|
|
|
|
|
|
|
|
private int total; |
|
|
|
|
|
private List<CaRotatorsEntity> list; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public int getTotal() { |
|
|
|
|
|
return total; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void setTotal(int total) { |
|
|
|
|
|
this.total = total; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public List<CaRotatorsEntity> getList() { |
|
|
|
|
|
return list; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void setList(List<CaRotatorsEntity> list) { |
|
|
|
|
|
this.list = list; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |