Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
G
glinfo-api
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
林业通
glinfo-api
Commits
fc764791
提交
fc764791
authored
3月 01, 2022
作者:
林业通
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
人脸锁图片删除
上级
5d261d0a
隐藏空白字符变更
内嵌
并排
正在显示
8 个修改的文件
包含
108 行增加
和
15 行删除
+108
-15
ShLockUserController.java
...nfo/enbao/modules/sh/controller/ShLockUserController.java
+21
-15
OtherShLockUserDao.java
.../tech/glinfo/enbao/modules/sh/dao/OtherShLockUserDao.java
+21
-0
OtherShLockUserService.java
...info/enbao/modules/sh/service/OtherShLockUserService.java
+13
-0
OtherShLockUserServiceImpl.java
...o/modules/sh/service/impl/OtherShLockUserServiceImpl.java
+19
-0
AliyunCloudStorageService.java
...fo/enbao/modules/oss/cloud/AliyunCloudStorageService.java
+5
-0
CloudStorageService.java
...h/glinfo/enbao/modules/oss/cloud/CloudStorageService.java
+4
-0
QcloudCloudStorageService.java
...fo/enbao/modules/oss/cloud/QcloudCloudStorageService.java
+5
-0
QiniuCloudStorageService.java
...nfo/enbao/modules/oss/cloud/QiniuCloudStorageService.java
+20
-0
没有找到文件。
appapi/src/main/java/tech/glinfo/enbao/modules/sh/controller/ShLockUserController.java
浏览文件 @
fc764791
...
@@ -9,15 +9,13 @@ import org.springframework.beans.factory.annotation.Autowired;
...
@@ -9,15 +9,13 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
import
tech.glinfo.enbao.common.annotation.ApiLog
;
import
tech.glinfo.enbao.common.annotation.ApiLog
;
import
tech.glinfo.enbao.common.annotation.Login
;
import
tech.glinfo.enbao.common.annotation.Login
;
import
tech.glinfo.enbao.common.annotation.LoginUser
;
import
tech.glinfo.enbao.common.utils.ImageUtils
;
import
tech.glinfo.enbao.common.utils.ImageUtils
;
import
tech.glinfo.enbao.common.utils.R
;
import
tech.glinfo.enbao.common.utils.R
;
import
tech.glinfo.enbao.common.utils.StringUtils
;
import
tech.glinfo.enbao.common.utils.StringUtils
;
import
tech.glinfo.enbao.modules.appuser.entity.AppUserEntity
;
import
tech.glinfo.enbao.modules.oss.cloud.OSSFactory
;
import
tech.glinfo.enbao.modules.appuser.service.AppUserService
;
import
tech.glinfo.enbao.modules.service.BaiduApiService
;
import
tech.glinfo.enbao.modules.service.BaiduApiService
;
import
tech.glinfo.enbao.modules.sh.entity.ShLockUserEntity
;
import
tech.glinfo.enbao.modules.sh.entity.ShLockUserEntity
;
import
tech.glinfo.enbao.modules.sh.service.ShLockUserService
;
import
tech.glinfo.enbao.modules.sh.service.
Other
ShLockUserService
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
...
@@ -28,7 +26,7 @@ import java.util.Map;
...
@@ -28,7 +26,7 @@ import java.util.Map;
public
class
ShLockUserController
{
public
class
ShLockUserController
{
@Autowired
@Autowired
private
ShLockUserService
s
hLockUserService
;
private
OtherShLockUserService
otherS
hLockUserService
;
@Autowired
@Autowired
private
BaiduApiService
baiduApiService
;
private
BaiduApiService
baiduApiService
;
...
@@ -43,7 +41,7 @@ public class ShLockUserController {
...
@@ -43,7 +41,7 @@ public class ShLockUserController {
Integer
id
=
(
Integer
)
params
.
get
(
"id"
);
Integer
id
=
(
Integer
)
params
.
get
(
"id"
);
Integer
deviceId
=
(
Integer
)
params
.
get
(
"deviceId"
);
Integer
deviceId
=
(
Integer
)
params
.
get
(
"deviceId"
);
String
img
=
(
String
)
params
.
get
(
"img"
);
String
img
=
(
String
)
params
.
get
(
"img"
);
ShLockUserEntity
lockUser
=
s
hLockUserService
.
getById
(
id
);
ShLockUserEntity
lockUser
=
otherS
hLockUserService
.
getById
(
id
);
if
(
lockUser
==
null
)
{
if
(
lockUser
==
null
)
{
return
R
.
error
(
"用户不存在"
);
return
R
.
error
(
"用户不存在"
);
}
}
...
@@ -56,7 +54,9 @@ public class ShLockUserController {
...
@@ -56,7 +54,9 @@ public class ShLockUserController {
//保存人脸参数
//保存人脸参数
lockUser
.
setFaceImg
(
img
);
lockUser
.
setFaceImg
(
img
);
lockUser
.
setFaceParam
(
faceParam
.
toString
());
lockUser
.
setFaceParam
(
faceParam
.
toString
());
shLockUserService
.
updateById
(
lockUser
);
otherShLockUserService
.
updateById
(
lockUser
);
}
else
{
return
R
.
error
(
"添加失败"
);
}
}
return
R
.
ok
();
return
R
.
ok
();
}
}
...
@@ -67,13 +67,19 @@ public class ShLockUserController {
...
@@ -67,13 +67,19 @@ public class ShLockUserController {
@ApiLog
(
"删除人脸"
)
@ApiLog
(
"删除人脸"
)
public
R
deleteFaceLock
(
@RequestBody
Map
<
String
,
Object
>
params
)
{
public
R
deleteFaceLock
(
@RequestBody
Map
<
String
,
Object
>
params
)
{
Integer
id
=
(
Integer
)
params
.
get
(
"id"
);
Integer
id
=
(
Integer
)
params
.
get
(
"id"
);
ShLockUserEntity
lockUser
=
s
hLockUserService
.
getById
(
id
);
ShLockUserEntity
lockUser
=
otherS
hLockUserService
.
getById
(
id
);
if
(
lockUser
==
null
)
{
if
(
lockUser
==
null
)
{
return
R
.
error
(
"用户不存在"
);
return
R
.
error
(
"用户不存在"
);
}
}
if
(
lockUser
.
getFaceParam
()
!=
null
)
{
if
(
lockUser
.
getFaceParam
()
!=
null
)
{
String
[]
faceParam
=
lockUser
.
getFaceParam
().
split
(
","
);
String
[]
faceParam
=
lockUser
.
getFaceParam
().
split
(
","
);
baiduApiService
.
delUser
(
faceParam
[
0
],
faceParam
[
1
],
faceParam
[
2
]);
JSONObject
jsonObject
=
baiduApiService
.
delUser
(
faceParam
[
0
],
faceParam
[
1
],
faceParam
[
2
]);
if
(
jsonObject
!=
null
&&
jsonObject
.
has
(
"error_code"
)
&&
jsonObject
.
getInt
(
"error_code"
)
==
0
)
{
otherShLockUserService
.
deleteFaceLock
(
id
);
OSSFactory
.
build
().
delete
(
lockUser
.
getFaceImg
());
}
else
{
return
R
.
error
(
"添加失败"
);
}
}
}
return
R
.
ok
();
return
R
.
ok
();
}
}
...
@@ -89,7 +95,7 @@ public class ShLockUserController {
...
@@ -89,7 +95,7 @@ public class ShLockUserController {
if
(
StringUtils
.
isBlank
(
lockId
,
userId
,
userName
))
{
if
(
StringUtils
.
isBlank
(
lockId
,
userId
,
userName
))
{
return
R
.
error
(
"参数为空!"
);
return
R
.
error
(
"参数为空!"
);
}
}
ShLockUserEntity
lockUserEntity
=
s
hLockUserService
.
getOne
(
new
QueryWrapper
<
ShLockUserEntity
>().
eq
(
"lock_id"
,
lockId
).
eq
(
"user_id"
,
userId
));
ShLockUserEntity
lockUserEntity
=
otherS
hLockUserService
.
getOne
(
new
QueryWrapper
<
ShLockUserEntity
>().
eq
(
"lock_id"
,
lockId
).
eq
(
"user_id"
,
userId
));
if
(
lockUserEntity
!=
null
)
{
if
(
lockUserEntity
!=
null
)
{
return
R
.
error
(
"用户ID不能重复!"
);
return
R
.
error
(
"用户ID不能重复!"
);
}
}
...
@@ -97,7 +103,7 @@ public class ShLockUserController {
...
@@ -97,7 +103,7 @@ public class ShLockUserController {
entity
.
setLockId
(
lockId
);
entity
.
setLockId
(
lockId
);
entity
.
setUserId
(
userId
);
entity
.
setUserId
(
userId
);
entity
.
setUserName
(
userName
);
entity
.
setUserName
(
userName
);
boolean
flag
=
s
hLockUserService
.
save
(
entity
);
boolean
flag
=
otherS
hLockUserService
.
save
(
entity
);
return
flag
?
R
.
ok
()
:
R
.
error
(
"新增失败!"
);
return
flag
?
R
.
ok
()
:
R
.
error
(
"新增失败!"
);
}
}
...
@@ -113,7 +119,7 @@ public class ShLockUserController {
...
@@ -113,7 +119,7 @@ public class ShLockUserController {
if
(
StringUtils
.
isBlank
(
id
,
userId
,
userName
))
{
if
(
StringUtils
.
isBlank
(
id
,
userId
,
userName
))
{
return
R
.
error
(
"参数为空!"
);
return
R
.
error
(
"参数为空!"
);
}
}
ShLockUserEntity
lockUserEntity
=
s
hLockUserService
.
getOne
(
new
QueryWrapper
<
ShLockUserEntity
>().
eq
(
"lock_id"
,
lockId
).
eq
(
"user_id"
,
userId
));
ShLockUserEntity
lockUserEntity
=
otherS
hLockUserService
.
getOne
(
new
QueryWrapper
<
ShLockUserEntity
>().
eq
(
"lock_id"
,
lockId
).
eq
(
"user_id"
,
userId
));
if
(!
lockUserEntity
.
getId
().
equals
(
id
))
{
if
(!
lockUserEntity
.
getId
().
equals
(
id
))
{
return
R
.
error
(
"用户ID不能重复!"
);
return
R
.
error
(
"用户ID不能重复!"
);
}
}
...
@@ -121,7 +127,7 @@ public class ShLockUserController {
...
@@ -121,7 +127,7 @@ public class ShLockUserController {
entity
.
setId
(
id
);
entity
.
setId
(
id
);
entity
.
setUserId
(
userId
);
entity
.
setUserId
(
userId
);
entity
.
setUserName
(
userName
);
entity
.
setUserName
(
userName
);
boolean
flag
=
s
hLockUserService
.
updateById
(
entity
);
boolean
flag
=
otherS
hLockUserService
.
updateById
(
entity
);
return
flag
?
R
.
ok
()
:
R
.
error
(
"修改失败!"
);
return
flag
?
R
.
ok
()
:
R
.
error
(
"修改失败!"
);
}
}
...
@@ -134,7 +140,7 @@ public class ShLockUserController {
...
@@ -134,7 +140,7 @@ public class ShLockUserController {
if
(
StringUtils
.
isBlank
(
id
))
{
if
(
StringUtils
.
isBlank
(
id
))
{
return
R
.
error
(
"参数为空!"
);
return
R
.
error
(
"参数为空!"
);
}
}
boolean
flag
=
s
hLockUserService
.
removeById
(
id
);
boolean
flag
=
otherS
hLockUserService
.
removeById
(
id
);
return
flag
?
R
.
ok
()
:
R
.
error
(
"删除失败!"
);
return
flag
?
R
.
ok
()
:
R
.
error
(
"删除失败!"
);
}
}
...
@@ -144,7 +150,7 @@ public class ShLockUserController {
...
@@ -144,7 +150,7 @@ public class ShLockUserController {
@ApiLog
(
"锁用户列表"
)
@ApiLog
(
"锁用户列表"
)
public
R
list
(
@RequestParam
Map
<
String
,
Object
>
params
)
{
public
R
list
(
@RequestParam
Map
<
String
,
Object
>
params
)
{
Integer
lockId
=
Integer
.
parseInt
((
String
)
params
.
get
(
"lockId"
));
Integer
lockId
=
Integer
.
parseInt
((
String
)
params
.
get
(
"lockId"
));
List
<
ShLockUserEntity
>
list
=
s
hLockUserService
.
list
(
new
QueryWrapper
<
ShLockUserEntity
>().
eq
(
"lock_id"
,
lockId
));
List
<
ShLockUserEntity
>
list
=
otherS
hLockUserService
.
list
(
new
QueryWrapper
<
ShLockUserEntity
>().
eq
(
"lock_id"
,
lockId
));
return
R
.
ok
().
put
(
"list"
,
list
);
return
R
.
ok
().
put
(
"list"
,
list
);
}
}
...
...
appapi/src/main/java/tech/glinfo/enbao/modules/sh/dao/OtherShLockUserDao.java
0 → 100644
浏览文件 @
fc764791
package
tech
.
glinfo
.
enbao
.
modules
.
sh
.
dao
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Update
;
import
tech.glinfo.enbao.modules.sh.entity.ShLockUserEntity
;
/**
* @author lyt
* @date 2022/3/1 10:57
*/
@Mapper
public
interface
OtherShLockUserDao
extends
BaseMapper
<
ShLockUserEntity
>
{
@Update
(
"<script>"
+
" UPDATE sh_lock_user SET face_param = NULL, face_img = NULL WHERE id = ${id}"
+
" </script>"
)
void
deleteFaceLock
(
Integer
id
);
}
appapi/src/main/java/tech/glinfo/enbao/modules/sh/service/OtherShLockUserService.java
0 → 100644
浏览文件 @
fc764791
package
tech
.
glinfo
.
enbao
.
modules
.
sh
.
service
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
tech.glinfo.enbao.modules.sh.entity.ShLockUserEntity
;
/**
* @author lyt
* @date 2022/3/1 10:56
*/
public
interface
OtherShLockUserService
extends
IService
<
ShLockUserEntity
>
{
void
deleteFaceLock
(
Integer
id
);
}
appapi/src/main/java/tech/glinfo/enbao/modules/sh/service/impl/OtherShLockUserServiceImpl.java
0 → 100644
浏览文件 @
fc764791
package
tech
.
glinfo
.
enbao
.
modules
.
sh
.
service
.
impl
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
org.springframework.stereotype.Service
;
import
tech.glinfo.enbao.modules.sh.dao.OtherShLockUserDao
;
import
tech.glinfo.enbao.modules.sh.entity.ShLockUserEntity
;
import
tech.glinfo.enbao.modules.sh.service.OtherShLockUserService
;
/**
* @author lyt
* @date 2022/3/1 10:56
*/
@Service
(
"otherShLockUserService"
)
public
class
OtherShLockUserServiceImpl
extends
ServiceImpl
<
OtherShLockUserDao
,
ShLockUserEntity
>
implements
OtherShLockUserService
{
@Override
public
void
deleteFaceLock
(
Integer
id
)
{
this
.
baseMapper
.
deleteFaceLock
(
id
);
}
}
common/src/main/java/tech/glinfo/enbao/modules/oss/cloud/AliyunCloudStorageService.java
浏览文件 @
fc764791
...
@@ -50,4 +50,9 @@ public class AliyunCloudStorageService extends CloudStorageService {
...
@@ -50,4 +50,9 @@ public class AliyunCloudStorageService extends CloudStorageService {
public
String
uploadSuffix
(
InputStream
inputStream
,
String
suffix
)
{
public
String
uploadSuffix
(
InputStream
inputStream
,
String
suffix
)
{
return
upload
(
inputStream
,
getPath
(
config
.
getAliyunPrefix
(),
suffix
));
return
upload
(
inputStream
,
getPath
(
config
.
getAliyunPrefix
(),
suffix
));
}
}
@Override
public
Boolean
delete
(
String
fileName
)
{
return
null
;
}
}
}
common/src/main/java/tech/glinfo/enbao/modules/oss/cloud/CloudStorageService.java
浏览文件 @
fc764791
...
@@ -67,4 +67,8 @@ public abstract class CloudStorageService {
...
@@ -67,4 +67,8 @@ public abstract class CloudStorageService {
*/
*/
public
abstract
String
uploadSuffix
(
InputStream
inputStream
,
String
suffix
);
public
abstract
String
uploadSuffix
(
InputStream
inputStream
,
String
suffix
);
/**
*/
public
abstract
Boolean
delete
(
String
fileName
);
}
}
common/src/main/java/tech/glinfo/enbao/modules/oss/cloud/QcloudCloudStorageService.java
浏览文件 @
fc764791
...
@@ -85,4 +85,9 @@ public class QcloudCloudStorageService extends CloudStorageService {
...
@@ -85,4 +85,9 @@ public class QcloudCloudStorageService extends CloudStorageService {
public
String
uploadSuffix
(
InputStream
inputStream
,
String
suffix
)
{
public
String
uploadSuffix
(
InputStream
inputStream
,
String
suffix
)
{
return
upload
(
inputStream
,
getPath
(
config
.
getQcloudPrefix
(),
suffix
));
return
upload
(
inputStream
,
getPath
(
config
.
getQcloudPrefix
(),
suffix
));
}
}
@Override
public
Boolean
delete
(
String
fileName
)
{
return
null
;
}
}
}
common/src/main/java/tech/glinfo/enbao/modules/oss/cloud/QiniuCloudStorageService.java
浏览文件 @
fc764791
package
tech
.
glinfo
.
enbao
.
modules
.
oss
.
cloud
;
package
tech
.
glinfo
.
enbao
.
modules
.
oss
.
cloud
;
import
com.qiniu.storage.BucketManager
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
tech.glinfo.enbao.common.exception.RRException
;
import
tech.glinfo.enbao.common.exception.RRException
;
import
com.qiniu.common.Zone
;
import
com.qiniu.common.Zone
;
import
com.qiniu.http.Response
;
import
com.qiniu.http.Response
;
...
@@ -19,6 +22,7 @@ import java.io.InputStream;
...
@@ -19,6 +22,7 @@ import java.io.InputStream;
* @author Mark sunlightcs@gmail.com
* @author Mark sunlightcs@gmail.com
*/
*/
public
class
QiniuCloudStorageService
extends
CloudStorageService
{
public
class
QiniuCloudStorageService
extends
CloudStorageService
{
private
final
static
Logger
logger
=
LoggerFactory
.
getLogger
(
QiniuCloudStorageService
.
class
);
private
UploadManager
uploadManager
;
private
UploadManager
uploadManager
;
private
String
token
;
private
String
token
;
private
String
key
;
private
String
key
;
...
@@ -76,6 +80,22 @@ public class QiniuCloudStorageService extends CloudStorageService {
...
@@ -76,6 +80,22 @@ public class QiniuCloudStorageService extends CloudStorageService {
return
upload
(
inputStream
,
getPath
(
config
.
getQiniuPrefix
(),
suffix
));
return
upload
(
inputStream
,
getPath
(
config
.
getQiniuPrefix
(),
suffix
));
}
}
@Override
public
Boolean
delete
(
String
fileName
)
{
BucketManager
bucketManager
=
new
BucketManager
(
Auth
.
create
(
config
.
getQiniuAccessKey
(),
config
.
getQiniuSecretKey
()),
new
Configuration
(
Zone
.
autoZone
()));
try
{
Response
res
=
bucketManager
.
delete
(
config
.
getQiniuBucketName
(),
fileName
);
if
(!
res
.
isOK
())
{
logger
.
error
(
"删除图片七牛出错:"
+
res
.
toString
());
return
false
;
}
}
catch
(
Exception
e
)
{
logger
.
error
(
"删除图片七牛出错"
,
e
);
return
false
;
}
return
true
;
}
public
String
getToken
()
{
public
String
getToken
()
{
return
token
;
return
token
;
}
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论