Procházet zdrojové kódy

Merge branch 'han' of hanzhengyi/usky-power into master

hanzhengyi před 1 týdnem
rodič
revize
64468b2afe

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

@@ -57,12 +57,14 @@ public class SiteController {
      *
      * @param name 名称
      * @param stationAreaId 台区id
+     * @param siteStatus 站点状态
      * @return
      */
     @GetMapping("list2")
     public ApiResult<List<SiteTwo>> list2(@RequestParam(required = false) String name,
-                                          @RequestParam(required = false) Integer stationAreaId) {
-        return ApiResult.success(siteService.list2(name, stationAreaId));
+                                          @RequestParam(required = false) Integer stationAreaId,
+                                          @RequestParam(required = false) Integer siteStatus) {
+        return ApiResult.success(siteService.list2(name,stationAreaId,siteStatus));
     }
 
     /**

+ 2 - 1
fiveep-persistence/src/main/java/com/bizmatics/persistence/mapper/SiteMapper.java

@@ -32,7 +32,8 @@ public interface SiteMapper extends CrudMapper<Site> {
 
     List<SiteTwo> list2(@Param("userId") Integer userId,
                         @Param("name") String name,
-                        @Param("stationAreaId") Integer stationAreaId);
+                        @Param("stationAreaId") Integer stationAreaId,
+                        @Param("siteStatus") Integer siteStatus);
 
 
     List<Device> getDeviceListOne(@Param("siteId") Integer siteId);

+ 1 - 0
fiveep-persistence/src/main/resources/mapper/mysql/DeviceMapper.xml

@@ -22,6 +22,7 @@
         inner join device as d
         on ds.device_code = d.device_code
         <where>
+            d.enable = 1
             <if test="userId != null and userId != 0">
                 and us.user_id = #{userId}
             </if>

+ 5 - 0
fiveep-persistence/src/main/resources/mapper/mysql/SiteMapper.xml

@@ -117,6 +117,11 @@
             </if>
         </where>) AS a
         LEFT JOIN device_status AS b ON a.id = b.site_id
+        <where>
+        <if test="siteStatus != null">
+            b.device_status = #{siteStatus}
+        </if>
+        </where>
         GROUP BY
         a.id
         ORDER BY

+ 1 - 1
fiveep-service/src/main/java/com/bizmatics/service/SiteService.java

@@ -43,7 +43,7 @@ public interface SiteService extends CrudService<Site> {
      * @param stationAreaId
      * @return
      */
-    List<SiteTwo> list2(String name, Integer stationAreaId);
+    List<SiteTwo> list2(String name,Integer stationAreaId,Integer siteStatus);
 
     /**
      * 查看站点列表

+ 6 - 3
fiveep-service/src/main/java/com/bizmatics/service/impl/SiteServiceImpl.java

@@ -18,6 +18,7 @@ import com.bizmatics.persistence.mapper.SiteMapper;
 import com.bizmatics.persistence.mapper.system.SysUserMapper;
 import com.bizmatics.service.*;
 import com.bizmatics.service.enums.DeviceStatusCode;
+import com.bizmatics.service.enums.DeviceType;
 import com.bizmatics.service.util.SecurityUtils;
 import com.bizmatics.service.vo.DeviceCountVO;
 import com.bizmatics.service.vo.SiteLoadAnalysisVO;
@@ -72,8 +73,10 @@ public class SiteServiceImpl extends AbstractCrudService<SiteMapper, Site> imple
         deviceCountVO.setNormalCount(baseMapper.selectCount(userId, null, DeviceStatusCode.NORMAL.getValue()));
         deviceCountVO.setOffLineCount(baseMapper.selectCount(userId, null, DeviceStatusCode.OFFLINE.getValue()));
         deviceCountVO.setDeviceCount(baseMapper.selectCount(userId, null, DeviceStatusCode.DEVICE.getValue()));
-        deviceCountVO.setFaultCount(baseMapper.selectCount(userId, null, DeviceStatusCode.FAULT.getValue()));
+        deviceCountVO.setFaultCount(baseMapper.selectCount(userId, null, null));
         deviceCountVO.setCount(userSiteService.count(userId));
+        deviceCountVO.setSiteDeviceCount(deviceMapper.selectCount(userId, null, null, null, null,
+                null));
         return deviceCountVO;
     }
 
@@ -94,9 +97,9 @@ public class SiteServiceImpl extends AbstractCrudService<SiteMapper, Site> imple
     }
 
     @Override
-    public List<SiteTwo> list2(String name, Integer stationAreaId) {
+    public List<SiteTwo> list2(String name,Integer stationAreaId,Integer siteStatus) {
         Integer userId = SecurityUtils.getLoginUser().getUser().getUserId().intValue();
-        return baseMapper.list2(userId, name, stationAreaId);
+        return baseMapper.list2(userId, name,stationAreaId,siteStatus);
     }
 
     @Override

+ 4 - 0
fiveep-service/src/main/java/com/bizmatics/service/vo/DeviceCountVO.java

@@ -30,6 +30,10 @@ public class DeviceCountVO {
      * 站点数量/设备数量
      */
     private Integer count;
+    /**
+     * 设备数量
+     */
+    private Integer siteDeviceCount;
     /**
      * 用电量
      */