Browse Source

添加我的聊天历史记录列表

udream-cxs 4 năm trước cách đây
mục cha
commit
b1fb4ea8dd

+ 6 - 0
lift-ud-service/src/main/java/cn/com/ty/lift/ud/chat/controller/ChatSessionController.java

@@ -49,6 +49,12 @@ public class ChatSessionController extends BaseController<ChatSessionEntity, Cha
         return chatSessionService.batchUpdate(req);
     }
 
+    @PutMapping("/set-top")
+    @ApiOperation(value = "置顶")
+    public RestResponse setTop(@RequestBody ChatSessionReq req) {
+        return chatSessionService.setTop(req);
+    }
+
     @PostMapping("/query-page")
     @ApiOperation(value = "分页查询")
     @Override

+ 2 - 0
lift-ud-service/src/main/java/cn/com/ty/lift/ud/chat/controller/model/ChatSessionReq.java

@@ -17,4 +17,6 @@ public class ChatSessionReq {
     private String sessionId;
     
     private List<String> sessionList;
+
+    private Integer topFlag;
 }

+ 6 - 0
lift-ud-service/src/main/java/cn/com/ty/lift/ud/chat/controller/query/ChatSessionQuery.java

@@ -100,6 +100,9 @@ public final class ChatSessionQuery extends BasePageQuery {
     @ApiModelProperty("发起人")
     private String userName;
 
+    @ApiModelProperty("诊单描述")
+    private String caseExpression;
+
     /**
      * 查询条件
      * 
@@ -130,6 +133,9 @@ public final class ChatSessionQuery extends BasePageQuery {
         if (StringUtils.isNotBlank(userName)) {
             query.like("users.name",userName);
         }
+        if (StringUtils.isNotBlank(caseExpression)) {
+            query.like("caseExpression",caseExpression);
+        }
         //按修改时间倒序
 //        query.orderByDesc("t.update_time");
         query.isNotNull("t.create_user_id");

+ 9 - 1
lift-ud-service/src/main/java/cn/com/ty/lift/ud/chat/mapper/ChatSessionMapper.java

@@ -59,9 +59,17 @@ public interface ChatSessionMapper extends BaseMapper<ChatSessionEntity> {
 
     int batchUpdate(@Param("req") ChatSessionReq req);
 
+    /**
+     * 置顶操作,取消置顶炒操作,根据sessionid修改top_flag字段
+     * @param req
+     * @return
+     */
+    int setTop(@Param("req") ChatSessionReq req);
+
     List<ChatSessionEntity> selectByQuery(@Param("ew") Wrapper wrapper, @Param("page") ChatSessionQuery query);
 
-    List<ChatSessionEntity> findDBListByUserId(@Param("userId") String userId);
+//    List<ChatSessionEntity> findDBListByUserId(@Param("userId") String userId);
+    List<ChatSessionEntity> findDBListByUserId(ChatSessionQuery query);
 
     int countByQuery(@Param("ew") Wrapper wrapper);
 

+ 34 - 19
lift-ud-service/src/main/java/cn/com/ty/lift/ud/chat/mapper/ChatSessionMapper.xml

@@ -221,6 +221,10 @@
         #{item}
     </foreach>
   </update>
+
+    <update id="setTop">
+        update chat_session set top_flag = #{req.topFlag} where  sessionid = #{req.sessionId}
+    </update>
   
   <update id="batchUpdateEntrance" >
    update chat_session set entrance = #{entrance} where  sessionid =  #{sessionId}
@@ -245,14 +249,16 @@
     </where>
   </select>
   
-  <select id="findDBListByUserId" parameterType="java.lang.String" resultType="cn.com.ty.lift.ud.chat.mapper.entity.ChatSessionEntity" >
+  <select id="findDBListByUserId" resultType="cn.com.ty.lift.ud.chat.mapper.entity.ChatSessionEntity" >
+      select * from (
       select
-              usr.`name` AS userName,
-              usr.avatar_url AS avatarUrl,
-              sessio.*,
-              '' caseType,
-              '' acceptStatus,
-              '' expression
+          usr.`name` AS userName,
+          usr.avatar_url AS avatarUrl,
+          sessio.*,
+          '' caseType,
+          '' acceptStatus,
+          '' expression,
+          sessio.top_flag topFlag
       from chat_session sessio
       left join user_info usr on usr.user_id = sessio.user_id
       where sessio.sessionid in (select sessionid from chat_session where user_id =   #{userId,javaType=java.lang.String})
@@ -260,34 +266,43 @@
       and sessio.statuz = 1 and sessio.data_table = 3
       union
       select
-              usr.`name` AS userName,
-              usr.avatar_url AS avatarUrl,
-              sessio.*,
-              cas.data_table caseType,
-              cas.accept_status acceptStatus,
-              cas.expression expression
+          usr.`name` AS userName,
+          usr.avatar_url AS avatarUrl,
+          sessio.*,
+          cas.data_table caseType,
+          cas.accept_status acceptStatus,
+          cas.expression expression,
+          sessio.top_flag topFlag
       from chat_session sessio
       left join lift_case cas on cas.session_id = sessio.sessionid
       left join user_info usr on usr.user_id = sessio.user_id
       where sessio.sessionid in (select sessionid from chat_session where user_id =   #{userId,javaType=java.lang.String})
       and sessio.user_id !=   #{userId,javaType=java.lang.String}
+      <if test="caseExpression != null" >
+          and cas.expression like CONCAT("%",#{caseExpression},"%")
+      </if>
       and sessio.statuz = 1 and sessio.data_table != 3
       and cas.accept_status = 1
       union
       select
-              '' AS userName,
-              '' AS avatarUrl,
-              sessio.*,
-              cas.data_table caseType,
-              cas.accept_status acceptStatus,
-              cas.expression expression
+          '' AS userName,
+          '' AS avatarUrl,
+          sessio.*,
+          cas.data_table caseType,
+          cas.accept_status acceptStatus,
+          cas.expression expression,
+          sessio.top_flag topFlag
       from chat_session sessio
       left join lift_case cas on cas.session_id = sessio.sessionid
       left join user_info usr on usr.user_id = sessio.user_id
       where sessio.user_id =   #{userId,javaType=java.lang.String}
+      <if test="caseExpression != null" >
+          and cas.expression like CONCAT("%",#{caseExpression},"%")
+      </if>
       and sessio.data_table != 3
       and sessio.statuz = 1
       and cas.accept_status != 1
+      )temp order by topFlag desc
   </select>
 
 

+ 6 - 0
lift-ud-service/src/main/java/cn/com/ty/lift/ud/chat/mapper/entity/ChatSessionEntity.java

@@ -70,6 +70,12 @@ public class ChatSessionEntity extends BaseEntity {
     @ApiModelProperty("状态 1:正常 0:屏蔽")
     private Integer statuz;
 
+    /**
+     * 是否置顶 1置顶,0不置顶
+     */
+    @ApiModelProperty("是否置顶 1置顶,0不置顶")
+    private Integer topFlag;
+
     private transient String userName;
     private transient String avatarUrl;
     private transient Integer acceptStatus;

+ 7 - 0
lift-ud-service/src/main/java/cn/com/ty/lift/ud/chat/service/IChatSessionService.java

@@ -45,6 +45,13 @@ public interface IChatSessionService extends IService<ChatSessionEntity> {
      */
     RestResponse batchUpdate(ChatSessionReq req);
 
+    /**
+     * 置顶操作,取消置顶炒操作,根据sessionid修改top_flag字段
+     * @param req
+     * @return
+     */
+    RestResponse setTop(ChatSessionReq req);
+
     RestResponse selectByExample(ChatSessionQuery request);
 
     int insertSelective(ChatSessionEntity record);

+ 11 - 1
lift-ud-service/src/main/java/cn/com/ty/lift/ud/chat/service/impl/ChatSessionServiceImpl.java

@@ -89,6 +89,16 @@ public class ChatSessionServiceImpl extends ServiceImpl<ChatSessionMapper, ChatS
             return RestResponse.fail("Updated unsuccessfully");
     }
 
+    @Override
+    public RestResponse setTop(ChatSessionReq req) {
+        int i = sessionMapper.setTop(req);
+
+        if (i > 0)
+            return RestResponse.success("Updated successfully");
+        else
+            return RestResponse.fail("Updated unsuccessfully");
+    }
+
     @Override
     public RestResponse selectByExample(ChatSessionQuery query) {
         IPage page = query.page();
@@ -128,7 +138,7 @@ public class ChatSessionServiceImpl extends ServiceImpl<ChatSessionMapper, ChatS
     @Override
     public RestResponse findDBListByUserId(ChatSessionQuery query) {
         IPage page = query.page();
-        List<ChatSessionEntity> list = sessionMapper.findDBListByUserId(query.getUserId());
+        List<ChatSessionEntity> list = sessionMapper.findDBListByUserId(query);
         list.forEach(entity -> {
             RoomInfo roomInfo = redis.get("ROOM:" + entity.getSessionid(), RoomInfo.class);
             if (null != roomInfo) {

+ 7 - 0
lift-ud-service/src/main/java/cn/com/ty/lift/ud/dataBank/mapper/entity/CategoryConstant.java

@@ -0,0 +1,7 @@
+package cn.com.ty.lift.ud.dataBank.mapper.entity;
+
+public interface CategoryConstant {
+    Integer MANUAL_NUM = 1;
+    String MANUAL_NAME = "使用手册";
+    String MANUAL_PIC_URL = "";
+}

+ 1 - 1
lift-ud-service/src/main/resources/application-prod.yml

@@ -1,6 +1,6 @@
 spring:
   datasource:
-    url: jdbc:mysql://rm-bp1qkwy173koi066xuo.mysql.rds.aliyuncs.com/rdsliftmanager?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai
+    url: jdbc:mysql://rm-bp1qkwy173koi066xuo.mysql.rds.aliyuncs.com:3306/rdsliftmanager?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai
     username: tykj
     password: Tdkg-13250409
     driver-class-name: com.mysql.cj.jdbc.Driver