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
Show whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
574 additions
and
71 deletions
+574
-71
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
+37
-27
RoomDeviceServiceImpl.java
...java/share/system/service/impl/RoomDeviceServiceImpl.java
+91
-0
SRoomServiceImpl.java
...main/java/share/system/service/impl/SRoomServiceImpl.java
+48
-36
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
...
@@ -12,6 +12,7 @@ import com.dianping.openapi.sdk.api.tuangou.*;
...
@@ -12,6 +12,7 @@ import com.dianping.openapi.sdk.api.tuangou.*;
import
com.dianping.openapi.sdk.api.tuangou.entity.*
;
import
com.dianping.openapi.sdk.api.tuangou.entity.*
;
import
com.dianping.openapi.sdk.httpclient.DefaultOpenAPIClient
;
import
com.dianping.openapi.sdk.httpclient.DefaultOpenAPIClient
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
...
@@ -21,9 +22,12 @@ import share.system.domain.SConsumer;
...
@@ -21,9 +22,12 @@ import share.system.domain.SConsumer;
import
share.system.domain.SConsumerCoupon
;
import
share.system.domain.SConsumerCoupon
;
import
share.system.domain.SCoupon
;
import
share.system.domain.SCoupon
;
import
share.system.domain.vo.FrontTokenComponent
;
import
share.system.domain.vo.FrontTokenComponent
;
import
share.system.domain.vo.TuangouReceiptPrepareResponseEntityVo
;
import
share.system.service.ISConsumerCouponService
;
import
share.system.service.ISConsumerCouponService
;
import
share.system.service.ISCouponService
;
import
share.system.service.ISCouponService
;
import
share.system.service.QPService
;
import
share.system.service.QPService
;
import
java.text.SimpleDateFormat
;
import
java.util.*
;
import
java.util.*
;
@Service
@Service
...
@@ -46,7 +50,7 @@ public class QPServiceImpl implements QPService {
...
@@ -46,7 +50,7 @@ public class QPServiceImpl implements QPService {
* 用户验卷接口
* 用户验卷接口
*/
*/
@Override
@Override
public
String
consumeByUser
(
String
code
,
int
count
)
{
public
TuangouReceiptPrepareResponseEntityVo
consumeByUser
(
String
code
)
{
//验券准备
//验券准备
TuangouReceiptPrepareResponseEntity
prepare
=
prepare
(
code
);
TuangouReceiptPrepareResponseEntity
prepare
=
prepare
(
code
);
SCoupon
sCoupon
=
isCouponService
.
selectSCouponByName
(
prepare
.
getDeal_title
());
SCoupon
sCoupon
=
isCouponService
.
selectSCouponByName
(
prepare
.
getDeal_title
());
...
@@ -54,15 +58,15 @@ public class QPServiceImpl implements QPService {
...
@@ -54,15 +58,15 @@ public class QPServiceImpl implements QPService {
throw
new
RuntimeException
(
"未找到对应的优惠券"
);
throw
new
RuntimeException
(
"未找到对应的优惠券"
);
}
}
//执行验券
//执行验券
List
<
TuangouReceiptConsumeResponseEntity
>
consume
=
consume
(
code
,
count
);
//
List<TuangouReceiptConsumeResponseEntity> consume = consume(code, count);
consume
.
forEach
(
item
->
{
//
consume.forEach(item -> {
SConsumer
user
=
FrontTokenComponent
.
getWxSConsumerEntry
();
SConsumer
user
=
FrontTokenComponent
.
getWxSConsumerEntry
();
SConsumerCoupon
sConsumerCoupon
=
new
SConsumerCoupon
();
SConsumerCoupon
sConsumerCoupon
=
new
SConsumerCoupon
();
sConsumerCoupon
.
setConsumerId
(
user
.
getId
());
sConsumerCoupon
.
setConsumerId
(
user
.
getId
());
//取订单ID,如果为空,则取套餐ID
//取订单ID,如果为空,则取套餐ID
sConsumerCoupon
.
setCouponId
(
Long
.
valueOf
(
item
.
getOrder_id
())
!=
null
?
Long
.
valueOf
(
item
.
getOrder_id
())
:
item
.
getDeal_id
());
sConsumerCoupon
.
setCouponId
(
prepare
.
getDeal_id
());
sConsumerCoupon
.
setCouponCode
(
code
);
sConsumerCoupon
.
setCouponCode
(
code
);
sConsumerCoupon
.
setName
(
item
.
getDeal_title
());
sConsumerCoupon
.
setName
(
prepare
.
getDeal_title
());
sConsumerCoupon
.
setCouponType
(
sCoupon
.
getCouponType
());
sConsumerCoupon
.
setCouponType
(
sCoupon
.
getCouponType
());
sConsumerCoupon
.
setStoreType
(
sCoupon
.
getStoreType
());
sConsumerCoupon
.
setStoreType
(
sCoupon
.
getStoreType
());
sConsumerCoupon
.
setRoomType
(
sCoupon
.
getRoomType
());
sConsumerCoupon
.
setRoomType
(
sCoupon
.
getRoomType
());
...
@@ -74,17 +78,23 @@ public class QPServiceImpl implements QPService {
...
@@ -74,17 +78,23 @@ public class QPServiceImpl implements QPService {
sConsumerCoupon
.
setSourceType
(
SourceTypeEnum
.
CHECK
.
getCode
());
sConsumerCoupon
.
setSourceType
(
SourceTypeEnum
.
CHECK
.
getCode
());
sConsumerCoupon
.
setPlatformType
(
PlatformTypeEnum
.
MEITUAN
.
getCode
());
sConsumerCoupon
.
setPlatformType
(
PlatformTypeEnum
.
MEITUAN
.
getCode
());
sConsumerCoupon
.
setStartDate
(
sCoupon
.
getStartDate
());
sConsumerCoupon
.
setStartDate
(
sCoupon
.
getStartDate
());
sConsumerCoupon
.
setEndDate
(
item
.
getReceiptEndDate
());
sConsumerCoupon
.
setEndDate
(
prepare
.
getReceiptEndDate
());
sConsumerCoupon
.
setCouponTimeStart
(
sCoupon
.
getValidStartTime
());
sConsumerCoupon
.
setCouponTimeStart
(
sCoupon
.
getValidStartTime
());
sConsumerCoupon
.
setCouponTimeEnd
(
sCoupon
.
getValidEndTime
());
sConsumerCoupon
.
setCouponTimeEnd
(
sCoupon
.
getValidEndTime
());
sConsumerCoupon
.
setCreateBy
(
String
.
valueOf
(
user
.
getId
()));
sConsumerCoupon
.
setCreateBy
(
String
.
valueOf
(
user
.
getId
()));
isConsumerCouponService
.
insertSConsumerCoupon
(
sConsumerCoupon
);
isConsumerCouponService
.
insertSConsumerCoupon
(
sConsumerCoupon
);
});
// });
return
"验券成功"
;
SimpleDateFormat
format2
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
String
output1
=
format2
.
format
(
prepare
.
getReceiptEndDate
());
TuangouReceiptPrepareResponseEntityVo
response
=
new
TuangouReceiptPrepareResponseEntityVo
();
BeanUtils
.
copyProperties
(
prepare
,
response
);
response
.
setExpirationTime
(
output1
);
return
response
;
}
}
@Override
@Override
public
String
reverseconsumeByUser
(
Long
id
)
{
public
List
<
TuangouReceiptReverseConsumeResponseEntity
>
reverseconsumeByUser
(
Long
id
)
{
SConsumerCoupon
byId
=
isConsumerCouponService
.
getById
(
id
);
SConsumerCoupon
byId
=
isConsumerCouponService
.
getById
(
id
);
if
(
byId
==
null
)
{
if
(
byId
==
null
)
{
throw
new
RuntimeException
(
"未找到对应的券码"
);
throw
new
RuntimeException
(
"未找到对应的券码"
);
...
@@ -94,14 +104,16 @@ public class QPServiceImpl implements QPService {
...
@@ -94,14 +104,16 @@ public class QPServiceImpl implements QPService {
}
}
TuangouReceiptGetConsumedReponseEntity
getconsumed
=
getconsumed
(
byId
.
getCouponCode
());
TuangouReceiptGetConsumedReponseEntity
getconsumed
=
getconsumed
(
byId
.
getCouponCode
());
if
(
getconsumed
==
null
)
{
if
(
getconsumed
==
null
)
{
throw
new
RuntimeException
(
"未找到对应的券码"
);
isConsumerCouponService
.
removeById
(
id
);
}
}
else
{
List
<
TuangouReceiptReverseConsumeResponseEntity
>
reverseconsume
=
reverseconsume
(
byId
.
getCouponCode
(),
getconsumed
.
getApp_shop_i
d
());
List
<
TuangouReceiptReverseConsumeResponseEntity
>
reverseconsume
=
reverseconsume
(
byId
.
getCouponCode
(),
byId
.
getCouponI
d
());
if
(
reverseconsume
==
null
)
{
if
(
reverseconsume
==
null
)
{
throw
new
RuntimeException
(
"未找到对应的券码"
);
throw
new
RuntimeException
(
"未找到对应的券码"
);
}
}
isConsumerCouponService
.
removeById
(
id
);
isConsumerCouponService
.
removeById
(
id
);
return
"销卷成功"
;
return
reverseconsume
;
}
return
null
;
}
}
/**
/**
...
@@ -110,7 +122,7 @@ public class QPServiceImpl implements QPService {
...
@@ -110,7 +122,7 @@ public class QPServiceImpl implements QPService {
*/
*/
@Override
@Override
public
TuangouReceiptPrepareResponseEntity
prepare
(
String
code
)
{
public
TuangouReceiptPrepareResponseEntity
prepare
(
String
code
)
{
TuangouReceiptPrepareRequest
request
=
new
TuangouReceiptPrepareRequest
(
APP_KEY
,
APP_SECRET
,
"
session"
,
code
,
OPEN_SHOP_UUID
);
TuangouReceiptPrepareRequest
request
=
new
TuangouReceiptPrepareRequest
(
APP_KEY
,
APP_SECRET
,
"
04bdcb2ccac3075eac0f60680587be2138c6c362"
,
code
,
""
,
OPEN_SHOP_UUID
);
TuangouReceiptPrepare
tuangouReceiptPrepare
=
new
TuangouReceiptPrepare
(
request
);
TuangouReceiptPrepare
tuangouReceiptPrepare
=
new
TuangouReceiptPrepare
(
request
);
DefaultOpenAPIClient
client
=
new
DefaultOpenAPIClient
();
DefaultOpenAPIClient
client
=
new
DefaultOpenAPIClient
();
TuangouReceiptPrepareResponse
invoke
=
client
.
invoke
(
tuangouReceiptPrepare
);
TuangouReceiptPrepareResponse
invoke
=
client
.
invoke
(
tuangouReceiptPrepare
);
...
@@ -126,14 +138,11 @@ public class QPServiceImpl implements QPService {
...
@@ -126,14 +138,11 @@ public class QPServiceImpl implements QPService {
*/
*/
@Override
@Override
public
List
<
TuangouReceiptConsumeResponseEntity
>
consume
(
String
code
,
int
count
)
{
public
List
<
TuangouReceiptConsumeResponseEntity
>
consume
(
String
code
,
int
count
)
{
//商家在自研系统或第三方服务商系统内登录的帐号
SConsumer
user
=
FrontTokenComponent
.
getWxSConsumerEntry
();
String
app_shop_account
=
"app_shop_account"
;
//自研系统或第三方服务商系统内登陆的用户名
String
app_shop_accountname
=
"app_shop_accountname"
;
String
requestid
=
UUID
.
randomUUID
().
toString
();
String
requestid
=
UUID
.
randomUUID
().
toString
();
TuangouReceiptConsumeRequest
request
=
new
TuangouReceiptConsumeRequest
(
APP_KEY
,
APP_SECRET
,
"
session
"
,
TuangouReceiptConsumeRequest
request
=
new
TuangouReceiptConsumeRequest
(
APP_KEY
,
APP_SECRET
,
"
04bdcb2ccac3075eac0f60680587be2138c6c362
"
,
requestid
,
code
,
count
,
OPEN_SHOP_UUID
,
requestid
,
code
,
count
,
OPEN_SHOP_UUID
,
app_shop_account
,
app_shop_accountname
);
user
.
getAccount
(),
user
.
getNickName
()
);
DefaultOpenAPIClient
openAPIClient
=
new
DefaultOpenAPIClient
();
DefaultOpenAPIClient
openAPIClient
=
new
DefaultOpenAPIClient
();
TuangouReceiptConsume
tuangouReceiptConsume
=
new
TuangouReceiptConsume
(
request
);
TuangouReceiptConsume
tuangouReceiptConsume
=
new
TuangouReceiptConsume
(
request
);
TuangouReceiptConsumeResponse
invoke
=
openAPIClient
.
invoke
(
tuangouReceiptConsume
);
TuangouReceiptConsumeResponse
invoke
=
openAPIClient
.
invoke
(
tuangouReceiptConsume
);
...
@@ -148,10 +157,11 @@ public class QPServiceImpl implements QPService {
...
@@ -148,10 +157,11 @@ public class QPServiceImpl implements QPService {
* 撤销已经核销的券码(只可撤销当天核销且未超过10分钟的团购券)
* 撤销已经核销的券码(只可撤销当天核销且未超过10分钟的团购券)
*/
*/
@Override
@Override
public
List
<
TuangouReceiptReverseConsumeResponseEntity
>
reverseconsume
(
String
code
,
String
appDealId
)
{
public
List
<
TuangouReceiptReverseConsumeResponseEntity
>
reverseconsume
(
String
code
,
Long
appDealId
)
{
TuangouReceiptReverseConsumeRequest
tuangouReceiptReverseConsumeRequest
=
new
TuangouReceiptReverseConsumeRequest
(
APP_KEY
,
APP_SECRET
,
"session"
,
SConsumer
user
=
FrontTokenComponent
.
getWxSConsumerEntry
();
appDealId
,
code
,
OPEN_SHOP_UUID
,
TuangouReceiptReverseConsumeRequest
tuangouReceiptReverseConsumeRequest
=
new
TuangouReceiptReverseConsumeRequest
(
APP_KEY
,
APP_SECRET
,
"04bdcb2ccac3075eac0f60680587be2138c6c362"
,
"app_shop_account"
,
"app_shop_accountname"
);
String
.
valueOf
(
appDealId
),
code
,
OPEN_SHOP_UUID
,
user
.
getAccount
(),
user
.
getNickName
());
DefaultOpenAPIClient
openAPIClient
=
new
DefaultOpenAPIClient
();
DefaultOpenAPIClient
openAPIClient
=
new
DefaultOpenAPIClient
();
TuangouReceiptReverseConsume
tuangouReceiptReverseConsume
=
new
TuangouReceiptReverseConsume
(
tuangouReceiptReverseConsumeRequest
);
TuangouReceiptReverseConsume
tuangouReceiptReverseConsume
=
new
TuangouReceiptReverseConsume
(
tuangouReceiptReverseConsumeRequest
);
TuangouReceiptReverseConsumeResponse
response
=
openAPIClient
.
invoke
(
tuangouReceiptReverseConsume
);
TuangouReceiptReverseConsumeResponse
response
=
openAPIClient
.
invoke
(
tuangouReceiptReverseConsume
);
...
@@ -169,7 +179,7 @@ public class QPServiceImpl implements QPService {
...
@@ -169,7 +179,7 @@ public class QPServiceImpl implements QPService {
public
TuangouReceiptGetConsumedReponseEntity
getconsumed
(
String
code
)
{
public
TuangouReceiptGetConsumedReponseEntity
getconsumed
(
String
code
)
{
DefaultOpenAPIClient
openAPIClient
=
new
DefaultOpenAPIClient
();
DefaultOpenAPIClient
openAPIClient
=
new
DefaultOpenAPIClient
();
TuangouReceiptGetConsumedRequest
request
=
new
TuangouReceiptGetConsumedRequest
(
APP_KEY
,
APP_SECRET
,
TuangouReceiptGetConsumedRequest
request
=
new
TuangouReceiptGetConsumedRequest
(
APP_KEY
,
APP_SECRET
,
"
7bd6cc83aecf6fe937d4cd774e1682aeb87773ad
"
,
code
,
OPEN_SHOP_UUID
);
"
04bdcb2ccac3075eac0f60680587be2138c6c362
"
,
code
,
OPEN_SHOP_UUID
);
TuangouReceiptGetConsumed
tuangouReceiptGetConsumed
=
new
TuangouReceiptGetConsumed
(
request
);
TuangouReceiptGetConsumed
tuangouReceiptGetConsumed
=
new
TuangouReceiptGetConsumed
(
request
);
TuangouReceiptGetConsumedReponse
response
=
openAPIClient
.
invoke
(
tuangouReceiptGetConsumed
);
TuangouReceiptGetConsumedReponse
response
=
openAPIClient
.
invoke
(
tuangouReceiptGetConsumed
);
if
(
response
.
getCode
()
!=
200
)
{
if
(
response
.
getCode
()
!=
200
)
{
...
@@ -182,7 +192,7 @@ public class QPServiceImpl implements QPService {
...
@@ -182,7 +192,7 @@ public class QPServiceImpl implements QPService {
public
String
oauthToken
(
String
authCode
)
{
public
String
oauthToken
(
String
authCode
)
{
DefaultOpenAPIClient
openAPIClient
=
new
DefaultOpenAPIClient
();
DefaultOpenAPIClient
openAPIClient
=
new
DefaultOpenAPIClient
();
DynamicTokenRequest
request
=
new
DynamicTokenRequest
(
APP_KEY
,
DynamicTokenRequest
request
=
new
DynamicTokenRequest
(
APP_KEY
,
APP_SECRET
,
GrantType
.
AUTHORIZATION_CODE
.
getValue
(),
authCode
);
APP_SECRET
,
GrantType
.
AUTHORIZATION_CODE
.
getValue
(),
"6be3e11e19d0b3595046cc2cefbf05da790be35d"
);
DynamicToken
dynamicToken
=
new
DynamicToken
(
request
);
DynamicToken
dynamicToken
=
new
DynamicToken
(
request
);
DynamicTokenResponse
response
=
openAPIClient
.
invoke
(
dynamicToken
);
DynamicTokenResponse
response
=
openAPIClient
.
invoke
(
dynamicToken
);
if
(
response
.
getRemain_refresh_count
()
==
0
)
{
if
(
response
.
getRemain_refresh_count
()
==
0
)
{
...
@@ -200,7 +210,7 @@ public class QPServiceImpl implements QPService {
...
@@ -200,7 +210,7 @@ public class QPServiceImpl implements QPService {
* @param app_shop_id
* @param app_shop_id
*/
*/
DefaultOpenAPIClient
openAPIClient
=
new
DefaultOpenAPIClient
();
DefaultOpenAPIClient
openAPIClient
=
new
DefaultOpenAPIClient
();
TuangouDealQueryShopDealRequest
request
=
new
TuangouDealQueryShopDealRequest
(
APP_KEY
,
APP_SECRET
,
"
session
"
,
OPEN_SHOP_UUID
,
1
,
100
);
TuangouDealQueryShopDealRequest
request
=
new
TuangouDealQueryShopDealRequest
(
APP_KEY
,
APP_SECRET
,
"
04bdcb2ccac3075eac0f60680587be2138c6c362
"
,
OPEN_SHOP_UUID
,
1
,
100
);
TuangouDealQueryShopDeal
tuangouDealQueryShopDeal
=
new
TuangouDealQueryShopDeal
(
request
);
TuangouDealQueryShopDeal
tuangouDealQueryShopDeal
=
new
TuangouDealQueryShopDeal
(
request
);
TuangouDealQueryShopDealResponse
response
=
openAPIClient
.
invoke
(
tuangouDealQueryShopDeal
);
TuangouDealQueryShopDealResponse
response
=
openAPIClient
.
invoke
(
tuangouDealQueryShopDeal
);
if
(
response
.
getCode
()
!=
200
)
{
if
(
response
.
getCode
()
!=
200
)
{
...
...
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,17 +11,11 @@ import share.common.enums.RoleTypeEnum;
...
@@ -11,17 +11,11 @@ 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业务层处理
...
@@ -30,8 +24,7 @@ import share.system.service.ISStoreService;
...
@@ -30,8 +24,7 @@ import share.system.service.ISStoreService;
* @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,6 +37,12 @@ public class SRoomServiceImpl extends ServiceImpl<SRoomMapper,SRoom> implements
...
@@ -44,6 +37,12 @@ public class SRoomServiceImpl extends ServiceImpl<SRoomMapper,SRoom> implements
@Autowired
@Autowired
private
IRoomPackService
roomPackService
;
private
IRoomPackService
roomPackService
;
@Autowired
private
DeviceService
deviceService
;
@Autowired
public
RoomDeviceService
roomDeviceService
;
/**
/**
* 查询房间
* 查询房间
*
*
...
@@ -51,12 +50,13 @@ public class SRoomServiceImpl extends ServiceImpl<SRoomMapper,SRoom> implements
...
@@ -51,12 +50,13 @@ public class SRoomServiceImpl extends ServiceImpl<SRoomMapper,SRoom> implements
* @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
();
}
}
...
@@ -68,8 +68,7 @@ public class SRoomServiceImpl extends ServiceImpl<SRoomMapper,SRoom> implements
...
@@ -68,8 +68,7 @@ public class SRoomServiceImpl extends ServiceImpl<SRoomMapper,SRoom> implements
* @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
);
...
@@ -105,8 +104,7 @@ public class SRoomServiceImpl extends ServiceImpl<SRoomMapper,SRoom> implements
...
@@ -105,8 +104,7 @@ public class SRoomServiceImpl extends ServiceImpl<SRoomMapper,SRoom> implements
* @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
(
"新增房间失败"
);
}
}
...
@@ -142,8 +157,7 @@ public class SRoomServiceImpl extends ServiceImpl<SRoomMapper,SRoom> implements
...
@@ -142,8 +157,7 @@ public class SRoomServiceImpl extends ServiceImpl<SRoomMapper,SRoom> implements
* @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
...
@@ -175,8 +189,7 @@ public class SRoomServiceImpl extends ServiceImpl<SRoomMapper,SRoom> implements
...
@@ -175,8 +189,7 @@ public class SRoomServiceImpl extends ServiceImpl<SRoomMapper,SRoom> implements
* @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
);
}
}
...
@@ -188,15 +201,14 @@ public class SRoomServiceImpl extends ServiceImpl<SRoomMapper,SRoom> implements
...
@@ -188,15 +201,14 @@ public class SRoomServiceImpl extends ServiceImpl<SRoomMapper,SRoom> implements
* @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