夏文涛 2 rokov pred
rodič
commit
472d3e43ea

+ 35 - 0
.idea/workspace.xml

@@ -1,11 +1,23 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <project version="4">
   <component name="ChangeListManager">
+<<<<<<< HEAD
     <list default="true" id="b276f38f-0e4c-4de5-804a-b533dfcb04c5" name="Default Changelist" comment="">
       <change beforePath="$PROJECT_DIR$/src/main/java/com/template/controller/SmartUserController.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/template/controller/SmartUserController.java" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/src/main/java/com/template/services/SmartDutiesService.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/template/services/SmartDutiesService.java" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/src/main/java/com/template/services/impl/SmartDutiesServiceImpl.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/template/services/impl/SmartDutiesServiceImpl.java" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/target/mybatis_plus-0.0.1-SNAPSHOT.jar.original" beforeDir="false" afterPath="$PROJECT_DIR$/target/mybatis_plus-0.0.1-SNAPSHOT.jar.original" afterDir="false" />
+=======
+
+    <list default="true" id="be7aa737-81a4-4fa1-848a-b64feaec2f6c" name="Default Changelist" comment=""></list>
+      <change beforePath="$PROJECT_DIR$/src/main/java/com/template/common/utils/TimeExchange.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/template/common/utils/TimeExchange.java" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/src/main/java/com/template/controller/SmartVisitorController.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/template/controller/SmartVisitorController.java" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/target/mybatis_plus-0.0.1-SNAPSHOT.jar.original" beforeDir="false" />
+=======
+    <list default="true" id="36922be1-416a-4a25-9739-9814e01883a6" name="Default Changelist" comment="">
+      <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
+>>>>>>> 678fbbf6788b3304f5df8b5725dd74a977b78d1c
+>>>>>>> 39c614f357691d80c577d9392ae59044f043be63
     </list>
     <ignored path="$PROJECT_DIR$/classes/" />
     <ignored path="$PROJECT_DIR$/target/" />
@@ -15,6 +27,14 @@
     <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
     <option name="LAST_RESOLUTION" value="IGNORE" />
   </component>
+<<<<<<< HEAD
+=======
+
+  <component name="DefaultGradleProjectSettings">
+    <option name="testRunner" value="GRADLE" />
+    <option name="delegatedBuild" value="true" />
+  </component>
+>>>>>>> 39c614f357691d80c577d9392ae59044f043be63
   <component name="FileEditorManager">
     <leaf>
       <file pinned="false" current-in-tab="true">
@@ -207,7 +227,12 @@
       <pane id="Scope" />
     </panes>
   </component>
+<<<<<<< HEAD
   <component name="PropertiesComponent">
+=======
+
+  <component name="PropertiesComponent"></component>
+>>>>>>> 39c614f357691d80c577d9392ae59044f043be63
     <property name="RequestMappingsPanelOrder0" value="0" />
     <property name="RequestMappingsPanelOrder1" value="1" />
     <property name="RequestMappingsPanelWidth0" value="75" />
@@ -252,8 +277,18 @@
       <created>1706844127386</created>
       <option name="number" value="Default" />
       <option name="presentableId" value="Default" />
+<<<<<<< HEAD
       <updated>1706844127386</updated>
       <workItem from="1706844128633" duration="8353000" />
+=======
+      <updated>1706770138891</updated>
+
+      <workItem from="1706770142017" duration="13022000" />
+=======
+      <workItem from="1706770142017" duration="4313000" />
+      <workItem from="1706842947127" duration="21000" />
+>>>>>>> 678fbbf6788b3304f5df8b5725dd74a977b78d1c
+>>>>>>> 39c614f357691d80c577d9392ae59044f043be63
     </task>
     <servers />
   </component>

+ 34 - 28
src/main/java/com/template/controller/SmartAuthorGroupController.java

@@ -361,42 +361,48 @@ public class SmartAuthorGroupController implements SmartAuthorGroupControllerAPI
     @PassToken
     @Override
     public CommonResult queryUserAuthor(String userId){
+        String[] userids = userId.split(",");
         QueryWrapper<SmartAuthority> queryWrapper1 = new QueryWrapper<>();
         queryWrapper1.eq("deleted", 0);
-        queryWrapper1.eq("user_id", userId);
+        queryWrapper1.in("user_id", Arrays.asList(userids));
         List<SmartAuthority> userAuthor = smartAuthorityService.getAuthorByKey(queryWrapper1);
         if (userAuthor.size()<=0){
             return CommonResult.ok(new ArrayList<>());
         }
-        SmartAuthority smartAuthority = userAuthor.get(0);
-        Integer groupId = smartAuthority.getGroupId();
-        SmartAuthorGroup smartAuthorGroup = smartAuthorGroupService.getSmartById(groupId);
-        if (smartAuthorGroup==null){
-            return CommonResult.ok(new ArrayList<>());
-        }
-        JSONObject jsonObject = new JSONObject();
-        QueryWrapper<SmartDepartment> queryWrapper2 = new QueryWrapper<>();
-        queryWrapper2.eq("deleted", 0);
-        List<String> viewDepart = Arrays.asList(smartAuthority.getDepartmentView().split(","));
-        queryWrapper2.in("id", viewDepart);
-        List<SmartDepartment> list1 = smartDepartmentService.list(queryWrapper2);
-        QueryWrapper<SmartDepartment> queryWrapper3 = new QueryWrapper<>();
-        queryWrapper3.eq("deleted", 0);
-        List<String> manageDepart = Arrays.asList(smartAuthority.getDepartmentManage().split(","));
-        queryWrapper3.in("id", manageDepart);
-        List<SmartDepartment> list2 = smartDepartmentService.list(queryWrapper3);
-        jsonObject.put("departmentViewAuthor", list1);
-        jsonObject.put("departmentManageAuthor", list2);
-        if (smartAuthorGroup.getDeleted()==0){
-            QueryWrapper<SmartMenu> queryWrapper4 = new QueryWrapper<>();
-            queryWrapper4.eq("deleted", 0);
-            List<String> menuList = Arrays.asList(smartAuthorGroup.getApplyId().split(","));
-            queryWrapper4.in("id", menuList);
-            List<SmartMenu> list3 = smartMenuService.list(queryWrapper4);
-            jsonObject.put("treAuthor", list3);
+        List<JSONObject> allList = new ArrayList<>();
+        for (int i = 0; i < userAuthor.size(); i++) {
+            SmartAuthority smartAuthority = userAuthor.get(i);
+            JSONObject jsonObject = new JSONObject();
+            jsonObject.put("userId", smartAuthority.getUserId());
+            Integer groupId = smartAuthority.getGroupId();
+            SmartAuthorGroup smartAuthorGroup = smartAuthorGroupService.getSmartById(groupId);
+            QueryWrapper<SmartDepartment> queryWrapper2 = new QueryWrapper<>();
+            queryWrapper2.eq("deleted", 0);
+            List<String> viewDepart = Arrays.asList(smartAuthority.getDepartmentView().split(","));
+            queryWrapper2.in("id", viewDepart);
+            List<SmartDepartment> list1 = smartDepartmentService.list(queryWrapper2);
+            QueryWrapper<SmartDepartment> queryWrapper3 = new QueryWrapper<>();
+            queryWrapper3.eq("deleted", 0);
+            List<String> manageDepart = Arrays.asList(smartAuthority.getDepartmentManage().split(","));
+            queryWrapper3.in("id", manageDepart);
+            List<SmartDepartment> list2 = smartDepartmentService.list(queryWrapper3);
+            jsonObject.put("departmentViewAuthor", list1);
+            jsonObject.put("departmentManageAuthor", list2);
+            if (smartAuthorGroup!=null && smartAuthorGroup.getDeleted()==0){
+                QueryWrapper<SmartMenu> queryWrapper4 = new QueryWrapper<>();
+                queryWrapper4.eq("deleted", 0);
+                List<String> menuList = Arrays.asList(smartAuthorGroup.getApplyId().split(","));
+                queryWrapper4.in("id", menuList);
+                List<SmartMenu> list3 = smartMenuService.list(queryWrapper4);
+                jsonObject.put("treAuthor", list3);
+            } else {
+                jsonObject.put("treAuthor", new ArrayList<>());
+            }
+            allList.add(jsonObject);
         }
-        return CommonResult.ok(jsonObject);
+        return CommonResult.ok(allList);
     }
+
     /**
      * 查看权限列表
      * @return

+ 3 - 2
src/main/java/com/template/controller/SmartWarningController.java

@@ -19,6 +19,7 @@ import com.template.model.pojo.SmartUser;
 import com.template.model.pojo.SmartWarning;
 import com.template.model.result.CommonResult;
 import com.template.model.result.PageUtils;
+import com.template.model.vo.BehaviourListVo;
 import com.template.model.vo.DepartmentTreeVo;
 import com.template.model.vo.UserVo;
 import com.template.services.SmartDepartmentService;
@@ -357,9 +358,9 @@ public class SmartWarningController implements SmartWarningControllerAPI {
 
     @Override
     public CommonResult behaviourList() {
+        List<BehaviourListVo> behaviourList=smartWarningService.behaviourList();
 
-
-        return null;
+        return CommonResult.ok(behaviourList);
     }
 
 

+ 4 - 0
src/main/java/com/template/mapper/SmartWarningMapper.java

@@ -2,6 +2,7 @@ package com.template.mapper;
 
 import com.template.model.pojo.SmartWarning;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.template.model.vo.BehaviourListVo;
 import org.springframework.stereotype.Repository;
 
 import java.util.List;
@@ -20,4 +21,7 @@ public interface SmartWarningMapper extends BaseMapper<SmartWarning> {
     List<String> warningType();
 
 
+    List<BehaviourListVo> behaviourList();
+
+
 }

+ 13 - 0
src/main/java/com/template/model/vo/BehaviourListVo.java

@@ -0,0 +1,13 @@
+package com.template.model.vo;
+
+import lombok.Data;
+
+@Data
+public class BehaviourListVo {
+    private String typeName; //预警名称
+
+    private Integer typeCount; //预警次数
+
+    private Integer totalCount;// 总次数
+
+}

+ 2 - 0
src/main/java/com/template/services/SmartWarningService.java

@@ -5,6 +5,7 @@ import com.template.model.pojo.SmartWarning;
 import com.template.model.pojo.SmartWarning;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.template.model.result.PageUtils;
+import com.template.model.vo.BehaviourListVo;
 
 import java.util.List;
 
@@ -32,5 +33,6 @@ public interface SmartWarningService extends IService<SmartWarning> {
     PageUtils<SmartWarning> pageWarning(int currentPage, int pageCount, String type, String dateTime);
 
 
+    List<BehaviourListVo> behaviourList();
 
 }

+ 5 - 1
src/main/java/com/template/services/impl/SmartWarningServiceImpl.java

@@ -12,6 +12,7 @@ import com.template.model.pojo.SmartWarning;
 import com.template.model.pojo.SmartWarning;
 import com.template.mapper.SmartWarningMapper;
 import com.template.model.result.PageUtils;
+import com.template.model.vo.BehaviourListVo;
 import com.template.services.SmartWarningService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -95,7 +96,10 @@ public class SmartWarningServiceImpl extends ServiceImpl<SmartWarningMapper, Sma
         return new PageUtils<>(result);
     }
 
-
+    @Override
+    public List<BehaviourListVo> behaviourList() {
+        return smartWarningMapper.behaviourList();
+    }
 
 
 }

+ 10 - 0
src/main/resources/mapper/template/SmartWarningMapper.xml

@@ -5,4 +5,14 @@
     <select id="warningType" resultType="java.lang.String">
         SELECT type FROM `smart_warning` GROUP BY type
     </select>
+    <select id="behaviourList" resultType="com.template.model.vo.BehaviourListVo">
+        SELECT
+            sw.type as typeName,
+            COUNT( sw.type ) AS typeCount,
+            ( SELECT COUNT( 0 ) FROM smart_warning sw2 ) AS totalCount
+        FROM
+            `smart_warning` sw
+        GROUP BY
+            sw.type
+    </select>
 </mapper>

+ 10 - 0
target/classes/mapper/template/SmartWarningMapper.xml

@@ -5,4 +5,14 @@
     <select id="warningType" resultType="java.lang.String">
         SELECT type FROM `smart_warning` GROUP BY type
     </select>
+    <select id="behaviourList" resultType="com.template.model.vo.BehaviourListVo">
+        SELECT
+            sw.type as typeName,
+            COUNT( sw.type ) AS typeCount,
+            ( SELECT COUNT( 0 ) FROM smart_warning sw2 ) AS totalCount
+        FROM
+            `smart_warning` sw
+        GROUP BY
+            sw.type
+    </select>
 </mapper>