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 971dae05
authored
May 18, 2023
by
chamberone
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop' of
https://zhangguoping@gitlab.dituhui.com/bsh/project/pr…
…oject.git into develop
2 parents
010f7290
a0328826
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
105 additions
and
67 deletions
project-order/src/main/java/com/alibaba/cloud/integration/order/controller/OrderServiceListController.java
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/OrderServiceList.java → project-order/src/main/java/com/alibaba/cloud/integration/order/service/OrderServiceListService.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/service/impl/OrderServiceListImpl.java → project-order/src/main/java/com/alibaba/cloud/integration/order/service/impl/OrderServiceListServiceImpl.java
project-order/src/main/java/com/alibaba/cloud/integration/order/controller/OrderServiceListController.java
View file @
971dae0
...
...
@@ -2,8 +2,7 @@ package com.alibaba.cloud.integration.order.controller;
import
com.alibaba.cloud.integration.common.BusinessException
;
import
com.alibaba.cloud.integration.common.Result
;
import
com.alibaba.cloud.integration.order.dto.OrderServiceListReq
;
import
com.alibaba.cloud.integration.order.service.OrderServiceList
;
import
com.alibaba.cloud.integration.order.service.OrderServiceListService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.*
;
...
...
@@ -14,13 +13,23 @@ import org.springframework.web.bind.annotation.*;
public
class
OrderServiceListController
{
@Autowired
private
OrderServiceList
orderServiceList
;
private
OrderServiceList
Service
orderServiceListService
;
@GetMapping
(
"/order/service/list"
)
public
Result
<?>
GetOrderServiceList
(
@RequestParam
OrderServiceListReq
req
)
{
public
Result
<?>
GetOrderServiceList
(
@RequestParam
(
"startDate"
)
String
startDate
,
@RequestParam
(
"endDate"
)
String
endDate
,
@RequestParam
(
"page"
)
long
page
,
@RequestParam
(
"size"
)
long
size
,
@RequestParam
(
"sort"
)
String
sort
,
@RequestParam
(
"appointmentType"
)
String
appointmentType
,
@RequestParam
(
"appointmentStatus"
)
String
appointmentStatus
,
@RequestParam
(
"type"
)
String
type
,
@RequestParam
(
"brand"
)
String
brand
,
@RequestParam
(
"skill"
)
String
skill
)
{
Result
<?>
res
=
null
;
try
{
res
=
orderServiceList
.
GetOrderServiceList
(
req
);
res
=
orderServiceListService
.
GetOrderServiceList
(
startDate
,
endDate
,
page
,
size
,
sort
,
appointmentType
,
appointmentStatus
,
type
,
brand
,
skill
);
}
catch
(
BusinessException
e
)
{
return
Result
.
failed
(
e
.
getMessage
());
...
...
project-order/src/main/java/com/alibaba/cloud/integration/order/dao/OrderReqeustDao.java
0 → 100644
View file @
971dae0
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 @
971dae0
...
...
@@ -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 @
971dae0
...
...
@@ -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/OrderServiceList.java
→
project-order/src/main/java/com/alibaba/cloud/integration/order/service/OrderServiceList
Service
.java
View file @
971dae0
...
...
@@ -4,8 +4,12 @@ import com.alibaba.cloud.integration.common.BusinessException;
import
com.alibaba.cloud.integration.common.Result
;
import
com.alibaba.cloud.integration.order.dto.OrderServiceListReq
;
import
com.alibaba.cloud.integration.order.dto.OrderServiceListResp
;
import
org.springframework.web.bind.annotation.RequestParam
;
public
interface
OrderServiceList
{
public
interface
OrderServiceList
Service
{
Result
<
OrderServiceListResp
>
GetOrderServiceList
(
OrderServiceListReq
req
)
throws
BusinessException
;
Result
<
OrderServiceListResp
>
GetOrderServiceList
(
String
startDate
,
String
endDate
,
long
page
,
long
size
,
String
sort
,
String
appointmentType
,
String
appointmentStatus
,
String
type
,
String
brand
,
String
skill
)
throws
BusinessException
;
}
project-order/src/main/java/com/alibaba/cloud/integration/order/service/impl/OrderServiceImpl.java
View file @
971dae0
...
...
@@ -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
;
...
...
@@ -34,21 +37,36 @@ import org.springframework.stereotype.Service;
public
class
OrderServiceImpl
implements
OrderService
{
@Autowired
private
OrderMapper
orderMapper
;
@Autowired
private
AccountServiceFeignClient
accountService
;
@Autowired
private
StorageServiceFeignClient
storageService
;
private
OrderReqeustDao
orderReqeustDao
;
@Override
@GlobalTransactional
public
Result
<?>
createOrder
(
OrderCreateReqDTO
orderCreateReqDTO
)
{
public
Result
<?>
createOrder
(
OrderCreateReqDTO
req
)
{
log
.
info
(
"[createOrder] current XID: {}"
,
RootContext
.
getXID
());
return
null
;
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
);
}
}
project-order/src/main/java/com/alibaba/cloud/integration/order/service/impl/OrderServiceListImpl.java
→
project-order/src/main/java/com/alibaba/cloud/integration/order/service/impl/OrderServiceList
Service
Impl.java
View file @
971dae0
...
...
@@ -5,11 +5,10 @@ import com.alibaba.cloud.integration.common.Result;
import
com.alibaba.cloud.integration.order.dao.OrderAppointmentDao
;
import
com.alibaba.cloud.integration.order.dao.OrderRequestDao
;
import
com.alibaba.cloud.integration.order.dto.OrderServiceList
;
import
com.alibaba.cloud.integration.order.dto.OrderServiceListReq
;
import
com.alibaba.cloud.integration.order.dto.OrderServiceListResp
;
import
com.alibaba.cloud.integration.order.entity.OrderAppointment
;
import
com.alibaba.cloud.integration.order.entity.OrderRequest
;
import
com.alibaba.cloud.integration.order.service.OrderService
;
import
com.alibaba.cloud.integration.order.service.OrderService
ListService
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
...
...
@@ -23,7 +22,7 @@ import java.util.*;
import
java.util.stream.Collectors
;
@Service
public
class
OrderServiceList
Impl
implements
com
.
alibaba
.
cloud
.
integration
.
order
.
service
.
OrderServiceList
{
public
class
OrderServiceList
ServiceImpl
implements
OrderServiceListService
{
@Autowired
private
OrderRequestDao
orderRequestDao
;
...
...
@@ -31,38 +30,42 @@ public class OrderServiceListImpl implements com.alibaba.cloud.integration.order
@Autowired
private
OrderAppointmentDao
orderAppointmentDao
;
@Override
@Transactional
public
Result
<
OrderServiceListResp
>
GetOrderServiceList
(
OrderServiceListReq
req
)
throws
BusinessException
{
@Override
public
Result
<
OrderServiceListResp
>
GetOrderServiceList
(
String
startDate
,
String
endDate
,
long
page
,
long
size
,
String
sort
,
String
appointmentType
,
String
appointmentStatus
,
String
type
,
String
brand
,
String
skill
)
throws
BusinessException
{
//分页
IPage
<
OrderRequest
>
p
age
=
new
Page
(
req
.
getPage
(),
req
.
getSize
()
);
IPage
<
OrderRequest
>
p
g
=
new
Page
(
page
,
size
);
LambdaQueryWrapper
<
OrderRequest
>
lqw
=
new
LambdaQueryWrapper
<>();
lqw
.
ge
(
OrderRequest:
:
getExpectTimeBegin
,
this
.
GetTimestampFromDate
(
req
.
getStartDate
()
));
//预约开始日期
lqw
.
le
(
OrderRequest:
:
getExpectTimeBegin
,
this
.
GetTimestampFromDate
(
req
.
getEndDate
()
));
//预约结束日期
lqw
.
eq
(
Strings
.
isNotEmpty
(
req
.
getAppointmentStatus
()),
OrderRequest:
:
getStatusAppointment
,
req
.
getAppointmentStatus
()
);
//指派状态
lqw
.
eq
(
Strings
.
isNotEmpty
(
req
.
getType
()),
OrderRequest:
:
getType
,
req
.
getType
()
);
//设备类型
lqw
.
eq
(
Strings
.
isNotEmpty
(
req
.
getBrand
()),
OrderRequest:
:
getBrand
,
req
.
getBrand
()
);
//品牌
lqw
.
eq
(
Strings
.
isNotEmpty
(
req
.
getSkill
()),
OrderRequest:
:
getSkill
,
req
.
getSkill
()
);
//技能
lqw
.
ge
(
OrderRequest:
:
getExpectTimeBegin
,
this
.
GetTimestampFromDate
(
startDate
));
//预约开始日期
lqw
.
le
(
OrderRequest:
:
getExpectTimeBegin
,
this
.
GetTimestampFromDate
(
endDate
));
//预约结束日期
lqw
.
eq
(
Strings
.
isNotEmpty
(
appointmentStatus
),
OrderRequest:
:
getStatusAppointment
,
appointmentStatus
);
//指派状态
lqw
.
eq
(
Strings
.
isNotEmpty
(
type
),
OrderRequest:
:
getType
,
type
);
//设备类型
lqw
.
eq
(
Strings
.
isNotEmpty
(
brand
),
OrderRequest:
:
getBrand
,
brand
);
//品牌
lqw
.
eq
(
Strings
.
isNotEmpty
(
skill
),
OrderRequest:
:
getSkill
,
skill
);
//技能
// 查询工单表列表
orderRequestDao
.
selectPage
(
p
age
,
lqw
);
orderRequestDao
.
selectPage
(
p
g
,
lqw
);
List
<
OrderRequest
>
records
=
p
age
.
getRecords
();
List
<
OrderRequest
>
records
=
p
g
.
getRecords
();
//获取工单订单号列表
List
<
String
>
orderIds
=
new
ArrayList
<>();
for
(
OrderRequest
r:
records
)
{
orderIds
.
add
(
r
.
getOrderId
());
}
// 获取
指派订单
列表
HashMap
<
String
,
List
<
OrderAppointment
>>
appointOrders
=
this
.
PackOrderAppointment
(
this
.
GetOrderAppointment
(
orderIds
));
List
<
OrderAppointment
>
appoint
;
// 获取
工程师姓名
列表
HashMap
<
String
,
List
<
String
>>
engineerNames
=
this
.
GetEngineerNames
(
this
.
GetOrderAppointment
(
orderIds
));
List
<
String
>
names
;
List
<
OrderServiceList
>
content
=
new
ArrayList
<>();
for
(
OrderRequest
o:
records
)
{
OrderServiceList
record
=
new
OrderServiceList
();
appoint
=
appointOrders
.
getOrDefault
(
o
.
getOrderId
(),
List
.
of
());
names
=
engineerNames
.
get
(
o
.
getOrderId
());
record
.
setOrderId
(
o
.
getOrderId
());
record
.
setType
(
o
.
getType
());
record
.
setBrand
(
o
.
getBrand
());
...
...
@@ -76,18 +79,18 @@ public class OrderServiceListImpl implements com.alibaba.cloud.integration.order
record
.
setSource
(
o
.
getSource
());
record
.
setDescription
(
o
.
getDescription
());
record
.
setOrgBranchName
(
o
.
getOrgBranchName
());
record
.
setEngineerNum
(
this
.
getEngNum
(
appoint
));
//工程师数量
record
.
setEngineerNames
(
this
.
getEngNames
(
appoint
));
//工程师姓名列表
record
.
setEngineerNum
(
this
.
getEngNum
(
names
));
//工程师数量
record
.
setEngineerNames
(
this
.
getEngNames
(
names
));
//工程师姓名列表
content
.
add
(
record
);
}
// 组装
OrderServiceListResp
res
=
new
OrderServiceListResp
();
res
.
setTotal
(
p
age
.
getTotal
());
res
.
setPages
(
p
age
.
getPages
());
res
.
setPageCurrent
(
p
age
.
getCurrent
());
res
.
setPageSize
(
p
age
.
getSize
());
res
.
setTotal
(
p
g
.
getTotal
());
res
.
setPages
(
p
g
.
getPages
());
res
.
setPageCurrent
(
p
g
.
getCurrent
());
res
.
setPageSize
(
p
g
.
getSize
());
res
.
setContent
(
content
);
return
Result
.
success
(
res
);
...
...
@@ -101,42 +104,36 @@ public class OrderServiceListImpl implements com.alibaba.cloud.integration.order
return
orderAppointmentDao
.
selectList
(
lqw
);
}
public
HashMap
<
String
,
List
<
OrderAppointment
>>
PackOrderAppointment
(
List
<
OrderAppointment
>
orders
){
HashMap
<
String
,
List
<
OrderAppointment
>>
map
=
new
HashMap
<>();
// 根据订单ID-子订单降序排序
public
HashMap
<
String
,
List
<
String
>>
GetEngineerNames
(
List
<
OrderAppointment
>
orders
){
return
null
;
}
public
HashMap
<
String
,
List
<
String
>>
GetOrderAppointments
(
List
<
OrderAppointment
>
orders
){
// 获取指派单工人姓名
HashMap
<
String
,
List
<
String
>>
map
=
new
HashMap
<>();
// 根据orderId+subOrderId降序排序
Comparator
<
OrderAppointment
>
byOrderIdDesc
=
Comparator
.
comparing
(
OrderAppointment:
:
getOrderId
,
String
.
CASE_INSENSITIVE_ORDER
).
reversed
();
Comparator
<
OrderAppointment
>
bySuborderIdDesc
=
Comparator
.
comparing
(
OrderAppointment:
:
getSuborderId
,
String
.
CASE_INSENSITIVE_ORDER
).
reversed
();
Comparator
<
OrderAppointment
>
comp
=
byOrderIdDesc
.
thenComparing
(
bySuborderIdDesc
);
List
<
OrderAppointment
>
results
=
orders
.
stream
().
sorted
(
comp
).
collect
(
Collectors
.
toList
());
Set
<
String
>
set
=
new
HashSet
<>();
for
(
OrderAppointment
o:
results
){
set
.
add
(
o
.
getOrderId
());
}
for
(
String
s:
set
){
map
.
put
(
s
,
new
ArrayList
<
OrderAppointment
>());
}
// 根据订单ID-子订单分组, 只取一组子订单分组
String
flagOrderId
=
""
;
String
flagSuborderId
=
""
;
for
(
OrderAppointment
o:
results
)
{
}
// TODO
return
map
;
}
private
Integer
getEngNum
(
List
<
OrderAppointment
>
order
s
){
private
Integer
getEngNum
(
List
<
String
>
name
s
){
/*获取工程师数量*/
return
orders
.
size
();
if
(
names
==
null
)
{
return
0
;
}
return
names
.
size
();
}
private
String
getEngNames
(
List
<
OrderAppointment
>
order
s
)
{
private
String
getEngNames
(
List
<
String
>
name
s
)
{
/*获取工程师姓名列表*/
List
<
String
>
names
=
new
ArrayList
<>();
for
(
OrderAppointment
o:
orders
)
{
names
.
add
(
o
.
getEngineerName
());
if
(
names
==
null
)
{
return
""
;
}
return
String
.
join
(
"、"
,
names
);
}
...
...
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