Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
amos-boot-biz
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
项目统一框架
amos-boot-biz
Commits
4cdd66c8
Commit
4cdd66c8
authored
Jul 30, 2022
by
任刚
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加部件信息导出功能
parent
7b23c939
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
389 additions
and
590 deletions
+389
-590
DetailssDTO.java
...om/yeejoin/equipmanage/common/entity/dto/DetailssDTO.java
+0
-85
DetailssAmountVO.java
...eejoin/equipmanage/common/entity/vo/DetailssAmountVO.java
+3
-15
EquipmentPar.java
.../java/com/yeejoin/equipmanage/common/vo/EquipmentPar.java
+0
-23
EquipmentController.java
...m/yeejoin/equipmanage/controller/EquipmentController.java
+0
-17
EquipmentDetailController.java
...oin/equipmanage/controller/EquipmentDetailController.java
+4
-51
EquipmentDetailMapper.java
...com/yeejoin/equipmanage/mapper/EquipmentDetailMapper.java
+2
-2
IEquipmentDetailService.java
.../yeejoin/equipmanage/service/IEquipmentDetailService.java
+0
-3
EquipmentDetailServiceImpl.java
.../equipmanage/service/impl/EquipmentDetailServiceImpl.java
+0
-9
pom.xml
...ule/amos-boot-module-biz/amos-boot-module-jcs-biz/pom.xml
+1
-2
pom.xml
...boot-module-biz/amos-boot-module-latentdanger-biz/pom.xml
+3
-3
FileHelper.java
...m/yeejoin/amos/latentdanger/business/util/FileHelper.java
+355
-355
EquipmentDetailMapper.xml
...equip/src/main/resources/mapper/EquipmentDetailMapper.xml
+20
-23
FireFightingSystemMapper.xml
...ip/src/main/resources/mapper/FireFightingSystemMapper.xml
+1
-2
No files found.
amos-boot-module/amos-boot-module-api/amos-boot-module-equip-api/src/main/java/com/yeejoin/equipmanage/common/entity/dto/DetailssDTO.java
View file @
4cdd66c8
...
@@ -74,89 +74,4 @@ public class DetailssDTO extends BaseDTO<EquipmentDetail> {
...
@@ -74,89 +74,4 @@ public class DetailssDTO extends BaseDTO<EquipmentDetail> {
@ApiModelProperty
(
value
=
"判断是否导出全部"
)
@ApiModelProperty
(
value
=
"判断是否导出全部"
)
private
Integer
prop
;
private
Integer
prop
;
// @Excel(name = "id",orderNum ="0")
// @ApiModelProperty(value = "id")
// private Long id;
//
// @Excel(name = "部件名称",orderNum ="1")
// @TableField("name")
// @ApiModelProperty(value = "部件名称")
// private String name;
//
// @Excel(name = "部件编码",orderNum ="2")
// @TableField("eq_code")
// @ApiModelProperty(value = "部件编码")
// private String eqcode;
//
// @Excel(name = "部件型号",orderNum ="3")
// @TableField("standard")
// @ApiModelProperty(value = "部件型号")
// private String standard;
//
// @Excel(name = "存放位置",orderNum ="4")
// @TableField("area")
// @ApiModelProperty(value = "存放位置")
// private String area;
//
// @Excel(name = "生产厂家",orderNum ="5")
// @TableField("brand")
// @ApiModelProperty(value = "生产厂家")
// private String brand;
//
// @Excel(name = "出厂时间",orderNum ="6")
// @JsonFormat(pattern = "yyyy-MM-dd")
// @TableField("open_date")
// @ApiModelProperty(value = "出厂时间")
// private Date openDate;
//
// @Excel(name = "工作时间",orderNum ="7")
// @TableField("maintenance_cycle")
// @ApiModelProperty(value = "工作时间")
// private BigDecimal maintenanceCycle;
//
//
// @Excel(name = "所属单位",orderNum ="8")
// @TableField("remark")
// @ApiModelProperty(value = "所属单位")
// private String remark;
//
// @Excel(name = "入库时间",orderNum ="9")
// @JsonFormat(pattern = "yyyy-MM-dd")
// @TableField("join_date")
// @ApiModelProperty(value = "入库时间")
// private Date joinDate;
//
// @ApiModelProperty(value = "装备类型")
// private String type;
//
// @Excel(name = "物联编码",orderNum ="10")
// @ApiModelProperty(value = "物联编码")
// private String iotCode;
//
// @TableField("status")
// @ApiModelProperty(value="状态")
// @Excel(name = "状态",orderNum = "11")
// private String status;
//
// @TableField("reason")
// @ApiModelProperty(value = "原因分析")
// @Excel(name = "原因分析",orderNum = "12")
// private String reason;
//
// @TableField("measure")
// @ApiModelProperty(value = "处置措施")
// @Excel(name = "处置措施",orderNum = "13")
// private String measure;
//
// @Excel(name = "装备定义id",orderNum ="14")
// @TableField("equipment_id")
// @ApiModelProperty(value = "装备定义id")
// private Long equipmentId;
//
//
// @Excel(name = "装备定义名称",orderNum ="15")
// @TableField("equipment_name")
// @ApiModelProperty(value = "装备定义名称")
// private String equipmentName;
}
}
amos-boot-module/amos-boot-module-api/amos-boot-module-equip-api/src/main/java/com/yeejoin/equipmanage/common/entity/vo/DetailssAmountVO.java
View file @
4cdd66c8
...
@@ -17,55 +17,46 @@ import java.util.Date;
...
@@ -17,55 +17,46 @@ import java.util.Date;
@Data
@Data
public
class
DetailssAmountVO
{
public
class
DetailssAmountVO
{
@Excel
(
name
=
"id"
,
orderNum
=
"0"
)
@ApiModelProperty
(
value
=
"id"
)
@ApiModelProperty
(
value
=
"id"
)
private
Long
id
;
private
Long
id
;
@Excel
(
name
=
"部件名称"
,
orderNum
=
"1"
)
@Excel
(
name
=
"部件名称"
,
orderNum
=
"1"
)
@TableField
(
"name"
)
@ApiModelProperty
(
value
=
"部件名称"
)
@ApiModelProperty
(
value
=
"部件名称"
)
private
String
name
;
private
String
name
;
@Excel
(
name
=
"部件编码"
,
orderNum
=
"2"
)
@Excel
(
name
=
"部件编码"
,
orderNum
=
"2"
)
@TableField
(
"eq_code"
)
@ApiModelProperty
(
value
=
"部件编码"
)
@ApiModelProperty
(
value
=
"部件编码"
)
private
String
eqcode
;
private
String
eqcode
;
@Excel
(
name
=
"部件型号"
,
orderNum
=
"3"
)
@Excel
(
name
=
"部件型号"
,
orderNum
=
"3"
)
@TableField
(
"standard"
)
@ApiModelProperty
(
value
=
"部件型号"
)
@ApiModelProperty
(
value
=
"部件型号"
)
private
String
standard
;
private
String
standard
;
@Excel
(
name
=
"存放位置"
,
orderNum
=
"4"
)
@Excel
(
name
=
"存放位置"
,
orderNum
=
"4"
)
@TableField
(
"area"
)
@ApiModelProperty
(
value
=
"存放位置"
)
@ApiModelProperty
(
value
=
"存放位置"
)
private
String
area
;
private
String
area
;
@Excel
(
name
=
"生产厂家"
,
orderNum
=
"5"
)
@Excel
(
name
=
"生产厂家"
,
orderNum
=
"5"
)
@TableField
(
"brand"
)
@ApiModelProperty
(
value
=
"生产厂家"
)
@ApiModelProperty
(
value
=
"生产厂家"
)
private
String
brand
;
private
String
brand
;
@Excel
(
name
=
"出厂时间"
,
orderNum
=
"6"
)
@Excel
(
name
=
"出厂时间"
,
orderNum
=
"6"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd"
)
@TableField
(
"open_date"
)
@ApiModelProperty
(
value
=
"出厂时间"
)
@ApiModelProperty
(
value
=
"出厂时间"
)
private
Date
openDate
;
private
Date
openDate
;
@Excel
(
name
=
"工作时间"
,
orderNum
=
"7"
)
@Excel
(
name
=
"工作时间"
,
orderNum
=
"7"
)
@TableField
(
"maintenance_cycle"
)
@ApiModelProperty
(
value
=
"工作时间"
)
@ApiModelProperty
(
value
=
"工作时间"
)
private
BigDecimal
maintenanceCycle
;
private
BigDecimal
maintenanceCycle
;
@Excel
(
name
=
"所属单位"
,
orderNum
=
"8"
)
@Excel
(
name
=
"所属单位"
,
orderNum
=
"8"
)
@TableField
(
"remark"
)
@ApiModelProperty
(
value
=
"所属单位"
)
@ApiModelProperty
(
value
=
"所属单位"
)
private
String
remark
;
private
String
remark
;
@Excel
(
name
=
"入库时间"
,
orderNum
=
"9"
)
@Excel
(
name
=
"入库时间"
,
orderNum
=
"9"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd"
)
@TableField
(
"join_date"
)
@ApiModelProperty
(
value
=
"入库时间"
)
@ApiModelProperty
(
value
=
"入库时间"
)
private
Date
joinDate
;
private
Date
joinDate
;
...
@@ -76,29 +67,26 @@ public class DetailssAmountVO {
...
@@ -76,29 +67,26 @@ public class DetailssAmountVO {
@ApiModelProperty
(
value
=
"物联编码"
)
@ApiModelProperty
(
value
=
"物联编码"
)
private
String
iotCode
;
private
String
iotCode
;
@TableField
(
"status"
)
@ApiModelProperty
(
value
=
"状态"
)
@ApiModelProperty
(
value
=
"状态"
)
@Excel
(
name
=
"状态"
,
orderNum
=
"11"
)
@Excel
(
name
=
"状态"
,
orderNum
=
"11"
)
private
String
status
;
private
String
status
;
@TableField
(
"reason"
)
@ApiModelProperty
(
value
=
"原因分析"
)
@ApiModelProperty
(
value
=
"原因分析"
)
@Excel
(
name
=
"原因分析"
,
orderNum
=
"12"
)
@Excel
(
name
=
"原因分析"
,
orderNum
=
"12"
)
private
String
reason
;
private
String
reason
;
@TableField
(
"measure"
)
@ApiModelProperty
(
value
=
"处置措施"
)
@ApiModelProperty
(
value
=
"处置措施"
)
@Excel
(
name
=
"处置措施"
,
orderNum
=
"13"
)
@Excel
(
name
=
"处置措施"
,
orderNum
=
"13"
)
private
String
measure
;
private
String
measure
;
@Excel
(
name
=
"装备定义id"
,
orderNum
=
"14"
)
@Excel
(
name
=
"装备定义id"
,
orderNum
=
"14"
)
@TableField
(
"equipment_id"
)
@ApiModelProperty
(
value
=
"装备定义id"
)
@ApiModelProperty
(
value
=
"装备定义id"
)
private
Long
equipmentId
;
private
Long
equipmentId
;
@Excel
(
name
=
"装备定义名称"
,
orderNum
=
"15"
)
@Excel
(
name
=
"装备定义名称"
,
orderNum
=
"15"
)
@TableField
(
"equipment_name"
)
@ApiModelProperty
(
value
=
"装备定义名称"
)
@ApiModelProperty
(
value
=
"装备定义名称"
)
private
String
equipmentName
;
private
String
equipmentName
;
...
...
amos-boot-module/amos-boot-module-api/amos-boot-module-equip-api/src/main/java/com/yeejoin/equipmanage/common/vo/EquipmentPar.java
deleted
100644 → 0
View file @
7b23c939
/**
* @Time: 2022/7/20 17:41
* @Author: 任刚
* @File:EquipmentPar.class
*/
package
com
.
yeejoin
.
equipmanage
.
common
.
vo
;
import
cn.afterturn.easypoi.excel.annotation.ExcelEntity
;
import
com.yeejoin.equipmanage.common.entity.Equipment
;
import
com.yeejoin.equipmanage.common.entity.EquipmentDetail
;
import
com.yeejoin.equipmanage.common.entity.EquipmentParams
;
import
com.yeejoin.equipmanage.common.entity.EquipmentSpecific
;
import
lombok.Data
;
@Data
public
class
EquipmentPar
{
@ExcelEntity
private
EquipmentDetail
equipmentDetail
;
@ExcelEntity
private
EquipmentParams
equipmentParams
;
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/controller/EquipmentController.java
View file @
4cdd66c8
...
@@ -704,22 +704,5 @@ public class EquipmentController extends AbstractBaseController {
...
@@ -704,22 +704,5 @@ public class EquipmentController extends AbstractBaseController {
return
iEquipmentService
.
getAll
();
return
iEquipmentService
.
getAll
();
}
}
/**
* 导出隐患清单
*/
// @ApiOperation(value = "导出装备清单", notes = "导出装备清单")
// @PostMapping(value = "/export")
// @TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
// public void exportDangerList(@ApiParam(value = "导出装备的数据") @RequestBody(required = false) List<EquipmentPar> equipmentPars,
// @ApiParam(value = "是否全部导出" ) @RequestParam boolean type,
// HttpServletResponse response) {
// String fileName = "装备清单" + new Date().getTime();
// if(type==true){//全部导出
// List<EquipmentPar> equpar = equipmentDetailMapper.equpar();
// FileHelper.exportExcel(equpar, "装备清单", "装备清单", EquipmentPar.class, fileName + ".xls", response);
// }else {//仅仅导出筛选结果的数据
// FileHelper.exportExcel(equipmentPars, "装备清单", "装备清单", Equipment.class, fileName + ".xls", response);
// }
// }
}
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/controller/EquipmentDetailController.java
View file @
4cdd66c8
...
@@ -4,27 +4,20 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
...
@@ -4,27 +4,20 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.github.pagehelper.page.PageParams
;
import
com.mchange.lang.LongUtils
;
import
com.yeejoin.equipmanage.common.entity.*
;
import
com.yeejoin.equipmanage.common.entity.*
;
import
com.yeejoin.equipmanage.common.entity.dto.DetailssDTO
;
import
com.yeejoin.equipmanage.common.entity.dto.TopographyNodeDetailDTO
;
import
com.yeejoin.equipmanage.common.entity.vo.DetailssAmountVO
;
import
com.yeejoin.equipmanage.common.entity.vo.DetailssAmountVO
;
import
com.yeejoin.equipmanage.common.entity.vo.EquipmentDetailDownloadVO
;
import
com.yeejoin.equipmanage.common.entity.vo.EquipmentDetailDownloadVO
;
import
com.yeejoin.equipmanage.common.enums.ExcelEnums
;
import
com.yeejoin.equipmanage.common.enums.ExcelEnums
;
import
com.yeejoin.equipmanage.common.utils.*
;
import
com.yeejoin.equipmanage.common.utils.*
;
import
com.yeejoin.equipmanage.common.vo.EquipmentDate
;
import
com.yeejoin.equipmanage.common.vo.EquipmentDate
;
import
com.yeejoin.equipmanage.common.vo.EquipmentPar
;
import
com.yeejoin.equipmanage.dto.ExcelDto
;
import
com.yeejoin.equipmanage.dto.ExcelDto
;
import
com.yeejoin.equipmanage.fegin.JcsFeign
;
import
com.yeejoin.equipmanage.fegin.JcsFeign
;
import
com.yeejoin.equipmanage.mapper.*
;
import
com.yeejoin.equipmanage.mapper.*
;
import
com.yeejoin.equipmanage.service.*
;
import
com.yeejoin.equipmanage.service.*
;
import
com.yeejoin.equipmanage.service.impl.TopographyNodeDetailService
;
import
com.yeejoin.equipmanage.utils.ExcelUtil
;
import
com.yeejoin.equipmanage.utils.ExcelUtil
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiParam
;
import
io.swagger.annotations.ApiParam
;
import
net.bytebuddy.asm.Advice
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.beans.factory.annotation.Value
;
...
@@ -41,7 +34,6 @@ import org.typroject.tyboot.core.restful.utils.ResponseModel;
...
@@ -41,7 +34,6 @@ import org.typroject.tyboot.core.restful.utils.ResponseModel;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
javax.servlet.http.HttpServletResponse
;
import
java.text.DateFormat
;
import
java.text.SimpleDateFormat
;
import
java.text.SimpleDateFormat
;
import
java.util.*
;
import
java.util.*
;
...
@@ -128,14 +120,6 @@ public class EquipmentDetailController extends AbstractBaseController {
...
@@ -128,14 +120,6 @@ public class EquipmentDetailController extends AbstractBaseController {
public
EquipmentDate
saveEquipmentDetail
(
@RequestBody
EquipmentDate
equipmentDate
)
{
public
EquipmentDate
saveEquipmentDetail
(
@RequestBody
EquipmentDate
equipmentDate
)
{
EquipmentSpecific
vo
=
equipmentDate
.
getEquipmentSpecific
();
EquipmentSpecific
vo
=
equipmentDate
.
getEquipmentSpecific
();
// String sysCode = vo.getCode();
//
// if (StringUtils.isNotEmpty(sysCode) && StringUtils.isNotEmpty(sysCode.trim())){
// int code = equipmentSpecificSerivce.count(new QueryWrapper<EquipmentSpecific>().eq("code", sysCode.trim()));
// if (code != 0 ) {
// throw new BadRequest("设备编码填写重复,请重新输入!");
// }
// }
EquipmentDetail
de
=
equipmentDate
.
getEquipmentDetail
();
EquipmentDetail
de
=
equipmentDate
.
getEquipmentDetail
();
String
eqcode
=
de
.
getEqcode
();
String
eqcode
=
de
.
getEqcode
();
...
@@ -166,31 +150,6 @@ public class EquipmentDetailController extends AbstractBaseController {
...
@@ -166,31 +150,6 @@ public class EquipmentDetailController extends AbstractBaseController {
return
equipmentDate
;
return
equipmentDate
;
}
}
@RequestMapping
(
value
=
"/saveEqu"
,
method
=
RequestMethod
.
POST
)
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"新增"
,
notes
=
"新增"
)
public
EquipmentPar
saveEquipments
(
@RequestBody
EquipmentPar
equipmentPar
)
{
EquipmentDetail
vo
=
equipmentPar
.
getEquipmentDetail
();
EquipmentParams
params
=
equipmentPar
.
getEquipmentParams
();
String
sysCode
=
vo
.
getCode
();
if
(
StringUtils
.
isNotEmpty
(
sysCode
)
&&
StringUtils
.
isNotEmpty
(
sysCode
.
trim
())){
int
code
=
iEquipmentDetailService
.
count
(
new
QueryWrapper
<
EquipmentDetail
>().
eq
(
"code"
,
sysCode
.
trim
()));
if
(
code
!=
0
)
{
// throw new BadRequest("设备编码填写重复,请重新输入!");
equipmentPar
.
getEquipmentDetail
().
setEquipmentName
(
"设备编码填写重复,请重新输入!"
);
return
equipmentPar
;
}
}
params
.
setCode
(
equipmentPar
.
getEquipmentDetail
().
getCode
());
iEquipmentDetailService
.
saveOne
(
vo
);
iEquipmentParamsService
.
saveOne
(
params
);
return
equipmentPar
;
}
/***
/***
*
*
...
@@ -638,20 +597,14 @@ public class EquipmentDetailController extends AbstractBaseController {
...
@@ -638,20 +597,14 @@ public class EquipmentDetailController extends AbstractBaseController {
@ApiOperation
(
value
=
"导出装备清单"
,
notes
=
"导出装备清单"
)
@ApiOperation
(
value
=
"导出装备清单"
,
notes
=
"导出装备清单"
)
@PostMapping
(
value
=
"/export"
)
@PostMapping
(
value
=
"/export"
)
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
public
void
exportDangerList
(
@RequestBody
DetailssDTO
detailssDTO
,
HttpServletResponse
response
)
{
public
void
exportDangerList
(
@RequestBody
List
<
DetailssAmountVO
>
detailssAmountVO
,
@RequestParam
Integer
prop
,
HttpServletResponse
response
)
{
// DetailssDTO detailssDTO = new DetailssDTO();
// detailssDTO.setType("equipment");
String
fileName
=
"装备清单"
+
new
Date
().
getTime
();
String
fileName
=
"装备清单"
+
new
Date
().
getTime
();
if
(
detailssDTO
.
getProp
()
==
1
){
//全部导出
if
(
prop
==
1
){
//全部导出
List
<
DetailssAmountVO
>
getall
=
iEquipmentDetailService
.
getall
();
List
<
DetailssAmountVO
>
getall
=
iEquipmentDetailService
.
getall
();
// IPage<DetailssAmountVO> detailsssAmountList = fireFightingSystemService.getDetailsssAmountList(0, null, detailssDTO);
FileHelper
.
exportExcel
(
getall
,
"装备清单"
,
"装备清单"
,
DetailssAmountVO
.
class
,
fileName
+
".xls"
,
response
);
// List<DetailssAmountVO> records = detailsssAmountList.getRecords();
FileHelper
.
exportExcel
(
getall
,
"装备清单"
,
"装备清单"
,
EquipmentDate
.
class
,
fileName
+
".xls"
,
response
);
}
}
else
{
//仅仅导出筛选结果的数据
else
{
//仅仅导出筛选结果的数据
IPage
<
DetailssAmountVO
>
detailsssAmountList
=
fireFightingSystemService
.
getDetailsssAmountList
(
0
,
null
,
detailssDTO
);
FileHelper
.
exportExcel
(
detailssAmountVO
,
"装备清单"
,
"装备清单"
,
DetailssAmountVO
.
class
,
fileName
+
".xls"
,
response
);
List
<
DetailssAmountVO
>
records
=
detailsssAmountList
.
getRecords
();
FileHelper
.
exportExcel
(
records
,
"装备清单"
,
"装备清单"
,
EquipmentDate
.
class
,
fileName
+
".xls"
,
response
);
}
}
}
}
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/mapper/EquipmentDetailMapper.java
View file @
4cdd66c8
...
@@ -3,10 +3,8 @@ package com.yeejoin.equipmanage.mapper;
...
@@ -3,10 +3,8 @@ package com.yeejoin.equipmanage.mapper;
import
java.util.List
;
import
java.util.List
;
import
com.yeejoin.equipmanage.common.entity.EquProperty
;
import
com.yeejoin.equipmanage.common.entity.EquProperty
;
import
com.yeejoin.equipmanage.common.entity.dto.DetailssDTO
;
import
com.yeejoin.equipmanage.common.entity.vo.DetailssAmountVO
;
import
com.yeejoin.equipmanage.common.entity.vo.DetailssAmountVO
;
import
com.yeejoin.equipmanage.common.vo.EquipmentDate
;
import
com.yeejoin.equipmanage.common.vo.EquipmentDate
;
import
com.yeejoin.equipmanage.common.vo.EquipmentPar
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
import
org.apache.ibatis.annotations.Param
;
...
@@ -45,4 +43,6 @@ public interface EquipmentDetailMapper extends BaseMapper<EquipmentDetail> {
...
@@ -45,4 +43,6 @@ public interface EquipmentDetailMapper extends BaseMapper<EquipmentDetail> {
List
<
Long
>
getWareId
(
@Param
(
"id"
)
Long
id
);
List
<
Long
>
getWareId
(
@Param
(
"id"
)
Long
id
);
List
<
DetailssAmountVO
>
getall
();
List
<
DetailssAmountVO
>
getall
();
boolean
save
(
EquipmentDetail
equipmentDetail
);
}
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/service/IEquipmentDetailService.java
View file @
4cdd66c8
...
@@ -4,10 +4,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
...
@@ -4,10 +4,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.yeejoin.equipmanage.common.entity.EquProperty
;
import
com.yeejoin.equipmanage.common.entity.EquProperty
;
import
com.yeejoin.equipmanage.common.entity.EquipmentDetail
;
import
com.yeejoin.equipmanage.common.entity.EquipmentDetail
;
import
com.yeejoin.equipmanage.common.entity.dto.DetailssDTO
;
import
com.yeejoin.equipmanage.common.entity.vo.DetailssAmountVO
;
import
com.yeejoin.equipmanage.common.entity.vo.DetailssAmountVO
;
import
com.yeejoin.equipmanage.common.vo.EquipmentDate
;
import
com.yeejoin.equipmanage.common.vo.EquipmentPar
;
import
java.util.List
;
import
java.util.List
;
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/service/impl/EquipmentDetailServiceImpl.java
View file @
4cdd66c8
...
@@ -5,16 +5,12 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
...
@@ -5,16 +5,12 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.yeejoin.equipmanage.common.entity.*
;
import
com.yeejoin.equipmanage.common.entity.*
;
import
com.yeejoin.equipmanage.common.entity.dto.DetailssDTO
;
import
com.yeejoin.equipmanage.common.entity.vo.DetailssAmountVO
;
import
com.yeejoin.equipmanage.common.entity.vo.DetailssAmountVO
;
import
com.yeejoin.equipmanage.common.enums.BillContentEnum
;
import
com.yeejoin.equipmanage.common.enums.BillContentEnum
;
import
com.yeejoin.equipmanage.common.enums.FileTypeEnum
;
import
com.yeejoin.equipmanage.common.enums.FileTypeEnum
;
import
com.yeejoin.equipmanage.common.vo.EquipmentDate
;
import
com.yeejoin.equipmanage.common.vo.EquipmentPar
;
import
com.yeejoin.equipmanage.mapper.*
;
import
com.yeejoin.equipmanage.mapper.*
;
import
com.yeejoin.equipmanage.service.*
;
import
com.yeejoin.equipmanage.service.*
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.typroject.tyboot.core.foundation.utils.Bean
;
import
org.typroject.tyboot.core.foundation.utils.Bean
;
...
@@ -80,11 +76,8 @@ public class EquipmentDetailServiceImpl extends ServiceImpl<EquipmentDetailMappe
...
@@ -80,11 +76,8 @@ public class EquipmentDetailServiceImpl extends ServiceImpl<EquipmentDetailMappe
@Override
@Override
public
EquipmentDetail
saveOne
(
EquipmentDetail
equipmentDetail
)
{
public
EquipmentDetail
saveOne
(
EquipmentDetail
equipmentDetail
)
{
// EquipmentCategory byId = equipmentCategoryService.getById(equipmentDetail.getCode());
// equipmentDetail.setCode(byId.getCode());
equipmentDetail
.
setEquipmentId
(
equipmentDetail
.
getEquipmentId
());
equipmentDetail
.
setEquipmentId
(
equipmentDetail
.
getEquipmentId
());
this
.
save
(
equipmentDetail
);
this
.
save
(
equipmentDetail
);
saveFile
(
equipmentDetail
);
return
equipmentDetail
;
return
equipmentDetail
;
}
}
...
@@ -120,8 +113,6 @@ public class EquipmentDetailServiceImpl extends ServiceImpl<EquipmentDetailMappe
...
@@ -120,8 +113,6 @@ public class EquipmentDetailServiceImpl extends ServiceImpl<EquipmentDetailMappe
Map
<
String
,
Object
>
map2
=
new
HashMap
<>();
Map
<
String
,
Object
>
map2
=
new
HashMap
<>();
map2
.
put
(
"code"
,
equipmentDetail
.
getCode
());
map2
.
put
(
"code"
,
equipmentDetail
.
getCode
());
EquipmentCategory
equipmentCategory
=
equipmentCategoryMapper
.
selectByMap
(
map2
).
get
(
0
);
EquipmentCategory
equipmentCategory
=
equipmentCategoryMapper
.
selectByMap
(
map2
).
get
(
0
);
// equipmentDetail.setCountry(equipmentCategory.getId());
// EquipmentCategory equipmentCategory = equipmentCategoryMapper.selectById(equipment.getCategoryId());
equipment
.
setEquipmentCategory
(
equipmentCategory
);
equipment
.
setEquipmentCategory
(
equipmentCategory
);
Unit
unit
=
iUnitService
.
getById
(
equipment
.
getUnitId
());
Unit
unit
=
iUnitService
.
getById
(
equipment
.
getUnitId
());
equipment
.
setUnit
(
unit
);
equipment
.
setUnit
(
unit
);
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-jcs-biz/pom.xml
View file @
4cdd66c8
...
@@ -44,7 +44,7 @@
...
@@ -44,7 +44,7 @@
<dependency>
<dependency>
<groupId>
e-iceblue
</groupId>
<groupId>
e-iceblue
</groupId>
<artifactId>
spire.doc
</artifactId>
<artifactId>
spire.doc
</artifactId>
<version>
4.9.0
</version>
<version>
5.1.9
</version>
</dependency>
</dependency>
<dependency>
<dependency>
<groupId>
com.amosframework.boot
</groupId>
<groupId>
com.amosframework.boot
</groupId>
...
@@ -53,5 +53,4 @@
...
@@ -53,5 +53,4 @@
<scope>
compile
</scope>
<scope>
compile
</scope>
</dependency>
</dependency>
</dependencies>
</dependencies>
</project>
</project>
amos-boot-module/amos-boot-module-biz/amos-boot-module-latentdanger-biz/pom.xml
View file @
4cdd66c8
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<modelVersion>
4.0.0
</modelVersion>
<modelVersion>
4.0.0
</modelVersion>
<parent>
<parent>
<artifactId>
amos-boot-module-biz
</artifactId>
<artifactId>
amos-boot-module-biz
</artifactId>
...
@@ -78,7 +78,7 @@
...
@@ -78,7 +78,7 @@
<dependency>
<dependency>
<groupId>
org.apache.poi
</groupId>
<groupId>
org.apache.poi
</groupId>
<artifactId>
poi-scratchpad
</artifactId>
<artifactId>
poi-scratchpad
</artifactId>
<version>
4.0.0
</version>
<version>
3.15
</version>
</dependency>
</dependency>
<dependency>
<dependency>
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-latentdanger-biz/src/main/java/com/yeejoin/amos/latentdanger/business/util/FileHelper.java
View file @
4cdd66c8
...
@@ -312,7 +312,7 @@ public class FileHelper {
...
@@ -312,7 +312,7 @@ public class FileHelper {
buffer
.
append
(
"<meta name=\"keywords\" content=\"\"/>"
);
buffer
.
append
(
"<meta name=\"keywords\" content=\"\"/>"
);
buffer
.
append
(
"<meta name=\"description\" content=\"\"/>"
);
buffer
.
append
(
"<meta name=\"description\" content=\"\"/>"
);
buffer
.
append
(
buffer
.
append
(
"<style type=\"text/css\">body{width:100%;height:auto;position:relative;}img{max-width:100%;height:auto;margin:0 auto;}</style>"
);
"<style type=\"text/css\">body{width:100%;height:auto;position:relative;}img{max-width:100%;height:auto;margin:0 auto;}</style>"
);
buffer
.
append
(
"</head>"
);
buffer
.
append
(
"</head>"
);
buffer
.
append
(
"<body>"
);
buffer
.
append
(
"<body>"
);
...
@@ -331,14 +331,14 @@ public class FileHelper {
...
@@ -331,14 +331,14 @@ public class FileHelper {
buffer
.
append
(
"<!DOCTYPE html><html><head>"
);
buffer
.
append
(
"<!DOCTYPE html><html><head>"
);
buffer
.
append
(
"<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\"/>"
);
buffer
.
append
(
"<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\"/>"
);
buffer
.
append
(
buffer
.
append
(
"<meta name=\"viewport\" content=\"width=device-width,minimum-scale=1,maximum-scale=1,user-scalable=no,minimal-ui\"/>"
);
"<meta name=\"viewport\" content=\"width=device-width,minimum-scale=1,maximum-scale=1,user-scalable=no,minimal-ui\"/>"
);
buffer
.
append
(
"<meta name=\"format-detection\" content=\"telephone=no\"/>"
);
buffer
.
append
(
"<meta name=\"format-detection\" content=\"telephone=no\"/>"
);
buffer
.
append
(
"<meta http-equiv=\"Access-Control-Allow-Origin\" content=\"*\"/>"
);
buffer
.
append
(
"<meta http-equiv=\"Access-Control-Allow-Origin\" content=\"*\"/>"
);
buffer
.
append
(
"<title>touch</title>"
);
buffer
.
append
(
"<title>touch</title>"
);
buffer
.
append
(
"<meta name=\"keywords\" content=\"\"/>"
);
buffer
.
append
(
"<meta name=\"keywords\" content=\"\"/>"
);
buffer
.
append
(
"<meta name=\"description\" content=\"\"/>"
);
buffer
.
append
(
"<meta name=\"description\" content=\"\"/>"
);
buffer
.
append
(
buffer
.
append
(
"<style type=\"text/css\">body{width:100%;height:auto;position:relative;}img{max-width:100%;height:auto;margin:0 auto;}</style>"
);
"<style type=\"text/css\">body{width:100%;height:auto;position:relative;}img{max-width:100%;height:auto;margin:0 auto;}</style>"
);
buffer
.
append
(
"</head>"
);
buffer
.
append
(
"</head>"
);
buffer
.
append
(
"<body>"
);
buffer
.
append
(
"<body>"
);
...
@@ -355,7 +355,7 @@ public class FileHelper {
...
@@ -355,7 +355,7 @@ public class FileHelper {
StringBuffer
buffer
=
new
StringBuffer
();
StringBuffer
buffer
=
new
StringBuffer
();
buffer
.
append
(
buffer
.
append
(
"<html><head><meta http-equiv=\"Access-Control-Allow-Origin\" content=\"*\"></head><body><div align=\"left\">"
);
"<html><head><meta http-equiv=\"Access-Control-Allow-Origin\" content=\"*\"></head><body><div align=\"left\">"
);
buffer
.
append
(
"<p>"
+
content
+
"</p>"
);
buffer
.
append
(
"<p>"
+
content
+
"</p>"
);
buffer
.
append
(
"</div></body></html>"
);
buffer
.
append
(
"</div></body></html>"
);
// System.out.println(buffer.toString());
// System.out.println(buffer.toString());
...
@@ -470,7 +470,7 @@ public class FileHelper {
...
@@ -470,7 +470,7 @@ public class FileHelper {
* metas = children.getElementsByTag("meta"); for(Element meta : metas) { meta.remove(); } }
* metas = children.getElementsByTag("meta"); for(Element meta : metas) { meta.remove(); } }
*/
*/
head
.
appendElement
(
"meta"
).
attr
(
"name"
,
"viewport"
).
attr
(
"content"
,
head
.
appendElement
(
"meta"
).
attr
(
"name"
,
"viewport"
).
attr
(
"content"
,
"width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no"
);
"width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no"
);
// 获取html节点
// 获取html节点
Element
element
=
doc
.
body
();
Element
element
=
doc
.
body
();
...
@@ -537,7 +537,7 @@ public class FileHelper {
...
@@ -537,7 +537,7 @@ public class FileHelper {
}
else
{
}
else
{
try
{
try
{
String
endTag
=
String
endTag
=
content
.
substring
(
content
.
length
()
-
tagName
.
length
()
-
3
,
content
.
length
());
content
.
substring
(
content
.
length
()
-
tagName
.
length
()
-
3
,
content
.
length
());
if
(!(
"</"
+
tagName
+
">"
).
equals
(
endTag
))
{
if
(!(
"</"
+
tagName
+
">"
).
equals
(
endTag
))
{
element
.
text
(
""
);
element
.
text
(
""
);
}
}
...
@@ -743,13 +743,13 @@ public class FileHelper {
...
@@ -743,13 +743,13 @@ public class FileHelper {
// 复制文件
// 复制文件
if
(
files
[
i
].
isFile
())
{
if
(
files
[
i
].
isFile
())
{
flag
=
FileHelper
.
copyFile
(
files
[
i
].
getAbsolutePath
(),
destDirName
+
files
[
i
].
getName
(),
flag
=
FileHelper
.
copyFile
(
files
[
i
].
getAbsolutePath
(),
destDirName
+
files
[
i
].
getName
(),
overlay
);
overlay
);
if
(!
flag
)
{
if
(!
flag
)
{
break
;
break
;
}
}
}
else
if
(
files
[
i
].
isDirectory
())
{
}
else
if
(
files
[
i
].
isDirectory
())
{
flag
=
FileHelper
.
copyDirectory
(
files
[
i
].
getAbsolutePath
(),
flag
=
FileHelper
.
copyDirectory
(
files
[
i
].
getAbsolutePath
(),
destDirName
+
files
[
i
].
getName
(),
overlay
);
destDirName
+
files
[
i
].
getName
(),
overlay
);
if
(!
flag
)
{
if
(!
flag
)
{
break
;
break
;
}
}
...
@@ -873,409 +873,409 @@ public class FileHelper {
...
@@ -873,409 +873,409 @@ public class FileHelper {
public
static
void
exportExcel
(
List
<?>
list
,
String
title
,
String
sheetName
,
Class
<?>
pojoClass
,
String
fileName
,
boolean
isCreateHeader
,
HttpServletResponse
response
){
public
static
void
exportExcel
(
List
<?>
list
,
String
title
,
String
sheetName
,
Class
<?>
pojoClass
,
String
fileName
,
boolean
isCreateHeader
,
HttpServletResponse
response
){
ExportParams
exportParams
=
new
ExportParams
(
title
,
sheetName
);
ExportParams
exportParams
=
new
ExportParams
(
title
,
sheetName
);
exportParams
.
setCreateHeadRows
(
isCreateHeader
);
exportParams
.
setCreateHeadRows
(
isCreateHeader
);
defaultExport
(
list
,
pojoClass
,
fileName
,
response
,
exportParams
);
defaultExport
(
list
,
pojoClass
,
fileName
,
response
,
exportParams
);
}
}
public
static
void
exportExcel
(
List
<?>
list
,
String
title
,
String
sheetName
,
Class
<?>
pojoClass
,
String
fileName
,
HttpServletResponse
response
){
public
static
void
exportExcel
(
List
<?>
list
,
String
title
,
String
sheetName
,
Class
<?>
pojoClass
,
String
fileName
,
HttpServletResponse
response
){
defaultExport
(
list
,
pojoClass
,
fileName
,
response
,
new
ExportParams
(
title
,
sheetName
));
defaultExport
(
list
,
pojoClass
,
fileName
,
response
,
new
ExportParams
(
title
,
sheetName
));
}
}
public
static
void
exportExcel
(
List
<
Map
<
String
,
Object
>>
list
,
String
fileName
,
HttpServletResponse
response
){
public
static
void
exportExcel
(
List
<
Map
<
String
,
Object
>>
list
,
String
fileName
,
HttpServletResponse
response
){
defaultExport
(
list
,
fileName
,
response
);
defaultExport
(
list
,
fileName
,
response
);
}
}
private
static
void
defaultExport
(
List
<?>
list
,
Class
<?>
pojoClass
,
String
fileName
,
HttpServletResponse
response
,
ExportParams
exportParams
)
{
private
static
void
defaultExport
(
List
<?>
list
,
Class
<?>
pojoClass
,
String
fileName
,
HttpServletResponse
response
,
ExportParams
exportParams
)
{
Workbook
workbook
=
ExcelExportUtil
.
exportExcel
(
exportParams
,
pojoClass
,
list
);
Workbook
workbook
=
ExcelExportUtil
.
exportExcel
(
exportParams
,
pojoClass
,
list
);
if
(
workbook
!=
null
);
if
(
workbook
!=
null
);
downLoadExcel
(
fileName
,
response
,
workbook
);
downLoadExcel
(
fileName
,
response
,
workbook
);
}
}
private
static
void
downLoadExcel
(
String
fileName
,
HttpServletResponse
response
,
Workbook
workbook
)
{
private
static
void
downLoadExcel
(
String
fileName
,
HttpServletResponse
response
,
Workbook
workbook
)
{
try
{
try
{
String
name
=
new
String
(
fileName
.
getBytes
(
"UTF-8"
),
"ISO8859_1"
);
String
name
=
new
String
(
fileName
.
getBytes
(
"UTF-8"
),
"ISO8859_1"
);
response
.
setHeader
(
"content-Type"
,
"application/vnd.ms-excel"
);
response
.
setHeader
(
"content-Type"
,
"application/vnd.ms-excel"
);
response
.
setHeader
(
"Content-Disposition"
,
response
.
setHeader
(
"Content-Disposition"
,
"attachment;filename="
+
name
);
"attachment;filename="
+
name
);
workbook
.
write
(
response
.
getOutputStream
());
workbook
.
write
(
response
.
getOutputStream
());
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
throw
new
YeeException
(
e
.
getMessage
());
throw
new
YeeException
(
e
.
getMessage
());
}
}
}
}
private
static
void
defaultExport
(
List
<
Map
<
String
,
Object
>>
list
,
String
fileName
,
HttpServletResponse
response
)
{
private
static
void
defaultExport
(
List
<
Map
<
String
,
Object
>>
list
,
String
fileName
,
HttpServletResponse
response
)
{
Workbook
workbook
=
ExcelExportUtil
.
exportExcel
(
list
,
ExcelType
.
HSSF
);
Workbook
workbook
=
ExcelExportUtil
.
exportExcel
(
list
,
ExcelType
.
HSSF
);
if
(
workbook
!=
null
);
if
(
workbook
!=
null
);
downLoadExcel
(
fileName
,
response
,
workbook
);
downLoadExcel
(
fileName
,
response
,
workbook
);
}
}
public
static
<
T
>
List
<
T
>
importExcel
(
String
filePath
,
Integer
titleRows
,
Integer
headerRows
,
Class
<
T
>
pojoClass
){
public
static
<
T
>
List
<
T
>
importExcel
(
String
filePath
,
Integer
titleRows
,
Integer
headerRows
,
Class
<
T
>
pojoClass
){
if
(
ObjectUtils
.
isEmpty
(
filePath
)){
if
(
ObjectUtils
.
isEmpty
(
filePath
)){
return
null
;
return
null
;
}
}
ImportParams
params
=
new
ImportParams
();
ImportParams
params
=
new
ImportParams
();
params
.
setTitleRows
(
titleRows
);
params
.
setTitleRows
(
titleRows
);
params
.
setHeadRows
(
headerRows
);
params
.
setHeadRows
(
headerRows
);
List
<
T
>
list
=
null
;
List
<
T
>
list
=
null
;
try
{
try
{
list
=
ExcelImportUtil
.
importExcel
(
new
File
(
filePath
),
pojoClass
,
params
);
list
=
ExcelImportUtil
.
importExcel
(
new
File
(
filePath
),
pojoClass
,
params
);
}
catch
(
NoSuchElementException
e
){
}
catch
(
NoSuchElementException
e
){
throw
new
YeeException
(
"模板不能为空"
);
throw
new
YeeException
(
"模板不能为空"
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
throw
new
YeeException
(
e
.
getMessage
());
throw
new
YeeException
(
e
.
getMessage
());
}
}
return
list
;
return
list
;
}
}
public
static
<
T
>
List
<
T
>
importExcel
(
MultipartFile
file
,
Integer
titleRows
,
Integer
headerRows
,
Class
<
T
>
pojoClass
){
public
static
<
T
>
List
<
T
>
importExcel
(
MultipartFile
file
,
Integer
titleRows
,
Integer
headerRows
,
Class
<
T
>
pojoClass
){
if
(
file
==
null
){
if
(
file
==
null
){
return
null
;
return
null
;
}
ImportParams
params
=
new
ImportParams
();
params
.
setTitleRows
(
titleRows
);
params
.
setHeadRows
(
headerRows
);
List
<
T
>
list
=
null
;
try
{
list
=
ExcelImportUtil
.
importExcel
(
file
.
getInputStream
(),
pojoClass
,
params
);
}
catch
(
NoSuchElementException
e
){
throw
new
YeeException
(
"excel文件不能为空"
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
throw
new
YeeException
(
e
.
getMessage
());
}
return
list
;
}
public
static
void
exportZip
(
List
<
Map
<
String
,
Object
>>
list
,
String
fileName
,
HttpServletResponse
response
)
{
try
{
response
.
setContentType
(
"multipart/form-data"
);
response
.
setHeader
(
"Content-Disposition"
,
"attachment;fileName="
+
URLEncoder
.
encode
(
fileName
,
"UTF-8"
));
}
catch
(
UnsupportedEncodingException
e
)
{
throw
new
YeeException
(
"下载文件名编码时出现错误."
);
}
OutputStream
outputStream
=
null
;
ZipOutputStream
zos
=
null
;
try
{
outputStream
=
response
.
getOutputStream
();
zos
=
new
ZipOutputStream
(
outputStream
);
downloadZip
(
fileName
.
replace
(
".zip"
,
""
),
zos
,
list
);
}
catch
(
IOException
e
)
{
throw
new
YeeException
(
"下载文件名编码时出现错误."
);
}
finally
{
if
(
zos
!=
null
)
{
try
{
zos
.
close
();
}
catch
(
Exception
e2
)
{
throw
new
YeeException
(
"下载文件名编码时出现错误."
);
}
}
}
ImportParams
params
=
new
ImportParams
();
if
(
outputStream
!=
null
)
{
params
.
setTitleRows
(
titleRows
);
try
{
params
.
setHeadRows
(
headerRows
);
outputStream
.
close
();
List
<
T
>
list
=
null
;
}
catch
(
Exception
e2
)
{
try
{
throw
new
YeeException
(
"下载文件名编码时出现错误."
);
list
=
ExcelImportUtil
.
importExcel
(
file
.
getInputStream
(),
pojoClass
,
params
);
}
}
catch
(
NoSuchElementException
e
){
throw
new
YeeException
(
"excel文件不能为空"
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
throw
new
YeeException
(
e
.
getMessage
());
}
}
return
list
;
}
}
}
public
static
void
exportZip
(
List
<
Map
<
String
,
Object
>>
list
,
String
fileName
,
HttpServletResponse
response
)
{
public
static
void
downloadZip
(
String
baseDir
,
ZipOutputStream
zos
,
List
<
Map
<
String
,
Object
>>
list
)
{
try
{
for
(
Map
<
String
,
Object
>
map
:
list
)
{
response
.
setContentType
(
"multipart/form-data"
);
String
checkId
=
map
.
get
(
"id"
).
toString
();
response
.
setHeader
(
"Content-Disposition"
,
"attachment;fileName="
+
URLEncoder
.
encode
(
fileName
,
"UTF-8"
));
//文件名称(带后缀)
}
catch
(
UnsupportedEncodingException
e
)
{
String
fileName
=
map
.
get
(
"photoData"
).
toString
();
throw
new
YeeException
(
"下载文件名编码时出现错误."
);
InputStream
is
=
null
;
}
BufferedInputStream
in
=
null
;
OutputStream
outputStream
=
null
;
byte
[]
buffer
=
new
byte
[
1024
];
ZipOutputStream
zos
=
null
;
int
len
;
try
{
//创建zip实体(一个文件对应一个ZipEntry)
outputStream
=
response
.
getOutputStream
();
ZipEntry
entry
=
new
ZipEntry
(
baseDir
+
fileName
.
substring
(
fileName
.
lastIndexOf
(
'/'
),
fileName
.
length
()));
zos
=
new
ZipOutputStream
(
outputStream
);
try
{
downloadZip
(
fileName
.
replace
(
".zip"
,
""
),
zos
,
list
);
//获取需要下载的文件流
}
catch
(
IOException
e
)
{
URL
url
=
new
URL
(
fileName
);
throw
new
YeeException
(
"下载文件名编码时出现错误."
);
HttpURLConnection
conn
=
(
HttpURLConnection
)
url
.
openConnection
();
}
finally
{
//下载
if
(
zos
!=
null
)
{
is
=
conn
.
getInputStream
();
try
{
zos
.
close
();
}
catch
(
Exception
e2
)
{
throw
new
YeeException
(
"下载文件名编码时出现错误."
);
}
}
if
(
outputStream
!=
null
)
{
try
{
outputStream
.
close
();
}
catch
(
Exception
e2
)
{
throw
new
YeeException
(
"下载文件名编码时出现错误."
);
}
}
}
}
public
static
void
downloadZip
(
String
baseDir
,
ZipOutputStream
zos
,
List
<
Map
<
String
,
Object
>>
list
)
{
for
(
Map
<
String
,
Object
>
map
:
list
)
{
String
checkId
=
map
.
get
(
"id"
).
toString
();
//文件名称(带后缀)
String
fileName
=
map
.
get
(
"photoData"
).
toString
();
InputStream
is
=
null
;
BufferedInputStream
in
=
null
;
byte
[]
buffer
=
new
byte
[
1024
];
int
len
;
//创建zip实体(一个文件对应一个ZipEntry)
ZipEntry
entry
=
new
ZipEntry
(
baseDir
+
fileName
.
substring
(
fileName
.
lastIndexOf
(
'/'
),
fileName
.
length
()));
try
{
//获取需要下载的文件流
URL
url
=
new
URL
(
fileName
);
HttpURLConnection
conn
=
(
HttpURLConnection
)
url
.
openConnection
();
//下载
is
=
conn
.
getInputStream
();
// File file = new File(fileName);
// File file = new File(fileName);
// is = new FileInputStream(file);
// is = new FileInputStream(file);
in
=
new
BufferedInputStream
(
is
);
in
=
new
BufferedInputStream
(
is
);
zos
.
putNextEntry
(
entry
);
zos
.
putNextEntry
(
entry
);
//文件流循环写入ZipOutputStream
//文件流循环写入ZipOutputStream
while
((
len
=
in
.
read
(
buffer
))
!=
-
1
)
{
while
((
len
=
in
.
read
(
buffer
))
!=
-
1
)
{
zos
.
write
(
buffer
,
0
,
len
);
zos
.
write
(
buffer
,
0
,
len
);
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
finally
{
if
(
entry
!=
null
)
{
try
{
zos
.
closeEntry
();
}
catch
(
Exception
e2
)
{
}
}
if
(
in
!=
null
)
{
try
{
in
.
close
();
}
catch
(
Exception
e2
)
{
}
}
if
(
is
!=
null
)
{
try
{
is
.
close
();
}
catch
(
Exception
e
)
{
}
}
}
}
}
/**
* @Title: createExcelTemplate
* @Description: 生成Excel导入模板
* @param @param filePath Excel文件路径
* @param @param handers Excel列标题(数组)
* @param @param downData 下拉框数据(数组)
* @param @param downRows 下拉列的序号(数组,序号从0开始)
* @return void
* @throws
*/
public
static
void
createExcelTemplate
(
String
fileName
,
String
[]
handers
,
List
<
String
[]>
downData
,
String
[]
downRows
,
HttpServletResponse
response
){
HSSFWorkbook
wb
=
new
HSSFWorkbook
();
//创建工作薄
//表头样式
HSSFCellStyle
style
=
wb
.
createCellStyle
();
style
.
setAlignment
(
HSSFCellStyle
.
ALIGN_CENTER
);
// 创建一个居中格式
//字体样式
HSSFFont
fontStyle
=
wb
.
createFont
();
fontStyle
.
setFontName
(
"微软雅黑"
);
fontStyle
.
setFontHeightInPoints
((
short
)
12
);
fontStyle
.
setBoldweight
(
HSSFFont
.
BOLDWEIGHT_BOLD
);
style
.
setFont
(
fontStyle
);
//新建sheet
HSSFSheet
sheet1
=
wb
.
createSheet
(
"Sheet1"
);
HSSFSheet
sheet2
=
wb
.
createSheet
(
"Sheet2"
);
HSSFSheet
sheet3
=
wb
.
createSheet
(
"Sheet3"
);
//生成sheet1内容
HSSFRow
rowFirst
=
sheet1
.
createRow
(
0
);
//第一个sheet的第一行为标题
//写标题
for
(
int
i
=
0
;
i
<
handers
.
length
;
i
++){
HSSFCell
cell
=
rowFirst
.
createCell
(
i
);
//获取第一行的每个单元格
sheet1
.
setColumnWidth
(
i
,
4000
);
//设置每列的列宽
cell
.
setCellStyle
(
style
);
//加样式
cell
.
setCellValue
(
handers
[
i
]);
//往单元格里写数据
}
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
finally
{
if
(
entry
!=
null
)
{
try
{
zos
.
closeEntry
();
}
catch
(
Exception
e2
)
{
//设置下拉框数据
}
String
[]
arr
=
{
"A"
,
"B"
,
"C"
,
"D"
,
"E"
,
"F"
,
"G"
,
"H"
,
"I"
,
"J"
,
"K"
,
"L"
,
"M"
,
"N"
,
"O"
,
"P"
,
"Q"
,
"R"
,
"S"
,
"T"
,
"U"
,
"V"
,
"W"
,
"X"
,
"Y"
,
"Z"
};
}
int
index
=
0
;
if
(
in
!=
null
)
{
HSSFRow
row
=
null
;
try
{
for
(
int
r
=
0
;
r
<
downRows
.
length
;
r
++){
in
.
close
();
String
[]
dlData
=
downData
.
get
(
r
);
//获取下拉对象
}
catch
(
Exception
e2
)
{
int
rownum
=
Integer
.
parseInt
(
downRows
[
r
]);
if
(
dlData
==
null
){
}
continue
;
}
}
if
(
is
!=
null
)
{
if
(
dlData
.
length
<
5
){
//255以内的下拉
try
{
//255以内的下拉,参数分别是:作用的sheet、下拉内容数组、起始行、终止行、起始列、终止列
is
.
close
();
sheet1
.
addValidationData
(
setDataValidation
(
sheet1
,
dlData
,
1
,
30000
,
rownum
,
rownum
));
//超过255个报错
}
catch
(
Exception
e
)
{
}
else
{
//255以上的下拉,即下拉列表元素很多的情况
}
//1、设置有效性
//String strFormula = "Sheet2!$A$1:$A$5000" ; //Sheet2第A1到A5000作为下拉列表来源数据
String
strFormula
=
"Sheet2!$"
+
arr
[
index
]+
"$1:$"
+
arr
[
index
]+
"$5000"
;
//Sheet2第A1到A5000作为下拉列表来源数据
sheet2
.
setColumnWidth
(
r
,
4000
);
//设置每列的列宽
//设置数据有效性加载在哪个单元格上,参数分别是:从sheet2获取A1到A5000作为一个下拉的数据、起始行、终止行、起始列、终止列
sheet1
.
addValidationData
(
SetDataValidation
(
strFormula
,
1
,
30000
,
rownum
,
rownum
));
//下拉列表元素很多的情况
//2、生成sheet2内容
for
(
int
j
=
0
;
j
<
dlData
.
length
;
j
++){
if
(
index
==
0
){
//第1个下拉选项,直接创建行、列
row
=
sheet2
.
createRow
(
j
);
//创建数据行
sheet2
.
setColumnWidth
(
j
,
4000
);
//设置每列的列宽
row
.
createCell
(
0
).
setCellValue
(
dlData
[
j
]);
//设置对应单元格的值
}
else
{
//非第1个下拉选项
int
rowCount
=
sheet2
.
getLastRowNum
();
//System.out.println("========== LastRowNum =========" + rowCount);
if
(
j
<=
rowCount
){
//前面创建过的行,直接获取行,创建列
//获取行,创建列
sheet2
.
getRow
(
j
).
createCell
(
index
).
setCellValue
(
dlData
[
j
]);
//设置对应单元格的值
}
else
{
//未创建过的行,直接创建行、创建列
sheet2
.
setColumnWidth
(
j
,
4000
);
//设置每列的列宽
//创建行、创建列
sheet2
.
createRow
(
j
).
createCell
(
index
).
setCellValue
(
dlData
[
j
]);
//设置对应单元格的值
}
}
}
index
++;
}
}
}
downLoadExcel
(
fileName
,
response
,
wb
);
}
}
}
/**
}
*
* @Title: SetDataValidation
* @Description: 下拉列表元素很多的情况 (255以上的下拉)
* @param @param strFormula
* @param @param firstRow 起始行
* @param @param endRow 终止行
* @param @param firstCol 起始列
* @param @param endCol 终止列
* @param @return
* @return HSSFDataValidation
* @throws
*/
private
static
HSSFDataValidation
SetDataValidation
(
String
strFormula
,
int
firstRow
,
int
endRow
,
int
firstCol
,
int
endCol
)
{
// 设置数据有效性加载在哪个单元格上。四个参数分别是:起始行、终止行、起始列、终止列
/**
CellRangeAddressList
regions
=
new
CellRangeAddressList
(
firstRow
,
endRow
,
firstCol
,
endCol
);
* @Title: createExcelTemplate
DVConstraint
constraint
=
DVConstraint
.
createFormulaListConstraint
(
strFormula
);
* @Description: 生成Excel导入模板
HSSFDataValidation
dataValidation
=
new
HSSFDataValidation
(
regions
,
constraint
);
* @param @param filePath Excel文件路径
* @param @param handers Excel列标题(数组)
* @param @param downData 下拉框数据(数组)
* @param @param downRows 下拉列的序号(数组,序号从0开始)
* @return void
* @throws
*/
public
static
void
createExcelTemplate
(
String
fileName
,
String
[]
handers
,
List
<
String
[]>
downData
,
String
[]
downRows
,
HttpServletResponse
response
){
HSSFWorkbook
wb
=
new
HSSFWorkbook
();
//创建工作薄
//表头样式
HSSFCellStyle
style
=
wb
.
createCellStyle
();
style
.
setAlignment
(
HSSFCellStyle
.
ALIGN_CENTER
);
// 创建一个居中格式
//字体样式
HSSFFont
fontStyle
=
wb
.
createFont
();
fontStyle
.
setFontName
(
"微软雅黑"
);
fontStyle
.
setFontHeightInPoints
((
short
)
12
);
fontStyle
.
setBoldweight
(
HSSFFont
.
BOLDWEIGHT_BOLD
);
style
.
setFont
(
fontStyle
);
//新建sheet
HSSFSheet
sheet1
=
wb
.
createSheet
(
"Sheet1"
);
HSSFSheet
sheet2
=
wb
.
createSheet
(
"Sheet2"
);
HSSFSheet
sheet3
=
wb
.
createSheet
(
"Sheet3"
);
//生成sheet1内容
HSSFRow
rowFirst
=
sheet1
.
createRow
(
0
);
//第一个sheet的第一行为标题
//写标题
for
(
int
i
=
0
;
i
<
handers
.
length
;
i
++){
HSSFCell
cell
=
rowFirst
.
createCell
(
i
);
//获取第一行的每个单元格
sheet1
.
setColumnWidth
(
i
,
4000
);
//设置每列的列宽
cell
.
setCellStyle
(
style
);
//加样式
cell
.
setCellValue
(
handers
[
i
]);
//往单元格里写数据
}
dataValidation
.
createErrorBox
(
"Error"
,
"Error"
);
//设置下拉框数据
dataValidation
.
createPromptBox
(
""
,
null
);
String
[]
arr
=
{
"A"
,
"B"
,
"C"
,
"D"
,
"E"
,
"F"
,
"G"
,
"H"
,
"I"
,
"J"
,
"K"
,
"L"
,
"M"
,
"N"
,
"O"
,
"P"
,
"Q"
,
"R"
,
"S"
,
"T"
,
"U"
,
"V"
,
"W"
,
"X"
,
"Y"
,
"Z"
};
int
index
=
0
;
HSSFRow
row
=
null
;
for
(
int
r
=
0
;
r
<
downRows
.
length
;
r
++){
String
[]
dlData
=
downData
.
get
(
r
);
//获取下拉对象
int
rownum
=
Integer
.
parseInt
(
downRows
[
r
]);
return
dataValidation
;
if
(
dlData
==
null
){
continue
;
}
if
(
dlData
.
length
<
5
){
//255以内的下拉
//255以内的下拉,参数分别是:作用的sheet、下拉内容数组、起始行、终止行、起始列、终止列
sheet1
.
addValidationData
(
setDataValidation
(
sheet1
,
dlData
,
1
,
30000
,
rownum
,
rownum
));
//超过255个报错
}
else
{
//255以上的下拉,即下拉列表元素很多的情况
//1、设置有效性
//String strFormula = "Sheet2!$A$1:$A$5000" ; //Sheet2第A1到A5000作为下拉列表来源数据
String
strFormula
=
"Sheet2!$"
+
arr
[
index
]+
"$1:$"
+
arr
[
index
]+
"$5000"
;
//Sheet2第A1到A5000作为下拉列表来源数据
sheet2
.
setColumnWidth
(
r
,
4000
);
//设置每列的列宽
//设置数据有效性加载在哪个单元格上,参数分别是:从sheet2获取A1到A5000作为一个下拉的数据、起始行、终止行、起始列、终止列
sheet1
.
addValidationData
(
SetDataValidation
(
strFormula
,
1
,
30000
,
rownum
,
rownum
));
//下拉列表元素很多的情况
//2、生成sheet2内容
for
(
int
j
=
0
;
j
<
dlData
.
length
;
j
++){
if
(
index
==
0
){
//第1个下拉选项,直接创建行、列
row
=
sheet2
.
createRow
(
j
);
//创建数据行
sheet2
.
setColumnWidth
(
j
,
4000
);
//设置每列的列宽
row
.
createCell
(
0
).
setCellValue
(
dlData
[
j
]);
//设置对应单元格的值
}
else
{
//非第1个下拉选项
int
rowCount
=
sheet2
.
getLastRowNum
();
//System.out.println("========== LastRowNum =========" + rowCount);
if
(
j
<=
rowCount
){
//前面创建过的行,直接获取行,创建列
//获取行,创建列
sheet2
.
getRow
(
j
).
createCell
(
index
).
setCellValue
(
dlData
[
j
]);
//设置对应单元格的值
}
else
{
//未创建过的行,直接创建行、创建列
sheet2
.
setColumnWidth
(
j
,
4000
);
//设置每列的列宽
//创建行、创建列
sheet2
.
createRow
(
j
).
createCell
(
index
).
setCellValue
(
dlData
[
j
]);
//设置对应单元格的值
}
}
}
index
++;
}
}
}
downLoadExcel
(
fileName
,
response
,
wb
);
}
/**
*
* @Title: SetDataValidation
* @Description: 下拉列表元素很多的情况 (255以上的下拉)
* @param @param strFormula
* @param @param firstRow 起始行
* @param @param endRow 终止行
* @param @param firstCol 起始列
* @param @param endCol 终止列
* @param @return
* @return HSSFDataValidation
* @throws
*/
private
static
HSSFDataValidation
SetDataValidation
(
String
strFormula
,
int
firstRow
,
int
endRow
,
int
firstCol
,
int
endCol
)
{
/**
// 设置数据有效性加载在哪个单元格上。四个参数分别是:起始行、终止行、起始列、终止列
*
CellRangeAddressList
regions
=
new
CellRangeAddressList
(
firstRow
,
endRow
,
firstCol
,
endCol
);
* @Title: setDataValidation
DVConstraint
constraint
=
DVConstraint
.
createFormulaListConstraint
(
strFormula
);
* @Description: 下拉列表元素不多的情况(255以内的下拉)
HSSFDataValidation
dataValidation
=
new
HSSFDataValidation
(
regions
,
constraint
);
* @param @param sheet
* @param @param textList
* @param @param firstRow
* @param @param endRow
* @param @param firstCol
* @param @param endCol
* @param @return
* @return DataValidation
* @throws
*/
private
static
DataValidation
setDataValidation
(
Sheet
sheet
,
String
[]
textList
,
int
firstRow
,
int
endRow
,
int
firstCol
,
int
endCol
)
{
DataValidationHelper
helper
=
sheet
.
getDataValidationHelper
();
dataValidation
.
createErrorBox
(
"Error"
,
"Error"
);
//加载下拉列表内容
dataValidation
.
createPromptBox
(
""
,
null
);
DataValidationConstraint
constraint
=
helper
.
createExplicitListConstraint
(
textList
);
//DVConstraint constraint = new DVConstraint();
constraint
.
setExplicitListValues
(
textList
);
//设置数据有效性加载在哪个单元格上。四个参数分别是:起始行、终止行、起始列、终止列
return
dataValidation
;
CellRangeAddressList
regions
=
new
CellRangeAddressList
((
short
)
firstRow
,
(
short
)
endRow
,
(
short
)
firstCol
,
(
short
)
endCol
);
}
//数据有效性对象
DataValidation
data_validation
=
helper
.
createValidation
(
constraint
,
regions
);
//DataValidation data_validation = new DataValidation(regions, constraint);
return
data_validation
;
/**
}
*
* @Title: setDataValidation
* @Description: 下拉列表元素不多的情况(255以内的下拉)
* @param @param sheet
* @param @param textList
* @param @param firstRow
* @param @param endRow
* @param @param firstCol
* @param @param endCol
* @param @return
* @return DataValidation
* @throws
*/
private
static
DataValidation
setDataValidation
(
Sheet
sheet
,
String
[]
textList
,
int
firstRow
,
int
endRow
,
int
firstCol
,
int
endCol
)
{
/**
DataValidationHelper
helper
=
sheet
.
getDataValidationHelper
();
* @Title: getExcel
//加载下拉列表内容
* @Description: 下载指定路径的Excel文件
DataValidationConstraint
constraint
=
helper
.
createExplicitListConstraint
(
textList
);
* @param @param url 文件路径
//DVConstraint constraint = new DVConstraint();
* @param @param fileName 文件名
constraint
.
setExplicitListValues
(
textList
);
* @param @param response
* @return void
//设置数据有效性加载在哪个单元格上。四个参数分别是:起始行、终止行、起始列、终止列
* @throws
CellRangeAddressList
regions
=
new
CellRangeAddressList
((
short
)
firstRow
,
(
short
)
endRow
,
(
short
)
firstCol
,
(
short
)
endCol
);
*/
public
static
void
getExcel
(
String
url
,
String
fileName
,
HttpServletResponse
response
,
HttpServletRequest
request
){
//数据有效性对象
DataValidation
data_validation
=
helper
.
createValidation
(
constraint
,
regions
);
//DataValidation data_validation = new DataValidation(regions, constraint);
return
data_validation
;
}
/**
* @Title: getExcel
* @Description: 下载指定路径的Excel文件
* @param @param url 文件路径
* @param @param fileName 文件名
* @param @param response
* @return void
* @throws
*/
public
static
void
getExcel
(
String
url
,
String
fileName
,
HttpServletResponse
response
,
HttpServletRequest
request
){
try
{
try
{
//1.设置文件ContentType类型,这样设置,会自动判断下载文件类型
//1.设置文件ContentType类型,这样设置,会自动判断下载文件类型
response
.
setContentType
(
"multipart/form-data"
);
response
.
setContentType
(
"multipart/form-data"
);
//2.设置文件头:最后一个参数是设置下载文件名
//2.设置文件头:最后一个参数是设置下载文件名
response
.
setHeader
(
"Content-disposition"
,
"attachment; filename=\""
response
.
setHeader
(
"Content-disposition"
,
"attachment; filename=\""
+
encodeChineseDownloadFileName
(
request
,
fileName
+
".xls"
)
+
"\""
);
+
encodeChineseDownloadFileName
(
request
,
fileName
+
".xls"
)
+
"\""
);
// response.setHeader("Content-Disposition", "attachment;filename="
// response.setHeader("Content-Disposition", "attachment;filename="
// + new String(fileName.getBytes("UTF-8"), "ISO-8859-1") + ".xls"); //中文文件名
// + new String(fileName.getBytes("UTF-8"), "ISO-8859-1") + ".xls"); //中文文件名
//通过文件路径获得File对象
//通过文件路径获得File对象
File
file
=
new
File
(
url
);
File
file
=
new
File
(
url
);
FileInputStream
in
=
new
FileInputStream
(
file
);
FileInputStream
in
=
new
FileInputStream
(
file
);
//3.通过response获取OutputStream对象(out)
//3.通过response获取OutputStream对象(out)
OutputStream
out
=
new
BufferedOutputStream
(
response
.
getOutputStream
());
OutputStream
out
=
new
BufferedOutputStream
(
response
.
getOutputStream
());
int
b
=
0
;
int
b
=
0
;
byte
[]
buffer
=
new
byte
[
2048
];
byte
[]
buffer
=
new
byte
[
2048
];
while
((
b
=
in
.
read
(
buffer
))
!=
-
1
){
while
((
b
=
in
.
read
(
buffer
))
!=
-
1
){
out
.
write
(
buffer
,
0
,
b
);
//4.写到输出流(out)中
out
.
write
(
buffer
,
0
,
b
);
//4.写到输出流(out)中
}
}
in
.
close
();
in
.
close
();
out
.
flush
();
out
.
flush
();
out
.
close
();
out
.
close
();
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
log
.
error
(
"下载Excel模板异常"
,
e
);
log
.
error
(
"下载Excel模板异常"
,
e
);
}
}
}
}
/**
/**
*
*
* @Title: encodeChineseDownloadFileName
* @Title: encodeChineseDownloadFileName
* @Description: TODO(这里用一句话描述这个方法的作用)
* @Description: TODO(这里用一句话描述这个方法的作用)
* @param @param request
* @param @param request
* @param @param pFileName
* @param @param pFileName
* @param @return
* @param @return
* @param @throws UnsupportedEncodingException
* @param @throws UnsupportedEncodingException
* @return String
* @return String
* @throws
* @throws
*/
*/
private
static
String
encodeChineseDownloadFileName
(
HttpServletRequest
request
,
String
pFileName
)
private
static
String
encodeChineseDownloadFileName
(
HttpServletRequest
request
,
String
pFileName
)
throws
UnsupportedEncodingException
{
throws
UnsupportedEncodingException
{
String
filename
=
null
;
String
filename
=
null
;
String
agent
=
request
.
getHeader
(
"USER-AGENT"
);
String
agent
=
request
.
getHeader
(
"USER-AGENT"
);
//System.out.println("agent==========》"+agent);
//System.out.println("agent==========》"+agent);
if
(
null
!=
agent
)
{
if
(
null
!=
agent
)
{
if
(-
1
!=
agent
.
indexOf
(
"Firefox"
))
{
//Firefox
if
(-
1
!=
agent
.
indexOf
(
"Firefox"
))
{
//Firefox
filename
=
"=?UTF-8?B?"
+
(
new
String
(
org
.
apache
.
commons
.
codec
.
binary
.
Base64
.
encodeBase64
(
pFileName
.
getBytes
(
"UTF-8"
))))
+
"?="
;
filename
=
"=?UTF-8?B?"
+
(
new
String
(
org
.
apache
.
commons
.
codec
.
binary
.
Base64
.
encodeBase64
(
pFileName
.
getBytes
(
"UTF-8"
))))
+
"?="
;
}
else
if
(-
1
!=
agent
.
indexOf
(
"Chrome"
))
{
//Chrome
}
else
if
(-
1
!=
agent
.
indexOf
(
"Chrome"
))
{
//Chrome
filename
=
new
String
(
pFileName
.
getBytes
(),
"ISO8859-1"
);
filename
=
new
String
(
pFileName
.
getBytes
(),
"ISO8859-1"
);
}
else
{
//IE7+
}
else
{
//IE7+
filename
=
java
.
net
.
URLEncoder
.
encode
(
pFileName
,
"UTF-8"
);
filename
=
java
.
net
.
URLEncoder
.
encode
(
pFileName
,
"UTF-8"
);
filename
=
StringUtils
.
replace
(
filename
,
"+"
,
"%20"
);
//替换空格
filename
=
StringUtils
.
replace
(
filename
,
"+"
,
"%20"
);
//替换空格
}
}
}
else
{
}
else
{
filename
=
pFileName
;
filename
=
pFileName
;
}
return
filename
;
}
}
/**
return
filename
;
* @Title: delFile
}
* @Description: 删除文件
* @param @param filePath 文件路径
/**
* @return void
* @Title: delFile
* @throws
* @Description: 删除文件
*/
* @param @param filePath 文件路径
public
static
void
delFile
(
String
filePath
)
{
* @return void
java
.
io
.
File
delFile
=
new
java
.
io
.
File
(
filePath
);
* @throws
delFile
.
delete
();
*/
}
public
static
void
delFile
(
String
filePath
)
{
java
.
io
.
File
delFile
=
new
java
.
io
.
File
(
filePath
);
delFile
.
delete
();
}
}
}
amos-boot-system-equip/src/main/resources/mapper/EquipmentDetailMapper.xml
View file @
4cdd66c8
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.yeejoin.equipmanage.mapper.EquipmentDetailMapper"
>
<mapper
namespace=
"com.yeejoin.equipmanage.mapper.EquipmentDetailMapper"
>
<resultMap
id=
"EquipmentDateMap"
type=
"com.yeejoin.equipmanage.common.vo.EquipmentDate"
>
<resultMap
id=
"DetailssAmountList"
type=
"com.yeejoin.equipmanage.common.entity.vo.DetailssAmountVO"
>
<association
property=
"equipmentDetail"
javaType=
"com.yeejoin.equipmanage.common.entity.EquipmentDetail"
>
<result
column=
"id"
property=
"id"
></result>
<result
column=
"name"
property=
"name"
/>
<result
column=
"standard"
property=
"standard"
></result>
<result
column=
"eq_code"
property=
"eqcode"
/>
<result
column=
"brand"
property=
"brand"
></result>
<result
column=
"remark"
property=
"remark"
/>
<result
column=
"name"
property=
"name"
></result>
<result
column=
"manufacturer_cycle"
property=
"manufacturerCycle"
/>
<result
column=
"area"
property=
"area"
></result>
<result
column=
"standard"
property=
"standard"
/>
<result
property=
"type"
column=
"type"
></result>
<result
column=
"brand"
property=
"brand"
/>
<result
column=
"remark"
property=
"remark"
></result>
<result
column=
"join_date"
property=
"joinDate"
/>
<result
column=
"eq_code"
property=
"eqcode"
></result>
<result
column=
"open_date"
property=
"openDate"
/>
<result
column=
"maintenance_cycle"
property=
"maintenanceCycle"
></result>
<result
column=
"area"
property=
"area"
/>
<result
column=
"join_date"
property=
"joinDate"
></result>
<result
column=
"equipment_id"
property=
"equipmentId"
/>
<result
column=
"open_date"
property=
"openDate"
></result>
<result
column=
"equipment_name"
property=
"equipmentName"
/>
<result
column=
"reason"
property=
"reason"
></result>
</association>
<result
column=
"STATUS"
property=
"status"
></result>
<association
property=
"equipmentParams"
javaType=
"com.yeejoin.equipmanage.common.entity.EquipmentParams"
>
<result
column=
"measure"
property=
"measure"
></result>
<result
column=
"status"
property=
"status"
/>
<result
column=
"iot_code"
property=
"iotCode"
></result>
<result
column=
"reason"
property=
"reason"
/>
<result
column=
"equipment_id"
property=
"equipmentId"
/>
<result
column=
"measure"
property=
"measure"
/>
<result
column=
"equipment_name"
property=
"equipmentName"
/>
</association>
<association
property=
"equipmentSpecific"
javaType=
"com.yeejoin.equipmanage.common.entity.EquipmentSpecific"
>
<result
column=
"iot_code"
property=
"iotCode"
/>
</association>
</resultMap>
</resultMap>
<select
id=
"page"
<select
id=
"page"
resultType=
"com.yeejoin.equipmanage.common.entity.EquipmentDetail"
>
resultType=
"com.yeejoin.equipmanage.common.entity.EquipmentDetail"
>
SELECT
SELECT
...
@@ -137,7 +134,7 @@
...
@@ -137,7 +134,7 @@
LIMIT #{offset},#{size}
LIMIT #{offset},#{size}
</select>
</select>
<select
id=
"getall"
resultMap=
"
EquipmentDateMap
"
>
<select
id=
"getall"
resultMap=
"
DetailssAmountList
"
>
SELECT
SELECT
wles.id,
wles.id,
wled.standard,
wled.standard,
...
...
amos-boot-system-equip/src/main/resources/mapper/FireFightingSystemMapper.xml
View file @
4cdd66c8
...
@@ -7,7 +7,6 @@
...
@@ -7,7 +7,6 @@
<result
property=
"code"
column=
"code"
></result>
<result
property=
"code"
column=
"code"
></result>
<result
property=
"categoryName"
column=
"category_name"
></result>
<result
property=
"categoryName"
column=
"category_name"
></result>
</resultMap>
</resultMap>
<resultMap
id=
"EquipCountBySystemId"
type=
"com.yeejoin.equipmanage.common.entity.vo.EquipCountBySystemVO"
>
<resultMap
id=
"EquipCountBySystemId"
type=
"com.yeejoin.equipmanage.common.entity.vo.EquipCountBySystemVO"
>
<result
property=
"equipmentId"
column=
"equipment_id"
></result>
<result
property=
"equipmentId"
column=
"equipment_id"
></result>
<result
property=
"equipmentName"
column=
"equipment_name"
></result>
<result
property=
"equipmentName"
column=
"equipment_name"
></result>
...
@@ -48,7 +47,7 @@
...
@@ -48,7 +47,7 @@
<result
column=
"reason"
property=
"reason"
></result>
<result
column=
"reason"
property=
"reason"
></result>
<result
column=
"STATUS"
property=
"status"
></result>
<result
column=
"STATUS"
property=
"status"
></result>
<result
column=
"measure"
property=
"measure"
></result>
<result
column=
"measure"
property=
"measure"
></result>
<result
property=
"iotCode"
column
=
"iotCode"
></result>
<result
column=
"iot_code"
property
=
"iotCode"
></result>
</resultMap>
</resultMap>
<select
id=
"getEquiplistBySystemId"
resultMap=
"EquiplistBySystemId"
>
<select
id=
"getEquiplistBySystemId"
resultMap=
"EquiplistBySystemId"
>
SELECT
SELECT
...
...
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