@ -147,11 +147,11 @@ public class VoucherController {
private ContractLService contractLService ;
/ * *
* 列 表
*
* @param voucherPagination
* @return
* /
* 列 表
*
* @param voucherPagination
* @return
* /
@Operation ( summary = "获取列表" )
@PostMapping ( "/getList" )
public ActionResult list ( @RequestBody VoucherPagination voucherPagination ) throws IOException {
@ -167,13 +167,13 @@ public class VoucherController {
entity . setPlaceDispatch ( placeDispatchs . stream ( ) . collect ( Collectors . joining ( "," ) ) ) ;
entity . setDestination ( destinations . stream ( ) . collect ( Collectors . joining ( "," ) ) ) ;
Map < String , Object > voucherMap = JsonUtil . entityToMap ( entity ) ;
voucherMap . put ( "id" , voucherMap . get ( "id" ) ) ;
//副表数据
//子表数据
List < VoucherProductEntity > voucherProductList = voucherService . getVoucherProductList ( entity . getId ( ) , voucherPagination ) ;
voucherMap . put ( "voucherProductList" , JsonUtil . getJsonToList ( JsonUtil . getListToJsonArray ( voucherProductList ) ) ) ;
List < VoucherVehicleEntity > voucherVehicleList = voucherService . getVoucherVehicleList ( entity . getId ( ) , voucherPagination ) ;
voucherMap . put ( "voucherVehicleList" , JsonUtil . getJsonToList ( JsonUtil . getListToJsonArray ( voucherVehicleList ) ) ) ;
voucherMap . put ( "id" , voucherMap . get ( "id" ) ) ;
//副表数据
//子表数据
List < VoucherProductEntity > voucherProductList = voucherService . getVoucherProductList ( entity . getId ( ) , voucherPagination ) ;
voucherMap . put ( "voucherProductList" , JsonUtil . getJsonToList ( JsonUtil . getListToJsonArray ( voucherProductList ) ) ) ;
List < VoucherVehicleEntity > voucherVehicleList = voucherService . getVoucherVehicleList ( entity . getId ( ) , voucherPagination ) ;
voucherMap . put ( "voucherVehicleList" , JsonUtil . getJsonToList ( JsonUtil . getListToJsonArray ( voucherVehicleList ) ) ) ;
realList . add ( voucherMap ) ;
}
//数据转换
@ -207,11 +207,11 @@ public class VoucherController {
return ActionResult . success ( vo ) ;
}
/ * *
* 创 建
*
* @param voucherForm
* @return
* /
* 创 建
*
* @param voucherForm
* @return
* /
@PostMapping ( )
@Operation ( summary = "创建" )
public ActionResult create ( @RequestBody @Valid VoucherForm voucherForm ) {
@ -220,7 +220,7 @@ public class VoucherController {
return ActionResult . fail ( b ) ;
}
if ( StringUtils . isNotEmpty ( voucherForm . getBusinessType ( ) ) & & voucherForm . getBusinessType ( ) . equals ( "1" ) & &
StringUtils . isNotEmpty ( voucherForm . getDocumentType ( ) ) & & voucherForm . getDocumentType ( ) . equals ( "1" ) ) {
StringUtils . isNotEmpty ( voucherForm . getDocumentType ( ) ) & & voucherForm . getDocumentType ( ) . equals ( "1" ) ) {
UserInfo userInfo = userProvider . get ( ) ;
OrganizeEntity organizeEntity = organizeService . getInfo ( userInfo . getOrganizeId ( ) ) ;
List < String > organizeJsonId = Arrays . stream ( organizeEntity . getCompanyIdTree ( ) . split ( "," ) ) . collect ( Collectors . toList ( ) ) ;
@ -245,10 +245,10 @@ public class VoucherController {
return ActionResult . success ( "创建成功" ) ;
}
/ * *
* 导 出 Excel
*
* @return
* /
* 导 出 Excel
*
* @return
* /
@Operation ( summary = "导出Excel" )
@PostMapping ( "/Actions/Export" )
public ActionResult Export ( @RequestBody VoucherPagination voucherPagination ) throws IOException {
@ -258,27 +258,27 @@ public class VoucherController {
List < VoucherEntity > list = voucherService . getList ( voucherPagination ) ;
List < Map < String , Object > > realList = new ArrayList < > ( ) ;
for ( VoucherEntity entity : list ) {
Map < String , Object > voucherMap = JsonUtil . entityToMap ( entity ) ;
voucherMap . put ( "id" , voucherMap . get ( "id" ) ) ;
//副表数据
//子表数据
List < VoucherProductEntity > voucherProductList = voucherService . getVoucherProductList ( entity . getId ( ) , voucherPagination ) ;
voucherMap . put ( "tableField111" , JsonUtil . getJsonToList ( JsonUtil . getListToJsonArray ( voucherProductList ) ) ) ;
List < VoucherVehicleEntity > voucherVehicleList = voucherService . getVoucherVehicleList ( entity . getId ( ) , voucherPagination ) ;
voucherMap . put ( "tableField140" , JsonUtil . getJsonToList ( JsonUtil . getListToJsonArray ( voucherVehicleList ) ) ) ;
Map < String , Object > voucherMap = JsonUtil . entityToMap ( entity ) ;
voucherMap . put ( "id" , voucherMap . get ( "id" ) ) ;
//副表数据
//子表数据
List < VoucherProductEntity > voucherProductList = voucherService . getVoucherProductList ( entity . getId ( ) , voucherPagination ) ;
voucherMap . put ( "tableField111" , JsonUtil . getJsonToList ( JsonUtil . getListToJsonArray ( voucherProductList ) ) ) ;
List < VoucherVehicleEntity > voucherVehicleList = voucherService . getVoucherVehicleList ( entity . getId ( ) , voucherPagination ) ;
voucherMap . put ( "tableField140" , JsonUtil . getJsonToList ( JsonUtil . getListToJsonArray ( voucherVehicleList ) ) ) ;
realList . add ( voucherMap ) ;
}
//数据转换
realList = generaterSwapUtil . swapDataList ( realList , VoucherConstant . getFormData ( ) , VoucherConstant . getColumnData ( ) , voucherPagination . getModuleId ( ) , false ) ;
String [ ] keys = ! StringUtil . isEmpty ( voucherPagination . getSelectKey ( ) ) ? voucherPagination . getSelectKey ( ) : new String [ 0 ] ;
UserInfo userInfo = userProvider . get ( ) ;
DownloadVO vo = this . creatModelExcel ( configValueUtil . getTemporaryFilePath ( ) , realList , keys , userInfo ) ;
DownloadVO vo = this . creatModelExcel ( configValueUtil . getTemporaryFilePath ( ) , realList , keys , userInfo ) ;
return ActionResult . success ( vo ) ;
}
/ * *
* 导 出 表 格 方 法
* /
* 导 出 表 格 方 法
* /
public DownloadVO creatModelExcel ( String path , List < Map < String , Object > > list , String [ ] keys , UserInfo userInfo ) {
DownloadVO vo = DownloadVO . builder ( ) . build ( ) ;
List < ExcelExportEntity > entitys = new ArrayList < > ( ) ;
@ -290,130 +290,130 @@ public class VoucherController {
for ( String key : keys ) {
switch ( key ) {
case "voucherCode" :
entitys . add ( new ExcelExportEntity ( "凭证编号" , "voucherCode" ) ) ;
break ;
entitys . add ( new ExcelExportEntity ( "凭证编号" , "voucherCode" ) ) ;
break ;
case "voucherType" :
entitys . add ( new ExcelExportEntity ( "凭证类型" , "voucherType" ) ) ;
break ;
entitys . add ( new ExcelExportEntity ( "凭证类型" , "voucherType" ) ) ;
break ;
case "preparationTime" :
entitys . add ( new ExcelExportEntity ( "制单时间" , "preparationTime" ) ) ;
break ;
entitys . add ( new ExcelExportEntity ( "制单时间" , "preparationTime" ) ) ;
break ;
case "associateThirdSuppliers" :
entitys . add ( new ExcelExportEntity ( "三级供应商" , "associateThirdSuppliers" ) ) ;
break ;
entitys . add ( new ExcelExportEntity ( "三级供应商" , "associateThirdSuppliers" ) ) ;
break ;
case "voucherPictures" :
entitys . add ( new ExcelExportEntity ( "凭证图片" , "voucherPictures" ) ) ;
break ;
entitys . add ( new ExcelExportEntity ( "凭证图片" , "voucherPictures" ) ) ;
break ;
case "poundCode" :
entitys . add ( new ExcelExportEntity ( "磅单编号" , "poundCode" ) ) ;
break ;
entitys . add ( new ExcelExportEntity ( "磅单编号" , "poundCode" ) ) ;
break ;
case "vehicleName" :
entitys . add ( new ExcelExportEntity ( "车牌号" , "vehicleName" ) ) ;
break ;
entitys . add ( new ExcelExportEntity ( "车牌号" , "vehicleName" ) ) ;
break ;
case "supplierName" :
entitys . add ( new ExcelExportEntity ( "发货单位" , "supplierName" ) ) ;
break ;
entitys . add ( new ExcelExportEntity ( "发货单位" , "supplierName" ) ) ;
break ;
case "customerName" :
entitys . add ( new ExcelExportEntity ( "收货单位" , "customerName" ) ) ;
break ;
entitys . add ( new ExcelExportEntity ( "收货单位" , "customerName" ) ) ;
break ;
case "modeTransport" :
entitys . add ( new ExcelExportEntity ( "运输方式" , "modeTransport" ) ) ;
break ;
entitys . add ( new ExcelExportEntity ( "运输方式" , "modeTransport" ) ) ;
break ;
case "transportationMethod" :
entitys . add ( new ExcelExportEntity ( "承运方式" , "transportationMethod" ) ) ;
break ;
entitys . add ( new ExcelExportEntity ( "承运方式" , "transportationMethod" ) ) ;
break ;
case "carrier" :
entitys . add ( new ExcelExportEntity ( "承运商" , "carrier" ) ) ;
break ;
entitys . add ( new ExcelExportEntity ( "承运商" , "carrier" ) ) ;
break ;
case "placeDispatch" :
entitys . add ( new ExcelExportEntity ( "起运地" , "placeDispatch" ) ) ;
break ;
entitys . add ( new ExcelExportEntity ( "起运地" , "placeDispatch" ) ) ;
break ;
case "destination" :
entitys . add ( new ExcelExportEntity ( "到达地" , "destination" ) ) ;
break ;
entitys . add ( new ExcelExportEntity ( "到达地" , "destination" ) ) ;
break ;
case "freight" :
entitys . add ( new ExcelExportEntity ( "运费" , "freight" ) ) ;
break ;
entitys . add ( new ExcelExportEntity ( "运费" , "freight" ) ) ;
break ;
case "vehiclePictures" :
entitys . add ( new ExcelExportEntity ( "车辆信息" , "vehiclePictures" ) ) ;
break ;
entitys . add ( new ExcelExportEntity ( "车辆信息" , "vehiclePictures" ) ) ;
break ;
case "vehiclePictures1" :
entitys . add ( new ExcelExportEntity ( "车辆45度图片" , "vehiclePictures1" ) ) ;
break ;
entitys . add ( new ExcelExportEntity ( "车辆45度图片" , "vehiclePictures1" ) ) ;
break ;
case "vehiclePictures2" :
entitys . add ( new ExcelExportEntity ( "车辆货物图片" , "vehiclePictures2" ) ) ;
break ;
entitys . add ( new ExcelExportEntity ( "车辆货物图片" , "vehiclePictures2" ) ) ;
break ;
case "driverPictures" :
entitys . add ( new ExcelExportEntity ( "驾驶员信息" , "driverPictures" ) ) ;
break ;
entitys . add ( new ExcelExportEntity ( "驾驶员信息" , "driverPictures" ) ) ;
break ;
case "driverPictures1" :
entitys . add ( new ExcelExportEntity ( "驾驶员信息行驶证图片" , "driverPictures1" ) ) ;
break ;
entitys . add ( new ExcelExportEntity ( "驾驶员信息行驶证图片" , "driverPictures1" ) ) ;
break ;
case "driverPictures2" :
entitys . add ( new ExcelExportEntity ( "驾驶员信息身份证图片" , "driverPictures2" ) ) ;
break ;
entitys . add ( new ExcelExportEntity ( "驾驶员信息身份证图片" , "driverPictures2" ) ) ;
break ;
case "weighPictures" :
entitys . add ( new ExcelExportEntity ( "过磅信息正面图片" , "weighPictures" ) ) ;
break ;
entitys . add ( new ExcelExportEntity ( "过磅信息正面图片" , "weighPictures" ) ) ;
break ;
case "weighPictures1" :
entitys . add ( new ExcelExportEntity ( "过磅信息后面图片" , "weighPictures1" ) ) ;
break ;
entitys . add ( new ExcelExportEntity ( "过磅信息后面图片" , "weighPictures1" ) ) ;
break ;
case "weighPictures2" :
entitys . add ( new ExcelExportEntity ( "过磅信息过磅图片" , "weighPictures2" ) ) ;
break ;
entitys . add ( new ExcelExportEntity ( "过磅信息过磅图片" , "weighPictures2" ) ) ;
break ;
case "weighPictures3" :
entitys . add ( new ExcelExportEntity ( "过磅信息货物图片" , "weighPictures3" ) ) ;
break ;
entitys . add ( new ExcelExportEntity ( "过磅信息货物图片" , "weighPictures3" ) ) ;
break ;
case "voucherStatus" :
entitys . add ( new ExcelExportEntity ( "凭证状态" , "voucherStatus" ) ) ;
break ;
entitys . add ( new ExcelExportEntity ( "凭证状态" , "voucherStatus" ) ) ;
break ;
case "documentType" :
entitys . add ( new ExcelExportEntity ( "单据类型" , "documentType" ) ) ;
break ;
entitys . add ( new ExcelExportEntity ( "单据类型" , "documentType" ) ) ;
break ;
case "associatedDocumentNo" :
entitys . add ( new ExcelExportEntity ( "关联单据号" , "associatedDocumentNo" ) ) ;
break ;
entitys . add ( new ExcelExportEntity ( "关联单据号" , "associatedDocumentNo" ) ) ;
break ;
case "tableField111-productId" :
tableField111List . add ( new ExcelExportEntity ( "商品名称" , "productId" ) ) ;
break ;
tableField111List . add ( new ExcelExportEntity ( "商品名称" , "productId" ) ) ;
break ;
case "tableField111-spec" :
tableField111List . add ( new ExcelExportEntity ( "规格" , "spec" ) ) ;
break ;
tableField111List . add ( new ExcelExportEntity ( "规格" , "spec" ) ) ;
break ;
case "tableField111-unit" :
tableField111List . add ( new ExcelExportEntity ( "单位" , "unit" ) ) ;
break ;
tableField111List . add ( new ExcelExportEntity ( "单位" , "unit" ) ) ;
break ;
case "tableField111-grossWeight" :
tableField111List . add ( new ExcelExportEntity ( "毛重" , "grossWeight" ) ) ;
break ;
tableField111List . add ( new ExcelExportEntity ( "毛重" , "grossWeight" ) ) ;
break ;
case "tableField111-tareWeight" :
tableField111List . add ( new ExcelExportEntity ( "皮重" , "tareWeight" ) ) ;
break ;
tableField111List . add ( new ExcelExportEntity ( "皮重" , "tareWeight" ) ) ;
break ;
case "tableField111-buckleWeight" :
tableField111List . add ( new ExcelExportEntity ( "扣重" , "buckleWeight" ) ) ;
break ;
tableField111List . add ( new ExcelExportEntity ( "扣重" , "buckleWeight" ) ) ;
break ;
case "tableField111-netWeight" :
tableField111List . add ( new ExcelExportEntity ( "净重" , "netWeight" ) ) ;
break ;
tableField111List . add ( new ExcelExportEntity ( "净重" , "netWeight" ) ) ;
break ;
case "tableField111-remark" :
tableField111List . add ( new ExcelExportEntity ( "备注" , "remark" ) ) ;
break ;
tableField111List . add ( new ExcelExportEntity ( "备注" , "remark" ) ) ;
break ;
case "tableField111-printTime" :
tableField111List . add ( new ExcelExportEntity ( "打印时间" , "printTime" ) ) ;
break ;
tableField111List . add ( new ExcelExportEntity ( "打印时间" , "printTime" ) ) ;
break ;
case "tableField140-vehicleId" :
tableField140List . add ( new ExcelExportEntity ( "车牌号" , "vehicleId" ) ) ;
break ;
tableField140List . add ( new ExcelExportEntity ( "车牌号" , "vehicleId" ) ) ;
break ;
case "tableField140-driverName" :
tableField140List . add ( new ExcelExportEntity ( "驾驶员名称" , "driverName" ) ) ;
break ;
tableField140List . add ( new ExcelExportEntity ( "驾驶员名称" , "driverName" ) ) ;
break ;
case "tableField140-telephone" :
tableField140List . add ( new ExcelExportEntity ( "联系电话" , "telephone" ) ) ;
break ;
tableField140List . add ( new ExcelExportEntity ( "联系电话" , "telephone" ) ) ;
break ;
case "tableField140-carrier" :
tableField140List . add ( new ExcelExportEntity ( "承运商" , "carrier" ) ) ;
break ;
tableField140List . add ( new ExcelExportEntity ( "承运商" , "carrier" ) ) ;
break ;
default :
break ;
break ;
}
}
if ( tableField111List . size ( ) > 0 ) {
@ -486,53 +486,53 @@ public class VoucherController {
return vo ;
}
/ * *
* 批 量 删 除
* @param ids
* @return
* /
* 批 量 删 除
* @param ids
* @return
* /
@DeleteMapping ( "/batchRemove" )
@Transactional
@Operation ( summary = "批量删除" )
public ActionResult batchRemove ( @RequestBody String ids ) {
List < String > idList = JsonUtil . getJsonToList ( ids , String . class ) ;
List < String > columnIdList = new ArrayList < > ( 20 ) ;
int i = 0 ;
String errInfo = "" ;
for ( String allId : idList ) {
FlowTaskEntity taskEntity = generaterSwapUtil . getInfoSubmit ( allId , FlowTaskEntity : : getId , FlowTaskEntity : : getStatus ) ;
if ( taskEntity = = null ) {
List < String > idList = JsonUtil . getJsonToList ( ids , String . class ) ;
List < String > columnIdList = new ArrayList < > ( 20 ) ;
int i = 0 ;
String errInfo = "" ;
for ( String allId : idList ) {
FlowTaskEntity taskEntity = generaterSwapUtil . getInfoSubmit ( allId , FlowTaskEntity : : getId , FlowTaskEntity : : getStatus ) ;
if ( taskEntity = = null ) {
columnIdList . add ( allId ) ;
this . delete ( allId ) ;
} else if ( taskEntity . getStatus ( ) . equals ( 0 ) | | taskEntity . getStatus ( ) . equals ( 4 ) ) {
try {
generaterSwapUtil . deleteFlowTask ( taskEntity ) ;
columnIdList . add ( allId ) ;
this . delete ( allId ) ;
} else if ( taskEntity . getStatus ( ) . equals ( 0 ) | | taskEntity . getStatus ( ) . equals ( 4 ) ) {
try {
generaterSwapUtil . deleteFlowTask ( taskEntity ) ;
columnIdList . add ( allId ) ;
this . delete ( allId ) ;
i + + ;
} catch ( WorkFlowException e ) {
errInfo = e . getMessage ( ) ;
e . printStackTrace ( ) ;
}
i + + ;
} catch ( WorkFlowException e ) {
errInfo = e . getMessage ( ) ;
e . printStackTrace ( ) ;
}
}
if ( i = = 0 & & columnIdList . size ( ) = = 0 ) {
return ActionResult . fail ( "流程已发起,无法删除" ) ;
}
if ( StringUtil . isNotEmpty ( errInfo ) ) {
return ActionResult . fail ( errInfo ) ;
}
return ActionResult . success ( "删除成功" ) ;
}
if ( i = = 0 & & columnIdList . size ( ) = = 0 ) {
return ActionResult . fail ( "流程已发起,无法删除" ) ;
}
if ( StringUtil . isNotEmpty ( errInfo ) ) {
return ActionResult . fail ( errInfo ) ;
}
return ActionResult . success ( "删除成功" ) ;
}
/ * *
* 编 辑
* @param id
* @param voucherForm
* @return
* /
* 编 辑
* @param id
* @param voucherForm
* @return
* /
@PutMapping ( "/{id}" )
@Operation ( summary = "更新" )
public ActionResult update ( @PathVariable ( "id" ) String id , @RequestBody @Valid VoucherForm voucherForm ,
@RequestParam ( value = "isImport" , required = false ) boolean isImport ) {
@RequestParam ( value = "isImport" , required = false ) boolean isImport ) {
voucherForm . setId ( id ) ;
if ( ! isImport ) {
String b = voucherService . checkForm ( voucherForm , 1 ) ;
@ -568,10 +568,10 @@ public class VoucherController {
}
}
/ * *
* 删 除
* @param id
* @return
* /
* 删 除
* @param id
* @return
* /
@Operation ( summary = "删除" )
@DeleteMapping ( "/{id}" )
@Transactional
@ -593,11 +593,11 @@ public class VoucherController {
return ActionResult . success ( "删除成功" ) ;
}
/ * *
* 表 单 信 息 ( 详 情 页 )
* 详 情 页 面 使 用 - 转 换 数 据
* @param id
* @return
* /
* 表 单 信 息 ( 详 情 页 )
* 详 情 页 面 使 用 - 转 换 数 据
* @param id
* @return
* /
@Operation ( summary = "表单信息(详情页)" )
@GetMapping ( "/detail/{id}" )
public ActionResult detailInfo ( @PathVariable ( "id" ) String id ) {
@ -629,11 +629,11 @@ public class VoucherController {
return ActionResult . success ( voucherMap ) ;
}
/ * *
* 获 取 详 情 ( 编 辑 页 )
* 编 辑 页 面 使 用 - 不 转 换 数 据
* @param id
* @return
* /
* 获 取 详 情 ( 编 辑 页 )
* 编 辑 页 面 使 用 - 不 转 换 数 据
* @param id
* @return
* /
@Operation ( summary = "信息" )
@GetMapping ( "/{id}" )
public ActionResult info ( @PathVariable ( "id" ) String id ) {
@ -1412,91 +1412,14 @@ public class VoucherController {
@Operation ( summary = "模板下载" )
@GetMapping ( "/TemplateDownload" )
public ActionResult < DownloadVO > TemplateDownload ( ) {
DownloadVO vo = DownloadVO . builder ( ) . build ( ) ;
UserInfo userInfo = userProvider . get ( ) ;
Map < String , Object > dataMap = new HashMap < > ( ) ;
//主表对象
List < ExcelExportEntity > entitys = new ArrayList < > ( ) ;
//以下添加字段
entitys . add ( new ExcelExportEntity ( "凭证编号" , "voucherCode" ) ) ;
dataMap . put ( "voucherCode" , "系统自动生成" ) ;
entitys . add ( new ExcelExportEntity ( "凭证类型" , "voucherType" ) ) ;
entitys . add ( new ExcelExportEntity ( "制单时间" , "preparationTime" ) ) ;
dataMap . put ( "preparationTime" , "例: yyyy-MM-dd" ) ;
entitys . add ( new ExcelExportEntity ( "磅单编号" , "poundCode" ) ) ;
entitys . add ( new ExcelExportEntity ( "车牌号" , "vehicleName" ) ) ;
entitys . add ( new ExcelExportEntity ( "发货单位" , "supplierName" ) ) ;
entitys . add ( new ExcelExportEntity ( "收货单位" , "customerName" ) ) ;
entitys . add ( new ExcelExportEntity ( "运输方式" , "modeTransport" ) ) ;
entitys . add ( new ExcelExportEntity ( "承运方式" , "transportationMethod" ) ) ;
entitys . add ( new ExcelExportEntity ( "承运商" , "carrier" ) ) ;
entitys . add ( new ExcelExportEntity ( "起运地" , "placeDispatch" ) ) ;
dataMap . put ( "placeDispatch" , "例:福建省/莆田市/城厢区" ) ;
entitys . add ( new ExcelExportEntity ( "到达地" , "destination" ) ) ;
dataMap . put ( "destination" , "例:福建省/莆田市/城厢区" ) ;
entitys . add ( new ExcelExportEntity ( "运费" , "freight" ) ) ;
entitys . add ( new ExcelExportEntity ( "关联单据号" , "associatedDocumentNo" ) ) ;
entitys . add ( new ExcelExportEntity ( "单据类型" , "documentType" ) ) ;
entitys . add ( new ExcelExportEntity ( "凭证状态" , "voucherStatus" ) ) ;
//tableField111子表对象
ExcelExportEntity tableField111ExcelEntity = new ExcelExportEntity ( "" , "tableField111" ) ;
List < ExcelExportEntity > tableField111ExcelEntityList = new ArrayList < > ( ) ;
Map < String , Object > tableField111ChildData = new HashMap < > ( ) ;
List < Map < String , Object > > tableField111ChildDataList = new ArrayList < > ( ) ;
tableField111ExcelEntityList . add ( new ExcelExportEntity ( "规格" , "spec" ) ) ;
tableField111ExcelEntityList . add ( new ExcelExportEntity ( "单位" , "unit" ) ) ;
tableField111ExcelEntityList . add ( new ExcelExportEntity ( "毛重" , "grossWeight" ) ) ;
tableField111ExcelEntityList . add ( new ExcelExportEntity ( "皮重" , "tareWeight" ) ) ;
tableField111ExcelEntityList . add ( new ExcelExportEntity ( "扣重" , "buckleWeight" ) ) ;
tableField111ExcelEntityList . add ( new ExcelExportEntity ( "净重" , "netWeight" ) ) ;
tableField111ExcelEntityList . add ( new ExcelExportEntity ( "备注" , "remark" ) ) ;
tableField111ExcelEntityList . add ( new ExcelExportEntity ( "打印时间" , "printTime" ) ) ;
tableField111ChildData . put ( "printTime" , "例: yyyy-MM-dd" ) ;
tableField111ChildDataList . add ( tableField111ChildData ) ;
dataMap . put ( "tableField111" , tableField111ChildDataList ) ;
tableField111ExcelEntity . setList ( tableField111ExcelEntityList ) ;
entitys . add ( tableField111ExcelEntity ) ;
//tableField140子表对象
ExcelExportEntity tableField140ExcelEntity = new ExcelExportEntity ( "" , "tableField140" ) ;
List < ExcelExportEntity > tableField140ExcelEntityList = new ArrayList < > ( ) ;
Map < String , Object > tableField140ChildData = new HashMap < > ( ) ;
List < Map < String , Object > > tableField140ChildDataList = new ArrayList < > ( ) ;
tableField140ExcelEntityList . add ( new ExcelExportEntity ( "驾驶员名称" , "driverName" ) ) ;
tableField140ExcelEntityList . add ( new ExcelExportEntity ( "联系电话" , "telephone" ) ) ;
tableField140ExcelEntityList . add ( new ExcelExportEntity ( "承运商" , "carrier" ) ) ;
tableField140ChildDataList . add ( tableField140ChildData ) ;
dataMap . put ( "tableField140" , tableField140ChildDataList ) ;
tableField140ExcelEntity . setList ( tableField140ExcelEntityList ) ;
entitys . add ( tableField140ExcelEntity ) ;
List < Map < String , Object > > list = new ArrayList < > ( ) ;
list . add ( dataMap ) ;
ExportParams exportParams = new ExportParams ( null , "凭证单模板" ) ;
exportParams . setType ( ExcelType . XSSF ) ;
try {
@Cleanup Workbook workbook = new HSSFWorkbook ( ) ;
if ( entitys . size ( ) > 0 ) {
if ( list . size ( ) = = 0 ) {
list . add ( new HashMap < > ( ) ) ;
}
//复杂表头-表头和数据处理
ColumnDataModel columnDataModel = JsonUtil . getJsonToBean ( VoucherConstant . getColumnData ( ) , ColumnDataModel . class ) ;
List < HeaderModel > complexHeaderList = columnDataModel . getComplexHeaderList ( ) ;
if ( ! Objects . equals ( columnDataModel . getType ( ) , 3 ) & & ! Objects . equals ( columnDataModel . getType ( ) , 5 ) ) {
entitys = VisualUtils . complexHeaderHandel ( entitys , complexHeaderList ) ;
list = VisualUtils . complexHeaderDataHandel ( list , complexHeaderList ) ;
}
workbook = ExcelExportUtil . exportExcel ( exportParams , entitys , list ) ;
}
String fileName = "凭证单模板" + DateUtil . dateNow ( "yyyyMMddHHmmss" ) + ".xlsx" ;
MultipartFile multipartFile = ExcelUtil . workbookToCommonsMultipartFile ( workbook , fileName ) ;
String temporaryFilePath = configValueUtil . getTemporaryFilePath ( ) ;
FileInfo fileInfo = FileUploadUtils . uploadFile ( multipartFile , temporaryFilePath , fileName ) ;
vo . setName ( fileInfo . getFilename ( ) ) ;
vo . setUrl ( UploaderUtil . uploaderFile ( fileInfo . getFilename ( ) + "#" + "Temporary" ) + "&name=" + fileName ) ;
UserInfo userInfo = userProvider . get ( ) ;
DownloadVO vo = DownloadVO . builder ( ) . build ( ) ;
try {
vo . setName ( "凭证导入.zip" ) ;
vo . setUrl ( UploaderUtil . uploaderFile ( "/api/file/DownloadModel?encryption=" , userInfo . getId ( ) + "#" + "凭证导入.zip" + "#" + "Temporary" ) ) ;
} catch ( Exception e ) {
log . error ( "模板信息导出Excel错误:{}" , e . getMessage ( ) ) ;
e . printStackTrace ( ) ;
log . error ( "信息导出Excel错误:{}" , e . getMessage ( ) ) ;
}
return ActionResult . success ( vo ) ;
}
@ -1509,14 +1432,14 @@ public class VoucherController {
@Operation ( summary = "导入预览" )
@GetMapping ( "/ImportPreview" )
public ActionResult < Map < String , Object > > ImportPreview ( String fileName ) throws Exception {
fileName = "66441f9464a4bd991e589f74.xls" ;
//fileName = "6645af470365f697b7120ff7.xls";
Map < String , Object > headAndDataMap = new HashMap < > ( 2 ) ;
String filePath = FileUploadUtils . getLocalBasePath ( ) + configValueUtil . getWebAnnexFilePath ( ) ;
FileUploadUtils . downLocal ( configValueUtil . getTemporaryFilePath ( ) , filePath , fileName ) ;
File temporary = new File ( XSSEscape . escapePath ( filePath + fileName ) ) ;
int headerRowIndex = 1 ;
ImportParams params = new ImportParams ( ) ;
params . setTitleRows ( 0 ) ;
params . setTitleRows ( 2 ) ;
params . setHeadRows ( headerRowIndex ) ;
params . setNeedVerify ( true ) ;
try {
@ -1527,7 +1450,7 @@ public class VoucherController {
columns . add ( new ExcelImFieldModel ( "businessType" , "业务类型" ) ) ;
columns . add ( new ExcelImFieldModel ( "documentType" , "单据类型" ) ) ;
columns . add ( new ExcelImFieldModel ( "voucherType" , "凭证类型" ) ) ;
columns . add ( new ExcelImFieldModel ( "receivingDate" , "收货日期" ) ) ;
// columns.add(new ExcelImFieldModel("receivingDate","收货日期"));
columns . add ( new ExcelImFieldModel ( "productName" , "商品名称" ) ) ;
columns . add ( new ExcelImFieldModel ( "vehicleName" , "送货车号" ) ) ;
columns . add ( new ExcelImFieldModel ( "unit" , "单位" ) ) ;
@ -1557,7 +1480,7 @@ public class VoucherController {
columns . add ( new ExcelImFieldModel ( "vehiclePictures10" , "车辆信息10" ) ) ;
columns . add ( new ExcelImFieldModel ( "contractNo" , "合同编码" ) ) ;
//tableField111子表对象
List < ExcelImFieldModel > tableField111columns = new ArrayList < > ( ) ;
/ * List < ExcelImFieldModel > tableField111columns = new ArrayList < > ( ) ;
tableField111columns . add ( new ExcelImFieldModel ( "spec" , "规格" ) ) ;
tableField111columns . add ( new ExcelImFieldModel ( "unit" , "单位" ) ) ;
tableField111columns . add ( new ExcelImFieldModel ( "grossWeight" , "毛重" ) ) ;
@ -1572,7 +1495,7 @@ public class VoucherController {
tableField140columns . add ( new ExcelImFieldModel ( "driverName" , "驾驶员名称" ) ) ;
tableField140columns . add ( new ExcelImFieldModel ( "telephone" , "联系电话" ) ) ;
tableField140columns . add ( new ExcelImFieldModel ( "carrier" , "承运商" ) ) ;
columns . add ( new ExcelImFieldModel ( "tableField140" , "" , tableField140columns ) ) ;
columns . add ( new ExcelImFieldModel ( "tableField140" , "" , tableField140columns ) ) ; * /
headAndDataMap . put ( "dataRow" , JsonUtil . getJsonToList ( JsonUtil . getListToJsonArray ( excelDataList ) ) ) ;
headAndDataMap . put ( "headerRow" , JsonUtil . getJsonToList ( JsonUtil . getListToJsonArray ( columns ) ) ) ;
} catch ( Exception e ) {