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 ef4f0eca
authored
Jul 14, 2023
by
丁伟峰
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/develop' into develop
2 parents
2ff72eac
4723bf4a
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
43 additions
and
35 deletions
project-interface/src/main/java/com/dituhui/pea/common/Result.java
project-interface/src/main/java/com/dituhui/pea/order/IOrganization.java
project-interface/src/main/java/com/dituhui/pea/user/IUser.java
project-order/src/main/java/com/dituhui/pea/order/common/OrderAssignCheck.java
project-order/src/main/java/com/dituhui/pea/order/controller/PublicOrganizationController.java
project-order/src/main/java/com/dituhui/pea/order/dao/EngineerInfoMPDao.java
project-order/src/main/java/com/dituhui/pea/order/dao/EngineerSkillGroupMPDao.java
project-order/src/main/java/com/dituhui/pea/order/service/impl/OrderAssignImpl.java
project-user/src/main/java/com/dituhui/pea/user/controller/UserController.java
project-user/src/main/java/com/dituhui/pea/user/service/UserService.java
project-interface/src/main/java/com/dituhui/pea/common/Result.java
View file @
ef4f0ec
...
...
@@ -43,6 +43,10 @@ public class Result<T> {
public
static
Result
<?>
failed
(
String
message
)
{
return
new
Result
<>(
ResultEnum
.
COMMON_FAILED
.
getCode
(),
message
,
null
);
}
public
static
<
T
>
Result
<
T
>
failure
(
String
message
)
{
return
new
Result
<>(
ResultEnum
.
COMMON_FAILED
.
getCode
(),
message
,
null
);
}
public
static
Result
<?>
failed
(
IResult
errorResult
)
{
return
new
Result
<>(
errorResult
.
getCode
(),
errorResult
.
getMessage
(),
null
);
...
...
project-interface/src/main/java/com/dituhui/pea/order/IOrganization.java
View file @
ef4f0ec
...
...
@@ -8,6 +8,7 @@ import org.springframework.web.bind.annotation.RequestMethod;
import
org.springframework.web.bind.annotation.RequestParam
;
import
com.dituhui.pea.common.Result
;
import
com.dituhui.pea.pojo.OrganizationDTO
;
/**
* 组织结构相关接口
...
...
@@ -24,7 +25,7 @@ public interface IOrganization {
* @return
*/
@RequestMapping
(
value
=
"/pea-order/organization/list"
,
method
=
RequestMethod
.
GET
)
public
Result
<
?
>
getAllOrganizations
(
@RequestParam
(
"levelType"
)
String
levelType
,
public
Result
<
List
<
OrganizationDTO
>
>
getAllOrganizations
(
@RequestParam
(
"levelType"
)
String
levelType
,
@RequestParam
(
"organizationIds"
)
List
<
String
>
organizationIds
);
}
project-interface/src/main/java/com/dituhui/pea/user/IUser.java
View file @
ef4f0ec
...
...
@@ -11,6 +11,7 @@ import com.dituhui.pea.common.Result;
import
com.dituhui.pea.enums.ThirdPartyEnum
;
import
com.dituhui.pea.pojo.ThirdUserInfo
;
import
com.dituhui.pea.pojo.UserInfo
;
import
com.dituhui.pea.pojo.UserLoginDTO
;
import
com.dituhui.pea.pojo.UserLoginParam
;
import
com.dituhui.pea.pojo.WebResult
;
...
...
@@ -22,10 +23,10 @@ import com.dituhui.pea.pojo.WebResult;
public
interface
IUser
{
@RequestMapping
(
value
=
"/pea-user/login"
,
method
=
RequestMethod
.
POST
)
public
Result
<
?
>
userLogin
(
@RequestBody
UserLoginParam
user
);
public
Result
<
UserLoginDTO
>
userLogin
(
@RequestBody
UserLoginParam
user
);
@RequestMapping
(
value
=
"/pea-user/userInfo"
,
method
=
RequestMethod
.
GET
)
public
Result
<
?
>
getUserInfo
(
@RequestHeader
(
name
=
"userId"
,
required
=
true
)
String
userId
);
public
Result
<
UserLoginDTO
>
getUserInfo
(
@RequestHeader
(
name
=
"userId"
,
required
=
true
)
String
userId
);
/**
* 获取当前登陆用户信息
...
...
project-order/src/main/java/com/dituhui/pea/order/common/OrderAssignCheck.java
View file @
ef4f0ec
...
...
@@ -47,14 +47,16 @@ public class OrderAssignCheck {
private
int
distanceAddition
;
private
LocalDateTime
start
;
private
LocalDateTime
end
;
private
int
index
;
public
Result
(
boolean
canAssign
,
String
message
,
int
minuteAddition
,
int
distanceAddition
,
LocalDateTime
start
,
LocalDateTime
end
){
public
Result
(
boolean
canAssign
,
String
message
,
int
minuteAddition
,
int
distanceAddition
,
LocalDateTime
start
,
LocalDateTime
end
,
int
index
){
this
.
canAssign
=
canAssign
;
this
.
message
=
message
;
this
.
minuteAddition
=
minuteAddition
;
this
.
distanceAddition
=
distanceAddition
;
this
.
start
=
start
;
this
.
end
=
end
;
this
.
index
=
index
;
}
}
...
...
@@ -83,7 +85,7 @@ public class OrderAssignCheck {
int
index
=
SegmentInsertion
.
insertSegment
(
takeTime
,
start
,
end
,
segments
);
if
(
index
==
-
1
)
{
log
.
info
(
"没有可连续插入的空间"
);
return
new
Result
(
false
,
"没有连续可插入空间(没计算时间)"
,
0
,
0
,
null
,
null
);
return
new
Result
(
false
,
"没有连续可插入空间(没计算时间)"
,
0
,
0
,
null
,
null
,
index
);
}
log
.
info
(
"插入位置为第{}单, 已分配单数(不包含本单):{}"
,
index
,
orderSegments
.
size
());
...
...
@@ -105,7 +107,7 @@ public class OrderAssignCheck {
LocalDateTime
startDateTime
=
this
.
point2LocalDateTime
(
startInsert
,
order
.
getDt
());
LocalDateTime
endDateTime
=
this
.
point2LocalDateTime
(
endInsert
,
order
.
getDt
());
return
new
Result
(
true
,
"success"
,
0
,
0
,
startDateTime
,
endDateTime
);
return
new
Result
(
true
,
"success"
,
0
,
0
,
startDateTime
,
endDateTime
,
index
);
}
else
if
(
index
==
0
&&
!
orderSegments
.
isEmpty
())
{
// 第一订单为出发地, 且有其他订单
...
...
@@ -115,7 +117,7 @@ public class OrderAssignCheck {
OrderSegment
post
=
orderSegments
.
get
(
0
);
OrderSegment
pre
=
new
OrderSegment
(
480
,
480
,
preX
,
preY
);
return
this
.
getResult
(
curX
,
curY
,
pre
,
post
,
takeTime
,
order
.
getDt
());
return
this
.
getResult
(
curX
,
curY
,
pre
,
post
,
takeTime
,
order
.
getDt
()
,
index
);
}
else
if
(
index
==
orderSegments
.
size
())
{
// 最后一个订单出发
...
...
@@ -128,12 +130,12 @@ public class OrderAssignCheck {
LocalDateTime
startDateTime
=
this
.
point2LocalDateTime
(
startInsert
,
order
.
getDt
());
LocalDateTime
endDateTime
=
this
.
point2LocalDateTime
(
endInsert
,
order
.
getDt
());
return
new
Result
(
true
,
"success"
,
0
,
0
,
startDateTime
,
endDateTime
);
return
new
Result
(
true
,
"success"
,
0
,
0
,
startDateTime
,
endDateTime
,
index
);
}
else
{
OrderSegment
pre
=
orderSegments
.
get
(
index
-
1
);
OrderSegment
post
=
orderSegments
.
get
(
index
);
return
this
.
getResult
(
curX
,
curY
,
pre
,
post
,
takeTime
,
order
.
getDt
());
return
this
.
getResult
(
curX
,
curY
,
pre
,
post
,
takeTime
,
order
.
getDt
()
,
index
);
}
}
...
...
@@ -181,7 +183,7 @@ public class OrderAssignCheck {
return
segments
;
}
private
Result
getResult
(
double
curX
,
double
curY
,
OrderSegment
pre
,
OrderSegment
post
,
int
takeTime
,
LocalDate
dt
)
{
private
Result
getResult
(
double
curX
,
double
curY
,
OrderSegment
pre
,
OrderSegment
post
,
int
takeTime
,
LocalDate
dt
,
int
index
)
{
Pair
preCurPair
=
this
.
getDistanceAndDuration
(
pre
.
getX
(),
pre
.
getY
(),
curX
,
curY
);
Pair
postCurPair
=
this
.
getDistanceAndDuration
(
post
.
getX
(),
post
.
getY
(),
curX
,
curY
);
Pair
prePostPair
=
this
.
getDistanceAndDuration
(
post
.
getX
(),
post
.
getY
(),
pre
.
getX
(),
pre
.
getY
());
...
...
@@ -190,7 +192,7 @@ public class OrderAssignCheck {
int
distance
=
post
.
getStart
()
-
postCurPair
.
getDuration
()
-
(
pre
.
getEnd
()
+
preCurPair
.
getDuration
());
if
(
distance
<
takeTime
)
{
// 不支持插入
return
new
Result
(
false
,
"增加时间路程后,不支持插入"
,
0
,
0
,
null
,
null
);
return
new
Result
(
false
,
"增加时间路程后,不支持插入"
,
0
,
0
,
null
,
null
,
index
);
}
// 插入点(时间点)
int
startInsert
=
pre
.
getEnd
()
+
preCurPair
.
getDuration
();
...
...
@@ -200,7 +202,7 @@ public class OrderAssignCheck {
int
minuteAddition
=
preCurPair
.
getDuration
()
+
postCurPair
.
getDuration
()
-
prePostPair
.
getDuration
();
int
distanceAddition
=
preCurPair
.
getDistance
()
+
postCurPair
.
getDistance
()
-
prePostPair
.
getDistance
();
return
new
Result
(
true
,
"success"
,
minuteAddition
,
distanceAddition
,
startDateTime
,
endDateTime
);
return
new
Result
(
true
,
"success"
,
minuteAddition
,
distanceAddition
,
startDateTime
,
endDateTime
,
index
);
}
private
double
[]
getEngineerDepartureLocation
(
String
engineerCode
){
...
...
project-order/src/main/java/com/dituhui/pea/order/controller/PublicOrganizationController.java
View file @
ef4f0ec
...
...
@@ -24,20 +24,20 @@ public class PublicOrganizationController implements IOrganization {
private
OrganizationService
organizationService
;
@Override
public
Result
<
?
>
getAllOrganizations
(
String
levelType
,
List
<
String
>
organizationIds
)
{
public
Result
<
List
<
OrganizationDTO
>
>
getAllOrganizations
(
String
levelType
,
List
<
String
>
organizationIds
)
{
if
(
StringUtils
.
isEmpty
(
levelType
))
{
return
Result
.
fail
ed
(
"缺少参数levelType"
);
return
Result
.
fail
ure
(
"缺少参数levelType"
);
}
if
(
CollectionUtils
.
isEmpty
(
organizationIds
))
{
return
Result
.
fail
ed
(
"缺少参数organizationIds"
);
return
Result
.
fail
ure
(
"缺少参数organizationIds"
);
}
Result
<
?
>
res
=
null
;
Result
<
List
<
OrganizationDTO
>
>
res
=
null
;
try
{
List
<
OrganizationDTO
>
orgs
=
organizationService
.
getAllOrganizations
(
levelType
,
organizationIds
);
res
=
Result
.
success
(
orgs
);
}
catch
(
BusinessException
e
)
{
return
Result
.
fail
ed
(
e
.
getMessage
());
return
Result
.
fail
ure
(
e
.
getMessage
());
}
return
res
;
}
...
...
project-order/src/main/java/com/dituhui/pea/order/dao/EngineerInfoMPDao.java
View file @
ef4f0ec
...
...
@@ -23,4 +23,8 @@ public interface EngineerInfoMPDao extends BaseMapper<EngineerInfo> {
@Select
(
"select * from engineer_info where group_id = #{groupId}"
)
List
<
EngineerInfo
>
selectByGroupId
(
String
groupId
);
@Select
(
"<script> select * from engineer_info where group_id in "
+
"<foreach item='groupId' collection='groupIds' open='(' separator=',' close=')'>#{groupId}</foreach></script>"
)
List
<
EngineerInfo
>
selectByGroupIds
(
@Param
(
"groupIds"
)
List
<
String
>
groupIds
);
}
\ No newline at end of file
project-order/src/main/java/com/dituhui/pea/order/dao/EngineerSkillGroupMPDao.java
View file @
ef4f0ec
...
...
@@ -12,4 +12,7 @@ import java.util.List;
public
interface
EngineerSkillGroupMPDao
extends
BaseMapper
<
EngineerSkillGroup
>
{
@Select
(
"select * from engineer_skill_group where engineer_code = #{engineerCode}"
)
List
<
EngineerSkillGroup
>
selectByEngineerCode
(
String
engineerCode
);
@Select
(
"select * from engineer_skill_group where skill_group_code = #{skillGroupCode}"
)
List
<
EngineerSkillGroup
>
selectBySkillGroupCode
(
String
skillGroupCode
);
}
project-order/src/main/java/com/dituhui/pea/order/service/impl/OrderAssignImpl.java
View file @
ef4f0ec
This diff is collapsed.
Click to expand it.
project-user/src/main/java/com/dituhui/pea/user/controller/UserController.java
View file @
ef4f0ec
...
...
@@ -13,6 +13,7 @@ import com.dituhui.pea.enums.ThirdPartyEnum;
import
com.dituhui.pea.pojo.ThirdUserInfo
;
import
com.dituhui.pea.pojo.UserAuthInfo
;
import
com.dituhui.pea.pojo.UserInfo
;
import
com.dituhui.pea.pojo.UserLoginDTO
;
import
com.dituhui.pea.pojo.UserLoginParam
;
import
com.dituhui.pea.pojo.WebResult
;
import
com.dituhui.pea.user.IUser
;
...
...
@@ -32,12 +33,12 @@ public class UserController implements IUser {
private
UserService
userService
;
@Override
public
Result
<
?
>
userLogin
(
UserLoginParam
user
)
{
public
Result
<
UserLoginDTO
>
userLogin
(
UserLoginParam
user
)
{
return
userService
.
userLogin
(
user
.
getAccount
(),
user
.
getPassword
());
}
@Override
public
Result
<
?
>
getUserInfo
(
String
userId
)
{
public
Result
<
UserLoginDTO
>
getUserInfo
(
String
userId
)
{
return
userService
.
getUserInfo
(
userId
);
}
...
...
project-user/src/main/java/com/dituhui/pea/user/service/UserService.java
View file @
ef4f0ec
...
...
@@ -93,12 +93,11 @@ public class UserService {
@Autowired
IOrganization
organizationService
;
public
Result
<
?
>
userLogin
(
String
account
,
String
password
)
{
public
Result
<
UserLoginDTO
>
userLogin
(
String
account
,
String
password
)
{
UserEntity
user
=
userDao
.
findByAccountAndPassword
(
account
,
SecureUtil
.
md5
(
password
));
log
.
info
(
"{}/{} login"
,
account
,
password
);
if
(
null
!=
user
)
{
UserLoginDTO
userDTO
=
convertToUserLoginDTO
(
user
);
// 生成token
String
token
=
IdUtil
.
simpleUUID
();
userDTO
.
setToken
(
token
);
...
...
@@ -106,7 +105,7 @@ public class UserService {
redisService
.
set
(
RedisKeyGroup
.
authToken
+
":"
+
token
,
gson
.
toJson
(
userDTO
),
timestamp
/
1000
);
return
Result
.
success
(
userDTO
);
}
else
{
return
Result
.
fail
ed
(
"鉴权失败"
);
return
Result
.
fail
ure
(
"鉴权失败"
);
}
}
...
...
@@ -151,24 +150,16 @@ public class UserService {
List
<
OrganizationDTO
>
allOrgs
=
resources
.
stream
().
filter
(
r
->
r
.
getType
()
==
3
).
map
(
r
->
{
List
<
OrganizationDTO
>
orgs
=
Lists
.
newArrayList
();
String
[]
temp
=
r
.
getExtra
().
split
(
"\\|"
);
Result
<
?
>
result
=
organizationService
.
getAllOrganizations
(
temp
[
0
],
Result
<
List
<
OrganizationDTO
>
>
result
=
organizationService
.
getAllOrganizations
(
temp
[
0
],
Arrays
.
asList
(
temp
[
1
].
split
(
","
)));
if
(
StringUtils
.
equals
(
ResultEnum
.
SUCCESS
.
getCode
(),
result
.
getCode
()))
{
orgs
=
(
List
<
OrganizationDTO
>)
result
.
getResult
();
orgs
=
result
.
getResult
();
}
return
orgs
;
}).
flatMap
(
a
->
a
.
stream
()).
collect
(
Collectors
.
toList
());
if
(
CollectionUtils
.
isNotEmpty
(
allOrgs
))
{
log
.
info
(
"allOrgs2: {}"
,
allOrgs
.
size
());
try
{
allOrgs
.
stream
().
forEach
(
o
->
o
.
setIsActive
(
true
));
log
.
info
(
"allOrgs3: {}"
,
allOrgs
.
get
(
0
));
log
.
info
(
"allOrgs4: {}"
,
allOrgs
.
get
(
0
).
getIsActive
());
allOrgs
.
get
(
0
).
setIsActive
(
true
);
}
catch
(
Throwable
e
)
{
e
.
printStackTrace
();
log
.
error
(
"allOrgs4: {} {}"
,
e
.
getMessage
(),
e
);
}
// 设置第一个为当前权限等级
allOrgs
.
get
(
0
).
setIsActive
(
true
);
}
userDTO
.
setAuths
(
allOrgs
);
}
...
...
@@ -184,7 +175,7 @@ public class UserService {
resourceInfo
.
setExtra
(
null
);
}
public
Result
<
?
>
getUserInfo
(
String
userId
)
{
public
Result
<
UserLoginDTO
>
getUserInfo
(
String
userId
)
{
UserEntity
user
=
userDao
.
getById
(
userId
);
UserLoginDTO
userDTO
=
convertToUserLoginDTO
(
user
);
return
Result
.
success
(
userDTO
);
...
...
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