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
a8366b42
Commit
a8366b42
authored
Nov 09, 2023
by
吕明尚
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
开门改为订单编号开门
parent
9d66a9a5
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
79 additions
and
29 deletions
+79
-29
SStoreController.java
...in/java/share/web/controller/system/SStoreController.java
+4
-0
SOrderController.java
...in/java/share/web/controller/system/SOrderController.java
+13
-2
SRoomController.java
...ain/java/share/web/controller/system/SRoomController.java
+13
-2
application-dev.yml
share-front/src/main/resources/application-dev.yml
+1
-1
application-prod.yml
share-front/src/main/resources/application-prod.yml
+2
-2
application-test.yml
share-front/src/main/resources/application-test.yml
+2
-2
SOrderMapper.java
...ystem/src/main/java/share/system/mapper/SOrderMapper.java
+2
-0
ISOrderService.java
...em/src/main/java/share/system/service/ISOrderService.java
+2
-1
ISRoomService.java
...tem/src/main/java/share/system/service/ISRoomService.java
+2
-1
SOrderServiceImpl.java
...ain/java/share/system/service/impl/SOrderServiceImpl.java
+20
-12
SRoomServiceImpl.java
...main/java/share/system/service/impl/SRoomServiceImpl.java
+14
-6
SOrderMapper.xml
...-system/src/main/resources/mapper/system/SOrderMapper.xml
+4
-0
No files found.
share-admin/src/main/java/share/web/controller/system/SStoreController.java
View file @
a8366b42
...
...
@@ -181,5 +181,9 @@ public class SStoreController extends BaseController
return
toAjax
(
sStoreService
.
insertStoreConsumers
(
storeId
,
consumerIds
));
}
/**
* 数据同步
*/
}
share-front/src/main/java/share/web/controller/system/SOrderController.java
View file @
a8366b42
...
...
@@ -13,11 +13,14 @@ import share.common.core.domain.AjaxResult;
import
share.common.core.domain.R
;
import
share.common.core.redis.RedisUtil
;
import
share.common.utils.JsonConvertUtil
;
import
share.framework.mqtt.MqttGatewayComponent
;
import
share.system.domain.SOrder
;
import
share.system.domain.vo.MqttxVo
;
import
share.system.request.CreateOrderRequest
;
import
share.system.request.OrderComputedPriceRequest
;
import
share.system.response.ComputedOrderPriceResponse
;
import
share.system.response.OrderPayResultResponse
;
import
share.system.service.DeviceLogService
;
import
share.system.service.ISOrderService
;
import
share.common.core.page.TableDataInfo
;
...
...
@@ -40,6 +43,10 @@ public class SOrderController extends BaseController
@Autowired
private
RedisUtil
redisUtil
;
@Autowired
private
MqttGatewayComponent
mqttGatewayComponent
;
@Autowired
private
DeviceLogService
deviceLogService
;
/**
* 查询订单列表
...
...
@@ -75,8 +82,12 @@ public class SOrderController extends BaseController
*/
@ApiOperation
(
value
=
"开门"
)
@RequestMapping
(
value
=
"/open/door"
,
method
=
RequestMethod
.
POST
)
public
R
<
String
>
openDoor
(
@RequestBody
Long
id
){
return
R
.
ok
(
sOrderService
.
openDoor
(
id
));
public
R
<
Integer
>
openDoor
(
@RequestBody
String
orderNo
)
{
MqttxVo
mqttxVo
=
sOrderService
.
openDoor
(
orderNo
);
mqttGatewayComponent
.
sendToMqtt
(
mqttxVo
.
getTopic
(),
0
,
mqttxVo
.
getPayload
());
// 写日志记录
int
result
=
deviceLogService
.
addDeviceLog
(
mqttxVo
);
return
R
.
ok
(
result
);
}
/**
...
...
share-front/src/main/java/share/web/controller/system/SRoomController.java
View file @
a8366b42
...
...
@@ -9,10 +9,13 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.web.bind.annotation.*
;
import
share.common.core.controller.BaseController
;
import
share.common.core.domain.R
;
import
share.framework.mqtt.MqttGatewayComponent
;
import
share.system.domain.SPack
;
import
share.system.domain.SRoom
;
import
share.system.domain.vo.MqttxVo
;
import
share.system.domain.vo.RoomStatusVo
;
import
share.system.domain.vo.SRoomVo
;
import
share.system.service.DeviceLogService
;
import
share.system.service.IPackService
;
import
share.system.service.ISRoomService
;
import
share.common.core.page.TableDataInfo
;
...
...
@@ -36,6 +39,10 @@ public class SRoomController extends BaseController {
@Autowired
private
IPackService
packService
;
@Autowired
private
MqttGatewayComponent
mqttGatewayComponent
;
@Autowired
private
DeviceLogService
deviceLogService
;
/**
* 查询房间列表
...
...
@@ -79,8 +86,12 @@ public class SRoomController extends BaseController {
*/
@ApiOperation
(
value
=
"专属保洁的开门操作"
)
@RequestMapping
(
value
=
"/open/door"
,
method
=
RequestMethod
.
POST
)
public
R
<
String
>
openDoor
(
@RequestBody
Long
id
)
{
return
R
.
ok
(
sRoomService
.
openDoor
(
id
));
public
R
<
Integer
>
openDoor
(
@RequestBody
Long
id
)
{
MqttxVo
mqttxVo
=
sRoomService
.
openDoor
(
id
);
mqttGatewayComponent
.
sendToMqtt
(
mqttxVo
.
getTopic
(),
0
,
mqttxVo
.
getPayload
());
// 写日志记录
int
result
=
deviceLogService
.
addDeviceLog
(
mqttxVo
);
return
R
.
ok
(
result
);
}
/**
...
...
share-front/src/main/resources/application-dev.yml
View file @
a8366b42
...
...
@@ -191,4 +191,4 @@ dianping:
appKey
:
a59ea57cd1eb4737
appSecret
:
0caaabb7fda1c1be46636171548dcf510d1fb706
authCode
:
abcdefghijklmnopqrstuvwxyz
openShoopUuid
:
5067d2db1311d32a0ff366c79a73df51
openShoopUuid
:
cf0eb0891f9e366bcda10cb7f6f23b25
share-front/src/main/resources/application-prod.yml
View file @
a8366b42
...
...
@@ -192,4 +192,4 @@ dianping:
appKey
:
a59ea57cd1eb4737
appSecret
:
0caaabb7fda1c1be46636171548dcf510d1fb706
authCode
:
abcdefghijklmnopqrstuvwxyz
openShoopUuid
:
5067d2db1311d32a0ff366c79a73df51
\ No newline at end of file
openShoopUuid
:
cf0eb0891f9e366bcda10cb7f6f23b25
\ No newline at end of file
share-front/src/main/resources/application-test.yml
View file @
a8366b42
...
...
@@ -192,4 +192,4 @@ dianping:
appKey
:
a59ea57cd1eb4737
appSecret
:
0caaabb7fda1c1be46636171548dcf510d1fb706
authCode
:
abcdefghijklmnopqrstuvwxyz
openShoopUuid
:
5067d2db1311d32a0ff366c79a73df51
\ No newline at end of file
openShoopUuid
:
cf0eb0891f9e366bcda10cb7f6f23b25
\ No newline at end of file
share-system/src/main/java/share/system/mapper/SOrderMapper.java
View file @
a8366b42
...
...
@@ -60,4 +60,6 @@ public interface SOrderMapper extends BaseMapper<SOrder>
* @return 结果
*/
public
int
deleteSOrderByIds
(
Long
[]
ids
);
SOrder
selectSOrderByNo
();
}
share-system/src/main/java/share/system/service/ISOrderService.java
View file @
a8366b42
...
...
@@ -5,6 +5,7 @@ import java.util.List;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
share.system.domain.SOrder
;
import
share.system.domain.vo.MqttxVo
;
import
share.system.request.CreateOrderRequest
;
import
share.system.request.OrderComputedPriceRequest
;
import
share.system.request.OrderRefundRequest
;
...
...
@@ -97,7 +98,7 @@ public interface ISOrderService extends IService<SOrder>
*/
SOrder
getByOrderNo
(
String
orderNo
);
String
openDoor
(
Long
id
);
MqttxVo
openDoor
(
String
orderNo
);
SOrder
getInfoByEntity
(
SOrder
orderParam
);
...
...
share-system/src/main/java/share/system/service/ISRoomService.java
View file @
a8366b42
...
...
@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
import
share.system.domain.Device
;
import
share.system.domain.SPack
;
import
share.system.domain.SRoom
;
import
share.system.domain.vo.MqttxVo
;
import
share.system.domain.vo.SRoomVo
;
/**
...
...
@@ -84,7 +85,7 @@ public interface ISRoomService extends IService<SRoom>
List
<
SRoom
>
selectSroomListByStroeId
(
Long
storeId
);
String
openDoor
(
Long
id
);
MqttxVo
openDoor
(
Long
id
);
List
<
SPack
>
getPackByRoomId
(
Long
id
);
...
...
share-system/src/main/java/share/system/service/impl/SOrderServiceImpl.java
View file @
a8366b42
...
...
@@ -22,9 +22,11 @@ import share.common.utils.DateUtil;
import
share.common.utils.DateUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
share.common.utils.SecurityUtils
;
import
share.common.utils.bean.BeanUtils
;
import
share.system.domain.*
;
import
share.system.domain.vo.FrontTokenComponent
;
import
share.system.domain.vo.MqttxVo
;
import
share.system.domain.vo.SRoomVo
;
import
share.system.mapper.SOrderMapper
;
import
share.system.request.CreateOrderRequest
;
...
...
@@ -71,6 +73,12 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper,SOrder> implemen
@Autowired
private
RedisUtil
redisUtil
;
@Autowired
private
MqttxService
mqttxService
;
@Autowired
private
DeviceService
deviceService
;
/**
* 查询订单
*
...
...
@@ -389,8 +397,8 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper,SOrder> implemen
}
@Override
public
String
openDoor
(
Long
id
)
{
SOrder
sOrder
=
sOrderMapper
.
selectSOrderBy
Id
(
id
);
public
MqttxVo
openDoor
(
String
orderNo
)
{
SOrder
sOrder
=
sOrderMapper
.
selectSOrderBy
No
(
);
if
(
Objects
.
isNull
(
sOrder
))
{
throw
new
BaseException
(
"订单不存在!"
);
}
...
...
@@ -398,12 +406,15 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper,SOrder> implemen
if
(
Objects
.
isNull
(
sRoomVo
))
{
throw
new
BaseException
(
"房间不存在!"
);
}
//根据门锁编号,电机控制,密码进行开门
String
doorLockCode
=
sRoomVo
.
getDoorLockCode
();
String
electricControlCode
=
sRoomVo
.
getElectricControlCode
();
String
password
=
sRoomVo
.
getPassword
();
if
(
true
){
//TODO 开门成功
LambdaQueryWrapper
<
Device
>
queryWrapper
=
new
LambdaQueryWrapper
<>();
queryWrapper
.
eq
(
Device:
:
getRoomId
,
sOrder
.
getRoomId
());
Device
one
=
deviceService
.
getOne
(
queryWrapper
);
if
(
Objects
.
isNull
(
one
))
{
throw
new
BaseException
(
"设备不存在!"
);
}
SConsumer
user
=
FrontTokenComponent
.
getWxSConsumerEntry
();
MqttxVo
mqttxVo
=
mqttxService
.
openOrCloseDevice
(
one
.
getDevId
(),
user
.
getNickName
(),
"10"
);
if
(
sOrder
.
getStatus
().
equals
(
OrderStatusEnum
.
INUSE
.
getCode
()))
{
//更改订单状态,房间状态,开始时间,结束时间
sOrder
.
setStatus
(
1
);
//计算预约开始和结束时间时长
...
...
@@ -412,11 +423,8 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper,SOrder> implemen
//结束时间为开始时间+预约时长
sOrder
.
setEndDate
(
DateUtils
.
addHours
(
new
Date
(),
bigDecimal
.
intValue
()));
sOrderMapper
.
updateById
(
sOrder
);
return
"开门成功"
;
}
else
{
//TODO 开门失败
return
"开门失败"
;
}
return
mqttxVo
;
}
private
BigDecimal
computeTotalPrice
(
BigDecimal
unitPrice
,
Date
startTime
,
Date
endTime
){
...
...
share-system/src/main/java/share/system/service/impl/SRoomServiceImpl.java
View file @
a8366b42
...
...
@@ -8,11 +8,13 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.springframework.beans.BeanUtils
;
import
share.common.enums.RoleTypeEnum
;
import
share.common.exception.base.BaseException
;
import
share.common.utils.DateUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
share.system.domain.*
;
import
share.system.domain.vo.FrontTokenComponent
;
import
share.system.domain.vo.MqttxVo
;
import
share.system.domain.vo.SRoomVo
;
import
share.system.mapper.DeviceMapper
;
import
share.system.mapper.SRoomMapper
;
...
...
@@ -39,6 +41,10 @@ public class SRoomServiceImpl extends ServiceImpl<SRoomMapper, SRoom> implements
private
IRoomPackService
roomPackService
;
@Autowired
private
DeviceMapper
deviceMapper
;
@Autowired
private
DeviceService
deviceService
;
@Autowired
private
MqttxService
mqttxService
;
/**
...
...
@@ -211,7 +217,7 @@ public class SRoomServiceImpl extends ServiceImpl<SRoomMapper, SRoom> implements
}
@Override
public
String
openDoor
(
Long
id
)
{
public
MqttxVo
openDoor
(
Long
id
)
{
SConsumer
user
=
FrontTokenComponent
.
getWxSConsumerEntry
();
if
(!
user
.
getRoleType
().
equals
(
RoleTypeEnum
.
CLEANER
.
getCode
()))
{
throw
new
RuntimeException
(
"当前用户不是保洁人员"
);
...
...
@@ -220,12 +226,14 @@ public class SRoomServiceImpl extends ServiceImpl<SRoomMapper, SRoom> implements
if
(
Objects
.
isNull
(
room
))
{
throw
new
RuntimeException
(
"房间不存在"
);
}
//TODO 调用开门接口
if
(
true
)
{
return
"开门成功"
;
}
else
{
return
"开门失败"
;
LambdaQueryWrapper
<
Device
>
queryWrapper
=
new
LambdaQueryWrapper
<>();
queryWrapper
.
eq
(
Device:
:
getRoomId
,
id
);
Device
one
=
deviceService
.
getOne
(
queryWrapper
)
;
if
(
Objects
.
isNull
(
one
))
{
throw
new
BaseException
(
"设备不存在!"
)
;
}
MqttxVo
mqttxVo
=
mqttxService
.
openOrCloseDevice
(
one
.
getDevId
(),
user
.
getNickName
(),
"10"
);
return
mqttxVo
;
}
@Override
...
...
share-system/src/main/resources/mapper/system/SOrderMapper.xml
View file @
a8366b42
...
...
@@ -125,6 +125,10 @@
<include
refid=
"selectSOrderVo"
/>
where id = #{id}
</select>
<select
id=
"selectSOrderByNo"
resultMap=
"SOrderResult"
parameterType=
"String"
>
<include
refid=
"selectSOrderVo"
/>
where order_no=#{orderNo}
</select>
<insert
id=
"insertSOrder"
parameterType=
"SOrder"
useGeneratedKeys=
"true"
keyProperty=
"id"
>
insert into s_order
...
...
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