Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
app-service
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Container Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
SuperHive
back-end
app-service
Commits
5e2eca10
Commit
5e2eca10
authored
Jun 05, 2020
by
zhangzc
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加司机抢单接口
parent
0d8e7e6d
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
322 additions
and
2 deletions
+322
-2
OwnerContractInterface.java
...ava/com/esv/freight/app/feign/OwnerContractInterface.java
+26
-0
TmsGrabInterface.java
...main/java/com/esv/freight/app/feign/TmsGrabInterface.java
+8
-0
OwnerContractController.java
...p/module/contract/controller/OwnerContractController.java
+71
-0
ContractQueryForm.java
...v/freight/app/module/contract/form/ContractQueryForm.java
+34
-0
OwnerContractPojo.java
...v/freight/app/module/contract/pojo/OwnerContractPojo.java
+65
-0
OwnerContractDetailVO.java
...freight/app/module/contract/vo/OwnerContractDetailVO.java
+72
-0
GrabController.java
...reight/app/module/grabbing/controller/GrabController.java
+34
-2
OrderGrabbingForm.java
...v/freight/app/module/grabbing/form/OrderGrabbingForm.java
+6
-0
OrderController.java
.../freight/app/module/order/controller/OrderController.java
+1
-0
OrderListItemVO.java
.../com/esv/freight/app/module/order/vo/OrderListItemVO.java
+5
-0
No files found.
src/main/java/com/esv/freight/app/feign/OwnerContractInterface.java
0 → 100644
View file @
5e2eca10
package
com
.
esv
.
freight
.
app
.
feign
;
import
com.alibaba.fastjson.JSONObject
;
import
org.springframework.cloud.openfeign.FeignClient
;
import
org.springframework.web.bind.annotation.PostMapping
;
/**
* @description:
* @project: freight-app-service
* @name: com.esv.freight.app.feign.DriverInterface
* @author: 张志臣
* @email: zhangzhichen@esvtek.com
* @createTime: 2020/06/05 13:00
* @version:1.0
*/
@FeignClient
(
value
=
"freight-customer-service"
)
public
interface
OwnerContractInterface
{
/**
* 货主合同详情
* @param bodyJson
* @return
*/
@PostMapping
(
value
=
"/customer/contract/online/getContractByNumber"
)
JSONObject
detail
(
JSONObject
bodyJson
);
}
src/main/java/com/esv/freight/app/feign/TmsGrabInterface.java
View file @
5e2eca10
...
...
@@ -30,4 +30,12 @@ public interface TmsGrabInterface {
*/
@PostMapping
(
value
=
"tms/order/grabbing/grab"
)
JSONObject
grabOrder
(
JSONObject
bodyJson
);
/**
* 司机抢单
* @param bodyJson
* @return
*/
@PostMapping
(
value
=
"tms/order/grabbing/grab/prepare"
)
JSONObject
grabOrderPrepare
(
JSONObject
bodyJson
);
}
src/main/java/com/esv/freight/app/module/contract/controller/OwnerContractController.java
0 → 100644
View file @
5e2eca10
package
com
.
esv
.
freight
.
app
.
module
.
contract
.
controller
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.esv.freight.app.common.exception.EException
;
import
com.esv.freight.app.common.response.EResponse
;
import
com.esv.freight.app.common.util.FeignUtils
;
import
com.esv.freight.app.common.validator.groups.ValidatorDetail
;
import
com.esv.freight.app.common.validator.groups.ValidatorList
;
import
com.esv.freight.app.feign.OwnerComplaintInterface
;
import
com.esv.freight.app.feign.OwnerContractInterface
;
import
com.esv.freight.app.module.complaint.form.OwnerComplaintForm
;
import
com.esv.freight.app.module.contract.form.ContractQueryForm
;
import
com.esv.freight.app.module.contract.pojo.OwnerContractPojo
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.ArrayList
;
import
java.util.List
;
/**
* @description: 货主合同Controller
* @project: freight-app-service
* @name: com.esv.freight.app.module.contract.controller.OwnerContractController
* @author: 张志臣
* @email: zhangzhichen@esvtek.com
* @createTime: 2020/06/05 13:30
* @version:1.0
*/
@RestController
@RequestMapping
(
"/ownerBackend/contract"
)
@Slf4j
@Validated
public
class
OwnerContractController
{
private
OwnerContractInterface
ownerContractInterface
;
@Autowired
public
OwnerContractController
(
OwnerContractInterface
ownerContractInterface
)
{
this
.
ownerContractInterface
=
ownerContractInterface
;
}
/**
* description 获取线下文本合同(货主)详情
* param [form]
* return com.esv.freight.customer.common.response.EResponse
* author Administrator
* createTime 2020/06/05 13:30
**/
@PostMapping
(
"/detail"
)
public
EResponse
detail
(
@RequestBody
@Validated
(
ValidatorDetail
.
class
)
ContractQueryForm
form
)
throws
EException
{
// 调用投诉列表分页查询接口
JSONObject
reqJson
=
new
JSONObject
();
reqJson
.
put
(
"contractNumber"
,
form
.
getContractNumber
());
log
.
info
(
reqJson
.
toJSONString
());
JSONObject
result
=
ownerContractInterface
.
detail
(
reqJson
);
log
.
info
(
result
.
toJSONString
());
if
(!
FeignUtils
.
isFeignSuccess
(
result
))
{
return
FeignUtils
.
getFeignEResponse
(
result
);
}
OwnerContractPojo
driverAccountInfoPojo
=
JSONObject
.
toJavaObject
(
FeignUtils
.
getFeignDataJson
(
result
),
OwnerContractPojo
.
class
);
return
EResponse
.
ok
(
driverAccountInfoPojo
);
}
}
src/main/java/com/esv/freight/app/module/contract/form/ContractQueryForm.java
0 → 100644
View file @
5e2eca10
package
com
.
esv
.
freight
.
app
.
module
.
contract
.
form
;
import
com.esv.freight.app.common.validator.groups.ValidatorDetail
;
import
lombok.Data
;
import
org.apache.commons.lang3.builder.ToStringBuilder
;
import
org.apache.commons.lang3.builder.ToStringStyle
;
import
org.hibernate.validator.constraints.Length
;
import
javax.validation.constraints.NotBlank
;
import
javax.validation.constraints.NotNull
;
/**
* @description:
* @project: freight-app-service
* @name: com.esv.freight.app.module.contract.form.ContractQueryForm
* @author: 张志臣
* @email: zhangzhichen@esvtek.com
* @createTime: 2020/06/05 13:25
* @version:1.0
*/
@Data
public
class
ContractQueryForm
{
/**
* 合同编号
*/
@Length
(
max
=
64
,
message
=
"参数contractNumber长度不合法"
,
groups
=
{
ValidatorDetail
.
class
})
@NotBlank
(
message
=
"参数contractNumber不能为空"
,
groups
=
{
ValidatorDetail
.
class
})
private
String
contractNumber
;
@Override
public
String
toString
()
{
return
ToStringBuilder
.
reflectionToString
(
this
,
ToStringStyle
.
JSON_STYLE
);
}
}
src/main/java/com/esv/freight/app/module/contract/pojo/OwnerContractPojo.java
0 → 100644
View file @
5e2eca10
package
com
.
esv
.
freight
.
app
.
module
.
contract
.
pojo
;
import
lombok.Data
;
/**
* @description:
* @project: freight-app-service
* @name: com.esv.freight.app.module.contract.pojo.OwnerContractPojo
* @author: 张志臣
* @email: zhangzhichen@esvtek.com
* @createTime: 2020/06/05 14:00
* @version:1.0
*/
@Data
public
class
OwnerContractPojo
{
/**
*
*/
private
Long
id
;
/**
* 合同类型:1-货主与平台合同、2-司机与平台合同
*/
private
Integer
contractType
;
/**
* 合同文件ID
*/
private
String
contractFileId
;
/**
* 合同文件URL
*/
private
String
contractFileUrl
;
/**
* 合同编号
*/
private
String
contractNumber
;
/**
* 业务编号(订单号或运单号)
*/
private
String
businessNumber
;
/**
* 客户ID
*/
private
Long
customerId
;
/**
* 客户名称
*/
private
String
customerName
;
/**
* 客户(货主或司机)签订时间
*/
private
Long
customerSignTime
;
/**
* 平台签订时间
*/
private
Long
platformSignTime
;
/**
* 合同签订完成:1-是,2-否
*/
private
Integer
signComplete
;
/**
* 合同生效时间
*/
private
Long
effectiveTime
;
}
src/main/java/com/esv/freight/app/module/contract/vo/OwnerContractDetailVO.java
0 → 100644
View file @
5e2eca10
package
com
.
esv
.
freight
.
app
.
module
.
contract
.
vo
;
import
lombok.Data
;
import
org.apache.commons.lang3.builder.ToStringBuilder
;
import
org.apache.commons.lang3.builder.ToStringStyle
;
/**
* @description:
* @project: freight-app-service
* @name: com.esv.freight.app.module.contract.vo.OwnerContractDetailVO
* @author: 张志臣
* @email: zhangzhichen@esvtek.com
* @createTime: 2020/06/05 13:25
* @version:1.0
*/
@Data
public
class
OwnerContractDetailVO
{
/**
*
*/
private
Long
id
;
/**
* 合同类型:1-货主与平台合同、2-司机与平台合同
*/
private
Integer
contractType
;
/**
* 合同文件ID
*/
private
String
contractFileId
;
/**
* 合同文件URL
*/
private
String
contractFileUrl
;
/**
* 合同编号
*/
private
String
contractNumber
;
/**
* 业务编号(订单号或运单号)
*/
private
String
businessNumber
;
/**
* 客户ID
*/
private
Long
customerId
;
/**
* 客户名称
*/
private
String
customerName
;
/**
* 客户(货主或司机)签订时间
*/
private
Long
customerSignTime
;
/**
* 平台签订时间
*/
private
Long
platformSignTime
;
/**
* 合同签订完成:1-是,2-否
*/
private
Integer
signComplete
;
/**
* 合同生效时间
*/
private
Long
effectiveTime
;
@Override
public
String
toString
()
{
return
ToStringBuilder
.
reflectionToString
(
this
,
ToStringStyle
.
JSON_STYLE
);
}
}
src/main/java/com/esv/freight/app/module/grabbing/controller/GrabController.java
View file @
5e2eca10
...
...
@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONArray;
import
com.alibaba.fastjson.JSONObject
;
import
com.esv.freight.app.common.response.ECode
;
import
com.esv.freight.app.common.response.EResponse
;
import
com.esv.freight.app.common.util.FeignUtils
;
import
com.esv.freight.app.common.validator.groups.ValidatorInsert
;
import
com.esv.freight.app.common.validator.groups.ValidatorList
;
import
com.esv.freight.app.common.validator.groups.ValidatorUpdate
;
...
...
@@ -154,6 +155,7 @@ public class GrabController {
reqJson
.
put
(
"orderGrabbingId"
,
orderGrabbingForm
.
getOrderGrabbingId
());
reqJson
.
put
(
"driverId"
,
orderGrabbingForm
.
getDriverId
());
reqJson
.
put
(
"vehicleId"
,
orderGrabbingForm
.
getVehicleId
());
reqJson
.
put
(
"signData"
,
orderGrabbingForm
.
getSignData
());
log
.
info
(
reqJson
.
toJSONString
());
JSONObject
result
=
tmsGrabInterface
.
grabOrder
(
reqJson
);
log
.
info
(
result
.
toJSONString
());
...
...
@@ -162,8 +164,38 @@ public class GrabController {
return
EResponse
.
error
(
1009
,
"已经抢过该订单了"
);
}
if
(
result
.
getInteger
(
"code"
)
!=
200
)
{
return
EResponse
.
error
(
result
.
getInteger
(
"code"
),
result
.
getString
(
"message"
));
if
(!
FeignUtils
.
isFeignSuccess
(
result
))
{
return
FeignUtils
.
getFeignEResponse
(
result
);
}
return
EResponse
.
ok
();
}
/**
* description 判断司机是否符合抢单条件
* param orderGrabbingForm
* return com.esv.freight.common.response.EResponse
* author 张志臣
* createTime 2020/06/05 09:20
**/
@PostMapping
(
"/find/grab/prepare"
)
public
EResponse
prepare
(
@RequestBody
(
required
=
false
)
@Validated
(
ValidatorInsert
.
class
)
OrderGrabbingForm
orderGrabbingForm
)
{
// 调用抢单接口
JSONObject
reqJson
=
new
JSONObject
();
reqJson
.
put
(
"orderGrabbingId"
,
orderGrabbingForm
.
getOrderGrabbingId
());
reqJson
.
put
(
"driverId"
,
orderGrabbingForm
.
getDriverId
());
reqJson
.
put
(
"vehicleId"
,
orderGrabbingForm
.
getVehicleId
());
log
.
info
(
reqJson
.
toJSONString
());
JSONObject
result
=
tmsGrabInterface
.
grabOrderPrepare
(
reqJson
);
log
.
info
(
result
.
toJSONString
());
if
(
result
.
getInteger
(
"code"
)
==
1009
)
{
return
EResponse
.
error
(
1009
,
"已经抢过该订单了"
);
}
if
(!
FeignUtils
.
isFeignSuccess
(
result
))
{
return
FeignUtils
.
getFeignEResponse
(
result
);
}
return
EResponse
.
ok
();
...
...
src/main/java/com/esv/freight/app/module/grabbing/form/OrderGrabbingForm.java
View file @
5e2eca10
...
...
@@ -7,6 +7,7 @@ import org.apache.commons.lang3.builder.ToStringStyle;
import
javax.validation.constraints.DecimalMax
;
import
javax.validation.constraints.DecimalMin
;
import
javax.validation.constraints.NotBlank
;
import
javax.validation.constraints.NotNull
;
import
java.math.BigDecimal
;
...
...
@@ -47,6 +48,11 @@ public class OrderGrabbingForm {
@DecimalMin
(
value
=
"0.000000"
,
message
=
"运费司机议价单价不合法"
,
groups
=
{
ValidatorInsert
.
class
})
private
BigDecimal
freightUnitPriceOutput
;
/**
* 司机签名数据
*/
private
String
signData
;
@Override
public
String
toString
()
{
return
ToStringBuilder
.
reflectionToString
(
this
,
ToStringStyle
.
JSON_STYLE
);
...
...
src/main/java/com/esv/freight/app/module/order/controller/OrderController.java
View file @
5e2eca10
...
...
@@ -131,6 +131,7 @@ public class OrderController {
vo
.
setRequiredReceiveTime
(
object
.
getLong
(
"requiredReceiveTime"
));
vo
.
setCreateTime
(
object
.
getLong
(
"createTime"
));
vo
.
setOrderSource
(
object
.
getString
(
"orderSource"
));
vo
.
setContractNumber
(
object
.
getString
(
"contractNumber"
));
vo
.
setPlaceOrderTime
(
object
.
getLong
(
"placeOrderTime"
));
records
.
add
(
vo
);
}
...
...
src/main/java/com/esv/freight/app/module/order/vo/OrderListItemVO.java
View file @
5e2eca10
...
...
@@ -121,4 +121,9 @@ public class OrderListItemVO {
* 客户下单时间
*/
private
Long
placeOrderTime
;
/**
* 合同编号
*/
private
String
contractNumber
;
}
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