Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gxpt_ht
Overview
Overview
Details
Activity
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
pseer
gxpt_ht
Commits
a290146b
Commit
a290146b
authored
Jan 22, 2024
by
吕明尚
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改保洁和设备管理权限
parent
df6f054e
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
222 additions
and
27 deletions
+222
-27
DeviceController.java
...in/java/share/web/controller/system/DeviceController.java
+13
-0
SCleanRecordsController.java
.../share/web/controller/system/SCleanRecordsController.java
+11
-14
SCleanRecordsVo.java
...src/main/java/share/system/domain/vo/SCleanRecordsVo.java
+33
-0
SCleanRecordsMapper.java
...rc/main/java/share/system/mapper/SCleanRecordsMapper.java
+1
-0
SStoreConsumerMapper.java
...c/main/java/share/system/mapper/SStoreConsumerMapper.java
+3
-1
ISCleanRecordsService.java
...main/java/share/system/service/ISCleanRecordsService.java
+3
-1
SCleanRecordsServiceImpl.java
...a/share/system/service/impl/SCleanRecordsServiceImpl.java
+137
-7
SRoomServiceImpl.java
...main/java/share/system/service/impl/SRoomServiceImpl.java
+8
-0
SStoreServiceImpl.java
...ain/java/share/system/service/impl/SStoreServiceImpl.java
+5
-3
SStoreConsumerMapper.xml
...src/main/resources/mapper/system/SStoreConsumerMapper.xml
+8
-1
No files found.
share-front/src/main/java/share/web/controller/system/DeviceController.java
View file @
a290146b
package
share
.
web
.
controller
.
system
;
package
share
.
web
.
controller
.
system
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
...
@@ -8,6 +9,8 @@ import share.common.core.controller.BaseController;
...
@@ -8,6 +9,8 @@ import share.common.core.controller.BaseController;
import
share.common.core.domain.AjaxResult
;
import
share.common.core.domain.AjaxResult
;
import
share.common.core.page.TableDataInfo
;
import
share.common.core.page.TableDataInfo
;
import
share.common.enums.BusinessType
;
import
share.common.enums.BusinessType
;
import
share.common.enums.PositionEnum
;
import
share.common.enums.RoleTypeEnum
;
import
share.common.utils.SecurityUtils
;
import
share.common.utils.SecurityUtils
;
import
share.common.utils.poi.ExcelUtil
;
import
share.common.utils.poi.ExcelUtil
;
import
share.system.domain.Device
;
import
share.system.domain.Device
;
...
@@ -15,6 +18,7 @@ import share.system.domain.SConsumer;
...
@@ -15,6 +18,7 @@ import share.system.domain.SConsumer;
import
share.system.domain.vo.DeviceParamVo
;
import
share.system.domain.vo.DeviceParamVo
;
import
share.system.domain.vo.FrontTokenComponent
;
import
share.system.domain.vo.FrontTokenComponent
;
import
share.system.domain.vo.MqttxVo
;
import
share.system.domain.vo.MqttxVo
;
import
share.system.mapper.SStoreConsumerMapper
;
import
share.system.mqtt.MqttGatewayComponent
;
import
share.system.mqtt.MqttGatewayComponent
;
import
share.system.service.DeviceLogService
;
import
share.system.service.DeviceLogService
;
import
share.system.service.DeviceService
;
import
share.system.service.DeviceService
;
...
@@ -41,6 +45,8 @@ public class DeviceController extends BaseController {
...
@@ -41,6 +45,8 @@ public class DeviceController extends BaseController {
private
MqttGatewayComponent
mqttGatewayComponent
;
private
MqttGatewayComponent
mqttGatewayComponent
;
@Autowired
@Autowired
private
SConsumerService
consumerService
;
private
SConsumerService
consumerService
;
@Autowired
private
SStoreConsumerMapper
storeConsumerMapper
;
/**
/**
...
@@ -49,6 +55,13 @@ public class DeviceController extends BaseController {
...
@@ -49,6 +55,13 @@ public class DeviceController extends BaseController {
@PostMapping
(
value
=
"/openOrClose"
)
@PostMapping
(
value
=
"/openOrClose"
)
public
AjaxResult
openOrClose
(
@RequestBody
DeviceParamVo
deviceParam
)
{
public
AjaxResult
openOrClose
(
@RequestBody
DeviceParamVo
deviceParam
)
{
SConsumer
user
=
consumerService
.
getInfo
();
SConsumer
user
=
consumerService
.
getInfo
();
if
(!
user
.
getRoleType
().
equals
(
RoleTypeEnum
.
CLEANER
.
getCode
()))
{
throw
new
RuntimeException
(
"当前用户不是店员"
);
}
List
<
Long
>
longs
=
storeConsumerMapper
.
selectByConsumerId
(
user
.
getId
(),
PositionEnum
.
ADMIN
.
getCode
());
if
(
CollectionUtils
.
isEmpty
(
longs
))
{
throw
new
RuntimeException
(
"当前用户不是管理员"
);
}
// 获取mqtt的topic、payload
// 获取mqtt的topic、payload
MqttxVo
mqttxVo
=
mqttxService
.
openOrCloseDevice
(
deviceParam
.
getDevId
(),
MqttxVo
mqttxVo
=
mqttxService
.
openOrCloseDevice
(
deviceParam
.
getDevId
(),
user
.
getAccount
(),
deviceParam
.
getOpType
());
user
.
getAccount
(),
deviceParam
.
getOpType
());
...
...
share-front/src/main/java/share/web/controller/system/SCleanRecordsController.java
View file @
a290146b
...
@@ -4,6 +4,7 @@ import java.util.List;
...
@@ -4,6 +4,7 @@ import java.util.List;
import
javax.servlet.http.HttpServletResponse
;
import
javax.servlet.http.HttpServletResponse
;
import
cn.hutool.core.date.DateUtil
;
import
cn.hutool.core.date.DateUtil
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.security.access.prepost.PreAuthorize
;
...
@@ -21,9 +22,14 @@ import share.common.core.controller.BaseController;
...
@@ -21,9 +22,14 @@ import share.common.core.controller.BaseController;
import
share.common.core.domain.AjaxResult
;
import
share.common.core.domain.AjaxResult
;
import
share.common.enums.BusinessType
;
import
share.common.enums.BusinessType
;
import
share.common.enums.CleaningStatusEnum
;
import
share.common.enums.CleaningStatusEnum
;
import
share.common.enums.PositionEnum
;
import
share.common.enums.RoleTypeEnum
;
import
share.system.domain.SCleanRecords
;
import
share.system.domain.SCleanRecords
;
import
share.system.domain.SConsumer
;
import
share.system.domain.SConsumer
;
import
share.system.domain.SStoreConsumer
;
import
share.system.domain.vo.FrontTokenComponent
;
import
share.system.domain.vo.FrontTokenComponent
;
import
share.system.domain.vo.SCleanRecordsVo
;
import
share.system.mapper.SStoreConsumerMapper
;
import
share.system.service.DeviceOpService
;
import
share.system.service.DeviceOpService
;
import
share.system.service.ISCleanRecordsService
;
import
share.system.service.ISCleanRecordsService
;
import
share.common.utils.poi.ExcelUtil
;
import
share.common.utils.poi.ExcelUtil
;
...
@@ -42,6 +48,8 @@ public class SCleanRecordsController extends BaseController
...
@@ -42,6 +48,8 @@ public class SCleanRecordsController extends BaseController
{
{
@Autowired
@Autowired
private
ISCleanRecordsService
sCleanRecordsService
;
private
ISCleanRecordsService
sCleanRecordsService
;
@Autowired
private
SStoreConsumerMapper
storeConsumerMapper
;
/**
/**
* 查询保洁记录列表
* 查询保洁记录列表
...
@@ -76,13 +84,9 @@ public class SCleanRecordsController extends BaseController
...
@@ -76,13 +84,9 @@ public class SCleanRecordsController extends BaseController
*/
*/
@ApiOperation
(
value
=
"已开始的保洁记录列表"
)
@ApiOperation
(
value
=
"已开始的保洁记录列表"
)
@GetMapping
(
"/myCleanList"
)
@GetMapping
(
"/myCleanList"
)
public
TableDataInfo
myCleanList
(
SCleanRecords
sCleanRecords
)
public
TableDataInfo
myCleanList
(
SCleanRecords
Vo
sCleanRecords
)
{
{
SConsumer
user
=
FrontTokenComponent
.
getWxSConsumerEntry
();
return
sCleanRecordsService
.
myCleanList
(
sCleanRecords
);
sCleanRecords
.
setConsumerId
(
user
.
getId
());
startPage
();
List
<
SCleanRecords
>
list
=
sCleanRecordsService
.
myCleanList
(
sCleanRecords
);
return
getDataTable
(
list
);
}
}
/**
/**
...
@@ -104,10 +108,6 @@ public class SCleanRecordsController extends BaseController
...
@@ -104,10 +108,6 @@ public class SCleanRecordsController extends BaseController
@PostMapping
(
value
=
"/startClean"
)
@PostMapping
(
value
=
"/startClean"
)
public
AjaxResult
startClean
(
@RequestBody
SCleanRecords
sCleanRecords
)
public
AjaxResult
startClean
(
@RequestBody
SCleanRecords
sCleanRecords
)
{
{
SConsumer
user
=
FrontTokenComponent
.
getWxSConsumerEntry
();
sCleanRecords
.
setConsumerId
(
user
.
getId
());
sCleanRecords
.
setStartDate
(
DateUtil
.
date
());
sCleanRecords
.
setStatus
(
CleaningStatusEnum
.
CLEANING
.
getCode
());
return
toAjax
(
sCleanRecordsService
.
startCleanRecords
(
sCleanRecords
));
return
toAjax
(
sCleanRecordsService
.
startCleanRecords
(
sCleanRecords
));
}
}
...
@@ -119,10 +119,7 @@ public class SCleanRecordsController extends BaseController
...
@@ -119,10 +119,7 @@ public class SCleanRecordsController extends BaseController
@PostMapping
(
value
=
"/endClean"
)
@PostMapping
(
value
=
"/endClean"
)
public
AjaxResult
endClean
(
@RequestBody
SCleanRecords
sCleanRecords
)
public
AjaxResult
endClean
(
@RequestBody
SCleanRecords
sCleanRecords
)
{
{
SConsumer
user
=
FrontTokenComponent
.
getWxSConsumerEntry
();
sCleanRecords
.
setConsumerId
(
user
.
getId
());
sCleanRecords
.
setEndDate
(
DateUtil
.
date
());
sCleanRecords
.
setStatus
(
CleaningStatusEnum
.
CLEANED
.
getCode
());
return
toAjax
(
sCleanRecordsService
.
endCleanRecords
(
sCleanRecords
));
return
toAjax
(
sCleanRecordsService
.
endCleanRecords
(
sCleanRecords
));
}
}
...
...
share-system/src/main/java/share/system/domain/vo/SCleanRecordsVo.java
0 → 100644
View file @
a290146b
package
share
.
system
.
domain
.
vo
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
lombok.Data
;
import
share.common.annotation.Excel
;
import
share.common.core.domain.BaseEntity
;
import
java.util.List
;
@Data
public
class
SCleanRecordsVo
extends
BaseEntity
{
/**
* 门店ID
*/
private
List
<
Long
>
storeIds
;
/**
* 保洁人员ID
*/
private
Long
consumerId
;
private
Integer
status
;
/**
* 门店名称
*/
private
String
storeName
;
Integer
pageNum
;
Integer
pageSize
;
}
share-system/src/main/java/share/system/mapper/SCleanRecordsMapper.java
View file @
a290146b
...
@@ -5,6 +5,7 @@ import java.util.List;
...
@@ -5,6 +5,7 @@ import java.util.List;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
share.system.domain.SCleanRecords
;
import
share.system.domain.SCleanRecords
;
import
share.system.domain.SRoom
;
import
share.system.domain.SRoom
;
import
share.system.domain.vo.SCleanRecordsVo
;
/**
/**
* 保洁记录Mapper接口
* 保洁记录Mapper接口
...
...
share-system/src/main/java/share/system/mapper/SStoreConsumerMapper.java
View file @
a290146b
...
@@ -34,5 +34,7 @@ public interface SStoreConsumerMapper extends BaseMapper<SStoreConsumer> {
...
@@ -34,5 +34,7 @@ public interface SStoreConsumerMapper extends BaseMapper<SStoreConsumer> {
public
int
deleteInfos
(
@Param
(
"storeId"
)
Long
storeId
,
@Param
(
"consumerIds"
)
Long
[]
consumerIds
);
public
int
deleteInfos
(
@Param
(
"storeId"
)
Long
storeId
,
@Param
(
"consumerIds"
)
Long
[]
consumerIds
);
List
<
Long
>
selectByConsumerId
(
Long
id
);
List
<
Long
>
selectByConsumerId
(
Long
id
,
Integer
position
);
List
<
SStoreConsumer
>
queryByConsumerId
(
Long
id
);
}
}
share-system/src/main/java/share/system/service/ISCleanRecordsService.java
View file @
a290146b
...
@@ -4,7 +4,9 @@ import java.util.List;
...
@@ -4,7 +4,9 @@ import java.util.List;
import
java.util.Map
;
import
java.util.Map
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
share.common.core.page.TableDataInfo
;
import
share.system.domain.SCleanRecords
;
import
share.system.domain.SCleanRecords
;
import
share.system.domain.vo.SCleanRecordsVo
;
/**
/**
* 保洁记录Service接口
* 保洁记录Service接口
...
@@ -72,7 +74,7 @@ public interface ISCleanRecordsService extends IService<SCleanRecords>
...
@@ -72,7 +74,7 @@ public interface ISCleanRecordsService extends IService<SCleanRecords>
List
<
SCleanRecords
>
unCleanList
(
SCleanRecords
sCleanRecords
);
List
<
SCleanRecords
>
unCleanList
(
SCleanRecords
sCleanRecords
);
List
<
SCleanRecords
>
myCleanList
(
SCleanRecords
sCleanRecords
);
TableDataInfo
myCleanList
(
SCleanRecordsVo
sCleanRecords
);
SCleanRecords
getByRoomId
(
Long
roomId
);
SCleanRecords
getByRoomId
(
Long
roomId
);
...
...
share-system/src/main/java/share/system/service/impl/SCleanRecordsServiceImpl.java
View file @
a290146b
This diff is collapsed.
Click to expand it.
share-system/src/main/java/share/system/service/impl/SRoomServiceImpl.java
View file @
a290146b
...
@@ -10,6 +10,7 @@ import org.apache.commons.collections4.CollectionUtils;
...
@@ -10,6 +10,7 @@ import org.apache.commons.collections4.CollectionUtils;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.util.ObjectUtils
;
import
share.common.enums.DeviceType
;
import
share.common.enums.DeviceType
;
import
share.common.enums.PositionEnum
;
import
share.common.enums.RoleTypeEnum
;
import
share.common.enums.RoleTypeEnum
;
import
share.common.enums.YesNoEnum
;
import
share.common.enums.YesNoEnum
;
import
share.common.exception.base.BaseException
;
import
share.common.exception.base.BaseException
;
...
@@ -23,6 +24,7 @@ import share.system.domain.vo.RoomStatusVo;
...
@@ -23,6 +24,7 @@ import share.system.domain.vo.RoomStatusVo;
import
share.system.domain.vo.SRoomVo
;
import
share.system.domain.vo.SRoomVo
;
import
share.system.mapper.DeviceMapper
;
import
share.system.mapper.DeviceMapper
;
import
share.system.mapper.SRoomMapper
;
import
share.system.mapper.SRoomMapper
;
import
share.system.mapper.SStoreConsumerMapper
;
import
share.system.service.*
;
import
share.system.service.*
;
/**
/**
...
@@ -52,6 +54,8 @@ public class SRoomServiceImpl extends ServiceImpl<SRoomMapper, SRoom> implements
...
@@ -52,6 +54,8 @@ public class SRoomServiceImpl extends ServiceImpl<SRoomMapper, SRoom> implements
private
DeviceOpService
deviceOpService
;
private
DeviceOpService
deviceOpService
;
@Autowired
@Autowired
private
RoomStatusService
roomStatusService
;
private
RoomStatusService
roomStatusService
;
@Autowired
private
SStoreConsumerMapper
storeConsumerMapper
;
/**
/**
...
@@ -281,6 +285,10 @@ public class SRoomServiceImpl extends ServiceImpl<SRoomMapper, SRoom> implements
...
@@ -281,6 +285,10 @@ public class SRoomServiceImpl extends ServiceImpl<SRoomMapper, SRoom> implements
public
String
openDoor
(
Long
id
)
{
public
String
openDoor
(
Long
id
)
{
SConsumer
user
=
FrontTokenComponent
.
getWxSConsumerEntry
();
SConsumer
user
=
FrontTokenComponent
.
getWxSConsumerEntry
();
if
(!
user
.
getRoleType
().
equals
(
RoleTypeEnum
.
CLEANER
.
getCode
()))
{
if
(!
user
.
getRoleType
().
equals
(
RoleTypeEnum
.
CLEANER
.
getCode
()))
{
throw
new
RuntimeException
(
"当前用户不是店员"
);
}
List
<
Long
>
longs
=
storeConsumerMapper
.
selectByConsumerId
(
user
.
getId
(),
PositionEnum
.
CLEANER
.
getCode
());
if
(
CollectionUtils
.
isEmpty
(
longs
))
{
throw
new
RuntimeException
(
"当前用户不是保洁人员"
);
throw
new
RuntimeException
(
"当前用户不是保洁人员"
);
}
}
SRoom
room
=
baseMapper
.
selectById
(
id
);
SRoom
room
=
baseMapper
.
selectById
(
id
);
...
...
share-system/src/main/java/share/system/service/impl/SStoreServiceImpl.java
View file @
a290146b
...
@@ -368,10 +368,12 @@ public class SStoreServiceImpl extends ServiceImpl<SStoreMapper, SStore> impleme
...
@@ -368,10 +368,12 @@ public class SStoreServiceImpl extends ServiceImpl<SStoreMapper, SStore> impleme
public
List
<
SStore
>
listVoByCleaner
()
{
public
List
<
SStore
>
listVoByCleaner
()
{
SConsumer
user
=
FrontTokenComponent
.
getWxSConsumerEntry
();
SConsumer
user
=
FrontTokenComponent
.
getWxSConsumerEntry
();
if
(!
user
.
getRoleType
().
equals
(
RoleTypeEnum
.
CLEANER
.
getCode
()))
{
if
(!
user
.
getRoleType
().
equals
(
RoleTypeEnum
.
CLEANER
.
getCode
()))
{
throw
new
BaseException
(
"当前用户不是保洁人员!"
);
throw
new
BaseException
(
"当前用户不是店员!"
);
}
List
<
Long
>
storeIdList
=
storeConsumerMapper
.
selectByConsumerId
(
user
.
getId
(),
PositionEnum
.
CLEANER
.
getCode
());
if
(
CollectionUtils
.
isEmpty
(
storeIdList
))
{
throw
new
RuntimeException
(
"当前用户不是保洁人员"
);
}
}
//查询保洁人员所属门店
List
<
Long
>
storeIdList
=
storeConsumerMapper
.
selectByConsumerId
(
user
.
getId
());
List
<
SStore
>
storeList
=
new
ArrayList
<>();
List
<
SStore
>
storeList
=
new
ArrayList
<>();
if
(
CollectionUtils
.
isNotEmpty
(
storeIdList
))
{
if
(
CollectionUtils
.
isNotEmpty
(
storeIdList
))
{
// 查询门店信息
// 查询门店信息
...
...
share-system/src/main/resources/mapper/system/SStoreConsumerMapper.xml
View file @
a290146b
...
@@ -21,7 +21,14 @@
...
@@ -21,7 +21,14 @@
select store_id
select store_id
from s_store_consumer
from s_store_consumer
where consumer_id = #{consumerId}
where consumer_id = #{consumerId}
and position = '1'
<if
test=
"position != null"
>
and position = #{position}
</if>
</select>
<select
id=
"queryByConsumerId"
resultMap=
"SStoreConsumerResult"
>
select store_id, store_id, position
from s_store_consumer
where consumer_id = #{consumerId}
</select>
</select>
<delete
id=
"deleteSStoreConsumer"
parameterType=
"Long"
>
<delete
id=
"deleteSStoreConsumer"
parameterType=
"Long"
>
...
...
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