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 ba1593a2
authored
Jun 14, 2023
by
王力
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature_mvp616_wangl' into 'develop'
Feature mvp616 wangl See merge request !82
2 parents
4b4c8a65
2d6ff345
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
64 additions
and
2 deletions
project-order/src/main/java/com/alibaba/cloud/integration/order/dao/CapacityEngineerStatMPDao.java
project-order/src/main/java/com/alibaba/cloud/integration/order/entity/CapacityEngineerStat.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/dao/CapacityEngineerStatMPDao.java
0 → 100644
View file @
ba1593a
package
com
.
alibaba
.
cloud
.
integration
.
order
.
dao
;
import
com.alibaba.cloud.integration.order.entity.CapacityEngineerStat
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
org.apache.ibatis.annotations.Mapper
;
@Mapper
public
interface
CapacityEngineerStatMPDao
extends
BaseMapper
<
CapacityEngineerStat
>
{
}
project-order/src/main/java/com/alibaba/cloud/integration/order/entity/CapacityEngineerStat.java
0 → 100644
View file @
ba1593a
package
com
.
alibaba
.
cloud
.
integration
.
order
.
entity
;
import
lombok.Data
;
import
java.sql.Timestamp
;
@Data
public
class
CapacityEngineerStat
{
private
long
id
;
private
String
workDay
;
private
String
engineerCode
;
private
Integer
capTotal
;
private
Integer
capUsed
;
private
Integer
capUsedTravel
;
private
Integer
capLeft
;
private
Integer
orderCount
;
private
Integer
maxDuration
;
private
Integer
memo
;
private
Timestamp
createTime
;
private
Timestamp
updateTime
;
}
project-order/src/main/java/com/alibaba/cloud/integration/order/service/impl/DispatchServiceImpl.java
View file @
ba1593a
...
...
@@ -41,6 +41,9 @@ public class DispatchServiceImpl implements DispatchService {
@Autowired
private
ProductCategoryMPDao
productCategoryMPDao
;
@Autowired
private
CapacityEngineerStatMPDao
capacityEngineerStatMPDao
;
@Transactional
@Override
public
Result
<?>
getDispatchOrderList
(
String
levelType
,
List
<
String
>
levelIds
,
String
date
,
String
groupTagId
)
{
...
...
@@ -106,6 +109,9 @@ public class DispatchServiceImpl implements DispatchService {
// 获取技术员已指派单列表
Map
<
String
,
List
<
OrderAppointment
>>
engineerOrders
=
this
.
queryEngineerOrders
(
engineerCodes
,
date
);
// 获取技术员的容量
HashMap
<
String
,
CapacityEngineerStat
>
engineerCap
=
this
.
queryCapacityEngineerStat
(
engineerCodes
,
date
);
// 获取订单ID
Set
<
String
>
orderIds
=
new
HashSet
<>();
for
(
String
k
:
engineerOrders
.
keySet
())
{
...
...
@@ -155,13 +161,26 @@ public class DispatchServiceImpl implements DispatchService {
items
.
add
(
item
);
}
// 获取容量
int
capUsed
=
0
;
int
capTotal
=
0
;
String
capacityStatus
=
"less"
;
CapacityEngineerStat
cap
=
engineerCap
.
get
(
e
.
getEngineerCode
());
if
(
cap
!=
null
)
{
capUsed
=
cap
.
getCapUsed
();
capTotal
=
cap
.
getCapTotal
();
if
(
capTotal
>
0
&&
(
float
)
capUsed
/
capTotal
<
0.8
)
{
capacityStatus
=
"normal"
;
}
}
DispatchEngineerOrderListResp
.
EngineerInfo
eg
=
new
DispatchEngineerOrderListResp
.
EngineerInfo
();
eg
.
setOrders
(
items
);
eg
.
setEngineerCode
(
e
.
getEngineerCode
());
eg
.
setEngineerName
(
e
.
getName
());
eg
.
setCapacity
(
""
);
eg
.
setCapacityStatus
(
""
);
eg
.
setCertificate
(
e
.
getCredentials
());
eg
.
setCapacity
(
String
.
format
(
"%d/%d"
,
capUsed
,
capTotal
));
eg
.
setCapacityStatus
(
capacityStatus
);
egs
.
add
(
eg
);
}
...
...
@@ -245,6 +264,19 @@ public class DispatchServiceImpl implements DispatchService {
return
map
;
}
private
HashMap
<
String
,
CapacityEngineerStat
>
queryCapacityEngineerStat
(
List
<
String
>
engineerCodes
,
String
date
)
{
LambdaQueryWrapper
<
CapacityEngineerStat
>
lqw
=
new
LambdaQueryWrapper
<>();
lqw
.
eq
(
CapacityEngineerStat:
:
getWorkDay
,
date
);
lqw
.
in
(
CapacityEngineerStat:
:
getEngineerCode
,
engineerCodes
);
List
<
CapacityEngineerStat
>
records
=
capacityEngineerStatMPDao
.
selectList
(
lqw
);
HashMap
<
String
,
CapacityEngineerStat
>
map
=
new
HashMap
<>();
for
(
CapacityEngineerStat
r
:
records
)
{
map
.
put
(
r
.
getEngineerCode
(),
r
);
}
return
map
;
}
public
Timestamp
getTimestampFromDate
(
String
date
,
String
time
)
{
return
Timestamp
.
valueOf
(
date
+
" "
+
time
);
}
...
...
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