Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vehicle-quality-review
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
王飞
vehicle-quality-review
Commits
f6dcc69c
Commit
f6dcc69c
authored
Jan 29, 2024
by
盖献康
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
用户照片存储-使用websocket实现服务端->客户端交互
parent
77a664da
Changes
14
Show whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
481 additions
and
13 deletions
+481
-13
pom.xml
quality-review/pom.xml
+5
-1
UserPhotoStorage.java
...view/src/main/java/com/ruoyi/domain/UserPhotoStorage.java
+56
-0
AutomobileEnterpriseMapper.java
...ain/java/com/ruoyi/mapper/AutomobileEnterpriseMapper.java
+1
-2
UserPhotoStorageMapper.java
...rc/main/java/com/ruoyi/mapper/UserPhotoStorageMapper.java
+42
-0
UserPhotoStorageService.java
.../main/java/com/ruoyi/service/UserPhotoStorageService.java
+41
-0
UserPhotoStorageServiceImpl.java
...a/com/ruoyi/service/impl/UserPhotoStorageServiceImpl.java
+76
-0
UserPhotoStorageController.java
...c/main/java/com/ruoyi/web/UserPhotoStorageController.java
+91
-0
UserPhotoStorageCreateRequest.java
.../com/ruoyi/web/request/UserPhotoStorageCreateRequest.java
+24
-0
UserPhotoStorageEditRequest.java
...va/com/ruoyi/web/request/UserPhotoStorageEditRequest.java
+27
-0
UserPhotoStorageListRequest.java
...va/com/ruoyi/web/request/UserPhotoStorageListRequest.java
+31
-0
UserPhotoStorageRemoveRequest.java
.../com/ruoyi/web/request/UserPhotoStorageRemoveRequest.java
+23
-0
UserPhotoStorageMapper.xml
...view/src/main/resources/mapper/UserPhotoStorageMapper.xml
+59
-0
pom.xml
ruoyi-framework/pom.xml
+1
-6
SecurityConfig.java
.../main/java/com/ruoyi/framework/config/SecurityConfig.java
+4
-4
No files found.
quality-review/pom.xml
View file @
f6dcc69c
...
...
@@ -61,6 +61,10 @@
<artifactId>
itext-asian
</artifactId>
<version>
5.2.0
</version>
</dependency>
<dependency>
<groupId>
com.ruoyi
</groupId>
<artifactId>
ruoyi-framework
</artifactId>
</dependency>
</dependencies>
...
...
quality-review/src/main/java/com/ruoyi/domain/UserPhotoStorage.java
0 → 100644
View file @
f6dcc69c
package
com
.
ruoyi
.
domain
;
import
com.baomidou.mybatisplus.annotation.*
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.AllArgsConstructor
;
import
lombok.Builder
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
java.util.Date
;
/**
* 用户照片存储对象 t_user_photo_storage
*
* @author gxk
* @date 2024-01-29
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@ApiModel
(
value
=
"用户照片存储"
)
@TableName
(
value
=
"t_user_photo_storage"
)
public
class
UserPhotoStorage
{
/** 主键 */
@TableId
(
type
=
IdType
.
ASSIGN_ID
)
@JsonFormat
(
shape
=
JsonFormat
.
Shape
.
STRING
)
@ApiModelProperty
(
"ID"
)
private
Long
id
;
/** 用户id */
@ApiModelProperty
(
"用户ID"
)
private
Long
userId
;
/** 用户账号 */
@ApiModelProperty
(
"用户账号"
)
private
String
username
;
/** 图片路径 */
@ApiModelProperty
(
"图片路径"
)
private
String
path
;
/** 创建时间 */
@ApiModelProperty
(
"创建时间"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
private
Date
createTime
;
/** 逻辑删除标记 */
@ApiModelProperty
(
"逻辑删除标记(0-存在、1-删除)"
)
@TableField
(
fill
=
FieldFill
.
INSERT
)
private
Integer
deleted
;
}
quality-review/src/main/java/com/ruoyi/mapper/AutomobileEnterpriseMapper.java
View file @
f6dcc69c
...
...
@@ -23,11 +23,10 @@ public interface AutomobileEnterpriseMapper extends BaseMapper<AutomobileEnterpr
* @return 车企信息
*/
public
AutomobileEnterprise
selectAutomobileEnterpriseById
(
Long
id
);
/**
* 查询车企信息列表
*
* @param
automobileEnterprise
车企信息
* @param
request
车企信息
* @return 车企信息集合
*/
public
List
<
AutomobileEnterprise
>
selectAutomobileEnterpriseList
(
AutomobileEnterpriseListRequest
request
);
...
...
quality-review/src/main/java/com/ruoyi/mapper/UserPhotoStorageMapper.java
0 → 100644
View file @
f6dcc69c
package
com
.
ruoyi
.
mapper
;
import
java.util.List
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.ruoyi.domain.UserPhotoStorage
;
import
com.ruoyi.web.request.UserPhotoStorageListRequest
;
import
org.springframework.stereotype.Repository
;
/**
* 用户照片存储Mapper接口
*
* @author gxk
* @date 2024-01-29
*/
@Repository
public
interface
UserPhotoStorageMapper
extends
BaseMapper
<
UserPhotoStorage
>
{
/**
* 查询用户照片存储列表
*
* @param request 用户照片存储
* @return 用户照片存储集合
*/
public
List
<
UserPhotoStorage
>
selectUserPhotoStorageList
(
UserPhotoStorageListRequest
request
);
/**
* 新增用户照片存储
*
* @param userPhotoStorage 用户照片存储
* @return 结果
*/
public
int
insertUserPhotoStorage
(
UserPhotoStorage
userPhotoStorage
);
/**
* 修改用户照片存储
*
* @param userPhotoStorage 用户照片存储
* @return 结果
*/
public
int
updateUserPhotoStorage
(
UserPhotoStorage
userPhotoStorage
);
}
quality-review/src/main/java/com/ruoyi/service/UserPhotoStorageService.java
0 → 100644
View file @
f6dcc69c
package
com
.
ruoyi
.
service
;
import
java.util.List
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.ruoyi.domain.UserPhotoStorage
;
import
com.ruoyi.web.request.UserPhotoStorageCreateRequest
;
import
com.ruoyi.web.request.UserPhotoStorageListRequest
;
/**
* 用户照片存储Service接口
*
* @author gxk
* @date 2024-01-29
*/
public
interface
UserPhotoStorageService
extends
IService
<
UserPhotoStorage
>
{
/**
* 查询用户照片存储列表
*
* @param request 用户照片存储
* @return 用户照片存储集合
*/
public
List
<
UserPhotoStorage
>
selectUserPhotoStorageList
(
UserPhotoStorageListRequest
request
);
/**
* 新增用户照片存储
*
* @param request 用户照片存储
* @return 结果
*/
public
int
insertUserPhotoStorage
(
UserPhotoStorageCreateRequest
request
);
/**
* 修改用户照片存储
*
* @param userPhotoStorage 用户照片存储
* @return 结果
*/
public
int
updateUserPhotoStorage
(
UserPhotoStorage
userPhotoStorage
);
}
quality-review/src/main/java/com/ruoyi/service/impl/UserPhotoStorageServiceImpl.java
0 → 100644
View file @
f6dcc69c
package
com
.
ruoyi
.
service
.
impl
;
import
java.util.List
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.ruoyi.common.core.domain.model.LoginUser
;
import
com.ruoyi.common.utils.DateUtils
;
import
com.ruoyi.common.utils.SecurityUtils
;
import
com.ruoyi.framework.websocket.WebSocketUsers
;
import
com.ruoyi.service.UserPhotoStorageService
;
import
com.ruoyi.web.request.UserPhotoStorageCreateRequest
;
import
com.ruoyi.web.request.UserPhotoStorageListRequest
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
com.ruoyi.mapper.UserPhotoStorageMapper
;
import
com.ruoyi.domain.UserPhotoStorage
;
import
org.springframework.transaction.annotation.Transactional
;
/**
* 用户照片存储Service业务层处理
*
* @author gxk
* @date 2024-01-29
*/
@Service
@Transactional
public
class
UserPhotoStorageServiceImpl
extends
ServiceImpl
<
UserPhotoStorageMapper
,
UserPhotoStorage
>
implements
UserPhotoStorageService
{
@Autowired
private
UserPhotoStorageMapper
userPhotoStorageMapper
;
/**
* 查询用户照片存储列表
*
* @param request 用户照片存储
* @return 用户照片存储
*/
@Override
public
List
<
UserPhotoStorage
>
selectUserPhotoStorageList
(
UserPhotoStorageListRequest
request
)
{
return
userPhotoStorageMapper
.
selectUserPhotoStorageList
(
request
);
}
/**
* 新增用户照片存储
*
* @param request 用户照片存储
* @return 结果
*/
@Override
public
int
insertUserPhotoStorage
(
UserPhotoStorageCreateRequest
request
)
{
LoginUser
loginUser
=
SecurityUtils
.
getLoginUser
();
UserPhotoStorage
userPhotoStorage
=
UserPhotoStorage
.
builder
()
.
userId
(
loginUser
.
getUserId
())
.
username
(
loginUser
.
getUsername
())
.
path
(
request
.
getPath
())
.
createTime
(
DateUtils
.
getNowDate
())
.
build
();
WebSocketUsers
.
sendMessageToUserByUserId
(
loginUser
.
getUserId
(),
request
.
getPath
());
return
userPhotoStorageMapper
.
insert
(
userPhotoStorage
);
}
/**
* 修改用户照片存储
*
* @param userPhotoStorage 用户照片存储
* @return 结果
*/
@Override
public
int
updateUserPhotoStorage
(
UserPhotoStorage
userPhotoStorage
)
{
return
userPhotoStorageMapper
.
updateUserPhotoStorage
(
userPhotoStorage
);
}
}
quality-review/src/main/java/com/ruoyi/web/UserPhotoStorageController.java
0 → 100644
View file @
f6dcc69c
package
com
.
ruoyi
.
web
;
import
java.util.Arrays
;
import
java.util.List
;
import
com.ruoyi.common.annotation.Anonymous
;
import
com.ruoyi.common.core.domain.R
;
import
com.ruoyi.service.UserPhotoStorageService
;
import
com.ruoyi.web.request.UserPhotoStorageCreateRequest
;
import
com.ruoyi.web.request.UserPhotoStorageEditRequest
;
import
com.ruoyi.web.request.UserPhotoStorageListRequest
;
import
com.ruoyi.web.request.UserPhotoStorageRemoveRequest
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.validation.annotation.Validated
;
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
;
import
com.ruoyi.common.annotation.Log
;
import
com.ruoyi.common.core.controller.BaseController
;
import
com.ruoyi.common.enums.BusinessType
;
import
com.ruoyi.domain.UserPhotoStorage
;
import
com.ruoyi.common.core.page.TableDataInfo
;
/**
* 用户照片存储Controller
*
* @author gxk
* @date 2024-01-29
*/
@Api
(
tags
=
"用户照片存储"
)
@RestController
@RequestMapping
(
"/review/storage"
)
public
class
UserPhotoStorageController
extends
BaseController
{
@Autowired
private
UserPhotoStorageService
userPhotoStorageService
;
/**
* 查询用户照片存储列表
*/
@Anonymous
@ApiOperation
(
"分页查询照片存储列表"
)
@PostMapping
(
"/list"
)
public
TableDataInfo
<
UserPhotoStorage
>
list
(
@Validated
@RequestBody
UserPhotoStorageListRequest
request
)
{
startPage
();
List
<
UserPhotoStorage
>
list
=
userPhotoStorageService
.
selectUserPhotoStorageList
(
request
);
return
getDataTable
(
list
);
}
/**
* 新增用户照片存储
*/
@Anonymous
@ApiOperation
(
"新增用户照片存储"
)
@Log
(
title
=
"用户照片存储"
,
businessType
=
BusinessType
.
INSERT
)
@PostMapping
(
"/create"
)
public
R
<
Integer
>
create
(
@Validated
@RequestBody
UserPhotoStorageCreateRequest
request
)
{
return
R
.
ok
(
userPhotoStorageService
.
insertUserPhotoStorage
(
request
));
}
/**
* 修改用户照片存储
*/
@ApiOperation
(
"修改用户照片存储"
)
@Log
(
title
=
"用户照片存储"
,
businessType
=
BusinessType
.
UPDATE
)
@PostMapping
(
"/edit"
)
public
R
<
Boolean
>
edit
(
@Validated
@RequestBody
UserPhotoStorageEditRequest
request
)
{
UserPhotoStorage
userPhotoStorage
=
UserPhotoStorage
.
builder
()
.
id
(
request
.
getId
())
.
path
(
request
.
getPath
()).
build
();
return
R
.
ok
(
userPhotoStorageService
.
updateById
(
userPhotoStorage
));
}
/**
* 删除用户照片存储
*/
@ApiOperation
(
"批量删除用户照片存储"
)
@Log
(
title
=
"用户照片存储"
,
businessType
=
BusinessType
.
DELETE
)
@PostMapping
(
"/remove"
)
public
R
<
Boolean
>
remove
(
@Validated
@RequestBody
UserPhotoStorageRemoveRequest
request
)
{
return
R
.
ok
(
userPhotoStorageService
.
removeBatchByIds
(
Arrays
.
asList
(
request
.
getIds
())));
}
}
quality-review/src/main/java/com/ruoyi/web/request/UserPhotoStorageCreateRequest.java
0 → 100644
View file @
f6dcc69c
package
com
.
ruoyi
.
web
.
request
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
javax.validation.constraints.NotEmpty
;
import
javax.validation.constraints.NotNull
;
/**
* 用户照片存储新增所需的对象
* @author gxk
*/
@Data
@ApiModel
public
class
UserPhotoStorageCreateRequest
{
/** 图片路径(以逗号分隔) */
@ApiModelProperty
(
"图片路径(以逗号分隔)"
)
@NotEmpty
(
message
=
"图片路径不能为空"
)
@NotNull
(
message
=
"图片路径不能为空"
)
private
String
path
;
}
quality-review/src/main/java/com/ruoyi/web/request/UserPhotoStorageEditRequest.java
0 → 100644
View file @
f6dcc69c
package
com
.
ruoyi
.
web
.
request
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
javax.validation.constraints.NotEmpty
;
import
javax.validation.constraints.NotNull
;
/**
* 用户照片存储修改所需的对象
* @author gxk
*/
@Data
@ApiModel
public
class
UserPhotoStorageEditRequest
{
@ApiModelProperty
(
"ID"
)
@NotNull
(
message
=
"ID不能为空"
)
private
Long
id
;
@ApiModelProperty
(
"图片路径"
)
@NotEmpty
(
message
=
"路径不能为空"
)
@NotNull
(
message
=
"路径不能为空"
)
private
String
path
;
}
quality-review/src/main/java/com/ruoyi/web/request/UserPhotoStorageListRequest.java
0 → 100644
View file @
f6dcc69c
package
com
.
ruoyi
.
web
.
request
;
import
com.baomidou.mybatisplus.annotation.FieldFill
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.ruoyi.common.core.page.PageDomain
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.util.Date
;
/**
* 用户照片存储集合所需的对象
* @author gxk
*/
@Data
@ApiModel
public
class
UserPhotoStorageListRequest
extends
PageDomain
{
/** 用户id */
@ApiModelProperty
(
"用户ID"
)
private
Long
userId
;
/** 用户账号 */
@ApiModelProperty
(
"用户账号"
)
private
String
username
;
}
quality-review/src/main/java/com/ruoyi/web/request/UserPhotoStorageRemoveRequest.java
0 → 100644
View file @
f6dcc69c
package
com
.
ruoyi
.
web
.
request
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
javax.validation.constraints.NotEmpty
;
import
javax.validation.constraints.NotNull
;
/**
* 用户照片存储删除所需的对象
* @author gxk
*/
@Data
@ApiModel
public
class
UserPhotoStorageRemoveRequest
{
@ApiModelProperty
(
"照片存储ID集合"
)
@NotEmpty
(
message
=
"照片存储ID集合不能为空"
)
@NotNull
(
message
=
"照片存储ID集合不能为空"
)
private
Long
[]
ids
;
}
quality-review/src/main/resources/mapper/UserPhotoStorageMapper.xml
0 → 100644
View file @
f6dcc69c
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.ruoyi.mapper.UserPhotoStorageMapper"
>
<resultMap
type=
"com.ruoyi.domain.UserPhotoStorage"
id=
"UserPhotoStorageResult"
>
<result
property=
"id"
column=
"id"
/>
<result
property=
"userId"
column=
"user_id"
/>
<result
property=
"username"
column=
"username"
/>
<result
property=
"path"
column=
"path"
/>
<result
property=
"createTime"
column=
"create_time"
/>
<result
property=
"deleted"
column=
"deleted"
/>
</resultMap>
<sql
id=
"selectUserPhotoStorageVo"
>
select id, user_id, username, path, create_time, deleted from t_user_photo_storage
</sql>
<select
id=
"selectUserPhotoStorageList"
parameterType=
"com.ruoyi.domain.UserPhotoStorage"
resultMap=
"UserPhotoStorageResult"
>
<include
refid=
"selectUserPhotoStorageVo"
/>
<where>
<if
test=
"userId != null "
>
and user_id = #{userId}
</if>
<if
test=
"username != null and username != ''"
>
and username like concat('%', #{username}, '%')
</if>
</where>
</select>
<insert
id=
"insertUserPhotoStorage"
parameterType=
"com.ruoyi.domain.UserPhotoStorage"
>
insert into t_user_photo_storage
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"id != null"
>
id,
</if>
<if
test=
"userId != null"
>
user_id,
</if>
<if
test=
"username != null"
>
username,
</if>
<if
test=
"path != null"
>
path,
</if>
<if
test=
"createTime != null"
>
create_time,
</if>
<if
test=
"deleted != null"
>
deleted,
</if>
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"id != null"
>
#{id},
</if>
<if
test=
"userId != null"
>
#{userId},
</if>
<if
test=
"username != null"
>
#{username},
</if>
<if
test=
"path != null"
>
#{path},
</if>
<if
test=
"createTime != null"
>
#{createTime},
</if>
<if
test=
"deleted != null"
>
#{deleted},
</if>
</trim>
</insert>
<update
id=
"updateUserPhotoStorage"
parameterType=
"com.ruoyi.domain.UserPhotoStorage"
>
update t_user_photo_storage
<trim
prefix=
"SET"
suffixOverrides=
","
>
<if
test=
"userId != null"
>
user_id = #{userId},
</if>
<if
test=
"username != null"
>
username = #{username},
</if>
<if
test=
"path != null"
>
path = #{path},
</if>
<if
test=
"createTime != null"
>
create_time = #{createTime},
</if>
<if
test=
"deleted != null"
>
deleted = #{deleted},
</if>
</trim>
where id = #{id}
</update>
</mapper>
ruoyi-framework/pom.xml
View file @
f6dcc69c
...
...
@@ -59,11 +59,6 @@
<artifactId>
ruoyi-system
</artifactId>
</dependency>
<dependency>
<groupId>
com.ruoyi
</groupId>
<artifactId>
quality-review
</artifactId>
</dependency>
<!-- skywalking log -->
<dependency>
<groupId>
org.apache.skywalking
</groupId>
...
...
ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java
View file @
f6dcc69c
...
...
@@ -114,7 +114,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter
.
antMatchers
(
"/login"
,
"/register"
,
"/captchaImage"
).
permitAll
()
// 静态资源,可匿名访问
.
antMatchers
(
HttpMethod
.
GET
,
"/"
,
"/*.html"
,
"/**/*.html"
,
"/**/*.css"
,
"/**/*.js"
,
"/profile/**"
).
permitAll
()
.
antMatchers
(
"/swagger-ui.html"
,
"/swagger-resources/**"
,
"/webjars/**"
,
"/*/api-docs"
,
"/druid/**"
).
permitAll
()
.
antMatchers
(
"/swagger-ui.html"
,
"/
websocket/**"
,
"/
swagger-resources/**"
,
"/webjars/**"
,
"/*/api-docs"
,
"/druid/**"
).
permitAll
()
// 除上面外的所有请求全部需要鉴权认证
.
anyRequest
().
authenticated
()
.
and
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment