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
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;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
share.common.core.domain.R
;
import
share.system.domain.vo.TuangouReceiptPrepareResponseEntityVo
;
import
share.system.service.QPService
;
import
java.util.List
;
...
...
@@ -32,7 +33,7 @@ public class QPController {
//撤销验券接口
@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
));
}
...
...
@@ -44,13 +45,13 @@ public class QPController {
//用户验券接口
@GetMapping
(
"/consumeByUser"
)
public
R
<
String
>
consumeByUser
(
String
code
,
int
count
)
{
return
R
.
ok
(
qpService
.
consumeByUser
(
code
,
count
));
public
R
<
TuangouReceiptPrepareResponseEntityVo
>
consumeByUser
(
String
code
)
{
return
R
.
ok
(
qpService
.
consumeByUser
(
code
));
}
//用户销券接口
@GetMapping
(
"/reverseconsumeByUser"
)
public
R
<
String
>
reverseconsumeByUser
(
Long
id
)
{
public
R
<
List
<
TuangouReceiptReverseConsumeResponseEntity
>
>
reverseconsumeByUser
(
Long
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
private
String
packIds
;
/**
* 设备ID
*/
@TableField
(
exist
=
false
)
private
String
deviceIds
;
/**
* 套餐集合
*/
@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>
*/
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
;
import
com.dianping.openapi.sdk.api.tuangou.entity.*
;
import
share.
common.core.domain.R
;
import
share.
system.domain.vo.TuangouReceiptPrepareResponseEntityVo
;
import
java.util.List
;
...
...
@@ -10,13 +10,13 @@ public interface QPService {
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
);
String
consumeByUser
(
String
code
,
int
count
);
TuangouReceiptPrepareResponseEntityVo
consumeByUser
(
String
code
);
String
reverseconsumeByUser
(
Long
id
);
List
<
TuangouReceiptReverseConsumeResponseEntity
>
reverseconsumeByUser
(
Long
id
);
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;
import
java.util.List
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
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.common.utils.SecurityUtils
;
import
share.system.domain.SPack
;
import
share.system.mapper.DeviceMapper
;
import
share.system.domain.Device
;
import
share.system.service.DeviceService
;
...
...
@@ -104,4 +106,11 @@ public class DeviceServiceImpl extends ServiceImpl<DeviceMapper, Device> impleme
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.*;
import
com.dianping.openapi.sdk.api.tuangou.entity.*
;
import
com.dianping.openapi.sdk.httpclient.DefaultOpenAPIClient
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Service
;
...
...
@@ -21,9 +22,12 @@ import share.system.domain.SConsumer;
import
share.system.domain.SConsumerCoupon
;
import
share.system.domain.SCoupon
;
import
share.system.domain.vo.FrontTokenComponent
;
import
share.system.domain.vo.TuangouReceiptPrepareResponseEntityVo
;
import
share.system.service.ISConsumerCouponService
;
import
share.system.service.ISCouponService
;
import
share.system.service.QPService
;
import
java.text.SimpleDateFormat
;
import
java.util.*
;
@Service
...
...
@@ -46,7 +50,7 @@ public class QPServiceImpl implements QPService {
* 用户验卷接口
*/
@Override
public
String
consumeByUser
(
String
code
,
int
count
)
{
public
TuangouReceiptPrepareResponseEntityVo
consumeByUser
(
String
code
)
{
//验券准备
TuangouReceiptPrepareResponseEntity
prepare
=
prepare
(
code
);
SCoupon
sCoupon
=
isCouponService
.
selectSCouponByName
(
prepare
.
getDeal_title
());
...
...
@@ -54,15 +58,15 @@ public class QPServiceImpl implements QPService {
throw
new
RuntimeException
(
"未找到对应的优惠券"
);
}
//执行验券
List
<
TuangouReceiptConsumeResponseEntity
>
consume
=
consume
(
code
,
count
);
consume
.
forEach
(
item
->
{
//
List<TuangouReceiptConsumeResponseEntity> consume = consume(code, count);
//
consume.forEach(item -> {
SConsumer
user
=
FrontTokenComponent
.
getWxSConsumerEntry
();
SConsumerCoupon
sConsumerCoupon
=
new
SConsumerCoupon
();
sConsumerCoupon
.
setConsumerId
(
user
.
getId
());
//取订单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
.
setName
(
item
.
getDeal_title
());
sConsumerCoupon
.
setName
(
prepare
.
getDeal_title
());
sConsumerCoupon
.
setCouponType
(
sCoupon
.
getCouponType
());
sConsumerCoupon
.
setStoreType
(
sCoupon
.
getStoreType
());
sConsumerCoupon
.
setRoomType
(
sCoupon
.
getRoomType
());
...
...
@@ -74,17 +78,23 @@ public class QPServiceImpl implements QPService {
sConsumerCoupon
.
setSourceType
(
SourceTypeEnum
.
CHECK
.
getCode
());
sConsumerCoupon
.
setPlatformType
(
PlatformTypeEnum
.
MEITUAN
.
getCode
());
sConsumerCoupon
.
setStartDate
(
sCoupon
.
getStartDate
());
sConsumerCoupon
.
setEndDate
(
item
.
getReceiptEndDate
());
sConsumerCoupon
.
setEndDate
(
prepare
.
getReceiptEndDate
());
sConsumerCoupon
.
setCouponTimeStart
(
sCoupon
.
getValidStartTime
());
sConsumerCoupon
.
setCouponTimeEnd
(
sCoupon
.
getValidEndTime
());
sConsumerCoupon
.
setCreateBy
(
String
.
valueOf
(
user
.
getId
()));
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
public
String
reverseconsumeByUser
(
Long
id
)
{
public
List
<
TuangouReceiptReverseConsumeResponseEntity
>
reverseconsumeByUser
(
Long
id
)
{
SConsumerCoupon
byId
=
isConsumerCouponService
.
getById
(
id
);
if
(
byId
==
null
)
{
throw
new
RuntimeException
(
"未找到对应的券码"
);
...
...
@@ -94,14 +104,16 @@ public class QPServiceImpl implements QPService {
}
TuangouReceiptGetConsumedReponseEntity
getconsumed
=
getconsumed
(
byId
.
getCouponCode
());
if
(
getconsumed
==
null
)
{
throw
new
RuntimeException
(
"未找到对应的券码"
);
}
List
<
TuangouReceiptReverseConsumeResponseEntity
>
reverseconsume
=
reverseconsume
(
byId
.
getCouponCode
(),
getconsumed
.
getApp_shop_id
());
if
(
reverseconsume
==
null
)
{
throw
new
RuntimeException
(
"未找到对应的券码"
);
isConsumerCouponService
.
removeById
(
id
);
}
else
{
List
<
TuangouReceiptReverseConsumeResponseEntity
>
reverseconsume
=
reverseconsume
(
byId
.
getCouponCode
(),
byId
.
getCouponId
());
if
(
reverseconsume
==
null
)
{
throw
new
RuntimeException
(
"未找到对应的券码"
);
}
isConsumerCouponService
.
removeById
(
id
);
return
reverseconsume
;
}
isConsumerCouponService
.
removeById
(
id
);
return
"销卷成功"
;
return
null
;
}
/**
...
...
@@ -110,7 +122,7 @@ public class QPServiceImpl implements QPService {
*/
@Override
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
);
DefaultOpenAPIClient
client
=
new
DefaultOpenAPIClient
();
TuangouReceiptPrepareResponse
invoke
=
client
.
invoke
(
tuangouReceiptPrepare
);
...
...
@@ -126,14 +138,11 @@ public class QPServiceImpl implements QPService {
*/
@Override
public
List
<
TuangouReceiptConsumeResponseEntity
>
consume
(
String
code
,
int
count
)
{
//商家在自研系统或第三方服务商系统内登录的帐号
String
app_shop_account
=
"app_shop_account"
;
//自研系统或第三方服务商系统内登陆的用户名
String
app_shop_accountname
=
"app_shop_accountname"
;
SConsumer
user
=
FrontTokenComponent
.
getWxSConsumerEntry
();
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
,
app_shop_account
,
app_shop_accountname
);
user
.
getAccount
(),
user
.
getNickName
()
);
DefaultOpenAPIClient
openAPIClient
=
new
DefaultOpenAPIClient
();
TuangouReceiptConsume
tuangouReceiptConsume
=
new
TuangouReceiptConsume
(
request
);
TuangouReceiptConsumeResponse
invoke
=
openAPIClient
.
invoke
(
tuangouReceiptConsume
);
...
...
@@ -148,10 +157,11 @@ public class QPServiceImpl implements QPService {
* 撤销已经核销的券码(只可撤销当天核销且未超过10分钟的团购券)
*/
@Override
public
List
<
TuangouReceiptReverseConsumeResponseEntity
>
reverseconsume
(
String
code
,
String
appDealId
)
{
TuangouReceiptReverseConsumeRequest
tuangouReceiptReverseConsumeRequest
=
new
TuangouReceiptReverseConsumeRequest
(
APP_KEY
,
APP_SECRET
,
"session"
,
appDealId
,
code
,
OPEN_SHOP_UUID
,
"app_shop_account"
,
"app_shop_accountname"
);
public
List
<
TuangouReceiptReverseConsumeResponseEntity
>
reverseconsume
(
String
code
,
Long
appDealId
)
{
SConsumer
user
=
FrontTokenComponent
.
getWxSConsumerEntry
();
TuangouReceiptReverseConsumeRequest
tuangouReceiptReverseConsumeRequest
=
new
TuangouReceiptReverseConsumeRequest
(
APP_KEY
,
APP_SECRET
,
"04bdcb2ccac3075eac0f60680587be2138c6c362"
,
String
.
valueOf
(
appDealId
),
code
,
OPEN_SHOP_UUID
,
user
.
getAccount
(),
user
.
getNickName
());
DefaultOpenAPIClient
openAPIClient
=
new
DefaultOpenAPIClient
();
TuangouReceiptReverseConsume
tuangouReceiptReverseConsume
=
new
TuangouReceiptReverseConsume
(
tuangouReceiptReverseConsumeRequest
);
TuangouReceiptReverseConsumeResponse
response
=
openAPIClient
.
invoke
(
tuangouReceiptReverseConsume
);
...
...
@@ -169,7 +179,7 @@ public class QPServiceImpl implements QPService {
public
TuangouReceiptGetConsumedReponseEntity
getconsumed
(
String
code
)
{
DefaultOpenAPIClient
openAPIClient
=
new
DefaultOpenAPIClient
();
TuangouReceiptGetConsumedRequest
request
=
new
TuangouReceiptGetConsumedRequest
(
APP_KEY
,
APP_SECRET
,
"
7bd6cc83aecf6fe937d4cd774e1682aeb87773ad
"
,
code
,
OPEN_SHOP_UUID
);
"
04bdcb2ccac3075eac0f60680587be2138c6c362
"
,
code
,
OPEN_SHOP_UUID
);
TuangouReceiptGetConsumed
tuangouReceiptGetConsumed
=
new
TuangouReceiptGetConsumed
(
request
);
TuangouReceiptGetConsumedReponse
response
=
openAPIClient
.
invoke
(
tuangouReceiptGetConsumed
);
if
(
response
.
getCode
()
!=
200
)
{
...
...
@@ -182,7 +192,7 @@ public class QPServiceImpl implements QPService {
public
String
oauthToken
(
String
authCode
)
{
DefaultOpenAPIClient
openAPIClient
=
new
DefaultOpenAPIClient
();
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
);
DynamicTokenResponse
response
=
openAPIClient
.
invoke
(
dynamicToken
);
if
(
response
.
getRemain_refresh_count
()
==
0
)
{
...
...
@@ -200,7 +210,7 @@ public class QPServiceImpl implements QPService {
* @param app_shop_id
*/
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
);
TuangouDealQueryShopDealResponse
response
=
openAPIClient
.
invoke
(
tuangouDealQueryShopDeal
);
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,27 +11,20 @@ import share.common.enums.RoleTypeEnum;
import
share.common.utils.DateUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
share.system.domain.SPack
;
import
share.system.domain.SRoomPack
;
import
share.system.domain.SConsumer
;
import
share.system.domain.*
;
import
share.system.domain.vo.FrontTokenComponent
;
import
share.system.domain.vo.SRoomVo
;
import
share.system.mapper.SRoomMapper
;
import
share.system.domain.SRoom
;
import
share.system.service.IPackService
;
import
share.system.service.IRoomPackService
;
import
share.system.service.ISRoomService
;
import
share.system.service.ISStoreService
;
import
share.system.service.*
;
/**
* 房间Service业务层处理
*
*
* @author ruoyi
* @date 2023-09-27
*/
@Service
public
class
SRoomServiceImpl
extends
ServiceImpl
<
SRoomMapper
,
SRoom
>
implements
ISRoomService
{
public
class
SRoomServiceImpl
extends
ServiceImpl
<
SRoomMapper
,
SRoom
>
implements
ISRoomService
{
@Autowired
private
SRoomMapper
sRoomMapper
;
...
...
@@ -44,32 +37,38 @@ public class SRoomServiceImpl extends ServiceImpl<SRoomMapper,SRoom> implements
@Autowired
private
IRoomPackService
roomPackService
;
@Autowired
private
DeviceService
deviceService
;
@Autowired
public
RoomDeviceService
roomDeviceService
;
/**
* 查询房间
*
*
* @param id 房间主键
* @return 房间
*/
@Override
public
SRoomVo
selectSRoomById
(
Long
id
)
{
public
SRoomVo
selectSRoomById
(
Long
id
)
{
SRoom
sRoom
=
sRoomMapper
.
selectSRoomById
(
id
);
sRoom
.
setPackIds
(
roomPackService
.
selectPackListByRoomId
(
id
).
stream
().
map
(
String:
:
valueOf
).
collect
(
Collectors
.
joining
(
","
)));
if
(
Objects
.
nonNull
(
sRoom
)&&
sRoom
.
getId
()!=
null
){
return
convertVoList
(
new
ArrayList
<
SRoom
>(){{
add
(
sRoom
);}}).
get
(
0
);
if
(
Objects
.
nonNull
(
sRoom
)
&&
sRoom
.
getId
()
!=
null
)
{
return
convertVoList
(
new
ArrayList
<
SRoom
>()
{{
add
(
sRoom
);
}}).
get
(
0
);
}
return
new
SRoomVo
();
}
/**
* 查询房间列表
*
*
* @param sRoom 房间
* @return 房间
*/
@Override
public
List
<
SRoomVo
>
selectSRoomList
(
SRoom
sRoom
)
{
public
List
<
SRoomVo
>
selectSRoomList
(
SRoom
sRoom
)
{
List
<
SRoom
>
roomList
=
sRoomMapper
.
selectSRoomList
(
sRoom
);
roomList
.
forEach
(
o
->
{
List
<
Long
>
roomId
=
roomPackService
.
selectPackListByRoomId
(
o
.
getId
());
...
...
@@ -79,17 +78,17 @@ public class SRoomServiceImpl extends ServiceImpl<SRoomMapper,SRoom> implements
return
convertVoList
(
roomList
);
}
private
List
<
SRoomVo
>
convertVoList
(
List
<
SRoom
>
roomList
){
private
List
<
SRoomVo
>
convertVoList
(
List
<
SRoom
>
roomList
)
{
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
<
Map
>
storeList
=
sStoreService
.
optionList
(
storeIds
);
roomList
.
stream
().
forEach
(
sRoom
->
{
SRoomVo
vo
=
new
SRoomVo
();
BeanUtils
.
copyProperties
(
sRoom
,
vo
);
storeList
.
stream
().
forEach
(
store
->
{
if
(
vo
.
getStoreId
().
compareTo
(
Long
.
parseLong
(
store
.
get
(
"id"
).
toString
()))
==
0
)
{
vo
.
setStoreName
(
store
.
getOrDefault
(
"name"
,
""
).
toString
());
if
(
vo
.
getStoreId
().
compareTo
(
Long
.
parseLong
(
store
.
get
(
"id"
).
toString
()))
==
0
)
{
vo
.
setStoreName
(
store
.
getOrDefault
(
"name"
,
""
).
toString
());
}
});
voList
.
add
(
vo
);
...
...
@@ -100,13 +99,12 @@ public class SRoomServiceImpl extends ServiceImpl<SRoomMapper,SRoom> implements
/**
* 新增房间
*
*
* @param sRoom 房间
* @return 结果
*/
@Override
public
int
insertSRoom
(
SRoom
sRoom
)
{
public
int
insertSRoom
(
SRoom
sRoom
)
{
int
i
=
0
;
try
{
sRoom
.
setCreateTime
(
DateUtils
.
getNowDate
());
...
...
@@ -129,6 +127,23 @@ public class SRoomServiceImpl extends ServiceImpl<SRoomMapper,SRoom> implements
});
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
)
{
throw
new
RuntimeException
(
"新增房间失败"
);
}
...
...
@@ -137,13 +152,12 @@ public class SRoomServiceImpl extends ServiceImpl<SRoomMapper,SRoom> implements
/**
* 修改房间
*
*
* @param sRoom 房间
* @return 结果
*/
@Override
public
int
updateSRoom
(
SRoom
sRoom
)
{
public
int
updateSRoom
(
SRoom
sRoom
)
{
//判断套餐ID
if
(!
sRoom
.
getPackIds
().
isEmpty
())
{
//判断套餐ID
...
...
@@ -170,33 +184,31 @@ public class SRoomServiceImpl extends ServiceImpl<SRoomMapper,SRoom> implements
/**
* 批量删除房间
*
*
* @param ids 需要删除的房间主键
* @return 结果
*/
@Override
public
int
deleteSRoomByIds
(
Long
[]
ids
)
{
public
int
deleteSRoomByIds
(
Long
[]
ids
)
{
roomPackService
.
deleteRoomPackByIds
(
ids
);
return
sRoomMapper
.
deleteSRoomByIds
(
ids
);
}
/**
* 删除房间信息
*
*
* @param id 房间主键
* @return 结果
*/
@Override
public
int
deleteSRoomById
(
Long
id
)
{
public
int
deleteSRoomById
(
Long
id
)
{
return
sRoomMapper
.
deleteSRoomById
(
id
);
}
@Override
public
List
<
SRoomVo
>
listByStoreIds
(
List
<
Long
>
storeIds
)
{
LambdaQueryWrapper
<
SRoom
>
queryWrapper
=
new
LambdaQueryWrapper
();
queryWrapper
.
in
(
SRoom:
:
getStoreId
,
storeIds
);
queryWrapper
.
in
(
SRoom:
:
getStoreId
,
storeIds
);
List
<
SRoom
>
roomList
=
sRoomMapper
.
selectList
(
queryWrapper
);
return
convertDoListToVoList
(
roomList
);
}
...
...
@@ -224,13 +236,13 @@ public class SRoomServiceImpl extends ServiceImpl<SRoomMapper,SRoom> implements
throw
new
RuntimeException
(
"当前用户不是保洁人员"
);
}
SRoom
room
=
sRoomMapper
.
selectById
(
id
);
if
(
Objects
.
isNull
(
room
))
{
if
(
Objects
.
isNull
(
room
))
{
throw
new
RuntimeException
(
"房间不存在"
);
}
//TODO 调用开门接口
if
(
true
)
{
if
(
true
)
{
return
"开门成功"
;
}
else
{
}
else
{
return
"开门失败"
;
}
}
...
...
@@ -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
<>();
if
(
CollectionUtils
.
isNotEmpty
(
roomList
))
{
roomList
.
stream
().
forEach
(
o
->
{
if
(
CollectionUtils
.
isNotEmpty
(
roomList
))
{
roomList
.
stream
().
forEach
(
o
->
{
SRoomVo
vo
=
new
SRoomVo
();
BeanUtils
.
copyProperties
(
o
,
vo
);
BeanUtils
.
copyProperties
(
o
,
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