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 bcd8d1b5
authored
Jun 08, 2023
by
wangli
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
派工台功能实现
1 parent
ab38b472
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
96 additions
and
7 deletions
project-order/src/main/java/com/alibaba/cloud/integration/order/controller/DispatchController.java
project-order/src/main/java/com/alibaba/cloud/integration/order/service/DispatchService.java
project-order/src/main/java/com/alibaba/cloud/integration/order/service/impl/DispatchServiceImpl.java
project-order/src/main/java/com/alibaba/cloud/integration/order/controller/DispatchController.java
View file @
bcd8d1b
...
...
@@ -6,6 +6,8 @@ import com.alibaba.cloud.integration.order.service.DispatchService;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.*
;
import
java.util.List
;
@RestController
@RequestMapping
(
"/pea-order"
)
public
class
DispatchController
{
...
...
@@ -14,7 +16,7 @@ public class DispatchController {
private
DispatchService
dispatchService
;
@GetMapping
(
"/dispatch/order/list"
)
public
Result
<?>
getDispatchOrderList
(
@RequestParam
String
levelType
,
@RequestParam
(
"levelId"
)
String
levelIds
,
public
Result
<?>
getDispatchOrderList
(
@RequestParam
String
levelType
,
@RequestParam
(
"levelId"
)
List
<
String
>
levelIds
,
@RequestParam
String
date
,
@RequestParam
String
groupTagId
)
{
// 获取派工台待派订单列表
Result
<?>
res
=
null
;
...
...
@@ -27,7 +29,7 @@ public class DispatchController {
}
@GetMapping
(
"/dispatch/engineer/order/list"
)
public
Result
<?>
getDispatchEngineerOrderList
(
@RequestParam
String
levelType
,
@RequestParam
(
"levelId"
)
String
levelIds
,
@RequestParam
String
date
)
{
public
Result
<?>
getDispatchEngineerOrderList
(
@RequestParam
String
levelType
,
@RequestParam
(
"levelId"
)
List
<
String
>
levelIds
,
@RequestParam
String
date
)
{
// 获取派工台工程师已派订单列表
Result
<?>
res
=
null
;
try
{
...
...
project-order/src/main/java/com/alibaba/cloud/integration/order/service/DispatchService.java
View file @
bcd8d1b
package
com
.
alibaba
.
cloud
.
integration
.
order
.
service
;
import
com.alibaba.cloud.integration.common.Result
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
java.util.List
;
public
interface
DispatchService
{
Result
<?>
getDispatchOrderList
(
String
levelType
,
String
levelIds
,
String
date
,
String
groupTagId
);
Result
<?>
getDispatchEngineerOrderList
(
String
levelType
,
String
levelIds
,
String
date
);
Result
<?>
getDispatchOrderList
(
String
levelType
,
List
<
String
>
levelIds
,
String
date
,
String
groupTagId
);
Result
<?>
getDispatchEngineerOrderList
(
String
levelType
,
List
<
String
>
levelIds
,
String
date
);
Result
<?>
dispatchOrderConfirm
(
String
engineerCode
,
String
orderIds
);
}
project-order/src/main/java/com/alibaba/cloud/integration/order/service/impl/DispatchServiceImpl.java
View file @
bcd8d1b
package
com
.
alibaba
.
cloud
.
integration
.
order
.
service
.
impl
;
import
com.alibaba.cloud.integration.common.Result
;
import
com.alibaba.cloud.integration.order.dao.EngineerInfoMPDao
;
import
com.alibaba.cloud.integration.order.dao.OrderAppointmentMPDao
;
import
com.alibaba.cloud.integration.order.dao.OrderRequestMPDao
;
import
com.alibaba.cloud.integration.order.dao.OrgGroupMPDao
;
import
com.alibaba.cloud.integration.order.entity.EngineerInfo
;
import
com.alibaba.cloud.integration.order.entity.OrderAppointment
;
import
com.alibaba.cloud.integration.order.entity.OrderRequest
;
import
com.alibaba.cloud.integration.order.entity.OrgGroup
;
import
com.alibaba.cloud.integration.order.service.DispatchService
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.text.SimpleDateFormat
;
import
java.util.List
;
import
java.util.stream.Collectors
;
@Service
public
class
DispatchServiceImpl
implements
DispatchService
{
@Autowired
private
OrderRequestMPDao
orderRequestMPDao
;
@Autowired
private
OrderAppointmentMPDao
orderAppointmentMPDao
;
@Autowired
private
OrgGroupMPDao
orgGroupMPDao
;
@Autowired
private
EngineerInfoMPDao
engineerInfoMPDao
;
@Override
public
Result
<?>
getDispatchOrderList
(
String
levelType
,
String
levelIds
,
String
date
,
String
groupId
)
{
public
Result
<?>
getDispatchOrderList
(
String
levelType
,
List
<
String
>
levelIds
,
String
date
,
String
groupTagId
)
{
List
<
OrderRequest
>
orders
=
this
.
queryOrderRequests
(
levelType
,
levelIds
,
date
);
return
null
;
}
@Override
public
Result
<?>
getDispatchEngineerOrderList
(
String
levelType
,
String
levelIds
,
String
date
)
{
public
Result
<?>
getDispatchEngineerOrderList
(
String
levelType
,
List
<
String
>
levelIds
,
String
date
)
{
return
null
;
}
...
...
@@ -21,4 +49,60 @@ public class DispatchServiceImpl implements DispatchService {
return
null
;
}
private
List
<
OrderRequest
>
queryOrderRequests
(
String
levelType
,
List
<
String
>
levelIds
,
String
date
)
{
// 获取服务单列表
LambdaQueryWrapper
<
OrderRequest
>
lqw
=
new
LambdaQueryWrapper
<>();
lqw
.
in
(
levelType
.
equals
(
"cluster"
),
OrderRequest:
:
getOrgClusterId
,
levelIds
);
lqw
.
in
(
levelType
.
equals
(
"branch"
),
OrderRequest:
:
getOrgBranchId
,
levelIds
);
lqw
.
in
(
levelType
.
equals
(
"group"
),
OrderRequest:
:
getOrgGroupId
,
levelIds
);
lqw
.
eq
(
OrderRequest:
:
getStatus
,
"open"
);
lqw
.
ge
(
OrderRequest:
:
getExpectTimeBegin
,
this
.
DateString2Timestamp
(
date
,
"00:00:00"
));
lqw
.
le
(
OrderRequest:
:
getExpectTimeBegin
,
this
.
DateString2Timestamp
(
date
,
"23:59:59"
));
List
<
String
>
statuses
=
List
.
of
(
""
,
"未派单"
);
lqw
.
eq
(
OrderRequest:
:
getAppointmentStatus
,
statuses
);
return
orderRequestMPDao
.
selectList
(
lqw
);
}
private
List
<
OrderAppointment
>
queryOrderAppointments
(
List
<
String
>
engineerCodes
,
String
date
)
{
// 获取工程师服务单列表
LambdaQueryWrapper
<
OrderAppointment
>
lqw
=
new
LambdaQueryWrapper
<>();
lqw
.
in
(
OrderAppointment:
:
getEngineerCode
,
engineerCodes
);
lqw
.
eq
(
OrderAppointment:
:
getStatus
,
"预指派"
);
lqw
.
ge
(
OrderAppointment:
:
getExpectTime
,
this
.
DateString2Timestamp
(
date
,
"00:00:00"
));
lqw
.
le
(
OrderAppointment:
:
getExpectTime
,
this
.
DateString2Timestamp
(
date
,
"23:59:59"
));
orderAppointmentMPDao
.
selectList
(
lqw
);
return
null
;
}
private
List
<
String
>
queryEngineerCodes
(
List
<
String
>
groupIds
)
{
// 通过groupIds获取技术员列表
LambdaQueryWrapper
<
EngineerInfo
>
lqw
=
new
LambdaQueryWrapper
<>();
lqw
.
in
(
EngineerInfo:
:
getGroupId
,
groupIds
);
lqw
.
eq
(
EngineerInfo:
:
getBeanStatus
,
1
);
List
<
EngineerInfo
>
engineers
=
engineerInfoMPDao
.
selectList
(
lqw
);
return
engineers
.
stream
().
map
(
EngineerInfo:
:
getEngineerCode
).
collect
(
Collectors
.
toList
());
}
private
List
<
String
>
queryOrgGroupIds
(
String
levelType
,
List
<
String
>
levelIds
)
{
LambdaQueryWrapper
<
OrgGroup
>
lqw
=
new
LambdaQueryWrapper
<>();
lqw
.
in
(
levelType
.
equals
(
"cluster"
),
OrgGroup:
:
getClusterId
,
levelIds
);
lqw
.
in
(
levelType
.
equals
(
"branch"
),
OrgGroup:
:
getBranchId
,
levelIds
);
lqw
.
in
(
levelType
.
equals
(
"group"
),
OrgGroup:
:
getGroupId
,
levelIds
);
List
<
OrgGroup
>
groups
=
orgGroupMPDao
.
selectList
(
lqw
);
return
groups
.
stream
().
map
(
OrgGroup:
:
getGroupId
).
collect
(
Collectors
.
toList
());
}
private
long
DateString2Timestamp
(
String
date
,
String
time
)
{
String
datetime
=
String
.
format
(
"%s %s"
,
date
,
time
);
SimpleDateFormat
dateFormat
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
try
{
return
dateFormat
.
parse
(
datetime
).
getTime
();
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
return
0
;
}
}
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