Browse Source

流动人口调用ruoyi接口存储数据

dev
HAHA 3 years ago
parent
commit
14c330e2eb
  1. 15
      epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/controller/CaRotatorsController.java
  2. 2
      epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/dao/CaRotatorsDao.java
  3. 2
      epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/entity/CaLoudongEntity.java
  4. 2
      epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/entity/CaPingfangEntity.java
  5. 2
      epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/entity/CaRentalEntity.java
  6. 2
      epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/entity/CaResidentEntity.java
  7. 2
      epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/entity/CaRotatorsEntity.java
  8. 8
      epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/CaRotatorsService.java
  9. 10
      epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/CaLoudongServiceImpl.java
  10. 2
      epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/CaPingfangServiceImpl.java
  11. 2
      epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/CaRentalServiceImpl.java
  12. 2
      epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/CaResidentServiceImpl.java
  13. 108
      epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/CaRotatorsServiceImpl.java
  14. 28
      epmet-module/open-data-worker/open-data-worker-server/src/main/resources/mapper/CaLoudongDao.xml
  15. 3
      epmet-module/open-data-worker/open-data-worker-server/src/main/resources/mapper/CaRotatorsDao.xml

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

@ -14,6 +14,7 @@ import com.epmet.commons.tools.validator.group.UpdateGroup;
import com.epmet.opendata.dto.CaRotatorsDTO; import com.epmet.opendata.dto.CaRotatorsDTO;
import com.epmet.opendata.dto.form.CaLoudongFormDTO; import com.epmet.opendata.dto.form.CaLoudongFormDTO;
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.excel.CaRotatorsExcel; import com.epmet.opendata.excel.CaRotatorsExcel;
@ -98,5 +99,19 @@ public class CaRotatorsController {
return new Result<PageData<CaRotatorsResultDTO>>().ok(data); return new Result<PageData<CaRotatorsResultDTO>>().ok(data);
} }
/**
* 流动人口调用ruoyi接口存储数据
*
* @param dto
* @return com.epmet.commons.tools.utils.Result
* @author LZN
* @date 2022/6/2 11:00
*/
@PostMapping("/preserRotatorsVation")
public Result getPreserRotatorsVation(@RequestBody PreserVationFormDTO dto) {
caRotatorsService.preserRotatorsVation(dto);
return new Result();
}
} }

2
epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/dao/CaRotatorsDao.java

@ -25,4 +25,6 @@ public interface CaRotatorsDao extends BaseDao<CaRotatorsEntity> {
* @return * @return
*/ */
List<CaRotatorsResultDTO> getPage(@Param("rotatorsName") String rotatorsName); List<CaRotatorsResultDTO> getPage(@Param("rotatorsName") String rotatorsName);
void deleteAll();
} }

2
epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/entity/CaLoudongEntity.java

@ -18,7 +18,7 @@ import java.util.Date;
@Data @Data
@EqualsAndHashCode(callSuper=false) @EqualsAndHashCode(callSuper=false)
@TableName("ca_loudong") @TableName("ca_loudong")
public class CaLoudongEntity extends BaseEpmetEntity { public class CaLoudongEntity {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;

2
epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/entity/CaPingfangEntity.java

@ -18,7 +18,7 @@ import java.util.Date;
@Data @Data
@EqualsAndHashCode(callSuper=false) @EqualsAndHashCode(callSuper=false)
@TableName("ca_pingfang") @TableName("ca_pingfang")
public class CaPingfangEntity extends BaseEpmetEntity { public class CaPingfangEntity {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;

2
epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/entity/CaRentalEntity.java

@ -18,7 +18,7 @@ import java.util.Date;
@Data @Data
@EqualsAndHashCode(callSuper=false) @EqualsAndHashCode(callSuper=false)
@TableName("ca_rental") @TableName("ca_rental")
public class CaRentalEntity extends BaseEpmetEntity { public class CaRentalEntity {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;

2
epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/entity/CaResidentEntity.java

@ -17,7 +17,7 @@ import java.util.Date;
@Data @Data
@EqualsAndHashCode(callSuper=false) @EqualsAndHashCode(callSuper=false)
@TableName("ca_resident") @TableName("ca_resident")
public class CaResidentEntity extends BaseEpmetEntity { public class CaResidentEntity {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;

2
epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/entity/CaRotatorsEntity.java

@ -17,7 +17,7 @@ import java.util.Date;
@Data @Data
@EqualsAndHashCode(callSuper=false) @EqualsAndHashCode(callSuper=false)
@TableName("ca_rotators") @TableName("ca_rotators")
public class CaRotatorsEntity extends BaseEpmetEntity { public class CaRotatorsEntity {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;

8
epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/CaRotatorsService.java

@ -4,6 +4,7 @@ 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.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.CaRotatorsResultDTO; import com.epmet.opendata.dto.result.CaRotatorsResultDTO;
import com.epmet.opendata.entity.CaRotatorsEntity; import com.epmet.opendata.entity.CaRotatorsEntity;
@ -85,4 +86,11 @@ public interface CaRotatorsService extends BaseService<CaRotatorsEntity> {
* @return * @return
*/ */
PageData<CaRotatorsResultDTO> getPage(CaRotatorsFormDTO dto); PageData<CaRotatorsResultDTO> getPage(CaRotatorsFormDTO dto);
/**
* 流动人口调用ruoyi接口存储数据
*
* @param dto
*/
void preserRotatorsVation(PreserVationFormDTO dto);
} }

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

@ -112,6 +112,14 @@ public class CaLoudongServiceImpl extends BaseServiceImpl<CaLoudongDao, CaLoudon
return new PageData<>(result, info.getTotal()); return new PageData<>(result, info.getTotal());
} }
/**
* 楼栋基本信息详情
*
* @param dto
* @return com.epmet.opendata.dto.result.CaLoudongDetailsResultDTO
* @author LZN
* @date 2022/6/2 13:40
*/
@Override @Override
public CaLoudongDetailsResultDTO getLouDongDetails(CaLoudongDetailsFormDTO dto) { public CaLoudongDetailsResultDTO getLouDongDetails(CaLoudongDetailsFormDTO dto) {
CaLoudongDetailsResultDTO result = baseDao.getLouDongDetails(dto.getBuildingId()); CaLoudongDetailsResultDTO result = baseDao.getLouDongDetails(dto.getBuildingId());
@ -177,7 +185,7 @@ public class CaLoudongServiceImpl extends BaseServiceImpl<CaLoudongDao, CaLoudon
return returnDate.getTotal(); return returnDate.getTotal();
} }
class ReturnDate { static class ReturnDate {
private int total; private int total;
private List<CaLoudongEntity> list; private List<CaLoudongEntity> list;

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

@ -160,7 +160,7 @@ public class CaPingfangServiceImpl extends BaseServiceImpl<CaPingfangDao, CaPing
return returnDate.getTotal(); return returnDate.getTotal();
} }
class ReturnDate { static class ReturnDate {
private int total; private int total;
private List<CaPingfangEntity> list; private List<CaPingfangEntity> list;

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

@ -166,7 +166,7 @@ public class CaRentalServiceImpl extends BaseServiceImpl<CaRentalDao, CaRentalEn
return returnDate.getTotal(); return returnDate.getTotal();
} }
class ReturnDate { static class ReturnDate {
private int total; private int total;
private List<CaRentalEntity> list; private List<CaRentalEntity> list;

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

@ -178,7 +178,7 @@ public class CaResidentServiceImpl extends BaseServiceImpl<CaResidentDao, CaResi
return returnDate.getTotal(); return returnDate.getTotal();
} }
class ReturnDate { static class ReturnDate {
private int total; private int total;
private List<CaResidentEntity> list; private List<CaResidentEntity> list;

108
epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/CaRotatorsServiceImpl.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.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;
}
}
} }

28
epmet-module/open-data-worker/open-data-worker-server/src/main/resources/mapper/CaLoudongDao.xml

@ -94,33 +94,7 @@
</select> </select>
<select id="getLouDongDetails" resultType="com.epmet.opendata.dto.result.CaLoudongDetailsResultDTO"> <select id="getLouDongDetails" resultType="com.epmet.opendata.dto.result.CaLoudongDetailsResultDTO">
SELECT SELECT
building_id, *
building_type,
grid_id,
building_name,
building_use,
building_status,
building_structure,
building_useage,
construction_time,
building_addr,
community_name,
building_leader,
layer_count,
basement_layer_count,
house_begin_layer,
unit_count,
layer_room_count,
room_count,
elevator_count,
building_area,
building_pmc,
building_desc,
point_status,
longitude,
latitude,
plat_code,
community_id
FROM FROM
ca_loudong ca_loudong
<where> <where>

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

@ -61,6 +61,9 @@
<result property="attribute9" column="attribute9"/> <result property="attribute9" column="attribute9"/>
<result property="attribute10" column="attribute10"/> <result property="attribute10" column="attribute10"/>
</resultMap> </resultMap>
<delete id="deleteAll">
delete from ca_rotators
</delete>
<select id="getPage" resultType="com.epmet.opendata.dto.result.CaRotatorsResultDTO"> <select id="getPage" resultType="com.epmet.opendata.dto.result.CaRotatorsResultDTO">
SELECT SELECT
rotators_id, rotators_id,

Loading…
Cancel
Save