Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
yangxiujun
/
paidan_demo
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 31c45ee6
authored
May 18, 2023
by
丁伟峰
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
订单创建接口实现
1 parent
ac6441f3
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
41 additions
and
13 deletions
project-order/src/main/java/com/alibaba/cloud/integration/order/dao/OrderReqeustDao.java
project-order/src/main/java/com/alibaba/cloud/integration/order/dto/OrderCreateReqDTO.java
project-order/src/main/java/com/alibaba/cloud/integration/order/entity/OrderRequestEntity.java
project-order/src/main/java/com/alibaba/cloud/integration/order/service/impl/OrderServiceImpl.java
project-order/src/main/java/com/alibaba/cloud/integration/order/dao/OrderReqeustDao.java
0 → 100644
View file @
31c45ee
package
com
.
alibaba
.
cloud
.
integration
.
order
.
dao
;
import
com.alibaba.cloud.integration.order.entity.OrderRequestEntity
;
import
org.springframework.data.jpa.repository.JpaRepository
;
public
interface
OrderReqeustDao
extends
JpaRepository
<
OrderRequestEntity
,
Long
>
{
}
project-order/src/main/java/com/alibaba/cloud/integration/order/dto/OrderCreateReqDTO.java
View file @
31c45ee
...
@@ -15,5 +15,5 @@ public class OrderCreateReqDTO {
...
@@ -15,5 +15,5 @@ public class OrderCreateReqDTO {
private
String
expectEnd
;
private
String
expectEnd
;
private
String
priority
;
private
String
priority
;
private
String
orderTags
;
private
String
orderTags
;
private
String
memo
;
private
String
description
;
}
}
project-order/src/main/java/com/alibaba/cloud/integration/order/entity/OrderRequestEntity.java
View file @
31c45ee
...
@@ -16,6 +16,8 @@
...
@@ -16,6 +16,8 @@
package
com
.
alibaba
.
cloud
.
integration
.
order
.
entity
;
package
com
.
alibaba
.
cloud
.
integration
.
order
.
entity
;
import
lombok.Data
;
import
javax.persistence.Entity
;
import
javax.persistence.Entity
;
import
javax.persistence.GeneratedValue
;
import
javax.persistence.GeneratedValue
;
import
javax.persistence.GenerationType
;
import
javax.persistence.GenerationType
;
...
@@ -23,7 +25,8 @@ import javax.persistence.Id;
...
@@ -23,7 +25,8 @@ import javax.persistence.Id;
import
java.io.Serializable
;
import
java.io.Serializable
;
@Entity
@Entity
public
class
OrderRequestEntity
implements
Serializable
{
@Data
public
class
OrderRequestEntity
{
@Id
@Id
@GeneratedValue
(
strategy
=
GenerationType
.
IDENTITY
)
@GeneratedValue
(
strategy
=
GenerationType
.
IDENTITY
)
...
...
project-order/src/main/java/com/alibaba/cloud/integration/order/service/impl/OrderServiceImpl.java
View file @
31c45ee
...
@@ -17,7 +17,10 @@
...
@@ -17,7 +17,10 @@
package
com
.
alibaba
.
cloud
.
integration
.
order
.
service
.
impl
;
package
com
.
alibaba
.
cloud
.
integration
.
order
.
service
.
impl
;
import
com.alibaba.cloud.integration.common.Result
;
import
com.alibaba.cloud.integration.common.Result
;
import
com.alibaba.cloud.integration.order.dao.OrderReqeustDao
;
import
com.alibaba.cloud.integration.order.dto.LocationDTO
;
import
com.alibaba.cloud.integration.order.dto.OrderCreateReqDTO
;
import
com.alibaba.cloud.integration.order.dto.OrderCreateReqDTO
;
import
com.alibaba.cloud.integration.order.entity.OrderRequestEntity
;
import
com.alibaba.cloud.integration.order.feign.AccountServiceFeignClient
;
import
com.alibaba.cloud.integration.order.feign.AccountServiceFeignClient
;
import
com.alibaba.cloud.integration.order.feign.StorageServiceFeignClient
;
import
com.alibaba.cloud.integration.order.feign.StorageServiceFeignClient
;
import
com.alibaba.cloud.integration.order.mapper.OrderMapper
;
import
com.alibaba.cloud.integration.order.mapper.OrderMapper
;
...
@@ -34,21 +37,36 @@ import org.springframework.stereotype.Service;
...
@@ -34,21 +37,36 @@ import org.springframework.stereotype.Service;
public
class
OrderServiceImpl
implements
OrderService
{
public
class
OrderServiceImpl
implements
OrderService
{
@Autowired
@Autowired
private
OrderMapper
orderMapper
;
private
OrderReqeustDao
orderReqeustDao
;
@Autowired
private
AccountServiceFeignClient
accountService
;
@Autowired
private
StorageServiceFeignClient
storageService
;
@Override
@Override
@GlobalTransactional
@GlobalTransactional
public
Result
<?>
createOrder
(
OrderCreateReqDTO
orderCreateReqDTO
)
{
public
Result
<?>
createOrder
(
OrderCreateReqDTO
req
)
{
log
.
info
(
"[createOrder] current XID: {}"
,
RootContext
.
getXID
());
log
.
info
(
"[createOrder] current XID: {}"
,
RootContext
.
getXID
());
OrderRequestEntity
entity
=
new
OrderRequestEntity
();
return
null
;
entity
.
setName
(
req
.
getName
());
entity
.
setPhone
(
req
.
getPhone
());
entity
.
setAddress
(
req
.
getAddress
());
entity
.
setBrand
(
req
.
getBrand
());
entity
.
setCategoryId
(
req
.
getCatalogId
());
entity
.
setFaultDescribe
(
req
.
getFaultDescribe
());
entity
.
setExpectTimeBegin
(
req
.
getExpectBegin
());
entity
.
setExpectTimeEnd
(
req
.
getExpectEnd
());
entity
.
setDescription
(
req
.
getDescription
());
// location
LocationDTO
location
=
req
.
getLocation
();
entity
.
setProvince
(
location
.
getProvince
());
entity
.
setCity
(
location
.
getCity
());
entity
.
setCounty
(
location
.
getCountry
());
orderReqeustDao
.
save
(
entity
);
// 根据orderTags, 解析保存到type、skill等字段
String
[]
l
=
req
.
getLocation
().
getLocation
().
split
(
","
);
entity
.
setX
(
l
[
0
]);
entity
.
setY
(
l
[
1
]);
// todo 服务单状态、预约状态等
entity
.
setStatus
(
""
);
entity
.
setAppointmentStatus
(
""
);
return
Result
.
success
(
null
);
}
}
}
}
Write
Preview
Markdown
is supported
Attach a file
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 post a comment