Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation
This project
Loading...
Sign in
李苗
/
Vion-DevOps
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit a3266dd6
authored
Mar 15, 2024
by
HlQ
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
[chg] 项目维保状态逻辑修改
[add] 1.设备返修和备件申请支持发货日期查询 2.项目列表添加参数
1 parent
819a2bea
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
146 additions
and
55 deletions
src/main/java/vion/dto/RepairRecDTO.java
src/main/java/vion/dto/SparePartDTO.java
src/main/java/vion/dto/StoreDTO.java
src/main/java/vion/model/Store.java
src/main/java/vion/service/impl/RepairRecServiceImpl.java
src/main/java/vion/service/impl/SparePartServiceImpl.java
src/main/java/vion/service/impl/StoreServiceImpl.java
src/main/java/vion/vo/StoreVO.java
src/main/java/vion/dto/RepairRecDTO.java
View file @
a3266dd
...
@@ -121,4 +121,9 @@ public class RepairRecDTO extends BaseDTO {
...
@@ -121,4 +121,9 @@ public class RepairRecDTO extends BaseDTO {
private
Date
createTimeStart
;
private
Date
createTimeStart
;
@DateTimeFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
@DateTimeFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
private
Date
createTimeEnd
;
private
Date
createTimeEnd
;
@DateTimeFormat
(
pattern
=
"yyyy-MM-dd"
)
private
Date
shipDateStart
;
@DateTimeFormat
(
pattern
=
"yyyy-MM-dd"
)
private
Date
shipDateEnd
;
}
}
\ No newline at end of file
\ No newline at end of file
src/main/java/vion/dto/SparePartDTO.java
View file @
a3266dd
...
@@ -117,4 +117,9 @@ public class SparePartDTO extends BaseDTO {
...
@@ -117,4 +117,9 @@ public class SparePartDTO extends BaseDTO {
private
Date
createTimeStart
;
private
Date
createTimeStart
;
@DateTimeFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
@DateTimeFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
private
Date
createTimeEnd
;
private
Date
createTimeEnd
;
@DateTimeFormat
(
pattern
=
"yyyy-MM-dd"
)
private
Date
shipDateStart
;
@DateTimeFormat
(
pattern
=
"yyyy-MM-dd"
)
private
Date
shipDateEnd
;
}
}
\ No newline at end of file
\ No newline at end of file
src/main/java/vion/dto/StoreDTO.java
View file @
a3266dd
...
@@ -59,6 +59,17 @@ public class StoreDTO extends BaseDTO {
...
@@ -59,6 +59,17 @@ public class StoreDTO extends BaseDTO {
private
String
stuckPoint
;
private
String
stuckPoint
;
/** 标签id */
/** 标签id */
private
Long
tagId
;
private
Long
tagId
;
/** 项目负责人 or 项目经理 */
private
Long
mainUser
;
/** 主要产品 */
private
Integer
mainProduct
;
/** 点位数量 */
private
Integer
pointNum
;
/** 计划完成日期 */
@JsonFormat
(
pattern
=
"yyyy-MM-dd"
,
timezone
=
"GMT+8"
)
private
Date
planFinishDate
;
/** 项目规模 */
private
Integer
projectSize
;
private
Long
sourceId
;
private
Long
sourceId
;
private
Long
targetId
;
private
Long
targetId
;
...
...
src/main/java/vion/model/Store.java
View file @
a3266dd
...
@@ -71,7 +71,7 @@ public class Store {
...
@@ -71,7 +71,7 @@ public class Store {
/** 任务详情 */
/** 任务详情 */
private
String
taskDetail
;
private
String
taskDetail
;
/**
预计
完成日期 */
/**
实际
完成日期 */
private
Date
finishDate
;
private
Date
finishDate
;
/** 完成百分比 */
/** 完成百分比 */
...
@@ -80,4 +80,16 @@ public class Store {
...
@@ -80,4 +80,16 @@ public class Store {
/** 当前卡点 */
/** 当前卡点 */
private
String
stuckPoint
;
private
String
stuckPoint
;
/** 主要产品 */
private
Integer
mainProduct
;
/** 点位数量 */
private
Integer
pointNum
;
/** 计划完成日期 */
private
Date
planFinishDate
;
/** 项目规模 */
private
Integer
projectSize
;
}
}
src/main/java/vion/service/impl/RepairRecServiceImpl.java
View file @
a3266dd
package
vion
.
service
.
impl
;
package
vion
.
service
.
impl
;
import
org.dromara.hutool.core.array.ArrayUtil
;
import
org.dromara.hutool.core.date.DateUtil
;
import
org.dromara.hutool.core.date.DateUtil
;
import
org.dromara.hutool.core.io.file.FileNameUtil
;
import
org.dromara.hutool.core.io.file.FileNameUtil
;
import
org.dromara.hutool.core.io.file.FileUtil
;
import
org.dromara.hutool.core.io.file.FileUtil
;
...
@@ -93,6 +94,7 @@ public class RepairRecServiceImpl extends MPJBaseServiceImpl<RepairRecMapper, Re
...
@@ -93,6 +94,7 @@ public class RepairRecServiceImpl extends MPJBaseServiceImpl<RepairRecMapper, Re
.
leftJoin
(
Store
.
class
,
Store:
:
getId
,
RepairRec:
:
getStoreId
)
.
leftJoin
(
Store
.
class
,
Store:
:
getId
,
RepairRec:
:
getStoreId
)
.
leftJoin
(
RRepairDevice
.
class
,
on
->
on
.
eq
(
RRepairDevice:
:
getRId
,
RepairRec:
:
getId
).
eq
(
RRepairDevice:
:
getRType
,
2
))
.
leftJoin
(
RRepairDevice
.
class
,
on
->
on
.
eq
(
RRepairDevice:
:
getRId
,
RepairRec:
:
getId
).
eq
(
RRepairDevice:
:
getRType
,
2
))
.
between
(
RepairRec:
:
getCreateTime
,
dto
.
getCreateTimeStart
(),
dto
.
getCreateTimeEnd
())
.
between
(
RepairRec:
:
getCreateTime
,
dto
.
getCreateTimeStart
(),
dto
.
getCreateTimeEnd
())
.
between
(
ArrayUtil
.
isAllNotNull
(
dto
.
getShipDateStart
(),
dto
.
getShipDateEnd
()),
SparePart:
:
getShipDate
,
dto
.
getShipDateStart
(),
dto
.
getShipDateEnd
())
.
orderByDesc
(
RepairRec:
:
getCreateTime
);
.
orderByDesc
(
RepairRec:
:
getCreateTime
);
return
this
.
selectJoinList
(
RepairRecVO
.
class
,
wrapper
);
return
this
.
selectJoinList
(
RepairRecVO
.
class
,
wrapper
);
}
}
...
...
src/main/java/vion/service/impl/SparePartServiceImpl.java
View file @
a3266dd
package
vion
.
service
.
impl
;
package
vion
.
service
.
impl
;
import
org.dromara.hutool.core.array.ArrayUtil
;
import
org.dromara.hutool.core.date.DateUtil
;
import
org.dromara.hutool.core.date.DateUtil
;
import
org.dromara.hutool.core.io.file.FileNameUtil
;
import
org.dromara.hutool.core.io.file.FileNameUtil
;
import
org.dromara.hutool.core.io.file.FileUtil
;
import
org.dromara.hutool.core.io.file.FileUtil
;
...
@@ -91,6 +92,7 @@ public class SparePartServiceImpl extends MPJBaseServiceImpl<SparePartMapper, Sp
...
@@ -91,6 +92,7 @@ public class SparePartServiceImpl extends MPJBaseServiceImpl<SparePartMapper, Sp
.
leftJoin
(
Contract
.
class
,
Contract:
:
getId
,
SparePart:
:
getContractId
)
.
leftJoin
(
Contract
.
class
,
Contract:
:
getId
,
SparePart:
:
getContractId
)
.
leftJoin
(
RRepairDevice
.
class
,
on
->
on
.
eq
(
RRepairDevice:
:
getRId
,
SparePart:
:
getId
).
eq
(
RRepairDevice:
:
getRType
,
1
))
.
leftJoin
(
RRepairDevice
.
class
,
on
->
on
.
eq
(
RRepairDevice:
:
getRId
,
SparePart:
:
getId
).
eq
(
RRepairDevice:
:
getRType
,
1
))
.
between
(
SparePart:
:
getCreateTime
,
dto
.
getCreateTimeStart
(),
dto
.
getCreateTimeEnd
())
.
between
(
SparePart:
:
getCreateTime
,
dto
.
getCreateTimeStart
(),
dto
.
getCreateTimeEnd
())
.
between
(
ArrayUtil
.
isAllNotNull
(
dto
.
getShipDateStart
(),
dto
.
getShipDateEnd
()),
SparePart:
:
getShipDate
,
dto
.
getShipDateStart
(),
dto
.
getShipDateEnd
())
.
orderByDesc
(
SparePart:
:
getCreateTime
);
.
orderByDesc
(
SparePart:
:
getCreateTime
);
return
this
.
selectJoinList
(
SparePartVO
.
class
,
wrapper
);
return
this
.
selectJoinList
(
SparePartVO
.
class
,
wrapper
);
}
}
...
...
src/main/java/vion/service/impl/StoreServiceImpl.java
View file @
a3266dd
package
vion
.
service
.
impl
;
package
vion
.
service
.
impl
;
import
cn.dev33.satoken.stp.StpUtil
;
import
cn.dev33.satoken.stp.StpUtil
;
import
cn.hutool.core.map.MapUtil
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.toolkit.Db
;
import
com.github.yulichang.base.MPJBaseServiceImpl
;
import
com.github.yulichang.wrapper.MPJLambdaWrapper
;
import
io.github.linpeilie.Converter
;
import
lombok.RequiredArgsConstructor
;
import
org.dromara.hutool.core.array.ArrayUtil
;
import
org.dromara.hutool.core.collection.CollUtil
;
import
org.dromara.hutool.core.collection.CollUtil
;
import
org.dromara.hutool.core.collection.ListUtil
;
import
org.dromara.hutool.core.collection.ListUtil
;
import
org.dromara.hutool.core.date.DateUtil
;
import
org.dromara.hutool.core.date.DateUtil
;
import
org.dromara.hutool.core.io.file.FileNameUtil
;
import
org.dromara.hutool.core.io.file.FileNameUtil
;
import
org.dromara.hutool.core.io.file.FileUtil
;
import
org.dromara.hutool.core.io.file.FileUtil
;
import
org.dromara.hutool.core.lang.Opt
;
import
org.dromara.hutool.core.lang.Opt
;
import
org.dromara.hutool.core.map.MapUtil
;
import
org.dromara.hutool.core.array.ArrayUtil
;
import
org.dromara.hutool.core.util.ObjUtil
;
import
org.dromara.hutool.core.text.StrUtil
;
import
org.dromara.hutool.core.text.StrUtil
;
import
org.dromara.hutool.core.util.ObjUtil
;
import
org.dromara.hutool.crypto.SecureUtil
;
import
org.dromara.hutool.crypto.SecureUtil
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.toolkit.Db
;
import
com.github.yulichang.base.MPJBaseServiceImpl
;
import
com.github.yulichang.wrapper.MPJLambdaWrapper
;
import
io.github.linpeilie.Converter
;
import
lombok.RequiredArgsConstructor
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
...
@@ -54,6 +54,7 @@ public class StoreServiceImpl extends MPJBaseServiceImpl<StoreMapper, Store> imp
...
@@ -54,6 +54,7 @@ public class StoreServiceImpl extends MPJBaseServiceImpl<StoreMapper, Store> imp
private
final
IInspectService
inspectService
;
private
final
IInspectService
inspectService
;
private
final
ITagService
tagService
;
private
final
ITagService
tagService
;
private
final
IRStoreTagService
storeTagService
;
private
final
IRStoreTagService
storeTagService
;
private
final
IRStoreUserService
storeUserService
;
private
final
Converter
converter
;
private
final
Converter
converter
;
// 引入 taskService 会循环依赖
// 引入 taskService 会循环依赖
private
final
TaskMapper
taskMapper
;
private
final
TaskMapper
taskMapper
;
...
@@ -63,40 +64,46 @@ public class StoreServiceImpl extends MPJBaseServiceImpl<StoreMapper, Store> imp
...
@@ -63,40 +64,46 @@ public class StoreServiceImpl extends MPJBaseServiceImpl<StoreMapper, Store> imp
@Override
@Override
public
Page
<
StoreVO
>
getStoreList
(
StoreDTO
data
)
{
public
Page
<
StoreVO
>
getStoreList
(
StoreDTO
data
)
{
List
<
Long
>
storeIdListByTagId
=
new
ArrayList
<>();
var
storeIdListByTagId
=
Optional
.
ofNullable
(
data
.
getTagId
())
if
(
ObjUtil
.
isNotNull
(
data
.
getTagId
()))
{
.
map
(
tagId
->
storeTagService
.
lambdaQuery
().
eq
(
RStoreTag:
:
getTagId
,
tagId
).
list
())
List
<
RStoreTag
>
storeTagList
=
storeTagService
.
lambdaQuery
().
eq
(
RStoreTag:
:
getTagId
,
data
.
getTagId
()).
list
();
.
map
(
storeTagList
->
storeTagList
.
stream
().
map
(
RStoreTag:
:
getStoreId
).
collect
(
Collectors
.
toList
()))
storeIdListByTagId
=
storeTagList
.
stream
().
map
(
RStoreTag:
:
getStoreId
).
collect
(
Collectors
.
toList
());
.
filter
(
CollUtil:
:
isNotEmpty
)
if
(
CollUtil
.
isEmpty
(
storeIdListByTagId
))
{
.
orElse
(
List
.
of
(-
1L
));
storeIdListByTagId
.
add
(-
1L
);
}
}
Store
store
=
converter
.
convert
(
data
,
Store
.
class
);
var
storeIdListByMainUser
=
Optional
.
ofNullable
(
data
.
getMainUser
())
Page
<
Store
>
storeList
=
this
.
lambdaQuery
(
store
)
.
map
(
mainUser
->
storeUserService
.
lambdaQuery
().
eq
(
RStoreUser:
:
getUserId
,
mainUser
).
eq
(
RStoreUser:
:
getIsMain
,
1
).
list
())
.
in
(
CollUtil
.
isNotEmpty
(
storeIdListByTagId
),
Store:
:
getId
,
storeIdListByTagId
)
.
map
(
storeUserList
->
storeUserList
.
stream
().
map
(
RStoreUser:
:
getStoreId
).
collect
(
Collectors
.
toList
()))
.
filter
(
CollUtil:
:
isNotEmpty
)
.
orElse
(
List
.
of
(-
1L
));
var
store
=
converter
.
convert
(
data
,
Store
.
class
);
var
storeList
=
this
.
lambdaQuery
(
store
)
.
in
(
ObjUtil
.
notEquals
(
storeIdListByTagId
.
get
(
0
),
-
1L
),
Store:
:
getId
,
storeIdListByTagId
)
.
in
(
ObjUtil
.
notEquals
(
storeIdListByMainUser
.
get
(
0
),
-
1L
),
Store:
:
getId
,
storeIdListByMainUser
)
.
orderByDesc
(
Store:
:
getIsImportant
,
Store:
:
getCreateTime
)
.
page
(
Page
.
of
(
data
.
getPageNum
(),
data
.
getPageSize
()));
.
page
(
Page
.
of
(
data
.
getPageNum
(),
data
.
getPageSize
()));
// todo 缓存
// todo 缓存
List
<
Account
>
accountList
=
accountService
.
list
();
List
<
Account
>
accountList
=
accountService
.
list
();
List
<
FileInfo
>
fileInfoList
=
fileService
.
lambdaQuery
().
eq
(
FileInfo:
:
getSourceType
,
1
).
list
();
List
<
FileInfo
>
fileInfoList
=
fileService
.
lambdaQuery
().
eq
(
FileInfo:
:
getSourceType
,
1
).
list
();
Map
<
Long
,
Long
>
store2CntMap
=
fileInfoList
.
stream
().
collect
(
Collectors
.
groupingBy
(
FileInfo:
:
getStoreId
,
Collectors
.
counting
()));
var
store2CntMap
=
fileInfoList
.
stream
().
collect
(
Collectors
.
groupingBy
(
FileInfo:
:
getStoreId
,
Collectors
.
counting
()));
List
<
Long
>
storeIdList
=
Opt
.
ofEmptyAble
(
storeList
.
getRecords
())
var
storeIdList
=
Opt
.
ofEmptyAble
(
storeList
.
getRecords
())
.
map
(
recs
->
recs
.
stream
().
map
(
Store:
:
getId
).
collect
(
Collectors
.
toList
()))
.
map
(
recs
->
recs
.
stream
().
map
(
Store:
:
getId
).
collect
(
Collectors
.
toList
()))
.
orElse
(
ListUtil
.
empty
());
.
orElse
(
ListUtil
.
empty
());
// storeId -> 项目绑定的合同的 list
// storeId -> 项目绑定的合同的 list
Map
<
Long
,
List
<
RContractStore
>>
storeIdMap
=
Opt
.
ofEmptyAble
(
storeIdList
)
var
storeIdMap
=
Opt
.
ofEmptyAble
(
storeIdList
)
.
map
(
l
->
contractStoreService
.
lambdaQuery
().
in
(
RContractStore:
:
getStoreId
,
l
).
list
())
.
map
(
l
->
contractStoreService
.
lambdaQuery
().
in
(
RContractStore:
:
getStoreId
,
l
).
list
())
.
map
(
contractStoreList
->
contractStoreList
.
stream
().
collect
(
Collectors
.
groupingBy
(
RContractStore:
:
getStoreId
)))
.
map
(
contractStoreList
->
contractStoreList
.
stream
().
collect
(
Collectors
.
groupingBy
(
RContractStore:
:
getStoreId
)))
.
orElse
(
MapUtil
.
empty
());
.
orElse
(
MapUtil
.
empty
());
// 项目绑定的合同的id
// 项目绑定的合同的id
List
<
Long
>
contractIdList
=
Opt
.
ofEmptyAble
(
storeIdMap
.
values
())
var
contractIdList
=
Opt
.
ofEmptyAble
(
storeIdMap
.
values
())
.
map
(
l
->
l
.
stream
().
flatMap
(
List:
:
stream
).
collect
(
Collectors
.
toList
()))
.
map
(
values
->
values
.
stream
()
.
filter
(
CollUtil:
:
isNotEmpty
)
.
flatMap
(
List:
:
stream
)
.
map
(
contractStoreList
->
contractStoreList
.
stream
().
map
(
RContractStore:
:
getContractId
).
collect
(
Collectors
.
toList
())).
.
map
(
RContractStore:
:
getContractId
)
orElse
(
ListUtil
.
empty
());
.
collect
(
Collectors
.
toList
()))
.
orElse
(
Collections
.
emptyList
());
// contractId -> contract
// contractId -> contract
Map
<
Long
,
Contract
>
id2ContractMap
=
Opt
.
ofEmptyAble
(
contractIdList
)
var
id2ContractMap
=
Opt
.
ofEmptyAble
(
contractIdList
)
.
map
(
l
->
contractService
.
lambdaQuery
()
.
map
(
l
->
contractService
.
lambdaQuery
()
.
select
(
Contract:
:
getId
,
Contract:
:
getName
,
Contract:
:
getContractNo
,
Contract:
:
getType
,
Contract:
:
getSignDate
,
Contract:
:
getWarrantyPeriod
,
Contract:
:
getFinalDate
,
Contract:
:
getStatus
,
Contract:
:
getSaleName
,
Contract:
:
getCustomerName
,
Contract:
:
getMaintainSdate
,
Contract:
:
getMaintainEdate
)
.
select
(
Contract:
:
getId
,
Contract:
:
getName
,
Contract:
:
getContractNo
,
Contract:
:
getType
,
Contract:
:
getSignDate
,
Contract:
:
getWarrantyPeriod
,
Contract:
:
getFinalDate
,
Contract:
:
getStatus
,
Contract:
:
getSaleName
,
Contract:
:
getCustomerName
,
Contract:
:
getMaintainSdate
,
Contract:
:
getMaintainEdate
)
.
in
(
Contract:
:
getId
,
l
).
list
())
.
in
(
Contract:
:
getId
,
l
).
list
())
...
@@ -104,7 +111,7 @@ public class StoreServiceImpl extends MPJBaseServiceImpl<StoreMapper, Store> imp
...
@@ -104,7 +111,7 @@ public class StoreServiceImpl extends MPJBaseServiceImpl<StoreMapper, Store> imp
.
orElse
(
MapUtil
.
empty
());
.
orElse
(
MapUtil
.
empty
());
// contractId -> 合同付款约定
// contractId -> 合同付款约定
Map
<
Long
,
List
<
ContractPayment
>>
contractId2CpMap
=
Opt
.
ofEmptyAble
(
contractIdList
)
var
contractId2CpMap
=
Opt
.
ofEmptyAble
(
contractIdList
)
.
map
(
l
->
contractPaymentService
.
lambdaQuery
().
in
(
ContractPayment:
:
getContractId
,
l
).
in
(
ContractPayment:
:
getPaymentType
,
3
,
4
).
isNotNull
(
ContractPayment:
:
getNodeDate
).
list
())
.
map
(
l
->
contractPaymentService
.
lambdaQuery
().
in
(
ContractPayment:
:
getContractId
,
l
).
in
(
ContractPayment:
:
getPaymentType
,
3
,
4
).
isNotNull
(
ContractPayment:
:
getNodeDate
).
list
())
.
map
(
contractPaymentList
->
contractPaymentList
.
stream
().
collect
(
Collectors
.
groupingBy
(
ContractPayment:
:
getContractId
,
Collectors
.
collectingAndThen
(
Collectors
.
toList
(),
v
->
{
.
map
(
contractPaymentList
->
contractPaymentList
.
stream
().
collect
(
Collectors
.
groupingBy
(
ContractPayment:
:
getContractId
,
Collectors
.
collectingAndThen
(
Collectors
.
toList
(),
v
->
{
v
.
sort
(
Comparator
.
comparing
(
ContractPayment:
:
getPaymentType
).
reversed
());
v
.
sort
(
Comparator
.
comparing
(
ContractPayment:
:
getPaymentType
).
reversed
());
...
@@ -112,20 +119,21 @@ public class StoreServiceImpl extends MPJBaseServiceImpl<StoreMapper, Store> imp
...
@@ -112,20 +119,21 @@ public class StoreServiceImpl extends MPJBaseServiceImpl<StoreMapper, Store> imp
}))))
}))))
.
orElse
(
MapUtil
.
empty
());
.
orElse
(
MapUtil
.
empty
());
Map
<
Long
,
List
<
Long
>>
store2TaskIdMap
=
Opt
.
ofEmptyAble
(
storeIdList
)
// storeId -> taskIdList
var
store2TaskIdMap
=
Opt
.
ofEmptyAble
(
storeIdList
)
.
map
(
l
->
taskMapper
.
selectList
(
Wrappers
.
lambdaQuery
(
Task
.
class
).
in
(
Task:
:
getStoreId
,
l
)))
.
map
(
l
->
taskMapper
.
selectList
(
Wrappers
.
lambdaQuery
(
Task
.
class
).
in
(
Task:
:
getStoreId
,
l
)))
.
map
(
taskList
->
taskList
.
stream
().
collect
(
Collectors
.
groupingBy
(
Task:
:
getStoreId
,
Collectors
.
mapping
(
Task:
:
getId
,
Collectors
.
toList
()))))
.
map
(
taskList
->
taskList
.
stream
().
collect
(
Collectors
.
groupingBy
(
Task:
:
getStoreId
,
Collectors
.
mapping
(
Task:
:
getId
,
Collectors
.
toList
()))))
.
orElse
(
MapUtil
.
empty
());
.
orElse
(
MapUtil
.
empty
());
List
<
Long
>
taskIds
=
store2TaskIdMap
.
values
().
stream
()
var
taskIds
=
store2TaskIdMap
.
values
().
stream
()
.
flatMap
(
List:
:
stream
)
.
flatMap
(
List:
:
stream
)
.
collect
(
Collectors
.
toList
());
.
collect
(
Collectors
.
toList
());
Map
<
Long
,
List
<
ServiceOrder
>>
taskServiceOrderMap
=
Opt
.
ofEmptyAble
(
taskIds
)
var
taskServiceOrderMap
=
Opt
.
ofEmptyAble
(
taskIds
)
.
map
(
t
->
Db
.
list
(
Wrappers
.
lambdaQuery
(
ServiceOrder
.
class
).
in
(
ServiceOrder:
:
getTaskId
,
taskIds
)))
.
map
(
t
->
Db
.
list
(
Wrappers
.
lambdaQuery
(
ServiceOrder
.
class
).
in
(
ServiceOrder:
:
getTaskId
,
taskIds
)))
.
map
(
serviceOrderList
->
serviceOrderList
.
stream
().
collect
(
Collectors
.
groupingBy
(
ServiceOrder:
:
getTaskId
)))
.
map
(
serviceOrderList
->
serviceOrderList
.
stream
().
collect
(
Collectors
.
groupingBy
(
ServiceOrder:
:
getTaskId
)))
.
orElse
(
MapUtil
.
empty
());
.
orElse
(
MapUtil
.
empty
());
// storeId -> tagList
// storeId -> tagList
Map
<
Long
,
List
<
TagVO
>>
storeId2TagMap
=
Opt
.
ofEmptyAble
(
storeIdList
)
var
storeId2TagMap
=
Opt
.
ofEmptyAble
(
storeIdList
)
.
map
(
l
->
{
.
map
(
l
->
{
MPJLambdaWrapper
<
Tag
>
wrapper
=
new
MPJLambdaWrapper
<
Tag
>()
MPJLambdaWrapper
<
Tag
>
wrapper
=
new
MPJLambdaWrapper
<
Tag
>()
.
select
(
Tag:
:
getId
,
Tag:
:
getName
,
Tag:
:
getRemark
)
.
select
(
Tag:
:
getId
,
Tag:
:
getName
,
Tag:
:
getRemark
)
...
@@ -138,41 +146,49 @@ public class StoreServiceImpl extends MPJBaseServiceImpl<StoreMapper, Store> imp
...
@@ -138,41 +146,49 @@ public class StoreServiceImpl extends MPJBaseServiceImpl<StoreMapper, Store> imp
.
map
(
tagVOS
->
tagVOS
.
stream
().
collect
(
Collectors
.
groupingBy
(
TagVO:
:
getStoreId
)))
.
map
(
tagVOS
->
tagVOS
.
stream
().
collect
(
Collectors
.
groupingBy
(
TagVO:
:
getStoreId
)))
.
orElse
(
MapUtil
.
empty
());
.
orElse
(
MapUtil
.
empty
());
// storeId -> userId(项目主要负责人 or 项目经理)
var
storeId2UserIdMap
=
Opt
.
ofEmptyAble
(
storeIdList
)
.
map
(
l
->
storeUserService
.
lambdaQuery
().
in
(
RStoreUser:
:
getStoreId
,
l
).
eq
(
RStoreUser:
:
getIsMain
,
1
).
list
())
.
map
(
suList
->
suList
.
stream
().
collect
(
Collectors
.
toMap
(
RStoreUser:
:
getStoreId
,
RStoreUser:
:
getUserId
)))
.
orElse
(
MapUtil
.
empty
());
List
<
StoreVO
>
storeVOList
=
new
ArrayList
<>();
List
<
StoreVO
>
storeVOList
=
new
ArrayList
<>();
storeList
.
getRecords
().
forEach
(
item
->
{
storeList
.
getRecords
().
forEach
(
item
->
{
StoreVO
storeVO
=
converter
.
convert
(
item
,
StoreVO
.
class
);
var
storeVO
=
converter
.
convert
(
item
,
StoreVO
.
class
);
storeVO
.
setAccountName
(
accountList
.
stream
().
filter
(
v
->
v
.
getId
().
equals
(
item
.
getAccountId
())).
map
(
Account:
:
getName
).
findFirst
().
orElse
(
"--"
));
storeVO
.
setAccountName
(
accountList
.
stream
().
filter
(
v
->
v
.
getId
().
equals
(
item
.
getAccountId
())).
map
(
Account:
:
getName
).
findFirst
().
orElse
(
"--"
));
storeVO
.
setFileNum
(
store2CntMap
.
getOrDefault
(
item
.
getId
(),
0L
));
storeVO
.
setFileNum
(
store2CntMap
.
getOrDefault
(
item
.
getId
(),
0L
));
Long
storeId
=
item
.
getId
();
Long
storeId
=
item
.
getId
();
// 关联合同
// 关联合同
List
<
RContractStore
>
contractStores
=
storeIdMap
.
get
(
storeId
);
var
contractStores
=
storeIdMap
.
get
(
storeId
);
storeVO
.
setContractCount
(
Opt
.
ofEmptyAble
(
contractStores
).
map
(
List:
:
size
).
orElse
(
0
));
storeVO
.
setContractCount
(
Opt
.
ofEmptyAble
(
contractStores
).
map
(
List:
:
size
).
orElse
(
0
));
storeVO
.
setContractVOList
(
id2ContractMap
.
values
().
stream
()
storeVO
.
setContractVOList
(
id2ContractMap
.
values
().
stream
()
.
filter
(
v
->
CollUtil
.
isNotEmpty
(
contractStores
)
&&
contractStores
.
stream
().
map
(
RContractStore:
:
getContractId
).
collect
(
Collectors
.
toList
()
).
contains
(
v
.
getId
()))
.
filter
(
v
->
CollUtil
.
isNotEmpty
(
contractStores
)
&&
contractStores
.
stream
().
map
(
RContractStore:
:
getContractId
).
toList
(
).
contains
(
v
.
getId
()))
.
map
(
v
->
converter
.
convert
(
v
,
ContractVO
.
class
))
.
map
(
v
->
converter
.
convert
(
v
,
ContractVO
.
class
))
.
collect
(
Collectors
.
toList
()));
.
collect
(
Collectors
.
toList
()));
Contract
masterContract
=
id2ContractMap
.
getOrDefault
(
item
.
getMasterContract
(),
null
);
var
masterContract
=
id2ContractMap
.
getOrDefault
(
item
.
getMasterContract
(),
null
);
// 关联合同验收时间
// 关联合同验收时间
Opt
.
ofNullable
(
masterContract
)
Opt
.
ofNullable
(
masterContract
)
.
map
(
c
->
contractId2CpMap
.
getOrDefault
(
c
.
getId
(),
ListUtil
.
empty
()))
.
map
(
c
->
contractId2CpMap
.
getOrDefault
(
c
.
getId
(),
ListUtil
.
empty
()))
.
filter
(
CollUtil:
:
isNotEmpty
)
.
filter
(
CollUtil:
:
isNotEmpty
)
.
map
(
l
->
l
.
get
(
0
).
getNodeDate
())
.
map
(
l
->
l
.
get
(
0
).
getNodeDate
())
.
ifPresent
(
nodeDate
->
masterContract
.
setFinalDate
(
nodeDate
)
);
.
ifPresent
(
masterContract:
:
setFinalDate
);
storeVO
.
setMainContract
(
Opt
.
ofNullable
(
masterContract
).
map
(
c
->
converter
.
convert
(
c
,
ContractVO
.
class
)).
orElse
(
null
));
storeVO
.
setMainContract
(
Opt
.
ofNullable
(
masterContract
).
map
(
c
->
converter
.
convert
(
c
,
ContractVO
.
class
)).
orElse
(
null
));
storeVO
.
setTaskCount
(
store2TaskIdMap
.
getOrDefault
(
storeId
,
ListUtil
.
empty
()).
size
());
storeVO
.
setTaskCount
(
store2TaskIdMap
.
getOrDefault
(
storeId
,
ListUtil
.
empty
()).
size
());
// 补充服务单
// 补充服务单
if
(
store2TaskIdMap
.
containsKey
(
item
.
getId
()))
{
if
(
store2TaskIdMap
.
containsKey
(
item
.
getId
()))
{
List
<
ServiceOrder
>
serviceOrders
=
store2TaskIdMap
.
get
(
item
.
getId
())
var
cnt
=
store2TaskIdMap
.
get
(
item
.
getId
())
.
stream
().
flatMap
(
taskId
->
taskServiceOrderMap
.
getOrDefault
(
taskId
,
ListUtil
.
empty
()).
stream
())
.
stream
().
mapToLong
(
taskId
->
taskServiceOrderMap
.
getOrDefault
(
taskId
,
ListUtil
.
empty
()).
size
()).
sum
();
.
collect
(
Collectors
.
toList
());
storeVO
.
setServiceOrderCount
((
int
)
cnt
);
storeVO
.
setServiceOrderCount
(
serviceOrders
.
size
());
}
}
// 关联标签
// 关联标签
storeVO
.
setTagList
(
storeId2TagMap
.
getOrDefault
(
storeId
,
ListUtil
.
empty
()));
storeVO
.
setTagList
(
storeId2TagMap
.
getOrDefault
(
storeId
,
ListUtil
.
empty
()));
// 关联项目负责人 or 项目经理
storeVO
.
setMainUser
(
storeId2UserIdMap
.
getOrDefault
(
storeId
,
null
));
storeVOList
.
add
(
storeVO
);
storeVOList
.
add
(
storeVO
);
});
});
return
Page
.<
StoreVO
>
of
(
data
.
getPageNum
(),
data
.
getPageSize
(),
storeList
.
getTotal
()).
setRecords
(
storeVOList
);
return
Page
.<
StoreVO
>
of
(
data
.
getPageNum
(),
data
.
getPageSize
(),
storeList
.
getTotal
()).
setRecords
(
storeVOList
);
...
@@ -223,7 +239,7 @@ public class StoreServiceImpl extends MPJBaseServiceImpl<StoreMapper, Store> imp
...
@@ -223,7 +239,7 @@ public class StoreServiceImpl extends MPJBaseServiceImpl<StoreMapper, Store> imp
.
map
(
l
->
l
.
stream
().
collect
(
Collectors
.
groupingBy
(
RContractStore:
:
getStoreId
,
Collectors
.
mapping
(
RContractStore:
:
getContractId
,
Collectors
.
toList
()))))
.
map
(
l
->
l
.
stream
().
collect
(
Collectors
.
groupingBy
(
RContractStore:
:
getStoreId
,
Collectors
.
mapping
(
RContractStore:
:
getContractId
,
Collectors
.
toList
()))))
.
orElse
(
MapUtil
.
empty
());
.
orElse
(
MapUtil
.
empty
());
List
<
Contract
>
contractList
=
contractService
.
listByIds
(
storeId2ContractIdMap
.
values
().
stream
().
flatMap
(
List:
:
stream
).
collect
(
Collectors
.
toList
()));
List
<
Contract
>
contractList
=
contractService
.
listByIds
(
storeId2ContractIdMap
.
values
().
stream
().
flatMap
(
List:
:
stream
).
collect
(
Collectors
.
toList
()));
//
根据 storeList、storeId2ContractIdMap、contractList,得到一个
storeId 为 key,List<Contract> 为 value 的 map
// storeId 为 key,List<Contract> 为 value 的 map
Map
<
Long
,
List
<
Contract
>>
storeId2ContractListMap
=
storeList
.
stream
()
Map
<
Long
,
List
<
Contract
>>
storeId2ContractListMap
=
storeList
.
stream
()
.
collect
(
Collectors
.
toMap
(
Store:
:
getId
,
store
->
.
collect
(
Collectors
.
toMap
(
Store:
:
getId
,
store
->
storeId2ContractIdMap
.
getOrDefault
(
store
.
getId
(),
ListUtil
.
empty
())
storeId2ContractIdMap
.
getOrDefault
(
store
.
getId
(),
ListUtil
.
empty
())
...
@@ -232,6 +248,13 @@ public class StoreServiceImpl extends MPJBaseServiceImpl<StoreMapper, Store> imp
...
@@ -232,6 +248,13 @@ public class StoreServiceImpl extends MPJBaseServiceImpl<StoreMapper, Store> imp
.
filter
(
Objects:
:
nonNull
)
.
filter
(
Objects:
:
nonNull
)
.
collect
(
Collectors
.
toList
())));
.
collect
(
Collectors
.
toList
())));
var
contractId2CpMap
=
Opt
.
ofEmptyAble
(
contractPaymentService
.
lambdaQuery
().
in
(
ContractPayment:
:
getPaymentType
,
3
,
4
).
isNotNull
(
ContractPayment:
:
getNodeDate
).
list
())
.
map
(
contractPaymentList
->
contractPaymentList
.
stream
().
collect
(
Collectors
.
groupingBy
(
ContractPayment:
:
getContractId
,
Collectors
.
collectingAndThen
(
Collectors
.
toList
(),
v
->
{
v
.
sort
(
Comparator
.
comparing
(
ContractPayment:
:
getPaymentType
).
reversed
());
return
v
;
}))))
.
orElse
(
MapUtil
.
empty
());
List
<
Store
>
updStoreList
=
new
ArrayList
<>();
List
<
Store
>
updStoreList
=
new
ArrayList
<>();
for
(
Store
s
:
storeList
)
{
for
(
Store
s
:
storeList
)
{
s
.
setMaintainStatus
(
"--"
);
s
.
setMaintainStatus
(
"--"
);
...
@@ -240,13 +263,23 @@ public class StoreServiceImpl extends MPJBaseServiceImpl<StoreMapper, Store> imp
...
@@ -240,13 +263,23 @@ public class StoreServiceImpl extends MPJBaseServiceImpl<StoreMapper, Store> imp
// 1.项目关联的主合同在维保期内,那么这个项目就是在保
// 1.项目关联的主合同在维保期内,那么这个项目就是在保
Contract
masterContract
=
contracts
.
stream
().
filter
(
contract
->
ObjUtil
.
equals
(
contract
.
getId
(),
s
.
getMasterContract
())).
findFirst
().
orElse
(
null
);
Contract
masterContract
=
contracts
.
stream
().
filter
(
contract
->
ObjUtil
.
equals
(
contract
.
getId
(),
s
.
getMasterContract
())).
findFirst
().
orElse
(
null
);
if
(
ObjUtil
.
isNotNull
(
masterContract
))
{
if
(
ObjUtil
.
isNotNull
(
masterContract
))
{
Date
finalDate
=
masterContract
.
getFinalDate
();
Integer
warrantyPeriod
=
masterContract
.
getWarrantyPeriod
();
Integer
warrantyPeriod
=
masterContract
.
getWarrantyPeriod
();
Opt
.
ofNullable
(
contractId2CpMap
.
getOrDefault
(
masterContract
.
getId
(),
ListUtil
.
empty
()))
.
filter
(
CollUtil:
:
isNotEmpty
)
.
map
(
l
->
l
.
get
(
0
).
getNodeDate
())
.
ifPresent
(
masterContract:
:
setFinalDate
);
Date
finalDate
=
masterContract
.
getFinalDate
();
if
(
ArrayUtil
.
isAllNotNull
(
finalDate
,
warrantyPeriod
))
{
if
(
ArrayUtil
.
isAllNotNull
(
finalDate
,
warrantyPeriod
))
{
Date
finalDateEnd
=
DateUtil
.
offsetMonth
(
finalDate
,
warrantyPeriod
);
Date
finalDateEnd
=
DateUtil
.
offsetMonth
(
finalDate
,
warrantyPeriod
);
boolean
isIn
=
DateUtil
.
isIn
(
new
Date
(),
finalDate
,
finalDateEnd
);
boolean
isIn
=
DateUtil
.
isIn
(
new
Date
(),
finalDate
,
finalDateEnd
);
if
(
isIn
)
{
if
(
isIn
)
{
s
.
setMaintainStatus
(
"在保"
);
s
.
setMaintainStatus
(
"在保"
);
Store
updStore
=
new
Store
();
updStore
.
setId
(
s
.
getId
());
updStore
.
setMaintainStatus
(
s
.
getMaintainStatus
());
updStoreList
.
add
(
updStore
);
continue
;
continue
;
}
else
{
}
else
{
s
.
setMaintainStatus
(
"脱保"
);
s
.
setMaintainStatus
(
"脱保"
);
...
@@ -258,13 +291,9 @@ public class StoreServiceImpl extends MPJBaseServiceImpl<StoreMapper, Store> imp
...
@@ -258,13 +291,9 @@ public class StoreServiceImpl extends MPJBaseServiceImpl<StoreMapper, Store> imp
Set
<
Boolean
>
maintainStatusSet
=
new
HashSet
<>();
Set
<
Boolean
>
maintainStatusSet
=
new
HashSet
<>();
contracts
.
stream
()
contracts
.
stream
()
.
filter
(
contract
->
ObjUtil
.
equals
(
contract
.
getType
(),
1
))
.
filter
(
contract
->
ObjUtil
.
equals
(
contract
.
getType
(),
1
))
.
forEach
(
c
->
{
.
map
(
Contract:
:
getMaintainEdate
)
Date
maintainEdate
=
c
.
getMaintainEdate
();
.
filter
(
Objects:
:
nonNull
)
if
(
ObjUtil
.
isNotNull
(
maintainEdate
))
{
.
forEach
(
maintainEdate
->
maintainStatusSet
.
add
(
DateUtil
.
compare
(
maintainEdate
,
new
Date
())
>=
0
));
// 维保结束时间大于等于当前时间,返回 true
maintainStatusSet
.
add
(
DateUtil
.
compare
(
maintainEdate
,
new
Date
())
>=
0
);
}
});
s
.
setMaintainStatus
(
CollUtil
.
isEmpty
(
maintainStatusSet
)
?
s
.
getMaintainStatus
()
:
maintainStatusSet
.
contains
(
true
)
?
"在保"
:
"脱保"
);
s
.
setMaintainStatus
(
CollUtil
.
isEmpty
(
maintainStatusSet
)
?
s
.
getMaintainStatus
()
:
maintainStatusSet
.
contains
(
true
)
?
"在保"
:
"脱保"
);
}
}
Store
updStore
=
new
Store
();
Store
updStore
=
new
Store
();
...
...
src/main/java/vion/vo/StoreVO.java
View file @
a3266dd
...
@@ -78,7 +78,7 @@ public class StoreVO {
...
@@ -78,7 +78,7 @@ public class StoreVO {
*/
*/
private
String
taskDetail
;
private
String
taskDetail
;
/**
/**
*
预计
完成日期
*
实际
完成日期
*/
*/
@JsonFormat
(
pattern
=
"yyyy-MM-dd"
,
timezone
=
"GMT+8"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd"
,
timezone
=
"GMT+8"
)
private
Date
finishDate
;
private
Date
finishDate
;
...
@@ -90,6 +90,26 @@ public class StoreVO {
...
@@ -90,6 +90,26 @@ public class StoreVO {
* 当前卡点
* 当前卡点
*/
*/
private
String
stuckPoint
;
private
String
stuckPoint
;
/**
* 主要产品
*/
private
Integer
mainProduct
;
/**
* 点位数量
*/
private
Integer
pointNum
;
/**
* 计划完成日期
*/
@JsonFormat
(
pattern
=
"yyyy-MM-dd"
,
timezone
=
"GMT+8"
)
private
Date
planFinishDate
;
/**
* 项目规模
*/
private
Integer
projectSize
;
private
List
<
String
>
userNameList
;
private
List
<
String
>
userNameList
;
...
@@ -118,4 +138,9 @@ public class StoreVO {
...
@@ -118,4 +138,9 @@ public class StoreVO {
* 标签
* 标签
*/
*/
private
List
<
TagVO
>
tagList
;
private
List
<
TagVO
>
tagList
;
/**
* 项目负责人 or 项目经理
*/
private
Long
mainUser
;
}
}
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