Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
D
device-back
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
1
议题
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
Matrix
device-back
Commits
71bfa9d9
提交
71bfa9d9
authored
5月 06, 2021
作者:
133
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[exl] 提交新的代码
上级
a385e05b
隐藏空白字符变更
内嵌
并排
正在显示
7 个修改的文件
包含
153 行增加
和
22 行删除
+153
-22
ExeclController.java
...com/tykj/dev/device/excel/controller/ExeclController.java
+55
-18
DeviceExcel.java
...in/java/com/tykj/dev/device/excel/entity/DeviceExcel.java
+82
-0
TrainExcel.java
...ain/java/com/tykj/dev/device/excel/entity/TrainExcel.java
+0
-2
TrainUserExcel.java
...java/com/tykj/dev/device/excel/entity/TrainUserExcel.java
+10
-1
Confirm.java
...rc/main/java/com/tykj/dev/device/file/entity/Confirm.java
+1
-0
DocumentDevice.java
.../java/com/tykj/dev/device/file/entity/DocumentDevice.java
+3
-0
PdfServiceImpl.java
...com/tykj/dev/device/file/service/Impl/PdfServiceImpl.java
+2
-1
没有找到文件。
dev-excel/src/main/java/com/tykj/dev/device/excel/controller/ExeclController.java
浏览文件 @
71bfa9d9
package
com
.
tykj
.
dev
.
device
.
excel
.
controller
;
package
com
.
tykj
.
dev
.
device
.
excel
.
controller
;
import
cn.afterturn.easypoi.excel.ExcelExportUtil
;
import
cn.afterturn.easypoi.excel.ExcelExportUtil
;
import
cn.afterturn.easypoi.excel.ExcelImportUtil
;
import
cn.afterturn.easypoi.excel.entity.ExportParams
;
import
cn.afterturn.easypoi.excel.entity.ExportParams
;
import
cn.afterturn.easypoi.excel.entity.ImportParams
;
import
cn.afterturn.easypoi.excel.entity.enmus.ExcelType
;
import
cn.afterturn.easypoi.excel.entity.enmus.ExcelType
;
import
cn.afterturn.easypoi.excel.entity.result.ExcelImportResult
;
import
com.tykj.dev.config.swagger.AutoDocument
;
import
com.tykj.dev.config.swagger.AutoDocument
;
import
com.tykj.dev.device.excel.entity.DeviceExcel
;
import
com.tykj.dev.device.excel.entity.TrainExcel
;
import
com.tykj.dev.device.excel.entity.TrainExcel
;
import
com.tykj.dev.device.excel.entity.TrainUserExcel
;
import
com.tykj.dev.device.excel.entity.TrainUserExcel
;
import
com.tykj.dev.device.excel.utils.ExcelStyleUtil
;
import
com.tykj.dev.device.excel.utils.ExcelStyleUtil
;
...
@@ -11,13 +15,17 @@ import com.tykj.dev.device.excel.utils.ExcelUtil;
...
@@ -11,13 +15,17 @@ import com.tykj.dev.device.excel.utils.ExcelUtil;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
import
org.apache.poi.ss.formula.functions.T
;
import
org.apache.poi.ss.formula.functions.T
;
import
org.apache.poi.ss.usermodel.Row
;
import
org.apache.poi.ss.usermodel.Sheet
;
import
org.apache.poi.ss.usermodel.Workbook
;
import
org.apache.poi.ss.usermodel.Workbook
;
import
org.
springframework.beans.factory.annotation.Autowired
;
import
org.
apache.poi.ss.usermodel.WorkbookFactory
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.multipart.MultipartFile
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.IOException
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.List
;
...
@@ -37,29 +45,58 @@ public class ExeclController {
...
@@ -37,29 +45,58 @@ public class ExeclController {
@GetMapping
(
value
=
"/test"
)
@GetMapping
(
value
=
"/test"
)
@ApiOperation
(
value
=
"下载培训excel"
,
notes
=
"下载培训excel"
)
@ApiOperation
(
value
=
"下载培训excel"
,
notes
=
"下载培训excel"
)
public
ResponseEntity
saveDeviceDestroyBill
(
HttpServletRequest
request
,
HttpServletResponse
response
){
public
ResponseEntity
saveDeviceDestroyBill
(
HttpServletRequest
request
,
HttpServletResponse
response
){
TrainExcel
tableInfoVo
=
new
TrainExcel
();
tableInfoVo
.
setName
(
"xxx培训"
);
List
<
TrainUserExcel
>
tableInfoVos
=
new
ArrayList
<>();
List
<
DeviceExcel
>
excelList
=
new
ArrayList
<>();
for
(
int
i
=
0
;
i
<
6
;
i
++){
for
(
int
i
=
0
;
i
<
6
;
i
++){
TrainUserExcel
trainUserExcel
=
new
TrainUserExcel
();
DeviceExcel
deviceExcel
=
new
DeviceExcel
();
trainUserExcel
.
setIdCard
(
"123123123131"
);
deviceExcel
.
setId
(
i
);
trainUserExcel
.
setMobel
(
"15171636570"
);
deviceExcel
.
setLifeStatus
(
1
);
trainUserExcel
.
setName
(
"占金明"
);
deviceExcel
.
setModel
(
"1"
);
trainUserExcel
.
setSex
(
"男"
);
excelList
.
add
(
deviceExcel
);
trainUserExcel
.
setNumber
(
i
);
tableInfoVos
.
add
(
trainUserExcel
);
}
}
tableInfoVo
.
setTrainUserExcels
(
tableInfoVos
);
List
<
TrainExcel
>
list
=
new
ArrayList
<>();
ExportParams
exportParams
=
new
ExportParams
(
"xxx"
,
"xxx"
,
ExcelType
.
XSSF
);
list
.
add
(
tableInfoVo
);
ExportParams
exportParams
=
new
ExportParams
(
tableInfoVo
.
getName
(),
tableInfoVo
.
getName
(),
ExcelType
.
XSSF
);
exportParams
.
setSecondTitle
(
tableInfoVo
.
getName
());
exportParams
.
setStyle
(
ExcelStyleUtil
.
class
);
exportParams
.
setStyle
(
ExcelStyleUtil
.
class
);
Workbook
workbook
=
ExcelExportUtil
.
exportExcel
(
exportParams
,
TrainExcel
.
class
,
list
);
Workbook
workbook
=
ExcelExportUtil
.
exportExcel
(
exportParams
,
DeviceExcel
.
class
,
excelList
);
ExcelUtil
.
downloadExcel
(
request
,
response
,
workbook
,
tableInfoVo
.
getName
());
ExcelUtil
.
downloadExcel
(
request
,
response
,
workbook
,
"xxx"
);
// List<TrainUserExcel> tableInfoVos = new ArrayList<>();
// for (int i=0;i<6;i++){
// TrainUserExcel trainUserExcel=new TrainUserExcel();
// trainUserExcel.setIdCard("123123123131");
// trainUserExcel.setMobel("15171636570");
// trainUserExcel.setName("占金明");
// trainUserExcel.setSex("男");
// trainUserExcel.setNumber(i);
// tableInfoVos.add(trainUserExcel);
// }
// ExportParams exportParams = new ExportParams("xxx","xxx", ExcelType.XSSF);
// exportParams.setStyle(ExcelStyleUtil.class);
// Workbook workbook = ExcelExportUtil.exportExcel(exportParams, TrainUserExcel.class, tableInfoVos);
// ExcelUtil.downloadExcel(request, response, workbook, "xxx");
return
ResponseEntity
.
ok
(
"ok"
);
return
ResponseEntity
.
ok
(
"ok"
);
}
}
@PostMapping
(
value
=
"/test1"
)
@ApiOperation
(
value
=
"下载培训excel"
,
notes
=
"下载培训excel"
)
public
ResponseEntity
importExcel
(
MultipartFile
file
)
throws
Exception
{
ImportParams
params
=
new
ImportParams
();
params
.
setTitleRows
(
1
);
params
.
setHeadRows
(
1
);
// 开启Excel校验
// params.setNeedVerfiy(true);
// params.setVerifyHandler(excelVerifyHandle);
Workbook
workbook
=
WorkbookFactory
.
create
(
file
.
getInputStream
());
Sheet
sheet
=
workbook
.
getSheet
(
workbook
.
getSheetName
(
0
));
//获取第一行
// Row titlerow = sheet.getRow(0);
// String tableName = titlerow.getCell(0).getStringCellValue();
ExcelImportResult
<
DeviceExcel
>
result
=
ExcelImportUtil
.
importExcelMore
(
file
.
getInputStream
(),
DeviceExcel
.
class
,
params
);
List
<
DeviceExcel
>
deviceExcels
=
result
.
getList
();
return
ResponseEntity
.
ok
(
deviceExcels
.
size
());
}
}
}
dev-excel/src/main/java/com/tykj/dev/device/excel/entity/DeviceExcel.java
0 → 100644
浏览文件 @
71bfa9d9
package
com
.
tykj
.
dev
.
device
.
excel
.
entity
;
import
cn.afterturn.easypoi.excel.annotation.Excel
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
org.hibernate.annotations.SQLDelete
;
import
org.hibernate.annotations.Where
;
import
org.springframework.data.jpa.domain.support.AuditingEntityListener
;
import
javax.persistence.*
;
/**
* entity class for device_library
* 装备库
*/
@Data
@ApiModel
(
"装备库"
)
@AllArgsConstructor
@NoArgsConstructor
public
class
DeviceExcel
{
/**
* 主键id
*/
@Id
@Excel
(
name
=
"id"
,
orderNum
=
"1"
,
width
=
30
,
needMerge
=
true
)
private
Integer
id
;
/**
* 型号
*/
@ApiModelProperty
(
value
=
"型号"
)
@Excel
(
name
=
"型号"
,
orderNum
=
"1"
,
width
=
30
,
needMerge
=
true
)
private
String
model
;
/**
* 密级
*/
@ApiModelProperty
(
value
=
"密级"
)
@Excel
(
name
=
"密级"
,
orderNum
=
"1"
,
width
=
30
,
needMerge
=
true
)
private
Integer
secretLevel
;
/**
* 装备名称
*/
@ApiModelProperty
(
value
=
"装备名称"
)
@Excel
(
name
=
"装备名称"
,
orderNum
=
"1"
,
width
=
30
,
needMerge
=
true
)
private
String
name
;
/**
* 装备序列号
*/
@ApiModelProperty
(
value
=
"装备序列号"
)
@Excel
(
name
=
"装备序列号"
,
orderNum
=
"1"
,
width
=
30
,
needMerge
=
true
)
private
String
seqNumber
;
/**
* rfid表面号
*/
@ApiModelProperty
(
value
=
"rfid表面号"
)
@Excel
(
name
=
"rfid表面号"
,
orderNum
=
"1"
,
width
=
30
,
needMerge
=
true
)
private
String
rfidSurfaceId
;
/**
* 类型
*/
@ApiModelProperty
(
value
=
"类型"
)
@Excel
(
name
=
"类型"
,
orderNum
=
"1"
,
width
=
30
,
needMerge
=
true
)
private
Integer
type
;
/**
* 生命状态,0-入库待审核,1-入库审核失败,2-在库,3-配发,4-维修,5,维修失败,6-退回,7-待退装,8-退装,9-待销毁,10-已销毁,11-丢失 12.清退
*/
@ApiModelProperty
(
value
=
"生命状态,0-入库待审核,1-入库审核失败,2-在库,3-配发,4-维修,5,维修失败,6-退回,7-待退装,8-退装,9-待销毁,10-已销毁,11-丢失"
)
@Excel
(
name
=
"生命状态"
,
orderNum
=
"1"
,
width
=
30
,
needMerge
=
true
)
private
Integer
lifeStatus
;
}
dev-excel/src/main/java/com/tykj/dev/device/excel/entity/TrainExcel.java
浏览文件 @
71bfa9d9
...
@@ -19,8 +19,6 @@ import java.util.List;
...
@@ -19,8 +19,6 @@ import java.util.List;
@AllArgsConstructor
@AllArgsConstructor
@NoArgsConstructor
@NoArgsConstructor
public
class
TrainExcel
{
public
class
TrainExcel
{
@Excel
(
name
=
"培训标题"
,
orderNum
=
"1"
,
width
=
30
,
needMerge
=
true
)
private
String
name
;
@ExcelCollection
(
name
=
"参加培训用户信息"
,
orderNum
=
"2"
)
@ExcelCollection
(
name
=
"参加培训用户信息"
,
orderNum
=
"2"
)
private
List
<
TrainUserExcel
>
trainUserExcels
;
private
List
<
TrainUserExcel
>
trainUserExcels
;
...
...
dev-excel/src/main/java/com/tykj/dev/device/excel/entity/TrainUserExcel.java
浏览文件 @
71bfa9d9
...
@@ -9,13 +9,14 @@ import lombok.NoArgsConstructor;
...
@@ -9,13 +9,14 @@ import lombok.NoArgsConstructor;
* @author zjm
* @author zjm
* @version 1.0.0
* @version 1.0.0
* @ClassName TrainExcel.java
* @ClassName TrainExcel.java
* @Description
TODO
* @Description
excel导出实体类
* @createTime 2021年04月29日 15:22:00
* @createTime 2021年04月29日 15:22:00
*/
*/
@Data
@Data
@AllArgsConstructor
@AllArgsConstructor
@NoArgsConstructor
@NoArgsConstructor
public
class
TrainUserExcel
{
public
class
TrainUserExcel
{
@Excel
(
name
=
"序号"
,
orderNum
=
"1"
,
width
=
30
,
needMerge
=
true
)
@Excel
(
name
=
"序号"
,
orderNum
=
"1"
,
width
=
30
,
needMerge
=
true
)
private
Integer
number
;
private
Integer
number
;
...
@@ -33,4 +34,12 @@ public class TrainUserExcel {
...
@@ -33,4 +34,12 @@ public class TrainUserExcel {
@Excel
(
name
=
"身份证"
,
orderNum
=
"6"
,
width
=
30
,
needMerge
=
true
)
@Excel
(
name
=
"身份证"
,
orderNum
=
"6"
,
width
=
30
,
needMerge
=
true
)
private
String
idCard
;
private
String
idCard
;
@Excel
(
name
=
"房间号"
,
orderNum
=
"6"
,
width
=
30
,
needMerge
=
true
)
private
String
roomCode
;
@Excel
(
name
=
"备注"
,
orderNum
=
"6"
,
width
=
30
,
needMerge
=
true
)
private
String
des
;
}
}
dev-file/src/main/java/com/tykj/dev/device/file/entity/Confirm.java
浏览文件 @
71bfa9d9
...
@@ -18,6 +18,7 @@ import java.util.List;
...
@@ -18,6 +18,7 @@ import java.util.List;
@NoArgsConstructor
@NoArgsConstructor
@Data
@Data
public
class
Confirm
{
public
class
Confirm
{
@ApiModelProperty
(
name
=
"抬头"
)
@ApiModelProperty
(
name
=
"抬头"
)
private
String
title
;
private
String
title
;
...
...
dev-file/src/main/java/com/tykj/dev/device/file/entity/DocumentDevice.java
浏览文件 @
71bfa9d9
...
@@ -49,6 +49,9 @@ public class DocumentDevice {
...
@@ -49,6 +49,9 @@ public class DocumentDevice {
@ApiModelProperty
(
value
=
"备注"
)
@ApiModelProperty
(
value
=
"备注"
)
private
String
remark
;
private
String
remark
;
@ApiModelProperty
(
value
=
"校对"
)
private
String
proofreading
;
public
Integer
getLen
(){
public
Integer
getLen
(){
return
deviceSerialNumber
.
length
();
return
deviceSerialNumber
.
length
();
}
}
...
...
dev-file/src/main/java/com/tykj/dev/device/file/service/Impl/PdfServiceImpl.java
浏览文件 @
71bfa9d9
...
@@ -37,6 +37,7 @@ public class PdfServiceImpl implements PdfService {
...
@@ -37,6 +37,7 @@ public class PdfServiceImpl implements PdfService {
}
}
private
DocumentDevice
toDocDev
(
ScriptSaveVo
scriptSaveVo
){
private
DocumentDevice
toDocDev
(
ScriptSaveVo
scriptSaveVo
){
return
new
DocumentDevice
(
null
,
scriptSaveVo
.
getModel
(),
null
,
scriptSaveVo
.
getType
(),
scriptSaveVo
.
getSecretLevel
(),
scriptSaveVo
.
getInvisibleRange
(),
scriptSaveVo
.
getNum
(),
scriptSaveVo
.
getSeqNumber
(),
null
,
scriptSaveVo
.
getRemark
());
return
new
DocumentDevice
(
null
,
scriptSaveVo
.
getModel
(),
null
,
scriptSaveVo
.
getType
(),
scriptSaveVo
.
getSecretLevel
(),
scriptSaveVo
.
getInvisibleRange
(),
scriptSaveVo
.
getNum
(),
scriptSaveVo
.
getSeqNumber
(),
null
,
scriptSaveVo
.
getRemark
()
,
null
);
}
}
}
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论