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 bd7e6e87
authored
Jul 21, 2023
by
王力
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev_engineer_bussiness' into 'develop'
Dev engineer bussiness See merge request !257
2 parents
7b8df1cb
2bcf09a0
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
60 additions
and
20 deletions
project-order/src/main/java/com/dituhui/pea/order/common/TimeUtils.java
project-order/src/main/java/com/dituhui/pea/order/controller/EngineerController.java
project-order/src/main/java/com/dituhui/pea/order/dto/EngineerBusinessListResp.java
project-order/src/main/java/com/dituhui/pea/order/dto/EngineerBusinessUpdateReqDTO.java
project-order/src/main/java/com/dituhui/pea/order/entity/EngineerBusiness.java
project-order/src/main/java/com/dituhui/pea/order/service/EngineerService.java
project-order/src/main/java/com/dituhui/pea/order/service/impl/EngineerServiceImpl.java
project-order/src/main/java/com/dituhui/pea/order/common/TimeUtils.java
View file @
bd7e6e8
...
...
@@ -3,13 +3,14 @@ package com.dituhui.pea.order.common;
import
java.sql.Timestamp
;
import
java.time.LocalDate
;
import
java.time.LocalDateTime
;
import
java.time.LocalTime
;
import
java.time.format.DateTimeFormatter
;
public
class
TimeUtils
{
public
static
final
String
DATE_TIME_FORMAT
=
"yyyy-MM-dd HH:mm:ss"
;
public
static
final
String
DATE_NO_GAP_FORMAT
=
"yyyyMMdd"
;
public
static
final
String
DATE_GAP_FORMAT
=
"yyyy-MM-dd"
;
public
static
final
String
TIME_HH_MM_FORMAT
=
"HHmm"
;
public
static
final
String
TIME_HH_MM_FORMAT
=
"HH
:
mm"
;
public
static
final
String
IsoTimestamp2DateTime
(
Timestamp
timestamp
)
{
// Timestamp转换为日期时间字符串
...
...
@@ -51,6 +52,10 @@ public class TimeUtils {
return
localDate
.
format
(
DateTimeFormatter
.
ofPattern
(
DATE_GAP_FORMAT
));
}
public
static
final
LocalTime
time2LocalTime
(
String
s
)
{
return
LocalTime
.
parse
(
s
,
DateTimeFormatter
.
ofPattern
(
TIME_HH_MM_FORMAT
));
}
public
static
final
LocalDate
addDays
(
LocalDate
date
,
long
days
)
{
return
date
.
plusDays
(
days
);
}
...
...
project-order/src/main/java/com/dituhui/pea/order/controller/EngineerController.java
View file @
bd7e6e8
...
...
@@ -132,8 +132,8 @@ public class EngineerController {
Result
<?>
res
=
null
;
try
{
res
=
engineerService
.
engineerBusinessUpdate
(
req
.
getEngineerCode
(),
req
.
getMaxNum
(),
req
.
get
MaxMinute
(),
req
.
get
Departure
(),
req
.
getPriority
());
req
.
getEngineerCode
(),
req
.
getMaxNum
(),
req
.
get
Departure
(),
req
.
getPriority
(),
req
.
get
WorkOn
(),
req
.
getWorkOff
(),
req
.
getTransportMode
());
}
catch
(
BusinessException
e
)
{
return
Result
.
failed
(
e
.
getMessage
());
}
...
...
project-order/src/main/java/com/dituhui/pea/order/dto/EngineerBusinessListResp.java
View file @
bd7e6e8
...
...
@@ -17,12 +17,15 @@ public class EngineerBusinessListResp {
private
String
engineerCode
;
private
String
engineerName
;
private
String
groupName
;
private
String
workOn
;
private
String
workOff
;
private
String
kind
;
private
Integer
maxNum
;
private
Integer
maxMinute
;
private
Integer
priority
;
private
String
address
;
private
String
location
;
private
String
transportMode
;
private
Integer
departure
;
}
}
project-order/src/main/java/com/dituhui/pea/order/dto/EngineerBusinessUpdateReqDTO.java
View file @
bd7e6e8
...
...
@@ -9,4 +9,7 @@ public class EngineerBusinessUpdateReqDTO {
private
Integer
maxMinute
;
private
Integer
departure
;
private
Integer
priority
;
private
String
workOn
;
private
String
workOff
;
private
String
transportMode
;
}
project-order/src/main/java/com/dituhui/pea/order/entity/EngineerBusiness.java
View file @
bd7e6e8
...
...
@@ -8,12 +8,16 @@ import java.sql.Timestamp;
public
class
EngineerBusiness
{
private
Integer
id
;
private
String
engineerCode
;
private
String
workOn
;
private
String
workOff
;
private
Integer
maxNum
;
private
Integer
maxMinute
;
private
Integer
maxDistance
;
private
String
address
;
private
String
x
;
private
String
y
;
private
String
vehicle
;
private
String
vehicleNo
;
private
Integer
priority
;
private
Integer
departure
;
private
String
memo
;
...
...
project-order/src/main/java/com/dituhui/pea/order/service/EngineerService.java
View file @
bd7e6e8
...
...
@@ -20,5 +20,7 @@ public interface EngineerService {
Result
<?>
getEngineerBusinessDetail
(
String
engineerCode
);
// 技术员业务属性配置修改
Result
<?>
engineerBusinessUpdate
(
String
engineerCode
,
Integer
maxNum
,
Integer
maxMinute
,
Integer
departure
,
Integer
priority
);
Result
<?>
engineerBusinessUpdate
(
String
engineerCode
,
Integer
maxNum
,
Integer
departure
,
Integer
priority
,
String
workOn
,
String
workOff
,
String
transportMode
);
}
project-order/src/main/java/com/dituhui/pea/order/service/impl/EngineerServiceImpl.java
View file @
bd7e6e8
...
...
@@ -18,6 +18,9 @@ import org.springframework.stereotype.Service;
import
org.springframework.transaction.annotation.Transactional
;
import
java.text.SimpleDateFormat
;
import
java.time.Duration
;
import
java.time.LocalDateTime
;
import
java.time.LocalTime
;
import
java.util.*
;
import
java.util.stream.Collectors
;
...
...
@@ -202,15 +205,22 @@ public class EngineerServiceImpl implements EngineerService {
@Transactional
@Override
public
Result
<?>
engineerBusinessUpdate
(
String
engineerCode
,
Integer
maxNum
,
Integer
maxMinute
,
Integer
departure
,
Integer
priority
)
{
// 技术员业务属性配置修改
public
Result
<?>
engineerBusinessUpdate
(
String
engineerCode
,
Integer
maxNum
,
Integer
departure
,
Integer
priority
,
String
workOn
,
String
workOff
,
String
transportMode
)
{
// 计算时间差
int
minute
=
this
.
getMinuteDiff
(
TimeUtils
.
time2LocalTime
(
workOn
),
TimeUtils
.
time2LocalTime
(
workOff
));
// 技术员业务属性配置修改
LambdaUpdateWrapper
<
EngineerBusiness
>
wrapper
=
new
LambdaUpdateWrapper
<>();
wrapper
.
eq
(
EngineerBusiness:
:
getEngineerCode
,
engineerCode
);
wrapper
.
set
(
maxNum
>=
0
,
EngineerBusiness:
:
getMaxNum
,
maxNum
);
wrapper
.
set
(
maxMinute
>=
0
,
EngineerBusiness:
:
getMaxMinute
,
maxMinute
);
wrapper
.
set
(
EngineerBusiness:
:
getMaxNum
,
maxNum
);
wrapper
.
set
(
EngineerBusiness:
:
getDeparture
,
departure
);
wrapper
.
set
(
EngineerBusiness:
:
getPriority
,
priority
);
wrapper
.
set
(
EngineerBusiness:
:
getWorkOn
,
workOn
);
wrapper
.
set
(
EngineerBusiness:
:
getWorkOff
,
workOff
);
wrapper
.
set
(
EngineerBusiness:
:
getMaxMinute
,
minute
);
wrapper
.
set
(
EngineerBusiness:
:
getVehicle
,
transportMode
);
// 更新字段
engineerBusinessDao
.
update
(
null
,
wrapper
);
...
...
@@ -398,28 +408,25 @@ public class EngineerServiceImpl implements EngineerService {
List
<
EngineerBusinessListResp
.
EngineerBusiness
>
items
=
new
ArrayList
<>();
for
(
EngineerInfo
e
:
engineers
)
{
EngineerBusinessListResp
.
EngineerBusiness
item
=
new
EngineerBusinessListResp
.
EngineerBusiness
();
EngineerBusiness
b
=
buss
.
getOrDefault
(
e
.
getEngineerCode
(),
null
);
if
(
b
==
null
){
// 若没有配置,则不返回, 由同步程序初始化
continue
;
}
item
.
setEngineerCode
(
e
.
getEngineerCode
());
item
.
setGroupName
(
groupNames
.
getOrDefault
(
e
.
getGroupId
(),
""
));
item
.
setEngineerName
(
e
.
getName
());
item
.
setKind
((
e
.
getKind
()
==
1
)
?
"fullJob"
:
"partJob"
);
EngineerBusiness
b
=
buss
.
getOrDefault
(
e
.
getEngineerCode
(),
null
);
if
(
b
==
null
)
{
item
.
setAddress
(
""
);
item
.
setLocation
(
""
);
item
.
setDeparture
(
1
);
item
.
setMaxMinute
(
0
);
item
.
setMaxNum
(
0
);
item
.
setPriority
(
1
);
}
else
{
item
.
setAddress
(
b
.
getAddress
());
item
.
setLocation
(
String
.
format
(
"%s,%s"
,
b
.
getX
(),
b
.
getY
()));
item
.
setWorkOn
(
b
.
getWorkOn
());
item
.
setWorkOff
(
b
.
getWorkOff
());
item
.
setTransportMode
(
b
.
getVehicle
());
item
.
setDeparture
(
b
.
getDeparture
());
item
.
setMaxMinute
(
b
.
getMaxMinute
());
item
.
setMaxNum
(
b
.
getMaxNum
());
item
.
setPriority
(
b
.
getPriority
());
}
items
.
add
(
item
);
}
return
items
;
...
...
@@ -456,4 +463,20 @@ public class EngineerServiceImpl implements EngineerService {
return
(
age
<=
0
)
?
""
:
Integer
.
toString
(
age
);
}
private
int
getMinuteDiff
(
LocalTime
tBegin
,
LocalTime
tEnd
)
{
int
r
=
tBegin
.
compareTo
(
tEnd
);
if
(
r
==
0
)
{
return
0
;
}
LocalDateTime
dtBegin
=
LocalDateTime
.
of
(
LocalDateTime
.
now
().
toLocalDate
(),
tBegin
);
LocalDateTime
dtEnd
;
if
(
r
<
0
)
{
dtEnd
=
LocalDateTime
.
of
(
LocalDateTime
.
now
().
toLocalDate
(),
tEnd
);
}
else
{
dtEnd
=
LocalDateTime
.
of
(
LocalDateTime
.
now
().
plusDays
(
1
).
toLocalDate
(),
tEnd
);
}
Duration
duration
=
Duration
.
between
(
dtBegin
,
dtEnd
);
return
(
int
)
duration
.
toMinutes
();
}
}
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