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 3f2af6ff
authored
Dec 02, 2023
by
zhuht
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
[chg]合同列表返回值增加关联的项目名;项目查询支持名称模糊搜索和返回条数限制;
1 parent
7a04d0d6
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
44 additions
and
7 deletions
src/main/java/vion/controller/StoreController.java
src/main/java/vion/service/impl/ContractServiceImpl.java
src/main/java/vion/vo/ContractVO.java
src/main/java/vion/controller/StoreController.java
View file @
3f2af6f
package
vion
.
controller
;
import
cn.dev33.satoken.annotation.SaCheckPermission
;
import
com.baomidou.mybatisplus.core.toolkit.StringUtils
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
io.github.linpeilie.Converter
;
import
lombok.RequiredArgsConstructor
;
...
...
@@ -35,29 +36,31 @@ public class StoreController {
@GetMapping
(
"/stores"
)
@SaCheckPermission
(
value
=
"store:list"
,
orRole
=
"admin"
)
@SaCheckPermission
(
value
=
"store:list"
,
orRole
=
"admin"
)
public
Page
<
StoreVO
>
getStoreList
(
StoreDTO
data
)
{
return
storeService
.
getStoreList
(
data
);
}
@GetMapping
(
"/store"
)
@SaCheckPermission
(
value
=
"store:query"
,
orRole
=
"admin"
)
@SaCheckPermission
(
value
=
"store:query"
,
orRole
=
"admin"
)
public
StoreVO
getStoreById
(
@RequestParam
Integer
id
)
{
Store
store
=
storeService
.
getById
(
id
);
return
converter
.
convert
(
store
,
StoreVO
.
class
);
}
@GetMapping
(
"/storeList"
)
@SaCheckPermission
(
value
=
"store:list1"
,
orRole
=
"admin"
)
public
List
<
StoreVO
>
getStoreList
(
Integer
accountId
)
{
@SaCheckPermission
(
value
=
"store:list1"
,
orRole
=
"admin"
)
public
List
<
StoreVO
>
getStoreList
(
Integer
accountId
,
String
name
,
Integer
limit
)
{
List
<
Store
>
storeList
=
storeService
.
lambdaQuery
()
.
eq
(
accountId
!=
null
,
Store:
:
getAccountId
,
accountId
)
.
like
(
StringUtils
.
isNotBlank
(
name
),
Store:
:
getName
,
name
)
.
last
(
limit
!=
null
,
"limit "
+
limit
)
.
list
();
return
converter
.
convert
(
storeList
,
StoreVO
.
class
);
}
@PostMapping
(
"/stores"
)
@SaCheckPermission
(
value
=
"store:editAndSave"
,
orRole
=
"admin"
)
@SaCheckPermission
(
value
=
"store:editAndSave"
,
orRole
=
"admin"
)
public
String
saveOrUpdate
(
@RequestBody
StoreDTO
data
,
@RequestHeader
String
token
)
{
UserVO
user
=
Global
.
USERNAME_MAP
.
get
(
token
);
...
...
@@ -71,14 +74,14 @@ public class StoreController {
}
@PostMapping
(
"/updateStoreStatus"
)
@SaCheckPermission
(
value
=
"store:editStatus"
,
orRole
=
"admin"
)
@SaCheckPermission
(
value
=
"store:editStatus"
,
orRole
=
"admin"
)
public
Object
updateStoreStage
(
StatusDTO
statusDTO
,
@RequestHeader
String
token
)
{
return
storeService
.
updateStoreStage
(
statusDTO
,
token
);
}
// 未用到
// @GetMapping("/store/contract/{id}")
@SaCheckPermission
(
value
=
"store:contract"
,
orRole
=
"admin"
)
@SaCheckPermission
(
value
=
"store:contract"
,
orRole
=
"admin"
)
public
List
<
ContractVO
>
listContractById
(
@PathVariable
Long
id
)
{
List
<
RContractStore
>
contractStoreList
=
contractStoreService
.
lambdaQuery
().
eq
(
RContractStore:
:
getStoreId
,
id
).
list
();
List
<
Long
>
contractIdList
=
contractStoreList
.
stream
().
map
(
RContractStore:
:
getContractId
).
collect
(
Collectors
.
toList
());
...
...
src/main/java/vion/service/impl/ContractServiceImpl.java
View file @
3f2af6f
...
...
@@ -18,9 +18,11 @@ import org.springframework.stereotype.Service;
import
vion.dto.ContractDTO
;
import
vion.mapper.ContractMapper
;
import
vion.mapper.RContractStoreMapper
;
import
vion.mapper.StoreMapper
;
import
vion.model.Contract
;
import
vion.model.FileInfo
;
import
vion.model.RContractStore
;
import
vion.model.Store
;
import
vion.service.IContractPaymentService
;
import
vion.service.IContractService
;
import
vion.service.IFileService
;
...
...
@@ -32,6 +34,7 @@ import java.io.IOException;
import
java.util.Arrays
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
/**
...
...
@@ -46,6 +49,7 @@ public class ContractServiceImpl extends MPJBaseServiceImpl<ContractMapper, Cont
private
final
IContractPaymentService
contractPaymentService
;
private
final
Converter
converter
;
private
final
RContractStoreMapper
rContractStoreMapper
;
private
final
StoreMapper
storeMapper
;
@Value
(
"${fileUrl:}"
)
private
String
fileUrl
;
...
...
@@ -70,9 +74,33 @@ public class ContractServiceImpl extends MPJBaseServiceImpl<ContractMapper, Cont
.
like
(
StringUtils
.
isNotBlank
(
name
),
Contract:
:
getName
,
name
)
.
page
(
Page
.
of
(
dto
.
getPageNum
(),
dto
.
getPageSize
()));
List
<
ContractVO
>
contractVOList
=
converter
.
convert
(
contractList
.
getRecords
(),
ContractVO
.
class
);
// 查出合同关联的项目名
completeStoreName
(
contractVOList
);
return
Page
.<
ContractVO
>
of
(
contractList
.
getCurrent
(),
contractList
.
getSize
(),
contractList
.
getTotal
()).
setRecords
(
contractVOList
);
}
private
void
completeStoreName
(
List
<
ContractVO
>
contractVOList
)
{
if
(
CollectionUtils
.
isNotEmpty
(
contractVOList
))
{
List
<
Long
>
contractIds
=
contractVOList
.
stream
().
map
(
ContractVO:
:
getId
).
collect
(
Collectors
.
toList
());
Map
<
Long
,
List
<
Long
>>
contractStoreIdsMap
=
rContractStoreMapper
.
selectList
(
Wrappers
.
lambdaQuery
(
RContractStore
.
class
)
.
in
(
RContractStore:
:
getContractId
,
contractIds
))
.
stream
().
collect
(
Collectors
.
groupingBy
(
RContractStore:
:
getContractId
,
Collectors
.
mapping
(
RContractStore:
:
getStoreId
,
Collectors
.
toList
())));
if
(!
contractStoreIdsMap
.
isEmpty
())
{
List
<
Long
>
storeIds
=
contractStoreIdsMap
.
values
().
stream
().
flatMap
(
List:
:
stream
).
collect
(
Collectors
.
toList
());
Map
<
Long
,
String
>
storeIdNameMap
=
storeMapper
.
selectBatchIds
(
storeIds
).
stream
().
collect
(
Collectors
.
toMap
(
Store:
:
getId
,
Store:
:
getName
));
if
(!
storeIdNameMap
.
isEmpty
())
{
contractVOList
.
forEach
(
contractVO
->
{
if
(
contractStoreIdsMap
.
containsKey
(
contractVO
.
getId
()))
{
contractVO
.
setStoreNames
(
contractStoreIdsMap
.
get
(
contractVO
.
getId
()).
stream
().
map
(
storeIdNameMap:
:
get
).
collect
(
Collectors
.
toList
()));
}
});
}
}
}
}
@Override
public
String
updateById
(
Long
id
,
ContractDTO
dto
)
{
Contract
exitContract
=
this
.
getById
(
id
);
...
...
src/main/java/vion/vo/ContractVO.java
View file @
3f2af6f
...
...
@@ -7,6 +7,7 @@ import lombok.Setter;
import
java.math.BigDecimal
;
import
java.util.Date
;
import
java.util.List
;
@Getter
@Setter
...
...
@@ -118,4 +119,9 @@ public class ContractVO {
* 合同质保周期(月)
*/
private
Integer
warrantyPeriod
;
/**
* 合同关联的项目名
*/
private
List
<
String
>
storeNames
;
}
\ No newline at end of file
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