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
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
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.web.bind.annotation.*
;
...
...
@@ -8,6 +9,8 @@ import share.common.core.controller.BaseController;
import
share.common.core.domain.AjaxResult
;
import
share.common.core.page.TableDataInfo
;
import
share.common.enums.BusinessType
;
import
share.common.enums.PositionEnum
;
import
share.common.enums.RoleTypeEnum
;
import
share.common.utils.SecurityUtils
;
import
share.common.utils.poi.ExcelUtil
;
import
share.system.domain.Device
;
...
...
@@ -15,6 +18,7 @@ import share.system.domain.SConsumer;
import
share.system.domain.vo.DeviceParamVo
;
import
share.system.domain.vo.FrontTokenComponent
;
import
share.system.domain.vo.MqttxVo
;
import
share.system.mapper.SStoreConsumerMapper
;
import
share.system.mqtt.MqttGatewayComponent
;
import
share.system.service.DeviceLogService
;
import
share.system.service.DeviceService
;
...
...
@@ -41,6 +45,8 @@ public class DeviceController extends BaseController {
private
MqttGatewayComponent
mqttGatewayComponent
;
@Autowired
private
SConsumerService
consumerService
;
@Autowired
private
SStoreConsumerMapper
storeConsumerMapper
;
/**
...
...
@@ -49,6 +55,13 @@ public class DeviceController extends BaseController {
@PostMapping
(
value
=
"/openOrClose"
)
public
AjaxResult
openOrClose
(
@RequestBody
DeviceParamVo
deviceParam
)
{
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
MqttxVo
mqttxVo
=
mqttxService
.
openOrCloseDevice
(
deviceParam
.
getDevId
(),
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;
import
javax.servlet.http.HttpServletResponse
;
import
cn.hutool.core.date.DateUtil
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.security.access.prepost.PreAuthorize
;
...
...
@@ -21,9 +22,14 @@ import share.common.core.controller.BaseController;
import
share.common.core.domain.AjaxResult
;
import
share.common.enums.BusinessType
;
import
share.common.enums.CleaningStatusEnum
;
import
share.common.enums.PositionEnum
;
import
share.common.enums.RoleTypeEnum
;
import
share.system.domain.SCleanRecords
;
import
share.system.domain.SConsumer
;
import
share.system.domain.SStoreConsumer
;
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.ISCleanRecordsService
;
import
share.common.utils.poi.ExcelUtil
;
...
...
@@ -42,6 +48,8 @@ public class SCleanRecordsController extends BaseController
{
@Autowired
private
ISCleanRecordsService
sCleanRecordsService
;
@Autowired
private
SStoreConsumerMapper
storeConsumerMapper
;
/**
* 查询保洁记录列表
...
...
@@ -76,13 +84,9 @@ public class SCleanRecordsController extends BaseController
*/
@ApiOperation
(
value
=
"已开始的保洁记录列表"
)
@GetMapping
(
"/myCleanList"
)
public
TableDataInfo
myCleanList
(
SCleanRecords
sCleanRecords
)
public
TableDataInfo
myCleanList
(
SCleanRecords
Vo
sCleanRecords
)
{
SConsumer
user
=
FrontTokenComponent
.
getWxSConsumerEntry
();
sCleanRecords
.
setConsumerId
(
user
.
getId
());
startPage
();
List
<
SCleanRecords
>
list
=
sCleanRecordsService
.
myCleanList
(
sCleanRecords
);
return
getDataTable
(
list
);
return
sCleanRecordsService
.
myCleanList
(
sCleanRecords
);
}
/**
...
...
@@ -104,10 +108,6 @@ public class SCleanRecordsController extends BaseController
@PostMapping
(
value
=
"/startClean"
)
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
));
}
...
...
@@ -119,10 +119,7 @@ public class SCleanRecordsController extends BaseController
@PostMapping
(
value
=
"/endClean"
)
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
));
}
...
...
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;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
share.system.domain.SCleanRecords
;
import
share.system.domain.SRoom
;
import
share.system.domain.vo.SCleanRecordsVo
;
/**
* 保洁记录Mapper接口
...
...
share-system/src/main/java/share/system/mapper/SStoreConsumerMapper.java
View file @
a290146b
...
...
@@ -34,5 +34,7 @@ public interface SStoreConsumerMapper extends BaseMapper<SStoreConsumer> {
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;
import
java.util.Map
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
share.common.core.page.TableDataInfo
;
import
share.system.domain.SCleanRecords
;
import
share.system.domain.vo.SCleanRecordsVo
;
/**
* 保洁记录Service接口
...
...
@@ -72,7 +74,7 @@ public interface ISCleanRecordsService extends IService<SCleanRecords>
List
<
SCleanRecords
>
unCleanList
(
SCleanRecords
sCleanRecords
);
List
<
SCleanRecords
>
myCleanList
(
SCleanRecords
sCleanRecords
);
TableDataInfo
myCleanList
(
SCleanRecordsVo
sCleanRecords
);
SCleanRecords
getByRoomId
(
Long
roomId
);
...
...
share-system/src/main/java/share/system/service/impl/SCleanRecordsServiceImpl.java
View file @
a290146b
package
share
.
system
.
service
.
impl
;
import
java.util.*
;
import
java.util.function.Function
;
import
java.util.stream.Collectors
;
import
cn.hutool.core.date.DateUtil
;
...
...
@@ -8,16 +9,15 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
org.apache.commons.collections4.CollectionUtils
;
import
share.common.constant.Constants
;
import
share.common.core.page.TableDataInfo
;
import
share.common.enums.*
;
import
share.common.utils.DateUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
share.system.domain.*
;
import
share.system.domain.vo.FrontTokenComponent
;
import
share.system.mapper.SCleanRecordsMapper
;
import
share.system.mapper.SConsumerMapper
;
import
share.system.mapper.SRoomMapper
;
import
share.system.mapper.SStoreMapper
;
import
share.system.domain.vo.SCleanRecordsVo
;
import
share.system.mapper.*
;
import
share.system.service.DeviceOpService
;
import
share.system.service.ISCleanRecordsService
;
import
share.system.service.ISOrderService
;
...
...
@@ -44,6 +44,8 @@ public class SCleanRecordsServiceImpl extends ServiceImpl<SCleanRecordsMapper,SC
private
DeviceOpService
deviceOpService
;
@Autowired
private
ISOrderService
orderService
;
@Autowired
private
SStoreConsumerMapper
storeConsumerMapper
;
//管理员手机号
private
static
final
String
phone
=
"13888888888"
;
...
...
@@ -160,11 +162,116 @@ public class SCleanRecordsServiceImpl extends ServiceImpl<SCleanRecordsMapper,SC
return
baseMapper
.
unCleanList
(
sCleanRecords
);
}
// @Override
// public TableDataInfo myCleanList(SCleanRecordsVo sCleanRecords) {
// SConsumer user = FrontTokenComponent.getWxSConsumerEntry();
// sCleanRecords.setConsumerId(user.getId());
// List<SStoreConsumer> sStoreConsumers = storeConsumerMapper.queryByConsumerId(user.getId());
// //保洁的门店id
// List<Long> storeIds = sStoreConsumers.stream().filter(s -> s.getPosition().equals(PositionEnum.CLEANER.getCode())).map(SStoreConsumer::getStoreId).collect(Collectors.toList());
// //管理员的门店id
// List<Long> longList = sStoreConsumers.stream().filter(s -> s.getPosition().equals(PositionEnum.ADMIN.getCode())).map(SStoreConsumer::getStoreId).collect(Collectors.toList());
// LambdaQueryWrapper<SCleanRecords> queryWrapper = new LambdaQueryWrapper<>();
// queryWrapper.in(SCleanRecords::getStoreId,longList);
// List<SCleanRecords> cleanRecordsList = baseMapper.selectList(queryWrapper);
// LambdaQueryWrapper<SCleanRecords> queryWrapper1 = new LambdaQueryWrapper<>();
// queryWrapper1.in(SCleanRecords::getStoreId,storeIds);
// queryWrapper1.eq(SCleanRecords::getConsumerId,user.getId());
// List<SCleanRecords> cleanRecords = baseMapper.selectList(queryWrapper1);
// cleanRecords.stream().forEach(item -> cleanRecordsList.add(item));
// List<SStore> sStoreList = sStoreMapper.selectList(new LambdaQueryWrapper<>());
// List<SRoom> sRoomList = sRoomMapper.selectList(new LambdaQueryWrapper<>());
// cleanRecordsList.stream().forEach(item -> {
// sStoreList.stream().forEach(store -> {
// if (item.getStoreId().equals(store.getId())) {
// item.setsStore(store);
// item.setStoreName(store.getName());
// }
// });
// sRoomList.stream().forEach(room -> {
// if (item.getRoomId().equals(room.getId())) {
// item.setsRoom(room);
// item.setRoomName(room.getName());
// }
// });
// });
// //排序 按照创建时间倒序
// cleanRecordsList.sort(Comparator.comparing(SCleanRecords::getCreateTime).reversed());
// //分页
// List<SCleanRecords> collect = cleanRecordsList.stream().skip((sCleanRecords.getPageNum() - 1) * sCleanRecords.getPageSize()).limit(sCleanRecords.getPageSize()).collect(Collectors.toList());
// TableDataInfo tableDataInfo = new TableDataInfo();
// tableDataInfo.setRows(collect);
// tableDataInfo.setTotal(cleanRecordsList.size());
// tableDataInfo.setCode(200);
// tableDataInfo.setMsg("查询成功");
// return tableDataInfo;
//
// }
@Override
public
List
<
SCleanRecords
>
myCleanList
(
SCleanRecords
sCleanRecords
)
{
return
baseMapper
.
myCleanList
(
sCleanRecords
);
public
TableDataInfo
myCleanList
(
SCleanRecordsVo
sCleanRecords
)
{
SConsumer
user
=
FrontTokenComponent
.
getWxSConsumerEntry
();
if
(
user
==
null
)
{
throw
new
RuntimeException
(
"User not found"
);
// 或者返回特定的错误响应
}
sCleanRecords
.
setConsumerId
(
user
.
getId
());
List
<
SStoreConsumer
>
sStoreConsumers
=
storeConsumerMapper
.
queryByConsumerId
(
user
.
getId
());
List
<
Long
>
cleanerStoreIds
=
sStoreConsumers
.
stream
()
.
filter
(
s
->
s
.
getPosition
().
equals
(
PositionEnum
.
CLEANER
.
getCode
()))
.
map
(
SStoreConsumer:
:
getStoreId
)
.
collect
(
Collectors
.
toList
());
cleanerStoreIds
=
Optional
.
ofNullable
(
cleanerStoreIds
).
orElse
(
Collections
.
emptyList
());
List
<
Long
>
adminStoreIds
=
sStoreConsumers
.
stream
()
.
filter
(
s
->
s
.
getPosition
().
equals
(
PositionEnum
.
ADMIN
.
getCode
()))
.
map
(
SStoreConsumer:
:
getStoreId
)
.
collect
(
Collectors
.
toList
());
adminStoreIds
=
Optional
.
ofNullable
(
adminStoreIds
).
orElse
(
Collections
.
emptyList
());
LambdaQueryWrapper
<
SCleanRecords
>
queryWrapper
=
new
LambdaQueryWrapper
<>();
if
(
CollectionUtils
.
isNotEmpty
(
adminStoreIds
))
{
queryWrapper
.
in
(
SCleanRecords:
:
getStoreId
,
adminStoreIds
);
}
if
(
CollectionUtils
.
isNotEmpty
(
cleanerStoreIds
))
{
queryWrapper
.
or
().
in
(
SCleanRecords:
:
getStoreId
,
cleanerStoreIds
);
queryWrapper
.
eq
(
SCleanRecords:
:
getConsumerId
,
user
.
getId
());
}
List
<
SCleanRecords
>
cleanRecordsList
=
baseMapper
.
selectList
(
queryWrapper
);
Map
<
Long
,
SStore
>
storeMap
=
sStoreMapper
.
selectList
(
new
LambdaQueryWrapper
<>()).
stream
()
.
collect
(
Collectors
.
toMap
(
SStore:
:
getId
,
Function
.
identity
()));
Map
<
Long
,
SRoom
>
roomMap
=
sRoomMapper
.
selectList
(
new
LambdaQueryWrapper
<>()).
stream
()
.
collect
(
Collectors
.
toMap
(
SRoom:
:
getId
,
Function
.
identity
()));
cleanRecordsList
.
forEach
(
item
->
{
SStore
store
=
storeMap
.
get
(
item
.
getStoreId
());
if
(
store
!=
null
)
{
item
.
setsStore
(
store
);
item
.
setStoreName
(
store
.
getName
());
}
SRoom
room
=
roomMap
.
get
(
item
.
getRoomId
());
if
(
room
!=
null
)
{
item
.
setsRoom
(
room
);
item
.
setRoomName
(
room
.
getName
());
}
});
cleanRecordsList
.
sort
(
Comparator
.
comparing
(
SCleanRecords:
:
getCreateTime
).
reversed
());
int
start
=
(
sCleanRecords
.
getPageNum
()
-
1
)
*
sCleanRecords
.
getPageSize
();
int
end
=
Math
.
min
(
start
+
sCleanRecords
.
getPageSize
(),
cleanRecordsList
.
size
());
List
<
SCleanRecords
>
pagedList
=
cleanRecordsList
.
subList
(
start
,
end
);
TableDataInfo
tableDataInfo
=
new
TableDataInfo
();
tableDataInfo
.
setRows
(
pagedList
);
tableDataInfo
.
setTotal
(
cleanRecordsList
.
size
());
tableDataInfo
.
setCode
(
200
);
tableDataInfo
.
setMsg
(
"查询成功"
);
return
tableDataInfo
;
}
@Override
public
SCleanRecords
getByRoomId
(
Long
roomId
)
{
LambdaQueryWrapper
<
SCleanRecords
>
queryWrapper
=
new
LambdaQueryWrapper
();
...
...
@@ -177,7 +284,11 @@ public class SCleanRecordsServiceImpl extends ServiceImpl<SCleanRecordsMapper,SC
public
SCleanRecords
getByCleanerId
()
{
SConsumer
user
=
FrontTokenComponent
.
getWxSConsumerEntry
();
if
(!
user
.
getRoleType
().
equals
(
RoleTypeEnum
.
CLEANER
.
getCode
()))
{
throw
new
RuntimeException
(
"当前用户不是保洁人员"
);
throw
new
RuntimeException
(
"当前用户不是店员"
);
}
List
<
Long
>
longs
=
storeConsumerMapper
.
selectByConsumerId
(
user
.
getId
(),
PositionEnum
.
CLEANER
.
getCode
());
if
(
CollectionUtils
.
isEmpty
(
longs
))
{
throw
new
RuntimeException
(
"当前用户不是保洁人员"
);
}
LambdaQueryWrapper
<
SCleanRecords
>
queryWrapper
=
new
LambdaQueryWrapper
<>();
queryWrapper
.
in
(
SCleanRecords:
:
getConsumerId
,
user
.
getId
());
...
...
@@ -233,6 +344,9 @@ public class SCleanRecordsServiceImpl extends ServiceImpl<SCleanRecordsMapper,SC
@Override
public
int
startCleanRecords
(
SCleanRecords
sCleanRecords
)
{
isCleaner
(
sCleanRecords
);
sCleanRecords
.
setStartDate
(
DateUtil
.
date
());
sCleanRecords
.
setStatus
(
CleaningStatusEnum
.
CLEANING
.
getCode
());
LambdaQueryWrapper
<
SCleanRecords
>
queryWrapper
=
new
LambdaQueryWrapper
<>();
queryWrapper
.
eq
(
SCleanRecords:
:
getStatus
,
CleaningStatusEnum
.
CLEANING
.
getCode
());
queryWrapper
.
eq
(
SCleanRecords:
:
getConsumerId
,
sCleanRecords
.
getConsumerId
());
...
...
@@ -291,6 +405,10 @@ public class SCleanRecordsServiceImpl extends ServiceImpl<SCleanRecordsMapper,SC
@Override
public
int
endCleanRecords
(
SCleanRecords
sCleanRecords
)
{
isCleaner
(
sCleanRecords
);
sCleanRecords
.
setEndDate
(
DateUtil
.
date
());
sCleanRecords
.
setStatus
(
CleaningStatusEnum
.
CLEANED
.
getCode
());
SCleanRecords
records
=
baseMapper
.
selectSCleanRecordsById
(
sCleanRecords
.
getId
());
if
(
records
==
null
)
{
throw
new
RuntimeException
(
"当前保洁任务不存在!"
);
...
...
@@ -303,6 +421,18 @@ public class SCleanRecordsServiceImpl extends ServiceImpl<SCleanRecordsMapper,SC
return
index
;
}
private
void
isCleaner
(
SCleanRecords
sCleanRecords
)
{
SConsumer
user
=
FrontTokenComponent
.
getWxSConsumerEntry
();
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
(
"当前用户不是保洁人员"
);
}
sCleanRecords
.
setConsumerId
(
user
.
getId
());
}
private
void
sendSms
(
Long
storeId
,
SStore
store
,
SRoom
room
)
{
sConsumerMapper
.
selectListByStoreId
(
storeId
).
stream
().
forEach
(
item
->
{
// 循环发送短信提示门店保洁打扫卫生
...
...
share-system/src/main/java/share/system/service/impl/SRoomServiceImpl.java
View file @
a290146b
...
...
@@ -10,6 +10,7 @@ import org.apache.commons.collections4.CollectionUtils;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.util.ObjectUtils
;
import
share.common.enums.DeviceType
;
import
share.common.enums.PositionEnum
;
import
share.common.enums.RoleTypeEnum
;
import
share.common.enums.YesNoEnum
;
import
share.common.exception.base.BaseException
;
...
...
@@ -23,6 +24,7 @@ import share.system.domain.vo.RoomStatusVo;
import
share.system.domain.vo.SRoomVo
;
import
share.system.mapper.DeviceMapper
;
import
share.system.mapper.SRoomMapper
;
import
share.system.mapper.SStoreConsumerMapper
;
import
share.system.service.*
;
/**
...
...
@@ -52,6 +54,8 @@ public class SRoomServiceImpl extends ServiceImpl<SRoomMapper, SRoom> implements
private
DeviceOpService
deviceOpService
;
@Autowired
private
RoomStatusService
roomStatusService
;
@Autowired
private
SStoreConsumerMapper
storeConsumerMapper
;
/**
...
...
@@ -281,6 +285,10 @@ public class SRoomServiceImpl extends ServiceImpl<SRoomMapper, SRoom> implements
public
String
openDoor
(
Long
id
)
{
SConsumer
user
=
FrontTokenComponent
.
getWxSConsumerEntry
();
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
(
"当前用户不是保洁人员"
);
}
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
public
List
<
SStore
>
listVoByCleaner
()
{
SConsumer
user
=
FrontTokenComponent
.
getWxSConsumerEntry
();
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
<>();
if
(
CollectionUtils
.
isNotEmpty
(
storeIdList
))
{
// 查询门店信息
...
...
share-system/src/main/resources/mapper/system/SStoreConsumerMapper.xml
View file @
a290146b
...
...
@@ -21,7 +21,14 @@
select store_id
from s_store_consumer
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>
<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