Browse Source

后台管理修改

shilin 2 years ago
parent
commit
a87af1ed02

+ 5 - 0
web/consumer-hb/src/main/java/com/gyee/consumer/config/FeignConfiguration.java

@@ -1,6 +1,7 @@
 package com.gyee.consumer.config;
 
 
+import com.gyee.consumer.fallback.admin.AdminServiceFallbackFactory;
 import com.gyee.consumer.fallback.alarm.AlarmServiceFallbackFactory;
 import com.gyee.consumer.fallback.compare.CompareServiceFallbackFactory;
 import com.gyee.consumer.fallback.goodness.WindturbineGoodnessServiceFallbackFactory;
@@ -134,6 +135,10 @@ public class FeignConfiguration {
     public HealthServiceFallbackFactory healthServiceFallbackFactory() {
         return new HealthServiceFallbackFactory();
     }
+    @Bean
+    public AdminServiceFallbackFactory adminServiceFallbackFactory() {
+        return new AdminServiceFallbackFactory();
+    }
 
 
 }

+ 58 - 0
web/consumer-hb/src/main/java/com/gyee/consumer/controller/admin/AdminController.java

@@ -0,0 +1,58 @@
+package com.gyee.consumer.controller.admin;
+
+
+import com.gyee.common.domain.AjaxResult;
+import com.gyee.consumer.model.TsysUser;
+import com.gyee.consumer.service.admin.compare.AdminService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.ResponseBody;
+
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+@Controller
+@RequestMapping("/admin")
+@Api(value = "系统管理功能",tags =  "系统管理功能")
+public class AdminController {
+    @Resource
+    private AdminService adminService;
+
+    /**
+     * 用户登陆验证
+     *
+     * @param user
+     * @param request
+     * @return
+     */
+    @ApiOperation(value = "用户登陆验证", notes = "用户登陆验证")
+    @PostMapping("/loginvue")
+    @ResponseBody
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "user", value = "用户名称和密码", required = true, dataType = "TsysUser", paramType = "query")})
+
+    public AjaxResult loginvue(TsysUser user,
+                              HttpServletRequest request) {
+        String authToken=request.getHeader("authToken");
+        AjaxResult ajax=adminService.loginvue(user,authToken,request);
+
+        return ajax;
+    }
+
+    @ApiOperation(value = "退出登陆", notes = "退出登陆")
+    @PostMapping("/Loginoutvue")
+    @ResponseBody
+    public AjaxResult Loginoutvue( HttpServletRequest request,HttpServletResponse response){
+
+        AjaxResult ajax=adminService.Loginoutvue(request,response);
+
+        return ajax;
+    }
+
+}

+ 24 - 1
web/consumer-hb/src/main/java/com/gyee/consumer/controller/monitor/MonitorInverterPushController.java

@@ -2,7 +2,6 @@ package com.gyee.consumer.controller.monitor;
 
 import com.gyee.common.domain.AjaxResult;
 import com.gyee.consumer.service.monitor.MonitorInverterPushService;
-
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiImplicitParams;
@@ -58,4 +57,28 @@ public class MonitorInverterPushController {
 
         return ajax;
     }
+
+
+    @GetMapping("/findMatrixByWpId")
+    @ResponseBody
+    @ApiOperation(value = "场站逆变器矩阵", notes = "场站逆变器矩阵")
+    @ApiImplicitParams({ @ApiImplicitParam(name = "wpId", value = "场站编号", required = true, dataType = "string", paramType = "query") })
+    public AjaxResult findMatrixByWpId(String wpId) throws Exception {
+
+        AjaxResult ajax=monitorInverterPushService.findMatrixByWpId(wpId);
+
+        return ajax;
+    }
+
+    @GetMapping("/findMatrix")
+    @ResponseBody
+    @ApiOperation(value = "逆变器矩阵", notes = "逆变器矩阵")
+    @ApiImplicitParams({ })
+    public AjaxResult findMatrix() throws Exception {
+
+        AjaxResult ajax=monitorInverterPushService.findMatrix();
+
+        return ajax;
+
+    }
 }

+ 32 - 0
web/consumer-hb/src/main/java/com/gyee/consumer/fallback/admin/AdminServiceFallbackFactory.java

@@ -0,0 +1,32 @@
+package com.gyee.consumer.fallback.admin;
+
+import com.gyee.common.domain.AjaxResult;
+import com.gyee.consumer.model.TsysUser;
+import com.gyee.consumer.service.admin.compare.AdminService;
+import feign.hystrix.FallbackFactory;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestParam;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+public class AdminServiceFallbackFactory implements FallbackFactory<AdminService> {
+
+    @Override
+    public AdminService create(Throwable throwable) {
+        return new AdminService() {
+
+
+            @Override
+            public AjaxResult loginvue(@RequestBody TsysUser user, @RequestParam("authToken") String authToken, @RequestParam("request") HttpServletRequest request){
+                return  AjaxResult.error(throwable.getMessage());
+            }
+            @Override
+            public AjaxResult Loginoutvue(HttpServletRequest request, HttpServletResponse response){
+                return  AjaxResult.error(throwable.getMessage());
+            }
+
+
+        };
+    }
+}

+ 8 - 1
web/consumer-hb/src/main/java/com/gyee/consumer/fallback/monitor/MonitorInverterPushServiceFallbackFactory.java

@@ -26,7 +26,14 @@ public class MonitorInverterPushServiceFallbackFactory implements FallbackFactor
             public AjaxResult findInverterPowerLine(@RequestParam("wtId") String wtId) throws Exception{
                 return  AjaxResult.error(throwable.getMessage());
             }
-
+            @Override
+            public AjaxResult findMatrixByWpId(@RequestParam("wpId") String wpId) throws Exception{
+                return  AjaxResult.error(throwable.getMessage());
+            }
+            @Override
+            public AjaxResult findMatrix() throws Exception{
+                return  AjaxResult.error(throwable.getMessage());
+            }
         };
     }
 }

+ 138 - 0
web/consumer-hb/src/main/java/com/gyee/consumer/model/TsysUser.java

@@ -0,0 +1,138 @@
+package com.gyee.consumer.model;
+
+import io.swagger.annotations.ApiModelProperty;
+
+import java.io.Serializable;
+
+public class TsysUser implements Serializable {
+	
+	private static final long serialVersionUID = 1L;
+	
+	/** 主键 **/
+	@ApiModelProperty(value = "主键")
+	private String id;
+		
+	/** 用户账号 **/
+	@ApiModelProperty(value = "用户账号")
+	private String username;
+		
+	/** 用户密码 **/
+	@ApiModelProperty(value = "用户密码")
+	private String password;
+		
+	/** 昵称 **/
+	@ApiModelProperty(value = "昵称")
+	private String nickname;
+		
+	/** 部门id **/
+	@ApiModelProperty(value = "部门id")
+	private String depId;
+		
+	/** 岗位id **/
+	@ApiModelProperty(value = "岗位id")
+	private String posId;
+    /** 公司id **/
+    @ApiModelProperty(value = "公司id")
+    private String comId;
+    /**公司名称**/
+    private String comName;
+    /**部门名称**/
+    private String depName;
+    /**岗位名称**/
+    private String posName;
+
+    public TsysUser(String id, String username, String password, String nickname, String depId, String posId, String comId) {
+		super();
+		this.id = id;
+		this.username = username;
+		this.password = password;
+		this.nickname = nickname;
+		this.depId = depId;
+		this.posId = posId;
+        this.comId = comId;
+	}
+
+	public TsysUser() {
+        super();
+    }
+
+    public String getId() {
+        return id;
+    }
+
+    public void setId(String id) {
+        this.id = id == null ? null : id.trim();
+    }
+
+    public String getUsername() {
+        return username;
+    }
+
+    public void setUsername(String username) {
+        this.username = username == null ? null : username.trim();
+    }
+
+    public String getPassword() {
+        return password;
+    }
+
+    public void setPassword(String password) {
+        this.password = password == null ? null : password.trim();
+    }
+
+    public String getNickname() {
+        return nickname;
+    }
+
+    public void setNickname(String nickname) {
+        this.nickname = nickname == null ? null : nickname.trim();
+    }
+	public String getDepId() {
+        return depId;
+    }
+
+    public void setDepId(String depId) {
+        this.depId = depId;
+    }
+	 
+			
+	public String getPosId() {
+        return posId;
+    }
+
+    public void setPosId(String posId) {
+        this.posId = posId;
+    }
+
+	public String getDepName() {
+		return depName;
+	}
+
+	public void setDepName(String depName) {
+		this.depName = depName;
+	}
+
+	public String getPosName() {
+		return posName;
+	}
+
+	public void setPosName(String posName) {
+		this.posName = posName;
+	}
+
+    public String getComId() {
+        return comId;
+    }
+
+    public void setComId(String comId) {
+        this.comId = comId;
+    }
+
+    public String getComName() {
+        return comName;
+    }
+
+    public void setComName(String comName) {
+        this.comName = comName;
+    }
+}

+ 26 - 0
web/consumer-hb/src/main/java/com/gyee/consumer/service/admin/compare/AdminService.java

@@ -0,0 +1,26 @@
+package com.gyee.consumer.service.admin.compare;
+
+
+import com.gyee.common.domain.AjaxResult;
+import com.gyee.consumer.config.FeignConfiguration;
+import com.gyee.consumer.fallback.admin.AdminServiceFallbackFactory;
+import com.gyee.consumer.model.TsysUser;
+import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestParam;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+@FeignClient(name = "admin",url = "${provider.adminurl}",
+        fallbackFactory = AdminServiceFallbackFactory.class,
+        configuration = FeignConfiguration.class)
+public interface AdminService {
+
+    /**登录**/
+    @PostMapping("/admin/loginvue")
+    public AjaxResult loginvue(@RequestBody TsysUser user,@RequestParam("authToken") String authToken, @RequestParam("request") HttpServletRequest request) ;
+    @PostMapping("/admin/Loginoutvue")
+    public AjaxResult Loginoutvue(@RequestParam("request") HttpServletRequest request, @RequestParam("response") HttpServletResponse response);
+}

+ 9 - 1
web/consumer-hb/src/main/java/com/gyee/consumer/service/monitor/MonitorInverterPushService.java

@@ -21,4 +21,12 @@ public interface MonitorInverterPushService {
 
     @GetMapping("/monitorinverter/findInverterPowerLine")
       public AjaxResult findInverterPowerLine(@RequestParam("wtId") String wtId) throws Exception;
-}
+
+    @GetMapping("/monitorinverter/findMatrixByWpId")
+    public AjaxResult findMatrixByWpId(@RequestParam("wpId") String wpId) throws Exception;
+
+    @GetMapping("/monitorinverter/findMatrix")
+    public AjaxResult findMatrix() throws Exception;
+
+
+    }

+ 6 - 0
web/consumer-hb/src/main/resources/application-jn.yml

@@ -107,6 +107,12 @@ provider:
   analysisurl: http://10.81.3.155:8171/
   adminurl: http://10.81.3.155:8171/
   alarmurl: http://10.81.3.155:8171/
+
+#  monitorurl: http://192.168.56.1:8171/
+#  healthurl: http://192.168.56.1:8171/
+#  analysisurl: http://192.168.56.1:8171/
+#  adminurl: http://192.168.56.1:8171/
+#  alarmurl: http://192.168.56.1:8171/
 management:
   endpoints:
     jmx:

+ 1 - 1
web/consumer-hb/src/main/resources/application.yml

@@ -1,4 +1,4 @@
 spring:
   profiles:
-    active: hf
+    active: jn
 #    active: jn