Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
jiedao-api-boot-master
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
lanbaoming
jiedao-api-boot-master
Commits
f93069a0
Commit
f93069a0
authored
Dec 07, 2024
by
honghy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
海运已装单添加底色
parent
9af4107e
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
142 additions
and
32 deletions
+142
-32
CustomsTypeEnum.java
.../iocoder/yudao/module/shipment/enums/CustomsTypeEnum.java
+21
-0
ShipmentLoadExcelExportListener2.java
...e/shipment/listener/ShipmentLoadExcelExportListener2.java
+96
-28
CustomLoadMergeStrategyNew.java
...dao/module/shipment/utils/CustomLoadMergeStrategyNew.java
+25
-4
No files found.
yudao-module-shipment/yudao-module-shipment-core/src/main/java/cn/iocoder/yudao/module/shipment/enums/CustomsTypeEnum.java
0 → 100644
View file @
f93069a0
package
cn
.
iocoder
.
yudao
.
module
.
shipment
.
enums
;
import
lombok.AllArgsConstructor
;
import
lombok.Getter
;
/**
* 报关方式枚举
*
* @author jayden
*/
@Getter
@AllArgsConstructor
public
enum
CustomsTypeEnum
{
CUSTOMS_TYPE_1
(
"我司全代"
,
1
),
CUSTOMS_TYPE_2
(
"自单代报"
,
2
),
CUSTOMS_TYPE_3
(
"混合报关"
,
3
);
private
final
String
name
;
private
final
Integer
value
;
}
yudao-module-shipment/yudao-module-shipment-core/src/main/java/cn/iocoder/yudao/module/shipment/listener/ShipmentLoadExcelExportListener2.java
View file @
f93069a0
This diff is collapsed.
Click to expand it.
yudao-module-shipment/yudao-module-shipment-core/src/main/java/cn/iocoder/yudao/module/shipment/utils/CustomLoadMergeStrategyNew.java
View file @
f93069a0
package
cn
.
iocoder
.
yudao
.
module
.
shipment
.
utils
;
import
cn.iocoder.yudao.module.shipment.dto.AirLoadDto
;
import
cn.iocoder.yudao.module.shipment.dto.LoadDto
;
import
com.alibaba.excel.metadata.CellData
;
import
com.alibaba.excel.metadata.Head
;
import
com.alibaba.excel.write.merge.AbstractMergeStrategy
;
import
org.apache.poi.ss.usermodel.Cell
;
import
org.apache.poi.ss.usermodel.Sheet
;
import
com.alibaba.excel.write.metadata.holder.WriteSheetHolder
;
import
com.alibaba.excel.write.metadata.holder.WriteTableHolder
;
import
org.apache.poi.ss.usermodel.*
;
import
org.apache.poi.ss.util.CellRangeAddress
;
import
org.springframework.util.CollectionUtils
;
...
...
@@ -41,14 +42,33 @@ public class CustomLoadMergeStrategyNew extends AbstractMergeStrategy {
// 需要开始合并单元格的首行index
private
Integer
rowIndex
;
private
List
<
Integer
>
colorRowList
;
private
Map
<
String
,
Integer
>
colorMap
;
// exportDataList为待合并目标列的值 partMerge为另外一种合并方式计算好的合并行数,mergeType 合并类型 1为订单维度合并 2为入仓记录维度的合并
public
CustomLoadMergeStrategyNew
(
List
<
LoadDto
>
exportDataList
,
List
<
Integer
>
partMergeList
,
Integer
targetColumnIndex
,
int
mergeType
)
{
public
CustomLoadMergeStrategyNew
(
List
<
LoadDto
>
exportDataList
,
List
<
Integer
>
partMergeList
,
Integer
targetColumnIndex
,
int
mergeType
,
List
<
Integer
>
colorRowList
,
Map
<
String
,
Integer
>
colorMap
)
{
this
.
exportFieldGroupCountList
=
getGroupCountList
(
exportDataList
,
targetColumnIndex
);
this
.
partMergeList
=
partMergeList
;
this
.
mergeType
=
mergeType
;
this
.
targetColumnIndex
=
targetColumnIndex
;
this
.
colorRowList
=
colorRowList
;
this
.
colorMap
=
colorMap
;
}
@Override
public
void
afterCellDispose
(
WriteSheetHolder
writeSheetHolder
,
WriteTableHolder
writeTableHolder
,
List
<
CellData
>
cellDataList
,
Cell
cell
,
Head
head
,
Integer
relativeRowIndex
,
Boolean
isHead
)
{
Workbook
workbook
=
writeSheetHolder
.
getSheet
().
getWorkbook
();
if
(
colorRowList
.
contains
(
cell
.
getRowIndex
())
&&
cell
.
getColumnIndex
()
==
targetColumnIndex
)
{
CellStyle
cellStyle
=
workbook
.
createCellStyle
();
cellStyle
.
setFillForegroundColor
(
IndexedColors
.
fromInt
(
colorMap
.
get
(
String
.
valueOf
(
cell
.
getRowIndex
()))).
index
);
cellStyle
.
setFillPattern
(
FillPatternType
.
SOLID_FOREGROUND
);
cell
.
setCellStyle
(
cellStyle
);
}
if
(!
isHead
)
{
this
.
merge
(
writeSheetHolder
.
getSheet
(),
cell
,
head
,
relativeRowIndex
);
}
}
@Override
protected
void
merge
(
Sheet
sheet
,
Cell
cell
,
Head
head
,
Integer
relativeRowIndex
)
{
...
...
@@ -56,6 +76,7 @@ public class CustomLoadMergeStrategyNew extends AbstractMergeStrategy {
if
(
null
==
rowIndex
)
{
rowIndex
=
cell
.
getRowIndex
();
}
// 仅从首行以及目标列的单元格开始合并,忽略其他
if
(
cell
.
getRowIndex
()
==
rowIndex
&&
cell
.
getColumnIndex
()
==
targetColumnIndex
)
{
if
(
mergeType
==
1
)
{
...
...
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