Merge remote-tracking branch 'origin/jihan_0920_护理服务、商城、积分兑换、在线问诊功能分支' into jihan_0920_护理服务、商城、积分兑换、在线问诊功能分支
This commit is contained in:
commit
b285e99460
@ -40,6 +40,11 @@ public class MessageTemplate {
|
||||
*/
|
||||
private String msgType;
|
||||
|
||||
/**
|
||||
* 消息类型(文字/图片)
|
||||
*/
|
||||
private String messageType;
|
||||
|
||||
/**
|
||||
* 发送时间
|
||||
* */
|
||||
|
||||
@ -12,12 +12,14 @@ import com.xinelu.common.core.domain.R;
|
||||
import com.xinelu.common.enums.BusinessType;
|
||||
import com.xinelu.common.socket.WebSocketUtils;
|
||||
import com.xinelu.manage.domain.chatRecord.ChatRecord;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
@ -33,6 +35,7 @@ import org.springframework.web.multipart.MultipartFile;
|
||||
* @author wanghao
|
||||
* @create 2023/9/26 0026
|
||||
*/
|
||||
@Api(tags = "消息控制器")
|
||||
@RestController
|
||||
@RequestMapping("/nurseApplet/chatRecord")
|
||||
public class ChatRecordController extends BaseController {
|
||||
@ -62,7 +65,8 @@ public class ChatRecordController extends BaseController {
|
||||
@PostMapping("/sendMessage")
|
||||
@Transactional
|
||||
public AjaxResult sendMessage(@RequestBody ChatRecordDTO chatRecordDTO) {
|
||||
if (chatRecordService.insertChatRecord(chatRecordDTO) > 0) {
|
||||
chatRecordDTO.setMessageCategory("3");
|
||||
if (chatRecordService.insertChatRecord(chatRecordDTO) > 0) {
|
||||
// 判断接收人是否在线
|
||||
if (WebSocketUtils.clients.get(chatRecordDTO.getRecipientId().toString()) == null) {
|
||||
return AjaxResult.success();
|
||||
@ -96,4 +100,13 @@ public class ChatRecordController extends BaseController {
|
||||
}
|
||||
return R.ok(chatRecordService.getMegVoList(messageDto));
|
||||
}
|
||||
|
||||
@ApiOperation("删除消息")
|
||||
@GetMapping("/deleteMegs")
|
||||
public R<String> deleteMegs(@RequestBody List<Long> ids) {
|
||||
if (CollectionUtils.isEmpty(ids)) {
|
||||
return R.fail("请选择要删除的消息!");
|
||||
}
|
||||
return chatRecordService.deleteMegs(ids) > 0 ? R.ok("删除成功") : R.fail("删除失败");
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,6 +2,7 @@ package com.xinelu.applet.dto.chatrecord;
|
||||
|
||||
import com.xinelu.common.core.domain.BaseEntity;
|
||||
import com.xinelu.common.custominterface.Insert;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import net.sf.jsqlparser.statement.update.Update;
|
||||
import org.hibernate.validator.constraints.Length;
|
||||
@ -21,6 +22,9 @@ public class ChatRecordDTO extends BaseEntity implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = -3911806583514536587L;
|
||||
|
||||
@ApiModelProperty("消息类别 1:通知公告,2:健康推送,3:在线咨询 4:消息通知")
|
||||
private String messageCategory;
|
||||
|
||||
/**
|
||||
* 聊天记录业务主键(问诊表id)
|
||||
*/
|
||||
|
||||
@ -25,7 +25,7 @@ public interface ChatRecordMapper {
|
||||
* @param id 图文咨询-聊天记录主键
|
||||
* @return 图文咨询-聊天记录
|
||||
*/
|
||||
public ChatRecord selectChatRecordById(Long id);
|
||||
ChatRecord selectChatRecordById(Long id);
|
||||
|
||||
/**
|
||||
* 查询图文咨询-聊天记录列表
|
||||
@ -33,7 +33,7 @@ public interface ChatRecordMapper {
|
||||
* @param chatRecord 图文咨询-聊天记录
|
||||
* @return 图文咨询-聊天记录集合
|
||||
*/
|
||||
public List<ChatRecord> selectChatRecordList(ChatRecord chatRecord);
|
||||
List<ChatRecord> selectChatRecordList(ChatRecord chatRecord);
|
||||
|
||||
/**
|
||||
* 新增图文咨询-聊天记录
|
||||
@ -41,7 +41,7 @@ public interface ChatRecordMapper {
|
||||
* @param chatRecord 图文咨询-聊天记录
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertChatRecord(ChatRecord chatRecord);
|
||||
int insertChatRecord(ChatRecord chatRecord);
|
||||
|
||||
/**
|
||||
* 修改图文咨询-聊天记录
|
||||
@ -49,7 +49,7 @@ public interface ChatRecordMapper {
|
||||
* @param chatRecord 图文咨询-聊天记录
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateChatRecord(ChatRecord chatRecord);
|
||||
int updateChatRecord(ChatRecord chatRecord);
|
||||
|
||||
/**
|
||||
* 删除图文咨询-聊天记录
|
||||
@ -57,7 +57,7 @@ public interface ChatRecordMapper {
|
||||
* @param id 图文咨询-聊天记录主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteChatRecordById(Long id);
|
||||
int deleteChatRecordById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除图文咨询-聊天记录
|
||||
@ -65,7 +65,9 @@ public interface ChatRecordMapper {
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteChatRecordByIds(Long[] ids);
|
||||
int deleteChatRecordByIds(Long[] ids);
|
||||
|
||||
Integer updateReadStatus(MarkReadDto markReadDto);
|
||||
|
||||
int deleteMegs(@Param("ids") List<Long> ids);
|
||||
}
|
||||
|
||||
@ -24,7 +24,7 @@ public interface IChatRecordService {
|
||||
* @param id 图文咨询-聊天记录主键
|
||||
* @return 图文咨询-聊天记录
|
||||
*/
|
||||
public ChatRecord selectChatRecordById(Long id);
|
||||
ChatRecord selectChatRecordById(Long id);
|
||||
|
||||
/**
|
||||
* 查询图文咨询-聊天记录列表
|
||||
@ -32,7 +32,7 @@ public interface IChatRecordService {
|
||||
* @param chatRecord 图文咨询-聊天记录
|
||||
* @return 图文咨询-聊天记录集合
|
||||
*/
|
||||
public List<ChatRecord> selectChatRecordList(ChatRecord chatRecord);
|
||||
List<ChatRecord> selectChatRecordList(ChatRecord chatRecord);
|
||||
|
||||
/**
|
||||
* 新增图文咨询-聊天记录
|
||||
@ -40,7 +40,7 @@ public interface IChatRecordService {
|
||||
* @param chatRecordDTO 图文咨询-聊天记录
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertChatRecord(ChatRecordDTO chatRecordDTO);
|
||||
int insertChatRecord(ChatRecordDTO chatRecordDTO);
|
||||
|
||||
Boolean sendMessage(ChatRecordDTO chatRecordDTO);
|
||||
|
||||
@ -50,7 +50,7 @@ public interface IChatRecordService {
|
||||
* @param chatRecord 图文咨询-聊天记录
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateChatRecord(ChatRecord chatRecord);
|
||||
int updateChatRecord(ChatRecord chatRecord);
|
||||
|
||||
/**
|
||||
* 批量删除图文咨询-聊天记录
|
||||
@ -58,7 +58,7 @@ public interface IChatRecordService {
|
||||
* @param ids 需要删除的图文咨询-聊天记录主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteChatRecordByIds(Long[] ids);
|
||||
int deleteChatRecordByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除图文咨询-聊天记录信息
|
||||
@ -66,7 +66,7 @@ public interface IChatRecordService {
|
||||
* @param id 图文咨询-聊天记录主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteChatRecordById(Long id);
|
||||
int deleteChatRecordById(Long id);
|
||||
|
||||
|
||||
/**
|
||||
@ -75,7 +75,9 @@ public interface IChatRecordService {
|
||||
* @param multipartFile,consultationId 文件,问诊id
|
||||
* @return 结果
|
||||
*/
|
||||
public AjaxResult uploadChatRecordFile(MultipartFile multipartFile, Long consultationId) throws IOException, InvalidExtensionException;
|
||||
AjaxResult uploadChatRecordFile(MultipartFile multipartFile, Long consultationId) throws IOException, InvalidExtensionException;
|
||||
|
||||
List<MessageCenterVo> getMegVoList(MessageSearchDto messageDto);
|
||||
|
||||
Integer deleteMegs(List<Long> ids);
|
||||
}
|
||||
|
||||
@ -20,6 +20,7 @@ import com.xinelu.common.utils.file.MimeTypeUtils;
|
||||
import com.xinelu.manage.domain.chatRecord.ChatRecord;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@ -76,6 +77,9 @@ public class ChatRecordServiceImpl implements IChatRecordService {
|
||||
chatRecord.setCreateTime(DateUtils.getNowDate());
|
||||
ChatRecord record = new ChatRecord();
|
||||
BeanUtils.copyBeanProp(record, chatRecord);
|
||||
record.setReadStatus("0");
|
||||
record.setSendTime(new Date());
|
||||
record.setDelFlag(0);
|
||||
return chatRecordMapper.insertChatRecord(record);
|
||||
}
|
||||
|
||||
@ -87,6 +91,7 @@ public class ChatRecordServiceImpl implements IChatRecordService {
|
||||
msg.setFromKey(chatRecord.getSenderId().toString());
|
||||
msg.setToKey(chatRecord.getRecipientId().toString());
|
||||
msg.setMsgType(MessageContentType.CHAT.name());
|
||||
msg.setMessageType(chatRecord.getMessageType());
|
||||
msg.setSendTime(chatRecord.getSendTime());
|
||||
return WebSocketUtils.sendMessage(chatRecord.getRecipientId().toString(), msg);
|
||||
}
|
||||
@ -209,4 +214,8 @@ public class ChatRecordServiceImpl implements IChatRecordService {
|
||||
|
||||
return messageCenterVos;
|
||||
}
|
||||
|
||||
@Override public Integer deleteMegs(List<Long> ids) {
|
||||
return chatRecordMapper.deleteMegs(ids);
|
||||
}
|
||||
}
|
||||
|
||||
@ -66,7 +66,7 @@
|
||||
select
|
||||
<include refid="Message_Vo_List"/>
|
||||
from chat_record
|
||||
where del_flag = '0' and (recipient_id = #{recipientId} or sender_id = #{recipientId})
|
||||
where del_flag = 0 and (recipient_id = #{recipientId} or sender_id = #{recipientId})
|
||||
<if test="messageCategory != null">
|
||||
and message_category = #{messageCategory}
|
||||
</if>
|
||||
@ -89,7 +89,7 @@
|
||||
recipient_id,
|
||||
recipient_name
|
||||
from chat_record
|
||||
where del_flag = '0'
|
||||
where del_flag = 0
|
||||
and message_category = '3'
|
||||
and ((sender_id = #{bindingNo} and recipient_id = #{doctorNo})
|
||||
or (sender_id = #{doctorNo} and recipient_id = #{bindingNo}))
|
||||
@ -98,7 +98,7 @@
|
||||
|
||||
<select id="selectChatRecordList" parameterType="ChatRecord" resultMap="ChatRecordResult">
|
||||
<include refid="selectChatRecordVo"/>
|
||||
where del_flag = '0'
|
||||
where del_flag = 0
|
||||
and consultation_id = #{consultationId}
|
||||
and (
|
||||
(sender_id = #{senderId} and recipient_id = #{recipientId})
|
||||
@ -218,7 +218,7 @@
|
||||
<if test="crowds != null">crowds =
|
||||
#{crowds},
|
||||
</if>
|
||||
<if test="crowdsName != null">crowds_name
|
||||
<if test="crowdsName != null">crowds_name =
|
||||
#{crowdsName},
|
||||
</if>
|
||||
<if test="senderId != null">sender_id =
|
||||
@ -283,7 +283,7 @@
|
||||
read_time = #{readTime},
|
||||
</if>
|
||||
</trim>
|
||||
where del_flag = '0' and read_status = '0' and recipient_id = #{recipientId}
|
||||
where del_flag = 0 and read_status = '0' and recipient_id = #{recipientId}
|
||||
</update>
|
||||
|
||||
<delete id="deleteChatRecordById" parameterType="Long">
|
||||
@ -298,4 +298,16 @@
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<update id="deleteMegs">
|
||||
update chat_record set del_flag = 1
|
||||
<where>
|
||||
<if test="ids != null">
|
||||
id in
|
||||
<foreach collection="ids" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</if>
|
||||
</where>
|
||||
</update>
|
||||
</mapper>
|
||||
|
||||
@ -69,6 +69,8 @@
|
||||
ci.doctor_name,
|
||||
ci.problem_description,
|
||||
ci.create_time,
|
||||
(SELECT content FROM chat_record cr WHERE cr.consultation_id = ci.id ORDER BY create_time DESC LIMIT 1) as content,
|
||||
(SELECT message_type FROM chat_record cr WHERE cr.consultation_id = ci.id ORDER BY create_time DESC LIMIT 1) as messageType,
|
||||
(SELECT COUNT(cr.id) FROM chat_record cr WHERE cr.consultation_id = ci.id AND read_status = '0'
|
||||
<if test="patientId != null ">
|
||||
and sender_id= ci.doctor_id
|
||||
|
||||
@ -118,6 +118,15 @@ public class ConsultationInfoVO extends BaseEntity implements Serializable {
|
||||
*/
|
||||
private String medicalRecord;
|
||||
|
||||
/**
|
||||
* 最近一次内容
|
||||
*/
|
||||
private String content;
|
||||
/**
|
||||
* 内容类型
|
||||
*/
|
||||
private String messageType;
|
||||
|
||||
/**
|
||||
* 是否删除标识,0:否,1:是
|
||||
*/
|
||||
@ -152,6 +161,8 @@ public class ConsultationInfoVO extends BaseEntity implements Serializable {
|
||||
.append("medicalRecord", getMedicalRecord())
|
||||
.append("delFlag", getDelFlag())
|
||||
.append("messageCount", getMessageCount())
|
||||
.append("content", getContent())
|
||||
.append("messageType", getMessageType())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user