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
6274d700
Commit
6274d700
authored
Nov 03, 2020
by
hezhen
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev-chw' of
http://113.105.137.151:22280/youjj/cloud-platform
into dev-chw
parents
0fac62c1
c99f8d0b
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
100 additions
and
21 deletions
+100
-21
SpecialRent.java
...main/java/com/xxfc/platform/order/entity/SpecialRent.java
+4
-0
SpecialRentBiz.java
...main/java/com/xxfc/platform/order/biz/SpecialRentBiz.java
+16
-7
RabbitDelayConfig.java
...ava/com/xxfc/platform/order/config/RabbitDelayConfig.java
+35
-1
SpecialRentController.java
...a/com/xxfc/platform/order/rest/SpecialRentController.java
+45
-13
No files found.
xx-order/xx-order-api/src/main/java/com/xxfc/platform/order/entity/SpecialRent.java
View file @
6274d700
...
...
@@ -239,4 +239,8 @@ public class SpecialRent implements Serializable {
@Column
(
name
=
"category_name"
)
@ApiModelProperty
(
"型号名称"
)
private
String
categoryName
;
@Column
(
name
=
"is_del"
)
private
Integer
isDel
;
}
xx-order/xx-order-server/src/main/java/com/xxfc/platform/order/biz/SpecialRentBiz.java
View file @
6274d700
...
...
@@ -67,9 +67,13 @@ public class SpecialRentBiz extends BaseBiz<SpecialRentMapper, SpecialRent> {
return
w
;
});
if
(
list
.
size
()
>
0
)
{
if
(
list
.
size
()
>
0
)
{
for
(
SpecialRent
specialRent
:
list
)
{
if
(
specialRent
.
getStartCompanyId
().
equals
(
specialRent
.
getEndCompanyId
()))
{
return
Boolean
.
TRUE
;
}
}
}
return
Boolean
.
FALSE
;
}
...
...
@@ -128,12 +132,14 @@ public class SpecialRentBiz extends BaseBiz<SpecialRentMapper, SpecialRent> {
specialRent
.
setEndCityCode
(
companyDetail
.
getAddrCity
());
}
if
(
null
!=
specialRent
.
getCategoryId
())
{
VehicleCategory
vehicleCategory
=
vehicleFeign
.
getVehicleCategory
(
specialRent
.
get
EndCompan
yId
()).
getData
();
VehicleCategory
vehicleCategory
=
vehicleFeign
.
getVehicleCategory
(
specialRent
.
get
Categor
yId
()).
getData
();
specialRent
.
setBrandName
(
vehicleCategory
.
getBrandName
());
specialRent
.
setCategoryName
(
vehicleCategory
.
getName
());
}
specialRent
.
setPublishUserId
(
userDTO
.
getId
());
specialRent
.
setCrtUser
(
userDTO
.
getId
().
toString
());
specialRent
.
setUpdUser
(
userDTO
.
getId
().
toString
());
specialRent
.
setStatus
(
STATUS_CRT
);
RentVehicleBO
detail
=
new
RentVehicleBO
();
...
...
@@ -158,11 +164,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 @
6274d700
...
...
@@ -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 @
6274d700
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,14 @@ 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"
)
...
...
@@ -76,21 +68,43 @@ public class SpecialRentController extends BaseController<SpecialRentBiz, Specia
return
ObjectRestResponse
.
succ
();
}
@RequestMapping
(
value
=
"/appBusiness/cnlRent"
,
method
=
RequestMethod
.
POST
)
@RequestMapping
(
value
=
"/appBusiness/cnlRent"
,
method
=
RequestMethod
.
DELETE
)
@ResponseBody
@ApiOperation
(
value
=
"取消发布特惠租车"
)
public
ObjectRestResponse
appBusinessCnlRent
(
@RequestBody
SpecialRent
specialRent
)
{
UserDTO
userDTO
=
getBusinessUserByAppUser
();
//查询
SpecialRent
specialRentDB
=
baseBiz
.
selectById
(
specialRent
.
getId
());
AssertUtils
.
isBlank
(
specialRentDB
);
if
(
SpecialRent
.
STATUS_CRT
!=
specialRentDB
.
getStatus
())
{
throw
new
BaseException
(
ResultCode
.
AJAX_WECHAT_NOTEXIST_CODE
);
}
//拒绝原来的预约
orderRentVehicleService
.
errorRejectVehicle
(
new
RentVehicleBO
(){{
setBookRecordId
(
specialRent
.
getBookRecordId
());
setBookRecordId
(
specialRent
DB
.
getBookRecordId
());
}});
//设置车辆上架
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
());
setStatus
(
SpecialRent
.
STATUS_CNL
);
setUpdUser
(
userDTO
.
getId
().
toString
());
}});
return
ObjectRestResponse
.
succ
();
}
@RequestMapping
(
value
=
"/app
Business
/pageList"
,
method
=
RequestMethod
.
GET
)
@RequestMapping
(
value
=
"/app/pageList"
,
method
=
RequestMethod
.
GET
)
@ResponseBody
@ApiOperation
(
value
=
"分页查询可参加特惠租车"
)
public
ObjectRestResponse
<
SpecialRentVO
>
pageList
(
QueryDTO
dto
)
{
...
...
@@ -98,7 +112,6 @@ public class SpecialRentController extends BaseController<SpecialRentBiz, Specia
if
(
StrUtil
.
isBlank
(
getCurrentUserId
()))
{
throw
new
BaseException
(
ResultCode
.
AJAX_WECHAT_NOTEXIST_CODE
);
}
dto
.
setUserId
(
getCurrentUserIdInt
());
Query
query
=
new
Query
(
dto
);
PageDataVO
<
SpecialRentVO
>
pages
=
PageDataVO
.
pageInfo
(
query
,
()
->
baseBiz
.
selectByWeekend
(
w
->
{
w
.
andEqualTo
(
SpecialRent:
:
getStatus
,
STATUS_CRT
);
...
...
@@ -108,7 +121,26 @@ public class SpecialRentController extends BaseController<SpecialRentBiz, Specia
return
ObjectRestResponse
.
succ
(
pages
);
}
@RequestMapping
(
value
=
"/appBusiness/specialOrder"
,
method
=
RequestMethod
.
POST
)
@RequestMapping
(
value
=
"/appBusiness/myList"
,
method
=
RequestMethod
.
GET
)
@ResponseBody
@ApiOperation
(
value
=
"分页查询我发布的特惠租车"
)
public
ObjectRestResponse
<
SpecialRentVO
>
myList
(
QueryDTO
dto
)
{
//查询列表数据
if
(
StrUtil
.
isBlank
(
getCurrentUserId
()))
{
throw
new
BaseException
(
ResultCode
.
AJAX_WECHAT_NOTEXIST_CODE
);
}
UserDTO
userDTO
=
getBusinessUserByAppUser
();
Query
query
=
new
Query
(
dto
);
PageDataVO
<
SpecialRentVO
>
pages
=
PageDataVO
.
pageInfo
(
query
,
()
->
baseBiz
.
selectByWeekend
(
w
->
{
w
.
andEqualTo
(
SpecialRent:
:
getIsDel
,
SYS_FALSE
);
w
.
andEqualTo
(
SpecialRent:
:
getPublishUserId
,
userDTO
.
getId
());
return
w
;
},
" crt_time desc "
),
SpecialRentVO
.
class
);
return
ObjectRestResponse
.
succ
(
pages
);
}
@RequestMapping
(
value
=
"/app/specialOrder"
,
method
=
RequestMethod
.
POST
)
@ResponseBody
@ApiOperation
(
value
=
"特惠租车下单"
)
public
ObjectRestResponse
specialOrder
(
@RequestBody
SpecialOrderDTO
dto
)
{
...
...
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