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
9b4257b8
Commit
9b4257b8
authored
Nov 09, 2023
by
吕明尚
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
领取记录表增加套餐ID
parent
ae624c7a
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
87 additions
and
32 deletions
+87
-32
DeviceController.java
...in/java/share/web/controller/system/DeviceController.java
+1
-1
DeviceGatewayController.java
.../share/web/controller/system/DeviceGatewayController.java
+3
-2
SOrderController.java
...in/java/share/web/controller/system/SOrderController.java
+2
-2
SConsumerCoupon.java
...em/src/main/java/share/system/domain/SConsumerCoupon.java
+6
-0
DeviceMapper.java
...ystem/src/main/java/share/system/mapper/DeviceMapper.java
+2
-0
DeviceLogService.java
.../src/main/java/share/system/service/DeviceLogService.java
+1
-1
DeviceOpService.java
...m/src/main/java/share/system/service/DeviceOpService.java
+4
-4
DeviceService.java
...tem/src/main/java/share/system/service/DeviceService.java
+2
-0
DeviceLogServiceImpl.java
.../java/share/system/service/impl/DeviceLogServiceImpl.java
+2
-2
DeviceOpServiceImpl.java
...n/java/share/system/service/impl/DeviceOpServiceImpl.java
+12
-12
DeviceServiceImpl.java
...ain/java/share/system/service/impl/DeviceServiceImpl.java
+5
-0
SOrderServiceImpl.java
...ain/java/share/system/service/impl/SOrderServiceImpl.java
+6
-6
SRoomServiceImpl.java
...main/java/share/system/service/impl/SRoomServiceImpl.java
+1
-1
DeviceMapper.xml
...-system/src/main/resources/mapper/system/DeviceMapper.xml
+4
-0
SConsumerCouponMapper.xml
...rc/main/resources/mapper/system/SConsumerCouponMapper.xml
+36
-1
No files found.
share-admin/src/main/java/share/web/controller/system/DeviceController.java
View file @
9b4257b8
...
...
@@ -128,7 +128,7 @@ public class DeviceController extends BaseController
// 发送mqtt消息
mqttGatewayComponent
.
sendToMqtt
(
mqttxVo
.
getTopic
(),
0
,
mqttxVo
.
getPayload
());
// 写日志记录
int
result
=
deviceLogService
.
addDeviceLog
(
mqttxVo
);
int
result
=
deviceLogService
.
addDeviceLog
(
mqttxVo
,
SecurityUtils
.
getUsername
()
);
return
toAjax
(
result
);
}
...
...
share-admin/src/main/java/share/web/controller/system/DeviceGatewayController.java
View file @
9b4257b8
...
...
@@ -16,6 +16,7 @@ import share.common.annotation.Log;
import
share.common.core.controller.BaseController
;
import
share.common.core.domain.AjaxResult
;
import
share.common.enums.BusinessType
;
import
share.common.utils.SecurityUtils
;
import
share.system.domain.DeviceGateway
;
import
share.system.service.DeviceGatewayService
;
import
share.common.utils.poi.ExcelUtil
;
...
...
@@ -113,7 +114,7 @@ public class DeviceGatewayController extends BaseController
@PostMapping
(
value
=
"/clearGatewayDevice"
)
public
AjaxResult
clearGatewayDevice
(
@RequestBody
DeviceGateway
deviceGateway
)
{
deviceOpService
.
clearGatewayDevice
(
deviceGateway
.
getDevId
());
deviceOpService
.
clearGatewayDevice
(
deviceGateway
.
getDevId
()
,
SecurityUtils
.
getUsername
()
);
return
toAjax
(
true
);
}
...
...
@@ -125,7 +126,7 @@ public class DeviceGatewayController extends BaseController
@PostMapping
(
value
=
"/addGatewayDevice"
)
public
AjaxResult
addGatewayDevice
(
@RequestBody
DeviceGateway
deviceGateway
)
{
deviceOpService
.
addGatewayDevice
(
deviceGateway
.
getDevId
());
deviceOpService
.
addGatewayDevice
(
deviceGateway
.
getDevId
()
,
SecurityUtils
.
getUsername
()
);
return
toAjax
(
true
);
}
...
...
share-front/src/main/java/share/web/controller/system/SOrderController.java
View file @
9b4257b8
...
...
@@ -84,8 +84,8 @@ public class SOrderController extends BaseController
* 开门
*/
@ApiOperation
(
value
=
"开门"
)
@RequestMapping
(
value
=
"/open/door"
,
method
=
RequestMethod
.
POS
T
)
public
R
<
String
>
openDoor
(
@Request
Body
String
orderNo
)
{
@RequestMapping
(
value
=
"/open/door"
,
method
=
RequestMethod
.
GE
T
)
public
R
<
String
>
openDoor
(
@Request
Param
(
"orderNo"
)
String
orderNo
)
{
return
R
.
ok
(
sOrderService
.
openDoor
(
orderNo
));
}
...
...
share-system/src/main/java/share/system/domain/SConsumerCoupon.java
View file @
9b4257b8
...
...
@@ -32,6 +32,12 @@ public class SConsumerCoupon extends BaseEntity
@Excel
(
name
=
"优惠券ID"
)
private
Long
couponId
;
/**
* 优惠券ID
*/
@Excel
(
name
=
"套餐ID"
)
private
Long
dealId
;
/** 优惠券编码 */
@Excel
(
name
=
"优惠券编码"
)
private
String
couponCode
;
...
...
share-system/src/main/java/share/system/mapper/DeviceMapper.java
View file @
9b4257b8
...
...
@@ -81,4 +81,6 @@ public interface DeviceMapper extends BaseMapper<Device>
List
<
Device
>
notRoomIdList
(
Device
device
);
int
clearDeviceRoomId
(
Device
device
);
Device
selectDeviceByRoomId
(
Long
roomId
);
}
share-system/src/main/java/share/system/service/DeviceLogService.java
View file @
9b4257b8
...
...
@@ -67,6 +67,6 @@ public interface DeviceLogService extends IService<DeviceLog>
* @param mqttxVo 设备操作信息
* @return 结果
*/
int
addDeviceLog
(
MqttxVo
mqttxVo
);
int
addDeviceLog
(
MqttxVo
mqttxVo
,
String
userNme
);
}
share-system/src/main/java/share/system/service/DeviceOpService.java
View file @
9b4257b8
...
...
@@ -14,27 +14,27 @@ public interface DeviceOpService {
* 小程序订单开门
* @param deviceParam
*/
void
openDoor
(
DeviceParamVo
deviceParam
);
void
openDoor
(
DeviceParamVo
deviceParam
,
String
userName
);
/**
* 小程序订单开门
* @param roomId 房间id
* @param phone 操作用户
*/
void
openDoor
(
Long
roomId
,
String
phone
);
void
openDoor
(
Long
roomId
,
String
phone
,
String
userName
);
/**
* 清除网关锁id列表
* @param devId 网关设备dev_id
* @return
*/
void
clearGatewayDevice
(
String
devId
);
void
clearGatewayDevice
(
String
devId
,
String
userName
);
/**
* 下发组号、锁id/取电开关id列表
* @param devId 网关设备dev_id
* @return
*/
void
addGatewayDevice
(
String
devId
);
void
addGatewayDevice
(
String
devId
,
String
userName
);
}
share-system/src/main/java/share/system/service/DeviceService.java
View file @
9b4257b8
...
...
@@ -70,4 +70,6 @@ public interface DeviceService extends IService<Device>
List
<
Device
>
notRoomIdList
(
Device
device
);
List
<
Device
>
selectDeviceListByIds
(
List
<
Long
>
collect
);
Device
selectDeviceByRoomId
(
Long
roomId
);
}
share-system/src/main/java/share/system/service/impl/DeviceLogServiceImpl.java
View file @
9b4257b8
...
...
@@ -98,7 +98,7 @@ public class DeviceLogServiceImpl extends ServiceImpl<DeviceLogMapper, DeviceLog
}
@Override
public
int
addDeviceLog
(
MqttxVo
mqttxVo
)
{
public
int
addDeviceLog
(
MqttxVo
mqttxVo
,
String
userNmae
)
{
DeviceLog
deviceLog
=
new
DeviceLog
();
deviceLog
.
setDevId
(
mqttxVo
.
getDevId
());
deviceLog
.
setDevMac
(
mqttxVo
.
getDevMac
());
...
...
@@ -108,7 +108,7 @@ public class DeviceLogServiceImpl extends ServiceImpl<DeviceLogMapper, DeviceLog
deviceLog
.
setMqttType
(
mqttxVo
.
getMqttType
());
deviceLog
.
setMqttDescribe
(
mqttxVo
.
getMqttDescribe
());
deviceLog
.
setCreateTime
(
DateUtils
.
getNowDate
());
deviceLog
.
setCreateBy
(
SecurityUtils
.
getUsername
()
);
deviceLog
.
setCreateBy
(
userNmae
);
return
deviceLogMapper
.
insertDeviceLog
(
deviceLog
);
}
}
share-system/src/main/java/share/system/service/impl/DeviceOpServiceImpl.java
View file @
9b4257b8
...
...
@@ -40,7 +40,7 @@ public class DeviceOpServiceImpl implements DeviceOpService {
* 小程序订单开门
* @param deviceParam
*/
public
void
openDoor
(
DeviceParamVo
deviceParam
)
{
public
void
openDoor
(
DeviceParamVo
deviceParam
,
String
userName
)
{
SRoom
room
=
roomMapper
.
selectSRoomById
(
deviceParam
.
getRoomId
());
if
(
room
!=
null
)
{
Device
param
=
new
Device
();
...
...
@@ -49,11 +49,11 @@ public class DeviceOpServiceImpl implements DeviceOpService {
for
(
Device
device
:
list
)
{
if
(
DeviceType
.
DEVICE_CCEE
.
getCode
().
equals
(
device
.
getDevType
()))
{
// 门锁
this
.
deviceOpInit
(
device
.
getDevId
(),
deviceParam
.
getPhone
(),
"10"
);
this
.
deviceOpInit
(
device
.
getDevId
(),
deviceParam
.
getPhone
(),
"10"
,
userName
);
}
if
(
DeviceType
.
DEVICE_0001
.
getCode
().
equals
(
device
.
getDevType
()))
{
// 取电开关
this
.
deviceOpInit
(
device
.
getDevId
(),
deviceParam
.
getPhone
(),
"20"
);
this
.
deviceOpInit
(
device
.
getDevId
(),
deviceParam
.
getPhone
(),
"20"
,
userName
);
}
}
...
...
@@ -65,7 +65,7 @@ public class DeviceOpServiceImpl implements DeviceOpService {
* @param roomId 房间id
* @param phone 操作用户
*/
public
void
openDoor
(
Long
roomId
,
String
phone
)
{
public
void
openDoor
(
Long
roomId
,
String
phone
,
String
userName
)
{
SRoom
room
=
roomMapper
.
selectSRoomById
(
roomId
);
if
(
room
!=
null
)
{
Device
param
=
new
Device
();
...
...
@@ -74,24 +74,24 @@ public class DeviceOpServiceImpl implements DeviceOpService {
for
(
Device
device
:
list
)
{
if
(
DeviceType
.
DEVICE_CCEE
.
getCode
().
equals
(
device
.
getDevType
()))
{
// 门锁
this
.
deviceOpInit
(
device
.
getDevId
(),
phone
,
"10"
);
this
.
deviceOpInit
(
device
.
getDevId
(),
phone
,
"10"
,
userName
);
}
if
(
DeviceType
.
DEVICE_0001
.
getCode
().
equals
(
device
.
getDevType
()))
{
// 取电开关
this
.
deviceOpInit
(
device
.
getDevId
(),
phone
,
"20"
);
this
.
deviceOpInit
(
device
.
getDevId
(),
phone
,
"20"
,
userName
);
}
}
}
}
private
void
deviceOpInit
(
String
devId
,
String
phone
,
String
opType
)
{
private
void
deviceOpInit
(
String
devId
,
String
phone
,
String
opType
,
String
userName
)
{
// 获取mqtt的topic、payload
MqttxVo
mqttxVo
=
mqttxService
.
openOrCloseDevice
(
devId
,
phone
,
opType
);
// 发送mqtt消息
mqttGatewayComponent
.
sendToMqtt
(
mqttxVo
.
getTopic
(),
0
,
mqttxVo
.
getPayload
());
// 写日志记录
deviceLogService
.
addDeviceLog
(
mqttxVo
);
deviceLogService
.
addDeviceLog
(
mqttxVo
,
userName
);
}
/**
...
...
@@ -100,13 +100,13 @@ public class DeviceOpServiceImpl implements DeviceOpService {
* @return
*/
@Override
public
void
clearGatewayDevice
(
String
devId
)
{
public
void
clearGatewayDevice
(
String
devId
,
String
userName
)
{
// 获取mqtt的topic、payload
MqttxVo
mqttxVo
=
mqttxService
.
clearGatewayDevice
(
devId
);
// 发送mqtt消息
mqttGatewayComponent
.
sendToMqtt
(
mqttxVo
.
getTopic
(),
0
,
mqttxVo
.
getPayload
());
// 写日志记录
deviceLogService
.
addDeviceLog
(
mqttxVo
);
deviceLogService
.
addDeviceLog
(
mqttxVo
,
userName
);
}
/**
...
...
@@ -115,13 +115,13 @@ public class DeviceOpServiceImpl implements DeviceOpService {
* @return
*/
@Override
public
void
addGatewayDevice
(
String
devId
)
{
public
void
addGatewayDevice
(
String
devId
,
String
userName
)
{
// 获取mqtt的topic、payload
MqttxVo
mqttxVo
=
mqttxService
.
addGatewayDevice
(
devId
);
// 发送mqtt消息
mqttGatewayComponent
.
sendToMqtt
(
mqttxVo
.
getTopic
(),
0
,
mqttxVo
.
getPayload
());
// 写日志记录
deviceLogService
.
addDeviceLog
(
mqttxVo
);
deviceLogService
.
addDeviceLog
(
mqttxVo
,
userName
);
}
...
...
share-system/src/main/java/share/system/service/impl/DeviceServiceImpl.java
View file @
9b4257b8
...
...
@@ -123,6 +123,11 @@ public class DeviceServiceImpl extends ServiceImpl<DeviceMapper, Device> impleme
}
@Override
public
Device
selectDeviceByRoomId
(
Long
roomId
)
{
return
deviceMapper
.
selectDeviceByRoomId
(
roomId
);
}
@Override
public
List
<
Device
>
notRoomIdList
(
Device
device
)
{
SRoom
room
=
roomMapper
.
selectSRoomById
(
device
.
getRoomId
());
if
(
room
!=
null
)
{
...
...
share-system/src/main/java/share/system/service/impl/SOrderServiceImpl.java
View file @
9b4257b8
...
...
@@ -463,7 +463,9 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper,SOrder> implemen
@Override
public
String
openDoor
(
String
orderNo
)
{
SOrder
sOrder
=
sOrderMapper
.
selectSOrderByNo
(
orderNo
);
LambdaQueryWrapper
<
SOrder
>
orderLambdaQueryWrapper
=
new
LambdaQueryWrapper
<>();
orderLambdaQueryWrapper
.
eq
(
SOrder:
:
getOrderNo
,
orderNo
);
SOrder
sOrder
=
sOrderMapper
.
selectOne
(
orderLambdaQueryWrapper
);
if
(
Objects
.
isNull
(
sOrder
))
{
throw
new
BaseException
(
"订单不存在!"
);
}
...
...
@@ -471,9 +473,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper,SOrder> implemen
if
(
Objects
.
isNull
(
sRoomVo
))
{
throw
new
BaseException
(
"房间不存在!"
);
}
LambdaQueryWrapper
<
Device
>
queryWrapper
=
new
LambdaQueryWrapper
<>();
queryWrapper
.
eq
(
Device:
:
getRoomId
,
sOrder
.
getRoomId
());
Device
one
=
deviceService
.
getOne
(
queryWrapper
);
Device
one
=
deviceService
.
selectDeviceByRoomId
(
sOrder
.
getRoomId
());
if
(
Objects
.
isNull
(
one
))
{
throw
new
BaseException
(
"设备不存在!"
);
}
...
...
@@ -492,7 +492,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper,SOrder> implemen
}
}
SConsumer
user
=
FrontTokenComponent
.
getWxSConsumerEntry
();
deviceOpService
.
openDoor
(
sRoomVo
.
getId
(),
user
.
getNickName
());
deviceOpService
.
openDoor
(
sRoomVo
.
getId
(),
user
.
get
Phone
(),
user
.
get
NickName
());
return
"开锁成功"
;
}
...
...
@@ -513,7 +513,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper,SOrder> implemen
add
(
RefundStatusEnum
.
REFUNDED
.
getCode
());
}});
queryWrapper
.
apply
(
"IFNULL(start_date,pre_start_date) >= '"
+
DateUtils
.
getTime
()+
"' "
+
" AND IFNULL(start_date,pre_start_date) <= '"
+
DateUtils
.
getTime
()+
"')
"
);
" AND IFNULL(start_date,pre_start_date) <= '"
+
DateUtils
.
getTime
()
+
"'
"
);
return
count
(
queryWrapper
)==
0
;
}
...
...
share-system/src/main/java/share/system/service/impl/SRoomServiceImpl.java
View file @
9b4257b8
...
...
@@ -234,7 +234,7 @@ public class SRoomServiceImpl extends ServiceImpl<SRoomMapper, SRoom> implements
if
(
Objects
.
isNull
(
one
))
{
throw
new
BaseException
(
"设备不存在!"
);
}
deviceOpService
.
openDoor
(
id
,
user
.
getNickName
());
deviceOpService
.
openDoor
(
id
,
user
.
get
Phone
(),
user
.
get
NickName
());
return
"开锁成功"
;
}
...
...
share-system/src/main/resources/mapper/system/DeviceMapper.xml
View file @
9b4257b8
...
...
@@ -84,6 +84,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<include
refid=
"selectDeviceVo"
/>
where dev_id = #{devId}
</select>
<select
id=
"selectDeviceByRoomId"
parameterType=
"Long"
resultMap=
"DeviceResult"
>
<include
refid=
"selectDeviceVo"
/>
where room_id=#{roomId}
</select>
<insert
id=
"insertDevice"
parameterType=
"Device"
useGeneratedKeys=
"true"
keyProperty=
"id"
>
insert into s_device
...
...
share-system/src/main/resources/mapper/system/SConsumerCouponMapper.xml
View file @
9b4257b8
...
...
@@ -8,6 +8,7 @@
<result
property=
"id"
column=
"id"
/>
<result
property=
"consumerId"
column=
"consumer_id"
/>
<result
property=
"couponId"
column=
"coupon_id"
/>
<result
property=
"dealId"
column=
"deal_id"
/>
<result
property=
"couponCode"
column=
"coupon_code"
/>
<result
property=
"name"
column=
"name"
/>
<result
property=
"couponType"
column=
"coupon_type"
/>
...
...
@@ -37,7 +38,37 @@
</resultMap>
<sql
id=
"selectSConsumerCouponVo"
>
select id, consumer_id, coupon_id, coupon_code, name, coupon_type,coupon_time_start,coupon_time_end, max_duration,min_duration, duration, min_price, sub_price, source_type, platform_type, start_date, end_date, use_date, use_status, is_delete, create_by, create_time, update_by, update_time, delete_by, delete_time, remark,room_type,store_type from s_consumer_coupon
select id,
consumer_id,
coupon_id,
deal_id,
coupon_code,
name,
coupon_type,
coupon_time_start,
coupon_time_end,
max_duration,
min_duration,
duration,
min_price,
sub_price,
source_type,
platform_type,
start_date,
end_date,
use_date,
use_status,
is_delete,
create_by,
create_time,
update_by,
update_time,
delete_by,
delete_time,
remark,
room_type,
store_type
from s_consumer_coupon
</sql>
<select
id=
"selectSConsumerCouponList"
parameterType=
"SConsumerCoupon"
resultMap=
"SConsumerCouponResult"
>
...
...
@@ -45,6 +76,7 @@
<where>
<if
test=
"consumerId != null "
>
and consumer_id = #{consumerId}
</if>
<if
test=
"couponId != null "
>
and coupon_id = #{couponId}
</if>
<if
test=
"dealId !=null"
>
and deal_id=#{dealId}
</if>
<if
test=
"couponCode != null and couponCode != ''"
>
and coupon_code = #{couponCode}
</if>
<if
test=
"name != null and name != ''"
>
and name like concat('%', #{name}, '%')
</if>
<if
test=
"couponType != null and couponType != ''"
>
and coupon_type = #{couponType}
</if>
...
...
@@ -90,6 +122,7 @@
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"consumerId != null"
>
consumer_id,
</if>
<if
test=
"couponId != null"
>
coupon_id,
</if>
<if
test=
"dealId != null"
>
deal_id,
</if>
<if
test=
"couponCode != null and couponCode != ''"
>
coupon_code,
</if>
<if
test=
"name != null and name != ''"
>
name,
</if>
<if
test=
"couponType != null"
>
coupon_type,
</if>
...
...
@@ -120,6 +153,7 @@
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"consumerId != null"
>
#{consumerId},
</if>
<if
test=
"couponId != null"
>
#{couponId},
</if>
<if
test=
"dealId != null"
>
#{dealId}
</if>
<if
test=
"couponCode != null and couponCode != ''"
>
#{couponCode},
</if>
<if
test=
"name != null and name != ''"
>
#{name},
</if>
<if
test=
"couponType != null"
>
#{couponType},
</if>
...
...
@@ -154,6 +188,7 @@
<trim
prefix=
"SET"
suffixOverrides=
","
>
<if
test=
"consumerId != null"
>
consumer_id = #{consumerId},
</if>
<if
test=
"couponId != null"
>
coupon_id = #{couponId},
</if>
<if
test=
"dealId != null"
>
deal_id = #{dealId}
</if>
<if
test=
"couponCode != null and couponCode != ''"
>
coupon_code = #{couponCode},
</if>
<if
test=
"name != null and name != ''"
>
name = #{name},
</if>
<if
test=
"couponType != null"
>
coupon_type = #{couponType},
</if>
...
...
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