浏览代码

配合前端优化

tangbin 9 月之前
父节点
当前提交
77c9e2eb07

+ 1 - 1
yezhu-admin/src/main/java/com/kioor/common/config/SwaggerConfig.java

@@ -34,7 +34,7 @@ public class SwaggerConfig {
     @Bean
     public OpenAPI customOpenAPI() {
         return new OpenAPI().info(new Info()
-                .title("业主系统")
+                .title("管理系统")
                 .description("yezhu-admin文档")
                 .version("3.0")
                 .termsOfService("https://www.kioor.com"));

+ 2 - 1
yezhu-api/src/main/java/com/kioor/chat/controller/ChatLogController.java

@@ -48,10 +48,11 @@ public class ChatLogController {
         @Parameter(name = "type", description = "聊天类型:0小区群聊,1私聊"),
         @Parameter(name = "chatPartnerId", description = "聊天对象id")
     })
-    public Result<PageData<ChatLogDTO>> page(@Parameter(hidden = true) @RequestParam Map<String, Object> params){
+    public Result<PageData<ChatLogDTO>> page(@Parameter(hidden = true) @RequestParam Map<String, Object> params, @Parameter(hidden = true) @RequestAttribute("userId") Long userId){
         if(params.get("type")==null || params.get("chatPartnerId")==null){
             return new Result<PageData<ChatLogDTO>>().error(ErrorCode.NOT_NULL,"聊天类型和对象不能为空");
         }
+        params.put("editUser",userId);
         PageData<ChatLogDTO> page = chatLogService.page(params);
 
         return new Result<PageData<ChatLogDTO>>().ok(page);

+ 3 - 0
yezhu-api/src/main/java/com/kioor/chat/dto/ChatLogDTO.java

@@ -33,5 +33,8 @@ public class ChatLogDTO implements Serializable {
     private Date editTime;
     @Schema(description = "发言人房号")
     private String roomName;
+    @Schema(description = "是否是本人")
+    private Integer selfFlag;
+
 
 }

+ 8 - 1
yezhu-api/src/main/java/com/kioor/chat/service/impl/ChatLogServiceImpl.java

@@ -29,6 +29,8 @@ public class ChatLogServiceImpl extends BaseServiceImpl<ChatLogDao, ChatLogEntit
     @Override
     public PageData<ChatLogDTO> page(Map<String, Object> params) {
 
+        Long editUser = Long.parseLong(String.valueOf(params.get("editUser")));
+
         //分页
         IPage<ChatLogEntity> page = getPage(params, "edit_time", false);
 
@@ -36,7 +38,12 @@ public class ChatLogServiceImpl extends BaseServiceImpl<ChatLogDao, ChatLogEntit
         List<ChatLogDTO> list = baseDao.getList(params);
         //根据是否显示姓名和是否显示房号隐藏对应的数据
         list.forEach(this::hiddenInformation);
-
+        //判断是不是本人发送的消息
+        list.forEach(dto -> {
+            if (dto.getEditUser().equals(editUser)) {
+                dto.setSelfFlag(1);
+            }
+        });
 
         return getPageData(list, page.getTotal(), ChatLogDTO.class);
     }

+ 1 - 1
yezhu-api/src/main/java/com/kioor/config/SwaggerConfig.java

@@ -28,7 +28,7 @@ public class SwaggerConfig {
     @Bean
     public OpenAPI customOpenAPI() {
         return new OpenAPI().info(new Info()
-                .title("业主系统")
+                .title("管理系统")
                 .description("yezhu-api模块接口文档")
                 .version("3.0")
                 .termsOfService("https://www.kioor.com"));

+ 8 - 3
yezhu-api/src/main/java/com/kioor/room/controller/ApiRoomController.java

@@ -147,10 +147,15 @@ public class ApiRoomController {
             }
         }
         //从floorList的最后一个对象获取最大房号
-        int maxRoomNum = floorList.get(floorList.size()-1).getRoomNum();
+        int maxRoomNum = 0;
         //获取我的楼层
-        int centerFloor = floorService.get(floorList.get(0).getFloorId()).getFloorNum();
-
+        int centerFloor = 0;
+        if (!floorList.isEmpty()) {
+            //从floorList的最后一个对象获取最大房号
+            maxRoomNum = floorList.get(floorList.size() - 1).getRoomNum();
+            //获取我的楼层
+            centerFloor = floorService.get(floorList.get(0).getFloorId()).getFloorNum();
+        }
         //楼上的房间,设置数量和floorList相同的属性全为空的list
         List<RoomDetailDTO> upList = new ArrayList<>();
         //本层的房间,设置数量和floorList相同的属性全为空的list