Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
cloud-platform
Project
Project
Details
Activity
Releases
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
youjj
cloud-platform
Commits
a36c4671
Commit
a36c4671
authored
Nov 03, 2020
by
周健威
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加代码
parent
4d214ba6
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
48 additions
and
19 deletions
+48
-19
SpecialRentBiz.java
...main/java/com/xxfc/platform/order/biz/SpecialRentBiz.java
+7
-4
RabbitDelayConfig.java
...ava/com/xxfc/platform/order/config/RabbitDelayConfig.java
+35
-1
SpecialRentController.java
...a/com/xxfc/platform/order/rest/SpecialRentController.java
+6
-14
No files found.
xx-order/xx-order-server/src/main/java/com/xxfc/platform/order/biz/SpecialRentBiz.java
View file @
a36c4671
...
...
@@ -162,11 +162,14 @@ public class SpecialRentBiz extends BaseBiz<SpecialRentMapper, SpecialRent> {
specialRent
.
setOrderNo
(
detail
.
getOrder
().
getNo
());
// specialRent.setOverTime(DateUtil.offsetHour(DateUtil.date(), 1).getTime());
specialRent
.
setBookRecordId
(
detail
.
getBookRecordId
());
//设置车辆下架
if
(!
specialRent
.
getStartCompanyId
().
equals
(
specialRent
.
getEndCompanyId
()))
{
ObjectRestResponse
restResponse
=
vehicleFeign
.
updVehicleFeign
(
new
Vehicle
(){{
setId
(
vehicle
.
getId
());
setState
(
STATE_DOWN
);
}});
}
// rabbitProduct.sendApplyDelayMessage(baseBiz.selectById(specialRent.getId()), 1000L * 3601L);
// Long delayTime = DateUtil.date().getTime() - DateUtil.offsetDay(endDateTime, -1).getTime();
...
...
xx-order/xx-order-server/src/main/java/com/xxfc/platform/order/config/RabbitDelayConfig.java
View file @
a36c4671
...
...
@@ -30,6 +30,9 @@ public class RabbitDelayConfig {
public
static
final
String
APPLY_REQUIRE_CANCEL_EXC
=
"apply_require_cancel_delay_exchange"
;
public
static
final
String
APPLY_REQUIRE_CANCEL_QUE
=
"apply_require_cancel_delay_queue"
;
public
static
final
String
APPLY_REQUIRE_CANCEL_KEY
=
"apply_require_cancel_delay_key"
;
public
static
final
String
SPECIAL_CANCEL_EXC
=
"special_cancel_delay_exchange"
;
public
static
final
String
SPECIAL_CANCEL_QUE
=
"special_cancel_delay_queue"
;
public
static
final
String
SPECIAL_CANCEL_KEY
=
"special_cancel_delay_key"
;
/**
...
...
@@ -68,6 +71,18 @@ public class RabbitDelayConfig {
return
new
CustomExchange
(
APPLY_REQUIRE_CANCEL_QUE
,
"x-delayed-message"
,
true
,
false
,
args
);
}
/**
* 特惠租车自动取消延时队列交换机
* 注意这里的交换机类型:CustomExchange
* @return
*/
@Bean
(
SPECIAL_CANCEL_EXC
)
public
CustomExchange
specialDelayExchange
(){
Map
<
String
,
Object
>
args
=
new
HashMap
<>();
args
.
put
(
"x-delayed-type"
,
"direct"
);
return
new
CustomExchange
(
APPLY_CANCEL_EXC
,
"x-delayed-message"
,
true
,
false
,
args
);
}
/**
* 自动取消订单延时队列
...
...
@@ -96,6 +111,15 @@ public class RabbitDelayConfig {
return
new
Queue
(
APPLY_REQUIRE_CANCEL_QUE
,
true
);
}
/**
* 特惠租车自动取消延时队列
* @return
*/
@Bean
(
SPECIAL_CANCEL_QUE
)
public
Queue
specialDelayQueue
(){
return
new
Queue
(
SPECIAL_CANCEL_QUE
,
true
);
}
/**
...
...
@@ -117,12 +141,22 @@ public class RabbitDelayConfig {
}
/**
* 申请
下单
自动取消给延时队列绑定交换机
* 申请
需求
自动取消给延时队列绑定交换机
* @return
*/
@Bean
(
"acqRequireDelayBinding"
)
public
Binding
acqRequireDelayBinding
(
@Qualifier
(
APPLY_REQUIRE_CANCEL_QUE
)
Queue
acqDelayQueue
,
@Qualifier
(
APPLY_REQUIRE_CANCEL_EXC
)
CustomExchange
acqUserDelayExchange
){
return
BindingBuilder
.
bind
(
acqDelayQueue
).
to
(
acqUserDelayExchange
).
with
(
APPLY_REQUIRE_CANCEL_KEY
).
noargs
();
}
/**
* 特惠租车自动取消给延时队列绑定交换机
* @return
*/
@Bean
(
"acqSpecialDelayBinding"
)
public
Binding
acqSpecialDelayBinding
(
@Qualifier
(
SPECIAL_CANCEL_QUE
)
Queue
acqDelayQueue
,
@Qualifier
(
SPECIAL_CANCEL_EXC
)
CustomExchange
acqUserDelayExchange
){
return
BindingBuilder
.
bind
(
acqDelayQueue
).
to
(
acqUserDelayExchange
).
with
(
SPECIAL_CANCEL_KEY
).
noargs
();
}
}
xx-order/xx-order-server/src/main/java/com/xxfc/platform/order/rest/SpecialRentController.java
View file @
a36c4671
package
com
.
xxfc
.
platform
.
order
.
rest
;
import
cn.hutool.core.bean.BeanUtil
;
import
cn.hutool.core.date.DateTime
;
import
cn.hutool.core.date.DateUtil
;
import
cn.hutool.core.util.StrUtil
;
import
cn.hutool.json.JSONUtil
;
import
com.alibaba.fastjson.JSON
;
import
com.github.wxiaoqi.security.admin.feign.UserFeign
;
import
com.github.wxiaoqi.security.admin.feign.dto.UserDTO
;
import
com.github.wxiaoqi.security.admin.feign.rest.UserRestInterface
;
...
...
@@ -14,14 +11,12 @@ import com.github.wxiaoqi.security.common.exception.BaseException;
import
com.github.wxiaoqi.security.common.msg.ObjectRestResponse
;
import
com.github.wxiaoqi.security.common.rest.BaseController
;
import
com.github.wxiaoqi.security.common.util.AssertUtils
;
import
com.github.wxiaoqi.security.common.util.OrderUtil
;
import
com.github.wxiaoqi.security.common.util.Query
;
import
com.github.wxiaoqi.security.common.util.process.ResultCode
;
import
com.github.wxiaoqi.security.common.vo.PageDataVO
;
import
com.github.wxiaoqi.security.common.vo.PageParam
;
import
com.xxfc.platform.order.biz.OrderRentVehicleBiz
;
import
com.xxfc.platform.order.biz.SpecialRentBiz
;
import
com.xxfc.platform.order.entity.BaseOrder
;
import
com.xxfc.platform.order.entity.SpecialRent
;
import
com.xxfc.platform.order.mqhandler.RabbitProduct
;
import
com.xxfc.platform.order.pojo.order.RentVehicleBO
;
...
...
@@ -29,17 +24,12 @@ import com.xxfc.platform.order.pojo.order.add.AddRentVehicleDTO;
import
com.xxfc.platform.order.service.OrderRentVehicleService
;
import
com.xxfc.platform.vehicle.entity.Vehicle
;
import
com.xxfc.platform.vehicle.feign.VehicleFeign
;
import
com.xxfc.platform.vehicle.pojo.BookVehicleVO
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.Data
;
import
org.mockito.internal.util.collections.Sets
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.*
;
import
static
com
.
github
.
wxiaoqi
.
security
.
common
.
constant
.
CommonConstants
.
SYS_FALSE
;
import
static
com
.
github
.
wxiaoqi
.
security
.
common
.
constant
.
CommonConstants
.
SYS_TRUE
;
import
static
com
.
xxfc
.
platform
.
order
.
entity
.
SpecialRent
.
STATUS_CRT
;
import
static
com
.
xxfc
.
platform
.
vehicle
.
entity
.
Vehicle
.
STATE_DOWN
;
@RestController
@RequestMapping
(
"/chw/specialRent"
)
...
...
@@ -95,10 +85,12 @@ public class SpecialRentController extends BaseController<SpecialRentBiz, Specia
}});
//设置车辆上架
if
(!
specialRentDB
.
getStartCompanyId
().
equals
(
specialRentDB
.
getEndCompanyId
()))
{
ObjectRestResponse
restResponse
=
vehicleFeign
.
updVehicleFeign
(
new
Vehicle
(){{
setId
(
specialRentDB
.
getVehicleId
());
setState
(
STATE_UP
);
}});
}
baseBiz
.
updateSelectiveById
(
new
SpecialRent
(){{
setId
(
specialRentDB
.
getId
());
...
...
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