Jelajahi Sumber

增加批量设置表达式,清空客户端登录人信息

zhoupeng 2 tahun lalu
induk
melakukan
8594844699
31 mengubah file dengan 130 tambahan dan 24 penghapusan
  1. 17 1
      chaunyi_opc/opc_da/src/main/java/com/example/opc_da/controller/MessageNoticeController.java
  2. 19 2
      chaunyi_opc/opc_da/src/main/java/com/example/opc_da/controller/UserController.java
  3. 2 0
      chaunyi_opc/opc_da/src/main/java/com/example/opc_da/dao/ItemGroupDao.java
  4. 2 0
      chaunyi_opc/opc_da/src/main/java/com/example/opc_da/dao/MessageNoticeDao.java
  5. 10 8
      chaunyi_opc/opc_da/src/main/java/com/example/opc_da/dao/UserDao.java
  6. 4 0
      chaunyi_opc/opc_da/src/main/java/com/example/opc_da/service/MessageNoticeService.java
  7. 2 0
      chaunyi_opc/opc_da/src/main/java/com/example/opc_da/service/UserService.java
  8. 6 1
      chaunyi_opc/opc_da/src/main/java/com/example/opc_da/service/impl/ItemGroupServiceImpl.java
  9. 8 1
      chaunyi_opc/opc_da/src/main/java/com/example/opc_da/service/impl/MessageNoticeServiceImpl.java
  10. 22 5
      chaunyi_opc/opc_da/src/main/java/com/example/opc_da/service/impl/UserServiceImpl.java
  11. 6 0
      chaunyi_opc/opc_da/src/main/resources/mapper/ItemGroupDao.xml
  12. 11 1
      chaunyi_opc/opc_da/src/main/resources/mapper/MessageNoticeDao.xml
  13. 17 1
      chaunyi_opc/opc_da/src/main/resources/mapper/UserDao.xml
  14. 2 2
      chaunyi_opc/opc_da/src/main/resources/static/page/index.html
  15. 0 0
      chaunyi_opc/opc_da/src/main/resources/static/page/static/css/app.d8a7ff2c.css
  16. 0 0
      chaunyi_opc/opc_da/src/main/resources/static/page/static/css/chunk-3154de5d.fd2076b5.css
  17. 0 0
      chaunyi_opc/opc_da/src/main/resources/static/page/static/css/chunk-8edeae9a.dff46571.css
  18. 0 0
      chaunyi_opc/opc_da/src/main/resources/static/page/static/css/chunk-9ad6dad4.587f22e3.css
  19. 0 0
      chaunyi_opc/opc_da/src/main/resources/static/page/static/css/chunk-9bb6506a.9033d0a8.css
  20. 0 0
      chaunyi_opc/opc_da/src/main/resources/static/page/static/css/chunk-9de2d316.38e77d7e.css
  21. 0 0
      chaunyi_opc/opc_da/src/main/resources/static/page/static/js/app.ce181ce1.js
  22. 0 0
      chaunyi_opc/opc_da/src/main/resources/static/page/static/js/app.e3e74964.js
  23. 0 0
      chaunyi_opc/opc_da/src/main/resources/static/page/static/js/chunk-23122476.0ec98a48.js
  24. 0 0
      chaunyi_opc/opc_da/src/main/resources/static/page/static/js/chunk-25fa7e82.5d15f594.js
  25. 0 0
      chaunyi_opc/opc_da/src/main/resources/static/page/static/js/chunk-3154de5d.612bd2a9.js
  26. 0 0
      chaunyi_opc/opc_da/src/main/resources/static/page/static/js/chunk-5565aa3a.bcdef190.js
  27. 0 0
      chaunyi_opc/opc_da/src/main/resources/static/page/static/js/chunk-8edeae9a.37d67e3e.js
  28. 0 0
      chaunyi_opc/opc_da/src/main/resources/static/page/static/js/chunk-9ad6dad4.41991f1f.js
  29. 0 0
      chaunyi_opc/opc_da/src/main/resources/static/page/static/js/chunk-9bb6506a.6f3fa68b.js
  30. 0 0
      chaunyi_opc/opc_da/src/main/resources/static/page/static/js/chunk-9de2d316.896a0149.js
  31. 2 2
      chaunyi_opc/opc_ua/src/main/java/com/example/opc_ua/util/OpcUaUtil.java

+ 17 - 1
chaunyi_opc/opc_da/src/main/java/com/example/opc_da/controller/MessageNoticeController.java

@@ -13,6 +13,7 @@ import lombok.extern.slf4j.Slf4j;
 import org.springframework.web.bind.annotation.*;
 
 import javax.annotation.Resource;
+import java.util.List;
 
 @RestController
 @RequestMapping("messageNotice")
@@ -25,7 +26,7 @@ public class MessageNoticeController {
     @PostMapping("/addMessageNotice")
     @WebLog(ServerEnum = ServerEnum.CLIENT, ModelEnum = ModelEnum.MESSAGENOTICE, OperationEnum = OperationEnum.ADD)
     public Result addMessageNotice(@RequestBody MessageNotice messageNotice) {
-        if (Blank.isEmpty(messageNotice, messageNotice.getUserId(),messageNotice.getNoticeTitle(), messageNotice.getNoticeContent())) {
+        if (Blank.isEmpty(messageNotice, messageNotice.getUserId(), messageNotice.getNoticeTitle(), messageNotice.getNoticeContent())) {
             return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), "消息通知人,通知标题,内容不能为空");
         }
         return messageNoticeService.addMessageNotice(messageNotice);
@@ -92,4 +93,19 @@ public class MessageNoticeController {
         return messageNoticeService.deleteMessageNoticeById(id);
     }
 
+    /**
+     * 通过idList批量删除消息通知
+     *
+     * @param idList
+     * @return
+     */
+    @PostMapping("/delMesNotByIdList")
+    @WebLog(ServerEnum = ServerEnum.CLIENT, ModelEnum = ModelEnum.MESSAGENOTICE, OperationEnum = OperationEnum.DELETE)
+    public Result delMesNotByIdList(@RequestBody List<Integer> idList) {
+        if (Blank.isEmpty(idList)) {
+            return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), ResultEnum.REQUEST_WRONGPARAMS.getRespMsg());
+        }
+        return messageNoticeService.delMesNotByIdList(idList);
+    }
+
 }

+ 19 - 2
chaunyi_opc/opc_da/src/main/java/com/example/opc_da/controller/UserController.java

@@ -434,15 +434,32 @@ public class UserController {
 
     /**
      * 在线用户人数
+     *
      * @param loginType
      * @return
      */
     @GetMapping("/getOnlineUser")
-    public Result getOnlineUser(String loginType){
-        if (Blank.isEmpty(loginType)){
+    @WebLog(ServerEnum = ServerEnum.SERVER, ModelEnum = ModelEnum.USER, OperationEnum = OperationEnum.SELECT)
+    public Result getOnlineUser(String loginType) {
+        if (Blank.isEmpty(loginType)) {
             return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), ResultEnum.REQUEST_WRONGPARAMS.getRespMsg());
         }
         return userService.getOnlineUser(loginType);
     }
 
+    /**
+     * 清空用户的登录信息
+     *
+     * @param userId
+     * @return
+     */
+    @PostMapping("/clearLoginSession")
+    @WebLog(ServerEnum = ServerEnum.SERVER, ModelEnum = ModelEnum.USER, OperationEnum = OperationEnum.DELETE)
+    public Result clearLoginSession(String userId) {
+        if (Blank.isEmpty(userId)) {
+            return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), ResultEnum.REQUEST_WRONGPARAMS.getRespMsg());
+        }
+        return userService.clearLoginSession(userId);
+    }
+
 }

+ 2 - 0
chaunyi_opc/opc_da/src/main/java/com/example/opc_da/dao/ItemGroupDao.java

@@ -52,4 +52,6 @@ public interface ItemGroupDao {
     String getItemDescribe(Integer itemGroupId, String itemName);
 
     List<ItemGroup> getItemGroupListByTableId(Integer tableReportId);
+
+    Integer updateItemExpresses(Integer id, Integer dataModelId);
 }

+ 2 - 0
chaunyi_opc/opc_da/src/main/java/com/example/opc_da/dao/MessageNoticeDao.java

@@ -19,4 +19,6 @@ public interface MessageNoticeDao {
     Integer addMessageNotice(MessageNotice messageNotice);
 
     MessageNotice getMessageNoticeById(Integer id);
+
+    Integer delMesNotByIdList(List<Integer> idList);
 }

+ 10 - 8
chaunyi_opc/opc_da/src/main/java/com/example/opc_da/dao/UserDao.java

@@ -61,10 +61,10 @@ public interface UserDao {
     /**
      * 根据用户和roleid批量删除用户角色
      */
-    Integer deleteByUserIdRoleIds(@Param("userRoles")List<UserRole> userRoles);
+    Integer deleteByUserIdRoleIds(@Param("userRoles") List<UserRole> userRoles);
 
     /**
-     *修改密码(重置)
+     * 修改密码(重置)
      */
     Integer updatePassWord(@Param("user") User user);
 
@@ -95,16 +95,16 @@ public interface UserDao {
     /**
      * 查询所有管理端用户
      */
-    List<User> queryUserType(Integer startNum, Integer limitNum, String userName, Integer state,  Integer tombstoneUser,Integer roleId);
+    List<User> queryUserType(Integer startNum, Integer limitNum, String userName, Integer state, Integer tombstoneUser, Integer roleId);
 
-    Integer queryUserTypeNum(String userName, Integer state,  Integer tombstoneUser,Integer roleId);
+    Integer queryUserTypeNum(String userName, Integer state, Integer tombstoneUser, Integer roleId);
 
     /**
      * 查询未有部门的用户
      */
-    List<User> queryUserNOtInDepartment(String userName,Integer state,Integer page,Integer num);
+    List<User> queryUserNOtInDepartment(String userName, Integer state, Integer page, Integer num);
 
-    Integer queryUserNOtInDepartmentNum(String userName,Integer state);
+    Integer queryUserNOtInDepartmentNum(String userName, Integer state);
 
     /**
      * 批量逻辑删除用户
@@ -126,12 +126,12 @@ public interface UserDao {
     /**
      * 客户端用户数量
      */
-    Integer queryCustomerUserNum(Integer frontUser,Integer TOMBSTONE);
+    Integer queryCustomerUserNum(Integer frontUser, Integer TOMBSTONE);
 
     /**
      * 管理端用户数量
      */
-    Integer queryManagerUserNum(Integer backUser,Integer TOMBSTONE);
+    Integer queryManagerUserNum(Integer backUser, Integer TOMBSTONE);
 
 
     Integer addUserDepartment(String userId, List<Department> departmentList);
@@ -145,4 +145,6 @@ public interface UserDao {
     List<Department> getNoShareOldDepartmentList(String userId, List<Department> departmentList);
 
     List<String> getAllUserIdByType(Integer userType);
+
+    List<User> getUserListByIdList(List<String> userIdList);
 }

+ 4 - 0
chaunyi_opc/opc_da/src/main/java/com/example/opc_da/service/MessageNoticeService.java

@@ -3,6 +3,8 @@ package com.example.opc_da.service;
 import com.example.opc_common.entity.MessageNotice;
 import com.example.opc_common.util.Result;
 
+import java.util.List;
+
 public interface MessageNoticeService {
     Result getAllMessageNotice(Integer page, Integer limit);
 
@@ -13,4 +15,6 @@ public interface MessageNoticeService {
     Result addMessageNotice(MessageNotice messageNotice);
 
     Result getMessageNoticeById(Integer id);
+
+    Result delMesNotByIdList(List<Integer> idList);
 }

+ 2 - 0
chaunyi_opc/opc_da/src/main/java/com/example/opc_da/service/UserService.java

@@ -125,4 +125,6 @@ public interface UserService {
     Result phoneUserLogin(User user);
 
     Result getOnlineUser(String loginType);
+
+    Result clearLoginSession(String userId);
 }

+ 6 - 1
chaunyi_opc/opc_da/src/main/java/com/example/opc_da/service/impl/ItemGroupServiceImpl.java

@@ -382,6 +382,11 @@ public class ItemGroupServiceImpl implements ItemGroupService {
     @Override
     public Result batchSetExpresses(ItemGroup itemGroup) {
         List<Item> itemList = itemGroup.getItemList();
-        return null;
+        for (Item item : itemList) {
+            if (Blank.isNotEmpty(item.getId())) {
+                itemGroupDao.updateItemExpresses(item.getId(), item.getDataModelId());
+            }
+        }
+        return Result.ok("设置表达式成功");
     }
 }

+ 8 - 1
chaunyi_opc/opc_da/src/main/java/com/example/opc_da/service/impl/MessageNoticeServiceImpl.java

@@ -39,7 +39,8 @@ public class MessageNoticeServiceImpl implements MessageNoticeService {
 
     @Override
     public synchronized Result deleteMessageNoticeById(Integer id) {
-        return Result.ok(messageNoticeDao.deleteMessageNoticeById(id));
+        messageNoticeDao.deleteMessageNoticeById(id);
+        return Result.ok("删除成功");
     }
 
     @Override
@@ -63,4 +64,10 @@ public class MessageNoticeServiceImpl implements MessageNoticeService {
     public Result getMessageNoticeById(Integer id) {
         return Result.ok(messageNoticeDao.getMessageNoticeById(id));
     }
+
+    @Override
+    public Result delMesNotByIdList(List<Integer> idList) {
+        messageNoticeDao.delMesNotByIdList(idList);
+        return Result.ok("删除成功");
+    }
 }

+ 22 - 5
chaunyi_opc/opc_da/src/main/java/com/example/opc_da/service/impl/UserServiceImpl.java

@@ -132,14 +132,14 @@ public class UserServiceImpl implements UserService {
         }
         switch (isExistUser.getState()) {
             case ConstantStr.NORMAL_USE:
-                String userId = Convert.toStr(redisUtil.get(ConstantStr.FRONT_USER_String + isExistUser.getUserId()));
-                if (Blank.isNotEmpty(userId)) {
+                String token = Convert.toStr(redisUtil.get(ConstantStr.FRONT_USER_String + isExistUser.getUserId()));
+                if (Blank.isNotEmpty(token)) {
                     return Result.no(ResultEnum.SERVER_ERROR.getRespCode(), "此账号在其他地方登录,请勿重新登录");
                 }
                 JSONObject json = new JSONObject();
                 isExistUser.setPassword("");
                 //生成token
-                String token = TokenUtil.token(isExistUser.getUserName(), ConstantStr.FIVE_HOUR);
+                token = TokenUtil.token(isExistUser.getUserName(), ConstantStr.FIVE_HOUR);
                 token = ConstantStr.FRONT_USER_String + token;
                 redisUtil.set(ConstantStr.FRONT_USER_String + isExistUser.getUserId(), token, ConstantStr.FIVE_HOUR);
                 redisUtil.set(token, isExistUser.getUserId(), ConstantStr.FIVE_HOUR);
@@ -665,23 +665,40 @@ public class UserServiceImpl implements UserService {
     @Override
     public Result getOnlineUser(String loginType) {
         if (loginType.equals(ConstantStr.FRONT_USER_String)) {
+            JSONObject jsonObject = new JSONObject();
             List<String> userIdList = userDao.getAllUserIdByType(ConstantStr.FRONT_USER);
+            List<String> userIdLoginList = new ArrayList<>();
             if (Blank.isEmpty(userIdList)) {
-                return Result.ok(0);
+                jsonObject.put("count", 0);
+                jsonObject.put("frontLoginList", new ArrayList<>());
             } else {
                 int count = 0;
                 for (String userId : userIdList) {
                     if (Blank.isNotEmpty(redisUtil.get(ConstantStr.FRONT_USER_String + userId))) {
                         count += 1;
+                        userIdLoginList.add(userId);
                     }
                 }
-                return Result.ok(count);
+                jsonObject.put("count", count);
+                jsonObject.put("frontLoginList", Blank.isEmpty(userIdLoginList) ?
+                        new ArrayList<>() : userDao.getUserListByIdList(userIdLoginList));
             }
+            return Result.ok(jsonObject);
         } else {
             throw new CustomException(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), "当前只支持查看客户端在线用户人数");
         }
     }
 
+    @Override
+    public Result clearLoginSession(String userId) {
+        String token = Convert.toStr(redisUtil.get(ConstantStr.FRONT_USER_String + userId));
+        redisUtil.del(ConstantStr.FRONT_USER_String + userId);
+        if (Blank.isNotEmpty(token)) {
+            redisUtil.del(token);
+        }
+        return Result.ok("清空用户登录信息成功");
+    }
+
 
     @Override
     public synchronized Result updateUser(User user) {

+ 6 - 0
chaunyi_opc/opc_da/src/main/resources/mapper/ItemGroupDao.xml

@@ -69,6 +69,12 @@
         where id = #{id}
     </update>
 
+    <update id="updateItemExpresses">
+        update t_item
+        set data_model_id=#{dataModelId}
+        where id = #{id}
+    </update>
+
     <delete id="delItemByGroupId">
         delete
         from t_item

+ 11 - 1
chaunyi_opc/opc_da/src/main/resources/mapper/MessageNoticeDao.xml

@@ -24,6 +24,16 @@
         where id = #{id}
     </delete>
 
+    <delete id="delMesNotByIdList">
+        <if test="idList!= null and idList.size() >0">
+            delete
+            from t_message_notice where id in
+            <foreach collection="idList" item="id" separator="," open="(" close=")">
+                #{id}
+            </foreach>
+        </if>
+    </delete>
+
     <select id="getAllMessageNoticeCount" resultType="java.lang.Long">
         select count(*)
         from t_message_notice
@@ -44,4 +54,4 @@
         from t_message_notice
         where id=#{id}
     </select>
-</mapper>
+</mapper>

+ 17 - 1
chaunyi_opc/opc_da/src/main/resources/mapper/UserDao.xml

@@ -450,5 +450,21 @@
         where user_type = #{userType}
     </select>
 
+    <select id="getUserListByIdList" resultType="com.example.opc_common.entity.User">
+        <if test="userIdList!= null and userIdList.size() >0">
+            select user_id,
+            user_name,
+            PASSWORD,
+            user_type,
+            create_time,
+            last_login_time,
+            state from sys_user where user_id in
+            <foreach collection="userIdList" item="userId" separator="," open="(" close=")">
+                #{userId}
+            </foreach>
+            order by create_time desc
+        </if>
+    </select>
+
 
-</mapper>
+</mapper>

File diff ditekan karena terlalu besar
+ 2 - 2
chaunyi_opc/opc_da/src/main/resources/static/page/index.html


File diff ditekan karena terlalu besar
+ 0 - 0
chaunyi_opc/opc_da/src/main/resources/static/page/static/css/app.d8a7ff2c.css


File diff ditekan karena terlalu besar
+ 0 - 0
chaunyi_opc/opc_da/src/main/resources/static/page/static/css/chunk-3154de5d.fd2076b5.css


File diff ditekan karena terlalu besar
+ 0 - 0
chaunyi_opc/opc_da/src/main/resources/static/page/static/css/chunk-8edeae9a.dff46571.css


File diff ditekan karena terlalu besar
+ 0 - 0
chaunyi_opc/opc_da/src/main/resources/static/page/static/css/chunk-9ad6dad4.587f22e3.css


+ 0 - 0
chaunyi_opc/opc_da/src/main/resources/static/page/static/css/chunk-25fa7e82.9033d0a8.css → chaunyi_opc/opc_da/src/main/resources/static/page/static/css/chunk-9bb6506a.9033d0a8.css


File diff ditekan karena terlalu besar
+ 0 - 0
chaunyi_opc/opc_da/src/main/resources/static/page/static/css/chunk-9de2d316.38e77d7e.css


File diff ditekan karena terlalu besar
+ 0 - 0
chaunyi_opc/opc_da/src/main/resources/static/page/static/js/app.ce181ce1.js


File diff ditekan karena terlalu besar
+ 0 - 0
chaunyi_opc/opc_da/src/main/resources/static/page/static/js/app.e3e74964.js


+ 0 - 0
chaunyi_opc/opc_da/src/main/resources/static/page/static/js/chunk-23122476.d6bb28ea.js → chaunyi_opc/opc_da/src/main/resources/static/page/static/js/chunk-23122476.0ec98a48.js


File diff ditekan karena terlalu besar
+ 0 - 0
chaunyi_opc/opc_da/src/main/resources/static/page/static/js/chunk-25fa7e82.5d15f594.js


File diff ditekan karena terlalu besar
+ 0 - 0
chaunyi_opc/opc_da/src/main/resources/static/page/static/js/chunk-3154de5d.612bd2a9.js


+ 0 - 0
chaunyi_opc/opc_da/src/main/resources/static/page/static/js/chunk-5565aa3a.0ecf4847.js → chaunyi_opc/opc_da/src/main/resources/static/page/static/js/chunk-5565aa3a.bcdef190.js


File diff ditekan karena terlalu besar
+ 0 - 0
chaunyi_opc/opc_da/src/main/resources/static/page/static/js/chunk-8edeae9a.37d67e3e.js


File diff ditekan karena terlalu besar
+ 0 - 0
chaunyi_opc/opc_da/src/main/resources/static/page/static/js/chunk-9ad6dad4.41991f1f.js


File diff ditekan karena terlalu besar
+ 0 - 0
chaunyi_opc/opc_da/src/main/resources/static/page/static/js/chunk-9bb6506a.6f3fa68b.js


File diff ditekan karena terlalu besar
+ 0 - 0
chaunyi_opc/opc_da/src/main/resources/static/page/static/js/chunk-9de2d316.896a0149.js


+ 2 - 2
chaunyi_opc/opc_ua/src/main/java/com/example/opc_ua/util/OpcUaUtil.java

@@ -332,7 +332,7 @@ public class OpcUaUtil {
 
     public static String genException(String message) {
         if (Blank.isEmpty(message)) {
-            return "";
+            return "通信异常,请联系管理员";
         }
         if (message.contains("Bad_ConnectionRejected")) {
             return "ip连接不可用";
@@ -345,6 +345,6 @@ public class OpcUaUtil {
         } else if (message.contains("UnknownHostException")) {
             return "未知主机异常";
         }
-        return message;
+        return "通信异常(" + message + ")";
     }
 }

Beberapa file tidak ditampilkan karena terlalu banyak file yang berubah dalam diff ini