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
7dc713b3
Commit
7dc713b3
authored
Sep 21, 2024
by
wei
🎱
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
供方预警数据导出
parent
2a5fba8f
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
154 additions
and
8 deletions
+154
-8
EasyExcelUtils.java
.../java/com/yonde/dcs/plan/common/utils/EasyExcelUtils.java
+36
-3
SupplierEarlyWarningVO.java
.../com/yonde/dcs/plan/common/vo/SupplierEarlyWarningVO.java
+87
-0
ExtSupplierManageController.java
...dcs/plan/core/controller/ExtSupplierManageController.java
+23
-5
ExtSupplierManageService.java
...yonde/dcs/plan/core/service/ExtSupplierManageService.java
+2
-0
ExtSupplierManageServiceImpl.java
.../plan/core/service/impl/ExtSupplierManageServiceImpl.java
+6
-0
No files found.
dcs-plan-common/src/main/java/com/yonde/dcs/plan/common/utils/EasyExcelUtils.java
View file @
7dc713b3
...
...
@@ -3,12 +3,12 @@ package com.yonde.dcs.plan.common.utils;
import
com.alibaba.excel.EasyExcel
;
import
com.alibaba.excel.context.AnalysisContext
;
import
com.alibaba.excel.event.AnalysisEventListener
;
import
com.alibaba.excel.
write.metadata.holder.WriteSheetHolder
;
import
com.alibaba.excel.
support.ExcelTypeEnum
;
import
com.alibaba.excel.write.metadata.style.WriteCellStyle
;
import
com.alibaba.excel.write.metadata.style.WriteFont
;
import
com.alibaba.excel.write.style.HorizontalCellStyleStrategy
;
import
com.alibaba.excel.write.style.column.AbstractColumnWidthStyleStrategy
;
import
com.alibaba.excel.write.style.column.LongestMatchColumnWidthStyleStrategy
;
import
com.yonde.dcs.plan.common.vo.SupplierEarlyWarningVO
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.poi.ss.usermodel.HorizontalAlignment
;
import
org.apache.poi.ss.usermodel.IndexedColors
;
...
...
@@ -93,6 +93,40 @@ public class EasyExcelUtils {
exportPublic
(
fileName
,
response
,
data
,
clazz
,
excludeColumnFieldNames
);
}
/**
* EasyExce导出到浏览器
* @param fileName 文件名
* @param response 响应对象
* @param list 数据集
* @param clazz 实体类模板
* @param <T> 泛型
* @throws IOException
*/
public
static
<
T
>
void
exportData
(
String
fileName
,
HttpServletResponse
response
,
List
<
T
>
list
,
Class
<
T
>
clazz
)
throws
IOException
{
setExcelResponseProp
(
response
,
fileName
);
EasyExcel
.
write
(
response
.
getOutputStream
())
.
head
(
clazz
)
.
excelType
(
ExcelTypeEnum
.
XLSX
)
.
sheet
(
fileName
)
.
doWrite
(
list
);
}
/**
* 设置响应结果
*
* @param response 响应结果对象
* @param rawFileName 文件名
* @throws UnsupportedEncodingException 不支持编码异常
*/
private
static
void
setExcelResponseProp
(
HttpServletResponse
response
,
String
rawFileName
)
throws
UnsupportedEncodingException
{
response
.
setContentType
(
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
);
response
.
setCharacterEncoding
(
"utf-8"
);
String
fileName
=
URLEncoder
.
encode
(
rawFileName
,
"UTF-8"
).
replaceAll
(
"\\+"
,
"%20"
);
response
.
setHeader
(
"Content-disposition"
,
"attachment;filename*=utf-8''"
+
fileName
+
".xlsx"
);
}
/**
* export公共
*
...
...
@@ -115,7 +149,6 @@ public class EasyExcelUtils {
// .registerWriteHandler(new CustomCellWriteHeightConfig())
.
sheet
()
.
doWrite
(
data
);
}
/**
...
...
dcs-plan-common/src/main/java/com/yonde/dcs/plan/common/vo/SupplierEarlyWarningVO.java
0 → 100644
View file @
7dc713b3
package
com
.
yonde
.
dcs
.
plan
.
common
.
vo
;
import
com.alibaba.excel.annotation.ExcelProperty
;
import
lombok.Data
;
import
java.io.Serializable
;
import
java.time.LocalDateTime
;
/**
* @author weihongda
* @Date 2024/9/21 11:26
* @Description: 供应商预警
*/
@Data
public
class
SupplierEarlyWarningVO
implements
Serializable
{
/**
* 供方编号
*/
@ExcelProperty
(
"供方编号"
)
private
String
number
;
/**
* 供方名称
*/
@ExcelProperty
(
"供方名称"
)
private
String
name
;
/**
* 经营类别
*/
//@ExcelProperty("经营类别")
private
String
operateType
;
/**
* 统一社会信用引用代码
*/
@ExcelProperty
(
"统一社会信用引用代码"
)
private
String
unifiedSocietyCode
;
/**
* 供方类别
*/
@ExcelProperty
(
"供方类别"
)
private
String
supplierType
;
/**
* 供方地址
*/
@ExcelProperty
(
"供方地址"
)
private
String
supplierAddress
;
/**
* 注册时间
*/
@ExcelProperty
(
"注册时间"
)
private
LocalDateTime
registrationTime
;
/**
* 注册资金
*/
@ExcelProperty
(
"注册资金"
)
private
String
registrationFund
;
/**
* 名录有效期
*/
@ExcelProperty
(
"名录有效期"
)
private
String
directoryValidity
;
/**
* 资质内容
*/
@ExcelProperty
(
"资质内容"
)
private
String
qualificationsContent
;
/**
* 证书编号
*/
@ExcelProperty
(
"证书编号"
)
private
String
certificateNumber
;
/**
* 证书有效期
*/
@ExcelProperty
(
"证书有效期"
)
private
LocalDateTime
certificateTime
;
}
dcs-plan-core/src/main/java/com/yonde/dcs/plan/core/controller/ExtSupplierManageController.java
View file @
7dc713b3
package
com
.
yonde
.
dcs
.
plan
.
core
.
controller
;
import
com.yonde.dcs.plan.common.utils.EasyExcelUtils
;
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.dcs.plan.entity.po.ExtSupplierManage
;
import
com.yonde.dex.basedata.entity.api.ApiResult
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
...
...
@@ -14,6 +15,10 @@ import org.springframework.web.bind.annotation.RequestMapping;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.IOException
;
import
java.util.List
;
/**
* @description: ExtSupplierManage-Controller
* @author: dexadmin
...
...
@@ -31,15 +36,28 @@ public class ExtSupplierManageController<V extends ExtSupplierManageVO, S extend
@ApiOperation
(
"发起审批流程"
)
@PostMapping
({
"startWorkflow"
})
public
ApiResult
startWorkflow
(
@RequestParam
(
"id"
)
Long
id
){
return
ApiResult
.
ok
(
extSupplierManageService
.
startWorkflow
(
id
),
"操作完成"
);
public
ApiResult
startWorkflow
(
@RequestParam
(
"id"
)
Long
id
)
{
return
ApiResult
.
ok
(
extSupplierManageService
.
startWorkflow
(
id
),
"操作完成"
);
}
@ApiOperation
(
"供方预警列表"
)
@PostMapping
({
"earlyWarning"
})
public
ApiResult
earlyWarning
(
@RequestParam
(
"warningDay"
)
Integer
warningDay
){
return
ApiResult
.
ok
(
extSupplierManageService
.
earlyWarning
(
warningDay
),
"查询成功"
);
public
ApiResult
earlyWarning
(
@RequestParam
(
"warningDay"
)
Integer
warningDay
)
{
return
ApiResult
.
ok
(
extSupplierManageService
.
earlyWarning
(
warningDay
),
"查询成功"
);
}
@ApiOperation
(
"导出供方预警列表"
)
@PostMapping
(
value
=
"/exportEarlyWarningData"
)
public
void
exportEarlyWarningData
(
@RequestParam
(
"fileName"
)
String
fileName
,
@RequestParam
(
"ids"
)
List
<
Long
>
ids
,
HttpServletResponse
response
)
{
try
{
List
<
SupplierEarlyWarningVO
>
list
=
extSupplierManageService
.
exportEarlyWarningData
(
ids
);
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 @
7dc713b3
...
...
@@ -17,4 +17,6 @@ public interface ExtSupplierManageService<V extends ExtSupplierManageVO> extends
ExtSupplierManageVO
startWorkflow
(
Long
id
);
List
<
SupplierEarlyWarningVO
>
earlyWarning
(
Integer
warningDay
);
List
<
SupplierEarlyWarningVO
>
exportEarlyWarningData
(
List
<
Long
>
ids
);
}
dcs-plan-core/src/main/java/com/yonde/dcs/plan/core/service/impl/ExtSupplierManageServiceImpl.java
View file @
7dc713b3
...
...
@@ -15,6 +15,7 @@ import com.yonde.dex.basedata.data.search.SearchQueryCondition;
import
com.yonde.dex.basedata.exception.DxBusinessException
;
import
com.yonde.dex.wfc.feign.api.WfcProcessFeign
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.commons.lang3.ObjectUtils
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -75,6 +76,11 @@ public class ExtSupplierManageServiceImpl<V extends ExtSupplierManageVO> impleme
return
list
;
}
@Override
public
List
<
SupplierEarlyWarningVO
>
exportEarlyWarningData
(
List
<
Long
>
ids
)
{
return
this
.
earlyWarning
(
30
);
}
private
SupplierEarlyWarningVO
buildSupplierEarlyWarningVO
(
ExtSupplierManageVO
source
,
ExtQualificationsVO
target
)
{
SupplierEarlyWarningVO
supplierEarlyWarningVO
=
new
SupplierEarlyWarningVO
();
BeanUtils
.
copyProperties
(
source
,
supplierEarlyWarningVO
);
...
...
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