diff --git a/radar-service-impl/src/main/java/com/pgmmers/radar/service/impl/engine/AggregateCommandImpl.java b/radar-service-impl/src/main/java/com/pgmmers/radar/service/impl/engine/AggregateCommandImpl.java index 5febef1..4e7e99e 100644 --- a/radar-service-impl/src/main/java/com/pgmmers/radar/service/impl/engine/AggregateCommandImpl.java +++ b/radar-service-impl/src/main/java/com/pgmmers/radar/service/impl/engine/AggregateCommandImpl.java @@ -123,12 +123,14 @@ public class AggregateCommandImpl implements AggregateCommand { } else { int model = docList.size() % 2; if (model == 1) { - doc = docList.get(model); + int pos = docList.size() / 2; + doc = docList.get(pos); median = new BigDecimal(doc.get(funcField).toString()); } else { - doc = docList.get(model); + int pos = docList.size() / 2; + doc = docList.get(pos); median = new BigDecimal(doc.get(funcField).toString()); - doc = docList.get(model - 1); + doc = docList.get(pos - 1); BigDecimal tmp = new BigDecimal(doc.get(funcField).toString()); median = median.add(tmp).divide(new BigDecimal(2), 2, 4); } diff --git a/sql/radar-1.0.8.sql b/sql/radar-1.0.8.sql index 5e769df..b0d5f79 100644 --- a/sql/radar-1.0.8.sql +++ b/sql/radar-1.0.8.sql @@ -2,4 +2,4 @@ ALTER TABLE `engine_rule` ADD COLUMN `MAX` int(11) NOT NULL DEFAULT 0 COMMENT '最大得分值' AFTER `RATE`; ALTER TABLE `engine_data_list_records` - ADD COLUMN `DATA_REMARK` varchar(32) NULL COMMENT '数据备注'; + ADD COLUMN `DATA_REMARK` varchar(32) NULL COMMENT '数据备注' AFTER `DATA_RECORD`;