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
1758b45e
Commit
1758b45e
authored
Feb 02, 2023
by
ma
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
完善列表查询
parent
0f376084
Changes
16
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
70 additions
and
31 deletions
+70
-31
ApplyController.java
.../java/iot/sixiang/license/controller/ApplyController.java
+6
-1
DeviceController.java
...java/iot/sixiang/license/controller/DeviceController.java
+6
-1
PmsUseLogController.java
...a/iot/sixiang/license/controller/PmsUseLogController.java
+12
-1
UserController.java
...n/java/iot/sixiang/license/controller/UserController.java
+0
-4
ApplyMapper.java
...src/main/java/iot/sixiang/license/mapper/ApplyMapper.java
+2
-2
DeviceMapper.java
...rc/main/java/iot/sixiang/license/mapper/DeviceMapper.java
+1
-1
PmsUseLogMapper.java
...main/java/iot/sixiang/license/mapper/PmsUseLogMapper.java
+1
-1
ApplyService.java
...c/main/java/iot/sixiang/license/service/ApplyService.java
+3
-1
DeviceService.java
.../main/java/iot/sixiang/license/service/DeviceService.java
+3
-1
PmsUseService.java
.../main/java/iot/sixiang/license/service/PmsUseService.java
+3
-1
ApplyServiceImpl.java
...va/iot/sixiang/license/service/impl/ApplyServiceImpl.java
+9
-8
DeviceServiceImpl.java
...a/iot/sixiang/license/service/impl/DeviceServiceImpl.java
+2
-2
PmsUseServiceImpl.java
...a/iot/sixiang/license/service/impl/PmsUseServiceImpl.java
+2
-2
ApplyMapper.xml
license/src/main/resources/mapper/ApplyMapper.xml
+5
-2
DeviceMapper.xml
license/src/main/resources/mapper/DeviceMapper.xml
+5
-2
PmsUseLogMapper.xml
license/src/main/resources/mapper/PmsUseLogMapper.xml
+10
-1
No files found.
license/src/main/java/iot/sixiang/license/controller/ApplyController.java
View file @
1758b45e
...
...
@@ -18,6 +18,7 @@ import iot.sixiang.license.model.PageInfoModel;
import
iot.sixiang.license.model.PageResult
;
import
iot.sixiang.license.model.vo.AppVo
;
import
iot.sixiang.license.service.ApplyService
;
import
iot.sixiang.license.util.TreeUtil
;
import
iot.sixiang.license.xss.XssUtil
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -25,6 +26,7 @@ import org.springframework.util.DigestUtils;
import
org.springframework.web.bind.WebDataBinder
;
import
org.springframework.web.bind.annotation.*
;
import
java.util.ArrayList
;
import
java.util.List
;
/**
...
...
@@ -97,7 +99,10 @@ public class ApplyController {
if
(
StringUtils
.
isEmpty
(
userId
))
{
throw
new
IotLicenseException
(
403
,
"请重新登录"
);
}
PageInfoModel
<
AppVo
>
records
=
applyService
.
getAppList
(
pageNo
,
pageSize
,
Integer
.
parseInt
(
userId
),
appName
);
List
<
Integer
>
userIds
=
new
ArrayList
<>();
List
<
Integer
>
userChildIds
=
TreeUtil
.
getUserChildIds
(
Integer
.
parseInt
(
userId
),
userIds
);
userChildIds
.
add
(
Integer
.
parseInt
(
userId
));
PageInfoModel
<
AppVo
>
records
=
applyService
.
getAppList
(
pageNo
,
pageSize
,
appName
,
userChildIds
);
int
total
=
records
.
getTotal
();
int
pages
=
total
/
pageSize
;
//pages为总页数
int
mod
=
total
%
pageSize
;
...
...
license/src/main/java/iot/sixiang/license/controller/DeviceController.java
View file @
1758b45e
...
...
@@ -22,6 +22,7 @@ import iot.sixiang.license.model.vo.DeviceDetailVo;
import
iot.sixiang.license.model.vo.DeviceVo
;
import
iot.sixiang.license.service.DeviceBlackService
;
import
iot.sixiang.license.service.DeviceService
;
import
iot.sixiang.license.util.TreeUtil
;
import
iot.sixiang.license.xss.XssUtil
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -34,6 +35,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.ArrayList
;
import
java.util.List
;
/**
...
...
@@ -115,7 +117,10 @@ public class DeviceController {
if
(
StringUtils
.
isEmpty
(
userId
))
{
throw
new
IotLicenseException
(
403
,
"请重新登录"
);
}
PageInfoModel
<
DeviceVo
>
records
=
deviceService
.
getDeviceList
(
pageNo
,
pageSize
,
Integer
.
parseInt
(
userId
),
appName
,
userName
,
sn
,
status
);
List
<
Integer
>
userIds
=
new
ArrayList
<>();
List
<
Integer
>
userChildIds
=
TreeUtil
.
getUserChildIds
(
Integer
.
parseInt
(
userId
),
userIds
);
userChildIds
.
add
(
Integer
.
parseInt
(
userId
));
PageInfoModel
<
DeviceVo
>
records
=
deviceService
.
getDeviceList
(
pageNo
,
pageSize
,
appName
,
userName
,
sn
,
status
,
userChildIds
);
int
total
=
records
.
getTotal
();
int
pages
=
total
/
pageSize
;
//pages为总页数
int
mod
=
total
%
pageSize
;
...
...
license/src/main/java/iot/sixiang/license/controller/PmsUseLogController.java
View file @
1758b45e
...
...
@@ -5,12 +5,15 @@ import io.swagger.annotations.ApiImplicitParam;
import
io.swagger.annotations.ApiImplicitParams
;
import
io.swagger.annotations.ApiOperation
;
import
iot.sixiang.license.entity.PmsUseLog
;
import
iot.sixiang.license.handler.IotLicenseException
;
import
iot.sixiang.license.jwt.UserUtils
;
import
iot.sixiang.license.log.BusinessType
;
import
iot.sixiang.license.log.MyLog
;
import
iot.sixiang.license.model.PageInfoModel
;
import
iot.sixiang.license.model.PageResult
;
import
iot.sixiang.license.service.PmsUseService
;
import
iot.sixiang.license.util.CommonUtil
;
import
iot.sixiang.license.util.TreeUtil
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -20,6 +23,7 @@ import org.springframework.web.bind.annotation.RequestParam;
import
org.springframework.web.bind.annotation.RestController
;
import
java.text.ParseException
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
...
...
@@ -56,12 +60,19 @@ public class PmsUseLogController {
@RequestParam
(
value
=
"endTime"
,
required
=
false
)
String
endTime
,
@RequestParam
(
value
=
"sn"
,
required
=
false
)
String
sn
,
@RequestParam
(
value
=
"status"
,
required
=
false
)
Integer
status
)
throws
ParseException
{
String
userId
=
UserUtils
.
getLoginUserId
();
if
(
StringUtils
.
isEmpty
(
userId
))
{
throw
new
IotLicenseException
(
403
,
"请重新登录"
);
}
List
<
Integer
>
userIds
=
new
ArrayList
<>();
List
<
Integer
>
userChildIds
=
TreeUtil
.
getUserChildIds
(
Integer
.
parseInt
(
userId
),
userIds
);
userChildIds
.
add
(
Integer
.
parseInt
(
userId
));
if
(
StringUtils
.
isEmpty
(
endTime
))
{
endTime
=
CommonUtil
.
getDayByNum
(
1
,
CommonUtil
.
dateToString
(
new
Date
(),
"yyyy-MM-dd"
));
}
else
{
endTime
=
CommonUtil
.
getDayByNum
(
1
,
endTime
);
}
PageInfoModel
<
PmsUseLog
>
records
=
pmsUseService
.
getPmsUseLogList
(
pageNo
,
pageSize
,
sn
,
status
,
startTime
,
endTime
);
PageInfoModel
<
PmsUseLog
>
records
=
pmsUseService
.
getPmsUseLogList
(
pageNo
,
pageSize
,
sn
,
status
,
startTime
,
endTime
,
userChildIds
);
int
total
=
records
.
getTotal
();
int
pages
=
total
/
pageSize
;
//pages为总页数
int
mod
=
total
%
pageSize
;
...
...
license/src/main/java/iot/sixiang/license/controller/UserController.java
View file @
1758b45e
...
...
@@ -69,10 +69,6 @@ public class UserController {
private
PermissionService
permissionService
;
@Resource
private
UserPermissionService
userPermissionService
;
@Resource
ReportService
reportService
;
@Resource
UserMapper
userMapper
;
@Value
(
"${rsa.private_key}"
)
private
String
PRIVATE_KRY
;
...
...
license/src/main/java/iot/sixiang/license/mapper/ApplyMapper.java
View file @
1758b45e
...
...
@@ -8,7 +8,7 @@ import java.util.List;
/**
* <p>
*
Mapper 接口
* Mapper 接口
* </p>
*
* @author m33
...
...
@@ -18,7 +18,7 @@ public interface ApplyMapper extends BaseMapper<Apply> {
boolean
addApply
(
String
appId
,
String
appName
,
String
appKey
,
int
userId
);
List
<
AppVo
>
getAppList
(
Integer
userId
,
String
appName
);
List
<
AppVo
>
getAppList
(
String
appName
,
List
<
Integer
>
userChildIds
);
Apply
getApplyByAppName
(
String
appName
);
}
license/src/main/java/iot/sixiang/license/mapper/DeviceMapper.java
View file @
1758b45e
...
...
@@ -13,7 +13,7 @@ import java.util.List;
* @since 2022-06-08
*/
public
interface
DeviceMapper
extends
BaseMapper
<
Device
>
{
List
<
DeviceVo
>
getDeviceList
(
String
appName
,
String
userName
,
Integer
userId
,
String
sn
,
Integer
status
);
List
<
DeviceVo
>
getDeviceList
(
String
appName
,
String
userName
,
List
<
Integer
>
userChildIds
,
String
sn
,
Integer
status
);
boolean
addDevice
(
String
sn
,
String
appId
);
...
...
license/src/main/java/iot/sixiang/license/mapper/PmsUseLogMapper.java
View file @
1758b45e
...
...
@@ -12,5 +12,5 @@ import java.util.List;
* Description
*/
public
interface
PmsUseLogMapper
extends
BaseMapper
<
PmsUseLog
>
{
List
<
PmsUseLog
>
getPmsUseLogList
(
String
sn
,
Integer
status
,
String
startTime
,
String
endTime
);
List
<
PmsUseLog
>
getPmsUseLogList
(
String
sn
,
Integer
status
,
String
startTime
,
String
endTime
,
List
<
Integer
>
userChildIds
);
}
license/src/main/java/iot/sixiang/license/service/ApplyService.java
View file @
1758b45e
...
...
@@ -5,6 +5,8 @@ import com.baomidou.mybatisplus.extension.service.IService;
import
iot.sixiang.license.model.PageInfoModel
;
import
iot.sixiang.license.model.vo.AppVo
;
import
java.util.List
;
/**
* <p>
* 服务类
...
...
@@ -17,5 +19,5 @@ public interface ApplyService extends IService<Apply> {
boolean
addApply
(
String
appName
,
String
appKey
,
int
userId
);
PageInfoModel
<
AppVo
>
getAppList
(
int
pageNo
,
int
pageSize
,
Integer
userId
,
String
appName
);
PageInfoModel
<
AppVo
>
getAppList
(
int
pageNo
,
int
pageSize
,
String
appName
,
List
<
Integer
>
userChildIds
);
}
license/src/main/java/iot/sixiang/license/service/DeviceService.java
View file @
1758b45e
...
...
@@ -10,6 +10,8 @@ import iot.sixiang.license.model.dto.TerminalDevieBindDTO;
import
iot.sixiang.license.model.dto.TerminalDevieUnBindDTO
;
import
iot.sixiang.license.model.vo.DeviceVo
;
import
java.util.List
;
/**
* 服务类
*
...
...
@@ -17,7 +19,7 @@ import iot.sixiang.license.model.vo.DeviceVo;
* @since 2022-06-08
*/
public
interface
DeviceService
extends
IService
<
Device
>
{
PageInfoModel
<
DeviceVo
>
getDeviceList
(
int
pageNo
,
int
pageSize
,
Integer
userId
,
String
appName
,
String
userName
,
String
sn
,
Integer
statu
s
);
PageInfoModel
<
DeviceVo
>
getDeviceList
(
int
pageNo
,
int
pageSize
,
String
appName
,
String
userName
,
String
sn
,
Integer
status
,
List
<
Integer
>
userChildId
s
);
boolean
addDevice
(
String
appId
,
int
count
);
...
...
license/src/main/java/iot/sixiang/license/service/PmsUseService.java
View file @
1758b45e
...
...
@@ -4,6 +4,8 @@ import iot.sixiang.license.entity.PmsUseLog;
import
iot.sixiang.license.model.PageInfoModel
;
import
iot.sixiang.license.model.dto.ReportErrorMsgDTO
;
import
java.util.List
;
/**
* Created by M=54G
* Date 11/23/22 3:09 PM
...
...
@@ -16,7 +18,7 @@ public interface PmsUseService {
void
success
(
ReportErrorMsgDTO
reportErrorMsgDTO
);
PageInfoModel
<
PmsUseLog
>
getPmsUseLogList
(
int
pageNo
,
int
pageSize
,
String
sn
,
Integer
status
,
String
startTime
,
String
endTime
);
PageInfoModel
<
PmsUseLog
>
getPmsUseLogList
(
int
pageNo
,
int
pageSize
,
String
sn
,
Integer
status
,
String
startTime
,
String
endTime
,
List
<
Integer
>
userChildIds
);
boolean
reportErrorMsg
(
ReportErrorMsgDTO
reportErrorMsgDTO
);
...
...
license/src/main/java/iot/sixiang/license/service/impl/ApplyServiceImpl.java
View file @
1758b45e
...
...
@@ -22,7 +22,7 @@ import java.util.stream.Collectors;
/**
* <p>
*
服务实现类
* 服务实现类
* </p>
*
* @author m33
...
...
@@ -33,11 +33,12 @@ public class ApplyServiceImpl extends ServiceImpl<ApplyMapper, Apply> implements
@Resource
ApplyMapper
applyMapper
;
@Override
public
boolean
addApply
(
String
appName
,
String
appKey
,
int
userId
)
{
if
(
StringUtils
.
isEmpty
(
appName
)
||
StringUtils
.
isEmpty
(
appKey
)
||
userId
==
0
)
{
throw
new
IotLicenseException
(
ResultCode
.
VALIDATE_FAILED
.
getCode
(),
ResultCode
.
VALIDATE_FAILED
.
getMsg
());
if
(
StringUtils
.
isEmpty
(
appName
)
||
StringUtils
.
isEmpty
(
appKey
)
||
userId
==
0
)
{
throw
new
IotLicenseException
(
ResultCode
.
VALIDATE_FAILED
.
getCode
(),
ResultCode
.
VALIDATE_FAILED
.
getMsg
());
}
Apply
res
=
applyMapper
.
getApplyByAppName
(
appName
);
if
(
res
!=
null
)
{
...
...
@@ -54,11 +55,11 @@ public class ApplyServiceImpl extends ServiceImpl<ApplyMapper, Apply> implements
}
@Override
public
PageInfoModel
<
AppVo
>
getAppList
(
int
pageNo
,
int
pageSize
,
Integer
userId
,
String
appName
)
{
if
(
pageNo
==
0
||
pageSize
==
0
)
{
throw
new
IotLicenseException
(
ResultCode
.
VALIDATE_FAILED
.
getCode
(),
ResultCode
.
VALIDATE_FAILED
.
getMsg
());
public
PageInfoModel
<
AppVo
>
getAppList
(
int
pageNo
,
int
pageSize
,
String
appName
,
List
<
Integer
>
userChildIds
)
{
if
(
pageNo
==
0
||
pageSize
==
0
)
{
throw
new
IotLicenseException
(
ResultCode
.
VALIDATE_FAILED
.
getCode
(),
ResultCode
.
VALIDATE_FAILED
.
getMsg
());
}
List
<
AppVo
>
records
=
applyMapper
.
getAppList
(
userId
,
appName
);
List
<
AppVo
>
records
=
applyMapper
.
getAppList
(
appName
,
userChildIds
);
records
=
records
.
stream
().
sorted
(
Comparator
.
comparing
(
AppVo:
:
getCreateTime
,
Comparator
.
reverseOrder
())).
collect
(
Collectors
.
toList
());
List
<
AppVo
>
result
=
new
ArrayList
<>();
int
begin
=
(
pageNo
-
1
)
*
pageSize
;
...
...
license/src/main/java/iot/sixiang/license/service/impl/DeviceServiceImpl.java
View file @
1758b45e
...
...
@@ -40,11 +40,11 @@ public class DeviceServiceImpl extends ServiceImpl<DeviceMapper, Device> impleme
private
DeviceMapper
deviceMapper
;
@Override
public
PageInfoModel
<
DeviceVo
>
getDeviceList
(
int
pageNo
,
int
pageSize
,
Integer
userId
,
String
appName
,
String
userName
,
String
sn
,
Integer
statu
s
)
{
public
PageInfoModel
<
DeviceVo
>
getDeviceList
(
int
pageNo
,
int
pageSize
,
String
appName
,
String
userName
,
String
sn
,
Integer
status
,
List
<
Integer
>
userChildId
s
)
{
if
(
pageNo
==
0
||
pageSize
==
0
)
{
throw
new
IotLicenseException
(
ResultCode
.
VALIDATE_FAILED
.
getCode
(),
ResultCode
.
VALIDATE_FAILED
.
getMsg
());
}
List
<
DeviceVo
>
deviceTypes
=
deviceMapper
.
getDeviceList
(
appName
,
userName
,
user
Id
,
sn
,
status
);
List
<
DeviceVo
>
deviceTypes
=
deviceMapper
.
getDeviceList
(
appName
,
userName
,
user
ChildIds
,
sn
,
status
);
deviceTypes
=
deviceTypes
.
stream
().
sorted
(
Comparator
.
comparing
(
DeviceVo:
:
getCreateTime
,
Comparator
.
reverseOrder
())).
collect
(
Collectors
.
toList
());
List
<
DeviceVo
>
result
=
new
ArrayList
<>();
int
begin
=
(
pageNo
-
1
)
*
pageSize
;
...
...
license/src/main/java/iot/sixiang/license/service/impl/PmsUseServiceImpl.java
View file @
1758b45e
...
...
@@ -65,11 +65,11 @@ public class PmsUseServiceImpl implements PmsUseService {
}
@Override
public
PageInfoModel
<
PmsUseLog
>
getPmsUseLogList
(
int
pageNo
,
int
pageSize
,
String
sn
,
Integer
status
,
String
startTime
,
String
endTime
)
{
public
PageInfoModel
<
PmsUseLog
>
getPmsUseLogList
(
int
pageNo
,
int
pageSize
,
String
sn
,
Integer
status
,
String
startTime
,
String
endTime
,
List
<
Integer
>
userChildIds
)
{
if
(
pageNo
==
0
||
pageSize
==
0
)
{
throw
new
IotLicenseException
(
ResultCode
.
VALIDATE_FAILED
.
getCode
(),
ResultCode
.
VALIDATE_FAILED
.
getMsg
());
}
List
<
PmsUseLog
>
pmsUseLogs
=
pmsUseLogMapper
.
getPmsUseLogList
(
sn
,
status
,
startTime
,
endTime
);
List
<
PmsUseLog
>
pmsUseLogs
=
pmsUseLogMapper
.
getPmsUseLogList
(
sn
,
status
,
startTime
,
endTime
,
userChildIds
);
List
<
PmsUseLog
>
result
=
new
ArrayList
<>();
int
begin
=
(
pageNo
-
1
)
*
pageSize
;
if
(
begin
>=
0
&&
pmsUseLogs
.
size
()
>
0
)
{
...
...
license/src/main/resources/mapper/ApplyMapper.xml
View file @
1758b45e
...
...
@@ -14,8 +14,11 @@
FROM apply AS app LEFT JOIN device AS de ON app.app_id = de.app_id
LEFT JOIN user AS us ON us.user_id = app.user_id
where 1=1
<if
test=
"null != userId"
>
and us.user_id = #{userId}
<if
test=
"userChildIds != null"
>
AND us.user_id IN
<foreach
collection=
"userChildIds"
open=
"("
separator=
","
close=
")"
item=
"userId"
>
#{userId}
</foreach>
</if>
<if
test=
"null != appName and '' != appName"
>
and app_name like concat('%',#{appName},'%')
...
...
license/src/main/resources/mapper/DeviceMapper.xml
View file @
1758b45e
...
...
@@ -8,8 +8,11 @@
JOIN apply AS app ON de.app_id = app.app_id
JOIN `user` AS us ON us.user_id = app.user_id
where 1=1
<if
test=
"null != userId"
>
and us.user_id = #{userId}
<if
test=
"userChildIds != null"
>
AND us.user_id IN
<foreach
collection=
"userChildIds"
open=
"("
separator=
","
close=
")"
item=
"userId"
>
#{userId}
</foreach>
</if>
<if
test=
"null != appName and '' != appName"
>
and app_name like concat('%',#{appName},'%')
...
...
license/src/main/resources/mapper/PmsUseLogMapper.xml
View file @
1758b45e
...
...
@@ -2,8 +2,17 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"iot.sixiang.license.mapper.PmsUseLogMapper"
>
<select
id=
"getPmsUseLogList"
resultType=
"iot.sixiang.license.entity.PmsUseLog"
>
SELECT * FROM pms_use_log
SELECT * FROM `pms_use_log`
INNER JOIN device ON device.sn = pms_use_log.sn
INNER JOIN apply ON device.app_id = apply.app_id
INNER JOIN `user` ON `user`.user_id = apply.user_id
where 1=1
<if
test=
"userChildIds != null"
>
AND user.user_id IN
<foreach
collection=
"userChildIds"
open=
"("
separator=
","
close=
")"
item=
"userId"
>
#{userId}
</foreach>
</if>
<if
test=
"startTime != null and startTime != ''"
>
AND create_time
>
#{startTime}
</if>
...
...
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