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
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
46 additions
and
18 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 {
private
String
expectEnd
;
private
String
priority
;
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 @@
package
com
.
alibaba
.
cloud
.
integration
.
order
.
entity
;
import
lombok.Data
;
import
javax.persistence.Entity
;
import
javax.persistence.GeneratedValue
;
import
javax.persistence.GenerationType
;
...
...
@@ -23,7 +25,8 @@ import javax.persistence.Id;
import
java.io.Serializable
;
@Entity
public
class
OrderRequestEntity
implements
Serializable
{
@Data
public
class
OrderRequestEntity
{
@Id
@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 @@
package
com
.
alibaba
.
cloud
.
integration
.
order
.
service
.
impl
;
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.entity.OrderRequestEntity
;
import
com.alibaba.cloud.integration.order.feign.AccountServiceFeignClient
;
import
com.alibaba.cloud.integration.order.feign.StorageServiceFeignClient
;
import
com.alibaba.cloud.integration.order.mapper.OrderMapper
;
...
...
@@ -33,22 +36,37 @@ import org.springframework.stereotype.Service;
@Service
public
class
OrderServiceImpl
implements
OrderService
{
@Autowired
private
OrderMapper
orderMapper
;
@Autowired
private
OrderReqeustDao
orderReqeustDao
;
@Autowired
private
AccountServiceFeignClient
accountService
;
@Autowired
private
StorageServiceFeignClient
storageService
;
@Override
@GlobalTransactional
public
Result
<?>
createOrder
(
OrderCreateReqDTO
orderCreateReqDTO
)
{
log
.
info
(
"[createOrder] current XID: {}"
,
RootContext
.
getXID
());
return
null
;
}
@Override
@GlobalTransactional
public
Result
<?>
createOrder
(
OrderCreateReqDTO
req
)
{
log
.
info
(
"[createOrder] current XID: {}"
,
RootContext
.
getXID
());
OrderRequestEntity
entity
=
new
OrderRequestEntity
();
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