|
@@ -0,0 +1,77 @@
|
|
|
+package com.gyee.alarm.controller;
|
|
|
+
|
|
|
+
|
|
|
+import com.gyee.alarm.model.auto.ProBasicPowerstation;
|
|
|
+import com.gyee.alarm.model.auto.ProBasicSubStation;
|
|
|
+import com.gyee.alarm.model.vo.AjaxResult;
|
|
|
+import com.gyee.alarm.model.vo.AjaxStatus;
|
|
|
+import com.gyee.alarm.model.vo.AlarmTypeValue;
|
|
|
+import com.gyee.alarm.service.TokenService;
|
|
|
+import com.gyee.alarm.util.StringUtils;
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
+import org.springframework.web.bind.annotation.GetMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
+import org.springframework.web.context.request.RequestContextHolder;
|
|
|
+import org.springframework.web.context.request.ServletRequestAttributes;
|
|
|
+
|
|
|
+import javax.annotation.Resource;
|
|
|
+import javax.servlet.http.HttpServletRequest;
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+/**
|
|
|
+ * <p>
|
|
|
+ * 前端控制器
|
|
|
+ * </p>
|
|
|
+ *
|
|
|
+ * @author shilin
|
|
|
+ * @since 2024-10-28
|
|
|
+ */
|
|
|
+@RestController
|
|
|
+@RequestMapping("///electricity")
|
|
|
+public class ProEconAlarmRealController {
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private TokenService tokenService;
|
|
|
+
|
|
|
+
|
|
|
+ @GetMapping(value = "/czlist")
|
|
|
+ @ApiOperation(value = "查询场站列表", notes = "查询场站列表")
|
|
|
+ public AjaxResult queryWplList(String types) {
|
|
|
+
|
|
|
+ HttpServletRequest request = ((ServletRequestAttributes) (RequestContextHolder.currentRequestAttributes())).getRequest();
|
|
|
+ List<ProBasicPowerstation> wpls = tokenService.getWpls(request);
|
|
|
+ List<ProBasicPowerstation> vos = new ArrayList<>();
|
|
|
+ if(!wpls.isEmpty())
|
|
|
+ {
|
|
|
+ for(ProBasicPowerstation wp:wpls)
|
|
|
+ {
|
|
|
+ if(StringUtils.notEmp(types))
|
|
|
+ {
|
|
|
+ if(types.equals(AlarmTypeValue.WT.getCode()) && wp.getId().contains("FDC"))
|
|
|
+ {
|
|
|
+ vos.add(wp);
|
|
|
+ }else if(types.equals(AlarmTypeValue.IN.getCode()) && wp.getId().contains("GDC"))
|
|
|
+ {
|
|
|
+ vos.add(wp);
|
|
|
+ }else if(types.equals(AlarmTypeValue.BT.getCode()))
|
|
|
+ {
|
|
|
+ List<ProBasicSubStation> subwpls = tokenService.getSubwpls(request);
|
|
|
+ return AjaxResult.successData(AjaxStatus.success.code, subwpls);
|
|
|
+ }
|
|
|
+ }else
|
|
|
+ {
|
|
|
+ vos =wpls;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (StringUtils.notEmp(vos)) {
|
|
|
+
|
|
|
+ return AjaxResult.successData(AjaxStatus.success.code, vos);
|
|
|
+ } else {
|
|
|
+ return AjaxResult.successData(AjaxStatus.loginexpire.code, "error");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+}
|