|
@@ -1,3 +1,4 @@
|
|
|
+package com.gyee.power.fitting.controller.fj;
|
|
|
package com.gyee.power.fitting.controller.gf;
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
@@ -12,6 +13,7 @@ import com.gyee.power.fitting.service.impl.IvPvCurveFittingService;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
+import javax.servlet.http.HttpServletResponse;
|
|
|
import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
@@ -116,10 +118,9 @@ public class PhotovoltaicController {
|
|
|
//功率-光照-温度曲线
|
|
|
@PostMapping("/analysis/powerbeam")
|
|
|
private JSONObject powerBeamTemperature(@RequestBody JSONObject filename) {
|
|
|
- String fn = filename.getString("filename");
|
|
|
- String[] split = fn.split(",");
|
|
|
- if (split.length > 450) return JsonResult.error(ResultCode.PARAM_NOT_VALID);
|
|
|
- List<PhotovoltaicInfo> infos = curveFittingService.calculatFitting(Arrays.asList(split));
|
|
|
+ List<String> strings = jsonObj2List(filename);
|
|
|
+ if (strings.size() > 450) return JsonResult.error(ResultCode.PARAM_NOT_VALID);
|
|
|
+ List<PhotovoltaicInfo> infos = curveFittingService.calculatFitting(strings);
|
|
|
List<double[]> b = curveFittingService.oneFileFitting(infos);
|
|
|
infos = infos.stream().filter(i -> i.getS() > 1).sorted(Comparator.comparing(PhotovoltaicInfo::getS)).collect(Collectors.toList());
|
|
|
|
|
@@ -142,4 +143,23 @@ public class PhotovoltaicController {
|
|
|
return JsonResult.successData(ResultCode.SUCCESS, map);
|
|
|
}
|
|
|
|
|
|
+ //文件删除
|
|
|
+ @DeleteMapping("/delete/files")
|
|
|
+ private JSONObject deleteFiles(@RequestBody JSONObject filename) {
|
|
|
+ List<String> strings = jsonObj2List(filename);
|
|
|
+ int i = curveFittingService.deleteFiles(strings);
|
|
|
+ return JsonResult.successData(ResultCode.SUCCESS, "共删除" + i + "个文件,删除失败" + (strings.size() - i) + "个!");
|
|
|
+ }
|
|
|
+
|
|
|
+ private List<String> jsonObj2List(JSONObject filename) {
|
|
|
+ String fn = filename.getString("filename");
|
|
|
+ String[] split = fn.split(",");
|
|
|
+ return Arrays.asList(split);
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("/export/files")
|
|
|
+ private void exportFiles(HttpServletResponse response, @RequestParam("filename") String filename) {
|
|
|
+ String[] split = filename.split(",");
|
|
|
+ curveFittingService.downFiles(Arrays.asList(split), response);
|
|
|
+ }
|
|
|
}
|