Commit 93144e2c authored by tianbo's avatar tianbo

纬度字段取值错误修改

parent 30f3572b
......@@ -179,6 +179,6 @@ public class CylinderInfo {
/**
* 纬度
*/
@TableField("longitude")
@TableField("latitude")
private String latitude;
}
......@@ -2,6 +2,7 @@ package com.yeejoin.amos.boot.module.tzs.biz.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.google.common.collect.Lists;
import com.yeejoin.amos.boot.module.tzs.api.dto.EsSpecialEquipmentDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.SpecialEquipmentDto;
import com.yeejoin.amos.boot.module.tzs.api.entity.EsCylinder;
......@@ -48,9 +49,12 @@ public class ESCylinderServiceImpl {
* 保存气瓶信息
* </pre>
*
* @param cylinderInfo 保存气瓶信息
* @param cylinderInfoList 保存气瓶信息
*/
public EsCylinder saveEsCylinderToES(CylinderInfo cylinderInfo) {
public boolean saveEsCylinderToES(List<CylinderInfo> cylinderInfoList) {
List<EsCylinder> esCylinderList = Lists.newArrayList();
if (!ValidationUtil.isEmpty(cylinderInfoList)) {
cylinderInfoList.forEach(cylinderInfo -> {
EsCylinder esCylinder = new EsCylinder();
if (StringUtils.isNotEmpty(cylinderInfo.getLongitude())) {
esCylinder.setLongitude(Double.parseDouble(cylinderInfo.getLongitude()));
......@@ -63,12 +67,15 @@ public class ESCylinderServiceImpl {
esCylinder.setFactoryNum(cylinderInfo.getFactoryNum());
esCylinder.setUnitName(cylinderInfo.getUnitName());
if (StringUtils.isNotBlank(cylinderInfo.getLatitude()) && StringUtils.isNotBlank(cylinderInfo.getLongitude())) {
Double lat = Double.parseDouble(cylinderInfo.getLatitude());
Double lon = Double.parseDouble(cylinderInfo.getLongitude());
double lat = Double.parseDouble(cylinderInfo.getLatitude());
double lon = Double.parseDouble(cylinderInfo.getLongitude());
esCylinder.setLocation(new GeoPoint(lat, lon));
}
esCylinderRepository.save(esCylinder);
return esCylinder;
esCylinderList.add(esCylinder);
});
}
esCylinderRepository.saveAll(esCylinderList);
return true;
}
public Page<SpecialEquipmentDto> queryPageByDto(EsSpecialEquipmentDto esSpecialEquipmentDto, int current, int size) {
......
......@@ -927,10 +927,7 @@ public class CylinderInfoController extends BaseController {
cylinderInfoPage.setCurrent(i);
cylinderInfoPage.setSize(500);
cylinderInfoPage = cylinderInfoServiceImpl.page(cylinderInfoPage);
for (CylinderInfo el : cylinderInfoPage.getRecords()
) {
esCylinderService.saveEsCylinderToES(el);
}
esCylinderService.saveEsCylinderToES(cylinderInfoPage.getRecords());
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment