!23 一些优化项

Merge pull request !23 from Radar/develop
This commit is contained in:
Radar
2023-08-27 16:14:30 +00:00
committed by Gitee
6 changed files with 17 additions and 8 deletions

View File

@@ -34,6 +34,9 @@ import java.util.List;
@Api(value = "ActivationApi", description = "策略集管理相关操作", tags = {"策略集API"})
public class ActivationApiController {
/**
* service.
*/
@Autowired
private ActivationService activationService;

View File

@@ -30,6 +30,7 @@ public class AggregateCommandImpl implements AggregateCommand {
return count(modelId, searchField, searchFieldValue, refDateName,"1", begin, end);
}
@Override
public long count(String modelId, String searchField, Object searchFieldValue, String refDateName, String status, Date begin,
Date end) {
String collectionName = "entity_" + modelId;
@@ -123,12 +124,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);
}

View File

@@ -55,7 +55,7 @@ public class EntityServiceImpl implements EntityService {
Document filter = new Document();
filter.append(model.getEntryName(), eventId);
Document updateDoc = new Document();
updateDoc.append("status",status);
updateDoc.append("status", status);
String collectionName = buildCollectionName(modelId);
return mongoService.update(collectionName, filter, updateDoc);
}
@@ -68,7 +68,7 @@ public class EntityServiceImpl implements EntityService {
Document attach = Document.parse(attachJson);
ModelVO model = modelService.getModelById(modelId);
attach.put("radar_ref_datetime", new Date(doc.getLong(model.getReferenceDate())));
attach.put("status", 1);
attach.put("status", "1");
doc.putAll(attach);
if (!isAllowDuplicate) {
//设置查询条件

View File

@@ -208,7 +208,7 @@ public class ModelServiceImpl extends BaseLocalCacheService implements ModelServ
// add status.
Document statusKey = new Document();
statusKey.put("status", 1);
statusKey.put("status", "1");
IndexModel statusIndex = new IndexModel(statusKey);
indexes.add(statusIndex);

View File

@@ -11,7 +11,10 @@ import com.pgmmers.radar.vo.model.ModelVO;
import com.pgmmers.radar.vo.model.PreItemVO;
import com.pgmmers.radar.vo.model.RuleVO;
/**
* cache service.
* @author feihu.wang
*/
public interface CacheService {
void saveAntiFraudResult(String modelId, String sessionId, CommonResult result);

View File

@@ -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`;