Commit 535f55bf authored by shiyu's avatar shiyu

时间类型

parent be8498f0
package com.wwdz.ch.admin.controller;
import com.alibaba.fastjson.JSON;
import com.wwdz.ch.admin.service.SysAiAssistantService;
import com.wwdz.ch.core.type.Result;
import com.wwdz.ch.db.dto.request.AiAssistantRequestDto;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/admin/sysAiAssistant")
public class SysAiAssistantController {
private static final Logger logger = LoggerFactory.getLogger(SysAiAssistantController.class);
@Autowired
SysAiAssistantService sysAiAssistantService;
@ApiOperation(value = "ai机器人")
@PostMapping("/find")
public Result find(@RequestBody AiAssistantRequestDto dto) {
logger.info("【请求开始】ai机器人列表,请求参数:{}", JSON.toJSONString(dto));
return sysAiAssistantService.find(dto);
}
}
package com.wwdz.ch.admin.impl;
import com.wwdz.ch.admin.service.SysAiAssistantService;
import com.wwdz.ch.core.type.Result;
import com.wwdz.ch.db.dao.AiAssistantDao;
import com.wwdz.ch.db.domain.AiAssistant;
import com.wwdz.ch.db.dto.request.AiAssistantRequestDto;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class SysAiAssistantServiceImpl implements SysAiAssistantService {
@Autowired
AiAssistantDao aiAssistantDao;
@Override
public Result find(AiAssistantRequestDto aiAssistantRequestDto) {
List<AiAssistant> list = aiAssistantDao.find(aiAssistantRequestDto);
return Result.success(list);
}
}
package com.wwdz.ch.admin.service;
import com.wwdz.ch.core.type.Result;
import com.wwdz.ch.db.dto.request.AiAssistantRequestDto;
public interface SysAiAssistantService {
Result find(AiAssistantRequestDto aiAssistantRequestDto);
}
package com.wwdz.ch.admin.impl;
import com.wwdz.ch.admin.service.BidRecordService;
import com.wwdz.ch.admin.service.SysIMService;
import com.wwdz.ch.core.consts.IMEnum;
import com.wwdz.ch.core.entity.im.SendChatMsgRequestDto;
import com.wwdz.ch.core.type.Result;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@SpringBootTest
@RunWith(SpringJUnit4ClassRunner.class)
public class SysIMServiceImplTest {
private static final Logger logger = LoggerFactory.getLogger(BidRecordServiceImplTest.class);
@Autowired
SysIMService sysIMService;
@Test
public void sendChatMsg() {
SendChatMsgRequestDto sendChatMsgRequestDto = new SendChatMsgRequestDto();
sendChatMsgRequestDto.setToAccount("251");
sendChatMsgRequestDto.setFromAccount("ai10000");
sendChatMsgRequestDto.setMsgType(IMEnum.MsgTypeEnum.TIMTextElem.getCode());
long timestamp = System.currentTimeMillis();
String msgContent = timestamp + " >> 测试消息的数据, 是否可以接收到";
// String msgContent = "Hi,欢迎来到老猫的世界";
sendChatMsgRequestDto.setMsgContent(msgContent);
sendChatMsgRequestDto.setIsRealPersonAnswer(1);
sendChatMsgRequestDto.setRealPersonId("257");
sysIMService.sendChatMsg(sendChatMsgRequestDto);
}
}
\ No newline at end of file
......@@ -6,6 +6,8 @@ import java.util.List;
public interface AiAssistantDao {
List<AiAssistant> find(AiAssistantRequestDto dto);
List<AiAssistant> findList (AiAssistantRequestDto dto);
AiAssistant findByCode (String code);
......
package com.wwdz.ch.db.domain;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import com.xxdxxs.entity.Entity;
import lombok.Data;
/**
* @author shiyu
* @date 2023/11/01
*/
@Data
public class Conversation implements Entity {
private Integer id;
/**
* 会话id
*/
private String chatId;
/**
* 消息发送账户
*/
private String fromAccount;
/**
* 消息接收账户
*/
private String toAccount;
/**
* 创建时间
*/
private Date createTime;
private static final long serialVersionUID = 1L;
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id);
sb.append(", chatId=").append(chatId);
sb.append(", fromAccount=").append(fromAccount);
sb.append(", toAccount=").append(toAccount);
sb.append(", createTime=").append(createTime);
sb.append(", serialVersionUID=").append(serialVersionUID);
sb.append("]");
return sb.toString();
}
@Override
public boolean equals(Object that) {
if (this == that) {
return true;
}
if (that == null) {
return false;
}
if (getClass() != that.getClass()) {
return false;
}
Conversation other = (Conversation) that;
return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
&& (this.getChatId() == null ? other.getChatId() == null : this.getChatId().equals(other.getChatId()))
&& (this.getFromAccount() == null ? other.getFromAccount() == null : this.getFromAccount().equals(other.getFromAccount()))
&& (this.getToAccount() == null ? other.getToAccount() == null : this.getToAccount().equals(other.getToAccount()))
&& (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()));
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
result = prime * result + ((getChatId() == null) ? 0 : getChatId().hashCode());
result = prime * result + ((getFromAccount() == null) ? 0 : getFromAccount().hashCode());
result = prime * result + ((getToAccount() == null) ? 0 : getToAccount().hashCode());
result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
return result;
}
/**
* This enum was generated by MyBatis Generator.
* This enum corresponds to the database table conversation
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public enum Column {
id("id", "id", "INTEGER", false),
chatId("chat_id", "chatId", "VARCHAR", false),
fromAccount("from_account", "fromAccount", "VARCHAR", false),
toAccount("to_account", "toAccount", "VARCHAR", false),
createTime("create_time", "createTime", "TIMESTAMP", false);
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table conversation
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
private static final String BEGINNING_DELIMITER = "`";
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table conversation
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
private static final String ENDING_DELIMITER = "`";
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table conversation
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
private final String column;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table conversation
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
private final boolean isColumnNameDelimited;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table conversation
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
private final String javaProperty;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table conversation
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
private final String jdbcType;
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table conversation
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public String value() {
return this.column;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table conversation
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public String getValue() {
return this.column;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table conversation
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public String getJavaProperty() {
return this.javaProperty;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table conversation
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public String getJdbcType() {
return this.jdbcType;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table conversation
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
Column(String column, String javaProperty, String jdbcType, boolean isColumnNameDelimited) {
this.column = column;
this.javaProperty = javaProperty;
this.jdbcType = jdbcType;
this.isColumnNameDelimited = isColumnNameDelimited;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table conversation
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public String desc() {
return this.getEscapedColumnName() + " DESC";
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table conversation
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public String asc() {
return this.getEscapedColumnName() + " ASC";
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table conversation
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public static Column[] excludes(Column ... excludes) {
ArrayList<Column> columns = new ArrayList<>(Arrays.asList(Column.values()));
if (excludes != null && excludes.length > 0) {
columns.removeAll(new ArrayList<>(Arrays.asList(excludes)));
}
return columns.toArray(new Column[]{});
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table conversation
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public String getEscapedColumnName() {
if (this.isColumnNameDelimited) {
return new StringBuilder().append(BEGINNING_DELIMITER).append(this.column).append(ENDING_DELIMITER).toString();
} else {
return this.column;
}
}
}
}
\ No newline at end of file
package com.wwdz.ch.db.domain;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import com.xxdxxs.entity.Entity;
import lombok.Data;
/**
* @author shiyu
* @date 2023/10/23
* @date 2023/11/01
*/
@Data
public class ImRecord implements Entity {
......@@ -69,6 +71,11 @@ public class ImRecord implements Entity {
*/
private String msgContent;
/**
* 自定义消息数据
*/
private String cloudCustomData;
private static final long serialVersionUID = 1L;
@Override
......@@ -89,6 +96,7 @@ public class ImRecord implements Entity {
sb.append(", updateTime=").append(updateTime);
sb.append(", state=").append(state);
sb.append(", msgContent=").append(msgContent);
sb.append(", cloudCustomData=").append(cloudCustomData);
sb.append(", serialVersionUID=").append(serialVersionUID);
sb.append("]");
return sb.toString();
......@@ -117,7 +125,8 @@ public class ImRecord implements Entity {
&& (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()))
&& (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime()))
&& (this.getState() == null ? other.getState() == null : this.getState().equals(other.getState()))
&& (this.getMsgContent() == null ? other.getMsgContent() == null : this.getMsgContent().equals(other.getMsgContent()));
&& (this.getMsgContent() == null ? other.getMsgContent() == null : this.getMsgContent().equals(other.getMsgContent()))
&& (this.getCloudCustomData() == null ? other.getCloudCustomData() == null : this.getCloudCustomData().equals(other.getCloudCustomData()));
}
@Override
......@@ -136,6 +145,7 @@ public class ImRecord implements Entity {
result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode());
result = prime * result + ((getState() == null) ? 0 : getState().hashCode());
result = prime * result + ((getMsgContent() == null) ? 0 : getMsgContent().hashCode());
result = prime * result + ((getCloudCustomData() == null) ? 0 : getCloudCustomData().hashCode());
return result;
}
......@@ -158,7 +168,8 @@ public class ImRecord implements Entity {
createTime("create_time", "createTime", "TIMESTAMP", false),
updateTime("update_time", "updateTime", "TIMESTAMP", false),
state("state", "state", "INTEGER", true),
msgContent("msg_content", "msgContent", "LONGVARCHAR", false);
msgContent("msg_content", "msgContent", "LONGVARCHAR", false),
cloudCustomData("cloud_custom_data", "cloudCustomData", "LONGVARCHAR", false);
/**
* This field was generated by MyBatis Generator.
......
......@@ -17,6 +17,12 @@ public class AiAssistantDaoImpl implements AiAssistantDao {
@Autowired
AiAssistantMapper aiAssistantMapper;
@Override
public List<AiAssistant> find(AiAssistantRequestDto dto) {
AiAssistantExample aiAssistantExample = new AiAssistantExample();
return aiAssistantMapper.selectByExample(aiAssistantExample);
}
@Override
public List<AiAssistant> findList(AiAssistantRequestDto dto) {
......
package com.wwdz.ch.db.mapper;
import com.wwdz.ch.db.domain.Conversation;
import com.wwdz.ch.db.domain.ConversationExample;
import java.util.List;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@Mapper
public interface ConversationMapper {
long countByExample(ConversationExample example);
int deleteByExample(ConversationExample example);
int deleteByPrimaryKey(Integer id);
int insert(Conversation record);
int insertSelective(Conversation record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table conversation
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
Conversation selectOneByExample(ConversationExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table conversation
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
Conversation selectOneByExampleSelective(@Param("example") ConversationExample example, @Param("selective") Conversation.Column ... selective);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table conversation
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
List<Conversation> selectByExampleSelective(@Param("example") ConversationExample example, @Param("selective") Conversation.Column ... selective);
List<Conversation> selectByExample(ConversationExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table conversation
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
Conversation selectByPrimaryKeySelective(@Param("id") Integer id, @Param("selective") Conversation.Column ... selective);
Conversation selectByPrimaryKey(Integer id);
int updateByExampleSelective(@Param("record") Conversation record, @Param("example") ConversationExample example);
int updateByExample(@Param("record") Conversation record, @Param("example") ConversationExample example);
int updateByPrimaryKeySelective(Conversation record);
int updateByPrimaryKey(Conversation record);
}
\ No newline at end of file
......@@ -16,6 +16,7 @@
</resultMap>
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="com.wwdz.ch.db.domain.ImRecord">
<result column="msg_content" jdbcType="LONGVARCHAR" property="msgContent" />
<result column="cloud_custom_data" jdbcType="LONGVARCHAR" property="cloudCustomData" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
......@@ -80,7 +81,7 @@
create_time, update_time, `state`
</sql>
<sql id="Blob_Column_List">
msg_content
msg_content, cloud_custom_data
</sql>
<select id="selectByExampleWithBLOBs" parameterType="com.wwdz.ch.db.domain.ImRecordExample" resultMap="ResultMapWithBLOBs">
select
......@@ -126,14 +127,14 @@
distinct
</if>
<choose>
<when test="selective != null and selective.length > 0">
<when test="selective != null and selective.length &gt; 0">
<foreach collection="selective" item="column" separator=",">
${column.escapedColumnName}
</foreach>
</when>
<otherwise>
id, from_account, to_account, msg_key, msg_time, send_msg_result, msg_type, online_only_flag,
create_time, update_time, `state`, msg_content
create_time, update_time, `state`, msg_content, cloud_custom_data
</otherwise>
</choose>
from im_record
......@@ -160,14 +161,14 @@
-->
select
<choose>
<when test="selective != null and selective.length > 0">
<when test="selective != null and selective.length &gt; 0">
<foreach collection="selective" item="column" separator=",">
${column.escapedColumnName}
</foreach>
</when>
<otherwise>
id, from_account, to_account, msg_key, msg_time, send_msg_result, msg_type, online_only_flag,
create_time, update_time, `state`, msg_content
create_time, update_time, `state`, msg_content, cloud_custom_data
</otherwise>
</choose>
from im_record
......@@ -190,11 +191,13 @@
insert into im_record (from_account, to_account, msg_key,
msg_time, send_msg_result, msg_type,
online_only_flag, create_time, update_time,
`state`, msg_content)
`state`, msg_content, cloud_custom_data
)
values (#{fromAccount,jdbcType=VARCHAR}, #{toAccount,jdbcType=VARCHAR}, #{msgKey,jdbcType=VARCHAR},
#{msgTime,jdbcType=TIMESTAMP}, #{sendMsgResult,jdbcType=INTEGER}, #{msgType,jdbcType=INTEGER},
#{onlineOnlyFlag,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP},
#{state,jdbcType=INTEGER}, #{msgContent,jdbcType=LONGVARCHAR})
#{state,jdbcType=INTEGER}, #{msgContent,jdbcType=LONGVARCHAR}, #{cloudCustomData,jdbcType=LONGVARCHAR}
)
</insert>
<insert id="insertSelective" parameterType="com.wwdz.ch.db.domain.ImRecord">
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
......@@ -235,6 +238,9 @@
<if test="msgContent != null">
msg_content,
</if>
<if test="cloudCustomData != null">
cloud_custom_data,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="fromAccount != null">
......@@ -270,6 +276,9 @@
<if test="msgContent != null">
#{msgContent,jdbcType=LONGVARCHAR},
</if>
<if test="cloudCustomData != null">
#{cloudCustomData,jdbcType=LONGVARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.wwdz.ch.db.domain.ImRecordExample" resultType="java.lang.Long">
......@@ -317,6 +326,9 @@
<if test="record.msgContent != null">
msg_content = #{record.msgContent,jdbcType=LONGVARCHAR},
</if>
<if test="record.cloudCustomData != null">
cloud_custom_data = #{record.cloudCustomData,jdbcType=LONGVARCHAR},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
......@@ -335,7 +347,8 @@
create_time = #{record.createTime,jdbcType=TIMESTAMP},
update_time = #{record.updateTime,jdbcType=TIMESTAMP},
`state` = #{record.state,jdbcType=INTEGER},
msg_content = #{record.msgContent,jdbcType=LONGVARCHAR}
msg_content = #{record.msgContent,jdbcType=LONGVARCHAR},
cloud_custom_data = #{record.cloudCustomData,jdbcType=LONGVARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
......@@ -393,6 +406,9 @@
<if test="msgContent != null">
msg_content = #{msgContent,jdbcType=LONGVARCHAR},
</if>
<if test="cloudCustomData != null">
cloud_custom_data = #{cloudCustomData,jdbcType=LONGVARCHAR},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
......@@ -408,7 +424,8 @@
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP},
`state` = #{state,jdbcType=INTEGER},
msg_content = #{msgContent,jdbcType=LONGVARCHAR}
msg_content = #{msgContent,jdbcType=LONGVARCHAR},
cloud_custom_data = #{cloudCustomData,jdbcType=LONGVARCHAR}
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="com.wwdz.ch.db.domain.ImRecord">
......@@ -472,14 +489,14 @@
select
'true' as QUERYID,
<choose>
<when test="selective != null and selective.length > 0">
<when test="selective != null and selective.length &gt; 0">
<foreach collection="selective" item="column" separator=",">
${column.escapedColumnName}
</foreach>
</when>
<otherwise>
id, from_account, to_account, msg_key, msg_time, send_msg_result, msg_type, online_only_flag,
create_time, update_time, `state`, msg_content
create_time, update_time, `state`, msg_content, cloud_custom_data
</otherwise>
</choose>
from im_record
......@@ -491,4 +508,5 @@
</if>
limit 1
</select>
</mapper>
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment