Commit 0abe87a3 authored by shiyu's avatar shiyu

ai助手

parent 31cb41b2
...@@ -41,6 +41,8 @@ public class MessageEnum { ...@@ -41,6 +41,8 @@ public class MessageEnum {
SHARE(1, "分享信息"), SHARE(1, "分享信息"),
COLLECT(2, "收藏信息"), COLLECT(2, "收藏信息"),
FOLLOW(3, "关注信息"), FOLLOW(3, "关注信息"),
AI_CHAT(4, "AI聊天信息"),
CHAT(5, "聊天信息"),
; ;
private int code; private int code;
...@@ -106,7 +108,7 @@ public class MessageEnum { ...@@ -106,7 +108,7 @@ public class MessageEnum {
ITEM_SHARE(1, "分享了您的藏品"), ITEM_SHARE(1, "分享了您的藏品"),
ITEM_COLLECT(2, "收藏了您的藏品"), ITEM_COLLECT(2, "收藏了您的藏品"),
FAVORITES_SHARE(3, "分享了您的收藏册"), FAVORITES_SHARE(3, "分享了您的收藏册"),
FAVORITES_COLLECT(3, "收藏了您的收藏册"), FAVORITES_COLLECT(4, "收藏了您的收藏册"),
; ;
private int code; private int code;
......
package com.wwdz.ch.db.dao;
import com.wwdz.ch.db.domain.AiAssistant;
import com.wwdz.ch.db.dto.request.AiAssistantRequestDto;
import java.util.List;
public interface AiAssistantDao {
List<AiAssistant> findList (AiAssistantRequestDto dto);
}
package com.wwdz.ch.db.dao;
import com.wwdz.ch.db.domain.AiDefaultQuestion;
import com.wwdz.ch.db.dto.request.AiDefaultQuestionRequestDto;
import java.util.List;
public interface AiDefaultQuestionDao {
/**
* 查询默认问题列表
* @param dto
* @return
*/
List<AiDefaultQuestion> findList (AiDefaultQuestionRequestDto dto);
}
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/11
*/
@Data
public class AiAssistant implements Entity {
private Integer id;
/**
* 头像
*/
private String avatar;
/**
* 名称
*/
private String name;
/**
* 类型
*/
private Integer type;
/**
* 创建时间
*/
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(", avatar=").append(avatar);
sb.append(", name=").append(name);
sb.append(", type=").append(type);
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;
}
AiAssistant other = (AiAssistant) that;
return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
&& (this.getAvatar() == null ? other.getAvatar() == null : this.getAvatar().equals(other.getAvatar()))
&& (this.getName() == null ? other.getName() == null : this.getName().equals(other.getName()))
&& (this.getType() == null ? other.getType() == null : this.getType().equals(other.getType()))
&& (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 + ((getAvatar() == null) ? 0 : getAvatar().hashCode());
result = prime * result + ((getName() == null) ? 0 : getName().hashCode());
result = prime * result + ((getType() == null) ? 0 : getType().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 ai_assistant
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public enum Column {
id("id", "id", "INTEGER", false),
avatar("avatar", "avatar", "VARCHAR", false),
name("name", "name", "VARCHAR", true),
type("type", "type", "INTEGER", true),
createTime("create_time", "createTime", "TIMESTAMP", false);
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table ai_assistant
*
* @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 ai_assistant
*
* @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 ai_assistant
*
* @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 ai_assistant
*
* @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 ai_assistant
*
* @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 ai_assistant
*
* @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 ai_assistant
*
* @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 ai_assistant
*
* @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 ai_assistant
*
* @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 ai_assistant
*
* @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 ai_assistant
*
* @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 ai_assistant
*
* @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 ai_assistant
*
* @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 ai_assistant
*
* @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 ai_assistant
*
* @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/11
*/
@Data
public class AiDefaultQuestion implements Entity {
private Integer id;
/**
* 问题
*/
private String question;
/**
* 问题类型
*/
private Integer type;
/**
* 创建时间
*/
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(", question=").append(question);
sb.append(", type=").append(type);
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;
}
AiDefaultQuestion other = (AiDefaultQuestion) that;
return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
&& (this.getQuestion() == null ? other.getQuestion() == null : this.getQuestion().equals(other.getQuestion()))
&& (this.getType() == null ? other.getType() == null : this.getType().equals(other.getType()))
&& (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 + ((getQuestion() == null) ? 0 : getQuestion().hashCode());
result = prime * result + ((getType() == null) ? 0 : getType().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 ai_default_question
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public enum Column {
id("id", "id", "INTEGER", false),
question("question", "question", "VARCHAR", false),
type("type", "type", "INTEGER", true),
createTime("create_time", "createTime", "TIMESTAMP", false);
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table ai_default_question
*
* @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 ai_default_question
*
* @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 ai_default_question
*
* @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 ai_default_question
*
* @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 ai_default_question
*
* @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 ai_default_question
*
* @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 ai_default_question
*
* @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 ai_default_question
*
* @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 ai_default_question
*
* @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 ai_default_question
*
* @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 ai_default_question
*
* @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 ai_default_question
*
* @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 ai_default_question
*
* @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 ai_default_question
*
* @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 ai_default_question
*
* @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.dto.request;
import com.xxdxxs.entity.Entity;
import lombok.Data;
@Data
public class AiAssistantRequestDto extends BaseRequestDto implements Entity {
private Integer id;
/**
* 名称
*/
private String name;
/**
* 类型
*/
private Integer type;
}
package com.wwdz.ch.db.dto.request;
import com.xxdxxs.entity.Entity;
import lombok.Data;
@Data
public class AiDefaultQuestionRequestDto extends BaseRequestDto implements Entity {
/**
* 问题类型
*/
private Integer type;
}
package com.wwdz.ch.db.impl;
import com.github.pagehelper.PageHelper;
import com.wwdz.ch.db.dao.AiAssistantDao;
import com.wwdz.ch.db.domain.AiAssistant;
import com.wwdz.ch.db.domain.AiAssistantExample;
import com.wwdz.ch.db.dto.request.AiAssistantRequestDto;
import com.wwdz.ch.db.mapper.AiAssistantMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository
public class AiAssistantDaoImpl implements AiAssistantDao {
@Autowired
AiAssistantMapper aiAssistantMapper;
@Override
public List<AiAssistant> findList(AiAssistantRequestDto dto) {
AiAssistantExample aiAssistantExample = new AiAssistantExample();
PageHelper.startPage(dto.getPage(), dto.getLimit());
return aiAssistantMapper.selectByExample(aiAssistantExample);
}
}
package com.wwdz.ch.db.impl;
import com.wwdz.ch.db.dao.AiDefaultQuestionDao;
import com.wwdz.ch.db.domain.AiDefaultQuestion;
import com.wwdz.ch.db.dto.request.AiDefaultQuestionRequestDto;
import com.wwdz.ch.db.mapper.AiDefaultQuestionMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository
public class AiDefaultQuestionDaoImpl implements AiDefaultQuestionDao {
@Autowired
AiDefaultQuestionMapper aiDefaultQuestionMapper;
@Override
public List<AiDefaultQuestion> findList(AiDefaultQuestionRequestDto dto) {
List<AiDefaultQuestion> list = aiDefaultQuestionMapper.selectRandom(dto);
return list;
}
}
...@@ -38,7 +38,8 @@ public class WebMvcConfiguration implements WebMvcConfigurer { ...@@ -38,7 +38,8 @@ public class WebMvcConfiguration implements WebMvcConfigurer {
.addPathPatterns("/**") .addPathPatterns("/**")
// 放行路径 // 放行路径
.excludePathPatterns("/*.html", "/**/*.html", "/**/*.css", "/**/*.js" .excludePathPatterns("/*.html", "/**/*.html", "/**/*.css", "/**/*.js"
, "/wx/user/loginByWx", "/wx/user/loginByMobile", "/wx/user/loginRegCaptcha", "/wx/user/updateRegCaptcha", "/wx/user/login", "/wx/user/fillCode" , "/wx/user/loginByWx", "/wx/user/loginByMobile", "/wx/user/loginRegCaptcha", "/wx/user/updateRegCaptcha", "/wx/user/login", "/wx/user/fillCode",
"/wx/item/**"
); );
} }
} }
...@@ -27,6 +27,13 @@ public class CacheCodeConstants { ...@@ -27,6 +27,13 @@ public class CacheCodeConstants {
*/ */
public static final String USER_INFO_KEY = "cjxc:wx:user:info:{0}"; public static final String USER_INFO_KEY = "cjxc:wx:user:info:{0}";
/**
* 缓存关注者新发布藏品记录
* <p>{0}被关注者id:粉丝id</p>
*/
public static final String UNREAD_ITEM_OF_FOLLOWER_KEY = "cjxc:unread:{0}";
/** /**
* 短信验证码类型枚举 * 短信验证码类型枚举
*/ */
......
package com.wwdz.ch.wx.impl;
import com.wwdz.ch.core.type.Result;
import com.wwdz.ch.db.dao.AiAssistantDao;
import com.wwdz.ch.db.dto.request.AiAssistantRequestDto;
import com.wwdz.ch.wx.service.AiAssistantService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
public class AiAssistantServiceImpl implements AiAssistantService {
@Autowired
AiAssistantDao aiAssistantDao;
@Override
public Result findList(AiAssistantRequestDto dto) {
return null;
}
}
package com.wwdz.ch.wx.impl;
import com.wwdz.ch.db.dao.AiDefaultQuestionDao;
import com.wwdz.ch.db.domain.AiDefaultQuestion;
import com.wwdz.ch.db.dto.request.AiDefaultQuestionRequestDto;
import com.wwdz.ch.wx.service.AiDefaultQuestionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class AiDefaultQuestionServiceImpl implements AiDefaultQuestionService {
@Autowired
AiDefaultQuestionDao aiDefaultQuestionDao;
@Override
public List<AiDefaultQuestion> findList(AiDefaultQuestionRequestDto dto) {
List<AiDefaultQuestion> aiDefaultQuestionList = aiDefaultQuestionDao.findList(dto);
return null;
}
}
...@@ -461,7 +461,7 @@ public class UserServiceImpl implements UserService { ...@@ -461,7 +461,7 @@ public class UserServiceImpl implements UserService {
user.setUsername(UUID.randomUUID().toString().replace("-", "")); user.setUsername(UUID.randomUUID().toString().replace("-", ""));
BCryptPasswordEncoder bCryptPasswordEncoder = new BCryptPasswordEncoder(); BCryptPasswordEncoder bCryptPasswordEncoder = new BCryptPasswordEncoder();
user.setPassword(bCryptPasswordEncoder.encode("Aa123456")); user.setPassword(bCryptPasswordEncoder.encode("Aa123456"));
user.setWeixinOpenid(""); user.setWeixinOpenid(dto.getWxOpenId());
user.setProfile(""); user.setProfile("");
user.setBackground(""); user.setBackground("");
user.setWechatId(""); user.setWechatId("");
...@@ -488,10 +488,10 @@ public class UserServiceImpl implements UserService { ...@@ -488,10 +488,10 @@ public class UserServiceImpl implements UserService {
userDao.insert(user); userDao.insert(user);
} else { } else {
// 注册过的用户修改最后登录的时间以及绑定微信openid和支付宝user_id // 注册过的用户修改最后登录的时间以及绑定微信openid和支付宝user_id
if (StringUtils.isNotBlank(dto.getWxOpenId())) { if (org.springframework.util.StringUtils.hasLength(dto.getWxOpenId())) {
user.setWeixinOpenid(dto.getWxOpenId()); user.setWeixinOpenid(dto.getWxOpenId());
} }
if (StringUtils.isNotBlank(dto.getAlipayUserId())) { if (org.springframework.util.StringUtils.hasLength(dto.getAlipayUserId())) {
user.setAlipayUserId(dto.getAlipayUserId()); user.setAlipayUserId(dto.getAlipayUserId());
} }
user.setLastLoginTime(new Date()); user.setLastLoginTime(new Date());
......
...@@ -54,7 +54,7 @@ public class WxLoginManager { ...@@ -54,7 +54,7 @@ public class WxLoginManager {
try { try {
WxMaJscode2SessionResult result = this.wxMaService.getUserService().getSessionInfo(loginCode); WxMaJscode2SessionResult result = this.wxMaService.getUserService().getSessionInfo(loginCode);
openId = result.getOpenid(); openId = result.getOpenid();
logger.info("获取openId成功"); logger.info("获取openId成功 openId :{}", openId);
} catch (Exception e) { } catch (Exception e) {
logger.error("获取微信登录用户的openId失败", e); logger.error("获取微信登录用户的openId失败", e);
} }
......
package com.wwdz.ch.wx.service;
import com.wwdz.ch.core.type.Result;
import com.wwdz.ch.db.dto.request.AiAssistantRequestDto;
public interface AiAssistantService {
/**
* 查询ai助手列表
* @param dto
* @return
*/
Result findList(AiAssistantRequestDto dto);
}
package com.wwdz.ch.wx.service;
import com.wwdz.ch.db.domain.AiDefaultQuestion;
import com.wwdz.ch.db.dto.request.AiDefaultQuestionRequestDto;
import java.util.List;
public interface AiDefaultQuestionService {
/**
* 查询默认问题列表
* @param dto
* @return
*/
List<AiDefaultQuestion> findList (AiDefaultQuestionRequestDto dto);
}
...@@ -143,4 +143,13 @@ public interface ItemService { ...@@ -143,4 +143,13 @@ public interface ItemService {
* @return * @return
*/ */
Result shareSendMessage(ItemRequestDto dto, HttpServletRequest request); Result shareSendMessage(ItemRequestDto dto, HttpServletRequest request);
/**
* 检查是否有关注者的新藏品未查看
*
* @param dto
* @return
*/
Result checkUnreadItemOfFollower(ItemRequestDto dto);
} }
package com.wwdz.ch.wx.web;
import com.alibaba.fastjson.JSON;
import com.wwdz.ch.core.consts.ResultCode;
import com.wwdz.ch.core.type.Result;
import com.wwdz.ch.db.dto.request.AiAssistantRequestDto;
import com.wwdz.ch.wx.service.AiAssistantService;
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("/wx/aiAssistant")
public class AiAssistantController {
private static final Logger logger = LoggerFactory.getLogger(AiAssistantController.class);
@Autowired
AiAssistantService aiAssistantService;
@Autowired
AiDef
@ApiOperation(value = "查询ai助手列表")
@PostMapping("/findList")
public Result findList(@RequestBody AiAssistantRequestDto dto) {
logger.info("【请求开始】查询ai助手列表,请求参数:{}", JSON.toJSONString(dto));
if (dto.getType() == null) {
return Result.failed(ResultCode.PARAM_ERROR);
}
return aiAssistantService.findList(dto);
}
@ApiOperation(value = "查询ai默认问题")
@PostMapping("/findDefaultQuestions")
public Result findDefaultQuestions(@RequestBody AiAssistantRequestDto dto) {
logger.info("【请求开始】查询ai助手列表,请求参数:{}", JSON.toJSONString(dto));
if (dto.getType() == null) {
return Result.failed(ResultCode.PARAM_ERROR);
}
return aiAssistantService.findList(dto);
}
}
...@@ -9,6 +9,7 @@ import org.apache.commons.lang3.StringUtils; ...@@ -9,6 +9,7 @@ import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
...@@ -56,6 +57,15 @@ public class WxItemController { ...@@ -56,6 +57,15 @@ public class WxItemController {
@PostMapping("/itemsOfFollower") @PostMapping("/itemsOfFollower")
public Result itemsOfFollower(@RequestBody ItemRequestDto dto) { public Result itemsOfFollower(@RequestBody ItemRequestDto dto) {
logger.info("【请求开始】关注人发布的商品列表,请求参数:{}", JSON.toJSONString(dto)); logger.info("【请求开始】关注人发布的商品列表,请求参数:{}", JSON.toJSONString(dto));
if (Objects.isNull(dto.getUserId())) {
return Result.failed("用户id不能为空");
}
if (Objects.isNull(dto.getPage())) {
return Result.failed("当前页不能为空");
}
if (Objects.isNull(dto.getSize())) {
return Result.failed("页面大小不能为空");
}
return itemService.itemsOfFollower(dto); return itemService.itemsOfFollower(dto);
} }
...@@ -135,7 +145,7 @@ public class WxItemController { ...@@ -135,7 +145,7 @@ public class WxItemController {
return itemService.update(dto); return itemService.update(dto);
} }
@ApiOperation(value = "详情") @ApiOperation(value = "藏品详情")
@PostMapping("/info") @PostMapping("/info")
public Result info(@RequestBody ItemRequestDto dto) { public Result info(@RequestBody ItemRequestDto dto) {
logger.info("【请求开始】藏品详情查询,请求参数:{}", JSON.toJSONString(dto)); logger.info("【请求开始】藏品详情查询,请求参数:{}", JSON.toJSONString(dto));
...@@ -240,4 +250,15 @@ public class WxItemController { ...@@ -240,4 +250,15 @@ public class WxItemController {
} }
return itemService.uploadVideo(file); return itemService.uploadVideo(file);
} }
@ApiOperation(value = "检查是否有关注者的新藏品未查看")
@PostMapping("/checkUnreadItemOfFollower")
public Result checkUnreadItemOfFollower(@RequestBody ItemRequestDto dto) {
logger.info("【请求开始】检查是否有关注者的新藏品未查看,请求参数:{}", JSON.toJSONString(dto));
if (ObjectUtils.isEmpty(dto.getUserId())) {
return Result.failed("用户id不能为空");
}
return itemService.checkUnreadItemOfFollower(dto);
}
} }
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