Commit 7ca60176 authored by ankh's avatar ankh

坡度比优化

parent 2f9eb135
......@@ -27,7 +27,7 @@ import java.util.List;
@ApiModel(value = "干滩")
@Getter
@Setter
@TableName("tb_ndb_data")
@TableName("tb_db_data")
public class DbData implements Serializable {
public static final long serialVersionUID = 1L;
......
......@@ -287,6 +287,24 @@ public class DbDataServiceImpl extends ServiceImpl<DbDataMapper, DbData> impleme
Page<DbData> dbDataPage = new Page<>(page + 1, size);
dbDataPage = dbDataMapper.selectPage(dbDataPage, dbDataQueryWrapper);
List<DbData> records = dbDataPage.getRecords();
// 插入计算 lenth / safeheight * 1000 并 setAngle 的逻辑
for (DbData record : records) {
if (record.getLenth() != null && record.getSafeheight() != null
&& !record.getSafeheight().equals("0")) {
try {
double lenthValue = Double.parseDouble(record.getLenth());
double safeheightValue = Double.parseDouble(record.getSafeheight());
double result = (safeheightValue / lenthValue) * 1000;
record.setAngle(String.format("%.4f", result)); // 存入 angle 字段
} catch (NumberFormatException e) {
record.setAngle(null);
}
} else {
record.setAngle(null);
}
}
long total = dbDataPage.getTotal();
//获取编码-名字map
HashMap<String, String> noName = ServiceUtil.getNoName(request);
......@@ -344,6 +362,7 @@ public class DbDataServiceImpl extends ServiceImpl<DbDataMapper, DbData> impleme
record.setDanwei(noDan.get(record.getSensorid()));
}
}
map.put("list", records);
map.put("total", total);
return map;
......
......@@ -24,6 +24,7 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.6.7</version>
<relativePath/>
</parent>
<properties>
......
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