@PostMapping("saveColors")public ResponseEntitysaveColors(@RequestBody RiskLevel riskLevel)
{
List colors =riskLevel.getColors();if(!CollectionUtils.isEmpty(colors)) {int cntColors =colors.size();for (int i = 0; i < cntColors; i++) {
String color=colors.get(i);if (!StringUtils.isEmpty(color)) {
defaultConfig.getColors().set(i, color);
}
}
}
Rule rule=riskLevel.getRule();if(Objects.nonNull(rule)) {
List provinces =rule.getProvince();if(!CollectionUtils.isEmpty(provinces))
{int cntProvinces =provinces.size();for (int i = 0; i < cntProvinces; i++) {
Integer province=provinces.get(i);if(Objects.nonNull(province))
{
rule.getProvince().set(i,province);
}
}
}
List cities =rule.getCity();if(!CollectionUtils.isEmpty(cities))
{int cntCities =cities.size();for (int i = 0; i < cntCities; i++) {
Integer city=cities.get(i);if(Objects.nonNull(city))
{
rule.getCity().set(i, city);
}
}
}
List areas =rule.getArea();if(!CollectionUtils.isEmpty(areas))
{int cntAreas =areas.size();for (int i = 0; i < cntAreas; i++) {
Integer city=areas.get(i);if(Objects.nonNull(city))
{
rule.getArea().set(i, city);
}
}
}
defaultConfig.setRule(rule);
}
riskService.updateLevel(defaultConfig);
byteDanceDataService.updateWeight();return ResponseEntity.status(HttpStatus.OK).body(Collections.singletonMap("message","保存成功"));
}