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
24f07b1c
Commit
24f07b1c
authored
Nov 08, 2023
by
吕明尚
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增房间设备中间表,增加房间时增加设备
parent
8166b0b3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
584 additions
and
81 deletions
+584
-81
RoomDeviceController.java
...ava/share/web/controller/system/RoomDeviceController.java
+97
-0
QPController.java
...c/main/java/share/web/controller/system/QPController.java
+5
-4
RoomDevice.java
...-system/src/main/java/share/system/domain/RoomDevice.java
+50
-0
SRoom.java
share-system/src/main/java/share/system/domain/SRoom.java
+7
-0
TuangouReceiptPrepareResponseEntityVo.java
...stem/domain/vo/TuangouReceiptPrepareResponseEntityVo.java
+9
-0
RoomDeviceMapper.java
...m/src/main/java/share/system/mapper/RoomDeviceMapper.java
+62
-0
DeviceService.java
...tem/src/main/java/share/system/service/DeviceService.java
+1
-0
QPService.java
...-system/src/main/java/share/system/service/QPService.java
+4
-4
RoomDeviceService.java
...src/main/java/share/system/service/RoomDeviceService.java
+62
-0
DeviceServiceImpl.java
...ain/java/share/system/service/impl/DeviceServiceImpl.java
+9
-0
QPServiceImpl.java
...rc/main/java/share/system/service/impl/QPServiceImpl.java
+40
-30
RoomDeviceServiceImpl.java
...java/share/system/service/impl/RoomDeviceServiceImpl.java
+91
-0
SRoomServiceImpl.java
...main/java/share/system/service/impl/SRoomServiceImpl.java
+55
-43
RoomDeviceMapper.xml
...tem/src/main/resources/mapper/system/RoomDeviceMapper.xml
+92
-0
No files found.
share-admin/src/main/java/share/web/controller/system/RoomDeviceController.java
0 → 100644
View file @
24f07b1c
package
share
.
web
.
controller
.
system
;
import
java.util.List
;
import
javax.servlet.http.HttpServletResponse
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.PutMapping
;
import
org.springframework.web.bind.annotation.DeleteMapping
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
share.common.annotation.Log
;
import
share.common.core.controller.BaseController
;
import
share.common.core.domain.AjaxResult
;
import
share.common.enums.BusinessType
;
import
share.system.domain.RoomDevice
;
import
share.common.utils.poi.ExcelUtil
;
import
share.common.core.page.TableDataInfo
;
import
share.system.service.RoomDeviceService
;
/**
* 包房设备关系Controller
*
* @author wuwenlong
* @date 2023-11-08
*/
@RestController
@RequestMapping
(
"/system/device"
)
public
class
RoomDeviceController
extends
BaseController
{
@Autowired
private
RoomDeviceService
roomDeviceService
;
/**
* 查询包房设备关系列表
*/
// @PreAuthorize("@ss.hasPermi('system:device:list')")
@GetMapping
(
"/list"
)
public
TableDataInfo
list
(
RoomDevice
RoomDevice
)
{
startPage
();
List
<
RoomDevice
>
list
=
roomDeviceService
.
selectRoomDeviceList
(
RoomDevice
);
return
getDataTable
(
list
);
}
/**
* 导出包房设备关系列表
*/
// @PreAuthorize("@ss.hasPermi('system:device:export')")
@Log
(
title
=
"包房设备关系"
,
businessType
=
BusinessType
.
EXPORT
)
@PostMapping
(
"/export"
)
public
void
export
(
HttpServletResponse
response
,
RoomDevice
RoomDevice
)
{
List
<
RoomDevice
>
list
=
roomDeviceService
.
selectRoomDeviceList
(
RoomDevice
);
ExcelUtil
<
RoomDevice
>
util
=
new
ExcelUtil
<
RoomDevice
>(
RoomDevice
.
class
);
util
.
exportExcel
(
response
,
list
,
"包房设备关系数据"
);
}
/**
* 获取包房设备关系详细信息
*/
// @PreAuthorize("@ss.hasPermi('system:device:query')")
@GetMapping
(
value
=
"/{id}"
)
public
AjaxResult
getInfo
(
@PathVariable
(
"id"
)
Long
id
)
{
return
success
(
roomDeviceService
.
selectRoomDeviceById
(
id
));
}
/**
* 新增包房设备关系
*/
// @PreAuthorize("@ss.hasPermi('system:device:add')")
@Log
(
title
=
"包房设备关系"
,
businessType
=
BusinessType
.
INSERT
)
@PostMapping
public
AjaxResult
add
(
@RequestBody
RoomDevice
RoomDevice
)
{
return
toAjax
(
roomDeviceService
.
insertRoomDevice
(
RoomDevice
));
}
/**
* 修改包房设备关系
*/
// @PreAuthorize("@ss.hasPermi('system:device:edit')")
@Log
(
title
=
"包房设备关系"
,
businessType
=
BusinessType
.
UPDATE
)
@PutMapping
public
AjaxResult
edit
(
@RequestBody
RoomDevice
RoomDevice
)
{
return
toAjax
(
roomDeviceService
.
updateRoomDevice
(
RoomDevice
));
}
/**
* 删除包房设备关系
*/
// @PreAuthorize("@ss.hasPermi('system:device:remove')")
@Log
(
title
=
"包房设备关系"
,
businessType
=
BusinessType
.
DELETE
)
@DeleteMapping
(
"/{ids}"
)
public
AjaxResult
remove
(
@PathVariable
Long
[]
ids
)
{
return
toAjax
(
roomDeviceService
.
deleteRoomDeviceByIds
(
ids
));
}
}
share-front/src/main/java/share/web/controller/system/QPController.java
View file @
24f07b1c
...
@@ -7,6 +7,7 @@ import org.springframework.web.bind.annotation.GetMapping;
...
@@ -7,6 +7,7 @@ import org.springframework.web.bind.annotation.GetMapping;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.RestController
;
import
share.common.core.domain.R
;
import
share.common.core.domain.R
;
import
share.system.domain.vo.TuangouReceiptPrepareResponseEntityVo
;
import
share.system.service.QPService
;
import
share.system.service.QPService
;
import
java.util.List
;
import
java.util.List
;
...
@@ -32,7 +33,7 @@ public class QPController {
...
@@ -32,7 +33,7 @@ public class QPController {
//撤销验券接口
//撤销验券接口
@GetMapping
(
"/reverseconsume"
)
@GetMapping
(
"/reverseconsume"
)
public
R
<
List
<
TuangouReceiptReverseConsumeResponseEntity
>>
reverseconsume
(
String
code
,
Stri
ng
appDealId
)
{
public
R
<
List
<
TuangouReceiptReverseConsumeResponseEntity
>>
reverseconsume
(
String
code
,
Lo
ng
appDealId
)
{
return
R
.
ok
(
qpService
.
reverseconsume
(
code
,
appDealId
));
return
R
.
ok
(
qpService
.
reverseconsume
(
code
,
appDealId
));
}
}
...
@@ -44,13 +45,13 @@ public class QPController {
...
@@ -44,13 +45,13 @@ public class QPController {
//用户验券接口
//用户验券接口
@GetMapping
(
"/consumeByUser"
)
@GetMapping
(
"/consumeByUser"
)
public
R
<
String
>
consumeByUser
(
String
code
,
int
count
)
{
public
R
<
TuangouReceiptPrepareResponseEntityVo
>
consumeByUser
(
String
code
)
{
return
R
.
ok
(
qpService
.
consumeByUser
(
code
,
count
));
return
R
.
ok
(
qpService
.
consumeByUser
(
code
));
}
}
//用户销券接口
//用户销券接口
@GetMapping
(
"/reverseconsumeByUser"
)
@GetMapping
(
"/reverseconsumeByUser"
)
public
R
<
String
>
reverseconsumeByUser
(
Long
id
)
{
public
R
<
List
<
TuangouReceiptReverseConsumeResponseEntity
>
>
reverseconsumeByUser
(
Long
id
)
{
return
R
.
ok
(
qpService
.
reverseconsumeByUser
(
id
));
return
R
.
ok
(
qpService
.
reverseconsumeByUser
(
id
));
}
}
...
...
share-system/src/main/java/share/system/domain/RoomDevice.java
0 → 100644
View file @
24f07b1c
package
share
.
system
.
domain
;
import
org.apache.commons.lang3.builder.ToStringBuilder
;
import
org.apache.commons.lang3.builder.ToStringStyle
;
import
share.common.annotation.Excel
;
import
share.common.core.domain.BaseEntity
;
import
lombok.Data
;
/**
* 包房设备关系对象 s_room_device
*
* @author wuwenlong
* @date 2023-11-08
*/
@Data
public
class
RoomDevice
extends
BaseEntity
{
private
static
final
long
serialVersionUID
=
1L
;
/**
* ID
*/
private
Long
id
;
/**
* 房间id
*/
@Excel
(
name
=
"房间id"
)
private
Long
roomId
;
/**
* 设备id
*/
@Excel
(
name
=
"设备id"
)
private
Long
deviceId
;
@Override
public
String
toString
()
{
return
new
ToStringBuilder
(
this
,
ToStringStyle
.
MULTI_LINE_STYLE
)
.
append
(
"id"
,
getId
())
.
append
(
"roomId"
,
getRoomId
())
.
append
(
"deviceId"
,
getDeviceId
())
.
append
(
"createBy"
,
getCreateBy
())
.
append
(
"createTime"
,
getCreateTime
())
.
append
(
"updateBy"
,
getUpdateBy
())
.
append
(
"updateTime"
,
getUpdateTime
())
.
append
(
"remark"
,
getRemark
())
.
toString
();
}
}
share-system/src/main/java/share/system/domain/SRoom.java
View file @
24f07b1c
...
@@ -83,6 +83,13 @@ public class SRoom extends BaseEntity
...
@@ -83,6 +83,13 @@ public class SRoom extends BaseEntity
private
String
packIds
;
private
String
packIds
;
/**
/**
* 设备ID
*/
@TableField
(
exist
=
false
)
private
String
deviceIds
;
/**
* 套餐集合
* 套餐集合
*/
*/
@TableField
(
exist
=
false
)
@TableField
(
exist
=
false
)
...
...
share-system/src/main/java/share/system/domain/vo/TuangouReceiptPrepareResponseEntityVo.java
0 → 100644
View file @
24f07b1c
package
share
.
system
.
domain
.
vo
;
import
com.dianping.openapi.sdk.api.tuangou.entity.TuangouReceiptPrepareResponseEntity
;
import
lombok.Data
;
@Data
public
class
TuangouReceiptPrepareResponseEntityVo
extends
TuangouReceiptPrepareResponseEntity
{
private
String
expirationTime
;
}
share-system/src/main/java/share/system/mapper/RoomDeviceMapper.java
0 → 100644
View file @
24f07b1c
package
share
.
system
.
mapper
;
import
java.util.List
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
share.system.domain.RoomDevice
;
/**
* 包房设备关系Mapper接口
*
* @author wuwenlong
* @date 2023-11-08
*/
public
interface
RoomDeviceMapper
extends
BaseMapper
<
RoomDevice
>
{
/**
* 查询包房设备关系
*
* @param id 包房设备关系主键
* @return 包房设备关系
*/
public
RoomDevice
selectRoomDeviceById
(
Long
id
);
/**
* 查询包房设备关系列表
*
* @param RoomDevice 包房设备关系
* @return 包房设备关系集合
*/
public
List
<
RoomDevice
>
selectRoomDeviceList
(
RoomDevice
RoomDevice
);
/**
* 新增包房设备关系
*
* @param RoomDevice 包房设备关系
* @return 结果
*/
public
int
insertRoomDevice
(
RoomDevice
RoomDevice
);
/**
* 修改包房设备关系
*
* @param RoomDevice 包房设备关系
* @return 结果
*/
public
int
updateRoomDevice
(
RoomDevice
RoomDevice
);
/**
* 删除包房设备关系
*
* @param id 包房设备关系主键
* @return 结果
*/
public
int
deleteRoomDeviceById
(
Long
id
);
/**
* 批量删除包房设备关系
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public
int
deleteRoomDeviceByIds
(
Long
[]
ids
);
}
share-system/src/main/java/share/system/service/DeviceService.java
View file @
24f07b1c
...
@@ -68,4 +68,5 @@ public interface DeviceService extends IService<Device>
...
@@ -68,4 +68,5 @@ public interface DeviceService extends IService<Device>
*/
*/
int
updateDeviceByDevId
(
Device
device
);
int
updateDeviceByDevId
(
Device
device
);
List
<
Device
>
selectDeviceListByIds
(
List
<
Long
>
collect
);
}
}
share-system/src/main/java/share/system/service/QPService.java
View file @
24f07b1c
package
share
.
system
.
service
;
package
share
.
system
.
service
;
import
com.dianping.openapi.sdk.api.tuangou.entity.*
;
import
com.dianping.openapi.sdk.api.tuangou.entity.*
;
import
share.
common.core.domain.R
;
import
share.
system.domain.vo.TuangouReceiptPrepareResponseEntityVo
;
import
java.util.List
;
import
java.util.List
;
...
@@ -10,13 +10,13 @@ public interface QPService {
...
@@ -10,13 +10,13 @@ public interface QPService {
List
<
TuangouReceiptConsumeResponseEntity
>
consume
(
String
code
,
int
count
);
List
<
TuangouReceiptConsumeResponseEntity
>
consume
(
String
code
,
int
count
);
List
<
TuangouReceiptReverseConsumeResponseEntity
>
reverseconsume
(
String
code
,
Stri
ng
appDealId
);
List
<
TuangouReceiptReverseConsumeResponseEntity
>
reverseconsume
(
String
code
,
Lo
ng
appDealId
);
TuangouReceiptGetConsumedReponseEntity
getconsumed
(
String
code
);
TuangouReceiptGetConsumedReponseEntity
getconsumed
(
String
code
);
String
consumeByUser
(
String
code
,
int
count
);
TuangouReceiptPrepareResponseEntityVo
consumeByUser
(
String
code
);
String
reverseconsumeByUser
(
Long
id
);
List
<
TuangouReceiptReverseConsumeResponseEntity
>
reverseconsumeByUser
(
Long
id
);
String
oauthToken
(
String
authCode
);
String
oauthToken
(
String
authCode
);
...
...
share-system/src/main/java/share/system/service/RoomDeviceService.java
0 → 100644
View file @
24f07b1c
package
share
.
system
.
service
;
import
java.util.List
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
share.system.domain.RoomDevice
;
/**
* 包房设备关系Service接口
*
* @author wuwenlong
* @date 2023-11-08
*/
public
interface
RoomDeviceService
extends
IService
<
RoomDevice
>
{
/**
* 查询包房设备关系
*
* @param id 包房设备关系主键
* @return 包房设备关系
*/
public
RoomDevice
selectRoomDeviceById
(
Long
id
);
/**
* 查询包房设备关系列表
*
* @param RoomDevice 包房设备关系
* @return 包房设备关系集合
*/
public
List
<
RoomDevice
>
selectRoomDeviceList
(
RoomDevice
RoomDevice
);
/**
* 新增包房设备关系
*
* @param RoomDevice 包房设备关系
* @return 结果
*/
public
int
insertRoomDevice
(
RoomDevice
RoomDevice
);
/**
* 修改包房设备关系
*
* @param RoomDevice 包房设备关系
* @return 结果
*/
public
int
updateRoomDevice
(
RoomDevice
RoomDevice
);
/**
* 批量删除包房设备关系
*
* @param ids 需要删除的包房设备关系主键集合
* @return 结果
*/
public
int
deleteRoomDeviceByIds
(
Long
[]
ids
);
/**
* 删除包房设备关系信息
*
* @param id 包房设备关系主键
* @return 结果
*/
public
int
deleteRoomDeviceById
(
Long
id
);
}
share-system/src/main/java/share/system/service/impl/DeviceServiceImpl.java
View file @
24f07b1c
...
@@ -2,11 +2,13 @@ package share.system.service.impl;
...
@@ -2,11 +2,13 @@ package share.system.service.impl;
import
java.util.List
;
import
java.util.List
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
share.common.utils.DateUtils
;
import
share.common.utils.DateUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
share.common.utils.SecurityUtils
;
import
share.common.utils.SecurityUtils
;
import
share.system.domain.SPack
;
import
share.system.mapper.DeviceMapper
;
import
share.system.mapper.DeviceMapper
;
import
share.system.domain.Device
;
import
share.system.domain.Device
;
import
share.system.service.DeviceService
;
import
share.system.service.DeviceService
;
...
@@ -104,4 +106,11 @@ public class DeviceServiceImpl extends ServiceImpl<DeviceMapper, Device> impleme
...
@@ -104,4 +106,11 @@ public class DeviceServiceImpl extends ServiceImpl<DeviceMapper, Device> impleme
return
deviceMapper
.
updateDeviceByDevId
(
device
);
return
deviceMapper
.
updateDeviceByDevId
(
device
);
}
}
@Override
public
List
<
Device
>
selectDeviceListByIds
(
List
<
Long
>
collect
)
{
LambdaQueryWrapper
<
Device
>
queryWrapper
=
new
LambdaQueryWrapper
();
queryWrapper
.
in
(
Device:
:
getId
,
collect
);
return
deviceMapper
.
selectList
(
queryWrapper
);
}
}
}
share-system/src/main/java/share/system/service/impl/QPServiceImpl.java
View file @
24f07b1c
This diff is collapsed.
Click to expand it.
share-system/src/main/java/share/system/service/impl/RoomDeviceServiceImpl.java
0 → 100644
View file @
24f07b1c
package
share
.
system
.
service
.
impl
;
import
java.util.List
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
share.common.utils.DateUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
share.system.domain.RoomDevice
;
import
share.system.mapper.RoomDeviceMapper
;
import
share.system.service.RoomDeviceService
;
/**
* 包房设备关系Service业务层处理
*
* @author wuwenlong
* @date 2023-11-08
*/
@Service
public
class
RoomDeviceServiceImpl
extends
ServiceImpl
<
RoomDeviceMapper
,
RoomDevice
>
implements
RoomDeviceService
{
@Autowired
private
RoomDeviceMapper
roomDeviceMapper
;
/**
* 查询包房设备关系
*
* @param id 包房设备关系主键
* @return 包房设备关系
*/
@Override
public
RoomDevice
selectRoomDeviceById
(
Long
id
)
{
return
roomDeviceMapper
.
selectRoomDeviceById
(
id
);
}
/**
* 查询包房设备关系列表
*
* @param RoomDevice 包房设备关系
* @return 包房设备关系
*/
@Override
public
List
<
RoomDevice
>
selectRoomDeviceList
(
RoomDevice
RoomDevice
)
{
return
roomDeviceMapper
.
selectRoomDeviceList
(
RoomDevice
);
}
/**
* 新增包房设备关系
*
* @param RoomDevice 包房设备关系
* @return 结果
*/
@Override
public
int
insertRoomDevice
(
RoomDevice
RoomDevice
)
{
RoomDevice
.
setCreateTime
(
DateUtils
.
getNowDate
());
return
roomDeviceMapper
.
insertRoomDevice
(
RoomDevice
);
}
/**
* 修改包房设备关系
*
* @param RoomDevice 包房设备关系
* @return 结果
*/
@Override
public
int
updateRoomDevice
(
RoomDevice
RoomDevice
)
{
RoomDevice
.
setUpdateTime
(
DateUtils
.
getNowDate
());
return
roomDeviceMapper
.
updateRoomDevice
(
RoomDevice
);
}
/**
* 批量删除包房设备关系
*
* @param ids 需要删除的包房设备关系主键
* @return 结果
*/
@Override
public
int
deleteRoomDeviceByIds
(
Long
[]
ids
)
{
return
roomDeviceMapper
.
deleteRoomDeviceByIds
(
ids
);
}
/**
* 删除包房设备关系信息
*
* @param id 包房设备关系主键
* @return 结果
*/
@Override
public
int
deleteRoomDeviceById
(
Long
id
)
{
return
roomDeviceMapper
.
deleteRoomDeviceById
(
id
);
}
}
share-system/src/main/java/share/system/service/impl/SRoomServiceImpl.java
View file @
24f07b1c
...
@@ -11,27 +11,20 @@ import share.common.enums.RoleTypeEnum;
...
@@ -11,27 +11,20 @@ import share.common.enums.RoleTypeEnum;
import
share.common.utils.DateUtils
;
import
share.common.utils.DateUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
share.system.domain.SPack
;
import
share.system.domain.*
;
import
share.system.domain.SRoomPack
;
import
share.system.domain.SConsumer
;
import
share.system.domain.vo.FrontTokenComponent
;
import
share.system.domain.vo.FrontTokenComponent
;
import
share.system.domain.vo.SRoomVo
;
import
share.system.domain.vo.SRoomVo
;
import
share.system.mapper.SRoomMapper
;
import
share.system.mapper.SRoomMapper
;
import
share.system.domain.SRoom
;
import
share.system.service.*
;
import
share.system.service.IPackService
;
import
share.system.service.IRoomPackService
;
import
share.system.service.ISRoomService
;
import
share.system.service.ISStoreService
;
/**
/**
* 房间Service业务层处理
* 房间Service业务层处理
*
*
* @author ruoyi
* @author ruoyi
* @date 2023-09-27
* @date 2023-09-27
*/
*/
@Service
@Service
public
class
SRoomServiceImpl
extends
ServiceImpl
<
SRoomMapper
,
SRoom
>
implements
ISRoomService
public
class
SRoomServiceImpl
extends
ServiceImpl
<
SRoomMapper
,
SRoom
>
implements
ISRoomService
{
{
@Autowired
@Autowired
private
SRoomMapper
sRoomMapper
;
private
SRoomMapper
sRoomMapper
;
...
@@ -44,32 +37,38 @@ public class SRoomServiceImpl extends ServiceImpl<SRoomMapper,SRoom> implements
...
@@ -44,32 +37,38 @@ public class SRoomServiceImpl extends ServiceImpl<SRoomMapper,SRoom> implements
@Autowired
@Autowired
private
IRoomPackService
roomPackService
;
private
IRoomPackService
roomPackService
;
@Autowired
private
DeviceService
deviceService
;
@Autowired
public
RoomDeviceService
roomDeviceService
;
/**
/**
* 查询房间
* 查询房间
*
*
* @param id 房间主键
* @param id 房间主键
* @return 房间
* @return 房间
*/
*/
@Override
@Override
public
SRoomVo
selectSRoomById
(
Long
id
)
public
SRoomVo
selectSRoomById
(
Long
id
)
{
{
SRoom
sRoom
=
sRoomMapper
.
selectSRoomById
(
id
);
SRoom
sRoom
=
sRoomMapper
.
selectSRoomById
(
id
);
sRoom
.
setPackIds
(
roomPackService
.
selectPackListByRoomId
(
id
).
stream
().
map
(
String:
:
valueOf
).
collect
(
Collectors
.
joining
(
","
)));
sRoom
.
setPackIds
(
roomPackService
.
selectPackListByRoomId
(
id
).
stream
().
map
(
String:
:
valueOf
).
collect
(
Collectors
.
joining
(
","
)));
if
(
Objects
.
nonNull
(
sRoom
)&&
sRoom
.
getId
()!=
null
){
if
(
Objects
.
nonNull
(
sRoom
)
&&
sRoom
.
getId
()
!=
null
)
{
return
convertVoList
(
new
ArrayList
<
SRoom
>(){{
add
(
sRoom
);}}).
get
(
0
);
return
convertVoList
(
new
ArrayList
<
SRoom
>()
{{
add
(
sRoom
);
}}).
get
(
0
);
}
}
return
new
SRoomVo
();
return
new
SRoomVo
();
}
}
/**
/**
* 查询房间列表
* 查询房间列表
*
*
* @param sRoom 房间
* @param sRoom 房间
* @return 房间
* @return 房间
*/
*/
@Override
@Override
public
List
<
SRoomVo
>
selectSRoomList
(
SRoom
sRoom
)
public
List
<
SRoomVo
>
selectSRoomList
(
SRoom
sRoom
)
{
{
List
<
SRoom
>
roomList
=
sRoomMapper
.
selectSRoomList
(
sRoom
);
List
<
SRoom
>
roomList
=
sRoomMapper
.
selectSRoomList
(
sRoom
);
roomList
.
forEach
(
o
->
{
roomList
.
forEach
(
o
->
{
List
<
Long
>
roomId
=
roomPackService
.
selectPackListByRoomId
(
o
.
getId
());
List
<
Long
>
roomId
=
roomPackService
.
selectPackListByRoomId
(
o
.
getId
());
...
@@ -79,17 +78,17 @@ public class SRoomServiceImpl extends ServiceImpl<SRoomMapper,SRoom> implements
...
@@ -79,17 +78,17 @@ public class SRoomServiceImpl extends ServiceImpl<SRoomMapper,SRoom> implements
return
convertVoList
(
roomList
);
return
convertVoList
(
roomList
);
}
}
private
List
<
SRoomVo
>
convertVoList
(
List
<
SRoom
>
roomList
){
private
List
<
SRoomVo
>
convertVoList
(
List
<
SRoom
>
roomList
)
{
List
<
SRoomVo
>
voList
=
new
ArrayList
<>();
List
<
SRoomVo
>
voList
=
new
ArrayList
<>();
if
(
CollectionUtils
.
isNotEmpty
(
roomList
))
{
if
(
CollectionUtils
.
isNotEmpty
(
roomList
))
{
List
<
Long
>
storeIds
=
roomList
.
stream
().
map
(
SRoom:
:
getStoreId
).
collect
(
Collectors
.
toList
());
List
<
Long
>
storeIds
=
roomList
.
stream
().
map
(
SRoom:
:
getStoreId
).
collect
(
Collectors
.
toList
());
List
<
Map
>
storeList
=
sStoreService
.
optionList
(
storeIds
);
List
<
Map
>
storeList
=
sStoreService
.
optionList
(
storeIds
);
roomList
.
stream
().
forEach
(
sRoom
->
{
roomList
.
stream
().
forEach
(
sRoom
->
{
SRoomVo
vo
=
new
SRoomVo
();
SRoomVo
vo
=
new
SRoomVo
();
BeanUtils
.
copyProperties
(
sRoom
,
vo
);
BeanUtils
.
copyProperties
(
sRoom
,
vo
);
storeList
.
stream
().
forEach
(
store
->
{
storeList
.
stream
().
forEach
(
store
->
{
if
(
vo
.
getStoreId
().
compareTo
(
Long
.
parseLong
(
store
.
get
(
"id"
).
toString
()))
==
0
)
{
if
(
vo
.
getStoreId
().
compareTo
(
Long
.
parseLong
(
store
.
get
(
"id"
).
toString
()))
==
0
)
{
vo
.
setStoreName
(
store
.
getOrDefault
(
"name"
,
""
).
toString
());
vo
.
setStoreName
(
store
.
getOrDefault
(
"name"
,
""
).
toString
());
}
}
});
});
voList
.
add
(
vo
);
voList
.
add
(
vo
);
...
@@ -100,13 +99,12 @@ public class SRoomServiceImpl extends ServiceImpl<SRoomMapper,SRoom> implements
...
@@ -100,13 +99,12 @@ public class SRoomServiceImpl extends ServiceImpl<SRoomMapper,SRoom> implements
/**
/**
* 新增房间
* 新增房间
*
*
* @param sRoom 房间
* @param sRoom 房间
* @return 结果
* @return 结果
*/
*/
@Override
@Override
public
int
insertSRoom
(
SRoom
sRoom
)
public
int
insertSRoom
(
SRoom
sRoom
)
{
{
int
i
=
0
;
int
i
=
0
;
try
{
try
{
sRoom
.
setCreateTime
(
DateUtils
.
getNowDate
());
sRoom
.
setCreateTime
(
DateUtils
.
getNowDate
());
...
@@ -129,6 +127,23 @@ public class SRoomServiceImpl extends ServiceImpl<SRoomMapper,SRoom> implements
...
@@ -129,6 +127,23 @@ public class SRoomServiceImpl extends ServiceImpl<SRoomMapper,SRoom> implements
});
});
roomPackService
.
saveBatch
(
SRoomPackList
);
roomPackService
.
saveBatch
(
SRoomPackList
);
}
}
//判断设备id
if
(!
sRoom
.
getDeviceIds
().
isEmpty
())
{
List
<
Device
>
deviceList
=
deviceService
.
selectDeviceListByIds
(
Arrays
.
asList
(
sRoom
.
getDeviceIds
().
split
(
","
)).
stream
().
map
(
Long:
:
valueOf
).
collect
(
Collectors
.
toList
()));
if
(
CollectionUtils
.
isEmpty
(
deviceList
))
{
throw
new
RuntimeException
(
"设备不存在"
);
}
List
<
Long
>
list
=
Arrays
.
asList
(
sRoom
.
getDeviceIds
().
split
(
","
)).
stream
().
map
(
Long:
:
valueOf
).
collect
(
Collectors
.
toList
());
List
<
RoomDevice
>
SRoomDeviceList
=
new
ArrayList
<>();
list
.
stream
().
forEach
(
o
->
{
RoomDevice
SRoomDevice
=
new
RoomDevice
();
SRoomDevice
.
setDeviceId
(
o
);
SRoomDevice
.
setRoomId
(
sRoom
.
getId
());
SRoomDevice
.
setCreateTime
(
DateUtils
.
getNowDate
());
SRoomDeviceList
.
add
(
SRoomDevice
);
});
roomDeviceService
.
saveBatch
(
SRoomDeviceList
);
}
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
throw
new
RuntimeException
(
"新增房间失败"
);
throw
new
RuntimeException
(
"新增房间失败"
);
}
}
...
@@ -137,13 +152,12 @@ public class SRoomServiceImpl extends ServiceImpl<SRoomMapper,SRoom> implements
...
@@ -137,13 +152,12 @@ public class SRoomServiceImpl extends ServiceImpl<SRoomMapper,SRoom> implements
/**
/**
* 修改房间
* 修改房间
*
*
* @param sRoom 房间
* @param sRoom 房间
* @return 结果
* @return 结果
*/
*/
@Override
@Override
public
int
updateSRoom
(
SRoom
sRoom
)
public
int
updateSRoom
(
SRoom
sRoom
)
{
{
//判断套餐ID
//判断套餐ID
if
(!
sRoom
.
getPackIds
().
isEmpty
())
{
if
(!
sRoom
.
getPackIds
().
isEmpty
())
{
//判断套餐ID
//判断套餐ID
...
@@ -170,33 +184,31 @@ public class SRoomServiceImpl extends ServiceImpl<SRoomMapper,SRoom> implements
...
@@ -170,33 +184,31 @@ public class SRoomServiceImpl extends ServiceImpl<SRoomMapper,SRoom> implements
/**
/**
* 批量删除房间
* 批量删除房间
*
*
* @param ids 需要删除的房间主键
* @param ids 需要删除的房间主键
* @return 结果
* @return 结果
*/
*/
@Override
@Override
public
int
deleteSRoomByIds
(
Long
[]
ids
)
public
int
deleteSRoomByIds
(
Long
[]
ids
)
{
{
roomPackService
.
deleteRoomPackByIds
(
ids
);
roomPackService
.
deleteRoomPackByIds
(
ids
);
return
sRoomMapper
.
deleteSRoomByIds
(
ids
);
return
sRoomMapper
.
deleteSRoomByIds
(
ids
);
}
}
/**
/**
* 删除房间信息
* 删除房间信息
*
*
* @param id 房间主键
* @param id 房间主键
* @return 结果
* @return 结果
*/
*/
@Override
@Override
public
int
deleteSRoomById
(
Long
id
)
public
int
deleteSRoomById
(
Long
id
)
{
{
return
sRoomMapper
.
deleteSRoomById
(
id
);
return
sRoomMapper
.
deleteSRoomById
(
id
);
}
}
@Override
@Override
public
List
<
SRoomVo
>
listByStoreIds
(
List
<
Long
>
storeIds
)
{
public
List
<
SRoomVo
>
listByStoreIds
(
List
<
Long
>
storeIds
)
{
LambdaQueryWrapper
<
SRoom
>
queryWrapper
=
new
LambdaQueryWrapper
();
LambdaQueryWrapper
<
SRoom
>
queryWrapper
=
new
LambdaQueryWrapper
();
queryWrapper
.
in
(
SRoom:
:
getStoreId
,
storeIds
);
queryWrapper
.
in
(
SRoom:
:
getStoreId
,
storeIds
);
List
<
SRoom
>
roomList
=
sRoomMapper
.
selectList
(
queryWrapper
);
List
<
SRoom
>
roomList
=
sRoomMapper
.
selectList
(
queryWrapper
);
return
convertDoListToVoList
(
roomList
);
return
convertDoListToVoList
(
roomList
);
}
}
...
@@ -224,13 +236,13 @@ public class SRoomServiceImpl extends ServiceImpl<SRoomMapper,SRoom> implements
...
@@ -224,13 +236,13 @@ public class SRoomServiceImpl extends ServiceImpl<SRoomMapper,SRoom> implements
throw
new
RuntimeException
(
"当前用户不是保洁人员"
);
throw
new
RuntimeException
(
"当前用户不是保洁人员"
);
}
}
SRoom
room
=
sRoomMapper
.
selectById
(
id
);
SRoom
room
=
sRoomMapper
.
selectById
(
id
);
if
(
Objects
.
isNull
(
room
))
{
if
(
Objects
.
isNull
(
room
))
{
throw
new
RuntimeException
(
"房间不存在"
);
throw
new
RuntimeException
(
"房间不存在"
);
}
}
//TODO 调用开门接口
//TODO 调用开门接口
if
(
true
)
{
if
(
true
)
{
return
"开门成功"
;
return
"开门成功"
;
}
else
{
}
else
{
return
"开门失败"
;
return
"开门失败"
;
}
}
}
}
...
@@ -249,12 +261,12 @@ public class SRoomServiceImpl extends ServiceImpl<SRoomMapper,SRoom> implements
...
@@ -249,12 +261,12 @@ public class SRoomServiceImpl extends ServiceImpl<SRoomMapper,SRoom> implements
}
}
private
List
<
SRoomVo
>
convertDoListToVoList
(
List
<
SRoom
>
roomList
){
private
List
<
SRoomVo
>
convertDoListToVoList
(
List
<
SRoom
>
roomList
)
{
List
<
SRoomVo
>
voList
=
new
ArrayList
<>();
List
<
SRoomVo
>
voList
=
new
ArrayList
<>();
if
(
CollectionUtils
.
isNotEmpty
(
roomList
))
{
if
(
CollectionUtils
.
isNotEmpty
(
roomList
))
{
roomList
.
stream
().
forEach
(
o
->
{
roomList
.
stream
().
forEach
(
o
->
{
SRoomVo
vo
=
new
SRoomVo
();
SRoomVo
vo
=
new
SRoomVo
();
BeanUtils
.
copyProperties
(
o
,
vo
);
BeanUtils
.
copyProperties
(
o
,
vo
);
voList
.
add
(
vo
);
voList
.
add
(
vo
);
});
});
}
}
...
...
share-system/src/main/resources/mapper/system/RoomDeviceMapper.xml
0 → 100644
View file @
24f07b1c
<?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">
<mapper
namespace=
"share.system.mapper.RoomDeviceMapper"
>
<resultMap
type=
"RoomDevice"
id=
"RoomDeviceResult"
>
<result
property=
"id"
column=
"id"
/>
<result
property=
"roomId"
column=
"room_id"
/>
<result
property=
"deviceId"
column=
"device_id"
/>
<result
property=
"createBy"
column=
"create_by"
/>
<result
property=
"createTime"
column=
"create_time"
/>
<result
property=
"updateBy"
column=
"update_by"
/>
<result
property=
"updateTime"
column=
"update_time"
/>
<result
property=
"remark"
column=
"remark"
/>
</resultMap>
<sql
id=
"selectRoomDeviceVo"
>
select id,
room_id,
device_id,
create_by,
create_time,
update_by,
update_time,
remark
from s_room_device
</sql>
<select
id=
"selectRoomDeviceList"
parameterType=
"RoomDevice"
resultMap=
"RoomDeviceResult"
>
<include
refid=
"selectRoomDeviceVo"
/>
<where>
<if
test=
"roomId != null "
>
and room_id = #{roomId}
</if>
<if
test=
"deviceId != null "
>
and device_id = #{deviceId}
</if>
</where>
</select>
<select
id=
"selectRoomDeviceById"
parameterType=
"Long"
resultMap=
"RoomDeviceResult"
>
<include
refid=
"selectRoomDeviceVo"
/>
where id = #{id}
</select>
<insert
id=
"insertRoomDevice"
parameterType=
"RoomDevice"
useGeneratedKeys=
"true"
keyProperty=
"id"
>
insert into s_room_device
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"roomId != null"
>
room_id,
</if>
<if
test=
"deviceId != null"
>
device_id,
</if>
<if
test=
"createBy != null"
>
create_by,
</if>
<if
test=
"createTime != null"
>
create_time,
</if>
<if
test=
"updateBy != null"
>
update_by,
</if>
<if
test=
"updateTime != null"
>
update_time,
</if>
<if
test=
"remark != null"
>
remark,
</if>
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"roomId != null"
>
#{roomId},
</if>
<if
test=
"deviceId != null"
>
#{deviceId},
</if>
<if
test=
"createBy != null"
>
#{createBy},
</if>
<if
test=
"createTime != null"
>
#{createTime},
</if>
<if
test=
"updateBy != null"
>
#{updateBy},
</if>
<if
test=
"updateTime != null"
>
#{updateTime},
</if>
<if
test=
"remark != null"
>
#{remark},
</if>
</trim>
</insert>
<update
id=
"updateRoomDevice"
parameterType=
"RoomDevice"
>
update s_room_device
<trim
prefix=
"SET"
suffixOverrides=
","
>
<if
test=
"roomId != null"
>
room_id = #{roomId},
</if>
<if
test=
"deviceId != null"
>
device_id = #{deviceId},
</if>
<if
test=
"createBy != null"
>
create_by = #{createBy},
</if>
<if
test=
"createTime != null"
>
create_time = #{createTime},
</if>
<if
test=
"updateBy != null"
>
update_by = #{updateBy},
</if>
<if
test=
"updateTime != null"
>
update_time = #{updateTime},
</if>
<if
test=
"remark != null"
>
remark = #{remark},
</if>
</trim>
where id = #{id}
</update>
<delete
id=
"deleteRoomDeviceById"
parameterType=
"Long"
>
delete
from s_room_device
where id = #{id}
</delete>
<delete
id=
"deleteRoomDeviceByIds"
parameterType=
"String"
>
delete from s_room_device where id in
<foreach
item=
"id"
collection=
"array"
open=
"("
separator=
","
close=
")"
>
#{id}
</foreach>
</delete>
</mapper>
\ No newline at end of file
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