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
Hide 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
;
package
vion
.
controller
;
import
cn.dev33.satoken.annotation.SaCheckPermission
;
import
cn.dev33.satoken.annotation.SaCheckPermission
;
import
com.baomidou.mybatisplus.core.toolkit.StringUtils
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
io.github.linpeilie.Converter
;
import
io.github.linpeilie.Converter
;
import
lombok.RequiredArgsConstructor
;
import
lombok.RequiredArgsConstructor
;
...
@@ -35,29 +36,31 @@ public class StoreController {
...
@@ -35,29 +36,31 @@ public class StoreController {
@GetMapping
(
"/stores"
)
@GetMapping
(
"/stores"
)
@SaCheckPermission
(
value
=
"store:list"
,
orRole
=
"admin"
)
@SaCheckPermission
(
value
=
"store:list"
,
orRole
=
"admin"
)
public
Page
<
StoreVO
>
getStoreList
(
StoreDTO
data
)
{
public
Page
<
StoreVO
>
getStoreList
(
StoreDTO
data
)
{
return
storeService
.
getStoreList
(
data
);
return
storeService
.
getStoreList
(
data
);
}
}
@GetMapping
(
"/store"
)
@GetMapping
(
"/store"
)
@SaCheckPermission
(
value
=
"store:query"
,
orRole
=
"admin"
)
@SaCheckPermission
(
value
=
"store:query"
,
orRole
=
"admin"
)
public
StoreVO
getStoreById
(
@RequestParam
Integer
id
)
{
public
StoreVO
getStoreById
(
@RequestParam
Integer
id
)
{
Store
store
=
storeService
.
getById
(
id
);
Store
store
=
storeService
.
getById
(
id
);
return
converter
.
convert
(
store
,
StoreVO
.
class
);
return
converter
.
convert
(
store
,
StoreVO
.
class
);
}
}
@GetMapping
(
"/storeList"
)
@GetMapping
(
"/storeList"
)
@SaCheckPermission
(
value
=
"store:list1"
,
orRole
=
"admin"
)
@SaCheckPermission
(
value
=
"store:list1"
,
orRole
=
"admin"
)
public
List
<
StoreVO
>
getStoreList
(
Integer
accountId
)
{
public
List
<
StoreVO
>
getStoreList
(
Integer
accountId
,
String
name
,
Integer
limit
)
{
List
<
Store
>
storeList
=
storeService
.
lambdaQuery
()
List
<
Store
>
storeList
=
storeService
.
lambdaQuery
()
.
eq
(
accountId
!=
null
,
Store:
:
getAccountId
,
accountId
)
.
eq
(
accountId
!=
null
,
Store:
:
getAccountId
,
accountId
)
.
like
(
StringUtils
.
isNotBlank
(
name
),
Store:
:
getName
,
name
)
.
last
(
limit
!=
null
,
"limit "
+
limit
)
.
list
();
.
list
();
return
converter
.
convert
(
storeList
,
StoreVO
.
class
);
return
converter
.
convert
(
storeList
,
StoreVO
.
class
);
}
}
@PostMapping
(
"/stores"
)
@PostMapping
(
"/stores"
)
@SaCheckPermission
(
value
=
"store:editAndSave"
,
orRole
=
"admin"
)
@SaCheckPermission
(
value
=
"store:editAndSave"
,
orRole
=
"admin"
)
public
String
saveOrUpdate
(
@RequestBody
StoreDTO
data
,
@RequestHeader
String
token
)
{
public
String
saveOrUpdate
(
@RequestBody
StoreDTO
data
,
@RequestHeader
String
token
)
{
UserVO
user
=
Global
.
USERNAME_MAP
.
get
(
token
);
UserVO
user
=
Global
.
USERNAME_MAP
.
get
(
token
);
...
@@ -71,14 +74,14 @@ public class StoreController {
...
@@ -71,14 +74,14 @@ public class StoreController {
}
}
@PostMapping
(
"/updateStoreStatus"
)
@PostMapping
(
"/updateStoreStatus"
)
@SaCheckPermission
(
value
=
"store:editStatus"
,
orRole
=
"admin"
)
@SaCheckPermission
(
value
=
"store:editStatus"
,
orRole
=
"admin"
)
public
Object
updateStoreStage
(
StatusDTO
statusDTO
,
@RequestHeader
String
token
)
{
public
Object
updateStoreStage
(
StatusDTO
statusDTO
,
@RequestHeader
String
token
)
{
return
storeService
.
updateStoreStage
(
statusDTO
,
token
);
return
storeService
.
updateStoreStage
(
statusDTO
,
token
);
}
}
// 未用到
// 未用到
// @GetMapping("/store/contract/{id}")
// @GetMapping("/store/contract/{id}")
@SaCheckPermission
(
value
=
"store:contract"
,
orRole
=
"admin"
)
@SaCheckPermission
(
value
=
"store:contract"
,
orRole
=
"admin"
)
public
List
<
ContractVO
>
listContractById
(
@PathVariable
Long
id
)
{
public
List
<
ContractVO
>
listContractById
(
@PathVariable
Long
id
)
{
List
<
RContractStore
>
contractStoreList
=
contractStoreService
.
lambdaQuery
().
eq
(
RContractStore:
:
getStoreId
,
id
).
list
();
List
<
RContractStore
>
contractStoreList
=
contractStoreService
.
lambdaQuery
().
eq
(
RContractStore:
:
getStoreId
,
id
).
list
();
List
<
Long
>
contractIdList
=
contractStoreList
.
stream
().
map
(
RContractStore:
:
getContractId
).
collect
(
Collectors
.
toList
());
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;
...
@@ -18,9 +18,11 @@ import org.springframework.stereotype.Service;
import
vion.dto.ContractDTO
;
import
vion.dto.ContractDTO
;
import
vion.mapper.ContractMapper
;
import
vion.mapper.ContractMapper
;
import
vion.mapper.RContractStoreMapper
;
import
vion.mapper.RContractStoreMapper
;
import
vion.mapper.StoreMapper
;
import
vion.model.Contract
;
import
vion.model.Contract
;
import
vion.model.FileInfo
;
import
vion.model.FileInfo
;
import
vion.model.RContractStore
;
import
vion.model.RContractStore
;
import
vion.model.Store
;
import
vion.service.IContractPaymentService
;
import
vion.service.IContractPaymentService
;
import
vion.service.IContractService
;
import
vion.service.IContractService
;
import
vion.service.IFileService
;
import
vion.service.IFileService
;
...
@@ -32,6 +34,7 @@ import java.io.IOException;
...
@@ -32,6 +34,7 @@ import java.io.IOException;
import
java.util.Arrays
;
import
java.util.Arrays
;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
/**
/**
...
@@ -46,6 +49,7 @@ public class ContractServiceImpl extends MPJBaseServiceImpl<ContractMapper, Cont
...
@@ -46,6 +49,7 @@ public class ContractServiceImpl extends MPJBaseServiceImpl<ContractMapper, Cont
private
final
IContractPaymentService
contractPaymentService
;
private
final
IContractPaymentService
contractPaymentService
;
private
final
Converter
converter
;
private
final
Converter
converter
;
private
final
RContractStoreMapper
rContractStoreMapper
;
private
final
RContractStoreMapper
rContractStoreMapper
;
private
final
StoreMapper
storeMapper
;
@Value
(
"${fileUrl:}"
)
@Value
(
"${fileUrl:}"
)
private
String
fileUrl
;
private
String
fileUrl
;
...
@@ -70,9 +74,33 @@ public class ContractServiceImpl extends MPJBaseServiceImpl<ContractMapper, Cont
...
@@ -70,9 +74,33 @@ public class ContractServiceImpl extends MPJBaseServiceImpl<ContractMapper, Cont
.
like
(
StringUtils
.
isNotBlank
(
name
),
Contract:
:
getName
,
name
)
.
like
(
StringUtils
.
isNotBlank
(
name
),
Contract:
:
getName
,
name
)
.
page
(
Page
.
of
(
dto
.
getPageNum
(),
dto
.
getPageSize
()));
.
page
(
Page
.
of
(
dto
.
getPageNum
(),
dto
.
getPageSize
()));
List
<
ContractVO
>
contractVOList
=
converter
.
convert
(
contractList
.
getRecords
(),
ContractVO
.
class
);
List
<
ContractVO
>
contractVOList
=
converter
.
convert
(
contractList
.
getRecords
(),
ContractVO
.
class
);
// 查出合同关联的项目名
completeStoreName
(
contractVOList
);
return
Page
.<
ContractVO
>
of
(
contractList
.
getCurrent
(),
contractList
.
getSize
(),
contractList
.
getTotal
()).
setRecords
(
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
@Override
public
String
updateById
(
Long
id
,
ContractDTO
dto
)
{
public
String
updateById
(
Long
id
,
ContractDTO
dto
)
{
Contract
exitContract
=
this
.
getById
(
id
);
Contract
exitContract
=
this
.
getById
(
id
);
...
...
src/main/java/vion/vo/ContractVO.java
View file @
3f2af6f
...
@@ -7,6 +7,7 @@ import lombok.Setter;
...
@@ -7,6 +7,7 @@ import lombok.Setter;
import
java.math.BigDecimal
;
import
java.math.BigDecimal
;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.List
;
@Getter
@Getter
@Setter
@Setter
...
@@ -118,4 +119,9 @@ public class ContractVO {
...
@@ -118,4 +119,9 @@ public class ContractVO {
* 合同质保周期(月)
* 合同质保周期(月)
*/
*/
private
Integer
warrantyPeriod
;
private
Integer
warrantyPeriod
;
/**
* 合同关联的项目名
*/
private
List
<
String
>
storeNames
;
}
}
\ No newline at end of file
\ 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