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 fc30f692
authored
Oct 13, 2023
by
刘鑫
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/develop' into develop
2 parents
b5244bc8
c047e1a7
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
8 deletions
project-order/src/main/java/com/dituhui/pea/order/service/impl/EngineerCalendarServiceImpl.java
project-order/src/main/java/com/dituhui/pea/order/service/impl/OrganizationServiceImpl.java
project-order/src/main/java/com/dituhui/pea/order/service/impl/EngineerCalendarServiceImpl.java
View file @
fc30f69
...
@@ -187,11 +187,14 @@ public class EngineerCalendarServiceImpl implements EngineerCalendarService {
...
@@ -187,11 +187,14 @@ public class EngineerCalendarServiceImpl implements EngineerCalendarService {
LocalDate
beginDate
=
DateUtils
.
localDateFromStr
(
beginTime
);
LocalDate
beginDate
=
DateUtils
.
localDateFromStr
(
beginTime
);
LocalDate
endDate
=
DateUtils
.
localDateFromStr
(
repeatEndDate
);
LocalDate
endDate
=
DateUtils
.
localDateFromStr
(
repeatEndDate
);
LocalDate
current
=
beginDate
;
LocalDate
current
=
beginDate
;
// 保留固定基准开始时间,后续日历根据此日期推算
final
String
finalBeginTime
=
beginTime
;
final
String
finalEndTime
=
endTime
;
while
(!
current
.
isAfter
(
endDate
))
{
while
(!
current
.
isAfter
(
endDate
))
{
// 开始时间,结束时间平移
// 开始时间,结束时间平移
int
days
=
Period
.
between
(
beginDate
,
current
).
getDays
(
);
long
days
=
beginDate
.
until
(
current
,
ChronoUnit
.
DAYS
);
beginTime
=
DateUtils
.
formatDateTime
(
DateUtils
.
localDateTimeFromStr
(
b
eginTime
).
plusDays
(
days
));
beginTime
=
DateUtils
.
formatDateTime
(
DateUtils
.
localDateTimeFromStr
(
finalB
eginTime
).
plusDays
(
days
));
endTime
=
DateUtils
.
formatDateTime
(
DateUtils
.
localDateTimeFromStr
(
e
ndTime
).
plusDays
(
days
));
endTime
=
DateUtils
.
formatDateTime
(
DateUtils
.
localDateTimeFromStr
(
finalE
ndTime
).
plusDays
(
days
));
addOneEngineerPlan
(
userId
,
engineerCode
,
type
,
beginTime
,
endTime
,
remark
);
addOneEngineerPlan
(
userId
,
engineerCode
,
type
,
beginTime
,
endTime
,
remark
);
current
=
getNextDate
(
current
,
repeatType
);
current
=
getNextDate
(
current
,
repeatType
);
}
}
...
@@ -406,7 +409,7 @@ public class EngineerCalendarServiceImpl implements EngineerCalendarService {
...
@@ -406,7 +409,7 @@ public class EngineerCalendarServiceImpl implements EngineerCalendarService {
return
mapping
.
get
(
type
);
return
mapping
.
get
(
type
);
}
}
private
String
newPlanId
(){
private
String
newPlanId
()
{
String
idStr
=
IdUtil
.
getSnowflake
().
nextIdStr
();
String
idStr
=
IdUtil
.
getSnowflake
().
nextIdStr
();
return
idStr
.
substring
(
idStr
.
length
()
-
10
);
return
idStr
.
substring
(
idStr
.
length
()
-
10
);
}
}
...
...
project-order/src/main/java/com/dituhui/pea/order/service/impl/OrganizationServiceImpl.java
View file @
fc30f69
...
@@ -13,6 +13,7 @@ import com.google.common.collect.Lists;
...
@@ -13,6 +13,7 @@ import com.google.common.collect.Lists;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.lang.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
...
@@ -43,12 +44,26 @@ public class OrganizationServiceImpl implements OrganizationService {
...
@@ -43,12 +44,26 @@ public class OrganizationServiceImpl implements OrganizationService {
@Override
@Override
public
Result
<?>
getOrganizationTree
(
String
levelType
,
String
levelValue
)
{
public
Result
<?>
getOrganizationTree
(
String
levelType
,
String
levelValue
)
{
// 如果传递了精确的id,只返回对应的tree内容;如果没有传递,返回所有tree内容
// 如果传递了精确的id,只返回对应的tree内容;如果没有传递,返回所有tree内容
List
<
OrganizationTreeDTO
.
Result
>
rs
=
new
ArrayList
<>();
if
(
StringUtils
.
isBlank
(
levelType
)
&&
StringUtils
.
isBlank
(
levelValue
))
{
rs
.
add
(
getOrganizationTreeByOrgId
(
levelType
,
levelValue
));
}
else
{
for
(
String
value
:
levelValue
.
split
(
","
))
{
rs
.
add
(
getOrganizationTreeByOrgId
(
levelType
,
value
));
}
}
return
Result
.
success
(
rs
);
}
public
OrganizationTreeDTO
.
Result
getOrganizationTreeByOrgId
(
String
levelType
,
String
levelValue
)
{
// 如果传递了精确的id,只返回对应的tree内容;如果没有传递,返回所有tree内容
OrganizationTreeDTO
.
Result
rs
=
new
OrganizationTreeDTO
.
Result
();
OrganizationTreeDTO
.
Result
rs
=
new
OrganizationTreeDTO
.
Result
();
rs
.
setLevelType
(
levelType
).
setLevelValue
(
levelValue
);
rs
.
setLevelType
(
levelType
).
setLevelValue
(
levelValue
);
if
(
"group"
.
equals
(
levelType
))
{
if
(
"group"
.
equals
(
levelType
))
{
OrgGroupEntity
orgGroupEntity
=
orgGroupDao
.
getByGroupId
(
levelValue
);
OrgGroupEntity
orgGroupEntity
=
orgGroupDao
.
getByGroupId
(
levelValue
);
if
(
orgGroupEntity
==
null
)
{
if
(
orgGroupEntity
==
null
)
{
return
Result
.
failed
(
"groupId对应的信息不存在"
)
;
return
null
;
}
}
List
<?>
groups
=
new
ArrayList
<>(
Collections
.
singletonList
(
groupEntity2Dto
(
orgGroupEntity
)));
List
<?>
groups
=
new
ArrayList
<>(
Collections
.
singletonList
(
groupEntity2Dto
(
orgGroupEntity
)));
OrgBranchEntity
orgBranchEntity
=
orgBranchDao
.
getByBranchId
(
orgGroupEntity
.
getBranchId
());
OrgBranchEntity
orgBranchEntity
=
orgBranchDao
.
getByBranchId
(
orgGroupEntity
.
getBranchId
());
...
@@ -59,7 +74,7 @@ public class OrganizationServiceImpl implements OrganizationService {
...
@@ -59,7 +74,7 @@ public class OrganizationServiceImpl implements OrganizationService {
}
else
if
(
"branch"
.
equals
(
levelType
))
{
}
else
if
(
"branch"
.
equals
(
levelType
))
{
OrgBranchEntity
orgBranchEntity
=
orgBranchDao
.
getByBranchId
(
levelValue
);
OrgBranchEntity
orgBranchEntity
=
orgBranchDao
.
getByBranchId
(
levelValue
);
if
(
orgBranchEntity
==
null
)
{
if
(
orgBranchEntity
==
null
)
{
return
Result
.
failed
(
"分站信息不存在"
)
;
return
null
;
}
}
OrgClusterEntity
orgClusterEntity
=
orgClusterDao
.
getByClusterId
(
orgBranchEntity
.
getClusterId
());
OrgClusterEntity
orgClusterEntity
=
orgClusterDao
.
getByClusterId
(
orgBranchEntity
.
getClusterId
());
List
<?>
groups
=
getChildByBranch
(
levelValue
);
List
<?>
groups
=
getChildByBranch
(
levelValue
);
...
@@ -69,7 +84,7 @@ public class OrganizationServiceImpl implements OrganizationService {
...
@@ -69,7 +84,7 @@ public class OrganizationServiceImpl implements OrganizationService {
}
else
if
(
"cluster"
.
equals
(
levelType
))
{
}
else
if
(
"cluster"
.
equals
(
levelType
))
{
OrgClusterEntity
orgClusterEntity
=
orgClusterDao
.
getByClusterId
(
levelValue
);
OrgClusterEntity
orgClusterEntity
=
orgClusterDao
.
getByClusterId
(
levelValue
);
if
(
orgClusterEntity
==
null
)
{
if
(
orgClusterEntity
==
null
)
{
return
Result
.
failed
(
"大区信息不存在"
)
;
return
null
;
}
}
List
<?>
branchs
=
getChildByCluster
(
levelValue
);
List
<?>
branchs
=
getChildByCluster
(
levelValue
);
List
<?>
clusters
=
new
ArrayList
<>(
Collections
.
singletonList
(
clusterEntity2Dto
(
orgClusterEntity
).
setChildren
(
branchs
)));
List
<?>
clusters
=
new
ArrayList
<>(
Collections
.
singletonList
(
clusterEntity2Dto
(
orgClusterEntity
).
setChildren
(
branchs
)));
...
@@ -77,7 +92,7 @@ public class OrganizationServiceImpl implements OrganizationService {
...
@@ -77,7 +92,7 @@ public class OrganizationServiceImpl implements OrganizationService {
}
else
{
}
else
{
rs
.
setClusters
(
getTreeByRoot
());
rs
.
setClusters
(
getTreeByRoot
());
}
}
return
Result
.
success
(
rs
)
;
return
rs
;
}
}
@Override
@Override
...
...
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