Selaa lähdekoodia

Merge branch 'master' into feature-fiveep-2021-7-12

jichaobo 4 vuotta sitten
vanhempi
commit
672ffb583a

+ 5 - 4
fiveep-controller/src/main/java/com/bizmatics/controller/web/AlarmPowerController.java

@@ -8,6 +8,7 @@ import com.bizmatics.service.AlarmPowerService;
 import com.bizmatics.service.vo.ApCountVO;
 import com.bizmatics.service.vo.CommonIcoVO;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 
 import org.springframework.web.bind.annotation.RequestParam;
@@ -37,7 +38,7 @@ public class AlarmPowerController {
      * @param siteId 站点id
      * @return
      */
-    @RequestMapping("/count")
+    @GetMapping("/count")
     public ApiResult<ApCountVO> count(@RequestParam(required = false) Integer siteId) {
         return ApiResult.success(alarmPowerService.selectCount(siteId));
     }
@@ -50,7 +51,7 @@ public class AlarmPowerController {
      * @param siteId 站点id
      * @return
      */
-    @RequestMapping("/trendIco")
+    @GetMapping("/trendIco")
     public ApiResult<List<CommonIcoVO>> selectByDate(@RequestParam Integer days,
                                                      @RequestParam Date endTime,
                                                      @RequestParam(required = false) Integer siteId){
@@ -68,7 +69,7 @@ public class AlarmPowerController {
      * @param size 条数
      * @return
      */
-    @RequestMapping("/page")
+    @GetMapping("/page")
     public ApiResult<CommonPage<AlarmPower>> page(@RequestParam(required = false) Date startTime,
                                                   @RequestParam(required = false) Date endTime,
                                                   @RequestParam(required = false) Integer status,
@@ -92,7 +93,7 @@ public class AlarmPowerController {
      * @param siteId 站点
      * @return
      */
-    @RequestMapping("/export")
+    @GetMapping("/export")
     public ApiResult<String> export(@RequestParam(required = false) Date startTime,
                                                   @RequestParam(required = false) Date endTime,
                                                   @RequestParam(required = false) Integer status,

+ 3 - 2
fiveep-controller/src/main/java/com/bizmatics/controller/web/DeviceController.java

@@ -5,6 +5,7 @@ import com.bizmatics.common.core.bean.ApiResult;
 import com.bizmatics.service.DeviceService;
 import com.bizmatics.service.vo.DeviceCountVO;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 
 import org.springframework.web.bind.annotation.RequestParam;
@@ -32,7 +33,7 @@ public class DeviceController {
      * @param endTime
      * @return
      */
-    @RequestMapping("/count")
+    @GetMapping("/count")
     public ApiResult<DeviceCountVO> count(@RequestParam Date startTime, @RequestParam Date endTime){
         return ApiResult.success(deviceService.selectDeviceCount(startTime,endTime));
     }
@@ -43,7 +44,7 @@ public class DeviceController {
      * @param site 站点id
      * @return
      */
-    @RequestMapping("/deviceTypeCount")
+    @GetMapping("/deviceTypeCount")
     public ApiResult<DeviceCountVO> selectDeviceCountByType(@RequestParam Integer site){
         return ApiResult.success(deviceService.selectDeviceCountByType(site));
     }

+ 1 - 0
fiveep-controller/src/main/java/com/bizmatics/controller/web/DeviceStatusController.java

@@ -5,6 +5,7 @@ import com.bizmatics.model.DeviceStatus;
 import com.bizmatics.service.DeviceStatusService;
 import org.checkerframework.checker.units.qual.A;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 
 import org.springframework.stereotype.Controller;

+ 2 - 1
fiveep-controller/src/main/java/com/bizmatics/controller/web/FacilityController.java

@@ -5,6 +5,7 @@ import com.bizmatics.service.FacilityService;
 import com.bizmatics.service.vo.FacilityCountVO;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
@@ -29,7 +30,7 @@ public class FacilityController {
      * @param siteId
      * @return
      */
-    @RequestMapping("count")
+    @GetMapping("count")
     public ApiResult<List<FacilityCountVO>> getCount(@RequestParam Integer siteId){
         return ApiResult.success(facilityService.getCount(siteId));
     }

+ 7 - 6
fiveep-controller/src/main/java/com/bizmatics/controller/web/HtAnalogDataController.java

@@ -7,6 +7,7 @@ import com.bizmatics.service.vo.CommonIcoVO;
 import com.bizmatics.service.vo.HadCountVO;
 import com.bizmatics.service.vo.TimeShareVO;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 
 import org.springframework.web.bind.annotation.RequestParam;
@@ -34,7 +35,7 @@ public class HtAnalogDataController {
      * 首页日/月/年用电量
      * @return
      */
-    @RequestMapping("count")
+    @GetMapping("count")
     public ApiResult<HadCountVO> count(){
         return ApiResult.success(htAnalogDataService.selectCount());
     }
@@ -45,7 +46,7 @@ public class HtAnalogDataController {
      * @param siteId 站点id
      * @return
      */
-    @RequestMapping("eptrendIco")
+    @GetMapping("eptrendIco")
     public ApiResult<List<CommonIcoVO>> getTrendByDate(@RequestParam Date startTime,@RequestParam(required = false) Integer siteId){
         return ApiResult.success(htAnalogDataService.selectTrendByDate(startTime,siteId));
     }
@@ -56,7 +57,7 @@ public class HtAnalogDataController {
      * @param siteId 站点id
      * @return
      */
-    @RequestMapping("dayMonthYearEp")
+    @GetMapping("dayMonthYearEp")
     public ApiResult<HadCountVO> getCountBySite(@RequestParam Integer siteId){
         return ApiResult.success(htAnalogDataService.getCountBySite(siteId));
     }
@@ -68,7 +69,7 @@ public class HtAnalogDataController {
      * @param date 时间
      * @return
      */
-    @RequestMapping("timeShare")
+    @GetMapping("timeShare")
     public ApiResult<TimeShareVO> getTimeShare(@RequestParam Integer siteId,@RequestParam Date date){
         return ApiResult.success(htAnalogDataService.getTimeShare(siteId,date));
     }
@@ -78,7 +79,7 @@ public class HtAnalogDataController {
      * @param siteId 站点id
      * @return
      */
-    @RequestMapping("demandIco")
+    @GetMapping("demandIco")
     public ApiResult<List<CommonIcoVO>> getDemandIco(@RequestParam Integer siteId){
         return ApiResult.success(htAnalogDataService.getDemandIco(siteId));
     }
@@ -89,7 +90,7 @@ public class HtAnalogDataController {
      * @param date 时间
      * @return
      */
-    @RequestMapping("electricIco")
+    @GetMapping("electricIco")
     public ApiResult<List<CommonIcoVO>> getElectricIco(@RequestParam Integer siteId,@RequestParam Date date){
         return ApiResult.success(htAnalogDataService.getElectricIco(siteId,date));
     }

+ 2 - 1
fiveep-controller/src/main/java/com/bizmatics/controller/web/PersonnelController.java

@@ -5,6 +5,7 @@ import com.bizmatics.common.core.bean.ApiResult;
 import com.bizmatics.service.PersonnelService;
 import com.bizmatics.service.vo.PerCountVO;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 
 import org.springframework.web.bind.annotation.RestController;
@@ -30,7 +31,7 @@ public class PersonnelController {
      * 查询不同种类的人员信息
      * @return
      */
-    @RequestMapping("count")
+    @GetMapping("count")
     public ApiResult<PerCountVO> getCount(){
         return ApiResult.success(personnelService.selectCount());
     }

+ 4 - 3
fiveep-controller/src/main/java/com/bizmatics/controller/web/RtAnalogDataController.java

@@ -5,6 +5,7 @@ import com.bizmatics.common.core.bean.ApiResult;
 import com.bizmatics.service.RtAnalogDataService;
 import com.bizmatics.service.vo.RadCountVO;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 
 import org.springframework.web.bind.annotation.RequestParam;
@@ -32,7 +33,7 @@ public class RtAnalogDataController {
      * 重载/轻载/正常
      * @return
      */
-    @RequestMapping("count")
+    @GetMapping("count")
     public ApiResult<RadCountVO> getCount(){
         return ApiResult.success(rtAnalogDataService.selectCount());
     }
@@ -42,7 +43,7 @@ public class RtAnalogDataController {
      * @param siteId 站点id
      * @return
      */
-    @RequestMapping("one")
+    @GetMapping("one")
     public ApiResult<List<Map<String,Object>>> getOne(@RequestParam Integer siteId){
         return ApiResult.success(rtAnalogDataService.getOne(siteId));
     }
@@ -53,7 +54,7 @@ public class RtAnalogDataController {
      * @param siteId 站点id
      * @return
      */
-    @RequestMapping("epLoad")
+    @GetMapping("epLoad")
     public ApiResult<Double> getEpLoad(Integer siteId){
         return ApiResult.success(rtAnalogDataService.getEpLoad(siteId));
     }

+ 2 - 1
fiveep-controller/src/main/java/com/bizmatics/controller/web/RtSwitchDataController.java

@@ -4,6 +4,7 @@ package com.bizmatics.controller.web;
 import com.bizmatics.common.core.bean.ApiResult;
 import com.bizmatics.service.RtSwitchDataService;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 
 import org.springframework.stereotype.Controller;
@@ -30,7 +31,7 @@ public class RtSwitchDataController {
      * 查看单个信息
      * @return
      */
-    @RequestMapping("one")
+    @GetMapping("one")
     public ApiResult<List<Map<String,Object>>> getOne(@RequestParam Integer siteId){
         return ApiResult.success(rtSwitchDataService.getOne(siteId));
     }

+ 4 - 3
fiveep-controller/src/main/java/com/bizmatics/controller/web/SiteController.java

@@ -7,6 +7,7 @@ import com.bizmatics.service.SiteService;
 import com.bizmatics.service.vo.DeviceCountVO;
 import com.bizmatics.service.vo.SiteVO;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 
 import org.springframework.web.bind.annotation.RequestParam;
@@ -32,7 +33,7 @@ public class SiteController {
      * 查看不同状态的站点数量
      * @return
      */
-    @RequestMapping("count")
+    @GetMapping("count")
     public ApiResult<DeviceCountVO> getCount(){
         return ApiResult.success(siteService.selectCount());
     }
@@ -43,7 +44,7 @@ public class SiteController {
      * @param name 名称
      * @return
      */
-    @RequestMapping("list")
+    @GetMapping("list")
     public ApiResult<List<SiteVO>> list(@RequestParam(required = false) String name){
         return ApiResult.success(siteService.list(name));
     }
@@ -53,7 +54,7 @@ public class SiteController {
      * @param siteId 站点id
      * @return
      */
-    @RequestMapping("one")
+    @GetMapping("one")
     public ApiResult<SiteVO> getOne(@RequestParam Long siteId){
         return ApiResult.success(siteService.getOne(siteId));
     }

+ 3 - 4
fiveep-controller/src/main/java/com/bizmatics/controller/web/UserController.java

@@ -6,6 +6,7 @@ import com.bizmatics.model.User;
 import com.bizmatics.service.UserService;
 import com.bizmatics.service.util.SessionLocal;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 
 import org.springframework.stereotype.Controller;
@@ -15,10 +16,8 @@ import org.springframework.web.bind.annotation.RestController;
 import javax.servlet.http.HttpServletRequest;
 
 /**
- * <p>
- *  前端控制器
- * </p>
  *
+ * 用户
  * @author ya
  * @since 2021-07-07
  */
@@ -29,7 +28,7 @@ public class UserController {
     @Autowired
     private UserService userService;
 
-    @RequestMapping("/login")
+    @GetMapping("/login")
     public ApiResult<User> login(@RequestParam String name, @RequestParam String password, HttpServletRequest request){
         return ApiResult.success(userService.login(name, password, request));
     }

+ 0 - 32
fiveep-service/src/main/java/com/bizmatics/service/config/CorsConfig.java

@@ -1,32 +0,0 @@
-package com.bizmatics.service.config;
-
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.http.HttpHeaders;
-import org.springframework.web.servlet.config.annotation.CorsRegistry;
-import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
-
-/**
- * @author yq
- * @date 2021/7/14 11:35
- */
-@Configuration
-public class CorsConfig implements WebMvcConfigurer {
-
-    @Bean
-    public WebMvcConfigurer corsConfigurer()
-    {
-        return new WebMvcConfigurer() {
-            @Override
-            public void addCorsMappings(CorsRegistry registry) {
-                registry.addMapping("/**").
-                        allowedOrigins("http://wx.ewoogi.com/"). //允许跨域的域名,可以用*表示允许任何域名使用
-                        allowedMethods("*"). //允许任何方法(post、get等)
-                        allowedHeaders("*"). //允许任何请求头
-                        allowCredentials(true). //带上cookie信息
-                        exposedHeaders(HttpHeaders.SET_COOKIE).maxAge(3600L); //maxAge(3600)表明在3600秒内,不需要再发送预检验请求,可以缓存该结果
-            }
-        };
-    }
-}
-

+ 22 - 0
fiveep-service/src/main/java/com/bizmatics/service/config/MyWebConfigurer.java

@@ -0,0 +1,22 @@
+package com.bizmatics.service.config;
+
+import org.springframework.boot.SpringBootConfiguration;
+import org.springframework.web.servlet.config.annotation.CorsRegistry;
+import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
+
+@SpringBootConfiguration
+public class MyWebConfigurer implements WebMvcConfigurer {
+
+    @Override
+    public void addCorsMappings(CorsRegistry registry) {
+        // 设置允许跨域的路径
+        registry.addMapping("/**")
+                // 设置允许跨域请求的域名
+                .allowedOrigins("*")
+                // 是否允许证书
+                .allowCredentials(true)
+                .allowedMethods("*")
+                .maxAge(3600);
+    }
+
+}