Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
I
ioc_sixiang_license
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
zengtianlai3
ioc_sixiang_license
Commits
dcda0114
Commit
dcda0114
authored
Feb 03, 2023
by
ma
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
完善删除用户逻辑
parent
47d59500
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
40 additions
and
9 deletions
+40
-9
UserController.java
...n/java/iot/sixiang/license/controller/UserController.java
+12
-9
ApplyMapper.java
...src/main/java/iot/sixiang/license/mapper/ApplyMapper.java
+2
-0
DeviceMapper.java
...rc/main/java/iot/sixiang/license/mapper/DeviceMapper.java
+2
-0
ApplyService.java
...c/main/java/iot/sixiang/license/service/ApplyService.java
+2
-0
DeviceService.java
.../main/java/iot/sixiang/license/service/DeviceService.java
+2
-0
ApplyServiceImpl.java
...va/iot/sixiang/license/service/impl/ApplyServiceImpl.java
+5
-0
DeviceServiceImpl.java
...a/iot/sixiang/license/service/impl/DeviceServiceImpl.java
+5
-0
ApplyMapper.xml
license/src/main/resources/mapper/ApplyMapper.xml
+6
-0
DeviceMapper.xml
license/src/main/resources/mapper/DeviceMapper.xml
+4
-0
No files found.
license/src/main/java/iot/sixiang/license/controller/UserController.java
View file @
dcda0114
...
@@ -13,14 +13,12 @@ import io.swagger.annotations.ApiImplicitParam;
...
@@ -13,14 +13,12 @@ import io.swagger.annotations.ApiImplicitParam;
import
io.swagger.annotations.ApiImplicitParams
;
import
io.swagger.annotations.ApiImplicitParams
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
import
iot.sixiang.license.entity.Permission
;
import
iot.sixiang.license.entity.Permission
;
import
iot.sixiang.license.entity.Report
;
import
iot.sixiang.license.entity.User
;
import
iot.sixiang.license.entity.User
;
import
iot.sixiang.license.entity.UserPermission
;
import
iot.sixiang.license.entity.UserPermission
;
import
iot.sixiang.license.handler.IotLicenseException
;
import
iot.sixiang.license.handler.IotLicenseException
;
import
iot.sixiang.license.jwt.UserUtils
;
import
iot.sixiang.license.jwt.UserUtils
;
import
iot.sixiang.license.log.BusinessType
;
import
iot.sixiang.license.log.BusinessType
;
import
iot.sixiang.license.log.MyLog
;
import
iot.sixiang.license.log.MyLog
;
import
iot.sixiang.license.mapper.UserMapper
;
import
iot.sixiang.license.model.BaseResult
;
import
iot.sixiang.license.model.BaseResult
;
import
iot.sixiang.license.model.PageInfoModel
;
import
iot.sixiang.license.model.PageInfoModel
;
import
iot.sixiang.license.model.PageResult
;
import
iot.sixiang.license.model.PageResult
;
...
@@ -28,16 +26,12 @@ import iot.sixiang.license.model.ResResult;
...
@@ -28,16 +26,12 @@ import iot.sixiang.license.model.ResResult;
import
iot.sixiang.license.model.dto.AssignUserPermissionDTO
;
import
iot.sixiang.license.model.dto.AssignUserPermissionDTO
;
import
iot.sixiang.license.model.dto.UpdateNotifyDTO
;
import
iot.sixiang.license.model.dto.UpdateNotifyDTO
;
import
iot.sixiang.license.model.vo.*
;
import
iot.sixiang.license.model.vo.*
;
import
iot.sixiang.license.service.PermissionService
;
import
iot.sixiang.license.service.*
;
import
iot.sixiang.license.service.ReportService
;
import
iot.sixiang.license.service.UserPermissionService
;
import
iot.sixiang.license.service.UserService
;
import
iot.sixiang.license.util.CommonUtil
;
import
iot.sixiang.license.util.CommonUtil
;
import
iot.sixiang.license.util.EmailUtils
;
import
iot.sixiang.license.util.EmailUtils
;
import
iot.sixiang.license.util.TreeUtil
;
import
iot.sixiang.license.util.TreeUtil
;
import
iot.sixiang.license.xss.XssUtil
;
import
iot.sixiang.license.xss.XssUtil
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.util.DigestUtils
;
import
org.springframework.util.DigestUtils
;
import
org.springframework.web.bind.WebDataBinder
;
import
org.springframework.web.bind.WebDataBinder
;
...
@@ -45,7 +39,6 @@ import org.springframework.web.bind.annotation.*;
...
@@ -45,7 +39,6 @@ import org.springframework.web.bind.annotation.*;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.List
;
/**
/**
...
@@ -63,12 +56,16 @@ public class UserController {
...
@@ -63,12 +56,16 @@ public class UserController {
@Resource
@Resource
EmailUtils
emailUtils
;
EmailUtils
emailUtils
;
@
Autowired
@
Resource
private
UserService
userService
;
private
UserService
userService
;
@Resource
@Resource
private
PermissionService
permissionService
;
private
PermissionService
permissionService
;
@Resource
@Resource
private
UserPermissionService
userPermissionService
;
private
UserPermissionService
userPermissionService
;
@Resource
private
ApplyService
applyService
;
@Resource
private
DeviceService
deviceService
;
@Value
(
"${rsa.private_key}"
)
@Value
(
"${rsa.private_key}"
)
private
String
PRIVATE_KRY
;
private
String
PRIVATE_KRY
;
...
@@ -147,6 +144,12 @@ public class UserController {
...
@@ -147,6 +144,12 @@ public class UserController {
if
(!
CommonUtil
.
checkPermission
(
userPermissions
,
2
))
{
if
(!
CommonUtil
.
checkPermission
(
userPermissions
,
2
))
{
throw
new
IotLicenseException
(
403
,
"您无删除用户权限!"
);
throw
new
IotLicenseException
(
403
,
"您无删除用户权限!"
);
}
}
List
<
UserChildIdVO
>
childUser
=
userService
.
getChildUser
(
Integer
.
parseInt
(
userId
));
if
(!
childUser
.
isEmpty
())
{
throw
new
IotLicenseException
(
403
,
"该账户存在子账号,请先删除所有子账号!"
);
}
deviceService
.
deleteByUserId
(
Integer
.
parseInt
(
userId
));
applyService
.
deleteByUserId
(
Integer
.
parseInt
(
userId
));
boolean
res
=
userService
.
deleteUser
(
Integer
.
parseInt
(
userId
));
boolean
res
=
userService
.
deleteUser
(
Integer
.
parseInt
(
userId
));
userPermissionService
.
deleteUserPermission
(
Integer
.
parseInt
(
userId
));
userPermissionService
.
deleteUserPermission
(
Integer
.
parseInt
(
userId
));
UserUtils
.
removeToken
(
userId
);
UserUtils
.
removeToken
(
userId
);
...
...
license/src/main/java/iot/sixiang/license/mapper/ApplyMapper.java
View file @
dcda0114
...
@@ -21,4 +21,6 @@ public interface ApplyMapper extends BaseMapper<Apply> {
...
@@ -21,4 +21,6 @@ public interface ApplyMapper extends BaseMapper<Apply> {
List
<
AppVo
>
getAppList
(
String
appName
,
List
<
Integer
>
userChildIds
);
List
<
AppVo
>
getAppList
(
String
appName
,
List
<
Integer
>
userChildIds
);
Apply
getApplyByAppName
(
String
appName
);
Apply
getApplyByAppName
(
String
appName
);
void
deleteByUserId
(
Integer
userId
);
}
}
license/src/main/java/iot/sixiang/license/mapper/DeviceMapper.java
View file @
dcda0114
...
@@ -18,4 +18,6 @@ public interface DeviceMapper extends BaseMapper<Device> {
...
@@ -18,4 +18,6 @@ public interface DeviceMapper extends BaseMapper<Device> {
boolean
addDevice
(
String
sn
,
String
appId
);
boolean
addDevice
(
String
sn
,
String
appId
);
int
updateDeviceById
(
Device
device
);
int
updateDeviceById
(
Device
device
);
void
deleteByUserId
(
int
userId
);
}
}
license/src/main/java/iot/sixiang/license/service/ApplyService.java
View file @
dcda0114
...
@@ -20,4 +20,6 @@ public interface ApplyService extends IService<Apply> {
...
@@ -20,4 +20,6 @@ public interface ApplyService extends IService<Apply> {
boolean
addApply
(
String
appName
,
String
appKey
,
int
userId
);
boolean
addApply
(
String
appName
,
String
appKey
,
int
userId
);
PageInfoModel
<
AppVo
>
getAppList
(
int
pageNo
,
int
pageSize
,
String
appName
,
List
<
Integer
>
userChildIds
);
PageInfoModel
<
AppVo
>
getAppList
(
int
pageNo
,
int
pageSize
,
String
appName
,
List
<
Integer
>
userChildIds
);
void
deleteByUserId
(
Integer
userId
);
}
}
license/src/main/java/iot/sixiang/license/service/DeviceService.java
View file @
dcda0114
...
@@ -30,4 +30,6 @@ public interface DeviceService extends IService<Device> {
...
@@ -30,4 +30,6 @@ public interface DeviceService extends IService<Device> {
ResResult
getBindStatus
(
TerminalDevieUnBindDTO
terminalDevieUnBindDTO
);
ResResult
getBindStatus
(
TerminalDevieUnBindDTO
terminalDevieUnBindDTO
);
BaseResult
platFormBind
(
PlatFormBindDTO
platFormBindDTO
);
BaseResult
platFormBind
(
PlatFormBindDTO
platFormBindDTO
);
void
deleteByUserId
(
int
userId
);
}
}
license/src/main/java/iot/sixiang/license/service/impl/ApplyServiceImpl.java
View file @
dcda0114
...
@@ -71,4 +71,9 @@ public class ApplyServiceImpl extends ServiceImpl<ApplyMapper, Apply> implements
...
@@ -71,4 +71,9 @@ public class ApplyServiceImpl extends ServiceImpl<ApplyMapper, Apply> implements
objectPageInfoModel
.
setResult
(
result
);
objectPageInfoModel
.
setResult
(
result
);
return
objectPageInfoModel
;
return
objectPageInfoModel
;
}
}
@Override
public
void
deleteByUserId
(
Integer
userId
)
{
applyMapper
.
deleteByUserId
(
userId
);
}
}
}
license/src/main/java/iot/sixiang/license/service/impl/DeviceServiceImpl.java
View file @
dcda0114
...
@@ -180,4 +180,9 @@ public class DeviceServiceImpl extends ServiceImpl<DeviceMapper, Device> impleme
...
@@ -180,4 +180,9 @@ public class DeviceServiceImpl extends ServiceImpl<DeviceMapper, Device> impleme
return
BaseResult
.
failed
();
return
BaseResult
.
failed
();
}
}
}
}
@Override
public
void
deleteByUserId
(
int
userId
)
{
deviceMapper
.
deleteByUserId
(
userId
);
}
}
}
license/src/main/resources/mapper/ApplyMapper.xml
View file @
dcda0114
...
@@ -6,9 +6,15 @@
...
@@ -6,9 +6,15 @@
app.app_id, app.app_name, app.app_key, app.create_time, app.update_time, us.user_id,
app.app_id, app.app_name, app.app_key, app.create_time, app.update_time, us.user_id,
COUNT(sn) AS deviceCount, us.user_name, us.company
COUNT(sn) AS deviceCount, us.user_name, us.company
</sql>
</sql>
<insert
id=
"addApply"
parameterType=
"iot.sixiang.license.entity.Apply"
>
<insert
id=
"addApply"
parameterType=
"iot.sixiang.license.entity.Apply"
>
insert into apply(app_id,app_name, app_key, user_id, create_time, update_time) values (#{appId}, #{appName}, #{appKey}, #{userId}, now(), now())
insert into apply(app_id,app_name, app_key, user_id, create_time, update_time) values (#{appId}, #{appName}, #{appKey}, #{userId}, now(), now())
</insert>
</insert>
<delete
id=
"deleteByUserId"
>
delete from `apply` where user_id = #{userId}
</delete>
<select
id=
"getAppList"
resultType=
"iot.sixiang.license.model.vo.AppVo"
>
<select
id=
"getAppList"
resultType=
"iot.sixiang.license.model.vo.AppVo"
>
SELECT
<include
refid=
"AppVoColumn"
/>
SELECT
<include
refid=
"AppVoColumn"
/>
FROM apply AS app LEFT JOIN device AS de ON app.app_id = de.app_id
FROM apply AS app LEFT JOIN device AS de ON app.app_id = de.app_id
...
...
license/src/main/resources/mapper/DeviceMapper.xml
View file @
dcda0114
<?xml version="1.0" encoding="UTF-8"?>
<?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">
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"iot.sixiang.license.mapper.DeviceMapper"
>
<mapper
namespace=
"iot.sixiang.license.mapper.DeviceMapper"
>
<delete
id=
"deleteByUserId"
>
delete device from device,apply,`user` WHERE device.app_id = apply.app_id
and user.user_id = apply.user_id and user.user_id = #{userId}
</delete>
<select
id=
"getDeviceList"
resultType=
"iot.sixiang.license.model.vo.DeviceVo"
>
<select
id=
"getDeviceList"
resultType=
"iot.sixiang.license.model.vo.DeviceVo"
>
SELECT de.device_id, de.app_id, app_name,user_name,sn,sn_bind,de.status,de.create_time,de.update_time,de.device_id IN (select
SELECT de.device_id, de.app_id, app_name,user_name,sn,sn_bind,de.status,de.create_time,de.update_time,de.device_id IN (select
...
...
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