|
@@ -8,6 +8,7 @@ import com.gyee.impala.model.custom.diagnose.FaultInfo;
|
|
|
import com.gyee.impala.model.master.Casefaultalg;
|
|
|
import com.gyee.impala.service.custom.diagnose.AutoCmdService;
|
|
|
import com.gyee.impala.service.master.CasefaultalgService;
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
import java.util.ArrayList;
|
|
@@ -30,6 +31,7 @@ public class DiagnoseFaultController {
|
|
|
|
|
|
@GetMapping("/offline")
|
|
|
public JSONObject offline(@RequestParam(value = "station", required = false) String station,
|
|
|
+ @RequestParam(value = "windturbindid", required = false) String wtId,
|
|
|
@RequestParam(value = "id", required = false) String[] id,
|
|
|
@RequestParam(value = "faultid", required = false) Long[] faultid,
|
|
|
@RequestParam(value = "model", required = false) String[] model,
|
|
@@ -40,13 +42,20 @@ public class DiagnoseFaultController {
|
|
|
@RequestParam(value = "confirm", required = false) Optional<Boolean> confirm){
|
|
|
boolean conf = confirm.isPresent() ? confirm.get() : false;
|
|
|
if (conf){
|
|
|
- List<Casefaultalg> list = casefaultalgService.getAll(station, id, faultid, model, faultcode, st, et, algcode, false);
|
|
|
+ List<Casefaultalg> list = casefaultalgService.getAll(station, wtId, id, faultid, model, faultcode, st, et, algcode, false);
|
|
|
return JsonResult.successData(ResultCode.SUCCESS, list);
|
|
|
}else{
|
|
|
List<Casefaultalg> array = new ArrayList<>();
|
|
|
- List<Casefaultalg> list = casefaultalgService.getAll(station, id, faultid, model, faultcode, st, et, algcode, false);
|
|
|
+ List<Casefaultalg> list = casefaultalgService.getAll(station, wtId, id, faultid, model, faultcode, st, et, algcode, false);
|
|
|
List<FaultInfo> faults = remoteServiceBuilder.sharding().getFaultRecent(et);
|
|
|
- List<FaultInfo> collect = faults.stream().filter(f -> f.getCategory1().equals("FJ") && f.getCategory2().equals("GZ")).collect(Collectors.toList());
|
|
|
+ List<FaultInfo> collect;
|
|
|
+ if (!StringUtils.isEmpty(wtId))
|
|
|
+ collect = faults.stream().filter(f -> f.getCategory1().equals("FJ")
|
|
|
+ && f.getCategory2().equals("GZ")&& f.getWindturbineId().equals(wtId)).collect(Collectors.toList());
|
|
|
+ else
|
|
|
+ collect = faults.stream().filter(f -> f.getCategory1().equals("FJ")
|
|
|
+ && f.getCategory2().equals("GZ")).collect(Collectors.toList());
|
|
|
+
|
|
|
for (int i = 0; i < collect.size(); i++){
|
|
|
FaultInfo info = collect.get(i);
|
|
|
if (list == null || list.size() == 0){
|
|
@@ -63,7 +72,12 @@ public class DiagnoseFaultController {
|
|
|
|
|
|
|
|
|
@PostMapping("/offlinediagnose")
|
|
|
- public JSONObject offlineDiagnose(@RequestBody List<Casefaultalg> faults){
|
|
|
+ public JSONObject offlineDiagnose(@RequestBody JSONObject json){
|
|
|
+ if (json == null)
|
|
|
+ return JsonResult.error(ResultCode.PARAM_IS_BLANK);
|
|
|
+
|
|
|
+ String model = json.getString("model");
|
|
|
+ List<Casefaultalg> faults = JSONObject.parseArray(json.getJSONArray("faults").toString(), Casefaultalg.class);
|
|
|
faults.stream().forEach(obj -> {
|
|
|
FaultInfo info = new FaultInfo();
|
|
|
info.setStationId(obj.getStationen());
|