refactor(shop): 重构聊天相关实体和映射
-移除了 UserServiceImpl 中的系统配置信息代码 - 更新了 ShopChatConversationController 中的注释 - 在 ShopChatMessage 中添加了发送人和接收人的相关信息字段 - 在 ShopDealerApply 中添加了用户昵称和备注字段 - 更新了相关映射文件以支持新的字段 - 调整了应用配置文件,增加了测试环境配置
This commit is contained in:
@@ -87,18 +87,6 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
|
||||
if (user != null) {
|
||||
user.setRoles(userRoleService.listByUserId(user.getUserId()));
|
||||
user.setAuthorities(roleMenuService.listMenuByUserId(user.getUserId(), null));
|
||||
// 系统配置信息
|
||||
// Map<String, Object> map = new HashMap<>();
|
||||
// 1)云存储
|
||||
// String key = "setting:upload:" + user.getTenantId();
|
||||
// final String upload = redisUtil.get(key);
|
||||
// if(upload != null){
|
||||
// final JSONObject object = JSONObject.parseObject(upload);
|
||||
// map.put("uploadMethod",object.getString("uploadMethod"));
|
||||
// map.put("bucketDomain",object.getString("bucketDomain"));
|
||||
// map.put("fileUrl",object.getString("fileUrl") + "/");
|
||||
// user.setSystem(map);
|
||||
// }
|
||||
}
|
||||
return user;
|
||||
}
|
||||
|
||||
@@ -6,9 +6,7 @@ import com.gxwebsoft.shop.entity.ShopChatConversation;
|
||||
import com.gxwebsoft.shop.param.ShopChatConversationParam;
|
||||
import com.gxwebsoft.common.core.web.ApiResult;
|
||||
import com.gxwebsoft.common.core.web.PageResult;
|
||||
import com.gxwebsoft.common.core.web.PageParam;
|
||||
import com.gxwebsoft.common.core.web.BatchParam;
|
||||
import com.gxwebsoft.common.core.annotation.OperationLog;
|
||||
import com.gxwebsoft.common.system.entity.User;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
@@ -19,26 +17,26 @@ import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 聊天消息表控制器
|
||||
* 聊天会话表控制器
|
||||
*
|
||||
* @author 科技小王子
|
||||
* @since 2025-01-11 10:45:12
|
||||
*/
|
||||
@Tag(name = "聊天消息表管理")
|
||||
@Tag(name = "聊天会话表管理")
|
||||
@RestController
|
||||
@RequestMapping("/api/shop/shop-chat-conversation")
|
||||
public class ShopChatConversationController extends BaseController {
|
||||
@Resource
|
||||
private ShopChatConversationService shopChatConversationService;
|
||||
|
||||
@Operation(summary = "分页查询聊天消息表")
|
||||
@Operation(summary = "分页查询聊天会话表")
|
||||
@GetMapping("/page")
|
||||
public ApiResult<PageResult<ShopChatConversation>> page(ShopChatConversationParam param) {
|
||||
// 使用关联查询
|
||||
return success(shopChatConversationService.pageRel(param));
|
||||
}
|
||||
|
||||
@Operation(summary = "查询全部聊天消息表")
|
||||
@Operation(summary = "查询全部聊天会话表")
|
||||
@GetMapping()
|
||||
public ApiResult<List<ShopChatConversation>> list(ShopChatConversationParam param) {
|
||||
// 使用关联查询
|
||||
@@ -46,14 +44,14 @@ public class ShopChatConversationController extends BaseController {
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('shop:shopChatConversation:list')")
|
||||
@Operation(summary = "根据id查询聊天消息表")
|
||||
@Operation(summary = "根据id查询聊天会话表")
|
||||
@GetMapping("/{id}")
|
||||
public ApiResult<ShopChatConversation> get(@PathVariable("id") Integer id) {
|
||||
// 使用关联查询
|
||||
return success(shopChatConversationService.getByIdRel(id));
|
||||
}
|
||||
|
||||
@Operation(summary = "添加聊天消息表")
|
||||
@Operation(summary = "添加聊天会话表")
|
||||
@PostMapping()
|
||||
public ApiResult<?> save(@RequestBody ShopChatConversation shopChatConversation) {
|
||||
// 记录当前登录用户id
|
||||
@@ -67,7 +65,7 @@ public class ShopChatConversationController extends BaseController {
|
||||
return fail("添加失败");
|
||||
}
|
||||
|
||||
@Operation(summary = "修改聊天消息表")
|
||||
@Operation(summary = "修改聊天会话表")
|
||||
@PutMapping()
|
||||
public ApiResult<?> update(@RequestBody ShopChatConversation shopChatConversation) {
|
||||
if (shopChatConversationService.updateById(shopChatConversation)) {
|
||||
@@ -76,7 +74,7 @@ public class ShopChatConversationController extends BaseController {
|
||||
return fail("修改失败");
|
||||
}
|
||||
|
||||
@Operation(summary = "删除聊天消息表")
|
||||
@Operation(summary = "删除聊天会话表")
|
||||
@DeleteMapping("/{id}")
|
||||
public ApiResult<?> remove(@PathVariable("id") Integer id) {
|
||||
if (shopChatConversationService.removeById(id)) {
|
||||
@@ -85,7 +83,7 @@ public class ShopChatConversationController extends BaseController {
|
||||
return fail("删除失败");
|
||||
}
|
||||
|
||||
@Operation(summary = "批量添加聊天消息表")
|
||||
@Operation(summary = "批量添加聊天会话表")
|
||||
@PostMapping("/batch")
|
||||
public ApiResult<?> saveBatch(@RequestBody List<ShopChatConversation> list) {
|
||||
if (shopChatConversationService.saveBatch(list)) {
|
||||
@@ -94,7 +92,7 @@ public class ShopChatConversationController extends BaseController {
|
||||
return fail("添加失败");
|
||||
}
|
||||
|
||||
@Operation(summary = "批量修改聊天消息表")
|
||||
@Operation(summary = "批量修改聊天会话表")
|
||||
@PutMapping("/batch")
|
||||
public ApiResult<?> removeBatch(@RequestBody BatchParam<ShopChatConversation> batchParam) {
|
||||
if (batchParam.update(shopChatConversationService, "id")) {
|
||||
@@ -103,7 +101,7 @@ public class ShopChatConversationController extends BaseController {
|
||||
return fail("修改失败");
|
||||
}
|
||||
|
||||
@Operation(summary = "批量删除聊天消息表")
|
||||
@Operation(summary = "批量删除聊天会话表")
|
||||
@DeleteMapping("/batch")
|
||||
public ApiResult<?> removeBatch(@RequestBody List<Integer> ids) {
|
||||
if (shopChatConversationService.removeByIds(ids)) {
|
||||
|
||||
@@ -31,6 +31,7 @@ public class ShopChatMessageController extends BaseController {
|
||||
@Resource
|
||||
private ShopChatMessageService shopChatMessageService;
|
||||
|
||||
@PreAuthorize("hasAuthority('shop:shopChatMessage:list')")
|
||||
@Operation(summary = "分页查询聊天消息表")
|
||||
@GetMapping("/page")
|
||||
public ApiResult<PageResult<ShopChatMessage>> page(ShopChatMessageParam param) {
|
||||
@@ -38,6 +39,7 @@ public class ShopChatMessageController extends BaseController {
|
||||
return success(shopChatMessageService.pageRel(param));
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('shop:shopChatMessage:list')")
|
||||
@Operation(summary = "查询全部聊天消息表")
|
||||
@GetMapping()
|
||||
public ApiResult<List<ShopChatMessage>> list(ShopChatMessageParam param) {
|
||||
@@ -53,20 +55,22 @@ public class ShopChatMessageController extends BaseController {
|
||||
return success(shopChatMessageService.getByIdRel(id));
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('shop:shopChatMessage:save')")
|
||||
@Operation(summary = "添加聊天消息表")
|
||||
@PostMapping()
|
||||
public ApiResult<?> save(@RequestBody ShopChatMessage shopChatMessage) {
|
||||
// 记录当前登录用户id
|
||||
// User loginUser = getLoginUser();
|
||||
// if (loginUser != null) {
|
||||
// shopChatMessage.setUserId(loginUser.getUserId());
|
||||
// }
|
||||
// 获取当前登录用户id
|
||||
User loginUser = getLoginUser();
|
||||
if (loginUser != null) {
|
||||
shopChatMessage.setFormUserId(loginUser.getUserId());
|
||||
}
|
||||
if (shopChatMessageService.save(shopChatMessage)) {
|
||||
return success("添加成功");
|
||||
}
|
||||
return fail("添加失败");
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('shop:shopChatMessage:update')")
|
||||
@Operation(summary = "修改聊天消息表")
|
||||
@PutMapping()
|
||||
public ApiResult<?> update(@RequestBody ShopChatMessage shopChatMessage) {
|
||||
@@ -76,6 +80,7 @@ public class ShopChatMessageController extends BaseController {
|
||||
return fail("修改失败");
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('shop:shopChatMessage:remove')")
|
||||
@Operation(summary = "删除聊天消息表")
|
||||
@DeleteMapping("/{id}")
|
||||
public ApiResult<?> remove(@PathVariable("id") Integer id) {
|
||||
@@ -85,6 +90,7 @@ public class ShopChatMessageController extends BaseController {
|
||||
return fail("删除失败");
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('shop:shopChatMessage:save')")
|
||||
@Operation(summary = "批量添加聊天消息表")
|
||||
@PostMapping("/batch")
|
||||
public ApiResult<?> saveBatch(@RequestBody List<ShopChatMessage> list) {
|
||||
@@ -94,6 +100,7 @@ public class ShopChatMessageController extends BaseController {
|
||||
return fail("添加失败");
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('shop:shopChatMessage:update')")
|
||||
@Operation(summary = "批量修改聊天消息表")
|
||||
@PutMapping("/batch")
|
||||
public ApiResult<?> removeBatch(@RequestBody BatchParam<ShopChatMessage> batchParam) {
|
||||
@@ -103,6 +110,7 @@ public class ShopChatMessageController extends BaseController {
|
||||
return fail("修改失败");
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('shop:shopChatMessage:remove')")
|
||||
@Operation(summary = "批量删除聊天消息表")
|
||||
@DeleteMapping("/batch")
|
||||
public ApiResult<?> removeBatch(@RequestBody List<Integer> ids) {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.gxwebsoft.shop.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import java.time.LocalDateTime;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
@@ -30,9 +31,41 @@ public class ShopChatMessage implements Serializable {
|
||||
@Schema(description = "发送人ID")
|
||||
private Integer formUserId;
|
||||
|
||||
@Schema(description = "发送人名称")
|
||||
@TableField(exist = false)
|
||||
private String formUserName;
|
||||
|
||||
@Schema(description = "发送人头像")
|
||||
@TableField(exist = false)
|
||||
private String formUserAvatar;
|
||||
|
||||
@Schema(description = "发送人手机号码")
|
||||
@TableField(exist = false)
|
||||
private String formUserPhone;
|
||||
|
||||
@Schema(description = "发送人别名")
|
||||
@TableField(exist = false)
|
||||
private String formUserAlias;
|
||||
|
||||
@Schema(description = "接收人ID")
|
||||
private Integer toUserId;
|
||||
|
||||
@Schema(description = "接收人名称")
|
||||
@TableField(exist = false)
|
||||
private String toUserName;
|
||||
|
||||
@Schema(description = "接收人头像")
|
||||
@TableField(exist = false)
|
||||
private String toUserAvatar;
|
||||
|
||||
@Schema(description = "接收人手机号码")
|
||||
@TableField(exist = false)
|
||||
private String toUserPhone;
|
||||
|
||||
@Schema(description = "接收人别名")
|
||||
@TableField(exist = false)
|
||||
private String toUserAlias;
|
||||
|
||||
@Schema(description = "消息类型")
|
||||
private String type;
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.gxwebsoft.shop.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
@@ -33,6 +34,10 @@ public class ShopDealerApply implements Serializable {
|
||||
@Schema(description = "用户ID")
|
||||
private Integer userId;
|
||||
|
||||
@Schema(description = "昵称")
|
||||
@TableField(exist = false)
|
||||
private String nickName;
|
||||
|
||||
@Schema(description = "姓名")
|
||||
private String realName;
|
||||
|
||||
@@ -79,6 +84,9 @@ public class ShopDealerApply implements Serializable {
|
||||
@Schema(description = "驳回原因")
|
||||
private String rejectReason;
|
||||
|
||||
@Schema(description = "备注")
|
||||
private String comments;
|
||||
|
||||
@Schema(description = "商城ID")
|
||||
private Integer tenantId;
|
||||
|
||||
@@ -90,4 +98,8 @@ public class ShopDealerApply implements Serializable {
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
@Schema(description = "推荐人名称")
|
||||
@TableField(exist = false)
|
||||
private String refereeName;
|
||||
|
||||
}
|
||||
|
||||
@@ -52,6 +52,10 @@ public class ShopDealerReferee implements Serializable {
|
||||
@TableField(exist = false)
|
||||
private String avatar;
|
||||
|
||||
@Schema(description = "别名")
|
||||
@TableField(exist = false)
|
||||
private String alias;
|
||||
|
||||
@Schema(description = "手机号")
|
||||
@TableField(exist = false)
|
||||
private String phone;
|
||||
|
||||
@@ -4,8 +4,11 @@
|
||||
|
||||
<!-- 关联查询sql -->
|
||||
<sql id="selectSql">
|
||||
SELECT a.*
|
||||
SELECT a.*, b.nickname as formUserName, b.avatar as formUserAvatar, b.phone as formUserPhone, b.alias as formUserAlias,
|
||||
c.nickname as toUserName, c.avatar as toUserAvatar, c.phone as toUserPhone, c.alias as toUserAlias
|
||||
FROM shop_chat_message a
|
||||
LEFT JOIN gxwebsoft_core.sys_user b ON a.form_user_id = b.user_id
|
||||
LEFT JOIN gxwebsoft_core.sys_user c ON a.to_user_id = c.user_id
|
||||
<where>
|
||||
<if test="param.id != null">
|
||||
AND a.id = #{param.id}
|
||||
|
||||
@@ -4,8 +4,10 @@
|
||||
|
||||
<!-- 关联查询sql -->
|
||||
<sql id="selectSql">
|
||||
SELECT a.*
|
||||
SELECT a.*, b.nickname as nickName, c.nickname as refereeName
|
||||
FROM shop_dealer_apply a
|
||||
LEFT JOIN gxwebsoft_core.sys_user b ON a.user_id = b.user_id
|
||||
LEFT JOIN gxwebsoft_core.sys_user c ON a.referee_id = c.user_id
|
||||
<where>
|
||||
<if test="param.applyId != null">
|
||||
AND a.apply_id = #{param.applyId}
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
d.phone AS dealerPhone,
|
||||
u.nickname,
|
||||
u.avatar,
|
||||
u.alias,
|
||||
u.phone
|
||||
FROM shop_dealer_referee a
|
||||
INNER JOIN gxwebsoft_core.sys_user d ON a.dealer_id = d.user_id AND d.deleted = 0
|
||||
|
||||
@@ -7,12 +7,9 @@ server:
|
||||
# 数据源配置
|
||||
spring:
|
||||
datasource:
|
||||
# url: jdbc:mysql://8.134.169.209:13306/cms_demo?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=Asia/Shanghai
|
||||
# username: cms_demo
|
||||
# password: EtzJFr4A3c4THZjY
|
||||
url: jdbc:mysql://8.134.169.209:13306/modules?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=Asia/Shanghai
|
||||
username: modules
|
||||
password: 8YdLnk7KsPAyDXGA
|
||||
url: jdbc:mysql://8.134.169.209:13306/cms_demo?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=Asia/Shanghai
|
||||
username: cms_demo
|
||||
password: EtzJFr4A3c4THZjY
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
type: com.alibaba.druid.pool.DruidDataSource
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ spring:
|
||||
datasource:
|
||||
url: jdbc:mysql://1Panel-mysql-Bqdt:3306/modules?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=Asia/Shanghai
|
||||
username: modules
|
||||
password: 8YdLnk7KsPAyDXGA
|
||||
password: P7KsAyDXG8YdLnkA
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
type: com.alibaba.druid.pool.DruidDataSource
|
||||
druid:
|
||||
|
||||
65
src/main/resources/application-test.yml
Normal file
65
src/main/resources/application-test.yml
Normal file
@@ -0,0 +1,65 @@
|
||||
# 开发环境配置
|
||||
|
||||
# 服务器配置
|
||||
server:
|
||||
port: 9200
|
||||
|
||||
# 数据源配置
|
||||
spring:
|
||||
datasource:
|
||||
url: jdbc:mysql://8.134.169.209:13306/modules?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=Asia/Shanghai
|
||||
username: modules
|
||||
password: P7KsAyDXG8YdLnkA
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
type: com.alibaba.druid.pool.DruidDataSource
|
||||
|
||||
# redis
|
||||
redis:
|
||||
database: 0
|
||||
host: 8.134.169.209
|
||||
port: 16379
|
||||
password: redis_WSDb88
|
||||
|
||||
# 日志配置
|
||||
logging:
|
||||
level:
|
||||
com.gxwebsoft: DEBUG
|
||||
com.baomidou.mybatisplus: DEBUG
|
||||
com.gxwebsoft.shop.mapper: DEBUG
|
||||
org.apache.ibatis: DEBUG
|
||||
|
||||
socketio:
|
||||
host: localhost #IP地址
|
||||
|
||||
# MQTT配置
|
||||
mqtt:
|
||||
enabled: false # 添加开关来禁用MQTT服务
|
||||
host: tcp://1.14.159.185:1883
|
||||
username: swdev
|
||||
password: Sw20250523
|
||||
client-id-prefix: hjm_car_
|
||||
topic: /SW_GPS/#
|
||||
qos: 2
|
||||
connection-timeout: 10
|
||||
keep-alive-interval: 20
|
||||
auto-reconnect: true
|
||||
|
||||
# 框架配置
|
||||
config:
|
||||
# 开发环境接口
|
||||
server-url: https://server.websoft.top/api
|
||||
upload-path: /Users/gxwebsoft/JAVA/mp-java/src/main/resources # window(D:\Temp)
|
||||
|
||||
# JWT配置
|
||||
jwt:
|
||||
secret: websoft-jwt-secret-key-2025-dev-environment
|
||||
expire: 86400 # token过期时间(秒) 24小时
|
||||
|
||||
# 开发环境证书配置
|
||||
certificate:
|
||||
load-mode: CLASSPATH # 开发环境从classpath加载
|
||||
wechat-pay:
|
||||
dev:
|
||||
private-key-file: "apiclient_key.pem"
|
||||
apiclient-cert-file: "apiclient_cert.pem"
|
||||
wechatpay-cert-file: "wechatpay_cert.pem"
|
||||
@@ -4,7 +4,7 @@ server:
|
||||
# 多环境配置
|
||||
spring:
|
||||
profiles:
|
||||
active: dev
|
||||
active: test
|
||||
|
||||
application:
|
||||
name: server
|
||||
|
||||
Reference in New Issue
Block a user