Commit 7ca60176 authored by ankh's avatar ankh

坡度比优化

parent 2f9eb135
...@@ -27,7 +27,7 @@ import java.util.List; ...@@ -27,7 +27,7 @@ import java.util.List;
@ApiModel(value = "干滩") @ApiModel(value = "干滩")
@Getter @Getter
@Setter @Setter
@TableName("tb_ndb_data") @TableName("tb_db_data")
public class DbData implements Serializable { public class DbData implements Serializable {
public static final long serialVersionUID = 1L; public static final long serialVersionUID = 1L;
......
...@@ -287,6 +287,24 @@ public class DbDataServiceImpl extends ServiceImpl<DbDataMapper, DbData> impleme ...@@ -287,6 +287,24 @@ public class DbDataServiceImpl extends ServiceImpl<DbDataMapper, DbData> impleme
Page<DbData> dbDataPage = new Page<>(page + 1, size); Page<DbData> dbDataPage = new Page<>(page + 1, size);
dbDataPage = dbDataMapper.selectPage(dbDataPage, dbDataQueryWrapper); dbDataPage = dbDataMapper.selectPage(dbDataPage, dbDataQueryWrapper);
List<DbData> records = dbDataPage.getRecords(); 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(); long total = dbDataPage.getTotal();
//获取编码-名字map //获取编码-名字map
HashMap<String, String> noName = ServiceUtil.getNoName(request); HashMap<String, String> noName = ServiceUtil.getNoName(request);
...@@ -344,6 +362,7 @@ public class DbDataServiceImpl extends ServiceImpl<DbDataMapper, DbData> impleme ...@@ -344,6 +362,7 @@ public class DbDataServiceImpl extends ServiceImpl<DbDataMapper, DbData> impleme
record.setDanwei(noDan.get(record.getSensorid())); record.setDanwei(noDan.get(record.getSensorid()));
} }
} }
map.put("list", records); map.put("list", records);
map.put("total", total); map.put("total", total);
return map; return map;
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId> <artifactId>spring-boot-starter-parent</artifactId>
<version>2.6.7</version> <version>2.6.7</version>
<relativePath/>
</parent> </parent>
<properties> <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