|
@@ -10,6 +10,7 @@ import org.springframework.web.bind.annotation.RequestParam;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
+import java.text.DecimalFormat;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.Map;
|
|
|
|
|
@@ -24,12 +25,14 @@ public class SoundController extends BaseController {
|
|
|
|
|
|
@ApiOperation(value = "评分")
|
|
|
@PostMapping("compare")
|
|
|
- public HttpResponseResult compare(@RequestParam("record") MultipartFile file, Integer musicScoreId){
|
|
|
- Map<String, Double> result = new HashMap<>();
|
|
|
+ public HttpResponseResult compare(@RequestParam("record") MultipartFile record, Integer musicScoreId){
|
|
|
+ Map<String, String> result = new HashMap<>();
|
|
|
|
|
|
- result.put("score", Math.random()*100);
|
|
|
- result.put("cadence", Math.random()*100);
|
|
|
- result.put("integrity", Math.random()*100);
|
|
|
+ DecimalFormat df = new DecimalFormat("######0.00");
|
|
|
+
|
|
|
+ result.put("score", df.format(Math.random()*100));
|
|
|
+ result.put("cadence", df.format(Math.random()*100));
|
|
|
+ result.put("integrity", df.format(Math.random()*100));
|
|
|
|
|
|
return succeed(result);
|
|
|
}
|