Commit 93144e2c authored by tianbo's avatar tianbo

纬度字段取值错误修改

parent 30f3572b
...@@ -179,6 +179,6 @@ public class CylinderInfo { ...@@ -179,6 +179,6 @@ public class CylinderInfo {
/** /**
* 纬度 * 纬度
*/ */
@TableField("longitude") @TableField("latitude")
private String latitude; private String latitude;
} }
...@@ -2,6 +2,7 @@ package com.yeejoin.amos.boot.module.tzs.biz.service.impl; ...@@ -2,6 +2,7 @@ package com.yeejoin.amos.boot.module.tzs.biz.service.impl;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; 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.EsSpecialEquipmentDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.SpecialEquipmentDto; import com.yeejoin.amos.boot.module.tzs.api.dto.SpecialEquipmentDto;
import com.yeejoin.amos.boot.module.tzs.api.entity.EsCylinder; import com.yeejoin.amos.boot.module.tzs.api.entity.EsCylinder;
...@@ -48,27 +49,33 @@ public class ESCylinderServiceImpl { ...@@ -48,27 +49,33 @@ public class ESCylinderServiceImpl {
* 保存气瓶信息 * 保存气瓶信息
* </pre> * </pre>
* *
* @param cylinderInfo 保存气瓶信息 * @param cylinderInfoList 保存气瓶信息
*/ */
public EsCylinder saveEsCylinderToES(CylinderInfo cylinderInfo) { public boolean saveEsCylinderToES(List<CylinderInfo> cylinderInfoList) {
EsCylinder esCylinder = new EsCylinder(); List<EsCylinder> esCylinderList = Lists.newArrayList();
if (StringUtils.isNotEmpty(cylinderInfo.getLongitude())) { if (!ValidationUtil.isEmpty(cylinderInfoList)) {
esCylinder.setLongitude(Double.parseDouble(cylinderInfo.getLongitude())); cylinderInfoList.forEach(cylinderInfo -> {
} EsCylinder esCylinder = new EsCylinder();
if (StringUtils.isNotEmpty(cylinderInfo.getLatitude())) { if (StringUtils.isNotEmpty(cylinderInfo.getLongitude())) {
esCylinder.setLatitude(Double.parseDouble(cylinderInfo.getLatitude())); esCylinder.setLongitude(Double.parseDouble(cylinderInfo.getLongitude()));
} }
esCylinder.setSequenceNbr(cylinderInfo.getSequenceNbr()); if (StringUtils.isNotEmpty(cylinderInfo.getLatitude())) {
esCylinder.setLatitude(Double.parseDouble(cylinderInfo.getLatitude()));
}
esCylinder.setSequenceNbr(cylinderInfo.getSequenceNbr());
// esCylinder.setAddress(cylinder.getAddress()); // esCylinder.setAddress(cylinder.getAddress());
esCylinder.setFactoryNum(cylinderInfo.getFactoryNum()); esCylinder.setFactoryNum(cylinderInfo.getFactoryNum());
esCylinder.setUnitName(cylinderInfo.getUnitName()); esCylinder.setUnitName(cylinderInfo.getUnitName());
if (StringUtils.isNotBlank(cylinderInfo.getLatitude()) && StringUtils.isNotBlank(cylinderInfo.getLongitude())) { if (StringUtils.isNotBlank(cylinderInfo.getLatitude()) && StringUtils.isNotBlank(cylinderInfo.getLongitude())) {
Double lat = Double.parseDouble(cylinderInfo.getLatitude()); double lat = Double.parseDouble(cylinderInfo.getLatitude());
Double lon = Double.parseDouble(cylinderInfo.getLongitude()); double lon = Double.parseDouble(cylinderInfo.getLongitude());
esCylinder.setLocation(new GeoPoint(lat, lon)); esCylinder.setLocation(new GeoPoint(lat, lon));
}
esCylinderList.add(esCylinder);
});
} }
esCylinderRepository.save(esCylinder); esCylinderRepository.saveAll(esCylinderList);
return esCylinder; return true;
} }
public Page<SpecialEquipmentDto> queryPageByDto(EsSpecialEquipmentDto esSpecialEquipmentDto, int current, int size) { public Page<SpecialEquipmentDto> queryPageByDto(EsSpecialEquipmentDto esSpecialEquipmentDto, int current, int size) {
......
...@@ -927,10 +927,7 @@ public class CylinderInfoController extends BaseController { ...@@ -927,10 +927,7 @@ public class CylinderInfoController extends BaseController {
cylinderInfoPage.setCurrent(i); cylinderInfoPage.setCurrent(i);
cylinderInfoPage.setSize(500); cylinderInfoPage.setSize(500);
cylinderInfoPage = cylinderInfoServiceImpl.page(cylinderInfoPage); cylinderInfoPage = cylinderInfoServiceImpl.page(cylinderInfoPage);
for (CylinderInfo el : cylinderInfoPage.getRecords() esCylinderService.saveEsCylinderToES(cylinderInfoPage.getRecords());
) {
esCylinderService.saveEsCylinderToES(el);
}
} }
} }
......
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