Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
D
dcs-plan
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
INET-TWO
server
dcs-plan
Commits
a1d4936a
Commit
a1d4936a
authored
Sep 22, 2024
by
wei
🎱
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
供方预警列表导出
parent
628e1c4d
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
26 additions
and
40 deletions
+26
-40
SupplierEarlyWarningVO.java
.../com/yonde/dcs/plan/common/vo/SupplierEarlyWarningVO.java
+3
-0
ExtSupplierManageController.java
...dcs/plan/core/controller/ExtSupplierManageController.java
+8
-10
ExtSupplierManageService.java
...yonde/dcs/plan/core/service/ExtSupplierManageService.java
+3
-10
ExtSupplierManageServiceImpl.java
.../plan/core/service/impl/ExtSupplierManageServiceImpl.java
+12
-20
No files found.
dcs-plan-common/src/main/java/com/yonde/dcs/plan/common/vo/SupplierEarlyWarningVO.java
View file @
a1d4936a
...
...
@@ -13,6 +13,9 @@ import java.time.LocalDateTime;
*/
@Data
public
class
SupplierEarlyWarningVO
implements
Serializable
{
private
long
id
;
/**
* 供方编号
*/
...
...
dcs-plan-core/src/main/java/com/yonde/dcs/plan/core/controller/ExtSupplierManageController.java
View file @
a1d4936a
...
...
@@ -5,15 +5,13 @@ import com.yonde.dcs.plan.common.vo.ExtSupplierManageVO;
import
com.yonde.dcs.plan.common.vo.SupplierEarlyWarningVO
;
import
com.yonde.dcs.plan.core.controller.shadow.ExtSupplierManageControllerShadow
;
import
com.yonde.dcs.plan.core.service.ExtSupplierManageService
;
import
com.yonde.dex.basedata.data.search.SearchQueryCondition
;
import
com.yonde.dex.basedata.entity.api.ApiResult
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
org.springframework.web.bind.annotation.*
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.IOException
;
...
...
@@ -43,17 +41,17 @@ public class ExtSupplierManageController<V extends ExtSupplierManageVO, S extend
@ApiOperation
(
"供方预警列表"
)
@PostMapping
({
"earlyWarning"
})
public
ApiResult
earlyWarning
(
@RequestParam
(
value
=
"warningDay"
,
defaultValue
=
"30"
)
int
warningDay
,
@RequestParam
(
value
=
"pageSize"
,
defaultValue
=
"10"
)
int
pageSize
,
@RequestParam
(
value
=
"pageNumber"
,
defaultValue
=
"1"
)
int
pageNumber
)
{
return
ApiResult
.
ok
(
extSupplierManageService
.
earlyWarning
(
pageSize
,
pageNumber
,
warningDay
),
"查询成功"
);
@RequestBody
SearchQueryCondition
searchQueryCondition
)
{
return
ApiResult
.
ok
(
extSupplierManageService
.
earlyWarning
(
searchQueryCondition
,
warningDay
),
"查询成功"
);
}
@ApiOperation
(
"导出供方预警列表"
)
@PostMapping
(
value
=
"/exportEarlyWarningData"
)
public
void
exportEarlyWarningData
(
@RequestParam
(
"fileName"
)
String
fileName
,
@RequestParam
(
"ids"
)
List
<
Long
>
ids
,
HttpServletResponse
response
)
{
public
void
exportEarlyWarningData
(
@RequestParam
(
"fileName"
)
String
fileName
,
HttpServletResponse
response
,
@RequestParam
(
value
=
"warningDay"
,
defaultValue
=
"30"
)
int
warningDay
,
@RequestBody
SearchQueryCondition
searchQueryCondition
)
{
try
{
List
<
SupplierEarlyWarningVO
>
list
=
extSupplierManageService
.
exportEarlyWarningData
(
ids
);
List
<
SupplierEarlyWarningVO
>
list
=
extSupplierManageService
.
exportEarlyWarningData
(
searchQueryCondition
,
warningDay
);
EasyExcelUtils
.
exportData
(
fileName
,
response
,
list
,
SupplierEarlyWarningVO
.
class
);
}
catch
(
IOException
e
)
{
throw
new
RuntimeException
(
e
);
...
...
dcs-plan-core/src/main/java/com/yonde/dcs/plan/core/service/ExtSupplierManageService.java
View file @
a1d4936a
...
...
@@ -3,6 +3,7 @@ package com.yonde.dcs.plan.core.service;
import
com.yonde.dcs.plan.common.vo.ExtSupplierManageVO
;
import
com.yonde.dcs.plan.common.vo.SupplierEarlyWarningVO
;
import
com.yonde.dcs.plan.core.service.shadow.ExtSupplierManageServiceShadow
;
import
com.yonde.dex.basedata.data.search.SearchQueryCondition
;
import
java.util.List
;
...
...
@@ -16,15 +17,7 @@ public interface ExtSupplierManageService<V extends ExtSupplierManageVO> extends
ExtSupplierManageVO
startWorkflow
(
Long
id
);
/**
* 获取预警列表
*
* @param pageSize 每页大小
* @param pageNumber 第几页
* @param warningDay 预警天数
* @return
*/
List
<
SupplierEarlyWarningVO
>
earlyWarning
(
int
pageSize
,
int
pageNumber
,
int
warningDay
);
List
<
SupplierEarlyWarningVO
>
earlyWarning
(
SearchQueryCondition
searchQueryCondition
,
int
warningDay
);
List
<
SupplierEarlyWarningVO
>
exportEarlyWarningData
(
List
<
Long
>
ids
);
List
<
SupplierEarlyWarningVO
>
exportEarlyWarningData
(
SearchQueryCondition
searchQueryCondition
,
int
warningDay
);
}
dcs-plan-core/src/main/java/com/yonde/dcs/plan/core/service/impl/ExtSupplierManageServiceImpl.java
View file @
a1d4936a
...
...
@@ -10,7 +10,6 @@ import com.yonde.dcs.plan.core.service.ExtSupplierManageLinkService;
import
com.yonde.dcs.plan.core.service.ExtSupplierManageService
;
import
com.yonde.dcs.plan.entity.po.ExtSupplierManage
;
import
com.yonde.dex.basedata.data.search.SearchItem
;
import
com.yonde.dex.basedata.data.search.SearchItems
;
import
com.yonde.dex.basedata.data.search.SearchQueryCondition
;
import
com.yonde.dex.basedata.exception.DxBusinessException
;
import
com.yonde.dex.wfc.feign.api.WfcProcessFeign
;
...
...
@@ -21,7 +20,6 @@ import org.springframework.stereotype.Service;
import
java.time.LocalDate
;
import
java.util.List
;
import
java.util.stream.Collectors
;
/**
* @description: ExtSupplierManage-ServiceImpl
...
...
@@ -57,19 +55,10 @@ public class ExtSupplierManageServiceImpl<V extends ExtSupplierManageVO> impleme
}
@Override
public
List
<
SupplierEarlyWarningVO
>
earlyWarning
(
int
pageSize
,
int
pageNumber
,
int
warningDay
)
{
public
List
<
SupplierEarlyWarningVO
>
earlyWarning
(
SearchQueryCondition
searchQueryCondition
,
int
warningDay
)
{
List
<
SupplierEarlyWarningVO
>
list
=
Lists
.
newArrayList
();
LocalDate
warningDate
=
LocalDate
.
now
().
minusDays
(
warningDay
);
List
<
ExtSupplierManageLinkVO
>
extSupplierManageLinkVOS
=
this
.
recursionSupplierManageLinks
(
warningDate
.
toString
());
// 分页
if
(
pageSize
>
0
&&
pageNumber
>
0
)
{
int
fromIndex
=
(
pageNumber
-
1
)
*
pageSize
;
//int toIndex = fromIndex + pageSize;
if
(
fromIndex
>=
extSupplierManageLinkVOS
.
size
())
{
return
list
;
}
extSupplierManageLinkVOS
=
extSupplierManageLinkVOS
.
stream
().
skip
(
fromIndex
).
limit
(
pageSize
).
collect
(
Collectors
.
toList
());
}
List
<
ExtSupplierManageLinkVO
>
extSupplierManageLinkVOS
=
this
.
recursionSupplierManageLinks
(
searchQueryCondition
,
warningDate
.
toString
());
for
(
ExtSupplierManageLinkVO
extSupplierManageLinkVO
:
extSupplierManageLinkVOS
)
{
ExtSupplierManageVO
source
=
extSupplierManageLinkVO
.
getSource
();
ExtQualificationsVO
target
=
extSupplierManageLinkVO
.
getTarget
();
...
...
@@ -79,8 +68,8 @@ public class ExtSupplierManageServiceImpl<V extends ExtSupplierManageVO> impleme
}
@Override
public
List
<
SupplierEarlyWarningVO
>
exportEarlyWarningData
(
List
<
Long
>
ids
)
{
return
this
.
earlyWarning
(
0
,
0
,
30
);
public
List
<
SupplierEarlyWarningVO
>
exportEarlyWarningData
(
SearchQueryCondition
searchQueryCondition
,
int
warningDay
)
{
return
earlyWarning
(
searchQueryCondition
,
warningDay
);
}
private
SupplierEarlyWarningVO
buildSupplierEarlyWarningVO
(
ExtSupplierManageVO
source
,
ExtQualificationsVO
target
)
{
...
...
@@ -89,19 +78,22 @@ public class ExtSupplierManageServiceImpl<V extends ExtSupplierManageVO> impleme
supplierEarlyWarningVO
.
setQualificationsContent
(
target
.
getQualificationsContent
());
supplierEarlyWarningVO
.
setCertificateNumber
(
target
.
getCertificateNumber
());
supplierEarlyWarningVO
.
setCertificateTime
(
target
.
getCertificateTime
());
supplierEarlyWarningVO
.
setId
(
target
.
getId
());
return
supplierEarlyWarningVO
;
}
private
List
<
ExtSupplierManageLinkVO
>
recursionSupplierManageLinks
(
String
warningDate
)
{
SearchQueryCondition
condition
=
SearchQueryCondition
.
builder
().
searchItems
(
private
List
<
ExtSupplierManageLinkVO
>
recursionSupplierManageLinks
(
S
earchQueryCondition
searchQueryCondition
,
S
tring
warningDate
)
{
/*
SearchQueryCondition condition = SearchQueryCondition.builder().searchItems(
SearchItems.of(
SearchItems.BooleanOperator.AND,
new SearchItem("target.certificateTime", SearchItem.Operator.GT, warningDate, null)
)
).openProp(SearchQueryCondition.builder().name("target").build()
).
openProp
(
SearchQueryCondition
.
builder
().
name
(
"source"
).
build
()).
build
();
List
<
ExtSupplierManageLinkVO
>
content
=
extSupplierManageLinkService
.
findRecursion
(
condition
).
getContent
();
).openProp(SearchQueryCondition.builder().name("source").build()).build();*/
SearchItem
searchItem
=
new
SearchItem
(
"target.certificateTime"
,
SearchItem
.
Operator
.
GT
,
warningDate
);
searchQueryCondition
.
getSearchItems
().
getItems
().
add
(
searchItem
);
List
<
ExtSupplierManageLinkVO
>
content
=
extSupplierManageLinkService
.
findRecursion
(
searchQueryCondition
).
getContent
();
return
content
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
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 comment